@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.
Files changed (131) hide show
  1. package/dist/App-GJVTVGRU.js +6717 -0
  2. package/dist/agent-7ZJ3ZDJ7.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/chunk-4IFIOMCW.js +86 -0
  7. package/dist/chunk-7X2GI5OV.js +181 -0
  8. package/dist/{chunk-S3QYSBW4.js → chunk-C6XZ3FJT.js} +6 -3
  9. package/dist/chunk-C6XZ3FJT.js.map +1 -0
  10. package/dist/chunk-CHIP7O6V.js +83 -0
  11. package/dist/{chunk-BCPUTULS.js → chunk-DAVHOWGD.js} +188 -16
  12. package/dist/chunk-FRTKB575.js +87 -0
  13. package/dist/{chunk-BGHCY7WY.js → chunk-GBXUNDKN.js} +32 -13
  14. package/dist/chunk-GBXUNDKN.js.map +1 -0
  15. package/dist/chunk-HXYAZGLP.js +15 -0
  16. package/dist/chunk-I3SMISEF.js +29 -0
  17. package/dist/chunk-K6DMQERQ.js +89 -0
  18. package/dist/chunk-LV6GDBBI.js +297 -0
  19. package/dist/chunk-MGGSRXWJ.js +69 -0
  20. package/dist/chunk-P6ATSXGL.js +107 -0
  21. package/dist/chunk-PNE6LQRF.js +5 -0
  22. package/dist/chunk-U2VDNUZL.js +52 -0
  23. package/dist/chunk-VG4465AG.js +275 -0
  24. package/dist/chunk-VG4465AG.js.map +1 -0
  25. package/dist/{chunk-B4JQM4NU.js → chunk-VXS2CJFH.js} +119 -47
  26. package/dist/chunk-XJTJ2TJV.js +221 -0
  27. package/dist/{claude-INM52PTH.js → claude-WUJU5KIE.js} +6 -5
  28. package/dist/claude-WUJU5KIE.js.map +1 -0
  29. package/dist/claude-ZUEKJJ4X.js +5 -0
  30. package/dist/cli.js +199 -1
  31. package/dist/clipboard-service-RTDUUQQU.js +200 -0
  32. package/dist/codex-7IXXXG5U.js +123 -0
  33. package/dist/{codex-QGH2GRV6.js → codex-NYJWEPRQ.js} +4 -4
  34. package/dist/codex-NYJWEPRQ.js.map +1 -0
  35. package/dist/config-OTAVSMOD.js +75 -0
  36. package/dist/container-LUWGNBSS.js +1596 -0
  37. package/dist/context-OL4BVUV5.js +83 -0
  38. package/dist/{cursor-KQJTQ73D.js → cursor-3YHVD4NP.js} +4 -4
  39. package/dist/cursor-3YHVD4NP.js.map +1 -0
  40. package/dist/cursor-622RBRHH.js +97 -0
  41. package/dist/doctor-XSGQSD57.js +67 -0
  42. package/dist/doctor-service-TPOMFAIG.js +2 -0
  43. package/dist/goal-FMYYN2FR.js +138 -0
  44. package/dist/index.d.ts +16 -2
  45. package/dist/index.js +25 -16
  46. package/dist/index.js.map +1 -1
  47. package/dist/init-JU343RXK.js +165 -0
  48. package/dist/logs-PHPYWQ6I.js +207 -0
  49. package/dist/msg-FUWWLEKM.js +95 -0
  50. package/dist/opencode-FAMPSA6X.js +100 -0
  51. package/dist/opencode-FAMPSA6X.js.map +1 -0
  52. package/dist/opencode-WOR53TSC.js +98 -0
  53. package/dist/orchestrator-IYWBVA7J.js +5 -0
  54. package/dist/{orchestrator-KF4UY5GD.js.map → orchestrator-IYWBVA7J.js.map} +1 -1
  55. package/dist/orchestrator-QNAD7MFH.js +1433 -0
  56. package/dist/process-manager-HUVNAPQV.js +2 -0
  57. package/dist/registry-PQWRVNF2.js +2 -0
  58. package/dist/run-N72G5V2H.js +95 -0
  59. package/dist/shell-DVFHHYAZ.js +5 -0
  60. package/dist/{shell-UXJNTNBC.js → shell-NJNW3O6K.js} +6 -4
  61. package/dist/shell-NJNW3O6K.js.map +1 -0
  62. package/dist/shop-picker-2HY67UWP.js +79 -0
  63. package/dist/status-RZWN2C6C.js +56 -0
  64. package/dist/task-3O2OFSP6.js +221 -0
  65. package/dist/team-PFLP4PPL.js +97 -0
  66. package/dist/template-engine-5ZKVJMYA.js +3 -0
  67. package/dist/{template-engine-MFL5B677.js.map → template-engine-5ZKVJMYA.js.map} +1 -1
  68. package/dist/template-engine-AWIS56BL.js +3 -0
  69. package/dist/tui-LN5XHSQY.js +245 -0
  70. package/dist/update-YLP7FPNY.js +64 -0
  71. package/dist/update-check-4YKLGBFB.js +2 -0
  72. package/dist/workspace-manager-JM6U7JOH.js +215 -0
  73. package/package.json +2 -1
  74. package/readme.md +11 -4
  75. package/scripts/load-test.ts +478 -0
  76. package/scripts/postinstall.js +44 -2
  77. package/dist/App-NN7HR7UE.js +0 -20
  78. package/dist/agent-S4DKSX63.js +0 -9
  79. package/dist/agent-shop-D2RS4BZK.js +0 -2
  80. package/dist/chunk-3MQNQ7QW.js +0 -2
  81. package/dist/chunk-5AJ4LYO5.js +0 -8
  82. package/dist/chunk-6MJ7V6VY.js +0 -2
  83. package/dist/chunk-B4JQM4NU.js.map +0 -1
  84. package/dist/chunk-BGHCY7WY.js.map +0 -1
  85. package/dist/chunk-CDFA4IIQ.js +0 -2
  86. package/dist/chunk-CHRW4CLD.js +0 -2
  87. package/dist/chunk-HMMPM7MF.js +0 -3
  88. package/dist/chunk-HSBYJ5C5.js +0 -112
  89. package/dist/chunk-HXOMNULD.js +0 -2
  90. package/dist/chunk-IS3YBE2B.js +0 -3
  91. package/dist/chunk-KPCT44WU.js +0 -2
  92. package/dist/chunk-L26TK7Y5.js +0 -2
  93. package/dist/chunk-LXNRCJ22.js +0 -2
  94. package/dist/chunk-OQKREZUF.js +0 -11
  95. package/dist/chunk-PJ5DKXGR.js +0 -2
  96. package/dist/chunk-QFKVCNKL.js +0 -2
  97. package/dist/chunk-S3QYSBW4.js.map +0 -1
  98. package/dist/chunk-UMZEA3JT.js +0 -5
  99. package/dist/claude-GQZNDJ6L.js +0 -2
  100. package/dist/claude-INM52PTH.js.map +0 -1
  101. package/dist/clipboard-service-MYLSWM5E.js +0 -25
  102. package/dist/codex-QGH2GRV6.js.map +0 -1
  103. package/dist/codex-SJV7ZZBY.js +0 -2
  104. package/dist/config-CCSS2P7R.js +0 -2
  105. package/dist/container-NEKK5W2B.js +0 -6
  106. package/dist/context-GSMQHQES.js +0 -7
  107. package/dist/cursor-4JQOCP5X.js +0 -2
  108. package/dist/cursor-KQJTQ73D.js.map +0 -1
  109. package/dist/doctor-UAII4VWN.js +0 -2
  110. package/dist/doctor-service-PB7YBH3F.js +0 -2
  111. package/dist/goal-RFKFPR7M.js +0 -8
  112. package/dist/init-2D4RAN7B.js +0 -53
  113. package/dist/logs-UXFXVYCP.js +0 -12
  114. package/dist/msg-4SCLBO4K.js +0 -9
  115. package/dist/orchestrator-KF4UY5GD.js +0 -5
  116. package/dist/orchestrator-MFL3XK5L.js +0 -13
  117. package/dist/process-manager-33H27MQF.js +0 -2
  118. package/dist/registry-BO2PPRNG.js +0 -2
  119. package/dist/run-HSHRELOP.js +0 -3
  120. package/dist/shell-F42UUF3U.js +0 -2
  121. package/dist/shell-UXJNTNBC.js.map +0 -1
  122. package/dist/shop-picker-LE3SKFOX.js +0 -5
  123. package/dist/status-DLBNWSWM.js +0 -2
  124. package/dist/task-AP2TIOOF.js +0 -20
  125. package/dist/team-MSIBKOQC.js +0 -4
  126. package/dist/template-engine-MFL5B677.js +0 -3
  127. package/dist/template-engine-ONIDVD4F.js +0 -2
  128. package/dist/tui-PIQT4ZZ2.js +0 -2
  129. package/dist/update-PC2ENCKU.js +0 -2
  130. package/dist/update-check-HGMBDYHL.js +0 -2
  131. package/dist/workspace-manager-DYN3XJ7X.js +0 -3
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'child_process';
3
+
4
+ var ProcessManager = class {
5
+ isAlive(pid) {
6
+ try {
7
+ process.kill(pid, 0);
8
+ return true;
9
+ } catch (err) {
10
+ if (err.code === "EPERM") return true;
11
+ return false;
12
+ }
13
+ }
14
+ kill(pid, signal = "SIGTERM") {
15
+ try {
16
+ process.kill(-pid, signal);
17
+ } catch {
18
+ try {
19
+ process.kill(pid, signal);
20
+ } catch {
21
+ }
22
+ }
23
+ }
24
+ async killWithGrace(pid, graceMs = 1e4) {
25
+ if (!this.isAlive(pid)) return;
26
+ this.kill(pid, "SIGTERM");
27
+ const deadline = Date.now() + graceMs;
28
+ while (Date.now() < deadline) {
29
+ if (!this.isAlive(pid)) return;
30
+ await new Promise((r) => setTimeout(r, 200));
31
+ }
32
+ this.kill(pid, "SIGKILL");
33
+ }
34
+ spawn(command, args, options) {
35
+ const proc = spawn(command, args, {
36
+ stdio: ["ignore", "pipe", "pipe"],
37
+ detached: true,
38
+ // Create new process group so killWithGrace(-pid) kills all children
39
+ ...options
40
+ });
41
+ if (!proc.pid) {
42
+ throw new Error(`Failed to spawn process: ${command}`);
43
+ }
44
+ proc.unref();
45
+ return { process: proc, pid: proc.pid };
46
+ }
47
+ };
48
+ var MAX_LINE_LEN = 16384;
49
+ function capLine(s) {
50
+ return s.length > MAX_LINE_LEN ? s.slice(0, MAX_LINE_LEN) : s;
51
+ }
52
+ async function* readLines(stream) {
53
+ const chunks = [];
54
+ let totalLen = 0;
55
+ for await (const chunk of stream) {
56
+ const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf-8");
57
+ if (buf.length === 0) continue;
58
+ chunks.push(buf);
59
+ totalLen += buf.length;
60
+ const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, totalLen);
61
+ chunks.length = 0;
62
+ totalLen = 0;
63
+ let offset = 0;
64
+ let newlineIdx;
65
+ while ((newlineIdx = buffer.indexOf(10, offset)) !== -1) {
66
+ if (newlineIdx > offset) {
67
+ yield capLine(buffer.toString("utf-8", offset, newlineIdx));
68
+ }
69
+ offset = newlineIdx + 1;
70
+ }
71
+ if (offset < buffer.length) {
72
+ const remainder = buffer.subarray(offset);
73
+ chunks.push(remainder);
74
+ totalLen = remainder.length;
75
+ }
76
+ }
77
+ if (totalLen > 0) {
78
+ const final = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, totalLen);
79
+ yield capLine(final.toString("utf-8"));
80
+ }
81
+ }
82
+
83
+ export { ProcessManager, readLines };
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- var n=`Backend engineer \u2014 builds APIs, services, database layers, and server-side business logic.
2
+ // src/domain/agent-shop.ts
3
+ var BACKEND_DEV_ROLE = `Backend engineer \u2014 builds APIs, services, database layers, and server-side business logic.
3
4
 
