@mesh-tech/mesh-cli 0.1.0 → 0.12.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 (504) hide show
  1. package/assets/intent/agents-fence.md +10 -0
  2. package/assets/intent/intent-claude-gate.mjs +255 -0
  3. package/assets/log-shipper.mjs +94 -0
  4. package/bin/mesh.mjs +80 -0
  5. package/dist/bin/mesh.d.ts +7 -9
  6. package/dist/bin/mesh.d.ts.map +1 -1
  7. package/dist/bin/mesh.js +20826 -37
  8. package/dist/bin/mesh.js.map +7 -1
  9. package/dist/build-info.json +4 -0
  10. package/dist/src/commands/agent-api-client.d.ts +79 -0
  11. package/dist/src/commands/agent-api-client.d.ts.map +1 -0
  12. package/dist/src/commands/agent-api-client.js +170 -0
  13. package/dist/src/commands/agent-api-client.js.map +1 -0
  14. package/dist/src/commands/artifacts.d.ts +13 -0
  15. package/dist/src/commands/artifacts.d.ts.map +1 -0
  16. package/dist/src/commands/artifacts.js +140 -0
  17. package/dist/src/commands/artifacts.js.map +1 -0
  18. package/dist/src/commands/cluster.d.ts +45 -0
  19. package/dist/src/commands/cluster.d.ts.map +1 -0
  20. package/dist/src/commands/cluster.js +259 -0
  21. package/dist/src/commands/cluster.js.map +1 -0
  22. package/dist/src/commands/conversations.d.ts +61 -0
  23. package/dist/src/commands/conversations.d.ts.map +1 -0
  24. package/dist/src/commands/conversations.js +239 -0
  25. package/dist/src/commands/conversations.js.map +1 -0
  26. package/dist/src/commands/create-app.d.ts +26 -3
  27. package/dist/src/commands/create-app.d.ts.map +1 -1
  28. package/dist/src/commands/create-app.js +465 -107
  29. package/dist/src/commands/create-app.js.map +1 -1
  30. package/dist/src/commands/deploy.d.ts +19 -0
  31. package/dist/src/commands/deploy.d.ts.map +1 -1
  32. package/dist/src/commands/deploy.js +83 -142
  33. package/dist/src/commands/deploy.js.map +1 -1
  34. package/dist/src/commands/dev-doctor.d.ts +137 -0
  35. package/dist/src/commands/dev-doctor.d.ts.map +1 -0
  36. package/dist/src/commands/dev-doctor.js +671 -0
  37. package/dist/src/commands/dev-doctor.js.map +1 -0
  38. package/dist/src/commands/dev-launch.d.ts +59 -0
  39. package/dist/src/commands/dev-launch.d.ts.map +1 -0
  40. package/dist/src/commands/dev-launch.js +118 -0
  41. package/dist/src/commands/dev-launch.js.map +1 -0
  42. package/dist/src/commands/dev-token-server.d.ts +32 -0
  43. package/dist/src/commands/dev-token-server.d.ts.map +1 -0
  44. package/dist/src/commands/dev-token-server.js +68 -0
  45. package/dist/src/commands/dev-token-server.js.map +1 -0
  46. package/dist/src/commands/dev.d.ts +289 -2
  47. package/dist/src/commands/dev.d.ts.map +1 -1
  48. package/dist/src/commands/dev.js +2501 -574
  49. package/dist/src/commands/dev.js.map +1 -1
  50. package/dist/src/commands/docs.d.ts +3 -0
  51. package/dist/src/commands/docs.d.ts.map +1 -0
  52. package/dist/src/commands/docs.js +262 -0
  53. package/dist/src/commands/docs.js.map +1 -0
  54. package/dist/src/commands/hub/index.d.ts +99 -0
  55. package/dist/src/commands/hub/index.d.ts.map +1 -0
  56. package/dist/src/commands/hub/index.js +452 -0
  57. package/dist/src/commands/hub/index.js.map +1 -0
  58. package/dist/src/commands/init.d.ts +65 -0
  59. package/dist/src/commands/init.d.ts.map +1 -0
  60. package/dist/src/commands/init.js +370 -0
  61. package/dist/src/commands/init.js.map +1 -0
  62. package/dist/src/commands/install-shim.d.ts +21 -0
  63. package/dist/src/commands/install-shim.d.ts.map +1 -0
  64. package/dist/src/commands/install-shim.js +132 -0
  65. package/dist/src/commands/install-shim.js.map +1 -0
  66. package/dist/src/commands/local/auth-provision.d.ts +71 -0
  67. package/dist/src/commands/local/auth-provision.d.ts.map +1 -0
  68. package/dist/src/commands/local/auth-provision.js +286 -0
  69. package/dist/src/commands/local/auth-provision.js.map +1 -0
  70. package/dist/src/commands/local/dev-local.d.ts +97 -0
  71. package/dist/src/commands/local/dev-local.d.ts.map +1 -0
  72. package/dist/src/commands/local/dev-local.js +306 -0
  73. package/dist/src/commands/local/dev-local.js.map +1 -0
  74. package/dist/src/commands/local/docker-runner.d.ts +37 -0
  75. package/dist/src/commands/local/docker-runner.d.ts.map +1 -0
  76. package/dist/src/commands/local/docker-runner.js +104 -0
  77. package/dist/src/commands/local/docker-runner.js.map +1 -0
  78. package/dist/src/commands/local/helpers.d.ts +22 -0
  79. package/dist/src/commands/local/helpers.d.ts.map +1 -0
  80. package/dist/src/commands/local/helpers.js +46 -0
  81. package/dist/src/commands/local/helpers.js.map +1 -0
  82. package/dist/src/commands/local/hub-local.d.ts +51 -0
  83. package/dist/src/commands/local/hub-local.d.ts.map +1 -0
  84. package/dist/src/commands/local/hub-local.js +197 -0
  85. package/dist/src/commands/local/hub-local.js.map +1 -0
  86. package/dist/src/commands/local/index.d.ts +23 -0
  87. package/dist/src/commands/local/index.d.ts.map +1 -0
  88. package/dist/src/commands/local/index.js +386 -0
  89. package/dist/src/commands/local/index.js.map +1 -0
  90. package/dist/src/commands/local/mocks.d.ts +361 -0
  91. package/dist/src/commands/local/mocks.d.ts.map +1 -0
  92. package/dist/src/commands/local/mocks.js +756 -0
  93. package/dist/src/commands/local/mocks.js.map +1 -0
  94. package/dist/src/commands/local/seed-zitadel.d.ts +151 -0
  95. package/dist/src/commands/local/seed-zitadel.d.ts.map +1 -0
  96. package/dist/src/commands/local/seed-zitadel.js +408 -0
  97. package/dist/src/commands/local/seed-zitadel.js.map +1 -0
  98. package/dist/src/commands/local/seed.d.ts +106 -0
  99. package/dist/src/commands/local/seed.d.ts.map +1 -0
  100. package/dist/src/commands/local/seed.js +252 -0
  101. package/dist/src/commands/local/seed.js.map +1 -0
  102. package/dist/src/commands/local/stack.d.ts +173 -0
  103. package/dist/src/commands/local/stack.d.ts.map +1 -0
  104. package/dist/src/commands/local/stack.js +499 -0
  105. package/dist/src/commands/local/stack.js.map +1 -0
  106. package/dist/src/commands/login.d.ts +256 -12
  107. package/dist/src/commands/login.d.ts.map +1 -1
  108. package/dist/src/commands/login.js +978 -50
  109. package/dist/src/commands/login.js.map +1 -1
  110. package/dist/src/commands/peer-addressing.d.ts +51 -0
  111. package/dist/src/commands/peer-addressing.d.ts.map +1 -0
  112. package/dist/src/commands/peer-addressing.js +64 -0
  113. package/dist/src/commands/peer-addressing.js.map +1 -0
  114. package/dist/src/commands/port-ownership.d.ts +69 -0
  115. package/dist/src/commands/port-ownership.d.ts.map +1 -0
  116. package/dist/src/commands/port-ownership.js +161 -0
  117. package/dist/src/commands/port-ownership.js.map +1 -0
  118. package/dist/src/commands/registry-publish.d.ts +3 -0
  119. package/dist/src/commands/registry-publish.d.ts.map +1 -0
  120. package/dist/src/commands/registry-publish.js +161 -0
  121. package/dist/src/commands/registry-publish.js.map +1 -0
  122. package/dist/src/commands/registry.d.ts +146 -2
  123. package/dist/src/commands/registry.d.ts.map +1 -1
  124. package/dist/src/commands/registry.js +541 -85
  125. package/dist/src/commands/registry.js.map +1 -1
  126. package/dist/src/commands/secrets/index.d.ts.map +1 -1
  127. package/dist/src/commands/secrets/index.js +15 -1
  128. package/dist/src/commands/secrets/index.js.map +1 -1
  129. package/dist/src/commands/secrets/migrate-config.d.ts +24 -0
  130. package/dist/src/commands/secrets/migrate-config.d.ts.map +1 -0
  131. package/dist/src/commands/secrets/migrate-config.js +277 -0
  132. package/dist/src/commands/secrets/migrate-config.js.map +1 -0
  133. package/dist/src/commands/secrets/set.d.ts +4 -0
  134. package/dist/src/commands/secrets/set.d.ts.map +1 -1
  135. package/dist/src/commands/secrets/set.js +243 -64
  136. package/dist/src/commands/secrets/set.js.map +1 -1
  137. package/dist/src/commands/skills.d.ts +34 -0
  138. package/dist/src/commands/skills.d.ts.map +1 -0
  139. package/dist/src/commands/skills.js +207 -0
  140. package/dist/src/commands/skills.js.map +1 -0
  141. package/dist/src/commands/stack.d.ts.map +1 -1
  142. package/dist/src/commands/stack.js +361 -23
  143. package/dist/src/commands/stack.js.map +1 -1
  144. package/dist/src/commands/temporal.d.ts +15 -0
  145. package/dist/src/commands/temporal.d.ts.map +1 -0
  146. package/dist/src/commands/temporal.js +781 -0
  147. package/dist/src/commands/temporal.js.map +1 -0
  148. package/dist/src/commands/tenant.d.ts +56 -0
  149. package/dist/src/commands/tenant.d.ts.map +1 -0
  150. package/dist/src/commands/tenant.js +233 -0
  151. package/dist/src/commands/tenant.js.map +1 -0
  152. package/dist/src/commands/tunnel/index.d.ts +49 -3
  153. package/dist/src/commands/tunnel/index.d.ts.map +1 -1
  154. package/dist/src/commands/tunnel/index.js +331 -8
  155. package/dist/src/commands/tunnel/index.js.map +1 -1
  156. package/dist/src/commands/vcs/clone.d.ts +3 -0
  157. package/dist/src/commands/vcs/clone.d.ts.map +1 -0
  158. package/dist/src/commands/vcs/clone.js +20 -0
  159. package/dist/src/commands/vcs/clone.js.map +1 -0
  160. package/dist/src/commands/vcs/common.d.ts +21 -0
  161. package/dist/src/commands/vcs/common.d.ts.map +1 -0
  162. package/dist/src/commands/vcs/common.js +62 -0
  163. package/dist/src/commands/vcs/common.js.map +1 -0
  164. package/dist/src/commands/vcs/drafts.d.ts +13 -0
  165. package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
  166. package/dist/src/commands/vcs/drafts.js +45 -0
  167. package/dist/src/commands/vcs/drafts.js.map +1 -0
  168. package/dist/src/commands/vcs/get.d.ts +8 -0
  169. package/dist/src/commands/vcs/get.d.ts.map +1 -0
  170. package/dist/src/commands/vcs/get.js +61 -0
  171. package/dist/src/commands/vcs/get.js.map +1 -0
  172. package/dist/src/commands/vcs/index.d.ts +3 -0
  173. package/dist/src/commands/vcs/index.d.ts.map +1 -0
  174. package/dist/src/commands/vcs/index.js +58 -0
  175. package/dist/src/commands/vcs/index.js.map +1 -0
  176. package/dist/src/commands/vcs/propose.d.ts +23 -0
  177. package/dist/src/commands/vcs/propose.d.ts.map +1 -0
  178. package/dist/src/commands/vcs/propose.js +94 -0
  179. package/dist/src/commands/vcs/propose.js.map +1 -0
  180. package/dist/src/commands/vcs/review.d.ts +15 -0
  181. package/dist/src/commands/vcs/review.d.ts.map +1 -0
  182. package/dist/src/commands/vcs/review.js +35 -0
  183. package/dist/src/commands/vcs/review.js.map +1 -0
  184. package/dist/src/commands/vcs-enrich.d.ts +15 -0
  185. package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
  186. package/dist/src/commands/vcs-enrich.js +28 -0
  187. package/dist/src/commands/vcs-enrich.js.map +1 -0
  188. package/dist/src/commands/vpn/index.d.ts +24 -0
  189. package/dist/src/commands/vpn/index.d.ts.map +1 -0
  190. package/dist/src/commands/vpn/index.js +543 -0
  191. package/dist/src/commands/vpn/index.js.map +1 -0
  192. package/dist/src/commands/vpn/tunnel.d.ts +11 -0
  193. package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
  194. package/dist/src/commands/vpn/tunnel.js +188 -0
  195. package/dist/src/commands/vpn/tunnel.js.map +1 -0
  196. package/dist/src/commands/workflow.d.ts +24 -0
  197. package/dist/src/commands/workflow.d.ts.map +1 -0
  198. package/dist/src/commands/workflow.js +577 -0
  199. package/dist/src/commands/workflow.js.map +1 -0
  200. package/dist/src/docs/assemble.d.ts +217 -0
  201. package/dist/src/docs/assemble.d.ts.map +1 -0
  202. package/dist/src/docs/assemble.js +739 -0
  203. package/dist/src/docs/assemble.js.map +1 -0
  204. package/dist/src/docs/cli-reference.d.ts +93 -0
  205. package/dist/src/docs/cli-reference.d.ts.map +1 -0
  206. package/dist/src/docs/cli-reference.js +256 -0
  207. package/dist/src/docs/cli-reference.js.map +1 -0
  208. package/dist/src/docs/discover.d.ts +60 -0
  209. package/dist/src/docs/discover.d.ts.map +1 -0
  210. package/dist/src/docs/discover.js +233 -0
  211. package/dist/src/docs/discover.js.map +1 -0
  212. package/dist/src/docs/portal.d.ts +79 -0
  213. package/dist/src/docs/portal.d.ts.map +1 -0
  214. package/dist/src/docs/portal.js +242 -0
  215. package/dist/src/docs/portal.js.map +1 -0
  216. package/dist/src/docs/registry-docs.d.ts +43 -0
  217. package/dist/src/docs/registry-docs.d.ts.map +1 -0
  218. package/dist/src/docs/registry-docs.js +138 -0
  219. package/dist/src/docs/registry-docs.js.map +1 -0
  220. package/dist/src/docs/schema.d.ts +48 -0
  221. package/dist/src/docs/schema.d.ts.map +1 -0
  222. package/dist/src/docs/schema.js +96 -0
  223. package/dist/src/docs/schema.js.map +1 -0
  224. package/dist/src/docs/serve.d.ts +27 -0
  225. package/dist/src/docs/serve.d.ts.map +1 -0
  226. package/dist/src/docs/serve.js +102 -0
  227. package/dist/src/docs/serve.js.map +1 -0
  228. package/dist/src/docs/start.d.ts +80 -0
  229. package/dist/src/docs/start.d.ts.map +1 -0
  230. package/dist/src/docs/start.js +313 -0
  231. package/dist/src/docs/start.js.map +1 -0
  232. package/dist/src/eval/agent-eval.d.mts +14 -0
  233. package/dist/src/eval/agent-eval.d.mts.map +1 -0
  234. package/dist/src/eval/agent-eval.mjs +273 -0
  235. package/dist/src/eval/agent-eval.mjs.map +1 -0
  236. package/dist/src/index.js +624 -7
  237. package/dist/src/index.js.map +7 -1
  238. package/dist/src/program.d.ts +26 -0
  239. package/dist/src/program.d.ts.map +1 -0
  240. package/dist/src/program.js +76 -0
  241. package/dist/src/program.js.map +1 -0
  242. package/dist/src/utils/auth-preflight.d.ts +159 -0
  243. package/dist/src/utils/auth-preflight.d.ts.map +1 -0
  244. package/dist/src/utils/auth-preflight.js +298 -0
  245. package/dist/src/utils/auth-preflight.js.map +1 -0
  246. package/dist/src/utils/aws-auth.d.ts +181 -0
  247. package/dist/src/utils/aws-auth.d.ts.map +1 -0
  248. package/dist/src/utils/aws-auth.js +527 -0
  249. package/dist/src/utils/aws-auth.js.map +1 -0
  250. package/dist/src/utils/bastion.d.ts +1 -1
  251. package/dist/src/utils/bastion.d.ts.map +1 -1
  252. package/dist/src/utils/bastion.js +29 -8
  253. package/dist/src/utils/bastion.js.map +1 -1
  254. package/dist/src/utils/build-info.d.ts +33 -0
  255. package/dist/src/utils/build-info.d.ts.map +1 -0
  256. package/dist/src/utils/build-info.js +102 -0
  257. package/dist/src/utils/build-info.js.map +1 -0
  258. package/dist/src/utils/capture-history.d.ts +62 -0
  259. package/dist/src/utils/capture-history.d.ts.map +1 -0
  260. package/dist/src/utils/capture-history.js +94 -0
  261. package/dist/src/utils/capture-history.js.map +1 -0
  262. package/dist/src/utils/deploy-preflight.d.ts +52 -0
  263. package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
  264. package/dist/src/utils/deploy-preflight.js +183 -0
  265. package/dist/src/utils/deploy-preflight.js.map +1 -0
  266. package/dist/src/utils/errors.d.ts +75 -0
  267. package/dist/src/utils/errors.d.ts.map +1 -0
  268. package/dist/src/utils/errors.js +106 -0
  269. package/dist/src/utils/errors.js.map +1 -0
  270. package/dist/src/utils/first-party-contexts.d.ts +40 -0
  271. package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
  272. package/dist/src/utils/first-party-contexts.js +53 -0
  273. package/dist/src/utils/first-party-contexts.js.map +1 -0
  274. package/dist/src/utils/index.d.ts +2 -0
  275. package/dist/src/utils/index.d.ts.map +1 -1
  276. package/dist/src/utils/index.js +2 -0
  277. package/dist/src/utils/index.js.map +1 -1
  278. package/dist/src/utils/kubeconfig.d.ts +62 -0
  279. package/dist/src/utils/kubeconfig.d.ts.map +1 -0
  280. package/dist/src/utils/kubeconfig.js +118 -0
  281. package/dist/src/utils/kubeconfig.js.map +1 -0
  282. package/dist/src/utils/log.d.ts +27 -1
  283. package/dist/src/utils/log.d.ts.map +1 -1
  284. package/dist/src/utils/log.js +59 -5
  285. package/dist/src/utils/log.js.map +1 -1
  286. package/dist/src/utils/pid.d.ts +47 -0
  287. package/dist/src/utils/pid.d.ts.map +1 -0
  288. package/dist/src/utils/pid.js +83 -0
  289. package/dist/src/utils/pid.js.map +1 -0
  290. package/dist/src/utils/pulumi-run.d.ts +23 -0
  291. package/dist/src/utils/pulumi-run.d.ts.map +1 -0
  292. package/dist/src/utils/pulumi-run.js +112 -0
  293. package/dist/src/utils/pulumi-run.js.map +1 -0
  294. package/dist/src/utils/pulumi.d.ts +15 -0
  295. package/dist/src/utils/pulumi.d.ts.map +1 -1
  296. package/dist/src/utils/pulumi.js +35 -0
  297. package/dist/src/utils/pulumi.js.map +1 -1
  298. package/dist/src/utils/reachability.d.ts +29 -0
  299. package/dist/src/utils/reachability.d.ts.map +1 -0
  300. package/dist/src/utils/reachability.js +81 -0
  301. package/dist/src/utils/reachability.js.map +1 -0
  302. package/dist/src/utils/recover-conversation.d.ts +154 -0
  303. package/dist/src/utils/recover-conversation.d.ts.map +1 -0
  304. package/dist/src/utils/recover-conversation.js +314 -0
  305. package/dist/src/utils/recover-conversation.js.map +1 -0
  306. package/dist/src/utils/registry-broker.d.ts +148 -0
  307. package/dist/src/utils/registry-broker.d.ts.map +1 -0
  308. package/dist/src/utils/registry-broker.js +180 -0
  309. package/dist/src/utils/registry-broker.js.map +1 -0
  310. package/dist/src/utils/socks-forward.d.ts +40 -0
  311. package/dist/src/utils/socks-forward.d.ts.map +1 -0
  312. package/dist/src/utils/socks-forward.js +97 -0
  313. package/dist/src/utils/socks-forward.js.map +1 -0
  314. package/dist/src/utils/stack-flag.d.ts +23 -0
  315. package/dist/src/utils/stack-flag.d.ts.map +1 -0
  316. package/dist/src/utils/stack-flag.js +41 -0
  317. package/dist/src/utils/stack-flag.js.map +1 -0
  318. package/dist/src/utils/tailscale-targets.d.ts +52 -0
  319. package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
  320. package/dist/src/utils/tailscale-targets.js +93 -0
  321. package/dist/src/utils/tailscale-targets.js.map +1 -0
  322. package/dist/src/utils/tailscale.d.ts +277 -0
  323. package/dist/src/utils/tailscale.d.ts.map +1 -0
  324. package/dist/src/utils/tailscale.js +1007 -0
  325. package/dist/src/utils/tailscale.js.map +1 -0
  326. package/dist/src/utils/temporal-auth.d.ts +43 -0
  327. package/dist/src/utils/temporal-auth.d.ts.map +1 -0
  328. package/dist/src/utils/temporal-auth.js +176 -0
  329. package/dist/src/utils/temporal-auth.js.map +1 -0
  330. package/dist/src/utils/temporal-codec.d.ts +101 -0
  331. package/dist/src/utils/temporal-codec.d.ts.map +1 -0
  332. package/dist/src/utils/temporal-codec.js +319 -0
  333. package/dist/src/utils/temporal-codec.js.map +1 -0
  334. package/dist/src/utils/tunnel-ownership.d.ts +130 -0
  335. package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
  336. package/dist/src/utils/tunnel-ownership.js +274 -0
  337. package/dist/src/utils/tunnel-ownership.js.map +1 -0
  338. package/dist/src/utils/vpn-join.d.ts +32 -0
  339. package/dist/src/utils/vpn-join.d.ts.map +1 -0
  340. package/dist/src/utils/vpn-join.js +62 -0
  341. package/dist/src/utils/vpn-join.js.map +1 -0
  342. package/dist/src/utils/vpn.d.ts +62 -0
  343. package/dist/src/utils/vpn.d.ts.map +1 -0
  344. package/dist/src/utils/vpn.js +183 -0
  345. package/dist/src/utils/vpn.js.map +1 -0
  346. package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
  347. package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
  348. package/dist/src/utils/workflow-fingerprint.js +135 -0
  349. package/dist/src/utils/workflow-fingerprint.js.map +1 -0
  350. package/dist/src/utils/worktree-identity.d.ts +86 -0
  351. package/dist/src/utils/worktree-identity.d.ts.map +1 -0
  352. package/dist/src/utils/worktree-identity.js +164 -0
  353. package/dist/src/utils/worktree-identity.js.map +1 -0
  354. package/fragments/agents/AGENTS.md.hbs +92 -0
  355. package/fragments/agents/CLAUDE.md.hbs +8 -0
  356. package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
  357. package/fragments/base/Pulumi.yaml.hbs +9 -0
  358. package/fragments/base/index.ts.hbs +107 -0
  359. package/fragments/base/package.json.hbs +22 -0
  360. package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
  361. package/fragments/bucket/api/src/storage.ts.hbs +81 -0
  362. package/fragments/database/api/src/db.ts.hbs +23 -0
  363. package/fragments/database/prisma/schema.prisma.hbs +18 -0
  364. package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
  365. package/fragments/service/api/package.json.hbs +40 -0
  366. package/fragments/service/api/src/index.ts.hbs +58 -0
  367. package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
  368. package/fragments/temporal/worker/.dockerignore +4 -0
  369. package/fragments/temporal/worker/Dockerfile +15 -0
  370. package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
  371. package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
  372. package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
  373. package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
  374. package/fragments/temporal/worker/tsconfig.json +13 -0
  375. package/package.json +35 -21
  376. package/skills/core/SKILL.md +365 -0
  377. package/skills/pull-remote-agent-context/SKILL.md +194 -0
  378. package/stack/docker-compose.hub.yml +134 -0
  379. package/stack/docker-compose.yml +447 -0
  380. package/stack/hub/Dockerfile.api +18 -0
  381. package/stack/hub/Dockerfile.auth +10 -0
  382. package/stack/hub/Dockerfile.ui +10 -0
  383. package/stack/init/01-databases.sql +12 -0
  384. package/stack/observability/blackbox.yml +20 -0
  385. package/stack/observability/otel-collector.yaml +73 -0
  386. package/stack/observability/prometheus.yml +36 -0
  387. package/stack/observability/tempo.yaml +25 -0
  388. package/stack/temporal/local.yaml +44 -0
  389. package/templates/api-auth/AGENTS.md.hbs +16 -0
  390. package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
  391. package/templates/api-auth/Pulumi.yaml.hbs +8 -0
  392. package/templates/api-auth/README.md.hbs +67 -0
  393. package/templates/api-auth/api/package.json.hbs +28 -0
  394. package/templates/api-auth/api/src/index.ts.hbs +96 -0
  395. package/templates/api-auth/api/src/schema.ts.hbs +35 -0
  396. package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
  397. package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
  398. package/templates/api-auth/index.ts.hbs +65 -0
  399. package/templates/api-auth/package.json.hbs +20 -0
  400. package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
  401. package/templates/api-role-gating/AGENTS.md.hbs +20 -0
  402. package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
  403. package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
  404. package/templates/api-role-gating/README.md.hbs +64 -0
  405. package/templates/api-role-gating/api/Dockerfile +17 -0
  406. package/templates/api-role-gating/api/package.json.hbs +28 -0
  407. package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
  408. package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
  409. package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
  410. package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
  411. package/templates/api-role-gating/api/tsconfig.json +13 -0
  412. package/templates/api-role-gating/index.ts.hbs +107 -0
  413. package/templates/api-role-gating/package.json.hbs +21 -0
  414. package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
  415. package/templates/api-role-gating/tsconfig.json +10 -0
  416. package/templates/apps-repo/README.md.hbs +24 -0
  417. package/templates/apps-repo/gitignore +41 -0
  418. package/templates/apps-repo/npmrc.hbs +7 -0
  419. package/templates/apps-repo/package.json.hbs +15 -0
  420. package/templates/apps-repo/pnpm-workspace.yaml +3 -0
  421. package/templates/apps-repo/tsconfig.json +18 -0
  422. package/templates/external-service/AGENTS.md.hbs +20 -0
  423. package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
  424. package/templates/external-service/Pulumi.yaml.hbs +8 -0
  425. package/templates/external-service/README.md.hbs +56 -0
  426. package/templates/external-service/api/Dockerfile +15 -0
  427. package/templates/external-service/api/package.json.hbs +25 -0
  428. package/templates/external-service/api/src/index.ts.hbs +81 -0
  429. package/templates/external-service/index.ts.hbs +82 -0
  430. package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
  431. package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
  432. package/templates/external-service/package.json.hbs +34 -0
  433. package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
  434. package/templates/external-service/tsconfig.json +10 -0
  435. package/templates/platform-repo/AGENTS.md.hbs +18 -0
  436. package/templates/platform-repo/README.md.hbs +38 -0
  437. package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
  438. package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
  439. package/templates/platform-repo/core/index.ts +62 -0
  440. package/templates/platform-repo/core/package.json.hbs +22 -0
  441. package/templates/platform-repo/core/tsconfig.json +8 -0
  442. package/templates/platform-repo/package.json.hbs +15 -0
  443. package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
  444. package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
  445. package/templates/platform-repo/platform/index.ts +95 -0
  446. package/templates/platform-repo/platform/package.json.hbs +26 -0
  447. package/templates/platform-repo/platform/tsconfig.json +8 -0
  448. package/templates/platform-repo/pnpm-workspace.yaml +3 -0
  449. package/templates/workflow/AGENTS.md.hbs +15 -0
  450. package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
  451. package/templates/workflow/Pulumi.yaml.hbs +8 -0
  452. package/templates/workflow/README.md.hbs +45 -0
  453. package/templates/workflow/api/.dockerignore +4 -0
  454. package/templates/workflow/api/Dockerfile +15 -0
  455. package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
  456. package/templates/workflow/api/src/index.ts.hbs +130 -0
  457. package/templates/workflow/api/tsconfig.json +14 -0
  458. package/templates/workflow/index.ts.hbs +67 -0
  459. package/templates/workflow/package.json.hbs +20 -0
  460. package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
  461. package/templates/workflow/tsconfig.json +10 -0
  462. package/templates/workflow/worker/.dockerignore +4 -0
  463. package/templates/workflow/worker/Dockerfile +13 -0
  464. package/templates/workflow/worker/package.json.hbs +25 -0
  465. package/templates/workflow/worker/src/worker.ts.hbs +24 -0
  466. package/templates/workflow/worker/tsconfig.json +14 -0
  467. package/dist/src/commands/devbox.d.ts +0 -22
  468. package/dist/src/commands/devbox.d.ts.map +0 -1
  469. package/dist/src/commands/devbox.js +0 -463
  470. package/dist/src/commands/devbox.js.map +0 -1
  471. package/templates/api-web-db/api/Dockerfile +0 -16
  472. package/templates/api-web-db/api/package.json.hbs +0 -21
  473. package/templates/api-web-db/api/src/index.ts.hbs +0 -123
  474. package/templates/api-web-db/package.json.hbs +0 -27
  475. package/templates/api-web-db/sst.config.ts.hbs +0 -151
  476. package/templates/api-web-db/web/.dockerignore +0 -3
  477. package/templates/api-web-db/web/Dockerfile +0 -17
  478. package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
  479. package/templates/api-web-db/web/app/root.tsx +0 -29
  480. package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
  481. package/templates/api-web-db/web/app/routes.ts +0 -3
  482. package/templates/api-web-db/web/package.json.hbs +0 -30
  483. package/templates/api-web-db/web/prisma/schema.prisma +0 -25
  484. package/templates/api-web-db/web/prisma.config.ts +0 -18
  485. package/templates/api-web-db/web/react-router.config.ts +0 -5
  486. package/templates/api-web-db/web/tsconfig.json +0 -19
  487. package/templates/api-web-db/web/vite.config.ts +0 -9
  488. package/templates/temporal-api-worker/README.md.hbs +0 -133
  489. package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
  490. package/templates/temporal-api-worker/package.json.hbs +0 -29
  491. package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
  492. package/templates/temporal-api-worker/worker/Dockerfile +0 -11
  493. package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
  494. package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
  495. /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
  496. /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
  497. /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
  498. /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
  499. /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
  500. /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
  501. /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
  502. /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
  503. /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
  504. /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Guard for pids the CLI reads back rather than constructs.
