codekin 0.6.4 → 0.7.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 (86) hide show
  1. package/README.md +8 -5
  2. package/bin/codekin.mjs +69 -6
  3. package/dist/assets/index-CLuQVRRb.css +1 -0
  4. package/dist/assets/index-JVnFWiSw.js +185 -0
  5. package/dist/index.html +2 -2
  6. package/package.json +6 -4
  7. package/server/dist/anthropic-models.d.ts +40 -0
  8. package/server/dist/anthropic-models.js +212 -0
  9. package/server/dist/anthropic-models.js.map +1 -0
  10. package/server/dist/claude-process.d.ts +32 -3
  11. package/server/dist/claude-process.js +129 -9
  12. package/server/dist/claude-process.js.map +1 -1
  13. package/server/dist/codex-process.d.ts +147 -0
  14. package/server/dist/codex-process.js +741 -0
  15. package/server/dist/codex-process.js.map +1 -0
  16. package/server/dist/coding-process.d.ts +16 -4
  17. package/server/dist/coding-process.js +10 -0
  18. package/server/dist/coding-process.js.map +1 -1
  19. package/server/dist/commit-event-handler.d.ts +14 -1
  20. package/server/dist/commit-event-handler.js +40 -8
  21. package/server/dist/commit-event-handler.js.map +1 -1
  22. package/server/dist/config.d.ts +25 -0
  23. package/server/dist/config.js +42 -0
  24. package/server/dist/config.js.map +1 -1
  25. package/server/dist/opencode-process.d.ts +142 -5
  26. package/server/dist/opencode-process.js +664 -84
  27. package/server/dist/opencode-process.js.map +1 -1
  28. package/server/dist/orchestrator-children.d.ts +94 -7
  29. package/server/dist/orchestrator-children.js +375 -65
  30. package/server/dist/orchestrator-children.js.map +1 -1
  31. package/server/dist/orchestrator-manager.d.ts +10 -0
  32. package/server/dist/orchestrator-manager.js +70 -18
  33. package/server/dist/orchestrator-manager.js.map +1 -1
  34. package/server/dist/orchestrator-monitor.d.ts +7 -1
  35. package/server/dist/orchestrator-monitor.js +62 -19
  36. package/server/dist/orchestrator-monitor.js.map +1 -1
  37. package/server/dist/orchestrator-notify.d.ts +42 -0
  38. package/server/dist/orchestrator-notify.js +42 -0
  39. package/server/dist/orchestrator-notify.js.map +1 -0
  40. package/server/dist/orchestrator-outbox.d.ts +48 -0
  41. package/server/dist/orchestrator-outbox.js +154 -0
  42. package/server/dist/orchestrator-outbox.js.map +1 -0
  43. package/server/dist/orchestrator-session-router.js +43 -1
  44. package/server/dist/orchestrator-session-router.js.map +1 -1
  45. package/server/dist/prompt-router.d.ts +22 -1
  46. package/server/dist/prompt-router.js +94 -11
  47. package/server/dist/prompt-router.js.map +1 -1
  48. package/server/dist/session-archive.js +11 -1
  49. package/server/dist/session-archive.js.map +1 -1
  50. package/server/dist/session-lifecycle.d.ts +1 -0
  51. package/server/dist/session-lifecycle.js +37 -0
  52. package/server/dist/session-lifecycle.js.map +1 -1
  53. package/server/dist/session-manager.d.ts +49 -2
  54. package/server/dist/session-manager.js +221 -33
  55. package/server/dist/session-manager.js.map +1 -1
  56. package/server/dist/session-naming.d.ts +4 -0
  57. package/server/dist/session-naming.js +26 -5
  58. package/server/dist/session-naming.js.map +1 -1
  59. package/server/dist/session-routes.js +42 -2
  60. package/server/dist/session-routes.js.map +1 -1
  61. package/server/dist/stepflow-handler.js +2 -2
  62. package/server/dist/stepflow-handler.js.map +1 -1
  63. package/server/dist/tsconfig.tsbuildinfo +1 -1
  64. package/server/dist/types.d.ts +24 -3
  65. package/server/dist/types.js +1 -9
  66. package/server/dist/types.js.map +1 -1
  67. package/server/dist/upload-routes.d.ts +7 -0
  68. package/server/dist/upload-routes.js +85 -28
  69. package/server/dist/upload-routes.js.map +1 -1
  70. package/server/dist/webhook-handler.js +3 -3
  71. package/server/dist/webhook-handler.js.map +1 -1
  72. package/server/dist/workflow-config.d.ts +2 -2
  73. package/server/dist/workflow-engine.d.ts +20 -0
  74. package/server/dist/workflow-engine.js +52 -15
  75. package/server/dist/workflow-engine.js.map +1 -1
  76. package/server/dist/workflow-loader.d.ts +5 -5
  77. package/server/dist/workflow-loader.js +169 -54
  78. package/server/dist/workflow-loader.js.map +1 -1
  79. package/server/dist/workflow-routes.js +36 -2
  80. package/server/dist/workflow-routes.js.map +1 -1
  81. package/server/dist/ws-message-handler.js +24 -9
  82. package/server/dist/ws-message-handler.js.map +1 -1
  83. package/server/dist/ws-server.js +53 -11
  84. package/server/dist/ws-server.js.map +1 -1
  85. package/dist/assets/index-BRB_Ksyk.js +0 -182
  86. package/dist/assets/index-Q2WSVlHo.css +0 -1