4
5
  ## WORKFLOW
5
6
 
@@ -18,7 +19,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
18
19
  - Every public function must have at least one test.
19
20
  - Never store secrets or credentials in code \u2014 use environment variables.
20
21
  - Keep functions under 40 lines; extract helpers when complexity grows.
21
- - If the task is ambiguous, set context with your questions before coding.`,a=`Frontend engineer \u2014 builds React UI components, pages, styles, and client-side interactions.
22
+ - If the task is ambiguous, set context with your questions before coding.`;
23
+ var FRONTEND_DEV_ROLE = `Frontend engineer \u2014 builds React UI components, pages, styles, and client-side interactions.
22
24
 
23
25
  ## WORKFLOW
24
26
 
@@ -37,7 +39,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
37
39
  - Use semantic HTML elements (nav, main, section, button) \u2014 not div soup.
38
40
  - Keep components under 150 lines; extract sub-components when they grow.
39
41
  - Never hardcode colors or spacing \u2014 use design tokens / theme variables.
40
- - Ensure keyboard navigation and ARIA labels for interactive elements.`,i=`QA engineer \u2014 writes tests, analyzes coverage, and ensures code quality across the project.
42
+ - Ensure keyboard navigation and ARIA labels for interactive elements.`;
43
+ var QA_ENGINEER_ROLE = `QA engineer \u2014 writes tests, analyzes coverage, and ensures code quality across the project.
41
44
 
