@oxgeneral/orch 0.3.3 → 1.0.0
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/dist/App-GJVTVGRU.js +6717 -0
- package/dist/agent-7ZJ3ZDJ7.js +183 -0
- package/dist/agent-shop-YN2BSLHM.js +2 -0
- package/dist/chunk-2C2TFQ7K.js +136 -0
- package/dist/chunk-45K2XID7.js +29 -0
- package/dist/chunk-4IFIOMCW.js +86 -0
- package/dist/chunk-7X2GI5OV.js +181 -0
- package/dist/{chunk-S3QYSBW4.js → chunk-C6XZ3FJT.js} +6 -3
- package/dist/chunk-C6XZ3FJT.js.map +1 -0
- package/dist/chunk-CHIP7O6V.js +83 -0
- package/dist/{chunk-BCPUTULS.js → chunk-DAVHOWGD.js} +188 -16
- package/dist/chunk-FRTKB575.js +87 -0
- package/dist/{chunk-BGHCY7WY.js → chunk-GBXUNDKN.js} +32 -13
- package/dist/chunk-GBXUNDKN.js.map +1 -0
- package/dist/chunk-HXYAZGLP.js +15 -0
- package/dist/chunk-I3SMISEF.js +29 -0
- package/dist/chunk-K6DMQERQ.js +89 -0
- package/dist/chunk-LV6GDBBI.js +297 -0
- package/dist/chunk-MGGSRXWJ.js +69 -0
- package/dist/chunk-P6ATSXGL.js +107 -0
- package/dist/chunk-PNE6LQRF.js +5 -0
- package/dist/chunk-U2VDNUZL.js +52 -0
- package/dist/chunk-VG4465AG.js +275 -0
- package/dist/chunk-VG4465AG.js.map +1 -0
- package/dist/{chunk-B4JQM4NU.js → chunk-VXS2CJFH.js} +119 -47
- package/dist/chunk-XJTJ2TJV.js +221 -0
- package/dist/{claude-INM52PTH.js → claude-WUJU5KIE.js} +6 -5
- package/dist/claude-WUJU5KIE.js.map +1 -0
- package/dist/claude-ZUEKJJ4X.js +5 -0
- package/dist/cli.js +199 -1
- package/dist/clipboard-service-RTDUUQQU.js +200 -0
- package/dist/codex-7IXXXG5U.js +123 -0
- package/dist/{codex-QGH2GRV6.js → codex-NYJWEPRQ.js} +4 -4
- package/dist/codex-NYJWEPRQ.js.map +1 -0
- package/dist/config-OTAVSMOD.js +75 -0
- package/dist/container-LUWGNBSS.js +1596 -0
- package/dist/context-OL4BVUV5.js +83 -0
- package/dist/{cursor-KQJTQ73D.js → cursor-3YHVD4NP.js} +4 -4
- package/dist/cursor-3YHVD4NP.js.map +1 -0
- package/dist/cursor-622RBRHH.js +97 -0
- package/dist/doctor-XSGQSD57.js +67 -0
- package/dist/doctor-service-TPOMFAIG.js +2 -0
- package/dist/goal-FMYYN2FR.js +138 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/init-JU343RXK.js +165 -0
- package/dist/logs-PHPYWQ6I.js +207 -0
- package/dist/msg-FUWWLEKM.js +95 -0
- package/dist/opencode-FAMPSA6X.js +100 -0
- package/dist/opencode-FAMPSA6X.js.map +1 -0
- package/dist/opencode-WOR53TSC.js +98 -0
- package/dist/orchestrator-IYWBVA7J.js +5 -0
- package/dist/{orchestrator-KF4UY5GD.js.map → orchestrator-IYWBVA7J.js.map} +1 -1
- package/dist/orchestrator-QNAD7MFH.js +1433 -0
- package/dist/process-manager-HUVNAPQV.js +2 -0
- package/dist/registry-PQWRVNF2.js +2 -0
- package/dist/run-N72G5V2H.js +95 -0
- package/dist/shell-DVFHHYAZ.js +5 -0
- package/dist/{shell-UXJNTNBC.js → shell-NJNW3O6K.js} +6 -4
- package/dist/shell-NJNW3O6K.js.map +1 -0
- package/dist/shop-picker-2HY67UWP.js +79 -0
- package/dist/status-RZWN2C6C.js +56 -0
- package/dist/task-3O2OFSP6.js +221 -0
- package/dist/team-PFLP4PPL.js +97 -0
- package/dist/template-engine-5ZKVJMYA.js +3 -0
- package/dist/{template-engine-MFL5B677.js.map → template-engine-5ZKVJMYA.js.map} +1 -1
- package/dist/template-engine-AWIS56BL.js +3 -0
- package/dist/tui-LN5XHSQY.js +245 -0
- package/dist/update-YLP7FPNY.js +64 -0
- package/dist/update-check-4YKLGBFB.js +2 -0
- package/dist/workspace-manager-JM6U7JOH.js +215 -0
- package/package.json +2 -1
- package/readme.md +11 -4
- package/scripts/load-test.ts +478 -0
- package/scripts/postinstall.js +44 -2
- package/dist/App-NN7HR7UE.js +0 -20
- package/dist/agent-S4DKSX63.js +0 -9
- package/dist/agent-shop-D2RS4BZK.js +0 -2
- package/dist/chunk-3MQNQ7QW.js +0 -2
- package/dist/chunk-5AJ4LYO5.js +0 -8
- package/dist/chunk-6MJ7V6VY.js +0 -2
- package/dist/chunk-B4JQM4NU.js.map +0 -1
- package/dist/chunk-BGHCY7WY.js.map +0 -1
- package/dist/chunk-CDFA4IIQ.js +0 -2
- package/dist/chunk-CHRW4CLD.js +0 -2
- package/dist/chunk-HMMPM7MF.js +0 -3
- package/dist/chunk-HSBYJ5C5.js +0 -112
- package/dist/chunk-HXOMNULD.js +0 -2
- package/dist/chunk-IS3YBE2B.js +0 -3
- package/dist/chunk-KPCT44WU.js +0 -2
- package/dist/chunk-L26TK7Y5.js +0 -2
- package/dist/chunk-LXNRCJ22.js +0 -2
- package/dist/chunk-OQKREZUF.js +0 -11
- package/dist/chunk-PJ5DKXGR.js +0 -2
- package/dist/chunk-QFKVCNKL.js +0 -2
- package/dist/chunk-S3QYSBW4.js.map +0 -1
- package/dist/chunk-UMZEA3JT.js +0 -5
- package/dist/claude-GQZNDJ6L.js +0 -2
- package/dist/claude-INM52PTH.js.map +0 -1
- package/dist/clipboard-service-MYLSWM5E.js +0 -25
- package/dist/codex-QGH2GRV6.js.map +0 -1
- package/dist/codex-SJV7ZZBY.js +0 -2
- package/dist/config-CCSS2P7R.js +0 -2
- package/dist/container-NEKK5W2B.js +0 -6
- package/dist/context-GSMQHQES.js +0 -7
- package/dist/cursor-4JQOCP5X.js +0 -2
- package/dist/cursor-KQJTQ73D.js.map +0 -1
- package/dist/doctor-UAII4VWN.js +0 -2
- package/dist/doctor-service-PB7YBH3F.js +0 -2
- package/dist/goal-RFKFPR7M.js +0 -8
- package/dist/init-2D4RAN7B.js +0 -53
- package/dist/logs-UXFXVYCP.js +0 -12
- package/dist/msg-4SCLBO4K.js +0 -9
- package/dist/orchestrator-KF4UY5GD.js +0 -5
- package/dist/orchestrator-MFL3XK5L.js +0 -13
- package/dist/process-manager-33H27MQF.js +0 -2
- package/dist/registry-BO2PPRNG.js +0 -2
- package/dist/run-HSHRELOP.js +0 -3
- package/dist/shell-F42UUF3U.js +0 -2
- package/dist/shell-UXJNTNBC.js.map +0 -1
- package/dist/shop-picker-LE3SKFOX.js +0 -5
- package/dist/status-DLBNWSWM.js +0 -2
- package/dist/task-AP2TIOOF.js +0 -20
- package/dist/team-MSIBKOQC.js +0 -4
- package/dist/template-engine-MFL5B677.js +0 -3
- package/dist/template-engine-ONIDVD4F.js +0 -2
- package/dist/tui-PIQT4ZZ2.js +0 -2
- package/dist/update-PC2ENCKU.js +0 -2
- package/dist/update-check-HGMBDYHL.js +0 -2
- package/dist/workspace-manager-DYN3XJ7X.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,4 +1,4 @@
|
|
|
1
|
-
import { createStreamingEvents, extractTokens } from './chunk-
|
|
1
|
+
import { buildFullPrompt, createStreamingEvents, extractTokens } from './chunk-C6XZ3FJT.js';
|
|
2
2
|
import './chunk-XDVMX2FO.js';
|
|
3
3
|
import { classifyAdapterError } from './chunk-NLQAJ7TW.js';
|
|
4
4
|
import './chunk-O2MSGW3V.js';
|
|
@@ -55,7 +55,7 @@ var CursorAdapter = class {
|
|
|
55
55
|
// stdin must be 'pipe' to send prompt
|
|
56
56
|
});
|
|
57
57
|
if (proc.stdin) {
|
|
58
|
-
proc.stdin.write(params.prompt);
|
|
58
|
+
proc.stdin.write(buildFullPrompt(params.systemPrompt, params.prompt));
|
|
59
59
|
proc.stdin.end();
|
|
60
60
|
}
|
|
61
61
|
const events = createStreamingEvents(proc, parseCursorEvent, "Cursor agent", params.signal);
|
|
@@ -95,5 +95,5 @@ function parseCursorEvent(line) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export { CursorAdapter };
|
|
98
|
-
//# sourceMappingURL=cursor-
|
|
99
|
-
//# sourceMappingURL=cursor-
|
|
98
|
+
//# sourceMappingURL=cursor-3YHVD4NP.js.map
|
|
99
|
+
//# sourceMapp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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, buildFullPrompt } 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 — prepend system prompt if present (Cursor has no native --system-prompt)\n if (proc.stdin) {\n proc.stdin.write(buildFullPrompt(params.systemPrompt, 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,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { buildFullPrompt, createStreamingEvents, extractTokens } from './chunk-MGGSRXWJ.js';
|
|
3
|
+
import { classifyAdapterError } from './chunk-2C2TFQ7K.js';
|
|
4
|
+
import './chunk-CHIP7O6V.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(buildFullPrompt(params.systemPrompt, 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 };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { DoctorService } from './chunk-K6DMQERQ.js';
|
|
3
|
+
import { Paths } from './chunk-LV6GDBBI.js';
|
|
4
|
+
import { amber, getIcon, dim } from './chunk-7X2GI5OV.js';
|
|
5
|
+
import { AdapterRegistry } from './chunk-45K2XID7.js';
|
|
6
|
+
import { ClaudeAdapter } from './chunk-4IFIOMCW.js';
|
|
7
|
+
import { ShellAdapter } from './chunk-XJTJ2TJV.js';
|
|
8
|
+
import './chunk-MGGSRXWJ.js';
|
|
9
|
+
import './chunk-2C2TFQ7K.js';
|
|
10
|
+
import { ProcessManager } from './chunk-CHIP7O6V.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,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;
|
|
@@ -185,6 +191,8 @@ interface OrchestratorConfig {
|
|
|
185
191
|
scheduling: SchedulingConfig;
|
|
186
192
|
prompt?: {
|
|
187
193
|
template?: string;
|
|
194
|
+
system_template?: string;
|
|
195
|
+
user_template?: string;
|
|
188
196
|
};
|
|
189
197
|
}
|
|
190
198
|
|
|
@@ -841,7 +849,7 @@ declare class RunService {
|
|
|
841
849
|
* Get error and last N lines of output from the most recent failed run for a task.
|
|
842
850
|
* Used to provide retry context so agents can learn from previous failures.
|
|
843
851
|
*/
|
|
844
|
-
getLastFailedRunContext(taskId: string
|
|
852
|
+
getLastFailedRunContext(taskId: string): Promise<{
|
|
845
853
|
error: string;
|
|
846
854
|
output: string;
|
|
847
855
|
} | null>;
|
|
@@ -893,6 +901,7 @@ interface AdapterTestResult {
|
|
|
893
901
|
}
|
|
894
902
|
interface ExecuteParams {
|
|
895
903
|
prompt: string;
|
|
904
|
+
systemPrompt?: string;
|
|
896
905
|
workspace: string;
|
|
897
906
|
env?: Record<string, string>;
|
|
898
907
|
config: AgentConfig;
|
|
@@ -1269,8 +1278,13 @@ interface CliContext {
|
|
|
1269
1278
|
*/
|
|
1270
1279
|
/** Activity feed filter preset name */
|
|
1271
1280
|
type ActivityFilterPreset = 'all' | 'text' | 'tools' | 'errors' | 'events';
|
|
1281
|
+
interface NotificationPreferences {
|
|
1282
|
+
toast: boolean;
|
|
1283
|
+
bell: boolean;
|
|
1284
|
+
}
|
|
1272
1285
|
interface TuiPreferences {
|
|
1273
1286
|
activity_filter: ActivityFilterPreset;
|
|
1287
|
+
notifications: NotificationPreferences;
|
|
1274
1288
|
}
|
|
1275
1289
|
interface GlobalConfig {
|
|
1276
1290
|
tui: TuiPreferences;
|
|
@@ -1443,4 +1457,4 @@ declare function buildFullContainer(context: CliContext): Promise<Container>;
|
|
|
1443
1457
|
*/
|
|
1444
1458
|
declare function buildContainer(context: CliContext): Promise<Container>;
|
|
1445
1459
|
|
|
1446
|
-
export { type AdapterErrorHint, AdapterErrorKind, 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, 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 };
|
|
1460
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureDir, Paths, readYaml, writeYaml, listFiles, writeJson, readJson, appendJsonl, readJsonl, readJsonlTail, pathExists } from './chunk-UIJYU3J7.js';
|
|
2
|
-
import { canTransition, isTerminal } from './chunk-
|
|
3
|
-
export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus } from './chunk-
|
|
4
|
-
import { AUTONOMOUS_LABEL } from './chunk-
|
|
2
|
+
import { canTransition, isTerminal } from './chunk-GBXUNDKN.js';
|
|
3
|
+
export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus } from './chunk-GBXUNDKN.js';
|
|
4
|
+
import { AUTONOMOUS_LABEL } from './chunk-VG4465AG.js';
|
|
5
5
|
export { AdapterRegistry } from './chunk-6DWHQPTE.js';
|
|
6
6
|
export { createTokenUsage } from './chunk-XDVMX2FO.js';
|
|
7
7
|
import { InvalidArgumentsError, TaskNotFoundError, InvalidTransitionError, AgentNotFoundError, OrchestryError, TeamNotFoundError, GoalNotFoundError } from './chunk-NLQAJ7TW.js';
|
|
@@ -544,16 +544,15 @@ var RunService = class {
|
|
|
544
544
|
* Get error and last N lines of output from the most recent failed run for a task.
|
|
545
545
|
* Used to provide retry context so agents can learn from previous failures.
|
|
546
546
|
*/
|
|
547
|
-
async getLastFailedRunContext(taskId
|
|
547
|
+
async getLastFailedRunContext(taskId) {
|
|
548
548
|
const runs = await this.runStore.listForTask(taskId);
|
|
549
549
|
const failedRun = runs.filter((r) => r.status === "failed").sort((a, b) => (b.finished_at ?? "").localeCompare(a.finished_at ?? ""))[0];
|
|
550
550
|
if (!failedRun) return null;
|
|
551
551
|
const error = failedRun.error ?? "Unknown error";
|
|
552
552
|
let output = "";
|
|
553
553
|
try {
|
|
554
|
-
const events = await this.runStore.
|
|
555
|
-
|
|
556
|
-
output = outputLines.slice(-maxOutputLines).join("\n");
|
|
554
|
+
const events = await this.runStore.readEvents(failedRun.id);
|
|
555
|
+
output = events.filter((e) => e.type === "agent_output" || e.type === "error").map((e) => typeof e.data === "string" ? e.data : JSON.stringify(e.data)).join("\n");
|
|
557
556
|
} catch {
|
|
558
557
|
}
|
|
559
558
|
return { error, output };
|
|
@@ -1060,7 +1059,8 @@ function deepMerge(target, source) {
|
|
|
1060
1059
|
// src/domain/global-config.ts
|
|
1061
1060
|
var DEFAULT_GLOBAL_CONFIG = {
|
|
1062
1061
|
tui: {
|
|
1063
|
-
activity_filter: "all"
|
|
1062
|
+
activity_filter: "all",
|
|
1063
|
+
notifications: { toast: true, bell: false }
|
|
1064
1064
|
}
|
|
1065
1065
|
};
|
|
1066
1066
|
|
|
@@ -1070,10 +1070,16 @@ var GLOBAL_CONFIG_PATH = path.join(GLOBAL_DIR, "global.yml");
|
|
|
1070
1070
|
var GlobalConfigStore = class {
|
|
1071
1071
|
async read() {
|
|
1072
1072
|
const data = await readYaml(GLOBAL_CONFIG_PATH);
|
|
1073
|
-
if (!data) return { ...DEFAULT_GLOBAL_CONFIG };
|
|
1073
|
+
if (!data) return { ...DEFAULT_GLOBAL_CONFIG, tui: { ...DEFAULT_GLOBAL_CONFIG.tui, notifications: { ...DEFAULT_GLOBAL_CONFIG.tui.notifications } } };
|
|
1074
|
+
const tui = data.tui;
|
|
1075
|
+
const notif = tui?.notifications;
|
|
1074
1076
|
return {
|
|
1075
1077
|
tui: {
|
|
1076
|
-
activity_filter:
|
|
1078
|
+
activity_filter: tui?.activity_filter ?? DEFAULT_GLOBAL_CONFIG.tui.activity_filter,
|
|
1079
|
+
notifications: {
|
|
1080
|
+
toast: typeof notif?.toast === "boolean" ? notif.toast : DEFAULT_GLOBAL_CONFIG.tui.notifications.toast,
|
|
1081
|
+
bell: typeof notif?.bell === "boolean" ? notif.bell : DEFAULT_GLOBAL_CONFIG.tui.notifications.bell
|
|
1082
|
+
}
|
|
1077
1083
|
}
|
|
1078
1084
|
};
|
|
1079
1085
|
}
|
|
@@ -1752,6 +1758,7 @@ async function buildFullContainer(context) {
|
|
|
1752
1758
|
{ CodexAdapter },
|
|
1753
1759
|
{ CursorAdapter },
|
|
1754
1760
|
{ ShellAdapter },
|
|
1761
|
+
{ OpenCodeAdapter },
|
|
1755
1762
|
{ WorkspaceManager },
|
|
1756
1763
|
{ LiquidTemplateEngine },
|
|
1757
1764
|
{ Orchestrator: Orchestrator2 },
|
|
@@ -1759,13 +1766,14 @@ async function buildFullContainer(context) {
|
|
|
1759
1766
|
] = await Promise.all([
|
|
1760
1767
|
import('./process-manager-A36Y7LHP.js'),
|
|
1761
1768
|
import('./registry-JXXRLJ5J.js'),
|
|
1762
|
-
import('./claude-
|
|
1763
|
-
import('./codex-
|
|
1764
|
-
import('./cursor-
|
|
1765
|
-
import('./shell-
|
|
1769
|
+
import('./claude-WUJU5KIE.js'),
|
|
1770
|
+
import('./codex-NYJWEPRQ.js'),
|
|
1771
|
+
import('./cursor-3YHVD4NP.js'),
|
|
1772
|
+
import('./shell-NJNW3O6K.js'),
|
|
1773
|
+
import('./opencode-FAMPSA6X.js'),
|
|
1766
1774
|
import('./workspace-manager-EVD67GCG.js'),
|
|
1767
|
-
import('./template-engine-
|
|
1768
|
-
import('./orchestrator-
|
|
1775
|
+
import('./template-engine-5ZKVJMYA.js'),
|
|
1776
|
+
import('./orchestrator-IYWBVA7J.js'),
|
|
1769
1777
|
import('./doctor-service-F2SXDWHS.js')
|
|
1770
1778
|
]);
|
|
1771
1779
|
const processManager = new ProcessManager();
|
|
@@ -1780,6 +1788,7 @@ async function buildFullContainer(context) {
|
|
|
1780
1788
|
adapterRegistry.register(new CodexAdapter(processManager));
|
|
1781
1789
|
adapterRegistry.register(new CursorAdapter(processManager));
|
|
1782
1790
|
adapterRegistry.register(new ShellAdapter(processManager));
|
|
1791
|
+
adapterRegistry.register(new OpenCodeAdapter(processManager));
|
|
1783
1792
|
const doctorService = new DoctorService(adapterRegistry, processManager, context.projectRoot);
|
|
1784
1793
|
const orchestrator = new Orchestrator2({
|
|
1785
1794
|
taskStore: light.taskStore,
|