@pellux/goodvibes-sdk 0.37.2 → 1.0.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 (555) hide show
  1. package/dist/contracts/artifacts/operator-contract.json +3171 -929
  2. package/dist/daemon.d.ts +2 -0
  3. package/dist/daemon.d.ts.map +1 -1
  4. package/dist/daemon.js +4 -0
  5. package/dist/events/communication.d.ts +21 -1
  6. package/dist/events/communication.d.ts.map +1 -1
  7. package/dist/events/surfaces.d.ts +25 -3
  8. package/dist/events/surfaces.d.ts.map +1 -1
  9. package/dist/events/surfaces.js +22 -1
  10. package/dist/events/workflows.d.ts +7 -6
  11. package/dist/events/workflows.d.ts.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/platform/agents/archetypes.d.ts.map +1 -1
  15. package/dist/platform/agents/archetypes.js +7 -0
  16. package/dist/platform/agents/index.d.ts +1 -0
  17. package/dist/platform/agents/index.d.ts.map +1 -1
  18. package/dist/platform/agents/index.js +1 -0
  19. package/dist/platform/agents/message-bus-core.d.ts +7 -0
  20. package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
  21. package/dist/platform/agents/message-bus-core.js +2 -1
  22. package/dist/platform/agents/orchestrator-runner.d.ts +50 -1
  23. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  24. package/dist/platform/agents/orchestrator-runner.js +172 -7
  25. package/dist/platform/agents/orchestrator.d.ts +78 -6
  26. package/dist/platform/agents/orchestrator.d.ts.map +1 -1
  27. package/dist/platform/agents/orchestrator.js +95 -18
  28. package/dist/platform/agents/planner-decomposition-runner.d.ts +38 -0
  29. package/dist/platform/agents/planner-decomposition-runner.d.ts.map +1 -0
  30. package/dist/platform/agents/planner-decomposition-runner.js +113 -0
  31. package/dist/platform/agents/turn-knowledge-injection.d.ts +192 -0
  32. package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -0
  33. package/dist/platform/agents/turn-knowledge-injection.js +269 -0
  34. package/dist/platform/agents/worktree.d.ts +126 -8
  35. package/dist/platform/agents/worktree.d.ts.map +1 -1
  36. package/dist/platform/agents/worktree.js +240 -19
  37. package/dist/platform/agents/wrfc-controller.d.ts +46 -0
  38. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  39. package/dist/platform/agents/wrfc-controller.js +213 -32
  40. package/dist/platform/agents/wrfc-gate-runtime.d.ts +9 -0
  41. package/dist/platform/agents/wrfc-gate-runtime.d.ts.map +1 -1
  42. package/dist/platform/agents/wrfc-gate-runtime.js +7 -3
  43. package/dist/platform/agents/wrfc-gates.d.ts +1 -1
  44. package/dist/platform/agents/wrfc-gates.d.ts.map +1 -1
  45. package/dist/platform/agents/wrfc-gates.js +7 -1
  46. package/dist/platform/agents/wrfc-types.d.ts +23 -3
  47. package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
  48. package/dist/platform/automation/types.d.ts +9 -1
  49. package/dist/platform/automation/types.d.ts.map +1 -1
  50. package/dist/platform/calendar/calendar-api-shared.d.ts +25 -0
  51. package/dist/platform/calendar/calendar-api-shared.d.ts.map +1 -0
  52. package/dist/platform/calendar/calendar-api-shared.js +100 -0
  53. package/dist/platform/calendar/calendar-connector.d.ts +79 -0
  54. package/dist/platform/calendar/calendar-connector.d.ts.map +1 -0
  55. package/dist/platform/calendar/calendar-connector.js +155 -0
  56. package/dist/platform/calendar/google-calendar-api.d.ts +25 -0
  57. package/dist/platform/calendar/google-calendar-api.d.ts.map +1 -0
  58. package/dist/platform/calendar/google-calendar-api.js +89 -0
  59. package/dist/platform/calendar/http-fetch-adapter.d.ts +25 -0
  60. package/dist/platform/calendar/http-fetch-adapter.d.ts.map +1 -0
  61. package/dist/platform/calendar/http-fetch-adapter.js +25 -0
  62. package/dist/platform/calendar/ics-parser.d.ts +35 -0
  63. package/dist/platform/calendar/ics-parser.d.ts.map +1 -0
  64. package/dist/platform/calendar/ics-parser.js +236 -0
  65. package/dist/platform/calendar/index.d.ts +41 -0
  66. package/dist/platform/calendar/index.d.ts.map +1 -0
  67. package/dist/platform/calendar/index.js +49 -0
  68. package/dist/platform/calendar/merged-calendar-model.d.ts +67 -0
  69. package/dist/platform/calendar/merged-calendar-model.d.ts.map +1 -0
  70. package/dist/platform/calendar/merged-calendar-model.js +181 -0
  71. package/dist/platform/calendar/microsoft-graph-api.d.ts +25 -0
  72. package/dist/platform/calendar/microsoft-graph-api.d.ts.map +1 -0
  73. package/dist/platform/calendar/microsoft-graph-api.js +95 -0
  74. package/dist/platform/calendar/oauth-flow.d.ts +62 -0
  75. package/dist/platform/calendar/oauth-flow.d.ts.map +1 -0
  76. package/dist/platform/calendar/oauth-flow.js +305 -0
  77. package/dist/platform/calendar/oauth-providers.d.ts +43 -0
  78. package/dist/platform/calendar/oauth-providers.d.ts.map +1 -0
  79. package/dist/platform/calendar/oauth-providers.js +120 -0
  80. package/dist/platform/calendar/oauth-token-store.d.ts +72 -0
  81. package/dist/platform/calendar/oauth-token-store.d.ts.map +1 -0
  82. package/dist/platform/calendar/oauth-token-store.js +189 -0
  83. package/dist/platform/calendar/oauth-types.d.ts +274 -0
  84. package/dist/platform/calendar/oauth-types.d.ts.map +1 -0
  85. package/dist/platform/calendar/oauth-types.js +22 -0
  86. package/dist/platform/calendar/rrule.d.ts +39 -0
  87. package/dist/platform/calendar/rrule.d.ts.map +1 -0
  88. package/dist/platform/calendar/rrule.js +261 -0
  89. package/dist/platform/calendar/subscription-store.d.ts +118 -0
  90. package/dist/platform/calendar/subscription-store.d.ts.map +1 -0
  91. package/dist/platform/calendar/subscription-store.js +293 -0
  92. package/dist/platform/calendar/types.d.ts +170 -0
  93. package/dist/platform/calendar/types.d.ts.map +1 -0
  94. package/dist/platform/calendar/types.js +21 -0
  95. package/dist/platform/companion/companion-chat-attachments.d.ts +29 -0
  96. package/dist/platform/companion/companion-chat-attachments.d.ts.map +1 -0
  97. package/dist/platform/companion/companion-chat-attachments.js +121 -0
  98. package/dist/platform/companion/companion-chat-broker-bridge.d.ts +40 -0
  99. package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -0
  100. package/dist/platform/companion/companion-chat-broker-bridge.js +14 -0
  101. package/dist/platform/companion/companion-chat-broker-sync.d.ts +38 -0
  102. package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -0
  103. package/dist/platform/companion/companion-chat-broker-sync.js +80 -0
  104. package/dist/platform/companion/companion-chat-gc.d.ts +63 -0
  105. package/dist/platform/companion/companion-chat-gc.d.ts.map +1 -0
  106. package/dist/platform/companion/companion-chat-gc.js +38 -0
  107. package/dist/platform/companion/companion-chat-manager.d.ts +67 -20
  108. package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
  109. package/dist/platform/companion/companion-chat-manager.js +130 -144
  110. package/dist/platform/companion/companion-chat-persistence.d.ts +9 -1
  111. package/dist/platform/companion/companion-chat-persistence.d.ts.map +1 -1
  112. package/dist/platform/companion/companion-chat-persistence.js +10 -2
  113. package/dist/platform/companion/companion-chat-routes.d.ts +2 -1
  114. package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
  115. package/dist/platform/companion/companion-chat-routes.js +37 -4
  116. package/dist/platform/config/credential-status.d.ts +28 -0
  117. package/dist/platform/config/credential-status.d.ts.map +1 -0
  118. package/dist/platform/config/credential-status.js +75 -0
  119. package/dist/platform/config/index.d.ts +25 -0
  120. package/dist/platform/config/index.d.ts.map +1 -1
  121. package/dist/platform/config/index.js +18 -0
  122. package/dist/platform/config/manager.d.ts +18 -0
  123. package/dist/platform/config/manager.d.ts.map +1 -1
  124. package/dist/platform/config/manager.js +36 -2
  125. package/dist/platform/config/migrations.d.ts +48 -0
  126. package/dist/platform/config/migrations.d.ts.map +1 -0
  127. package/dist/platform/config/migrations.js +54 -0
  128. package/dist/platform/config/schema-domain-core.d.ts +10 -1
  129. package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
  130. package/dist/platform/config/schema-domain-core.js +46 -3
  131. package/dist/platform/config/schema-types.d.ts +13 -7
  132. package/dist/platform/config/schema-types.d.ts.map +1 -1
  133. package/dist/platform/config/schema.d.ts.map +1 -1
  134. package/dist/platform/config/schema.js +2 -0
  135. package/dist/platform/control-plane/approval-broker.d.ts +11 -0
  136. package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
  137. package/dist/platform/control-plane/approval-broker.js +17 -1
  138. package/dist/platform/control-plane/approval-hunk-apply.d.ts +77 -0
  139. package/dist/platform/control-plane/approval-hunk-apply.d.ts.map +1 -0
  140. package/dist/platform/control-plane/approval-hunk-apply.js +80 -0
  141. package/dist/platform/control-plane/gateway-disabled-response.d.ts +20 -0
  142. package/dist/platform/control-plane/gateway-disabled-response.d.ts.map +1 -0
  143. package/dist/platform/control-plane/gateway-disabled-response.js +24 -0
  144. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts +68 -0
  145. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts.map +1 -0
  146. package/dist/platform/control-plane/gateway-scope-enforcement.js +91 -0
  147. package/dist/platform/control-plane/gateway-utils.d.ts +17 -0
  148. package/dist/platform/control-plane/gateway-utils.d.ts.map +1 -1
  149. package/dist/platform/control-plane/gateway-utils.js +30 -0
  150. package/dist/platform/control-plane/gateway.d.ts +12 -2
  151. package/dist/platform/control-plane/gateway.d.ts.map +1 -1
  152. package/dist/platform/control-plane/gateway.js +27 -31
  153. package/dist/platform/control-plane/index.d.ts +6 -1
  154. package/dist/platform/control-plane/index.d.ts.map +1 -1
  155. package/dist/platform/control-plane/index.js +4 -0
  156. package/dist/platform/control-plane/invoke-input-validation.d.ts +56 -0
  157. package/dist/platform/control-plane/invoke-input-validation.d.ts.map +1 -0
  158. package/dist/platform/control-plane/invoke-input-validation.js +163 -0
  159. package/dist/platform/control-plane/method-catalog-admin.d.ts.map +1 -1
  160. package/dist/platform/control-plane/method-catalog-admin.js +12 -1
  161. package/dist/platform/control-plane/method-catalog-calendar.d.ts +16 -0
  162. package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -1
  163. package/dist/platform/control-plane/method-catalog-calendar.js +21 -0
  164. package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
  165. package/dist/platform/control-plane/method-catalog-channels.js +32 -3
  166. package/dist/platform/control-plane/method-catalog-control-automation.d.ts.map +1 -1
  167. package/dist/platform/control-plane/method-catalog-control-automation.js +19 -34
  168. package/dist/platform/control-plane/method-catalog-control-companion.d.ts +15 -0
  169. package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -0
  170. package/dist/platform/control-plane/method-catalog-control-companion.js +133 -0
  171. package/dist/platform/control-plane/method-catalog-control-core.d.ts.map +1 -1
  172. package/dist/platform/control-plane/method-catalog-control-core.js +104 -122
  173. package/dist/platform/control-plane/method-catalog-control.d.ts.map +1 -1
  174. package/dist/platform/control-plane/method-catalog-control.js +4 -0
  175. package/dist/platform/control-plane/method-catalog-email.d.ts +17 -0
  176. package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
  177. package/dist/platform/control-plane/method-catalog-email.js +21 -0
  178. package/dist/platform/control-plane/method-catalog-events.d.ts +28 -0
  179. package/dist/platform/control-plane/method-catalog-events.d.ts.map +1 -1
  180. package/dist/platform/control-plane/method-catalog-events.js +74 -1
  181. package/dist/platform/control-plane/method-catalog-fleet.d.ts +24 -0
  182. package/dist/platform/control-plane/method-catalog-fleet.d.ts.map +1 -0
  183. package/dist/platform/control-plane/method-catalog-fleet.js +65 -0
  184. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +84 -0
  185. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts.map +1 -0
  186. package/dist/platform/control-plane/method-catalog-route-reconcile.js +103 -0
  187. package/dist/platform/control-plane/method-catalog-shared.d.ts +29 -0
  188. package/dist/platform/control-plane/method-catalog-shared.d.ts.map +1 -1
  189. package/dist/platform/control-plane/method-catalog.d.ts +9 -0
  190. package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
  191. package/dist/platform/control-plane/method-catalog.js +32 -3
  192. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts +8 -0
  193. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
  194. package/dist/platform/control-plane/operator-contract-schemas-admin.js +22 -1
  195. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts +18 -0
  196. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts.map +1 -0
  197. package/dist/platform/control-plane/operator-contract-schemas-fleet.js +182 -0
  198. package/dist/platform/control-plane/operator-contract-schemas-permissions.d.ts.map +1 -1
  199. package/dist/platform/control-plane/operator-contract-schemas-permissions.js +5 -0
  200. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +29 -0
  201. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
  202. package/dist/platform/control-plane/operator-contract-schemas-runtime.js +57 -3
  203. package/dist/platform/control-plane/operator-contract-schemas.d.ts +1 -0
  204. package/dist/platform/control-plane/operator-contract-schemas.d.ts.map +1 -1
  205. package/dist/platform/control-plane/operator-contract-schemas.js +1 -0
  206. package/dist/platform/control-plane/operator-contract.d.ts.map +1 -1
  207. package/dist/platform/control-plane/operator-contract.js +8 -0
  208. package/dist/platform/control-plane/routes/checkpoints.d.ts +39 -0
  209. package/dist/platform/control-plane/routes/checkpoints.d.ts.map +1 -0
  210. package/dist/platform/control-plane/routes/checkpoints.js +166 -0
  211. package/dist/platform/control-plane/routes/fleet.d.ts +53 -0
  212. package/dist/platform/control-plane/routes/fleet.d.ts.map +1 -0
  213. package/dist/platform/control-plane/routes/fleet.js +153 -0
  214. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +30 -0
  215. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts.map +1 -0
  216. package/dist/platform/control-plane/routes/gateway-verb-error.js +36 -0
  217. package/dist/platform/control-plane/routes/index.d.ts +0 -6
  218. package/dist/platform/control-plane/routes/index.d.ts.map +1 -1
  219. package/dist/platform/control-plane/routes/index.js +5 -5
  220. package/dist/platform/control-plane/routes/invocation-params.d.ts +23 -0
  221. package/dist/platform/control-plane/routes/invocation-params.d.ts.map +1 -0
  222. package/dist/platform/control-plane/routes/invocation-params.js +9 -0
  223. package/dist/platform/control-plane/routes/register-w3-s2.d.ts +26 -0
  224. package/dist/platform/control-plane/routes/register-w3-s2.d.ts.map +1 -0
  225. package/dist/platform/control-plane/routes/register-w3-s2.js +8 -0
  226. package/dist/platform/control-plane/routes/session-search.d.ts +37 -0
  227. package/dist/platform/control-plane/routes/session-search.d.ts.map +1 -0
  228. package/dist/platform/control-plane/routes/session-search.js +113 -0
  229. package/dist/platform/control-plane/session-broker-gc.d.ts +16 -0
  230. package/dist/platform/control-plane/session-broker-gc.d.ts.map +1 -1
  231. package/dist/platform/control-plane/session-broker-gc.js +23 -6
  232. package/dist/platform/control-plane/session-broker-helpers.d.ts +3 -3
  233. package/dist/platform/control-plane/session-broker-helpers.d.ts.map +1 -1
  234. package/dist/platform/control-plane/session-broker-inputs.d.ts +18 -0
  235. package/dist/platform/control-plane/session-broker-inputs.d.ts.map +1 -1
  236. package/dist/platform/control-plane/session-broker-inputs.js +34 -0
  237. package/dist/platform/control-plane/session-broker-sessions.d.ts +102 -3
  238. package/dist/platform/control-plane/session-broker-sessions.d.ts.map +1 -1
  239. package/dist/platform/control-plane/session-broker-sessions.js +179 -5
  240. package/dist/platform/control-plane/session-broker-state.d.ts +20 -1
  241. package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
  242. package/dist/platform/control-plane/session-broker-state.js +67 -5
  243. package/dist/platform/control-plane/session-broker.d.ts +51 -38
  244. package/dist/platform/control-plane/session-broker.d.ts.map +1 -1
  245. package/dist/platform/control-plane/session-broker.js +183 -75
  246. package/dist/platform/control-plane/session-store-importer.d.ts +57 -0
  247. package/dist/platform/control-plane/session-store-importer.d.ts.map +1 -0
  248. package/dist/platform/control-plane/session-store-importer.js +227 -0
  249. package/dist/platform/control-plane/session-types.d.ts +142 -7
  250. package/dist/platform/control-plane/session-types.d.ts.map +1 -1
  251. package/dist/platform/core/adaptive-planner.d.ts +50 -0
  252. package/dist/platform/core/adaptive-planner.d.ts.map +1 -1
  253. package/dist/platform/core/adaptive-planner.js +49 -0
  254. package/dist/platform/core/execution-plan.d.ts +43 -1
  255. package/dist/platform/core/execution-plan.d.ts.map +1 -1
  256. package/dist/platform/core/execution-plan.js +46 -10
  257. package/dist/platform/core/index.d.ts +2 -0
  258. package/dist/platform/core/index.d.ts.map +1 -1
  259. package/dist/platform/core/index.js +2 -0
  260. package/dist/platform/core/orchestrator-runtime.d.ts +31 -0
  261. package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
  262. package/dist/platform/core/orchestrator-tool-runtime.d.ts +7 -0
  263. package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  264. package/dist/platform/core/orchestrator-tool-runtime.js +10 -0
  265. package/dist/platform/core/orchestrator-turn-loop.d.ts +35 -1
  266. package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
  267. package/dist/platform/core/orchestrator-turn-loop.js +121 -3
  268. package/dist/platform/core/orchestrator.d.ts +67 -0
  269. package/dist/platform/core/orchestrator.d.ts.map +1 -1
  270. package/dist/platform/core/orchestrator.js +89 -1
  271. package/dist/platform/core/plan-decomposition.d.ts +196 -0
  272. package/dist/platform/core/plan-decomposition.d.ts.map +1 -0
  273. package/dist/platform/core/plan-decomposition.js +417 -0
  274. package/dist/platform/core/plan-proposal.d.ts +204 -0
  275. package/dist/platform/core/plan-proposal.d.ts.map +1 -0
  276. package/dist/platform/core/plan-proposal.js +296 -0
  277. package/dist/platform/core/wrfc-routing.d.ts +1 -0
  278. package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
  279. package/dist/platform/core/wrfc-routing.js +51 -1
  280. package/dist/platform/daemon/boot.d.ts +63 -0
  281. package/dist/platform/daemon/boot.d.ts.map +1 -0
  282. package/dist/platform/daemon/boot.js +60 -0
  283. package/dist/platform/daemon/cli.js +2 -1
  284. package/dist/platform/daemon/control-plane.d.ts.map +1 -1
  285. package/dist/platform/daemon/control-plane.js +50 -1
  286. package/dist/platform/daemon/facade-composition.d.ts.map +1 -1
  287. package/dist/platform/daemon/facade-composition.js +6 -0
  288. package/dist/platform/daemon/facade.d.ts +18 -6
  289. package/dist/platform/daemon/facade.d.ts.map +1 -1
  290. package/dist/platform/daemon/facade.js +50 -43
  291. package/dist/platform/daemon/http/router-route-contexts.d.ts +1 -0
  292. package/dist/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
  293. package/dist/platform/daemon/http/router-route-contexts.js +1 -0
  294. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +13 -0
  295. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts.map +1 -0
  296. package/dist/platform/daemon/http/router-session-broker-adapter.js +27 -0
  297. package/dist/platform/daemon/http/router.d.ts +1 -1
  298. package/dist/platform/daemon/http/router.d.ts.map +1 -1
  299. package/dist/platform/daemon/http/router.js +7 -22
  300. package/dist/platform/daemon/http/runtime-route-types.d.ts +42 -4
  301. package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  302. package/dist/platform/daemon/index.d.ts +2 -0
  303. package/dist/platform/daemon/index.d.ts.map +1 -1
  304. package/dist/platform/daemon/index.js +1 -0
  305. package/dist/platform/daemon/service-manager.d.ts +16 -0
  306. package/dist/platform/daemon/service-manager.d.ts.map +1 -1
  307. package/dist/platform/daemon/service-manager.js +79 -15
  308. package/dist/platform/intelligence/tree-sitter/service.d.ts.map +1 -1
  309. package/dist/platform/intelligence/tree-sitter/service.js +16 -2
  310. package/dist/platform/knowledge/browser-history/readers.d.ts.map +1 -1
  311. package/dist/platform/knowledge/browser-history/readers.js +15 -5
  312. package/dist/platform/knowledge/knowledge-api.d.ts +26 -0
  313. package/dist/platform/knowledge/knowledge-api.d.ts.map +1 -1
  314. package/dist/platform/knowledge/knowledge-api.js +11 -0
  315. package/dist/platform/knowledge/project-planning/service.d.ts +14 -1
  316. package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
  317. package/dist/platform/knowledge/project-planning/service.js +77 -0
  318. package/dist/platform/knowledge/project-planning/types.d.ts +32 -0
  319. package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
  320. package/dist/platform/orchestration/bookkeeping.d.ts +12 -0
  321. package/dist/platform/orchestration/bookkeeping.d.ts.map +1 -0
  322. package/dist/platform/orchestration/bookkeeping.js +91 -0
  323. package/dist/platform/orchestration/budget.d.ts +22 -0
  324. package/dist/platform/orchestration/budget.d.ts.map +1 -0
  325. package/dist/platform/orchestration/budget.js +35 -0
  326. package/dist/platform/orchestration/cancellation.d.ts +31 -0
  327. package/dist/platform/orchestration/cancellation.d.ts.map +1 -0
  328. package/dist/platform/orchestration/cancellation.js +25 -0
  329. package/dist/platform/orchestration/controller-compat.d.ts +46 -0
  330. package/dist/platform/orchestration/controller-compat.d.ts.map +1 -0
  331. package/dist/platform/orchestration/controller-compat.js +27 -0
  332. package/dist/platform/orchestration/dirty-guard.d.ts +32 -0
  333. package/dist/platform/orchestration/dirty-guard.d.ts.map +1 -0
  334. package/dist/platform/orchestration/dirty-guard.js +147 -0
  335. package/dist/platform/orchestration/engine.d.ts +82 -0
  336. package/dist/platform/orchestration/engine.d.ts.map +1 -0
  337. package/dist/platform/orchestration/engine.js +623 -0
  338. package/dist/platform/orchestration/index.d.ts +20 -0
  339. package/dist/platform/orchestration/index.d.ts.map +1 -0
  340. package/dist/platform/orchestration/index.js +11 -0
  341. package/dist/platform/orchestration/persistence.d.ts +24 -0
  342. package/dist/platform/orchestration/persistence.d.ts.map +1 -0
  343. package/dist/platform/orchestration/persistence.js +179 -0
  344. package/dist/platform/orchestration/phase-runner.d.ts +114 -0
  345. package/dist/platform/orchestration/phase-runner.d.ts.map +1 -0
  346. package/dist/platform/orchestration/phase-runner.js +347 -0
  347. package/dist/platform/orchestration/proposal-workstream.d.ts +56 -0
  348. package/dist/platform/orchestration/proposal-workstream.d.ts.map +1 -0
  349. package/dist/platform/orchestration/proposal-workstream.js +76 -0
  350. package/dist/platform/orchestration/scheduler.d.ts +64 -0
  351. package/dist/platform/orchestration/scheduler.d.ts.map +1 -0
  352. package/dist/platform/orchestration/scheduler.js +73 -0
  353. package/dist/platform/orchestration/types.d.ts +535 -0
  354. package/dist/platform/orchestration/types.d.ts.map +1 -0
  355. package/dist/platform/orchestration/types.js +47 -0
  356. package/dist/platform/orchestration/worktree-isolation.d.ts +33 -0
  357. package/dist/platform/orchestration/worktree-isolation.d.ts.map +1 -0
  358. package/dist/platform/orchestration/worktree-isolation.js +248 -0
  359. package/dist/platform/presentation/glyphs.d.ts +91 -0
  360. package/dist/platform/presentation/glyphs.d.ts.map +1 -0
  361. package/dist/platform/presentation/glyphs.js +93 -0
  362. package/dist/platform/presentation/index.d.ts +28 -0
  363. package/dist/platform/presentation/index.d.ts.map +1 -0
  364. package/dist/platform/presentation/index.js +27 -0
  365. package/dist/platform/presentation/thinking-phrases.d.ts +12 -0
  366. package/dist/platform/presentation/thinking-phrases.d.ts.map +1 -0
  367. package/dist/platform/presentation/thinking-phrases.js +32 -0
  368. package/dist/platform/presentation/tones.d.ts +121 -0
  369. package/dist/platform/presentation/tones.d.ts.map +1 -0
  370. package/dist/platform/presentation/tones.js +145 -0
  371. package/dist/platform/presentation/waiting-wording.d.ts +54 -0
  372. package/dist/platform/presentation/waiting-wording.d.ts.map +1 -0
  373. package/dist/platform/presentation/waiting-wording.js +51 -0
  374. package/dist/platform/providers/runtime-snapshot.d.ts.map +1 -1
  375. package/dist/platform/providers/runtime-snapshot.js +12 -2
  376. package/dist/platform/runtime/bootstrap-services.d.ts +62 -2
  377. package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
  378. package/dist/platform/runtime/bootstrap-services.js +217 -50
  379. package/dist/platform/runtime/daemon-version-compat.d.ts +39 -0
  380. package/dist/platform/runtime/daemon-version-compat.d.ts.map +1 -0
  381. package/dist/platform/runtime/daemon-version-compat.js +75 -0
  382. package/dist/platform/runtime/detached-daemon-runtime.d.ts +26 -0
  383. package/dist/platform/runtime/detached-daemon-runtime.d.ts.map +1 -0
  384. package/dist/platform/runtime/detached-daemon-runtime.js +49 -0
  385. package/dist/platform/runtime/emitters/communication.d.ts +11 -0
  386. package/dist/platform/runtime/emitters/communication.d.ts.map +1 -1
  387. package/dist/platform/runtime/emitters/communication.js +9 -0
  388. package/dist/platform/runtime/emitters/workflows.d.ts +1 -1
  389. package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
  390. package/dist/platform/runtime/events/index.d.ts +13 -0
  391. package/dist/platform/runtime/events/index.d.ts.map +1 -1
  392. package/dist/platform/runtime/events/index.js +13 -0
  393. package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
  394. package/dist/platform/runtime/feature-flags/flags.js +56 -1
  395. package/dist/platform/runtime/fleet/adapters/agent.d.ts +56 -0
  396. package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -0
  397. package/dist/platform/runtime/fleet/adapters/agent.js +143 -0
  398. package/dist/platform/runtime/fleet/adapters/automation.d.ts +30 -0
  399. package/dist/platform/runtime/fleet/adapters/automation.d.ts.map +1 -0
  400. package/dist/platform/runtime/fleet/adapters/automation.js +41 -0
  401. package/dist/platform/runtime/fleet/adapters/background-process.d.ts +12 -0
  402. package/dist/platform/runtime/fleet/adapters/background-process.d.ts.map +1 -0
  403. package/dist/platform/runtime/fleet/adapters/background-process.js +46 -0
  404. package/dist/platform/runtime/fleet/adapters/code-index.d.ts +21 -0
  405. package/dist/platform/runtime/fleet/adapters/code-index.d.ts.map +1 -0
  406. package/dist/platform/runtime/fleet/adapters/code-index.js +44 -0
  407. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +69 -0
  408. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -0
  409. package/dist/platform/runtime/fleet/adapters/orchestration.js +329 -0
  410. package/dist/platform/runtime/fleet/adapters/schedule.d.ts +14 -0
  411. package/dist/platform/runtime/fleet/adapters/schedule.d.ts.map +1 -0
  412. package/dist/platform/runtime/fleet/adapters/schedule.js +28 -0
  413. package/dist/platform/runtime/fleet/adapters/trigger.d.ts +12 -0
  414. package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -0
  415. package/dist/platform/runtime/fleet/adapters/trigger.js +22 -0
  416. package/dist/platform/runtime/fleet/adapters/watcher.d.ts +13 -0
  417. package/dist/platform/runtime/fleet/adapters/watcher.d.ts.map +1 -0
  418. package/dist/platform/runtime/fleet/adapters/watcher.js +47 -0
  419. package/dist/platform/runtime/fleet/adapters/workflow.d.ts +11 -0
  420. package/dist/platform/runtime/fleet/adapters/workflow.d.ts.map +1 -0
  421. package/dist/platform/runtime/fleet/adapters/workflow.js +34 -0
  422. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +35 -0
  423. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -0
  424. package/dist/platform/runtime/fleet/adapters/wrfc.js +275 -0
  425. package/dist/platform/runtime/fleet/index.d.ts +10 -0
  426. package/dist/platform/runtime/fleet/index.d.ts.map +1 -0
  427. package/dist/platform/runtime/fleet/index.js +6 -0
  428. package/dist/platform/runtime/fleet/registry.d.ts +113 -0
  429. package/dist/platform/runtime/fleet/registry.d.ts.map +1 -0
  430. package/dist/platform/runtime/fleet/registry.js +664 -0
  431. package/dist/platform/runtime/fleet/types.d.ts +199 -0
  432. package/dist/platform/runtime/fleet/types.d.ts.map +1 -0
  433. package/dist/platform/runtime/fleet/types.js +2 -0
  434. package/dist/platform/runtime/operator-client.d.ts +20 -2
  435. package/dist/platform/runtime/operator-client.d.ts.map +1 -1
  436. package/dist/platform/runtime/operator-client.js +11 -1
  437. package/dist/platform/runtime/provider-accounts/registry.d.ts.map +1 -1
  438. package/dist/platform/runtime/provider-accounts/registry.js +11 -1
  439. package/dist/platform/runtime/runtime-knowledge-api.d.ts +1 -1
  440. package/dist/platform/runtime/runtime-knowledge-api.d.ts.map +1 -1
  441. package/dist/platform/runtime/runtime-knowledge-api.js +1 -0
  442. package/dist/platform/runtime/services.d.ts +48 -0
  443. package/dist/platform/runtime/services.d.ts.map +1 -1
  444. package/dist/platform/runtime/services.js +95 -2
  445. package/dist/platform/runtime/session-spine/client.d.ts +234 -0
  446. package/dist/platform/runtime/session-spine/client.d.ts.map +1 -0
  447. package/dist/platform/runtime/session-spine/client.js +449 -0
  448. package/dist/platform/runtime/session-spine/index.d.ts +12 -0
  449. package/dist/platform/runtime/session-spine/index.d.ts.map +1 -0
  450. package/dist/platform/runtime/session-spine/index.js +11 -0
  451. package/dist/platform/runtime/session-spine/union-cache.d.ts +225 -0
  452. package/dist/platform/runtime/session-spine/union-cache.d.ts.map +1 -0
  453. package/dist/platform/runtime/session-spine/union-cache.js +333 -0
  454. package/dist/platform/runtime/shell-command-ops.d.ts +3 -1
  455. package/dist/platform/runtime/shell-command-ops.d.ts.map +1 -1
  456. package/dist/platform/runtime/transports/daemon-http-client-validators.d.ts.map +1 -1
  457. package/dist/platform/runtime/transports/daemon-http-client-validators.js +22 -0
  458. package/dist/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
  459. package/dist/platform/runtime/transports/daemon-http-client.js +25 -2
  460. package/dist/platform/runtime/transports/http-types.d.ts +9 -2
  461. package/dist/platform/runtime/transports/http-types.d.ts.map +1 -1
  462. package/dist/platform/state/canonical-memory.d.ts +95 -0
  463. package/dist/platform/state/canonical-memory.d.ts.map +1 -0
  464. package/dist/platform/state/canonical-memory.js +155 -0
  465. package/dist/platform/state/code-index-chunking.d.ts +49 -0
  466. package/dist/platform/state/code-index-chunking.d.ts.map +1 -0
  467. package/dist/platform/state/code-index-chunking.js +111 -0
  468. package/dist/platform/state/code-index-db.d.ts +53 -0
  469. package/dist/platform/state/code-index-db.d.ts.map +1 -0
  470. package/dist/platform/state/code-index-db.js +101 -0
  471. package/dist/platform/state/code-index-reindex.d.ts +73 -0
  472. package/dist/platform/state/code-index-reindex.d.ts.map +1 -0
  473. package/dist/platform/state/code-index-reindex.js +156 -0
  474. package/dist/platform/state/code-index-store.d.ts +175 -0
  475. package/dist/platform/state/code-index-store.d.ts.map +1 -0
  476. package/dist/platform/state/code-index-store.js +620 -0
  477. package/dist/platform/state/index.d.ts +12 -2
  478. package/dist/platform/state/index.d.ts.map +1 -1
  479. package/dist/platform/state/index.js +6 -1
  480. package/dist/platform/state/knowledge-injection.d.ts +23 -0
  481. package/dist/platform/state/knowledge-injection.d.ts.map +1 -1
  482. package/dist/platform/state/knowledge-injection.js +34 -19
  483. package/dist/platform/state/memory-recall-contract.d.ts +63 -0
  484. package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
  485. package/dist/platform/state/memory-recall-contract.js +94 -0
  486. package/dist/platform/state/memory-store.d.ts +2 -0
  487. package/dist/platform/state/memory-store.d.ts.map +1 -1
  488. package/dist/platform/state/memory-store.js +4 -0
  489. package/dist/platform/state/memory-vector-store.d.ts +1 -13
  490. package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
  491. package/dist/platform/state/memory-vector-store.js +18 -39
  492. package/dist/platform/state/sqlite-store.d.ts +2 -0
  493. package/dist/platform/state/sqlite-store.d.ts.map +1 -1
  494. package/dist/platform/state/sqlite-store.js +4 -0
  495. package/dist/platform/state/sqlite-vec-loader.d.ts +25 -0
  496. package/dist/platform/state/sqlite-vec-loader.d.ts.map +1 -0
  497. package/dist/platform/state/sqlite-vec-loader.js +43 -0
  498. package/dist/platform/state/vibe-projection.d.ts +67 -0
  499. package/dist/platform/state/vibe-projection.d.ts.map +1 -0
  500. package/dist/platform/state/vibe-projection.js +115 -0
  501. package/dist/platform/tools/agent/index.d.ts.map +1 -1
  502. package/dist/platform/tools/agent/index.js +8 -0
  503. package/dist/platform/tools/agent/manager.d.ts +140 -1
  504. package/dist/platform/tools/agent/manager.d.ts.map +1 -1
  505. package/dist/platform/tools/agent/manager.js +143 -1
  506. package/dist/platform/tools/agent/schema.d.ts +26 -0
  507. package/dist/platform/tools/agent/schema.d.ts.map +1 -1
  508. package/dist/platform/tools/agent/schema.js +2 -2
  509. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
  510. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -1
  511. package/dist/platform/tools/agent/wrfc-batch-policy.js +60 -0
  512. package/dist/platform/tools/exec/runtime.d.ts +10 -0
  513. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  514. package/dist/platform/tools/exec/runtime.js +161 -49
  515. package/dist/platform/tools/exec/schema.d.ts +3 -1
  516. package/dist/platform/tools/exec/schema.d.ts.map +1 -1
  517. package/dist/platform/tools/exec/schema.js +2 -1
  518. package/dist/platform/tools/fetch/runtime.d.ts +7 -0
  519. package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
  520. package/dist/platform/tools/fetch/runtime.js +8 -6
  521. package/dist/platform/tools/index.d.ts +2 -0
  522. package/dist/platform/tools/index.d.ts.map +1 -1
  523. package/dist/platform/tools/index.js +2 -0
  524. package/dist/platform/tools/registry.d.ts +9 -3
  525. package/dist/platform/tools/registry.d.ts.map +1 -1
  526. package/dist/platform/tools/registry.js +9 -3
  527. package/dist/platform/tools/state/index.d.ts +9 -0
  528. package/dist/platform/tools/state/index.d.ts.map +1 -1
  529. package/dist/platform/tools/state/index.js +60 -3
  530. package/dist/platform/types/foundation-contract.d.ts +1 -1
  531. package/dist/platform/types/foundation-contract.d.ts.map +1 -1
  532. package/dist/platform/types/index.d.ts +1 -1
  533. package/dist/platform/types/index.d.ts.map +1 -1
  534. package/dist/platform/types/tools.d.ts +14 -1
  535. package/dist/platform/types/tools.d.ts.map +1 -1
  536. package/dist/platform/version.js +1 -1
  537. package/package.json +29 -9
  538. package/dist/platform/control-plane/routes/automation.d.ts +0 -3
  539. package/dist/platform/control-plane/routes/automation.d.ts.map +0 -1
  540. package/dist/platform/control-plane/routes/automation.js +0 -63
  541. package/dist/platform/control-plane/routes/context.d.ts +0 -2
  542. package/dist/platform/control-plane/routes/context.d.ts.map +0 -1
  543. package/dist/platform/control-plane/routes/context.js +0 -1
  544. package/dist/platform/control-plane/routes/operator.d.ts +0 -8
  545. package/dist/platform/control-plane/routes/operator.d.ts.map +0 -1
  546. package/dist/platform/control-plane/routes/operator.js +0 -415
  547. package/dist/platform/control-plane/routes/remote.d.ts +0 -3
  548. package/dist/platform/control-plane/routes/remote.d.ts.map +0 -1
  549. package/dist/platform/control-plane/routes/remote.js +0 -35
  550. package/dist/platform/control-plane/routes/sessions.d.ts +0 -3
  551. package/dist/platform/control-plane/routes/sessions.d.ts.map +0 -1
  552. package/dist/platform/control-plane/routes/sessions.js +0 -43
  553. package/dist/platform/control-plane/routes/tasks.d.ts +0 -3
  554. package/dist/platform/control-plane/routes/tasks.d.ts.map +0 -1
  555. package/dist/platform/control-plane/routes/tasks.js +0 -22