42
45
  ## WORKFLOW
43
46
 
@@ -55,7 +58,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
55
58
  - Never test implementation details \u2014 test behavior and contracts.
56
59
  - Mock external dependencies at the boundary, not deep inside the code.
57
60
  - Coverage targets: aim for >80% line coverage on new code, >90% on critical paths.
58
- - Flag any untestable code as a design smell and suggest refactoring.`,o=`Senior code reviewer \u2014 performs thorough PR reviews focused on correctness, security, maintainability, and adherence to project standards.
61
+ - Flag any untestable code as a design smell and suggest refactoring.`;
62
+ var CODE_REVIEWER_ROLE = `Senior code reviewer \u2014 performs thorough PR reviews focused on correctness, security, maintainability, and adherence to project standards.
59
63
 
60
64
  ## WORKFLOW
61
65
 
@@ -77,7 +81,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
77
81
  - Never approve code with known security issues, even if the task is urgent.
78
82
  - Be respectful \u2014 critique code, not the author.
79
83
  - If the change is too large to review safely, request it be split.
80
- - Check that tests exist for new logic; flag untested paths.`,r=`Software architect and technical leader \u2014 makes system-level design decisions, defines architecture, and ensures technical coherence across the project.
84
+ - Check that tests exist for new logic; flag untested paths.`;
85
+ var ARCHITECT_ROLE = `Software architect and technical leader \u2014 makes system-level design decisions, defines architecture, and ensures technical coherence across the project.
81
86
 
82
87
  ## WORKFLOW
83
88
 
@@ -96,7 +101,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
96
101
  - Enforce layer boundaries \u2014 domain must not depend on infrastructure.
97
102
  - Never introduce a new technology without evaluating operational cost.
98
103
  - Think in interfaces first, implementations second.