3
+ *
4
+ * Every teardown path in the CLI signals a pid it recovered from somewhere:
5
+ * `tunnel-state.json`, `runner.json`, `daemon.json`, or a `ps` argv scan. None
6
+ * of those are trustworthy — a truncated write, a stale file from an older
7
+ * build, or a hand-edited state dir can put any integer there. POSIX `kill(2)`
8
+ * overloads the pid argument, so the wrong integer is not a no-op:
9
+ *
10
+ * - `kill(0, sig)` → every process in the CALLER'S OWN process group.
11
+ * - `kill(-1, sig)` → every process the caller is permitted to signal.
12
+ * - `kill(1, sig)` → init. And teardown negates before signalling, so a `1`
13
+ * on disk becomes `kill(-1)` — the broadcast.
14
+ *
15
+ * That is not hypothetical: a `pid: -1` written by a unit test SIGTERM'd the
16
+ * author's entire login session (tmux server, every pane, an in-flight
17
+ * `mesh login`) on 2026-08-01. Refuse the input instead of signalling it.
18
+ *
19
+ * The guard is intentionally strict about the LOW end (`pid >= 2`) so the
20
+ * NEGATED form used for process-group teardown is safe by construction: if
21
+ * `pid >= 2` then `-pid <= -2`, which is always a real process group and never
22
+ * `0` (own group) or `-1` (broadcast). Callers signalling `-pid` need no
23
+ * second check — see `killSupervisor`.
24
+ */
25
+ import { MeshCliError } from "./errors.js";
26
+ /**
27
+ * Lowest pid the CLI will ever signal. 0 and 1 are the two overloaded values;
28
+ * anything below 0 is already a process-group id, not a pid.
29
+ */
30
+ const MIN_SIGNALABLE_PID = 2;
31
+ /**
32
+ * Why `pid` must not be handed to `process.kill`, or null if it is signalable.
33
+ * Pure — every branch is unit-testable without spawning anything.
34
+ */
35
+ function unsignalableReason(pid) {
36
+ if (typeof pid !== "number") {
37
+ return `expected an integer, got ${typeof pid} (${String(pid)})`;
38
+ }
39
+ if (!Number.isInteger(pid)) {
40
+ // NaN, ±Infinity, and fractions all land here. Number.isInteger is the one
41
+ // predicate that rejects every non-pid a JSON.parse can produce.
42
+ return `expected an integer, got ${String(pid)}`;
43
+ }
44
+ if (pid === 0) {
45
+ return "0 is not a pid — kill(0) signals every process in this shell's own process group";
46
+ }
47
+ if (pid === 1) {
48
+ return "1 is init — and teardown negates first, so kill(-1) would signal every process you can signal";
49
+ }
50
+ if (pid < MIN_SIGNALABLE_PID) {
51
+ return `${pid} is negative — that is already a process-group id, not a pid`;
52
+ }
53
+ if (pid === process.pid) {
54
+ return `${pid} is this CLI process itself — signalling it (or its group) would kill the command doing the teardown`;
55
+ }
56
+ if (pid === process.ppid) {
57
+ return `${pid} is this CLI's parent (your shell) — signalling its group would kill your terminal session`;
58
+ }
59
+ return null;
60
+ }
61
+ /**
62
+ * Throw unless `pid` is safe to pass to `process.kill` (directly or negated).
63
+ *
64
+ * Call this at the top of any function that signals a pid it did not construct
65
+ * itself. Existence checks (`process.kill(pid, 0)`) do not need it — signal 0
66
+ * delivers nothing — but they gain nothing from skipping it either.
67
+ *
68
+ * @throws {MeshCliError} with `rm <file>` remediation when `source.file` is set.
69
+ */
70
+ export function assertSignalablePid(pid, source) {
71
+ const reason = unsignalableReason(pid);
72
+ if (reason === null)
73
+ return;
74
+ // "Corrupt or stale" is only true when the pid was read back from a state
75
+ // file. Call sites without one (e.g. reclaimPort's lsof-derived holder) get a
76
+ // pid that is CORRECT — that is exactly why it is refused — so the causal
77
+ // clause is gated on the same condition as the `rm` remediation.
78
+ throw new MeshCliError(`Refusing to signal ${source.what} — ${reason}. ` +
79
+ (source.file
80
+ ? `The recorded value is corrupt or stale; signalling it could terminate unrelated processes.`
81
+ : `Signalling it could terminate unrelated processes.`), source.file ? { remediation: { command: `rm ${source.file}` } } : {});
82
+ }
83
+ //# sourceMappingURL=pid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pid.js","sourceRoot":"","sources":["../../../src/utils/pid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAe3C;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;GAGG;AACH,SAAS,kBAAkB,CAAC,GAAY;IACtC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,4BAA4B,OAAO,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;IACnE,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,2EAA2E;QAC3E,iEAAiE;QACjE,OAAO,4BAA4B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACd,OAAO,kFAAkF,CAAC;IAC5F,CAAC;IACD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACd,OAAO,+FAA+F,CAAC;IACzG,CAAC;IACD,IAAI,GAAG,GAAG,kBAAkB,EAAE,CAAC;QAC7B,OAAO,GAAG,GAAG,8DAA8D,CAAC;IAC9E,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;QACxB,OAAO,GAAG,GAAG,sGAAsG,CAAC;IACtH,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;QACzB,OAAO,GAAG,GAAG,4FAA4F,CAAC;IAC5G,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY,EAAE,MAAiB;IACjE,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO;IAC5B,0EAA0E;IAC1E,8EAA8E;IAC9E,0EAA0E;IAC1E,iEAAiE;IACjE,MAAM,IAAI,YAAY,CACpB,sBAAsB,MAAM,CAAC,IAAI,MAAM,MAAM,IAAI;QAC/C,CAAC,MAAM,CAAC,IAAI;YACV,CAAC,CAAC,4FAA4F;YAC9F,CAAC,CAAC,oDAAoD,CAAC,EAC3D,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type CredProbe } from "../commands/login.js";
2
+ /**
3
+ * Map a credential probe to a preflight message. Pure — no I/O — so the
4
+ * remediation wording is unit-testable. `null` means "proceed" (`ok`, or a
5
+ * non-fatal warning already surfaced). `fatal` callers should stop before
6
+ * touching pulumi; non-fatal is a warning that lets the run continue.
7
+ */
8
+ export declare function credProbeToPreflightError(probe: CredProbe, context: string): {
9
+ message: string;
10
+ fatal: boolean;
11
+ } | null;
12
+ /**
13
+ * Resolve deployer AWS credentials for a `pulumi` invocation against `stack`,
14
+ * with an up-front login preflight. Returns env vars to merge into the pulumi
15
+ * child (`AWS_ACCESS_KEY_ID`/`_SECRET_ACCESS_KEY`/`_SESSION_TOKEN`). Exits the
16
+ * process with a clear, actionable message on any hard failure — callers can
17
+ * treat a return as "creds are ready".
18
+ */
19
+ export declare function resolvePulumiEnv(opts: {
20
+ appRoot: string;
21
+ stack: string;
22
+ }): Promise<Record<string, string>>;
23
+ //# sourceMappingURL=pulumi-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi-run.d.ts","sourceRoot":"","sources":["../../../src/utils/pulumi-run.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,MAAM,GACd;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAkC5C;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiDlC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * The single credentialed-Pulumi chokepoint (MESH-2085).
3
+ *
4
+ * Every mesh command that shells `pulumi` against the S3 state backend needs
5
+ * AWS credentials from the stack's `mesh:deployerRole`. Historically each
6
+ * command re-implemented that glue and `mesh stack init` skipped it entirely
7
+ * (→ `NoCredentialProviders`). This module centralizes it:
8
+ *
9
+ * 1. read `mesh:deployerRole` from the stack config (clear error if absent),
10
+ * 2. run a LOGIN PREFLIGHT (`probeCredentials`) that names the real problem
11
+ * ("run `mesh login --device`") BEFORE pulumi is invoked — and before
12
+ * `resolveAwsCredentials`' interactive path can hang a browser login over
13
+ * SSH,
14
+ * 3. resolve the deployer creds and return them as env vars to merge into the
15
+ * `pulumi` child process.
16
+ *
17
+ * Callers thread the returned env into their existing `execFileSync("pulumi", …)`
18
+ * calls (deploy passes it once; stack init reuses it across init/select/config).
19
+ */
20
+ import { logError, logWarn } from "./log.js";
21
+ import { readStackConfig } from "./pulumi.js";
22
+ import { derivePlatformContext, resolveAwsCredentials } from "./aws-auth.js";
23
+ import { probeCredentials } from "../commands/login.js";
24
+ /**
25
+ * Map a credential probe to a preflight message. Pure — no I/O — so the
26
+ * remediation wording is unit-testable. `null` means "proceed" (`ok`, or a
27
+ * non-fatal warning already surfaced). `fatal` callers should stop before
28
+ * touching pulumi; non-fatal is a warning that lets the run continue.
29
+ */
30
+ export function credProbeToPreflightError(probe, context) {
31
+ switch (probe.state) {
32
+ case "ok":
33
+ return null;
34
+ case "no-session":
35
+ return {
36
+ fatal: true,
37
+ message: `Not logged in for ${context}. Run:\n` +
38
+ ` mesh login ${context} --device`,
39
+ };
40
+ case "expired-session":
41
+ return {
42
+ fatal: true,
43
+ message: `Your mesh login session for ${context} expired. Run:\n` +
44
+ ` mesh login ${context} --device`,
45
+ };
46
+ case "assume-denied":
47
+ return {
48
+ fatal: true,
49
+ message: `Logged in, but couldn't assume the deployer role — ${probe.detail}\n` +
50
+ ` Check mesh:deployerRole in the stack config and your IAM access.`,
51
+ };
52
+ case "stale-env-override":
53
+ return {
54
+ fatal: false,
55
+ message: `Stale AWS_* env vars are set and will override your mesh login.\n` +
56
+ ` If pulumi fails with an auth error, clear them first:\n` +
57
+ ` unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN`,
58
+ };
59
+ }
60
+ }
61
+ /**
62
+ * Resolve deployer AWS credentials for a `pulumi` invocation against `stack`,
63
+ * with an up-front login preflight. Returns env vars to merge into the pulumi
64
+ * child (`AWS_ACCESS_KEY_ID`/`_SECRET_ACCESS_KEY`/`_SESSION_TOKEN`). Exits the
65
+ * process with a clear, actionable message on any hard failure — callers can
66
+ * treat a return as "creds are ready".
67
+ */
68
+ export async function resolvePulumiEnv(opts) {
69
+ const { appRoot, stack } = opts;
70
+ const roleArn = readStackConfig(appRoot, stack, "mesh:deployerRole");
71
+ if (!roleArn) {
72
+ // Platform stacks are deployed by operators with ambient credentials
73
+ // (SSO/exported env) and typically carry no mesh:deployerRole — only app
74
+ // stacks do. With ambient creds present, run Pulumi against them directly.
75
+ if (process.env.AWS_ACCESS_KEY_ID) {
76
+ return {};
77
+ }
78
+ logError(`No mesh:deployerRole in Pulumi.${stack}.yaml — mesh needs it to assume a ` +
79
+ `role for the Pulumi backend.\n` +
80
+ ` Set it (copy the value from a base stack), e.g.:\n` +
81
+ ` mesh deploy config set mesh:deployerRole arn:aws:iam::<account>:role/<tenant>-<stage>-apps-deployer --stack ${stack}\n` +
82
+ ` (or provide operator AWS credentials in the environment for platform stacks).`);
83
+ process.exit(1);
84
+ }
85
+ // Skip the login preflight whenever explicit ambient AWS credentials are
86
+ // present — both the CI/OIDC case (key + session token) AND long-lived static
87
+ // keys (key, no session token). Requiring a session token here regressed
88
+ // static-key users: with no cached mesh session the probe returns `no-session`
89
+ // → fatal, even though `resolveAwsCredentials`' ambient-SDK AssumeRole path
90
+ // (which accepts a bare static key) would have worked. (MESH-2085 review.)
91
+ const hasAmbientCreds = !!process.env.AWS_ACCESS_KEY_ID;
92
+ const context = derivePlatformContext(appRoot, stack);
93
+ if (!hasAmbientCreds && context) {
94
+ const probe = await probeCredentials(context, roleArn);
95
+ const preflight = credProbeToPreflightError(probe, context);
96
+ if (preflight?.fatal) {
97
+ logError(preflight.message);
98
+ process.exit(1);
99
+ }
100
+ if (preflight)
101
+ logWarn(preflight.message);
102
+ }
103
+ const resolved = await resolveAwsCredentials(roleArn, appRoot, stack);
104
+ if (!resolved) {
105
+ logError(`Failed to obtain AWS credentials for ${roleArn}.\n` +
106
+ (context ? ` Try: mesh login ${context} --device\n` : "") +
107
+ ` (or provide AWS credentials in the environment).`);
108
+ process.exit(1);
109
+ }
110
+ return { ...resolved.env };
111
+ }
112
+ //# sourceMappingURL=pulumi-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi-run.js","sourceRoot":"","sources":["../../../src/utils/pulumi-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAkB,MAAM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IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,yEAAyE;IACzE,8EAA8E;IAC9E,yEAAyE;IACzE,+EAA+E;IAC/E,4EAA4E;IAC5E,2EAA2E;IAC3E,MAAM,eAAe,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACxD,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,KAAK,EAAE,CAAC;YACrB,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,SAAS;YAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,CACN,wCAAwC,OAAO,KAAK;YAClD,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,OAAO,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,oDAAoD,CACvD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;AAC7B,CAAC"}
@@ -21,4 +21,19 @@ export declare function getCurrentStack(appRoot: string): string | null;
21
21
  * For complex values, use `pulumi config` CLI instead.
