@pellux/goodvibes-sdk 0.38.0 → 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 (474) 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/surfaces.d.ts +25 -3
  6. package/dist/events/surfaces.d.ts.map +1 -1
  7. package/dist/events/surfaces.js +22 -1
  8. package/dist/events/workflows.d.ts +7 -6
  9. package/dist/events/workflows.d.ts.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/platform/agents/archetypes.d.ts.map +1 -1
  13. package/dist/platform/agents/archetypes.js +7 -0
  14. package/dist/platform/agents/index.d.ts +1 -0
  15. package/dist/platform/agents/index.d.ts.map +1 -1
  16. package/dist/platform/agents/index.js +1 -0
  17. package/dist/platform/agents/orchestrator-runner.d.ts +13 -0
  18. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  19. package/dist/platform/agents/orchestrator-runner.js +14 -0
  20. package/dist/platform/agents/orchestrator.d.ts +38 -6
  21. package/dist/platform/agents/orchestrator.d.ts.map +1 -1
  22. package/dist/platform/agents/orchestrator.js +66 -18
  23. package/dist/platform/agents/planner-decomposition-runner.d.ts +38 -0
  24. package/dist/platform/agents/planner-decomposition-runner.d.ts.map +1 -0
  25. package/dist/platform/agents/planner-decomposition-runner.js +113 -0
  26. package/dist/platform/agents/turn-knowledge-injection.d.ts +88 -3
  27. package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -1
  28. package/dist/platform/agents/turn-knowledge-injection.js +147 -30
  29. package/dist/platform/agents/worktree.d.ts +126 -8
  30. package/dist/platform/agents/worktree.d.ts.map +1 -1
  31. package/dist/platform/agents/worktree.js +240 -19
  32. package/dist/platform/agents/wrfc-controller.d.ts +23 -0
  33. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  34. package/dist/platform/agents/wrfc-controller.js +158 -32
  35. package/dist/platform/agents/wrfc-gate-runtime.d.ts +9 -0
  36. package/dist/platform/agents/wrfc-gate-runtime.d.ts.map +1 -1
  37. package/dist/platform/agents/wrfc-gate-runtime.js +7 -3
  38. package/dist/platform/agents/wrfc-gates.d.ts +1 -1
  39. package/dist/platform/agents/wrfc-gates.d.ts.map +1 -1
  40. package/dist/platform/agents/wrfc-gates.js +7 -1
  41. package/dist/platform/agents/wrfc-types.d.ts +23 -3
  42. package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
  43. package/dist/platform/automation/types.d.ts +9 -1
  44. package/dist/platform/automation/types.d.ts.map +1 -1
  45. package/dist/platform/calendar/calendar-api-shared.d.ts +25 -0
  46. package/dist/platform/calendar/calendar-api-shared.d.ts.map +1 -0
  47. package/dist/platform/calendar/calendar-api-shared.js +100 -0
  48. package/dist/platform/calendar/calendar-connector.d.ts +79 -0
  49. package/dist/platform/calendar/calendar-connector.d.ts.map +1 -0
  50. package/dist/platform/calendar/calendar-connector.js +155 -0
  51. package/dist/platform/calendar/google-calendar-api.d.ts +25 -0
  52. package/dist/platform/calendar/google-calendar-api.d.ts.map +1 -0
  53. package/dist/platform/calendar/google-calendar-api.js +89 -0
  54. package/dist/platform/calendar/http-fetch-adapter.d.ts +25 -0
  55. package/dist/platform/calendar/http-fetch-adapter.d.ts.map +1 -0
  56. package/dist/platform/calendar/http-fetch-adapter.js +25 -0
  57. package/dist/platform/calendar/ics-parser.d.ts +35 -0
  58. package/dist/platform/calendar/ics-parser.d.ts.map +1 -0
  59. package/dist/platform/calendar/ics-parser.js +236 -0
  60. package/dist/platform/calendar/index.d.ts +41 -0
  61. package/dist/platform/calendar/index.d.ts.map +1 -0
  62. package/dist/platform/calendar/index.js +49 -0
  63. package/dist/platform/calendar/merged-calendar-model.d.ts +67 -0
  64. package/dist/platform/calendar/merged-calendar-model.d.ts.map +1 -0
  65. package/dist/platform/calendar/merged-calendar-model.js +181 -0
  66. package/dist/platform/calendar/microsoft-graph-api.d.ts +25 -0
  67. package/dist/platform/calendar/microsoft-graph-api.d.ts.map +1 -0
  68. package/dist/platform/calendar/microsoft-graph-api.js +95 -0
  69. package/dist/platform/calendar/oauth-flow.d.ts +62 -0
  70. package/dist/platform/calendar/oauth-flow.d.ts.map +1 -0
  71. package/dist/platform/calendar/oauth-flow.js +305 -0
  72. package/dist/platform/calendar/oauth-providers.d.ts +43 -0
  73. package/dist/platform/calendar/oauth-providers.d.ts.map +1 -0
  74. package/dist/platform/calendar/oauth-providers.js +120 -0
  75. package/dist/platform/calendar/oauth-token-store.d.ts +72 -0
  76. package/dist/platform/calendar/oauth-token-store.d.ts.map +1 -0
  77. package/dist/platform/calendar/oauth-token-store.js +189 -0
  78. package/dist/platform/calendar/oauth-types.d.ts +274 -0
  79. package/dist/platform/calendar/oauth-types.d.ts.map +1 -0
  80. package/dist/platform/calendar/oauth-types.js +22 -0
  81. package/dist/platform/calendar/rrule.d.ts +39 -0
  82. package/dist/platform/calendar/rrule.d.ts.map +1 -0
  83. package/dist/platform/calendar/rrule.js +261 -0
  84. package/dist/platform/calendar/subscription-store.d.ts +118 -0
  85. package/dist/platform/calendar/subscription-store.d.ts.map +1 -0
  86. package/dist/platform/calendar/subscription-store.js +293 -0
  87. package/dist/platform/calendar/types.d.ts +170 -0
  88. package/dist/platform/calendar/types.d.ts.map +1 -0
  89. package/dist/platform/calendar/types.js +21 -0
  90. package/dist/platform/companion/companion-chat-attachments.d.ts +29 -0
  91. package/dist/platform/companion/companion-chat-attachments.d.ts.map +1 -0
  92. package/dist/platform/companion/companion-chat-attachments.js +121 -0
  93. package/dist/platform/companion/companion-chat-broker-bridge.d.ts +40 -0
  94. package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -0
  95. package/dist/platform/companion/companion-chat-broker-bridge.js +14 -0
  96. package/dist/platform/companion/companion-chat-broker-sync.d.ts +38 -0
  97. package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -0
  98. package/dist/platform/companion/companion-chat-broker-sync.js +80 -0
  99. package/dist/platform/companion/companion-chat-gc.d.ts +63 -0
  100. package/dist/platform/companion/companion-chat-gc.d.ts.map +1 -0
  101. package/dist/platform/companion/companion-chat-gc.js +38 -0
  102. package/dist/platform/companion/companion-chat-manager.d.ts +67 -20
  103. package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
  104. package/dist/platform/companion/companion-chat-manager.js +130 -144
  105. package/dist/platform/companion/companion-chat-persistence.d.ts +9 -1
  106. package/dist/platform/companion/companion-chat-persistence.d.ts.map +1 -1
  107. package/dist/platform/companion/companion-chat-persistence.js +10 -2
  108. package/dist/platform/companion/companion-chat-routes.d.ts +2 -1
  109. package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
  110. package/dist/platform/companion/companion-chat-routes.js +37 -4
  111. package/dist/platform/config/credential-status.d.ts +28 -0
  112. package/dist/platform/config/credential-status.d.ts.map +1 -0
  113. package/dist/platform/config/credential-status.js +75 -0
  114. package/dist/platform/config/index.d.ts +25 -0
  115. package/dist/platform/config/index.d.ts.map +1 -1
  116. package/dist/platform/config/index.js +18 -0
  117. package/dist/platform/config/manager.d.ts +9 -0
  118. package/dist/platform/config/manager.d.ts.map +1 -1
  119. package/dist/platform/config/manager.js +21 -2
  120. package/dist/platform/config/migrations.d.ts +48 -0
  121. package/dist/platform/config/migrations.d.ts.map +1 -0
  122. package/dist/platform/config/migrations.js +54 -0
  123. package/dist/platform/config/schema-domain-core.d.ts +10 -1
  124. package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
  125. package/dist/platform/config/schema-domain-core.js +46 -3
  126. package/dist/platform/config/schema-types.d.ts +13 -7
  127. package/dist/platform/config/schema-types.d.ts.map +1 -1
  128. package/dist/platform/config/schema.d.ts.map +1 -1
  129. package/dist/platform/config/schema.js +2 -0
  130. package/dist/platform/control-plane/approval-broker.d.ts +11 -0
  131. package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
  132. package/dist/platform/control-plane/approval-broker.js +17 -1
  133. package/dist/platform/control-plane/approval-hunk-apply.d.ts +77 -0
  134. package/dist/platform/control-plane/approval-hunk-apply.d.ts.map +1 -0
  135. package/dist/platform/control-plane/approval-hunk-apply.js +80 -0
  136. package/dist/platform/control-plane/gateway-disabled-response.d.ts +20 -0
  137. package/dist/platform/control-plane/gateway-disabled-response.d.ts.map +1 -0
  138. package/dist/platform/control-plane/gateway-disabled-response.js +24 -0
  139. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts +68 -0
  140. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts.map +1 -0
  141. package/dist/platform/control-plane/gateway-scope-enforcement.js +91 -0
  142. package/dist/platform/control-plane/gateway-utils.d.ts +17 -0
  143. package/dist/platform/control-plane/gateway-utils.d.ts.map +1 -1
  144. package/dist/platform/control-plane/gateway-utils.js +30 -0
  145. package/dist/platform/control-plane/gateway.d.ts +12 -2
  146. package/dist/platform/control-plane/gateway.d.ts.map +1 -1
  147. package/dist/platform/control-plane/gateway.js +27 -31
  148. package/dist/platform/control-plane/index.d.ts +6 -1
  149. package/dist/platform/control-plane/index.d.ts.map +1 -1
  150. package/dist/platform/control-plane/index.js +4 -0
  151. package/dist/platform/control-plane/invoke-input-validation.d.ts +56 -0
  152. package/dist/platform/control-plane/invoke-input-validation.d.ts.map +1 -0
  153. package/dist/platform/control-plane/invoke-input-validation.js +163 -0
  154. package/dist/platform/control-plane/method-catalog-admin.d.ts.map +1 -1
  155. package/dist/platform/control-plane/method-catalog-admin.js +12 -1
  156. package/dist/platform/control-plane/method-catalog-calendar.d.ts +16 -0
  157. package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -1
  158. package/dist/platform/control-plane/method-catalog-calendar.js +21 -0
  159. package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
  160. package/dist/platform/control-plane/method-catalog-channels.js +32 -3
  161. package/dist/platform/control-plane/method-catalog-control-automation.d.ts.map +1 -1
  162. package/dist/platform/control-plane/method-catalog-control-automation.js +19 -34
  163. package/dist/platform/control-plane/method-catalog-control-companion.d.ts +15 -0
  164. package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -0
  165. package/dist/platform/control-plane/method-catalog-control-companion.js +133 -0
  166. package/dist/platform/control-plane/method-catalog-control-core.d.ts.map +1 -1
  167. package/dist/platform/control-plane/method-catalog-control-core.js +104 -122
  168. package/dist/platform/control-plane/method-catalog-control.d.ts.map +1 -1
  169. package/dist/platform/control-plane/method-catalog-control.js +4 -0
  170. package/dist/platform/control-plane/method-catalog-email.d.ts +17 -0
  171. package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
  172. package/dist/platform/control-plane/method-catalog-email.js +21 -0
  173. package/dist/platform/control-plane/method-catalog-events.d.ts +28 -0
  174. package/dist/platform/control-plane/method-catalog-events.d.ts.map +1 -1
  175. package/dist/platform/control-plane/method-catalog-events.js +74 -1
  176. package/dist/platform/control-plane/method-catalog-fleet.d.ts +24 -0
  177. package/dist/platform/control-plane/method-catalog-fleet.d.ts.map +1 -0
  178. package/dist/platform/control-plane/method-catalog-fleet.js +65 -0
  179. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +84 -0
  180. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts.map +1 -0
  181. package/dist/platform/control-plane/method-catalog-route-reconcile.js +103 -0
  182. package/dist/platform/control-plane/method-catalog-shared.d.ts +29 -0
  183. package/dist/platform/control-plane/method-catalog-shared.d.ts.map +1 -1
  184. package/dist/platform/control-plane/method-catalog.d.ts +9 -0
  185. package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
  186. package/dist/platform/control-plane/method-catalog.js +32 -3
  187. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts +8 -0
  188. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
  189. package/dist/platform/control-plane/operator-contract-schemas-admin.js +22 -1
  190. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts +18 -0
  191. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts.map +1 -0
  192. package/dist/platform/control-plane/operator-contract-schemas-fleet.js +182 -0
  193. package/dist/platform/control-plane/operator-contract-schemas-permissions.d.ts.map +1 -1
  194. package/dist/platform/control-plane/operator-contract-schemas-permissions.js +5 -0
  195. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +29 -0
  196. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
  197. package/dist/platform/control-plane/operator-contract-schemas-runtime.js +57 -3
  198. package/dist/platform/control-plane/operator-contract-schemas.d.ts +1 -0
  199. package/dist/platform/control-plane/operator-contract-schemas.d.ts.map +1 -1
  200. package/dist/platform/control-plane/operator-contract-schemas.js +1 -0
  201. package/dist/platform/control-plane/operator-contract.d.ts.map +1 -1
  202. package/dist/platform/control-plane/operator-contract.js +8 -0
  203. package/dist/platform/control-plane/routes/checkpoints.d.ts +39 -0
  204. package/dist/platform/control-plane/routes/checkpoints.d.ts.map +1 -0
  205. package/dist/platform/control-plane/routes/checkpoints.js +166 -0
  206. package/dist/platform/control-plane/routes/fleet.d.ts +53 -0
  207. package/dist/platform/control-plane/routes/fleet.d.ts.map +1 -0
  208. package/dist/platform/control-plane/routes/fleet.js +153 -0
  209. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +30 -0
  210. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts.map +1 -0
  211. package/dist/platform/control-plane/routes/gateway-verb-error.js +36 -0
  212. package/dist/platform/control-plane/routes/index.d.ts +0 -6
  213. package/dist/platform/control-plane/routes/index.d.ts.map +1 -1
  214. package/dist/platform/control-plane/routes/index.js +5 -5
  215. package/dist/platform/control-plane/routes/invocation-params.d.ts +23 -0
  216. package/dist/platform/control-plane/routes/invocation-params.d.ts.map +1 -0
  217. package/dist/platform/control-plane/routes/invocation-params.js +9 -0
  218. package/dist/platform/control-plane/routes/register-w3-s2.d.ts +26 -0
  219. package/dist/platform/control-plane/routes/register-w3-s2.d.ts.map +1 -0
  220. package/dist/platform/control-plane/routes/register-w3-s2.js +8 -0
  221. package/dist/platform/control-plane/routes/session-search.d.ts +37 -0
  222. package/dist/platform/control-plane/routes/session-search.d.ts.map +1 -0
  223. package/dist/platform/control-plane/routes/session-search.js +113 -0
  224. package/dist/platform/control-plane/session-broker-gc.d.ts +16 -0
  225. package/dist/platform/control-plane/session-broker-gc.d.ts.map +1 -1
  226. package/dist/platform/control-plane/session-broker-gc.js +23 -6
  227. package/dist/platform/control-plane/session-broker-helpers.d.ts +3 -3
  228. package/dist/platform/control-plane/session-broker-helpers.d.ts.map +1 -1
  229. package/dist/platform/control-plane/session-broker-inputs.d.ts +18 -0
  230. package/dist/platform/control-plane/session-broker-inputs.d.ts.map +1 -1
  231. package/dist/platform/control-plane/session-broker-inputs.js +34 -0
  232. package/dist/platform/control-plane/session-broker-sessions.d.ts +102 -3
  233. package/dist/platform/control-plane/session-broker-sessions.d.ts.map +1 -1
  234. package/dist/platform/control-plane/session-broker-sessions.js +179 -5
  235. package/dist/platform/control-plane/session-broker-state.d.ts +20 -1
  236. package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
  237. package/dist/platform/control-plane/session-broker-state.js +67 -5
  238. package/dist/platform/control-plane/session-broker.d.ts +51 -38
  239. package/dist/platform/control-plane/session-broker.d.ts.map +1 -1
  240. package/dist/platform/control-plane/session-broker.js +183 -75
  241. package/dist/platform/control-plane/session-store-importer.d.ts +57 -0
  242. package/dist/platform/control-plane/session-store-importer.d.ts.map +1 -0
  243. package/dist/platform/control-plane/session-store-importer.js +227 -0
  244. package/dist/platform/control-plane/session-types.d.ts +142 -7
  245. package/dist/platform/control-plane/session-types.d.ts.map +1 -1
  246. package/dist/platform/core/execution-plan.d.ts +43 -1
  247. package/dist/platform/core/execution-plan.d.ts.map +1 -1
  248. package/dist/platform/core/execution-plan.js +46 -10
  249. package/dist/platform/core/index.d.ts +1 -0
  250. package/dist/platform/core/index.d.ts.map +1 -1
  251. package/dist/platform/core/index.js +1 -0
  252. package/dist/platform/core/orchestrator-runtime.d.ts +21 -1
  253. package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
  254. package/dist/platform/core/orchestrator-tool-runtime.d.ts +7 -0
  255. package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  256. package/dist/platform/core/orchestrator-tool-runtime.js +10 -0
  257. package/dist/platform/core/orchestrator-turn-loop.d.ts +8 -1
  258. package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
  259. package/dist/platform/core/orchestrator-turn-loop.js +6 -0
  260. package/dist/platform/core/orchestrator.d.ts +6 -0
  261. package/dist/platform/core/orchestrator.d.ts.map +1 -1
  262. package/dist/platform/core/orchestrator.js +15 -0
  263. package/dist/platform/core/plan-decomposition.d.ts +196 -0
  264. package/dist/platform/core/plan-decomposition.d.ts.map +1 -0
  265. package/dist/platform/core/plan-decomposition.js +417 -0
  266. package/dist/platform/core/plan-proposal.d.ts +39 -0
  267. package/dist/platform/core/plan-proposal.d.ts.map +1 -1
  268. package/dist/platform/core/wrfc-routing.d.ts +1 -0
  269. package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
  270. package/dist/platform/core/wrfc-routing.js +51 -1
  271. package/dist/platform/daemon/boot.d.ts +63 -0
  272. package/dist/platform/daemon/boot.d.ts.map +1 -0
  273. package/dist/platform/daemon/boot.js +60 -0
  274. package/dist/platform/daemon/cli.js +2 -1
  275. package/dist/platform/daemon/control-plane.d.ts.map +1 -1
  276. package/dist/platform/daemon/control-plane.js +50 -1
  277. package/dist/platform/daemon/facade-composition.d.ts.map +1 -1
  278. package/dist/platform/daemon/facade-composition.js +6 -0
  279. package/dist/platform/daemon/facade.d.ts +18 -6
  280. package/dist/platform/daemon/facade.d.ts.map +1 -1
  281. package/dist/platform/daemon/facade.js +50 -43
  282. package/dist/platform/daemon/http/router-route-contexts.d.ts +1 -0
  283. package/dist/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
  284. package/dist/platform/daemon/http/router-route-contexts.js +1 -0
  285. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +13 -0
  286. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts.map +1 -0
  287. package/dist/platform/daemon/http/router-session-broker-adapter.js +27 -0
  288. package/dist/platform/daemon/http/router.d.ts +1 -1
  289. package/dist/platform/daemon/http/router.d.ts.map +1 -1
  290. package/dist/platform/daemon/http/router.js +7 -22
  291. package/dist/platform/daemon/http/runtime-route-types.d.ts +42 -4
  292. package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  293. package/dist/platform/daemon/index.d.ts +2 -0
  294. package/dist/platform/daemon/index.d.ts.map +1 -1
  295. package/dist/platform/daemon/index.js +1 -0
  296. package/dist/platform/daemon/service-manager.d.ts +16 -0
  297. package/dist/platform/daemon/service-manager.d.ts.map +1 -1
  298. package/dist/platform/daemon/service-manager.js +79 -15
  299. package/dist/platform/intelligence/tree-sitter/service.d.ts.map +1 -1
  300. package/dist/platform/intelligence/tree-sitter/service.js +16 -2
  301. package/dist/platform/knowledge/browser-history/readers.d.ts.map +1 -1
  302. package/dist/platform/knowledge/browser-history/readers.js +15 -5
  303. package/dist/platform/knowledge/project-planning/service.d.ts +14 -1
  304. package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
  305. package/dist/platform/knowledge/project-planning/service.js +77 -0
  306. package/dist/platform/knowledge/project-planning/types.d.ts +32 -0
  307. package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
  308. package/dist/platform/orchestration/bookkeeping.d.ts +12 -0
  309. package/dist/platform/orchestration/bookkeeping.d.ts.map +1 -0
  310. package/dist/platform/orchestration/bookkeeping.js +91 -0
  311. package/dist/platform/orchestration/controller-compat.d.ts +14 -0
  312. package/dist/platform/orchestration/controller-compat.d.ts.map +1 -1
  313. package/dist/platform/orchestration/controller-compat.js +18 -4
  314. package/dist/platform/orchestration/engine.d.ts +26 -1
  315. package/dist/platform/orchestration/engine.d.ts.map +1 -1
  316. package/dist/platform/orchestration/engine.js +226 -21
  317. package/dist/platform/orchestration/index.d.ts +6 -4
  318. package/dist/platform/orchestration/index.d.ts.map +1 -1
  319. package/dist/platform/orchestration/index.js +3 -2
  320. package/dist/platform/orchestration/persistence.d.ts.map +1 -1
  321. package/dist/platform/orchestration/persistence.js +4 -1
  322. package/dist/platform/orchestration/phase-runner.d.ts +29 -2
  323. package/dist/platform/orchestration/phase-runner.d.ts.map +1 -1
  324. package/dist/platform/orchestration/phase-runner.js +98 -25
  325. package/dist/platform/orchestration/proposal-workstream.d.ts +56 -0
  326. package/dist/platform/orchestration/proposal-workstream.d.ts.map +1 -0
  327. package/dist/platform/orchestration/proposal-workstream.js +76 -0
  328. package/dist/platform/orchestration/scheduler.d.ts +19 -0
  329. package/dist/platform/orchestration/scheduler.d.ts.map +1 -1
  330. package/dist/platform/orchestration/scheduler.js +16 -0
  331. package/dist/platform/orchestration/types.d.ts +286 -1
  332. package/dist/platform/orchestration/types.d.ts.map +1 -1
  333. package/dist/platform/orchestration/types.js +32 -0
  334. package/dist/platform/orchestration/worktree-isolation.d.ts +33 -0
  335. package/dist/platform/orchestration/worktree-isolation.d.ts.map +1 -0
  336. package/dist/platform/orchestration/worktree-isolation.js +248 -0
  337. package/dist/platform/presentation/glyphs.d.ts +91 -0
  338. package/dist/platform/presentation/glyphs.d.ts.map +1 -0
  339. package/dist/platform/presentation/glyphs.js +93 -0
  340. package/dist/platform/presentation/index.d.ts +28 -0
  341. package/dist/platform/presentation/index.d.ts.map +1 -0
  342. package/dist/platform/presentation/index.js +27 -0
  343. package/dist/platform/presentation/thinking-phrases.d.ts +12 -0
  344. package/dist/platform/presentation/thinking-phrases.d.ts.map +1 -0
  345. package/dist/platform/presentation/thinking-phrases.js +32 -0
  346. package/dist/platform/presentation/tones.d.ts +121 -0
  347. package/dist/platform/presentation/tones.d.ts.map +1 -0
  348. package/dist/platform/presentation/tones.js +145 -0
  349. package/dist/platform/presentation/waiting-wording.d.ts +54 -0
  350. package/dist/platform/presentation/waiting-wording.d.ts.map +1 -0
  351. package/dist/platform/presentation/waiting-wording.js +51 -0
  352. package/dist/platform/providers/runtime-snapshot.d.ts.map +1 -1
  353. package/dist/platform/providers/runtime-snapshot.js +12 -2
  354. package/dist/platform/runtime/bootstrap-services.d.ts +62 -2
  355. package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
  356. package/dist/platform/runtime/bootstrap-services.js +217 -50
  357. package/dist/platform/runtime/daemon-version-compat.d.ts +39 -0
  358. package/dist/platform/runtime/daemon-version-compat.d.ts.map +1 -0
  359. package/dist/platform/runtime/daemon-version-compat.js +75 -0
  360. package/dist/platform/runtime/detached-daemon-runtime.d.ts +26 -0
  361. package/dist/platform/runtime/detached-daemon-runtime.d.ts.map +1 -0
  362. package/dist/platform/runtime/detached-daemon-runtime.js +49 -0
  363. package/dist/platform/runtime/emitters/workflows.d.ts +1 -1
  364. package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
  365. package/dist/platform/runtime/events/index.d.ts +13 -0
  366. package/dist/platform/runtime/events/index.d.ts.map +1 -1
  367. package/dist/platform/runtime/events/index.js +13 -0
  368. package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
  369. package/dist/platform/runtime/feature-flags/flags.js +39 -1
  370. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +40 -18
  371. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -1
  372. package/dist/platform/runtime/fleet/adapters/orchestration.js +138 -34
  373. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +13 -0
  374. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -1
  375. package/dist/platform/runtime/fleet/adapters/wrfc.js +48 -1
  376. package/dist/platform/runtime/fleet/registry.d.ts.map +1 -1
  377. package/dist/platform/runtime/fleet/registry.js +38 -4
  378. package/dist/platform/runtime/operator-client.d.ts +20 -2
  379. package/dist/platform/runtime/operator-client.d.ts.map +1 -1
  380. package/dist/platform/runtime/operator-client.js +11 -1
  381. package/dist/platform/runtime/provider-accounts/registry.d.ts.map +1 -1
  382. package/dist/platform/runtime/provider-accounts/registry.js +11 -1
  383. package/dist/platform/runtime/services.d.ts +9 -7
  384. package/dist/platform/runtime/services.d.ts.map +1 -1
  385. package/dist/platform/runtime/services.js +19 -4
  386. package/dist/platform/runtime/session-spine/client.d.ts +234 -0
  387. package/dist/platform/runtime/session-spine/client.d.ts.map +1 -0
  388. package/dist/platform/runtime/session-spine/client.js +449 -0
  389. package/dist/platform/runtime/session-spine/index.d.ts +12 -0
  390. package/dist/platform/runtime/session-spine/index.d.ts.map +1 -0
  391. package/dist/platform/runtime/session-spine/index.js +11 -0
  392. package/dist/platform/runtime/session-spine/union-cache.d.ts +225 -0
  393. package/dist/platform/runtime/session-spine/union-cache.d.ts.map +1 -0
  394. package/dist/platform/runtime/session-spine/union-cache.js +333 -0
  395. package/dist/platform/runtime/shell-command-ops.d.ts +3 -1
  396. package/dist/platform/runtime/shell-command-ops.d.ts.map +1 -1
  397. package/dist/platform/runtime/transports/daemon-http-client-validators.d.ts.map +1 -1
  398. package/dist/platform/runtime/transports/daemon-http-client-validators.js +22 -0
  399. package/dist/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
  400. package/dist/platform/runtime/transports/daemon-http-client.js +25 -2
  401. package/dist/platform/runtime/transports/http-types.d.ts +9 -2
  402. package/dist/platform/runtime/transports/http-types.d.ts.map +1 -1
  403. package/dist/platform/state/canonical-memory.d.ts +95 -0
  404. package/dist/platform/state/canonical-memory.d.ts.map +1 -0
  405. package/dist/platform/state/canonical-memory.js +155 -0
  406. package/dist/platform/state/code-index-reindex.d.ts +73 -0
  407. package/dist/platform/state/code-index-reindex.d.ts.map +1 -0
  408. package/dist/platform/state/code-index-reindex.js +156 -0
  409. package/dist/platform/state/code-index-store.d.ts.map +1 -1
  410. package/dist/platform/state/code-index-store.js +10 -2
  411. package/dist/platform/state/index.d.ts +8 -0
  412. package/dist/platform/state/index.d.ts.map +1 -1
  413. package/dist/platform/state/index.js +4 -0
  414. package/dist/platform/state/memory-recall-contract.d.ts +63 -0
  415. package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
  416. package/dist/platform/state/memory-recall-contract.js +94 -0
  417. package/dist/platform/state/memory-store.d.ts +2 -0
  418. package/dist/platform/state/memory-store.d.ts.map +1 -1
  419. package/dist/platform/state/memory-store.js +4 -0
  420. package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
  421. package/dist/platform/state/memory-vector-store.js +13 -2
  422. package/dist/platform/state/sqlite-store.d.ts +2 -0
  423. package/dist/platform/state/sqlite-store.d.ts.map +1 -1
  424. package/dist/platform/state/sqlite-store.js +4 -0
  425. package/dist/platform/state/vibe-projection.d.ts +67 -0
  426. package/dist/platform/state/vibe-projection.d.ts.map +1 -0
  427. package/dist/platform/state/vibe-projection.js +115 -0
  428. package/dist/platform/tools/agent/index.d.ts.map +1 -1
  429. package/dist/platform/tools/agent/index.js +8 -0
  430. package/dist/platform/tools/agent/manager.d.ts +12 -0
  431. package/dist/platform/tools/agent/manager.d.ts.map +1 -1
  432. package/dist/platform/tools/agent/manager.js +6 -0
  433. package/dist/platform/tools/agent/schema.d.ts +26 -0
  434. package/dist/platform/tools/agent/schema.d.ts.map +1 -1
  435. package/dist/platform/tools/agent/schema.js +2 -2
  436. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
  437. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -1
  438. package/dist/platform/tools/agent/wrfc-batch-policy.js +60 -0
  439. package/dist/platform/tools/exec/runtime.d.ts +10 -0
  440. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  441. package/dist/platform/tools/exec/runtime.js +22 -5
  442. package/dist/platform/tools/exec/schema.d.ts +1 -1
  443. package/dist/platform/tools/exec/schema.d.ts.map +1 -1
  444. package/dist/platform/tools/exec/schema.js +2 -1
  445. package/dist/platform/tools/index.d.ts +2 -0
  446. package/dist/platform/tools/index.d.ts.map +1 -1
  447. package/dist/platform/tools/index.js +2 -0
  448. package/dist/platform/tools/state/index.d.ts +9 -0
  449. package/dist/platform/tools/state/index.d.ts.map +1 -1
  450. package/dist/platform/tools/state/index.js +60 -3
  451. package/dist/platform/types/foundation-contract.d.ts +1 -1
  452. package/dist/platform/types/foundation-contract.d.ts.map +1 -1
  453. package/dist/platform/types/index.d.ts +1 -1
  454. package/dist/platform/types/index.d.ts.map +1 -1
  455. package/dist/platform/version.js +1 -1
  456. package/package.json +21 -9
  457. package/dist/platform/control-plane/routes/automation.d.ts +0 -3
  458. package/dist/platform/control-plane/routes/automation.d.ts.map +0 -1
  459. package/dist/platform/control-plane/routes/automation.js +0 -63
  460. package/dist/platform/control-plane/routes/context.d.ts +0 -2
  461. package/dist/platform/control-plane/routes/context.d.ts.map +0 -1
  462. package/dist/platform/control-plane/routes/context.js +0 -1
  463. package/dist/platform/control-plane/routes/operator.d.ts +0 -8
  464. package/dist/platform/control-plane/routes/operator.d.ts.map +0 -1
  465. package/dist/platform/control-plane/routes/operator.js +0 -415
  466. package/dist/platform/control-plane/routes/remote.d.ts +0 -3
  467. package/dist/platform/control-plane/routes/remote.d.ts.map +0 -1
  468. package/dist/platform/control-plane/routes/remote.js +0 -35
  469. package/dist/platform/control-plane/routes/sessions.d.ts +0 -3
  470. package/dist/platform/control-plane/routes/sessions.d.ts.map +0 -1
  471. package/dist/platform/control-plane/routes/sessions.js +0 -43
  472. package/dist/platform/control-plane/routes/tasks.d.ts +0 -3
  473. package/dist/platform/control-plane/routes/tasks.d.ts.map +0 -1
  474. package/dist/platform/control-plane/routes/tasks.js +0 -22
