@creativeintelligence/abbie 0.1.5 → 0.1.7

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 (142) hide show
  1. package/bin/dev.js +1 -49
  2. package/bin/run.js +42 -49
  3. package/dist/cli/commands/login.js +26 -0
  4. package/dist/cli/commands/project/add.d.ts +0 -1
  5. package/dist/cli/commands/project/add.js +16 -52
  6. package/dist/cli/commands/project/list.js +13 -93
  7. package/dist/cli/commands/project/remove.d.ts +0 -2
  8. package/dist/cli/commands/project/remove.js +11 -28
  9. package/dist/cli/commands/session/list.js +3 -12
  10. package/dist/cli/commands/session/mark-done.js +1 -7
  11. package/dist/cli/commands/session/start.d.ts +0 -1
  12. package/dist/cli/commands/session/start.js +5 -7
  13. package/dist/lib/active-sessions.d.ts +0 -12
  14. package/dist/lib/active-sessions.js +6 -175
  15. package/dist/lib/project-path.d.ts +6 -0
  16. package/dist/lib/project-path.js +21 -0
  17. package/dist/lib.d.ts +1 -2
  18. package/dist/lib.js +2 -4
  19. package/oclif.manifest.json +2569 -6368
  20. package/package.json +1 -1
  21. package/dist/cli/commands/backlog/add.d.ts +0 -22
  22. package/dist/cli/commands/backlog/add.js +0 -65
  23. package/dist/cli/commands/backlog/claim.d.ts +0 -19
  24. package/dist/cli/commands/backlog/claim.js +0 -45
  25. package/dist/cli/commands/backlog/complete.d.ts +0 -18
  26. package/dist/cli/commands/backlog/complete.js +0 -42
  27. package/dist/cli/commands/backlog/list.d.ts +0 -20
  28. package/dist/cli/commands/backlog/list.js +0 -91
  29. package/dist/cli/commands/backlog/pick.d.ts +0 -18
  30. package/dist/cli/commands/backlog/pick.js +0 -42
  31. package/dist/cli/commands/backlog/sync.d.ts +0 -24
  32. package/dist/cli/commands/backlog/sync.js +0 -109
  33. package/dist/cli/commands/daemon.d.ts +0 -56
  34. package/dist/cli/commands/daemon.js +0 -1465
  35. package/dist/cli/commands/docs/lint.d.ts +0 -18
  36. package/dist/cli/commands/docs/lint.js +0 -82
  37. package/dist/cli/commands/docs/sync.d.ts +0 -19
  38. package/dist/cli/commands/docs/sync.js +0 -76
  39. package/dist/cli/commands/gc.d.ts +0 -29
  40. package/dist/cli/commands/gc.js +0 -211
  41. package/dist/cli/commands/index.d.ts +0 -36
  42. package/dist/cli/commands/index.js +0 -228
  43. package/dist/cli/commands/panes/broker.d.ts +0 -17
  44. package/dist/cli/commands/panes/broker.js +0 -57
  45. package/dist/cli/commands/panes/pipe-sink.d.ts +0 -17
  46. package/dist/cli/commands/panes/pipe-sink.js +0 -90
  47. package/dist/cli/commands/panes/snapshot.d.ts +0 -20
  48. package/dist/cli/commands/panes/snapshot.js +0 -125
  49. package/dist/cli/commands/preview/init.d.ts +0 -25
  50. package/dist/cli/commands/preview/init.js +0 -159
  51. package/dist/cli/commands/preview/sync.d.ts +0 -23
  52. package/dist/cli/commands/preview/sync.js +0 -144
  53. package/dist/cli/commands/preview/watch.d.ts +0 -24
  54. package/dist/cli/commands/preview/watch.js +0 -153
  55. package/dist/cli/commands/resource/acquire.d.ts +0 -21
  56. package/dist/cli/commands/resource/acquire.js +0 -90
  57. package/dist/cli/commands/resource/list.d.ts +0 -15
  58. package/dist/cli/commands/resource/list.js +0 -61
  59. package/dist/cli/commands/resource/release.d.ts +0 -18
  60. package/dist/cli/commands/resource/release.js +0 -50
  61. package/dist/cli/commands/resource/wait.d.ts +0 -21
  62. package/dist/cli/commands/resource/wait.js +0 -73
  63. package/dist/cli/commands/session/view.d.ts +0 -24
  64. package/dist/cli/commands/session/view.js +0 -145
  65. package/dist/cli/commands/start.d.ts +0 -37
  66. package/dist/cli/commands/start.js +0 -234
  67. package/dist/cli/commands/triage/claim.d.ts +0 -23
  68. package/dist/cli/commands/triage/claim.js +0 -186
  69. package/dist/cli/commands/triage/list.d.ts +0 -22
  70. package/dist/cli/commands/triage/list.js +0 -112
  71. package/dist/cli/commands/triage/next.d.ts +0 -18
  72. package/dist/cli/commands/triage/next.js +0 -63
  73. package/dist/cli/commands/triage/pull.d.ts +0 -19
  74. package/dist/cli/commands/triage/pull.js +0 -82
  75. package/dist/cli/commands/triage/stats.d.ts +0 -16
  76. package/dist/cli/commands/triage/stats.js +0 -69
  77. package/dist/cli/commands/tunnel/list.d.ts +0 -16
  78. package/dist/cli/commands/tunnel/list.js +0 -98
  79. package/dist/cli/commands/tunnel/start.d.ts +0 -24
  80. package/dist/cli/commands/tunnel/start.js +0 -107
  81. package/dist/cli/commands/tunnel/stop.d.ts +0 -20
  82. package/dist/cli/commands/tunnel/stop.js +0 -90
  83. package/dist/cli/commands/tunnel/url.d.ts +0 -21
  84. package/dist/cli/commands/tunnel/url.js +0 -70
  85. package/dist/cli/commands/windows/context.d.ts +0 -18
  86. package/dist/cli/commands/windows/context.js +0 -326
  87. package/dist/cli/commands/windows/focus.d.ts +0 -17
  88. package/dist/cli/commands/windows/focus.js +0 -103
  89. package/dist/cli/commands/windows/list.d.ts +0 -21
  90. package/dist/cli/commands/windows/list.js +0 -172
  91. package/dist/cli/commands/windows/map.d.ts +0 -17
  92. package/dist/cli/commands/windows/map.js +0 -168
  93. package/dist/cli/commands/windows/read.d.ts +0 -21
  94. package/dist/cli/commands/windows/read.js +0 -241
  95. package/dist/cli/commands/windows/search.d.ts +0 -24
  96. package/dist/cli/commands/windows/search.js +0 -171
  97. package/dist/cli/commands/windows/show.d.ts +0 -19
  98. package/dist/cli/commands/windows/show.js +0 -165
  99. package/dist/cli/commands/windows/watch.d.ts +0 -19
  100. package/dist/cli/commands/windows/watch.js +0 -241
  101. package/dist/lib/managed-session.d.ts +0 -27
  102. package/dist/lib/managed-session.js +0 -105
  103. package/dist/lib/panes/broker.d.ts +0 -130
  104. package/dist/lib/panes/broker.js +0 -97
  105. package/dist/lib/panes/index.d.ts +0 -2
  106. package/dist/lib/panes/index.js +0 -1
  107. package/dist/lib/panes/server.d.ts +0 -17
  108. package/dist/lib/panes/server.js +0 -308
  109. package/dist/lib/preview/manager.d.ts +0 -77
  110. package/dist/lib/preview/manager.js +0 -369
  111. package/dist/lib/preview/schema.d.ts +0 -2
  112. package/dist/lib/preview/schema.js +0 -32
  113. package/dist/lib/preview/sprite.d.ts +0 -85
  114. package/dist/lib/preview/sprite.js +0 -321
  115. package/dist/lib/preview/watcher.d.ts +0 -63
  116. package/dist/lib/preview/watcher.js +0 -185
  117. package/dist/lib/project-identity.d.ts +0 -16
  118. package/dist/lib/project-identity.js +0 -75
  119. package/dist/lib/tmux/bridge.d.ts +0 -133
  120. package/dist/lib/tmux/bridge.js +0 -315
  121. package/dist/lib/tmux/context.d.ts +0 -82
  122. package/dist/lib/tmux/context.js +0 -239
  123. package/dist/lib/tmux/index.d.ts +0 -8
  124. package/dist/lib/tmux/index.js +0 -11
  125. package/dist/lib/tmux/map.d.ts +0 -57
  126. package/dist/lib/tmux/map.js +0 -198
  127. package/dist/lib/tmux/panes.d.ts +0 -27
  128. package/dist/lib/tmux/panes.js +0 -151
  129. package/dist/lib/tmux/redaction.d.ts +0 -57
  130. package/dist/lib/tmux/redaction.js +0 -152
  131. package/dist/lib/web/analytics.d.ts +0 -63
  132. package/dist/lib/web/analytics.js +0 -168
  133. package/dist/lib/web/server.d.ts +0 -26
  134. package/dist/lib/web/server.js +0 -697
  135. package/dist/lib/web/tmux-bridge.d.ts +0 -7
  136. package/dist/lib/web/tmux-bridge.js +0 -7
  137. package/dist/lib/windows/index.d.ts +0 -3
  138. package/dist/lib/windows/index.js +0 -2
  139. package/dist/lib/windows/inventory.d.ts +0 -21
  140. package/dist/lib/windows/inventory.js +0 -263
  141. package/dist/lib/windows/types.d.ts +0 -46
  142. package/dist/lib/windows/types.js +0 -1
