antechamber 2.0.4 → 2.0.6

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,18 @@ and this project uses [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.6] - 2026-11-19
11
+
12
+ ### Fixed
13
+
14
+ - Sending chat quotes with comments but no text of your own no longer fails with `session.prompt failed (400):
15
+ prompt requires non-whitespace text, files, or agents`. OpenChamber sends the quotes ahead of the prompt, so the
16
+ prompt had no text; the quotes were kept anyway, and a retry sent them a second time.
17
+
18
+ ## [2.0.5] - 2026-11-19
19
+
20
+ - fix(v2): open a turn for a ! shell command in OpenChamber 2.x (#92)
21
+
10
22
  ## [2.0.4] - 2026-11-19
11
23
 
12
24
  ### Fixed
@@ -16,6 +28,9 @@ and this project uses [Semantic Versioning](https://semver.org/).
16
28
  - A `!` shell command shows one card in OpenChamber 2.5, not two. The adapter no longer sends `session.shell.started`
17
29
  and `session.shell.ended`, which OpenChamber draws as a second shell row; the remaining `bash` card is the one that
18
30
  shows output while the command runs.
31
+ - Show a `!` shell command as its own turn at the end of the conversation in OpenChamber 2.x, instead of inside the
32
+ agent's previous turn. antechamber announced the command's user turn with `session.prompted`, which OpenChamber 2.5
33
+ does not handle, so the shell card joined the last turn it knew; it now uses the inbox events OpenChamber reads.
19
34
 
20
35
  ## [2.0.3] - 2026-11-17
21
36
 
@@ -56,6 +56,9 @@ export function promptAsync(services, session, text, model, noReply = false, mes
56
56
  void services.sessions
57
57
  .prompt(session.info.id, text, model, noReply, messageID, delivery, parts, metadata)
58
58
  .catch((error) => {
59
+ // Context that never reached the agent cannot stand in for a prompt's text.
60
+ if (noReply && messageID !== undefined)
61
+ session.pendingContext?.delete(messageID);
59
62
  // The agent stopped: the session's exit handler already shows why, once.
60
63
  if (error instanceof PiStoppedError)
61
64
  return;
package/dist/routes-v2.js CHANGED
@@ -810,6 +810,8 @@ export async function handleV2(services, req, res, url, path, method, directory)
810
810
  const body = (await services.body(req));
811
811
  if (body.delivery !== undefined && body.delivery !== "steer" && body.delivery !== "queue")
812
812
  throw new RequestBodyError(400, 'delivery must be "steer" or "queue"');
813
+ // The command carries the quotes sent before it; ones sent while it runs wait for the next prompt.
814
+ const quotes = [...(managed.pendingContext ?? [])];
813
815
  const result = await runSessionSlash(services, sessionId, {
814
816
  command: body.name,
815
817
  arguments: body.text ?? "",
@@ -821,6 +823,8 @@ export async function handleV2(services, req, res, url, path, method, directory)
821
823
  json(res, 400, errorBody("BadRequestError", "command is required"));
822
824
  return;
823
825
  }
826
+ for (const quote of quotes)
827
+ managed.pendingContext?.delete(quote);
824
828
  res.writeHead(204).end();
825
829
  return;
826
830
  }
@@ -840,7 +844,11 @@ export async function handleV2(services, req, res, url, path, method, directory)
840
844
  const parts = explicit.length > 0
841
845
  ? [...explicit, ...v2PromptParts("", body.files, body.agents)]
842
846
  : v2PromptParts(text, body.files, body.agents);
843
- if (text.trim() === "" && !parts.some((part) => part.type === "file" || part.type === "agent")) {
847
+ // OpenChamber sends chat quotes as context ahead of the prompt, so a prompt of quotes alone has no text;
848
+ // OmO runs it as an empty user message after the quotes (RPC probe 2026-11-19).
849
+ if (text.trim() === "" &&
850
+ !parts.some((part) => part.type === "file" || part.type === "agent") &&
851
+ !managed.pendingContext?.size) {
844
852
  json(res, 400, {
845
853
  _tag: "InvalidRequestError",
846
854
  message: "prompt requires non-whitespace text, files, or agents",
@@ -870,6 +878,7 @@ export async function handleV2(services, req, res, url, path, method, directory)
870
878
  return;
871
879
  }
872
880
  const delivery = body.delivery ?? "steer";
881
+ managed.pendingContext?.clear();
873
882
  promptAsync(services, managed, text, model, false, messageID, delivery, parts.length > 0 ? parts : undefined, metadata);
874
883
  json(res, 200, {
875
884
  data: {
@@ -910,6 +919,7 @@ export async function handleV2(services, req, res, url, path, method, directory)
910
919
  throw new RequestBodyError(400, "description must be a string");
911
920
  if (body.description !== undefined)
912
921
  (managed.tree.promptDescriptions ??= {})[messageID] = body.description;
922
+ (managed.pendingContext ??= new Set()).add(messageID);
913
923
  promptAsync(services, managed, text, undefined, true, messageID, body.delivery ?? "steer", undefined, metadata);
914
924
  // OpenChamber 2.3.2 treats anything but 200 + the admitted record as a failed send (captured OpenCode shape).
915
925
  json(res, 200, {
@@ -235,7 +235,8 @@ export function parsePiSessionText(s, agentName, raw) {
235
235
  if (m.role === "user") {
236
236
  endRun();
237
237
  const text = textOf(m.content);
238
- if (text === "")
238
+ // An empty prompt antechamber sent (chat quotes alone) is a real turn; its reply answers it.
239
+ if (text === "" && m.clientMessageId === undefined)
239
240
  continue;
240
241
  const msgId = m.clientMessageId ??
241
242
  Object.keys(s.tree.messageEntries).find((key) => s.tree.messageEntries[key] === e.id) ??
@@ -33,6 +33,11 @@ export interface ManagedSession extends ThinkingState {
33
33
  accepted: boolean;
34
34
  delivered: boolean;
35
35
  }>;
36
+ /**
37
+ * Context (v2 synthetic) admitted since the last prompt or command: OpenChamber sends chat quotes this way, ahead of
38
+ * a prompt that may have no text of its own. Recorded when the route accepts it, before its queued admission runs.
39
+ */
40
+ pendingContext?: Set<string>;
36
41
  instructions?: Record<string, InstructionEntryState>;
37
42
  /** Suppress model-selection events until the session creation record has its final model. */
38
43
  initializing?: boolean;
package/dist/sessions.js CHANGED
@@ -1201,6 +1201,17 @@ export class SessionManager {
1201
1201
  }
1202
1202
  async promptLive(s, text, model, noReply = false, messageID, delivery = "steer", parts, metadata) {
1203
1203
  const pi = await this.preparePrompt(s, model);
1204
+ // The route accepts an empty prompt while quotes are pending, but a quote's admission can still fail after that:
1205
+ // an empty prompt with no context ahead of it would send OmO nothing.
1206
+ if (!noReply && text.trim() === "" && !parts?.some((part) => part.type === "file" || part.type === "agent")) {
1207
+ const messages = this.ensureMessages(s);
1208
+ const boundary = messages.findIndex((message) => message.info.id === s.tree.revert?.messageID);
1209
+ const visible = boundary < 0 ? messages : messages.slice(0, boundary);
1210
+ const user = visible.findLast((message) => message.info.role === "user")?.info;
1211
+ if (user?.role !== "user" || user.synthetic !== true) {
1212
+ throw new Error("prompt requires non-whitespace text, files, or agents");
1213
+ }
1214
+ }
1204
1215
  const native = nativePromptInput(text, parts ?? []);
1205
1216
  // OpenChamber treats instruction writes as best effort, so a rejected delivery must not fail the prompt;
1206
1217
  // the entries stay undelivered and are offered again before the next prompt.
package/dist/v2.js CHANGED
@@ -574,15 +574,18 @@ export class V2EventTranslator {
574
574
  return part.type === "tool" ? this.onToolPart(directory, part) : this.onTextPart(directory, part, delta);
575
575
  }
576
576
  onTextPart(directory, part, delta) {
577
- // Shell creates this user turn on the server; there is no optimistic prompt.
577
+ // Shell creates this user turn on the server; there is no optimistic prompt. OpenChamber 2.5 maps no
578
+ // `session.prompted` (packages/ui/src/lib/opencode/events.ts), so it learns of the turn from the inbox events;
579
+ // without them the shell card joins the previous turn. Both keep the message's own time, ahead of its card.
578
580
  if (part.type === "text" && part.synthetic) {
581
+ const created = part.time?.start ?? Date.now();
579
582
  return [
580
- this.frame(directory, "session.prompted", {
583
+ this.frame(directory, "session.inbox.enqueued", {
581
584
  sessionID: part.sessionID,
582
- messageID: part.messageID,
583
- prompt: { text: part.text },
584
- delivery: "queue",
585
- }),
585
+ inboxID: part.messageID,
586
+ item: { type: "user", delivery: "queue", payload: { text: part.text } },
587
+ }, created),
588
+ this.frame(directory, "session.inbox.delivered", { sessionID: part.sessionID, inboxID: part.messageID }, created),
586
589
  ];
587
590
  }
588
591
  const kind = part.type;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber-openchamber",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
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.4",
3
+ "version": "2.0.6",
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",