@te-river/opencode-team-mode 1.6.0 → 1.6.1
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 +80 -15
- package/README.zh-CN.md +67 -18
- package/dist/host/note.d.ts +7 -0
- package/dist/host/note.d.ts.map +1 -0
- package/dist/host/note.js +28 -0
- package/dist/host/note.js.map +1 -0
- package/dist/host/v1.d.ts +14 -0
- package/dist/host/v1.d.ts.map +1 -0
- package/dist/host/v1.js +340 -0
- package/dist/host/v1.js.map +1 -0
- package/dist/host/v2-browser-gate.d.ts +45 -0
- package/dist/host/v2-browser-gate.d.ts.map +1 -0
- package/dist/host/v2-browser-gate.js +319 -0
- package/dist/host/v2-browser-gate.js.map +1 -0
- package/dist/host/v2-capabilities.d.ts +68 -0
- package/dist/host/v2-capabilities.d.ts.map +1 -0
- package/dist/host/v2-capabilities.js +146 -0
- package/dist/host/v2-capabilities.js.map +1 -0
- package/dist/host/v2-client.d.ts +53 -0
- package/dist/host/v2-client.d.ts.map +1 -0
- package/dist/host/v2-client.js +193 -0
- package/dist/host/v2-client.js.map +1 -0
- package/dist/host/v2-events.d.ts +56 -0
- package/dist/host/v2-events.d.ts.map +1 -0
- package/dist/host/v2-events.js +158 -0
- package/dist/host/v2-events.js.map +1 -0
- package/dist/host/v2-guard.d.ts +101 -0
- package/dist/host/v2-guard.d.ts.map +1 -0
- package/dist/host/v2-guard.js +199 -0
- package/dist/host/v2-guard.js.map +1 -0
- package/dist/host/v2-offload.d.ts +148 -0
- package/dist/host/v2-offload.d.ts.map +1 -0
- package/dist/host/v2-offload.js +288 -0
- package/dist/host/v2-offload.js.map +1 -0
- package/dist/host/v2-permissions.d.ts +123 -0
- package/dist/host/v2-permissions.d.ts.map +1 -0
- package/dist/host/v2-permissions.js +190 -0
- package/dist/host/v2-permissions.js.map +1 -0
- package/dist/host/v2-probe.d.ts +85 -0
- package/dist/host/v2-probe.d.ts.map +1 -0
- package/dist/host/v2-probe.js +268 -0
- package/dist/host/v2-probe.js.map +1 -0
- package/dist/host/v2-scope.d.ts +51 -0
- package/dist/host/v2-scope.d.ts.map +1 -0
- package/dist/host/v2-scope.js +58 -0
- package/dist/host/v2-scope.js.map +1 -0
- package/dist/host/v2-session-client.d.ts +74 -0
- package/dist/host/v2-session-client.d.ts.map +1 -0
- package/dist/host/v2-session-client.js +171 -0
- package/dist/host/v2-session-client.js.map +1 -0
- package/dist/host/v2-session.d.ts +85 -0
- package/dist/host/v2-session.d.ts.map +1 -0
- package/dist/host/v2-session.js +171 -0
- package/dist/host/v2-session.js.map +1 -0
- package/dist/host/v2-subagent.d.ts +157 -0
- package/dist/host/v2-subagent.d.ts.map +1 -0
- package/dist/host/v2-subagent.js +286 -0
- package/dist/host/v2-subagent.js.map +1 -0
- package/dist/host/v2-tool.d.ts +67 -0
- package/dist/host/v2-tool.d.ts.map +1 -0
- package/dist/host/v2-tool.js +209 -0
- package/dist/host/v2-tool.js.map +1 -0
- package/dist/host/v2-transcript.d.ts +73 -0
- package/dist/host/v2-transcript.d.ts.map +1 -0
- package/dist/host/v2-transcript.js +151 -0
- package/dist/host/v2-transcript.js.map +1 -0
- package/dist/host/v2-types.d.ts +229 -0
- package/dist/host/v2-types.d.ts.map +1 -0
- package/dist/host/v2-types.js +17 -0
- package/dist/host/v2-types.js.map +1 -0
- package/dist/host/v2.d.ts +42 -0
- package/dist/host/v2.d.ts.map +1 -0
- package/dist/host/v2.js +706 -0
- package/dist/host/v2.js.map +1 -0
- package/dist/index.d.ts +23 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -366
- package/dist/index.js.map +1 -1
- package/dist/prompts/lead.d.ts +1 -1
- package/dist/prompts/lead.d.ts.map +1 -1
- package/dist/prompts/lead.js +452 -426
- package/dist/prompts/lead.js.map +1 -1
- package/dist/prompts/shared.d.ts +2 -2
- package/dist/prompts/shared.d.ts.map +1 -1
- package/dist/prompts/shared.js +30 -10
- package/dist/prompts/shared.js.map +1 -1
- package/dist/prompts/specialists.d.ts +2 -2
- package/dist/prompts/specialists.d.ts.map +1 -1
- package/dist/prompts/specialists.js +7 -6
- package/dist/prompts/specialists.js.map +1 -1
- package/dist/task-offload.d.ts +16 -0
- package/dist/task-offload.d.ts.map +1 -1
- package/dist/task-offload.js +51 -0
- package/dist/task-offload.js.map +1 -1
- package/dist/tm/browser.d.ts.map +1 -1
- package/dist/tm/browser.js +41 -10
- package/dist/tm/browser.js.map +1 -1
- package/dist/tm/dispatch.d.ts +47 -0
- package/dist/tm/dispatch.d.ts.map +1 -1
- package/dist/tm/dispatch.js +230 -31
- package/dist/tm/dispatch.js.map +1 -1
- package/dist/tm/dupe-guard.d.ts +16 -3
- package/dist/tm/dupe-guard.d.ts.map +1 -1
- package/dist/tm/dupe-guard.js +27 -7
- package/dist/tm/dupe-guard.js.map +1 -1
- package/dist/tm/index.d.ts +40 -1
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +40 -11
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/ledger.d.ts +114 -0
- package/dist/tm/ledger.d.ts.map +1 -0
- package/dist/tm/ledger.js +308 -0
- package/dist/tm/ledger.js.map +1 -0
- package/dist/tm/perm-ask.d.ts +1 -3
- package/dist/tm/perm-ask.d.ts.map +1 -1
- package/dist/tm/perm-ask.js +10 -1
- package/dist/tm/perm-ask.js.map +1 -1
- package/dist/tm/preview.d.ts +55 -0
- package/dist/tm/preview.d.ts.map +1 -1
- package/dist/tm/preview.js +225 -0
- package/dist/tm/preview.js.map +1 -1
- package/dist/tm/search.d.ts.map +1 -1
- package/dist/tm/search.js +40 -10
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/serp-loop.d.ts +45 -0
- package/dist/tm/serp-loop.d.ts.map +1 -0
- package/dist/tm/serp-loop.js +80 -0
- package/dist/tm/serp-loop.js.map +1 -0
- package/dist/tm/stats.d.ts +10 -0
- package/dist/tm/stats.d.ts.map +1 -1
- package/dist/tm/stats.js +160 -0
- package/dist/tm/stats.js.map +1 -1
- package/dist/tm/webfetch.d.ts +4 -0
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +75 -8
- package/dist/tm/webfetch.js.map +1 -1
- package/docs/installation-v2.md +436 -0
- package/docs/installation.md +12 -0
- package/docs/research/agent-data-exchange.md +117 -0
- package/docs/research/browser-pane.md +89 -0
- package/docs/research/host-http-api.md +132 -0
- package/docs/research/host-subagent-injection.md +187 -0
- package/docs/research/plugin-loader-contract.md +261 -0
- package/docs/research/v2-builtin-tools.md +447 -0
- package/docs/v2-port-notes.md +315 -0
- package/index.js +7 -0
- package/package.json +64 -61
- package/scripts/gen-v2-config.mjs +304 -0
- package/scripts/lib/config-surgery.cjs +239 -0
- package/scripts/lib/fake-ctx.mjs +146 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The v2 host's own sub-agents, made collectable by `tm_join` (decision 4, 2026-09-26).
|
|
3
|
+
*
|
|
4
|
+
* What was broken: on v2 every dispatch goes through the host's `subagent` tool (v1's
|
|
5
|
+
* `tm_dispatch` is gone and the plugin forces `background:true`), so the child session
|
|
6
|
+
* was never entered into `tm_join`'s registry. `tm_join` then answered 没有待收集的派发
|
|
7
|
+
* about work that was running on screen, a wait could never end, and the lead had to
|
|
8
|
+
* re-read the round from the injected message like a person paging through mail. The
|
|
9
|
+
* event feed added in 1.7.x made this worse in the specific way goal #6 refuses: the
|
|
10
|
+
* dispatcher ignores a session id it has no record of, so a settled child produced
|
|
11
|
+
* silence that read as "nothing to report".
|
|
12
|
+
*
|
|
13
|
+
* Why these two hooks and not a session query: the v2 plugin ctx has no
|
|
14
|
+
* `session.children` and our `ctx.session.get` bridge has never resolved a shape on a
|
|
15
|
+
* live host, so a tree walk is not available. What IS available is measured, from the
|
|
16
|
+
* user's own desktop session (`docs/research/host-subagent-injection.md`):
|
|
17
|
+
*
|
|
18
|
+
* execute.before subagent {agent, background, description, prompt}
|
|
19
|
+
* execute.after result.metadata = {sessionID:"ses_…", status:"running", truncated:false}
|
|
20
|
+
* result text "The subagent is working in the background
|
|
21
|
+
* (sessionID: ses_…). You will be notified…"
|
|
22
|
+
* later, as a message the plugin never sees as a tool result:
|
|
23
|
+
* metadata {source:"subagent", childID:"ses_…", agent, state}
|
|
24
|
+
* text <subagent sessionID="ses_…" state="completed" …>body</subagent>
|
|
25
|
+
*
|
|
26
|
+
* So the before hook supplies who and what-for, the after hook supplies the child's id,
|
|
27
|
+
* and the pairing is per CALLER session — a lead that fires three dispatches in one round
|
|
28
|
+
* gets three pending rows and pairs them oldest-first as the acks come back.
|
|
29
|
+
*
|
|
30
|
+
* The reply BODY is deliberately not promised: it reaches the parent as an injected
|
|
31
|
+
* message, not through this seam, so a registered child reports where its answer comes
|
|
32
|
+
* from instead of pretending we can fetch it. Claiming to hold a report we never read
|
|
33
|
+
* is the defect this product exists to refuse.
|
|
34
|
+
*
|
|
35
|
+
* Privacy: the trajectory records the child id and the agent name only — never the
|
|
36
|
+
* description or the prompt (R6 binds a diagnostic as much as a guard).
|
|
37
|
+
*/
|
|
38
|
+
/** How many unclaimed acks one caller may have in flight before we stop guessing which
|
|
39
|
+
* `description` belongs to which child. Past this the child is registered with a
|
|
40
|
+
* generic label rather than a possibly-wrong one. */
|
|
41
|
+
export const PENDING_PER_CALLER = 8;
|
|
42
|
+
/** Read the dispatch out of the tool input (the host's `execute.before` field is
|
|
43
|
+
* `input`, and it IS the argument object). Returns null for anything that is not a
|
|
44
|
+
* recognisable `subagent` call — a non-object input is left alone, never invented. */
|
|
45
|
+
export function pendingDispatchOf(raw, at = Date.now()) {
|
|
46
|
+
if (!raw || typeof raw !== "object")
|
|
47
|
+
return null;
|
|
48
|
+
const a = raw;
|
|
49
|
+
const agent = typeof a.agent === "string" ? a.agent.trim().toLowerCase() : "";
|
|
50
|
+
if (!agent)
|
|
51
|
+
return null;
|
|
52
|
+
const desc = typeof a.description === "string" ? a.description.trim() : "";
|
|
53
|
+
return { agent, label: (desc || "host subagent").slice(0, 40), at };
|
|
54
|
+
}
|
|
55
|
+
/** The child's session id, from the two places the host puts it (measured). A
|
|
56
|
+
* synchronous child DOES have a `metadata.sessionID` — the host always sets
|
|
57
|
+
* `{sessionID, status}` — but its `status` is already `completed` and its content IS the
|
|
58
|
+
* reply, so there is nothing to
|
|
59
|
+
* collect and null is the correct answer, not a failure. */
|
|
60
|
+
export function hostChildIdOf(result) {
|
|
61
|
+
const r = result;
|
|
62
|
+
if (!r || typeof r !== "object")
|
|
63
|
+
return null;
|
|
64
|
+
const meta = r.metadata;
|
|
65
|
+
const fromMeta = typeof meta?.sessionID === "string" ? meta.sessionID.trim() : "";
|
|
66
|
+
if (fromMeta)
|
|
67
|
+
return fromMeta;
|
|
68
|
+
// The ack sentence, as a fallback: metadata is the host's own field and the text is
|
|
69
|
+
// what the model reads, so a shape change in one of the two still leaves a path.
|
|
70
|
+
const parts = Array.isArray(r.content) ? r.content : [];
|
|
71
|
+
for (const p of parts) {
|
|
72
|
+
if (typeof p?.text !== "string")
|
|
73
|
+
continue;
|
|
74
|
+
const m = /sessionID:\s*(ses_[A-Za-z0-9]+)/.exec(p.text);
|
|
75
|
+
if (m)
|
|
76
|
+
return m[1];
|
|
77
|
+
}
|
|
78
|
+
const flat = typeof r.output === "string" ? /sessionID:\s*(ses_[A-Za-z0-9]+)/.exec(r.output) : null;
|
|
79
|
+
return flat ? flat[1] : null;
|
|
80
|
+
}
|
|
81
|
+
/** True when the ack says the child is still open — i.e. worth registering. Read from
|
|
82
|
+
* the host's own code (2.0.18): the `subagent` result always carries
|
|
83
|
+
* `metadata:{sessionID, status}`, and a SYNCHRONOUS child arrives with
|
|
84
|
+
* `status:"completed"` and the body itself, so there is nothing left to collect. A
|
|
85
|
+
* `status` we do not recognise registers anyway, because a missed child costs the lead a
|
|
86
|
+
* whole round while a spurious row only costs a line in a table. */
|
|
87
|
+
export function hostChildIsOpen(result) {
|
|
88
|
+
const meta = result?.metadata;
|
|
89
|
+
return String(meta?.status ?? "running").toLowerCase() !== "completed";
|
|
90
|
+
}
|
|
91
|
+
/** The host's own completion envelope, in either generation's spelling. Returns the child
|
|
92
|
+
* id and the state the host asserted, or null when the text is not an injection.
|
|
93
|
+
* `[B]` 2.0.18 builds the wrapper as `<subagent sessionID="…" state="completed" …>`; v1
|
|
94
|
+
* used `<task id="…" state="completed">`. Both are matched because a plugin reload can
|
|
95
|
+
* serve a session whose history contains either. */
|
|
96
|
+
export function completionFromText(text) {
|
|
97
|
+
const m = /<(?:subagent|task)\s[^>]*?(?:sessionID|id)="(ses_[A-Za-z0-9]+)"[^>]*?state="([a-zA-Z_]+)"/.exec(text);
|
|
98
|
+
return m ? { sessionID: m[1], state: m[2].toLowerCase() } : null;
|
|
99
|
+
}
|
|
100
|
+
/** Pull the candidate text out of whatever a hook payload carries. Names only are ever
|
|
101
|
+
* reported; the text itself is read to find an envelope and is not stored. */
|
|
102
|
+
function textsOf(payload) {
|
|
103
|
+
const p = payload;
|
|
104
|
+
if (!p || typeof p !== "object")
|
|
105
|
+
return [];
|
|
106
|
+
const out = [];
|
|
107
|
+
const push = (v) => { if (typeof v === "string" && v)
|
|
108
|
+
out.push(v); };
|
|
109
|
+
push(p.text);
|
|
110
|
+
for (const key of ["parts", "messages"]) {
|
|
111
|
+
const arr = p[key];
|
|
112
|
+
if (!Array.isArray(arr))
|
|
113
|
+
continue;
|
|
114
|
+
for (const item of arr) {
|
|
115
|
+
const rec = item;
|
|
116
|
+
push(rec?.text);
|
|
117
|
+
// A v2 message is `{info, parts[]}` and a provider message is `{role, content[]}`;
|
|
118
|
+
// the envelope can ride either, and reading only one of them is how this watcher
|
|
119
|
+
// fired on every hook and settled nothing (caught by the suite, not by the host).
|
|
120
|
+
for (const listKey of ["parts", "content"]) {
|
|
121
|
+
const list = rec?.[listKey];
|
|
122
|
+
if (!Array.isArray(list))
|
|
123
|
+
continue;
|
|
124
|
+
for (const c of list)
|
|
125
|
+
push(c?.text);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The settle path for a child the plugin never created (#31, 2026-09-26).
|
|
133
|
+
*
|
|
134
|
+
* A live 2.0.18 round proved the two obvious paths do not work: the host does NOT forward a
|
|
135
|
+
* child session's `session.idle` to a plugin subscriber, and the parent-idle presumption
|
|
136
|
+
* cannot fire mid-turn because the parent is by definition busy while it works. So a
|
|
137
|
+
* background child whose full report had ALREADY been injected stayed 运行中 — goal #6's
|
|
138
|
+
* overstated claim wearing the opposite face.
|
|
139
|
+
*
|
|
140
|
+
* A second round then proved a hook can exist and still be the wrong one: `session.prompt`
|
|
141
|
+
* fired 0 times and `session.model.request` fired 6 but carried no messages at all (the
|
|
142
|
+
* message list is assembled separately from that payload). The seam that DOES carry the
|
|
143
|
+
* parent's history is `session.hook("context")` — the same one the request trim and the
|
|
144
|
+
* probe read, and the one whose `messages` the probe counted at 8 in that round.
|
|
145
|
+
*
|
|
146
|
+
* So: watch `context`, and only when something is actually open. The scan is O(messages)
|
|
147
|
+
* per request, which is a real cost on a long-lived lead session, so an idle registry skips
|
|
148
|
+
* it entirely and the skip is counted — "we did not look because there was nothing to look
|
|
149
|
+
* for" stays distinguishable from "we looked and saw nothing".
|
|
150
|
+
*
|
|
151
|
+
* `session.prompt` is kept registered and counted as well: it costs nothing, and if a future
|
|
152
|
+
* host routes the injection through it, the counter is where we would learn that.
|
|
153
|
+
*/
|
|
154
|
+
export function applyV2CompletionWatch(ctx, deps) {
|
|
155
|
+
const report = { contextFired: 0, promptFired: 0, seen: 0, settled: 0, skipped: 0 };
|
|
156
|
+
const session = ctx?.session;
|
|
157
|
+
const hook = session?.hook;
|
|
158
|
+
if (typeof hook !== "function")
|
|
159
|
+
return { registrations: [], report, active: false };
|
|
160
|
+
const reg = hook;
|
|
161
|
+
const scan = (which) => (raw) => {
|
|
162
|
+
try {
|
|
163
|
+
const event = raw;
|
|
164
|
+
if (deps.scope && deps.scope.count(deps.scope.decide(event)) !== "ours")
|
|
165
|
+
return;
|
|
166
|
+
if (which === "context")
|
|
167
|
+
report.contextFired++;
|
|
168
|
+
else
|
|
169
|
+
report.promptFired++;
|
|
170
|
+
if (deps.hasOpen && !deps.hasOpen()) {
|
|
171
|
+
report.skipped++;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
for (const text of textsOf(raw)) {
|
|
175
|
+
const c = completionFromText(text);
|
|
176
|
+
if (!c)
|
|
177
|
+
continue;
|
|
178
|
+
report.seen++;
|
|
179
|
+
if (deps.settle(c.sessionID, c.state))
|
|
180
|
+
report.settled++;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
/* a diagnostic may never block a request */
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
return {
|
|
188
|
+
registrations: [reg("context", scan("context")), reg("prompt", scan("prompt"))],
|
|
189
|
+
report,
|
|
190
|
+
active: true,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export function applyV2SubagentRegistry(ctx, deps) {
|
|
194
|
+
const report = { seen: 0, registered: 0, noChildId: 0, settledAtOnce: 0, unpaired: 0, labelGuessed: 0 };
|
|
195
|
+
const hook = ctx?.tool?.hook;
|
|
196
|
+
if (typeof hook !== "function")
|
|
197
|
+
return { registrations: [], report, active: false };
|
|
198
|
+
const now = deps.now ?? (() => Date.now());
|
|
199
|
+
const pending = new Map();
|
|
200
|
+
const reg = hook;
|
|
201
|
+
const ours = (event) => {
|
|
202
|
+
if (!deps.scope)
|
|
203
|
+
return true;
|
|
204
|
+
if (deps.scope.count(deps.scope.decide(event)) !== "ours")
|
|
205
|
+
return false;
|
|
206
|
+
deps.scope.learn(event.agent, event.sessionID);
|
|
207
|
+
return true;
|
|
208
|
+
};
|
|
209
|
+
const before = reg("execute.before", (raw) => {
|
|
210
|
+
// The host's own field name is `input` — read out of 2.0.18:
|
|
211
|
+
// e.trigger("tool","execute.before",{tool,sessionID,agent,messageID,id,input:m})
|
|
212
|
+
// Reading `args` here was the live-round failure: the stash silently stayed empty,
|
|
213
|
+
// so every ack arrived unpaired and the child was registered under a generic label
|
|
214
|
+
// instead of the role and task it was dispatched for.
|
|
215
|
+
const event = raw;
|
|
216
|
+
try {
|
|
217
|
+
if (String(event?.tool ?? "") !== "subagent")
|
|
218
|
+
return;
|
|
219
|
+
if (!ours(event))
|
|
220
|
+
return;
|
|
221
|
+
const p = pendingDispatchOf(event?.input, now());
|
|
222
|
+
if (!p)
|
|
223
|
+
return;
|
|
224
|
+
const caller = String(event.sessionID ?? "").trim();
|
|
225
|
+
if (!caller)
|
|
226
|
+
return;
|
|
227
|
+
const list = pending.get(caller) ?? [];
|
|
228
|
+
list.push(p);
|
|
229
|
+
// Bounded, oldest-first: an unbounded map is how a long-lived lead process grows,
|
|
230
|
+
// and past the cap the pairing stops being a fact.
|
|
231
|
+
if (list.length > PENDING_PER_CALLER)
|
|
232
|
+
list.splice(0, list.length - PENDING_PER_CALLER);
|
|
233
|
+
pending.set(caller, list);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
/* a diagnostic may never break a dispatch */
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const after = reg("execute.after", (raw) => {
|
|
240
|
+
const event = raw;
|
|
241
|
+
try {
|
|
242
|
+
if (String(event?.tool ?? "") !== "subagent")
|
|
243
|
+
return;
|
|
244
|
+
if (!ours(event))
|
|
245
|
+
return;
|
|
246
|
+
report.seen++;
|
|
247
|
+
const child = hostChildIdOf(event?.result);
|
|
248
|
+
if (!child) {
|
|
249
|
+
report.noChildId++;
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const caller = String(event.sessionID ?? "").trim();
|
|
253
|
+
if (!caller || caller === child)
|
|
254
|
+
return;
|
|
255
|
+
if (!hostChildIsOpen(event?.result)) {
|
|
256
|
+
report.settledAtOnce++; // a synchronous child: its result IS the reply
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const list = pending.get(caller) ?? [];
|
|
260
|
+
const p = list.shift();
|
|
261
|
+
if (list.length >= PENDING_PER_CALLER)
|
|
262
|
+
report.labelGuessed++;
|
|
263
|
+
if (!p)
|
|
264
|
+
report.unpaired++;
|
|
265
|
+
const opened = deps.register({
|
|
266
|
+
sessionID: child,
|
|
267
|
+
parentSessionID: caller,
|
|
268
|
+
agent: p?.agent ?? "subagent",
|
|
269
|
+
// An unpaired ack still deserves a row: the child exists and the user can see
|
|
270
|
+
// it. What we do not do is invent a task name for it.
|
|
271
|
+
label: p?.label ?? "宿主子代理(未配到派发)",
|
|
272
|
+
});
|
|
273
|
+
if (opened)
|
|
274
|
+
report.registered++;
|
|
275
|
+
if (list.length)
|
|
276
|
+
pending.set(caller, list);
|
|
277
|
+
else
|
|
278
|
+
pending.delete(caller);
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
/* never throw into the host's hook */
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return { registrations: [before, after], report, active: true };
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=v2-subagent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2-subagent.js","sourceRoot":"","sources":["../../src/host/v2-subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAoBH;;sDAEsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC;;uFAEuF;AACvF,MAAM,UAAU,iBAAiB,CAAC,GAAY,EAAE,KAAa,IAAI,CAAC,GAAG,EAAE;IACrE,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAChD,MAAM,CAAC,GAAG,GAA8B,CAAA;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC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ions -> v2 tool registrations.
|
|
3
|
+
*
|
|
4
|
+
* Two shapes have to be translated, and both translations are load-bearing:
|
|
5
|
+
*
|
|
6
|
+
* 1. THE RESULT. v1 tools answer `{output: string, attachments?: [...]}`. A
|
|
7
|
+
* live probe measured what the v2 host does with that: every tool that
|
|
8
|
+
* returned a bare `output` without declaring an `output` schema came back as
|
|
9
|
+
* "Tool result declared output without an output schema". So the v2 adapter
|
|
10
|
+
* answers with `content` parts instead — text plus `file` entries, which is
|
|
11
|
+
* also the first time tm_browser's screenshot attachment has had a host
|
|
12
|
+
* contract we can VERIFY rather than assume (the v1 capability row for it is
|
|
13
|
+
* still 未验证).
|
|
14
|
+
* 2. THE CONTEXT. Our tools read `{directory, sessionID, agent, ask}` off the
|
|
15
|
+
* per-call ctx. v2's ToolContext carries `{sessionID, agent, messageID, id,
|
|
16
|
+
* progress}` and NO directory and NO ask bridge. Directory comes from the
|
|
17
|
+
* boot location; the missing ask bridge is left missing on purpose, because
|
|
18
|
+
* `askFnOf` then reports "unavailable" and every governed call fails CLOSED
|
|
19
|
+
* rather than pretending somebody approved it.
|
|
20
|
+
*/
|
|
21
|
+
import type { ToolDefinition } from "../types.js";
|
|
22
|
+
import type { V2ToolContext, V2ToolInfo, V2ToolResult } from "./v2-types.js";
|
|
23
|
+
/**
|
|
24
|
+
* `args` is a ZodRawShape (see `src/tm/args-schema.ts`) — but it is a
|
|
25
|
+
* *descriptor* when zod could not be loaded, and it may already be a JSON
|
|
26
|
+
* Schema. `exact:false` means the model gets no parameter guidance for this
|
|
27
|
+
* tool, which the caller reports instead of hiding: a tool the model cannot
|
|
28
|
+
* call correctly is a tool that is broken, whatever the code says.
|
|
29
|
+
*/
|
|
30
|
+
export declare function inputSchemaFor(args: unknown): Promise<{
|
|
31
|
+
schema: Record<string, unknown>;
|
|
32
|
+
exact: boolean;
|
|
33
|
+
source: string;
|
|
34
|
+
note?: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** The per-execute literal our pipelines expect. */
|
|
37
|
+
export declare function v2ToolCtx(ctx: V2ToolContext, directory: string): Record<string, unknown>;
|
|
38
|
+
export declare function v2Result(res: unknown): V2ToolResult;
|
|
39
|
+
export interface V2ToolBinding {
|
|
40
|
+
readonly tool: V2ToolInfo;
|
|
41
|
+
readonly inputExact: boolean;
|
|
42
|
+
/** How the schema was obtained: "zod" | "json-schema" | "descriptor" |
|
|
43
|
+
* "permissive". `exact` alone cannot tell a translated zod shape from a
|
|
44
|
+
* regex read of a descriptor string, and the boot log must not claim the
|
|
45
|
+
* two are the same fact. */
|
|
46
|
+
readonly inputSource: string;
|
|
47
|
+
readonly note?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Wrap one v1 ToolDefinition. `execute` may be absent on exotic hosts; a tool
|
|
51
|
+
* that cannot run must not be registered at all, because the model would spend
|
|
52
|
+
* a round on it and get nothing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function bindV2Tool(name: string, def: ToolDefinition, directory: string,
|
|
55
|
+
/** Every call to OUR tool tells the host-scope resolver which sessions belong to
|
|
56
|
+
* Team (#22) — the one fact about a session we can learn from the inside. */
|
|
57
|
+
onCall?: (agent: unknown, sessionID: unknown) => void,
|
|
58
|
+
/** `codemodeDirect: true` sends `options:{codemode:false}`, which the 2.0.16
|
|
59
|
+
* binary uses as the visibility switch: without it a registered tool reaches the
|
|
60
|
+
* model ONLY inside the Code Mode catalog, with its description cut to the first
|
|
61
|
+
* line — so every governance sentence we wrote below that line never arrives.
|
|
62
|
+
* Off by default because the cost is the whole definition set riding every
|
|
63
|
+
* request; the number is measured, not argued (see TM_V2_CODEMODE). */
|
|
64
|
+
opts?: {
|
|
65
|
+
codemodeDirect?: boolean;
|
|
66
|
+
}): Promise<V2ToolBinding | null>;
|
|
67
|
+
//# sourceMappingURL=v2-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2-tool.d.ts","sourceRoot":"","sources":["../../src/host/v2-tool.ts"],"names":[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
|
+
/**
|
|
2
|
+
* v1 tool definitions -> v2 tool registrations.
|
|
3
|
+
*
|
|
4
|
+
* Two shapes have to be translated, and both translations are load-bearing:
|
|
5
|
+
*
|
|
6
|
+
* 1. THE RESULT. v1 tools answer `{output: string, attachments?: [...]}`. A
|
|
7
|
+
* live probe measured what the v2 host does with that: every tool that
|
|
8
|
+
* returned a bare `output` without declaring an `output` schema came back as
|
|
9
|
+
* "Tool result declared output without an output schema". So the v2 adapter
|
|
10
|
+
* answers with `content` parts instead — text plus `file` entries, which is
|
|
11
|
+
* also the first time tm_browser's screenshot attachment has had a host
|
|
12
|
+
* contract we can VERIFY rather than assume (the v1 capability row for it is
|
|
13
|
+
* still 未验证).
|
|
14
|
+
* 2. THE CONTEXT. Our tools read `{directory, sessionID, agent, ask}` off the
|
|
15
|
+
* per-call ctx. v2's ToolContext carries `{sessionID, agent, messageID, id,
|
|
16
|
+
* progress}` and NO directory and NO ask bridge. Directory comes from the
|
|
17
|
+
* boot location; the missing ask bridge is left missing on purpose, because
|
|
18
|
+
* `askFnOf` then reports "unavailable" and every governed call fails CLOSED
|
|
19
|
+
* rather than pretending somebody approved it.
|
|
20
|
+
*/
|
|
21
|
+
/** zod is a peer the host ships, never a dependency we require: the same
|
|
22
|
+
* variable-specifier trick `args-schema.ts` uses for the arg schemas. */
|
|
23
|
+
async function loadZod() {
|
|
24
|
+
try {
|
|
25
|
+
const spec = "zod";
|
|
26
|
+
const mod = (await import(spec));
|
|
27
|
+
const z = (mod.z ?? mod.default?.z);
|
|
28
|
+
return z && typeof z.object === "function" ? z : null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** A descriptor entry: `{ key: { descriptor: "name: type (…) — guidance" } }`.
|
|
35
|
+
* Three tools ship this shape (tm_join / tm_pty / tm_stats) because their args
|
|
36
|
+
* are built without zod, and feeding it to `z.object()` throws
|
|
37
|
+
* `undefined is not an object (evaluating 'schema._zod.def')` — measured live,
|
|
38
|
+
* where those three reached the model with NO parameter guidance at all.
|
|
39
|
+
* The descriptor's leading `name: type` is parseable, and the whole string is
|
|
40
|
+
* the guidance, so translating it is strictly better than a permissive schema. */
|
|
41
|
+
const DESCRIPTOR_HEAD = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*([\s\S]*)$/;
|
|
42
|
+
/** `typed` is what follows the `name:` in the descriptor — the type is read off
|
|
43
|
+
* its first token. Passing the whole line instead would read the parameter
|
|
44
|
+
* NAME plus its colon (`action:`), which matches no type shape at all, so every
|
|
45
|
+
* descriptor would collapse to `string` and the enum/array/number guidance
|
|
46
|
+
* would be silently lost. `full` stays the description verbatim: the guidance
|
|
47
|
+
* after the type is the part the model actually needs. */
|
|
48
|
+
function descriptorToProperty(full, typed) {
|
|
49
|
+
const head = (typed.trim().match(/^[^\s(,]+/) ?? [""])[0];
|
|
50
|
+
let type = "string";
|
|
51
|
+
let enumValues;
|
|
52
|
+
if (/^[A-Za-z][\w.]*\[\]$/.test(head)) {
|
|
53
|
+
type = "array";
|
|
54
|
+
}
|
|
55
|
+
else if (/^\d+$/.test(head) || /^(number|int|integer)/i.test(head)) {
|
|
56
|
+
type = "number";
|
|
57
|
+
}
|
|
58
|
+
else if (/^(true|false|boolean)$/i.test(head)) {
|
|
59
|
+
type = "boolean";
|
|
60
|
+
}
|
|
61
|
+
else if (/^[A-Za-z0-9_|-]*\|[A-Za-z0-9_|-]+$/.test(head)) {
|
|
62
|
+
enumValues = head.split("|").filter(Boolean);
|
|
63
|
+
type = "string";
|
|
64
|
+
}
|
|
65
|
+
const prop = { type };
|
|
66
|
+
if (type === "array")
|
|
67
|
+
prop.items = { type: "string" };
|
|
68
|
+
if (enumValues)
|
|
69
|
+
prop.enum = enumValues;
|
|
70
|
+
prop.description = full.trim();
|
|
71
|
+
return prop;
|
|
72
|
+
}
|
|
73
|
+
function fromDescriptors(shape) {
|
|
74
|
+
const properties = {};
|
|
75
|
+
const required = [];
|
|
76
|
+
let seen = 0;
|
|
77
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
78
|
+
const text = typeof value === "string"
|
|
79
|
+
? `${key}: ${value}`
|
|
80
|
+
: typeof value?.descriptor === "string"
|
|
81
|
+
? String(value.descriptor)
|
|
82
|
+
: null;
|
|
83
|
+
if (!text)
|
|
84
|
+
continue;
|
|
85
|
+
seen++;
|
|
86
|
+
const m = text.match(DESCRIPTOR_HEAD);
|
|
87
|
+
properties[key] = m
|
|
88
|
+
? descriptorToProperty(text, m[2] ?? "")
|
|
89
|
+
: { type: "string", description: text };
|
|
90
|
+
// `(required)` is explicit in the fallback schemas; `(optional` marks the
|
|
91
|
+
// rest. Anything unmarked stays optional — execute() coerces raw args
|
|
92
|
+
// itself, and a wrong `required` makes the host reject a valid call.
|
|
93
|
+
if (/\(required\)/i.test(text) && !/optional/i.test(text))
|
|
94
|
+
required.push(key);
|
|
95
|
+
}
|
|
96
|
+
if (!seen || seen !== Object.keys(shape).length)
|
|
97
|
+
return null;
|
|
98
|
+
const schema = { type: "object", properties, additionalProperties: false };
|
|
99
|
+
if (required.length)
|
|
100
|
+
schema.required = required;
|
|
101
|
+
return { schema, required };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* `args` is a ZodRawShape (see `src/tm/args-schema.ts`) — but it is a
|
|
105
|
+
* *descriptor* when zod could not be loaded, and it may already be a JSON
|
|
106
|
+
* Schema. `exact:false` means the model gets no parameter guidance for this
|
|
107
|
+
* tool, which the caller reports instead of hiding: a tool the model cannot
|
|
108
|
+
* call correctly is a tool that is broken, whatever the code says.
|
|
109
|
+
*/
|
|
110
|
+
export async function inputSchemaFor(args) {
|
|
111
|
+
if (args && typeof args === "object") {
|
|
112
|
+
const shape = args;
|
|
113
|
+
if (typeof shape.type === "string" && (shape.properties || shape.additionalProperties !== undefined)) {
|
|
114
|
+
return { schema: shape, exact: true, source: "json-schema" };
|
|
115
|
+
}
|
|
116
|
+
const descriptors = fromDescriptors(shape);
|
|
117
|
+
if (descriptors) {
|
|
118
|
+
return { schema: descriptors.schema, exact: true, source: "descriptor" };
|
|
119
|
+
}
|
|
120
|
+
const z = await loadZod();
|
|
121
|
+
const toJSONSchema = z?.toJSONSchema;
|
|
122
|
+
if (z && toJSONSchema) {
|
|
123
|
+
try {
|
|
124
|
+
const schema = toJSONSchema(z.object(shape));
|
|
125
|
+
return { schema, exact: true, source: "zod" };
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
return {
|
|
129
|
+
schema: { type: "object", additionalProperties: true },
|
|
130
|
+
exact: false,
|
|
131
|
+
source: "permissive",
|
|
132
|
+
note: `zod 形状转换失败:${err?.message ?? String(err)}`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
schema: { type: "object", additionalProperties: true },
|
|
139
|
+
exact: false,
|
|
140
|
+
source: "permissive",
|
|
141
|
+
note: "宿主未提供 zod,参数表退化为不限形状",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** The per-execute literal our pipelines expect. */
|
|
145
|
+
export function v2ToolCtx(ctx, directory) {
|
|
146
|
+
const c = (ctx ?? {});
|
|
147
|
+
return {
|
|
148
|
+
// A future host may carry a per-call directory (sessions CAN move); honor it
|
|
149
|
+
// when present instead of pinning the boot value.
|
|
150
|
+
directory: typeof c.directory === "string" && c.directory ? c.directory : directory,
|
|
151
|
+
sessionID: String(c.sessionID ?? ""),
|
|
152
|
+
agent: String(c.agent ?? ""),
|
|
153
|
+
// NOTE: no `ask` on purpose — see the header. Adding a stub that resolves
|
|
154
|
+
// would be the self-allowing this codebase refuses.
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export function v2Result(res) {
|
|
158
|
+
// `ToolResult` is a union: most tm_* answers are already plain strings.
|
|
159
|
+
if (typeof res === "string")
|
|
160
|
+
return { content: [{ type: "text", text: res }] };
|
|
161
|
+
const out = (res ?? {});
|
|
162
|
+
const text = typeof out.output === "string" ? out.output : String(out.output ?? "");
|
|
163
|
+
const content = [{ type: "text", text }];
|
|
164
|
+
for (const att of (out.attachments ?? [])) {
|
|
165
|
+
if (!att || typeof att.url !== "string" || !att.url)
|
|
166
|
+
continue;
|
|
167
|
+
content.push({ type: "file", uri: att.url, mime: att.mime, name: att.filename });
|
|
168
|
+
}
|
|
169
|
+
const metadata = out.metadata;
|
|
170
|
+
return metadata && typeof metadata === "object"
|
|
171
|
+
? { content, metadata }
|
|
172
|
+
: { content };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Wrap one v1 ToolDefinition. `execute` may be absent on exotic hosts; a tool
|
|
176
|
+
* that cannot run must not be registered at all, because the model would spend
|
|
177
|
+
* a round on it and get nothing.
|
|
178
|
+
*/
|
|
179
|
+
export async function bindV2Tool(name, def, directory,
|
|
180
|
+
/** Every call to OUR tool tells the host-scope resolver which sessions belong to
|
|
181
|
+
* Team (#22) — the one fact about a session we can learn from the inside. */
|
|
182
|
+
onCall,
|
|
183
|
+
/** `codemodeDirect: true` sends `options:{codemode:false}`, which the 2.0.16
|
|
184
|
+
* binary uses as the visibility switch: without it a registered tool reaches the
|
|
185
|
+
* model ONLY inside the Code Mode catalog, with its description cut to the first
|
|
186
|
+
* line — so every governance sentence we wrote below that line never arrives.
|
|
187
|
+
* Off by default because the cost is the whole definition set riding every
|
|
188
|
+
* request; the number is measured, not argued (see TM_V2_CODEMODE). */
|
|
189
|
+
opts = {}) {
|
|
190
|
+
if (typeof def?.execute !== "function")
|
|
191
|
+
return null;
|
|
192
|
+
const { schema, exact, source, note } = await inputSchemaFor(def.args);
|
|
193
|
+
const tool = {
|
|
194
|
+
name,
|
|
195
|
+
description: String(def.description ?? ""),
|
|
196
|
+
input: schema,
|
|
197
|
+
...(opts.codemodeDirect ? { options: { codemode: false } } : {}),
|
|
198
|
+
async execute(args, ctx) {
|
|
199
|
+
onCall?.(ctx?.agent, ctx?.sessionID);
|
|
200
|
+
// Our tools are defensive about raw model args already (they coerce
|
|
201
|
+
// string booleans and JSON-array strings themselves), so nothing is
|
|
202
|
+
// normalized here beyond a guaranteed object.
|
|
203
|
+
const res = await def.execute?.((args ?? {}), v2ToolCtx(ctx, directory));
|
|
204
|
+
return v2Result(res);
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
return { tool, inputExact: exact, inputSource: source, note };
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=v2-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2-tool.js","sourceRoot":"","sources":["../../src/host/v2-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH;0EAC0E;AAC1E,KAAK,UAAU,OAAO;IACpB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAA;QAClB,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAA+C,CAAA;QAC9E,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAwC,CAAA;QAC1E,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;;;mFAMmF;AACnF,MAAM,eAAe,GAAG,4CAA4C,CAAA;AAEpE;;;;;2DAK2D;AAC3D,SAAS,oBAAoB,CAAC,IAAY,EAAE,KAAa;IACvD,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,IAAI,IAAI,GAAG,QAAQ,CAAA;IACnB,IAAI,UAAgC,CAAA;IACpC,IAAI,sBAAsB,CAA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