antechamber 2.0.12 → 2.0.14

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/approvals.js +2 -3
  3. package/dist/background-results.d.ts +0 -17
  4. package/dist/background-results.js +12 -9
  5. package/dist/cli.js +2 -1
  6. package/dist/commands/doctor.js +5 -4
  7. package/dist/commands/serve.js +3 -2
  8. package/dist/guards.d.ts +5 -0
  9. package/dist/guards.js +9 -0
  10. package/dist/http.d.ts +0 -2
  11. package/dist/http.js +3 -2
  12. package/dist/instructions.d.ts +17 -0
  13. package/dist/instructions.js +53 -0
  14. package/dist/mcp.d.ts +0 -4
  15. package/dist/mcp.js +3 -8
  16. package/dist/misc-routes.d.ts +1 -1
  17. package/dist/misc-routes.js +2 -2
  18. package/dist/monitor-sessions.d.ts +0 -2
  19. package/dist/monitor-sessions.js +7 -9
  20. package/dist/omo-shells.d.ts +0 -1
  21. package/dist/pi-rpc.d.ts +2 -2
  22. package/dist/pi-rpc.js +2 -1
  23. package/dist/proc-table-darwin.d.ts +2 -1
  24. package/dist/prompt-parts.js +7 -11
  25. package/dist/route-services.d.ts +3 -2
  26. package/dist/route-services.js +2 -1
  27. package/dist/routes-v2.js +5 -4
  28. package/dist/running-servers.d.ts +1 -1
  29. package/dist/self-update.d.ts +2 -3
  30. package/dist/self-update.js +4 -3
  31. package/dist/session-commands.js +2 -4
  32. package/dist/session-history.js +4 -1
  33. package/dist/session-store.js +28 -30
  34. package/dist/sessions.d.ts +4 -1
  35. package/dist/sessions.js +29 -94
  36. package/dist/sse.d.ts +0 -2
  37. package/dist/sse.js +1 -1
  38. package/dist/subagents.js +19 -21
  39. package/dist/todo-bridge.d.ts +0 -2
  40. package/dist/todo-bridge.js +11 -13
  41. package/dist/tool-map.d.ts +1 -1
  42. package/dist/tool-map.js +22 -22
  43. package/dist/types.d.ts +8 -32
  44. package/dist/v2.d.ts +2 -7
  45. package/dist/v2.js +1 -1
  46. package/dist/vcs.js +2 -1
  47. package/dist/work-status.d.ts +2 -8
  48. package/dist/work-status.js +18 -20
  49. package/extensions/antechamber/package.json +1 -1
  50. package/package.json +4 -2
@@ -17,11 +17,12 @@
17
17
  import { readFileSync } from "node:fs";
18
18
  import { dirname, join } from "node:path";
19
19
  import { errorBody, json } from "./http.js";
20
- export const WAKE_SOURCE_STATE_EVENT = "wake_source_state";
21
- export const GOAL_TIMER_STATE_EVENT = "goal_continuation_timer_state";
22
- export const GOAL_SCHEDULED_EVENT = "goal_continuation_scheduled";
23
- export const GOAL_FIRE_NOW_REQUEST = "goal_continuation_fire_now";
24
- export const CODEMODE_WAKE_SOURCE = "senpi-codemode";
20
+ import { isRecord } from "./guards.js";
21
+ const WAKE_SOURCE_STATE_EVENT = "wake_source_state";
22
+ const GOAL_TIMER_STATE_EVENT = "goal_continuation_timer_state";
23
+ const GOAL_SCHEDULED_EVENT = "goal_continuation_scheduled";
24
+ const GOAL_FIRE_NOW_REQUEST = "goal_continuation_fire_now";
25
+ const CODEMODE_WAKE_SOURCE = "senpi-codemode";
25
26
  /** Ended watches and matched lines kept per watch in a snapshot. */
26
27
  const MAX_ENDED_MONITORS = 5;
27
28
  const MAX_MONITOR_LINES = 20;
@@ -37,24 +38,21 @@ export class WorkStatusError extends Error {
37
38
  this.name = "WorkStatusError";
38
39
  }
39
40
  }
40
- function record(value) {
41
- return value !== null && typeof value === "object" && !Array.isArray(value);
42
- }
43
41
  function finite(value) {
44
42
  return typeof value === "number" && Number.isFinite(value) ? value : undefined;
45
43
  }
46
44
  function nonEmpty(value) {
47
45
  return typeof value === "string" && value !== "" ? value : undefined;
48
46
  }
