2026-06-24 22:58:59 +08:00
|
|
|
const QUERY_CANDIDATE_ACTIONS = new Set(['delete', 'approve', 'reject', 'query'])
|
|
|
|
|
|
|
|
|
|
export function resolveWorkbenchIntentActionRoute(frame = null) {
|
|
|
|
|
if (!frame) {
|
|
|
|
|
return { nextStep: 'pass_through' }
|
|
|
|
|
}
|
|
|
|
|
if (frame.safetyLevel === 'blocked') {
|
|
|
|
|
return { nextStep: 'blocked', reason: '高风险批量动作需要先选择具体单据。' }
|
|
|
|
|
}
|
|
|
|
|
if (frame.action === 'ask_policy') {
|
|
|
|
|
return { nextStep: 'pass_through' }
|
|
|
|
|
}
|
2026-06-25 10:55:49 +08:00
|
|
|
if (frame.policyDecision === 'need_confirmation') {
|
|
|
|
|
return {
|
|
|
|
|
nextStep: 'open_context_confirm',
|
|
|
|
|
riskLevel: frame.riskLevel,
|
|
|
|
|
requiresSelection: Boolean(frame.requiresSelection),
|
|
|
|
|
requiresConfirmation: Boolean(frame.requiresConfirmation)
|
|
|
|
|
}
|
2026-06-24 22:58:59 +08:00
|
|
|
}
|
2026-06-25 10:55:49 +08:00
|
|
|
if (frame.policyDecision === 'query_candidates' && QUERY_CANDIDATE_ACTIONS.has(frame.action)) {
|
2026-06-24 22:58:59 +08:00
|
|
|
return {
|
|
|
|
|
nextStep: 'query_candidates',
|
2026-06-25 10:55:49 +08:00
|
|
|
queryPrompt: frame.normalizedQuery || '',
|
|
|
|
|
riskLevel: frame.riskLevel,
|
|
|
|
|
requiresSelection: Boolean(frame.requiresSelection),
|
|
|
|
|
requiresConfirmation: Boolean(frame.requiresConfirmation)
|
2026-06-24 22:58:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return { nextStep: 'pass_through' }
|
|
|
|
|
}
|