@oxgeneral/orch 0.2.4 → 0.3.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-TW35IULR.js +18 -0
- package/dist/agent-FRQKL7YI.js +9 -0
- package/dist/{orchestrator-OMU46RCE.js → chunk-2UC4SVJB.js} +190 -53
- package/dist/chunk-2UC4SVJB.js.map +1 -0
- package/dist/chunk-5AJ4LYO5.js +8 -0
- package/dist/{chunk-45K2XID7.js → chunk-6DWHQPTE.js} +2 -1
- package/dist/chunk-6DWHQPTE.js.map +1 -0
- package/dist/{chunk-POUC4CPC.js → chunk-6MJ7V6VY.js} +2 -2
- package/dist/{chunk-HNKJ4IF7.js → chunk-B4JQM4NU.js} +34 -10
- package/dist/chunk-B4JQM4NU.js.map +1 -0
- package/dist/{chunk-6HENRUYZ.js → chunk-CDFA4IIQ.js} +2 -2
- package/dist/chunk-CHRW4CLD.js +2 -0
- package/dist/{chunk-VAAOW526.js → chunk-GZ2Q56YZ.js} +2 -2
- package/dist/{doctor-service-QEJCE5FK.js → chunk-HMMPM7MF.js} +2 -2
- package/dist/{chunk-AELEEEV3.js → chunk-HSBYJ5C5.js} +27 -7
- package/dist/chunk-HXOMNULD.js +2 -0
- package/dist/{chunk-3TGCIXJA.js → chunk-IQXRQBUK.js} +2 -1
- package/dist/chunk-IQXRQBUK.js.map +1 -0
- package/dist/chunk-L26TK7Y5.js +2 -0
- package/dist/chunk-L3FYR45M.js +2 -0
- package/dist/chunk-LXNRCJ22.js +2 -0
- package/dist/{chunk-TX7WOFCW.js → chunk-MGFMVPRD.js} +4 -7
- package/dist/chunk-MGFMVPRD.js.map +1 -0
- package/dist/chunk-MNXU3KCD.js +2 -0
- package/dist/{chunk-CHIP7O6V.js → chunk-O2MSGW3V.js} +3 -1
- package/dist/chunk-O2MSGW3V.js.map +1 -0
- package/dist/chunk-PJ5DKXGR.js +2 -0
- package/dist/{chunk-2KSBOAW3.js → chunk-QEEM67OA.js} +11 -17
- package/dist/chunk-QEEM67OA.js.map +1 -0
- package/dist/chunk-UMZEA3JT.js +5 -0
- package/dist/{shell-OGTSH4RJ.js → chunk-UW6GUUE6.js} +3 -3
- package/dist/chunk-XDVMX2FO.js +8 -0
- package/dist/chunk-XDVMX2FO.js.map +1 -0
- package/dist/chunk-ZA5Z33GO.js +11 -0
- package/dist/claude-E36EGXUV.js +2 -0
- package/dist/{chunk-IRN2U2NE.js → claude-RIB3RQS5.js} +5 -2
- package/dist/claude-RIB3RQS5.js.map +1 -0
- package/dist/cli.js +1 -199
- package/dist/clipboard-service-PDTSZIR5.js +25 -0
- package/dist/codex-OTZKVESD.js +2 -0
- package/dist/{codex-U7LTJTX6.js → codex-VBUSA2GJ.js} +5 -3
- package/dist/codex-VBUSA2GJ.js.map +1 -0
- package/dist/config-CCSS2P7R.js +2 -0
- package/dist/container-OIXLFSX2.js +6 -0
- package/dist/context-GSMQHQES.js +7 -0
- package/dist/cursor-3DJA6LWS.js +2 -0
- package/dist/{cursor-3DI5GKRF.js → cursor-4QIOTDBW.js} +5 -3
- package/dist/cursor-4QIOTDBW.js.map +1 -0
- package/dist/doctor-KBK5JZBZ.js +2 -0
- package/dist/{chunk-K6DMQERQ.js → doctor-service-F2SXDWHS.js} +3 -1
- package/dist/doctor-service-F2SXDWHS.js.map +1 -0
- package/dist/doctor-service-PB7YBH3F.js +2 -0
- package/dist/goal-RFKFPR7M.js +8 -0
- package/dist/index.d.ts +105 -43
- package/dist/index.js +1817 -5
- package/dist/index.js.map +1 -1
- package/dist/init-WRDFAFS2.js +53 -0
- package/dist/logs-5QHJWMEG.js +12 -0
- package/dist/msg-4SCLBO4K.js +9 -0
- package/dist/orchestrator-FGGXK3N3.js +5 -0
- package/dist/{orchestrator-L6QX2LJ7.js.map → orchestrator-FGGXK3N3.js.map} +1 -1
- package/dist/orchestrator-R7IWZUT6.js +13 -0
- package/dist/process-manager-33H27MQF.js +2 -0
- package/dist/process-manager-A36Y7LHP.js +3 -0
- package/dist/{process-manager-TLZOTO4Y.js.map → process-manager-A36Y7LHP.js.map} +1 -1
- package/dist/registry-BO2PPRNG.js +2 -0
- package/dist/registry-JXXRLJ5J.js +3 -0
- package/dist/{registry-UQAHK77P.js.map → registry-JXXRLJ5J.js.map} +1 -1
- package/dist/run-HSHRELOP.js +3 -0
- package/dist/shell-EOJBDWTH.js +2 -0
- package/dist/{chunk-CIIE6LNG.js → shell-IH2MMTVP.js} +3 -2
- package/dist/shell-IH2MMTVP.js.map +1 -0
- package/dist/status-DLBNWSWM.js +2 -0
- package/dist/task-J6ZN7ALI.js +20 -0
- package/dist/team-MSIBKOQC.js +4 -0
- package/dist/template-engine-MFL5B677.js +3 -0
- package/dist/{template-engine-322SCRR6.js.map → template-engine-MFL5B677.js.map} +1 -1
- package/dist/template-engine-ONIDVD4F.js +2 -0
- package/dist/tui-G4XUFAIP.js +2 -0
- package/dist/update-PC2ENCKU.js +2 -0
- package/dist/update-check-HGMBDYHL.js +2 -0
- package/dist/workspace-manager-KOOYTO7E.js +3 -0
- package/dist/{workspace-manager-G5EQRS72.js → workspace-manager-T6AXG7XL.js} +4 -3
- package/dist/workspace-manager-T6AXG7XL.js.map +1 -0
- package/package.json +2 -1
- package/readme.md +5 -4
- package/scripts/benchmark.ts +304 -0
- package/dist/App-KHUT3IV7.js +0 -4962
- package/dist/agent-V5M2C3OC.js +0 -157
- package/dist/chunk-33QNTNR6.js +0 -46
- package/dist/chunk-6HENRUYZ.js.map +0 -1
- package/dist/chunk-AELEEEV3.js.map +0 -1
- package/dist/chunk-ED47GL3F.js +0 -29
- package/dist/chunk-FRTKB575.js +0 -87
- package/dist/chunk-HXYAZGLP.js +0 -15
- package/dist/chunk-I5WEMARW.js +0 -166
- package/dist/chunk-IZYSGYXG.js +0 -2
- package/dist/chunk-IZYSGYXG.js.map +0 -1
- package/dist/chunk-P6ATSXGL.js +0 -107
- package/dist/chunk-PBFE5V3G.js +0 -2
- package/dist/chunk-PBFE5V3G.js.map +0 -1
- package/dist/chunk-PNE6LQRF.js +0 -5
- package/dist/chunk-POUC4CPC.js.map +0 -1
- package/dist/chunk-QTDKQYZI.js +0 -11
- package/dist/chunk-QTDKQYZI.js.map +0 -1
- package/dist/chunk-VAAOW526.js.map +0 -1
- package/dist/chunk-ZTQ3KWXR.js +0 -13
- package/dist/chunk-ZTQ3KWXR.js.map +0 -1
- package/dist/claude-GH6P2DC5.js +0 -4
- package/dist/claude-S47YTIHU.js +0 -2
- package/dist/claude-S47YTIHU.js.map +0 -1
- package/dist/codex-2CH57B7G.js +0 -2
- package/dist/codex-2CH57B7G.js.map +0 -1
- package/dist/config-LJFM55LN.js +0 -75
- package/dist/container-KPH4HVAJ.js +0 -1532
- package/dist/context-EPSDCJTU.js +0 -83
- package/dist/cursor-QFUNKPCQ.js +0 -2
- package/dist/cursor-QFUNKPCQ.js.map +0 -1
- package/dist/doctor-GHRV5I2S.js +0 -67
- package/dist/doctor-service-QEJCE5FK.js.map +0 -1
- package/dist/doctor-service-TPOMFAIG.js +0 -2
- package/dist/goal-I56QP7HS.js +0 -110
- package/dist/init-EQTGQ4G2.js +0 -165
- package/dist/logs-AK255DEJ.js +0 -207
- package/dist/msg-SQWQLJP6.js +0 -95
- package/dist/orchestrator-L6QX2LJ7.js +0 -2
- package/dist/process-manager-HUVNAPQV.js +0 -2
- package/dist/process-manager-TLZOTO4Y.js +0 -2
- package/dist/registry-PQWRVNF2.js +0 -2
- package/dist/registry-UQAHK77P.js +0 -2
- package/dist/run-PSZURVVL.js +0 -95
- package/dist/shell-5ZNXFGXV.js +0 -3
- package/dist/shell-OGTSH4RJ.js.map +0 -1
- package/dist/status-DTF7D3DV.js +0 -56
- package/dist/task-35SDKXFC.js +0 -209
- package/dist/team-AISPLEJB.js +0 -97
- package/dist/template-engine-322SCRR6.js +0 -2
- package/dist/template-engine-3CDRZNMJ.js +0 -3
- package/dist/tui-AR6PVMBQ.js +0 -230
- package/dist/update-DCCWVISK.js +0 -64
- package/dist/update-check-4YKLGBFB.js +0 -2
- package/dist/workspace-manager-AS4TFA7R.js +0 -3
- package/dist/workspace-manager-AS4TFA7R.js.map +0 -1
package/dist/msg-SQWQLJP6.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { printSuccess, dim, formatDurationSince, printTable } from './chunk-I5WEMARW.js';
|
|
3
|
-
|
|
4
|
-
// src/cli/commands/msg.ts
|
|
5
|
-
function registerMsgCommand(program, container) {
|
|
6
|
-
const msg = program.command("msg").description("Inter-agent messaging");
|
|
7
|
-
msg.command("send <to-agent-id> <body>").description("Send a direct message to an agent").option("-s, --subject <subject>", "Message subject").option("--from <agent-id>", "Sender agent ID (default: cli)").option("--ttl <ms>", "TTL in milliseconds").option("--reply-to <msg-id>", "Reply to a message").action(async (toAgentId, body, opts) => {
|
|
8
|
-
await container.paths.requireInit();
|
|
9
|
-
const messages = await container.messageService.send({
|
|
10
|
-
channel: "direct",
|
|
11
|
-
from_agent_id: opts.from ?? "cli",
|
|
12
|
-
to_agent_id: toAgentId,
|
|
13
|
-
subject: opts.subject ?? "",
|
|
14
|
-
body,
|
|
15
|
-
ttl_ms: opts.ttl ? parseInt(opts.ttl, 10) : void 0,
|
|
16
|
-
reply_to: opts.replyTo
|
|
17
|
-
});
|
|
18
|
-
if (container.context.json) {
|
|
19
|
-
console.log(JSON.stringify(messages, null, 2));
|
|
20
|
-
} else if (container.context.quiet) {
|
|
21
|
-
console.log(messages[0]?.id);
|
|
22
|
-
} else {
|
|
23
|
-
printSuccess(`Message sent: ${messages[0]?.id} \u2192 ${toAgentId}`);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
msg.command("broadcast <body>").description("Broadcast a message to all agents (or team members)").option("-s, --subject <subject>", "Message subject").option("--from <agent-id>", "Sender agent ID (default: cli)").option("--team <team-id>", "Limit broadcast to team members").option("--ttl <ms>", "TTL in milliseconds").action(async (body, opts) => {
|
|
27
|
-
await container.paths.requireInit();
|
|
28
|
-
const messages = await container.messageService.send({
|
|
29
|
-
channel: "broadcast",
|
|
30
|
-
from_agent_id: opts.from ?? "cli",
|
|
31
|
-
subject: opts.subject ?? "",
|
|
32
|
-
body,
|
|
33
|
-
ttl_ms: opts.ttl ? parseInt(opts.ttl, 10) : void 0,
|
|
34
|
-
team_id: opts.team
|
|
35
|
-
});
|
|
36
|
-
if (container.context.json) {
|
|
37
|
-
console.log(JSON.stringify(messages, null, 2));
|
|
38
|
-
} else if (container.context.quiet) {
|
|
39
|
-
console.log(messages.map((m) => m.id).join("\n"));
|
|
40
|
-
} else {
|
|
41
|
-
printSuccess(`Broadcast sent to ${messages.length} agent(s)`);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
msg.command("inbox <agent-id>").description("Show pending messages for an agent").action(async (agentId) => {
|
|
45
|
-
await container.paths.requireInit();
|
|
46
|
-
const pending = await container.messageService.listPendingForAgent(agentId);
|
|
47
|
-
if (container.context.json) {
|
|
48
|
-
console.log(JSON.stringify(pending, null, 2));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (pending.length === 0) {
|
|
52
|
-
console.log(dim("\n No pending messages.\n"));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
console.log();
|
|
56
|
-
for (const m of pending) {
|
|
57
|
-
console.log(` ${dim(m.id)} from ${m.from_agent_id}${m.subject ? ` \u2014 ${m.subject}` : ""}`);
|
|
58
|
-
console.log(` ${m.body}`);
|
|
59
|
-
console.log();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
msg.command("list").description("List all messages").option("--agent <agent-id>", "Filter by agent (sent or received)").action(async (opts) => {
|
|
63
|
-
await container.paths.requireInit();
|
|
64
|
-
let messages;
|
|
65
|
-
if (opts.agent) {
|
|
66
|
-
messages = await container.messageService.listForAgent(opts.agent);
|
|
67
|
-
} else {
|
|
68
|
-
messages = await container.messageService.listAll();
|
|
69
|
-
}
|
|
70
|
-
if (container.context.json) {
|
|
71
|
-
console.log(JSON.stringify(messages, null, 2));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (messages.length === 0) {
|
|
75
|
-
console.log(dim("\n No messages.\n"));
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const headers = ["ID", "FROM", "TO", "CHANNEL", "STATUS", "SENT"];
|
|
79
|
-
const rows = messages.map((m) => [
|
|
80
|
-
m.id,
|
|
81
|
-
m.from_agent_id,
|
|
82
|
-
m.to_agent_id ?? "*",
|
|
83
|
-
m.channel,
|
|
84
|
-
m.status,
|
|
85
|
-
formatDurationSince(m.created_at)
|
|
86
|
-
]);
|
|
87
|
-
console.log();
|
|
88
|
-
printTable(headers, rows);
|
|
89
|
-
console.log(`
|
|
90
|
-
${messages.length} message(s)
|
|
91
|
-
`);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { registerMsgCommand };
|
package/dist/run-PSZURVVL.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { printError, amber, printSuccess, dim, getIcon } from './chunk-I5WEMARW.js';
|
|
3
|
-
|
|
4
|
-
// src/cli/commands/run.ts
|
|
5
|
-
function registerRunCommand(program, container) {
|
|
6
|
-
program.command("run [task-id]").description("Run tasks").option("--all", "Run all todo tasks").option("--watch", "Watch mode: continuous orchestration").action(async (taskId, opts) => {
|
|
7
|
-
await container.paths.requireInit();
|
|
8
|
-
if (opts.watch) {
|
|
9
|
-
await runWatch(container);
|
|
10
|
-
} else if (opts.all) {
|
|
11
|
-
await runAll(container);
|
|
12
|
-
} else if (taskId) {
|
|
13
|
-
await runSingle(container, taskId);
|
|
14
|
-
} else {
|
|
15
|
-
printError("Specify a task ID, --all, or --watch");
|
|
16
|
-
process.exit(2);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async function runSingle(container, taskId) {
|
|
21
|
-
const task = await container.taskService.get(taskId);
|
|
22
|
-
console.log();
|
|
23
|
-
console.log(` ${amber("orch")} \xB7 running ${taskId} "${task.title}"`);
|
|
24
|
-
const unsub = container.eventBus.onAny((event) => {
|
|
25
|
-
const time = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
26
|
-
switch (event.type) {
|
|
27
|
-
case "agent:output":
|
|
28
|
-
console.log(` ${dim(time)} ${getIcon("agentAction")} ${typeof event.data === "string" ? event.data.slice(0, 80) : ""}`);
|
|
29
|
-
break;
|
|
30
|
-
case "agent:file_changed":
|
|
31
|
-
console.log(` ${dim(time)} ${getIcon("agentAction")} Modified ${event.path}`);
|
|
32
|
-
break;
|
|
33
|
-
case "agent:error":
|
|
34
|
-
console.log(` ${dim(time)} ${getIcon("failed")} ${event.error}`);
|
|
35
|
-
break;
|
|
36
|
-
case "agent:completed":
|
|
37
|
-
if (event.success) {
|
|
38
|
-
printSuccess("Done");
|
|
39
|
-
} else {
|
|
40
|
-
printError("Failed");
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
try {
|
|
46
|
-
await container.orchestrator.runTask(taskId);
|
|
47
|
-
} finally {
|
|
48
|
-
unsub();
|
|
49
|
-
}
|
|
50
|
-
console.log();
|
|
51
|
-
}
|
|
52
|
-
async function runAll(container) {
|
|
53
|
-
console.log();
|
|
54
|
-
console.log(` ${amber("orch")} \xB7 running all todo tasks`);
|
|
55
|
-
console.log();
|
|
56
|
-
await container.orchestrator.runAll();
|
|
57
|
-
}
|
|
58
|
-
async function runWatch(container) {
|
|
59
|
-
console.log(`${amber("orch")} \xB7 watching \xB7 poll interval ${container.config.scheduling.poll_interval_ms / 1e3}s`);
|
|
60
|
-
console.log("\u2501".repeat(43));
|
|
61
|
-
console.log();
|
|
62
|
-
container.eventBus.onAny((event) => {
|
|
63
|
-
const time = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit" });
|
|
64
|
-
switch (event.type) {
|
|
65
|
-
case "agent:output": {
|
|
66
|
-
const data = typeof event.data === "string" ? event.data.slice(0, 60) : "";
|
|
67
|
-
console.log(`${dim(time)} ${getIcon("agentAction")} ${data}`);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case "agent:completed":
|
|
71
|
-
if (event.success) {
|
|
72
|
-
console.log(`${dim(time)} ${getIcon("done")} DONE ${event.runId}`);
|
|
73
|
-
} else {
|
|
74
|
-
console.log(`${dim(time)} ${getIcon("failed")} FAIL ${event.runId}`);
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
case "run:retry":
|
|
78
|
-
console.log(`${dim(time)} ${getIcon("retrying")} RETRY attempt ${event.attempt} \xB7 next in ${Math.round(event.delay_ms / 1e3)}s`);
|
|
79
|
-
break;
|
|
80
|
-
case "orchestrator:tick":
|
|
81
|
-
process.stdout.write(`\r${amber("orch")} \xB7 watching \xB7 ${event.running} running \xB7 ${event.queued} queued `);
|
|
82
|
-
break;
|
|
83
|
-
case "orchestrator:stall_detected":
|
|
84
|
-
console.log(`${dim(time)} ${getIcon("warning")} STALL ${event.runId}`);
|
|
85
|
-
break;
|
|
86
|
-
case "orchestrator:shutdown":
|
|
87
|
-
console.log(`
|
|
88
|
-
${dim("Shutting down...")}`);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
await container.orchestrator.startWatch();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { registerRunCommand };
|
package/dist/shell-5ZNXFGXV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/infrastructure/adapters/event-buffer.ts","../src/infrastructure/adapters/shell.ts"],"names":["deferred","resolve","r","EventBuffer","capacity","event","dr","sr","execFileAsync","promisify","execFile","ShellAdapter","processManager","stdout","params","command","errorGen","proc","pid","signal","generateEvents","buffer","onAbort","stdoutPromise","line","readLines","stderrPromise","reject","code"],"mapp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OAAA,CAASG,CAAO,CAAA,CAI7C,MAAM,IAAI,OAAA,CAAc,CAACrB,CAAAA,CAAS0B,CAAAA,GAAW,CAE3C,GAAIV,EAAK,QAAA,GAAa,IAAA,EAAQA,CAAAA,CAAK,MAAA,CAAQ,CACzChB,CAAAA,EAAQ,CACR,MACF,CACAgB,CAAAA,CAAK,EAAA,CAAG,OAAA,CAAUW,CAAAA,EAAS,CACrBA,CAAAA,GAAS,CAAA,EAAKT,CAAAA,EAAQ,OAAA,CACxBlB,GAAQ,CAER0B,CAAAA,CAAO,IAAI,KAAA,CAAM,CAAA,+BAAA,EAAkCC,CAAI,CAAA,CAAE,CAAC,EAE9D,CAAC,CAAA,CACDX,CAAAA,CAAK,EAAA,CAAG,QAASU,CAAM,EACzB,CAAC,EACH,CAEA,OAAO,CAAE,GAAA,CAAAT,CAAAA,CAAK,MAAA,CAAQE,CAAAA,EAAiB,CACzC,CAEA,MAAM,IAAA,CAAKF,CAAAA,CAA4B,CACrC,MAAM,IAAA,CAAK,cAAA,CAAe,aAAA,CAAcA,CAAG,EAC7C,CACF","file":"shell-OGTSH4RJ.js","sourcesContent":["/**\n * Lock-free ring buffer for AgentEvent streaming.\n *\n * Replaces Array.shift() O(n) polling with O(1) dequeue\n * and event-driven notification instead of 50ms busy-wait.\n * Includes backpressure: when buffer is full, push() returns\n * a promise that resolves when space is available.\n */\n\nimport type { AgentEvent } from './interface.js';\n\nconst DEFAULT_CAPACITY = 1024;\n\ninterface Deferred<T> {\n promise: Promise<T>;\n resolve: (value: T) => void;\n}\n\nfunction deferred<T>(): Deferred<T> {\n let resolve!: (value: T) => void;\n const promise = new Promise<T>((r) => { resolve = r; });\n return { promise, resolve };\n}\n\nexport class EventBuffer {\n private buf: (AgentEvent | undefined)[];\n private head = 0; // read index\n private tail = 0; // write index\n private count = 0;\n private readonly capacity: number;\n\n // Consumer notification: resolved when new data is available\n private dataReady: Deferred<void> | null = null;\n // Producer notification: resolved when space is available\n private spaceReady: Deferred<void> | null = null;\n\n private closed = false;\n\n constructor(capacity = DEFAULT_CAPACITY) {\n this.capacity = capacity;\n this.buf = new Array(capacity);\n }\n\n /** Number of buffered events. */\n get size(): number {\n return this.count;\n }\n\n get isFull(): boolean {\n return this.count >= this.capacity;\n }\n\n /**\n * Push an event into the buffer.\n * If the buffer is full, waits until space is available (backpressure).\n */\n async push(event: AgentEvent): Promise<void> {\n while (this.isFull && !this.closed) {\n if (!this.spaceReady) {\n this.spaceReady = deferred<void>();\n }\n await this.spaceReady.promise;\n }\n if (this.closed) return;\n\n this.buf[this.tail] = event;\n this.tail = (this.tail + 1) % this.capacity;\n this.count++;\n\n // Wake up consumer if waiting\n if (this.dataReady) {\n const dr = this.dataReady;\n this.dataReady = null;\n dr.resolve();\n }\n }\n\n /**\n * Dequeue the next event. O(1).\n * Returns undefined only when buffer is empty AND closed.\n */\n async take(): Promise<AgentEvent | undefined> {\n while (this.count === 0) {\n if (this.closed) return undefined;\n if (!this.dataReady) {\n this.dataReady = deferred<void>();\n }\n await this.dataReady.promise;\n }\n\n const event = this.buf[this.head];\n this.buf[this.head] = undefined; // allow GC\n this.head = (this.head + 1) % this.capacity;\n this.count--;\n\n // Wake up producer if waiting for space\n if (this.spaceReady) {\n const sr = this.spaceReady;\n this.spaceReady = null;\n sr.resolve();\n }\n\n return event;\n }\n\n /**\n * Signal that no more events will be pushed.\n * Wakes up any waiting consumer/producer.\n */\n close(): void {\n this.closed = true;\n if (this.dataReady) {\n const dr = this.dataReady;\n this.dataReady = null;\n dr.resolve();\n }\n if (this.spaceReady) {\n const sr = this.spaceReady;\n this.spaceReady = null;\n sr.resolve();\n }\n }\n\n get isClosed(): boolean {\n return this.closed;\n }\n\n /**\n * Async iterator that drains the buffer until closed and empty.\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<AgentEvent> {\n while (true) {\n const event = await this.take();\n if (event === undefined) return;\n yield event;\n }\n }\n}\n","/**\n * Shell adapter.\n *\n * Spawns an arbitrary command via `bash -lc`.\n * Task prompt is passed via ORCHESTRY_TASK_PROMPT env variable.\n * Consumes stdout and stderr concurrently to avoid deadlocks.\n */\n\nimport type { IAgentAdapter, AdapterTestResult, ExecuteParams, AgentEvent, ExecuteHandle } from './interface.js';\nimport type { IProcessManager } from '../process/process-manager.js';\nimport { readLines } from '../process/process-manager.js';\nimport { EventBuffer } from './event-buffer.js';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execFileAsync = promisify(execFile);\n\nexport class ShellAdapter implements IAgentAdapter {\n readonly kind = 'shell';\n\n constructor(private readonly processManager: IProcessManager) {}\n\n async test(): Promise<AdapterTestResult> {\n try {\n const { stdout } = await execFileAsync('bash', ['--version']);\n const version = stdout.split('\\n')[0]?.trim() ?? 'unknown';\n return { ok: true, version };\n } catch {\n return { ok: false, error: 'bash not found' };\n }\n }\n\n execute(params: ExecuteParams): ExecuteHandle {\n const command = params.config.command;\n if (!command) {\n // Return a handle that immediately yields an error\n async function* errorGen(): AsyncGenerator<AgentEvent> {\n yield {\n type: 'error',\n timestamp: new Date().toISOString(),\n data: 'Shell adapter requires a command in agent config',\n };\n }\n return { pid: 0, events: errorGen() };\n }\n\n const { process: proc, pid } = this.processManager.spawn('bash', ['-lc', command], {\n cwd: params.workspace,\n env: {\n ...process.env,\n ...params.env,\n ORCHESTRY_TASK_PROMPT: params.prompt,\n },\n signal: params.signal,\n });\n\n const signal = params.signal;\n const processManager = this.processManager;\n\n async function* generateEvents(): AsyncGenerator<AgentEvent> {\n // Ring buffer with backpressure replaces Array.shift() polling\n const buffer = new EventBuffer();\n\n // Ensure process is reaped on abort — SIGTERM + grace period + SIGKILL\n const onAbort = () => {\n processManager.killWithGrace(pid, 5_000).catch(() => {});\n };\n if (signal) {\n if (signal.aborted) {\n onAbort();\n } else {\n signal.addEventListener('abort', onAbort, { once: true });\n }\n }\n\n const stdoutPromise = (async () => {\n if (!proc.stdout) return;\n for await (const line of readLines(proc.stdout)) {\n if (signal?.aborted) break;\n await buffer.push({\n type: 'output',\n timestamp: new Date().toISOString(),\n data: line,\n });\n }\n })();\n\n const stderrPromise = (async () => {\n if (!proc.stderr) return;\n for await (const line of readLines(proc.stderr)) {\n if (signal?.aborted) break;\n await buffer.push({\n type: 'error',\n timestamp: new Date().toISOString(),\n data: line,\n });\n }\n })();\n\n // Close the buffer once both streams are drained (or on error)\n void Promise.all([stdoutPromise, stderrPromise]).then(\n () => buffer.close(),\n () => buffer.close(),\n );\n\n // Yield events as they arrive — no polling, no busy-wait\n yield* buffer;\n\n // Clean up abort listener\n if (signal && !signal.aborted) {\n signal.removeEventListener('abort', onAbort);\n }\n\n // Wait for process to exit\n await new Promise<void>((resolve, reject) => {\n // If process already exited, resolve immediately\n if (proc.exitCode !== null || proc.killed) {\n resolve();\n return;\n }\n proc.on('close', (code) => {\n if (code === 0 || signal?.aborted) {\n resolve();\n } else {\n reject(new Error(`Shell command exited with code ${code}`));\n }\n });\n proc.on('error', reject);\n });\n }\n\n return { pid, events: generateEvents() };\n }\n\n async stop(pid: number): Promise<void> {\n await this.processManager.killWithGrace(pid);\n }\n}\n"]}
|
package/dist/status-DTF7D3DV.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { formatDurationSince, amber, dim, statusIcon, agentName, priorityLabel, formatTokens } from './chunk-I5WEMARW.js';
|
|
3
|
-
|
|
4
|
-
// src/cli/commands/status.ts
|
|
5
|
-
function registerStatusCommand(program, container) {
|
|
6
|
-
program.command("status").description("Show orchestrator status").action(async () => {
|
|
7
|
-
await container.paths.requireInit();
|
|
8
|
-
const tasks = await container.taskService.list();
|
|
9
|
-
const agents = await container.agentService.list();
|
|
10
|
-
const state = await container.stateStore.read();
|
|
11
|
-
if (container.context.json) {
|
|
12
|
-
console.log(JSON.stringify({ tasks, agents, state }, null, 2));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const runningCount = Object.keys(state.running).length;
|
|
16
|
-
const mode = state.pid ? "watching" : "idle";
|
|
17
|
-
const uptime = state.started_at ? formatDurationSince(state.started_at) : "";
|
|
18
|
-
console.log();
|
|
19
|
-
console.log(`${amber("orch")} \xB7 ${container.config.project.name} \xB7 ${mode}`);
|
|
20
|
-
console.log();
|
|
21
|
-
const counts = {};
|
|
22
|
-
for (const t of tasks) {
|
|
23
|
-
counts[t.status] = (counts[t.status] ?? 0) + 1;
|
|
24
|
-
}
|
|
25
|
-
if (runningCount > 0) {
|
|
26
|
-
console.log(` ${"RUNNING".padEnd(12)}${runningCount}${"".padEnd(20)}AGENTS ${agents.length}`);
|
|
27
|
-
}
|
|
28
|
-
for (const [status, count] of Object.entries(counts)) {
|
|
29
|
-
if (status !== "in_progress") {
|
|
30
|
-
console.log(` ${dim(status.padEnd(12))}${count}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const runningTasks = tasks.filter((t) => t.status === "in_progress");
|
|
34
|
-
if (runningTasks.length > 0) {
|
|
35
|
-
console.log();
|
|
36
|
-
for (const t of runningTasks) {
|
|
37
|
-
const time = formatDurationSince(t.updated_at);
|
|
38
|
-
console.log(
|
|
39
|
-
` ${statusIcon("in_progress")} ${t.assignee ? agentName(t.assignee) : ""} ${t.title.slice(0, 35).padEnd(37)}${time} ${priorityLabel(t.priority)}`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const totalTokens = state.stats.total_tokens.total;
|
|
44
|
-
const footer = [
|
|
45
|
-
uptime ? `up ${uptime}` : null,
|
|
46
|
-
totalTokens > 0 ? `${formatTokens(totalTokens)} tokens` : null
|
|
47
|
-
].filter(Boolean).join(" \xB7 ");
|
|
48
|
-
if (footer) {
|
|
49
|
-
console.log();
|
|
50
|
-
console.log(` ${dim(footer)}`);
|
|
51
|
-
}
|
|
52
|
-
console.log();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { registerStatusCommand };
|
package/dist/task-35SDKXFC.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { openInEditor, toEditorContent, fromEditorContent } from './chunk-P6ATSXGL.js';
|
|
3
|
-
import { printSuccess, dim, formatDurationSince, statusIcon, priorityLabel, agentName, printTable, filePath, printKeyValue } from './chunk-I5WEMARW.js';
|
|
4
|
-
|
|
5
|
-
// src/cli/commands/task.ts
|
|
6
|
-
function registerTaskCommand(program, container) {
|
|
7
|
-
const task = program.command("task").description("Manage tasks");
|
|
8
|
-
task.command("add <title>").description("Create a new task").option("-d, --description <desc>", "Task description").option("-p, --priority <n>", "Priority (1-4)", "3").option("-l, --labels <labels>", "Comma-separated labels").option("--depends-on <ids>", "Comma-separated dependency task IDs").option("--max-attempts <n>", "Max retry attempts").option("--workspace-mode <mode>", "Workspace mode: shared|worktree|isolated").option("--assignee <agent-id>", "Assign to agent").option("--review-criteria <criteria>", "Comma-separated auto-review criteria: test_pass,typecheck,lint").option("--scope <patterns>", "Comma-separated glob patterns for file scope (e.g. src/auth/**,src/session/**)").option("-e, --edit", "Open $EDITOR to write the description").action(async (title, opts) => {
|
|
9
|
-
await container.paths.requireInit();
|
|
10
|
-
let description = opts.description;
|
|
11
|
-
if (opts.edit) {
|
|
12
|
-
const content = await openInEditor(
|
|
13
|
-
toEditorContent({ title, priority: parseInt(opts.priority, 10), description })
|
|
14
|
-
);
|
|
15
|
-
const parsed = fromEditorContent(content);
|
|
16
|
-
description = parsed.description;
|
|
17
|
-
}
|
|
18
|
-
const task2 = await container.taskService.create({
|
|
19
|
-
title,
|
|
20
|
-
description,
|
|
21
|
-
priority: parseInt(opts.priority, 10),
|
|
22
|
-
labels: opts.labels?.split(",").map((s) => s.trim()),
|
|
23
|
-
depends_on: opts.dependsOn?.split(",").map((s) => s.trim()),
|
|
24
|
-
max_attempts: opts.maxAttempts ? parseInt(opts.maxAttempts, 10) : void 0,
|
|
25
|
-
workspace_mode: opts.workspaceMode,
|
|
26
|
-
assignee: opts.assignee,
|
|
27
|
-
review_criteria: opts.reviewCriteria?.split(",").map((s) => s.trim()),
|
|
28
|
-
scope: opts.scope?.split(",").map((s) => s.trim())
|
|
29
|
-
});
|
|
30
|
-
if (container.context.json) {
|
|
31
|
-
console.log(JSON.stringify(task2, null, 2));
|
|
32
|
-
} else if (container.context.quiet) {
|
|
33
|
-
console.log(task2.id);
|
|
34
|
-
} else {
|
|
35
|
-
printSuccess(`Created ${task2.id} "${task2.title}"`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
task.command("list").description("List all tasks").option("--status <status>", "Filter by status").action(async (opts) => {
|
|
39
|
-
await container.paths.requireInit();
|
|
40
|
-
const tasks = await container.taskService.list(
|
|
41
|
-
opts.status ? { status: opts.status } : void 0
|
|
42
|
-
);
|
|
43
|
-
if (container.context.json) {
|
|
44
|
-
console.log(JSON.stringify(tasks, null, 2));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (container.context.quiet) {
|
|
48
|
-
tasks.forEach((t) => console.log(t.id));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (tasks.length === 0) {
|
|
52
|
-
console.log(`
|
|
53
|
-
No tasks. Create one: ${dim('orch task add "Title"')}
|
|
54
|
-
`);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const headers = ["STATUS", "PRI", "TASK", "AGENT", "TIME"];
|
|
58
|
-
const rows = tasks.map((t) => {
|
|
59
|
-
const time = (t.status === "in_progress" || t.status === "done") && t.updated_at ? formatDurationSince(t.updated_at) : dim("\u2014");
|
|
60
|
-
return [
|
|
61
|
-
`${statusIcon(t.status)} ${t.status}`,
|
|
62
|
-
priorityLabel(t.priority),
|
|
63
|
-
t.title.slice(0, 35),
|
|
64
|
-
t.assignee ? agentName(t.assignee) : dim("\u2014"),
|
|
65
|
-
time
|
|
66
|
-
];
|
|
67
|
-
});
|
|
68
|
-
console.log();
|
|
69
|
-
printTable(headers, rows);
|
|
70
|
-
const running = tasks.filter((t) => t.status === "in_progress").length;
|
|
71
|
-
const review = tasks.filter((t) => t.status === "review").length;
|
|
72
|
-
const done = tasks.filter((t) => t.status === "done").length;
|
|
73
|
-
console.log(
|
|
74
|
-
`
|
|
75
|
-
${tasks.length} tasks${running ? ` \xB7 ${running} running` : ""}${review ? ` \xB7 ${review} review` : ""}${done ? ` \xB7 ${done} done` : ""}
|
|
76
|
-
`
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
task.command("show <id>").description("Show task details").action(async (id) => {
|
|
80
|
-
await container.paths.requireInit();
|
|
81
|
-
const t = await container.taskService.get(id);
|
|
82
|
-
if (container.context.json) {
|
|
83
|
-
console.log(JSON.stringify(t, null, 2));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
console.log(`
|
|
87
|
-
${t.title}`);
|
|
88
|
-
console.log(` ${"\u2550".repeat(42)}`);
|
|
89
|
-
console.log();
|
|
90
|
-
const pairs = [
|
|
91
|
-
["Status", `${statusIcon(t.status)} ${t.status} \xB7 attempt ${t.attempts}/${t.max_attempts}`],
|
|
92
|
-
["Priority", priorityLabel(t.priority)]
|
|
93
|
-
];
|
|
94
|
-
if (t.assignee) pairs.push(["Agent", agentName(t.assignee)]);
|
|
95
|
-
if (t.labels.length) pairs.push(["Labels", t.labels.join(", ")]);
|
|
96
|
-
if (t.scope?.length) pairs.push(["Scope", t.scope.join(", ")]);
|
|
97
|
-
if (t.workspace_mode) pairs.push(["Workspace", t.workspace_mode]);
|
|
98
|
-
if (t.workspace) pairs.push(["Path", filePath(t.workspace)]);
|
|
99
|
-
if (t.review_criteria?.length) pairs.push(["Review", t.review_criteria.join(", ")]);
|
|
100
|
-
if (t.feedback) pairs.push(["Feedback", t.feedback]);
|
|
101
|
-
pairs.push(["Created", t.created_at]);
|
|
102
|
-
printKeyValue(pairs);
|
|
103
|
-
if (t.description) {
|
|
104
|
-
console.log(`
|
|
105
|
-
Description
|
|
106
|
-
${"\u2500".repeat(42)}`);
|
|
107
|
-
for (const line of t.description.split("\n")) {
|
|
108
|
-
console.log(` ${line}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (t.proof) {
|
|
112
|
-
console.log(`
|
|
113
|
-
Result
|
|
114
|
-
${"\u2500".repeat(42)}`);
|
|
115
|
-
if (t.proof.branch) console.log(` Branch: ${t.proof.branch}`);
|
|
116
|
-
if (t.proof.pr_url) console.log(` PR: ${t.proof.pr_url}`);
|
|
117
|
-
if (t.proof.files_changed.length) {
|
|
118
|
-
console.log(` Files changed:`);
|
|
119
|
-
for (const f of t.proof.files_changed) {
|
|
120
|
-
console.log(` \u2022 ${f}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (t.proof.test_results) {
|
|
124
|
-
console.log(` Test results:`);
|
|
125
|
-
for (const line of t.proof.test_results.split("\n")) {
|
|
126
|
-
console.log(` ${line}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (t.proof.agent_summary) {
|
|
130
|
-
console.log(` Agent summary:`);
|
|
131
|
-
for (const line of t.proof.agent_summary.split("\n")) {
|
|
132
|
-
console.log(` ${line}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (t.review_results?.length) {
|
|
137
|
-
console.log(`
|
|
138
|
-
Review Results
|
|
139
|
-
${"\u2500".repeat(42)}`);
|
|
140
|
-
for (const r of t.review_results) {
|
|
141
|
-
const icon = r.passed ? "\u2713" : "\u2717";
|
|
142
|
-
console.log(` ${icon} ${r.criterion}: ${r.passed ? "passed" : "failed"}`);
|
|
143
|
-
if (r.output) {
|
|
144
|
-
for (const line of r.output.split("\n")) {
|
|
145
|
-
console.log(` ${line}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
console.log();
|
|
151
|
-
});
|
|
152
|
-
task.command("edit <id>").description("Open task in $EDITOR to modify title, priority and description").action(async (id) => {
|
|
153
|
-
await container.paths.requireInit();
|
|
154
|
-
const existing = await container.taskService.get(id);
|
|
155
|
-
const initial = toEditorContent({
|
|
156
|
-
title: existing.title,
|
|
157
|
-
priority: existing.priority,
|
|
158
|
-
description: existing.description
|
|
159
|
-
});
|
|
160
|
-
const content = await openInEditor(initial);
|
|
161
|
-
const parsed = fromEditorContent(content);
|
|
162
|
-
const fields = {};
|
|
163
|
-
if (parsed.title && parsed.title !== existing.title) fields.title = parsed.title;
|
|
164
|
-
if (parsed.priority && parsed.priority !== existing.priority) fields.priority = parsed.priority;
|
|
165
|
-
if (parsed.description !== void 0 && parsed.description !== existing.description) {
|
|
166
|
-
fields.description = parsed.description ?? "";
|
|
167
|
-
}
|
|
168
|
-
if (Object.keys(fields).length === 0) {
|
|
169
|
-
console.log(" No changes.");
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const updated = await container.taskService.update(id, fields);
|
|
173
|
-
printSuccess(`Updated ${updated.id} "${updated.title}"`);
|
|
174
|
-
});
|
|
175
|
-
task.command("assign <task-id> <agent-id>").description("Assign task to agent").action(async (taskId, agentId) => {
|
|
176
|
-
await container.paths.requireInit();
|
|
177
|
-
const t = await container.taskService.assign(taskId, agentId);
|
|
178
|
-
printSuccess(`Assigned ${t.id} \u2192 ${agentId}`);
|
|
179
|
-
});
|
|
180
|
-
task.command("cancel <id>").description("Cancel a task").action(async (id) => {
|
|
181
|
-
await container.paths.requireInit();
|
|
182
|
-
const task2 = await container.taskService.get(id);
|
|
183
|
-
if (task2.status === "in_progress") {
|
|
184
|
-
const { buildFullContainer } = await import('./container-KPH4HVAJ.js');
|
|
185
|
-
const full = await buildFullContainer(container.context);
|
|
186
|
-
await full.orchestrator.cancelTask(id);
|
|
187
|
-
} else {
|
|
188
|
-
await container.taskService.cancel(id);
|
|
189
|
-
}
|
|
190
|
-
printSuccess(`Cancelled ${id}`);
|
|
191
|
-
});
|
|
192
|
-
task.command("approve <id>").description("Approve a task in review").action(async (id) => {
|
|
193
|
-
await container.paths.requireInit();
|
|
194
|
-
await container.taskService.updateStatus(id, "done");
|
|
195
|
-
printSuccess(`Approved ${id}`);
|
|
196
|
-
});
|
|
197
|
-
task.command("reject <id>").description("Reject a task and send it back for rework").option("-r, --reason <reason>", "Feedback for the agent explaining what to fix").action(async (id, opts) => {
|
|
198
|
-
await container.paths.requireInit();
|
|
199
|
-
await container.taskService.reject(id, opts.reason);
|
|
200
|
-
printSuccess(`Rejected ${id} \u2192 todo${opts.reason ? ` (reason: ${opts.reason})` : ""}`);
|
|
201
|
-
});
|
|
202
|
-
task.command("retry <id>").description("Retry a failed task").action(async (id) => {
|
|
203
|
-
await container.paths.requireInit();
|
|
204
|
-
await container.taskService.retry(id);
|
|
205
|
-
printSuccess(`Reset ${id} to todo`);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export { registerTaskCommand };
|
package/dist/team-AISPLEJB.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { printSuccess, dim, printTable, printKeyValue } from './chunk-I5WEMARW.js';
|
|
3
|
-
|
|
4
|
-
// src/cli/commands/team.ts
|
|
5
|
-
function registerTeamCommand(program, container) {
|
|
6
|
-
const team = program.command("team").description("Manage agent teams");
|
|
7
|
-
team.command("create <name>").description("Create a new team").requiredOption("--lead <agent-id>", "Lead agent ID").option("--members <ids>", "Comma-separated member agent IDs").option("-d, --description <desc>", "Team description").option("--no-auto-claim", "Disable auto-claiming").action(async (name, opts) => {
|
|
8
|
-
await container.paths.requireInit();
|
|
9
|
-
const t = await container.teamService.create({
|
|
10
|
-
name,
|
|
11
|
-
description: opts.description,
|
|
12
|
-
lead_agent_id: opts.lead,
|
|
13
|
-
member_agent_ids: opts.members?.split(",").map((s) => s.trim()),
|
|
14
|
-
config: { auto_claim: opts.autoClaim !== false }
|
|
15
|
-
});
|
|
16
|
-
if (container.context.json) {
|
|
17
|
-
console.log(JSON.stringify(t, null, 2));
|
|
18
|
-
} else if (container.context.quiet) {
|
|
19
|
-
console.log(t.id);
|
|
20
|
-
} else {
|
|
21
|
-
printSuccess(`Created team "${t.name}" \u2192 ${t.id}`);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
team.command("list").description("List all teams").action(async () => {
|
|
25
|
-
await container.paths.requireInit();
|
|
26
|
-
const teams = await container.teamService.list();
|
|
27
|
-
if (container.context.json) {
|
|
28
|
-
console.log(JSON.stringify(teams, null, 2));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (teams.length === 0) {
|
|
32
|
-
console.log(dim(`
|
|
33
|
-
No teams. Create one: orch team create <name> --lead <agent-id>
|
|
34
|
-
`));
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const headers = ["ID", "NAME", "STATUS", "LEAD", "MEMBERS", "POOL"];
|
|
38
|
-
const rows = teams.map((t) => [
|
|
39
|
-
t.id,
|
|
40
|
-
t.name,
|
|
41
|
-
t.status,
|
|
42
|
-
t.lead_agent_id,
|
|
43
|
-
String(t.members.length),
|
|
44
|
-
String(t.task_pool.length)
|
|
45
|
-
]);
|
|
46
|
-
console.log();
|
|
47
|
-
printTable(headers, rows);
|
|
48
|
-
console.log();
|
|
49
|
-
});
|
|
50
|
-
team.command("show <id>").description("Show team details").action(async (id) => {
|
|
51
|
-
await container.paths.requireInit();
|
|
52
|
-
const t = await container.teamService.get(id);
|
|
53
|
-
if (container.context.json) {
|
|
54
|
-
console.log(JSON.stringify(t, null, 2));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
console.log();
|
|
58
|
-
printKeyValue([
|
|
59
|
-
["ID", t.id],
|
|
60
|
-
["Name", t.name],
|
|
61
|
-
["Status", t.status],
|
|
62
|
-
["Lead", t.lead_agent_id],
|
|
63
|
-
["Members", t.members.map((m) => `${m.agent_id} (${m.role})`).join(", ")],
|
|
64
|
-
["Pool", t.task_pool.length > 0 ? t.task_pool.join(", ") : dim("empty")],
|
|
65
|
-
["Auto-claim", String(t.config.auto_claim)],
|
|
66
|
-
["Created", t.created_at]
|
|
67
|
-
]);
|
|
68
|
-
console.log();
|
|
69
|
-
});
|
|
70
|
-
team.command("join <team-id> <agent-id>").description("Add an agent to a team").action(async (teamId, agentId) => {
|
|
71
|
-
await container.paths.requireInit();
|
|
72
|
-
await container.teamService.join(teamId, agentId);
|
|
73
|
-
printSuccess(`Agent ${agentId} joined team ${teamId}`);
|
|
74
|
-
});
|
|
75
|
-
team.command("leave <team-id> <agent-id>").description("Remove an agent from a team").action(async (teamId, agentId) => {
|
|
76
|
-
await container.paths.requireInit();
|
|
77
|
-
await container.teamService.leave(teamId, agentId);
|
|
78
|
-
printSuccess(`Agent ${agentId} left team ${teamId}`);
|
|
79
|
-
});
|
|
80
|
-
team.command("add-task <team-id> <task-id>").description("Add a task to the team pool").action(async (teamId, taskId) => {
|
|
81
|
-
await container.paths.requireInit();
|
|
82
|
-
await container.teamService.addTask(teamId, taskId);
|
|
83
|
-
printSuccess(`Task ${taskId} added to team ${teamId} pool`);
|
|
84
|
-
});
|
|
85
|
-
team.command("set-lead <team-id> <agent-id>").description("Transfer team lead to another member").action(async (teamId, agentId) => {
|
|
86
|
-
await container.paths.requireInit();
|
|
87
|
-
await container.teamService.setLead(teamId, agentId);
|
|
88
|
-
printSuccess(`${agentId} is now lead of team ${teamId}`);
|
|
89
|
-
});
|
|
90
|
-
team.command("disband <id>").description("Disband a team").action(async (id) => {
|
|
91
|
-
await container.paths.requireInit();
|
|
92
|
-
await container.teamService.disband(id);
|
|
93
|
-
printSuccess(`Team ${id} disbanded`);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { registerTeamCommand };
|