@oxgeneral/orch 0.3.2 → 0.3.4

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 (128) hide show
  1. package/dist/App-RKAPZNZO.js +6682 -0
  2. package/dist/agent-KBTLGGCT.js +183 -0
  3. package/dist/agent-shop-YN2BSLHM.js +2 -0
  4. package/dist/chunk-2C2TFQ7K.js +136 -0
  5. package/dist/chunk-45K2XID7.js +29 -0
  6. package/dist/{shell-IH2MMTVP.js → chunk-52BFUGDD.js} +8 -6
  7. package/dist/chunk-7X2GI5OV.js +181 -0
  8. package/dist/{chunk-HSBYJ5C5.js → chunk-A36WAF2S.js} +89 -2
  9. package/dist/chunk-CHIP7O6V.js +83 -0
  10. package/dist/{claude-RIB3RQS5.js → chunk-D6RFF3KN.js} +12 -9
  11. package/dist/{chunk-BCPUTULS.js → chunk-DAVHOWGD.js} +188 -16
  12. package/dist/chunk-FRTKB575.js +87 -0
  13. package/dist/chunk-HXYAZGLP.js +15 -0
  14. package/dist/chunk-I3SMISEF.js +29 -0
  15. package/dist/chunk-K6DMQERQ.js +89 -0
  16. package/dist/chunk-LV6GDBBI.js +297 -0
  17. package/dist/chunk-NLQAJ7TW.js +147 -0
  18. package/dist/chunk-NLQAJ7TW.js.map +1 -0
  19. package/dist/chunk-P6ATSXGL.js +107 -0
  20. package/dist/chunk-PNE6LQRF.js +5 -0
  21. package/dist/{chunk-MGFMVPRD.js → chunk-S3QYSBW4.js} +11 -4
  22. package/dist/chunk-S3QYSBW4.js.map +1 -0
  23. package/dist/chunk-U2VDNUZL.js +52 -0
  24. package/dist/{chunk-QEEM67OA.js → chunk-UIJYU3J7.js} +3 -3
  25. package/dist/{chunk-QEEM67OA.js.map → chunk-UIJYU3J7.js.map} +1 -1
  26. package/dist/{chunk-2UC4SVJB.js → chunk-VMDQVRBR.js} +22 -8
  27. package/dist/chunk-VMDQVRBR.js.map +1 -0
  28. package/dist/chunk-W6RSVMXR.js +66 -0
  29. package/dist/claude-INM52PTH.js +88 -0
  30. package/dist/claude-INM52PTH.js.map +1 -0
  31. package/dist/claude-NHUNA5RZ.js +5 -0
  32. package/dist/cli.js +199 -1
  33. package/dist/clipboard-service-RTDUUQQU.js +200 -0
  34. package/dist/{codex-VBUSA2GJ.js → codex-DIXT44JR.js} +17 -11
  35. package/dist/codex-QGH2GRV6.js +125 -0
  36. package/dist/codex-QGH2GRV6.js.map +1 -0
  37. package/dist/config-OTAVSMOD.js +75 -0
  38. package/dist/container-LJU4QNDH.js +1594 -0
  39. package/dist/context-OL4BVUV5.js +83 -0
  40. package/dist/{cursor-4QIOTDBW.js → cursor-C3TR2IJC.js} +11 -8
  41. package/dist/cursor-KQJTQ73D.js +99 -0
  42. package/dist/cursor-KQJTQ73D.js.map +1 -0
  43. package/dist/doctor-V2FPS236.js +67 -0
  44. package/dist/doctor-service-TPOMFAIG.js +2 -0
  45. package/dist/goal-FMYYN2FR.js +138 -0
  46. package/dist/index.d.ts +64 -41
  47. package/dist/index.js +23 -14
  48. package/dist/index.js.map +1 -1
  49. package/dist/init-U7MCIOB2.js +165 -0
  50. package/dist/logs-PHPYWQ6I.js +207 -0
  51. package/dist/msg-FUWWLEKM.js +95 -0
  52. package/dist/orchestrator-ADO66XZ3.js +5 -0
  53. package/dist/{orchestrator-FGGXK3N3.js.map → orchestrator-ADO66XZ3.js.map} +1 -1
  54. package/dist/orchestrator-E3FQ4SOE.js +1424 -0
  55. package/dist/process-manager-HUVNAPQV.js +2 -0
  56. package/dist/registry-PQWRVNF2.js +2 -0
  57. package/dist/run-N72G5V2H.js +95 -0
  58. package/dist/shell-3S4VLYEG.js +4 -0
  59. package/dist/shell-JXOPKDXH.js +221 -0
  60. package/dist/shell-JXOPKDXH.js.map +1 -0
  61. package/dist/shop-picker-2HY67UWP.js +79 -0
  62. package/dist/status-RZWN2C6C.js +56 -0
  63. package/dist/task-2TJW6Z7O.js +221 -0
  64. package/dist/team-PFLP4PPL.js +97 -0
  65. package/dist/template-engine-4IZKRRHG.js +3 -0
  66. package/dist/tui-IM3YUUVD.js +245 -0
  67. package/dist/update-YLP7FPNY.js +64 -0
  68. package/dist/update-check-4YKLGBFB.js +2 -0
  69. package/dist/{workspace-manager-T6AXG7XL.js → workspace-manager-EVD67GCG.js} +4 -4
  70. package/dist/{workspace-manager-T6AXG7XL.js.map → workspace-manager-EVD67GCG.js.map} +1 -1
  71. package/dist/workspace-manager-JM6U7JOH.js +215 -0
  72. package/package.json +1 -1
  73. package/readme.md +9 -2
  74. package/scripts/postinstall.js +44 -2
  75. package/dist/App-YJM5QGP7.js +0 -19
  76. package/dist/agent-S4DKSX63.js +0 -9
  77. package/dist/agent-shop-D2RS4BZK.js +0 -2
  78. package/dist/chunk-2UC4SVJB.js.map +0 -1
  79. package/dist/chunk-5AJ4LYO5.js +0 -8
  80. package/dist/chunk-6MJ7V6VY.js +0 -2
  81. package/dist/chunk-CDFA4IIQ.js +0 -2
  82. package/dist/chunk-CHRW4CLD.js +0 -2
  83. package/dist/chunk-GZ2Q56YZ.js +0 -2
  84. package/dist/chunk-HMMPM7MF.js +0 -3
  85. package/dist/chunk-HXOMNULD.js +0 -2
  86. package/dist/chunk-IQXRQBUK.js +0 -83
  87. package/dist/chunk-IQXRQBUK.js.map +0 -1
  88. package/dist/chunk-L26TK7Y5.js +0 -2
  89. package/dist/chunk-L3FYR45M.js +0 -2
  90. package/dist/chunk-LXNRCJ22.js +0 -2
  91. package/dist/chunk-MGFMVPRD.js.map +0 -1
  92. package/dist/chunk-MNXU3KCD.js +0 -2
  93. package/dist/chunk-PJ5DKXGR.js +0 -2
  94. package/dist/chunk-UMZEA3JT.js +0 -5
  95. package/dist/chunk-UW6GUUE6.js +0 -3
  96. package/dist/chunk-ZA5Z33GO.js +0 -11
  97. package/dist/claude-E36EGXUV.js +0 -2
  98. package/dist/claude-RIB3RQS5.js.map +0 -1
  99. package/dist/clipboard-service-PDTSZIR5.js +0 -25
  100. package/dist/codex-OTZKVESD.js +0 -2
  101. package/dist/codex-VBUSA2GJ.js.map +0 -1
  102. package/dist/config-CCSS2P7R.js +0 -2
  103. package/dist/container-OIXLFSX2.js +0 -6
  104. package/dist/context-GSMQHQES.js +0 -7
  105. package/dist/cursor-3DJA6LWS.js +0 -2
  106. package/dist/cursor-4QIOTDBW.js.map +0 -1
  107. package/dist/doctor-KBK5JZBZ.js +0 -2
  108. package/dist/doctor-service-PB7YBH3F.js +0 -2
  109. package/dist/goal-RFKFPR7M.js +0 -8
  110. package/dist/init-WRDFAFS2.js +0 -53
  111. package/dist/logs-5QHJWMEG.js +0 -12
  112. package/dist/msg-4SCLBO4K.js +0 -9
  113. package/dist/orchestrator-FGGXK3N3.js +0 -5
  114. package/dist/orchestrator-R7IWZUT6.js +0 -13
  115. package/dist/process-manager-33H27MQF.js +0 -2
  116. package/dist/registry-BO2PPRNG.js +0 -2
  117. package/dist/run-HSHRELOP.js +0 -3
  118. package/dist/shell-EOJBDWTH.js +0 -2
  119. package/dist/shell-IH2MMTVP.js.map +0 -1
  120. package/dist/shop-picker-LE3SKFOX.js +0 -5
  121. package/dist/status-DLBNWSWM.js +0 -2
  122. package/dist/task-J6ZN7ALI.js +0 -20
  123. package/dist/team-MSIBKOQC.js +0 -4
  124. package/dist/template-engine-ONIDVD4F.js +0 -2
  125. package/dist/tui-LW7WIDE3.js +0 -2
  126. package/dist/update-PC2ENCKU.js +0 -2
  127. package/dist/update-check-HGMBDYHL.js +0 -2
  128. package/dist/workspace-manager-KOOYTO7E.js +0 -3
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { printSuccess, printError, dim, formatDurationSince, printTable } from './chunk-7X2GI5OV.js';
3
+
4
+ // src/cli/commands/context.ts
5
+ function registerContextCommand(program, container) {
6
+ const ctx = program.command("context").description("Shared context store for inter-agent data exchange");
7
+ ctx.command("set <key> <value>").description("Set a shared context entry").option("--ttl <ms>", "Time-to-live in milliseconds").action(async (key, value, opts) => {
8
+ await container.paths.requireInit();
9
+ const ttlMs = opts.ttl ? parseInt(opts.ttl, 10) : void 0;
10
+ await container.contextStore.set(key, value, ttlMs);
11
+ if (container.context.json) {
12
+ const entry = await container.contextStore.get(key);
13
+ console.log(JSON.stringify(entry, null, 2));
14
+ } else if (container.context.quiet) {
15
+ console.log(key);
16
+ } else {
17
+ printSuccess(`Set context "${key}"`);
18
+ }
19
+ });
20
+ ctx.command("get <key>").description("Get a shared context entry").action(async (key) => {
21
+ await container.paths.requireInit();
22
+ const entry = await container.contextStore.get(key);
23
+ if (!entry) {
24
+ if (container.context.json) {
25
+ console.log("null");
26
+ } else {
27
+ printError(`Context key "${key}" not found`);
28
+ }
29
+ return;
30
+ }
31
+ if (container.context.json) {
32
+ console.log(JSON.stringify(entry, null, 2));
33
+ } else if (container.context.quiet) {
34
+ console.log(entry.value);
35
+ } else {
36
+ console.log(`
37
+ ${key} = ${entry.value}`);
38
+ if (entry.expires_at) {
39
+ console.log(` ${dim(`expires: ${entry.expires_at}`)}`);
40
+ }
41
+ console.log();
42
+ }
43
+ });
44
+ ctx.command("list").description("List all shared context entries").action(async () => {
45
+ await container.paths.requireInit();
46
+ const entries = await container.contextStore.list();
47
+ if (container.context.json) {
48
+ console.log(JSON.stringify(entries, null, 2));
49
+ return;
50
+ }
51
+ if (container.context.quiet) {
52
+ entries.forEach((e) => console.log(`${e.key}=${e.value}`));
53
+ return;
54
+ }
55
+ if (entries.length === 0) {
56
+ console.log(`
57
+ No shared context entries. Set one: ${dim("orch context set key value")}
58
+ `);
59
+ return;
60
+ }
61
+ const headers = ["KEY", "VALUE", "UPDATED", "TTL"];
62
+ const rows = entries.map((e) => [
63
+ e.key,
64
+ e.value.length > 50 ? e.value.slice(0, 47) + "..." : e.value,
65
+ formatDurationSince(e.updated_at),
66
+ e.expires_at ? formatDurationSince(e.expires_at) : dim("\u2014")
67
+ ]);
68
+ console.log();
69
+ printTable(headers, rows);
70
+ console.log(`
71
+ ${entries.length} entries
72
+ `);
73
+ });
74
+ ctx.command("delete <key>").description("Delete a shared context entry").action(async (key) => {
75
+ await container.paths.requireInit();
76
+ await container.contextStore.delete(key);
77
+ if (!container.context.quiet && !container.context.json) {
78
+ printSuccess(`Deleted context "${key}"`);
79
+ }
80
+ });
81
+ }
82
+
83
+ export { registerContextCommand };
@@ -1,6 +1,7 @@
1
- import { createStreamingEvents, extractTokens } from './chunk-MGFMVPRD.js';
2
- import './chunk-XDVMX2FO.js';
3
- import './chunk-O2MSGW3V.js';
1
+ #!/usr/bin/env node
2
+ import { createStreamingEvents, extractTokens } from './chunk-W6RSVMXR.js';
3
+ import './chunk-CHIP7O6V.js';
4
+ import { classifyAdapterError } from './chunk-2C2TFQ7K.js';
4
5
  import { execFile } from 'child_process';
