@os-eco/overstory-cli 0.7.0 → 0.7.2

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 (60) hide show
  1. package/README.md +6 -5
  2. package/agents/builder.md +1 -1
  3. package/agents/coordinator.md +12 -11
  4. package/agents/lead.md +6 -6
  5. package/agents/monitor.md +4 -4
  6. package/agents/reviewer.md +1 -1
  7. package/agents/scout.md +5 -5
  8. package/agents/supervisor.md +36 -32
  9. package/package.json +1 -1
  10. package/src/agents/guard-rules.ts +97 -0
  11. package/src/agents/hooks-deployer.ts +7 -90
  12. package/src/agents/overlay.test.ts +7 -7
  13. package/src/agents/overlay.ts +5 -5
  14. package/src/commands/agents.test.ts +5 -0
  15. package/src/commands/clean.test.ts +3 -0
  16. package/src/commands/completions.ts +1 -1
  17. package/src/commands/coordinator.test.ts +1 -0
  18. package/src/commands/coordinator.ts +15 -11
  19. package/src/commands/costs.test.ts +5 -0
  20. package/src/commands/init.test.ts +1 -2
  21. package/src/commands/init.ts +1 -8
  22. package/src/commands/inspect.test.ts +14 -0
  23. package/src/commands/log.test.ts +14 -0
  24. package/src/commands/log.ts +39 -0
  25. package/src/commands/mail.test.ts +5 -0
  26. package/src/commands/monitor.ts +15 -11
  27. package/src/commands/nudge.test.ts +1 -0
  28. package/src/commands/prime.test.ts +2 -0
  29. package/src/commands/prime.ts +6 -2
  30. package/src/commands/run.test.ts +1 -0
  31. package/src/commands/sling.test.ts +15 -1
  32. package/src/commands/sling.ts +44 -21
  33. package/src/commands/status.test.ts +1 -0
  34. package/src/commands/stop.test.ts +1 -0
  35. package/src/commands/supervisor.ts +19 -12
  36. package/src/commands/trace.test.ts +1 -0
  37. package/src/commands/worktree.test.ts +9 -0
  38. package/src/config.ts +29 -0
  39. package/src/doctor/consistency.test.ts +14 -0
  40. package/src/e2e/init-sling-lifecycle.test.ts +3 -5
  41. package/src/index.ts +1 -1
  42. package/src/mail/broadcast.test.ts +1 -0
  43. package/src/merge/resolver.ts +23 -4
  44. package/src/runtimes/claude.test.ts +1 -1
  45. package/src/runtimes/pi-guards.test.ts +433 -0
  46. package/src/runtimes/pi-guards.ts +349 -0
  47. package/src/runtimes/pi.test.ts +620 -0
  48. package/src/runtimes/pi.ts +244 -0
  49. package/src/runtimes/registry.test.ts +33 -0
  50. package/src/runtimes/registry.ts +15 -2
  51. package/src/runtimes/types.ts +63 -0
  52. package/src/schema-consistency.test.ts +1 -0
  53. package/src/sessions/compat.ts +1 -0
  54. package/src/sessions/store.test.ts +31 -0
  55. package/src/sessions/store.ts +37 -4
  56. package/src/types.ts +17 -0
  57. package/src/watchdog/daemon.test.ts +7 -4
  58. package/src/watchdog/daemon.ts +1 -1
  59. package/src/watchdog/health.test.ts +1 -0
  60. package/src/watchdog/triage.ts +14 -4
@@ -47,6 +47,7 @@ function makeSession(overrides: Partial<AgentSession> = {}): AgentSession {
47
47
  lastActivity: new Date().toISOString(),
48
48
  escalationLevel: 0,
49
49
  stalledSince: null,
50
+ transcriptPath: null,
50
51
  ...overrides,
51
52
  };
52
53
  }
@@ -9,6 +9,8 @@
9
9
  import { readdir } from "node:fs/promises";
10
10
  import { join } from "node:path";
11
11
  import { AgentError } from "../errors.ts";
12
+ import { getRuntime } from "../runtimes/registry.ts";
13
+ import type { OverstoryConfig } from "../types.ts";
12
14
 
13
15
  /**
14
16
  * Triage a stalled agent by analyzing its recent log output with Claude.
@@ -30,8 +32,10 @@ export async function triageAgent(options: {
30
32
  lastActivity: string;
31
33
  /** Timeout in ms for the Claude subprocess. Defaults to 30_000 (30s). */
32
34
  timeoutMs?: number;
35
+ /** Overstory config for runtime resolution. */
36
+ config?: OverstoryConfig;
33
37
  }): Promise<"retry" | "terminate" | "extend"> {
34
- const { agentName, root, lastActivity, timeoutMs } = options;
38
+ const { agentName, root, lastActivity, timeoutMs, config } = options;
35
39
  const logsDir = join(root, ".overstory", "logs", agentName);
36
40
 
37
41
  let logContent: string;
@@ -45,7 +49,7 @@ export async function triageAgent(options: {
45
49
  const prompt = buildTriagePrompt(agentName, lastActivity, logContent);
46
50
 
47
51
  try {
48
- const response = await spawnClaude(prompt, timeoutMs);
52
+ const response = await spawnClaude(prompt, timeoutMs, config);
49
53
  return classifyResponse(response);
50
54
  } catch {
51
55
  // Claude not available — default to extend (safe fallback)
@@ -130,10 +134,16 @@ const DEFAULT_TRIAGE_TIMEOUT_MS = 30_000;
130
134
  * @returns Claude's response text
131
135
  * @throws Error if claude is not installed, the process fails, or the timeout is reached
132
136
  */
133
- async function spawnClaude(prompt: string, timeoutMs?: number): Promise<string> {
137
+ async function spawnClaude(
138
+ prompt: string,
139
+ timeoutMs?: number,
140
+ config?: OverstoryConfig,
141
+ ): Promise<string> {
134
142
  const timeout = timeoutMs ?? DEFAULT_TRIAGE_TIMEOUT_MS;
135
143
 
136
- const proc = Bun.spawn(["claude", "--print", "-p", prompt], {
144
+ const runtime = getRuntime(config?.runtime?.printCommand ?? config?.runtime?.default, config);
145
+ const argv = runtime.buildPrintCommand(prompt);
146
+ const proc = Bun.spawn(argv, {
137
147
  stdout: "pipe",
138
148
  stderr: "pipe",
139
149
  });