antechamber 2.0.9 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/routes-v2.js +8 -0
- package/dist/subagents.js +2 -0
- package/dist/v2.d.ts +1 -0
- package/dist/v2.js +82 -15
- package/extensions/antechamber/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project uses [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.11] - 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- A background task (`run_in_background`) no longer shows as "Interrupted" in OpenChamber while it is still
|
|
15
|
+
running. It reaches OpenChamber as OpenCode's background subagent, so its row stays running, labelled in
|
|
16
|
+
background, while the child works, and shows the child's result when it finishes.
|
|
17
|
+
|
|
18
|
+
## [2.0.10] - 2026-11-20
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- OpenChamber keeps subagent costs in the session total after a restart, even
|
|
23
|
+
when its live events arrive before the session list finishes loading.
|
|
24
|
+
|
|
10
25
|
## [2.0.9] - 2026-11-19
|
|
11
26
|
|
|
12
27
|
### Fixed
|
package/dist/routes-v2.js
CHANGED
|
@@ -162,6 +162,8 @@ async function handleV2Bootstrap(services, res, url, path, method, directory) {
|
|
|
162
162
|
}
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
|
+
/** OpenChamber's subagent stop note (subagent-run.ts `subagentCancellationNote`). */
|
|
166
|
+
const SUBAGENT_CANCELLATION_KEY = "openchamberSubagentCancellation";
|
|
165
167
|
/** Shell ids named by OpenChamber's stop note (background-shell.ts `shellCancellationNote`). */
|
|
166
168
|
function cancelledShells(metadata) {
|
|
167
169
|
const note = metadata?.[SHELL_CANCELLATION_KEY];
|
|
@@ -913,6 +915,12 @@ export async function handleV2(services, req, res, url, path, method, directory)
|
|
|
913
915
|
json(res, 400, errorBody("UnsupportedError", `OmO cannot stop ${unstoppable.join(", ")}: only eval cells can be stopped`));
|
|
914
916
|
return;
|
|
915
917
|
}
|
|
918
|
+
// OpenChamber's subagent stop sends this note, then interrupts the child (client.ts `stopSubagent`,
|
|
919
|
+
// 2.5.3). An OmO task child has no RPC to stop it, so refuse the note: the agent is never told of a stop.
|
|
920
|
+
if (metadata?.[SUBAGENT_CANCELLATION_KEY] !== undefined) {
|
|
921
|
+
json(res, 400, errorBody("UnsupportedError", "OmO cannot stop a subagent from OpenChamber"));
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
916
924
|
const messageID = typeof body.id === "string" && body.id !== "" ? body.id : `msg_${randomUUID().replaceAll("-", "")}`;
|
|
917
925
|
const text = body.text;
|
|
918
926
|
if (body.description !== undefined && typeof body.description !== "string")
|
package/dist/subagents.js
CHANGED
|
@@ -54,6 +54,8 @@ toolMappers.task = (args, result) => {
|
|
|
54
54
|
description: args.task_summary ?? args.name ?? args.description,
|
|
55
55
|
prompt: args.prompt,
|
|
56
56
|
subagent_type: args.subagent_type ?? args.category,
|
|
57
|
+
// OpenCode 2.x's own flag for a delegated call that returns at once (v2.ts `backgroundTask`).
|
|
58
|
+
...(args.run_in_background === true ? { background: true } : {}),
|
|
57
59
|
};
|
|
58
60
|
const details = record(result?.details) ? result.details : {};
|
|
59
61
|
return {
|
package/dist/v2.d.ts
CHANGED
package/dist/v2.js
CHANGED
|
@@ -189,9 +189,52 @@ export function toV2AssistantMessage(info) {
|
|
|
189
189
|
msg.error = i.error;
|
|
190
190
|
return msg;
|
|
191
191
|
}
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
/**
|
|
193
|
+
* OpenCode 2.x renamed `bash` to `shell`; OpenChamber 2.x draws a shell card (command, live output) only for `shell`.
|
|
194
|
+
* A background `task` is OpenCode's background `subagent` call, the only call OpenChamber 2.x follows past its step.
|
|
195
|
+
*/
|
|
196
|
+
function v2ToolName(part) {
|
|
197
|
+
if (part.tool === "task" && part.state.status !== "pending" && part.state.input.background === true)
|
|
198
|
+
return "subagent";
|
|
199
|
+
return part.tool === "bash" ? "shell" : part.tool;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A background task whose call returned while the child still runs. pi completes the step before the child ends, and
|
|
203
|
+
* OpenChamber 2.x marks a running tool under a completed message "Interrupted". OpenCode 2.x settles such a call at
|
|
204
|
+
* once with `{status: "running", sessionID}` in its metadata, and OpenChamber 2.x draws the row from the child
|
|
205
|
+
* session's status, then from its report (`session.synthetic`, see `subagentReport`).
|
|
206
|
+
*/
|
|
207
|
+
function backgroundTask(part) {
|
|
208
|
+
const st = part.state;
|
|
209
|
+
if (part.tool !== "task" || st.status !== "running" || st.input.background !== true)
|
|
210
|
+
return undefined;
|
|
211
|
+
const sessionID = st.metadata?.sessionID;
|
|
212
|
+
if (typeof sessionID !== "string")
|
|
213
|
+
return undefined;
|
|
214
|
+
return { output: "", metadata: { ...st.metadata, status: "running", sessionID } };
|
|
215
|
+
}
|
|
216
|
+
/** OpenCode 2.x's report of a finished background subagent, which OpenChamber 2.x puts on the call's row. */
|
|
217
|
+
function subagentReport(part) {
|
|
218
|
+
const st = part.state;
|
|
219
|
+
if (part.tool !== "task" || st.input.background !== true)
|
|
220
|
+
return undefined;
|
|
221
|
+
if (st.status !== "completed" && st.status !== "error")
|
|
222
|
+
return undefined;
|
|
223
|
+
const childID = st.metadata?.sessionID;
|
|
224
|
+
if (typeof childID !== "string")
|
|
225
|
+
return undefined;
|
|
226
|
+
const task = st.metadata?.task;
|
|
227
|
+
const cancelled = task !== null && typeof task === "object" && "status" in task && /^cancel/.test(String(task.status));
|
|
228
|
+
const state = st.status === "completed" ? "completed" : cancelled ? "cancelled" : "error";
|
|
229
|
+
const text = st.status === "completed" ? st.output : st.error;
|
|
230
|
+
const description = st.input.description;
|
|
231
|
+
const agent = st.input.subagent_type;
|
|
232
|
+
return {
|
|
233
|
+
sessionID: part.sessionID,
|
|
234
|
+
text: `<subagent sessionID="${childID}" state="${state}">\n${text}\n</subagent>`,
|
|
235
|
+
...(typeof description === "string" ? { description } : {}),
|
|
236
|
+
metadata: { source: "subagent", childID, state, ...(typeof agent === "string" ? { agent } : {}) },
|
|
237
|
+
};
|
|
195
238
|
}
|
|
196
239
|
/**
|
|
197
240
|
* A card whose call left OmO work running (background-results.ts `backgroundShellID`), as OpenCode 2.x settles a
|
|
@@ -224,7 +267,7 @@ function v2ToolId(part) {
|
|
|
224
267
|
}
|
|
225
268
|
function toolContent(part) {
|
|
226
269
|
const st = part.state;
|
|
227
|
-
const name = v2ToolName(part
|
|
270
|
+
const name = v2ToolName(part);
|
|
228
271
|
const start = st.status === "pending" ? undefined : st.time.start;
|
|
229
272
|
const end = st.status === "pending" || st.status === "running" ? undefined : st.time.end;
|
|
230
273
|
const id = v2ToolId(part);
|
|
@@ -241,7 +284,7 @@ function toolContent(part) {
|
|
|
241
284
|
...(end !== undefined ? { completed: end } : {}),
|
|
242
285
|
},
|
|
243
286
|
};
|
|
244
|
-
const background = st.status === "running" ? backgroundShell(part) : undefined;
|
|
287
|
+
const background = st.status === "running" ? (backgroundShell(part) ?? backgroundTask(part)) : undefined;
|
|
245
288
|
if (st.status === "pending") {
|
|
246
289
|
base.state = { status: "streaming", input: st.raw ?? "", metadata: {} };
|
|
247
290
|
}
|
|
@@ -345,6 +388,7 @@ export class V2EventTranslator {
|
|
|
345
388
|
...(info.parentMessageID !== undefined ? { parentMessageID: info.parentMessageID } : {}),
|
|
346
389
|
...(info.metadata !== undefined ? { metadata: info.metadata } : {}),
|
|
347
390
|
}),
|
|
391
|
+
...this.usageFrames(directory, info),
|
|
348
392
|
];
|
|
349
393
|
}
|
|
350
394
|
case "session.updated": {
|
|
@@ -353,15 +397,7 @@ export class V2EventTranslator {
|
|
|
353
397
|
...(info.metadata !== undefined
|
|
354
398
|
? [this.frame(directory, "session.metadata.updated", { sessionID: info.id, metadata: info.metadata })]
|
|
355
399
|
: []),
|
|
356
|
-
...(info
|
|
357
|
-
? [
|
|
358
|
-
this.frame(directory, "session.usage.updated", {
|
|
359
|
-
sessionID: info.id,
|
|
360
|
-
cost: info.cost,
|
|
361
|
-
tokens: info.tokens ?? zeroTokens(),
|
|
362
|
-
}),
|
|
363
|
-
]
|
|
364
|
-
: []),
|
|
400
|
+
...this.usageFrames(directory, info),
|
|
365
401
|
];
|
|
366
402
|
}
|
|
367
403
|
case "session.diff":
|
|
@@ -626,7 +662,7 @@ export class V2EventTranslator {
|
|
|
626
662
|
}
|
|
627
663
|
onToolPart(directory, part) {
|
|
628
664
|
const st = this.state(part.sessionID);
|
|
629
|
-
const name = v2ToolName(part
|
|
665
|
+
const name = v2ToolName(part);
|
|
630
666
|
let ts = st.tools.get(part.id);
|
|
631
667
|
if (!ts) {
|
|
632
668
|
ts = {
|
|
@@ -676,6 +712,26 @@ export class V2EventTranslator {
|
|
|
676
712
|
ts.called = true;
|
|
677
713
|
frames.push(this.frame(directory, "session.tool.called", { ...base, input: state.input, executed: false }));
|
|
678
714
|
}
|
|
715
|
+
const task = backgroundTask(part);
|
|
716
|
+
if (task !== undefined) {
|
|
717
|
+
if (!ts.ended) {
|
|
718
|
+
ts.ended = true;
|
|
719
|
+
frames.push(this.frame(directory, "session.tool.success", {
|
|
720
|
+
...base,
|
|
721
|
+
content: [],
|
|
722
|
+
metadata: task.metadata,
|
|
723
|
+
executed: false,
|
|
724
|
+
}));
|
|
725
|
+
}
|
|
726
|
+
return frames;
|
|
727
|
+
}
|
|
728
|
+
// Every terminal background task reports once, even one settled before a restart: OpenChamber 2.x drops the
|
|
729
|
+
// report of a call whose row it already shows finished.
|
|
730
|
+
const report = subagentReport(part);
|
|
731
|
+
if (report !== undefined && !ts.reported) {
|
|
732
|
+
ts.reported = true;
|
|
733
|
+
frames.push(this.frame(directory, "session.synthetic", report));
|
|
734
|
+
}
|
|
679
735
|
const background = backgroundShell(part);
|
|
680
736
|
if (background !== undefined) {
|
|
681
737
|
if (!ts.ended) {
|
|
@@ -726,6 +782,17 @@ export class V2EventTranslator {
|
|
|
726
782
|
}
|
|
727
783
|
return st;
|
|
728
784
|
}
|
|
785
|
+
usageFrames(directory, info) {
|
|
786
|
+
if (info.cost === undefined)
|
|
787
|
+
return [];
|
|
788
|
+
return [
|
|
789
|
+
this.frame(directory, "session.usage.updated", {
|
|
790
|
+
sessionID: info.id,
|
|
791
|
+
cost: info.cost,
|
|
792
|
+
tokens: info.tokens ?? zeroTokens(),
|
|
793
|
+
}),
|
|
794
|
+
];
|
|
795
|
+
}
|
|
729
796
|
frame(directory, type, data, created = Date.now()) {
|
|
730
797
|
const aggregateID = typeof data.sessionID === "string" ? data.sessionID : undefined;
|
|
731
798
|
const seq = aggregateID === undefined ? undefined : (this.sequences.get(aggregateID) ?? 0) + 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antechamber-openchamber",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "OpenChamber extension for antechamber: installs and pins the antechamber server and OmO, draws the OmO Graph and the OmO Work section, and titles OmO tool cards",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|