@@ -1,4 +1,4 @@
1
- import { execSync, spawn, spawnSync } from "node:child_process";
1
+ import { execSync, spawn } from "node:child_process";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
4
4
  import { homedir } from "node:os";
@@ -181,9 +181,8 @@ export class ActiveSessionManager {
181
181
  issue: options.issue,
182
182
  worktree: cwd,
183
183
  }));
184
- // Determine spawn mode: terminal (default) or headless.
185
- // --await always runs headless in foreground.
186
- const useHeadless = options.headless || options.awaitCompletion;
184
+ // Always headless tmux terminal mode removed.
185
+ const useHeadless = true;
187
186
  const localBin = join(homedir(), ".local", "bin");
188
187
  const pathWithLocalBin = process.env.PATH?.includes(localBin)
189
188
  ? process.env.PATH
@@ -228,84 +227,7 @@ export class ActiveSessionManager {
228
227
  ...process.env,
229
228
  ...runnerEnvShared,
230
229
  };
231
- if (!useHeadless) {
232
- // TERMINAL MODE: spawn runner in a tmux window.
233
- try {
234
- const { newWindow, getPaneId, isRunning, listSessions } = await import("./tmux/bridge.js");
235
- const { ensureManagedSession } = await import("./managed-session.js");
236
- const tmuxSession = options.tmuxSession
237
- ? options.tmuxSession
238
- : await ensureManagedSession();
239
- if (options.tmuxSession) {
240
- const running = await isRunning();
241
- const sessions = running ? await listSessions() : [];
242
- const exists = sessions.some((s) => s.name === tmuxSession);
243
- if (!exists) {
244
- await new Promise((resolve, reject) => {
245
- const proc = spawn("tmux", ["new-session", "-d", "-s", tmuxSession, "-n", "_abbie", "-c", homedir()], { stdio: ["ignore", "ignore", "ignore"] });
246
- proc.on("close", (code) => {
247
- if (code === 0)
248
- resolve();
249
- else
250
- reject(new Error(`Failed to create tmux session: ${tmuxSession}`));
251
- });
252
- proc.on("error", reject);
253
- });
254
- }
255
- }
256
- const launchScript = join(this.promptsPath, `${sessionId}-runner-launch.sh`);
257
- const launchScriptContent = this.buildRunnerLaunchScript({
258
- cwd,
259
- agentsPath,
260
- sessionId,
261
- env: runnerEnvShared,
262
- });
263
- writeFileSync(launchScript, launchScriptContent, { mode: 0o755 });
264
- const windowName = `${options.project}-${options.agent}-${sessionId.slice(-4)}`;
265
- const command = `bash ${this.shellEscape(launchScript)}`;
266
- await newWindow({ name: windowName, cwd, command, session: tmuxSession });
267
- const paneId = await getPaneId(windowName, 0, tmuxSession);
268
- session.spawn_mode = "terminal";
269
- session.pane_id = paneId ?? undefined;
270
- this.saveSession(session);
271
- return {
272
- session_id: sessionId,
273
- pid: 0,
274
- prompt_path: promptPath,
275
- output_path: outputPath,
276
- result_path: resultPath,
277
- status: "spawned",
278
- trace_id: traceId,
279
- read_only: readOnly,
280
- };
281
- }
282
- catch (tmuxError) {
283
- // tmux unavailable - fall through to headless.
284
- const errMsg = tmuxError.message;
285
- if (!errMsg.includes("ENOENT") &&
286
- !errMsg.includes("not found") &&
287
- !errMsg.includes("no server")) {
288
- session.status = "failed";
289
- this.saveSession(session);
290
- this.markSessionArtifactComplete(sessionId, {
291
- status: "failed",
292
- outputPath,
293
- });
294
- return {
295
- session_id: sessionId,
296
- pid: 0,
297
- prompt_path: promptPath,
298
- output_path: outputPath,
299
- result_path: resultPath,
300
- status: "failed",
301
- error: `Terminal spawn failed: ${errMsg}`,
302
- trace_id: traceId,
303
- read_only: readOnly,
304
- };
305
- }
306
- }
307
- }
308
- // HEADLESS MODE (--headless, --await, or tmux fallback)
230
+ // HEADLESS MODE
309
231
  session.spawn_mode = "headless";
