@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 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/recovery/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EAGf,MAAM,aAAa,CAAC;AAWrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA0CtF,wBAAsB,cAAc,CAClC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAkHzB;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAyEzB;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAsDzB;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAgBzB"}
@@ -0,0 +1,8 @@
1
+ export type { RecoveryClassification, RecoveryAction, RecoveryAssessment, RecoveryResult, RecoveryReport, RecoveryLogEntry, RecoveryConfig, RecoveryContext, } from "./types.js";
2
+ export { DEFAULT_RECOVERY_CONFIG } from "./types.js";
3
+ export { scanAllSessions, getRecoveryLogPath, type ScannedSession } from "./scanner.js";
4
+ export { validateSession, classifySession, determineAction } from "./validator.js";
5
+ export { recoverSession, cleanupSession, escalateSession, executeAction } from "./actions.js";
6
+ export { writeRecoveryLog, createLogEntry, formatRecoveryReport, createEmptyReport, } from "./logger.js";
7
+ export { runRecovery, recoverSessionById, type RecoveryManagerOptions, type RecoveryRunResult, } from "./manager.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recovery/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9F,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { SessionId, SessionStatus } from "../types.js";
2
+ import type { RecoveryLogEntry, RecoveryReport } from "./types.js";
3
+ export declare function writeRecoveryLog(logPath: string, entry: RecoveryLogEntry): void;
4
+ export declare function createLogEntry(sessionId: SessionId, action: RecoveryLogEntry["action"], options?: {
5
+ previousStatus?: SessionStatus;
6
+ reason?: string;
7
+ error?: string;
8
+ details?: Record<string, unknown>;
9
+ }): RecoveryLogEntry;
10
+ export declare function formatRecoveryReport(report: RecoveryReport): string;
11
+ export declare function createEmptyReport(): RecoveryReport;
12
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/recovery/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAO/E;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAClC,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GACA,gBAAgB,CAOlB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAgCnE;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAWlD"}
@@ -0,0 +1,24 @@
1
+ import type { OrchestratorConfig, PluginRegistry, Session } from "../types.js";
2
+ import { type RecoveryReport, type RecoveryResult, type RecoveryAssessment, type RecoveryConfig } from "./types.js";
3
+ export interface RecoveryManagerOptions {
4
+ config: OrchestratorConfig;
5
+ registry: PluginRegistry;
6
+ recoveryConfig?: Partial<RecoveryConfig>;
7
+ dryRun?: boolean;
8
+ projectFilter?: string;
9
+ /**
10
+ * Called after each metadata mutation performed by recovery actions.
11
+ * Pass `sessionManager.invalidateCache` when wiring recovery into a
12
+ * surface that also reads from listCached() (dashboard, SSE).
13
+ */
14
+ invalidateCache?: () => void;
15
+ }
16
+ export interface RecoveryRunResult {
17
+ report: RecoveryReport;
18
+ assessments: RecoveryAssessment[];
19
+ results: RecoveryResult[];
20
+ recoveredSessions: Session[];
21
+ }
22
+ export declare function runRecovery(options: RecoveryManagerOptions): Promise<RecoveryRunResult>;
23
+ export declare function recoverSessionById(sessionId: string, options: RecoveryManagerOptions): Promise<RecoveryResult | null>;
24
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/recovery/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAM/E,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,iBAAiB,EAAE,OAAO,EAAE,CAAC;CAC9B;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmG7F;AA6CD,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8ChC"}
@@ -0,0 +1,11 @@
1
+ import type { SessionId, OrchestratorConfig, ProjectConfig } from "../types.js";
2
+ export interface ScannedSession {
3
+ sessionId: SessionId;
4
+ projectId: string;
5
+ project: ProjectConfig;
6
+ sessionsDir: string;
7
+ rawMetadata: Record<string, string>;
8
+ }
9
+ export declare function scanAllSessions(config: OrchestratorConfig, projectIdFilter?: string): ScannedSession[];
10
+ export declare function getRecoveryLogPath(_configPath: string, projectId?: string): string;
11
+ //# sourceMappingURL=scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/recovery/scanner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIhF,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,eAAe,CAAC,EAAE,MAAM,GACvB,cAAc,EAAE,CAwBlB;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAMlF"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Recovery Types — Session classification and recovery result types.
3
+ *
4
+ * Part of the orchestrator recovery automation system (Issue #356).
5
+ * These types define how sessions are classified and what actions are taken.
6
+ */
7
+ import type { SessionId, SessionStatus, Session, RuntimeHandle, ActivityState } from "../types.js";
8
+ /**
9
+ * Classification of a session's recoverability state.
10
+ *
11
+ * - live: Session is running normally, just needs to be re-registered
12
+ * - dead: Runtime is gone, needs cleanup
13
+ * - partial: Some components exist but session is incomplete
14
+ * - unrecoverable: Session is in a terminal state (merged, done) - skip
15
+ */
16
+ export type RecoveryClassification = "live" | "dead" | "partial" | "unrecoverable";
17
+ /**
18
+ * Action to take for a session during recovery.
19
+ *
20
+ * - recover: Restore session to in-memory state
21
+ * - cleanup: Remove runtime/workspace, archive metadata
22
+ * - escalate: Requires manual intervention
23
+ * - skip: No action needed
24
+ */
25
+ export type RecoveryAction = "recover" | "cleanup" | "escalate" | "skip";
26
+ /**
27
+ * Assessment of a session's state for recovery purposes.
28
+ */
29
+ export interface RecoveryAssessment {
30
+ /** Session ID being assessed */
31
+ sessionId: SessionId;
32
+ /** Project ID this session belongs to */
33
+ projectId: string;
34
+ /** Overall classification */
35
+ classification: RecoveryClassification;
36
+ /** Recommended action */
37
+ action: RecoveryAction;
38
+ /** Human-readable reason for classification */
39
+ reason: string;
40
+ /** Whether the runtime probe itself succeeded */
41
+ runtimeProbeSucceeded: boolean;
42
+ /** Whether the process probe itself succeeded */
43
+ processProbeSucceeded: boolean;
44
+ /** Whether the signals disagree strongly enough to block cleanup */
45
+ signalDisagreement: boolean;
46
+ /** Whether recovery can proceed automatically, needs a human, or should be skipped */
47
+ recoveryRule: "auto" | "human" | "skip";
48
+ /** Whether the runtime (tmux/docker) is alive */
49
+ runtimeAlive: boolean;
50
+ /** Runtime handle if available */
51
+ runtimeHandle: RuntimeHandle | null;
52
+ /** Whether the workspace directory exists */
53
+ workspaceExists: boolean;
54
+ /** Workspace path if known */
55
+ workspacePath: string | null;
56
+ /** Whether the agent process appears to be running */
57
+ agentProcessRunning: boolean;
58
+ /** Detected agent activity state */
59
+ agentActivity: ActivityState | null;
60
+ /** Whether metadata file is valid/readable */
61
+ metadataValid: boolean;
62
+ /** Current status from metadata */
63
+ metadataStatus: SessionStatus;
64
+ /** Raw metadata key-value pairs */
65
+ rawMetadata: Record<string, string>;
66
+ }
67
+ /**
68
+ * Result of attempting to recover a single session.
69
+ */
70
+ export interface RecoveryResult {
71
+ /** Whether the operation succeeded */
72
+ success: boolean;
73
+ /** Session ID that was processed */
74
+ sessionId: SessionId;
75
+ /** Action that was taken */
76
+ action: RecoveryAction;
77
+ /** Recovered session object (only for 'recover' action) */
78
+ session?: Session;
79
+ /** Whether manual intervention is required */
80
+ requiresManualIntervention?: boolean;
81
+ reason?: string;
82
+ /** Error message if operation failed */
83
+ error?: string;
84
+ }
85
+ /**
86
+ * Summary report of a recovery operation.
87
+ */
88
+ export interface RecoveryReport {
89
+ /** When the recovery was run */
90
+ timestamp: Date;
91
+ /** Total sessions scanned */
92
+ totalScanned: number;
93
+ /** Sessions that were recovered (live, restored to memory) */
94
+ recovered: SessionId[];
95
+ /** Sessions that were cleaned up (dead, resources removed) */
96
+ cleanedUp: SessionId[];
97
+ /** Sessions that require manual intervention */
98
+ escalated: SessionId[];
99
+ /** Sessions that were skipped (no action needed) */
100
+ skipped: SessionId[];
101
+ /** Errors encountered during recovery */
102
+ errors: Array<{
103
+ sessionId: SessionId;
104
+ error: string;
105
+ }>;
106
+ /** Time taken for recovery in milliseconds */
107
+ durationMs: number;
108
+ }
109
+ /**
110
+ * Entry in the recovery log.
111
+ */
112
+ export interface RecoveryLogEntry {
113
+ /** ISO timestamp */
114
+ timestamp: string;
115
+ /** Session ID */
116
+ sessionId: SessionId;
117
+ /** Action taken */
118
+ action: "recovered" | "cleaned_up" | "escalated" | "skipped" | "error";
119
+ /** Previous status (for recovered sessions) */
120
+ previousStatus?: SessionStatus;
121
+ /** Reason for action (for cleanup/escalate) */
122
+ reason?: string;
123
+ /** Error message (for error action) */
124
+ error?: string;
125
+ /** Additional details */
126
+ details?: Record<string, unknown>;
127
+ }
128
+ /**
129
+ * Configuration for recovery behavior.
130
+ */
131
+ export interface RecoveryConfig {
132
+ /** Enable automatic recovery on orchestrator startup */
133
+ enabled: boolean;
134
+ /** Maximum time for recovery phase in milliseconds */
135
+ timeoutMs: number;
136
+ /** Number of concurrent validation tasks */
137
+ parallelValidation: number;
138
+ /** Path to recovery log file */
139
+ logPath: string;
140
+ /** Automatically cleanup dead sessions */
141
+ autoCleanup: boolean;
142
+ /** Escalate partial sessions (vs. auto-cleanup) */
143
+ escalatePartial: boolean;
144
+ /** Maximum recovery attempts before escalating */
145
+ maxRecoveryAttempts: number;
146
+ }
147
+ /**
148
+ * Default recovery configuration.
149
+ */
150
+ export declare const DEFAULT_RECOVERY_CONFIG: RecoveryConfig;
151
+ /**
152
+ * Context passed to recovery functions.
153
+ */
154
+ export interface RecoveryContext {
155
+ /** Root config path for the orchestrator */
156
+ configPath: string;
157
+ /** Recovery configuration */
158
+ recoveryConfig: RecoveryConfig;
159
+ /** Whether this is a dry run (no actual changes) */
160
+ dryRun: boolean;
161
+ /**
162
+ * Invoked after every metadata mutation performed by recovery actions
163
+ * (recover/cleanup/escalate). Callers that rely on SessionManager's
164
+ * listCached() cache should pass `sessionManager.invalidateCache` here
165
+ * so the dashboard sees recovery results immediately instead of waiting
166
+ * for the 35s TTL. Optional — omitted callers get a no-op.
167
+ */
168
+ invalidateCache?: () => void;
169
+ }
170
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/recovery/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,eAAe,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,SAAS,EAAE,SAAS,CAAC;IAErB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAElB,6BAA6B;IAC7B,cAAc,EAAE,sBAAsB,CAAC;IAEvC,yBAAyB;IACzB,MAAM,EAAE,cAAc,CAAC;IAEvB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,qBAAqB,EAAE,OAAO,CAAC;IAE/B,iDAAiD;IACjD,qBAAqB,EAAE,OAAO,CAAC;IAE/B,oEAAoE;IACpE,kBAAkB,EAAE,OAAO,CAAC;IAE5B,sFAAsF;IACtF,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAIxC,iDAAiD;IACjD,YAAY,EAAE,OAAO,CAAC;IAEtB,kCAAkC;IAClC,aAAa,EAAE,aAA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type PluginRegistry, type SessionStatus } from "../types.js";
2
+ import type { ScannedSession } from "./scanner.js";
3
+ import { type RecoveryAssessment, type RecoveryClassification, type RecoveryAction, type RecoveryConfig } from "./types.js";
4
+ export declare function validateSession(scanned: ScannedSession, config: OrchestratorConfig, registry: PluginRegistry, recoveryConfigInput?: Partial<RecoveryConfig>): Promise<RecoveryAssessment>;
5
+ declare function classifySession(runtimeAlive: boolean, workspaceExists: boolean, agentProcessRunning: boolean, metadataStatus: SessionStatus, runtimeProbeSucceeded: boolean, processProbeSucceeded: boolean, hasRuntimeHandle: boolean): RecoveryClassification;
6
+ declare function determineAction(classification: RecoveryClassification, _metadataStatus: SessionStatus, recoveryConfig: RecoveryConfig, recoveryRule: "auto" | "human" | "skip"): RecoveryAction;
7
+ export { classifySession, determineAction };
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/recovery/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAKnB,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAepB,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc,EACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAC5C,OAAO,CAAC,kBAAkB,CAAC,CA6J7B;AAED,iBAAS,eAAe,CACtB,YAAY,EAAE,OAAO,EACrB,eAAe,EAAE,OAAO,EACxB,mBAAmB,EAAE,OAAO,EAC5B,cAAc,EAAE,aAAa,EAC7B,qBAAqB,EAAE,OAAO,EAC9B,qBAAqB,EAAE,OAAO,EAC9B,gBAAgB,EAAE,OAAO,GACxB,sBAAsB,CA8BxB;AAwBD,iBAAS,eAAe,CACtB,cAAc,EAAE,sBAAsB,EACtC,eAAe,EAAE,aAAa,EAC9B,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GACtC,cAAc,CAmBhB;AA+BD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Report Watcher — Background trigger system for agent reports (#140)
3
+ *
4
+ * Monitors agent reports and triggers actions when anomalies are detected:
5
+ * - No acknowledge timeout: agent didn't acknowledge task after spawn
6
+ * - Stale report: agent hasn't reported in a while
7
+ * - Agent blocked: agent reported blocked/needs_input state
8
+ *
9
+ * This module is designed to be called from the lifecycle-manager polling loop.
10
+ */
11
+ import type { Session } from "./types.js";
12
+ import { type AgentReport } from "./agent-report.js";
13
+ /**
14
+ * Report watcher trigger types.
15
+ */
16
+ export type ReportWatcherTrigger = "no_acknowledge" | "stale_report" | "agent_needs_input";
17
+ /**
18
+ * Result of a report audit check.
19
+ */
20
+ export interface ReportAuditResult {
21
+ /** Which trigger was activated, if any. */
22
+ trigger: ReportWatcherTrigger | null;
23
+ /** Human-readable description of the finding. */
24
+ message: string;
25
+ /** ISO timestamp when the check was performed. */
26
+ checkedAt: string;
27
+ /** The agent report that was checked (if available). */
28
+ report: AgentReport | null;
29
+ /** Time since spawn in milliseconds. */
30
+ timeSinceSpawnMs?: number;
31
+ /** Time since last report in milliseconds. */
32
+ timeSinceReportMs?: number;
33
+ }
34
+ /**
35
+ * Configuration for report watcher thresholds.
36
+ */
37
+ export interface ReportWatcherConfig {
38
+ /** Time after spawn before triggering no-acknowledge (default: 10 minutes). */
39
+ acknowledgeTimeoutMs: number;
40
+ /** Time without reports before triggering stale report (default: 30 minutes). */
41
+ staleReportTimeoutMs: number;
42
+ /** Whether to check for acknowledge timeout. */
43
+ checkAcknowledge: boolean;
44
+ /** Whether to check for stale reports. */
45
+ checkStale: boolean;
46
+ /** Whether to check for blocked agents. */
47
+ checkBlocked: boolean;
48
+ }
49
+ /**
50
+ * Default report watcher configuration.
51
+ */
52
+ export declare const DEFAULT_REPORT_WATCHER_CONFIG: ReportWatcherConfig;
53
+ /**
54
+ * Check if a session should be audited for report issues.
55
+ * Note: spawning sessions are included so acknowledge timeout can fire.
56
+ */
57
+ export declare function shouldAuditSession(session: Session): boolean;
58
+ /**
59
+ * Check for acknowledge timeout: agent didn't acknowledge task within threshold.
60
+ */
61
+ export declare function checkAcknowledgeTimeout(session: Session, report: AgentReport | null, now: Date, config: ReportWatcherConfig): ReportAuditResult | null;
62
+ /**
63
+ * Check for stale report: agent hasn't reported in a while.
64
+ */
65
+ export declare function checkStaleReport(session: Session, report: AgentReport | null, now: Date, config: ReportWatcherConfig): ReportAuditResult | null;
66
+ /**
67
+ * Check for blocked agent: agent reported blocked or needs_input state.
68
+ */
69
+ export declare function checkBlockedAgent(_session: Session, report: AgentReport | null, now: Date, config: ReportWatcherConfig): ReportAuditResult | null;
70
+ /**
71
+ * Audit a session's agent reports for issues.
72
+ * Returns the first triggered audit result, or null if no issues found.
73
+ */
74
+ export declare function auditAgentReports(session: Session, config?: Partial<ReportWatcherConfig>, now?: Date): ReportAuditResult | null;
75
+ /**
76
+ * Get the reaction key for a report watcher trigger.
77
+ * Used to look up the reaction configuration.
78
+ */
79
+ export declare function getReactionKeyForTrigger(trigger: ReportWatcherTrigger): string;
80
+ /**
81
+ * Metadata keys for storing report watcher flags.
82
+ */
83
+ export declare const REPORT_WATCHER_METADATA_KEYS: {
84
+ /** ISO timestamp of last audit */
85
+ readonly LAST_AUDITED_AT: "reportWatcherLastAuditedAt";
86
+ /** Current active trigger (if any) */
87
+ readonly ACTIVE_TRIGGER: "reportWatcherActiveTrigger";
88
+ /** ISO timestamp when trigger was first activated */
89
+ readonly TRIGGER_ACTIVATED_AT: "reportWatcherTriggerActivatedAt";
90
+ /** Number of times this trigger has fired */
91
+ readonly TRIGGER_COUNT: "reportWatcherTriggerCount";
92
+ };
93
+ //# sourceMappingURL=report-watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-watcher.d.ts","sourceRoot":"","sources":["../src/report-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,cAAc,GACd,mBAAmB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrC,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iFAAiF;IACjF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,0CAA0C;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,mBAM3C,CAAC;AAcF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAW5D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,mBAAmB,GAC1B,iBAAiB,GAAG,IAAI,CAuB1B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,mBAAmB,GAC1B,iBAAiB,GAAG,IAAI,CAuB1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,mBAAmB,GAC1B,iBAAiB,GAAG,IAAI,CAqB1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,OAAO,CAAC,mBAAmB,CAAM,EACzC,GAAG,GAAE,IAAiB,GACrB,iBAAiB,GAAG,IAAI,CAuB1B;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAS9E;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B;IACvC,kCAAkC;;IAElC,sCAAsC;;IAEtC,qDAAqD;;IAErD,6CAA6C;;CAErC,CAAC"}
@@ -0,0 +1,182 @@
1
+ import { readAgentReport } from './agent-report.js';
2
+
3
+ /**
4
+ * Report Watcher — Background trigger system for agent reports (#140)
5
+ *
6
+ * Monitors agent reports and triggers actions when anomalies are detected:
7
+ * - No acknowledge timeout: agent didn't acknowledge task after spawn
8
+ * - Stale report: agent hasn't reported in a while
9
+ * - Agent blocked: agent reported blocked/needs_input state
10
+ *
11
+ * This module is designed to be called from the lifecycle-manager polling loop.
12
+ */
13
+ /**
14
+ * Default report watcher configuration.
15
+ */
16
+ const DEFAULT_REPORT_WATCHER_CONFIG = {
17
+ acknowledgeTimeoutMs: 10 * 60 * 1000, // 10 minutes
18
+ staleReportTimeoutMs: 30 * 60 * 1000, // 30 minutes
19
+ checkAcknowledge: true,
20
+ checkStale: true,
21
+ checkBlocked: true,
22
+ };
23
+ /**
24
+ * Terminal statuses that should not be audited.
25
+ */
26
+ const TERMINAL_STATUSES = new Set([
27
+ "done",
28
+ "terminated",
29
+ "killed",
30
+ "cleanup",
31
+ "merged",
32
+ "errored",
33
+ ]);
34
+ /**
35
+ * Check if a session should be audited for report issues.
36
+ * Note: spawning sessions are included so acknowledge timeout can fire.
37
+ */
38
+ function shouldAuditSession(session) {
39
+ // Skip terminal sessions
40
+ if (TERMINAL_STATUSES.has(session.status)) {
41
+ return false;
42
+ }
43
+ // Skip orchestrator sessions
44
+ if (session.lifecycle?.session.kind === "orchestrator") {
45
+ return false;
46
+ }
47
+ // Note: spawning sessions are NOT skipped — they need acknowledge timeout checks
48
+ return true;
49
+ }
50
+ /**
51
+ * Check for acknowledge timeout: agent didn't acknowledge task within threshold.
52
+ */
53
+ function checkAcknowledgeTimeout(session, report, now, config) {
54
+ if (!config.checkAcknowledge)
55
+ return null;
56
+ // If we have any report (acknowledge or otherwise), the agent responded
57
+ if (report)
58
+ return null;
59
+ // Check time since spawn
60
+ const createdAt = session.createdAt ?? session.metadata["createdAt"];
61
+ if (!createdAt)
62
+ return null;
63
+ const spawnTime = typeof createdAt === "string" ? Date.parse(createdAt) : createdAt.getTime();
64
+ if (Number.isNaN(spawnTime))
65
+ return null;
66
+ const timeSinceSpawn = now.getTime() - spawnTime;
67
+ if (timeSinceSpawn < config.acknowledgeTimeoutMs)
68
+ return null;
69
+ return {
70
+ trigger: "no_acknowledge",
71
+ message: `Agent has not acknowledged task after ${Math.round(timeSinceSpawn / 60000)} minutes`,
72
+ checkedAt: now.toISOString(),
73
+ report: null,
74
+ timeSinceSpawnMs: timeSinceSpawn,
75
+ };
76
+ }
77
+ /**
78
+ * Check for stale report: agent hasn't reported in a while.
79
+ */
80
+ function checkStaleReport(session, report, now, config) {
81
+ if (!config.checkStale)
82
+ return null;
83
+ // If no report, the acknowledge check handles it
84
+ if (!report)
85
+ return null;
86
+ // Check if the report is stale
87
+ const reportTime = Date.parse(report.timestamp);
88
+ if (Number.isNaN(reportTime))
89
+ return null;
90
+ const timeSinceReport = now.getTime() - reportTime;
91
+ if (timeSinceReport < config.staleReportTimeoutMs)
92
+ return null;
93
+ // Don't flag as stale if agent is in a waiting state (that's expected)
94
+ if (report.state === "waiting" || report.state === "needs_input")
95
+ return null;
96
+ return {
97
+ trigger: "stale_report",
98
+ message: `Agent report is stale (${Math.round(timeSinceReport / 60000)} minutes since last report)`,
99
+ checkedAt: now.toISOString(),
100
+ report,
101
+ timeSinceReportMs: timeSinceReport,
102
+ };
103
+ }
104
+ /**
105
+ * Check for blocked agent: agent reported blocked or needs_input state.
106
+ */
107
+ function checkBlockedAgent(_session, report, now, config) {
108
+ if (!config.checkBlocked)
109
+ return null;
110
+ // If no report, nothing to check
111
+ if (!report)
112
+ return null;
113
+ if (report.state === "needs_input") {
114
+ const reportTime = Date.parse(report.timestamp);
115
+ const timeSinceReportMs = Number.isNaN(reportTime) ? undefined : now.getTime() - reportTime;
116
+ return {
117
+ trigger: "agent_needs_input",
118
+ message: `Agent needs input: ${report.note ?? "waiting for user decision"}`,
119
+ checkedAt: now.toISOString(),
120
+ report,
121
+ timeSinceReportMs,
122
+ };
123
+ }
124
+ // Note: "blocked" is not in the current AGENT_REPORTED_STATES but we check for it
125
+ // in case it gets added or for forward compatibility
126
+ return null;
127
+ }
128
+ /**
129
+ * Audit a session's agent reports for issues.
130
+ * Returns the first triggered audit result, or null if no issues found.
131
+ */
132
+ function auditAgentReports(session, config = {}, now = new Date()) {
133
+ if (!shouldAuditSession(session)) {
134
+ return null;
135
+ }
136
+ const fullConfig = {
137
+ ...DEFAULT_REPORT_WATCHER_CONFIG,
138
+ ...config,
139
+ };
140
+ const report = readAgentReport(session.metadata);
141
+ // Check in priority order: blocked > no_acknowledge > stale
142
+ const blockedResult = checkBlockedAgent(session, report, now, fullConfig);
143
+ if (blockedResult)
144
+ return blockedResult;
145
+ const acknowledgeResult = checkAcknowledgeTimeout(session, report, now, fullConfig);
146
+ if (acknowledgeResult)
147
+ return acknowledgeResult;
148
+ const staleResult = checkStaleReport(session, report, now, fullConfig);
149
+ if (staleResult)
150
+ return staleResult;
151
+ return null;
152
+ }
153
+ /**
154
+ * Get the reaction key for a report watcher trigger.
155
+ * Used to look up the reaction configuration.
156
+ */
157
+ function getReactionKeyForTrigger(trigger) {
158
+ switch (trigger) {
159
+ case "no_acknowledge":
160
+ return "report-no-acknowledge";
161
+ case "stale_report":
162
+ return "report-stale";
163
+ case "agent_needs_input":
164
+ return "report-needs-input";
165
+ }
166
+ }
167
+ /**
168
+ * Metadata keys for storing report watcher flags.
169
+ */
170
+ const REPORT_WATCHER_METADATA_KEYS = {
171
+ /** ISO timestamp of last audit */
172
+ LAST_AUDITED_AT: "reportWatcherLastAuditedAt",
173
+ /** Current active trigger (if any) */
174
+ ACTIVE_TRIGGER: "reportWatcherActiveTrigger",
175
+ /** ISO timestamp when trigger was first activated */
176
+ TRIGGER_ACTIVATED_AT: "reportWatcherTriggerActivatedAt",
177
+ /** Number of times this trigger has fired */
178
+ TRIGGER_COUNT: "reportWatcherTriggerCount",
179
+ };
180
+
181
+ export { DEFAULT_REPORT_WATCHER_CONFIG, REPORT_WATCHER_METADATA_KEYS, auditAgentReports, checkAcknowledgeTimeout, checkBlockedAgent, checkStaleReport, getReactionKeyForTrigger, shouldAuditSession };
182
+ //# sourceMappingURL=report-watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-watcher.js","sources":["../src/report-watcher.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AA+CH;;AAEG;AACI,MAAM,6BAA6B,GAAwB;AAChE,IAAA,oBAAoB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AACpC,IAAA,oBAAoB,EAAE,EAAE,GAAG,EAA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,iBAAiB;AAE/C,IAAA,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC;AACtE,IAAA,IAAI,WAAW;AAAE,QAAA,OAAO,WAAW;AAEnC,IAAA,OAAO,IAAI;AACb;AAEA;;;AAGG;AACG,SAAU,wBAAwB,CAAC,OAA6B,EAAA;IACpE,QAAQ,OAAO;AACb,QAAA,KAAK,gBAAgB;AACnB,YAAA,OAAO,uBAAuB;AAChC,QAAA,KAAK,cAAc;AACjB,YAAA,OAAO,cAAc;AACvB,QAAA,KAAK,mBAAmB;AACtB,YAAA,OAAO,oBAAoB;;AAEjC;AAEA;;AAEG;AACI,MAAM,4BAA4B,GAAG;;AAE1C,IAAA,eAAe,EAAE,4BAA4B;;AAE7C,IAAA,cAAc,EAAE,4BAA4B;;AAE5C,IAAA,oBAAoB,EAAE,iCAAiC;;AAEvD,IAAA,aAAa,EAAE,2BAA2B;;;;;"}
@@ -0,0 +1,6 @@
1
+ import type { SCMWebhookRequest } from "./types.js";
2
+ export declare function getWebhookHeader(headers: SCMWebhookRequest["headers"], name: string): string | undefined;
3
+ export declare function parseWebhookJsonObject(body: string): Record<string, unknown>;
4
+ export declare function parseWebhookTimestamp(value: unknown): Date | undefined;
5
+ export declare function parseWebhookBranchRef(ref: unknown): string | undefined;
6
+ //# sourceMappingURL=scm-webhook-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scm-webhook-utils.d.ts","sourceRoot":"","sources":["../src/scm-webhook-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,EACrC,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM5E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAItE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKtE"}
@@ -0,0 +1,36 @@
1
+ function getWebhookHeader(headers, name) {
2
+ const target = name.toLowerCase();
3
+ for (const [key, value] of Object.entries(headers)) {
4
+ if (key.toLowerCase() !== target)
5
+ continue;
6
+ if (Array.isArray(value))
7
+ return value[0];
8
+ return value;
9
+ }
10
+ return undefined;
11
+ }
12
+ function parseWebhookJsonObject(body) {
13
+ const parsed = JSON.parse(body);
14
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
15
+ throw new Error("Webhook payload must be a JSON object");
16
+ }
17
+ return parsed;
18
+ }
19
+ function parseWebhookTimestamp(value) {
20
+ if (typeof value !== "string")
21
+ return undefined;
22
+ const date = new Date(value);
23
+ return Number.isNaN(date.getTime()) ? undefined : date;
24
+ }
25
+ function parseWebhookBranchRef(ref) {
26
+ if (typeof ref !== "string" || ref.length === 0)
27
+ return undefined;
28
+ if (ref.startsWith("refs/heads/"))
29
+ return ref.slice("refs/heads/".length);
30
+ if (ref.startsWith("refs/"))
31
+ return undefined;
32
+ return ref;
33
+ }
34
+
35
+ export { getWebhookHeader, parseWebhookBranchRef, parseWebhookJsonObject, parseWebhookTimestamp };
36
+ //# sourceMappingURL=scm-webhook-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scm-webhook-utils.js","sources":["../src/scm-webhook-utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEM,SAAU,gBAAgB,CAC9B,OAAqC,EACrC,IAAY,EAAA;AAEZ,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;AACjC,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAClD,QAA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
5
+ * - Spawn new sessions (create workspace → create runtime → launch agent)
6
+ * - List sessions (from metadata + live runtime checks)
7
+ * - Kill sessions (agent → runtime → workspace cleanup)
8
+ * - Cleanup completed sessions (PR merged / issue closed)
9
+ * - Send messages to running sessions
10
+ *
11
+ * Reference: scripts/claude-ao-session, scripts/send-to-session
12
+ */
13
+ import { type OpenCodeSessionManager, type OrchestratorConfig, type PluginRegistry } from "./types.js";
14
+ /** Re-export so existing core test-utils + session-manager call sites keep working. */
15
+ export declare function resetOpenCodeSessionListCache(): void;
16
+ export interface SessionManagerDeps {
17
+ config: OrchestratorConfig;
18
+ registry: PluginRegistry;
19
+ }
20
+ /** Create a SessionManager instance. */
21
+ export declare function createSessionManager(deps: SessionManagerDeps): OpenCodeSessionManager;
22
+ //# sourceMappingURL=session-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../src/session-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EAQL,KAAK,sBAAsB,EAW3B,KAAK,kBAAkB,EAQvB,KAAK,cAAc,EAKpB,MAAM,YAAY,CAAC;AAoGpB,uFAAuF;AACvF,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AA0ND,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,sBAAsB,CAixGrF"}