antechamber 2.0.18 → 2.0.20

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 CHANGED
@@ -7,6 +7,17 @@ and this project uses [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.20] - 2026-11-30
11
+
12
+ - fix(subagents): keep background task reports where the task ended (#111)
13
+
14
+ ## [2.0.19] - 2026-11-28
15
+
16
+ ### Fixed
17
+
18
+ - Folder-installed extensions now recognize when OpenChamber's default settings already select their launcher, so
19
+ OmO Graph and OmO Work no longer claim that sessions are not running on OmO while Antechamber is active.
20
+
10
21
  ## [2.0.18] - 2026-11-27
11
22
 
12
23
  ### Changed
@@ -27,6 +38,10 @@ and this project uses [Semantic Versioning](https://semver.org/).
27
38
 
28
39
  ### Fixed
29
40
 
41
+ - Finished background agent tasks no longer pile up as Agent Task rows at the end of the chat in OpenChamber
42
+ 2.x. Each time the conversation was reloaded (after a compaction, a `!` command or a slash command), every earlier
43
+ background task was reported again as a new row stamped with the reload time. Its report now keeps the time the task
44
+ ended and one identity, so it stays where the task finished.
30
45
  - An OmO edit that makes several replacements in one call now shows in OpenChamber 2.x as an edit card with its
31
46
  diff, like a single replacement, instead of a generic card listing the `edits` array as JSON. OpenCode 2.x has no
32
47
  `multiedit` tool, so OpenChamber did not recognize the name.
@@ -7,7 +7,10 @@ export declare function stripTaskSuffix(text: string): string;
7
7
  export declare function taskParts(template: OCToolPart, args: Record<string, unknown>): OCToolPart[];
8
8
  /** Keep task status independent of the parent tool returning a background handle. */
9
9
  export declare function updateTaskParts(parts: OCToolPart[], result: ToolResult, ended: boolean, now: number): void;
10
- /** Wake messages carry arrays of completion envelopes, not a flat details object. */
10
+ /**
11
+ * Wake messages carry arrays of completion envelopes, not a flat details object. A wake sent with a ticket wraps
12
+ * that array as `{producerDetails, ticketId}` (OmO core/agent-session.js).
13
+ */
11
14
  export declare function taskCompletions(value: unknown): Record<string, unknown>[];
12
15
  /** Keep bookmarks for known tasks; a bare native id is only safe while it has one parent. */
13
16
  export declare function taskSessionId(id: string, parentPiId: string, store?: SessionStore): string;
package/dist/subagents.js CHANGED
@@ -93,7 +93,7 @@ export function updateTaskParts(parts, result, ended, now) {
93
93
  const old = isRecord(previous?.task) ? previous.task : {};
94
94
  const item = items?.[index];
95
95
  const current = items !== undefined ? (isRecord(item) ? item : {}) : index === 0 ? details : {};
96
- const data = { ...old, ...current };
96
+ const data = mergeTaskDetails(old, current);
97
97
  const output = stripTaskSuffix(typeof data.final_response === "string"
98
98
  ? data.final_response
99
99
  : parts.length === 1
@@ -103,7 +103,21 @@ export function updateTaskParts(parts, result, ended, now) {
103
103
  : "");
104
104
  const input = part.state.input;
105
105
  const title = typeof input.description === "string" ? input.description : "task";
106
- const start = part.state.status === "pending" ? now : part.state.time.start;
106
+ const status = active(data.status) || (!ended && !terminal(data.status))
107
+ ? "running"
108
+ : result.isError || (terminal(data.status) && data.status !== "completed")
109
+ ? "error"
110
+ : "completed";
111
+ // A card ends when its task did: OmO's `terminal_at`, else the end already recorded for this same outcome.
112
+ // Settling it again (a refresh, a restart) must not move it to the time antechamber looked.
113
+ const terminalAt = timestamp(data.terminal_at);
114
+ const end = Number.isFinite(terminalAt)
115
+ ? terminalAt
116
+ : (part.state.status === "completed" || part.state.status === "error") && part.state.status === status
117
+ ? part.state.time.end
118
+ : now;
119
+ // The call's start is when antechamber saw it; a fast task's native end can precede it.
120
+ const start = Math.min(part.state.status === "pending" ? now : part.state.time.start, end);
107
121
  const metadata = {
108
122
  ...previous,
109
123
  task: data,
@@ -117,24 +131,43 @@ export function updateTaskParts(parts, result, ended, now) {
117
131
  // Preserve a final result for the fallback even after the parent JSONL is gone.
118
132
  if (ended && output !== "" && !active(data.status))
119
133
  data.final_response = output;
120
- if (active(data.status) || (!ended && !terminal(data.status))) {
121
- part.state = { status: "running", input, title, metadata, time: { start } };
134
+ if (status === "running") {
135
+ part.state = {
136
+ status: "running",
137
+ input,
138
+ title,
139
+ metadata,
140
+ time: { start: part.state.status === "pending" ? now : part.state.time.start },
141
+ };
122
142
  }
123
- else if (result.isError || (terminal(data.status) && data.status !== "completed")) {
143
+ else if (status === "error") {
124
144
  part.state = {
125
145
  status: "error",
126
146
  input,
127
147
  error: output || String(data.status ?? "task failed"),
128
148
  metadata,
129
- time: { start, end: now },
149
+ time: { start, end },
130
150
  };
131
151
  }
132
152
  else {
133
- part.state = { status: "completed", input, output, title, metadata, time: { start, end: now } };
153
+ part.state = { status: "completed", input, output, title, metadata, time: { start, end } };
134
154
  }
135
155
  });
136
156
  }
137
- /** Wake messages carry arrays of completion envelopes, not a flat details object. */
157
+ /**
158
+ * Task details with an update merged in. `terminal_at` dates only the state it came with: OmO drops it when a task
159
+ * is revived, and its snapshots and completions omit it, so a change of status without one clears the old one.
160
+ */
161
+ function mergeTaskDetails(known, update) {
162
+ const merged = { ...known, ...update };
163
+ if (update.terminal_at === undefined && update.status !== undefined && update.status !== known.status)
164
+ delete merged.terminal_at;
165
+ return merged;
166
+ }
167
+ /**
168
+ * Wake messages carry arrays of completion envelopes, not a flat details object. A wake sent with a ticket wraps
169
+ * that array as `{producerDetails, ticketId}` (OmO core/agent-session.js).
170
+ */
138
171
  export function taskCompletions(value) {
139
172
  if (Array.isArray(value))
140
173
  return value.flatMap(taskCompletions);
@@ -142,7 +175,7 @@ export function taskCompletions(value) {
142
175
  return [];
143
176
  if (taskId(value.task_id))
144
177
  return [value];
145
- return taskCompletions(value.details);
178
+ return [...taskCompletions(value.details), ...taskCompletions(value.producerDetails)];
146
179
  }
147
180
  function optionalFile(path) {
148
181
  try {
@@ -531,7 +564,7 @@ export class SubagentBridge {
531
564
  const child = this.children.get(id);
532
565
  if (child?.session.info.parentID !== parent.info.id)
533
566
  continue;
534
- child.task.details = { ...child.task.details, ...data };
567
+ child.task.details = mergeTaskDetails(child.task.details, data);
535
568
  if (terminal(data.status))
536
569
  child.task.terminalAt = Date.now();
537
570
  this.refresh(child, true, false);
@@ -584,7 +617,10 @@ export class SubagentBridge {
584
617
  return false;
585
618
  if (active(data.status) && terminal(child.task.details.status) && updated <= (child.task.terminalAt ?? 0))
586
619
  return false;
587
- child.task.details = { ...child.task.details, ...data };
620
+ child.task.details = mergeTaskDetails(child.task.details, data);
621
+ // A revived task's next end is its own, not the previous run's.
622
+ if (active(data.status))
623
+ delete child.task.terminalAt;
588
624
  return true;
589
625
  }
590
626
  discover(parent, messages) {
@@ -615,7 +651,7 @@ export class SubagentBridge {
615
651
  else {
616
652
  // A repeated history read must not overwrite a newer completion wake.
617
653
  if (!terminal(child.task.details.status) || terminal(details.status))
618
- child.task.details = { ...child.task.details, ...details };
654
+ child.task.details = mergeTaskDetails(child.task.details, details);
619
655
  }
620
656
  child.live ||= live;
621
657
  metadata.sessionID = child.session.info.id;
@@ -944,7 +980,12 @@ export class SubagentBridge {
944
980
  updateTaskParts([part], {
945
981
  details: child.task.details,
946
982
  content: [{ type: "text", text: child.task.details.final_response ?? "" }],
947
- }, !running, Date.now());
983
+ }, !running,
984
+ // A task OmO no longer keeps a record of ends when antechamber saw it end, not now.
985
+ child.task.terminalAt ?? Date.now());
986
+ // Keep that first end for the cards a later history read rebuilds (the registry persists it).
987
+ if (!running && (part.state.status === "completed" || part.state.status === "error"))
988
+ child.task.terminalAt ??= part.state.time.end;
948
989
  }
949
990
  return parts;
950
991
  }
package/dist/v2.js CHANGED
@@ -755,12 +755,20 @@ export class V2EventTranslator {
755
755
  }
756
756
  return frames;
757
757
  }
758
- // Every terminal background task reports once, even one settled before a restart: OpenChamber 2.x drops the
759
- // report of a call whose row it already shows finished.
758
+ // Every terminal background task reports, even one settled before a restart, and again when its outcome changes
759
+ // (a revived task ends anew): OpenChamber 2.x drops the report of a call whose row it already shows finished,
760
+ // and finishes the row from the last report it holds (subagent-run.ts `findSubagentRun`). A history reload
761
+ // re-emits every old card once this state is gone (it ends with the turn), and OpenChamber 2.x makes the report
762
+ // a message placed by `created` under an id taken from the envelope (events.ts `session.synthetic`). So the
763
+ // report keeps the task's end time and an id of its own call: sent again, it replaces itself where the task
764
+ // ended, not in a new row at the end.
760
765
  const report = subagentReport(part);
761
- if (report !== undefined && !ts.reported) {
762
- ts.reported = true;
763
- frames.push(this.frame(directory, "session.synthetic", report));
766
+ if (report !== undefined && state.status !== "running") {
767
+ const reported = safeJson([report, state.time.end]);
768
+ if (reported !== ts.reported) {
769
+ ts.reported = reported;
770
+ frames.push(this.frame(directory, "session.synthetic", report, state.time.end, `evt_subagent_${part.id}`));
771
+ }
764
772
  }
765
773
  const background = backgroundShell(part);
766
774
  if (background !== undefined) {
@@ -823,13 +831,13 @@ export class V2EventTranslator {
823
831
  }),
824
832
  ];
825
833
  }
826
- frame(directory, type, data, created = Date.now()) {
834
+ frame(directory, type, data, created = Date.now(), id = genId("evt")) {
827
835
  const aggregateID = typeof data.sessionID === "string" ? data.sessionID : undefined;
828
836
  const seq = aggregateID === undefined ? undefined : (this.sequences.get(aggregateID) ?? 0) + 1;
829
837
  if (aggregateID !== undefined && seq !== undefined)
830
838
  this.sequences.set(aggregateID, seq);
831
839
  return {
832
- id: genId("evt"),
840
+ id,
833
841
  created,
834
842
  type,
835
843
  location: { directory },
@@ -40,9 +40,10 @@ the npm `--auto-update` launcher); a CLI you picked yourself, then or later, sta
40
40
  as OpenCode CLI**. OpenChamber reads the setting each time it starts OpenCode, so the OmO panel and the Work section
41
41
  ask for **Restart OpenCode** until the launcher has started once since the switch; the launcher records its starts,
42
42
  and the service its switch, under `~/.antechamber/launches/`. They show nothing once antechamber runs. A folder
43
- install has no OpenChamber data dir around it, so they show the launcher path to paste into **Settings → General →
44
- OpenCode CLI** instead. The panel's settings (the sliders icon) list the installed versions, and the launcher path
45
- while it is not the OpenCode CLI.
43
+ install reads OpenChamber's default `~/.config/openchamber/settings.json` to recognize an already selected launcher.
44
+ It cannot switch that file automatically because the folder might belong to another OpenChamber data directory;
45
+ set the launcher in **Settings → General → OpenCode CLI** if it is not selected. The panel's settings (the sliders
46
+ icon) list the installed versions and the launcher path while it is not the OpenCode CLI.
46
47
 
47
48
  Other ways to add it: a **Folder** (`extensions/antechamber` of an npm install or a built checkout; `antechamber
48
49
  setup` prints it), or the release **ZIP**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber-openchamber",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
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",
@@ -6,13 +6,15 @@ import { fileURLToPath } from "node:url";
6
6
  // extensions/antechamber/src/runtime/activate.ts
7
7
  import { chmodSync, copyFileSync, existsSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
8
8
  import { basename, dirname, join } from "node:path";
9
- function openchamberSettingsPath(extensionDir2) {
9
+ function openchamberSettingsPath(extensionDir2, home) {
10
10
  for (let dir = extensionDir2; dirname(dir) !== dir; dir = dirname(dir)) {
11
11
  if (basename(dirname(dir)) !== "extensions") continue;
12
- const settings = join(dirname(dirname(dir)), "settings.json");
13
- if (existsSync(settings)) return settings;
12
+ const settings2 = join(dirname(dirname(dir)), "settings.json");
13
+ if (existsSync(settings2)) return settings2;
14
14
  }
15
- return void 0;
15
+ if (home === void 0) return void 0;
16
+ const settings = join(home, ".config", "openchamber", "settings.json");
17
+ return existsSync(settings) ? settings : void 0;
16
18
  }
17
19
  function launcherPath(extensionDir2) {
18
20
  return join(extensionDir2, "bin", "opencode-antechamber");
@@ -875,7 +877,7 @@ function createService(options) {
875
877
  const launcher = launcherPath(options.extensionDir);
876
878
  const launchStamp = launchStampPath(options.home, launcher);
877
879
  const switchStamp = `${launchStamp}.switched`;
878
- const findSettings = () => options.settingsPath ?? openchamberSettingsPath(options.extensionDir);
880
+ const findWritableSettings = () => options.settingsPath ?? openchamberSettingsPath(options.extensionDir);
879
881
  const readSettings = (settingsPath) => {
880
882
  try {
881
883
  const configured = configuredBinary(settingsPath);
@@ -890,7 +892,7 @@ function createService(options) {
890
892
  return activated;
891
893
  };
892
894
  const activateUnasked = () => {
893
- const settingsPath = findSettings();
895
+ const settingsPath = findWritableSettings();
894
896
  if (settingsPath === void 0 || runtimeState(options.paths, deps).state !== "ready") return;
895
897
  if (readStamp(switchStamp) !== void 0) return;
896
898
  try {
@@ -909,9 +911,11 @@ function createService(options) {
909
911
  return installing;
910
912
  };
911
913
  const status = () => {
912
- const settingsPath = findSettings();
914
+ const writableSettings = findWritableSettings();
915
+ const settingsPath = writableSettings ?? openchamberSettingsPath(options.extensionDir, options.home);
913
916
  const current = runtimeState(options.paths, deps);
914
- const { configured, error: settingsError } = settingsPath === void 0 ? {} : readSettings(settingsPath);
917
+ const { configured, error } = settingsPath === void 0 ? {} : readSettings(settingsPath);
918
+ const settingsError = writableSettings === void 0 ? void 0 : error;
915
919
  const active = configured === launcher;
916
920
  const switchedAt = readStamp(switchStamp);
917
921
  const base = {
@@ -919,7 +923,7 @@ function createService(options) {
919
923
  spec: options.paths.spec,
920
924
  launcher,
921
925
  bun: options.bun ?? null,
922
- settings: settingsPath ?? null,
926
+ settings: writableSettings ?? null,
923
927
  configured: configured?.trim() ? configured : null,
924
928
  active,
925
929
  ...settingsError ? { settingsError } : {},
@@ -959,7 +963,7 @@ function createService(options) {
959
963
  }
960
964
  if (pathname === "/runtime/activate" && req.method === "POST") {
961
965
  req.resume();
962
- const settingsPath = findSettings();
966
+ const settingsPath = findWritableSettings();
963
967
  if (settingsPath === void 0)
964
968
  return send(res, 409, {
965
969
  error: "settings-not-found",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "OpenCode-compatible HTTP/SSE server that lets OpenChamber drive the pi coding agent (and OmO) over RPC",
5
5
  "type": "module",
6
6
  "license": "MIT",