99
- - Flag technical debt explicitly; don't let it accumulate silently.`,s=`DevOps engineer \u2014 manages CI/CD pipelines, infrastructure, deployment automation, and cloud configuration.
104
+ - Flag technical debt explicitly; don't let it accumulate silently.`;
105
+ var DEVOPS_ENGINEER_ROLE = `DevOps engineer \u2014 manages CI/CD pipelines, infrastructure, deployment automation, and cloud configuration.
100
106
 
101
107
  ## WORKFLOW
102
108
 
@@ -115,7 +121,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
115
121
  - Always include health checks and rollback triggers in deployments.
116
122
  - Tag all cloud resources with project, environment, and owner.
117
123
  - Prefer declarative config over imperative scripts.
118
- - Monitor cost implications of infrastructure changes.`,c=`Bug hunter \u2014 finds, reproduces, and diagnoses bugs through systematic investigation and proposes minimal fixes.
124
+ - Monitor cost implications of infrastructure changes.`;
125
+ var BUG_HUNTER_ROLE = `Bug hunter \u2014 finds, reproduces, and diagnoses bugs through systematic investigation and proposes minimal fixes.
119
126
 
120
127
  ## WORKFLOW
121
128
 
@@ -134,7 +141,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
134
141
  - Keep fixes minimal and focused \u2014 one bug per task, no scope creep.
135
142
  - Check for the same bug pattern elsewhere in the codebase.
136
143
  - Never suppress errors to hide bugs \u2014 surface them properly.
137
- - If the bug is in a dependency, document the workaround and file upstream.`,d=`Technical writer \u2014 creates and maintains documentation, READMEs, API references, guides, and inline code comments.
144
+ - If the bug is in a dependency, document the workaround and file upstream.`;
145
+ var TECH_WRITER_ROLE = `Technical writer \u2014 creates and maintains documentation, READMEs, API references, guides, and inline code comments.
138
146
 
139
147
  ## WORKFLOW
140
148
 
@@ -155,7 +163,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
155
163
  - Use active voice and second person ("you can configure\u2026" not "it can be configured\u2026").
156
164
  - Keep sentences under 25 words; paragraphs under 5 sentences.
157
165
  - Code examples must be complete and runnable \u2014 no pseudo-code in docs.
158
- - Never document internal implementation details in user-facing docs.`,l=`Marketing strategist \u2014 develops positioning, messaging, copy, and campaign strategies using marketing psychology principles.
166
+ - Never document internal implementation details in user-facing docs.`;
167
+ var MARKETER_ROLE = `Marketing strategist \u2014 develops positioning, messaging, copy, and campaign strategies using marketing psychology principles.
159
168
 
160
169
  ## WORKFLOW
161
170
 
@@ -176,7 +185,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
176
185
  - Include measurable KPIs for every campaign recommendation.
177
186
  - Respect brand voice and tone guidelines if they exist.
178
187
  - A/B test assumptions \u2014 never assume you know what converts.
179
- - Keep copy scannable: short paragraphs, bullet points, clear hierarchy.`,p=`Content creator \u2014 writes blog posts, articles, social media content, and educational materials that drive engagement and authority.
188
+ - Keep copy scannable: short paragraphs, bullet points, clear hierarchy.`;
189
+ var CONTENT_CREATOR_ROLE = `Content creator \u2014 writes blog posts, articles, social media content, and educational materials that drive engagement and authority.
180
190
 
181
191
  ## WORKFLOW
182
192
 
@@ -197,7 +207,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
197
207
  - Paragraphs max 3-4 sentences for readability.
198
208
  - Include at least one concrete example or data point per section.
199
209
  - Never plagiarize \u2014 all content must be original.
200
- - Optimize for the target platform (blog post \u2260 tweet \u2260 LinkedIn post).`,u=`Growth hacker \u2014 designs and implements data-driven growth experiments to improve acquisition, activation, retention, and revenue.
210
+ - Optimize for the target platform (blog post \u2260 tweet \u2260 LinkedIn post).`;
211
+ var GROWTH_HACKER_ROLE = `Growth hacker \u2014 designs and implements data-driven growth experiments to improve acquisition, activation, retention, and revenue.
201
212
 
202
213
  ## WORKFLOW
203
214
 
@@ -215,7 +226,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
215
226
  - Run one experiment per funnel stage at a time to avoid confounding.
216
227
  - Prioritize experiments by ICE score (Impact \xD7 Confidence \xD7 Ease).
217
228
  - Never ship a "growth hack" that degrades user experience long-term.
218
- - Document results of every experiment, including failures \u2014 they are data.`,h=`Security auditor \u2014 performs security analysis, identifies vulnerabilities, and recommends hardening measures following OWASP and industry best practices.
229
+ - Document results of every experiment, including failures \u2014 they are data.`;
230
+ var SECURITY_AUDITOR_ROLE = `Security auditor \u2014 performs security analysis, identifies vulnerabilities, and recommends hardening measures following OWASP and industry best practices.
219
231
 
220
232
  ## WORKFLOW
221
233
 
@@ -238,7 +250,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
238
250
  - Classify severity honestly \u2014 don't inflate or downplay.
239
251
  - Check both application code AND configuration (CORS, headers, TLS, CSP).
240
252
  - Recommend defense-in-depth \u2014 never rely on a single security control.
241
- - Flag any plaintext secrets immediately as Critical, even in test code.`,m=`Performance engineer \u2014 profiles, benchmarks, and optimizes code for speed, memory efficiency, and scalability.
253
+ - Flag any plaintext secrets immediately as Critical, even in test code.`;
254
+ var PERFORMANCE_ENGINEER_ROLE = `Performance engineer \u2014 profiles, benchmarks, and optimizes code for speed, memory efficiency, and scalability.
242
255
 
243
256
  ## WORKFLOW
244
257
 
@@ -260,7 +273,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
260
273
  - Prefer algorithmic improvements over micro-optimizations.
261
274
  - Never sacrifice readability for marginal performance gains.
262
275
  - Profile in realistic conditions \u2014 not with trivial test data.
263
- - Watch for regressions \u2014 optimization in one area can degrade another.`,g=`Data engineer \u2014 builds data pipelines, ETL processes, analytics queries, and data infrastructure.
276
+ - Watch for regressions \u2014 optimization in one area can degrade another.`;
277
+ var DATA_ENGINEER_ROLE = `Data engineer \u2014 builds data pipelines, ETL processes, analytics queries, and data infrastructure.
264
278
 
265
279
  ## WORKFLOW
266
280
 
@@ -281,7 +295,8 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
281
295
  - Always validate data at ingestion boundaries \u2014 never trust upstream data.
282
296
  - Handle NULLs, duplicates, and encoding issues explicitly.
283
297
  - Log pipeline metrics: rows processed, duration, error count.
284
- - Never run DELETE or UPDATE without a WHERE clause and a backup plan.`,f=`Full-stack developer \u2014 works across the entire stack, from database and API to UI components and styling.
298
+ - Never run DELETE or UPDATE without a WHERE clause and a backup plan.`;
299
+ var FULLSTACK_DEV_ROLE = `Full-stack developer \u2014 works across the entire stack, from database and API to UI components and styling.
285
300
 
286
301
  ## WORKFLOW
287
302
 
@@ -305,4 +320,161 @@ var n=`Backend engineer \u2014 builds APIs, services, database layers, and serve
305
320
  - Keep frontend and backend changes in the same branch for atomic features.