@@ -0,0 +1,170 @@
1
+ /**
2
+ * types.ts — the shared type surface for the calendar-connectivity module.
3
+ *
4
+ * Pure data shapes only. The module reads external calendars two ways — parsing
5
+ * .ics text (a file or a fetched feed body) into typed events, and managing named
6
+ * feed subscriptions with honest per-subscription status — and every value a
7
+ * caller sees is described here.
8
+ *
9
+ * Honesty contract (see docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md):
10
+ * - date-time zone handling is stated, never faked. A DTSTART with a TZID is kept
11
+ * as its wall-clock value with the TZID recorded; NO offset conversion is applied
12
+ * (this build ships no tz database), so `zone: 'tzid'` means "local wall time in
13
+ * the named zone, not converted to UTC". A trailing-Z value is real UTC
14
+ * (`zone: 'utc'`); a bare date-time with neither is floating (`zone: 'floating'`).
15
+ * - recurrence is either fully expanded or explicitly not. A VEVENT whose RRULE
16
+ * uses only the supported subset expands to real occurrences; anything else keeps
17
+ * the seed event and carries an explicit `expansion: 'unsupported'` marker naming
18
+ * the part we declined to expand. Occurrences are never fabricated from a rule we
19
+ * do not fully honor.
20
+ */
21
+ /** How a date/date-time value is anchored in time. */
22
+ export type EventZone = 'utc' | 'floating' | 'tzid';
23
+ /** A parsed DTSTART/DTEND value with its honest time anchoring. */
24
+ export interface EventDateTime {
25
+ /**
26
+ * The as-parsed value:
27
+ * - `kind: 'date'` => 'YYYY-MM-DD'
28
+ * - `kind: 'date-time'` => 'YYYY-MM-DDTHH:mm:ss' (floating/tzid) or the same
29
+ * with a trailing 'Z' (utc).
30
+ */
31
+ readonly value: string;
32
+ readonly kind: 'date' | 'date-time';
33
+ readonly zone: EventZone;
34
+ /** Present only when `zone === 'tzid'`; the raw TZID as written in the feed. */
35
+ readonly tzid?: string;
36
+ }
37
+ /** Whether a VEVENT's RRULE was fully expanded, and why not when it was not. */
38
+ export type RecurrenceExpansion = 'full' | 'unsupported';
39
+ /** The honest recurrence descriptor attached to a recurring VEVENT. */
40
+ export interface RecurrenceInfo {
41
+ /** The raw RRULE line value, e.g. 'FREQ=WEEKLY;BYDAY=MO,WE;COUNT=10'. */
42
+ readonly rule: string;
43
+ readonly expansion: RecurrenceExpansion;
44
+ /**
45
+ * When `expansion === 'unsupported'`, a plain-language reason naming the part
46
+ * this build does not expand (e.g. 'RRULE part BYMONTHDAY is not expanded by
47
+ * this build'). Absent when `expansion === 'full'`.
48
+ */
49
+ readonly unsupportedReason?: string;
50
+ }
51
+ /** A single calendar event parsed from a VEVENT. */
52
+ export interface CalendarEvent {
53
+ /** The VEVENT UID; a stable synthetic id is assigned when the feed omits one. */
54
+ readonly uid: string;
55
+ readonly summary: string;
56
+ readonly location?: string;
57
+ readonly description?: string;
58
+ readonly start: EventDateTime;
59
+ /** DTEND when present; a VEVENT may legitimately omit it (e.g. a reminder). */
60
+ readonly end?: EventDateTime;
61
+ /** Present when the VEVENT carried an RRULE. */
62
+ readonly recurrence?: RecurrenceInfo;
63
+ }
64
+ /** A non-fatal problem encountered while parsing, tied to the source when known. */
65
+ export interface ParseDiagnostic {
66
+ /** 1-based line number in the (unfolded) source, when attributable. */
67
+ readonly line?: number;
68
+ /** The offending component/property name, when attributable (e.g. 'DTSTART'). */
69
+ readonly component?: string;
70
+ readonly message: string;
71
+ }
72
+ /** The full result of parsing .ics text. */
73
+ export interface ParsedCalendar {
74
+ /** Calendar name from X-WR-CALNAME, when the feed supplied one. */
75
+ readonly calendarName?: string;
76
+ readonly events: readonly CalendarEvent[];
77
+ /**
78
+ * Events that were recognised as VEVENTs but could not be turned into a usable
79
+ * event (e.g. no DTSTART). Never silently dropped — surfaced here with a reason.
80
+ */
81
+ readonly skipped: readonly ParseDiagnostic[];
82
+ /** Non-fatal notes (unsupported recurrence, unknown TZID kept as-is, etc.). */
83
+ readonly diagnostics: readonly ParseDiagnostic[];
84
+ }
85
+ /** One concrete occurrence produced by expanding a (possibly recurring) event. */
86
+ export interface EventOccurrence {
87
+ readonly event: CalendarEvent;
88
+ /** Occurrence start as 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ss[Z]', mirroring start.kind/zone. */
89
+ readonly start: string;
90
+ /** True only for the seed occurrence of a recurring event. */
91
+ readonly isSeed: boolean;
92
+ }
93
+ /** An inclusive [from, to] window for occurrence expansion, as 'YYYY-MM-DD' strings. */
94
+ export interface DateWindow {
95
+ readonly from: string;
96
+ readonly to: string;
97
+ }
98
+ /** Honest health of a named feed subscription. */
99
+ export type SubscriptionHealth = 'never-fetched' | 'ok' | 'stale' | 'unreachable' | 'parse-error';
100
+ /** A named external-calendar feed subscription and its current status. */
101
+ export interface CalendarSubscription {
102
+ readonly name: string;
103
+ /** The feed URL. Treat as secrets-adjacent: a Google "secret address" grants read access. */
104
+ readonly url: string;
105
+ /** How often a refresh becomes due, in milliseconds. Bounded by the store. */
106
+ readonly refreshIntervalMs: number;
107
+ /** Epoch ms of the last fetch ATTEMPT (success or failure), if any. */
108
+ readonly lastFetchedAt?: number;
109
+ /** Epoch ms of the last SUCCESSFUL parse, if any. */
110
+ readonly lastSucceededAt?: number;
111
+ /** HTTP validators for conditional refresh, when the server supplied them. */
112
+ readonly etag?: string;
113
+ readonly lastModified?: string;
114
+ readonly health: SubscriptionHealth;
115
+ /** Plain-language elaboration of a non-ok health (http status, parse line, age). */
116
+ readonly detail?: string;
117
+ /** Count of events from the most recent successful parse. */
118
+ readonly eventCount?: number;
119
+ }
120
+ /** A conditional-fetch request the injected fetcher receives. */
121
+ export interface FeedFetchRequest {
122
+ readonly url: string;
123
+ readonly etag?: string;
124
+ readonly lastModified?: string;
125
+ }
126
+ /** The result the injected fetcher returns. Tests supply this from fake feeds. */
127
+ export type FeedFetchResult = {
128
+ readonly kind: 'ok';
129
+ readonly body: string;
130
+ readonly etag?: string;
131
+ readonly lastModified?: string;
132
+ } | {
133
+ readonly kind: 'not-modified';
134
+ readonly etag?: string;
135
+ readonly lastModified?: string;
136
+ } | {
137
+ readonly kind: 'error';
138
+ readonly status?: number;
139
+ readonly message: string;
140
+ };
141
+ /** Injected network boundary — the ONLY way this module reaches the network. */
142
+ export type FeedFetcher = (req: FeedFetchRequest) => Promise<FeedFetchResult>;
143
+ /** Injected clock, so refresh/staleness timing is deterministic in tests. */
144
+ export type Clock = () => number;
145
+ /** The per-refresh report a caller can turn into an honest status line. */
146
+ export interface RefreshReport {
147
+ readonly name: string;
148
+ /**
149
+ * - 'updated' — fetched fresh body, parsed, events replaced.
150
+ * - 'not-modified' — server said 304; kept prior events, refreshed timestamp.
151
+ * - 'skipped' — not due yet and not forced.
152
+ * - 'unreachable' — fetch failed at the network stage.
153
+ * - 'parse-error' — fetched, but the body could not be parsed.
154
+ */
155
+ readonly outcome: 'updated' | 'not-modified' | 'skipped' | 'unreachable' | 'parse-error';
156
+ readonly health: SubscriptionHealth;
157
+ readonly eventCount?: number;
158
+ readonly detail?: string;
159
+ }
160
+ /** Serialisable subscription metadata for a caller that persists across restarts. */
161
+ export interface SubscriptionSnapshot {
162
+ readonly name: string;
163
+ readonly url: string;
164
+ readonly refreshIntervalMs: number;
165
+ readonly lastFetchedAt?: number;
166
+ readonly lastSucceededAt?: number;
167
+ readonly etag?: string;
168
+ readonly lastModified?: string;
169
+ }
170
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/platform/calendar/types.ts"],"names":[],"mappings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OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC;IACzF,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * types.ts — the shared type surface for the calendar-connectivity module.
3
+ *
4
+ * Pure data shapes only. The module reads external calendars two ways — parsing
5
+ * .ics text (a file or a fetched feed body) into typed events, and managing named
6
+ * feed subscriptions with honest per-subscription status — and every value a
7
+ * caller sees is described here.
8
+ *
9
+ * Honesty contract (see docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md):
10
+ * - date-time zone handling is stated, never faked. A DTSTART with a TZID is kept
11
+ * as its wall-clock value with the TZID recorded; NO offset conversion is applied
12
+ * (this build ships no tz database), so `zone: 'tzid'` means "local wall time in
13
+ * the named zone, not converted to UTC". A trailing-Z value is real UTC
14
+ * (`zone: 'utc'`); a bare date-time with neither is floating (`zone: 'floating'`).
15
+ * - recurrence is either fully expanded or explicitly not. A VEVENT whose RRULE
16
+ * uses only the supported subset expands to real occurrences; anything else keeps
17
+ * the seed event and carries an explicit `expansion: 'unsupported'` marker naming
18
+ * the part we declined to expand. Occurrences are never fabricated from a rule we
19
+ * do not fully honor.
20
+ */
21
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * companion-chat-attachments.ts
3
+ *
4
+ * Pure attachment-resolution + provider-content helpers for CompanionChatManager.
5
+ * Extracted so the manager file stays within its line budget; behaviour is
6
+ * unchanged — every function takes the artifact store explicitly instead of
7
+ * reaching through `this`.
8
+ */
9
+ import { Buffer } from 'node:buffer';
10
+ import type { ContentPart } from '../providers/interface.js';
11
+ import type { ArtifactDescriptor } from '../artifacts/index.js';
12
+ import type { CompanionChatMessageAttachment, CompanionChatMessageAttachmentInput, CompanionChatMessage } from './companion-chat-types.js';
13
+ export declare const MAX_ATTACHMENTS_PER_MESSAGE = 8;
14
+ export interface CompanionChatArtifactStore {
15
+ get(artifactId: string): ArtifactDescriptor | null;
16
+ readContent(artifactId: string): Promise<{
17
+ readonly record: {
18
+ readonly mimeType: string;
19
+ readonly filename?: string | undefined;
20
+ };
21
+ readonly buffer: ArrayBuffer | Uint8Array | Buffer;
22
+ }>;
23
+ }
24
+ export declare function toNodeBuffer(buffer: ArrayBuffer | Uint8Array | Buffer): Buffer;
25
+ export declare function resolveAttachments(inputs: readonly CompanionChatMessageAttachmentInput[], artifactStore: CompanionChatArtifactStore | null): CompanionChatMessageAttachment[];
26
+ export declare function formatAttachmentSummary(attachments: readonly CompanionChatMessageAttachment[]): string;
27
+ export declare function buildReplayUserContent(message: CompanionChatMessage): string;
28
+ export declare function buildProviderUserContent(content: string, attachments: readonly CompanionChatMessageAttachment[], artifactStore: CompanionChatArtifactStore | null): Promise<string | ContentPart[]>;
29
+ //# sourceMappingURL=companion-chat-attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companion-chat-attachments.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EA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resolution + provider-content helpers for CompanionChatManager.
5
+ * Extracted so the manager file stays within its line budget; behaviour is
6
+ * unchanged — every function takes the artifact store explicitly instead of
7
+ * reaching through `this`.
8
+ */
9
+ import { Buffer } from 'node:buffer';
10
+ import { summarizeError } from '../utils/error-display.js';
11
+ import { logger } from '../utils/logger.js';
12
+ export const MAX_ATTACHMENTS_PER_MESSAGE = 8;
13
+ const MAX_INLINE_IMAGE_ATTACHMENT_BYTES = 20 * 1024 * 1024;
14
+ const MAX_INLINE_TEXT_ATTACHMENT_BYTES = 200 * 1024;
15
+ export function toNodeBuffer(buffer) {
16
+ if (Buffer.isBuffer(buffer))
17
+ return buffer;
18
+ if (buffer instanceof ArrayBuffer)
19
+ return Buffer.from(new Uint8Array(buffer));
20
+ return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
21
+ }
22
+ export function resolveAttachments(inputs, artifactStore) {
23
+ if (inputs.length === 0)
24
+ return [];
25
+ if (inputs.length > MAX_ATTACHMENTS_PER_MESSAGE) {
26
+ throw Object.assign(new Error(`A companion chat message can include at most ${MAX_ATTACHMENTS_PER_MESSAGE} attachments.`), { code: 'TOO_MANY_ATTACHMENTS', status: 400 });
27
+ }
28
+ if (!artifactStore) {
29
+ throw Object.assign(new Error('Companion chat attachments require an artifact store.'), { code: 'ATTACHMENTS_UNAVAILABLE', status: 501 });
30
+ }
31
+ return inputs.map((input) => {
32
+ const artifactId = input.artifactId.trim();
33
+ if (!artifactId) {
34
+ throw Object.assign(new Error('Attachment artifactId is required.'), {
35
+ code: 'INVALID_ATTACHMENT',
36
+ status: 400,
37
+ });
38
+ }
39
+ const artifact = artifactStore.get(artifactId);
40
+ if (!artifact) {
41
+ throw Object.assign(new Error(`Unknown attachment artifact: ${artifactId}`), {
42
+ code: 'UNKNOWN_ARTIFACT',
43
+ status: 404,
44
+ });
45
+ }
46
+ return {
47
+ ...artifact,
48
+ artifactId: artifact.id,
49
+ ...(input.label?.trim() ? { label: input.label.trim() } : {}),
50
+ metadata: {
51
+ ...artifact.metadata,
52
+ ...(input.metadata ?? {}),
53
+ },
54
+ };
55
+ });
56
+ }
57
+ export function formatAttachmentSummary(attachments) {
58
+ if (attachments.length === 0)
59
+ return '';
60
+ const lines = attachments.map((attachment, index) => {
61
+ const name = attachment.label ?? attachment.filename ?? attachment.artifactId;
62
+ return `${index + 1}. ${name} (${attachment.mimeType}, ${attachment.sizeBytes} bytes, artifact ${attachment.artifactId})`;
63
+ });
64
+ return `\n\nAttached file${attachments.length === 1 ? '' : 's'}:\n${lines.join('\n')}`;
65
+ }
66
+ export function buildReplayUserContent(message) {
67
+ return `${message.content}${formatAttachmentSummary(message.attachments ?? [])}`;
68
+ }
69
+ function isInlineTextAttachment(attachment) {
70
+ const lower = attachment.mimeType.toLowerCase();
71
+ return attachment.sizeBytes <= MAX_INLINE_TEXT_ATTACHMENT_BYTES
72
+ && (lower.startsWith('text/')
73
+ || lower === 'application/json'
74
+ || lower === 'application/xml'
75
+ || lower === 'application/yaml'
76
+ || lower === 'text/csv');
77
+ }
78
+ function isInlineImageAttachment(attachment) {
79
+ const lower = attachment.mimeType.toLowerCase();
80
+ return attachment.sizeBytes <= MAX_INLINE_IMAGE_ATTACHMENT_BYTES
81
+ && (lower === 'image/png'
82
+ || lower === 'image/jpeg'
83
+ || lower === 'image/gif'
84
+ || lower === 'image/webp');
85
+ }
86
+ export async function buildProviderUserContent(content, attachments, artifactStore) {
87
+ if (attachments.length === 0)
88
+ return content;
89
+ const textSections = [content.trim() ? content : 'Please review the attached file(s).'];
90
+ const imageParts = [];
91
+ for (const attachment of attachments) {
92
+ if (!artifactStore)
93
+ continue;
94
+ try {
95
+ if (isInlineTextAttachment(attachment)) {
96
+ const { buffer } = await artifactStore.readContent(attachment.artifactId);
97
+ const text = toNodeBuffer(buffer).toString('utf-8');
98
+ textSections.push(`\n\n--- Attachment: ${attachment.label ?? attachment.filename ?? attachment.artifactId} ---\n${text}`);
99
+ continue;
100
+ }
101
+ if (isInlineImageAttachment(attachment)) {
102
+ const { buffer } = await artifactStore.readContent(attachment.artifactId);
103
+ imageParts.push({
104
+ type: 'image',
105
+ mediaType: attachment.mimeType,
106
+ data: toNodeBuffer(buffer).toString('base64'),
107
+ });
108
+ }
109
+ }
110
+ catch (error) {
111
+ logger.warn('[companion-chat] failed to inline attachment for provider prompt', {
112
+ artifactId: attachment.artifactId,
113
+ error: summarizeError(error),
114
+ });
115
+ }
116
+ }
117
+ textSections.push(formatAttachmentSummary(attachments));
118
+ if (imageParts.length === 0)
119
+ return textSections.join('');
120
+ return [{ type: 'text', text: textSections.join('') }, ...imageParts];
121
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * companion-chat-broker-bridge.ts
3
+ *
4
+ * The narrow, structural view of the SharedSessionBroker that CompanionChatManager
5
+ * uses to register companion sessions INTO the one shared session store at write
6
+ * time (S1 item D: companion registers into the broker). Defined structurally so
7
+ * the companion package does not take a hard dependency on the control-plane
8
+ * broker's full surface — the real SharedSessionBroker satisfies this shape.
9
+ *
10
+ * Live registration is the fast path (a created/closed companion session is
11
+ * visible to /api/sessions immediately, same-process); the boot-time importer
12
+ * fold remains the reconciliation path for files written by other instances.
13
+ */
14
+ /** Participant identity for a companion session in the shared store. */
15
+ export interface CompanionBrokerParticipant {
16
+ readonly surfaceKind: 'companion';
17
+ readonly surfaceId: string;
18
+ readonly lastSeenAt: number;
19
+ }
20
+ export interface CompanionBrokerRegisterInput {
21
+ readonly sessionId: string;
22
+ readonly kind: 'companion-chat';
23
+ readonly project?: string | undefined;
24
+ readonly title?: string | undefined;
25
+ readonly participant: CompanionBrokerParticipant;
26
+ /** Reopen a closed shared record; companion mirrors its own live state. */
27
+ readonly reopen?: boolean | undefined;
28
+ }
29
+ /**
30
+ * Structural subset of SharedSessionBroker. Return types are intentionally
31
+ * `unknown` — the companion manager fires these for their effect on the store,
32
+ * not for their result.
33
+ */
34
+ export interface CompanionSessionBrokerBridge {
35
+ register(input: CompanionBrokerRegisterInput): Promise<unknown>;
36
+ closeSession(sessionId: string): Promise<unknown>;
37
+ /** Hard-remove the mirrored shared-session record (W5-S1: companion delete is a real removal, not a close). */
38
+ deleteSession(sessionId: string): Promise<unknown>;
39
+ }
40
+ //# sourceMappingURL=companion-chat-broker-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companion-chat-broker-bridge.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-broker-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,wEAAwE;AACxE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,+GAA+G;IAC/G,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * companion-chat-broker-bridge.ts
3
+ *
4
+ * The narrow, structural view of the SharedSessionBroker that CompanionChatManager
5
+ * uses to register companion sessions INTO the one shared session store at write
6
+ * time (S1 item D: companion registers into the broker). Defined structurally so
7
+ * the companion package does not take a hard dependency on the control-plane
8
+ * broker's full surface — the real SharedSessionBroker satisfies this shape.
9
+ *
10
+ * Live registration is the fast path (a created/closed companion session is
11
+ * visible to /api/sessions immediately, same-process); the boot-time importer
12
+ * fold remains the reconciliation path for files written by other instances.
13
+ */
14
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * companion-chat-broker-sync.ts
3
+ *
4
+ * Owns the live mirror of companion sessions into the shared
5
+ * `SharedSessionBroker` store (S1 item D: companion registers into the
6
+ * broker at write time), chaining register/close/delete ops per session so
7
+ * they never race (order = call order), and exposing `flush()` so the
8
+ * companion HTTP routes can await in-flight ops before responding
9
+ * (deterministic for tests).
10
+ *
11
+ * Split out of CompanionChatManager (W5-S1) to stay under the repo's
12
+ * grandfathered line-cap ceiling (see scripts/check-line-cap.ts) — a pure
13
+ * file-organization move, not a behavior change: same chaining, same
14
+ * best-effort swallow-and-log-on-failure semantics.
15
+ */
16
+ import type { CompanionChatSession } from './companion-chat-types.js';
17
+ import type { CompanionSessionBrokerBridge } from './companion-chat-broker-bridge.js';
18
+ export declare class CompanionBrokerSync {
19
+ private readonly broker;
20
+ private readonly pendingOps;
21
+ constructor(broker: CompanionSessionBrokerBridge | null);
22
+ /**
23
+ * Await all in-flight best-effort broker-sync operations. The daemon's
24
+ * companion HTTP routes call this before responding so `/api/sessions`
25
+ * reflects the change synchronously; tests use it to make the mirror
26
+ * deterministic. A no-op when no broker bridge is configured.
27
+ */
28
+ flush(): Promise<void>;
29
+ /** Chain a broker op AFTER any prior op for the same session so register and
30
+ * close/delete never race (order = call order). Best-effort; errors are
31
+ * swallowed (logged, never thrown into the caller's write path). */
32
+ track(sessionId: string, run: () => Promise<void>): void;
33
+ registerSession(meta: CompanionChatSession): Promise<void>;
34
+ closeSession(sessionId: string): Promise<void>;
35
+ /** Hard-remove the mirrored shared-session record (W5-S1: companion delete is a real removal). */
36
+ deleteSession(sessionId: string): Promise<void>;
37
+ }
38
+ //# sourceMappingURL=companion-chat-broker-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companion-chat-broker-sync.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-broker-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAItF,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAC7D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;gBAEnD,MAAM,EAAE,4BAA4B,GAAG,IAAI;IAIvD;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;wEAEoE;IACpE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IASlD,eAAe,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB1D,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapD,kGAAkG;IAC5F,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAYtD"}
@@ -0,0 +1,80 @@
1
+ import { summarizeError } from '../utils/error-display.js';
2
+ import { logger } from '../utils/logger.js';
3
+ export class CompanionBrokerSync {
4
+ broker;
5
+ pendingOps = new Map();
6
+ constructor(broker) {
7
+ this.broker = broker;
8
+ }
9
+ /**
10
+ * Await all in-flight best-effort broker-sync operations. The daemon's
11
+ * companion HTTP routes call this before responding so `/api/sessions`
12
+ * reflects the change synchronously; tests use it to make the mirror
13
+ * deterministic. A no-op when no broker bridge is configured.
14
+ */
15
+ async flush() {
16
+ await Promise.all([...this.pendingOps.values()]);
17
+ }
18
+ /** Chain a broker op AFTER any prior op for the same session so register and
19
+ * close/delete never race (order = call order). Best-effort; errors are
20
+ * swallowed (logged, never thrown into the caller's write path). */
21
+ track(sessionId, run) {
22
+ if (!this.broker)
23
+ return;
24
+ const prior = this.pendingOps.get(sessionId) ?? Promise.resolve();
25
+ const next = prior.catch(() => { }).then(run).catch(() => { });
26
+ this.pendingOps.set(sessionId, next.finally(() => {
27
+ if (this.pendingOps.get(sessionId) === next)
28
+ this.pendingOps.delete(sessionId);
29
+ }));
30
+ }
31
+ async registerSession(meta) {
32
+ const broker = this.broker;
33
+ if (!broker)
34
+ return;
35
+ try {
36
+ await broker.register({
37
+ sessionId: meta.id,
38
+ kind: 'companion-chat',
39
+ project: 'unknown',
40
+ title: meta.title,
41
+ participant: { surfaceKind: 'companion', surfaceId: meta.id, lastSeenAt: Date.now() },
42
+ });
43
+ }
44
+ catch (error) {
45
+ logger.warn('[companion-chat] broker registration failed', {
46
+ sessionId: meta.id,
47
+ error: summarizeError(error),
48
+ });
49
+ }
50
+ }
51
+ async closeSession(sessionId) {
52
+ const broker = this.broker;
53
+ if (!broker)
54
+ return;
55
+ try {
56
+ await broker.closeSession(sessionId);
57
+ }
58
+ catch (error) {
59
+ logger.warn('[companion-chat] broker close failed', {
60
+ sessionId,
61
+ error: summarizeError(error),
62
+ });
63
+ }
64
+ }
65
+ /** Hard-remove the mirrored shared-session record (W5-S1: companion delete is a real removal). */
66
+ async deleteSession(sessionId) {
67
+ const broker = this.broker;
68
+ if (!broker)
69
+ return;
70
+ try {
71
+ await broker.deleteSession(sessionId);
72
+ }
73
+ catch (error) {
74
+ logger.warn('[companion-chat] broker delete failed', {
75
+ sessionId,
76
+ error: summarizeError(error),
77
+ });
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * companion-chat-gc.ts
3
+ *
4
+ * Pure GC-sweep planning for CompanionChatManager. Kept separate from the
5
+ * manager so the deletion-authority split (charter: closed sessions are HISTORY)
6
+ * is expressed as data — one decision per session — and unit-testable without a
7
+ * live manager or disk.
8
+ *
9
+ * Two distinct authorities, deliberately decoupled:
10
+ * - MEMORY eviction: cheap and aggressive. After a short grace past `closedAt`
11
+ * a closed session's heavy in-memory handles (the ConversationManager replay
12
+ * state and message bodies) are dropped so the resident footprint stays
13
+ * bounded no matter how much history is on disk. The session META stays in
14
+ * the map and remains listable (includeClosed) — only the bodies leave RAM.
15
+ * - PERSISTENT deletion: rare and explicit. The on-disk session file is removed
16
+ * ONLY when the caller opted into a finite retention window (or, in future, an
17
+ * explicit delete verb). The default is `undefined` = retain indefinitely, so
18
+ * a closed session is never deleted off disk by the periodic sweep.
19
+ */
20
+ export type CompanionSweepAction =
21
+ /** Active session past its idle TTL → close it (GC-initiated close). */
22
+ {
23
+ readonly kind: 'close-idle';
24
+ }
25
+ /** Closed session past the memory grace → drop bodies from RAM, keep meta. */
26
+ | {
27
+ readonly kind: 'evict-memory';
28
+ }
29
+ /** Closed session past an explicit finite retention window → delete off disk. */
30
+ | {
31
+ readonly kind: 'delete-persistent';
32
+ }
33
+ /** Nothing to do this sweep. */
34
+ | {
35
+ readonly kind: 'retain';
36
+ };
37
+ export interface CompanionSweepSessionView {
38
+ readonly status: 'active' | 'closed';
39
+ readonly closedAt: number | null | undefined;
40
+ /** epoch ms of last activity (idle measured from here for active sessions). */
41
+ readonly lastActivityAt: number;
42
+ /** whether the session currently holds message bodies in memory. */
43
+ readonly hasMessagesInMemory: boolean;
44
+ /** whether the session is empty (no messages) — selects the idle TTL. */
45
+ readonly isEmpty: boolean;
46
+ }
47
+ export interface CompanionSweepPolicy {
48
+ readonly now: number;
49
+ readonly idleActiveMs: number;
50
+ readonly idleEmptyMs: number;
51
+ /**
52
+ * Age past `closedAt` at which heavy in-memory handles are evicted while meta
53
+ * stays listable. Bounds resident memory for long-closed history.
54
+ */
55
+ readonly closedMemoryGraceMs: number;
56
+ /**
57
+ * Age past `closedAt` at which the persisted session file is permanently
58
+ * deleted. `undefined` = retain indefinitely (never delete via the sweep).
59
+ */
60
+ readonly closedRetentionMs: number | undefined;
61
+ }
62
+ export declare function planCompanionSweep(session: CompanionSweepSessionView, policy: CompanionSweepPolicy): CompanionSweepAction;
63
+ //# sourceMappingURL=companion-chat-gc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companion-chat-gc.d.ts","sourceRoot":"","sources":["../../../src/platform/companion/companion-chat-gc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,oBAAoB;AAC9B,wEAAwE;AACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE;AACjC,8EAA8E;GAC5E;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE;AACnC,iFAAiF;GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE;AACxC,gCAAgC;GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhC,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7C,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,EAClC,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CAmBtB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * companion-chat-gc.ts
3
+ *
4
+ * Pure GC-sweep planning for CompanionChatManager. Kept separate from the
5
+ * manager so the deletion-authority split (charter: closed sessions are HISTORY)
6
+ * is expressed as data — one decision per session — and unit-testable without a
7
+ * live manager or disk.
8
+ *
9
+ * Two distinct authorities, deliberately decoupled:
10
+ * - MEMORY eviction: cheap and aggressive. After a short grace past `closedAt`
11
+ * a closed session's heavy in-memory handles (the ConversationManager replay
12
+ * state and message bodies) are dropped so the resident footprint stays
13
+ * bounded no matter how much history is on disk. The session META stays in
14
+ * the map and remains listable (includeClosed) — only the bodies leave RAM.
15
+ * - PERSISTENT deletion: rare and explicit. The on-disk session file is removed
16
+ * ONLY when the caller opted into a finite retention window (or, in future, an
17
+ * explicit delete verb). The default is `undefined` = retain indefinitely, so
18
+ * a closed session is never deleted off disk by the periodic sweep.
19
+ */
20
+ export function planCompanionSweep(session, policy) {
21
+ if (session.status === 'closed') {
22
+ const closedAt = session.closedAt ?? policy.now;
23
+ const closedFor = policy.now - closedAt;
24
+ // Explicit finite retention is the ONLY authority for persistent deletion.
25
+ if (policy.closedRetentionMs !== undefined && closedFor >= policy.closedRetentionMs) {
26
+ return { kind: 'delete-persistent' };
27
+ }
28
+ // Otherwise evict heavy handles once past the memory grace, but only if
29
+ // there is still something resident to evict (idempotent across sweeps).
30
+ if (closedFor >= policy.closedMemoryGraceMs && session.hasMessagesInMemory) {
31
+ return { kind: 'evict-memory' };
32
+ }
33
+ return { kind: 'retain' };
34
+ }
35
+ const idleMs = policy.now - session.lastActivityAt;
36
+ const ttl = session.isEmpty ? policy.idleEmptyMs : policy.idleActiveMs;
37
+ return idleMs >= ttl ? { kind: 'close-idle' } : { kind: 'retain' };
38
+ }