5
6
  import { promisify } from 'util';
6
7
 
@@ -29,7 +30,8 @@ var CursorAdapter = class {
29
30
  }
30
31
  return {
31
32
  ok: false,
32
- error: "Cursor Agent CLI not found. The headless agent CLI is required (cursor-agent or agent)."
33
+ error: "Cursor Agent CLI not found. The headless agent CLI is required (cursor-agent or agent).",
34
+ errorKind: "adapter_not_found" /* ADAPTER_NOT_FOUND */
33
35
  };
34
36
  }
35
37
  execute(params) {
@@ -75,8 +77,11 @@ function parseCursorEvent(line) {
75
77
  return { type: "tool_call", timestamp, data: parsed };
76
78
  case "tool_result":
77
79
  return { type: "output", timestamp, data: parsed };
78
- case "error":
79
- return { type: "error", timestamp, data: parsed.error ?? parsed };
80
+ case "error": {
81
+ const errData = parsed.error ?? parsed;
82
+ const errMsg = typeof errData === "string" ? errData : JSON.stringify(errData);
83
+ return { type: "error", timestamp, data: errData, errorKind: classifyAdapterError(errMsg) };
84
+ }
80
85
  case "result": {
81
86
  const tokens = extractTokens(parsed);
82
87
  return { type: "done", timestamp, data: parsed, tokens };
@@ -90,5 +95,3 @@ function parseCursorEvent(line) {
90
95
  }
91
96
 
92
97
  export { CursorAdapter };
93
- //# sourceMappingURL=cursor-4QIOTDBW.js.map
94
- //# sourceMappingURL=cursor-4QIOTDBW.js.map
@@ -0,0 +1,99 @@
1
+ import { createStreamingEvents, extractTokens } from './chunk-S3QYSBW4.js';
2
+ import './chunk-XDVMX2FO.js';
3
+ import { classifyAdapterError } from './chunk-NLQAJ7TW.js';
4
+ import './chunk-O2MSGW3V.js';
5
+ import { execFile } from 'child_process';
6
+ import { promisify } from 'util';
7
+
8
+ var execFileAsync = promisify(execFile);
9
+ async function findCommand() {
10
+ for (const cmd of ["cursor-agent", "agent"]) {
11
+ try {
12
+ const { stdout } = await execFileAsync(cmd, ["--version"]);
13
+ return { command: cmd, version: stdout.trim() };
14
+ } catch {
15
+ }
16
+ }
17
+ return null;
18
+ }
19
+ var CursorAdapter = class {
20
+ constructor(processManager) {
21
+ this.processManager = processManager;
22
+ }
23
+ kind = "cursor";
24
+ resolvedCommand = "cursor-agent";
25
+ async test() {
26
+ const found = await findCommand();
27
+ if (found) {
28
+ this.resolvedCommand = found.command;
29
+ return { ok: true, version: found.version };
30
+ }
31
+ return {
32
+ ok: false,
33
+ error: "Cursor Agent CLI not found. The headless agent CLI is required (cursor-agent or agent).",
34
+ errorKind: "adapter_not_found" /* ADAPTER_NOT_FOUND */
35
+ };
36
+ }
37
+ execute(params) {
38
+ const args = [
39
+ "-p",
40
+ "--output-format",
41
+ "stream-json",
42
+ "--workspace",
43
+ params.workspace,
44
+ "--yolo"
45
+ // bypass interactive prompts for autonomous agents
46
+ ];
47
+ if (params.config.model) {
48
+ args.push("--model", params.config.model);
49
+ }
50
+ const { process: proc, pid } = this.processManager.spawn(this.resolvedCommand, args, {
51
+ cwd: params.workspace,
52
+ env: { ...process.env, ...params.env },
53
+ signal: params.signal,
54
+ stdio: ["pipe", "pipe", "pipe"]
55
+ // stdin must be 'pipe' to send prompt
56
+ });
57
+ if (proc.stdin) {
58
+ proc.stdin.write(params.prompt);
59
+ proc.stdin.end();
60
+ }
61
+ const events = createStreamingEvents(proc, parseCursorEvent, "Cursor agent", params.signal);
62
+ return { pid, events };
63
+ }
64
+ async stop(pid) {
65
+ await this.processManager.killWithGrace(pid);
66
+ }
67
+ };
68
+ function parseCursorEvent(line) {
69
+ if (!line.trim()) return null;
70
+ try {
71
+ const parsed = JSON.parse(line);
72
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
73
+ switch (parsed.type) {
74
+ case "assistant":
75
+ return { type: "output", timestamp, data: parsed.message ?? parsed };
76
+ case "tool_use":
77
+ return { type: "tool_call", timestamp, data: parsed };
78
+ case "tool_result":
79
+ return { type: "output", timestamp, data: parsed };
80
+ case "error": {
81
+ const errData = parsed.error ?? parsed;
82
+ const errMsg = typeof errData === "string" ? errData : JSON.stringify(errData);
83
+ return { type: "error", timestamp, data: errData, errorKind: classifyAdapterError(errMsg) };
84
+ }
85
+ case "result": {
86
+ const tokens = extractTokens(parsed);
87
+ return { type: "done", timestamp, data: parsed, tokens };
88
+ }
89
+ default:
90
+ return { type: "output", timestamp, data: parsed };
91
+ }
92
+ } catch {
93
+ return { type: "output", timestamp: (/* @__PURE__ */ new Date()).toISOString(), data: line };
94
+ }
95
+ }
96
+
97
+ export { CursorAdapter };
98
+ //# sourceMappingURL=cursor-KQJTQ73D.js.map
99
+ //# sourceMappingURL=cursor-KQJTQ73D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/infrastructure/adapters/cursor.ts"],"names":[],"mappings":";;;;;;;AAkBA,IAAM,aAAA,GAAgB,UAAU,QAAQ,CAAA;AAGxC,eAAe,WAAA,GAAoE;AACjF,EAAA,KAAA,MAAW,GAAA,IAAO,CAAC,cAAA,EAAgB,OAAO,CAAA,EAAG;AAC3C,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,QAAO,GAAI,MAAM,cAAc,GAAA,EAAK,CAAC,WAAW,CAAC,CAAA;AACzD,MAAA,OAAO,EAAE,OAAA,EAAS,GAAA,EAAK,OAAA,EAAS,MAAA,CAAO,MAAK,EAAE;AAAA,IAChD,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AA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AAA,CAAK,UAAU,OAAO,CAAA;AAC7E,QAAA,OAAO,EAAE,MAAM,OAAA,EAAS,SAAA,EAAW,MAAM,OAAA,EAAS,SAAA,EAAW,oBAAA,CAAqB,MAAM,CAAA,EAAE;AAAA,MAC5F;AAAA,MACA,KAAK,QAAA,EAAU;AACb,QAAA,MAAM,MAAA,GAAS,cAAc,MAAM,CAAA;AACnC,QAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAA,EAAW,IAAA,EAAM,QAAQ,MAAA,EAAO;AAAA,MACzD;AAAA,MACA;AACE,QAAA,OAAO,EAAE,IAAA,EAAM,QAAA,EAAU,SAAA,EAAW,MAAM,MAAA,EAAO;AAAA;AACrD,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,IAAA,EAAM,QAAA,EAAU,SAAA,EAAA,iBAAW,IAAI,MAAK,EAAE,WAAA,EAAY,EAAG,IAAA,EAAM,IAAA,EAAK;AAAA,EAC3E;AACF","file":"cursor-KQJTQ73D.js","sourcesContent":["/**\n * Cursor Agent adapter.\n *\n * Spawns `cursor-agent` (Cursor's headless agent CLI) with `--output-format stream-json`.\n * Falls back to `agent` command if `cursor-agent` is not found.\n * Parses JSON-lines from stdout into AgentEvent stream.\n *\n * Note: This requires Cursor Agent CLI, not the regular `cursor` IDE command.\n * Install via: npm i -g @anthropic-ai/cursor-agent (when available)\n */\n\nimport type { IAgentAdapter, AdapterTestResult, ExecuteParams, AgentEvent, ExecuteHandle } from './interface.js';\nimport type { IProcessManager } from '../process/process-manager.js';\nimport { extractTokens, createStreamingEvents } from './utils.js';\nimport { classifyAdapterError, AdapterErrorKind } from '../../domain/errors.js';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execFileAsync = promisify(execFile);\n\n/** Try multiple command names and return the first that works */\nasync function findCommand(): Promise<{ command: string; version: string } | null> {\n for (const cmd of ['cursor-agent', 'agent']) {\n try {\n const { stdout } = await execFileAsync(cmd, ['--version']);\n return { command: cmd, version: stdout.trim() };\n } catch {\n // try next\n }\n }\n return null;\n}\n\nexport class CursorAdapter implements IAgentAdapter {\n readonly kind = 'cursor';\n\n private resolvedCommand: string = 'cursor-agent';\n\n constructor(private readonly processManager: IProcessManager) {}\n\n async test(): Promise<AdapterTestResult> {\n const found = await findCommand();\n if (found) {\n this.resolvedCommand = found.command;\n return { ok: true, version: found.version };\n }\n return {\n ok: false,\n error: 'Cursor Agent CLI not found. The headless agent CLI is required (cursor-agent or agent).',\n errorKind: AdapterErrorKind.ADAPTER_NOT_FOUND,\n };\n }\n\n execute(params: ExecuteParams): ExecuteHandle {\n const args = [\n '-p',\n '--output-format', 'stream-json',\n '--workspace', params.workspace,\n '--yolo', // bypass interactive prompts for autonomous agents\n ];\n\n if (params.config.model) {\n args.push('--model', params.config.model);\n }\n\n const { process: proc, pid } = this.processManager.spawn(this.resolvedCommand, args, {\n cwd: params.workspace,\n env: { ...process.env, ...params.env },\n signal: params.signal,\n stdio: ['pipe', 'pipe', 'pipe'], // stdin must be 'pipe' to send prompt\n });\n\n // Pipe prompt via stdin\n if (proc.stdin) {\n proc.stdin.write(params.prompt);\n proc.stdin.end();\n }\n\n const events = createStreamingEvents(proc, parseCursorEvent, 'Cursor agent', params.signal);\n\n return { pid, events };\n }\n\n async stop(pid: number): Promise<void> {\n await this.processManager.killWithGrace(pid);\n }\n}\n\nfunction parseCursorEvent(line: string): AgentEvent | null {\n if (!line.trim()) return null;\n\n try {\n const parsed: Record<string, unknown> = JSON.parse(line);\n const timestamp = new Date().toISOString();\n\n // Cursor stream-json uses the same format as Claude stream-json\n switch (parsed.type) {\n case 'assistant':\n return { type: 'output', timestamp, data: (parsed.message as unknown) ?? parsed };\n case 'tool_use':\n return { type: 'tool_call', timestamp, data: parsed };\n case 'tool_result':\n return { type: 'output', timestamp, data: parsed };\n case 'error': {\n const errData = (parsed.error as unknown) ?? parsed;\n const errMsg = typeof errData === 'string' ? errData : JSON.stringify(errData);\n return { type: 'error', timestamp, data: errData, errorKind: classifyAdapterError(errMsg) };\n }\n case 'result': {\n const tokens = extractTokens(parsed);\n return { type: 'done', timestamp, data: parsed, tokens };\n }\n default:\n return { type: 'output', timestamp, data: parsed };\n }\n } catch {\n return { type: 'output', timestamp: new Date().toISOString(), data: line };\n }\n}\n"]}
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ import { DoctorService } from './chunk-K6DMQERQ.js';
3
+ import { amber, getIcon, dim } from './chunk-7X2GI5OV.js';
4
+ import { AdapterRegistry } from './chunk-45K2XID7.js';
5
+ import { ClaudeAdapter } from './chunk-D6RFF3KN.js';
6
+ import './chunk-W6RSVMXR.js';
7
+ import { ShellAdapter } from './chunk-52BFUGDD.js';
8
+ import { ProcessManager } from './chunk-CHIP7O6V.js';
9
+ import { Paths } from './chunk-LV6GDBBI.js';
10
+ import './chunk-2C2TFQ7K.js';
11
+ import chalk from 'chalk';
12
+
13
+ function registerDoctorCommand(program, container) {
14
+ program.command("doctor").description("Check adapters and dependencies").action(async () => {
15
+ let doctorService;
16
+ let paths;
17
+ let hasContainer = false;
18
+ if (container) {
19
+ doctorService = container.doctorService;
20
+ paths = container.paths;
21
+ hasContainer = true;
22
+ } else {
23
+ const pm = new ProcessManager();
24
+ const registry = new AdapterRegistry();
25
+ registry.register(new ClaudeAdapter(pm));
26
+ registry.register(new ShellAdapter(pm));
27
+ doctorService = new DoctorService(registry, pm, process.cwd());
28
+ paths = new Paths(process.cwd());
29
+ }
30
+ console.log();
31
+ console.log(` ${amber("orch doctor")} \xB7 checking adapters and dependencies`);
32
+ console.log();
33
+ const report = await doctorService.runAll();
34
+ if (container?.context.json) {
35
+ console.log(JSON.stringify(report, null, 2));
36
+ return;
37
+ }
38
+ for (const check of report.checks) {
39
+ const icon = check.status === "ok" ? chalk.ansi256(72)(getIcon("done")) : check.status === "fail" ? chalk.ansi256(167)(getIcon("failed")) : dim("\u2014");
40
+ const detail = check.detail ? dim(` ${check.detail}`) : "";
41
+ console.log(` ${icon} ${check.name.padEnd(12)}${detail}`);
42
+ }
43
+ if (paths) {
44
+ const initialized = await paths.isInitialized();
45
+ if (initialized && hasContainer) {
46
+ const agents = await container.agentService.list();
47
+ const tasks = await container.taskService.list();
48
+ console.log();
49
+ console.log(
50
+ ` ${chalk.ansi256(72)(getIcon("done"))} .orchestry/ ${dim(`exists \xB7 ${agents.length} agents \xB7 ${tasks.length} tasks`)}`
51
+ );
52
+ } else if (!initialized) {
53
+ console.log();
54
+ console.log(
55
+ ` ${chalk.ansi256(167)(getIcon("failed"))} .orchestry/ ${dim("not found \u2014 run: orch init")}`
56
+ );
57
+ }
58
+ }
59
+ console.log();
60
+ console.log(
61
+ ` ${report.adaptersReady} of ${report.adaptersTotal} adapters ready`
62
+ );
63
+ console.log();
64
+ });
65
+ }
66
+
67
+ export { registerDoctorCommand };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export { DoctorService } from './chunk-K6DMQERQ.js';
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+ import { GOAL_STATUSES } from './chunk-HXYAZGLP.js';
3
+ import { printSuccess, dim, printTable, printKeyValue, statusIcon, agentName, printError } from './chunk-7X2GI5OV.js';
4
+
5
+ // src/cli/commands/goal.ts
6
+ var STATUS_ICON = {
7
+ active: "\u25CF",
8
+ // ●
9
+ paused: "\u2016",
10
+ // ‖
11
+ achieved: "\u2713",
12
+ // ✓
13
+ abandoned: "\u2715"
14
+ // ✕
15
+ };
16
+ function registerGoalCommand(program, container) {
17
+ const goal = program.command("goal").description("Manage goals");
18
+ goal.command("add <title>").description("Create a new goal").option("--description <desc>", "Goal description").option("--assignee <agentId>", "Assign to a specific agent").action(async (title, opts) => {
19
+ await container.paths.requireInit();
20
+ const g = await container.goalService.create({
21
+ title,
22
+ description: opts.description,
23
+ assignee: opts.assignee
24
+ });
25
+ if (container.context.json) {
26
+ console.log(JSON.stringify(g, null, 2));
27
+ } else if (container.context.quiet) {
28
+ console.log(g.id);
29
+ } else {
30
+ printSuccess(`Created goal "${g.title}" (${g.id})`);
31
+ }
32
+ });
33
+ goal.command("list").alias("ls").description("List all goals").option("--status <status>", "Filter by status").action(async (opts) => {
34
+ await container.paths.requireInit();
35
+ const goals = await container.goalService.list(
36
+ opts.status ? { status: opts.status } : void 0
37
+ );
38
+ if (container.context.json) {
39
+ console.log(JSON.stringify(goals, null, 2));
40
+ return;
41
+ }
42
+ if (goals.length === 0) {
43
+ console.log(dim("No goals found."));
44
+ return;
45
+ }
46
+ const rows = goals.map((g) => [
47
+ STATUS_ICON[g.status] ?? "?",
48
+ g.id,
49
+ g.title,
50
+ g.status,
51
+ g.assignee ?? dim("any")
52
+ ]);
53
+ printTable(["", "ID", "Title", "Status", "Assignee"], rows);
54
+ });
55
+ goal.command("show <id>").description("Show goal details").action(async (id) => {
56
+ await container.paths.requireInit();
57
+ const [g, tasks, progress] = await Promise.all([
58
+ container.goalService.get(id),
59
+ container.goalService.listTasksForGoal(id),
60
+ container.goalService.getProgressReport(id)
61
+ ]);
62
+ if (container.context.json) {
63
+ console.log(JSON.stringify({ ...g, tasks, progress }, null, 2));
64
+ return;
65
+ }
66
+ printKeyValue([
67
+ ["ID", g.id],
68
+ ["Title", g.title],
69
+ ["Status", g.status],
70
+ ["Assignee", g.assignee ?? dim("any")],
71
+ ["Description", g.description || dim("none")],
72
+ ["Created", g.created_at],
73
+ ["Updated", g.updated_at ?? dim("never")]
74
+ ]);
75
+ if (tasks.length > 0) {
76
+ console.log(`
77
+ Tasks (${tasks.length})
78
+ ${"\u2500".repeat(42)}`);
79
+ const rows = tasks.map((t) => [
80
+ `${statusIcon(t.status)} ${t.status}`,
81
+ t.id,
82
+ t.title.slice(0, 40),
83
+ t.assignee ? agentName(t.assignee) : dim("\u2014")
84
+ ]);
85
+ printTable(["STATUS", "ID", "TITLE", "AGENT"], rows);
86
+ } else {
87
+ console.log(`
88
+ ${dim("No tasks linked to this goal yet.")}`);
89
+ }
90
+ if (progress) {
91
+ console.log(`
92
+ Progress Report
93
+ ${"\u2500".repeat(42)}`);
94
+ for (const line of progress.split("\n")) {
95
+ console.log(` ${line}`);
96
+ }
97
+ }
98
+ console.log();
99
+ });
100
+ goal.command("status <id> <status>").description("Change goal status (active, paused, achieved, abandoned)").action(async (id, status) => {
101
+ await container.paths.requireInit();
102
+ if (!GOAL_STATUSES.includes(status)) {
103
+ printError(`Invalid status "${status}". Valid: ${GOAL_STATUSES.join(", ")}`);
104
+ process.exitCode = 1;
105
+ return;
106
+ }
107
+ const g = await container.goalService.updateStatus(id, status);
108
+ if (container.context.json) {
109
+ console.log(JSON.stringify(g, null, 2));
110
+ } else if (container.context.quiet) {
111
+ console.log(g.id);
112
+ } else {
113
+ printSuccess(`Goal "${g.title}" \u2192 ${g.status}`);
114
+ }
115
+ });
116
+ goal.command("update <id>").description("Update goal fields").option("--title <title>", "New title").option("--description <desc>", "New description").option("--assignee <agentId>", "New assignee (empty string to unassign)").action(async (id, opts) => {
117
+ await container.paths.requireInit();
118
+ const g = await container.goalService.update(id, opts);
119
+ if (container.context.json) {
120
+ console.log(JSON.stringify(g, null, 2));
121
+ } else if (container.context.quiet) {
122
+ console.log(g.id);
123
+ } else {
124
+ printSuccess(`Updated goal "${g.title}"`);
125
+ }
126
+ });
127
+ goal.command("delete <id>").alias("rm").description("Delete a goal").action(async (id) => {
128
+ await container.paths.requireInit();
129
+ await container.goalService.delete(id);
130
+ if (container.context.json) {
131
+ console.log(JSON.stringify({ deleted: id }));
132
+ } else if (!container.context.quiet) {
133
+ printSuccess(`Deleted goal ${id}`);
134
+ }
135
+ });
136
+ }
137
+
138
+ export { registerGoalCommand };
package/dist/index.d.ts CHANGED
@@ -86,6 +86,11 @@ interface AgentStats {
86
86
  total_runtime_ms: number;
87
87
  tokens_used?: number;
88
88
  }
89
+ interface AgentLastError {
90
+ message: string;
91
+ kind: string;
92
+ timestamp: string;
93
+ }
89
94
  interface Agent {
90
95
  id: string;
91
96
  name: string;
@@ -96,6 +101,7 @@ interface Agent {
96
101
  current_task?: string;
97
102
  autonomous?: boolean;
98
103
  stats: AgentStats;
104
+ last_error?: AgentLastError;
99
105
  }
100
106
  interface CreateAgentInput {
101
107
  name: string;
@@ -212,6 +218,7 @@ interface OrchestratorState {
212
218
  version: 1;
213
219
  pid?: number;
214
220
  started_at?: string;
221
+ onboardingCompleted?: boolean;
215
222
  running: Record<string, RunningEntry>;
216
223
  claimed: Set<string>;
217
224
  retry_queue: RetryEntry[];
@@ -228,6 +235,54 @@ interface OrchestratorState {
228
235
  };
229
236
  }
230
237
 
238
+ /**
239
+ * Typed error hierarchy for the orchestrator.
240
+ *
241
+ * Every error carries an exit code (matching CLI_UI_DESIGN.md §11)
242
+ * and an optional hint for the user.
243
+ *
244
+ * Exit codes:
245
+ * 0 - Success
246
+ * 1 - General error
247
+ * 2 - Invalid arguments
248
+ * 3 - Not initialized (.orchestry/ not found)
249
+ * 4 - Lock conflict (orchestrator already running)
250
+ * 5 - Agent error (adapter test failed)
251
+ */
252
+ declare class OrchestryError extends Error {
253
+ readonly exitCode: number;
254
+ readonly hint?: string | undefined;
255
+ constructor(message: string, exitCode: number, hint?: string | undefined);
256
+ }
257
+ declare class NotInitializedError extends OrchestryError {
258
+ constructor();
259
+ }
260
+ declare class TaskNotFoundError extends OrchestryError {
261
+ constructor(taskId: string);
262
+ }
263
+ declare class AgentNotFoundError extends OrchestryError {
264
+ constructor(agentId: string);
265
+ }
266
+ declare class WorkspaceError extends OrchestryError {
267
+ constructor(message: string, hint?: string);
268
+ }
269
+ declare enum AdapterErrorKind {
270
+ ADAPTER_NOT_FOUND = "adapter_not_found",
271
+ AUTH_FAILED = "auth_failed",
272
+ TIMEOUT = "timeout",
273
+ RATE_LIMIT = "rate_limit",
274
+ PROCESS_CRASH = "process_crash",
275
+ SPAWN_FAILED = "spawn_failed",
276
+ UNKNOWN = "unknown"
277
+ }
278
+ interface AdapterErrorHint {
279
+ message: string;
280
+ fix: string;
281
+ doctorHint?: boolean;
282
+ }
283
+ declare const ERROR_HINTS: Record<AdapterErrorKind, AdapterErrorHint>;
284
+ declare function classifyAdapterError(error: string, exitCode?: number): AdapterErrorKind;
285
+
231
286
  /**
232
287
  * Goal domain model.
233
288
  *
@@ -288,14 +343,6 @@ interface CreateMessageInput {
288
343
  reply_to?: string;
289
344
  }
290
345
 
291
- /**
292
- * Orchestrator event system.
293
- *
294
- * All communication between layers goes through typed events.
295
- * The EventBus emits these synchronously; subscribers (TUI, logger,
296
- * run store, state) react independently.
297
- */
298
-
299
346
  type OrchestratorEvent = {
300
347
  type: 'task:created';
301
348
  task: Task;
@@ -338,6 +385,7 @@ type OrchestratorEvent = {
338
385
  runId: string;
339
386
  agentId: string;
340
387
  error: string;
388
+ errorKind?: AdapterErrorKind;
341
389
  } | {
342
390
  type: 'run:retry';
343
391
  runId: string;
@@ -439,38 +487,6 @@ type EventPayload<T extends OrchestratorEventType> = Extract<OrchestratorEvent,
439
487
  type: T;
440
488
  }>;
441
489
 
442
- /**
443
- * Typed error hierarchy for the orchestrator.
444
- *
445
- * Every error carries an exit code (matching CLI_UI_DESIGN.md §11)
446
- * and an optional hint for the user.
447
- *
448
- * Exit codes:
449
- * 0 - Success
450
- * 1 - General error
451
- * 2 - Invalid arguments
452
- * 3 - Not initialized (.orchestry/ not found)
453
- * 4 - Lock conflict (orchestrator already running)
454
- * 5 - Agent error (adapter test failed)
455
- */
456
- declare class OrchestryError extends Error {
457
- readonly exitCode: number;
458
- readonly hint?: string | undefined;
459
- constructor(message: string, exitCode: number, hint?: string | undefined);
460
- }
461
- declare class NotInitializedError extends OrchestryError {
462
- constructor();
463
- }
464
- declare class TaskNotFoundError extends OrchestryError {
465
- constructor(taskId: string);
466
- }
467
- declare class AgentNotFoundError extends OrchestryError {
468
- constructor(agentId: string);
469
- }
470
- declare class WorkspaceError extends OrchestryError {
471
- constructor(message: string, hint?: string);
472
- }
473
-
474
490
  /**
475
491
  * Task state machine — pure functions, no side effects.
476
492
  *
@@ -878,6 +894,7 @@ interface AdapterTestResult {
878
894
  ok: boolean;
879
895
  version?: string;
880
896
  error?: string;
897
+ errorKind?: AdapterErrorKind;
881
898
  details?: Record<string, unknown>;
882
899
  }
883
900
  interface ExecuteParams {
@@ -896,6 +913,7 @@ interface AgentEvent {
896
913
  output: number;
897
914
  total: number;
898
915
  };
916
+ errorKind?: AdapterErrorKind;
899
917
  }
900
918
  interface ExecuteHandle {
901
919
  pid: number;
@@ -1257,8 +1275,13 @@ interface CliContext {
1257
1275
  */
1258
1276
  /** Activity feed filter preset name */
1259
1277
  type ActivityFilterPreset = 'all' | 'text' | 'tools' | 'errors' | 'events';
1278
+ interface NotificationPreferences {
1279
+ toast: boolean;
1280
+ bell: boolean;
1281
+ }
1260
1282
  interface TuiPreferences {
1261
1283
  activity_filter: ActivityFilterPreset;
1284
+ notifications: NotificationPreferences;
1262
1285
  }
1263
1286
  interface GlobalConfig {
1264
1287
  tui: TuiPreferences;
@@ -1431,4 +1454,4 @@ declare function buildFullContainer(context: CliContext): Promise<Container>;
1431
1454
  */
1432
1455
  declare function buildContainer(context: CliContext): Promise<Container>;
1433
1456
 
1434
- export { AdapterRegistry, type AdapterTestResult, type Agent, type AgentConfig, type AgentEvent, AgentNotFoundError, AgentService, type AgentStats, type AgentStatus, type ApprovalPolicy, type ClipboardContentType, type ClipboardImage, type Container, type CreateAgentInput, type CreateTaskInput, EventBus, type EventPayload, type ExecuteParams, type IAgentAdapter, type LightContainer, NotInitializedError, Orchestrator, type OrchestratorConfig, type OrchestratorEvent, type OrchestratorEventType, type OrchestratorState, OrchestryError, type ProjectConfig, type RetryEntry, type Run, type RunEvent, type RunEventType, RunService, type RunStatus, type RunningEntry, type SchedulingConfig, type Task, TaskNotFoundError, type TaskProof, TaskService, type TaskStatus, type TokenUsage, WorkspaceError, type WorkspaceMode, buildContainer, buildFullContainer, buildLightContainer, canTransition, createTokenUsage, detectClipboardType, getClipboardImage, isBlocked, isClipboardToolAvailable, isDispatchable, isTerminal, resolveFailureStatus };
1457
+ export { type AdapterErrorHint, AdapterErrorKind, AdapterRegistry, type AdapterTestResult, type Agent, type AgentConfig, type AgentEvent, type AgentLastError, AgentNotFoundError, AgentService, type AgentStats, type AgentStatus, type ApprovalPolicy, type ClipboardContentType, type ClipboardImage, type Container, type CreateAgentInput, type CreateTaskInput, ERROR_HINTS, EventBus, type EventPayload, type ExecuteParams, type IAgentAdapter, type LightContainer, NotInitializedError, Orchestrator, type OrchestratorConfig, type OrchestratorEvent, type OrchestratorEventType, type OrchestratorState, OrchestryError, type ProjectConfig, type RetryEntry, type Run, type RunEvent, type RunEventType, RunService, type RunStatus, type RunningEntry, type SchedulingConfig, type Task, TaskNotFoundError, type TaskProof, TaskService, type TaskStatus, type TokenUsage, WorkspaceError, type WorkspaceMode, buildContainer, buildFullContainer, buildLightContainer, canTransition, classifyAdapterError, createTokenUsage, detectClipboardType, getClipboardImage, isBlocked, isClipboardToolAvailable, isDispatchable, isTerminal, resolveFailureStatus };