yepanywhere 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (635) hide show
  1. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts +229 -0
  2. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts.map +1 -0
  3. package/bundled/@yep-anywhere/shared/dist/app-types.js +46 -0
  4. package/bundled/@yep-anywhere/shared/dist/app-types.js.map +1 -0
  5. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.d.ts +16 -0
  6. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.d.ts.map +1 -0
  7. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.js +17 -0
  8. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.js.map +1 -0
  9. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.d.ts +15 -0
  10. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.d.ts.map +1 -0
  11. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.js +10 -0
  12. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.js.map +1 -0
  13. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.d.ts +6 -0
  14. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.d.ts.map +1 -0
  15. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.js +6 -0
  16. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.js.map +1 -0
  17. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.d.ts +7 -0
  18. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.d.ts.map +1 -0
  19. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.js +7 -0
  20. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.js.map +1 -0
  21. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.d.ts +24 -0
  22. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.d.ts.map +1 -0
  23. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.js +13 -0
  24. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.js.map +1 -0
  25. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.d.ts +8 -0
  26. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.d.ts.map +1 -0
  27. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.js +8 -0
  28. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.js.map +1 -0
  29. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts +78 -0
  30. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts.map +1 -0
  31. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.js +13 -0
  32. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.js.map +1 -0
  33. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts +18 -0
  34. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts.map +1 -0
  35. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js +19 -0
  36. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js.map +1 -0
  37. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.d.ts +13 -0
  38. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.d.ts.map +1 -0
  39. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.js +14 -0
  40. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.js.map +1 -0
  41. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.d.ts +68 -0
  42. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.d.ts.map +1 -0
  43. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.js +37 -0
  44. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.js.map +1 -0
  45. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.d.ts +8 -0
  46. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.d.ts.map +1 -0
  47. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.js +7 -0
  48. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.js.map +1 -0
  49. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts +52 -0
  50. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts.map +1 -0
  51. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js +29 -0
  52. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js.map +1 -0
  53. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts +72 -0
  54. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts.map +1 -0
  55. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.js +10 -0
  56. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.js.map +1 -0
  57. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.d.ts +14 -0
  58. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.d.ts.map +1 -0
  59. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.js +39 -0
  60. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.js.map +1 -0
  61. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.d.ts +15 -0
  62. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.d.ts.map +1 -0
  63. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js +26 -0
  64. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js.map +1 -0
  65. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts +566 -0
  66. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts.map +1 -0
  67. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.js +39 -0
  68. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.js.map +1 -0
  69. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.d.ts +93 -0
  70. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.d.ts.map +1 -0
  71. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.js +40 -0
  72. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.js.map +1 -0
  73. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.d.ts +105 -0
  74. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.d.ts.map +1 -0
  75. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.js +20 -0
  76. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.js.map +1 -0
  77. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.d.ts +53 -0
  78. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.d.ts.map +1 -0
  79. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.js +54 -0
  80. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.js.map +1 -0
  81. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.d.ts +9 -0
  82. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.d.ts.map +1 -0
  83. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.js +9 -0
  84. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.js.map +1 -0
  85. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.d.ts +32 -0
  86. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.d.ts.map +1 -0
  87. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.js +12 -0
  88. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.js.map +1 -0
  89. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts +288 -0
  90. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts.map +1 -0
  91. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js +293 -0
  92. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js.map +1 -0
  93. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.d.ts +83 -0
  94. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.d.ts.map +1 -0
  95. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.js +10 -0
  96. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.js.map +1 -0
  97. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.d.ts +42 -0
  98. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.d.ts.map +1 -0
  99. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.js +11 -0
  100. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.js.map +1 -0
  101. package/bundled/@yep-anywhere/shared/dist/codex-schema/content.d.ts +99 -0
  102. package/bundled/@yep-anywhere/shared/dist/codex-schema/content.d.ts.map +1 -0
  103. package/bundled/@yep-anywhere/shared/dist/codex-schema/content.js +64 -0
  104. package/bundled/@yep-anywhere/shared/dist/codex-schema/content.js.map +1 -0
  105. package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts +17 -0
  106. package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts.map +1 -0
  107. package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js +17 -0
  108. package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js.map +1 -0
  109. package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts +600 -0
  110. package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts.map +1 -0
  111. package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js +282 -0
  112. package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js.map +1 -0
  113. package/bundled/@yep-anywhere/shared/dist/codex-schema/types.d.ts +7 -0
  114. package/bundled/@yep-anywhere/shared/dist/codex-schema/types.d.ts.map +1 -0
  115. package/bundled/@yep-anywhere/shared/dist/codex-schema/types.js +6 -0
  116. package/bundled/@yep-anywhere/shared/dist/codex-schema/types.js.map +1 -0
  117. package/bundled/@yep-anywhere/shared/dist/dag.d.ts +35 -0
  118. package/bundled/@yep-anywhere/shared/dist/dag.d.ts.map +1 -0
  119. package/bundled/@yep-anywhere/shared/dist/dag.js +75 -0
  120. package/bundled/@yep-anywhere/shared/dist/dag.js.map +1 -0
  121. package/bundled/@yep-anywhere/shared/dist/filePathDetection.d.ts +72 -0
  122. package/bundled/@yep-anywhere/shared/dist/filePathDetection.d.ts.map +1 -0
  123. package/bundled/@yep-anywhere/shared/dist/filePathDetection.js +376 -0
  124. package/bundled/@yep-anywhere/shared/dist/filePathDetection.js.map +1 -0
  125. package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.d.ts +95 -0
  126. package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.d.ts.map +1 -0
  127. package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.js +57 -0
  128. package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.js.map +1 -0
  129. package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.d.ts +174 -0
  130. package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.d.ts.map +1 -0
  131. package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.js +117 -0
  132. package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.js.map +1 -0
  133. package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.d.ts +18 -0
  134. package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.d.ts.map +1 -0
  135. package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.js +18 -0
  136. package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.js.map +1 -0
  137. package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.d.ts +267 -0
  138. package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.d.ts.map +1 -0
  139. package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.js +147 -0
  140. package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.js.map +1 -0
  141. package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.d.ts +7 -0
  142. package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.d.ts.map +1 -0
  143. package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.js +6 -0
  144. package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.js.map +1 -0
  145. package/bundled/@yep-anywhere/shared/dist/ideMetadata.d.ts +30 -0
  146. package/bundled/@yep-anywhere/shared/dist/ideMetadata.d.ts.map +1 -0
  147. package/bundled/@yep-anywhere/shared/dist/ideMetadata.js +58 -0
  148. package/bundled/@yep-anywhere/shared/dist/ideMetadata.js.map +1 -0
  149. package/bundled/@yep-anywhere/shared/dist/index.d.ts +24 -0
  150. package/bundled/@yep-anywhere/shared/dist/index.d.ts.map +1 -0
  151. package/bundled/@yep-anywhere/shared/dist/index.js +17 -0
  152. package/bundled/@yep-anywhere/shared/dist/index.js.map +1 -0
  153. package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts +457 -0
  154. package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts.map +1 -0
  155. package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js +217 -0
  156. package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js.map +1 -0
  157. package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.d.ts +23 -0
  158. package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.d.ts.map +1 -0
  159. package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.js +23 -0
  160. package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.js.map +1 -0
  161. package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.d.ts +149 -0
  162. package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.d.ts.map +1 -0
  163. package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.js +158 -0
  164. package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.js.map +1 -0
  165. package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts +7 -0
  166. package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts.map +1 -0
  167. package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.js +6 -0
  168. package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.js.map +1 -0
  169. package/bundled/@yep-anywhere/shared/dist/projectId.d.ts +48 -0
  170. package/bundled/@yep-anywhere/shared/dist/projectId.d.ts.map +1 -0
  171. package/bundled/@yep-anywhere/shared/dist/projectId.js +74 -0
  172. package/bundled/@yep-anywhere/shared/dist/projectId.js.map +1 -0
  173. package/bundled/@yep-anywhere/shared/dist/session/SessionView.d.ts +171 -0
  174. package/bundled/@yep-anywhere/shared/dist/session/SessionView.d.ts.map +1 -0
  175. package/bundled/@yep-anywhere/shared/dist/session/SessionView.js +189 -0
  176. package/bundled/@yep-anywhere/shared/dist/session/SessionView.js.map +1 -0
  177. package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts +31 -0
  178. package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts.map +1 -0
  179. package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.js +2 -0
  180. package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.js.map +1 -0
  181. package/bundled/@yep-anywhere/shared/dist/session/index.d.ts +3 -0
  182. package/bundled/@yep-anywhere/shared/dist/session/index.d.ts.map +1 -0
  183. package/bundled/@yep-anywhere/shared/dist/session/index.js +2 -0
  184. package/bundled/@yep-anywhere/shared/dist/session/index.js.map +1 -0
  185. package/bundled/@yep-anywhere/shared/dist/types.d.ts +172 -0
  186. package/bundled/@yep-anywhere/shared/dist/types.d.ts.map +1 -0
  187. package/bundled/@yep-anywhere/shared/dist/types.js +33 -0
  188. package/bundled/@yep-anywhere/shared/dist/types.js.map +1 -0
  189. package/bundled/@yep-anywhere/shared/dist/upload.d.ts +58 -0
  190. package/bundled/@yep-anywhere/shared/dist/upload.d.ts.map +1 -0
  191. package/bundled/@yep-anywhere/shared/dist/upload.js +6 -0
  192. package/bundled/@yep-anywhere/shared/dist/upload.js.map +1 -0
  193. package/bundled/@yep-anywhere/shared/package.json +7 -0
  194. package/client-dist/assets/index-C7DeAWG4.css +1 -0
  195. package/client-dist/assets/index-yX0HPwrz.js +147 -0
  196. package/client-dist/badge-96.png +0 -0
  197. package/client-dist/badge.svg +20 -0
  198. package/client-dist/debug-streaming.html +746 -0
  199. package/client-dist/favicon.ico +0 -0
  200. package/client-dist/icon-192.png +0 -0
  201. package/client-dist/icon-512.png +0 -0
  202. package/client-dist/icon.svg +27 -0
  203. package/client-dist/index.html +35 -0
  204. package/client-dist/manifest.json +23 -0
  205. package/client-dist/sw.js +482 -0
  206. package/dist/app.d.ts +67 -0
  207. package/dist/app.d.ts.map +1 -0
  208. package/dist/app.js +236 -0
  209. package/dist/app.js.map +1 -0
  210. package/dist/augments/augment-generator.d.ts +30 -0
  211. package/dist/augments/augment-generator.d.ts.map +1 -0
  212. package/dist/augments/augment-generator.js +171 -0
  213. package/dist/augments/augment-generator.js.map +1 -0
  214. package/dist/augments/block-detector.d.ts +81 -0
  215. package/dist/augments/block-detector.d.ts.map +1 -0
  216. package/dist/augments/block-detector.js +615 -0
  217. package/dist/augments/block-detector.js.map +1 -0
  218. package/dist/augments/edit-augments.d.ts +138 -0
  219. package/dist/augments/edit-augments.d.ts.map +1 -0
  220. package/dist/augments/edit-augments.js +665 -0
  221. package/dist/augments/edit-augments.js.map +1 -0
  222. package/dist/augments/index.d.ts +14 -0
  223. package/dist/augments/index.d.ts.map +1 -0
  224. package/dist/augments/index.js +20 -0
  225. package/dist/augments/index.js.map +1 -0
  226. package/dist/augments/markdown-augments.d.ts +33 -0
  227. package/dist/augments/markdown-augments.d.ts.map +1 -0
  228. package/dist/augments/markdown-augments.js +128 -0
  229. package/dist/augments/markdown-augments.js.map +1 -0
  230. package/dist/augments/read-augments.d.ts +40 -0
  231. package/dist/augments/read-augments.d.ts.map +1 -0
  232. package/dist/augments/read-augments.js +64 -0
  233. package/dist/augments/read-augments.js.map +1 -0
  234. package/dist/augments/stream-coordinator.d.ts +32 -0
  235. package/dist/augments/stream-coordinator.d.ts.map +1 -0
  236. package/dist/augments/stream-coordinator.js +115 -0
  237. package/dist/augments/stream-coordinator.js.map +1 -0
  238. package/dist/augments/write-augments.d.ts +32 -0
  239. package/dist/augments/write-augments.d.ts.map +1 -0
  240. package/dist/augments/write-augments.js +27 -0
  241. package/dist/augments/write-augments.js.map +1 -0
  242. package/dist/auth/AuthService.d.ts +98 -0
  243. package/dist/auth/AuthService.d.ts.map +1 -0
  244. package/dist/auth/AuthService.js +217 -0
  245. package/dist/auth/AuthService.js.map +1 -0
  246. package/dist/auth/index.d.ts +3 -0
  247. package/dist/auth/index.d.ts.map +1 -0
  248. package/dist/auth/index.js +3 -0
  249. package/dist/auth/index.js.map +1 -0
  250. package/dist/auth/routes.d.ts +13 -0
  251. package/dist/auth/routes.d.ts.map +1 -0
  252. package/dist/auth/routes.js +149 -0
  253. package/dist/auth/routes.js.map +1 -0
  254. package/dist/cli.d.ts +19 -0
  255. package/dist/cli.d.ts.map +1 -0
  256. package/dist/cli.js +152 -0
  257. package/dist/cli.js.map +1 -0
  258. package/dist/config.d.ts +76 -0
  259. package/dist/config.d.ts.map +1 -0
  260. package/dist/config.js +124 -0
  261. package/dist/config.js.map +1 -0
  262. package/dist/dev-mock.d.ts +18 -0
  263. package/dist/dev-mock.d.ts.map +1 -0
  264. package/dist/dev-mock.js +260 -0
  265. package/dist/dev-mock.js.map +1 -0
  266. package/dist/frontend/index.d.ts +10 -0
  267. package/dist/frontend/index.d.ts.map +1 -0
  268. package/dist/frontend/index.js +10 -0
  269. package/dist/frontend/index.js.map +1 -0
  270. package/dist/frontend/proxy.d.ts +70 -0
  271. package/dist/frontend/proxy.d.ts.map +1 -0
  272. package/dist/frontend/proxy.js +329 -0
  273. package/dist/frontend/proxy.js.map +1 -0
  274. package/dist/frontend/static.d.ts +16 -0
  275. package/dist/frontend/static.d.ts.map +1 -0
  276. package/dist/frontend/static.js +106 -0
  277. package/dist/frontend/static.js.map +1 -0
  278. package/dist/highlighting/index.d.ts +43 -0
  279. package/dist/highlighting/index.d.ts.map +1 -0
  280. package/dist/highlighting/index.js +224 -0
  281. package/dist/highlighting/index.js.map +1 -0
  282. package/dist/index.d.ts +2 -0
  283. package/dist/index.d.ts.map +1 -0
  284. package/dist/index.js +259 -0
  285. package/dist/index.js.map +1 -0
  286. package/dist/indexes/SessionIndexService.d.ts +106 -0
  287. package/dist/indexes/SessionIndexService.d.ts.map +1 -0
  288. package/dist/indexes/SessionIndexService.js +356 -0
  289. package/dist/indexes/SessionIndexService.js.map +1 -0
  290. package/dist/indexes/index.d.ts +3 -0
  291. package/dist/indexes/index.d.ts.map +1 -0
  292. package/dist/indexes/index.js +2 -0
  293. package/dist/indexes/index.js.map +1 -0
  294. package/dist/indexes/types.d.ts +55 -0
  295. package/dist/indexes/types.d.ts.map +1 -0
  296. package/dist/indexes/types.js +8 -0
  297. package/dist/indexes/types.js.map +1 -0
  298. package/dist/logging/index.d.ts +2 -0
  299. package/dist/logging/index.d.ts.map +1 -0
  300. package/dist/logging/index.js +2 -0
  301. package/dist/logging/index.js.map +1 -0
  302. package/dist/logging/logger.d.ts +81 -0
  303. package/dist/logging/logger.d.ts.map +1 -0
  304. package/dist/logging/logger.js +257 -0
  305. package/dist/logging/logger.js.map +1 -0
  306. package/dist/maintenance/debug-routes.d.ts +39 -0
  307. package/dist/maintenance/debug-routes.d.ts.map +1 -0
  308. package/dist/maintenance/debug-routes.js +561 -0
  309. package/dist/maintenance/debug-routes.js.map +1 -0
  310. package/dist/maintenance/index.d.ts +3 -0
  311. package/dist/maintenance/index.d.ts.map +1 -0
  312. package/dist/maintenance/index.js +3 -0
  313. package/dist/maintenance/index.js.map +1 -0
  314. package/dist/maintenance/server.d.ts +53 -0
  315. package/dist/maintenance/server.d.ts.map +1 -0
  316. package/dist/maintenance/server.js +419 -0
  317. package/dist/maintenance/server.js.map +1 -0
  318. package/dist/metadata/SessionMetadataService.d.ts +96 -0
  319. package/dist/metadata/SessionMetadataService.d.ts.map +1 -0
  320. package/dist/metadata/SessionMetadataService.js +209 -0
  321. package/dist/metadata/SessionMetadataService.js.map +1 -0
  322. package/dist/metadata/index.d.ts +2 -0
  323. package/dist/metadata/index.d.ts.map +1 -0
  324. package/dist/metadata/index.js +2 -0
  325. package/dist/metadata/index.js.map +1 -0
  326. package/dist/middleware/auth.d.ts +18 -0
  327. package/dist/middleware/auth.d.ts.map +1 -0
  328. package/dist/middleware/auth.js +53 -0
  329. package/dist/middleware/auth.js.map +1 -0
  330. package/dist/middleware/security.d.ts +4 -0
  331. package/dist/middleware/security.d.ts.map +1 -0
  332. package/dist/middleware/security.js +28 -0
  333. package/dist/middleware/security.js.map +1 -0
  334. package/dist/notifications/NotificationService.d.ts +76 -0
  335. package/dist/notifications/NotificationService.d.ts.map +1 -0
  336. package/dist/notifications/NotificationService.js +155 -0
  337. package/dist/notifications/NotificationService.js.map +1 -0
  338. package/dist/notifications/index.d.ts +2 -0
  339. package/dist/notifications/index.d.ts.map +1 -0
  340. package/dist/notifications/index.js +2 -0
  341. package/dist/notifications/index.js.map +1 -0
  342. package/dist/projects/codex-scanner.d.ts +52 -0
  343. package/dist/projects/codex-scanner.d.ts.map +1 -0
  344. package/dist/projects/codex-scanner.js +167 -0
  345. package/dist/projects/codex-scanner.js.map +1 -0
  346. package/dist/projects/gemini-project-map.d.ts +54 -0
  347. package/dist/projects/gemini-project-map.d.ts.map +1 -0
  348. package/dist/projects/gemini-project-map.js +116 -0
  349. package/dist/projects/gemini-project-map.js.map +1 -0
  350. package/dist/projects/gemini-scanner.d.ts +58 -0
  351. package/dist/projects/gemini-scanner.d.ts.map +1 -0
  352. package/dist/projects/gemini-scanner.js +210 -0
  353. package/dist/projects/gemini-scanner.js.map +1 -0
  354. package/dist/projects/index.d.ts +16 -0
  355. package/dist/projects/index.d.ts.map +1 -0
  356. package/dist/projects/index.js +17 -0
  357. package/dist/projects/index.js.map +1 -0
  358. package/dist/projects/paths.d.ts +127 -0
  359. package/dist/projects/paths.d.ts.map +1 -0
  360. package/dist/projects/paths.js +185 -0
  361. package/dist/projects/paths.js.map +1 -0
  362. package/dist/projects/scanner.d.ts +45 -0
  363. package/dist/projects/scanner.d.ts.map +1 -0
  364. package/dist/projects/scanner.js +287 -0
  365. package/dist/projects/scanner.js.map +1 -0
  366. package/dist/push/PushNotifier.d.ts +48 -0
  367. package/dist/push/PushNotifier.d.ts.map +1 -0
  368. package/dist/push/PushNotifier.js +145 -0
  369. package/dist/push/PushNotifier.js.map +1 -0
  370. package/dist/push/PushService.d.ts +95 -0
  371. package/dist/push/PushService.d.ts.map +1 -0
  372. package/dist/push/PushService.js +245 -0
  373. package/dist/push/PushService.js.map +1 -0
  374. package/dist/push/index.d.ts +9 -0
  375. package/dist/push/index.d.ts.map +1 -0
  376. package/dist/push/index.js +8 -0
  377. package/dist/push/index.js.map +1 -0
  378. package/dist/push/routes.d.ts +10 -0
  379. package/dist/push/routes.d.ts.map +1 -0
  380. package/dist/push/routes.js +111 -0
  381. package/dist/push/routes.js.map +1 -0
  382. package/dist/push/types.d.ts +80 -0
  383. package/dist/push/types.d.ts.map +1 -0
  384. package/dist/push/types.js +5 -0
  385. package/dist/push/types.js.map +1 -0
  386. package/dist/push/vapid.d.ts +42 -0
  387. package/dist/push/vapid.d.ts.map +1 -0
  388. package/dist/push/vapid.js +132 -0
  389. package/dist/push/vapid.js.map +1 -0
  390. package/dist/recents/RecentsService.d.ts +77 -0
  391. package/dist/recents/RecentsService.d.ts.map +1 -0
  392. package/dist/recents/RecentsService.js +155 -0
  393. package/dist/recents/RecentsService.js.map +1 -0
  394. package/dist/recents/index.d.ts +2 -0
  395. package/dist/recents/index.d.ts.map +1 -0
  396. package/dist/recents/index.js +2 -0
  397. package/dist/recents/index.js.map +1 -0
  398. package/dist/routes/activity.d.ts +7 -0
  399. package/dist/routes/activity.d.ts.map +1 -0
  400. package/dist/routes/activity.js +80 -0
  401. package/dist/routes/activity.js.map +1 -0
  402. package/dist/routes/beads.d.ts +42 -0
  403. package/dist/routes/beads.d.ts.map +1 -0
  404. package/dist/routes/beads.js +101 -0
  405. package/dist/routes/beads.js.map +1 -0
  406. package/dist/routes/debug-streaming.d.ts +7 -0
  407. package/dist/routes/debug-streaming.d.ts.map +1 -0
  408. package/dist/routes/debug-streaming.js +88 -0
  409. package/dist/routes/debug-streaming.js.map +1 -0
  410. package/dist/routes/dev.d.ts +11 -0
  411. package/dist/routes/dev.d.ts.map +1 -0
  412. package/dist/routes/dev.js +55 -0
  413. package/dist/routes/dev.js.map +1 -0
  414. package/dist/routes/files.d.ts +7 -0
  415. package/dist/routes/files.d.ts.map +1 -0
  416. package/dist/routes/files.js +429 -0
  417. package/dist/routes/files.js.map +1 -0
  418. package/dist/routes/global-sessions.d.ts +76 -0
  419. package/dist/routes/global-sessions.d.ts.map +1 -0
  420. package/dist/routes/global-sessions.js +207 -0
  421. package/dist/routes/global-sessions.js.map +1 -0
  422. package/dist/routes/health.d.ts +3 -0
  423. package/dist/routes/health.d.ts.map +1 -0
  424. package/dist/routes/health.js +6 -0
  425. package/dist/routes/health.js.map +1 -0
  426. package/dist/routes/inbox.d.ts +45 -0
  427. package/dist/routes/inbox.d.ts.map +1 -0
  428. package/dist/routes/inbox.js +174 -0
  429. package/dist/routes/inbox.js.map +1 -0
  430. package/dist/routes/processes.d.ts +16 -0
  431. package/dist/routes/processes.d.ts.map +1 -0
  432. package/dist/routes/processes.js +82 -0
  433. package/dist/routes/processes.js.map +1 -0
  434. package/dist/routes/projects.d.ts +30 -0
  435. package/dist/routes/projects.d.ts.map +1 -0
  436. package/dist/routes/projects.js +316 -0
  437. package/dist/routes/projects.js.map +1 -0
  438. package/dist/routes/providers.d.ts +9 -0
  439. package/dist/routes/providers.d.ts.map +1 -0
  440. package/dist/routes/providers.js +63 -0
  441. package/dist/routes/providers.js.map +1 -0
  442. package/dist/routes/recents.d.ts +14 -0
  443. package/dist/routes/recents.d.ts.map +1 -0
  444. package/dist/routes/recents.js +82 -0
  445. package/dist/routes/recents.js.map +1 -0
  446. package/dist/routes/sessions.d.ts +26 -0
  447. package/dist/routes/sessions.d.ts.map +1 -0
  448. package/dist/routes/sessions.js +962 -0
  449. package/dist/routes/sessions.js.map +1 -0
  450. package/dist/routes/stream.d.ts +7 -0
  451. package/dist/routes/stream.d.ts.map +1 -0
  452. package/dist/routes/stream.js +561 -0
  453. package/dist/routes/stream.js.map +1 -0
  454. package/dist/routes/upload.d.ts +14 -0
  455. package/dist/routes/upload.d.ts.map +1 -0
  456. package/dist/routes/upload.js +278 -0
  457. package/dist/routes/upload.js.map +1 -0
  458. package/dist/sdk/cli-detection.d.ts +47 -0
  459. package/dist/sdk/cli-detection.d.ts.map +1 -0
  460. package/dist/sdk/cli-detection.js +122 -0
  461. package/dist/sdk/cli-detection.js.map +1 -0
  462. package/dist/sdk/messageLogger.d.ts +15 -0
  463. package/dist/sdk/messageLogger.d.ts.map +1 -0
  464. package/dist/sdk/messageLogger.js +68 -0
  465. package/dist/sdk/messageLogger.js.map +1 -0
  466. package/dist/sdk/messageQueue.d.ts +49 -0
  467. package/dist/sdk/messageQueue.d.ts.map +1 -0
  468. package/dist/sdk/messageQueue.js +186 -0
  469. package/dist/sdk/messageQueue.js.map +1 -0
  470. package/dist/sdk/mock.d.ts +16 -0
  471. package/dist/sdk/mock.d.ts.map +1 -0
  472. package/dist/sdk/mock.js +81 -0
  473. package/dist/sdk/mock.js.map +1 -0
  474. package/dist/sdk/providers/__mocks__/base.d.ts +78 -0
  475. package/dist/sdk/providers/__mocks__/base.d.ts.map +1 -0
  476. package/dist/sdk/providers/__mocks__/base.js +185 -0
  477. package/dist/sdk/providers/__mocks__/base.js.map +1 -0
  478. package/dist/sdk/providers/__mocks__/claude.d.ts +33 -0
  479. package/dist/sdk/providers/__mocks__/claude.d.ts.map +1 -0
  480. package/dist/sdk/providers/__mocks__/claude.js +146 -0
  481. package/dist/sdk/providers/__mocks__/claude.js.map +1 -0
  482. package/dist/sdk/providers/__mocks__/codex.d.ts +45 -0
  483. package/dist/sdk/providers/__mocks__/codex.d.ts.map +1 -0
  484. package/dist/sdk/providers/__mocks__/codex.js +160 -0
  485. package/dist/sdk/providers/__mocks__/codex.js.map +1 -0
  486. package/dist/sdk/providers/__mocks__/factory.d.ts +40 -0
  487. package/dist/sdk/providers/__mocks__/factory.d.ts.map +1 -0
  488. package/dist/sdk/providers/__mocks__/factory.js +183 -0
  489. package/dist/sdk/providers/__mocks__/factory.js.map +1 -0
  490. package/dist/sdk/providers/__mocks__/gemini.d.ts +43 -0
  491. package/dist/sdk/providers/__mocks__/gemini.d.ts.map +1 -0
  492. package/dist/sdk/providers/__mocks__/gemini.js +198 -0
  493. package/dist/sdk/providers/__mocks__/gemini.js.map +1 -0
  494. package/dist/sdk/providers/__mocks__/index.d.ts +23 -0
  495. package/dist/sdk/providers/__mocks__/index.d.ts.map +1 -0
  496. package/dist/sdk/providers/__mocks__/index.js +25 -0
  497. package/dist/sdk/providers/__mocks__/index.js.map +1 -0
  498. package/dist/sdk/providers/__mocks__/opencode.d.ts +33 -0
  499. package/dist/sdk/providers/__mocks__/opencode.d.ts.map +1 -0
  500. package/dist/sdk/providers/__mocks__/opencode.js +136 -0
  501. package/dist/sdk/providers/__mocks__/opencode.js.map +1 -0
  502. package/dist/sdk/providers/__mocks__/types.d.ts +50 -0
  503. package/dist/sdk/providers/__mocks__/types.d.ts.map +1 -0
  504. package/dist/sdk/providers/__mocks__/types.js +8 -0
  505. package/dist/sdk/providers/__mocks__/types.js.map +1 -0
  506. package/dist/sdk/providers/claude.d.ts +63 -0
  507. package/dist/sdk/providers/claude.d.ts.map +1 -0
  508. package/dist/sdk/providers/claude.js +252 -0
  509. package/dist/sdk/providers/claude.js.map +1 -0
  510. package/dist/sdk/providers/codex-oss.d.ts +108 -0
  511. package/dist/sdk/providers/codex-oss.d.ts.map +1 -0
  512. package/dist/sdk/providers/codex-oss.js +744 -0
  513. package/dist/sdk/providers/codex-oss.js.map +1 -0
  514. package/dist/sdk/providers/codex.d.ts +82 -0
  515. package/dist/sdk/providers/codex.d.ts.map +1 -0
  516. package/dist/sdk/providers/codex.js +597 -0
  517. package/dist/sdk/providers/codex.js.map +1 -0
  518. package/dist/sdk/providers/gemini.d.ts +78 -0
  519. package/dist/sdk/providers/gemini.d.ts.map +1 -0
  520. package/dist/sdk/providers/gemini.js +536 -0
  521. package/dist/sdk/providers/gemini.js.map +1 -0
  522. package/dist/sdk/providers/index.d.ts +22 -0
  523. package/dist/sdk/providers/index.d.ts.map +1 -0
  524. package/dist/sdk/providers/index.js +53 -0
  525. package/dist/sdk/providers/index.js.map +1 -0
  526. package/dist/sdk/providers/opencode.d.ts +95 -0
  527. package/dist/sdk/providers/opencode.d.ts.map +1 -0
  528. package/dist/sdk/providers/opencode.js +586 -0
  529. package/dist/sdk/providers/opencode.js.map +1 -0
  530. package/dist/sdk/providers/types.d.ts +99 -0
  531. package/dist/sdk/providers/types.d.ts.map +1 -0
  532. package/dist/sdk/providers/types.js +2 -0
  533. package/dist/sdk/providers/types.js.map +1 -0
  534. package/dist/sdk/real.d.ts +20 -0
  535. package/dist/sdk/real.d.ts.map +1 -0
  536. package/dist/sdk/real.js +22 -0
  537. package/dist/sdk/real.js.map +1 -0
  538. package/dist/sdk/types.d.ts +113 -0
  539. package/dist/sdk/types.d.ts.map +1 -0
  540. package/dist/sdk/types.js +3 -0
  541. package/dist/sdk/types.js.map +1 -0
  542. package/dist/sessions/Session.d.ts +80 -0
  543. package/dist/sessions/Session.d.ts.map +1 -0
  544. package/dist/sessions/Session.js +119 -0
  545. package/dist/sessions/Session.js.map +1 -0
  546. package/dist/sessions/codex-reader.d.ts +166 -0
  547. package/dist/sessions/codex-reader.d.ts.map +1 -0
  548. package/dist/sessions/codex-reader.js +664 -0
  549. package/dist/sessions/codex-reader.js.map +1 -0
  550. package/dist/sessions/dag.d.ts +62 -0
  551. package/dist/sessions/dag.d.ts.map +1 -0
  552. package/dist/sessions/dag.js +175 -0
  553. package/dist/sessions/dag.js.map +1 -0
  554. package/dist/sessions/fork.d.ts +34 -0
  555. package/dist/sessions/fork.d.ts.map +1 -0
  556. package/dist/sessions/fork.js +58 -0
  557. package/dist/sessions/fork.js.map +1 -0
  558. package/dist/sessions/gemini-reader.d.ts +103 -0
  559. package/dist/sessions/gemini-reader.d.ts.map +1 -0
  560. package/dist/sessions/gemini-reader.js +332 -0
  561. package/dist/sessions/gemini-reader.js.map +1 -0
  562. package/dist/sessions/normalization.d.ts +7 -0
  563. package/dist/sessions/normalization.d.ts.map +1 -0
  564. package/dist/sessions/normalization.js +429 -0
  565. package/dist/sessions/normalization.js.map +1 -0
  566. package/dist/sessions/opencode-reader.d.ts +99 -0
  567. package/dist/sessions/opencode-reader.d.ts.map +1 -0
  568. package/dist/sessions/opencode-reader.js +370 -0
  569. package/dist/sessions/opencode-reader.js.map +1 -0
  570. package/dist/sessions/reader.d.ts +118 -0
  571. package/dist/sessions/reader.d.ts.map +1 -0
  572. package/dist/sessions/reader.js +444 -0
  573. package/dist/sessions/reader.js.map +1 -0
  574. package/dist/sessions/types.d.ts +77 -0
  575. package/dist/sessions/types.d.ts.map +1 -0
  576. package/dist/sessions/types.js +8 -0
  577. package/dist/sessions/types.js.map +1 -0
  578. package/dist/supervisor/ExternalSessionTracker.d.ts +94 -0
  579. package/dist/supervisor/ExternalSessionTracker.d.ts.map +1 -0
  580. package/dist/supervisor/ExternalSessionTracker.js +507 -0
  581. package/dist/supervisor/ExternalSessionTracker.js.map +1 -0
  582. package/dist/supervisor/Process.d.ts +230 -0
  583. package/dist/supervisor/Process.d.ts.map +1 -0
  584. package/dist/supervisor/Process.js +878 -0
  585. package/dist/supervisor/Process.js.map +1 -0
  586. package/dist/supervisor/Supervisor.d.ts +191 -0
  587. package/dist/supervisor/Supervisor.d.ts.map +1 -0
  588. package/dist/supervisor/Supervisor.js +933 -0
  589. package/dist/supervisor/Supervisor.js.map +1 -0
  590. package/dist/supervisor/WorkerQueue.d.ts +113 -0
  591. package/dist/supervisor/WorkerQueue.d.ts.map +1 -0
  592. package/dist/supervisor/WorkerQueue.js +148 -0
  593. package/dist/supervisor/WorkerQueue.js.map +1 -0
  594. package/dist/supervisor/types.d.ts +176 -0
  595. package/dist/supervisor/types.d.ts.map +1 -0
  596. package/dist/supervisor/types.js +7 -0
  597. package/dist/supervisor/types.js.map +1 -0
  598. package/dist/testing/mockProjectData.d.ts +5 -0
  599. package/dist/testing/mockProjectData.d.ts.map +1 -0
  600. package/dist/testing/mockProjectData.js +27 -0
  601. package/dist/testing/mockProjectData.js.map +1 -0
  602. package/dist/uploads/index.d.ts +3 -0
  603. package/dist/uploads/index.d.ts.map +1 -0
  604. package/dist/uploads/index.js +2 -0
  605. package/dist/uploads/index.js.map +1 -0
  606. package/dist/uploads/manager.d.ts +84 -0
  607. package/dist/uploads/manager.d.ts.map +1 -0
  608. package/dist/uploads/manager.js +215 -0
  609. package/dist/uploads/manager.js.map +1 -0
  610. package/dist/utils/fileLock.d.ts +57 -0
  611. package/dist/utils/fileLock.d.ts.map +1 -0
  612. package/dist/utils/fileLock.js +91 -0
  613. package/dist/utils/fileLock.js.map +1 -0
  614. package/dist/watcher/BatchProcessor.d.ts +58 -0
  615. package/dist/watcher/BatchProcessor.d.ts.map +1 -0
  616. package/dist/watcher/BatchProcessor.js +105 -0
  617. package/dist/watcher/BatchProcessor.js.map +1 -0
  618. package/dist/watcher/EventBus.d.ts +157 -0
  619. package/dist/watcher/EventBus.d.ts.map +1 -0
  620. package/dist/watcher/EventBus.js +36 -0
  621. package/dist/watcher/EventBus.js.map +1 -0
  622. package/dist/watcher/FileWatcher.d.ts +42 -0
  623. package/dist/watcher/FileWatcher.d.ts.map +1 -0
  624. package/dist/watcher/FileWatcher.js +165 -0
  625. package/dist/watcher/FileWatcher.js.map +1 -0
  626. package/dist/watcher/SourceWatcher.d.ts +36 -0
  627. package/dist/watcher/SourceWatcher.d.ts.map +1 -0
  628. package/dist/watcher/SourceWatcher.js +97 -0
  629. package/dist/watcher/SourceWatcher.js.map +1 -0
  630. package/dist/watcher/index.d.ts +9 -0
  631. package/dist/watcher/index.d.ts.map +1 -0
  632. package/dist/watcher/index.js +5 -0
  633. package/dist/watcher/index.js.map +1 -0
  634. package/package.json +54 -0
  635. package/scripts/postinstall.js +48 -0