49
- export function parseWakeSource(data) {
50
- if (!record(data) || typeof data.source !== "string" || data.source === "")
47
+ function parseWakeSource(data) {
48
+ if (!isRecord(data) || typeof data.source !== "string" || data.source === "")
51
49
  return undefined;
52
50
  const activeCount = finite(data.activeCount);
53
51
  if (activeCount === undefined)
54
52
  return undefined;
55
53
  const rawItems = Array.isArray(data.items) ? data.items : Array.isArray(data.monitors) ? data.monitors : [];
56
54
  const items = rawItems.flatMap((item) => {
57
- if (!record(item) || typeof item.id !== "string")
55
+ if (!isRecord(item) || typeof item.id !== "string")
58
56
  return [];
59
57
  const startedAtMs = finite(item.startedAtMs);
60
58
  if (startedAtMs === undefined)
@@ -63,8 +61,8 @@ export function parseWakeSource(data) {
63
61
  });
64
62
  return { source: data.source, activeCount, items };
65
63
  }
66
- export function parseEvalCell(value) {
67
- if (!record(value) || typeof value.cellId !== "string" || typeof value.state !== "string")
64
+ function parseEvalCell(value) {
65
+ if (!isRecord(value) || typeof value.cellId !== "string" || typeof value.state !== "string")
68
66
  return undefined;
69
67
  const language = nonEmpty(value.language);
70
68
  const startedAtMs = finite(value.startedAtMs);
@@ -103,15 +101,15 @@ export function readBackgroundSessions(sessionFile, piSessionId, isAlive = alive
103
101
  catch {
104
102
  return []; // Missing (no background session yet), or mid-write: the next poll reads it.
105
103
  }
106
- if (!record(manifest) || !Array.isArray(manifest.backgroundSessions))
104
+ if (!isRecord(manifest) || !Array.isArray(manifest.backgroundSessions))
107
105
  return [];
108
106
  return manifest.backgroundSessions.flatMap((entry) => {
109
- if (!record(entry) || typeof entry.id !== "string")
107
+ if (!isRecord(entry) || typeof entry.id !== "string")
110
108
  return [];
111
109
  const startedAtMs = finite(entry.startedAtMs);
112
110
  if (startedAtMs === undefined)
113
111
  return [];
114
- const pid = record(entry.runtime) ? finite(entry.runtime.pid) : undefined;
112
+ const pid = isRecord(entry.runtime) ? finite(entry.runtime.pid) : undefined;
115
113
  if (pid !== undefined && !isAlive(pid))
116
114
  return [];
117
115
  return [
@@ -172,7 +170,7 @@ export class WorkStatusBridge {
172
170
  delete work.evalList;
173
171
  return;
174
172
  }
175
- if (!record(ev.data))
173
+ if (!isRecord(ev.data))
176
174
  return;
177
175
  if (ev.name === GOAL_TIMER_STATE_EVENT) {
178
176
  const work = this.state(s.info.id);
@@ -188,7 +186,7 @@ export class WorkStatusBridge {
188
186
  }
189
187
  : null;
190
188
  }
191
- else if (ev.name === GOAL_SCHEDULED_EVENT && record(ev.data.wakeSources)) {
189
+ else if (ev.name === GOAL_SCHEDULED_EVENT && isRecord(ev.data.wakeSources)) {
192
190
  const counts = Object.fromEntries(Object.entries(ev.data.wakeSources).filter((entry) => finite(entry[1]) !== undefined));
193
191
  const work = this.state(s.info.id);
194
192
  work.goal = { ...(work.goal ?? { armed: false }), wakeSources: counts };
@@ -242,7 +240,7 @@ export class WorkStatusBridge {
242
240
  async peekEvalCell(s, cellId, tailBytes) {
243
241
  const bytes = Math.max(0, Math.min(MAX_PEEK_BYTES, Math.trunc(tailBytes)));
244
242
  const data = await this.evalCommand(s, { type: "eval_cells.peek", cellId, tailBytes: bytes });
245
- if (!record(data))
243
+ if (!isRecord(data))
246
244
  throw new WorkStatusError(502, "OmO answered eval_cells.peek without a cell");
247
245
  return data;
248
246
  }
@@ -251,7 +249,7 @@ export class WorkStatusBridge {
251
249
  const work = this.work.get(s.info.id);
252
250
  if (work !== undefined)
253
251
  delete work.evalList;
254
- if (!record(data))
252
+ if (!isRecord(data))
255
253
  throw new WorkStatusError(502, "OmO answered eval_cells.stop without a cell");
256
254
  return data;
257
255
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antechamber-openchamber",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
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.12",
3
+ "version": "2.0.14",
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",
@@ -57,7 +57,8 @@
57
57
  "lint": "biome lint . --error-on-warnings",
58
58
  "format": "biome format --write .",
59
59
  "format:check": "biome format .",
60
- "check": "npm run typecheck && npm run lint && npm run format:check && npm test",
60
+ "knip": "knip --no-progress",
61
+ "check": "npm run typecheck && npm run lint && npm run format:check && npm run knip && npm test",
61
62
  "test": "tsx --test --import ./test/setup.ts test/*.test.ts extensions/*/test/*.test.ts extensions/*/test/*/*.test.ts",
62
63
  "probe": "tsx contrib/probe.ts",
63
64
  "smoke": "tsx contrib/smoke.ts",
@@ -82,6 +83,7 @@
82
83
  "@opencode-ai/sdk": "^1.18.31",
83
84
  "@types/node": "^22.0.0",
84
85
  "esbuild": "^0.28.2",
86
+ "knip": "^6.48.0",
85
87
  "tsx": "^4.23.14",
86
88
  "typescript": "^7.0.2"
87
89
  },