@@ -0,0 +1,236 @@
1
+ /**
2
+ * ics-parser.ts — a pure, dependency-free iCalendar (RFC 5545) reader.
3
+ *
4
+ * Vendored on purpose. The SDK's `packages/sdk` ships ZERO third-party runtime
5
+ * dependencies (workspace packages only — see packages/sdk/package.json), and it
6
+ * guards that with bundle-budget / browser-compat / no-any gates. Pulling a general
7
+ * ICS library in for the read-focused subset we actually need would break that
8
+ * convention for little gain; this focused reader matches repo style and is easy to
9
+ * hold honest. See the decision record for the vendored-vs-dependency ruling and the
10
+ * exact supported subset.
11
+ *
12
+ * Scope of what this reads (documented, not faked):
13
+ * - VCALENDAR framing, X-WR-CALNAME for a calendar display name.
14
+ * - VEVENT: UID, SUMMARY, LOCATION, DESCRIPTION, DTSTART, DTEND, RRULE.
15
+ * - DTSTART/DTEND as VALUE=DATE ('YYYYMMDD') or date-time ('YYYYMMDDTHHMMSS'),
16
+ * with honest zone anchoring: trailing 'Z' => utc; TZID=... => tzid (wall time
17
+ * kept, NOT offset-converted, because this build has no tz database); otherwise
18
+ * floating. RRULE is captured raw and handed to the recurrence expander.
19
+ * - RFC 5545 line unfolding (a leading space/tab continues the previous line) and
20
+ * TEXT unescaping (\\n \\, \\; \\, \\\\).
21
+ *
22
+ * Everything unrecognised is ignored quietly EXCEPT the two things a caller must be
23
+ * told about: a VEVENT with no usable DTSTART is `skipped` with a reason, and an
24
+ * RRULE we do not fully expand is flagged on the event (in rrule.ts) — never dropped.
25
+ *
26
+ * PURE: no fs, no network, no process globals. Input is text; output is data.
27
+ */
28
+ import { describeRecurrence } from './rrule.js';
29
+ /**
30
+ * Unfold physical lines into logical content lines (RFC 5545 §3.1). A line beginning
31
+ * with a single space or tab is a continuation of the previous line.
32
+ */
33
+ function unfold(text) {
34
+ const physical = text.split(/\r\n|\r|\n/);
35
+ const out = [];
36
+ for (let i = 0; i < physical.length; i++) {
37
+ const cur = physical[i] ?? '';
38
+ if ((cur.startsWith(' ') || cur.startsWith('\t')) && out.length > 0) {
39
+ out[out.length - 1].raw += cur.slice(1);
40
+ }
41
+ else {
42
+ out.push({ raw: cur, line: i + 1 });
43
+ }
44
+ }
45
+ return out;
46
+ }
47
+ /** Parse one content line into name/params/value (RFC 5545 §3.1). */
48
+ function parseContentLine(raw, line) {
49
+ const colon = raw.indexOf(':');
50
+ if (colon < 0)
51
+ return undefined;
52
+ const head = raw.slice(0, colon);
53
+ const value = raw.slice(colon + 1);
54
+ const segments = head.split(';');
55
+ const name = (segments[0] ?? '').trim().toUpperCase();
56
+ if (name === '')
57
+ return undefined;
58
+ const params = new Map();
59
+ for (let i = 1; i < segments.length; i++) {
60
+ const seg = segments[i] ?? '';
61
+ const eq = seg.indexOf('=');
62
+ if (eq < 0)
63
+ continue;
64
+ const pName = seg.slice(0, eq).trim().toUpperCase();
65
+ let pVal = seg.slice(eq + 1).trim();
66
+ if (pVal.startsWith('"') && pVal.endsWith('"'))
67
+ pVal = pVal.slice(1, -1);
68
+ params.set(pName, pVal);
69
+ }
70
+ return { name, params, value, line };
71
+ }
72
+ /** Unescape RFC 5545 TEXT (\\n, \\N, \\,, \\;, \\\\). */
73
+ function unescapeText(value) {
74
+ let out = '';
75
+ for (let i = 0; i < value.length; i++) {
76
+ const ch = value[i];
77
+ if (ch === '\\' && i + 1 < value.length) {
78
+ const next = value[i + 1];
79
+ if (next === 'n' || next === 'N')
80
+ out += '\n';
81
+ else if (next === ',' || next === ';' || next === '\\')
82
+ out += next;
83
+ else
84
+ out += next;
85
+ i++;
86
+ }
87
+ else {
88
+ out += ch ?? '';
89
+ }
90
+ }
91
+ return out;
92
+ }
93
+ const DATE_ONLY = /^(\d{4})(\d{2})(\d{2})$/;
94
+ const DATE_TIME = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/;
95
+ /** Parse a DTSTART/DTEND value + params into an honest EventDateTime, or undefined. */
96
+ function parseDateValue(value, params) {
97
+ const trimmed = value.trim();
98
+ const isDateParam = params.get('VALUE') === 'DATE';
99
+ const tzid = params.get('TZID');
100
+ const dateMatch = DATE_ONLY.exec(trimmed);
101
+ if (dateMatch && (isDateParam || !trimmed.includes('T'))) {
102
+ const [, y, m, d] = dateMatch;
103
+ return { value: `${y}-${m}-${d}`, kind: 'date', zone: 'floating' };
104
+ }
105
+ const dtMatch = DATE_TIME.exec(trimmed);
106
+ if (dtMatch) {
107
+ const [, y, m, d, hh, mm, ss, z] = dtMatch;
108
+ const local = `${y}-${m}-${d}T${hh}:${mm}:${ss}`;
109
+ if (z === 'Z') {
110
+ return { value: `${local}Z`, kind: 'date-time', zone: 'utc' };
111
+ }
112
+ if (tzid) {
113
+ return { value: local, kind: 'date-time', zone: 'tzid', tzid };
114
+ }
115
+ return { value: local, kind: 'date-time', zone: 'floating' };
116
+ }
117
+ return undefined;
118
+ }
119
+ let syntheticCounter = 0;
120
+ /** Build a stable synthetic UID for a VEVENT that omitted one. */
121
+ function syntheticUid(start, summary) {
122
+ syntheticCounter += 1;
123
+ const stamp = start?.value ?? 'no-start';
124
+ const slug = summary.replace(/\s+/g, '-').slice(0, 24) || 'event';
125
+ return `synthetic:${slug}:${stamp}:${syntheticCounter}`;
126
+ }
127
+ /**
128
+ * Parse .ics text into typed events plus honest skip/diagnostic lists.
129
+ *
130
+ * @param text raw .ics content (file body or fetched feed body).
131
+ */
132
+ export function parseIcs(text) {
133
+ const lines = unfold(text);
134
+ const events = [];
135
+ const skipped = [];
136
+ const diagnostics = [];
137
+ let calendarName;
138
+ let inEvent = false;
139
+ let draft;
140
+ for (const { raw, line } of lines) {
141
+ if (raw.trim() === '')
142
+ continue;
143
+ const cl = parseContentLine(raw, line);
144
+ if (!cl)
145
+ continue;
146
+ if (cl.name === 'BEGIN' && cl.value.trim().toUpperCase() === 'VEVENT') {
147
+ inEvent = true;
148
+ draft = { startLine: line };
149
+ continue;
150
+ }
151
+ if (cl.name === 'END' && cl.value.trim().toUpperCase() === 'VEVENT') {
152
+ if (draft)
153
+ finalizeEvent(draft, events, skipped, diagnostics);
154
+ inEvent = false;
155
+ draft = undefined;
156
+ continue;
157
+ }
158
+ if (!inEvent) {
159
+ if (cl.name === 'X-WR-CALNAME')
160
+ calendarName = unescapeText(cl.value).trim();
161
+ continue;
162
+ }
163
+ if (!draft)
164
+ continue;
165
+ switch (cl.name) {
166
+ case 'UID':
167
+ draft.uid = cl.value.trim();
168
+ break;
169
+ case 'SUMMARY':
170
+ draft.summary = unescapeText(cl.value);
171
+ break;
172
+ case 'LOCATION':
173
+ draft.location = unescapeText(cl.value);
174
+ break;
175
+ case 'DESCRIPTION':
176
+ draft.description = unescapeText(cl.value);
177
+ break;
178
+ case 'DTSTART': {
179
+ const parsed = parseDateValue(cl.value, cl.params);
180
+ if (parsed)
181
+ draft.start = parsed;
182
+ else
183
+ diagnostics.push({ line: cl.line, component: 'DTSTART', message: `Unrecognised DTSTART value '${cl.value.trim()}' — event kept without a usable start.` });
184
+ break;
185
+ }
186
+ case 'DTEND': {
187
+ const parsed = parseDateValue(cl.value, cl.params);
188
+ if (parsed)
189
+ draft.end = parsed;
190
+ else
191
+ diagnostics.push({ line: cl.line, component: 'DTEND', message: `Unrecognised DTEND value '${cl.value.trim()}' — event kept without an end.` });
192
+ break;
193
+ }
194
+ case 'RRULE':
195
+ draft.rrule = cl.value.trim();
196
+ break;
197
+ default:
198
+ break;
199
+ }
200
+ }
201
+ if (inEvent && draft) {
202
+ diagnostics.push({ line: draft.startLine, component: 'VEVENT', message: 'VEVENT was not closed with END:VEVENT before end of feed — finalised anyway.' });
203
+ finalizeEvent(draft, events, skipped, diagnostics);
204
+ }
205
+ return {
206
+ ...(calendarName !== undefined ? { calendarName } : {}),
207
+ events,
208
+ skipped,
209
+ diagnostics,
210
+ };
211
+ }
212
+ function finalizeEvent(draft, events, skipped, diagnostics) {
213
+ if (!draft.start) {
214
+ skipped.push({ line: draft.startLine, component: 'VEVENT', message: `Skipped VEVENT '${draft.summary ?? draft.uid ?? 'untitled'}' — no usable DTSTART.` });
215
+ return;
216
+ }
217
+ const summary = draft.summary ?? '(no title)';
218
+ const uid = draft.uid && draft.uid !== '' ? draft.uid : syntheticUid(draft.start, summary);
219
+ let recurrence;
220
+ if (draft.rrule) {
221
+ recurrence = describeRecurrence(draft.rrule);
222
+ if (recurrence.expansion === 'unsupported' && recurrence.unsupportedReason) {
223
+ diagnostics.push({ line: draft.startLine, component: 'RRULE', message: `Event '${summary}': ${recurrence.unsupportedReason}` });
224
+ }
225
+ }
226
+ const event = {
227
+ uid,
228
+ summary,
229
+ ...(draft.location !== undefined ? { location: draft.location } : {}),
230
+ ...(draft.description !== undefined ? { description: draft.description } : {}),
231
+ start: draft.start,
232
+ ...(draft.end !== undefined ? { end: draft.end } : {}),
233
+ ...(recurrence !== undefined ? { recurrence } : {}),
234
+ };
235
+ events.push(event);
236
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @pellux/goodvibes-sdk/platform/calendar
3
+ *
4
+ * External-calendar READ connectivity — the SDK machinery behind the agent's
5
+ * `/calendar import`, `/calendar subscribe`, and the connect wizard (One-Platform
6
+ * Wave 4, A9). Two pieces, both honest by construction:
7
+ *
8
+ * - A vendored iCalendar (RFC 5545) reader: `parseIcs` turns .ics text (a file body
9
+ * or a fetched feed) into typed events, and `expandEvent` expands the honest RRULE
10
+ * subset into concrete occurrences. A recurrence outside the subset is NEVER
11
+ * fabricated — the event keeps its seed and carries an explicit
12
+ * `recurrence.expansion: 'unsupported'` marker naming the part we declined.
13
+ * - `SubscriptionStore`: named external-calendar feed subscriptions with per-feed
14
+ * honest status (ok / stale-with-age / unreachable / parse-error), etag/
15
+ * last-modified conditional refresh, and a paste-URL-and-done `add()` that
16
+ * validates by fetching and auto-derives the name from X-WR-CALNAME.
17
+ *
18
+ * Network and clock are INJECTED (FeedFetcher / Clock) — this module never reaches
19
+ * the network or reads wall-clock on its own, so consumers (and tests, with fake
20
+ * feeds) own the IO boundary entirely. Persistence is the caller's job.
21
+ *
22
+ * The daemon `calendar.*` operator methods stay `invokable: false` — they are
23
+ * CalDAV-backed contracts with no live route, a separate concern from this
24
+ * read-focused file/feed machinery. See
25
+ * docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md.
26
+ */
27
+ export { parseIcs } from './ics-parser.js';
28
+ export { describeRecurrence, expandEvent } from './rrule.js';
29
+ export { SubscriptionStore, maskFeedUrl, DEFAULT_REFRESH_INTERVAL_MS, MIN_REFRESH_INTERVAL_MS, MAX_REFRESH_INTERVAL_MS, type SubscriptionStoreOptions, type AddSubscriptionInput, type AddResult, type ValidationResult, } from './subscription-store.js';
30
+ export type { CalendarEvent, EventDateTime, EventZone, RecurrenceInfo, RecurrenceExpansion, ParsedCalendar, ParseDiagnostic, EventOccurrence, DateWindow, CalendarSubscription, SubscriptionHealth, SubscriptionSnapshot, RefreshReport, FeedFetcher, FeedFetchRequest, FeedFetchResult, Clock, } from './types.js';
31
+ export { GOOGLE_PROFILE, MICROSOFT_PROFILE, GOOGLE_PLACEHOLDER_CLIENT_ID, MICROSOFT_PLACEHOLDER_CLIENT_ID, GOOGLE_SCOPES_DEFAULT, MICROSOFT_SCOPES_DEFAULT, PROVIDER_SETUP_STEPS, providerProfile, resolveClientConfig, } from './oauth-providers.js';
32
+ export { OAuthFlowError, createPkcePair, parseTokenResponse, beginAuthCodeFlow, completeAuthCodeFlow, beginDeviceCodeFlow, pollDeviceCodeFlow, refreshAccessToken, revokeToken, type PkcePair, type Sleep, } from './oauth-flow.js';
33
+ export { CalendarTokenStore, TokenRefreshError, type CalendarTokenStoreOptions, } from './oauth-token-store.js';
34
+ export { normalizeGoogleEvent, normalizeGraphEvent, normalizeOffsetDateTime, eventDateTimeEpochMs, compareEventDateTime, compareMergedCalendarEventsByStart, } from './merged-calendar-model.js';
35
+ export { CalendarApiError, authedRequest, errorFromResponse, } from './calendar-api-shared.js';
36
+ export { listGoogleCalendars, listGoogleEvents, createGoogleEvent, type GoogleEventsQuery, } from './google-calendar-api.js';
37
+ export { listGraphCalendars, listGraphEvents, createGraphEvent, type GraphEventsQuery, } from './microsoft-graph-api.js';
38
+ export { CalendarConnector, type CalendarConnectorOptions, type EventWindow, } from './calendar-connector.js';
39
+ export { fetchAdapter } from './http-fetch-adapter.js';
40
+ export type { CalendarProviderId, CalendarSource, OAuthProviderProfile, OAuthClientOverrides, ResolvedClientConfig, HttpFetch, HttpRequest, HttpResponse, LoopbackWaiter, LoopbackListenerFactory, SecretStoreSlice, StoredTokenSet, ConnectionState, FlowFailureReason, AuthCodeFlowStart, DeviceCodeFlowStart, ApiDegradedState, MergedCalendarEvent, ProviderCalendar, NewCalendarEvent, ConnectedAccount, } from './oauth-types.js';
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/calendar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,gBAAgB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,KAAK,GACN,MAAM,YAAY,CAAC;AAcpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,4BAA4B,EAC5B,+BAA+B,EAC/B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,KAAK,QAAQ,EACb,KAAK,KAAK,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kCAAkC,GACnC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @pellux/goodvibes-sdk/platform/calendar
3
+ *
4
+ * External-calendar READ connectivity — the SDK machinery behind the agent's
5
+ * `/calendar import`, `/calendar subscribe`, and the connect wizard (One-Platform
6
+ * Wave 4, A9). Two pieces, both honest by construction:
7
+ *
8
+ * - A vendored iCalendar (RFC 5545) reader: `parseIcs` turns .ics text (a file body
9
+ * or a fetched feed) into typed events, and `expandEvent` expands the honest RRULE
10
+ * subset into concrete occurrences. A recurrence outside the subset is NEVER
11
+ * fabricated — the event keeps its seed and carries an explicit
12
+ * `recurrence.expansion: 'unsupported'` marker naming the part we declined.
13
+ * - `SubscriptionStore`: named external-calendar feed subscriptions with per-feed
14
+ * honest status (ok / stale-with-age / unreachable / parse-error), etag/
15
+ * last-modified conditional refresh, and a paste-URL-and-done `add()` that
16
+ * validates by fetching and auto-derives the name from X-WR-CALNAME.
17
+ *
18
+ * Network and clock are INJECTED (FeedFetcher / Clock) — this module never reaches
19
+ * the network or reads wall-clock on its own, so consumers (and tests, with fake
20
+ * feeds) own the IO boundary entirely. Persistence is the caller's job.
21
+ *
22
+ * The daemon `calendar.*` operator methods stay `invokable: false` — they are
23
+ * CalDAV-backed contracts with no live route, a separate concern from this
24
+ * read-focused file/feed machinery. See
25
+ * docs/decisions/2026-07-05-calendar-connectivity-sdk-extraction.md.
26
+ */
27
+ export { parseIcs } from './ics-parser.js';
28
+ export { describeRecurrence, expandEvent } from './rrule.js';
29
+ export { SubscriptionStore, maskFeedUrl, DEFAULT_REFRESH_INTERVAL_MS, MIN_REFRESH_INTERVAL_MS, MAX_REFRESH_INTERVAL_MS, } from './subscription-store.js';
30
+ // ---------------------------------------------------------------------------
31
+ // Authenticated provider connectivity — Google Calendar API v3 + Microsoft Graph
32
+ // over OAuth 2.0 (One-Platform Wave 4, A10). This half connects to real accounts;
33
+ // A9's half above reads .ics files and feeds. Both normalize into ONE merged event
34
+ // model (see MergedCalendarEvent) that a unified /calendar view renders source-
35
+ // labeled (google-api / microsoft-graph / ics-feed / local).
36
+ //
37
+ // The network is an injected HttpFetch, the loopback redirect an injected
38
+ // LoopbackWaiter, token persistence an injected secret-store slice — so the full
39
+ // OAuth + API flow runs against fake servers with no real network, port, or keychain.
40
+ // See docs/decisions/2026-07-06-calendar-oauth-connector-sdk.md.
41
+ export { GOOGLE_PROFILE, MICROSOFT_PROFILE, GOOGLE_PLACEHOLDER_CLIENT_ID, MICROSOFT_PLACEHOLDER_CLIENT_ID, GOOGLE_SCOPES_DEFAULT, MICROSOFT_SCOPES_DEFAULT, PROVIDER_SETUP_STEPS, providerProfile, resolveClientConfig, } from './oauth-providers.js';
42
+ export { OAuthFlowError, createPkcePair, parseTokenResponse, beginAuthCodeFlow, completeAuthCodeFlow, beginDeviceCodeFlow, pollDeviceCodeFlow, refreshAccessToken, revokeToken, } from './oauth-flow.js';
43
+ export { CalendarTokenStore, TokenRefreshError, } from './oauth-token-store.js';
44
+ export { normalizeGoogleEvent, normalizeGraphEvent, normalizeOffsetDateTime, eventDateTimeEpochMs, compareEventDateTime, compareMergedCalendarEventsByStart, } from './merged-calendar-model.js';
45
+ export { CalendarApiError, authedRequest, errorFromResponse, } from './calendar-api-shared.js';
46
+ export { listGoogleCalendars, listGoogleEvents, createGoogleEvent, } from './google-calendar-api.js';
47
+ export { listGraphCalendars, listGraphEvents, createGraphEvent, } from './microsoft-graph-api.js';
48
+ export { CalendarConnector, } from './calendar-connector.js';
49
+ export { fetchAdapter } from './http-fetch-adapter.js';
@@ -0,0 +1,67 @@
1
+ /**
2
+ * merged-calendar-model.ts — normalization of provider (Google Calendar API v3,
3
+ * Microsoft Graph) events into the ONE merged event model shared with A9's .ics
4
+ * path: A9's CalendarEvent shape plus a source label and the provider ids.
5
+ *
6
+ * Time-anchoring honesty follows A9's contract (this build ships no tz database):
7
+ * - An all-day value keeps its 'YYYY-MM-DD' date and is `zone: 'floating'`.
8
+ * - A timed value carrying an explicit numeric offset or a trailing Z is normalized
9
+ * to a real UTC instant (`zone: 'utc'`) — a fixed-offset -> UTC shift is pure
10
+ * arithmetic, NOT a named-zone conversion, so it is lossless and honest.
11
+ * - A timed value that only names a zone (no offset) is kept as wall time with the
12
+ * TZID recorded (`zone: 'tzid'`), never converted.
13
+ *
14
+ * Recurrence is delegated to the provider: the API clients request expanded single
15
+ * instances (Google singleEvents=true, Graph calendarView), so each normalized event
16
+ * is one concrete occurrence — no rule is fabricated here.
17
+ */
18
+ import type { EventDateTime } from './types.js';
19
+ import type { MergedCalendarEvent } from './oauth-types.js';
20
+ /**
21
+ * Normalize one Google event (already a concrete instance from singleEvents=true)
22
+ * into the merged model. Returns null for an event with no usable start.
23
+ */
24
+ export declare function normalizeGoogleEvent(raw: unknown, calendarId: string, calendarLabel: string): MergedCalendarEvent | null;
25
+ /** Normalize one Graph event (a concrete instance from calendarView) into the model. */
26
+ export declare function normalizeGraphEvent(raw: unknown, calendarId: string, calendarLabel: string): MergedCalendarEvent | null;
27
+ /**
28
+ * Normalize a date-time that may carry a numeric offset or trailing Z into a real
29
+ * UTC instant. A value with only a named zone (no offset) is impossible here (the
30
+ * Google API always includes an offset on dateTime), but we defend: if Date cannot
31
+ * parse it, keep the wall value as tzid when a zone was named, else floating.
32
+ */
33
+ export declare function normalizeOffsetDateTime(value: string, namedZone?: string): EventDateTime;
34
+ /**
35
+ * Best-effort epoch (ms) for one {@link EventDateTime}, for sorting a mixed list of
36
+ * merged events across zones/kinds. THIS IS THE ONE DOCUMENTED FUNCTION every
37
+ * consumer should sort through — a raw `localeCompare`/string sort on `.value` looks
38
+ * like it works (ISO strings are lexicographically sortable) but silently produces
39
+ * the wrong order the moment a `zone: 'utc'` value (a real instant) is compared
40
+ * against a `zone: 'tzid'` or `zone: 'floating'` value (a wall-clock reading with an
41
+ * unknown or undeclared offset) — e.g. a `tzid` event at `01:00` in
42
+ * `America/New_York` and a `utc` event at `05:00Z` are close to the same real
43
+ * instant (EDT is UTC-4), but a naive string/localeCompare sort of `'01:00:00'` vs
44
+ * `'05:00:00Z'` treats them as 4-5 hours apart on the SAME axis, which they are not.
45
+ *
46
+ * Documented approximation (this build ships no tz database, so a true conversion is
47
+ * not possible):
48
+ * - `kind: 'date'` (all-day) => midnight UTC of that date.
49
+ * - `zone: 'utc'` => the real epoch, via `Date.parse` of the (already-normalized,
50
+ * Z-suffixed) ISO value. Authoritative.
51
+ * - `zone: 'tzid'` or `zone: 'floating'` => the wall-clock digits are read AS IF
52
+ * they were UTC (no offset applied). This is an approximation, not the true
53
+ * instant — it keeps events within the SAME zone in correct relative order, and
54
+ * gives cross-zone comparisons a deterministic (if approximate) answer instead of
55
+ * an arbitrary one.
56
+ */
57
+ export declare function eventDateTimeEpochMs(dt: EventDateTime): number;
58
+ /**
59
+ * Chronological comparator for {@link EventDateTime} values (ascending), suitable
60
+ * for `Array.prototype.sort`. See {@link eventDateTimeEpochMs} for the documented
61
+ * cross-zone approximation this is built on — this is the ONE function every
62
+ * consumer should sort through instead of inventing its own string comparison.
63
+ */
64
+ export declare function compareEventDateTime(a: EventDateTime, b: EventDateTime): number;
65
+ /** Sort {@link MergedCalendarEvent}s by start time, through {@link compareEventDateTime}. */
66
+ export declare function compareMergedCalendarEventsByStart(a: MergedCalendarEvent, b: MergedCalendarEvent): number;
67
+ //# sourceMappingURL=merged-calendar-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merged-calendar-model.d.ts","sourceRoot":"","sources":["../../../src/platform/calendar/merged-calendar-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAiChF;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,mBAAmB,GAAG,IAAI,CAmB5B;AAqCD,wFAAwF;AACxF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,mBAAmB,GAAG,IAAI,CAqB5B;AAMD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAUxF;AAiBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,aAAa,GAAG,MAAM,CAe9D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,CAE/E;AAED,6FAA6F;AAC7F,wBAAgB,kCAAkC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAEzG"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * merged-calendar-model.ts — normalization of provider (Google Calendar API v3,
3
+ * Microsoft Graph) events into the ONE merged event model shared with A9's .ics
4
+ * path: A9's CalendarEvent shape plus a source label and the provider ids.
5
+ *
6
+ * Time-anchoring honesty follows A9's contract (this build ships no tz database):
7
+ * - An all-day value keeps its 'YYYY-MM-DD' date and is `zone: 'floating'`.
8
+ * - A timed value carrying an explicit numeric offset or a trailing Z is normalized
9
+ * to a real UTC instant (`zone: 'utc'`) — a fixed-offset -> UTC shift is pure
10
+ * arithmetic, NOT a named-zone conversion, so it is lossless and honest.
11
+ * - A timed value that only names a zone (no offset) is kept as wall time with the
12
+ * TZID recorded (`zone: 'tzid'`), never converted.
13
+ *
14
+ * Recurrence is delegated to the provider: the API clients request expanded single
15
+ * instances (Google singleEvents=true, Graph calendarView), so each normalized event
16
+ * is one concrete occurrence — no rule is fabricated here.
17
+ */
18
+ function googleDateTime(value) {
19
+ if (!value)
20
+ return null;
21
+ if (typeof value.date === 'string') {
22
+ return { value: value.date, kind: 'date', zone: 'floating' };
23
+ }
24
+ if (typeof value.dateTime === 'string') {
25
+ return normalizeOffsetDateTime(value.dateTime, typeof value.timeZone === 'string' ? value.timeZone : undefined);
26
+ }
27
+ return null;
28
+ }
29
+ /**
30
+ * Normalize one Google event (already a concrete instance from singleEvents=true)
31
+ * into the merged model. Returns null for an event with no usable start.
32
+ */
33
+ export function normalizeGoogleEvent(raw, calendarId, calendarLabel) {
34
+ const ev = (raw ?? {});
35
+ const start = googleDateTime(ev.start);
36
+ if (!start)
37
+ return null;
38
+ const id = typeof ev.id === 'string' ? ev.id : undefined;
39
+ const uid = typeof ev.iCalUID === 'string' && ev.iCalUID.length > 0 ? ev.iCalUID : id ?? syntheticUid('google', calendarId);
40
+ const end = googleDateTime(ev.end);
41
+ return {
42
+ uid,
43
+ summary: typeof ev.summary === 'string' ? ev.summary : '(no title)',
44
+ ...(typeof ev.location === 'string' ? { location: ev.location } : {}),
45
+ ...(typeof ev.description === 'string' ? { description: ev.description } : {}),
46
+ start,
47
+ ...(end ? { end } : {}),
48
+ source: 'google-api',
49
+ ...(id ? { sourceEventId: id } : {}),
50
+ calendarId,
51
+ calendarLabel,
52
+ };
53
+ }
54
+ function graphDateTime(value, isAllDay) {
55
+ if (!value || typeof value.dateTime !== 'string')
56
+ return null;
57
+ const zone = typeof value.timeZone === 'string' ? value.timeZone : 'UTC';
58
+ if (isAllDay) {
59
+ // Graph all-day start is midnight; keep the date part as a floating date.
60
+ return { value: value.dateTime.slice(0, 10), kind: 'date', zone: 'floating' };
61
+ }
62
+ if (zone === 'UTC') {
63
+ // Graph returns UTC wall time without an offset; stamp it as real UTC.
64
+ const iso = value.dateTime.endsWith('Z') ? isoSeconds(value.dateTime) : `${isoSeconds(value.dateTime)}Z`;
65
+ return { value: iso, kind: 'date-time', zone: 'utc' };
66
+ }
67
+ // A named zone with no offset: keep wall time, record the TZID, do NOT convert.
68
+ return { value: isoSeconds(value.dateTime), kind: 'date-time', zone: 'tzid', tzid: zone };
69
+ }
70
+ /** Normalize one Graph event (a concrete instance from calendarView) into the model. */
71
+ export function normalizeGraphEvent(raw, calendarId, calendarLabel) {
72
+ const ev = (raw ?? {});
73
+ const isAllDay = ev.isAllDay === true;
74
+ const start = graphDateTime(ev.start, isAllDay);
75
+ if (!start)
76
+ return null;
77
+ const id = typeof ev.id === 'string' ? ev.id : undefined;
78
+ const uid = typeof ev.iCalUId === 'string' && ev.iCalUId.length > 0 ? ev.iCalUId : id ?? syntheticUid('microsoft', calendarId);
79
+ const end = graphDateTime(ev.end, isAllDay);
80
+ const location = ev.location && typeof ev.location.displayName === 'string' ? ev.location.displayName : undefined;
81
+ return {
82
+ uid,
83
+ summary: typeof ev.subject === 'string' ? ev.subject : '(no title)',
84
+ ...(location ? { location } : {}),
85
+ ...(typeof ev.bodyPreview === 'string' && ev.bodyPreview.length > 0 ? { description: ev.bodyPreview } : {}),
86
+ start,
87
+ ...(end ? { end } : {}),
88
+ source: 'microsoft-graph',
89
+ ...(id ? { sourceEventId: id } : {}),
90
+ calendarId,
91
+ calendarLabel,
92
+ };
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // Shared helpers
96
+ // ---------------------------------------------------------------------------
97
+ /**
98
+ * Normalize a date-time that may carry a numeric offset or trailing Z into a real
99
+ * UTC instant. A value with only a named zone (no offset) is impossible here (the
100
+ * Google API always includes an offset on dateTime), but we defend: if Date cannot
101
+ * parse it, keep the wall value as tzid when a zone was named, else floating.
102
+ */
103
+ export function normalizeOffsetDateTime(value, namedZone) {
104
+ const hasOffset = /[zZ]$|[+-]\d{2}:?\d{2}$/.test(value);
105
+ if (hasOffset) {
106
+ const ms = Date.parse(value);
107
+ if (Number.isFinite(ms)) {
108
+ return { value: new Date(ms).toISOString().replace(/\.\d{3}Z$/, 'Z'), kind: 'date-time', zone: 'utc' };
109
+ }
110
+ }
111
+ if (namedZone)
112
+ return { value: isoSeconds(value), kind: 'date-time', zone: 'tzid', tzid: namedZone };
113
+ return { value: isoSeconds(value), kind: 'date-time', zone: 'floating' };
114
+ }
115
+ /** Trim a provider date-time to whole-second ISO (drop sub-second + any offset tail). */
116
+ function isoSeconds(value) {
117
+ const trimmed = value.replace(/\.\d+/, '');
118
+ const m = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})/.exec(trimmed);
119
+ return m ? m[1] : trimmed;
120
+ }
121
+ function syntheticUid(provider, calendarId) {
122
+ return `goodvibes-${provider}-${calendarId}-${Math.random().toString(36).slice(2, 10)}`;
123
+ }
124
+ // ---------------------------------------------------------------------------
125
+ // Cross-zone chronological ordering (F4)
126
+ // ---------------------------------------------------------------------------
127
+ /**
128
+ * Best-effort epoch (ms) for one {@link EventDateTime}, for sorting a mixed list of
129
+ * merged events across zones/kinds. THIS IS THE ONE DOCUMENTED FUNCTION every
130
+ * consumer should sort through — a raw `localeCompare`/string sort on `.value` looks
131
+ * like it works (ISO strings are lexicographically sortable) but silently produces
132
+ * the wrong order the moment a `zone: 'utc'` value (a real instant) is compared
133
+ * against a `zone: 'tzid'` or `zone: 'floating'` value (a wall-clock reading with an
134
+ * unknown or undeclared offset) — e.g. a `tzid` event at `01:00` in
135
+ * `America/New_York` and a `utc` event at `05:00Z` are close to the same real
136
+ * instant (EDT is UTC-4), but a naive string/localeCompare sort of `'01:00:00'` vs
137
+ * `'05:00:00Z'` treats them as 4-5 hours apart on the SAME axis, which they are not.
138
+ *
139
+ * Documented approximation (this build ships no tz database, so a true conversion is
140
+ * not possible):
141
+ * - `kind: 'date'` (all-day) => midnight UTC of that date.
142
+ * - `zone: 'utc'` => the real epoch, via `Date.parse` of the (already-normalized,
143
+ * Z-suffixed) ISO value. Authoritative.
144
+ * - `zone: 'tzid'` or `zone: 'floating'` => the wall-clock digits are read AS IF
145
+ * they were UTC (no offset applied). This is an approximation, not the true
146
+ * instant — it keeps events within the SAME zone in correct relative order, and
147
+ * gives cross-zone comparisons a deterministic (if approximate) answer instead of
148
+ * an arbitrary one.
149
+ */
150
+ export function eventDateTimeEpochMs(dt) {
151
+ if (dt.kind === 'date') {
152
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(dt.value);
153
+ if (!m)
154
+ return Number.NaN;
155
+ return Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
156
+ }
157
+ if (dt.zone === 'utc') {
158
+ const ms = Date.parse(dt.value);
159
+ if (Number.isFinite(ms))
160
+ return ms;
161
+ }
162
+ // tzid / floating (or an unparsable utc value, defensively): treat the wall-clock
163
+ // digits as if they were UTC — see the documented approximation above.
164
+ const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/.exec(dt.value);
165
+ if (!m)
166
+ return Number.NaN;
167
+ return Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5]), Number(m[6]));
168
+ }
169
+ /**
170
+ * Chronological comparator for {@link EventDateTime} values (ascending), suitable
171
+ * for `Array.prototype.sort`. See {@link eventDateTimeEpochMs} for the documented
172
+ * cross-zone approximation this is built on — this is the ONE function every
173
+ * consumer should sort through instead of inventing its own string comparison.
174
+ */
175
+ export function compareEventDateTime(a, b) {
176
+ return eventDateTimeEpochMs(a) - eventDateTimeEpochMs(b);
177
+ }
178
+ /** Sort {@link MergedCalendarEvent}s by start time, through {@link compareEventDateTime}. */
179
+ export function compareMergedCalendarEventsByStart(a, b) {
180
+ return compareEventDateTime(a.start, b.start);
181
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * microsoft-graph-api.ts — the Microsoft Graph client over an access token and the
3
+ * injected HttpFetch. Lists calendars (me/calendars), lists events over a window
4
+ * (me/calendars/{id}/calendarView, which returns expanded instances), and creates
5
+ * events (me/calendars/{id}/events). A Prefer: outlook.timezone="UTC" header makes
6
+ * Graph return UTC wall times so normalization is honest. Paging follows
7
+ * @odata.nextLink; failures are named degraded states via CalendarApiError.
8
+ */
9
+ import type { HttpFetch, MergedCalendarEvent, NewCalendarEvent, ProviderCalendar } from './oauth-types.js';
10
+ /** List the user's calendars; write access comes from canEdit. */
11
+ export declare function listGraphCalendars(fetchImpl: HttpFetch, token: string): Promise<ProviderCalendar[]>;
12
+ export interface GraphEventsQuery {
13
+ readonly calendarId: string;
14
+ readonly calendarLabel: string;
15
+ /** ISO lower bound, e.g. '2026-07-01T00:00:00Z'. */
16
+ readonly start: string;
17
+ /** ISO upper bound. */
18
+ readonly end: string;
19
+ readonly pageSize?: number;
20
+ }
21
+ /** List events over a window via calendarView, paging @odata.nextLink to exhaustion. */
22
+ export declare function listGraphEvents(fetchImpl: HttpFetch, token: string, query: GraphEventsQuery): Promise<MergedCalendarEvent[]>;
23
+ /** Create an event; returns it normalized into the merged model. */
24
+ export declare function createGraphEvent(fetchImpl: HttpFetch, token: string, calendarId: string, calendarLabel: string, event: NewCalendarEvent): Promise<MergedCalendarEvent>;
25
+ //# sourceMappingURL=microsoft-graph-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft-graph-api.d.ts","sourceRoot":"","sources":["../../../src/platform/calendar/microsoft-graph-api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAK3G,kEAAkE;AAClE,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAsBzG;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uBAAuB;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wFAAwF;AACxF,wBAAsB,eAAe,CACnC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAuBhC;AAED,oEAAoE;AACpE,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,mBAAmB,CAAC,CAqB9B"}