@made-by-moonlight/athene-core 0.9.1

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 (285) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +241 -0
  3. package/dist/activity-events.d.ts +42 -0
  4. package/dist/activity-events.d.ts.map +1 -0
  5. package/dist/activity-events.js +192 -0
  6. package/dist/activity-events.js.map +1 -0
  7. package/dist/activity-log.d.ts +71 -0
  8. package/dist/activity-log.d.ts.map +1 -0
  9. package/dist/activity-log.js +203 -0
  10. package/dist/activity-log.js.map +1 -0
  11. package/dist/activity-signal.d.ts +20 -0
  12. package/dist/activity-signal.d.ts.map +1 -0
  13. package/dist/activity-signal.js +91 -0
  14. package/dist/activity-signal.js.map +1 -0
  15. package/dist/agent-report.d.ts +148 -0
  16. package/dist/agent-report.d.ts.map +1 -0
  17. package/dist/agent-report.js +516 -0
  18. package/dist/agent-report.js.map +1 -0
  19. package/dist/agent-selection.d.ts +31 -0
  20. package/dist/agent-selection.d.ts.map +1 -0
  21. package/dist/agent-selection.js +69 -0
  22. package/dist/agent-selection.js.map +1 -0
  23. package/dist/agent-workspace-hooks.d.ts +74 -0
  24. package/dist/agent-workspace-hooks.d.ts.map +1 -0
  25. package/dist/agent-workspace-hooks.js +988 -0
  26. package/dist/agent-workspace-hooks.js.map +1 -0
  27. package/dist/atomic-write.d.ts +6 -0
  28. package/dist/atomic-write.d.ts.map +1 -0
  29. package/dist/atomic-write.js +49 -0
  30. package/dist/atomic-write.js.map +1 -0
  31. package/dist/cleanup-stack.d.ts +37 -0
  32. package/dist/cleanup-stack.d.ts.map +1 -0
  33. package/dist/cleanup-stack.js +45 -0
  34. package/dist/cleanup-stack.js.map +1 -0
  35. package/dist/code-review-manager.d.ts +118 -0
  36. package/dist/code-review-manager.d.ts.map +1 -0
  37. package/dist/code-review-manager.js +719 -0
  38. package/dist/code-review-manager.js.map +1 -0
  39. package/dist/code-review-store.d.ts +114 -0
  40. package/dist/code-review-store.d.ts.map +1 -0
  41. package/dist/code-review-store.js +346 -0
  42. package/dist/code-review-store.js.map +1 -0
  43. package/dist/config-generator.d.ts +84 -0
  44. package/dist/config-generator.d.ts.map +1 -0
  45. package/dist/config-generator.js +295 -0
  46. package/dist/config-generator.js.map +1 -0
  47. package/dist/config.d.ts +55 -0
  48. package/dist/config.d.ts.map +1 -0
  49. package/dist/config.js +852 -0
  50. package/dist/config.js.map +1 -0
  51. package/dist/daemon-children.d.ts +55 -0
  52. package/dist/daemon-children.d.ts.map +1 -0
  53. package/dist/daemon-children.js +435 -0
  54. package/dist/daemon-children.js.map +1 -0
  55. package/dist/dashboard-notifications.d.ts +42 -0
  56. package/dist/dashboard-notifications.d.ts.map +1 -0
  57. package/dist/dashboard-notifications.js +123 -0
  58. package/dist/dashboard-notifications.js.map +1 -0
  59. package/dist/events-db.d.ts +39 -0
  60. package/dist/events-db.d.ts.map +1 -0
  61. package/dist/events-db.js +185 -0
  62. package/dist/events-db.js.map +1 -0
  63. package/dist/feature-flags.d.ts +2 -0
  64. package/dist/feature-flags.d.ts.map +1 -0
  65. package/dist/feature-flags.js +9 -0
  66. package/dist/feature-flags.js.map +1 -0
  67. package/dist/feedback-tools.d.ts +97 -0
  68. package/dist/feedback-tools.d.ts.map +1 -0
  69. package/dist/feedback-tools.js +161 -0
  70. package/dist/feedback-tools.js.map +1 -0
  71. package/dist/file-lock.d.ts +5 -0
  72. package/dist/file-lock.d.ts.map +1 -0
  73. package/dist/file-lock.js +59 -0
  74. package/dist/file-lock.js.map +1 -0
  75. package/dist/format-automated-comments.d.ts +18 -0
  76. package/dist/format-automated-comments.d.ts.map +1 -0
  77. package/dist/gh-trace.d.ts +57 -0
  78. package/dist/gh-trace.d.ts.map +1 -0
  79. package/dist/gh-trace.js +320 -0
  80. package/dist/gh-trace.js.map +1 -0
  81. package/dist/git-activity.d.ts +10 -0
  82. package/dist/git-activity.d.ts.map +1 -0
  83. package/dist/git-activity.js +30 -0
  84. package/dist/git-activity.js.map +1 -0
  85. package/dist/global-config.d.ts +1085 -0
  86. package/dist/global-config.d.ts.map +1 -0
  87. package/dist/global-config.js +1067 -0
  88. package/dist/global-config.js.map +1 -0
  89. package/dist/index.d.ts +91 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +59 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/key-value.d.ts +7 -0
  94. package/dist/key-value.d.ts.map +1 -0
  95. package/dist/key-value.js +24 -0
  96. package/dist/key-value.js.map +1 -0
  97. package/dist/lifecycle-manager.d.ts +22 -0
  98. package/dist/lifecycle-manager.d.ts.map +1 -0
  99. package/dist/lifecycle-manager.js +2813 -0
  100. package/dist/lifecycle-manager.js.map +1 -0
  101. package/dist/lifecycle-state.d.ts +28 -0
  102. package/dist/lifecycle-state.d.ts.map +1 -0
  103. package/dist/lifecycle-state.js +446 -0
  104. package/dist/lifecycle-state.js.map +1 -0
  105. package/dist/lifecycle-status-decisions.d.ts +85 -0
  106. package/dist/lifecycle-status-decisions.d.ts.map +1 -0
  107. package/dist/lifecycle-status-decisions.js +262 -0
  108. package/dist/lifecycle-status-decisions.js.map +1 -0
  109. package/dist/lifecycle-transition.d.ts +81 -0
  110. package/dist/lifecycle-transition.d.ts.map +1 -0
  111. package/dist/lifecycle-transition.js +207 -0
  112. package/dist/lifecycle-transition.js.map +1 -0
  113. package/dist/metadata.d.ts +54 -0
  114. package/dist/metadata.d.ts.map +1 -0
  115. package/dist/metadata.js +484 -0
  116. package/dist/metadata.js.map +1 -0
  117. package/dist/migration/storage-v2.d.ts +76 -0
  118. package/dist/migration/storage-v2.d.ts.map +1 -0
  119. package/dist/migration/storage-v2.js +1614 -0
  120. package/dist/migration/storage-v2.js.map +1 -0
  121. package/dist/notification-data.d.ts +135 -0
  122. package/dist/notification-data.d.ts.map +1 -0
  123. package/dist/notification-data.js +204 -0
  124. package/dist/notification-data.js.map +1 -0
  125. package/dist/notification-observability.d.ts +21 -0
  126. package/dist/notification-observability.d.ts.map +1 -0
  127. package/dist/notification-observability.js +154 -0
  128. package/dist/notification-observability.js.map +1 -0
  129. package/dist/notifier-resolution.d.ts +14 -0
  130. package/dist/notifier-resolution.d.ts.map +1 -0
  131. package/dist/notifier-resolution.js +23 -0
  132. package/dist/notifier-resolution.js.map +1 -0
  133. package/dist/observability.d.ts +100 -0
  134. package/dist/observability.d.ts.map +1 -0
  135. package/dist/observability.js +535 -0
  136. package/dist/observability.js.map +1 -0
  137. package/dist/opencode-agents-md.d.ts +3 -0
  138. package/dist/opencode-agents-md.d.ts.map +1 -0
  139. package/dist/opencode-agents-md.js +40 -0
  140. package/dist/opencode-agents-md.js.map +1 -0
  141. package/dist/opencode-config.d.ts +2 -0
  142. package/dist/opencode-config.d.ts.map +1 -0
  143. package/dist/opencode-config.js +17 -0
  144. package/dist/opencode-config.js.map +1 -0
  145. package/dist/opencode-session-id.d.ts +2 -0
  146. package/dist/opencode-session-id.d.ts.map +1 -0
  147. package/dist/opencode-session-id.js +12 -0
  148. package/dist/opencode-session-id.js.map +1 -0
  149. package/dist/opencode-shared.d.ts +80 -0
  150. package/dist/opencode-shared.d.ts.map +1 -0
  151. package/dist/opencode-shared.js +202 -0
  152. package/dist/opencode-shared.js.map +1 -0
  153. package/dist/orchestrator-prompt.d.ts +19 -0
  154. package/dist/orchestrator-prompt.d.ts.map +1 -0
  155. package/dist/orchestrator-prompt.js +130 -0
  156. package/dist/orchestrator-prompt.js.map +1 -0
  157. package/dist/orchestrator-session-strategy.d.ts +5 -0
  158. package/dist/orchestrator-session-strategy.d.ts.map +1 -0
  159. package/dist/orchestrator-session-strategy.js +13 -0
  160. package/dist/orchestrator-session-strategy.js.map +1 -0
  161. package/dist/paths.d.ts +145 -0
  162. package/dist/paths.d.ts.map +1 -0
  163. package/dist/paths.js +288 -0
  164. package/dist/paths.js.map +1 -0
  165. package/dist/platform.d.ts +32 -0
  166. package/dist/platform.d.ts.map +1 -0
  167. package/dist/platform.js +211 -0
  168. package/dist/platform.js.map +1 -0
  169. package/dist/plugin-registry.d.ts +15 -0
  170. package/dist/plugin-registry.d.ts.map +1 -0
  171. package/dist/plugin-registry.js +499 -0
  172. package/dist/plugin-registry.js.map +1 -0
  173. package/dist/portfolio-projects.d.ts +7 -0
  174. package/dist/portfolio-projects.d.ts.map +1 -0
  175. package/dist/portfolio-projects.js +65 -0
  176. package/dist/portfolio-projects.js.map +1 -0
  177. package/dist/portfolio-registry.d.ts +42 -0
  178. package/dist/portfolio-registry.d.ts.map +1 -0
  179. package/dist/portfolio-registry.js +311 -0
  180. package/dist/portfolio-registry.js.map +1 -0
  181. package/dist/portfolio-routing.d.ts +5 -0
  182. package/dist/portfolio-routing.d.ts.map +1 -0
  183. package/dist/portfolio-routing.js +24 -0
  184. package/dist/portfolio-routing.js.map +1 -0
  185. package/dist/portfolio-session-service.d.ts +15 -0
  186. package/dist/portfolio-session-service.d.ts.map +1 -0
  187. package/dist/portfolio-session-service.js +206 -0
  188. package/dist/portfolio-session-service.js.map +1 -0
  189. package/dist/process-cache.d.ts +32 -0
  190. package/dist/process-cache.d.ts.map +1 -0
  191. package/dist/process-cache.js +44 -0
  192. package/dist/process-cache.js.map +1 -0
  193. package/dist/project-resolver.d.ts +5 -0
  194. package/dist/project-resolver.d.ts.map +1 -0
  195. package/dist/project-resolver.js +20 -0
  196. package/dist/project-resolver.js.map +1 -0
  197. package/dist/prompt-builder.d.ts +42 -0
  198. package/dist/prompt-builder.d.ts.map +1 -0
  199. package/dist/prompt-builder.js +182 -0
  200. package/dist/prompt-builder.js.map +1 -0
  201. package/dist/prompts/orchestrator.md.js +4 -0
  202. package/dist/prompts/orchestrator.md.js.map +1 -0
  203. package/dist/query-activity-events.d.ts +42 -0
  204. package/dist/query-activity-events.d.ts.map +1 -0
  205. package/dist/query-activity-events.js +170 -0
  206. package/dist/query-activity-events.js.map +1 -0
  207. package/dist/recovery/actions.d.ts +7 -0
  208. package/dist/recovery/actions.d.ts.map +1 -0
  209. package/dist/recovery/index.d.ts +8 -0
  210. package/dist/recovery/index.d.ts.map +1 -0
  211. package/dist/recovery/logger.d.ts +12 -0
  212. package/dist/recovery/logger.d.ts.map +1 -0
  213. package/dist/recovery/manager.d.ts +24 -0
  214. package/dist/recovery/manager.d.ts.map +1 -0
  215. package/dist/recovery/scanner.d.ts +11 -0
  216. package/dist/recovery/scanner.d.ts.map +1 -0
  217. package/dist/recovery/types.d.ts +170 -0
  218. package/dist/recovery/types.d.ts.map +1 -0
  219. package/dist/recovery/validator.d.ts +8 -0
  220. package/dist/recovery/validator.d.ts.map +1 -0
  221. package/dist/report-watcher.d.ts +93 -0
  222. package/dist/report-watcher.d.ts.map +1 -0
  223. package/dist/report-watcher.js +182 -0
  224. package/dist/report-watcher.js.map +1 -0
  225. package/dist/scm-webhook-utils.d.ts +6 -0
  226. package/dist/scm-webhook-utils.d.ts.map +1 -0
  227. package/dist/scm-webhook-utils.js +36 -0
  228. package/dist/scm-webhook-utils.js.map +1 -0
  229. package/dist/session-manager.d.ts +22 -0
  230. package/dist/session-manager.d.ts.map +1 -0
  231. package/dist/session-manager.js +3077 -0
  232. package/dist/session-manager.js.map +1 -0
  233. package/dist/spawn-target.d.ts +23 -0
  234. package/dist/spawn-target.d.ts.map +1 -0
  235. package/dist/spawn-target.js +39 -0
  236. package/dist/spawn-target.js.map +1 -0
  237. package/dist/storage-key.d.ts +9 -0
  238. package/dist/storage-key.d.ts.map +1 -0
  239. package/dist/storage-key.js +59 -0
  240. package/dist/storage-key.js.map +1 -0
  241. package/dist/tmux.d.ts +39 -0
  242. package/dist/tmux.d.ts.map +1 -0
  243. package/dist/tmux.js +141 -0
  244. package/dist/tmux.js.map +1 -0
  245. package/dist/types.d.ts +1496 -0
  246. package/dist/types.d.ts.map +1 -0
  247. package/dist/types.js +215 -0
  248. package/dist/types.js.map +1 -0
  249. package/dist/update-cache.d.ts +59 -0
  250. package/dist/update-cache.d.ts.map +1 -0
  251. package/dist/update-cache.js +77 -0
  252. package/dist/update-cache.js.map +1 -0
  253. package/dist/utils/metadata-flatten.d.ts +3 -0
  254. package/dist/utils/metadata-flatten.d.ts.map +1 -0
  255. package/dist/utils/metadata-flatten.js +18 -0
  256. package/dist/utils/metadata-flatten.js.map +1 -0
  257. package/dist/utils/pr.d.ts +7 -0
  258. package/dist/utils/pr.d.ts.map +1 -0
  259. package/dist/utils/pr.js +97 -0
  260. package/dist/utils/pr.js.map +1 -0
  261. package/dist/utils/session-from-metadata.d.ts +16 -0
  262. package/dist/utils/session-from-metadata.d.ts.map +1 -0
  263. package/dist/utils/session-from-metadata.js +87 -0
  264. package/dist/utils/session-from-metadata.js.map +1 -0
  265. package/dist/utils/session-id.d.ts +4 -0
  266. package/dist/utils/session-id.d.ts.map +1 -0
  267. package/dist/utils/session-id.js +9 -0
  268. package/dist/utils/session-id.js.map +1 -0
  269. package/dist/utils/validation.d.ts +9 -0
  270. package/dist/utils/validation.d.ts.map +1 -0
  271. package/dist/utils/validation.js +45 -0
  272. package/dist/utils/validation.js.map +1 -0
  273. package/dist/utils.d.ts +65 -0
  274. package/dist/utils.d.ts.map +1 -0
  275. package/dist/utils.js +189 -0
  276. package/dist/utils.js.map +1 -0
  277. package/dist/version-compare.d.ts +27 -0
  278. package/dist/version-compare.d.ts.map +1 -0
  279. package/dist/version-compare.js +121 -0
  280. package/dist/version-compare.js.map +1 -0
  281. package/dist/windows-pty-registry.d.ts +27 -0
  282. package/dist/windows-pty-registry.d.ts.map +1 -0
  283. package/dist/windows-pty-registry.js +109 -0
  284. package/dist/windows-pty-registry.js.map +1 -0
  285. package/package.json +110 -0
