@opengsd/gsd-pi 1.7.0 → 1.8.1-dev.897b3c90

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 (465) hide show
  1. package/README.md +8 -6
  2. package/dist/cli.js +5 -1
  3. package/dist/headless-events.d.ts +2 -1
  4. package/dist/headless-events.js +11 -3
  5. package/dist/headless-milestone-readiness.d.ts +29 -0
  6. package/dist/headless-milestone-readiness.js +161 -0
  7. package/dist/headless.js +25 -2
  8. package/dist/print-mode-exit.d.ts +12 -0
  9. package/dist/print-mode-exit.js +14 -0
  10. package/dist/resources/.managed-resources-content-hash +1 -1
  11. package/dist/resources/GSD-WORKFLOW.md +16 -47
  12. package/dist/resources/extensions/browser-tools/capture.js +2 -77
  13. package/dist/resources/extensions/browser-tools/screenshot-constraints.js +83 -0
  14. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +17 -2
  15. package/dist/resources/extensions/claude-code-cli/turn-assembler.js +30 -2
  16. package/dist/resources/extensions/gsd/auto-artifact-paths.js +2 -2
  17. package/dist/resources/extensions/gsd/auto-dispatch.js +74 -19
  18. package/dist/resources/extensions/gsd/auto-post-unit.js +4 -0
  19. package/dist/resources/extensions/gsd/auto-prompts.js +35 -1
  20. package/dist/resources/extensions/gsd/auto.js +5 -1
  21. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +78 -4
  22. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +84 -26
  23. package/dist/resources/extensions/gsd/command-feedback.js +16 -12
  24. package/dist/resources/extensions/gsd/compat/compat-marker.js +19 -2
  25. package/dist/resources/extensions/gsd/db/command-queue.js +7 -2
  26. package/dist/resources/extensions/gsd/db/engine.js +51 -16
  27. package/dist/resources/extensions/gsd/db/writers/cascades.js +5 -1
  28. package/dist/resources/extensions/gsd/db/writers/status.js +13 -3
  29. package/dist/resources/extensions/gsd/db-base-schema.js +28 -0
  30. package/dist/resources/extensions/gsd/db-migration-steps.js +30 -0
  31. package/dist/resources/extensions/gsd/db-schema-metadata.js +4 -1
  32. package/dist/resources/extensions/gsd/docs/preferences-reference.md +4 -4
  33. package/dist/resources/extensions/gsd/doctor-history.js +65 -0
  34. package/dist/resources/extensions/gsd/doctor-state-checks.js +509 -0
  35. package/dist/resources/extensions/gsd/doctor-workspace-checks.js +91 -0
  36. package/dist/resources/extensions/gsd/doctor.js +14 -653
  37. package/dist/resources/extensions/gsd/flat-phase-migration.js +156 -21
  38. package/dist/resources/extensions/gsd/gsd-db.js +187 -45
  39. package/dist/resources/extensions/gsd/guided-flow.js +29 -10
  40. package/dist/resources/extensions/gsd/markdown-renderer.js +16 -2
  41. package/dist/resources/extensions/gsd/md-importer.js +109 -16
  42. package/dist/resources/extensions/gsd/migrate/command.js +19 -162
  43. package/dist/resources/extensions/gsd/migrate/execution.js +98 -0
  44. package/dist/resources/extensions/gsd/migrate/plan.js +49 -0
  45. package/dist/resources/extensions/gsd/migrate/planning-writer.js +20 -19
  46. package/dist/resources/extensions/gsd/migrate/presentation.js +64 -0
  47. package/dist/resources/extensions/gsd/migration-auto-check.js +4 -0
  48. package/dist/resources/extensions/gsd/parallel-eligibility.js +5 -4
  49. package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +28 -43
  50. package/dist/resources/extensions/gsd/paths.js +4 -1
  51. package/dist/resources/extensions/gsd/phase-anchor.js +7 -2
  52. package/dist/resources/extensions/gsd/post-execution-checks.js +4 -4
  53. package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  54. package/dist/resources/extensions/gsd/safety/evidence-collector.js +26 -1
  55. package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +30 -5
  56. package/dist/resources/extensions/gsd/state-reconciliation/drift/external-markdown-edit.js +27 -13
  57. package/dist/resources/extensions/gsd/state-reconciliation/drift/external-planning-edit.js +13 -3
  58. package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +54 -14
  59. package/dist/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.js +48 -5
  60. package/dist/resources/extensions/gsd/stop-notice.js +15 -1
  61. package/dist/resources/extensions/gsd/sync-lock.js +13 -7
  62. package/dist/resources/extensions/gsd/tools/complete-task.js +82 -1
  63. package/dist/resources/extensions/gsd/tools/plan-task.js +13 -15
  64. package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +18 -15
  65. package/dist/resources/extensions/gsd/tools/replan-task.js +128 -0
  66. package/dist/resources/extensions/gsd/tools/rework-brief.js +74 -0
  67. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +81 -0
  68. package/dist/resources/extensions/gsd/unit-registry.js +4 -0
  69. package/dist/resources/extensions/gsd/uok/plan-v2.js +19 -3
  70. package/dist/resources/extensions/gsd/worktree-state-projection.js +6 -0
  71. package/dist/resources/extensions/mac-tools/index.js +31 -9
  72. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  73. package/dist/web/standalone/.next/BUILD_ID +1 -1
  74. package/dist/web/standalone/.next/app-path-routes-manifest.json +9 -9
  75. package/dist/web/standalone/.next/build-manifest.json +3 -3
  76. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  77. package/dist/web/standalone/.next/required-server-files.json +3 -3
  78. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  79. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  80. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  81. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  82. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  83. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  84. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  85. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  86. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  87. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  88. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  89. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  90. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  91. package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -4
  92. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  93. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  94. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  95. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  96. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  97. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  98. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  99. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  100. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  101. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  102. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  103. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  104. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  105. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  106. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  107. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  108. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  109. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  110. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  111. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  112. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  113. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  114. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  115. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  116. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  117. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  118. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  119. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  120. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  121. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  122. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  123. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  124. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  127. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  129. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  130. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  131. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  132. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  133. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  135. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/mcp-connections/route_client-reference-manifest.js +1 -1
  138. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  139. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  140. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  142. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  144. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  145. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  146. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  147. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  148. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  149. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  150. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  151. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  152. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  153. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  154. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  155. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  156. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  157. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  158. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  159. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  160. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  161. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  162. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  163. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  164. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  166. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  167. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  168. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
  169. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  170. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  171. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  172. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
  173. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  174. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
  175. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  176. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  177. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  178. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  179. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  180. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  181. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  182. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  183. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  184. package/dist/web/standalone/.next/server/app/index.html +1 -1
  185. package/dist/web/standalone/.next/server/app/index.rsc +5 -5
  186. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  187. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +5 -5
  188. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  189. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -4
  190. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  191. package/dist/web/standalone/.next/server/app/page.js +2 -2
  192. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  193. package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
  194. package/dist/web/standalone/.next/server/chunks/2842.js +4 -4
  195. package/dist/web/standalone/.next/server/chunks/8357.js +3 -3
  196. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  197. package/dist/web/standalone/.next/server/middleware.js +3 -3
  198. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  199. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  200. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  201. package/dist/web/standalone/.next/static/chunks/app/_not-found/page-a6fb1847f67f167c.js +1 -0
  202. package/dist/web/standalone/.next/static/chunks/app/{layout-b35cbfff38aaf4cf.js → layout-4ae2d68984392bbf.js} +1 -1
  203. package/dist/web/standalone/.next/static/chunks/app/page-72a856634ad14c10.js +1 -0
  204. package/dist/web/standalone/.next/static/chunks/{main-app-590a74400e35f685.js → main-app-90d1d8d5e5d2dc6b.js} +1 -1
  205. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-1115d46ac61b9823.js +1 -0
  206. package/dist/web/standalone/.next/static/css/3b1ceb7abfb9a230.css +1 -0
  207. package/dist/web/standalone/node_modules/@gsd/native/package.json +1 -1
  208. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  209. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  210. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  211. package/dist/web/standalone/package.json +0 -1
  212. package/dist/web/standalone/server.js +1 -1
  213. package/dist/web-mode.js +31 -3
  214. package/integrations/hermes/open_gsd_hermes/gsd_client.py +1 -1
  215. package/integrations/hermes/pyproject.toml +1 -1
  216. package/package.json +12 -10
  217. package/packages/cloud-mcp-gateway/package.json +2 -2
  218. package/packages/contracts/dist/workflow.d.ts +14 -0
  219. package/packages/contracts/dist/workflow.d.ts.map +1 -1
  220. package/packages/contracts/dist/workflow.js +16 -0
  221. package/packages/contracts/dist/workflow.js.map +1 -1
  222. package/packages/contracts/package.json +1 -1
  223. package/packages/daemon/dist/cloud-config.d.ts +1 -1
  224. package/packages/daemon/dist/cloud-config.d.ts.map +1 -1
  225. package/packages/daemon/dist/cloud-config.js +30 -8
  226. package/packages/daemon/dist/cloud-config.js.map +1 -1
  227. package/packages/daemon/dist/cloud-config.test.js +69 -1
  228. package/packages/daemon/dist/cloud-config.test.js.map +1 -1
  229. package/packages/daemon/dist/local-tool-executor.d.ts.map +1 -1
  230. package/packages/daemon/dist/local-tool-executor.js +2 -0
  231. package/packages/daemon/dist/local-tool-executor.js.map +1 -1
  232. package/packages/daemon/package.json +6 -6
  233. package/packages/gsd-agent-core/package.json +5 -5
  234. package/packages/gsd-agent-modes/package.json +7 -7
  235. package/packages/gsd-cloud/README.md +18 -4
  236. package/packages/gsd-cloud/bin/gsd-cloud.js +6 -5
  237. package/packages/gsd-cloud/dist/cli.d.ts +5 -0
  238. package/packages/gsd-cloud/dist/cli.d.ts.map +1 -0
  239. package/packages/gsd-cloud/dist/cli.js +160 -0
  240. package/packages/gsd-cloud/dist/cli.js.map +1 -0
  241. package/packages/gsd-cloud/dist/cloud-config.d.ts +19 -0
  242. package/packages/gsd-cloud/dist/cloud-config.d.ts.map +1 -0
  243. package/packages/gsd-cloud/dist/cloud-config.js +231 -0
  244. package/packages/gsd-cloud/dist/cloud-config.js.map +1 -0
  245. package/packages/gsd-cloud/dist/cloud-config.test.d.ts +2 -0
  246. package/packages/gsd-cloud/dist/cloud-config.test.d.ts.map +1 -0
  247. package/packages/gsd-cloud/dist/cloud-config.test.js +118 -0
  248. package/packages/gsd-cloud/dist/cloud-config.test.js.map +1 -0
  249. package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.d.ts +2 -0
  250. package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.d.ts.map +1 -0
  251. package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.js +37 -0
  252. package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.js.map +1 -0
  253. package/packages/gsd-cloud/dist/cloud-runtime.d.ts +35 -0
  254. package/packages/gsd-cloud/dist/cloud-runtime.d.ts.map +1 -0
  255. package/packages/gsd-cloud/dist/cloud-runtime.js +258 -0
  256. package/packages/gsd-cloud/dist/cloud-runtime.js.map +1 -0
  257. package/packages/gsd-cloud/dist/cloud-runtime.test.d.ts +2 -0
  258. package/packages/gsd-cloud/dist/cloud-runtime.test.d.ts.map +1 -0
  259. package/packages/gsd-cloud/dist/cloud-runtime.test.js +88 -0
  260. package/packages/gsd-cloud/dist/cloud-runtime.test.js.map +1 -0
  261. package/packages/gsd-cloud/dist/cloud-token.d.ts +3 -0
  262. package/packages/gsd-cloud/dist/cloud-token.d.ts.map +1 -0
  263. package/packages/gsd-cloud/dist/cloud-token.js +37 -0
  264. package/packages/gsd-cloud/dist/cloud-token.js.map +1 -0
  265. package/packages/gsd-cloud/dist/config.d.ts +17 -0
  266. package/packages/gsd-cloud/dist/config.d.ts.map +1 -0
  267. package/packages/gsd-cloud/dist/config.js +146 -0
  268. package/packages/gsd-cloud/dist/config.js.map +1 -0
  269. package/packages/gsd-cloud/dist/device-flow.d.ts +24 -0
  270. package/packages/gsd-cloud/dist/device-flow.d.ts.map +1 -0
  271. package/packages/gsd-cloud/dist/device-flow.js +128 -0
  272. package/packages/gsd-cloud/dist/device-flow.js.map +1 -0
  273. package/packages/gsd-cloud/dist/device-flow.test.d.ts +2 -0
  274. package/packages/gsd-cloud/dist/device-flow.test.d.ts.map +1 -0
  275. package/packages/gsd-cloud/dist/device-flow.test.js +155 -0
  276. package/packages/gsd-cloud/dist/device-flow.test.js.map +1 -0
  277. package/packages/gsd-cloud/dist/executors/claude-executor.d.ts +6 -0
  278. package/packages/gsd-cloud/dist/executors/claude-executor.d.ts.map +1 -0
  279. package/packages/gsd-cloud/dist/executors/claude-executor.js +15 -0
  280. package/packages/gsd-cloud/dist/executors/claude-executor.js.map +1 -0
  281. package/packages/gsd-cloud/dist/executors/codex-executor.d.ts +6 -0
  282. package/packages/gsd-cloud/dist/executors/codex-executor.d.ts.map +1 -0
  283. package/packages/gsd-cloud/dist/executors/codex-executor.js +15 -0
  284. package/packages/gsd-cloud/dist/executors/codex-executor.js.map +1 -0
  285. package/packages/gsd-cloud/dist/executors/executor.d.ts +28 -0
  286. package/packages/gsd-cloud/dist/executors/executor.d.ts.map +1 -0
  287. package/packages/gsd-cloud/dist/executors/executor.js +11 -0
  288. package/packages/gsd-cloud/dist/executors/executor.js.map +1 -0
  289. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.d.ts +34 -0
  290. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.d.ts.map +1 -0
  291. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.js +179 -0
  292. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.js.map +1 -0
  293. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.d.ts +2 -0
  294. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.d.ts.map +1 -0
  295. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.js +44 -0
  296. package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.js.map +1 -0
  297. package/packages/gsd-cloud/dist/executors/index.d.ts +17 -0
  298. package/packages/gsd-cloud/dist/executors/index.d.ts.map +1 -0
  299. package/packages/gsd-cloud/dist/executors/index.js +29 -0
  300. package/packages/gsd-cloud/dist/executors/index.js.map +1 -0
  301. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.d.ts +36 -0
  302. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.d.ts.map +1 -0
  303. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.js +176 -0
  304. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.js.map +1 -0
  305. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.d.ts +2 -0
  306. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.d.ts.map +1 -0
  307. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.js +34 -0
  308. package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.js.map +1 -0
  309. package/packages/gsd-cloud/dist/index.d.ts +7 -0
  310. package/packages/gsd-cloud/dist/index.d.ts.map +1 -0
  311. package/packages/gsd-cloud/dist/index.js +8 -0
  312. package/packages/gsd-cloud/dist/index.js.map +1 -0
  313. package/packages/gsd-cloud/dist/inject-gateway.d.ts +16 -0
  314. package/packages/gsd-cloud/dist/inject-gateway.d.ts.map +1 -0
  315. package/packages/gsd-cloud/dist/inject-gateway.js +29 -0
  316. package/packages/gsd-cloud/dist/inject-gateway.js.map +1 -0
  317. package/packages/gsd-cloud/dist/inject-gateway.test.d.ts +2 -0
  318. package/packages/gsd-cloud/dist/inject-gateway.test.d.ts.map +1 -0
  319. package/packages/gsd-cloud/dist/inject-gateway.test.js +41 -0
  320. package/packages/gsd-cloud/dist/inject-gateway.test.js.map +1 -0
  321. package/packages/gsd-cloud/dist/logger.d.ts +25 -0
  322. package/packages/gsd-cloud/dist/logger.d.ts.map +1 -0
  323. package/packages/gsd-cloud/dist/logger.js +72 -0
  324. package/packages/gsd-cloud/dist/logger.js.map +1 -0
  325. package/packages/gsd-cloud/dist/types.d.ts +51 -0
  326. package/packages/gsd-cloud/dist/types.d.ts.map +1 -0
  327. package/packages/gsd-cloud/dist/types.js +9 -0
  328. package/packages/gsd-cloud/dist/types.js.map +1 -0
  329. package/packages/gsd-cloud/package.json +7 -5
  330. package/packages/mcp-server/README.md +8 -0
  331. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  332. package/packages/mcp-server/dist/workflow-tools.js +64 -2
  333. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  334. package/packages/mcp-server/package.json +4 -4
  335. package/packages/native/package.json +1 -1
  336. package/packages/pi-agent-core/package.json +1 -1
  337. package/packages/pi-ai/dist/models.generated.d.ts +60 -0
  338. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  339. package/packages/pi-ai/dist/models.generated.js +54 -0
  340. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  341. package/packages/pi-ai/dist/providers/amazon-bedrock.js +1 -0
  342. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  343. package/packages/pi-ai/dist/providers/anthropic.js +19 -0
  344. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  345. package/packages/pi-ai/package.json +1 -1
  346. package/packages/pi-coding-agent/package.json +7 -7
  347. package/packages/pi-tui/package.json +2 -2
  348. package/packages/rpc-client/package.json +2 -2
  349. package/pkg/package.json +1 -1
  350. package/src/resources/GSD-WORKFLOW.md +16 -47
  351. package/src/resources/extensions/browser-tools/capture.ts +2 -86
  352. package/src/resources/extensions/browser-tools/screenshot-constraints.ts +94 -0
  353. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +18 -1
  354. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +108 -0
  355. package/src/resources/extensions/claude-code-cli/turn-assembler.ts +30 -2
  356. package/src/resources/extensions/gsd/auto-artifact-paths.ts +2 -2
  357. package/src/resources/extensions/gsd/auto-dispatch.ts +86 -19
  358. package/src/resources/extensions/gsd/auto-post-unit.ts +4 -0
  359. package/src/resources/extensions/gsd/auto-prompts.ts +38 -1
  360. package/src/resources/extensions/gsd/auto.ts +5 -1
  361. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +91 -4
  362. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +80 -24
  363. package/src/resources/extensions/gsd/command-feedback.ts +19 -12
  364. package/src/resources/extensions/gsd/compat/compat-marker.ts +21 -4
  365. package/src/resources/extensions/gsd/db/command-queue.ts +7 -1
  366. package/src/resources/extensions/gsd/db/engine.ts +53 -17
  367. package/src/resources/extensions/gsd/db/writers/cascades.ts +5 -1
  368. package/src/resources/extensions/gsd/db/writers/status.ts +25 -8
  369. package/src/resources/extensions/gsd/db-base-schema.ts +30 -0
  370. package/src/resources/extensions/gsd/db-migration-steps.ts +32 -0
  371. package/src/resources/extensions/gsd/db-schema-metadata.ts +4 -1
  372. package/src/resources/extensions/gsd/docs/preferences-reference.md +4 -4
  373. package/src/resources/extensions/gsd/doctor-history.ts +81 -0
  374. package/src/resources/extensions/gsd/doctor-state-checks.ts +527 -0
  375. package/src/resources/extensions/gsd/doctor-workspace-checks.ts +97 -0
  376. package/src/resources/extensions/gsd/doctor.ts +14 -673
  377. package/src/resources/extensions/gsd/flat-phase-migration.ts +160 -19
  378. package/src/resources/extensions/gsd/gsd-db.ts +255 -52
  379. package/src/resources/extensions/gsd/guided-flow.ts +39 -10
  380. package/src/resources/extensions/gsd/markdown-renderer.ts +23 -7
  381. package/src/resources/extensions/gsd/md-importer.ts +116 -13
  382. package/src/resources/extensions/gsd/migrate/command.ts +21 -227
  383. package/src/resources/extensions/gsd/migrate/execution.ts +136 -0
  384. package/src/resources/extensions/gsd/migrate/plan.ts +101 -0
  385. package/src/resources/extensions/gsd/migrate/planning-writer.ts +21 -23
  386. package/src/resources/extensions/gsd/migrate/presentation.ts +83 -0
  387. package/src/resources/extensions/gsd/migration-auto-check.ts +3 -0
  388. package/src/resources/extensions/gsd/parallel-eligibility.ts +5 -4
  389. package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +37 -40
  390. package/src/resources/extensions/gsd/paths.ts +4 -1
  391. package/src/resources/extensions/gsd/phase-anchor.ts +8 -2
  392. package/src/resources/extensions/gsd/post-execution-checks.ts +4 -4
  393. package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
  394. package/src/resources/extensions/gsd/safety/evidence-collector.ts +28 -1
  395. package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +31 -5
  396. package/src/resources/extensions/gsd/state-reconciliation/drift/external-markdown-edit.ts +30 -13
  397. package/src/resources/extensions/gsd/state-reconciliation/drift/external-planning-edit.ts +16 -3
  398. package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +67 -20
  399. package/src/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.ts +47 -5
  400. package/src/resources/extensions/gsd/state-reconciliation/types.ts +2 -2
  401. package/src/resources/extensions/gsd/stop-notice.ts +18 -1
  402. package/src/resources/extensions/gsd/sync-lock.ts +14 -6
  403. package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +96 -1
  404. package/src/resources/extensions/gsd/tests/command-feedback.test.ts +12 -0
  405. package/src/resources/extensions/gsd/tests/compat-marker.test.ts +104 -0
  406. package/src/resources/extensions/gsd/tests/complete-task.test.ts +286 -0
  407. package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +76 -1
  408. package/src/resources/extensions/gsd/tests/db-engine-migrate-guards.test.ts +186 -0
  409. package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +29 -0
  410. package/src/resources/extensions/gsd/tests/discuss-routing-fixes.test.ts +123 -0
  411. package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +50 -0
  412. package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +49 -0
  413. package/src/resources/extensions/gsd/tests/doctor-history-public-api.test.ts +25 -0
  414. package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +81 -0
  415. package/src/resources/extensions/gsd/tests/evidence-xref-gsd-exec.test.ts +22 -0
  416. package/src/resources/extensions/gsd/tests/external-edit-scoped-import.test.ts +262 -0
  417. package/src/resources/extensions/gsd/tests/flat-phase-migration.test.ts +202 -0
  418. package/src/resources/extensions/gsd/tests/gate-storage.test.ts +29 -0
  419. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +25 -0
  420. package/src/resources/extensions/gsd/tests/import-slice-milestone-completion-preserve.test.ts +116 -0
  421. package/src/resources/extensions/gsd/tests/migrate-hierarchy.test.ts +53 -0
  422. package/src/resources/extensions/gsd/tests/migrate-plan.test.ts +68 -0
  423. package/src/resources/extensions/gsd/tests/migrate-presentation.test.ts +98 -0
  424. package/src/resources/extensions/gsd/tests/migrate-safety-audit.test.ts +1 -1
  425. package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +53 -0
  426. package/src/resources/extensions/gsd/tests/milestone-leases.test.ts +55 -0
  427. package/src/resources/extensions/gsd/tests/parallel-eligibility-file-overlap.test.ts +146 -0
  428. package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +59 -0
  429. package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +4 -0
  430. package/src/resources/extensions/gsd/tests/phase-anchor.test.ts +32 -4
  431. package/src/resources/extensions/gsd/tests/plan-task.test.ts +26 -23
  432. package/src/resources/extensions/gsd/tests/planning-writer.test.ts +47 -1
  433. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +22 -0
  434. package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +18 -3
  435. package/src/resources/extensions/gsd/tests/reassess-handler.test.ts +50 -0
  436. package/src/resources/extensions/gsd/tests/replan-task-handler.test.ts +103 -0
  437. package/src/resources/extensions/gsd/tests/rework-brief.test.ts +197 -0
  438. package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +21 -0
  439. package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +177 -25
  440. package/src/resources/extensions/gsd/tests/stop-notice.test.ts +17 -0
  441. package/src/resources/extensions/gsd/tests/sync-lock.test.ts +19 -0
  442. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +34 -0
  443. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +93 -1
  444. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -0
  445. package/src/resources/extensions/gsd/tests/workflow-migration-gates.test.ts +139 -0
  446. package/src/resources/extensions/gsd/tests/worktree-state-projection.test.ts +36 -0
  447. package/src/resources/extensions/gsd/tests/write-gate-seam.test.ts +52 -0
  448. package/src/resources/extensions/gsd/tools/complete-task.ts +120 -0
  449. package/src/resources/extensions/gsd/tools/plan-task.ts +14 -16
  450. package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +18 -17
  451. package/src/resources/extensions/gsd/tools/replan-task.ts +160 -0
  452. package/src/resources/extensions/gsd/tools/rework-brief.ts +91 -0
  453. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +92 -0
  454. package/src/resources/extensions/gsd/types.ts +11 -0
  455. package/src/resources/extensions/gsd/unit-registry.ts +4 -0
  456. package/src/resources/extensions/gsd/uok/plan-v2.ts +20 -3
  457. package/src/resources/extensions/gsd/worktree-state-projection.ts +12 -0
  458. package/src/resources/extensions/mac-tools/index.ts +52 -9
  459. package/src/resources/extensions/mac-tools/tests/mac-screenshot-payload.test.cjs +70 -0
  460. package/dist/web/standalone/.next/static/chunks/app/_not-found/page-49f565245e1e4afe.js +0 -1
  461. package/dist/web/standalone/.next/static/chunks/app/page-bc4c723c6a19c6f0.js +0 -1
  462. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ec3eaffc9785ba48.js +0 -1
  463. package/dist/web/standalone/.next/static/css/18c2fdf261bfc1b7.css +0 -1
  464. /package/dist/web/standalone/.next/static/{enWQFRY-aLTUq3wmxG2Qz → TezjdjSHBVRRr54XjAvte}/_buildManifest.js +0 -0
  465. /package/dist/web/standalone/.next/static/{enWQFRY-aLTUq3wmxG2Qz → TezjdjSHBVRRr54XjAvte}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-gateway-lookup.test.d.ts","sourceRoot":"","sources":["../src/cloud-gateway-lookup.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ // Project/App: Open GSD