306
321
  - Follow each layer's conventions independently \u2014 backend patterns for backend, frontend patterns for frontend.
307
322
  - Handle every error state in the UI \u2014 users should never see a blank screen.
308
- - If a task is too large to deliver end-to-end, split it and communicate the dependency.`,y=[{key:"backend-dev",name:"Backend Developer",description:"APIs, databases, backend services",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer"],role:n},{key:"frontend-dev",name:"Frontend Developer",description:"React, UI components, CSS, responsive design",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer","frontend-design"],role:a},{key:"qa-engineer",name:"QA Engineer",description:"Test writing, coverage analysis, quality assurance",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["testing-suite:generate-tests","testing-suite:test-coverage","testing-suite:test-quality-analyzer"],role:i},{key:"code-reviewer",name:"Code Reviewer",description:"PR review, bug finding, code quality, security",adapter:"claude",model:"claude-opus-4-6",approval_policy:"suggest",skills:["feature-dev:code-reviewer","feature-dev:code-explorer"],role:o},{key:"architect",name:"Architect",description:"System design, architecture decisions, tech leadership",adapter:"claude",model:"claude-opus-4-6",approval_policy:"suggest",skills:["feature-dev:code-architect","feature-dev:code-explorer"],role:r},{key:"devops-engineer",name:"DevOps Engineer",description:"CI/CD, infrastructure, deployment, cloud",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["devops-automation:cloud-architect","feature-dev:code-explorer"],role:s},{key:"bug-hunter",name:"Bug Hunter",description:"Find bugs, reproduce issues, propose fixes",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer"],role:c},{key:"tech-writer",name:"Technical Writer",description:"Documentation, READMEs, API docs, guides",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:code-explorer","docx"],role:d},{key:"marketer",name:"Marketer",description:"Marketing strategy, positioning, copy, campaigns",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["marketing-psychology","product-manager-toolkit"],role:l},{key:"content-creator",name:"Content Creator",description:"Blog posts, articles, social media content",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["marketing-psychology"],role:p},{key:"growth-hacker",name:"Growth Hacker",description:"Growth experiments, analytics, user acquisition",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["product-manager-toolkit","feature-dev:feature-dev"],role:u},{key:"security-auditor",name:"Security Auditor",description:"Security scanning, vulnerability analysis, OWASP",adapter:"claude",model:"claude-opus-4-6",approval_policy:"suggest",skills:["feature-dev:code-reviewer","feature-dev:code-explorer"],role:h},{key:"performance-engineer",name:"Performance Engineer",description:"Optimization, profiling, benchmarks, load testing",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer"],role:m},{key:"data-engineer",name:"Data Engineer",description:"Data pipelines, ETL, analytics, SQL",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer"],role:g},{key:"fullstack-dev",name:"Full-Stack Developer",description:"End-to-end development, frontend and backend",adapter:"claude",model:"claude-sonnet-4-6",approval_policy:"auto",skills:["feature-dev:feature-dev","feature-dev:code-explorer","frontend-design"],role:f}];function v(e){return y.find(t=>t.key===e)}export{y as a,v as b};
323
+ - If a task is too large to deliver end-to-end, split it and communicate the dependency.`;
324
+ var AGENT_SHOP_TEMPLATES = [
325
+ {
326
+ key: "backend-dev",
327
+ name: "Backend Developer",
328
+ description: "APIs, databases, backend services",
329
+ adapter: "claude",
330
+ model: "claude-sonnet-4-6",
331
+ approval_policy: "auto",
332
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer"],
333
+ role: BACKEND_DEV_ROLE
334
+ },
335
+ {
336
+ key: "frontend-dev",
337
+ name: "Frontend Developer",
338
+ description: "React, UI components, CSS, responsive design",
339
+ adapter: "claude",
340
+ model: "claude-sonnet-4-6",
341
+ approval_policy: "auto",
342
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer", "frontend-design"],
343
+ role: FRONTEND_DEV_ROLE
344
+ },
345
+ {
346
+ key: "qa-engineer",
347
+ name: "QA Engineer",
348
+ description: "Test writing, coverage analysis, quality assurance",
349
+ adapter: "claude",
350
+ model: "claude-sonnet-4-6",
351
+ approval_policy: "auto",
352
+ skills: ["testing-suite:generate-tests", "testing-suite:test-coverage", "testing-suite:test-quality-analyzer"],
353
+ role: QA_ENGINEER_ROLE
354
+ },
355
+ {
356
+ key: "code-reviewer",
357
+ name: "Code Reviewer",
358
+ description: "PR review, bug finding, code quality, security",
359
+ adapter: "claude",
360
+ model: "claude-opus-4-6",
361
+ approval_policy: "suggest",
362
+ skills: ["feature-dev:code-reviewer", "feature-dev:code-explorer"],
363
+ role: CODE_REVIEWER_ROLE
364
+ },
365
+ {
366
+ key: "architect",
367
+ name: "Architect",
368
+ description: "System design, architecture decisions, tech leadership",
369
+ adapter: "claude",
370
+ model: "claude-opus-4-6",
371
+ approval_policy: "suggest",
372
+ skills: ["feature-dev:code-architect", "feature-dev:code-explorer"],
373
+ role: ARCHITECT_ROLE
374
+ },
375
+ {
376
+ key: "devops-engineer",
377
+ name: "DevOps Engineer",
378
+ description: "CI/CD, infrastructure, deployment, cloud",
379
+ adapter: "claude",
380
+ model: "claude-sonnet-4-6",
381
+ approval_policy: "auto",
382
+ skills: ["devops-automation:cloud-architect", "feature-dev:code-explorer"],
383
+ role: DEVOPS_ENGINEER_ROLE
384
+ },
385
+ {
386
+ key: "bug-hunter",
387
+ name: "Bug Hunter",
388
+ description: "Find bugs, reproduce issues, propose fixes",
389
+ adapter: "claude",
390
+ model: "claude-sonnet-4-6",
391
+ approval_policy: "auto",
392
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer"],
393
+ role: BUG_HUNTER_ROLE
394
+ },
395
+ {
396
+ key: "tech-writer",
397
+ name: "Technical Writer",
398
+ description: "Documentation, READMEs, API docs, guides",
399
+ adapter: "claude",
400
+ model: "claude-sonnet-4-6",
401
+ approval_policy: "auto",
402
+ skills: ["feature-dev:code-explorer", "docx"],
403
+ role: TECH_WRITER_ROLE
404
+ },
405
+ {
406
+ key: "marketer",
407
+ name: "Marketer",
408
+ description: "Marketing strategy, positioning, copy, campaigns",
409
+ adapter: "claude",
410
+ model: "claude-sonnet-4-6",
411
+ approval_policy: "auto",
412
+ skills: ["marketing-psychology", "product-manager-toolkit"],
413
+ role: MARKETER_ROLE
414
+ },
415
+ {
416
+ key: "content-creator",
417
+ name: "Content Creator",
418
+ description: "Blog posts, articles, social media content",
419
+ adapter: "claude",
420
+ model: "claude-sonnet-4-6",
421
+ approval_policy: "auto",
422
+ skills: ["marketing-psychology"],
423
+ role: CONTENT_CREATOR_ROLE
424
+ },
425
+ {
426
+ key: "growth-hacker",
427
+ name: "Growth Hacker",
428
+ description: "Growth experiments, analytics, user acquisition",
429
+ adapter: "claude",
430
+ model: "claude-sonnet-4-6",
431
+ approval_policy: "auto",
432
+ skills: ["product-manager-toolkit", "feature-dev:feature-dev"],
433
+ role: GROWTH_HACKER_ROLE
434
+ },
435
+ {
436
+ key: "security-auditor",
437
+ name: "Security Auditor",
438
+ description: "Security scanning, vulnerability analysis, OWASP",
439
+ adapter: "claude",
440
+ model: "claude-opus-4-6",
441
+ approval_policy: "suggest",
442
+ skills: ["feature-dev:code-reviewer", "feature-dev:code-explorer"],
443
+ role: SECURITY_AUDITOR_ROLE
444
+ },
445
+ {
446
+ key: "performance-engineer",
447
+ name: "Performance Engineer",
448
+ description: "Optimization, profiling, benchmarks, load testing",
449
+ adapter: "claude",
450
+ model: "claude-sonnet-4-6",
451
+ approval_policy: "auto",
452
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer"],
453
+ role: PERFORMANCE_ENGINEER_ROLE
454
+ },
455
+ {
456
+ key: "data-engineer",
457
+ name: "Data Engineer",
458
+ description: "Data pipelines, ETL, analytics, SQL",
459
+ adapter: "claude",
460
+ model: "claude-sonnet-4-6",
461
+ approval_policy: "auto",
462
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer"],
463
+ role: DATA_ENGINEER_ROLE
464
+ },
465
+ {
466
+ key: "fullstack-dev",
467
+ name: "Full-Stack Developer",
468
+ description: "End-to-end development, frontend and backend",
469
+ adapter: "claude",
470
+ model: "claude-sonnet-4-6",
471
+ approval_policy: "auto",
472
+ skills: ["feature-dev:feature-dev", "feature-dev:code-explorer", "frontend-design"],
473
+ role: FULLSTACK_DEV_ROLE
474
+ }
475
+ ];
476
+ function getShopTemplateByKey(key) {
477
+ return AGENT_SHOP_TEMPLATES.find((t) => t.key === key);
478
+ }
479
+
480
+ export { AGENT_SHOP_TEMPLATES, getShopTemplateByKey };
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
+ import os from 'os';
5
+ import { execFile } from 'child_process';
6
+
7
+ var PACKAGE_NAME = "@oxgeneral/orch";
8
+ var CACHE_DIR = path.join(os.homedir(), ".orchestry");
9
+ var CACHE_FILE = path.join(CACHE_DIR, "update-check.json");
10
+ var CHECK_INTERVAL_MS = 4 * 60 * 60 * 1e3;
11
+ var REVALIDATE_AFTER_MS = CHECK_INTERVAL_MS * 0.75;
12
+ function compareSemver(a, b) {
13
+ const pa = a.split(".").map(Number);
14
+ const pb = b.split(".").map(Number);
15
+ for (let i = 0; i < 3; i++) {
16
+ const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
17
+ if (diff !== 0) return diff > 0 ? 1 : -1;
18
+ }
19
+ return 0;
20
+ }
21
+ async function readCache() {
22
+ try {
23
+ const raw = await fs.readFile(CACHE_FILE, "utf-8");
24
+ const data = JSON.parse(raw);
25
+ if (Date.now() - data.checked_at < CHECK_INTERVAL_MS) return data;
26
+ } catch {
27
+ }
28
+ return null;
29
+ }
30
+ async function writeCache(latest) {
31
+ await fs.mkdir(CACHE_DIR, { recursive: true });
32
+ const data = { latest, checked_at: Date.now() };
33
+ const tmp = `${CACHE_FILE}.tmp.${process.pid}`;
34
+ await fs.writeFile(tmp, JSON.stringify(data), "utf-8");
35
+ await fs.rename(tmp, CACHE_FILE);
36
+ }
37
+ function fetchLatestVersion() {
38
+ return new Promise((resolve) => {
39
+ const child = execFile("npm", ["view", PACKAGE_NAME, "version", "--json"], { timeout: 5e3 }, (err, stdout) => {
40
+ if (err) return resolve(null);
41
+ try {
42
+ resolve(JSON.parse(stdout.trim()));
43
+ } catch {
44
+ resolve(null);
45
+ }
46
+ });
47
+ child.unref();
48
+ });
49
+ }
50
+ function buildUpdateInfo(current, latest) {
51
+ return { current, latest, updateAvailable: compareSemver(latest, current) > 0 };
52
+ }
53
+ async function checkForUpdateNow(currentVersion) {
54
+ const latest = await fetchLatestVersion();
55
+ if (!latest) return null;
56
+ await writeCache(latest).catch(() => {
57
+ });
58
+ return buildUpdateInfo(currentVersion, latest);
59
+ }
60
+ async function checkForUpdateSWR(currentVersion) {
61
+ try {
62
+ const cached = await readCache();
63
+ if (!cached) {
64
+ checkForUpdateNow(currentVersion).catch(() => {
65
+ });
66
+ return null;
67
+ }
68
+ const age = Date.now() - cached.checked_at;
69
+ if (age >= REVALIDATE_AFTER_MS) {
70
+ checkForUpdateNow(currentVersion).catch(() => {
71
+ });
72
+ }
73
+ return buildUpdateInfo(currentVersion, cached.latest);
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ function printUpdateNotification(info) {
79
+ if (!info.updateAvailable) return;
80
+ const msg = `
81
+ Update available: ${info.current} \u2192 ${info.latest}
82
+ Run: npm install -g ${PACKAGE_NAME}
83
+ `;
84
+ process.stderr.write(msg);
85
+ }
86
+
87
+ export { checkForUpdateNow, checkForUpdateSWR, printUpdateNotification };
@@ -1,5 +1,5 @@
1
- import { AUTONOMOUS_LABEL, DEFAULT_PROMPT_TEMPLATE, buildPromptContext } from './chunk-B4JQM4NU.js';
2
- import { LockConflictError, WorkspaceError, TaskAlreadyRunningError, NoAgentsError } from './chunk-NLQAJ7TW.js';
1
+ import { AUTONOMOUS_LABEL, DEFAULT_SYSTEM_TEMPLATE, DEFAULT_USER_TEMPLATE, buildPromptContext } from './chunk-VG4465AG.js';
2
+ import { LockConflictError, WorkspaceError, TaskAlreadyRunningError, NoAgentsError, classifyAdapterError } from './chunk-NLQAJ7TW.js';
3
3
  import { dirname } from 'path';
4
4
  import fs from 'fs/promises';
5
5
  import { execFile } from 'child_process';
@@ -941,7 +941,9 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
941
941
  agent,
942
942
  this.deps.config
943
943
  );
944
- const template = this.deps.config.prompt?.template ?? DEFAULT_PROMPT_TEMPLATE;
944
+ const systemTemplate = this.deps.config.prompt?.system_template ?? DEFAULT_SYSTEM_TEMPLATE;
945
+ const userTemplate = this.deps.config.prompt?.user_template ?? DEFAULT_USER_TEMPLATE;
946
+ const legacyTemplate = this.deps.config.prompt?.template;
945
947
  const attempt = task.attempts + 1;
946
948
  let retryContext;
947
949
  if (attempt > 1) {
@@ -964,14 +966,13 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
964
966
  const allTasks = await this.cachedTaskStore.list();
965
967
  const goalTasks = allTasks.filter((t) => t.goalId === goalId);
966
968
  const progressEntry = await this.deps.contextStore?.get(`${goalId}-progress`);
967
- const MAX_GOAL_TASK_NAMES = 30;
968
969
  const taskNames = goalTasks.map((t) => `[${t.status}] ${t.title}`);
969
970
  goalContext = {
970
971
  id: goalRaw.id,
971
972
  title: goalRaw.title,
972
973
  description: goalRaw.description,
973
974
  status: goalRaw.status,
974
- task_names: taskNames.length > MAX_GOAL_TASK_NAMES ? [...taskNames.slice(0, MAX_GOAL_TASK_NAMES), `... and ${taskNames.length - MAX_GOAL_TASK_NAMES} more`] : taskNames,
975
+ task_names: taskNames,
975
976
  progress: progressEntry?.value
976
977
  };
977
978
  }
@@ -983,7 +984,14 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
983
984
  this.deps.config,
984
985
  { allAgents, retryContext, sharedContext, feedback: task.feedback, messages: pendingMessages.length ? pendingMessages : void 0, goal: goalContext }
985
986
  );