@@ -0,0 +1,12 @@
1
+ const OPENCODE_SESSION_ID_RE = /^ses_[A-Za-z0-9_-]+$/;
2
+ function asValidOpenCodeSessionId(value) {
3
+ if (typeof value !== "string")
4
+ return undefined;
5
+ const trimmed = value.trim();
6
+ if (trimmed.length === 0)
7
+ return undefined;
8
+ return OPENCODE_SESSION_ID_RE.test(trimmed) ? trimmed : undefined;
9
+ }
10
+
11
+ export { asValidOpenCodeSessionId };
12
+ //# sourceMappingURL=opencode-session-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-session-id.js","sources":["../src/opencode-session-id.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAG,sBAAsB;AAE/C,SAAU,wBAAwB,CAAC,KAAc,EAAA;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC/C,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE;AAC5B,IAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,SAAS;AAC1C,IAAA,OAAO,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,SAAS;AACnE;;;;"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Shared opencode-child plumbing.
3
+ *
4
+ * This module exists for two reasons:
5
+ *
6
+ * 1. **Bounded /tmp blast radius** (issue #1046, PR #1478 review).
7
+ * Bun-bundled binaries leak `.so`/`.dylib` files into the system temp
8
+ * directory and never unlink them. Rather than sweeping all of `/tmp`
9
+ * with a regex (which would touch other users' or other apps' Bun
10
+ * artifacts), we point every `opencode` child at an AO-owned temp dir
11
+ * via `TMPDIR`. The cli-side janitor then sweeps only that directory.
12
+ *
13
+ * 2. **Single shared cache for `opencode session list`.**
14
+ * Both `@made-by-moonlight/athene-core` and the `agent-opencode` plugin previously
15
+ * kept independent module-level caches. Per poll cycle the system
16
+ * therefore spawned at least two `opencode session list` processes
17
+ * instead of one. A single cache exported from core collapses them.
18
+ */
19
+ /**
20
+ * Path that opencode children should treat as `TMPDIR`. Lives under the AO
21
+ * base dir so a stray sweep cannot touch unrelated files.
22
+ */
23
+ export declare function getOpenCodeTmpDir(): string;
24
+ /**
25
+ * Best-effort: create the AO-owned temp dir. Spawn paths call this before
26
+ * launching opencode so the child sees a real directory at `TMPDIR`.
27
+ *
28
+ * Synchronous because the spawn helpers are themselves synchronous in their
29
+ * env construction. Failures are swallowed — opencode will fall back to the
30
+ * OS default temp dir, which is the pre-PR behavior.
31
+ */
32
+ export declare function ensureOpenCodeTmpDir(): string;
33
+ /**
34
+ * Build the env passed to every spawned `opencode` child.
35
+ *
36
+ * Setting both `TMPDIR` and `TMP`/`TEMP` covers POSIX (TMPDIR) and Windows
37
+ * fallbacks. Bun honors `TMPDIR` for its embedded shared-library extraction.
38
+ */
39
+ export declare function getOpenCodeChildEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
40
+ export interface OpenCodeSessionListEntry {
41
+ id: string;
42
+ title: string;
43
+ /** Raw `updated` field as emitted by opencode (string or number). */
44
+ updated?: string | number;
45
+ /** Normalized epoch ms, parsed from `updated`. */
46
+ updatedAt?: number;
47
+ }
48
+ /**
49
+ * TTL for the `opencode session list` cache.
50
+ *
51
+ * **Why 500ms.** The send-confirmation loop in `session-manager.sendMessage`
52
+ * polls at 500ms intervals up to 6 times (~3s total). The original PR sized
53
+ * the TTL to *cover* that window (3s), which made every loop iteration return
54
+ * the same cached snapshot — the `updatedAt > baselineUpdatedAt` delivery
55
+ * signal could not fire by construction. Sizing the TTL at 500ms means each
56
+ * poll iteration sees fresh data while still collapsing tight bursts (e.g.
57
+ * lifecycle poll + UI enrichment in the same tick) onto a single child.
58
+ * Concurrent callers always share the in-flight promise regardless of TTL.
59
+ */
60
+ export declare const OPENCODE_SESSION_LIST_CACHE_TTL_MS = 500;
61
+ /**
62
+ * Fetch the opencode session list, sharing both the cached snapshot and any
63
+ * in-flight request across all callers in core and plugins.
64
+ *
65
+ * Pass `forceRefresh: true` to bypass the TTL when a write is known to have
66
+ * just landed. Concurrent callers still collapse onto the in-flight promise.
67
+ */
68
+ export declare function getCachedOpenCodeSessionList(options?: {
69
+ timeoutMs?: number;
70
+ forceRefresh?: boolean;
71
+ }): Promise<OpenCodeSessionListEntry[]>;
72
+ /**
73
+ * Drop any cached snapshot. Call this immediately after any code path that
74
+ * mutates opencode session state (delete, create) so that the next reader
75
+ * does not observe a stale entry.
76
+ */
77
+ export declare function invalidateOpenCodeSessionListCache(): void;
78
+ /** Test-only: clear the cache including any in-flight promise. */
79
+ export declare function resetOpenCodeSessionListCache(): void;
80
+ //# sourceMappingURL=opencode-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-shared.d.ts","sourceRoot":"","sources":["../src/opencode-shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAmBH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAI1C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAS7C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,GACxB,MAAM,CAAC,UAAU,CASnB;AAMD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAoDtD;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,CAAC,EAAE;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CA8CtC;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,IAAI,IAAI,CAWzD;AAED,kEAAkE;AAClE,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}
@@ -0,0 +1,202 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { mkdirSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import { getAoBaseDir } from './paths.js';
6
+ import { safeJsonParse } from './utils/validation.js';
7
+ import { asValidOpenCodeSessionId } from './opencode-session-id.js';
8
+
9
+ /**
10
+ * Shared opencode-child plumbing.
11
+ *
12
+ * This module exists for two reasons:
13
+ *
14
+ * 1. **Bounded /tmp blast radius** (issue #1046, PR #1478 review).
15
+ * Bun-bundled binaries leak `.so`/`.dylib` files into the system temp
16
+ * directory and never unlink them. Rather than sweeping all of `/tmp`
17
+ * with a regex (which would touch other users' or other apps' Bun
18
+ * artifacts), we point every `opencode` child at an AO-owned temp dir
19
+ * via `TMPDIR`. The cli-side janitor then sweeps only that directory.
20
+ *
21
+ * 2. **Single shared cache for `opencode session list`.**
22
+ * Both `@made-by-moonlight/athene-core` and the `agent-opencode` plugin previously
23
+ * kept independent module-level caches. Per poll cycle the system
24
+ * therefore spawned at least two `opencode session list` processes
25
+ * instead of one. A single cache exported from core collapses them.
26
+ */
27
+ const execFileAsync = promisify(execFile);
28
+ // -----------------------------------------------------------------------------
29
+ // AO-owned temp dir for opencode children
30
+ // -----------------------------------------------------------------------------
31
+ let cachedOpenCodeTmpDir = null;
32
+ /**
33
+ * Path that opencode children should treat as `TMPDIR`. Lives under the AO
34
+ * base dir so a stray sweep cannot touch unrelated files.
35
+ */
36
+ function getOpenCodeTmpDir() {
37
+ if (cachedOpenCodeTmpDir)
38
+ return cachedOpenCodeTmpDir;
39
+ cachedOpenCodeTmpDir = join(getAoBaseDir(), ".bun-tmp");
40
+ return cachedOpenCodeTmpDir;
41
+ }
42
+ /**
43
+ * Best-effort: create the AO-owned temp dir. Spawn paths call this before
44
+ * launching opencode so the child sees a real directory at `TMPDIR`.
45
+ *
46
+ * Synchronous because the spawn helpers are themselves synchronous in their
47
+ * env construction. Failures are swallowed — opencode will fall back to the
48
+ * OS default temp dir, which is the pre-PR behavior.
49
+ */
50
+ function ensureOpenCodeTmpDir() {
51
+ const dir = getOpenCodeTmpDir();
52
+ try {
53
+ mkdirSync(dir, { recursive: true });
54
+ }
55
+ catch {
56
+ // Best-effort. If creation fails opencode still works; we just leak to
57
+ // the system temp dir as before.
58
+ }
59
+ return dir;
60
+ }
61
+ /**
62
+ * Build the env passed to every spawned `opencode` child.
63
+ *
64
+ * Setting both `TMPDIR` and `TMP`/`TEMP` covers POSIX (TMPDIR) and Windows
65
+ * fallbacks. Bun honors `TMPDIR` for its embedded shared-library extraction.
66
+ */
67
+ function getOpenCodeChildEnv(extra) {
68
+ const dir = ensureOpenCodeTmpDir();
69
+ return {
70
+ ...process.env,
71
+ TMPDIR: dir,
72
+ TMP: dir,
73
+ TEMP: dir,
74
+ ...extra,
75
+ };
76
+ }
77
+ /**
78
+ * TTL for the `opencode session list` cache.
79
+ *
80
+ * **Why 500ms.** The send-confirmation loop in `session-manager.sendMessage`
81
+ * polls at 500ms intervals up to 6 times (~3s total). The original PR sized
82
+ * the TTL to *cover* that window (3s), which made every loop iteration return
83
+ * the same cached snapshot — the `updatedAt > baselineUpdatedAt` delivery
84
+ * signal could not fire by construction. Sizing the TTL at 500ms means each
85
+ * poll iteration sees fresh data while still collapsing tight bursts (e.g.
86
+ * lifecycle poll + UI enrichment in the same tick) onto a single child.
87
+ * Concurrent callers always share the in-flight promise regardless of TTL.
88
+ */
89
+ const OPENCODE_SESSION_LIST_CACHE_TTL_MS = 500;
90
+ const OPENCODE_SESSION_LIST_DEFAULT_TIMEOUT_MS = 30_000;
91
+ let sessionListCache = null;
92
+ function parseUpdatedToEpochMs(value) {
93
+ if (typeof value === "number" && Number.isFinite(value))
94
+ return value;
95
+ if (typeof value !== "string")
96
+ return undefined;
97
+ const trimmed = value.trim();
98
+ if (trimmed.length === 0)
99
+ return undefined;
100
+ if (/^\d+$/.test(trimmed)) {
101
+ const n = Number(trimmed);
102
+ return Number.isFinite(n) ? n : undefined;
103
+ }
104
+ const parsed = Date.parse(trimmed);
105
+ return Number.isNaN(parsed) ? undefined : parsed;
106
+ }
107
+ function parseSessionListStdout(stdout) {
108
+ const parsed = safeJsonParse(stdout);
109
+ if (!Array.isArray(parsed))
110
+ return [];
111
+ return parsed.flatMap((entry) => {
112
+ if (!entry || typeof entry !== "object")
113
+ return [];
114
+ const record = entry;
115
+ const id = asValidOpenCodeSessionId(record["id"]);
116
+ if (!id)
117
+ return [];
118
+ const title = typeof record["title"] === "string" ? record["title"] : "";
119
+ const rawUpdated = record["updated"];
120
+ const updated = typeof rawUpdated === "string" || typeof rawUpdated === "number"
121
+ ? rawUpdated
122
+ : undefined;
123
+ const updatedAt = parseUpdatedToEpochMs(rawUpdated);
124
+ return [
125
+ {
126
+ id,
127
+ title,
128
+ ...(updated !== undefined ? { updated } : {}),
129
+ ...(updatedAt !== undefined ? { updatedAt } : {}),
130
+ },
131
+ ];
132
+ });
133
+ }
134
+ /**
135
+ * Fetch the opencode session list, sharing both the cached snapshot and any
136
+ * in-flight request across all callers in core and plugins.
137
+ *
138
+ * Pass `forceRefresh: true` to bypass the TTL when a write is known to have
139
+ * just landed. Concurrent callers still collapse onto the in-flight promise.
140
+ */
141
+ async function getCachedOpenCodeSessionList(options) {
142
+ const timeoutMs = options?.timeoutMs ?? OPENCODE_SESSION_LIST_DEFAULT_TIMEOUT_MS;
143
+ const forceRefresh = options?.forceRefresh ?? false;
144
+ const now = Date.now();
145
+ if (sessionListCache) {
146
+ if (sessionListCache.promise) {
147
+ // A fetch is already in flight — every caller waits on it, even if
148
+ // they wanted a refresh.
149
+ return sessionListCache.promise;
150
+ }
151
+ if (!forceRefresh &&
152
+ now - sessionListCache.timestamp < OPENCODE_SESSION_LIST_CACHE_TTL_MS) {
153
+ return sessionListCache.entries;
154
+ }
155
+ }
156
+ const promise = execFileAsync("opencode", ["session", "list", "--format", "json"], {
157
+ timeout: timeoutMs,
158
+ env: getOpenCodeChildEnv(),
159
+ // On Windows, execFile cannot resolve .cmd shim extensions without
160
+ // invoking the shell; windowsHide:true suppresses the conhost popup.
161
+ ...(process.platform === "win32" ? { shell: true, windowsHide: true } : {}),
162
+ })
163
+ .then(({ stdout }) => {
164
+ const entries = parseSessionListStdout(stdout);
165
+ if (sessionListCache?.promise === promise) {
166
+ sessionListCache = { entries, timestamp: Date.now() };
167
+ }
168
+ return entries;
169
+ })
170
+ .catch(() => {
171
+ if (sessionListCache?.promise === promise) {
172
+ sessionListCache = null;
173
+ }
174
+ return [];
175
+ });
176
+ sessionListCache = { entries: [], timestamp: now, promise };
177
+ return promise;
178
+ }
179
+ /**
180
+ * Drop any cached snapshot. Call this immediately after any code path that
181
+ * mutates opencode session state (delete, create) so that the next reader
182
+ * does not observe a stale entry.
183
+ */
184
+ function invalidateOpenCodeSessionListCache() {
185
+ // If a fetch is currently in flight we leave it alone — its result is
186
+ // about to land and a fresh fetch on top of it would be wasted work.
187
+ // Subsequent callers will see a stale snapshot for at most one tick;
188
+ // this is acceptable because the in-flight result already reflects state
189
+ // captured after the mutation began.
190
+ if (sessionListCache?.promise) {
191
+ sessionListCache = { ...sessionListCache, timestamp: 0 };
192
+ return;
193
+ }
194
+ sessionListCache = null;
195
+ }
196
+ /** Test-only: clear the cache including any in-flight promise. */
197
+ function resetOpenCodeSessionListCache() {
198
+ sessionListCache = null;
199
+ }
200
+
201
+ export { OPENCODE_SESSION_LIST_CACHE_TTL_MS, ensureOpenCodeTmpDir, getCachedOpenCodeSessionList, getOpenCodeChildEnv, getOpenCodeTmpDir, invalidateOpenCodeSessionListCache, resetOpenCodeSessionListCache };
202
+ //# sourceMappingURL=opencode-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-shared.js","sources":["../src/opencode-shared.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AAWH,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC;AAEzC;AACA;AACA;AAEA,IAAI,oBAAoB,GAAkB,IAAI;AAE9C;;;AAGG;SACa,iBAAiB,GAAA;AAC/B,IAAA,IAAI,oBAAoB;AAAE,QAAA,OAAO,oBAAoB;IACrD,oBAAoB,GAAG,IAAI,C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,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE;AAC3D,IAAA,OAAO,OAAO;AAChB;AAEA;;;;AAIG;SACa,kCAAkC,GAAA;;;;;;AAMhD,IAAA,IAAI,gBAAgB,EAAE,OAAO,EAAE;QAC7B,gBAAgB,GAAG,EAAE,GAAG,gBAAgB,EAAE,SAAS,EAAE,CAAC,EAAE;QACxD;IACF;IACA,gBAAgB,GAAG,IAAI;AACzB;AAEA;SACgB,6BAA6B,GAAA;IAC3C,gBAAgB,GAAG,IAAI;AACzB;;;;"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Orchestrator Prompt Generator - generates orchestrator prompt content.
3
+ *
4
+ * This is injected via `athene start` to provide orchestrator-specific context
5
+ * when the orchestrator agent runs.
6
+ */
7
+ import type { OrchestratorConfig, ProjectConfig } from "./types.js";
8
+ export interface OrchestratorPromptConfig {
9
+ config: OrchestratorConfig;
10
+ projectId: string;
11
+ project: ProjectConfig;
12
+ }
13
+ /**
14
+ * Generate orchestrator prompt content.
15
+ * Provides orchestrator agent with context about available commands,
16
+ * session management workflows, and project configuration.
17
+ */
18
+ export declare function generateOrchestratorPrompt(opts: OrchestratorPromptConfig): string;
19
+ //# sourceMappingURL=orchestrator-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-prompt.d.ts","sourceRoot":"","sources":["../src/orchestrator-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;CACxB;AAyKD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM,CAUjF"}
@@ -0,0 +1,130 @@
1
+ import orchestratorTemplate from './prompts/orchestrator.md.js';
2
+
3
+ /**
4
+ * Orchestrator Prompt Generator - generates orchestrator prompt content.
5
+ *
6
+ * This is injected via `athene start` to provide orchestrator-specific context
7
+ * when the orchestrator agent runs.
8
+ */
9
+ function buildAutomatedReactionsSection(project) {
10
+ const markdownBold = String.fromCharCode(42).repeat(2);
11
+ const bold = (text) => `${markdownBold}${text}${markdownBold}`;
12
+ const reactionLines = [];
13
+ for (const [event, reaction] of Object.entries(project.reactions ?? {})) {
14
+ if (reaction.auto && reaction.action === "send-to-agent") {
15
+ reactionLines.push(`- ${bold(event)}: Auto-sends instruction to agent (retries: ${reaction.retries ?? "none"}, escalates after: ${reaction.escalateAfter ?? "never"})`);
16
+ continue;
17
+ }
18
+ if (reaction.auto && reaction.action === "notify") {
19
+ reactionLines.push(`- ${bold(event)}: Notifies human (priority: ${reaction.priority ?? "info"})`);
20
+ }
21
+ }
22
+ if (reactionLines.length === 0) {
23
+ return "";
24
+ }
25
+ return reactionLines.join("\n");
26
+ }
27
+ function buildProjectSpecificRulesSection(project) {
28
+ const rules = project.orchestratorRules?.trim();
29
+ if (!rules) {
30
+ return "";
31
+ }
32
+ return rules;
33
+ }
34
+ function removeOptionalSectionBlocks(template, data) {
35
+ const templates = [
36
+ ["REPO_CONFIGURED_SECTION_START", "REPO_CONFIGURED_SECTION_END", data.repoConfiguredSection],
37
+ ["REPO_NOT_CONFIGURED_SECTION_START", "REPO_NOT_CONFIGURED_SECTION_END", data.repoNotConfiguredSection],
38
+ ["AUTOMATED_REACTIONS_SECTION_START", "AUTOMATED_REACTIONS_SECTION_END", data.automatedReactionsSection],
39
+ ["PROJECT_SPECIFIC_RULES_SECTION_START", "PROJECT_SPECIFIC_RULES_SECTION_END", data.projectSpecificRulesSection],
40
+ ];
41
+ let interpolated = template;
42
+ for (const [startKey, endKey, section] of templates) {
43
+ const startMarker = `{{${startKey}}}`;
44
+ const endMarker = `{{${endKey}}}`;
45
+ while (true) {
46
+ const start = interpolated.indexOf(startMarker);
47
+ const end = interpolated.indexOf(endMarker);
48
+ if (start === -1 && end === -1) {
49
+ break;
50
+ }
51
+ if (start === -1 || end === -1 || end < start) {
52
+ throw new Error(`Malformed optional section block: expected ${startMarker} before ${endMarker}`);
53
+ }
54
+ const fullStart = start;
55
+ const fullEnd = end + endMarker.length;
56
+ const blockContent = interpolated.slice(start + startMarker.length, end);
57
+ // Optional sections are flat by design. Reject nesting of the same block
58
+ // type so future template edits fail loudly instead of matching ambiguously.
59
+ if (blockContent.includes(startMarker)) {
60
+ throw new Error(`Nested optional section blocks are not supported: ${startMarker} before ${endMarker}`);
61
+ }
62
+ const replacement = section ? blockContent : "";
63
+ const before = interpolated.slice(0, fullStart);
64
+ const after = interpolated.slice(fullEnd);
65
+ interpolated = replacement
66
+ ? before + replacement + after
67
+ : collapseOptionalGap(before, after);
68
+ }
69
+ }
70
+ return interpolated;
71
+ }
72
+ function collapseOptionalGap(before, after) {
73
+ const trailingNewlines = before.match(/\n*$/)?.[0] ?? "";
74
+ const leadingNewlines = after.match(/^\n*/)?.[0] ?? "";
75
+ const totalNewlines = trailingNewlines.length + leadingNewlines.length;
76
+ const boundary = totalNewlines >= 2 ? "\n\n" : trailingNewlines + leadingNewlines;
77
+ return (before.slice(0, before.length - trailingNewlines.length) +
78
+ boundary +
79
+ after.slice(leadingNewlines.length));
80
+ }
81
+ function hasRenderDataKey(data, key) {
82
+ return Object.prototype.hasOwnProperty.call(data, key);
83
+ }
84
+ function createRenderData(opts) {
85
+ const { config, projectId, project } = opts;
86
+ const hasRepo = Boolean(project.repo);
87
+ return {
88
+ projectId,
89
+ projectName: project.name,
90
+ projectRepo: project.repo ?? "not configured",
91
+ projectDefaultBranch: project.defaultBranch,
92
+ projectSessionPrefix: project.sessionPrefix,
93
+ projectPath: project.path,
94
+ dashboardPort: String(config.port ?? 3000),
95
+ automatedReactionsSection: buildAutomatedReactionsSection(project),
96
+ projectSpecificRulesSection: buildProjectSpecificRulesSection(project),
97
+ repoConfiguredSection: hasRepo ? "true" : "",
98
+ repoNotConfiguredSection: hasRepo ? "" : "true",
99
+ };
100
+ }
101
+ function renderTemplate(template, data) {
102
+ const unresolvedPlaceholder = template
103
+ .replace(/\{\{([a-zA-Z0-9_]+)\}\}/g, "")
104
+ .match(/\{\{[^}]+\}\}/);
105
+ if (unresolvedPlaceholder) {
106
+ throw new Error(`Unresolved template placeholder: ${unresolvedPlaceholder[0]}`);
107
+ }
108
+ return template.replace(/\{\{([a-zA-Z0-9_]+)\}\}/g, (_match, rawKey) => {
109
+ if (!hasRenderDataKey(data, rawKey)) {
110
+ throw new Error(`Unresolved template placeholder: ${rawKey}`);
111
+ }
112
+ return data[rawKey];
113
+ });
114
+ }
115
+ function finalizeRenderedPrompt(prompt) {
116
+ return prompt.trim();
117
+ }
118
+ /**
119
+ * Generate orchestrator prompt content.
120
+ * Provides orchestrator agent with context about available commands,
121
+ * session management workflows, and project configuration.
122
+ */
123
+ function generateOrchestratorPrompt(opts) {
124
+ const data = createRenderData(opts);
125
+ const templateWithOptionalSections = removeOptionalSectionBlocks(orchestratorTemplate.trim(), data);
126
+ return finalizeRenderedPrompt(renderTemplate(templateWithOptionalSections, data));
127
+ }
128
+
129
+ export { generateOrchestratorPrompt };
130
+ //# sourceMappingURL=orchestrator-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-prompt.js","sources":["../src/orchestrator-prompt.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AA2BH,SAAS,8BAA8B,CAAC,OAAsB,EAAA;AAC5D,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtD,IAAA,MAAM,IAAI,GAAG,CAAC,IAAY,KAAa,CAAA,EAAG,YAAY,CAAA,EAAG,IAAI,CAAA,EAAG,YAAY,EAAE;IAE9E,MAAM,aAAa,GAAa,EAAE;AAElC,IAAA,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IA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;IAED,OAAO,sBAAsB,CAC3B,cAAc,CAAC,4BAA4B,EAAE,IAAI,CAAC,CACnD;AACH;;;;"}
@@ -0,0 +1,5 @@
1
+ import type { ProjectConfig } from "./types.js";
2
+ export type NormalizedOrchestratorSessionStrategy = "reuse" | "delete" | "ignore";
3
+ export declare function getOrchestratorSessionId(project: Pick<ProjectConfig, "sessionPrefix">): string;
4
+ export declare function normalizeOrchestratorSessionStrategy(strategy: ProjectConfig["orchestratorSessionStrategy"] | undefined): NormalizedOrchestratorSessionStrategy;
5
+ //# sourceMappingURL=orchestrator-session-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-session-strategy.d.ts","sourceRoot":"","sources":["../src/orchestrator-session-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,qCAAqC,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,GAAG,MAAM,CAE9F;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,aAAa,CAAC,6BAA6B,CAAC,GAAG,SAAS,GACjE,qCAAqC,CAIvC"}
@@ -0,0 +1,13 @@
1
+ function getOrchestratorSessionId(project) {
2
+ return `${project.sessionPrefix}-orchestrator`;
3
+ }
4
+ function normalizeOrchestratorSessionStrategy(strategy) {
5
+ if (strategy === "kill-previous" || strategy === "delete-new")
6
+ return "delete";
7
+ if (strategy === "ignore-new")
8
+ return "ignore";
9
+ return strategy ?? "reuse";
10
+ }
11
+
12
+ export { getOrchestratorSessionId, normalizeOrchestratorSessionStrategy };
13
+ //# sourceMappingURL=orchestrator-session-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-session-strategy.js","sources":["../src/orchestrator-session-strategy.ts"],"sourcesContent":[null],"names":[],"mappings":"AAIM,SAAU,wBAAwB,CAAC,OAA6C,EAAA;AACpF,IAAA,OAAO,CAAA,EAAG,OAAO,CAAC,aAAa,eAAe;AAChD;AAEM,SAAU,oCAAoC,CAClD,QAAkE,EAAA;AAElE,IAAA,IAAI,QAAQ,KAAK,eAAe,IAAI,QAAQ,KAAK,YAAY;AAAE,QAAA,OAAO,QAAQ;IAC9E,IAAI,QAAQ,KAAK,YAAY;AAAE,QAAA,OAAO,QAAQ;IAC9C,OAAO,QAAQ,IAAI,OAAO;AAC5B;;;;"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Path utilities for the AO storage directory structure.
3
+ *
4
+ * V2 layout (projects/{projectId}/):
5
+ * getProjectDir(projectId) → ~/.agent-orchestrator/projects/{projectId}
6
+ * getProjectSessionsDir(projectId) → .../projects/{projectId}/sessions
7
+ * getProjectWorktreesDir(projectId) → .../projects/{projectId}/worktrees
8
+ * getOrchestratorPath(projectId) → .../projects/{projectId}/orchestrator.json
9
+ * getSessionPath(projectId, sid) → .../projects/{projectId}/sessions/{sid}.json
10
+ *
11
+ * Legacy layout ({storageKey}/):
12
+ * getProjectBaseDir(storageKey) → ~/.agent-orchestrator/{storageKey}
13
+ * getSessionsDir(storageKey) → ~/.agent-orchestrator/{storageKey}/sessions
14
+ * ... (deprecated, kept for migration only)
15
+ */
16
+ /**
17
+ * Generate a 12-character hash from a config directory path.
18
+ *
19
+ * The hash is derived from dirname(configPath), which equals the project root
20
+ * directory when configPath is <project>/agent-orchestrator.yaml.
21
+ *
22
+ * Handles non-existent paths gracefully (e.g. synthesized paths in remote/
23
+ * Docker mode where no local config file exists) by falling back to
24
+ * resolve() when realpathSync fails.
25
+ */
26
+ export declare function generateConfigHash(configPath: string): string;
27
+ /**
28
+ * Generate project ID from project path (basename of the path).
29
+ * Example: ~/repos/integrator → "integrator"
30
+ *
31
+ * @deprecated New project registrations use generateExternalId() from global-config.ts.
32
+ */
33
+ export declare function generateProjectId(projectPath: string): string;
34
+ /**
35
+ * Generate session prefix from project ID using clean heuristics.
36
+ *
37
+ * Rules:
38
+ * 1. ≤4 chars: use as-is (lowercase)
39
+ * 2. CamelCase: extract uppercase letters (PyTorch → pt)
40
+ * 3. kebab/snake case: use initials (agent-orchestrator → ao)
41
+ * 4. Single word: first 3 chars (integrator → int)
42
+ */
43
+ export declare function generateSessionPrefix(projectId: string): string;
44
+ /** Get the project directory by project ID. */
45
+ export declare function getProjectDir(projectId: string): string;
46
+ /** Get the sessions directory for a project (workers only). */
47
+ export declare function getProjectSessionsDir(projectId: string): string;
48
+ /** Get the worktrees directory for a project. */
49
+ export declare function getProjectWorktreesDir(projectId: string): string;
50
+ /** Get the AO-local code review store directory for a project. */
51
+ export declare function getProjectCodeReviewsDir(projectId: string): string;
52
+ /** Get the feedback reports directory for a project (V2 layout). */
53
+ export declare function getProjectFeedbackReportsDir(projectId: string): string;
54
+ /** Get the orchestrator metadata file path for a project. */
55
+ export declare function getOrchestratorPath(projectId: string): string;
56
+ /** Get the session metadata file path (.json). */
57
+ export declare function getSessionPath(projectId: string, sessionId: string): string;
58
+ /**
59
+ * @deprecated Use getProjectDir(projectId) instead.
60
+ * Get the project base directory for a storage key.
61
+ * Format: ~/.agent-orchestrator/{storageKey}
62
+ */
63
+ export declare function getProjectBaseDir(storageKey: string | undefined): string;
64
+ /**
65
+ * Get the shared observability base directory for a config.
66
+ * Format: ~/.agent-orchestrator/{hash}-observability
67
+ */
68
+ export declare function getObservabilityBaseDir(configPath: string): string;
69
+ /**
70
+ * @deprecated Use getProjectSessionsDir(projectId) instead.
71
+ * Get the sessions directory for a project.
72
+ */
73
+ export declare function getSessionsDir(storageKey: string | undefined): string;
74
+ /**
75
+ * @deprecated Use getProjectWorktreesDir(projectId) instead.
76
+ * Get the worktrees directory for a project.
77
+ */
78
+ export declare function getWorktreesDir(storageKey: string | undefined): string;
79
+ /**
80
+ * @deprecated Use getProjectFeedbackReportsDir(projectId) instead.
81
+ * Get the feedback reports directory for a project.
82
+ */
83
+ export declare function getFeedbackReportsDir(storageKey: string | undefined): string;
84
+ /**
85
+ * @deprecated Legacy archive directory — archive system removed.
86
+ * Get the archive directory for a project (legacy: nested inside sessions/).
87
+ */
88
+ export declare function getArchiveDir(storageKey: string | undefined): string;
89
+ /**
90
+ * @deprecated No longer needed — collision detection by storageKey is removed.
91
+ * Get the .origin file path for a project.
92
+ */
93
+ export declare function getOriginFilePath(storageKey: string | undefined): string;
94
+ /**
95
+ * Generate user-facing session name.
96
+ * Format: {prefix}-{num}
97
+ * Example: "int-1", "ao-42"
98
+ */
99
+ export declare function generateSessionName(prefix: string, num: number): string;
100
+ /**
101
+ * @deprecated Session prefixes are globally unique — hash prefix is no longer needed.
102
+ * Use generateSessionName(prefix, num) instead (same output as the new tmux name).
103
+ *
104
+ * Generate tmux session name (legacy format with hash).
105
+ * Format: {storageKey}-{prefix}-{num}
106
+ * Example: "a3b4c5d6e7f8-int-1"
107
+ */
108
+ export declare function generateTmuxName(storageKey: string | undefined, prefix: string, num: number): string;
109
+ /**
110
+ * @deprecated Use parseTmuxNameV2 instead.
111
+ * Parse a legacy tmux session name (with hash prefix).
112
+ */
113
+ export declare function parseTmuxName(tmuxName: string): {
114
+ hash: string;
115
+ prefix: string;
116
+ num: number;
117
+ } | null;
118
+ /**
119
+ * Parse a V2 tmux session name (no hash prefix, same as session name).
120
+ * Format: {prefix}-{num} e.g. "ao-84", "my-app-1"
121
+ * Prefix must match sessionPrefix validation: [a-zA-Z0-9_-]+
122
+ */
123
+ export declare function parseTmuxNameV2(tmuxName: string): {
124
+ prefix: string;
125
+ num: number;
126
+ } | null;
127
+ /**
128
+ * Expand ~ to home directory.
129
+ */
130
+ export declare function expandHome(filepath: string): string;
131
+ /** Get the base AO directory (~/.agent-orchestrator/) */
132
+ export declare function getAoBaseDir(): string;
133
+ /** Get the portfolio directory (~/.agent-orchestrator/portfolio/) */
134
+ export declare function getPortfolioDir(): string;
135
+ /** Get the portfolio preferences file path */
136
+ export declare function getPreferencesPath(): string;
137
+ /** Get the portfolio registered projects file path */
138
+ export declare function getRegisteredPath(): string;
139
+ /**
140
+ * @deprecated No longer needed — storageKey and .origin collision detection are removed.
141
+ * Validate and store the .origin file for a project.
142
+ */
143
+ export declare function validateAndStoreOrigin(configPath: string, storageKey: string): void;
144
+ export declare function requireStorageKey(storageKey: string | undefined): string;
145
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAuB/D;AAyBD,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,+DAA+D;AAC/D,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,iDAAiD;AACjD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,oEAAoE;AACpE,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AAMD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GA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