@chances-ai/engine 26.0.0 → 28.0.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/dist/agents/bundled.d.ts +5 -0
- package/dist/agents/bundled.d.ts.map +1 -0
- package/dist/agents/bundled.js +66 -0
- package/dist/agents/bundled.js.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/parse.d.ts +3 -0
- package/dist/agents/parse.d.ts.map +1 -1
- package/dist/agents/parse.js +17 -0
- package/dist/agents/parse.js.map +1 -1
- package/dist/agents/types.d.ts +8 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/ai/adapters/ai-sdk-stream.d.ts.map +1 -1
- package/dist/ai/adapters/ai-sdk-stream.js +6 -1
- package/dist/ai/adapters/ai-sdk-stream.js.map +1 -1
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +1 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/overflow.d.ts +40 -0
- package/dist/ai/overflow.d.ts.map +1 -0
- package/dist/ai/overflow.js +84 -0
- package/dist/ai/overflow.js.map +1 -0
- package/dist/ai/types.d.ts +8 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/core/coordinator-mode.d.ts +32 -0
- package/dist/core/coordinator-mode.d.ts.map +1 -0
- package/dist/core/coordinator-mode.js +98 -0
- package/dist/core/coordinator-mode.js.map +1 -0
- package/dist/core/coordinator-tools.d.ts +22 -0
- package/dist/core/coordinator-tools.d.ts.map +1 -0
- package/dist/core/coordinator-tools.js +262 -0
- package/dist/core/coordinator-tools.js.map +1 -0
- package/dist/core/engine.d.ts +235 -10
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/engine.js +585 -274
- package/dist/core/engine.js.map +1 -1
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/task-tool.d.ts +85 -1
- package/dist/core/task-tool.d.ts.map +1 -1
- package/dist/core/task-tool.js +456 -494
- package/dist/core/task-tool.js.map +1 -1
- package/dist/session/index.d.ts +11 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +22 -1
- package/dist/session/index.js.map +1 -1
- package/dist/tools/bash-readonly.d.ts +26 -0
- package/dist/tools/bash-readonly.d.ts.map +1 -0
- package/dist/tools/bash-readonly.js +130 -0
- package/dist/tools/bash-readonly.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +12 -0
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +18 -12
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/todo.d.ts +33 -0
- package/dist/tools/builtins/todo.d.ts.map +1 -0
- package/dist/tools/builtins/todo.js +245 -0
- package/dist/tools/builtins/todo.js.map +1 -0
- package/dist/tools/builtins/write.d.ts.map +1 -1
- package/dist/tools/builtins/write.js +10 -5
- package/dist/tools/builtins/write.js.map +1 -1
- package/dist/tools/concurrency.d.ts +37 -0
- package/dist/tools/concurrency.d.ts.map +1 -0
- package/dist/tools/concurrency.js +50 -0
- package/dist/tools/concurrency.js.map +1 -0
- package/dist/tools/file-lock.d.ts +22 -0
- package/dist/tools/file-lock.d.ts.map +1 -0
- package/dist/tools/file-lock.js +85 -0
- package/dist/tools/file-lock.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.ts +31 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { COORDINATOR_TOOL_NAMES, TASK_TOOL_NAME } from "./task-tool.js";
|
|
2
|
+
/**
|
|
3
|
+
* (7.8 §3.3) The coordinator "never edits" STRUCTURAL enforcement.
|
|
4
|
+
*
|
|
5
|
+
* The coordinator persona DIRECTS workers; it must never edit, run shells, or
|
|
6
|
+
* mutate memory itself (claude-code's lead-never-edits rule). We enforce this at
|
|
7
|
+
* the tool-surface level — fail-closed — so it holds even if the persona's
|
|
8
|
+
* `tools` frontmatter is misconfigured AND without depending on task 12's
|
|
9
|
+
* per-agent `permissions` ruleset (codex 7.8 R1-§4): the coordinator's engine is
|
|
10
|
+
* simply built with a ToolRegistry that contains NO mutation tool.
|
|
11
|
+
*/
|
|
12
|
+
/** Categories a coordinator may never hold. `integration` is default-denied
|
|
13
|
+
* (it includes out-of-process MCP `mcp__*` tools whose writes the worktree
|
|
14
|
+
* can't confine, and the `lsp` host) — the orchestration tools are exempted
|
|
15
|
+
* explicitly below, not via this set (codex 7.8 R1-§4: real ToolCategory is
|
|
16
|
+
* `shell`, not `exec`; bash is `shell` and mutates). */
|
|
17
|
+
const MUTATION_CATEGORIES = new Set([
|
|
18
|
+
"file-write",
|
|
19
|
+
"shell",
|
|
20
|
+
"memory-write",
|
|
21
|
+
"integration",
|
|
22
|
+
]);
|
|
23
|
+
/** Names that are mutation tools regardless of how their category is declared —
|
|
24
|
+
* a belt-and-suspenders backstop against a renamed/miscategorised edit tool. */
|
|
25
|
+
const KNOWN_MUTATION_NAMES = new Set([
|
|
26
|
+
"write",
|
|
27
|
+
"edit",
|
|
28
|
+
"multi_edit",
|
|
29
|
+
"multiedit",
|
|
30
|
+
"apply_edit",
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* (7.8 §3.3) Is this tool one the coordinator must NOT hold? The orchestration
|
|
34
|
+
* tools (`spawn_worker`/`send_message`/… — themselves `integration`) are EXEMPT:
|
|
35
|
+
* they are the coordinator's whole purpose. Everything else mutation-shaped
|
|
36
|
+
* (file-write / shell / memory-write / integration / a known edit name) is a
|
|
37
|
+
* mutation tool.
|
|
38
|
+
*/
|
|
39
|
+
export function isMutationTool(tool) {
|
|
40
|
+
if (COORDINATOR_TOOL_NAMES.has(tool.name))
|
|
41
|
+
return false;
|
|
42
|
+
if (KNOWN_MUTATION_NAMES.has(tool.name))
|
|
43
|
+
return true;
|
|
44
|
+
return MUTATION_CATEGORIES.has(tool.category);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* (7.8 §3.3) Filter a candidate tool list down to the coordinator's safe
|
|
48
|
+
* surface: apply the persona's `tools` allowlist / `disallowedTools` (when set),
|
|
49
|
+
* then HARD-subtract every mutation tool ({@link isMutationTool}). Orchestration
|
|
50
|
+
* tools always survive. `task` is always dropped (the coordinator spawns
|
|
51
|
+
* persistent workers, not one-shot delegates — and never recurses). Returns a
|
|
52
|
+
* fresh array; the caller registers these on the coordinator engine.
|
|
53
|
+
*
|
|
54
|
+
* Fail-closed: a persona that lists `edit` / a mutating MCP tool / `bash` / a
|
|
55
|
+
* memory-write tool / any `integration` tool still gets NONE of them.
|
|
56
|
+
*/
|
|
57
|
+
export function filterCoordinatorTools(tools, persona) {
|
|
58
|
+
const allow = persona && persona.tools !== "*" ? new Set(persona.tools) : undefined;
|
|
59
|
+
const deny = new Set(persona?.disallowedTools ?? []);
|
|
60
|
+
const out = [];
|
|
61
|
+
for (const t of tools) {
|
|
62
|
+
if (t.name === TASK_TOOL_NAME)
|
|
63
|
+
continue; // coordinator uses spawn_worker, not task
|
|
64
|
+
// Orchestration tools are exempt from the allowlist + the mutation block.
|
|
65
|
+
if (COORDINATOR_TOOL_NAMES.has(t.name)) {
|
|
66
|
+
out.push(t);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (allow && !allow.has(t.name))
|
|
70
|
+
continue;
|
|
71
|
+
if (deny.has(t.name))
|
|
72
|
+
continue;
|
|
73
|
+
if (isMutationTool(t))
|
|
74
|
+
continue; // fail-closed structural block
|
|
75
|
+
out.push(t);
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* (7.8 §3.3 / codex R1-§8) The dynamic "what your workers can do" context the
|
|
81
|
+
* coordinator's system prompt carries — claude-code injects the worker tool set
|
|
82
|
+
* so the lead directs within the workers' real capabilities. Built from the tool
|
|
83
|
+
* names a worker actually inherits (the parent surface minus `task` and the
|
|
84
|
+
* orchestration tools, which `buildChildEngine` drops). Appended to the
|
|
85
|
+
* coordinator persona's system prompt by the boot wiring.
|
|
86
|
+
*/
|
|
87
|
+
export function coordinatorWorkerToolsNote(parentToolNames) {
|
|
88
|
+
const workerTools = parentToolNames
|
|
89
|
+
.filter((n) => n !== TASK_TOOL_NAME && !COORDINATOR_TOOL_NAMES.has(n))
|
|
90
|
+
.sort();
|
|
91
|
+
const list = workerTools.length > 0 ? workerTools.join(", ") : "(none)";
|
|
92
|
+
return [
|
|
93
|
+
"## Your workers' capabilities",
|
|
94
|
+
`Workers you spawn have FULL tool access: ${list}. They do the reading, editing, running, and verifying.`,
|
|
95
|
+
"Workers CANNOT spawn/message/stop other workers — only you orchestrate. Direct them with specific, self-contained instructions.",
|
|
96
|
+
].join("\n");
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=coordinator-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-mode.js","sourceRoot":"","sources":["../../src/core/coordinator-mode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;;;;;;;GASG;AAEH;;;;wDAIwD;AACxD,MAAM,mBAAmB,GAA8B,IAAI,GAAG,CAAe;IAC3E,YAAY;IACZ,OAAO;IACP,cAAc;IACd,aAAa;CACd,CAAC,CAAC;AAEH;gFACgF;AAChF,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,OAAO;IACP,MAAM;IACN,YAAY;IACZ,WAA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AC,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,eAAkC;IAC3E,MAAM,WAAW,GAAG,eAAe;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,cAAc,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACrE,IAAI,EAAE,CAAC;IACV,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,OAAO;QACL,+BAA+B;QAC/B,4CAA4C,IAAI,yDAAyD;QACzG,iIAAiI;KAClI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type WorkerRegistry } from "@chances-ai/runtime";
|
|
2
|
+
import type { Tool } from "../tools/index.js";
|
|
3
|
+
import { type TaskToolDeps } from "./task-tool.js";
|
|
4
|
+
/**
|
|
5
|
+
* (7.8 §3.2) Dependencies for the coordinator's orchestration tools. Reuses the
|
|
6
|
+
* SAME {@link TaskToolDeps} the one-shot `task` tool consumes (so the persistent
|
|
7
|
+
* worker builds via the shared `createChildAgentRuntime`), plus the
|
|
8
|
+
* {@link WorkerRegistry} that owns the live workers.
|
|
9
|
+
*/
|
|
10
|
+
export interface CoordinatorToolsDeps extends TaskToolDeps {
|
|
11
|
+
workerRegistry: WorkerRegistry;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* (7.8 §3.2) Build the coordinator's orchestration tool set:
|
|
15
|
+
* `spawn_worker` / `send_message` / `stop_worker` / `create_team` /
|
|
16
|
+
* `list_workers`. Registered on the COORDINATOR's main engine ONLY (coordinator
|
|
17
|
+
* mode) — a normal session never sees them, and the one-shot `task` stays the
|
|
18
|
+
* simple-delegation default. All orchestration ops are `isConcurrencySafe:false`
|
|
19
|
+
* (stateful side effects); only `list_workers` is read-only/parallel-safe.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createCoordinatorTools(deps: CoordinatorToolsDeps): Tool[];
|
|
22
|
+
//# sourceMappingURL=coordinator-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-tools.d.ts","sourceRoot":"","sources":["../../src/core/coordinator-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAMxB;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,cAAc,EAAE,cAAc,CAAC;CAChC;AAmBD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,EAAE,CAuPzE"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { AppError, ErrorCode } from "@chances-ai/runtime";
|
|
2
|
+
import { DEFAULT_MAX_TURNS } from "./engine.js";
|
|
3
|
+
import { CREATE_TEAM_TOOL_NAME, DISMISS_WORKER_TOOL_NAME, LIST_WORKERS_TOOL_NAME, SEND_MESSAGE_TOOL_NAME, SPAWN_WORKER_TOOL_NAME, STOP_WORKER_TOOL_NAME, createChildAgentRuntime, } from "./task-tool.js";
|
|
4
|
+
/** Upper bound on a worker child's `maxTurns` — matches the one-shot `task`
|
|
5
|
+
* tool's `CHILD_MAX_TURNS_CEILING` so a worker can't wedge for hours. */
|
|
6
|
+
const WORKER_MAX_TURNS_CEILING = 50;
|
|
7
|
+
function strArg(args, key, required) {
|
|
8
|
+
const v = args[key];
|
|
9
|
+
if (v === undefined || v === null) {
|
|
10
|
+
if (required)
|
|
11
|
+
throw new AppError(ErrorCode.Tool, `Expected string arg "${key}"`);
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (typeof v !== "string") {
|
|
15
|
+
throw new AppError(ErrorCode.Tool, `Expected string arg "${key}"`);
|
|
16
|
+
}
|
|
17
|
+
return v;
|
|
18
|
+
}
|
|
19
|
+
/** A `to` target of the form `team:<id>` → the team id, else null. */
|
|
20
|
+
function teamTarget(to) {
|
|
21
|
+
return to.startsWith("team:") ? to.slice("team:".length) : null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* (7.8 §3.2) Build the coordinator's orchestration tool set:
|
|
25
|
+
* `spawn_worker` / `send_message` / `stop_worker` / `create_team` /
|
|
26
|
+
* `list_workers`. Registered on the COORDINATOR's main engine ONLY (coordinator
|
|
27
|
+
* mode) — a normal session never sees them, and the one-shot `task` stays the
|
|
28
|
+
* simple-delegation default. All orchestration ops are `isConcurrencySafe:false`
|
|
29
|
+
* (stateful side effects); only `list_workers` is read-only/parallel-safe.
|
|
30
|
+
*/
|
|
31
|
+
export function createCoordinatorTools(deps) {
|
|
32
|
+
const reg = deps.workerRegistry;
|
|
33
|
+
const childMaxTurns = Math.min(Math.max(1, deps.maxTurns ?? DEFAULT_MAX_TURNS), WORKER_MAX_TURNS_CEILING);
|
|
34
|
+
const spawnWorker = {
|
|
35
|
+
name: SPAWN_WORKER_TOOL_NAME,
|
|
36
|
+
description: "Spawn a PERSISTENT worker (a child agent that stays alive so you can continue it with send_message, reusing its context). Unlike the one-shot `task` tool, the worker does not die after one reply — direct it to research/implement/verify, then `send_message` it follow-up work or `stop_worker` it if it goes the wrong way. Returns an agent_id you address it by. The worker has full tool access (it does the editing); YOU only direct.",
|
|
37
|
+
category: "integration",
|
|
38
|
+
parameters: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
description: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Short label (1–3 words) for this worker. Shown in the permission prompt and the worker panel.",
|
|
44
|
+
},
|
|
45
|
+
prompt: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "The worker's first instruction. Make it self-contained — include specific file paths, line numbers, and exactly what to do (you must understand the work before delegating it).",
|
|
48
|
+
},
|
|
49
|
+
subagent_type: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "Optional persona from the agent catalog. Omit for a full-inheritance worker.",
|
|
52
|
+
},
|
|
53
|
+
team: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Optional team id (from create_team) to group this worker under, for broadcast / batch-stop.",
|
|
56
|
+
},
|
|
57
|
+
isolation: {
|
|
58
|
+
type: "string",
|
|
59
|
+
enum: ["worktree", "none"],
|
|
60
|
+
description: "'worktree' runs the worker in an isolated git worktree; 'none' (default) shares the working tree.",
|
|
61
|
+
},
|
|
62
|
+
context: {
|
|
63
|
+
type: "string",
|
|
64
|
+
enum: ["fork", "fresh"],
|
|
65
|
+
description: "'fresh' (default) = empty context. 'fork' = inherit a copy of THIS conversation's completed turns as background.",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
required: ["prompt"],
|
|
69
|
+
},
|
|
70
|
+
isConcurrencySafe: () => false,
|
|
71
|
+
summarize: (args) => {
|
|
72
|
+
const prompt = strArg(args, "prompt", true);
|
|
73
|
+
const desc = strArg(args, "description", false);
|
|
74
|
+
const head = prompt.length > 80 ? prompt.slice(0, 80) + "…" : prompt;
|
|
75
|
+
return `spawn_worker${desc ? `[${desc}]` : ""}: ${head}`;
|
|
76
|
+
},
|
|
77
|
+
async execute(args, ctx) {
|
|
78
|
+
const prompt = strArg(args, "prompt", true);
|
|
79
|
+
const team = strArg(args, "team", false);
|
|
80
|
+
if (team !== undefined && !reg.hasTeam(team)) {
|
|
81
|
+
return { ok: false, output: `Unknown team '${team}'. Create it first with create_team.` };
|
|
82
|
+
}
|
|
83
|
+
const built = await createChildAgentRuntime(deps, {
|
|
84
|
+
prompt,
|
|
85
|
+
subagentType: strArg(args, "subagent_type", false),
|
|
86
|
+
isolation: strArg(args, "isolation", false),
|
|
87
|
+
context: strArg(args, "context", false),
|
|
88
|
+
}, childMaxTurns, ctx.signal);
|
|
89
|
+
if (!built.ok)
|
|
90
|
+
return { ok: false, output: built.output };
|
|
91
|
+
try {
|
|
92
|
+
const { agentId } = reg.spawn({
|
|
93
|
+
teamId: team,
|
|
94
|
+
firstPrompt: built.firstPrompt,
|
|
95
|
+
runtime: built.runtime,
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
output: [
|
|
100
|
+
`(worker spawned) agent_id=${agentId} name=${built.runtime.agentName}${team ? ` team=${team}` : ""}`,
|
|
101
|
+
"Continue it with send_message(to: \"" + agentId + "\", message: …); stop it with stop_worker. You will get its result as a <task-notification> on a future turn.",
|
|
102
|
+
].join("\n"),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
// Capacity refusal etc. → AppError(Tool) folded to ok:false.
|
|
107
|
+
if (e instanceof AppError) {
|
|
108
|
+
// worktree was created inside createChildAgentRuntime; close-on-failure
|
|
109
|
+
// happens via finalize() at the registry's next teardown — but since
|
|
110
|
+
// spawn never registered the worker, finalize the runtime now.
|
|
111
|
+
await built.runtime.finalize().catch(() => { });
|
|
112
|
+
await built.runtime.drainPty().catch(() => { });
|
|
113
|
+
return { ok: false, output: e.message };
|
|
114
|
+
}
|
|
115
|
+
throw e;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
const sendMessage = {
|
|
120
|
+
name: SEND_MESSAGE_TOOL_NAME,
|
|
121
|
+
description: "Send a follow-up instruction to a live worker, CONTINUING it on its existing context (it remembers what it already read/did). `to` is an agent_id, a worker name, or `team:<id>` to broadcast to every worker in a team. If the worker is busy the message queues (FIFO); if it's idle/stopped it resumes. Synthesize the worker's prior findings into a concrete spec before sending — never delegate understanding back to it.",
|
|
122
|
+
category: "integration",
|
|
123
|
+
parameters: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
to: { type: "string", description: "agent_id, worker name, or 'team:<id>' to broadcast." },
|
|
127
|
+
message: { type: "string", description: "The follow-up instruction (self-contained, with specifics)." },
|
|
128
|
+
},
|
|
129
|
+
required: ["to", "message"],
|
|
130
|
+
},
|
|
131
|
+
isConcurrencySafe: () => false,
|
|
132
|
+
summarize: (args) => {
|
|
133
|
+
const to = strArg(args, "to", true);
|
|
134
|
+
const msg = strArg(args, "message", true);
|
|
135
|
+
const head = msg.length > 60 ? msg.slice(0, 60) + "…" : msg;
|
|
136
|
+
return `send_message → ${to}: ${head}`;
|
|
137
|
+
},
|
|
138
|
+
async execute(args) {
|
|
139
|
+
const to = strArg(args, "to", true);
|
|
140
|
+
const message = strArg(args, "message", true);
|
|
141
|
+
const team = teamTarget(to);
|
|
142
|
+
if (team !== null) {
|
|
143
|
+
if (!reg.hasTeam(team))
|
|
144
|
+
return { ok: false, output: `Unknown team '${team}'.` };
|
|
145
|
+
const n = reg.broadcast(team, message);
|
|
146
|
+
return { ok: true, output: `Broadcast to ${n} worker(s) in team ${team}.` };
|
|
147
|
+
}
|
|
148
|
+
const delivered = reg.send(to, message);
|
|
149
|
+
if (!delivered) {
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
output: `No live worker matches '${to}' (it may have been stopped-and-evicted or never existed). Use list_workers, or spawn_worker a fresh one.`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return { ok: true, output: `Message queued for worker ${to}.` };
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
const stopWorker = {
|
|
159
|
+
name: STOP_WORKER_TOOL_NAME,
|
|
160
|
+
description: "Stop a worker that's going the wrong way: cancels its in-flight work but KEEPS it resumable (a later send_message continues it on the same context). `to` is an agent_id, a worker name, or `team:<id>` to stop every worker in a team.",
|
|
161
|
+
category: "integration",
|
|
162
|
+
parameters: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
to: { type: "string", description: "agent_id, worker name, or 'team:<id>'." },
|
|
166
|
+
},
|
|
167
|
+
required: ["to"],
|
|
168
|
+
},
|
|
169
|
+
isConcurrencySafe: () => false,
|
|
170
|
+
summarize: (args) => `stop_worker → ${strArg(args, "to", true)}`,
|
|
171
|
+
async execute(args) {
|
|
172
|
+
const to = strArg(args, "to", true);
|
|
173
|
+
const team = teamTarget(to);
|
|
174
|
+
if (team !== null) {
|
|
175
|
+
if (!reg.hasTeam(team))
|
|
176
|
+
return { ok: false, output: `Unknown team '${team}'.` };
|
|
177
|
+
const n = reg.stopTeam(team);
|
|
178
|
+
return { ok: true, output: `Stopped ${n} worker(s) in team ${team}.` };
|
|
179
|
+
}
|
|
180
|
+
const stopped = reg.stop(to);
|
|
181
|
+
if (!stopped)
|
|
182
|
+
return { ok: false, output: `No live worker matches '${to}'.` };
|
|
183
|
+
return { ok: true, output: `Stopped worker ${to} (resumable with send_message).` };
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
const dismissWorker = {
|
|
187
|
+
name: DISMISS_WORKER_TOOL_NAME,
|
|
188
|
+
description: "Permanently dismiss a worker you are DONE with — it is closed (its worktree/PTY finalized) and its capacity slot is freed immediately. Unlike stop_worker (which keeps the worker resumable), a dismissed worker cannot be continued. Use this to reclaim a slot when you hit the worker capacity limit and no longer need a finished worker. `to` is an agent_id, a worker name, or `team:<id>` to dismiss every worker in a team.",
|
|
189
|
+
category: "integration",
|
|
190
|
+
parameters: {
|
|
191
|
+
type: "object",
|
|
192
|
+
properties: {
|
|
193
|
+
to: { type: "string", description: "agent_id, worker name, or 'team:<id>'." },
|
|
194
|
+
},
|
|
195
|
+
required: ["to"],
|
|
196
|
+
},
|
|
197
|
+
isConcurrencySafe: () => false,
|
|
198
|
+
summarize: (args) => `dismiss_worker → ${strArg(args, "to", true)}`,
|
|
199
|
+
async execute(args) {
|
|
200
|
+
const to = strArg(args, "to", true);
|
|
201
|
+
const team = teamTarget(to);
|
|
202
|
+
if (team !== null) {
|
|
203
|
+
if (!reg.hasTeam(team))
|
|
204
|
+
return { ok: false, output: `Unknown team '${team}'.` };
|
|
205
|
+
const n = await reg.dismissTeam(team);
|
|
206
|
+
return { ok: true, output: `Dismissed ${n} worker(s) in team ${team} (slots freed).` };
|
|
207
|
+
}
|
|
208
|
+
// Resolve a name → agentId so a name target works (close() is by agentId).
|
|
209
|
+
const match = reg.listWorkers().find((w) => w.agentId === to || w.name === to);
|
|
210
|
+
const dismissed = match ? await reg.close(match.agentId) : false;
|
|
211
|
+
if (!dismissed)
|
|
212
|
+
return { ok: false, output: `No live worker matches '${to}'.` };
|
|
213
|
+
return { ok: true, output: `Dismissed worker ${to} (slot freed; not resumable).` };
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
const createTeam = {
|
|
217
|
+
name: CREATE_TEAM_TOOL_NAME,
|
|
218
|
+
description: "Create a team to group related workers. Returns a team_id; pass it as spawn_worker's `team`, then send_message/stop_worker with `to: \"team:<id>\"` to broadcast / batch-stop.",
|
|
219
|
+
category: "integration",
|
|
220
|
+
parameters: {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties: {
|
|
223
|
+
name: { type: "string", description: "Human-readable team label." },
|
|
224
|
+
},
|
|
225
|
+
required: ["name"],
|
|
226
|
+
},
|
|
227
|
+
isConcurrencySafe: () => false,
|
|
228
|
+
summarize: (args) => `create_team: ${strArg(args, "name", true)}`,
|
|
229
|
+
async execute(args) {
|
|
230
|
+
const name = strArg(args, "name", true);
|
|
231
|
+
const { teamId } = reg.createTeam(name);
|
|
232
|
+
return { ok: true, output: `(team created) team_id=${teamId} name=${name}` };
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
const listWorkers = {
|
|
236
|
+
name: LIST_WORKERS_TOOL_NAME,
|
|
237
|
+
description: "List your live workers and their status (running / idle / stopped / failed), optionally filtered by team. Use it to see what's in flight before directing more work.",
|
|
238
|
+
category: "file-read",
|
|
239
|
+
parameters: {
|
|
240
|
+
type: "object",
|
|
241
|
+
properties: {
|
|
242
|
+
team: { type: "string", description: "Optional team id to filter by." },
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
isConcurrencySafe: () => true,
|
|
246
|
+
summarize: (args) => {
|
|
247
|
+
const team = strArg(args, "team", false);
|
|
248
|
+
return team ? `list_workers (team ${team})` : "list_workers";
|
|
249
|
+
},
|
|
250
|
+
async execute(args) {
|
|
251
|
+
const team = strArg(args, "team", false);
|
|
252
|
+
const workers = reg.listWorkers(team);
|
|
253
|
+
if (workers.length === 0) {
|
|
254
|
+
return { ok: true, output: team ? `No workers in team ${team}.` : "No live workers." };
|
|
255
|
+
}
|
|
256
|
+
const lines = workers.map((w) => `- ${w.agentId} "${w.name}" [${w.status}]${w.teamId ? ` team=${w.teamId}` : ""} turns=${w.turnsRun} queued=${w.queued} — ${w.lastMessageHead}`);
|
|
257
|
+
return { ok: true, output: lines.join("\n") };
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
return [spawnWorker, sendMessage, stopWorker, dismissWorker, createTeam, listWorkers];
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=coordinator-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-tools.js","sourceRoot":"","sources":["../../src/core/coordinator-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,gBAAgB,CAAC;AAExB;yEACyE;AACzE,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAYpC,SAAS,MAAM,CAAC,IAAe,EAAE,GAAW,EAAE,QAAiB;IAC7D,MAAM,CAAC,GAAI,IAAkC,CAAC,GAAG,CAAC,CA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