22
22
  */
23
23
  export declare function readStackConfig(appRoot: string, stack: string, key: string): string | null;
24
+ /**
25
+ * Run `pulumi stack output <key> --json` with the given extra args.
26
+ *
27
+ * Pulumi redacts secret-tainted outputs as the literal string `"[secret]"`.
28
+ * Outputs like `env.register()`'s `dev` blob are tainted because they transitively
29
+ * include secret values (e.g. `TEMPORAL_ENCODING_KEY`, DB passwords), even though
30
+ * much of the blob (tunnels, namespace, service scaffolding) is non-secret.
31
+ *
32
+ * This helper tries without `--show-secrets` first — which avoids requiring
33
+ * the local machine to have the stack's secrets provider configured (KMS access
34
+ * etc.) — and retries with `--show-secrets` only if the first call returns a
35
+ * `"[secret]"` placeholder. KMS/secrets-provider errors are not retried because
36
+ * they will fail the same way with the flag set.
37
+ */
38
+ export declare function pulumiStackOutput(appRoot: string, key: string, extraArgs: string[], env?: Record<string, string>): string;
24
39
  //# sourceMappingURL=pulumi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi.d.ts","sourceRoot":"","sources":["../../../src/utils/pulumi.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU1F"}
1
+ {"version":3,"file":"pulumi.d.ts","sourceRoot":"","sources":["../../../src/utils/pulumi.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU1F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EAAE,EACnB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CA+BR"}
@@ -60,4 +60,39 @@ export function readStackConfig(appRoot, stack, key) {
60
60
  return null;
61
61
  return match[1].trim().replace(/^["']|["']$/g, "");
62
62
  }
63
+ /**
64
+ * Run `pulumi stack output <key> --json` with the given extra args.
65
+ *
66
+ * Pulumi redacts secret-tainted outputs as the literal string `"[secret]"`.
67
+ * Outputs like `env.register()`'s `dev` blob are tainted because they transitively
68
+ * include secret values (e.g. `TEMPORAL_ENCODING_KEY`, DB passwords), even though
69
+ * much of the blob (tunnels, namespace, service scaffolding) is non-secret.
70
+ *
71
+ * This helper tries without `--show-secrets` first — which avoids requiring
72
+ * the local machine to have the stack's secrets provider configured (KMS access
73
+ * etc.) — and retries with `--show-secrets` only if the first call returns a
74
+ * `"[secret]"` placeholder. KMS/secrets-provider errors are not retried because
75
+ * they will fail the same way with the flag set.
76
+ */
77
+ export function pulumiStackOutput(appRoot, key, extraArgs, env) {
78
+ const execEnv = env ? { ...process.env, ...env } : undefined;
79
+ // First attempt: no --show-secrets (works without PULUMI_CONFIG_PASSPHRASE / KMS)
80
+ try {
81
+ const result = execFileSync("pulumi", ["stack", "output", key, "--json", ...extraArgs], { cwd: appRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"], env: execEnv });
82
+ // If the output contains "[secret]" placeholders, retry with --show-secrets
83
+ if (result.includes('"[secret]"')) {
84
+ return execFileSync("pulumi", ["stack", "output", key, "--json", "--show-secrets", ...extraArgs], { cwd: appRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"], env: execEnv });
85
+ }
86
+ return result;
87
+ }
88
+ catch (err) {
89
+ // If the error is a secrets/KMS issue, don't retry with --show-secrets
90
+ // (it will fail the same way). Only retry for other Pulumi errors.
91
+ const errMsg = err?.stderr ?? "";
92
+ if (errMsg.includes("kms:") || errMsg.includes("KMS") || errMsg.includes("secrets manager")) {
93
+ throw err;
94
+ }
95
+ return execFileSync("pulumi", ["stack", "output", key, "--json", "--show-secrets", ...extraArgs], { cwd: appRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"], env: execEnv });
96
+ }
97
+ }
63
98
  //# sourceMappingURL=pulumi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi.js","sourceRoot":"","sources":["../../../src/utils/pulumi.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAA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S,CAAC,EAClE,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CACrF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Resolve `true` if a TCP connection to `host:port` completes within
3
+ * `timeoutMs`, else `false`. Never rejects — any failure (timeout, refused, DNS)
4
+ * is a `false`, since for transport selection "can't reach it" is the only signal
5
+ * that matters. The socket is always destroyed.
6
+ */
7
+ export declare function probeTcpReachable(host: string, port: number, timeoutMs?: number): Promise<boolean>;
8
+ /**
9
+ * Resolve `true` if a connection to `host:port` completes AND survives a brief
10
+ * grace window (`holdMs`). Stronger than {@link probeTcpReachable} for probing a
11
+ * LOCAL FORWARDER port, where "the port accepts" is not proof the tunnel carries
12
+ * traffic: a forwarder (SSM port-forward, or the userspace-Tailscale SOCKS
13
+ * bridge) binds its local port even when its upstream leg is dead — so a plain
14
+ * connect succeeds while nothing flows. A dead-upstream forwarder accepts the
15
+ * TCP connection and then tears it down SYNCHRONOUSLY (e.g. the Tailscale bridge
16
+ * dials a SOCKS port the daemon isn't on and destroys the client — MESH-2169);
17
+ * measured, that teardown lands in ~1ms.
18
+ *
19
+ * The window is deliberately SMALL — just enough to clear that ~1ms fail-fast
20
+ * teardown. It is NOT a latency budget for the upstream: a real upstream need
21
+ * send no bytes and may itself idle-close a bare connection (Temporal's UI drops
22
+ * an idle HTTP connection at ~50ms; Temporal gRPC and Postgres hold indefinitely).
23
+ * So "closed within ~1ms of connecting" means the forwarder never reached a real
24
+ * upstream; surviving `holdMs` means it did. A larger window would mis-report a
25
+ * healthy-but-idle-closing service (like the Temporal UI) as DOWN. Never rejects;
26
+ * the socket is always destroyed.
27
+ */
28
+ export declare function probeConnectionHolds(host: string, port: number, timeoutMs?: number, holdMs?: number): Promise<boolean>;
29
+ //# sourceMappingURL=reachability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reachability.d.ts","sourceRoot":"","sources":["../../../src/utils/reachability.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAehG;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,SAAM,EACf,MAAM,SAAK,GACV,OAAO,CAAC,OAAO,CAAC,CAsBlB"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * TCP reachability probe for transport selection.
3
+ *
4
+ * `mesh dev`'s VPN detection is otherwise a *presence* check — it asks whether a
5
+ * Tailscale/VPN connection exists, not whether the mesh VPC actually routes. On a
6
+ * machine using Tailscale for SSH (but not the mesh Headscale VPN) that presence
7
+ * check returns true, `mesh dev` picks "VPN-direct", and the worker then dies with
8
+ * `DnsResolutionError` / `ECONNREFUSED` on the Temporal frontend. Dialing the
9
+ * endpoint before committing to VPN-direct turns that tribal-knowledge failure
10
+ * into an automatic SSM fallback (MESH-2016).
11
+ */
12
+ import { createConnection } from "node:net";
13
+ /**
14
+ * Resolve `true` if a TCP connection to `host:port` completes within
15
+ * `timeoutMs`, else `false`. Never rejects — any failure (timeout, refused, DNS)
16
+ * is a `false`, since for transport selection "can't reach it" is the only signal
17
+ * that matters. The socket is always destroyed.
18
+ */
19
+ export function probeTcpReachable(host, port, timeoutMs = 1500) {
20
+ return new Promise((resolve) => {
21
+ let settled = false;
22
+ const socket = createConnection({ host, port });
23
+ const finish = (ok) => {
24
+ if (settled)
25
+ return;
26
+ settled = true;
27
+ socket.destroy();
28
+ resolve(ok);
29
+ };
30
+ socket.setTimeout(timeoutMs);
31
+ socket.once("connect", () => finish(true));
32
+ socket.once("timeout", () => finish(false));
33
+ socket.once("error", () => finish(false));
34
+ });
35
+ }
36
+ /**
37
+ * Resolve `true` if a connection to `host:port` completes AND survives a brief
38
+ * grace window (`holdMs`). Stronger than {@link probeTcpReachable} for probing a
39
+ * LOCAL FORWARDER port, where "the port accepts" is not proof the tunnel carries
40
+ * traffic: a forwarder (SSM port-forward, or the userspace-Tailscale SOCKS
41
+ * bridge) binds its local port even when its upstream leg is dead — so a plain
42
+ * connect succeeds while nothing flows. A dead-upstream forwarder accepts the
43
+ * TCP connection and then tears it down SYNCHRONOUSLY (e.g. the Tailscale bridge
44
+ * dials a SOCKS port the daemon isn't on and destroys the client — MESH-2169);
45
+ * measured, that teardown lands in ~1ms.
46
+ *
47
+ * The window is deliberately SMALL — just enough to clear that ~1ms fail-fast
48
+ * teardown. It is NOT a latency budget for the upstream: a real upstream need
49
+ * send no bytes and may itself idle-close a bare connection (Temporal's UI drops
50
+ * an idle HTTP connection at ~50ms; Temporal gRPC and Postgres hold indefinitely).
51
+ * So "closed within ~1ms of connecting" means the forwarder never reached a real
52
+ * upstream; surviving `holdMs` means it did. A larger window would mis-report a
53
+ * healthy-but-idle-closing service (like the Temporal UI) as DOWN. Never rejects;
54
+ * the socket is always destroyed.
55
+ */
56
+ export function probeConnectionHolds(host, port, timeoutMs = 800, holdMs = 25) {
57
+ return new Promise((resolve) => {
58
+ let settled = false;
59
+ let holdTimer;
60
+ const socket = createConnection({ host, port });
61
+ const finish = (ok) => {
62
+ if (settled)
63
+ return;
64
+ settled = true;
65
+ if (holdTimer)
66
+ clearTimeout(holdTimer);
67
+ socket.destroy();
68
+ resolve(ok);
69
+ };
70
+ socket.setTimeout(timeoutMs);
71
+ // Healthy iff the connection survives the grace window after connecting.
72
+ socket.once("connect", () => {
73
+ holdTimer = setTimeout(() => finish(true), holdMs);
74
+ });
75
+ // Closed before the grace window elapsed → the forwarder's upstream is dead.
76
+ socket.once("close", () => finish(false));
77
+ socket.once("timeout", () => finish(false));
78
+ socket.once("error", () => finish(false));
79
+ });
80
+ }
81
+ //# sourceMappingURL=reachability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reachability.js","sourceRoot":"","sources":["../../../src/utils/reachability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAY,EAAE,SAAS,GAAG,IAAI;IAC5E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,EAAE;YAC7B,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAY,EACZ,SAAS,GAAG,GAAG,EACf,MAAM,GAAG,EAAE;IAEX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,SAAoD,CAAC;QACzD,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,EAAE;YAC7B,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,SAAS;gBAAE,YAAY,CAAC,SAAS,CAAC,CAAC;YACvC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC7B,yEAAyE;QACzE,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;YAC1B,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,6EAA6E;QAC7E,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Reconstruct an agent conversation's transcript from decoded Temporal history.
3
+ *
4
+ * An agent conversation is a Temporal `agentWorkflow`. Its durable history holds
5
+ * everything needed to replay the human/agent exchange even when the worker can
6
+ * no longer run the workflow (code drift):
7
+ *
8
+ * - `WorkflowExecutionSignaled` with signal name `submit_user_message` →
9
+ * one HUMAN turn. Its input payload is `SubmitUserMessageParams`
10
+ * (agent-sdk `agent-core/workflows/signals.ts`): `{ model, messages,
11
+ * streamId, ... }` where `messages` is a Vercel-AI `ModelMessage[]`; the
12
+ * user text lives in the `user`-role message(s).
13
+ * - `callLLM` `ActivityTaskCompleted` → one ASSISTANT turn. Its result is
14
+ * `LLMResult` (agent-sdk `agent-core/types.ts`): `{ messages, usage?,
15
+ * telemetry? }` where `messages` is the model's output `ModelMessage[]` —
16
+ * `assistant`-role text parts plus any `tool-call` parts.
17
+ *
18
+ * This module is the PURE reconstruction core: it takes events whose payloads
19
+ * have ALREADY been decrypted into plain objects and returns ordered turns. The
20
+ * Temporal fetch + decrypt wiring lives in `commands/temporal.ts`.
21
+ *
22
+ * Everything here is best-effort and defensive: payload shapes vary across
23
+ * agent-sdk versions, so every field access is guarded and a turn that can't be
24
+ * parsed becomes a placeholder rather than throwing — the whole point is to
25
+ * recover *something* from an otherwise-unreplayable history.
26
+ */
27
+ /** Classification of a single decoded history event. */
28
+ export interface DecodedEvent {
29
+ /** Temporal event id (stringified). Used in placeholders. */
30
+ eventId: string;
31
+ /** Which kind of conversation event this is. */
32
+ kind: "userSignal" | "callLLMResult" | "other";
33
+ /**
34
+ * The decoded payload object for this event:
35
+ * - `userSignal` → the `submit_user_message` signal input (SubmitUserMessageParams)
36
+ * - `callLLMResult` → the `callLLM` activity result (LLMResult)
37
+ * - `other` → unused
38
+ */
39
+ payload?: unknown;
40
+ }
41
+ /**
42
+ * Minimal shape of a raw Temporal history event as consumed by
43
+ * `classifyHistoryEvents`. Only the attribute groups we classify are declared;
44
+ * everything else is ignored. Field access is defensive so partial/variant
45
+ * shapes (across Temporal SDK versions) don't throw.
46
+ */
47
+ export interface RawHistoryEvent {
48
+ eventId?: unknown;
49
+ activityTaskScheduledEventAttributes?: {
50
+ activityType?: {
51
+ name?: string | null;
52
+ } | null;
53
+ /**
54
+ * The activity's INPUT payload group. For `callLLM` this is `callLLMArgs`
55
+ * (`{ model, messages }`) whose `messages` is the FULL accumulated
56
+ * conversation — the highest-fidelity snapshot source.
57
+ */
58
+ input?: {
59
+ payloads?: unknown[] | null;
60
+ } | null;
61
+ } | null;
62
+ workflowExecutionSignaledEventAttributes?: {
63
+ signalName?: string | null;
64
+ input?: {
65
+ payloads?: unknown[] | null;
66
+ } | null;
67
+ } | null;
68
+ activityTaskCompletedEventAttributes?: {
69
+ scheduledEventId?: unknown;
70
+ result?: {
71
+ payloads?: unknown[] | null;
72
+ } | null;
73
+ } | null;
74
+ [k: string]: unknown;
75
+ }
76
+ /**
77
+ * Decrypt+parse a payload group (the `payloads` array from a signal input or
78
+ * activity result) into a plain object. Returns `undefined` when nothing could
79
+ * be decoded, so the pure reconstructor emits a placeholder. Injected so the
80
+ * classification stays pure and unit-testable without a live Temporal codec.
81
+ */
82
+ export type DecodePayload = (payloads: unknown[] | undefined | null) => Promise<unknown>;
83
+ /**
84
+ * Classify a raw Temporal history into the ordered `DecodedEvent[]` that
85
+ * `reconstructTranscript` consumes.
86
+ *
87
+ * `ActivityTaskCompleted` events carry only a `scheduledEventId`, not the
88
+ * activity's type name — so to tell which completions came from `callLLM` we
89
+ * build a map of `ActivityTaskScheduled.eventId → activityType.name` as we walk
90
+ * the history in event order, then look each completion's `scheduledEventId` up
91
+ * in it. Only `callLLM` completions become `callLLMResult` (assistant) events;
92
+ * completions of other activities (e.g. `routeTools`) are dropped.
93
+ * `submit_user_message` signals become `userSignal` (human) events.
94
+ *
95
+ * Pure aside from the injected `decodePayload` (which performs the decrypt):
96
+ * never throws, and preserves history order.
97
+ */
98
+ export declare function classifyHistoryEvents(rawEvents: Iterable<RawHistoryEvent>, decodePayload: DecodePayload): Promise<DecodedEvent[]>;
99
+ /**
100
+ * A Vercel-AI `ModelMessage` as it appears in decoded history — kept structural
101
+ * (not flattened to text) so tool-call / tool-result content parts survive into
102
+ * the snapshot. Typed loosely on purpose: shapes vary across agent-sdk versions
103
+ * and the snapshot is a best-effort passthrough of whatever was persisted.
104
+ */
105
+ export type ModelMessage = {
106
+ role?: string;
107
+ content?: unknown;
108
+ } & Record<string, unknown>;
109
+ /**
110
+ * Extract the highest-fidelity STRUCTURED transcript for a store-ready snapshot
111
+ * backfill — the complete `ModelMessage[]` with tool-call/tool-result parts
112
+ * intact (as opposed to `reconstructTranscript`'s flattened text turns).
113
+ *
114
+ * The source is the `callLLM` activity's SCHEDULED input, `callLLMArgs`
115
+ * (`{ model, messages }`), whose `messages` is the FULL accumulated conversation
116
+ * (user + assistant-with-tool-calls + tool-result messages) up to — but not
117
+ * including — that turn's assistant output. We take the LAST `callLLM`
118
+ * scheduled input (the most-accumulated one) and append the LAST `callLLM`
119
+ * completion's output messages (`LLMResult.messages`, the final assistant turn):
120
+ *
121
+ * [...lastScheduledInput.messages, ...lastCompletion.messages]
122
+ *
123
+ * Completions are matched to `callLLM` via `scheduledEventId` (same mapping as
124
+ * `classifyHistoryEvents`).
125
+ *
126
+ * Best-effort and never throws:
127
+ * - no `callLLM` scheduled input (0 assistant turns) → `[]`;
128
+ * - a scheduled input but no completion (last turn interrupted) → just the
129
+ * input messages.
130
+ *
131
+ * Pure aside from the injected `decodePayload` (which performs the decrypt).
132
+ */
133
+ export declare function extractSnapshotMessages(rawEvents: Iterable<RawHistoryEvent>, decodePayload: DecodePayload): Promise<ModelMessage[]>;
134
+ /** One reconstructed conversation turn. */
135
+ export interface Turn {
136
+ role: "user" | "assistant";
137
+ /** Human-readable text. Empty string is valid (e.g. a tool-only assistant turn). */
138
+ text: string;
139
+ /** Formatted tool-call summaries (`name(compactArgs)`), assistant turns only. */
140
+ toolCalls?: string[];
141
+ /** Originating Temporal event id. */
142
+ eventId: string;
143
+ }
144
+ /**
145
+ * Reconstruct ordered conversation turns from decoded history events.
146
+ *
147
+ * Pure: no I/O, never throws. `other` events are skipped; unparseable
148
+ * user/assistant events become placeholder turns so the recovery is complete
149
+ * end-to-end even when individual payloads are corrupt.
150
+ */
151
+ export declare function reconstructTranscript(events: DecodedEvent[]): Turn[];
152
+ /** Render turns as a readable markdown transcript. */
153
+ export declare function renderTranscriptMarkdown(turns: Turn[]): string;
154
+ //# sourceMappingURL=recover-conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recover-conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/recover-conversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,EAAE,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC;IAC/C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oCAAoC,CAAC,EAAE;QACrC,YAAY,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;QAC/C;;;;WAIG;QACH,KAAK,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;KAChD,GAAG,IAAI,CAAC;IACT,wCAAwC,CAAC,EAAE;QACzC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,KAAK,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;KAChD,GAAG,IAAI,CAAC;IACT,oCAAoC,CAAC,EAAE;QACrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,MAAM,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;KACjD,GAAG,IAAI,CAAC;IAET,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,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