@@ -7,8 +7,18 @@
7
7
  */
8
8
  import type { SessionManager } from './session-manager.js';
9
9
  export declare const ORCHESTRATOR_DIR: string;
10
+ /**
11
+ * Bump this whenever CLAUDE_MD_TEMPLATE changes. Already-seeded CLAUDE.md
12
+ * files carrying an older (or no) version stamp are refreshed on boot —
13
+ * without this, installs keep running on stale orchestrator instructions
14
+ * forever. CLAUDE.md is system-managed; user memory lives in PROFILE.md,
15
+ * REPOS.md and journal/, which are never overwritten.
16
+ */
17
+ export declare const CLAUDE_MD_TEMPLATE_VERSION = 2;
10
18
  /** Ensure the orchestrator workspace directory exists with starter files. */
11
19
  export declare function ensureOrchestratorDir(): void;
20
+ /** Parse the template version stamp from a seeded CLAUDE.md; 0 when absent. */
21
+ export declare function readTemplateVersion(path: string): number;
12
22
  /** Get or create a stable session UUID that persists across restarts. */
13
23
  export declare function getOrCreateOrchestratorId(): string;
14
24
  /** Check if a session is the orchestrator session. */
@@ -29,7 +29,16 @@ Agent ${AGENT_DISPLAY_NAME} tracks repositories you work with in Codekin.
29
29
  ## Active Repos
30
30
  (none yet — ${AGENT_DISPLAY_NAME} will populate this as you work)
