Add smart ACK provider for WeChat MP replies

Replace fixed ackText with a rule-based AckProvider that picks
response templates by message type and intent (translate, summary,
rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync,
zero I/O, auto-falls back to config.ackText on any error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
john
2026-06-26 15:19:03 +08:00
parent 9ed4fd48d7
commit 9b4a25799f
162 changed files with 17276 additions and 2054 deletions
+41
View File
@@ -52,6 +52,37 @@ export const POLICY_CATALOG = [
category: 'proxy',
risk: 'medium',
},
{
key: 'code_delegate_executor',
label: '代码委托执行器',
description:
'控制 Goose 在多文件编码、修复与重构任务中优先委托给谁。auto 由 Goose 结合当前可用扩展自行判断;aider / openhands 则优先使用指定执行器。',
type: 'select',
options: [
{ value: 'auto', label: '自动选择 (auto)' },
{ value: 'aider', label: '优先 Aider' },
{ value: 'openhands', label: '优先 OpenHands' },
],
defaultValue: 'auto',
category: 'routing',
risk: 'medium',
},
{
key: 'code_task_routing',
label: '代码任务路由策略',
description:
'定义代码任务如何在 Aider 与 OpenHands 之间分流。balanced 由 Goose 按任务复杂度判断;split 建议小改动走 Aider、复杂任务走 OpenHandsforce_* 则强制优先单一路径。',
type: 'select',
options: [
{ value: 'balanced', label: '平衡路由 (balanced)' },
{ value: 'split', label: '小改动 Aider,复杂任务 OpenHands' },
{ value: 'force_aider', label: '尽量统一走 Aider' },
{ value: 'force_openhands', label: '尽量统一走 OpenHands' },
],
defaultValue: 'balanced',
category: 'routing',
risk: 'medium',
},
];
export const DEFAULT_USER_POLICIES = Object.fromEntries(
@@ -62,6 +93,8 @@ const POLICY_KEYS = new Set(POLICY_CATALOG.map((item) => item.key));
const GOOSE_MODES = new Set(['auto', 'approve', 'smart_approve', 'chat']);
const WORKSPACE_ACCESS = new Set(['readwrite', 'readonly']);
const NETWORK_EGRESS = new Set(['allow', 'deny']);
const CODE_DELEGATE_EXECUTORS = new Set(['auto', 'aider', 'openhands']);
const CODE_TASK_ROUTINGS = new Set(['balanced', 'split', 'force_aider', 'force_openhands']);
export function policyKeys() {
return [...POLICY_KEYS];
@@ -85,6 +118,12 @@ export function normalizePolicyPatch(patch) {
if (def.key === 'goose_mode' && GOOSE_MODES.has(value)) normalized[key] = value;
if (def.key === 'workspace_access' && WORKSPACE_ACCESS.has(value)) normalized[key] = value;
if (def.key === 'network_egress' && NETWORK_EGRESS.has(value)) normalized[key] = value;
if (def.key === 'code_delegate_executor' && CODE_DELEGATE_EXECUTORS.has(value)) {
normalized[key] = value;
}
if (def.key === 'code_task_routing' && CODE_TASK_ROUTINGS.has(value)) {
normalized[key] = value;
}
}
return normalized;
}
@@ -114,6 +153,7 @@ function hasExecutableTools(capabilities) {
|| capabilities?.computer
|| capabilities?.charts
|| capabilities?.aider
|| capabilities?.openhands
|| capabilities?.apps
|| capabilities?.todo
|| capabilities?.skills
@@ -146,6 +186,7 @@ export function applyPoliciesToCapabilities(capabilities, policies) {
effective.filesystem = false;
effective.static_publish = false;
effective.aider = false;
effective.openhands = false;
effective.code_sandbox = false;
effective.image_read = false;
}