@@ -0,0 +1,933 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { getLogger } from "../logging/logger.js";
3
+ import { getProvider } from "../sdk/providers/index.js";
4
+ import { Process } from "./Process.js";
5
+ import { WorkerQueue, isQueueFullError, } from "./WorkerQueue.js";
6
+ import { DEFAULT_IDLE_PREEMPT_THRESHOLD_MS, encodeProjectId, } from "./types.js";
7
+ /** Maximum number of terminated processes to retain */
8
+ const MAX_TERMINATED_PROCESSES = 50;
9
+ /** How long to retain terminated process info (10 minutes) */
10
+ const TERMINATED_RETENTION_MS = 10 * 60 * 1000;
11
+ export class Supervisor {
12
+ processes = new Map();
13
+ sessionToProcess = new Map(); // sessionId -> processId
14
+ everOwnedSessions = new Set(); // Sessions we've ever owned (for orphan detection)
15
+ terminatedProcesses = []; // Recently terminated processes
16
+ provider;
17
+ sdk;
18
+ realSdk;
19
+ idleTimeoutMs;
20
+ defaultPermissionMode;
21
+ eventBus;
22
+ maxWorkers;
23
+ idlePreemptThresholdMs;
24
+ workerQueue;
25
+ constructor(options) {
26
+ this.provider = options.provider ?? null;
27
+ this.sdk = options.sdk ?? null;
28
+ this.realSdk = options.realSdk ?? null;
29
+ this.idleTimeoutMs = options.idleTimeoutMs;
30
+ this.defaultPermissionMode = options.defaultPermissionMode ?? "default";
31
+ this.eventBus = options.eventBus;
32
+ this.maxWorkers = options.maxWorkers ?? 0; // 0 = unlimited
33
+ this.idlePreemptThresholdMs =
34
+ options.idlePreemptThresholdMs ?? DEFAULT_IDLE_PREEMPT_THRESHOLD_MS;
35
+ this.workerQueue = new WorkerQueue({
36
+ eventBus: options.eventBus,
37
+ maxQueueSize: options.maxQueueSize,
38
+ });
39
+ if (!this.provider && !this.sdk && !this.realSdk) {
40
+ throw new Error("Either provider, sdk, or realSdk must be provided");
41
+ }
42
+ }
43
+ async startSession(projectPath, message, permissionMode, modelSettings) {
44
+ const projectId = encodeProjectId(projectPath);
45
+ // Check if at capacity
46
+ if (this.isAtCapacity()) {
47
+ // Try to preempt an idle worker
48
+ const preemptable = this.findPreemptableWorker();
49
+ if (preemptable) {
50
+ await this.preemptWorker(preemptable);
51
+ // Fall through to start session normally
52
+ }
53
+ else {
54
+ // Queue the request
55
+ const result = this.workerQueue.enqueue({
56
+ type: "new-session",
57
+ projectPath,
58
+ projectId,
59
+ message,
60
+ permissionMode,
61
+ });
62
+ if (isQueueFullError(result)) {
63
+ return result;
64
+ }
65
+ return {
66
+ queued: true,
67
+ queueId: result.queueId,
68
+ position: result.position,
69
+ };
70
+ }
71
+ }
72
+ // Resolve provider: use specified provider name, or fall back to default provider
73
+ const provider = modelSettings?.providerName
74
+ ? getProvider(modelSettings.providerName)
75
+ : this.provider;
76
+ // Use provider if available (preferred)
77
+ if (provider) {
78
+ return this.startProviderSession(projectPath, projectId, message, undefined, permissionMode, modelSettings, provider);
79
+ }
80
+ // Use real SDK if available
81
+ if (this.realSdk) {
82
+ return this.startRealSession(projectPath, projectId, message, undefined, permissionMode, modelSettings);
83
+ }
84
+ // Fall back to legacy mock SDK
85
+ return this.startLegacySession(projectPath, projectId, message, undefined, permissionMode);
86
+ }
87
+ /**
88
+ * Create a session without sending an initial message.
89
+ * Used for two-phase flow: create session first, upload files, then send message.
90
+ * The agent will wait for a message to be pushed to the queue.
91
+ */
92
+ async createSession(projectPath, permissionMode, modelSettings) {
93
+ const projectId = encodeProjectId(projectPath);
94
+ // Check if at capacity
95
+ if (this.isAtCapacity()) {
96
+ // Try to preempt an idle worker
97
+ const preemptable = this.findPreemptableWorker();
98
+ if (preemptable) {
99
+ await this.preemptWorker(preemptable);
100
+ // Fall through to create session normally
101
+ }
102
+ else {
103
+ // Queue the request - use empty message placeholder
104
+ const result = this.workerQueue.enqueue({
105
+ type: "new-session",
106
+ projectPath,
107
+ projectId,
108
+ message: { text: "" }, // Placeholder, will be replaced when first message sent
109
+ permissionMode,
110
+ });
111
+ if (isQueueFullError(result)) {
112
+ return result;
113
+ }
114
+ return {
115
+ queued: true,
116
+ queueId: result.queueId,
117
+ position: result.position,
118
+ };
119
+ }
120
+ }
121
+ // Resolve provider: use specified provider name, or fall back to default provider
122
+ const provider = modelSettings?.providerName
123
+ ? getProvider(modelSettings.providerName)
124
+ : this.provider;
125
+ // Use provider if available (preferred)
126
+ if (provider) {
127
+ return this.createProviderSession(projectPath, projectId, permissionMode, modelSettings, provider);
128
+ }
129
+ // Use real SDK if available
130
+ if (this.realSdk) {
131
+ return this.createRealSession(projectPath, projectId, permissionMode, modelSettings);
132
+ }
133
+ // Fall back to legacy mock SDK - not supported for create-only
134
+ throw new Error("createSession requires provider or real SDK - legacy mock SDK not supported");
135
+ }
136
+ /**
137
+ * Create a session using the real SDK without an initial message.
138
+ * The session is created and waits for a message to be queued.
139
+ */
140
+ async createRealSession(projectPath, projectId, permissionMode, modelSettings) {
141
+ if (!this.realSdk) {
142
+ throw new Error("realSdk is not available");
143
+ }
144
+ const processHolder = { process: null };
145
+ const effectiveMode = permissionMode ?? this.defaultPermissionMode;
146
+ // Start session WITHOUT an initial message - agent will wait
147
+ const result = await this.realSdk.startSession({
148
+ cwd: projectPath,
149
+ // No initialMessage - queue will block until one is pushed
150
+ permissionMode: effectiveMode,
151
+ model: modelSettings?.model,
152
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
153
+ onToolApproval: async (toolName, input, opts) => {
154
+ if (!processHolder.process) {
155
+ return { behavior: "deny", message: "Process not ready" };
156
+ }
157
+ return processHolder.process.handleToolApproval(toolName, input, opts);
158
+ },
159
+ });
160
+ const { iterator, queue, abort } = result;
161
+ const tempSessionId = randomUUID();
162
+ const options = {
163
+ projectPath,
164
+ projectId,
165
+ sessionId: tempSessionId,
166
+ idleTimeoutMs: this.idleTimeoutMs,
167
+ queue,
168
+ abortFn: abort,
169
+ permissionMode: effectiveMode,
170
+ provider: "claude", // Real SDK is always Claude
171
+ model: modelSettings?.model,
172
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
173
+ };
174
+ const process = new Process(iterator, options);
175
+ processHolder.process = process;
176
+ // Wait for the real session ID from the SDK
177
+ await process.waitForSessionId();
178
+ // Register as a new session
179
+ this.registerProcess(process, true);
180
+ return process;
181
+ }
182
+ /**
183
+ * Start a session using the real SDK with full features.
184
+ */
185
+ async startRealSession(projectPath, projectId, message, resumeSessionId, permissionMode, modelSettings) {
186
+ // Create a placeholder process first (needed for tool approval callback)
187
+ const tempSessionId = resumeSessionId ?? randomUUID();
188
+ // realSdk is guaranteed to exist here (checked in startSession)
189
+ if (!this.realSdk) {
190
+ throw new Error("realSdk is not available");
191
+ }
192
+ // We need to reference process in the callback before it's assigned
193
+ // Using a holder object allows us to set the reference later
194
+ const processHolder = { process: null };
195
+ // Use provided mode or fall back to default
196
+ const effectiveMode = permissionMode ?? this.defaultPermissionMode;
197
+ // Generate UUID for the initial message so SDK and SSE use the same ID.
198
+ // This ensures the client can match the SSE replay to its temp message,
199
+ // and prevents duplicates when JSONL is later fetched.
200
+ const messageUuid = randomUUID();
201
+ const messageWithUuid = { ...message, uuid: messageUuid };
202
+ const result = await this.realSdk.startSession({
203
+ cwd: projectPath,
204
+ initialMessage: messageWithUuid,
205
+ resumeSessionId,
206
+ permissionMode: effectiveMode,
207
+ model: modelSettings?.model,
208
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
209
+ onToolApproval: async (toolName, input, opts) => {
210
+ // Delegate to the process's handleToolApproval
211
+ if (!processHolder.process) {
212
+ return { behavior: "deny", message: "Process not ready" };
213
+ }
214
+ return processHolder.process.handleToolApproval(toolName, input, opts);
215
+ },
216
+ });
217
+ const { iterator, queue, abort } = result;
218
+ const options = {
219
+ projectPath,
220
+ projectId,
221
+ sessionId: tempSessionId,
222
+ idleTimeoutMs: this.idleTimeoutMs,
223
+ queue,
224
+ abortFn: abort,
225
+ permissionMode: effectiveMode,
226
+ provider: "claude", // Real SDK is always Claude
227
+ model: modelSettings?.model,
228
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
229
+ };
230
+ const process = new Process(iterator, options);
231
+ processHolder.process = process;
232
+ // Add the initial user message to history with the same UUID we passed to SDK.
233
+ // This ensures SSE replay includes the user message so the client can replace
234
+ // its temp message. The SDK also writes to JSONL with this UUID, so both SSE
235
+ // and JSONL will have matching IDs (no duplicates).
236
+ process.addInitialUserMessage(message.text, messageUuid, message.tempId);
237
+ // Wait for the real session ID from the SDK before registering
238
+ // This ensures the client gets the correct ID to use for persistence
239
+ if (!resumeSessionId) {
240
+ await process.waitForSessionId();
241
+ }
242
+ this.registerProcess(process, !resumeSessionId);
243
+ return process;
244
+ }
245
+ /**
246
+ * Create a session using the provider interface without an initial message.
247
+ * The session is created and waits for a message to be queued.
248
+ */
249
+ async createProviderSession(projectPath, projectId, permissionMode, modelSettings, provider) {
250
+ const activeProvider = provider ?? this.provider;
251
+ if (!activeProvider) {
252
+ throw new Error("provider is not available");
253
+ }
254
+ const processHolder = { process: null };
255
+ const effectiveMode = permissionMode ?? this.defaultPermissionMode;
256
+ // Start session WITHOUT an initial message - agent will wait
257
+ const result = await activeProvider.startSession({
258
+ cwd: projectPath,
259
+ // No initialMessage - queue will block until one is pushed
260
+ permissionMode: effectiveMode,
261
+ model: modelSettings?.model,
262
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
263
+ onToolApproval: async (toolName, input, opts) => {
264
+ if (!processHolder.process) {
265
+ return { behavior: "deny", message: "Process not ready" };
266
+ }
267
+ return processHolder.process.handleToolApproval(toolName, input, opts);
268
+ },
269
+ });
270
+ const { iterator, queue, abort } = result;
271
+ const tempSessionId = randomUUID();
272
+ const options = {
273
+ projectPath,
274
+ projectId,
275
+ sessionId: tempSessionId,
276
+ idleTimeoutMs: this.idleTimeoutMs,
277
+ queue,
278
+ abortFn: abort,
279
+ permissionMode: effectiveMode,
280
+ provider: activeProvider.name,
281
+ model: modelSettings?.model,
282
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
283
+ };
284
+ const process = new Process(iterator, options);
285
+ processHolder.process = process;
286
+ // Wait for the real session ID from the provider
287
+ await process.waitForSessionId();
288
+ // Register as a new session
289
+ this.registerProcess(process, true);
290
+ return process;
291
+ }
292
+ /**
293
+ * Start a session using the provider interface with full features.
294
+ */
295
+ async startProviderSession(projectPath, projectId, message, resumeSessionId, permissionMode, modelSettings, provider) {
296
+ const activeProvider = provider ?? this.provider;
297
+ if (!activeProvider) {
298
+ throw new Error("provider is not available");
299
+ }
300
+ const tempSessionId = resumeSessionId ?? randomUUID();
301
+ // We need to reference process in the callback before it's assigned
302
+ const processHolder = { process: null };
303
+ // Use provided mode or fall back to default
304
+ const effectiveMode = permissionMode ?? this.defaultPermissionMode;
305
+ // Generate UUID for the initial message so SDK and SSE use the same ID.
306
+ const messageUuid = randomUUID();
307
+ const messageWithUuid = { ...message, uuid: messageUuid };
308
+ const result = await activeProvider.startSession({
309
+ cwd: projectPath,
310
+ initialMessage: messageWithUuid,
311
+ resumeSessionId,
312
+ permissionMode: effectiveMode,
313
+ model: modelSettings?.model,
314
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
315
+ onToolApproval: async (toolName, input, opts) => {
316
+ if (!processHolder.process) {
317
+ return { behavior: "deny", message: "Process not ready" };
318
+ }
319
+ return processHolder.process.handleToolApproval(toolName, input, opts);
320
+ },
321
+ });
322
+ const { iterator, queue, abort } = result;
323
+ const options = {
324
+ projectPath,
325
+ projectId,
326
+ sessionId: tempSessionId,
327
+ idleTimeoutMs: this.idleTimeoutMs,
328
+ queue,
329
+ abortFn: abort,
330
+ permissionMode: effectiveMode,
331
+ provider: activeProvider.name,
332
+ model: modelSettings?.model,
333
+ maxThinkingTokens: modelSettings?.maxThinkingTokens,
334
+ };
335
+ const process = new Process(iterator, options);
336
+ processHolder.process = process;
337
+ // Add the initial user message to history with the same UUID we passed to provider.
338
+ process.addInitialUserMessage(message.text, messageUuid, message.tempId);
339
+ // Wait for the real session ID from the provider before registering
340
+ if (!resumeSessionId) {
341
+ await process.waitForSessionId();
342
+ }
343
+ this.registerProcess(process, !resumeSessionId);
344
+ return process;
345
+ }
346
+ /**
347
+ * Start a session using the legacy mock SDK.
348
+ */
349
+ startLegacySession(projectPath, projectId, message, resumeSessionId, permissionMode) {
350
+ // sdk is guaranteed to exist here (checked in startSession)
351
+ if (!this.sdk) {
352
+ throw new Error("sdk is not available");
353
+ }
354
+ const iterator = this.sdk.startSession({
355
+ cwd: projectPath,
356
+ resume: resumeSessionId,
357
+ });
358
+ const sessionId = resumeSessionId ?? randomUUID();
359
+ // Use provided mode or fall back to default
360
+ const effectiveMode = permissionMode ?? this.defaultPermissionMode;
361
+ const options = {
362
+ projectPath,
363
+ projectId,
364
+ sessionId,
365
+ idleTimeoutMs: this.idleTimeoutMs,
366
+ permissionMode: effectiveMode,
367
+ provider: "claude", // Legacy mock SDK simulates Claude
368
+ };
369
+ const process = new Process(iterator, options);
370
+ this.registerProcess(process, !resumeSessionId);
371
+ // Queue the initial message
372
+ process.queueMessage(message);
373
+ return process;
374
+ }
375
+ async resumeSession(sessionId, projectPath, message, permissionMode, modelSettings) {
376
+ // Check if already have a process for this session
377
+ const existingProcessId = this.sessionToProcess.get(sessionId);
378
+ if (existingProcessId) {
379
+ const existingProcess = this.processes.get(existingProcessId);
380
+ if (existingProcess) {
381
+ // Check if process is terminated - if so, start a fresh one
382
+ if (existingProcess.isTerminated) {
383
+ this.unregisterProcess(existingProcess);
384
+ }
385
+ else {
386
+ // Check if thinking settings changed - if so, abort and restart
387
+ const requestedThinking = modelSettings?.maxThinkingTokens;
388
+ if (existingProcess.maxThinkingTokens !== requestedThinking) {
389
+ const log = getLogger();
390
+ log.info({
391
+ event: "thinking_mode_changed",
392
+ sessionId,
393
+ processId: existingProcess.id,
394
+ oldThinking: existingProcess.maxThinkingTokens,
395
+ newThinking: requestedThinking,
396
+ }, `Thinking mode changed, restarting process: ${existingProcess.maxThinkingTokens} → ${requestedThinking}`);
397
+ // Abort the existing process and start fresh with new thinking settings
398
+ await existingProcess.abort();
399
+ this.unregisterProcess(existingProcess);
400
+ // Fall through to start a new session with the updated settings
401
+ }
402
+ else {
403
+ // Update permission mode if specified
404
+ if (permissionMode) {
405
+ existingProcess.setPermissionMode(permissionMode);
406
+ }
407
+ // Queue message to existing process
408
+ const result = existingProcess.queueMessage(message);
409
+ if (result.success) {
410
+ return existingProcess;
411
+ }
412
+ // Failed to queue - process likely terminated, clean up and start fresh
413
+ this.unregisterProcess(existingProcess);
414
+ }
415
+ }
416
+ }
417
+ }
418
+ // Check if there's already a queued request for this session
419
+ const existingQueued = this.workerQueue.findBySessionId(sessionId);
420
+ if (existingQueued) {
421
+ // Already queued - return current position
422
+ const position = this.workerQueue.getPosition(existingQueued.id);
423
+ return {
424
+ queued: true,
425
+ queueId: existingQueued.id,
426
+ position: position ?? 1,
427
+ };
428
+ }
429
+ const projectId = encodeProjectId(projectPath);
430
+ // Check if at capacity
431
+ if (this.isAtCapacity()) {
432
+ // Try to preempt an idle worker
433
+ const preemptable = this.findPreemptableWorker();
434
+ if (preemptable) {
435
+ await this.preemptWorker(preemptable);
436
+ // Fall through to start session normally
437
+ }
438
+ else {
439
+ // Queue the request
440
+ const result = this.workerQueue.enqueue({
441
+ type: "resume-session",
442
+ projectPath,
443
+ projectId,
444
+ sessionId,
445
+ message,
446
+ permissionMode,
447
+ });
448
+ if (isQueueFullError(result)) {
449
+ return result;
450
+ }
451
+ return {
452
+ queued: true,
453
+ queueId: result.queueId,
454
+ position: result.position,
455
+ };
456
+ }
457
+ }
458
+ // Resolve provider: use specified provider name, or fall back to default provider
459
+ const provider = modelSettings?.providerName
460
+ ? getProvider(modelSettings.providerName)
461
+ : this.provider;
462
+ // Use provider if available (preferred)
463
+ if (provider) {
464
+ return this.startProviderSession(projectPath, projectId, message, sessionId, permissionMode, modelSettings, provider);
465
+ }
466
+ // Use real SDK if available
467
+ if (this.realSdk) {
468
+ return this.startRealSession(projectPath, projectId, message, sessionId, permissionMode, modelSettings);
469
+ }
470
+ // Fall back to legacy mock SDK
471
+ return this.startLegacySession(projectPath, projectId, message, sessionId, permissionMode);
472
+ }
473
+ getProcess(processId) {
474
+ return this.processes.get(processId);
475
+ }
476
+ getProcessForSession(sessionId) {
477
+ const processId = this.sessionToProcess.get(sessionId);
478
+ if (!processId)
479
+ return undefined;
480
+ return this.processes.get(processId);
481
+ }
482
+ /**
483
+ * Queue a message to an existing session, handling thinking mode changes.
484
+ * If the thinking mode differs from the process's current setting, this will:
485
+ * 1. Abort the existing process
486
+ * 2. Start a new process with the new thinking settings
487
+ * 3. Queue the message to the new process
488
+ *
489
+ * @returns The process (possibly new), or an error object
490
+ */
491
+ async queueMessageToSession(sessionId, projectPath, message, permissionMode, modelSettings) {
492
+ const process = this.getProcessForSession(sessionId);
493
+ if (!process) {
494
+ return { success: false, error: "No active process for session" };
495
+ }
496
+ if (process.isTerminated) {
497
+ return { success: false, error: "Process terminated" };
498
+ }
499
+ // Check if thinking settings changed
500
+ const requestedThinking = modelSettings?.maxThinkingTokens;
501
+ if (process.maxThinkingTokens !== requestedThinking) {
502
+ const log = getLogger();
503
+ log.info({
504
+ event: "thinking_mode_changed_queue",
505
+ sessionId,
506
+ processId: process.id,
507
+ oldThinking: process.maxThinkingTokens,
508
+ newThinking: requestedThinking,
509
+ }, `Thinking mode changed on queue, restarting process: ${process.maxThinkingTokens} → ${requestedThinking}`);
510
+ // Abort the existing process
511
+ await process.abort();
512
+ this.unregisterProcess(process);
513
+ // Start a new session with the message and new thinking settings
514
+ const result = await this.resumeSession(sessionId, projectPath, message, permissionMode, modelSettings);
515
+ // Check if we got a process back
516
+ if ("id" in result) {
517
+ return { success: true, process: result, restarted: true };
518
+ }
519
+ // Queued or error
520
+ return { success: false, error: "Request was queued or failed" };
521
+ }
522
+ // No thinking change - just queue to existing process
523
+ if (permissionMode) {
524
+ process.setPermissionMode(permissionMode);
525
+ }
526
+ const result = process.queueMessage(message);
527
+ if (result.success) {
528
+ return { success: true, process, restarted: false };
529
+ }
530
+ return { success: false, error: result.error ?? "Failed to queue message" };
531
+ }
532
+ getAllProcesses() {
533
+ return Array.from(this.processes.values());
534
+ }
535
+ getProcessInfoList() {
536
+ return this.getAllProcesses().map((p) => p.getInfo());
537
+ }
538
+ /**
539
+ * Check if a session was ever owned by this server instance.
540
+ * Used to determine if orphaned tool detection should be trusted.
541
+ * For sessions we never owned (external), we can't know if tools were interrupted.
542
+ */
543
+ wasEverOwned(sessionId) {
544
+ return this.everOwnedSessions.has(sessionId);
545
+ }
546
+ async abortProcess(processId) {
547
+ const process = this.processes.get(processId);
548
+ if (!process)
549
+ return false;
550
+ const log = getLogger();
551
+ log.info({
552
+ event: "session_abort_requested",
553
+ sessionId: process.sessionId,
554
+ processId: process.id,
555
+ projectId: process.projectId,
556
+ currentState: process.state.type,
557
+ }, `Session abort requested: ${process.sessionId}`);
558
+ // Emit session-aborted event BEFORE aborting, so ExternalSessionTracker
559
+ // can set up the grace period before any file changes arrive
560
+ this.emitSessionAborted(process.sessionId, process.projectId);
561
+ await process.abort();
562
+ this.unregisterProcess(process);
563
+ return true;
564
+ }
565
+ emitSessionAborted(sessionId, projectId) {
566
+ if (!this.eventBus)
567
+ return;
568
+ const event = {
569
+ type: "session-aborted",
570
+ sessionId,
571
+ projectId,
572
+ timestamp: new Date().toISOString(),
573
+ };
574
+ this.eventBus.emit(event);
575
+ }
576
+ registerProcess(process, isNewSession) {
577
+ const log = getLogger();
578
+ log.info({
579
+ event: "session_registered",
580
+ sessionId: process.sessionId,
581
+ processId: process.id,
582
+ projectId: process.projectId,
583
+ projectPath: process.projectPath,
584
+ isNewSession,
585
+ permissionMode: process.permissionMode,
586
+ }, `Session registered: ${process.sessionId} (process: ${process.id})`);
587
+ this.processes.set(process.id, process);
588
+ this.sessionToProcess.set(process.sessionId, process.id);
589
+ this.everOwnedSessions.add(process.sessionId);
590
+ const status = {
591
+ state: "owned",
592
+ processId: process.id,
593
+ permissionMode: process.permissionMode,
594
+ modeVersion: process.modeVersion,
595
+ };
596
+ // Emit session created event for new sessions
597
+ if (isNewSession) {
598
+ this.emitSessionCreated(process, status);
599
+ }
600
+ // Emit status change event
601
+ this.emitStatusChange(process.sessionId, process.projectId, status);
602
+ // Emit initial process state (process starts in running state)
603
+ const initialState = process.state;
604
+ if (initialState.type === "running" ||
605
+ initialState.type === "waiting-input") {
606
+ // Convert InputRequest.type to PendingInputType if waiting for input at start
607
+ let pendingInputType;
608
+ if (initialState.type === "waiting-input") {
609
+ const requestType = initialState.request.type;
610
+ pendingInputType =
611
+ requestType === "tool-approval" ? "tool-approval" : "user-question";
612
+ }
613
+ this.emitProcessStateChange(process.sessionId, process.projectId, initialState.type, pendingInputType);
614
+ }
615
+ // Emit worker activity after registering (new worker added)
616
+ this.emitWorkerActivity();
617
+ // Listen for completion to auto-cleanup, and state changes for process state events
618
+ process.subscribe((event) => {
619
+ if (event.type === "complete") {
620
+ this.unregisterProcess(process);
621
+ }
622
+ else if (event.type === "session-id-changed") {
623
+ // Update session→process mapping when temp ID is replaced by real ID from SDK
624
+ // This is critical for ExternalSessionTracker to correctly identify owned sessions
625
+ const log = getLogger();
626
+ log.info({
627
+ event: "session_id_mapping_updated",
628
+ oldSessionId: event.oldSessionId,
629
+ newSessionId: event.newSessionId,
630
+ processId: process.id,
631
+ projectId: process.projectId,
632
+ }, `Session ID mapping updated: ${event.oldSessionId} → ${event.newSessionId}`);
633
+ // Keep both temp and real session ID mappings to support lookups by either ID
634
+ // Clients might still be using the temp ID when the real ID arrives
635
+ // The old temp ID mapping is retained (no delete)
636
+ this.sessionToProcess.set(event.newSessionId, process.id);
637
+ this.everOwnedSessions.add(event.newSessionId);
638
+ // Emit status change for new session ID so clients can update
639
+ const status = {
640
+ state: "owned",
641
+ processId: process.id,
642
+ permissionMode: process.permissionMode,
643
+ modeVersion: process.modeVersion,
644
+ };
645
+ this.emitStatusChange(event.newSessionId, process.projectId, status);
646
+ }
647
+ else if (event.type === "state-change") {
648
+ // Emit process state change for all states that clients need to track
649
+ // This includes running/waiting-input (active) and idle (inactive)
650
+ if (event.state.type === "running" ||
651
+ event.state.type === "waiting-input" ||
652
+ event.state.type === "idle") {
653
+ // Convert InputRequest.type to PendingInputType when waiting for input
654
+ // "tool-approval" stays as-is, "question" or "choice" becomes "user-question"
655
+ let pendingInputType;
656
+ if (event.state.type === "waiting-input") {
657
+ const requestType = event.state.request.type;
658
+ pendingInputType =
659
+ requestType === "tool-approval"
660
+ ? "tool-approval"
661
+ : "user-question";
662
+ }
663
+ this.emitProcessStateChange(process.sessionId, process.projectId, event.state.type, pendingInputType);
664
+ }
665
+ // Emit worker activity on any state change (affects hasActiveWork)
666
+ this.emitWorkerActivity();
667
+ }
668
+ });
669
+ }
670
+ unregisterProcess(process) {
671
+ const log = getLogger();
672
+ const durationMs = Date.now() - process.startedAt.getTime();
673
+ log.info({
674
+ event: "session_unregistered",
675
+ sessionId: process.sessionId,
676
+ processId: process.id,
677
+ projectId: process.projectId,
678
+ durationMs,
679
+ finalState: process.state.type,
680
+ terminationReason: process.terminationReason,
681
+ }, `Session unregistered: ${process.sessionId} after ${durationMs}ms (reason: ${process.terminationReason ?? process.state.type})`);
682
+ // Capture process info for terminated list before deleting
683
+ const terminatedInfo = process.getInfo();
684
+ terminatedInfo.state = "terminated"; // Override state since process may have been forcefully aborted
685
+ terminatedInfo.terminatedAt = new Date().toISOString();
686
+ if (process.terminationReason) {
687
+ terminatedInfo.terminationReason = process.terminationReason;
688
+ }
689
+ this.addTerminatedProcess(terminatedInfo);
690
+ this.processes.delete(process.id);
691
+ // Delete all session ID mappings that point to this process
692
+ // This handles both temp and real session IDs
693
+ for (const [sessionId, processId] of this.sessionToProcess.entries()) {
694
+ if (processId === process.id) {
695
+ this.sessionToProcess.delete(sessionId);
696
+ }
697
+ }
698
+ // Emit status change event (back to idle)
699
+ this.emitStatusChange(process.sessionId, process.projectId, {
700
+ state: "idle",
701
+ });
702
+ // Emit process state change to notify clients that this session is no longer running
703
+ // This is needed for real-time updates (e.g., AgentsNavItem indicator)
704
+ this.emitProcessStateChange(process.sessionId, process.projectId, "idle");
705
+ // Emit worker activity after unregistering (worker removed)
706
+ this.emitWorkerActivity();
707
+ // Process queue when a worker becomes available
708
+ void this.processQueue();
709
+ }
710
+ /**
711
+ * Add a terminated process to the tracking list.
712
+ * Prunes old entries and caps at MAX_TERMINATED_PROCESSES.
713
+ */
714
+ addTerminatedProcess(info) {
715
+ this.terminatedProcesses.push(info);
716
+ // Cap at max entries
717
+ if (this.terminatedProcesses.length > MAX_TERMINATED_PROCESSES) {
718
+ this.terminatedProcesses = this.terminatedProcesses.slice(-MAX_TERMINATED_PROCESSES);
719
+ }
720
+ }
721
+ /**
722
+ * Get recently terminated processes (within retention window).
723
+ * Prunes expired entries before returning.
724
+ */
725
+ getRecentlyTerminatedProcesses() {
726
+ const now = Date.now();
727
+ const cutoff = now - TERMINATED_RETENTION_MS;
728
+ // Prune old entries
729
+ this.terminatedProcesses = this.terminatedProcesses.filter((p) => {
730
+ if (!p.terminatedAt)
731
+ return false;
732
+ return new Date(p.terminatedAt).getTime() > cutoff;
733
+ });
734
+ return [...this.terminatedProcesses];
735
+ }
736
+ emitStatusChange(sessionId, projectId, status) {
737
+ if (!this.eventBus)
738
+ return;
739
+ const event = {
740
+ type: "session-status-changed",
741
+ sessionId,
742
+ projectId,
743
+ status,
744
+ timestamp: new Date().toISOString(),
745
+ };
746
+ this.eventBus.emit(event);
747
+ }
748
+ emitSessionCreated(process, status) {
749
+ if (!this.eventBus)
750
+ return;
751
+ const now = new Date().toISOString();
752
+ const session = {
753
+ id: process.sessionId,
754
+ projectId: process.projectId,
755
+ title: null, // Title comes from first user message, populated later via file change
756
+ fullTitle: null,
757
+ createdAt: now,
758
+ updatedAt: now,
759
+ messageCount: 0,
760
+ status,
761
+ provider: process.provider,
762
+ };
763
+ const event = {
764
+ type: "session-created",
765
+ session,
766
+ timestamp: now,
767
+ };
768
+ this.eventBus.emit(event);
769
+ }
770
+ emitProcessStateChange(sessionId, projectId, processState, pendingInputType) {
771
+ if (!this.eventBus)
772
+ return;
773
+ const event = {
774
+ type: "process-state-changed",
775
+ sessionId,
776
+ projectId,
777
+ processState,
778
+ pendingInputType,
779
+ timestamp: new Date().toISOString(),
780
+ };
781
+ this.eventBus.emit(event);
782
+ }
783
+ /**
784
+ * Emit worker activity event for safe restart indicator.
785
+ * Called when workers are added, removed, or change state.
786
+ */
787
+ emitWorkerActivity() {
788
+ if (!this.eventBus)
789
+ return;
790
+ const hasActiveWork = Array.from(this.processes.values()).some((p) => p.state.type === "running" || p.state.type === "waiting-input");
791
+ const event = {
792
+ type: "worker-activity-changed",
793
+ activeWorkers: this.processes.size,
794
+ queueLength: this.workerQueue.length,
795
+ hasActiveWork,
796
+ timestamp: new Date().toISOString(),
797
+ };
798
+ this.eventBus.emit(event);
799
+ }
800
+ // ============ Worker Pool Methods ============
801
+ /**
802
+ * Check if we're at worker capacity.
803
+ */
804
+ isAtCapacity() {
805
+ if (this.maxWorkers <= 0)
806
+ return false; // 0 = unlimited
807
+ return this.processes.size >= this.maxWorkers;
808
+ }
809
+ /**
810
+ * Find a preemptable worker (idle longer than threshold).
811
+ * Returns the worker that has been idle longest.
812
+ * Does not preempt workers waiting for input.
813
+ */
814
+ findPreemptableWorker() {
815
+ let oldest;
816
+ let oldestIdleTime = 0;
817
+ const now = Date.now();
818
+ for (const process of this.processes.values()) {
819
+ // Only preempt idle processes, not waiting-input
820
+ if (process.state.type !== "idle")
821
+ continue;
822
+ const idleMs = now - process.state.since.getTime();
823
+ if (idleMs >= this.idlePreemptThresholdMs && idleMs > oldestIdleTime) {
824
+ oldest = process;
825
+ oldestIdleTime = idleMs;
826
+ }
827
+ }
828
+ return oldest;
829
+ }
830
+ /**
831
+ * Preempt an idle worker to make room for a new request.
832
+ */
833
+ async preemptWorker(process) {
834
+ await process.abort();
835
+ this.unregisterProcess(process);
836
+ }
837
+ /**
838
+ * Process the queue - called when a worker becomes available.
839
+ */
840
+ async processQueue() {
841
+ while (!this.workerQueue.isEmpty && !this.isAtCapacity()) {
842
+ const request = this.workerQueue.dequeue();
843
+ if (!request)
844
+ break;
845
+ try {
846
+ let process;
847
+ if (request.type === "new-session") {
848
+ const result = await this.startSessionInternal(request.projectPath, request.projectId, request.message, undefined, request.permissionMode);
849
+ process = result;
850
+ }
851
+ else {
852
+ const result = await this.startSessionInternal(request.projectPath, request.projectId, request.message, request.sessionId, request.permissionMode);
853
+ process = result;
854
+ }
855
+ // Emit queue removed event
856
+ this.eventBus?.emit({
857
+ type: "queue-request-removed",
858
+ queueId: request.id,
859
+ sessionId: request.sessionId,
860
+ reason: "started",
861
+ timestamp: new Date().toISOString(),
862
+ });
863
+ request.resolve({ status: "started", processId: process.id });
864
+ }
865
+ catch (error) {
866
+ // On error, resolve with cancelled status
867
+ request.resolve({
868
+ status: "cancelled",
869
+ reason: error instanceof Error ? error.message : String(error),
870
+ });
871
+ }
872
+ }
873
+ }
874
+ /**
875
+ * Internal session start that always starts immediately.
876
+ * Used by queue processing.
877
+ */
878
+ async startSessionInternal(projectPath, projectId, message, resumeSessionId, permissionMode) {
879
+ // Use provider if available (preferred)
880
+ if (this.provider) {
881
+ return this.startProviderSession(projectPath, projectId, message, resumeSessionId, permissionMode);
882
+ }
883
+ // Use real SDK if available
884
+ if (this.realSdk) {
885
+ return this.startRealSession(projectPath, projectId, message, resumeSessionId, permissionMode);
886
+ }
887
+ // Fall back to legacy mock SDK
888
+ return this.startLegacySession(projectPath, projectId, message, resumeSessionId, permissionMode);
889
+ }
890
+ // ============ Public Queue Methods ============
891
+ /**
892
+ * Cancel a queued request.
893
+ * @returns true if cancelled, false if not found
894
+ */
895
+ cancelQueuedRequest(queueId) {
896
+ return this.workerQueue.cancel(queueId);
897
+ }
898
+ /**
899
+ * Get info about all queued requests.
900
+ */
901
+ getQueueInfo() {
902
+ return this.workerQueue.getQueueInfo();
903
+ }
904
+ /**
905
+ * Get position for a specific queue entry.
906
+ */
907
+ getQueuePosition(queueId) {
908
+ return this.workerQueue.getPosition(queueId);
909
+ }
910
+ /**
911
+ * Get current worker count and capacity info.
912
+ */
913
+ getWorkerPoolStatus() {
914
+ return {
915
+ activeWorkers: this.processes.size,
916
+ maxWorkers: this.maxWorkers,
917
+ queueLength: this.workerQueue.length,
918
+ };
919
+ }
920
+ /**
921
+ * Get worker activity status for safe restart indicator.
922
+ * Returns whether any workers are actively processing or waiting for input.
923
+ */
924
+ getWorkerActivity() {
925
+ const hasActiveWork = Array.from(this.processes.values()).some((p) => p.state.type === "running" || p.state.type === "waiting-input");
926
+ return {
927
+ activeWorkers: this.processes.size,
928
+ queueLength: this.workerQueue.length,
929
+ hasActiveWork,
930
+ };
931
+ }
932
+ }
933
+ //# sourceMappingURL=Supervisor.js.map