986
- const prompt = await this.deps.templateEngine.render(template, context);
987
+ let prompt;
988
+ let systemPrompt;
989
+ if (legacyTemplate) {
990
+ prompt = await this.deps.templateEngine.render(legacyTemplate, context);
991
+ } else {
992
+ systemPrompt = await this.deps.templateEngine.render(systemTemplate, context);
993
+ prompt = await this.deps.templateEngine.render(userTemplate, context);
994
+ }
987
995
  const run = await this.deps.runService.create({
988
996
  taskId: task.id,
989
997
  agentId: agent.id,
@@ -1007,12 +1015,14 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1007
1015
  await this.deps.agentService.setStatus(agent.id, "running");
1008
1016
  const agentData = await this.deps.agentService.get(agent.id);
1009
1017
  agentData.current_task = taskId;
1018
+ agentData.last_error = void 0;
1010
1019
  await this.deps.agentStore.save(agentData);
1011
1020
  const adapter = this.deps.adapterRegistry.require(agent.adapter);
1012
1021
  const abortController = new AbortController();
1013
1022
  this.abortControllers.set(taskId, abortController);
1014
1023
  const handle = adapter.execute({
1015
1024
  prompt,
1025
+ systemPrompt,
1016
1026
  workspace: workspacePath,
1017
1027
  env: {
1018
1028
  ...agent.config.env,
@@ -1062,6 +1072,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1062
1072
  let collectedTokens;
1063
1073
  let resultText;
1064
1074
  let lastAgentMessage;
1075
+ let lastErrorKind;
1065
1076
  const filesChangedSet = /* @__PURE__ */ new Set();
1066
1077
  try {
1067
1078
  for await (const event of generator) {
@@ -1120,11 +1131,13 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1120
1131
  path: typeof event.data === "string" ? event.data : String(event.data)
1121
1132
  });
1122
1133
  } else if (event.type === "error") {
1134
+ if (event.errorKind) lastErrorKind = event.errorKind;
1123
1135
  this.deps.eventBus.emit({
1124
1136
  type: "agent:error",
1125
1137
  runId,
1126
1138
  agentId,
1127
- error: busData
1139
+ error: busData,
1140
+ ...event.errorKind ? { errorKind: event.errorKind } : {}
1128
1141
  });
1129
1142
  }
1130
1143
  }
@@ -1132,9 +1145,10 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1132
1145
  await this.handleRunSuccess(taskId, runId, agentId, collectedTokens, finalResult, [...filesChangedSet]);
1133
1146
  } catch (err) {
1134
1147
  const error = err instanceof Error ? err.message : String(err);
1148
+ const errorKind = lastErrorKind ?? (err instanceof Error ? err.errorKind : void 0);
1135
1149
  const entry = this.state?.running[taskId];
1136
1150
  if (entry) {
1137
- await this.handleRunFailure(taskId, entry, error);
1151
+ await this.handleRunFailure(taskId, entry, error, errorKind);
1138
1152
  }
1139
1153
  }
1140
1154
  }
@@ -1259,10 +1273,10 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1259
1273
  await this.saveState();
1260
1274
  this.scheduleImmediateDispatch();
1261
1275
  }
