@co0ontty/wand 4.83.1 → 4.84.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/README.md +4 -0
- package/dist/agent-dispatch.js +5 -1
- package/dist/ai-team-availability.d.ts +1 -1
- package/dist/ai-team-prompts.js +13 -4
- package/dist/ai-team-runner.d.ts +80 -5
- package/dist/ai-team-runner.js +332 -55
- package/dist/ai-team-types.d.ts +92 -5
- package/dist/ai-team-types.js +9 -2
- package/dist/build-info.json +3 -3
- package/dist/cli-api.d.ts +1 -0
- package/dist/cli-api.js +3 -0
- package/dist/cli.js +18 -1
- package/dist/commit-task-archive.d.ts +3 -1
- package/dist/commit-task-archive.js +21 -10
- package/dist/config.d.ts +1 -1
- package/dist/config.js +73 -0
- package/dist/conversation-mentions.d.ts +16 -0
- package/dist/conversation-mentions.js +32 -0
- package/dist/conversation-service.d.ts +90 -0
- package/dist/conversation-service.js +759 -0
- package/dist/conversation-session-preview.d.ts +9 -0
- package/dist/conversation-session-preview.js +47 -0
- package/dist/conversation-task-preview.d.ts +5 -0
- package/dist/conversation-task-preview.js +8 -0
- package/dist/conversation-types.d.ts +80 -0
- package/dist/conversation-types.js +7 -0
- package/dist/core-extension-host.d.ts +27 -0
- package/dist/core-extension-host.js +138 -0
- package/dist/core-runner.d.ts +86 -0
- package/dist/core-runner.js +757 -0
- package/dist/core-status-cli.d.ts +9 -0
- package/dist/core-status-cli.js +280 -0
- package/dist/core-turn-tracker.d.ts +12 -0
- package/dist/core-turn-tracker.js +36 -0
- package/dist/decision-runner.d.ts +6 -0
- package/dist/decision-runner.js +3 -1
- package/dist/decision-tool.d.ts +2 -0
- package/dist/decision-tool.js +49 -22
- package/dist/env-utils.d.ts +7 -3
- package/dist/env-utils.js +30 -5
- package/dist/git-quick-commit.d.ts +5 -0
- package/dist/git-quick-commit.js +9 -3
- package/dist/git-utils.js +2 -1
- package/dist/harness-engine.d.ts +110 -0
- package/dist/harness-engine.js +331 -0
- package/dist/mission-diff.js +2 -1
- package/dist/model-auto-assign.d.ts +50 -0
- package/dist/model-auto-assign.js +163 -0
- package/dist/model-group-runner.d.ts +4 -0
- package/dist/model-group-runner.js +72 -0
- package/dist/model-groups.d.ts +38 -0
- package/dist/model-groups.js +138 -0
- package/dist/models.d.ts +12 -0
- package/dist/models.js +102 -8
- package/dist/npm-update-utils.js +2 -1
- package/dist/openrouter-free-cli.d.ts +25 -0
- package/dist/openrouter-free-cli.js +109 -0
- package/dist/openrouter-free-models.d.ts +85 -0
- package/dist/openrouter-free-models.js +458 -0
- package/dist/openrouter-free-selection.d.ts +5 -0
- package/dist/openrouter-free-selection.js +7 -0
- package/dist/path-repair.d.ts +10 -0
- package/dist/path-repair.js +50 -5
- package/dist/pi-auto-resources.d.ts +12 -0
- package/dist/pi-auto-resources.js +151 -0
- package/dist/pi-execution-types.d.ts +48 -0
- package/dist/pi-execution-types.js +1 -0
- package/dist/pi-execution.d.ts +9 -0
- package/dist/pi-execution.js +187 -0
- package/dist/pi-extension-resources.d.ts +13 -0
- package/dist/pi-extension-resources.js +71 -0
- package/dist/pi-openrouter-free-bridge.d.ts +2 -0
- package/dist/pi-openrouter-free-bridge.js +80 -0
- package/dist/pi-resource-bridge.d.ts +2 -0
- package/dist/pi-resource-bridge.js +73 -0
- package/dist/pi-resource-catalog.d.ts +18 -0
- package/dist/pi-resource-catalog.js +82 -0
- package/dist/pi-resource-recommendation.d.ts +29 -0
- package/dist/pi-resource-recommendation.js +169 -0
- package/dist/pi-resource-run.d.ts +8 -0
- package/dist/pi-resource-run.js +28 -0
- package/dist/pi-session-settings.d.ts +157 -0
- package/dist/pi-session-settings.js +166 -0
- package/dist/platform-action-catalog.d.ts +24 -0
- package/dist/platform-action-catalog.js +141 -0
- package/dist/platform-action-service.d.ts +37 -0
- package/dist/platform-action-service.js +138 -0
- package/dist/platform-action-types.d.ts +125 -0
- package/dist/platform-action-types.js +7 -0
- package/dist/process-manager.d.ts +21 -1
- package/dist/process-manager.js +168 -15
- package/dist/provider-catalog.js +1 -1
- package/dist/provider-cli-updater.js +29 -8
- package/dist/provider-history-scanner.d.ts +9 -0
- package/dist/provider-history-scanner.js +107 -1
- package/dist/retention.d.ts +19 -7
- package/dist/retention.js +171 -28
- package/dist/server-ai-team-routes.js +6 -2
- package/dist/server-conversation-routes.d.ts +5 -0
- package/dist/server-conversation-routes.js +91 -0
- package/dist/server-employee-routes.d.ts +2 -0
- package/dist/server-employee-routes.js +85 -11
- package/dist/server-pi-recommendation-routes.d.ts +13 -0
- package/dist/server-pi-recommendation-routes.js +67 -0
- package/dist/server-resume-routes.js +1 -1
- package/dist/server-session-routes.d.ts +4 -3
- package/dist/server-session-routes.js +182 -37
- package/dist/server-settings-routes.d.ts +5 -0
- package/dist/server-settings-routes.js +46 -0
- package/dist/server-task-routes.js +49 -4
- package/dist/server-team-dispatch-routes.d.ts +19 -0
- package/dist/server-team-dispatch-routes.js +71 -0
- package/dist/server-update-routes.d.ts +1 -1
- package/dist/server-update-routes.js +10 -5
- package/dist/server-workspace-routes.js +44 -24
- package/dist/server.d.ts +1 -0
- package/dist/server.js +148 -30
- package/dist/session-ai-context.d.ts +5 -1
- package/dist/session-ai-context.js +9 -4
- package/dist/session-registry.d.ts +4 -0
- package/dist/session-registry.js +47 -13
- package/dist/session-transport.js +8 -1
- package/dist/settings-web-access.d.ts +15 -0
- package/dist/settings-web-access.js +37 -0
- package/dist/silicon-employee-defaults.d.ts +29 -0
- package/dist/silicon-employee-defaults.js +41 -0
- package/dist/silicon-employee-dispatch.d.ts +5 -1
- package/dist/silicon-employee-dispatch.js +10 -4
- package/dist/silicon-employee-draft.d.ts +21 -4
- package/dist/silicon-employee-draft.js +103 -16
- package/dist/storage.d.ts +73 -2
- package/dist/storage.js +362 -26
- package/dist/structured-claude-protocol.js +1 -1
- package/dist/structured-client-protocol.js +11 -33
- package/dist/structured-content.d.ts +23 -0
- package/dist/structured-content.js +72 -0
- package/dist/structured-failure.d.ts +16 -0
- package/dist/structured-failure.js +36 -0
- package/dist/structured-pi-adapter.d.ts +8 -3
- package/dist/structured-pi-adapter.js +131 -30
- package/dist/structured-provider-common.d.ts +6 -0
- package/dist/structured-provider-common.js +23 -1
- package/dist/structured-runner.d.ts +45 -0
- package/dist/structured-session-manager.d.ts +78 -4
- package/dist/structured-session-manager.js +513 -129
- package/dist/structured-thinking.d.ts +15 -0
- package/dist/structured-thinking.js +46 -0
- package/dist/subagent-dispatch.d.ts +56 -0
- package/dist/subagent-dispatch.js +102 -0
- package/dist/system-employee.d.ts +4 -3
- package/dist/system-employee.js +7 -4
- package/dist/task-retention.d.ts +23 -0
- package/dist/task-retention.js +69 -0
- package/dist/task-types.d.ts +4 -0
- package/dist/task-types.js +3 -0
- package/dist/team-dispatch.d.ts +101 -0
- package/dist/team-dispatch.js +269 -0
- package/dist/tool-preview.js +7 -1
- package/dist/tui/commands.js +50 -1
- package/dist/tui/ipc-protocol.d.ts +1 -1
- package/dist/tui/ipc-server.d.ts +4 -0
- package/dist/tui/ipc-server.js +23 -0
- package/dist/turn-heartbeat.d.ts +35 -0
- package/dist/turn-heartbeat.js +64 -0
- package/dist/types.d.ts +147 -1
- package/dist/user-profile.d.ts +33 -0
- package/dist/user-profile.js +70 -0
- package/dist/web-ui/chat-message-meta.d.ts +11 -0
- package/dist/web-ui/chat-message-meta.js +47 -0
- package/dist/web-ui/content/ai-teams.js +13 -13
- package/dist/web-ui/content/scripts.js +795 -95
- package/dist/web-ui/content/styles.css +1 -1
- package/dist/web-ui/content/tailwind.css +1 -6808
- package/dist/web-ui/content/vendor/qrcode/qrcode.bundle.js +1 -1
- package/dist/web-ui/embedded-assets.d.ts +1 -1
- package/dist/web-ui/embedded-assets.js +5 -5
- package/dist/web-ui/index.d.ts +1 -1
- package/dist/web-ui/index.js +3 -3
- package/dist/web-ui/markdown.d.ts +2 -0
- package/dist/web-ui/markdown.js +111 -0
- package/dist/web-ui/page.d.ts +4 -0
- package/dist/web-ui/page.js +8 -0
- package/dist/web-ui/react/local-preview/controller.d.ts +30 -0
- package/dist/web-ui/react/local-preview/controller.js +159 -0
- package/dist/web-ui/running-activity.d.ts +63 -0
- package/dist/web-ui/running-activity.js +134 -0
- package/dist/web-ui/styles.js +2 -11
- package/package.json +7 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContentBlock } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reasoning events can carry boundaries only. Observation times are supplied
|
|
4
|
+
* by the live runner; historical replay must not invent recent activity.
|
|
5
|
+
*
|
|
6
|
+
* 有些 provider 会为一轮没有产出任何正文的思考发边界事件。这种轮次不该变成
|
|
7
|
+
* 一个空的思考块:它会在时间线里留下一条永远「思考中」又读不到内容的条目,
|
|
8
|
+
* 也会把轮次计数撑大。边界自证没有正文时直接丢弃,只有正在写的那一轮保留占位。
|
|
9
|
+
*/
|
|
10
|
+
export declare function updateThinkingActivity(blocks: ContentBlock[], update: Record<string, unknown> | null | undefined, observedAt?: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* 一条 assistant 消息结束时用它收尾:正文里没有思考内容时,丢掉流式留下的空占位。
|
|
13
|
+
* 返回是否清理过,供调用方在同一条消息没有正文时不再留下空轮次。
|
|
14
|
+
*/
|
|
15
|
+
export declare function settleThinkingRound(blocks: ContentBlock[], messageThinking: string): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function lastThinking(blocks) {
|
|
2
|
+
const last = blocks.at(-1);
|
|
3
|
+
return last?.type === "thinking" ? last : undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Reasoning events can carry boundaries only. Observation times are supplied
|
|
7
|
+
* by the live runner; historical replay must not invent recent activity.
|
|
8
|
+
*
|
|
9
|
+
* 有些 provider 会为一轮没有产出任何正文的思考发边界事件。这种轮次不该变成
|
|
10
|
+
* 一个空的思考块:它会在时间线里留下一条永远「思考中」又读不到内容的条目,
|
|
11
|
+
* 也会把轮次计数撑大。边界自证没有正文时直接丢弃,只有正在写的那一轮保留占位。
|
|
12
|
+
*/
|
|
13
|
+
export function updateThinkingActivity(blocks, update, observedAt) {
|
|
14
|
+
const type = update?.type;
|
|
15
|
+
if (type !== "thinking_start" && type !== "thinking_delta" && type !== "thinking_end")
|
|
16
|
+
return;
|
|
17
|
+
const content = typeof update?.content === "string" ? update.content : "";
|
|
18
|
+
let last = lastThinking(blocks);
|
|
19
|
+
if (type === "thinking_end" && last && !last.thinking.trim() && !content.trim()) {
|
|
20
|
+
blocks.pop();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// 上一轮只开了头就再开一轮:那个空块没有发生过,不是进行中的占位。
|
|
24
|
+
if (type === "thinking_start" && last && !last.thinking.trim())
|
|
25
|
+
blocks.pop();
|
|
26
|
+
last = lastThinking(blocks);
|
|
27
|
+
if (!last) {
|
|
28
|
+
last = { type: "thinking", thinking: "" };
|
|
29
|
+
blocks.push(last);
|
|
30
|
+
}
|
|
31
|
+
if (observedAt) {
|
|
32
|
+
last.occurredAt ??= observedAt;
|
|
33
|
+
last.lastActivityAt = observedAt;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 一条 assistant 消息结束时用它收尾:正文里没有思考内容时,丢掉流式留下的空占位。
|
|
38
|
+
* 返回是否清理过,供调用方在同一条消息没有正文时不再留下空轮次。
|
|
39
|
+
*/
|
|
40
|
+
export function settleThinkingRound(blocks, messageThinking) {
|
|
41
|
+
if (messageThinking.trim())
|
|
42
|
+
return;
|
|
43
|
+
const last = lastThinking(blocks);
|
|
44
|
+
if (last && !last.thinking.trim())
|
|
45
|
+
blocks.pop();
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 子 Agent 派发判据:Web 服务端(`structured-client-protocol.ts` 盖章,Android/iOS/macOS
|
|
3
|
+
* 都消费这份章)与 Web 前端(`web-ui/browser/agent-runs.ts` 现场补判)共用同一份实现,
|
|
4
|
+
* 不再各写一套——判据只留一个地方,就不会再出现「一端改了另一端没改」的漂移。
|
|
5
|
+
*
|
|
6
|
+
* 判据只问一件事:pi 的 `subagent` 工具带不带 `action`。
|
|
7
|
+
* pi 自己把 `action` 定义成「管理/控制专用,省略才是执行」
|
|
8
|
+
* (pi-subagents schemas:`Management action (when present, tool operates in management mode)`、
|
|
9
|
+
* `Management/control only; omit for execution`),所以:
|
|
10
|
+
* - 带 `action` ⇒ 管理调用(status / list / validate / steer / lane.* / schedule.* / command.* …),
|
|
11
|
+
* 不进子 Agent 面板,正文照常留在转录里;
|
|
12
|
+
* - 不带 `action` ⇒ 真正的派发(agent+task、tasks/chain、workflow 脚本、`workflow: true`、
|
|
13
|
+
* 命名工作流资源、resume、mission …),一律进面板。
|
|
14
|
+
*
|
|
15
|
+
* 这里刻意**不枚举**派发形态、也**不枚举**管理动作:pi 以后新增派发参数或新增 action 值,
|
|
16
|
+
* 都自动落到正确一侧,不用再回来补名单。历史实现按「有没有 agent/task」判,于是
|
|
17
|
+
* `subagent({ workflow: "…", async: true })` 这种真派发被当成管理调用丢掉,界面上什么都不显示。
|
|
18
|
+
*
|
|
19
|
+
* Claude Code 的 `Task` / `Agent` 是另一套形状:工具名本身即派发语义,`subagent_type` 可省;
|
|
20
|
+
* 其他 provider 只要真给了 `subagent_type`,同样按派发处理。
|
|
21
|
+
*/
|
|
22
|
+
/** pi 扩展工具经 `piToolName` 映射后带 `Pi/` 前缀。 */
|
|
23
|
+
export declare const PI_SUBAGENT_TOOL_NAME = "Pi/subagent";
|
|
24
|
+
export declare const PI_TODO_TOOL_NAME = "Pi/todo";
|
|
25
|
+
/** Claude Code 的派发工具名。 */
|
|
26
|
+
export declare const CLAUDE_SUBAGENT_TOOL_NAMES: readonly string[];
|
|
27
|
+
/** workflow 形态没有 agent 名,面板用这个类型标识;标题另取脚本名。 */
|
|
28
|
+
export declare const WORKFLOW_SUBAGENT_AGENT_TYPE = "workflow";
|
|
29
|
+
export interface SubagentDispatchMeta {
|
|
30
|
+
taskId: string;
|
|
31
|
+
agentType?: string;
|
|
32
|
+
taskDescription?: string;
|
|
33
|
+
}
|
|
34
|
+
/** 已有的 `__subagent` 盖章(服务端 `SubagentMeta` / 各端 DTO 的结构投影)。 */
|
|
35
|
+
export interface SubagentStampLike {
|
|
36
|
+
taskId?: string;
|
|
37
|
+
agentType?: string;
|
|
38
|
+
taskDescription?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SubagentToolUseLike {
|
|
41
|
+
type?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
input?: unknown;
|
|
45
|
+
__subagent?: SubagentStampLike | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* workflow 派发的可读标题:脚本路径取末段(`…/continuation.js` → `continuation.js`),
|
|
49
|
+
* 命名工作流资源取资源名。`workflow: true`(用同一条回复里的代码块)没有名字,返回 undefined。
|
|
50
|
+
*/
|
|
51
|
+
export declare function subagentWorkflowLabel(workflow: unknown): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* 从一次 tool_use 派生子 Agent 元数据;不是派发(或不是工具调用)时返回 null。
|
|
54
|
+
* 已盖章的块直接回投影,保证服务端盖的章在各端读出来一致。
|
|
55
|
+
*/
|
|
56
|
+
export declare function deriveSubagentDispatchMeta(block: SubagentToolUseLike | null | undefined): SubagentDispatchMeta | null;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 子 Agent 派发判据:Web 服务端(`structured-client-protocol.ts` 盖章,Android/iOS/macOS
|
|
3
|
+
* 都消费这份章)与 Web 前端(`web-ui/browser/agent-runs.ts` 现场补判)共用同一份实现,
|
|
4
|
+
* 不再各写一套——判据只留一个地方,就不会再出现「一端改了另一端没改」的漂移。
|
|
5
|
+
*
|
|
6
|
+
* 判据只问一件事:pi 的 `subagent` 工具带不带 `action`。
|
|
7
|
+
* pi 自己把 `action` 定义成「管理/控制专用,省略才是执行」
|
|
8
|
+
* (pi-subagents schemas:`Management action (when present, tool operates in management mode)`、
|
|
9
|
+
* `Management/control only; omit for execution`),所以:
|
|
10
|
+
* - 带 `action` ⇒ 管理调用(status / list / validate / steer / lane.* / schedule.* / command.* …),
|
|
11
|
+
* 不进子 Agent 面板,正文照常留在转录里;
|
|
12
|
+
* - 不带 `action` ⇒ 真正的派发(agent+task、tasks/chain、workflow 脚本、`workflow: true`、
|
|
13
|
+
* 命名工作流资源、resume、mission …),一律进面板。
|
|
14
|
+
*
|
|
15
|
+
* 这里刻意**不枚举**派发形态、也**不枚举**管理动作:pi 以后新增派发参数或新增 action 值,
|
|
16
|
+
* 都自动落到正确一侧,不用再回来补名单。历史实现按「有没有 agent/task」判,于是
|
|
17
|
+
* `subagent({ workflow: "…", async: true })` 这种真派发被当成管理调用丢掉,界面上什么都不显示。
|
|
18
|
+
*
|
|
19
|
+
* Claude Code 的 `Task` / `Agent` 是另一套形状:工具名本身即派发语义,`subagent_type` 可省;
|
|
20
|
+
* 其他 provider 只要真给了 `subagent_type`,同样按派发处理。
|
|
21
|
+
*/
|
|
22
|
+
/** pi 扩展工具经 `piToolName` 映射后带 `Pi/` 前缀。 */
|
|
23
|
+
export const PI_SUBAGENT_TOOL_NAME = "Pi/subagent";
|
|
24
|
+
export const PI_TODO_TOOL_NAME = "Pi/todo";
|
|
25
|
+
/** Claude Code 的派发工具名。 */
|
|
26
|
+
export const CLAUDE_SUBAGENT_TOOL_NAMES = ["Task", "Agent"];
|
|
27
|
+
/** workflow 形态没有 agent 名,面板用这个类型标识;标题另取脚本名。 */
|
|
28
|
+
export const WORKFLOW_SUBAGENT_AGENT_TYPE = "workflow";
|
|
29
|
+
function textValue(value) {
|
|
30
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
31
|
+
}
|
|
32
|
+
function inputRecord(block) {
|
|
33
|
+
const input = block.input;
|
|
34
|
+
return input && typeof input === "object" && !Array.isArray(input)
|
|
35
|
+
? input
|
|
36
|
+
: {};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* workflow 派发的可读标题:脚本路径取末段(`…/continuation.js` → `continuation.js`),
|
|
40
|
+
* 命名工作流资源取资源名。`workflow: true`(用同一条回复里的代码块)没有名字,返回 undefined。
|
|
41
|
+
*/
|
|
42
|
+
export function subagentWorkflowLabel(workflow) {
|
|
43
|
+
if (typeof workflow !== "string")
|
|
44
|
+
return undefined;
|
|
45
|
+
const raw = workflow.trim();
|
|
46
|
+
if (!raw || raw === "true")
|
|
47
|
+
return undefined;
|
|
48
|
+
const segments = raw.split(/[\\/]/).filter((segment) => segment.length > 0);
|
|
49
|
+
return segments.length > 0 ? segments[segments.length - 1] : raw;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 从一次 tool_use 派生子 Agent 元数据;不是派发(或不是工具调用)时返回 null。
|
|
53
|
+
* 已盖章的块直接回投影,保证服务端盖的章在各端读出来一致。
|
|
54
|
+
*/
|
|
55
|
+
export function deriveSubagentDispatchMeta(block) {
|
|
56
|
+
if (!block)
|
|
57
|
+
return null;
|
|
58
|
+
const stamped = block.__subagent;
|
|
59
|
+
const stampedTaskId = textValue(stamped?.taskId);
|
|
60
|
+
if (stampedTaskId) {
|
|
61
|
+
const stampedAgentType = textValue(stamped?.agentType);
|
|
62
|
+
const stampedDescription = textValue(stamped?.taskDescription);
|
|
63
|
+
return {
|
|
64
|
+
taskId: stampedTaskId,
|
|
65
|
+
...(stampedAgentType ? { agentType: stampedAgentType } : {}),
|
|
66
|
+
...(stampedDescription ? { taskDescription: stampedDescription } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (block.type !== "tool_use")
|
|
70
|
+
return null;
|
|
71
|
+
const taskId = textValue(block.id);
|
|
72
|
+
if (!taskId)
|
|
73
|
+
return null;
|
|
74
|
+
const input = inputRecord(block);
|
|
75
|
+
if (block.name === "workflow" || block.name === "Pi/workflow") {
|
|
76
|
+
return { taskId, agentType: WORKFLOW_SUBAGENT_AGENT_TYPE, taskDescription: "工作流" };
|
|
77
|
+
}
|
|
78
|
+
if (block.name === PI_SUBAGENT_TOOL_NAME || block.name === "subagent") {
|
|
79
|
+
// 有 action 就是管理/控制调用:面板不收,正文照旧。省略 action 才是执行。
|
|
80
|
+
if (textValue(input.action))
|
|
81
|
+
return null;
|
|
82
|
+
const agent = textValue(input.agent);
|
|
83
|
+
const task = textValue(input.task);
|
|
84
|
+
const workflow = input.workflow;
|
|
85
|
+
const description = task ?? subagentWorkflowLabel(workflow);
|
|
86
|
+
const agentType = agent ?? (workflow === undefined ? undefined : WORKFLOW_SUBAGENT_AGENT_TYPE);
|
|
87
|
+
return {
|
|
88
|
+
taskId,
|
|
89
|
+
...(agentType ? { agentType } : {}),
|
|
90
|
+
...(description ? { taskDescription: description } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const agentType = textValue(input.subagent_type);
|
|
94
|
+
if (CLAUDE_SUBAGENT_TOOL_NAMES.indexOf(String(block.name)) < 0 && !agentType)
|
|
95
|
+
return null;
|
|
96
|
+
const description = textValue(input.description);
|
|
97
|
+
return {
|
|
98
|
+
taskId,
|
|
99
|
+
...(agentType ? { agentType } : {}),
|
|
100
|
+
...(description ? { taskDescription: description } : {}),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -6,8 +6,8 @@ export { SYSTEM_EMPLOYEE_ID, SYSTEM_EMPLOYEE_KEY, SYSTEM_EMPLOYEE_NAME, SYSTEM_E
|
|
|
6
6
|
* 内置的「系统运维」员工。
|
|
7
7
|
*
|
|
8
8
|
* Wand 自己的 AI 调用(commit message / tag、提示词优化、会话与任务标题、
|
|
9
|
-
*
|
|
10
|
-
* 不可删除;只有执行候选(CLI 工具 + 模型 +
|
|
9
|
+
* 员工起草)都通过这位员工的 CLI 候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
|
|
10
|
+
* 不可删除;只有执行候选(CLI 工具 + 模型 + 思考深度,按顺序降级)由用户维护。候选中的 SDK 会被系统应用跳过。
|
|
11
11
|
*/
|
|
12
12
|
export declare const SYSTEM_EMPLOYEE_DUTY = "Wand \u7CFB\u7EDF\u8FD0\u7EF4\uFF1A\u670D\u52A1\u4E0E CLI \u7EBF\u8DEF\u3001\u66F4\u65B0\u5206\u53D1\u3001\u4ED3\u5E93\u4E0E\u4F1A\u8BDD\u64CD\u4F5C\uFF0CWand \u81EA\u6709 AI \u4EFB\u52A1\u7684\u6267\u884C\u8005\u3002";
|
|
13
13
|
/**
|
|
@@ -27,7 +27,8 @@ export interface SystemEmployeeSeed {
|
|
|
27
27
|
/** 首次创建内置员工时使用的候选:优先沿用用户已有的系统 AI 工具与模型。 */
|
|
28
28
|
export declare function systemEmployeeSeedAgents(seed?: SystemEmployeeSeed): WandTaskAgent[];
|
|
29
29
|
export declare function systemEmployeeDefinition(agents: WandTaskAgent[], now: string, existing?: SiliconEmployee | null): SiliconEmployee;
|
|
30
|
+
export declare function isSdkEmployeeAgent(agent: Pick<WandTaskAgent, "engine">): boolean;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* 系统应用只走员工的 CLI 渠道:员工候选里可以保存 SDK,但这里明确跳过。
|
|
32
33
|
*/
|
|
33
34
|
export declare function systemEmployeeCliCandidates(employee: Pick<SiliconEmployee, "agents"> | null | undefined): AiCliCandidate[];
|
package/dist/system-employee.js
CHANGED
|
@@ -7,8 +7,8 @@ export { SYSTEM_EMPLOYEE_ID, SYSTEM_EMPLOYEE_KEY, SYSTEM_EMPLOYEE_NAME, SYSTEM_E
|
|
|
7
7
|
* 内置的「系统运维」员工。
|
|
8
8
|
*
|
|
9
9
|
* Wand 自己的 AI 调用(commit message / tag、提示词优化、会话与任务标题、
|
|
10
|
-
*
|
|
11
|
-
* 不可删除;只有执行候选(CLI 工具 + 模型 +
|
|
10
|
+
* 员工起草)都通过这位员工的 CLI 候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
|
|
11
|
+
* 不可删除;只有执行候选(CLI 工具 + 模型 + 思考深度,按顺序降级)由用户维护。候选中的 SDK 会被系统应用跳过。
|
|
12
12
|
*/
|
|
13
13
|
export const SYSTEM_EMPLOYEE_DUTY = "Wand 系统运维:服务与 CLI 线路、更新分发、仓库与会话操作,Wand 自有 AI 任务的执行者。";
|
|
14
14
|
/**
|
|
@@ -57,14 +57,17 @@ export function systemEmployeeDefinition(agents, now, existing) {
|
|
|
57
57
|
updatedAt: now,
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
export function isSdkEmployeeAgent(agent) {
|
|
61
|
+
return agent.engine === "sdk";
|
|
62
|
+
}
|
|
60
63
|
/**
|
|
61
|
-
*
|
|
64
|
+
* 系统应用只走员工的 CLI 渠道:员工候选里可以保存 SDK,但这里明确跳过。
|
|
62
65
|
*/
|
|
63
66
|
export function systemEmployeeCliCandidates(employee) {
|
|
64
67
|
if (!employee)
|
|
65
68
|
return [];
|
|
66
69
|
return employee.agents
|
|
67
|
-
.filter((agent) => agent.kind === "structured")
|
|
70
|
+
.filter((agent) => agent.kind === "structured" && !isSdkEmployeeAgent(agent))
|
|
68
71
|
.map((agent) => {
|
|
69
72
|
const model = (agent.model ?? "").trim();
|
|
70
73
|
return {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** 看板任务的自动归档 / 自动删除。会话保留期不走这里。 */
|
|
2
|
+
export declare const TASK_RETENTION_MIN_DAYS = 1;
|
|
3
|
+
export declare const TASK_RETENTION_MAX_DAYS = 365;
|
|
4
|
+
export declare const DEFAULT_TASK_AUTO_ARCHIVE_DAYS = 7;
|
|
5
|
+
export declare const DEFAULT_TASK_AUTO_DELETE_DAYS = 7;
|
|
6
|
+
export interface TaskRetentionSettings {
|
|
7
|
+
/** 空闲达到天数后自动归档。关闭后只停止自动归档,手动归档不受影响。 */
|
|
8
|
+
autoArchiveEnabled: boolean;
|
|
9
|
+
autoArchiveDays: number;
|
|
10
|
+
/** 归档后达到天数仍未恢复则删除。关闭后已归档任务会一直保留。 */
|
|
11
|
+
autoDeleteEnabled: boolean;
|
|
12
|
+
autoDeleteDays: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function defaultTaskRetention(): TaskRetentionSettings;
|
|
15
|
+
/** 读路径:缺字段或坏值回落到默认,避免旧库或脏数据把保留期清掉。 */
|
|
16
|
+
export declare function normalizeTaskRetention(input: unknown): TaskRetentionSettings;
|
|
17
|
+
/** 写路径:缺字段或越界直接拒绝,不能把半份设置存成「看起来保存成功」。 */
|
|
18
|
+
export declare function parseTaskRetention(input: unknown): TaskRetentionSettings;
|
|
19
|
+
/** `null` 表示该动作关闭。调用方每次扫描都要重新读,不能缓存启动时的窗口。 */
|
|
20
|
+
export declare function taskRetentionWindows(input: unknown): {
|
|
21
|
+
idleMs: number | null;
|
|
22
|
+
archivedMs: number | null;
|
|
23
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** 看板任务的自动归档 / 自动删除。会话保留期不走这里。 */
|
|
2
|
+
export const TASK_RETENTION_MIN_DAYS = 1;
|
|
3
|
+
export const TASK_RETENTION_MAX_DAYS = 365;
|
|
4
|
+
export const DEFAULT_TASK_AUTO_ARCHIVE_DAYS = 7;
|
|
5
|
+
export const DEFAULT_TASK_AUTO_DELETE_DAYS = 7;
|
|
6
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
7
|
+
export function defaultTaskRetention() {
|
|
8
|
+
return {
|
|
9
|
+
autoArchiveEnabled: true,
|
|
10
|
+
autoArchiveDays: DEFAULT_TASK_AUTO_ARCHIVE_DAYS,
|
|
11
|
+
autoDeleteEnabled: true,
|
|
12
|
+
autoDeleteDays: DEFAULT_TASK_AUTO_DELETE_DAYS,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** 读路径:缺字段或坏值回落到默认,避免旧库或脏数据把保留期清掉。 */
|
|
16
|
+
export function normalizeTaskRetention(input) {
|
|
17
|
+
const defaults = defaultTaskRetention();
|
|
18
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
19
|
+
return defaults;
|
|
20
|
+
const raw = input;
|
|
21
|
+
return {
|
|
22
|
+
autoArchiveEnabled: typeof raw.autoArchiveEnabled === "boolean" ? raw.autoArchiveEnabled : defaults.autoArchiveEnabled,
|
|
23
|
+
autoArchiveDays: retentionDays(raw.autoArchiveDays, defaults.autoArchiveDays),
|
|
24
|
+
autoDeleteEnabled: typeof raw.autoDeleteEnabled === "boolean" ? raw.autoDeleteEnabled : defaults.autoDeleteEnabled,
|
|
25
|
+
autoDeleteDays: retentionDays(raw.autoDeleteDays, defaults.autoDeleteDays),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** 写路径:缺字段或越界直接拒绝,不能把半份设置存成「看起来保存成功」。 */
|
|
29
|
+
export function parseTaskRetention(input) {
|
|
30
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
31
|
+
throw new Error("任务保留设置必须是对象。");
|
|
32
|
+
}
|
|
33
|
+
const raw = input;
|
|
34
|
+
return {
|
|
35
|
+
autoArchiveEnabled: retentionFlag(raw.autoArchiveEnabled, "自动归档"),
|
|
36
|
+
autoArchiveDays: requireRetentionDays(raw.autoArchiveDays, "空闲天数"),
|
|
37
|
+
autoDeleteEnabled: retentionFlag(raw.autoDeleteEnabled, "自动删除"),
|
|
38
|
+
autoDeleteDays: requireRetentionDays(raw.autoDeleteDays, "归档后天数"),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** `null` 表示该动作关闭。调用方每次扫描都要重新读,不能缓存启动时的窗口。 */
|
|
42
|
+
export function taskRetentionWindows(input) {
|
|
43
|
+
const policy = normalizeTaskRetention(input);
|
|
44
|
+
return {
|
|
45
|
+
idleMs: policy.autoArchiveEnabled ? policy.autoArchiveDays * DAY_MS : null,
|
|
46
|
+
archivedMs: policy.autoDeleteEnabled ? policy.autoDeleteDays * DAY_MS : null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function retentionDays(value, fallback) {
|
|
50
|
+
if (typeof value !== "number" || !Number.isInteger(value))
|
|
51
|
+
return fallback;
|
|
52
|
+
if (value < TASK_RETENTION_MIN_DAYS || value > TASK_RETENTION_MAX_DAYS)
|
|
53
|
+
return fallback;
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function retentionFlag(value, label) {
|
|
57
|
+
if (typeof value !== "boolean")
|
|
58
|
+
throw new Error(`${label}开关必须是布尔值。`);
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function requireRetentionDays(value, label) {
|
|
62
|
+
if (typeof value !== "number"
|
|
63
|
+
|| !Number.isInteger(value)
|
|
64
|
+
|| value < TASK_RETENTION_MIN_DAYS
|
|
65
|
+
|| value > TASK_RETENTION_MAX_DAYS) {
|
|
66
|
+
throw new Error(`${label}必须是 ${TASK_RETENTION_MIN_DAYS}–${TASK_RETENTION_MAX_DAYS} 的整数。`);
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
package/dist/task-types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const DEFAULT_WAND_TASK_PRIORITY: WandTaskPriority;
|
|
|
7
7
|
/** 任务派发时选择的 CLI 工具;空串表示尚未指定。沿用 provider 的唯一真源。 */
|
|
8
8
|
export type WandTaskAgentProvider = import("./provider-catalog.js").SessionProvider;
|
|
9
9
|
export type WandTaskAgentModel = string;
|
|
10
|
+
export type WandTaskAgentEngine = "cli" | "sdk";
|
|
11
|
+
export declare function isWandTaskAgentEngine(value: unknown): value is WandTaskAgentEngine;
|
|
10
12
|
/** 与会话思考档位同一套:旧四档,或 `provider:level` 原生档。 */
|
|
11
13
|
export type WandTaskAgentEffort = "off" | "standard" | "deep" | "max" | `${WandTaskAgentProvider}:${string}`;
|
|
12
14
|
/**
|
|
@@ -44,6 +46,8 @@ export interface WandTaskAgent {
|
|
|
44
46
|
/** 具体模型 ID;"default" 表示跟随服务端为该 provider 选择的默认模型。 */
|
|
45
47
|
model: WandTaskAgentModel;
|
|
46
48
|
thinkingEffort: WandTaskAgentEffort;
|
|
49
|
+
/** 执行引擎;缺省为 CLI。SDK 仅支持 Pi 结构化员工会话。 */
|
|
50
|
+
engine?: WandTaskAgentEngine;
|
|
47
51
|
/** 执行模式;缺省时按标准模式处理。 */
|
|
48
52
|
mode: WandTaskAgentMode;
|
|
49
53
|
/** 派发出来的会话是结构化对话还是 PTY 终端;缺省时按结构化处理。 */
|
package/dist/task-types.js
CHANGED
|
@@ -4,6 +4,9 @@ export function isClosedWandTaskStatus(status) {
|
|
|
4
4
|
}
|
|
5
5
|
/** 新建任务的默认优先级:用户没挑就是「低」,不再落成「无优先级」。 */
|
|
6
6
|
export const DEFAULT_WAND_TASK_PRIORITY = "low";
|
|
7
|
+
export function isWandTaskAgentEngine(value) {
|
|
8
|
+
return value === "cli" || value === "sdk";
|
|
9
|
+
}
|
|
7
10
|
/** 合法执行模式清单;顺序即下拉顺序。 */
|
|
8
11
|
export const WAND_TASK_AGENT_MODES = ["managed", "full-access", "default"];
|
|
9
12
|
/** 历史行没有 mode 字段时的兜底:标准模式,与旧 `mode: "agent"` 的权限姿态一致。 */
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type DecisionResult } from "./decision-types.js";
|
|
2
|
+
import type { WandStorage } from "./storage.js";
|
|
3
|
+
/** 团队页「直接开工」自动建卡的标记,与手写卡区分。 */
|
|
4
|
+
export declare const TEAM_DISPATCH_LABEL = "team_direct";
|
|
5
|
+
/** 临时派工的候选集:一次决策调用最多评估这么多员工(= 每题最多选项数)。 */
|
|
6
|
+
export declare const DISPATCH_CANDIDATES_PER_CALL = 8;
|
|
7
|
+
/** 建议名单默认上限:够完成一件事,又不至于把团队开成大会。 */
|
|
8
|
+
export declare const DISPATCH_MAX_MEMBERS_DEFAULT = 3;
|
|
9
|
+
/** 一次规划最多发多少次判断(每批 8 人):保证响应时间与决策 worker 队列不被目录规模拖垮。 */
|
|
10
|
+
export declare const DISPATCH_MAX_CALLS = 8;
|
|
11
|
+
/** 入选门槛:低于这个概率视为“不参与”。概率只是参考,不是正确率。 */
|
|
12
|
+
export declare const DISPATCH_MIN_PROBABILITY_DEFAULT = 0.5;
|
|
13
|
+
/** 开工说明与状态的上限,与团队直接开工同口径。 */
|
|
14
|
+
export declare const DISPATCH_NOTE_MAX = 4000;
|
|
15
|
+
export interface TeamDispatchCandidate {
|
|
16
|
+
employeeId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
duty: string;
|
|
19
|
+
tags: string[];
|
|
20
|
+
avatar: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TeamDispatchMember extends TeamDispatchCandidate {
|
|
23
|
+
/** 本地决策给出的参与概率(0–1);仅作参考,不是正确率。 */
|
|
24
|
+
probability: number;
|
|
25
|
+
/** 决策给出的这一题的原始判定,便于复盘。 */
|
|
26
|
+
isLeader: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TeamDispatchPlan {
|
|
29
|
+
/** 建议参与的人(按概率降序),可能为空。 */
|
|
30
|
+
members: TeamDispatchMember[];
|
|
31
|
+
/** 超过上限但也被判定为参与的备选(按概率降序)。 */
|
|
32
|
+
bench: TeamDispatchMember[];
|
|
33
|
+
/** 员工目录里可派工的候选总数。 */
|
|
34
|
+
considered: number;
|
|
35
|
+
/** 因候选过多、未纳入本轮评估的人数(目录上限之外)。 */
|
|
36
|
+
omitted: number;
|
|
37
|
+
threshold: number;
|
|
38
|
+
maxMembers: number;
|
|
39
|
+
/** 人类可读说明:为空名单、被截断、覆盖范围等都由它表达。 */
|
|
40
|
+
note: string;
|
|
41
|
+
decision: {
|
|
42
|
+
calls: number;
|
|
43
|
+
model: string | null;
|
|
44
|
+
inputTokens: number;
|
|
45
|
+
};
|
|
46
|
+
experimental: true;
|
|
47
|
+
}
|
|
48
|
+
export interface TeamDispatchRequest {
|
|
49
|
+
storage: WandStorage;
|
|
50
|
+
note: string;
|
|
51
|
+
maxMembers?: number;
|
|
52
|
+
threshold?: number;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
/** 决策调用入口:生产用 DecisionService.evaluate,测试注入替身。 */
|
|
55
|
+
evaluate: (value: unknown, caller: string, signal?: AbortSignal) => Promise<DecisionResult>;
|
|
56
|
+
}
|
|
57
|
+
export interface TeamDispatchStartRequest {
|
|
58
|
+
storage: WandStorage;
|
|
59
|
+
runner: {
|
|
60
|
+
start(input: {
|
|
61
|
+
teamId: string;
|
|
62
|
+
taskId: string;
|
|
63
|
+
note?: string;
|
|
64
|
+
}): Promise<unknown>;
|
|
65
|
+
};
|
|
66
|
+
workspaceId: string;
|
|
67
|
+
note: string;
|
|
68
|
+
members: Array<{
|
|
69
|
+
employeeId: string;
|
|
70
|
+
isLeader?: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
name?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 可派工的员工目录。
|
|
76
|
+
* 系统运维(Wand 自己的生成式 AI 执行者)不是干活的人,永远不进候选集;
|
|
77
|
+
* 归档员工不参与派工,但历史会话仍可打开。
|
|
78
|
+
*/
|
|
79
|
+
export declare function listTeamDispatchCandidates(storage: WandStorage): TeamDispatchCandidate[];
|
|
80
|
+
/**
|
|
81
|
+
* 用本地决策模型给任务挑参与员工:**只产出建议名单**,不自动开工。
|
|
82
|
+
* 每批最多 8 名候选、一名一题(是非判断),批次之间顺序调用(决策服务本身是单 worker)。
|
|
83
|
+
*/
|
|
84
|
+
export declare function planTeamDispatch(request: TeamDispatchRequest): Promise<TeamDispatchPlan>;
|
|
85
|
+
/**
|
|
86
|
+
* 确认开工:用建议名单建一个临时团队并起 run。
|
|
87
|
+
* 名单由调用方回传(服务端重新校验员工身份),所以“建议”和“开工”之间不需要服务端存计划。
|
|
88
|
+
*/
|
|
89
|
+
export declare function startTeamDispatch(request: TeamDispatchStartRequest): Promise<{
|
|
90
|
+
teamId: string;
|
|
91
|
+
taskId: string;
|
|
92
|
+
run: unknown;
|
|
93
|
+
}>;
|
|
94
|
+
/** 决策服务可用性:不可用时明确报错,绝不编造名单。 */
|
|
95
|
+
export declare function assertDispatchDecisionReady(decisions: {
|
|
96
|
+
status(): {
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
supported: boolean;
|
|
99
|
+
configured: boolean;
|
|
100
|
+
};
|
|
101
|
+
}): void;
|