31
31
  `;
32
- const CLAUDE_MD_TEMPLATE = `# Agent ${AGENT_DISPLAY_NAME} — Codekin Orchestrator
32
+ /**
33
+ * Bump this whenever CLAUDE_MD_TEMPLATE changes. Already-seeded CLAUDE.md
34
+ * files carrying an older (or no) version stamp are refreshed on boot —
35
+ * without this, installs keep running on stale orchestrator instructions
36
+ * forever. CLAUDE.md is system-managed; user memory lives in PROFILE.md,
37
+ * REPOS.md and journal/, which are never overwritten.
38
+ */
39
+ export const CLAUDE_MD_TEMPLATE_VERSION = 2;
40
+ const CLAUDE_MD_TEMPLATE = `<!-- codekin-template-version: ${CLAUDE_MD_TEMPLATE_VERSION} -->
41
+ # Agent ${AGENT_DISPLAY_NAME} — Codekin Orchestrator
33
42
 
34
43
  You are ${AGENT_DISPLAY_NAME}, a calm and friendly ops manager inside Codekin.
35
44
  You help users keep their repositories healthy, their workflows running
@@ -129,6 +138,13 @@ Fields:
129
138
  - **useWorktree**: true (default) — runs in an isolated git worktree
130
139
  - **model**: Optional model override (e.g. "claude-sonnet-4-6")
131
140
  - **allowedTools**: Optional array of tool patterns to override defaults (advanced)
141
+ - **timeoutMs**: Optional working-time budget in ms (default 1800000 = 30 min,
142
+ range 1 min – 4 h). Time spent blocked on an approval does not count.
143
+ Raise this for large tasks (big refactors, full test suites).
144
+
145
+ The spawn response includes a \`worktree\` field ("active", "failed", or
146
+ "none") and \`worktreePath\`. If worktree is "failed", the child works
147
+ directly in the main repo directory — watch it more closely.
132
148
 
133
149
  ### What Child Sessions Can Do Automatically
134
150
  Child sessions have a broad set of pre-approved tools for standard dev work:
@@ -136,6 +152,9 @@ Child sessions have a broad set of pre-approved tools for standard dev work:
136
152
  - **Git & GitHub**: git (all subcommands), gh (PRs, issues, runs)
137
153
  - **Package managers**: npm, npx, yarn, pnpm, bun
138
154
  - **Build tools**: node, tsc, eslint, prettier, cargo, go, make, pip
155
+ - **Python**: python3, pytest
156
+ - **Text/data**: sed, rg, jq
157
+ - **File management** (non-destructive): mkdir, cp, mv, touch
139
158
  - **Filesystem** (read-only): ls, cat, head, tail, sort, diff, tree, wc, which, file
140
159
 
141
160
  They do NOT have access to destructive commands (rm, sudo, docker,
@@ -158,6 +177,12 @@ curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/children" \\
158
177
  # Get specific child session
159
178
  curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/children/SESSION_ID" \\
160
179
  -H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
180
+
181
+ # Read the tail of a child's transcript (what Claude actually output).
182
+ # Useful when a child stops with "Completion not verified" or gets stuck.
183
+ # ?limit caps the returned characters (default 5000, max 50000).
184
+ curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/children/SESSION_ID/transcript?limit=10000" \\
185
+ -H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
161
186
  \`\`\`
162
187
 
163
188
  ## Scheduling Reminders & Recurring Tasks
@@ -171,16 +196,26 @@ You have access to CronCreate, CronDelete, and CronList tools for in-session sch
171
196
  Examples:
172
197
  - Every morning at 9am: \`cron: "3 9 * * *"\`, \`prompt: "Check for new reports"\`
173
198
  - One-shot reminder: \`cron: "0 14 22 3 *"\`, \`prompt: "Follow up on deploy"\`, \`recurring: false\`
174
- - Every 30 minutes: \`cron: "*/30 * * * *"\`, \`prompt: "Check child session status"\`
199
+
200
+ You do NOT need a recurring cron to watch child sessions — the server
201
+ pushes you a notification the moment a child blocks on an approval,
202
+ finishes, fails, or times out. Use crons for reminders and scheduled
203
+ work, not for polling.
175
204
 
176
205
  Important: The \`cron\` parameter must be a plain string like \`"0 9 * * *"\`, NOT an object.
177
206
  Jobs only live in this session — they are lost when the session restarts. Recurring jobs auto-expire after 7 days.
178
207
 
179
208
  ## Monitoring Sessions
180
- After spawning a session:
181
- - Keep an eye on its progress
182
- - If the session completes but didn't do the final step (create PR, push,
183
- deploy), send it a follow-up instruction to finish
209
+ You receive push notifications about your child sessions automatically:
210
+ - **Blocked**: the child is waiting on a tool approval or question — the
211
+ notification includes the requestId and the exact curl to respond
212
+ - **Stopped**: the child completed, failed, or timed out
213
+
214
+ The server also verifies completion against ground truth (does the PR /
215
+ pushed branch actually exist?) and nudges the child once if the final
216
+ step is missing. When a "Stopped" notification carries a
217
+ "Completion not verified" note, the final step still didn't land —
218
+ inspect the worktree and finish it or respawn.
184
219
  - If the session gets stuck or fails, inform the user and suggest next steps
185
220
  - When done, summarize what was accomplished
186
221
 
@@ -188,31 +223,31 @@ After spawning a session:
188
223
  Sessions can get stuck waiting for tool approvals or user answers. You can
189
224
  discover and unblock them:
190
225
 
191
- \\\`\\\`\\\`bash
226
+ \`\`\`bash
192
227
  # List all sessions with pending prompts
193
228
  curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/sessions/pending-prompts" \\
194
229
  -H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
195
- \\\`\\\`\\\`
230
+ \`\`\`
196
231
 
197
- Returns sessions with their pending prompts, including the \\\`requestId\\\`,
198
- \\\`toolName\\\`, and \\\`promptType\\\` ("permission" or "question").
232
+ Returns sessions with their pending prompts, including the \`requestId\`,
233
+ \`toolName\`, and \`promptType\` ("permission" or "question").
199
234
 
200
235
  ### Giving Approvals to Stuck Sessions
201
236
  If a child session is blocked on a tool approval and you're confident it's
202
237
  safe, you can approve it directly:
203
238
 
204
- \\\`\\\`\\\`bash
239
+ \`\`\`bash
205
240
  curl -s -X POST "http://localhost:$CODEKIN_PORT/api/orchestrator/sessions/SESSION_ID/respond" \\
206
241
  -H "Authorization: Bearer $CODEKIN_AUTH_TOKEN" \\
207
242
  -H "Content-Type: application/json" \\
208
243
  -d '{"requestId": "REQUEST_ID", "value": "allow"}'
209
- \\\`\\\`\\\`
244
+ \`\`\`
210
245
 
211
- Values: \\\`"allow"\\\`, \\\`"deny"\\\`, \\\`"always_allow"\\\`, or free text for question prompts.
246
+ Values: \`"allow"\`, \`"deny"\`, \`"always_allow"\`, or free text for question prompts.
212
247
 
213
248
  **Guidelines for giving approvals:**
214
249
  - Only approve tools you understand — if unsure, ask the user
215
- - Prefer \\\`"allow"\\\` over \\\`"always_allow"\\\` for child sessions
250
+ - Prefer \`"allow"\` over \`"always_allow"\` for child sessions
216
251
  - Never approve destructive commands (rm -rf, git push --force, DROP TABLE)
217
252
  without user confirmation
218
253
  - For question prompts, provide a reasonable answer or ask the user
@@ -273,9 +308,9 @@ Users can manage trust directly in chat:
273
308
  4. Read skill-profile.json for guidance style adaptation
274
309
  5. Check for new audit reports that may have landed
275
310
  6. Check for decisions pending outcome assessment
276
- 7. **Re-establish cron jobs** — cron jobs do not survive session restarts, so always re-create your standard recurring checks on startup:
311
+ 7. **Re-establish cron jobs** — cron jobs do not survive session restarts, so re-create your scheduled work on startup:
277
312
  - Report check: \`cron: "3 9 * * *"\`, \`prompt: "Check for new audit reports across all managed repos and triage any new findings"\`
278
- - Child session monitor: \`cron: "*/30 * * * *"\`, \`prompt: "Check child session status and unblock any stuck sessions"\`
313
+ - Do NOT create a child-session polling cron the server pushes blocked/terminal notifications to you in realtime.
279
314
  8. Greet the user with a brief, friendly status update
280
315
 
281
316
  ### Greeting Guidelines
@@ -294,16 +329,33 @@ export function ensureOrchestratorDir() {
294
329
  const journalDir = join(ORCHESTRATOR_DIR, 'journal');
295
330
  if (!existsSync(journalDir))
296
331
  mkdirSync(journalDir, { recursive: true });
297
- // Seed files only if they don't exist (preserve user edits)
332
+ // Seed memory files only if they don't exist (preserve user edits)
298
333
  const seeds = [
299
334
  [join(ORCHESTRATOR_DIR, 'PROFILE.md'), PROFILE_TEMPLATE],
300
335
  [join(ORCHESTRATOR_DIR, 'REPOS.md'), REPOS_TEMPLATE],
301
- [join(ORCHESTRATOR_DIR, 'CLAUDE.md'), CLAUDE_MD_TEMPLATE],
302
336
  ];
303
337
  for (const [path, content] of seeds) {
304
338
  if (!existsSync(path))
305
339
  writeFileSync(path, content, 'utf-8');
306
340
  }
341
+ // CLAUDE.md is system-managed: refresh it whenever the embedded template
342
+ // version is older than the current one (or missing entirely).
343
+ const claudeMdPath = join(ORCHESTRATOR_DIR, 'CLAUDE.md');
344
+ if (readTemplateVersion(claudeMdPath) < CLAUDE_MD_TEMPLATE_VERSION) {
345
+ writeFileSync(claudeMdPath, CLAUDE_MD_TEMPLATE, 'utf-8');
346
+ }
347
+ }
348
+ /** Parse the template version stamp from a seeded CLAUDE.md; 0 when absent. */
349
+ export function readTemplateVersion(path) {
350
+ try {
351
+ if (!existsSync(path))
352
+ return 0;
353
+ const match = /<!-- codekin-template-version: (\d+) -->/.exec(readFileSync(path, 'utf-8'));
354
+ return match ? parseInt(match[1], 10) : 0;
355
+ }
356
+ catch {
357
+ return 0;
358
+ }
307
359
  }
308
360
  /** Get or create a stable session UUID that persists across restarts. */
309
361
  export function getOrCreateOrchestratorId() {
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-manager.js","sourceRoot":"","sources":["../orchestrator-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAG/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;AAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;AAE7D,MAAM,gBAAgB,GAAG;;QAEjB,kBAAkB;;;;KAIrB,kBAAkB;;;KAGlB,kBAAkB;CACtB,CAAA;AAED,MAAM,cAAc,GAAG;;QAEf,kBAAkB;;;cAGZ,kBAAkB;CAC/B,CAAA;AAED,MAAM,kBAAkB,GAAG,WAAW,kBAAkB;;UAE9C,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8P3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IAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;AACjD,CAAC"}
@@ -55,9 +55,15 @@ export declare class OrchestratorMonitor {
55
55
  private addNotification;
56
56
  /** Deliver a notification to the orchestrator chat session. */
57
57
  private deliverToOrchestrator;
58
- /** Discover repo paths from REPOS_ROOT. */
58
+ /** Discover repo paths from REPOS_ROOT (see discoverRepoPathsUnder). */
59
59
  private discoverRepoPaths;
60
60
  }
61
+ /**
62
+ * Discover git repositories under a root directory, recursing one level into
63
+ * non-repo directories so org-style layouts (root/org/repo) are picked up
64
+ * alongside flat ones (root/repo). Unreadable entries are skipped.
65
+ */
66
+ export declare function discoverRepoPathsUnder(root: string): string[];
61
67
  /**
62
68
  * Suppress passive-repo alerts unless at least one workflow is enabled for the
63
69
  * repo — there's nothing to "de-schedule" otherwise, so the nag is noise.
@@ -10,6 +10,7 @@ import { join } from 'path';
10
10
  import { scanRepoReports } from './orchestrator-reports.js';
11
11
  import { runAgingCycle, getPendingOutcomeAssessments } from './orchestrator-learning.js';
12
12
  import { getOrchestratorSessionId } from './orchestrator-manager.js';
13
+ import { getOrchestratorOutbox } from './orchestrator-outbox.js';
13
14
  import { REPOS_ROOT, getAgentDisplayName } from './config.js';
14
15
  import { loadWorkflowConfig } from './workflow-config.js';
15
16
  // ---------------------------------------------------------------------------
@@ -117,6 +118,13 @@ export class OrchestratorMonitor {
117
118
  }
118
119
  /** Periodic poll — check for new reports and idle repos. */
119
120
  async poll() {
121
+ // Skip the entire poll if the rate-limit circuit breaker is open. This
122
+ // is the dominant source of background API calls; continuing to poke
123
+ // the orchestrator session during a cooldown just deepens the hole.
124
+ if (this.sessions.isRateLimited()) {
125
+ console.log('[orchestrator-monitor] rate-limit circuit breaker open — skipping poll');
126
+ return;
127
+ }
120
128
  const repoPaths = this.discoverRepoPaths();
121
129
  // Check for new reports
122
130
  this.checkNewReports(repoPaths);
@@ -207,41 +215,76 @@ export class OrchestratorMonitor {
207
215
  }
208
216
  /** Deliver a notification to the orchestrator chat session. */
209
217
  deliverToOrchestrator(notification) {
218
+ // Don't push more API work at the orchestrator while the rate-limit
219
+ // circuit breaker is open. The notification stays in the buffer and
220
+ // can still be inspected via the API; it just isn't replayed as a
221
+ // chat message until the cooldown expires.
222
+ if (this.sessions.isRateLimited())
223
+ return;
210
224
  const orchestratorId = getOrchestratorSessionId(this.sessions);
211
225
  if (!orchestratorId)
212
226
  return;
213
227
  const session = this.sessions.get(orchestratorId);
214
- if (!session?.claudeProcess?.isAlive())
228
+ if (!session?.claudeProcess?.isAlive()) {
229
+ // Orchestrator not running — hand the notification to the persistent
230
+ // outbox so it is replayed (as a digest) when the session comes back,
231
+ // instead of rotting in the in-memory buffer forever.
232
+ getOrchestratorOutbox().enqueue({
233
+ label: notification.severity.toUpperCase(),
234
+ title: notification.title,
235
+ body: notification.body,
236
+ });
237
+ notification.delivered = true;
215
238
  return;
239
+ }
216
240
  // Send as a system message that the orchestrator will see and respond to
217
241
  const message = `[Agent ${getAgentDisplayName()} Notification — ${notification.severity.toUpperCase()}]\n${notification.title}\n${notification.body}`;
218
242
  this.sessions.sendInput(orchestratorId, message);
219
243
  notification.delivered = true;
220
244
  }
221
- /** Discover repo paths from REPOS_ROOT. */
245
+ /** Discover repo paths from REPOS_ROOT (see discoverRepoPathsUnder). */
222
246
  discoverRepoPaths() {
223
- if (!existsSync(REPOS_ROOT))
224
- return [];
225
- try {
226
- return readdirSync(REPOS_ROOT)
227
- .map(name => join(REPOS_ROOT, name))
228
- .filter(p => {
229
- try {
230
- return statSync(p).isDirectory() && existsSync(join(p, '.git'));
231
- }
232
- catch {
233
- return false;
234
- }
235
- });
236
- }
237
- catch {
238
- return [];
239
- }
247
+ return discoverRepoPathsUnder(REPOS_ROOT);
240
248
  }
241
249
  }
242
250
  // ---------------------------------------------------------------------------
243
251
  // Helpers
244
252
  // ---------------------------------------------------------------------------
253
+ /**
254
+ * Discover git repositories under a root directory, recursing one level into
255
+ * non-repo directories so org-style layouts (root/org/repo) are picked up
256
+ * alongside flat ones (root/repo). Unreadable entries are skipped.
257
+ */
258
+ export function discoverRepoPathsUnder(root) {
259
+ if (!existsSync(root))
260
+ return [];
261
+ const repos = [];
262
+ const scan = (dir, depth) => {
263
+ let entries;
264
+ try {
265
+ entries = readdirSync(dir);
266
+ }
267
+ catch {
268
+ return;
269
+ }
270
+ for (const name of entries) {
271
+ const p = join(dir, name);
272
+ try {
273
+ if (!statSync(p).isDirectory())
274
+ continue;
275
+ if (existsSync(join(p, '.git')))
276
+ repos.push(p);
277
+ else if (depth < 2)
278
+ scan(p, depth + 1);
279
+ }
280
+ catch {
281
+ // unreadable entry — skip
282
+ }
283
+ }
284
+ };
285
+ scan(root, 1);
286
+ return repos;
287
+ }
245
288
  /**
246
289
  * Suppress passive-repo alerts unless at least one workflow is enabled for the
247
290
  * repo — there's nothing to "de-schedule" otherwise, so the nag is noise.
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-monitor.js","sourceRoot":"","sources":["../orchestrator-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAyB,MAAM,sBAAsB,CAAA;AAehF,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA,C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ChD,IAAI,OAAiB,CAAA;QACrB,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,OAAM;QACR,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YACzB,IAAI,CAAC;gBACH,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;oBAAE,SAAQ;gBACxC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;oBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;qBACzC,IAAI,KAAK,GAAG,CAAC;oBAAE,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;YACxC,CAAC;YAAC,MAAM,CAAC;gBACP,0BAA0B;YAC5B,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IACD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACb,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAgB,EAChB,WAA+B;IAE/B,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,CAAA;AACpE,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared helper for delivering notification messages to the orchestrator
3
+ * (parent) session via the Claude stdin channel.
4
+ *
5
+ * The rendered format is:
6
+ * [Agent <name> Notification — LABEL]
7
+ * <title>
8
+ * <body>
9
+ *
10
+ * which is the established style used by the proactive monitor and surfaced
11
+ * inside the orchestrator chat.
12
+ *
13
+ * When the recipient session cannot be reached (missing or its Claude
14
+ * process is not running), the notification is queued in the persistent
15
+ * outbox and replayed as a digest once the orchestrator is back.
16
+ */
17
+ import type { SessionManager } from './session-manager.js';
18
+ export interface OrchestratorNotifyArgs {
19
+ /** Recipient session ID (the parent / orchestrator session). */
20
+ parentSessionId: string;
21
+ /** Bracket-suffix label (e.g. 'ACTION', 'ALERT', 'Child Session Stopped'). */
22
+ label: string;
23
+ /** First body line — short headline. */
24
+ title: string;
25
+ /** Remaining body — multi-line is fine. */
26
+ body: string;
27
+ }
28
+ /** Minimal outbox surface needed by this helper (injectable for tests). */
29
+ export interface NotificationOutbox {
30
+ enqueue(args: {
31
+ label: string;
32
+ title: string;
33
+ body: string;
34
+ }): void;
35
+ }
36
+ /**
37
+ * Send a notification to the parent session via Claude stdin.
38
+ * Returns true when delivered immediately OR queued in the outbox for
39
+ * replay (the outbox owns delivery from that point on). Returns false only
40
+ * when queueing itself failed.
41
+ */
42
+ export declare function sendOrchestratorNotification(sessions: SessionManager, args: OrchestratorNotifyArgs, outbox?: NotificationOutbox): boolean;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared helper for delivering notification messages to the orchestrator
3
+ * (parent) session via the Claude stdin channel.
4
+ *
5
+ * The rendered format is:
6
+ * [Agent <name> Notification — LABEL]
7
+ * <title>
8
+ * <body>
9
+ *
10
+ * which is the established style used by the proactive monitor and surfaced
11
+ * inside the orchestrator chat.
12
+ *
13
+ * When the recipient session cannot be reached (missing or its Claude
14
+ * process is not running), the notification is queued in the persistent
15
+ * outbox and replayed as a digest once the orchestrator is back.
16
+ */
17
+ import { getAgentDisplayName } from './config.js';
18
+ import { getOrchestratorOutbox } from './orchestrator-outbox.js';
19
+ /**
20
+ * Send a notification to the parent session via Claude stdin.
21
+ * Returns true when delivered immediately OR queued in the outbox for
22
+ * replay (the outbox owns delivery from that point on). Returns false only
23
+ * when queueing itself failed.
24
+ */
25
+ export function sendOrchestratorNotification(sessions, args, outbox = getOrchestratorOutbox()) {
26
+ const session = sessions.get(args.parentSessionId);
27
+ if (session?.claudeProcess?.isAlive()) {
28
+ const message = `[Agent ${getAgentDisplayName()} Notification — ${args.label}]\n${args.title}\n${args.body}`;
29
+ sessions.sendInput(args.parentSessionId, message);
30
+ return true;
31
+ }
32
+ // Parent unreachable — queue for replay when the orchestrator comes back.
33
+ try {
34
+ outbox.enqueue({ label: args.label, title: args.title, body: args.body });
35
+ return true;
36
+ }
37
+ catch (err) {
38
+ console.warn('[orchestrator-notify] failed to queue notification:', err);
39
+ return false;
40
+ }
41
+ }
42
+ //# sourceMappingURL=orchestrator-notify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-notify.js","sourceRoot":"","sources":["../orchestrator-notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAkBhE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,QAAwB,EACxB,IAA4B,EAC5B,SAA6B,qBAAqB,EAAE;IAEpD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAClD,IAAI,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,UAAU,mBAAmB,EAAE,mBAAmB,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,EAAE,CAAA;QAC5G,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,0EAA0E;IAC1E,IAAI,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACzE,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAA;QACxE,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Persistent outbox for orchestrator notifications.
3
+ *
4
+ * When a notification cannot be delivered to the orchestrator session
5
+ * (Claude process not running), it is queued here and replayed as a single
6
+ * digest message once the orchestrator is back. The queue survives server
7
+ * restarts via a JSON file in the orchestrator workspace.
8
+ */
9
+ import type { SessionManager } from './session-manager.js';
10
+ export interface OutboxItem {
11
+ id: string;
12
+ label: string;
13
+ title: string;
14
+ body: string;
15
+ queuedAt: string;
16
+ }
17
+ export declare class OrchestratorOutbox {
18
+ private items;
19
+ private filePath;
20
+ private flushTimer;
21
+ constructor(filePath?: string);
22
+ /** Number of queued (undelivered) notifications. */
23
+ size(): number;
24
+ /** Queue a notification for later delivery. Oldest items are dropped at the cap. */
25
+ enqueue(args: {
26
+ label: string;
27
+ title: string;
28
+ body: string;
29
+ }): void;
30
+ /**
31
+ * Attempt to deliver all queued items to the orchestrator session as a
32
+ * single digest message. No-op when the queue is empty, the orchestrator
33
+ * session is missing / not running, or the rate-limit circuit breaker is
34
+ * open. Returns the number of items delivered.
35
+ */
36
+ flush(sessions: SessionManager): number;
37
+ /** Start a background timer that periodically attempts a flush. */
38
+ startFlusher(sessions: SessionManager, intervalMs?: number): void;
39
+ /** Stop the background flusher. */
40
+ stopFlusher(): void;
41
+ private buildDigest;
42
+ private load;
43
+ private persist;
44
+ }
45
+ /** Get the process-wide outbox instance. */
46
+ export declare function getOrchestratorOutbox(): OrchestratorOutbox;
47
+ /** Test-only: replace the singleton (pass null to reset). */
48
+ export declare function setOrchestratorOutboxForTest(outbox: OrchestratorOutbox | null): void;