1262
- async handleRunFailure(taskId, entry, error) {
1263
- return this.withStateLock(() => this._handleRunFailure(taskId, entry, error));
1276
+ async handleRunFailure(taskId, entry, error, errorKind) {
1277
+ return this.withStateLock(() => this._handleRunFailure(taskId, entry, error, errorKind));
1264
1278
  }
1265
- async _handleRunFailure(taskId, entry, error) {
1279
+ async _handleRunFailure(taskId, entry, error, errorKind) {
1266
1280
  await this.flushStateLazy();
1267
1281
  this.abortControllers.delete(taskId);
1268
1282
  const state = this.state;
@@ -1273,6 +1287,11 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1273
1287
  const agentAfterIdle = await this.deps.agentStore.get(entry.agent_id);
1274
1288
  if (agentAfterIdle) {
1275
1289
  agentAfterIdle.current_task = void 0;
1290
+ agentAfterIdle.last_error = {
1291
+ message: error.slice(0, 500),
1292
+ kind: errorKind ?? classifyAdapterError(error),
1293
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1294
+ };
1276
1295
  await this.deps.agentStore.save(agentAfterIdle);
1277
1296
  }
1278
1297
  const agent = await this.deps.agentStore.get(entry.agent_id);
@@ -1457,5 +1476,5 @@ function serializeEventData(data, maxLen) {
1457
1476
  }
1458
1477
 
1459
1478
  export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus };
1460
- //# sourceMappingURL=chunk-BGHCY7WY.js.map
1461
- //# sourceMappingURL=chunk-BGHCY7WY.js.map
1479
+ //# sourceMappingURL=chunk-GBXUNDKN.js.map
1480
+ //# sourceMappingURL=chunk-GBXUNDKN.js.map