2
+ // File Purpose: Regression tests for createGatewayLookup — the custom DNS lookup
3
+ // must honor Node's `all: true` (autoSelectFamily/Happy Eyeballs) array form and
4
+ // still enforce the SSRF guard on every resolved address.
5
+ import { test } from "node:test";
6
+ import assert from "node:assert/strict";
7
+ import { createGatewayLookup } from "./cloud-config.js";
8
+ // Invoke the lookup and capture (err, result) from its Node-style callback.
9
+ function run(url, options) {
10
+ const lookup = createGatewayLookup(new URL(url));
11
+ return new Promise((resolve) => {
12
+ lookup("localhost", options, (...args) => resolve({ err: args[0] ?? null, result: args[1] }));
13
+ });
14
+ }
15
+ test("all:true resolves to an ARRAY for a http loopback URL (regression: was scalar → 'Invalid IP address')", async () => {
16
+ const { err, result } = await run("http://localhost", { all: true, family: 0 });
17
+ assert.equal(err, null, "loopback allowed for http URL");
18
+ assert.ok(Array.isArray(result), "all:true must call back with an array");
19
+ assert.ok(result.length > 0, "expected at least one address");
20
+ for (const entry of result) {
21
+ assert.equal(typeof entry.address, "string");
22
+ assert.ok(entry.family === 4 || entry.family === 6);
23
+ }
24
+ });
25
+ test("all:true REJECTS when a resolved address is private/loopback (SSRF guard, https URL)", async () => {
26
+ const { err } = await run("https://localhost", { all: true, family: 0 });
27
+ assert.ok(err instanceof Error, "expected rejection");
28
+ assert.match(err.message, /private or loopback/);
29
+ });
30
+ test("scalar (all:false) path still guards: https loopback rejected, http loopback allowed", async () => {
31
+ const rejected = await run("https://localhost", { all: false, family: 0 });
32
+ assert.ok(rejected.err instanceof Error, "https loopback rejected in scalar path");
33
+ const allowed = await run("http://localhost", { all: false, family: 0 });
34
+ assert.equal(allowed.err, null, "http loopback allowed in scalar path");
35
+ assert.equal(typeof allowed.result, "string", "scalar path returns a single address");
36
+ });
37
+ //# sourceMappingURL=cloud-gateway-lookup.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-gateway-lookup.test.js","sourceRoot":"","sources":["../src/cloud-gateway-lookup.test.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,iFAAiF;AACjF,iFAAiF;AACjF,0DAA0D;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OA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,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,sFAAsF,EAAE,KAAK,IAAI,EAAE;IACtG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,mBAAmB,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,KAAK,EAAE,oBAAoB,CAAC,CAAC;IACtD,MAAM,CAAC,KAAK,CAAC,GAAI,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,sFAAsF,EAAE,KAAK,IAAI,EAAE;IACtG,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,mBAAmB,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3E,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,YAAY,KAAK,EAAE,wCAAwC,CAAC,CAAC;IACnF,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACxE,MAAM,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,sCAAsC,CAAC,CAAC;AACxF,CAAC,CAAC,CAAC","sourcesContent":["// Project/App: Open GSD\n// File Purpose: Regression tests for createGatewayLookup — the custom DNS lookup\n// must honor Node's `all: true` (autoSelectFamily/Happy Eyeballs) array form and\n// still enforce the SSRF guard on every resolved address.\nimport { test } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport { createGatewayLookup } from \"./cloud-config.js\";\n\n// Invoke the lookup and capture (err, result) from its Node-style callback.\nfunction run(url: string, options: unknown): Promise<{ err: Error | null; result: unknown }> {\n const lookup = createGatewayLookup(new URL(url));\n return new Promise((resolve) => {\n (lookup as unknown as (h: string, o: unknown, cb: (...a: unknown[]) => void) => void)(\n \"localhost\",\n options,\n (...args: unknown[]) => resolve({ err: (args[0] as Error | null) ?? null, result: args[1] }),\n );\n });\n}\n\ntest(\"all:true resolves to an ARRAY for a http loopback URL (regression: was scalar → 'Invalid IP address')\", async () => {\n const { err, result } = await run(\"http://localhost\", { all: true, family: 0 });\n assert.equal(err, null, \"loopback allowed for http URL\");\n assert.ok(Array.isArray(result), \"all:true must call back with an array\");\n assert.ok((result as unknown[]).length > 0, \"expected at least one address\");\n for (const entry of result as Array<{ address: string; family: number }>) {\n assert.equal(typeof entry.address, \"string\");\n assert.ok(entry.family === 4 || entry.family === 6);\n }\n});\n\ntest(\"all:true REJECTS when a resolved address is private/loopback (SSRF guard, https URL)\", async () => {\n const { err } = await run(\"https://localhost\", { all: true, family: 0 });\n assert.ok(err instanceof Error, \"expected rejection\");\n assert.match(err!.message, /private or loopback/);\n});\n\ntest(\"scalar (all:false) path still guards: https loopback rejected, http loopback allowed\", async () => {\n const rejected = await run(\"https://localhost\", { all: false, family: 0 });\n assert.ok(rejected.err instanceof Error, \"https loopback rejected in scalar path\");\n const allowed = await run(\"http://localhost\", { all: false, family: 0 });\n assert.equal(allowed.err, null, \"http loopback allowed in scalar path\");\n assert.equal(typeof allowed.result, \"string\", \"scalar path returns a single address\");\n});\n"]}
@@ -0,0 +1,35 @@
1
+ import type { Logger } from "./logger.js";
2
+ import type { DaemonConfig } from "./types.js";
3
+ import type { Executor } from "./executors/executor.js";
4
+ export declare class CloudRuntime {
5
+ private readonly cloud;
6
+ private readonly executor;
7
+ private readonly logger;
8
+ private static readonly MAX_OUTBOX;
9
+ private static readonly RECONNECT_DELAY_MS;
10
+ private static readonly MAX_INITIAL_CONNECT_ATTEMPTS;
11
+ private static readonly INITIAL_CONNECT_HANDSHAKE_TIMEOUT_MS;
12
+ private socket;
13
+ private heartbeat;
14
+ private reconnect;
15
+ private readonly inFlight;
16
+ private outbox;
17
+ private stopped;
18
+ private firstConnectDeferred;
19
+ private initialConnectAttempts;
20
+ constructor(cloud: NonNullable<DaemonConfig["cloud"]>, executor: Executor, logger: Logger);
21
+ start(): Promise<void>;
22
+ stop(): void;
23
+ private connect;
24
+ private handleSocketOpen;
25
+ private handleSocketMessage;
26
+ private handleSocketClose;
27
+ private handleSocketError;
28
+ private advertiseProjects;
29
+ private handleMessage;
30
+ private cancelInFlight;
31
+ private resolveFirstConnect;
32
+ private rejectFirstConnect;
33
+ private send;
34
+ }
35
+ //# sourceMappingURL=cloud-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-runtime.d.ts","sourceRoot":"","sources":["../src/cloud-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAWxD,qBAAa,YAAY;IAoBrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IArBzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAO;IACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAMnD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAK;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAU;IACtE,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,SAAS,CAA6C;IAC9D,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,sBAAsB,CAAK;gBAGhB,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EACzC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM;IAGjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,IAAI;IAcZ,OAAO,CAAC,OAAO;IAkDf,OAAO,CAAC,gBAAgB;YAmBV,mBAAmB;IAKjC,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,iBAAiB;YAKX,iBAAiB;YAUjB,aAAa;YA6Bb,cAAc;IAqB5B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,IAAI;CAcb"}
@@ -0,0 +1,258 @@
1
+ import WebSocket from "ws";
2
+ import { createGatewayLookup, parseCloudGatewayUrl, validateGatewayNetworkTarget } from "./cloud-config.js";
3
+ export class CloudRuntime {
4
+ cloud;
5
+ executor;
6
+ logger;
7
+ static MAX_OUTBOX = 200;
8
+ static RECONNECT_DELAY_MS = 5_000;
9
+ // How many times to retry the initial connect before rejecting start(). A
10
+ // transient handshake failure (gateway briefly unreachable, DNS hiccup) should
11
+ // retry like the daemon's reconnect loop rather than kill the runtime; a
12
+ // persistent failure (gateway down, session rejected) must eventually reject so
13
+ // the CLI reports an error instead of hanging or exiting silently.
14
+ static MAX_INITIAL_CONNECT_ATTEMPTS = 5;
15
+ static INITIAL_CONNECT_HANDSHAKE_TIMEOUT_MS = 30_000;
16
+ socket;
17
+ heartbeat;
18
+ reconnect;
19
+ inFlight = new Map();
20
+ outbox = [];
21
+ stopped = false;
22
+ firstConnectDeferred;
23
+ initialConnectAttempts = 0;
24
+ constructor(cloud, executor, logger) {
25
+ this.cloud = cloud;
26
+ this.executor = executor;
27
+ this.logger = logger;
28
+ }
29
+ start() {
30
+ this.stopped = false;
31
+ this.initialConnectAttempts = 0;
32
+ this.firstConnectDeferred = Promise.withResolvers();
33
+ this.connect();
34
+ return this.firstConnectDeferred.promise;
35
+ }
36
+ stop() {
37
+ this.stopped = true;
38
+ this.rejectFirstConnect(new Error("cloud runtime stopped"));
39
+ if (this.reconnect)
40
+ clearTimeout(this.reconnect);
41
+ this.reconnect = undefined;
42
+ if (this.heartbeat)
43
+ clearInterval(this.heartbeat);
44
+ this.heartbeat = undefined;
45
+ this.inFlight.clear();
46
+ this.outbox = [];
47
+ const socket = this.socket;
48
+ this.socket = undefined;
49
+ socket?.close();
50
+ }
51
+ connect() {
52
+ if (this.reconnect)
53
+ clearTimeout(this.reconnect);
54
+ this.reconnect = undefined;
55
+ if (!this.cloud.device_token || !this.cloud.runtime_id) {
56
+ this.logger.warn("cloud runtime skipped — missing device token or runtime id");
57
+ this.rejectFirstConnect(new Error("cloud runtime missing device token or runtime id"));
58
+ return;
59
+ }
60
+ const gatewayUrl = parseCloudGatewayUrl(this.cloud.gateway_url);
61
+ try {
62
+ validateGatewayNetworkTarget(gatewayUrl);
63
+ }
64
+ catch (err) {
65
+ const message = err instanceof Error ? err.message : String(err);
66
+ this.logger.warn("cloud runtime skipped unsafe gateway URL", { error: message });
67
+ this.rejectFirstConnect(new Error(`cloud runtime unsafe gateway URL: ${message}`));
68
+ return;
69
+ }
70
+ const url = new URL("/runtime/connect", gatewayUrl);
71
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
72
+ const socket = new WebSocket(url, {
73
+ headers: { Authorization: `Bearer ${this.cloud.device_token}` },
74
+ lookup: createGatewayLookup(gatewayUrl),
75
+ handshakeTimeout: CloudRuntime.INITIAL_CONNECT_HANDSHAKE_TIMEOUT_MS,
76
+ });
77
+ const previousSocket = this.socket;
78
+ this.socket = socket;
79
+ if (previousSocket) {
80
+ // Detach the old socket's handlers before closing so its listeners don't
81
+ // linger on a socket we've already replaced (handlers also guard on
82
+ // identity, but this releases them eagerly for GC).
83
+ previousSocket.removeAllListeners();
84
+ if (previousSocket.readyState !== WebSocket.CLOSING && previousSocket.readyState !== WebSocket.CLOSED) {
85
+ previousSocket.close();
86
+ }
87
+ }
88
+ socket.on("open", () => {
89
+ this.handleSocketOpen(socket);
90
+ });
91
+ socket.on("message", (data) => {
92
+ void this.handleSocketMessage(socket, data.toString("utf8"));
93
+ });
94
+ socket.on("close", () => {
95
+ this.handleSocketClose(socket);
96
+ });
97
+ socket.on("error", (err) => {
98
+ this.handleSocketError(socket, err);
99
+ });
100
+ }
101
+ handleSocketOpen(socket) {
102
+ if (socket !== this.socket)
103
+ return;
104
+ this.resolveFirstConnect();
105
+ this.logger.info("cloud runtime connected", { gateway_url: this.cloud.gateway_url, runtime_id: this.cloud.runtime_id });
106
+ // Re-advertise projects (async: the hello is sent on a later microtask), then
107
+ // drain any messages buffered while disconnected. tool_results route by
108
+ // requestId on the authenticated connection, so drain order vs the hello is
109
+ // not significant.
110
+ void this.advertiseProjects();
111
+ const pending = this.outbox;
112
+ this.outbox = [];
113
+ for (const text of pending) {
114
+ if (this.socket?.readyState === WebSocket.OPEN)
115
+ this.socket.send(text);
116
+ else
117
+ this.outbox.push(text);
118
+ }
119
+ if (this.heartbeat)
120
+ clearInterval(this.heartbeat);
121
+ this.heartbeat = setInterval(() => this.send({ type: "heartbeat", at: Date.now() }), 30_000);
122
+ }
123
+ async handleSocketMessage(socket, text) {
124
+ if (socket !== this.socket)
125
+ return;
126
+ await this.handleMessage(text);
127
+ }
128
+ handleSocketClose(socket) {
129
+ if (socket !== this.socket)
130
+ return;
131
+ if (this.heartbeat)
132
+ clearInterval(this.heartbeat);
133
+ this.heartbeat = undefined;
134
+ this.socket = undefined;
135
+ if (this.stopped)
136
+ return;
137
+ if (this.firstConnectDeferred) {
138
+ // Still trying to establish the first connection: retry transient
139
+ // handshake failures (like the daemon's reconnect loop) and only reject
140
+ // start() once the bounded attempts are exhausted, so a brief blip does
141
+ // not kill the runtime while a persistent outage still surfaces an error.
142
+ this.initialConnectAttempts += 1;
143
+ if (this.initialConnectAttempts >= CloudRuntime.MAX_INITIAL_CONNECT_ATTEMPTS) {
144
+ this.rejectFirstConnect(new Error(`cloud runtime connection failed after ${this.initialConnectAttempts} attempt(s)`));
145
+ return;
146
+ }
147
+ this.logger.warn("cloud runtime initial connect failed; retrying", {
148
+ attempt: this.initialConnectAttempts,
149
+ max: CloudRuntime.MAX_INITIAL_CONNECT_ATTEMPTS,
150
+ });
151
+ }
152
+ else {
153
+ this.logger.warn("cloud runtime disconnected; reconnecting");
154
+ }
155
+ if (this.reconnect)
156
+ clearTimeout(this.reconnect);
157
+ this.reconnect = setTimeout(() => this.connect(), CloudRuntime.RECONNECT_DELAY_MS);
158
+ }
159
+ handleSocketError(socket, err) {
160
+ if (socket !== this.socket)
161
+ return;
162
+ this.logger.warn("cloud runtime socket error", { error: err.message });
163
+ }
164
+ async advertiseProjects() {
165
+ const projects = await this.executor.advertisedProjects();
166
+ this.send({
167
+ type: "hello",
168
+ runtimeId: this.cloud.runtime_id,
169
+ runtimeName: this.cloud.runtime_name,
170
+ projects,
171
+ });
172
+ }
173
+ async handleMessage(text) {
174
+ let message;
175
+ try {
176
+ message = JSON.parse(text);
177
+ }
178
+ catch {
179
+ return;
180
+ }
181
+ if (message.type === "cancel" && message.requestId) {
182
+ void this.cancelInFlight(message.requestId);
183
+ return;
184
+ }
185
+ if (message.type !== "tool_call" || !message.requestId || !message.toolName)
186
+ return;
187
+ this.inFlight.set(message.requestId, message);
188
+ try {
189
+ const result = await this.executor.execute(message.toolName, message.args ?? {}, message.projectAlias);
190
+ if (!this.inFlight.has(message.requestId))
191
+ return;
192
+ this.send({ type: "tool_result", requestId: message.requestId, result });
193
+ }
194
+ catch (err) {
195
+ if (!this.inFlight.has(message.requestId))
196
+ return;
197
+ this.send({
198
+ type: "tool_result",
199
+ requestId: message.requestId,
200
+ error: err instanceof Error ? err.message : String(err),
201
+ });
202
+ }
203
+ finally {
204
+ this.inFlight.delete(message.requestId);
205
+ }
206
+ }
207
+ async cancelInFlight(requestId) {
208
+ const pending = this.inFlight.get(requestId);
209
+ if (!pending)
210
+ return;
211
+ this.inFlight.delete(requestId);
212
+ try {
213
+ if (typeof pending.args?.sessionId === "string") {
214
+ await this.executor.execute("gsd_cancel", { sessionId: pending.args.sessionId }, pending.projectAlias);
215
+ return;
216
+ }
217
+ const projectDir = typeof pending.args?.projectDir === "string" ? pending.args.projectDir : pending.projectAlias;
218
+ if (projectDir) {
219
+ await this.executor.execute("gsd_cancel", { projectDir });
220
+ }
221
+ }
222
+ catch (err) {
223
+ this.logger.warn("cloud runtime cancel failed", {
224
+ requestId,
225
+ error: err instanceof Error ? err.message : String(err),
226
+ });
227
+ }
228
+ }
229
+ resolveFirstConnect() {
230
+ const deferred = this.firstConnectDeferred;
231
+ if (!deferred)
232
+ return;
233
+ this.firstConnectDeferred = undefined;
234
+ deferred.resolve();
235
+ }
236
+ rejectFirstConnect(err) {
237
+ const deferred = this.firstConnectDeferred;
238
+ if (!deferred)
239
+ return;
240
+ this.firstConnectDeferred = undefined;
241
+ deferred.reject(err);
242
+ }
243
+ send(message) {
244
+ const text = JSON.stringify(message);
245
+ if (this.socket?.readyState === WebSocket.OPEN) {
246
+ this.socket.send(text);
247
+ return;
248
+ }
249
+ // Buffer while disconnected; flushed on reconnect in handleSocketOpen. Bounded
250
+ // so a long outage cannot grow memory without limit — a stale heartbeat is
251
+ // worth less than a fresh tool_result, so drop oldest first.
252
+ this.outbox.push(text);
253
+ if (this.outbox.length > CloudRuntime.MAX_OUTBOX) {
254
+ this.outbox.shift();
255
+ }
256
+ }
257
+ }
258
+ //# sourceMappingURL=cloud-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-runtime.js","sourceRoot":"","sources":["../src/cloud-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAI3B,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAU5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DAA6D;QAC7D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;IACH,CAAC","sourcesContent":["import WebSocket from \"ws\";\nimport type { Logger } from \"./logger.js\";\nimport type { DaemonConfig } from \"./types.js\";\nimport type { Executor } from \"./executors/executor.js\";\nimport { createGatewayLookup, parseCloudGatewayUrl, validateGatewayNetworkTarget } from \"./cloud-config.js\";\n\ninterface GatewayMessage {\n type: string;\n requestId?: string;\n toolName?: string;\n args?: Record<string, unknown>;\n projectAlias?: string;\n}\n\nexport class CloudRuntime {\n private static readonly MAX_OUTBOX = 200;\n private static readonly RECONNECT_DELAY_MS = 5_000;\n // How many times to retry the initial connect before rejecting start(). A\n // transient handshake failure (gateway briefly unreachable, DNS hiccup) should\n // retry like the daemon's reconnect loop rather than kill the runtime; a\n // persistent failure (gateway down, session rejected) must eventually reject so\n // the CLI reports an error instead of hanging or exiting silently.\n private static readonly MAX_INITIAL_CONNECT_ATTEMPTS = 5;\n private static readonly INITIAL_CONNECT_HANDSHAKE_TIMEOUT_MS = 30_000;\n private socket: WebSocket | undefined;\n private heartbeat: ReturnType<typeof setInterval> | undefined;\n private reconnect: ReturnType<typeof setTimeout> | undefined;\n private readonly inFlight = new Map<string, GatewayMessage>();\n private outbox: string[] = [];\n private stopped = false;\n private firstConnectDeferred: PromiseWithResolvers<void> | undefined;\n private initialConnectAttempts = 0;\n\n constructor(\n private readonly cloud: NonNullable<DaemonConfig[\"cloud\"]>,\n private readonly executor: Executor,\n private readonly logger: Logger,\n ) {}\n\n start(): Promise<void> {\n this.stopped = false;\n this.initialConnectAttempts = 0;\n this.firstConnectDeferred = Promise.withResolvers<void>();\n this.connect();\n return this.firstConnectDeferred.promise;\n }\n\n stop(): void {\n this.stopped = true;\n this.rejectFirstConnect(new Error(\"cloud runtime stopped\"));\n if (this.reconnect) clearTimeout(this.reconnect);\n this.reconnect = undefined;\n if (this.heartbeat) clearInterval(this.heartbeat);\n this.heartbeat = undefined;\n this.inFlight.clear();\n this.outbox = [];\n const socket = this.socket;\n this.socket = undefined;\n socket?.close();\n }\n\n private connect(): void {\n if (this.reconnect) clearTimeout(this.reconnect);\n this.reconnect = undefined;\n if (!this.cloud.device_token || !this.cloud.runtime_id) {\n this.logger.warn(\"cloud runtime skipped — missing device token or runtime id\");\n this.rejectFirstConnect(new Error(\"cloud runtime missing device token or runtime id\"));\n return;\n }\n const gatewayUrl = parseCloudGatewayUrl(this.cloud.gateway_url);\n try {\n validateGatewayNetworkTarget(gatewayUrl);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n this.logger.warn(\"cloud runtime skipped unsafe gateway URL\", { error: message });\n this.rejectFirstConnect(new Error(`cloud runtime unsafe gateway URL: ${message}`));\n return;\n }\n const url = new URL(\"/runtime/connect\", gatewayUrl);\n url.protocol = url.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n const socket = new WebSocket(url, {\n headers: { Authorization: `Bearer ${this.cloud.device_token}` },\n lookup: createGatewayLookup(gatewayUrl),\n handshakeTimeout: CloudRuntime.INITIAL_CONNECT_HANDSHAKE_TIMEOUT_MS,\n });\n const previousSocket = this.socket;\n this.socket = socket;\n if (previousSocket) {\n // Detach the old socket's handlers before closing so its listeners don't\n // linger on a socket we've already replaced (handlers also guard on\n // identity, but this releases them eagerly for GC).\n previousSocket.removeAllListeners();\n if (previousSocket.readyState !== WebSocket.CLOSING && previousSocket.readyState !== WebSocket.CLOSED) {\n previousSocket.close();\n }\n }\n\n socket.on(\"open\", () => {\n this.handleSocketOpen(socket);\n });\n socket.on(\"message\", (data) => {\n void this.handleSocketMessage(socket, data.toString(\"utf8\"));\n });\n socket.on(\"close\", () => {\n this.handleSocketClose(socket);\n });\n socket.on(\"error\", (err) => {\n this.handleSocketError(socket, err);\n });\n }\n\n private handleSocketOpen(socket: WebSocket): void {\n if (socket !== this.socket) return;\n this.resolveFirstConnect();\n this.logger.info(\"cloud runtime connected\", { gateway_url: this.cloud.gateway_url, runtime_id: this.cloud.runtime_id });\n // Re-advertise projects (async: the hello is sent on a later microtask), then\n // drain any messages buffered while disconnected. tool_results route by\n // requestId on the authenticated connection, so drain order vs the hello is\n // not significant.\n void this.advertiseProjects();\n const pending = this.outbox;\n this.outbox = [];\n for (const text of pending) {\n if (this.socket?.readyState === WebSocket.OPEN) this.socket.send(text);\n else this.outbox.push(text);\n }\n if (this.heartbeat) clearInterval(this.heartbeat);\n this.heartbeat = setInterval(() => this.send({ type: \"heartbeat\", at: Date.now() }), 30_000);\n }\n\n private async handleSocketMessage(socket: WebSocket, text: string): Promise<void> {\n if (socket !== this.socket) return;\n await this.handleMessage(text);\n }\n\n private handleSocketClose(socket: WebSocket): void {\n if (socket !== this.socket) return;\n if (this.heartbeat) clearInterval(this.heartbeat);\n this.heartbeat = undefined;\n this.socket = undefined;\n if (this.stopped) return;\n if (this.firstConnectDeferred) {\n // Still trying to establish the first connection: retry transient\n // handshake failures (like the daemon's reconnect loop) and only reject\n // start() once the bounded attempts are exhausted, so a brief blip does\n // not kill the runtime while a persistent outage still surfaces an error.\n this.initialConnectAttempts += 1;\n if (this.initialConnectAttempts >= CloudRuntime.MAX_INITIAL_CONNECT_ATTEMPTS) {\n this.rejectFirstConnect(\n new Error(\n `cloud runtime connection failed after ${this.initialConnectAttempts} attempt(s)`,\n ),\n );\n return;\n }\n this.logger.warn(\"cloud runtime initial connect failed; retrying\", {\n attempt: this.initialConnectAttempts,\n max: CloudRuntime.MAX_INITIAL_CONNECT_ATTEMPTS,\n });\n } else {\n this.logger.warn(\"cloud runtime disconnected; reconnecting\");\n }\n if (this.reconnect) clearTimeout(this.reconnect);\n this.reconnect = setTimeout(() => this.connect(), CloudRuntime.RECONNECT_DELAY_MS);\n }\n\n private handleSocketError(socket: WebSocket, err: Error): void {\n if (socket !== this.socket) return;\n this.logger.warn(\"cloud runtime socket error\", { error: err.message });\n }\n\n private async advertiseProjects(): Promise<void> {\n const projects = await this.executor.advertisedProjects();\n this.send({\n type: \"hello\",\n runtimeId: this.cloud.runtime_id,\n runtimeName: this.cloud.runtime_name,\n projects,\n });\n }\n\n private async handleMessage(text: string): Promise<void> {\n let message: GatewayMessage;\n try {\n message = JSON.parse(text) as GatewayMessage;\n } catch {\n return;\n }\n if (message.type === \"cancel\" && message.requestId) {\n void this.cancelInFlight(message.requestId);\n return;\n }\n if (message.type !== \"tool_call\" || !message.requestId || !message.toolName) return;\n this.inFlight.set(message.requestId, message);\n try {\n const result = await this.executor.execute(message.toolName, message.args ?? {}, message.projectAlias);\n if (!this.inFlight.has(message.requestId)) return;\n this.send({ type: \"tool_result\", requestId: message.requestId, result });\n } catch (err) {\n if (!this.inFlight.has(message.requestId)) return;\n this.send({\n type: \"tool_result\",\n requestId: message.requestId,\n error: err instanceof Error ? err.message : String(err),\n });\n } finally {\n this.inFlight.delete(message.requestId);\n }\n }\n\n private async cancelInFlight(requestId: string): Promise<void> {\n const pending = this.inFlight.get(requestId);\n if (!pending) return;\n this.inFlight.delete(requestId);\n try {\n if (typeof pending.args?.sessionId === \"string\") {\n await this.executor.execute(\"gsd_cancel\", { sessionId: pending.args.sessionId }, pending.projectAlias);\n return;\n }\n const projectDir = typeof pending.args?.projectDir === \"string\" ? pending.args.projectDir : pending.projectAlias;\n if (projectDir) {\n await this.executor.execute(\"gsd_cancel\", { projectDir });\n }\n } catch (err) {\n this.logger.warn(\"cloud runtime cancel failed\", {\n requestId,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n private resolveFirstConnect(): void {\n const deferred = this.firstConnectDeferred;\n if (!deferred) return;\n this.firstConnectDeferred = undefined;\n deferred.resolve();\n }\n\n private rejectFirstConnect(err: Error): void {\n const deferred = this.firstConnectDeferred;\n if (!deferred) return;\n this.firstConnectDeferred = undefined;\n deferred.reject(err);\n }\n\n private send(message: unknown): void {\n const text = JSON.stringify(message);\n if (this.socket?.readyState === WebSocket.OPEN) {\n this.socket.send(text);\n return;\n }\n // Buffer while disconnected; flushed on reconnect in handleSocketOpen. Bounded\n // so a long outage cannot grow memory without limit — a stale heartbeat is\n // worth less than a fresh tool_result, so drop oldest first.\n this.outbox.push(text);\n if (this.outbox.length > CloudRuntime.MAX_OUTBOX) {\n this.outbox.shift();\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cloud-runtime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-runtime.test.d.ts","sourceRoot":"","sources":["../src/cloud-runtime.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,88 @@
1
+ // Project/App: Open GSD
2
+ // File Purpose: Regression tests for CloudRuntime.start()'s first-connect promise
3
+ // — it must resolve only once the relay is actually up and reject on connect
4
+ // failure, so the CLI never reports "connected" for a socket that never opened.
5
+ import { test } from "node:test";
6
+ import assert from "node:assert/strict";
7
+ import WebSocket from "ws";
8
+ import { CloudRuntime } from "./cloud-runtime.js";
9
+ const noopLogger = { info: () => undefined, warn: () => undefined, error: () => undefined, debug: () => undefined };
10
+ const noopExecutor = { execute: async () => ({}), advertisedProjects: async () => [] };
11
+ function makeRuntime(cloud = {}) {
12
+ return new CloudRuntime({ gateway_url: "wss://cloud.example.net", device_token: "fixture", runtime_id: "runtime", ...cloud }, noopExecutor, noopLogger);
13
+ }
14
+ function fakeSocket(readyState = WebSocket.OPEN) {
15
+ const sent = [];
16
+ return { readyState, sent, send: (t) => sent.push(t), close: () => undefined };
17
+ }
18
+ test("start()'s first-connect promise resolves only when the relay socket opens", async () => {
19
+ const runtime = makeRuntime();
20
+ const internals = runtime;
21
+ try {
22
+ const deferred = Promise.withResolvers();
23
+ internals.firstConnectDeferred = deferred;
24
+ const socket = fakeSocket();
25
+ internals.socket = socket;
26
+ let settled = false;
27
+ void deferred.promise.then(() => (settled = true));
28
+ await Promise.resolve(); // let any premature settle flush
29
+ assert.equal(settled, false, "promise must not resolve before the socket opens");
30
+ internals.handleSocketOpen(socket);
31
+ await deferred.promise; // resolves — otherwise this hangs/throws
32
+ }
33
+ finally {
34
+ runtime.stop();
35
+ }
36
+ });
37
+ test("an early socket close retries instead of rejecting while attempts remain", async () => {
38
+ const runtime = makeRuntime();
39
+ const internals = runtime;
40
+ try {
41
+ const deferred = Promise.withResolvers();
42
+ internals.firstConnectDeferred = deferred;
43
+ const socket = fakeSocket();
44
+ internals.socket = socket;
45
+ let settled = false;
46
+ void deferred.promise.then(() => (settled = true), () => (settled = true));
47
+ internals.handleSocketClose(socket); // first transient failure
48
+ await Promise.resolve();
49
+ assert.equal(settled, false, "a single early close must not settle start()");
50
+ assert.equal(internals.initialConnectAttempts, 1);
51
+ assert.notEqual(internals.reconnect, undefined, "a reconnect must be scheduled");
52
+ }
53
+ finally {
54
+ runtime.stop();
55
+ }
56
+ });
57
+ test("start()'s first-connect promise rejects once the initial connect attempts are exhausted", async () => {
58
+ const runtime = makeRuntime();
59
+ const internals = runtime;
60
+ try {
61
+ const deferred = Promise.withResolvers();
62
+ internals.firstConnectDeferred = deferred;
63
+ // Simulate having already burned every retry but the last so the next close
64
+ // is the one that must give up and reject.
65
+ internals.initialConnectAttempts = 4;
66
+ const socket = fakeSocket();
67
+ internals.socket = socket;
68
+ internals.handleSocketClose(socket);
69
+ await assert.rejects(deferred.promise, /connection failed/);
70
+ }
71
+ finally {
72
+ runtime.stop();
73
+ }
74
+ });
75
+ test("connect() rejects the first-connect promise when the device token is missing", async () => {
76
+ const runtime = makeRuntime({ device_token: "" });
77
+ const internals = runtime;
78
+ try {
79
+ const deferred = Promise.withResolvers();
80
+ internals.firstConnectDeferred = deferred;
81
+ internals.connect();
82
+ await assert.rejects(deferred.promise, /missing device token/);
83
+ }
84
+ finally {
85
+ runtime.stop();
86
+ }
87
+ });
88
+ //# sourceMappingURL=cloud-runtime.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAsC,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAC;QAC/C,SAAS,CAAC,oBAAoB,GAAG,QAAQ,CAAC;QAC1C,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACjE,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["// Project/App: Open GSD\n// File Purpose: Regression tests for CloudRuntime.start()'s first-connect promise\n// — it must resolve only once the relay is actually up and reject on connect\n// failure, so the CLI never reports \"connected\" for a socket that never opened.\nimport { test } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport WebSocket from \"ws\";\nimport { CloudRuntime } from \"./cloud-runtime.js\";\n\nconst noopLogger = { info: () => undefined, warn: () => undefined, error: () => undefined, debug: () => undefined };\nconst noopExecutor = { execute: async () => ({}), advertisedProjects: async () => [] };\n\nfunction makeRuntime(cloud: Record<string, unknown> = {}): CloudRuntime {\n return new CloudRuntime(\n { gateway_url: \"wss://cloud.example.net\", device_token: \"fixture\", runtime_id: \"runtime\", ...cloud } as never,\n noopExecutor as never,\n noopLogger as never,\n );\n}\n\ntype FakeSocket = { readyState: number; sent: string[]; send: (t: string) => void; close: () => void };\nfunction fakeSocket(readyState = WebSocket.OPEN): FakeSocket {\n const sent: string[] = [];\n return { readyState, sent, send: (t: string) => sent.push(t), close: () => undefined };\n}\ntype RuntimeInternals = {\n socket: FakeSocket | undefined;\n firstConnectDeferred: PromiseWithResolvers<void> | undefined;\n initialConnectAttempts: number;\n reconnect: ReturnType<typeof setTimeout> | undefined;\n handleSocketOpen: (socket: unknown) => void;\n handleSocketClose: (socket: unknown) => void;\n connect: () => void;\n};\n\ntest(\"start()'s first-connect promise resolves only when the relay socket opens\", async () => {\n const runtime = makeRuntime();\n const internals = runtime as unknown as RuntimeInternals;\n try {\n const deferred = Promise.withResolvers<void>();\n internals.firstConnectDeferred = deferred;\n const socket = fakeSocket();\n internals.socket = socket;\n\n let settled = false;\n void deferred.promise.then(() => (settled = true));\n await Promise.resolve(); // let any premature settle flush\n assert.equal(settled, false, \"promise must not resolve before the socket opens\");\n\n internals.handleSocketOpen(socket);\n await deferred.promise; // resolves — otherwise this hangs/throws\n } finally {\n runtime.stop();\n }\n});\n\ntest(\"an early socket close retries instead of rejecting while attempts remain\", async () => {\n const runtime = makeRuntime();\n const internals = runtime as unknown as RuntimeInternals;\n try {\n const deferred = Promise.withResolvers<void>();\n internals.firstConnectDeferred = deferred;\n const socket = fakeSocket();\n internals.socket = socket;\n\n let settled = false;\n void deferred.promise.then(() => (settled = true), () => (settled = true));\n\n internals.handleSocketClose(socket); // first transient failure\n await Promise.resolve();\n assert.equal(settled, false, \"a single early close must not settle start()\");\n assert.equal(internals.initialConnectAttempts, 1);\n assert.notEqual(internals.reconnect, undefined, \"a reconnect must be scheduled\");\n } finally {\n runtime.stop();\n }\n});\n\ntest(\"start()'s first-connect promise rejects once the initial connect attempts are exhausted\", async () => {\n const runtime = makeRuntime();\n const internals = runtime as unknown as RuntimeInternals;\n try {\n const deferred = Promise.withResolvers<void>();\n internals.firstConnectDeferred = deferred;\n // Simulate having already burned every retry but the last so the next close\n // is the one that must give up and reject.\n internals.initialConnectAttempts = 4;\n const socket = fakeSocket();\n internals.socket = socket;\n\n internals.handleSocketClose(socket);\n await assert.rejects(deferred.promise, /connection failed/);\n } finally {\n runtime.stop();\n }\n});\n\ntest(\"connect() rejects the first-connect promise when the device token is missing\", async () => {\n const runtime = makeRuntime({ device_token: \"\" });\n const internals = runtime as unknown as RuntimeInternals;\n try {\n const deferred = Promise.withResolvers<void>();\n internals.firstConnectDeferred = deferred;\n internals.connect();\n await assert.rejects(deferred.promise, /missing device token/);\n } finally {\n runtime.stop();\n }\n});\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function protectCloudDeviceToken(token: string): string;
2
+ export declare function unprotectCloudDeviceToken(value: string): string | undefined;
3
+ //# sourceMappingURL=cloud-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-token.d.ts","sourceRoot":"","sources":["../src/cloud-token.ts"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAc3E"}
@@ -0,0 +1,37 @@
1
+ import { createCipheriv, createDecipheriv, createHash, randomBytes } from "node:crypto";
2
+ import { homedir, hostname, userInfo } from "node:os";
3
+ const PREFIX = "v1.";
4
+ const ALGORITHM = "aes-256-gcm";
5
+ export function protectCloudDeviceToken(token) {
6
+ const iv = randomBytes(12);
7
+ const cipher = createCipheriv(ALGORITHM, cloudTokenKey(), iv);
8
+ const ciphertext = Buffer.concat([cipher.update(token, "utf8"), cipher.final()]);
9
+ const tag = cipher.getAuthTag();
10
+ return `${PREFIX}${Buffer.concat([iv, tag, ciphertext]).toString("base64url")}`;
11
+ }
12
+ export function unprotectCloudDeviceToken(value) {
13
+ if (!value.startsWith(PREFIX))
14
+ return undefined;
15
+ try {
16
+ const payload = Buffer.from(value.slice(PREFIX.length), "base64url");
17
+ if (payload.length <= 28)
18
+ return undefined;
19
+ const iv = payload.subarray(0, 12);
20
+ const tag = payload.subarray(12, 28);
21
+ const ciphertext = payload.subarray(28);
22
+ const decipher = createDecipheriv(ALGORITHM, cloudTokenKey(), iv);
23
+ decipher.setAuthTag(tag);
24
+ return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
25
+ }
26
+ catch {
27
+ return undefined;
28
+ }
29
+ }
30
+ function cloudTokenKey() {
31
+ const configuredKey = process.env["GSD_CLOUD_TOKEN_KEY"];
32
+ const material = configuredKey && configuredKey.trim()
33
+ ? `env:${configuredKey}`
34
+ : `local:${hostname()}:${userInfo().username}:${homedir()}`;
35
+ return createHash("sha256").update(material, "utf8").digest();
36
+ }
37
+ //# sourceMappingURL=cloud-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-token.js","sourceRoot":"","sources":["../src/cloud-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,MAAM,GAAG,KAAK,CAAC;AACrB,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,MAAM,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAChC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACrD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;QACrE,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE;YAAE,OAAO,SAAS,CAAC;QAC3C,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QAClE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,aAAa,IAAI,aAAa,CAAC,IAAI,EAAE;QACpD,CAAC,CAAC,OAAO,aAAa,EAAE;QACxB,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,QAAQ,EAAE,CAAC,QAAQ,IAAI,OAAO,EAAE,EAAE,CAAC;IAC9D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;AAChE,CAAC","sourcesContent":["import { createCipheriv, createDecipheriv, createHash, randomBytes } from \"node:crypto\";\nimport { homedir, hostname, userInfo } from \"node:os\";\n\nconst PREFIX = \"v1.\";\nconst ALGORITHM = \"aes-256-gcm\";\n\nexport function protectCloudDeviceToken(token: string): string {\n const iv = randomBytes(12);\n const cipher = createCipheriv(ALGORITHM, cloudTokenKey(), iv);\n const ciphertext = Buffer.concat([cipher.update(token, \"utf8\"), cipher.final()]);\n const tag = cipher.getAuthTag();\n return `${PREFIX}${Buffer.concat([iv, tag, ciphertext]).toString(\"base64url\")}`;\n}\n\nexport function unprotectCloudDeviceToken(value: string): string | undefined {\n if (!value.startsWith(PREFIX)) return undefined;\n try {\n const payload = Buffer.from(value.slice(PREFIX.length), \"base64url\");\n if (payload.length <= 28) return undefined;\n const iv = payload.subarray(0, 12);\n const tag = payload.subarray(12, 28);\n const ciphertext = payload.subarray(28);\n const decipher = createDecipheriv(ALGORITHM, cloudTokenKey(), iv);\n decipher.setAuthTag(tag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString(\"utf8\");\n } catch {\n return undefined;\n }\n}\n\nfunction cloudTokenKey(): Buffer {\n const configuredKey = process.env[\"GSD_CLOUD_TOKEN_KEY\"];\n const material = configuredKey && configuredKey.trim()\n ? `env:${configuredKey}`\n : `local:${hostname()}:${userInfo().username}:${homedir()}`;\n return createHash(\"sha256\").update(material, \"utf8\").digest();\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { DaemonConfig } from './types.js';
2
+ /**
3
+ * Resolve the config file path.
4
+ * Priority: explicit CLI arg → GSD_DAEMON_CONFIG env → ~/.gsd/daemon.yaml
5
+ */
6
+ export declare function resolveConfigPath(cliPath?: string): string;
7
+ /**
8
+ * Validate and normalise a raw parsed object into a DaemonConfig.
9
+ * Missing/invalid fields are filled with defaults. Invalid log level falls back to 'info'.
10
+ */
11
+ export declare function validateConfig(raw: unknown): DaemonConfig;
12
+ /**
13
+ * Load and validate a DaemonConfig from a YAML file.
14
+ * If the file doesn't exist, returns defaults. If the file is malformed YAML, throws.
15
+ */
16
+ export declare function loadConfig(configPath: string): DaemonConfig;
17
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,YAAY,CAAC;AA0BzD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAwFzD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAgB3D"}