@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,221 @@
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-7X2GI5OV.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("--goal-id <goalId>", "Associate task with a goal").option("--attach <paths>", "Comma-separated file paths to attach (screenshots, docs)").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
+ goalId: opts.goalId,
30
+ attachments: opts.attach?.split(",").map((s) => s.trim())
31
+ });
32
+ if (container.context.json) {
33
+ console.log(JSON.stringify(task2, null, 2));
34
+ } else if (container.context.quiet) {
35
+ console.log(task2.id);
36
+ } else {
37
+ printSuccess(`Created ${task2.id} "${task2.title}"`);
38
+ }
39
+ });
40
+ task.command("list").description("List all tasks").option("--status <status>", "Filter by status").action(async (opts) => {
41
+ await container.paths.requireInit();
42
+ const tasks = await container.taskService.list(
43
+ opts.status ? { status: opts.status } : void 0
44
+ );
45
+ if (container.context.json) {
46
+ console.log(JSON.stringify(tasks, null, 2));
47
+ return;
48
+ }
49
+ if (container.context.quiet) {
50
+ tasks.forEach((t) => console.log(t.id));
51
+ return;
52
+ }
53
+ if (tasks.length === 0) {
54
+ console.log(`
55
+ No tasks. Create one: ${dim('orch task add "Title"')}
56
+ `);
57
+ return;
58
+ }
59
+ const headers = ["STATUS", "PRI", "TASK", "AGENT", "TIME"];
60
+ const rows = tasks.map((t) => {
61
+ const time = (t.status === "in_progress" || t.status === "done") && t.updated_at ? formatDurationSince(t.updated_at) : dim("\u2014");
62
+ return [
63
+ `${statusIcon(t.status)} ${t.status}`,
64
+ priorityLabel(t.priority),
65
+ t.title.slice(0, 35),
66
+ t.assignee ? agentName(t.assignee) : dim("\u2014"),
67
+ time
68
+ ];
69
+ });
70
+ console.log();
71
+ printTable(headers, rows);
72
+ const running = tasks.filter((t) => t.status === "in_progress").length;
73
+ const review = tasks.filter((t) => t.status === "review").length;
74
+ const done = tasks.filter((t) => t.status === "done").length;
75
+ console.log(
76
+ `
77
+ ${tasks.length} tasks${running ? ` \xB7 ${running} running` : ""}${review ? ` \xB7 ${review} review` : ""}${done ? ` \xB7 ${done} done` : ""}
78
+ `
79
+ );
80
+ });
81
+ task.command("show <id>").description("Show task details").action(async (id) => {
82
+ await container.paths.requireInit();
83
+ const t = await container.taskService.get(id);
84
+ if (container.context.json) {
85
+ console.log(JSON.stringify(t, null, 2));
86
+ return;
87
+ }
88
+ console.log(`
89
+ ${t.title}`);
90
+ console.log(` ${"\u2550".repeat(42)}`);
91
+ console.log();
92
+ const pairs = [
93
+ ["Status", `${statusIcon(t.status)} ${t.status} \xB7 attempt ${t.attempts}/${t.max_attempts}`],
94
+ ["Priority", priorityLabel(t.priority)]
95
+ ];
96
+ if (t.assignee) pairs.push(["Agent", agentName(t.assignee)]);
97
+ if (t.labels.length) pairs.push(["Labels", t.labels.join(", ")]);
98
+ if (t.scope?.length) pairs.push(["Scope", t.scope.join(", ")]);
99
+ if (t.workspace_mode) pairs.push(["Workspace", t.workspace_mode]);
100
+ if (t.workspace) pairs.push(["Path", filePath(t.workspace)]);
101
+ if (t.review_criteria?.length) pairs.push(["Review", t.review_criteria.join(", ")]);
102
+ if (t.feedback) pairs.push(["Feedback", t.feedback]);
103
+ pairs.push(["Created", t.created_at]);
104
+ printKeyValue(pairs);
105
+ if (t.attachments?.length) {
106
+ console.log(`
107
+ Attachments (${t.attachments.length})
108
+ ${"\u2500".repeat(42)}`);
109
+ for (const a of t.attachments) {
110
+ console.log(` ${filePath(a)}`);
111
+ }
112
+ }
113
+ if (t.description) {
114
+ console.log(`
115
+ Description
116
+ ${"\u2500".repeat(42)}`);
117
+ for (const line of t.description.split("\n")) {
118
+ console.log(` ${line}`);
119
+ }
120
+ }
121
+ if (t.proof) {
122
+ console.log(`
123
+ Result
124
+ ${"\u2500".repeat(42)}`);
125
+ if (t.proof.branch) console.log(` Branch: ${t.proof.branch}`);
126
+ if (t.proof.pr_url) console.log(` PR: ${t.proof.pr_url}`);
127
+ if (t.proof.files_changed.length) {
128
+ console.log(` Files changed:`);
129
+ for (const f of t.proof.files_changed) {
130
+ console.log(` \u2022 ${f}`);
131
+ }
132
+ }
133
+ if (t.proof.test_results) {
134
+ console.log(` Test results:`);
135
+ for (const line of t.proof.test_results.split("\n")) {
136
+ console.log(` ${line}`);
137
+ }
138
+ }
139
+ if (t.proof.agent_summary) {
140
+ console.log(` Agent summary:`);
141
+ for (const line of t.proof.agent_summary.split("\n")) {
142
+ console.log(` ${line}`);
143
+ }
144
+ }
145
+ }
146
+ if (t.review_results?.length) {
147
+ console.log(`
148
+ Review Results
149
+ ${"\u2500".repeat(42)}`);
150
+ for (const r of t.review_results) {
151
+ const icon = r.passed ? "\u2713" : "\u2717";
152
+ console.log(` ${icon} ${r.criterion}: ${r.passed ? "passed" : "failed"}`);
153
+ if (r.output) {
154
+ for (const line of r.output.split("\n")) {
155
+ console.log(` ${line}`);
156
+ }
157
+ }
158
+ }
159
+ }
160
+ console.log();
161
+ });
162
+ task.command("edit <id>").description("Open task in $EDITOR to modify title, priority and description").action(async (id) => {
163
+ await container.paths.requireInit();
164
+ const existing = await container.taskService.get(id);
165
+ const attachmentNote = existing.attachments?.length ? `
166
+ # Attachments: ${existing.attachments.join(", ")}` : "";
167
+ const initial = toEditorContent({
168
+ title: existing.title,
169
+ priority: existing.priority,
170
+ description: existing.description
171
+ }) + attachmentNote;
172
+ const content = await openInEditor(initial);
173
+ const parsed = fromEditorContent(content);
174
+ const fields = {};
175
+ if (parsed.title && parsed.title !== existing.title) fields.title = parsed.title;
176
+ if (parsed.priority && parsed.priority !== existing.priority) fields.priority = parsed.priority;
177
+ if (parsed.description !== void 0 && parsed.description !== existing.description) {
178
+ fields.description = parsed.description ?? "";
179
+ }
180
+ if (Object.keys(fields).length === 0) {
181
+ console.log(" No changes.");
182
+ return;
183
+ }
184
+ const updated = await container.taskService.update(id, fields);
185
+ printSuccess(`Updated ${updated.id} "${updated.title}"`);
186
+ });
187
+ task.command("assign <task-id> <agent-id>").description("Assign task to agent").action(async (taskId, agentId) => {
188
+ await container.paths.requireInit();
189
+ const t = await container.taskService.assign(taskId, agentId);
190
+ printSuccess(`Assigned ${t.id} \u2192 ${agentId}`);
191
+ });
192
+ task.command("cancel <id>").description("Cancel a task").action(async (id) => {
193
+ await container.paths.requireInit();
194
+ const task2 = await container.taskService.get(id);
195
+ if (task2.status === "in_progress") {
196
+ const { buildFullContainer } = await import('./container-LJU4QNDH.js');
197
+ const full = await buildFullContainer(container.context);
198
+ await full.orchestrator.cancelTask(id);
199
+ } else {
200
+ await container.taskService.cancel(id);
201
+ }
202
+ printSuccess(`Cancelled ${id}`);
203
+ });
204
+ task.command("approve <id>").description("Approve a task in review").action(async (id) => {
205
+ await container.paths.requireInit();
206
+ await container.taskService.updateStatus(id, "done");
207
+ printSuccess(`Approved ${id}`);
208
+ });
209
+ 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) => {
210
+ await container.paths.requireInit();
211
+ await container.taskService.reject(id, opts.reason);
212
+ printSuccess(`Rejected ${id} \u2192 todo${opts.reason ? ` (reason: ${opts.reason})` : ""}`);
213
+ });
214
+ task.command("retry <id>").description("Retry a failed task").action(async (id) => {
215
+ await container.paths.requireInit();
216
+ await container.taskService.retry(id);
217
+ printSuccess(`Reset ${id} to todo`);
218
+ });
219
+ }
220
+
221
+ export { registerTaskCommand };
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import { printSuccess, dim, printTable, printKeyValue } from './chunk-7X2GI5OV.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 };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export { DEFAULT_PROMPT_TEMPLATE, LiquidTemplateEngine, buildPromptContext } from './chunk-A36WAF2S.js';
3
+ import './chunk-PNE6LQRF.js';
@@ -0,0 +1,245 @@
1
+ #!/usr/bin/env node
2
+ // src/cli/commands/tui.ts
3
+ function registerTuiCommand(program, container) {
4
+ program.command("tui").description("Launch interactive TUI dashboard").action(async () => {
5
+ await container.paths.requireInit();
6
+ const tasks = await container.taskService.list();
7
+ const agents = await container.agentService.list();
8
+ const state = await container.stateStore.read();
9
+ const { render } = await import('ink');
10
+ const { createElement } = await import('react');
11
+ const { App } = await import('./App-RKAPZNZO.js');
12
+ const onRunTask = async (taskId) => {
13
+ await container.orchestrator.runTask(taskId);
14
+ };
15
+ const onCreateTask = async (title, opts) => {
16
+ return container.taskService.create({
17
+ title,
18
+ priority: opts?.priority,
19
+ description: opts?.description,
20
+ attachments: opts?.attachments
21
+ });
22
+ };
23
+ const onCancelTask = async (taskId) => {
24
+ await container.orchestrator.cancelTask(taskId);
25
+ };
26
+ const onRetryTask = async (taskId) => {
27
+ await container.taskService.retry(taskId);
28
+ };
29
+ const onAssignTask = async (taskId, agentId) => {
30
+ await container.taskService.assign(taskId, agentId);
31
+ };
32
+ const onRunAll = async () => {
33
+ await container.orchestrator.runAll();
34
+ };
35
+ const onDisableAgent = async (agentId) => {
36
+ await container.agentService.disable(agentId);
37
+ };
38
+ const onEnableAgent = async (agentId) => {
39
+ await container.agentService.enable(agentId);
40
+ };
41
+ const onSubscribeEvents = (handler) => {
42
+ return container.eventBus.onAny(handler);
43
+ };
44
+ const onRefreshTasks = async () => {
45
+ return container.taskService.list();
46
+ };
47
+ const onRefreshAgents = async () => {
48
+ return container.agentService.list();
49
+ };
50
+ const onRefreshState = async () => {
51
+ return container.stateStore.read();
52
+ };
53
+ const onAddAgent = async (name, adapter, opts) => {
54
+ return container.agentService.create({
55
+ name,
56
+ adapter: adapter ?? "claude",
57
+ model: opts?.model || void 0,
58
+ role: opts?.role || void 0,
59
+ approval_policy: opts?.approval_policy || void 0,
60
+ skills: opts?.skills || void 0
61
+ });
62
+ };
63
+ const onDeleteAgent = async (agentId) => {
64
+ await container.agentService.remove(agentId);
65
+ };
66
+ const onDeleteTask = async (taskId) => {
67
+ await container.taskService.delete(taskId);
68
+ };
69
+ const onApproveTask = async (taskId) => {
70
+ await container.taskService.updateStatus(taskId, "done");
71
+ };
72
+ const onRejectTask = async (taskId, feedback) => {
73
+ await container.taskService.reject(taskId, feedback);
74
+ };
75
+ const onUpdateTask = async (taskId, fields) => {
76
+ return container.taskService.update(taskId, fields);
77
+ };
78
+ const onUpdateAgent = async (agentId, fields) => {
79
+ return container.agentService.update(agentId, {
80
+ ...fields,
81
+ approval_policy: fields.approval_policy
82
+ });
83
+ };
84
+ const onForceStopAgent = async (agentId) => {
85
+ await container.orchestrator.forceStopAgent(agentId);
86
+ };
87
+ const onToggleAutonomous = async (agentId, enabled) => {
88
+ return container.agentService.setAutonomous(agentId, enabled);
89
+ };
90
+ const onLoadHistory = async (onBatch) => {
91
+ const allRuns = await container.runService.listAll();
92
+ const FIRST_BATCH = 3;
93
+ const TOTAL_RUNS = 10;
94
+ const firstRuns = allRuns.slice(0, FIRST_BATCH);
95
+ const restRuns = allRuns.slice(FIRST_BATCH, TOTAL_RUNS);
96
+ const loadRunEvents = async (run) => {
97
+ const events = await container.runService.readEventsTail(run.id, 30);
98
+ return events.map((evt) => ({
99
+ timestamp: evt.timestamp,
100
+ agentId: run.agent_id,
101
+ taskId: run.task_id,
102
+ type: evt.type,
103
+ data: evt.data
104
+ }));
105
+ };
106
+ if (firstRuns.length > 0) {
107
+ const firstEntries = (await Promise.all(firstRuns.map(loadRunEvents))).flat();
108
+ firstEntries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
109
+ onBatch(firstEntries.slice(-200));
110
+ }
111
+ if (restRuns.length > 0) {
112
+ const restEntries = (await Promise.all(restRuns.map(loadRunEvents))).flat();
113
+ restEntries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
114
+ onBatch(restEntries.slice(-200));
115
+ }
116
+ };
117
+ const onCreateTeam = async (input) => {
118
+ return container.teamService.create(input);
119
+ };
120
+ const onListTeams = async () => {
121
+ return container.teamService.list();
122
+ };
123
+ const onJoinTeam = async (teamId, agentId) => {
124
+ return container.teamService.join(teamId, agentId);
125
+ };
126
+ const onLeaveTeam = async (teamId, agentId) => {
127
+ return container.teamService.leave(teamId, agentId);
128
+ };
129
+ const onDisbandTeam = async (teamId) => {
130
+ await container.teamService.disband(teamId);
131
+ };
132
+ const onSetTeamLead = async (teamId, agentId) => {
133
+ return container.teamService.setLead(teamId, agentId);
134
+ };
135
+ const onRefreshGoals = async () => {
136
+ return container.goalService.list();
137
+ };
138
+ const onCreateGoal = async (input) => {
139
+ return container.goalService.create(input);
140
+ };
141
+ const onUpdateGoal = async (id, fields) => {
142
+ return container.goalService.update(id, fields);
143
+ };
144
+ const onUpdateGoalStatus = async (id, status) => {
145
+ return container.goalService.updateStatus(id, status);
146
+ };
147
+ const onDeleteGoal = async (id) => {
148
+ await container.goalService.delete(id);
149
+ };
150
+ const onGetGoalProgress = async (goalId) => {
151
+ return container.goalService.getProgressReport(goalId);
152
+ };
153
+ const onStartWatch = async () => {
154
+ await container.orchestrator.startWatch();
155
+ };
156
+ const onStopWatch = async () => {
157
+ await container.orchestrator.stop();
158
+ };
159
+ const currentVersion = program.version() ?? "0.0.0";
160
+ const updateCheckPromise = import('./update-check-4YKLGBFB.js').then((m) => m.checkForUpdateSWR(currentVersion)).catch(() => null);
161
+ let watchStarted = false;
162
+ let watchError;
163
+ try {
164
+ await container.orchestrator.startWatch();
165
+ watchStarted = true;
166
+ } catch (err) {
167
+ watchError = err instanceof Error ? err.message : String(err);
168
+ }
169
+ const updateInfo = await updateCheckPromise;
170
+ const { waitUntilExit } = render(
171
+ createElement(App, {
172
+ projectName: container.config.project.name,
173
+ tasks,
174
+ agents,
175
+ state,
176
+ onRunTask,
177
+ onCreateTask,
178
+ onCancelTask,
179
+ onRetryTask,
180
+ onAssignTask,
181
+ onRunAll,
182
+ onDisableAgent,
183
+ onEnableAgent,
184
+ onSubscribeEvents,
185
+ onRefreshTasks,
186
+ onRefreshAgents,
187
+ onRefreshState,
188
+ onLoadHistory,
189
+ onAddAgent,
190
+ onDeleteAgent,
191
+ onApproveTask,
192
+ onRejectTask,
193
+ onDeleteTask,
194
+ onUpdateTask,
195
+ onUpdateAgent,
196
+ onForceStopAgent,
197
+ onToggleAutonomous,
198
+ onRefreshGoals,
199
+ onCreateGoal,
200
+ onUpdateGoal,
201
+ onUpdateGoalStatus,
202
+ onDeleteGoal,
203
+ onGetGoalProgress,
204
+ onCreateTeam,
205
+ onListTeams,
206
+ onJoinTeam,
207
+ onLeaveTeam,
208
+ onDisbandTeam,
209
+ onSetTeamLead,
210
+ onStartWatch,
211
+ onStopWatch,
212
+ initialWatchActive: watchStarted,
213
+ watchError,
214
+ version: currentVersion,
215
+ latestVersion: updateInfo?.updateAvailable ? updateInfo.latest : void 0,
216
+ initialActivityFilter: container.globalConfig.tui.activity_filter,
217
+ onSaveActivityFilter: async (preset) => {
218
+ await container.globalConfigStore.set("activity_filter", preset);
219
+ },
220
+ initialNotifications: container.globalConfig.tui.notifications,
221
+ onSaveNotifications: async (notif) => {
222
+ await container.globalConfigStore.set("notifications", notif);
223
+ },
224
+ initialMaxConcurrent: container.config.scheduling.max_concurrent_agents,
225
+ onSaveMaxConcurrent: async (value) => {
226
+ await container.configStore.set("scheduling.max_concurrent_agents", value);
227
+ container.config.scheduling.max_concurrent_agents = value;
228
+ },
229
+ onCompleteOnboarding: async () => {
230
+ const s = await container.stateStore.read();
231
+ s.onboardingCompleted = true;
232
+ await container.stateStore.write(s);
233
+ }
234
+ }),
235
+ { kittyKeyboard: { mode: "auto", flags: ["disambiguateEscapeCodes"] } }
236
+ );
237
+ await waitUntilExit();
238
+ if (watchStarted) {
239
+ await container.orchestrator.stop().catch(() => {
240
+ });
241
+ }
242
+ });
243
+ }
244
+
245
+ export { registerTuiCommand };
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ import { checkForUpdateNow } from './chunk-FRTKB575.js';
3
+ import { amber, dim } from './chunk-7X2GI5OV.js';
4
+ import { execFile } from 'child_process';
5
+ import chalk from 'chalk';
6
+
7
+ var PACKAGE_NAME = "@oxgeneral/orch";
8
+ function runInstall() {
9
+ return new Promise((resolve) => {
10
+ const child = execFile(
11
+ "npm",
12
+ ["install", "-g", `${PACKAGE_NAME}@latest`],
13
+ { timeout: 6e4 },
14
+ (err, stdout, stderr) => {
15
+ const output = (stdout ?? "") + (stderr ?? "");
16
+ resolve({ code: err ? 1 : 0, output });
17
+ }
18
+ );
19
+ child.stdout?.pipe(process.stdout);
20
+ child.stderr?.pipe(process.stderr);
21
+ });
22
+ }
23
+ function registerUpdateCommand(program) {
24
+ program.command("update").description("Check for updates and install the latest version").option("--check", "Only check, do not install").action(async (opts) => {
25
+ console.log();
26
+ console.log(` ${amber("orch update")} \xB7 checking for updates\u2026`);
27
+ console.log();
28
+ const currentVersion = program.version() ?? "0.0.0";
29
+ const info = await checkForUpdateNow(currentVersion);
30
+ if (!info) {
31
+ console.log(` ${chalk.ansi256(167)("\u2715")} Could not reach npm registry`);
32
+ console.log(` Check your network connection and try again.`);
33
+ console.log();
34
+ process.exit(1);
35
+ }
36
+ if (!info.updateAvailable) {
37
+ console.log(` ${chalk.ansi256(72)("\u2713")} Already up to date ${dim(`(${info.current})`)}`);
38
+ console.log();
39
+ return;
40
+ }
41
+ console.log(` ${chalk.ansi256(214)("\u25CF")} Update available: ${dim(info.current)} \u2192 ${chalk.ansi256(72)(info.latest)}`);
42
+ console.log();
43
+ if (opts.check) {
44
+ console.log(` Run ${dim("orch update")} to install.`);
45
+ console.log();
46
+ return;
47
+ }
48
+ console.log(` Installing ${PACKAGE_NAME}@${info.latest}\u2026`);
49
+ console.log();
50
+ const result = await runInstall();
51
+ if (result.code !== 0) {
52
+ console.log();
53
+ console.log(` ${chalk.ansi256(167)("\u2715")} Update failed. Try manually:`);
54
+ console.log(` npm install -g ${PACKAGE_NAME}@latest`);
55
+ console.log();
56
+ process.exit(1);
57
+ }
58
+ console.log();
59
+ console.log(` ${chalk.ansi256(72)("\u2713")} Updated to ${info.latest}`);
60
+ console.log();
61
+ });
62
+ }
63
+
64
+ export { registerUpdateCommand };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export { checkForUpdateNow, checkForUpdateSWR, printUpdateNotification } from './chunk-FRTKB575.js';
@@ -1,5 +1,5 @@
1
- import { sanitizeId, validateWorkspacePath, ensureDir } from './chunk-QEEM67OA.js';
2
- import { WorkspaceError } from './chunk-IQXRQBUK.js';
1
+ import { sanitizeId, validateWorkspacePath, ensureDir } from './chunk-UIJYU3J7.js';
2
+ import { WorkspaceError } from './chunk-NLQAJ7TW.js';
3
3
  import path from 'path';
4
4
  import fs from 'fs/promises';
5
5
 
@@ -212,5 +212,5 @@ function sanitizeTitle(title) {
212
212
  }
213
213
 
214
214
  export { WorkspaceManager };
215
- //# sourceMappingURL=workspace-manager-T6AXG7XL.js.map
216
- //# sourceMappingURL=workspace-manager-T6AXG7XL.js.map
215
+ //# sourceMappingURL=workspace-manager-EVD67GCG.js.map
216
+ //# sourceMappingURL=workspace-manager-EVD67GCG.js.map