310
232
  this.saveSession(session);
311
233
  try {
@@ -477,10 +399,7 @@ export class ActiveSessionManager {
477
399
  if (runnerPid > 0 && !this.isProcessRunning(runnerPid)) {
478
400
  dead = true;
479
401
  }
480
- else if (session.spawn_mode === "terminal" &&
481
- runnerPid <= 0 &&
482
- session.pane_id &&
483
- !this.isTmuxPaneAlive(session.pane_id)) {
402
+ else if (runnerPid <= 0) {
484
403
  dead = true;
485
404
  }
486
405
  if (dead) {
@@ -534,18 +453,6 @@ export class ActiveSessionManager {
534
453
  outputPath: session.output_path,
535
454
  });
536
455
  }
537
- else if (session.spawn_mode === "terminal" &&
538
- session.pane_id &&
539
- !this.isTmuxPaneAlive(session.pane_id)) {
540
- // Terminal pane is gone — agent died without mark-done
541
- session.status = "failed";
542
- this.saveSession(session);
543
- this.markSessionArtifactComplete(session.session_id, {
544
- status: "failed",
545
- exitCode: session.exit_code,
546
- outputPath: session.output_path,
547
- });
548
- }
549
456
  }
550
457
  // Apply filters
551
458
  if (options?.status && session.status !== options.status)
@@ -606,13 +513,7 @@ export class ActiveSessionManager {
606
513
  const killedAgent = agentPid !== undefined
607
514
  ? tryKillGroup(agentPid, signal) || tryKill(agentPid, signal)
608
515
  : false;
609
- // Legacy fallback for pre-runner terminal sessions that never recorded a runner PID.
610
- let signaledLegacy = false;
611
- if (!killedRunner && !killedAgent && session.spawn_mode === "terminal" && session.pane_id) {
612
- this.killPaneProcesses(session.pane_id, signal);
613
- signaledLegacy = true;
614
- }
615
- if (!killedRunner && !killedAgent && !signaledLegacy) {
516
+ if (!killedRunner && !killedAgent) {
616
517
  return false;
617
518
  }
618
519
  session.status = "stopped";
@@ -639,49 +540,6 @@ export class ActiveSessionManager {
639
540
  * Kill processes running inside a tmux pane.
640
541
  * Used only as a legacy fallback for pre-runner terminal sessions.
641
542
  */
642
- killPaneProcesses(paneId, signal = "SIGTERM") {
643
- try {
644
- // Get the shell PID running in the pane
645
- const result = spawnSync("tmux", ["display-message", "-p", "-t", paneId, "#{pane_pid}"], {
646
- stdio: ["ignore", "pipe", "ignore"],
647
- });
648
- if (result.status !== 0 || !result.stdout)
649
- return;
650
- const shellPid = parseInt(result.stdout.toString().trim(), 10);
651
- if (Number.isNaN(shellPid) || shellPid <= 0)
652
- return;
653
- // Find all child processes of the shell (the agent and its children)
654
- const psResult = spawnSync("pgrep", ["-P", String(shellPid)], {
655
- stdio: ["ignore", "pipe", "ignore"],
656
- });
657
- if (psResult.status !== 0 || !psResult.stdout)
658
- return;
659
- const childPids = psResult.stdout
660
- .toString()
661
- .trim()
662
- .split("\n")
663
- .map((p) => parseInt(p, 10))
664
- .filter((p) => !Number.isNaN(p) && p > 0);
665
- // Kill each child process group (agent spawns sub-processes)
666
- for (const pid of childPids) {
667
- try {
668
- // Try killing the process group first (catches agent child processes)
669
- process.kill(-pid, signal);
670
- }
671
- catch {
672
- try {
673
- process.kill(pid, signal);
674
- }
675
- catch {
676
- // Process already gone
677
- }
678
- }
679
- }
680
- }
681
- catch {
682
- // Best-effort fallback only.
683
- }
684
- }
685
543
  /**
686
544
  * Get events for a session.
687
545
  */
@@ -706,22 +564,6 @@ export class ActiveSessionManager {
706
564
  }
707
565
  return cleaned;
708
566
  }
709
- shellEscape(value) {
710
- return `'${value.replace(/'/g, `'\\''`)}'`;
711
- }
712
- buildRunnerLaunchScript(input) {
713
- const lines = ["#!/usr/bin/env bash", "set -euo pipefail", `cd ${this.shellEscape(input.cwd)}`];
714
- for (const [key, value] of Object.entries(input.env)) {
715
- if (!/^[A-Z_][A-Z0-9_]*$/.test(key))
716
- continue;
717
- lines.push(`export ${key}=${this.shellEscape(String(value))}`);
718
- }
719
- lines.push(`exec ${this.shellEscape(input.agentsPath)} session run ${this.shellEscape(input.sessionId)}`);
720
- return `${lines.join("\n")}\n`;
721
- }
722
- /**
723
- * Build prompt for agent.
724
- */
725
567
  /**
726
568
  * Build workspace awareness context from other active sessions in the same cwd.
727
569
  */
@@ -1141,17 +983,6 @@ Violation of this contract will cause session termination.
1141
983
  return false;
1142
984
  }
1143
985
  }
1144
- /**
1145
- * Check if a tmux pane is still alive.
1146
- * Uses list-panes which returns exit 1 for nonexistent targets
1147
- * (display-message returns 0 even for dead panes).
1148
- */
1149
- isTmuxPaneAlive(paneId) {
1150
- const result = spawnSync("tmux", ["list-panes", "-t", paneId], {
1151
- stdio: ["ignore", "ignore", "ignore"],
1152
- });
1153
- return result.status === 0;
1154
- }
1155
986
  }
1156
987
  /**
1157
988
  * Singleton instance.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract project name from a filesystem path.
3
+ * Maps ~/Developer/apps/{project}/... → project name.
4
+ */
5
+ export declare function extractProjectFromPath(path: string): string | null;
6
+ //# sourceMappingURL=project-path.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Extract project name from a filesystem path.
3
+ * Maps ~/Developer/apps/{project}/... → project name.
4
+ */
5
+ export function extractProjectFromPath(path) {
6
+ const home = process.env.HOME || "/Users/luke";
7
+ const normalized = path.replace(/\/+$/u, "");
8
+ // Pattern: ~/Developer/apps/{project}/...
9
+ const appsMatch = normalized.match(new RegExp(`^${home}/Developer/apps/([^/]+)`));
10
+ if (appsMatch)
11
+ return appsMatch[1];
12
+ // Pattern: ~/Developer/utils/{project}/...
13
+ const utilsMatch = normalized.match(new RegExp(`^${home}/Developer/utils/([^/]+)`));
14
+ if (utilsMatch)
15
+ return utilsMatch[1];
16
+ // Pattern: ~/Developer/{project}/...
17
+ const devMatch = normalized.match(new RegExp(`^${home}/Developer/([^/]+)`));
18
+ if (devMatch)
19
+ return devMatch[1];
20
+ return null;
21
+ }
package/dist/lib.d.ts CHANGED
@@ -81,8 +81,7 @@ export { AgentsError, errorToExitCode, InvalidProjectError, InvalidSessionError,
81
81
  export { type BaseEvent, createEvent, EventStore, type EventType, generateSessionId, type PreviewCreatedEvent, type ResourceAcquiredEvent, type ResourceReleasedEvent, type SessionBlockedEvent, type SessionCheckpointEvent, type SessionCompleteEvent, type SessionEvent, type SessionHeartbeatEvent, type SessionStartEvent, type TaskCompleteEvent, type TaskStartEvent, } from "./lib/events.js";
82
82
  export { type HeartbeatConfig, HeartbeatManager, type SessionLiveness, } from "./lib/heartbeat.js";
83
83
  export { type AgentPlatform, ClaudeAdapter, CodexAdapter, CopilotAdapter, discoverAllHooks, generateMockPayload, getAllHooks, getConfigPaths, getConfiguredPlatforms, getHooksForPlatform, type Hook, type HookAdapter, type HookDiscoveryError, type HookEventType, type HookRegistry, type HookTestResult, runHook, } from "./lib/hooks/index.js";
84
- export { ensureManagedSession, getManagedSessionName, hasProjectWindow, listManagedWindows, } from "./lib/managed-session.js";
85
- export * from "./lib/panes/index.js";
84
+ export { extractProjectFromPath } from "./lib/project-path.js";
86
85
  export { type AgentIdentity, type BlockerType, detectAgent, generateTraceId, getOrCreateTraceId, type ReportAction, type ReportOptions, type ReportResult, reportBlocked, reportComplete, reportProgress, reportStart, } from "./lib/report.js";
87
86
  export { createResourceManager, DEFAULT_RESOURCES, type ResourceConfig, type ResourceLease, ResourceManager, } from "./lib/resources.js";
88
87
  export { createSession, generateSlug, getAllSessions, getSession, type SessionMetadata, } from "./lib/session-manager.js";
package/dist/lib.js CHANGED
@@ -90,10 +90,8 @@ export { createEvent, EventStore, generateSessionId, } from "./lib/events.js";
90
90
  export { HeartbeatManager, } from "./lib/heartbeat.js";
91
91
  // Hook discovery and management
92
92
  export { ClaudeAdapter, CodexAdapter, CopilotAdapter, discoverAllHooks, generateMockPayload, getAllHooks, getConfigPaths, getConfiguredPlatforms, getHooksForPlatform, runHook, } from "./lib/hooks/index.js";
93
- // Managed abbie tmux session
94
- export { ensureManagedSession, getManagedSessionName, hasProjectWindow, listManagedWindows, } from "./lib/managed-session.js";
95
- // Panes broker protocol + client helper (local fanout for pane streaming)
96
- export * from "./lib/panes/index.js";
93
+ // Project path utilities
94
+ export { extractProjectFromPath } from "./lib/project-path.js";
97
95
  // Unified lifecycle reporting (Convex reports + Slack + messages)
98
96
  export { detectAgent, generateTraceId, getOrCreateTraceId, reportBlocked, reportComplete, reportProgress, reportStart, } from "./lib/report.js";
99
97
  // Resource semaphores