antechamber 2.0.19 → 2.0.21

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,16 @@ and this project uses [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.21] - 2026-11-30
11
+
12
+ ### Changed
13
+
14
+ - OmO 5.1.89 (engine senpi 2026.11.30-2), up from 5.1.81.
15
+
16
+ ## [2.0.20] - 2026-11-30
17
+
18
+ - fix(subagents): keep background task reports where the task ended (#111)
19
+
10
20
  ## [2.0.19] - 2026-11-28
11
21
 
12
22
  ### Fixed
@@ -34,6 +44,10 @@ and this project uses [Semantic Versioning](https://semver.org/).
34
44
 
35
45
  ### Fixed
36
46
 
47
+ - Finished background agent tasks no longer pile up as Agent Task rows at the end of the chat in OpenChamber
48
+ 2.x. Each time the conversation was reloaded (after a compaction, a `!` command or a slash command), every earlier
49
+ background task was reported again as a new row stamped with the reload time. Its report now keeps the time the task
50
+ ended and one identity, so it stays where the task finished.
37
51
  - An OmO edit that makes several replacements in one call now shows in OpenChamber 2.x as an edit card with its
38
52
  diff, like a single replacement, instead of a generic card listing the `edits` array as JSON. OpenCode 2.x has no
39
53
  `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 },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber-openchamber",
3
- "version": "2.0.19",
3
+ "version": "2.0.21",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber",
3
- "version": "2.0.19",
3
+ "version": "2.0.21",
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",
@@ -88,7 +88,7 @@
88
88
  "typescript": "^7.0.2"
89
89
  },
90
90
  "dependencies": {
91
- "omo-ai": "5.1.81"
91
+ "omo-ai": "5.1.89"
92
92
  },
93
93
  "openchamber": {
94
94
  "apiVersion": 1,