pi-web-ui 0.114.3 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -1
- package/bin/pi-web-ui.mjs +90 -8
- package/dist/gh-comment-781.md +5 -0
- package/dist/server/agent-service-daemon.js +522 -32
- package/dist/server/agent-service.js +954 -402
- package/dist/server/canvas/canvas-dispatch.js +13 -1
- package/dist/server/client-state.js +42 -2
- package/dist/server/communicate-tool.js +2 -0
- package/dist/server/conversation-communication.js +14 -0
- package/dist/server/conversation-identity.js +27 -0
- package/dist/server/device-center/approval-summary.js +31 -0
- package/dist/server/device-center/bot-catalog.js +21 -7
- package/dist/server/device-center/bot-execution.js +100 -9
- package/dist/server/device-center/bot-presets.js +46 -0
- package/dist/server/device-center/collab-service.js +362 -13
- package/dist/server/device-center/collab-tool.js +824 -13
- package/dist/server/device-center/connector.js +359 -23
- package/dist/server/device-center/desktop-page.js +22 -16
- package/dist/server/device-center/device-integration.js +595 -0
- package/dist/server/device-center/execution-guides.js +32 -0
- package/dist/server/device-center/execution-instructions.js +20 -0
- package/dist/server/device-center/execution-settings.js +213 -0
- package/dist/server/device-center/execution-system-prompt.js +38 -0
- package/dist/server/device-center/execution-workspace.js +20 -0
- package/dist/server/device-center/executor.js +392 -40
- package/dist/server/device-center/file-sync-paths.js +171 -0
- package/dist/server/device-center/file-sync.js +186 -96
- package/dist/server/device-center/group-context-delta.js +37 -0
- package/dist/server/device-center/group-context-message.js +210 -0
- package/dist/server/device-center/group-context.js +179 -0
- package/dist/server/device-center/group-events.js +136 -0
- package/dist/server/device-center/group-plan-guard.js +138 -0
- package/dist/server/device-center/hub-conversations.js +233 -0
- package/dist/server/device-center/hub-deliveries.js +277 -0
- package/dist/server/device-center/hub-integration.js +451 -0
- package/dist/server/device-center/hub-locks.js +320 -0
- package/dist/server/device-center/hub-page.js +13 -33
- package/dist/server/device-center/hub-webhooks.js +165 -0
- package/dist/server/device-center/hub.js +2379 -107
- package/dist/server/device-center/human-interaction.js +232 -0
- package/dist/server/device-center/integration-errors.js +25 -0
- package/dist/server/device-center/local-hub.js +20 -1
- package/dist/server/device-center/local-page.js +17 -0
- package/dist/server/device-center/local.js +430 -41
- package/dist/server/device-center/main.js +11 -1
- package/dist/server/device-center/partition-log.js +293 -0
- package/dist/server/device-center/path-portal.js +11 -3
- package/dist/server/device-center/relay.js +364 -35
- package/dist/server/device-center/report-metadata.js +66 -0
- package/dist/server/device-center/report-upload.js +63 -0
- package/dist/server/device-center/runtime.js +598 -41
- package/dist/server/device-center/smoke-preview.js +3 -0
- package/dist/server/device-center/store.js +203 -41
- package/dist/server/device-center/task-context-budget.js +161 -0
- package/dist/server/device-center/task-journal.js +385 -0
- package/dist/server/device-center/task-plan.js +33 -0
- package/dist/server/device-center/task-progress.js +141 -0
- package/dist/server/device-center/task-recovery.js +452 -0
- package/dist/server/device-center/task-report-outbox.js +216 -0
- package/dist/server/device-center/task-report.js +384 -0
- package/dist/server/device-center/task-scheduler.js +445 -0
- package/dist/server/device-center/task-state.js +333 -0
- package/dist/server/device-center/transfer-stream.js +1006 -0
- package/dist/server/device-center/transfers.js +841 -8
- package/dist/server/dispatch-domain-handlers.js +35 -6
- package/dist/server/dsh/dsh-agent-service.js +6 -0
- package/dist/server/durable/durable-capabilities.js +11 -0
- package/dist/server/engine-probe.js +112 -1
- package/dist/server/global-loader.js +119 -19
- package/dist/server/goal-service.js +10 -5
- package/dist/server/index.js +222 -29
- package/dist/server/managed.js +2 -0
- package/dist/server/markers/builtins/services.js +123 -0
- package/dist/server/markers/builtins/todo.js +189 -0
- package/dist/server/markers-list-tool.js +34 -0
- package/dist/server/message-deletion.js +40 -0
- package/dist/server/message-window.js +9 -0
- package/dist/server/model-admin.js +48 -6
- package/dist/server/model-enrich.js +10 -1
- package/dist/server/orchestrator.js +109 -0
- package/dist/server/patch-executable-lookup.js +396 -0
- package/dist/server/payload-limits.js +2 -0
- package/dist/server/plugin-llm.js +100 -9
- package/dist/server/plugins.js +65 -7
- package/dist/server/preset-fields.js +24 -0
- package/dist/server/preset-share.js +2 -0
- package/dist/server/prompt-base-store.js +85 -0
- package/dist/server/prompt-composer.js +44 -2
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/protocol.js +2 -2
- package/dist/server/reasoning-registry.js +207 -0
- package/dist/server/remote-ssh-service.js +22 -9
- package/dist/server/resolve-global-sdk.js +2 -0
- package/dist/server/session-search.js +1 -1
- package/dist/server/settings-service.js +90 -39
- package/dist/server/skill-content-filler.js +29 -8
- package/dist/server/skill-tool.js +12 -3
- package/dist/server/startup-banner.js +35 -0
- package/dist/server/subagent-helpers.js +4 -1
- package/dist/server/subagents.js +52 -37
- package/dist/server/system-prompt-soul.js +41 -0
- package/dist/server/tool-host-factories.js +1 -0
- package/dist/server/tool-manager.js +17 -9
- package/dist/server/unauthorized-page.js +319 -0
- package/dist/server/univer-service.js +448 -0
- package/dist/server/universal/drivers/dsh-driver.js +379 -0
- package/dist/server/universal/universal-session.js +5 -0
- package/dist/server/webui-context.js +25 -5
- package/dist/test-artifact.md +9 -0
- package/dist/test-preview-modal.md +11 -0
- package/dist/test-report.html +20 -0
- package/docs/README.md +94 -0
- package/docs/architecture-plugins.md +946 -0
- package/docs/device-center.md +106 -12
- package/docs/dsh-engine.md +10 -10
- package/extensions/webui.ts +43 -1
- package/package.json +2 -1
- package/themes/aetheris.css +5 -0
- package/themes/ayu-light.css +6 -0
- package/themes/bases/flow-base.css +68 -68
- package/themes/catppuccin-latte.css +6 -0
- package/themes/catppuccin.css +6 -0
- package/themes/claude-code-dark.css +5 -0
- package/themes/codex.css +6 -0
- package/themes/cyberpunk.css +6 -0
- package/themes/dark-teal.css +6 -1
- package/themes/dazzle.css +6 -0
- package/themes/everforest-light.css +6 -0
- package/themes/flow-light.css +8 -1
- package/themes/flow.css +6 -1
- package/themes/geist.css +6 -0
- package/themes/gruvbox-light.css +6 -0
- package/themes/kanagawa-lotus.css +6 -0
- package/themes/md-preview.css +6 -0
- package/themes/mist.css +6 -0
- package/themes/nord.css +6 -0
- package/themes/one-dark.css +6 -0
- package/themes/paper.css +6 -0
- package/themes/rose-pine-dawn.css +6 -0
- package/themes/sakura.css +6 -0
- package/themes/solarized-light.css +6 -0
- package/themes/tokyo-night.css +6 -0
- package/themes/translucent.css +6 -0
- package/themes/transparent.css +6 -0
- package/themes/vs-code-dark.css +5 -0
- package/themes/wallpaper-flow.css +5 -1
- package/themes/wallpaper-obsidian.css +6 -0
- package/themes/white.css +6 -0
- package/themes/zhujian-dark.css +6 -1
- package/themes/zhujian.css +6 -1
- package/themes/zhupi-dark.css +6 -1
- package/themes/zhupi.css +6 -1
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BDoOpj-F.js +1 -0
- package/web/dist/assets/BgTasksModal-C0i3O1FT.js +1 -0
- package/web/dist/assets/{CanvasStudio-BSg9ghPV.js → CanvasStudio-B8thymBN.js} +3 -3
- package/web/dist/assets/{CanvasStudio-DxW7C3Sz.js → CanvasStudio-zSxyIx1R.js} +3 -3
- package/web/dist/assets/DeviceCenter-DfAHKcid.js +3 -0
- package/web/dist/assets/DeviceCenter-ydvOTlzE.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-q5Ik8oXg.js +1 -0
- package/web/dist/assets/DeviceGroups-CI14_SRb.js +1 -0
- package/web/dist/assets/DeviceGroups-DvsB5IEU.js +1 -0
- package/web/dist/assets/Dropdown-C4LIhshN.js +1 -0
- package/web/dist/assets/FilePreview-BgGongmv.js +2 -0
- package/web/dist/assets/FilePreview-D4NrhF-U.js +2 -0
- package/web/dist/assets/GlobalSearchModal-BWgU8yPd.js +1 -0
- package/web/dist/assets/GlobalSearchModal-F7fNimKk.js +1 -0
- package/web/dist/assets/GroupConversation-Dh71Pdb-.js +17 -0
- package/web/dist/assets/GroupConversation-ZK3nRmNm.js +17 -0
- package/web/dist/assets/HintTip-c6d0TJoh.js +1 -0
- package/web/dist/assets/ModelConfigModal-YVEgyy34.js +2 -0
- package/web/dist/assets/ModelConfigModal-vWtg3srp.js +2 -0
- package/web/dist/assets/PiSetupModal-BmMrrgB9.js +1 -0
- package/web/dist/assets/ProviderOAuthControls-BGSBIKD7.js +1 -0
- package/web/dist/assets/SCMPanel-B8_EDxNr.js +2 -0
- package/web/dist/assets/SCMPanel-BU58qk3T.js +2 -0
- package/web/dist/assets/SettingsModal-CMUybq3J.js +32 -0
- package/web/dist/assets/SettingsModal-OBmGTh-5.js +32 -0
- package/web/dist/assets/TerminalPanel-0CYvD72B.js +3 -0
- package/web/dist/assets/TerminalPanel-DDavKvFr.js +3 -0
- package/web/dist/assets/TuiOverlayModal-BsA-QTvN.js +1 -0
- package/web/dist/assets/TuiOverlayModal-DzoVQBuG.js +1 -0
- package/web/dist/assets/app-globals-CZxzGvIo.js +123 -0
- package/web/dist/assets/canvas-client-CUnXlQYX.js +1 -0
- package/web/dist/assets/{desktop-7EvUHhKQ.js → desktop-aAKpvKJV.js} +1 -1
- package/web/dist/assets/group-view-state-CGCzYF8k.js +1 -0
- package/web/dist/assets/index-C6DwztqE.css +1 -0
- package/web/dist/assets/index-CuN802Sj.js +93 -0
- package/web/dist/assets/index-EH5Fw9fa.js +93 -0
- package/web/dist/assets/plugin-host-BRWib9DF.js +1 -0
- package/web/dist/assets/remote-ssh-client-CfYSMEZg.js +1 -0
- package/web/dist/assets/theme-D2l_mLNo.js +1 -0
- package/web/dist/index.html +10 -9
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/BgTasksModal-BvnUHjFe.js +0 -1
- package/web/dist/assets/BgTasksModal-DSC8ncW3.js +0 -1
- package/web/dist/assets/DeviceCenter-Bmgr-Bwm.js +0 -3
- package/web/dist/assets/DeviceCenter-Cl9MBXaH.js +0 -3
- package/web/dist/assets/DeviceGroups-aeLD2msl.js +0 -1
- package/web/dist/assets/Dropdown-D1Jl35dw.js +0 -1
- package/web/dist/assets/FilePreview-6CqoDF_P.js +0 -2
- package/web/dist/assets/FilePreview-CJa27G_Q.js +0 -2
- package/web/dist/assets/GlobalSearchModal-CJX35rZL.js +0 -1
- package/web/dist/assets/GlobalSearchModal-CMW0xz0P.js +0 -1
- package/web/dist/assets/GroupConversation-Cq4daBFb.js +0 -1
- package/web/dist/assets/GroupConversation-DoELa83U.js +0 -1
- package/web/dist/assets/ModelConfigModal-Bp7tfKYh.js +0 -2
- package/web/dist/assets/PiSetupModal-DD8srwBJ.js +0 -1
- package/web/dist/assets/ProviderOAuthControls-C6tfXb88.js +0 -1
- package/web/dist/assets/SCMPanel-CghgsyBN.js +0 -2
- package/web/dist/assets/SCMPanel-D8-8aqwC.js +0 -2
- package/web/dist/assets/SettingsModal-BbBe2rYo.js +0 -20
- package/web/dist/assets/SettingsModal-qETiVPKj.js +0 -20
- package/web/dist/assets/TerminalPanel-Da-Xs4Wk.js +0 -3
- package/web/dist/assets/TerminalPanel-DnS4tFQO.js +0 -3
- package/web/dist/assets/TuiOverlayModal-CGyGkKYl.js +0 -1
- package/web/dist/assets/TuiOverlayModal-CpBKjG6x.js +0 -1
- package/web/dist/assets/app-globals-DcyO0UPi.js +0 -1
- package/web/dist/assets/fi-NyN-ZrgD.js +0 -325
- package/web/dist/assets/index-DK3F5ZJo.js +0 -85
- package/web/dist/assets/index-DQMii2he.js +0 -85
- package/web/dist/assets/index-vwBnwzkr.css +0 -1
- package/web/dist/assets/plugin-host-BCnX3P8U.js +0 -1
- package/web/dist/assets/theme-D2DMH6tH.js +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* builtins/todo.ts — 内置任务标记(复刻 pi-marker-tools)。
|
|
3
|
+
*/
|
|
4
|
+
import { getServerBlock, pick } from "../../i18n.js";
|
|
5
|
+
export const TODO_NAMESPACE = "todo";
|
|
6
|
+
export function initTodoState() {
|
|
7
|
+
return { tasks: [], nextId: 1 };
|
|
8
|
+
}
|
|
9
|
+
function findTask(state, id) {
|
|
10
|
+
return state.tasks.find((t) => t.id === id && t.status !== "deleted");
|
|
11
|
+
}
|
|
12
|
+
function parseId(raw) {
|
|
13
|
+
if (raw === undefined)
|
|
14
|
+
return null;
|
|
15
|
+
const n = Number(raw);
|
|
16
|
+
return Number.isInteger(n) && n > 0 ? n : null;
|
|
17
|
+
}
|
|
18
|
+
const TODO_GUIDANCE_ZH = [
|
|
19
|
+
"- 标记语法:[[todo:new:<主题>]] 新建;[[todo:set:<id>,completed|in_progress|pending]] 状态;[[todo:remove:<id>]] 删除;[[todo:dep:<id>,blocks=<依赖id,逗号分隔>]] 设依赖。",
|
|
20
|
+
"- 状态变化全部用上面的 [[todo:...]] 内联标记表达,不会中断回答,无需等待返回。",
|
|
21
|
+
"- 想查看/list 当前任务列表时,才用 `todo_list` 工具(读操作走工具)。",
|
|
22
|
+
"- 不要编造不存在的任务 id;id 由 [[todo:new:...]] 分配,首次分配是自增整数。",
|
|
23
|
+
];
|
|
24
|
+
const TODO_GUIDANCE_EN = [
|
|
25
|
+
"- Marker syntax: [[todo:new:<subject>]] to create; [[todo:set:<id>,completed|in_progress|pending]] for status; [[todo:remove:<id>]] to delete; [[todo:dep:<id>,blocks=<dep ids, comma-separated>]] to set dependencies.",
|
|
26
|
+
"- Express all status changes with the [[todo:...]] inline markers above; they never interrupt your reply and need no waiting for a result.",
|
|
27
|
+
"- Only use the `todo_list` tool (the read path goes through the tool) when you want to list the current tasks.",
|
|
28
|
+
"- Never invent task ids; ids are assigned by [[todo:new:...]], starting from incrementing integers.",
|
|
29
|
+
];
|
|
30
|
+
/** 语言感知的 todo guidance(issue #91):en 用英译、zh 用中文,默认英文。 */
|
|
31
|
+
export function getTodoGuidance(lang = "en") {
|
|
32
|
+
return getServerBlock(lang, "markers.todo.guidance", TODO_GUIDANCE_ZH, TODO_GUIDANCE_EN);
|
|
33
|
+
}
|
|
34
|
+
export const todoMarker = {
|
|
35
|
+
name: "todo",
|
|
36
|
+
guidance: TODO_GUIDANCE_ZH,
|
|
37
|
+
getGuidance: getTodoGuidance,
|
|
38
|
+
async apply(token, _ctx, _state, lang = "en") {
|
|
39
|
+
const state = _state;
|
|
40
|
+
const op = token.op;
|
|
41
|
+
switch (op) {
|
|
42
|
+
case "new": {
|
|
43
|
+
// #499:subject 是唯一「整段自由文本」参数——args.join 还原含逗号的主题,
|
|
44
|
+
// 否则 `[[todo:new:修复登录页,同步改注册页]]` 的后半段被静默丢弃。
|
|
45
|
+
const subject = token.args.join(",").trim();
|
|
46
|
+
if (!subject)
|
|
47
|
+
return {
|
|
48
|
+
applied: false,
|
|
49
|
+
error: pick(lang, "todo:new 需要一个主题参数 [[todo:new:<主题>]]", "todo:new requires a subject argument [[todo:new:<subject>]]", "markers.todo.new.requires.subject"),
|
|
50
|
+
};
|
|
51
|
+
const id = state.nextId++;
|
|
52
|
+
state.tasks.push({ id, subject, status: "pending", blockedBy: [], createdAt: Date.now() });
|
|
53
|
+
return {
|
|
54
|
+
applied: true,
|
|
55
|
+
feedback: pick(lang, `已创建 #${id}:${subject}(pending)`, `Created #${id}: ${subject} (pending)`, "markers.todo.new.created", { id: id, subject: subject }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
case "set": {
|
|
59
|
+
const id = parseId(token.args[0]);
|
|
60
|
+
if (id === null) {
|
|
61
|
+
const rawId = token.args[0] ?? "";
|
|
62
|
+
return {
|
|
63
|
+
applied: false,
|
|
64
|
+
error: pick(lang, `todo:set 的 id 无效: "${rawId}"`, `todo:set has an invalid id: "${rawId}"`, "markers.todo.set.invalid.id", { rawId: rawId }),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const status = token.args[1]?.trim();
|
|
68
|
+
if (!status || !(status === "pending" || status === "in_progress" || status === "completed")) {
|
|
69
|
+
const statusText = status ?? "";
|
|
70
|
+
return {
|
|
71
|
+
applied: false,
|
|
72
|
+
error: pick(lang, `todo:set 状态无效: "${statusText}",应为 pending|in_progress|completed`, `todo:set has an invalid status: "${statusText}", expected pending|in_progress|completed`, "markers.todo.set.invalid.status", { statusText: statusText }),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const task = findTask(state, id);
|
|
76
|
+
if (!task)
|
|
77
|
+
return {
|
|
78
|
+
applied: false,
|
|
79
|
+
error: pick(lang, `todo:set 任务 #${id} 不存在`, `todo:set task #${id} does not exist`, "markers.todo.set.task.missing", { id: id }),
|
|
80
|
+
};
|
|
81
|
+
const activeForm = token.kwargs["activeForm"];
|
|
82
|
+
const from = task.status;
|
|
83
|
+
if (status === "pending" && from === "completed") {
|
|
84
|
+
return {
|
|
85
|
+
applied: false,
|
|
86
|
+
error: pick(lang, `任务 #${id} 已完成,不能置回 pending`, `Task #${id} is completed and cannot be set back to pending`, "markers.todo.set.completed.no.pending", { id: id }),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (status === "in_progress" && from === "completed") {
|
|
90
|
+
return {
|
|
91
|
+
applied: false,
|
|
92
|
+
error: pick(lang, `任务 #${id} 已完成,不能重新进行中`, `Task #${id} is completed and cannot be set back to in_progress`, "markers.todo.set.completed.no.inprogress", { id: id }),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
task.status = status;
|
|
96
|
+
if (status === "in_progress" && activeForm)
|
|
97
|
+
task.activeForm = activeForm;
|
|
98
|
+
const change = from !== status ? ` (${from} → ${status})` : "";
|
|
99
|
+
return {
|
|
100
|
+
applied: true,
|
|
101
|
+
feedback: pick(lang, `已更新 #${id}${change}`, `Updated #${id}${change}`, "markers.todo.set.updated", {
|
|
102
|
+
id: id,
|
|
103
|
+
change: change,
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
case "remove": {
|
|
108
|
+
const id = parseId(token.args[0]);
|
|
109
|
+
if (id === null) {
|
|
110
|
+
const rawId = token.args[0] ?? "";
|
|
111
|
+
return {
|
|
112
|
+
applied: false,
|
|
113
|
+
error: pick(lang, `todo:remove 的 id 无效: "${rawId}"`, `todo:remove has an invalid id: "${rawId}"`, "markers.todo.remove.invalid.id", { rawId: rawId }),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const task = findTask(state, id);
|
|
117
|
+
if (!task)
|
|
118
|
+
return {
|
|
119
|
+
applied: false,
|
|
120
|
+
error: pick(lang, `todo:remove 任务 #${id} 不存在`, `todo:remove task #${id} does not exist`, "markers.todo.remove.task.missing", { id: id }),
|
|
121
|
+
};
|
|
122
|
+
task.status = "deleted";
|
|
123
|
+
return {
|
|
124
|
+
applied: true,
|
|
125
|
+
feedback: pick(lang, `已删除 #${id}:${task.subject}`, `Deleted #${id}: ${task.subject}`, "markers.todo.remove.deleted", { id: id, "task.subject": task.subject }),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
case "dep": {
|
|
129
|
+
const id = parseId(token.args[0]);
|
|
130
|
+
if (id === null) {
|
|
131
|
+
const rawId = token.args[0] ?? "";
|
|
132
|
+
return {
|
|
133
|
+
applied: false,
|
|
134
|
+
error: pick(lang, `todo:dep 的 id 无效: "${rawId}"`, `todo:dep has an invalid id: "${rawId}"`, "markers.todo.dep.invalid.id", { rawId: rawId }),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const task = findTask(state, id);
|
|
138
|
+
if (!task)
|
|
139
|
+
return {
|
|
140
|
+
applied: false,
|
|
141
|
+
error: pick(lang, `todo:dep 任务 #${id} 不存在`, `todo:dep task #${id} does not exist`, "markers.todo.dep.task.missing", { id: id }),
|
|
142
|
+
};
|
|
143
|
+
const depRaw = token.kwargs["blocks"] ?? token.args[1] ?? "";
|
|
144
|
+
const deps = depRaw
|
|
145
|
+
.split(",")
|
|
146
|
+
.map((x) => parseId(x.trim()))
|
|
147
|
+
.filter((x) => x !== null);
|
|
148
|
+
const bad = deps.filter((d) => d === id || !findTask(state, d));
|
|
149
|
+
if (bad.length) {
|
|
150
|
+
const badList = bad.join(",");
|
|
151
|
+
return {
|
|
152
|
+
applied: false,
|
|
153
|
+
error: pick(lang, `todo:dep 检测到非法依赖 ${badList}(不存在或自环)`, `todo:dep detected invalid dependencies ${badList} (missing or self-referencing)`, "markers.todo.dep.invalid.dependencies", { badList: badList }),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
task.blockedBy = deps;
|
|
157
|
+
const depsText = deps.length ? deps.join(",") : lang === "zh" ? "(无)" : "(none)";
|
|
158
|
+
return {
|
|
159
|
+
applied: true,
|
|
160
|
+
feedback: pick(lang, `#${id} 依赖:${depsText}`,
|
|
161
|
+
// #499:实现是 blockedBy(deps 先完成)——原英文 "blocks" 把依赖方向说反了。
|
|
162
|
+
`#${id} is blocked by: ${depsText}`, "markers.todo.dep.blocks.updated", { id: id, depsText: depsText }),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
default:
|
|
166
|
+
return {
|
|
167
|
+
applied: false,
|
|
168
|
+
error: pick(lang, `todo 未知操作: ${op}`, `todo unknown operation: ${op}`, "markers.todo.unknown.operation", {
|
|
169
|
+
op: op,
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
overlay(state) {
|
|
175
|
+
if (!state || state.tasks.length === 0)
|
|
176
|
+
return undefined;
|
|
177
|
+
const visible = state.tasks.filter((t) => t.status !== "deleted");
|
|
178
|
+
if (visible.length === 0)
|
|
179
|
+
return undefined;
|
|
180
|
+
const done = visible.filter((t) => t.status === "completed").length;
|
|
181
|
+
const lines = visible.map((t) => {
|
|
182
|
+
const mark = t.status === "completed" ? "✓" : t.status === "in_progress" ? "◐" : "○";
|
|
183
|
+
const form = t.status === "in_progress" && t.activeForm ? ` (${t.activeForm})` : "";
|
|
184
|
+
return ` ${mark} #${t.id} ${t.subject}${form}`;
|
|
185
|
+
});
|
|
186
|
+
return { tool: "todo", lines: [`${done}/${visible.length} done`, ...lines] };
|
|
187
|
+
},
|
|
188
|
+
init: initTodoState,
|
|
189
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* markers-list-tool — 任务列表只读查询工具(todo_list)。
|
|
3
|
+
*
|
|
4
|
+
* 读操作仍走真工具;所有写操作由模型在回复正文中使用行内标记([[todo:new:...]] 等)。
|
|
5
|
+
* 从 agent-service.ts 抽出为独立模块。
|
|
6
|
+
*/
|
|
7
|
+
import { Type } from "typebox";
|
|
8
|
+
import { MARKERS_LIST_TOOL_NAME } from "./tool-manager.js";
|
|
9
|
+
export function makeMarkersListTool(getActiveId, markerSvc) {
|
|
10
|
+
return {
|
|
11
|
+
name: MARKERS_LIST_TOOL_NAME,
|
|
12
|
+
promptSnippet: "list inline-marker tasks (read-only; writes use [[todo:...]])",
|
|
13
|
+
label: "List marker state",
|
|
14
|
+
description: "Read-only query of inline marker state. All WRITE operations must use inline markers ([[todo:new:...]] etc.) in the reply body — never this tool.",
|
|
15
|
+
parameters: Type.Object({
|
|
16
|
+
action: Type.Unsafe({ type: "string", enum: ["list"] }),
|
|
17
|
+
tool: Type.Optional(Type.Literal("todo")),
|
|
18
|
+
includeDeleted: Type.Optional(Type.Boolean({
|
|
19
|
+
description: "Include deleted tasks (tombstones, todo only).",
|
|
20
|
+
})),
|
|
21
|
+
}),
|
|
22
|
+
execute: async (_id, params) => {
|
|
23
|
+
const p = params;
|
|
24
|
+
const convId = getActiveId();
|
|
25
|
+
const text = markerSvc.describe(convId, "todo", !!p.includeDeleted);
|
|
26
|
+
const state = markerSvc.getRawState(convId, "todo");
|
|
27
|
+
const visible = (state?.tasks ?? []).filter((t) => p.includeDeleted || t.status !== "deleted");
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text }],
|
|
30
|
+
details: { action: "list", todos: visible, nextId: state?.nextId },
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isPromptAsideEntry } from "./attachments.js";
|
|
2
|
+
/** Context entries retain tombstones; omit deleted messages before resolving UI IDs. */
|
|
3
|
+
export function undeletedContextEntries(entries) {
|
|
4
|
+
const edits = new Map();
|
|
5
|
+
for (const entry of entries) {
|
|
6
|
+
if (entry.type === "context_edit")
|
|
7
|
+
edits.set(entry.targetId, entry.replacement);
|
|
8
|
+
}
|
|
9
|
+
return entries.filter((entry) => edits.get(entry.id) !== null);
|
|
10
|
+
}
|
|
11
|
+
/** Keep deletion local to the selected message, including its attachment/tool records. */
|
|
12
|
+
export function messageDeletionTargets(entries, targetId) {
|
|
13
|
+
const visible = undeletedContextEntries(entries);
|
|
14
|
+
const index = visible.findIndex((entry) => entry.id === targetId);
|
|
15
|
+
const target = visible[index];
|
|
16
|
+
if (!target || target.type !== "message" || !["user", "assistant"].includes(target.message.role)) {
|
|
17
|
+
throw new Error("Message is no longer available for deletion");
|
|
18
|
+
}
|
|
19
|
+
const ids = new Set([target.id]);
|
|
20
|
+
if (target.message.role === "user") {
|
|
21
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
22
|
+
const entry = visible[i];
|
|
23
|
+
if (entry.type === "message" && entry.message.role !== "system" && !isPromptAsideEntry(entry))
|
|
24
|
+
break;
|
|
25
|
+
if (entry.type === "compaction" || entry.type === "branch_summary")
|
|
26
|
+
break;
|
|
27
|
+
if (isPromptAsideEntry(entry))
|
|
28
|
+
ids.add(entry.id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else if (target.message.role === "assistant") {
|
|
32
|
+
const calls = new Set(target.message.content.filter((block) => block.type === "toolCall").map((block) => block.id));
|
|
33
|
+
for (const entry of visible.slice(index + 1)) {
|
|
34
|
+
if (entry.type === "message" && entry.message.role === "toolResult" && calls.has(entry.message.toolCallId)) {
|
|
35
|
+
ids.add(entry.id);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [...ids];
|
|
40
|
+
}
|
|
@@ -117,6 +117,15 @@ export class MessageWindowTap {
|
|
|
117
117
|
convs = new Map();
|
|
118
118
|
/** 最近一次快照所属的对话 —— `load_earlier_messages` 不带 id,按「当前对话」服务。 */
|
|
119
119
|
lastConversationId = "";
|
|
120
|
+
scope = "";
|
|
121
|
+
/** Local conversation IDs are unique only within an execution owner. */
|
|
122
|
+
setScope(scope) {
|
|
123
|
+
if (this.scope === scope)
|
|
124
|
+
return;
|
|
125
|
+
this.scope = scope;
|
|
126
|
+
this.convs.clear();
|
|
127
|
+
this.lastConversationId = "";
|
|
128
|
+
}
|
|
120
129
|
constructor(send, cfg) {
|
|
121
130
|
this.send = send;
|
|
122
131
|
this.cfg = cfg;
|
|
@@ -16,6 +16,7 @@ import { dirname, join } from "node:path";
|
|
|
16
16
|
import { writeJsonAtomicSync } from "./atomic-file.js";
|
|
17
17
|
import { stripJsonComments } from "./json-utils.js";
|
|
18
18
|
import { enrichBatch } from "./model-enrich.js";
|
|
19
|
+
import { resolveModelReasoningSpec } from "./reasoning-registry.js";
|
|
19
20
|
import { pick } from "./i18n.js";
|
|
20
21
|
import { ProviderOAuthFlowManager } from "./provider-oauth-flow.js";
|
|
21
22
|
/** Drop provisional overlay rows once the official catalog lists the same id.
|
|
@@ -135,6 +136,30 @@ export function mergeProviderConfigEntry(prevEntry, config, models) {
|
|
|
135
136
|
const thinkingLevelMap = sanitizeThinkingLevelMap(model.thinkingLevelMap);
|
|
136
137
|
if (thinkingLevelMap)
|
|
137
138
|
merged.thinkingLevelMap = thinkingLevelMap;
|
|
139
|
+
if (model.compat && typeof model.compat === "object")
|
|
140
|
+
merged.compat = model.compat;
|
|
141
|
+
if (model.samplingParams && typeof model.samplingParams === "object")
|
|
142
|
+
merged.samplingParams = model.samplingParams;
|
|
143
|
+
if (typeof model.customExtraBody === "string") {
|
|
144
|
+
if (model.customExtraBody.trim()) {
|
|
145
|
+
merged.customExtraBody = model.customExtraBody.trim();
|
|
146
|
+
try {
|
|
147
|
+
const parsed = JSON.parse(model.customExtraBody.trim());
|
|
148
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
149
|
+
merged.samplingParams = {
|
|
150
|
+
...(merged.samplingParams ?? {}),
|
|
151
|
+
...parsed,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// 忽略非合法 JSON
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
delete merged.customExtraBody;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
138
163
|
return merged;
|
|
139
164
|
});
|
|
140
165
|
const mergedEntry = { ...prevEntry };
|
|
@@ -376,12 +401,13 @@ function parseOpenAiModel(m) {
|
|
|
376
401
|
boolMeta(r.supports_vision) === true ||
|
|
377
402
|
boolMeta(r.vision) === true ||
|
|
378
403
|
strArrMeta(r.input)?.includes("image") === true;
|
|
379
|
-
// 名字与元数据兜底:端点未提供 reasoning
|
|
404
|
+
// 名字与元数据兜底:端点未提供 reasoning 时通过通用推理模型特征或权威知识库推断。
|
|
380
405
|
// 只增不减:取消勾选靠手填(编辑页/刷新合并都只补缺)。
|
|
381
406
|
// 网关自报推理档位同样是「这是推理模型」的铁证(如聚合网关的 glm-5.3,
|
|
382
407
|
// 名字认不出来,但 reasoning_levels 报了 low/high/max)。
|
|
383
|
-
const
|
|
384
|
-
const
|
|
408
|
+
const knownSpec = resolveModelReasoningSpec(id, r);
|
|
409
|
+
const thinkingLevelMap = buildThinkingLevelMapFromMeta(r) ?? knownSpec?.thinkingLevelMap;
|
|
410
|
+
const reasoning = detectReasoningCapability(id, r) || thinkingLevelMap !== undefined || Boolean(knownSpec);
|
|
385
411
|
const contextWindow = numMeta(r.context_window) ?? numMeta(r.context_length) ?? numMeta(r.max_model_len) ?? numMeta(r.max_context_length);
|
|
386
412
|
const maxTokens = numMeta(r.max_tokens) ?? numMeta(r.max_output_tokens) ?? numMeta(r.max_completion_tokens);
|
|
387
413
|
return {
|
|
@@ -402,9 +428,10 @@ function parseGoogleModel(m) {
|
|
|
402
428
|
const rawName = typeof r.name === "string" ? r.name : "";
|
|
403
429
|
const id = rawName.replace(/^models\//, "");
|
|
404
430
|
const displayName = typeof r.displayName === "string" ? r.displayName : undefined;
|
|
405
|
-
// 与 OpenAI 形状同口径的推断兜底(见 detectReasoningCapability)。
|
|
406
|
-
const
|
|
407
|
-
const
|
|
431
|
+
// 与 OpenAI 形状同口径的推断兜底(见 detectReasoningCapability 与 resolveModelReasoningSpec)。
|
|
432
|
+
const knownGoogleSpec = resolveModelReasoningSpec(id, r);
|
|
433
|
+
const thinkingLevelMap = buildThinkingLevelMapFromMeta(r) ?? knownGoogleSpec?.thinkingLevelMap;
|
|
434
|
+
const reasoning = detectReasoningCapability(id, r) || thinkingLevelMap !== undefined || Boolean(knownGoogleSpec);
|
|
408
435
|
return {
|
|
409
436
|
id,
|
|
410
437
|
...(displayName && displayName !== id ? { name: displayName } : {}),
|
|
@@ -1847,11 +1874,26 @@ export class ModelAdminService {
|
|
|
1847
1874
|
* from sibling models at compose time. */
|
|
1848
1875
|
static toModelRow(m) {
|
|
1849
1876
|
const thinkingLevelMap = sanitizeThinkingLevelMap(m.thinkingLevelMap);
|
|
1877
|
+
let samplingParams = m.samplingParams;
|
|
1878
|
+
if (typeof m.customExtraBody === "string" && m.customExtraBody.trim()) {
|
|
1879
|
+
try {
|
|
1880
|
+
const parsed = JSON.parse(m.customExtraBody.trim());
|
|
1881
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1882
|
+
samplingParams = { ...(samplingParams ?? {}), ...parsed };
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
catch {
|
|
1886
|
+
// 忽略格式错误,保留原样
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1850
1889
|
return {
|
|
1851
1890
|
id: m.id.trim(),
|
|
1852
1891
|
...(m.name?.trim() ? { name: m.name.trim() } : {}),
|
|
1853
1892
|
...(m.reasoning ? { reasoning: true } : {}),
|
|
1854
1893
|
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
1894
|
+
...(m.compat && typeof m.compat === "object" ? { compat: m.compat } : {}),
|
|
1895
|
+
...(samplingParams && typeof samplingParams === "object" ? { samplingParams } : {}),
|
|
1896
|
+
...(m.customExtraBody?.trim() ? { customExtraBody: m.customExtraBody.trim() } : {}),
|
|
1855
1897
|
...(m.input?.length ? { input: m.input } : {}),
|
|
1856
1898
|
...(m.contextWindow ? { contextWindow: Number(m.contextWindow) } : {}),
|
|
1857
1899
|
...(m.maxTokens ? { maxTokens: Number(m.maxTokens) } : {}),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveModelReasoningSpec } from "./reasoning-registry.js";
|
|
1
2
|
const t = (lang, zh, en) => (lang === "zh" ? zh : en);
|
|
2
3
|
/** 反代路由档位后缀(只在精确匹配失败后剥离;-pro/-flash/-lite 等真实
|
|
3
4
|
* 家族区分绝不在此列)。 */
|
|
@@ -284,13 +285,17 @@ function familySuggestions(norm, indexes, cap = 6) {
|
|
|
284
285
|
return out;
|
|
285
286
|
}
|
|
286
287
|
function toResult(lang, id, model, source, matchType) {
|
|
288
|
+
const reasoningSpec = resolveModelReasoningSpec(id) ?? resolveModelReasoningSpec(model.id);
|
|
289
|
+
const isReasoning = Boolean(model.reasoning || reasoningSpec);
|
|
287
290
|
return {
|
|
288
291
|
id,
|
|
289
292
|
status: "matched",
|
|
290
293
|
...(model.contextWindow ? { contextWindow: model.contextWindow } : {}),
|
|
291
294
|
...(model.maxTokens ? { maxTokens: model.maxTokens } : {}),
|
|
292
295
|
...(model.vision ? { input: ["text", "image"] } : {}),
|
|
293
|
-
...(
|
|
296
|
+
...(isReasoning ? { reasoning: true } : {}),
|
|
297
|
+
...(reasoningSpec?.thinkingLevelMap ? { thinkingLevelMap: reasoningSpec.thinkingLevelMap } : {}),
|
|
298
|
+
...(reasoningSpec?.type ? { reasoningType: reasoningSpec.type } : {}),
|
|
294
299
|
...(model.name && model.name.toLowerCase() !== id.toLowerCase() ? { name: model.name } : {}),
|
|
295
300
|
source: `${source}${matchType === "exact" || matchType === "hint" ? "" : t(lang, "(别名)", " (alias)")}`,
|
|
296
301
|
matchType,
|
|
@@ -464,9 +469,13 @@ export async function enrichBatch(ids, hints, opts = {}) {
|
|
|
464
469
|
continue;
|
|
465
470
|
}
|
|
466
471
|
const suggestions = familySuggestions(norm, indexes());
|
|
472
|
+
const reasoningSpec = resolveModelReasoningSpec(id);
|
|
467
473
|
results.push({
|
|
468
474
|
id,
|
|
469
475
|
status: suggestions.length ? "suggested" : "unmatched",
|
|
476
|
+
...(reasoningSpec
|
|
477
|
+
? { reasoning: true, thinkingLevelMap: reasoningSpec.thinkingLevelMap, reasoningType: reasoningSpec.type }
|
|
478
|
+
: {}),
|
|
470
479
|
...(suggestions.length ? { suggestions, matchType: "family" } : {}),
|
|
471
480
|
note: suggestions.length
|
|
472
481
|
? t(lang, "家族相近,可用其 id 作依据重试", "Close family match — retry with its id as evidence")
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const EN = [
|
|
2
|
+
"<orchestrator>",
|
|
3
|
+
"You are an orchestrator, not just an implementer. Your value is decomposition,",
|
|
4
|
+
"delegation, and quality control. Default bias: DELEGATE. Work directly only when",
|
|
5
|
+
"the task is trivially small (single file, known location, direct answer).",
|
|
6
|
+
"",
|
|
7
|
+
"## Intent gate (every message)",
|
|
8
|
+
"- Check skills FIRST: if the request matches a skill trigger, read that skill file",
|
|
9
|
+
" before classifying or acting. Skills handle their tasks better than ad-hoc work.",
|
|
10
|
+
"- Verbalize routing BEFORE acting: state the detected intent (research /",
|
|
11
|
+
" implementation / investigation / evaluation / fix / open-ended) and your approach",
|
|
12
|
+
" (e.g. explore recon first, then answer; plan then delegate).",
|
|
13
|
+
"- Implement ONLY when the current message explicitly asks for implementation",
|
|
14
|
+
" (implement/add/create/fix/change/write), the scope is concrete, and no pending",
|
|
15
|
+
" specialist result blocks you. Otherwise research/clarify and wait.",
|
|
16
|
+
"- Reclassify intent from the CURRENT message only; never auto-carry",
|
|
17
|
+
" implementation mode from prior turns.",
|
|
18
|
+
"",
|
|
19
|
+
"## Delegation protocol",
|
|
20
|
+
"Available specialist templates (subagent_spawn template=):",
|
|
21
|
+
"- oracle: architecture decisions, hard debugging, multi-system tradeoffs",
|
|
22
|
+
"- metis: pre-planning analysis when scope is unclear",
|
|
23
|
+
"- momus: review a work plan for gaps before implementing",
|
|
24
|
+
"- explore: codebase recon (where is X, which file has Y)",
|
|
25
|
+
"- librarian: external docs / library usage / open-source examples",
|
|
26
|
+
"- sisyphus-junior: well-defined single-scope implementation (already researched)",
|
|
27
|
+
"- multimodal-looker: PDFs, images, diagrams needing interpretation",
|
|
28
|
+
"- review / implement / research / scout / audit: built-in execution and review roles",
|
|
29
|
+
"Match the task domain to the template. Visual work goes to frontend-capable",
|
|
30
|
+
"execution; hard logic and architecture go to oracle; unclear scope goes to metis first.",
|
|
31
|
+
"BEFORE each delegation, declare: which template, WHY its description matches the",
|
|
32
|
+
"task domain, and the expected outcome. Then call subagent_spawn.",
|
|
33
|
+
"Delegation prompts MUST include all six sections:",
|
|
34
|
+
"1. TASK (atomic, one action) 2. EXPECTED OUTCOME (concrete deliverables +",
|
|
35
|
+
"done criteria) 3. REQUIRED TOOLS (explicit whitelist) 4. MUST DO (leave nothing",
|
|
36
|
+
"implicit) 5. MUST NOT DO (forbidden actions) 6. CONTEXT (file paths, patterns,",
|
|
37
|
+
"constraints). Vague prompts fail; if your prompt is shorter than 5 lines it is too vague.",
|
|
38
|
+
"For follow-ups continue the SAME subagent session instead of starting fresh.",
|
|
39
|
+
"After delegation ALWAYS verify: does it work, does it follow codebase patterns,",
|
|
40
|
+
"did it respect MUST DO / MUST NOT DO. Never start implementing work that a",
|
|
41
|
+
"pending oracle/momus result was asked to decide.",
|
|
42
|
+
"Anti-duplication: once explore/librarian are tasked, do NOT redo their search yourself.",
|
|
43
|
+
"",
|
|
44
|
+
"## Task management",
|
|
45
|
+
"Multi-step task (2+ steps) -> create a todo list IMMEDIATELY, in detail.",
|
|
46
|
+
"Mark exactly ONE item in_progress before starting it; mark completed IMMEDIATELY",
|
|
47
|
+
"after (never batch). If scope changes, update todos before proceeding.",
|
|
48
|
+
"No todos on non-trivial work = incomplete work.",
|
|
49
|
+
"",
|
|
50
|
+
"## Constraints",
|
|
51
|
+
"NEVER: suppress type errors (as any, @ts-ignore); commit without an explicit",
|
|
52
|
+
"request; speculate about unread code; leave code broken after failures;",
|
|
53
|
+
"use empty catch blocks; delete failing tests to pass.",
|
|
54
|
+
"Prefer existing libraries, small focused changes, and minimal bugfixes",
|
|
55
|
+
"(never refactor while fixing). Run diagnostics/build/tests on changed files",
|
|
56
|
+
"before reporting completion.",
|
|
57
|
+
"</orchestrator>",
|
|
58
|
+
].join("\n");
|
|
59
|
+
const ZH = [
|
|
60
|
+
"<orchestrator>",
|
|
61
|
+
"你是编排者(orchestrator),而不只是一个执行者。你的价值在于任务分解、",
|
|
62
|
+
"委派和质量把关。默认倾向:能委派就委派。只有任务极小(单文件、位置明确、",
|
|
63
|
+
"直接可答)时才亲自动手。",
|
|
64
|
+
"",
|
|
65
|
+
"## 意图门(每条消息先过这一关)",
|
|
66
|
+
"- 先查技能:请求命中某技能触发条件时,先用 read 读该技能文件,再分类或动手。",
|
|
67
|
+
" 技能覆盖的任务,照技能流程做比临场发挥更可靠。",
|
|
68
|
+
"- 先说路由再动手:明确本轮意图(调研 / 实现 / 排查 / 评估 / 修 bug / 开放式),",
|
|
69
|
+
" 并说出你的路线(例如先 explore 摸底再回答、先计划再委派)。",
|
|
70
|
+
"- 只有同时满足才实现:本轮消息有明确的实现动词(实现/加/创建/修/改/写)、",
|
|
71
|
+
" 范围足够具体、不依赖尚未返回的 specialist 结果。否则只做调研/澄清然后等待。",
|
|
72
|
+
"- 每轮只按当前消息重判意图,不把上一轮的“实现模式”自动带过来。",
|
|
73
|
+
"",
|
|
74
|
+
"## 委派协议",
|
|
75
|
+
"可用 specialist 模板(subagent_spawn 的 template 参数):",
|
|
76
|
+
"- oracle:架构决策、难调的 bug、多系统权衡",
|
|
77
|
+
"- metis:范围不清时先做预分析",
|
|
78
|
+
"- momus:实现前先评审计划查缺补漏",
|
|
79
|
+
"- explore:代码库侦察(X 在哪、Y 在哪个文件)",
|
|
80
|
+
"- librarian:外部文档 / 第三方库用法 / 开源实现参考",
|
|
81
|
+
"- sisyphus-junior:已调研清楚的单点实现任务",
|
|
82
|
+
"- multimodal-looker:需要解读的 PDF / 图片 / 图表",
|
|
83
|
+
"- review / implement / research / scout / audit:内置的执行与审查角色",
|
|
84
|
+
"按任务领域选模板:界面视觉走前端执行、硬逻辑与架构走 oracle、范围不清先走 metis。",
|
|
85
|
+
"每次委派前必须声明:选哪个模板、它的简介与任务哪里匹配、期望产出,然后再调 subagent_spawn。",
|
|
86
|
+
"派单词必须包含六段:1. TASK(原子目标) 2. EXPECTED OUTCOME(交付物+完成标准)",
|
|
87
|
+
"3. REQUIRED TOOLS(可用工具白名单) 4. MUST DO(要求写尽) 5. MUST NOT DO(禁区)",
|
|
88
|
+
"6. CONTEXT(文件路径、既有模式、约束)。派单词短于 5 行就是太含糊,一定失败。",
|
|
89
|
+
"追问要在同一个子代理会话里继续,不要另起炉灶。",
|
|
90
|
+
"委派后必须验证:能跑吗、符合代码库既有模式吗、遵守 MUST DO / MUST NOT DO 了吗。",
|
|
91
|
+
"oracle/momus 还没回来之前,不准先把它们要定的实现写了。",
|
|
92
|
+
"禁重复劳动:explore/librarian 已经在查的东西,自己不要再查一遍。",
|
|
93
|
+
"",
|
|
94
|
+
"## 任务管理",
|
|
95
|
+
"多步任务(2 步以上)→ 立刻建 todo 列表,越细越好。",
|
|
96
|
+
"一次只把一项标 in_progress,做完立刻标 completed(不批量)。范围变了先更新 todo 再动手。",
|
|
97
|
+
"复杂任务没有 todo = 没做完。",
|
|
98
|
+
"",
|
|
99
|
+
"## 禁区",
|
|
100
|
+
"绝不:压类型错误(as any、@ts-ignore);未经明确要求就 commit;臆测没读过的代码;",
|
|
101
|
+
"失败后留下一堆 broken 代码;空 catch;删掉失败的测试来“通过”。",
|
|
102
|
+
"优先用现成库、小而聚焦的改动、最小化修 bug(修 bug 时不顺手重构)。",
|
|
103
|
+
"汇报完成前,先对改动过的文件跑一遍诊断/构建/测试。",
|
|
104
|
+
"</orchestrator>",
|
|
105
|
+
].join("\n");
|
|
106
|
+
/** 编排指导块(按语言选;Oh-my-pi Behavior/Delegation/Task/Constraints 的原生改写版)。 */
|
|
107
|
+
export function buildOrchestratorText(lang = "en") {
|
|
108
|
+
return lang === "zh" ? ZH : EN;
|
|
109
|
+
}
|