sanoma 0.11.21 → 0.11.23

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 (728) hide show
  1. package/README.md +55 -14
  2. package/app/README.md +12 -8
  3. package/app/dist/api.d.ts +191 -5
  4. package/app/dist/api.js +125 -4
  5. package/app/dist/api.js.map +1 -1
  6. package/app/dist/build.d.ts +28 -3
  7. package/app/dist/build.js +154 -15
  8. package/app/dist/build.js.map +1 -1
  9. package/app/dist/bundle-build.d.ts +32 -0
  10. package/app/dist/bundle-build.js +127 -67
  11. package/app/dist/bundle-build.js.map +1 -1
  12. package/app/dist/client/assets/ArrowDown.es-BVRf--PS.js +1 -0
  13. package/app/dist/client/assets/CaretDown.es-D12mWb2j.js +1 -0
  14. package/app/dist/client/assets/CatchBoundary-Cb__yx-s.js +1 -0
  15. package/app/dist/client/assets/Check.es-b7BdqO2s.js +1 -0
  16. package/app/dist/client/assets/CheckCircle.es-DKXiWmAT.js +1 -0
  17. package/app/dist/client/assets/Copy.es-CvUujKw7.js +1 -0
  18. package/app/dist/client/assets/DialogTitle-5oboyLiq.js +1 -0
  19. package/app/dist/client/assets/FloppyDisk.es-CDyDob8p.js +1 -0
  20. package/app/dist/client/assets/Globe.es-C1pgZCGM.js +1 -0
  21. package/app/dist/client/assets/MagnifyingGlass.es-CZ3i6pz0.js +1 -0
  22. package/app/dist/client/assets/Play.es-DGJ1CGhp.js +1 -0
  23. package/app/dist/client/assets/Plug.es-BPhGL8MK.js +1 -0
  24. package/app/dist/client/assets/Plus.es-i3Vaa2WW.js +1 -0
  25. package/app/dist/client/assets/Separator-Cu9cQDBN.js +1 -0
  26. package/app/dist/client/assets/X.es-B7rq0E_-.js +1 -0
  27. package/app/dist/client/assets/_id-0_Y-lz6G.js +1 -0
  28. package/app/dist/client/assets/_id-3tGIwJ5T.js +1 -0
  29. package/app/dist/client/assets/_id-CgPVeQe8.js +1 -0
  30. package/app/dist/client/assets/_id-DFlFuBDE.js +1 -0
  31. package/app/dist/client/assets/_id-QNnNLGx_.js +1 -0
  32. package/app/dist/client/assets/_name-6k1yqjX8.js +1 -0
  33. package/app/dist/client/assets/_name-B4Qba2-o.js +4 -0
  34. package/app/dist/client/assets/_name-BfPXcP49.js +1 -0
  35. package/app/dist/client/assets/_name-CqBzHz7c.js +1 -0
  36. package/app/dist/client/assets/_vendor-CfHRJBG8.js +1 -0
  37. package/app/dist/client/assets/_vendor-Dj7KCZ74.js +1 -0
  38. package/app/dist/client/assets/app-chrome-CFH47gLL.js +5 -0
  39. package/app/dist/client/assets/app-scope-Z_2GE9oz.js +1 -0
  40. package/app/dist/client/assets/approval-CgksyU5L.js +1 -0
  41. package/app/dist/client/assets/apps-BDsPVmMY.js +1 -0
  42. package/app/dist/client/assets/button-D5kdANef.js +1 -0
  43. package/app/dist/client/assets/change-glance-D6N6Xaqu.js +1 -0
  44. package/app/dist/client/assets/changes-B6xxBiC0.js +1 -0
  45. package/app/dist/client/assets/changes-BS7eJI5T.js +1 -0
  46. package/app/dist/client/assets/chat-Bw3WhRE9.js +14 -0
  47. package/app/dist/client/assets/chat-button-DNusaP5n.js +1 -0
  48. package/app/dist/client/assets/chat-prompt-z0XJPDtH.js +1 -0
  49. package/app/dist/client/assets/{code-BVYaiQEr.js → code-CT4-YDKq.js} +2 -2
  50. package/app/dist/client/assets/common-DZLdx_jS.js +3 -0
  51. package/app/dist/client/assets/composite-CoGyvQjv.js +1 -0
  52. package/app/dist/client/assets/connect-BMk-KP-f.js +1 -0
  53. package/app/dist/client/assets/connections-TbS_jeiy.js +5 -0
  54. package/app/dist/client/assets/connectors-CgRpyRdd.js +1 -0
  55. package/app/dist/client/assets/credentials-Dxpl8sUw.js +1 -0
  56. package/app/dist/client/assets/css-BGIxQoYs.js +1 -0
  57. package/app/dist/client/assets/css-DgaLhXQH.js +1 -0
  58. package/app/dist/client/assets/data-lKkklNeo.js +1 -0
  59. package/app/dist/client/assets/decidable-w2VGgZwN.js +1 -0
  60. package/app/dist/client/assets/declaration-form-CAwox7F1.js +1 -0
  61. package/app/dist/client/assets/dialog-DDAfDsGh.js +1 -0
  62. package/app/dist/client/assets/diff-woXpYk--.js +1 -0
  63. package/app/dist/client/assets/engine-CBuzy-Ik.js +1 -0
  64. package/app/dist/client/assets/existing-2kDivy4p.js +1 -0
  65. package/app/dist/client/assets/fence-BdtS5gi0.js +157 -0
  66. package/app/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
  67. package/app/dist/client/assets/github-light-EUqPIrTm.js +1 -0
  68. package/app/dist/client/assets/graph-BqVQ68hK.js +7 -0
  69. package/app/dist/client/assets/grid-diff-Jj1nTy52.js +1 -0
  70. package/app/dist/client/assets/held-card-DjBO8PTe.js +1 -0
  71. package/app/dist/client/assets/highlighted-body-JLMTFACH-Co7ss_Ht.js +1 -0
  72. package/app/dist/client/assets/hosting-DC7Pftfb.js +1 -0
  73. package/app/dist/client/assets/html-BHZv6uqE.js +1 -0
  74. package/app/dist/client/assets/import-DhVQArmJ.js +1 -0
  75. package/app/dist/client/assets/inbox-5h39e_tI.js +1 -0
  76. package/app/dist/client/assets/inbox-CUNaP4uz.js +1 -0
  77. package/app/dist/client/assets/index-CA_5CFb4.js +10 -0
  78. package/app/dist/client/assets/item-vV00RYfb.js +1 -0
  79. package/app/dist/client/assets/javascript-BzbQS41l.js +1 -0
  80. package/app/dist/client/assets/javascript-CpIGwZ_Y.js +1 -0
  81. package/app/dist/client/assets/json-qhed-kSA.js +1 -0
  82. package/app/dist/client/assets/jsx-Bz0zcwM4.js +1 -0
  83. package/app/dist/client/assets/kit-BZcdh1Xm.js +1 -0
  84. package/app/dist/client/assets/lazyRouteComponent-C2a8bGcK.js +1 -0
  85. package/app/dist/client/assets/markdown-BYOwaDjH.js +1 -0
  86. package/app/dist/client/assets/markdown-bsqylRZb.js +164 -0
  87. package/app/dist/client/assets/mermaid-WFAXDIZX-CYMnek4e.js +1 -0
  88. package/app/dist/client/assets/motion-D6e1hqz4.js +1 -0
  89. package/app/dist/client/assets/people-Bn8GAJ3z.js +1 -0
  90. package/app/dist/client/assets/permissions-Csf87P7b.js +2 -0
  91. package/app/dist/client/assets/permissions-grid-CzK64E29.js +1 -0
  92. package/app/dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  93. package/app/dist/client/assets/python-gzcpVVnB.js +1 -0
  94. package/app/dist/client/assets/queries-XJ-fmuYb.js +57 -0
  95. package/app/dist/client/assets/react-dom-D6fTz1bt.js +1 -0
  96. package/app/dist/client/assets/review-BjpH-tT4.js +1 -0
  97. package/app/dist/client/assets/route-CD2oErox.js +1 -0
  98. package/app/dist/client/assets/route-CRwDZE-c.js +1 -0
  99. package/app/dist/client/assets/routes-gbZbqIhO.js +1 -0
  100. package/app/dist/client/assets/runs-table-nkQLXJxG.js +1 -0
  101. package/app/dist/client/assets/scenario-CZ7tmap7.js +1 -0
  102. package/app/dist/client/assets/scenario-graph-W2XcWuur.js +1 -0
  103. package/app/dist/client/assets/separator-Bdtc7rou.js +1 -0
  104. package/app/dist/client/assets/{sheet-BYL9XU5s.js → sheet-P-hJsTeq.js} +1 -1
  105. package/app/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
  106. package/app/dist/client/assets/site-icon-1Mcc1UIb.js +1 -0
  107. package/app/dist/client/assets/sites.index-CXcRF_R0.js +1 -0
  108. package/app/dist/client/assets/spinner-XaRXIj9W.js +1 -0
  109. package/app/dist/client/assets/sql-CEbI0hMM.js +1 -0
  110. package/app/dist/client/assets/start-form-6whPfUoW.js +1 -0
  111. package/app/dist/client/assets/store-BT988jIX.js +1 -0
  112. package/app/dist/client/assets/style-DaqPHcI1.css +2 -0
  113. package/app/dist/client/assets/table-B81tv0LG.js +1 -0
  114. package/app/dist/client/assets/textarea-CRpYU-qx.js +1 -0
  115. package/app/dist/client/assets/tsx-udAQXfEw.js +1 -0
  116. package/app/dist/client/assets/typescript-bsJCZSQ-.js +1 -0
  117. package/app/dist/client/assets/useLoaderData-BIegJC9y.js +1 -0
  118. package/app/dist/client/assets/useOpenInteractionType-UhakpAXY.js +1 -0
  119. package/app/dist/client/assets/useRegisterFieldControl-CT8iqvDE.js +1 -0
  120. package/app/dist/client/assets/useValueChanged-DBqn456b.js +1 -0
  121. package/app/dist/client/assets/utils-BRvE9-Fo.js +1 -0
  122. package/app/dist/client/assets/who-are-you-_7OehU_o.js +1 -0
  123. package/app/dist/client/assets/workflow-DSNK0oFo.js +1 -0
  124. package/app/dist/client/assets/workflow-view-VFD3onJL.js +1 -0
  125. package/app/dist/client/assets/workflows-CT9wqMl2.js +1 -0
  126. package/app/dist/client/assets/yaml-rwi0_p6S.js +1 -0
  127. package/app/dist/components/grid/plan.d.ts +46 -262
  128. package/app/dist/components/grid/plan.js +134 -138
  129. package/app/dist/components/grid/plan.js.map +1 -1
  130. package/app/dist/demo-build.d.ts +58 -0
  131. package/app/dist/demo-build.js +440 -0
  132. package/app/dist/demo-build.js.map +1 -0
  133. package/app/dist/handler.d.ts +9 -7
  134. package/app/dist/handler.js +10 -10
  135. package/app/dist/handler.js.map +1 -1
  136. package/app/dist/index.d.ts +4 -4
  137. package/app/dist/index.js +52 -35
  138. package/app/dist/index.js.map +1 -1
  139. package/app/dist/lib/chat.d.ts +67 -20
  140. package/app/dist/lib/chat.js +54 -18
  141. package/app/dist/lib/chat.js.map +1 -1
  142. package/app/dist/lib/names.d.ts +7 -0
  143. package/app/dist/lib/names.js +6 -2
  144. package/app/dist/lib/names.js.map +1 -1
  145. package/app/dist/login/page.d.ts +1 -10
  146. package/app/dist/login/page.js +0 -14
  147. package/app/dist/login/page.js.map +1 -1
  148. package/app/dist/login/staff.js +3 -3
  149. package/app/dist/login/staff.js.map +1 -1
  150. package/app/dist/server/assets/{_id-wuJIq2ZZ.js → _id-B6iAc90c.js} +2 -2
  151. package/app/dist/server/assets/{_id-Dt9tTylX.js → _id-BlceO2iK.js} +3 -3
  152. package/app/dist/server/assets/{_id-wB8khGTz.js → _id-Cc0uBuJb.js} +12 -7
  153. package/app/dist/server/assets/{_id-ce1EGp7Y.js → _id-DYfvgveB.js} +2 -2
  154. package/app/dist/server/assets/{_id-BViXAagq.js → _id-Dvn0wB-1.js} +15 -330
  155. package/app/dist/server/assets/{_name-BGagGBjX.js → _name-3AGcE6tj.js} +7 -7
  156. package/app/dist/server/assets/{_name-DntbHE-b.js → _name-BIcmcEwj.js} +11 -11
  157. package/app/dist/server/assets/{_name-BqFwnyf7.js → _name-CfoydEzk.js} +2 -2
  158. package/app/dist/server/assets/{_name-D_-MhjNf.js → _name-VpcPszKf.js} +210 -63
  159. package/app/dist/server/assets/{_tanstack-start-manifest_v-BljuBM-G.js → _tanstack-start-manifest_v-DUL7FcJk.js} +119 -91
  160. package/app/dist/server/assets/{_vendor-CcEviOki.js → _vendor-Bwis2sPx.js} +2 -2
  161. package/app/dist/server/assets/{_vendor-CNB03LWX.js → _vendor-DUtH-Z9W.js} +8 -8
  162. package/app/dist/server/assets/{actor-D6iA0pDg.js → actor-DAOPjcdj.js} +1 -1
  163. package/app/dist/server/assets/app-chrome-B8oA4uXZ.js +2298 -0
  164. package/app/dist/server/assets/{app-scope-CXIgOFmi.js → app-scope-BxuIu0xV.js} +2 -2
  165. package/app/dist/server/assets/{apply-plan-ybBda6vQ.js → apply-plan-CHJ_Hr71.js} +8 -7
  166. package/app/dist/server/assets/{approval-Su315ikC.js → approval-DR_9mBcx.js} +17 -14
  167. package/app/dist/server/assets/{apps-xwQAehch.js → apps-CtPev5RI.js} +7 -7
  168. package/app/dist/server/assets/button-Xwx3rpQ0.js +43 -0
  169. package/app/dist/server/assets/change-glance-DGqh7Pxb.js +54 -0
  170. package/app/dist/server/assets/{change-glance-CpArIbGS.js → changes-C3qjEBZP.js} +2 -54
  171. package/app/dist/server/assets/{changes-Bc_OiDBD.js → changes-DfOnO87K.js} +8 -7
  172. package/app/dist/server/assets/{chat-DMN_hoKm.js → chat-B19X0_8f.js} +133 -34
  173. package/app/dist/server/assets/{chat-button-LtA80MoR.js → chat-button-SluTWK8R.js} +2 -2
  174. package/app/dist/server/assets/{code-COyt8L-n.js → code-hVpCkmAZ.js} +1 -1
  175. package/app/dist/server/assets/{common-CWHLj7KV.js → common-JUUJLp4v.js} +30 -82
  176. package/app/dist/server/assets/{connect-BpPiu5s6.js → connect-DKu1UgY-.js} +11 -10
  177. package/app/dist/server/assets/{connections-DBgb1bvX.js → connections-Dyedl4qi.js} +12 -11
  178. package/app/dist/server/assets/{connectors-5a5_SlHO.js → connectors-yojQH7WS.js} +8 -8
  179. package/app/dist/server/assets/{credentials-ud_Y68hx.js → credentials-2Z6EHitQ.js} +10 -9
  180. package/app/dist/server/assets/{data-aEdhwcqy.js → data-1padc_i_.js} +7 -7
  181. package/app/dist/server/assets/{declaration-form-Dfg1yNuY.js → declaration-form-MAnn_M8g.js} +7 -6
  182. package/app/dist/server/assets/{dialog-BGjiw3Dx.js → dialog-T0bzlKzs.js} +2 -2
  183. package/app/dist/server/assets/{dropdown-menu-DAC3LWas.js → dropdown-menu-RGvPORm4.js} +1 -1
  184. package/app/dist/server/assets/{existing-B4d4NrC8.js → existing-BZjX_7Aa.js} +8 -7
  185. package/app/dist/server/assets/fence-BvNu3YNO.js +130 -0
  186. package/app/dist/server/assets/{field-C0Xx_90s.js → field-DFpkT1id.js} +1 -1
  187. package/app/dist/server/assets/{functions-BvFYzabD.js → functions-wlvFaDkF.js} +246 -44
  188. package/app/dist/server/assets/{graph-qYOdoz2s.js → graph-DjANDk1P.js} +5 -5
  189. package/app/dist/server/assets/{grid-diff-jTvp-8wS.js → grid-diff-D5bQDKl2.js} +1 -1
  190. package/app/dist/server/assets/held-card-CCEypEau.js +75 -0
  191. package/app/dist/server/assets/{hosting-bbn9UvDc.js → hosting-Csr6AVC7.js} +321 -42
  192. package/app/dist/server/assets/{import-DIwvzHb6.js → import-CtPlwdIl.js} +12 -10
  193. package/app/dist/server/assets/{inbox-Dj-5FleF.js → inbox-9-WMgjdU.js} +2 -2
  194. package/app/dist/server/assets/{inbox-D6R6sWBB.js → inbox-BYKHV9Yh.js} +8 -8
  195. package/app/dist/server/assets/{input-D63gF3G2.js → input-CF-vX8Xp.js} +1 -1
  196. package/app/dist/server/assets/{item-BDSXoEr_.js → item-LBDNja5f.js} +1 -1
  197. package/app/dist/server/assets/{kit-D6EulwBe.js → kit-D5moAfcg.js} +57 -4
  198. package/app/dist/server/assets/markdown-B9odAiMy.js +116 -0
  199. package/app/dist/server/assets/{middleware-B8JRLyxx.js → middleware-C4Wn6uHO.js} +325 -285
  200. package/app/dist/server/assets/{native-select-DLa-He0n.js → native-select-etaMvR-i.js} +2 -9
  201. package/app/dist/server/assets/{people-CkU_AxrV.js → people-LpcYXtEq.js} +13 -12
  202. package/app/dist/server/assets/{permissions-BfMcQqQb.js → permissions-M0kzvVVm.js} +9 -8
  203. package/app/dist/server/assets/{permissions-grid-DWP9FAAS.js → permissions-grid-CwWWdcQA.js} +4 -4
  204. package/app/dist/server/assets/{button-f9Lc8qLl.js → queries-BDuQsTdU.js} +141 -59
  205. package/app/dist/server/assets/review-BFZCPdVZ.js +355 -0
  206. package/app/dist/server/assets/{route-CF_8jQYY.js → route-BJLQf4ik.js} +2 -2
  207. package/app/dist/server/assets/{route-BTT7nMJq.js → route-C3uFABee.js} +2 -2
  208. package/app/dist/server/assets/{router-BvYtxrVN.js → router-Dx7Gu0CN.js} +175 -147
  209. package/app/dist/server/assets/routes-iVrnGFaR.js +227 -0
  210. package/app/dist/server/assets/{runs-table-BBudn12Y.js → runs-table-g3QYggO3.js} +6 -6
  211. package/app/dist/server/assets/{scenario-BXGTSTiP.js → scenario-B5dGlEGF.js} +5 -5
  212. package/app/dist/server/assets/{separator-8MZ7vR3f.js → separator-Cf98V8ie.js} +1 -1
  213. package/app/dist/server/assets/{sheet-5Cyp-4UW.js → sheet-DTOG7OHQ.js} +2 -2
  214. package/app/dist/server/assets/sites.index-BNeYUQnQ.js +165 -0
  215. package/app/dist/server/assets/{spinner-C1ZW08lp.js → spinner-016IPVi-.js} +1 -1
  216. package/app/dist/server/assets/{start-CSU4irVK.js → start-CIKqNkKp.js} +2 -2
  217. package/app/dist/server/assets/{start-form-DI60UOrc.js → start-form-BXAi2lVm.js} +10 -9
  218. package/app/dist/server/assets/{table-DtPk_h_5.js → table-y-dGlLx6.js} +1 -1
  219. package/app/dist/server/assets/{textarea-f0Ip5ed1.js → textarea-B02joDnr.js} +1 -1
  220. package/app/dist/server/assets/utils-CHesvfjo.js +138 -0
  221. package/app/dist/server/assets/{who-are-you-ZGyMnpVi.js → who-are-you-CavnVMGe.js} +16 -10
  222. package/app/dist/server/assets/{workflow-Z99QWO42.js → workflow-BXhqp6S1.js} +5 -5
  223. package/app/dist/server/assets/{workflow-view-C8X8U11S.js → workflow-view-go1rbTSF.js} +14 -13
  224. package/app/dist/server/assets/{workflows-C0kJoGf1.js → workflows-BCcXZtN-.js} +14 -14
  225. package/app/dist/server/chat.d.ts +6 -1
  226. package/app/dist/server/chat.js +39 -20
  227. package/app/dist/server/chat.js.map +1 -1
  228. package/app/dist/server/core.d.ts +24 -9
  229. package/app/dist/server/core.js +58 -119
  230. package/app/dist/server/core.js.map +1 -1
  231. package/app/dist/server/go-live.d.ts +11 -2
  232. package/app/dist/server/go-live.js +27 -27
  233. package/app/dist/server/go-live.js.map +1 -1
  234. package/app/dist/server/server.js +68 -48
  235. package/app/dist/server/setup.js +1 -1
  236. package/app/dist/server/setup.js.map +1 -1
  237. package/app/dist/server/token-redeem.d.ts +8 -0
  238. package/app/dist/server/token-redeem.js +45 -0
  239. package/app/dist/server/token-redeem.js.map +1 -0
  240. package/app/dist/site-path.d.ts +15 -0
  241. package/app/dist/site-path.js +26 -0
  242. package/app/dist/site-path.js.map +1 -1
  243. package/app/dist/snapshot-build.js +1 -0
  244. package/app/dist/snapshot-build.js.map +1 -1
  245. package/app/dist/steps/agent/acp.d.ts +3 -97
  246. package/app/dist/steps/agent/acp.js +19 -49
  247. package/app/dist/steps/agent/acp.js.map +1 -1
  248. package/app/dist/steps/agent/checkout.d.ts +18 -1
  249. package/app/dist/steps/agent/checkout.js +17 -0
  250. package/app/dist/steps/agent/checkout.js.map +1 -1
  251. package/app/dist/steps/agent/harness.d.ts +2 -4
  252. package/app/dist/steps/agent/harness.js +45 -61
  253. package/app/dist/steps/agent/harness.js.map +1 -1
  254. package/app/dist/steps/agent/prompt.d.ts +1 -1
  255. package/app/dist/steps/agent/prompt.js +37 -16
  256. package/app/dist/steps/agent/prompt.js.map +1 -1
  257. package/app/dist/steps/agent/transcript.d.ts +10 -1
  258. package/app/dist/steps/agent/transcript.js +75 -2
  259. package/app/dist/steps/agent/transcript.js.map +1 -1
  260. package/app/dist/steps/agent/turn.d.ts +4 -6
  261. package/app/dist/steps/agent/turn.js +14 -16
  262. package/app/dist/steps/agent/turn.js.map +1 -1
  263. package/app/dist/steps/index.js +2 -2
  264. package/app/dist/steps/index.js.map +1 -1
  265. package/app/dist/steps/writes.d.ts +21 -7
  266. package/app/dist/steps/writes.js +100 -23
  267. package/app/dist/steps/writes.js.map +1 -1
  268. package/app/dist/stylesheet.json +1 -1
  269. package/app/src/api.ts +188 -4
  270. package/app/src/build.ts +177 -14
  271. package/app/src/bundle-build.ts +132 -63
  272. package/app/src/components/app-chrome.tsx +28 -13
  273. package/app/src/components/approval.tsx +1 -1
  274. package/app/src/components/common.tsx +18 -88
  275. package/app/src/components/data-grid.tsx +2 -1
  276. package/app/src/components/go-live-cloud.tsx +44 -0
  277. package/app/src/components/go-live.tsx +51 -13
  278. package/app/src/components/grid/columns.tsx +175 -53
  279. package/app/src/components/grid/grid.tsx +4 -2
  280. package/app/src/components/grid/plan.ts +153 -164
  281. package/app/src/components/grid/review.tsx +108 -118
  282. package/app/src/components/home.tsx +199 -0
  283. package/app/src/components/import/match.tsx +2 -1
  284. package/app/src/components/import/sheet.ts +2 -1
  285. package/app/src/components/kit.tsx +55 -1
  286. package/app/src/components/logo.tsx +25 -0
  287. package/app/src/components/record-form.tsx +12 -5
  288. package/app/src/components/shell/bar.tsx +35 -26
  289. package/app/src/components/shell/chat-parts.tsx +185 -126
  290. package/app/src/components/shell/chat-prompt.ts +6 -2
  291. package/app/src/components/shell/chat.tsx +154 -220
  292. package/app/src/components/shell/composer.tsx +140 -0
  293. package/app/src/components/shell/connect-agent.tsx +157 -0
  294. package/app/src/components/shell/draft-card.tsx +192 -45
  295. package/app/src/components/shell/engine-mark.tsx +9 -0
  296. package/app/src/components/shell/fence.tsx +25 -0
  297. package/app/src/components/shell/held-card.tsx +58 -0
  298. package/app/src/components/shell/markdown.tsx +152 -0
  299. package/app/src/components/shell/nav-user.tsx +11 -1
  300. package/app/src/components/shell/prefs.ts +12 -1
  301. package/app/src/components/shell/thread.tsx +174 -0
  302. package/app/src/components/store-move.tsx +2 -1
  303. package/app/src/components/ui/bubble.tsx +117 -0
  304. package/app/src/components/ui/code-block.tsx +235 -0
  305. package/app/src/components/ui/input-group.tsx +136 -0
  306. package/app/src/components/ui/marker.tsx +67 -0
  307. package/app/src/components/ui/message-scroller.tsx +117 -0
  308. package/app/src/components/ui/message.tsx +74 -0
  309. package/app/src/components/ui/radio-group.tsx +26 -0
  310. package/app/src/components/ui/trace.tsx +133 -0
  311. package/app/src/components/who-are-you.tsx +8 -3
  312. package/app/src/demo/api.ts +42 -0
  313. package/app/src/demo/client-rpc.ts +16 -0
  314. package/app/src/demo/demo.css +31 -0
  315. package/app/src/demo/mount.tsx +97 -0
  316. package/app/src/demo/root.tsx +31 -0
  317. package/app/src/demo/tailwind.css +4 -0
  318. package/app/src/demo-build.ts +525 -0
  319. package/app/src/env.d.ts +12 -0
  320. package/app/src/functions.ts +50 -7
  321. package/app/src/handler.ts +20 -14
  322. package/app/src/hooks/use-highlighted-code.ts +72 -0
  323. package/app/src/index.ts +55 -36
  324. package/app/src/lib/chat.ts +113 -23
  325. package/app/src/lib/cn-tables.ts +23 -23
  326. package/app/src/lib/company-state.ts +73 -0
  327. package/app/src/lib/highlighter.tsx +114 -0
  328. package/app/src/lib/names.ts +13 -2
  329. package/app/src/login/page.ts +1 -21
  330. package/app/src/login/staff.ts +3 -3
  331. package/app/src/queries.ts +121 -18
  332. package/app/src/routes/__root.tsx +24 -7
  333. package/app/src/routes/changes/$id.tsx +4 -3
  334. package/app/src/routes/connectors/index.tsx +1 -1
  335. package/app/src/routes/data/$name/import.tsx +2 -1
  336. package/app/src/routes/data/$name/index.tsx +1 -2
  337. package/app/src/routes/hosting/index.tsx +277 -60
  338. package/app/src/routes/index.tsx +15 -4
  339. package/app/src/routes/sites.index.tsx +41 -3
  340. package/app/src/routes/workflows/$name/runs/$id.tsx +3 -1
  341. package/app/src/server/chat.ts +41 -19
  342. package/app/src/server/columns.ts +44 -18
  343. package/app/src/server/company-state.ts +76 -0
  344. package/app/src/server/core.ts +72 -116
  345. package/app/src/server/go-live.ts +35 -27
  346. package/app/src/server/setup-progress.ts +28 -0
  347. package/app/src/server/setup.ts +1 -1
  348. package/app/src/server/token-redeem.ts +49 -0
  349. package/app/src/site-api.ts +10 -0
  350. package/app/src/site-path.ts +29 -0
  351. package/app/src/site.ts +1 -1
  352. package/app/src/snapshot-build.ts +1 -0
  353. package/app/src/steps/agent/acp.ts +10 -80
  354. package/app/src/steps/agent/checkout.ts +30 -0
  355. package/app/src/steps/agent/harness.ts +53 -78
  356. package/app/src/steps/agent/prompt.ts +45 -17
  357. package/app/src/steps/agent/transcript.ts +90 -3
  358. package/app/src/steps/agent/turn.ts +18 -16
  359. package/app/src/steps/index.ts +2 -2
  360. package/app/src/steps/writes.ts +121 -31
  361. package/app/src/worker/app.ts +17 -14
  362. package/dist/check.js +2 -2
  363. package/dist/check.js.map +1 -1
  364. package/dist/cli.js +81 -22
  365. package/dist/cli.js.map +1 -1
  366. package/dist/config.d.ts +8 -1
  367. package/dist/config.js +49 -8
  368. package/dist/config.js.map +1 -1
  369. package/dist/events.d.ts +15 -1
  370. package/dist/events.js +7 -0
  371. package/dist/events.js.map +1 -1
  372. package/dist/init.d.ts +27 -14
  373. package/dist/init.js +87 -39
  374. package/dist/init.js.map +1 -1
  375. package/dist/serve.d.ts +6 -2
  376. package/dist/serve.js +71 -9
  377. package/dist/serve.js.map +1 -1
  378. package/dist/source.d.ts +5 -0
  379. package/dist/source.js +113 -23
  380. package/dist/source.js.map +1 -1
  381. package/dist/worker-port.d.ts +16 -2
  382. package/dist/worker-port.js +44 -5
  383. package/dist/worker-port.js.map +1 -1
  384. package/invoices/README.md +66 -0
  385. package/invoices/dist/calculate.d.ts +37 -0
  386. package/invoices/dist/calculate.js +97 -0
  387. package/invoices/dist/calculate.js.map +1 -0
  388. package/invoices/dist/index.d.ts +4 -0
  389. package/invoices/dist/index.js +5 -0
  390. package/invoices/dist/index.js.map +1 -0
  391. package/invoices/dist/logo.d.ts +2 -0
  392. package/invoices/dist/logo.js +89 -0
  393. package/invoices/dist/logo.js.map +1 -0
  394. package/invoices/dist/pdf.d.ts +33 -0
  395. package/invoices/dist/pdf.js +215 -0
  396. package/invoices/dist/pdf.js.map +1 -0
  397. package/invoices/dist/schema.d.ts +156 -0
  398. package/invoices/dist/schema.js +88 -0
  399. package/invoices/dist/schema.js.map +1 -0
  400. package/oxlint.json +18 -0
  401. package/package.json +42 -7
  402. package/template/.env.example +15 -4
  403. package/template/AGENTS.md +10 -6
  404. package/template/package.json +6 -1
  405. package/template/policies/policy.cedar +5 -5
  406. package/template/resources/people.ts +5 -13
  407. package/template/resources/sanoma/infra.ts +8 -0
  408. package/template/sanoma.config.ts +18 -11
  409. package/template/scenarios/record-lead/record.feature +14 -0
  410. package/template/secrets.ts +13 -0
  411. package/template/tsconfig.json +1 -0
  412. package/template/workflows/record-lead.ts +30 -0
  413. package/testing/README.md +4 -4
  414. package/testing/dist/build.d.ts +3 -3
  415. package/testing/dist/build.js +4 -4
  416. package/testing/dist/build.js.map +1 -1
  417. package/testing/dist/host.d.ts +38 -21
  418. package/testing/dist/host.js +159 -77
  419. package/testing/dist/host.js.map +1 -1
  420. package/testing/dist/scenarios.d.ts +2 -1
  421. package/testing/dist/scenarios.js +14 -4
  422. package/testing/dist/scenarios.js.map +1 -1
  423. package/workflows/CLOUD-IDENTITY.md +15 -20
  424. package/workflows/README.md +54 -19
  425. package/workflows/dist/app-steps.js +8 -0
  426. package/workflows/dist/app-steps.js.map +1 -1
  427. package/workflows/dist/app-workflows.d.ts +172 -6
  428. package/workflows/dist/app-workflows.js +57 -9
  429. package/workflows/dist/app-workflows.js.map +1 -1
  430. package/workflows/dist/approvals.d.ts +3 -1
  431. package/workflows/dist/approvals.js +3 -1
  432. package/workflows/dist/approvals.js.map +1 -1
  433. package/workflows/dist/call.d.ts +8 -40
  434. package/workflows/dist/call.js +24 -135
  435. package/workflows/dist/call.js.map +1 -1
  436. package/workflows/dist/change-steps.d.ts +7 -0
  437. package/workflows/dist/change-steps.js +37 -13
  438. package/workflows/dist/change-steps.js.map +1 -1
  439. package/workflows/dist/change-workflow.d.ts +22 -10
  440. package/workflows/dist/change-workflow.js +30 -12
  441. package/workflows/dist/change-workflow.js.map +1 -1
  442. package/workflows/dist/change.d.ts +233 -7
  443. package/workflows/dist/change.js +27 -9
  444. package/workflows/dist/change.js.map +1 -1
  445. package/workflows/dist/client.d.ts +32 -5
  446. package/workflows/dist/client.js +94 -35
  447. package/workflows/dist/client.js.map +1 -1
  448. package/workflows/dist/cloud-identity.d.ts +5 -2
  449. package/workflows/dist/cloud-identity.js +7 -4
  450. package/workflows/dist/cloud-identity.js.map +1 -1
  451. package/workflows/dist/collection-driver.d.ts +20 -0
  452. package/workflows/dist/collection-driver.js +201 -0
  453. package/workflows/dist/collection-driver.js.map +1 -0
  454. package/workflows/dist/collection.d.ts +126 -14
  455. package/workflows/dist/collection.js +45 -168
  456. package/workflows/dist/collection.js.map +1 -1
  457. package/workflows/dist/company-file.d.ts +22 -0
  458. package/workflows/dist/company-file.js +82 -0
  459. package/workflows/dist/company-file.js.map +1 -0
  460. package/workflows/dist/config.d.ts +34 -6
  461. package/workflows/dist/config.js +58 -45
  462. package/workflows/dist/config.js.map +1 -1
  463. package/workflows/dist/ctx.d.ts +101 -0
  464. package/workflows/dist/ctx.js +171 -0
  465. package/workflows/dist/ctx.js.map +1 -0
  466. package/workflows/dist/db/company.d.ts +115 -1
  467. package/workflows/dist/db/company.js +14 -1
  468. package/workflows/dist/db/company.js.map +1 -1
  469. package/workflows/dist/db/dbos.d.ts +17 -0
  470. package/workflows/dist/db/dbos.js +2 -0
  471. package/workflows/dist/db/dbos.js.map +1 -1
  472. package/workflows/dist/db/identity.d.ts +2 -2
  473. package/workflows/dist/db/identity.js +2 -2
  474. package/workflows/dist/db/identity.js.map +1 -1
  475. package/workflows/dist/db.d.ts +1 -1
  476. package/workflows/dist/db.js +10 -6
  477. package/workflows/dist/db.js.map +1 -1
  478. package/workflows/dist/deadlines.d.ts +14 -8
  479. package/workflows/dist/deadlines.js +22 -11
  480. package/workflows/dist/deadlines.js.map +1 -1
  481. package/workflows/dist/define.d.ts +0 -8
  482. package/workflows/dist/define.js +1 -24
  483. package/workflows/dist/define.js.map +1 -1
  484. package/workflows/dist/describe.d.ts +1 -1
  485. package/workflows/dist/describe.js +18 -5
  486. package/workflows/dist/describe.js.map +1 -1
  487. package/workflows/dist/description.d.ts +408 -2
  488. package/workflows/dist/description.js +130 -5
  489. package/workflows/dist/description.js.map +1 -1
  490. package/workflows/dist/drift.d.ts +5 -2
  491. package/workflows/dist/drift.js +5 -3
  492. package/workflows/dist/drift.js.map +1 -1
  493. package/workflows/dist/errors.d.ts +11 -11
  494. package/workflows/dist/errors.js +17 -36
  495. package/workflows/dist/errors.js.map +1 -1
  496. package/workflows/dist/fake.d.ts +0 -26
  497. package/workflows/dist/fake.js +0 -123
  498. package/workflows/dist/fake.js.map +1 -1
  499. package/workflows/dist/fakes.d.ts +2 -0
  500. package/workflows/dist/fakes.js +5 -0
  501. package/workflows/dist/fakes.js.map +1 -0
  502. package/workflows/dist/givens.d.ts +51 -0
  503. package/workflows/dist/givens.js +89 -0
  504. package/workflows/dist/givens.js.map +1 -0
  505. package/workflows/dist/host.d.ts +8 -7
  506. package/workflows/dist/host.js +1 -1
  507. package/workflows/dist/host.js.map +1 -1
  508. package/workflows/dist/identity-provisioning.d.ts +2 -5
  509. package/workflows/dist/identity-provisioning.js +16 -20
  510. package/workflows/dist/identity-provisioning.js.map +1 -1
  511. package/workflows/dist/import.d.ts +2 -0
  512. package/workflows/dist/import.js +7 -6
  513. package/workflows/dist/import.js.map +1 -1
  514. package/workflows/dist/index.d.ts +8 -7
  515. package/workflows/dist/index.js +4 -3
  516. package/workflows/dist/index.js.map +1 -1
  517. package/workflows/dist/ledger.js +8 -17
  518. package/workflows/dist/ledger.js.map +1 -1
  519. package/workflows/dist/lint.d.ts +2 -2
  520. package/workflows/dist/lint.js +8 -4
  521. package/workflows/dist/lint.js.map +1 -1
  522. package/workflows/dist/load.js +1 -1
  523. package/workflows/dist/load.js.map +1 -1
  524. package/workflows/dist/log.d.ts +0 -2
  525. package/workflows/dist/log.js +0 -11
  526. package/workflows/dist/log.js.map +1 -1
  527. package/workflows/dist/op.d.ts +103 -3
  528. package/workflows/dist/op.js +56 -6
  529. package/workflows/dist/op.js.map +1 -1
  530. package/workflows/dist/page-run.d.ts +40 -0
  531. package/workflows/dist/page-run.js +317 -0
  532. package/workflows/dist/page-run.js.map +1 -0
  533. package/workflows/dist/paths.d.ts +0 -13
  534. package/workflows/dist/paths.js +2 -46
  535. package/workflows/dist/paths.js.map +1 -1
  536. package/workflows/dist/renewal.d.ts +1 -1
  537. package/workflows/dist/renewal.js +1 -1
  538. package/workflows/dist/run.d.ts +4 -1
  539. package/workflows/dist/run.js.map +1 -1
  540. package/workflows/dist/runtime-ops.d.ts +19 -4
  541. package/workflows/dist/runtime-ops.js +34 -5
  542. package/workflows/dist/runtime-ops.js.map +1 -1
  543. package/workflows/dist/sandbox-runner.cjs +4 -4
  544. package/workflows/dist/sandbox.d.ts +0 -20
  545. package/workflows/dist/sandbox.js +23 -85
  546. package/workflows/dist/sandbox.js.map +1 -1
  547. package/workflows/dist/scenario.d.ts +19 -1
  548. package/workflows/dist/scenario.js +82 -21
  549. package/workflows/dist/scenario.js.map +1 -1
  550. package/workflows/dist/schedules.d.ts +1 -1
  551. package/workflows/dist/schedules.js +1 -1
  552. package/workflows/dist/secret.d.ts +4 -5
  553. package/workflows/dist/secret.js +7 -6
  554. package/workflows/dist/secret.js.map +1 -1
  555. package/workflows/dist/shared.d.ts +84 -7
  556. package/workflows/dist/shared.js +255 -8
  557. package/workflows/dist/shared.js.map +1 -1
  558. package/workflows/dist/sites.d.ts +5 -0
  559. package/workflows/dist/sites.js +7 -0
  560. package/workflows/dist/sites.js.map +1 -1
  561. package/workflows/dist/source.d.ts +40 -1
  562. package/workflows/dist/source.js +3 -3
  563. package/workflows/dist/source.js.map +1 -1
  564. package/workflows/dist/supervisor.d.ts +21 -18
  565. package/workflows/dist/supervisor.js +20 -22
  566. package/workflows/dist/supervisor.js.map +1 -1
  567. package/workflows/dist/tokens.d.ts +34 -0
  568. package/workflows/dist/tokens.js +70 -9
  569. package/workflows/dist/tokens.js.map +1 -1
  570. package/workflows/dist/vendor-info.d.ts +12 -3
  571. package/workflows/dist/vendor-info.js +21 -5
  572. package/workflows/dist/vendor-info.js.map +1 -1
  573. package/workflows/dist/version.js +1 -1
  574. package/workflows/dist/version.js.map +1 -1
  575. package/workflows/dist/wakeup-driver.js +1 -1
  576. package/workflows/dist/wakeup-driver.js.map +1 -1
  577. package/workflows/dist/wakeup-fake.d.ts +27 -0
  578. package/workflows/dist/wakeup-fake.js +125 -0
  579. package/workflows/dist/wakeup-fake.js.map +1 -0
  580. package/workflows/dist/wakeup-service.js +8 -24
  581. package/workflows/dist/wakeup-service.js.map +1 -1
  582. package/workflows/dist/wakeup-type.js +1 -1
  583. package/workflows/dist/wakeup-type.js.map +1 -1
  584. package/workflows/dist/worker.d.ts +19 -1
  585. package/workflows/dist/worker.js +67 -49
  586. package/workflows/dist/worker.js.map +1 -1
  587. package/workflows/drizzle/company/0007_token_handoffs.sql +8 -0
  588. package/workflows/drizzle/company/meta/0007_snapshot.json +1281 -0
  589. package/workflows/drizzle/company/meta/_journal.json +7 -0
  590. package/workflows/src/app-steps.ts +11 -0
  591. package/workflows/src/app-workflows.ts +100 -10
  592. package/workflows/src/approvals.ts +4 -2
  593. package/workflows/src/call.ts +37 -186
  594. package/workflows/src/change-steps.ts +43 -14
  595. package/workflows/src/change-workflow.ts +45 -16
  596. package/workflows/src/change.ts +39 -10
  597. package/workflows/src/client.ts +137 -62
  598. package/workflows/src/cloud-identity.ts +7 -4
  599. package/workflows/src/collection-driver.ts +230 -0
  600. package/workflows/src/collection.ts +62 -186
  601. package/workflows/src/company-file.ts +82 -0
  602. package/workflows/src/config.ts +97 -56
  603. package/workflows/src/ctx.ts +266 -0
  604. package/workflows/src/db/company.ts +15 -1
  605. package/workflows/src/db/dbos.ts +2 -0
  606. package/workflows/src/db/identity.ts +2 -2
  607. package/workflows/src/db.ts +10 -6
  608. package/workflows/src/deadlines.ts +31 -17
  609. package/workflows/src/define.ts +1 -24
  610. package/workflows/src/describe.ts +27 -5
  611. package/workflows/src/description.ts +152 -5
  612. package/workflows/src/drift.ts +8 -4
  613. package/workflows/src/errors.ts +19 -45
  614. package/workflows/src/fake.ts +4 -139
  615. package/workflows/src/fakes.ts +4 -0
  616. package/workflows/src/givens.ts +141 -0
  617. package/workflows/src/host.ts +8 -7
  618. package/workflows/src/identity-provisioning.ts +19 -30
  619. package/workflows/src/import.ts +8 -6
  620. package/workflows/src/index.ts +13 -2
  621. package/workflows/src/ledger.ts +8 -16
  622. package/workflows/src/lint.ts +12 -6
  623. package/workflows/src/load.ts +1 -1
  624. package/workflows/src/log.ts +0 -11
  625. package/workflows/src/op.ts +147 -12
  626. package/workflows/src/page-run.ts +437 -0
  627. package/workflows/src/paths.ts +2 -46
  628. package/workflows/src/renewal.ts +1 -1
  629. package/workflows/src/run.ts +4 -1
  630. package/workflows/src/runtime-ops.ts +36 -6
  631. package/workflows/src/sandbox.ts +31 -109
  632. package/workflows/src/scenario.ts +102 -19
  633. package/workflows/src/schedules.ts +1 -1
  634. package/workflows/src/secret.ts +8 -7
  635. package/workflows/src/shared.ts +304 -10
  636. package/workflows/src/sites.ts +8 -0
  637. package/workflows/src/source.ts +31 -5
  638. package/workflows/src/supervisor.ts +40 -38
  639. package/workflows/src/tokens.ts +100 -9
  640. package/workflows/src/vendor-info.ts +21 -6
  641. package/workflows/src/version.ts +1 -1
  642. package/workflows/src/wakeup-driver.ts +1 -1
  643. package/workflows/src/wakeup-fake.ts +138 -0
  644. package/workflows/src/wakeup-service.ts +8 -24
  645. package/workflows/src/wakeup-type.ts +1 -1
  646. package/workflows/src/worker.ts +121 -58
  647. package/app/dist/client/assets/ArrowUp.es-DOgvoS0P.js +0 -1
  648. package/app/dist/client/assets/Copy.es-B0D5SwiQ.js +0 -1
  649. package/app/dist/client/assets/DialogTitle-BgjYK22C.js +0 -1
  650. package/app/dist/client/assets/FloppyDisk.es-DnuNe_a8.js +0 -1
  651. package/app/dist/client/assets/Globe.es-B6x2e4-a.js +0 -1
  652. package/app/dist/client/assets/MagnifyingGlass.es-DoNoHEhT.js +0 -1
  653. package/app/dist/client/assets/Play.es-BwXalGBh.js +0 -1
  654. package/app/dist/client/assets/Plug.es-CaZsN5P-.js +0 -1
  655. package/app/dist/client/assets/Plus.es-w9VPpTJB.js +0 -1
  656. package/app/dist/client/assets/Separator-BAhKFgSd.js +0 -1
  657. package/app/dist/client/assets/X.es-DKMYClf-.js +0 -1
  658. package/app/dist/client/assets/_id-BSRAaWtO.js +0 -1
  659. package/app/dist/client/assets/_id-BjDP-cPH.js +0 -1
  660. package/app/dist/client/assets/_id-BudM76zX.js +0 -1
  661. package/app/dist/client/assets/_id-C37U5bBa.js +0 -1
  662. package/app/dist/client/assets/_id-lmg24JVh.js +0 -2
  663. package/app/dist/client/assets/_name-CylqFo_t.js +0 -1
  664. package/app/dist/client/assets/_name-D8Gl8iwy.js +0 -4
  665. package/app/dist/client/assets/_name-DdPCU8pt.js +0 -1
  666. package/app/dist/client/assets/_name-TteWQXe0.js +0 -1
  667. package/app/dist/client/assets/_vendor-BLxW83yk.js +0 -1
  668. package/app/dist/client/assets/_vendor-Bq3uZU4-.js +0 -1
  669. package/app/dist/client/assets/app-chrome-H8uZ4dHI.js +0 -16
  670. package/app/dist/client/assets/app-scope-BeUW_8Qh.js +0 -1
  671. package/app/dist/client/assets/approval-DpgmTc63.js +0 -1
  672. package/app/dist/client/assets/apps-CoWzNm8M.js +0 -1
  673. package/app/dist/client/assets/change-glance-DbYcBT7H.js +0 -1
  674. package/app/dist/client/assets/changes-DIJvP7wQ.js +0 -1
  675. package/app/dist/client/assets/chat-button-BgpOfYh1.js +0 -1
  676. package/app/dist/client/assets/chat-prompt-hiawXcK0.js +0 -1
  677. package/app/dist/client/assets/common-Dw2i6XKZ.js +0 -3
  678. package/app/dist/client/assets/composite-D9GNDzFj.js +0 -1
  679. package/app/dist/client/assets/connect-CIq2KJTz.js +0 -1
  680. package/app/dist/client/assets/connections-iqd2XbWQ.js +0 -5
  681. package/app/dist/client/assets/connectors-rI8_D1n1.js +0 -1
  682. package/app/dist/client/assets/credentials-26vu6Fv5.js +0 -1
  683. package/app/dist/client/assets/data-sDMlKaLV.js +0 -1
  684. package/app/dist/client/assets/decidable-zcYI7bY8.js +0 -1
  685. package/app/dist/client/assets/declaration-form-BtSVvxhq.js +0 -1
  686. package/app/dist/client/assets/dialog-DskpUgkl.js +0 -1
  687. package/app/dist/client/assets/existing-BD3VgJ_8.js +0 -1
  688. package/app/dist/client/assets/graph-Prxl3c55.js +0 -7
  689. package/app/dist/client/assets/grid-diff-SMsvea6t.js +0 -1
  690. package/app/dist/client/assets/hosting-BBHUppH-.js +0 -1
  691. package/app/dist/client/assets/import-B92fd4Tl.js +0 -1
  692. package/app/dist/client/assets/inbox-57oGZtxE.js +0 -1
  693. package/app/dist/client/assets/inbox-B2AMNtk5.js +0 -1
  694. package/app/dist/client/assets/index-Bn3XeKy8.js +0 -10
  695. package/app/dist/client/assets/kit-BsK6VZTQ.js +0 -1
  696. package/app/dist/client/assets/lazyRouteComponent-Uri98HNq.js +0 -1
  697. package/app/dist/client/assets/motion-C8lNeYvK.js +0 -1
  698. package/app/dist/client/assets/people-ISOMYCTu.js +0 -1
  699. package/app/dist/client/assets/permissions-Cenat84K.js +0 -2
  700. package/app/dist/client/assets/permissions-grid-B2GtGwzv.js +0 -1
  701. package/app/dist/client/assets/route-BP1XwaTB.js +0 -1
  702. package/app/dist/client/assets/route-KVU6QgwJ.js +0 -1
  703. package/app/dist/client/assets/runs-table-35lNzKLn.js +0 -1
  704. package/app/dist/client/assets/scenario-DSwsavxS.js +0 -1
  705. package/app/dist/client/assets/scenario-graph-CAzWOtqV.js +0 -1
  706. package/app/dist/client/assets/separator-BlwkzEY0.js +0 -1
  707. package/app/dist/client/assets/site-icon-DZvOfBvU.js +0 -1
  708. package/app/dist/client/assets/sites.index-CcNo6N8u.js +0 -1
  709. package/app/dist/client/assets/spinner-BGy6LWIW.js +0 -1
  710. package/app/dist/client/assets/start-form-Bgo9I63s.js +0 -1
  711. package/app/dist/client/assets/store-BGu0d2Ld.js +0 -57
  712. package/app/dist/client/assets/style-CCDLLPgG.css +0 -2
  713. package/app/dist/client/assets/table-DjbI5VTn.js +0 -1
  714. package/app/dist/client/assets/textarea-DXO0eUdp.js +0 -1
  715. package/app/dist/client/assets/useLoaderData-BQd5yMlA.js +0 -1
  716. package/app/dist/client/assets/useOpenInteractionType-Bin8RjM5.js +0 -1
  717. package/app/dist/client/assets/useRegisterFieldControl-CQPTOU7Z.js +0 -1
  718. package/app/dist/client/assets/useValueChanged-DMkuvFZG.js +0 -1
  719. package/app/dist/client/assets/utils-CMsCvwYQ.js +0 -1
  720. package/app/dist/client/assets/who-are-you-Bt1WI3Cz.js +0 -1
  721. package/app/dist/client/assets/workflow-BJpO61A-.js +0 -1
  722. package/app/dist/client/assets/workflow-view-DP-UlRiH.js +0 -1
  723. package/app/dist/client/assets/workflows-BLCBgxbx.js +0 -1
  724. package/app/dist/server/assets/app-chrome-BYS81Vnx.js +0 -1410
  725. package/app/dist/server/assets/sites.index-1l0BtgVf.js +0 -138
  726. package/app/dist/server/assets/utils-wksS9pYh.js +0 -138
  727. package/template/scenarios/publish-post/publish.feature +0 -28
  728. package/template/workflows/publish-post.ts +0 -20
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/steps/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE3C,4FAA4F;AAC5F,2FAA2F;AAC3F,iGAAiG;AACjG,6EAA6E;AAE7E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,QAAQ,GAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/steps/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtD,4FAA4F;AAC5F,2FAA2F;AAC3F,iGAAiG;AACjG,6EAA6E;AAE7E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,QAAQ,GAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type AdoptInput, type AppStepContext, type PatchInput, type PatchOutput, type Written } from "sanoma/workflows";
1
+ import { type AdoptInput, type AppStepContext, type PatchInput, type PatchOutput, type SaveDraftInput, type SaveDraftOutput, type Written } from "sanoma/workflows";
2
2
  /** The config's root, where its data files are: a config without one has none to write. */
3
3
  export declare function rootOf({ resolved }: Pick<AppStepContext, "resolved">): string;
4
4
  /**
@@ -17,13 +17,27 @@ export declare function adopt(step: AppStepContext, { runId, id, paths }: AdoptI
17
17
  * `rename` names (`renameFields`), as the run's actor, and lands it.
18
18
  * With a repository that drafts and has a remote a connector's remote half is for, it is a change:
19
19
  * the file written in a draft of its own (`ui-<id>`), committed there, and the change opened for
20
- * review (`SanomaClient.openChange`, carrying `plan` when it is the plan of the collection at `at`,
21
- * each change to a field it edits, for its review), whose
20
+ * review (`SanomaClient.openChange`, carrying `plan`, for its review and its merge), whose
22
21
  * run holds a change to the rules for `admin`; the change's run id. Otherwise the file is written
23
22
  * in the checkout and committed as Adopt does, but a change to the rules (a people file) only by
24
- * someone in `admin`: `not_approver` for anyone else, since nothing would review it. Refused
25
- * (`invalid_input`) for a declaration the description does not name, a rename the file cannot
26
- * take, and, with the writer's reason and the `field`, for a field the file computes or a
27
- * declaration that is no object literal.
23
+ * someone in `admin`: `not_approver` for anyone else, since nothing would review it (the `patch`
24
+ * run then brings the records along with the plan itself). Refused (`invalid_input`) for a
25
+ * declaration the description does not name, a plan that is not of the collection at `at` with
26
+ * each change to a field it edits, a rename the file cannot take, and, with the writer's reason and
27
+ * the `field`, for a field the file computes or a declaration that is no object literal.
28
28
  */
29
29
  export declare function patch(step: AppStepContext, { at, fields, rename, plan }: PatchInput): Promise<PatchOutput>;
30
+ /**
31
+ * A chat's draft saved, as the run's actor, the chat's person (or, for an undo of a commit their
32
+ * `chat` saved, that commit reverted first in the draft of its own, `undoDraftOf`, left as it is
33
+ * when a retry finds it open). With a remote a connector reviews changes on, its change is opened
34
+ * as saved at `head` (`ChangeInput.save`), which the policy decides: the change's run id. Otherwise
35
+ * saving is publishing: the draft at `head` merged into the checkout and closed (`Source.merge`),
36
+ * a change to the rules only by someone in `admin` (`not_approver` for anyone else, as for a
37
+ * form's Save), `main` pushed to `origin` when there is one (a push that fails is said in the
38
+ * output, never the save's failure), and the worker started again on the files (`reload`). A run
39
+ * that merged already (cut short after it) answers with that commit. Refused for a draft of
40
+ * another person's chat, a commit their chat did not save, and once the draft has moved on from
41
+ * `head`.
42
+ */
43
+ export declare function saveDraft(step: AppStepContext, { id, title, head, undo, chat, page }: SaveDraftInput): Promise<SaveDraftOutput>;
@@ -1,14 +1,13 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { readFile, writeFile } from "node:fs/promises";
3
3
  import { join, relative } from "node:path";
4
- import { ADMIN, errorMessage, isRules, mayDeclarePeople, peopleSources, remoteFor, SanomaError, } from "sanoma/workflows";
4
+ import { ADMIN, editsRules, errorMessage, isRules, mayDeclarePeople, peopleSources, remoteFor, SanomaError, } from "sanoma/workflows";
5
5
  import { describeConfig, formatOptions, NotLiteral, renameFields, setFields, } from "sanoma/workflows/describe";
6
- import { TableChangePlan } from "../components/grid/plan.js";
7
- // A data file's change from the app's own pages, in the worker (the built-ins `adopt` and
8
- // `patch`): Adopt (a drifted field's value at the vendor) and a form's Save, each written into the
9
- // checkout (or a draft of it) and committed through the worker's repository, each read, write
10
- // and commit one of the worker's writes (`AppStepContext.serially`), so two never read the same
11
- // file and both write it.
6
+ // A change from the app's own pages, in the worker (the built-ins `adopt`, `patch` and
7
+ // `save-draft`): Adopt (a drifted field's value at the vendor) and a form's Save, each written into
8
+ // the checkout (or a draft of it) and committed through the worker's repository, and a chat's
9
+ // draft saved; each read, write and commit one of the worker's writes (`AppStepContext.serially`),
10
+ // so two never read the same file and both write it.
12
11
  /** The config's root, where its data files are: a config without one has none to write. */
13
12
  export function rootOf({ resolved }) {
14
13
  if (resolved.root === undefined)
@@ -75,14 +74,14 @@ async function written(step, file, text, message) {
75
74
  * `rename` names (`renameFields`), as the run's actor, and lands it.
76
75
  * With a repository that drafts and has a remote a connector's remote half is for, it is a change:
77
76
  * the file written in a draft of its own (`ui-<id>`), committed there, and the change opened for
78
- * review (`SanomaClient.openChange`, carrying `plan` when it is the plan of the collection at `at`,
79
- * each change to a field it edits, for its review), whose
77
+ * review (`SanomaClient.openChange`, carrying `plan`, for its review and its merge), whose
80
78
  * run holds a change to the rules for `admin`; the change's run id. Otherwise the file is written
81
79
  * in the checkout and committed as Adopt does, but a change to the rules (a people file) only by
82
- * someone in `admin`: `not_approver` for anyone else, since nothing would review it. Refused
83
- * (`invalid_input`) for a declaration the description does not name, a rename the file cannot
84
- * take, and, with the writer's reason and the `field`, for a field the file computes or a
85
- * declaration that is no object literal.
80
+ * someone in `admin`: `not_approver` for anyone else, since nothing would review it (the `patch`
81
+ * run then brings the records along with the plan itself). Refused (`invalid_input`) for a
82
+ * declaration the description does not name, a plan that is not of the collection at `at` with
83
+ * each change to a field it edits, a rename the file cannot take, and, with the writer's reason and
84
+ * the `field`, for a field the file computes or a declaration that is no object literal.
86
85
  */
87
86
  export async function patch(step, { at, fields, rename = {}, plan }) {
88
87
  const root = rootOf(step);
@@ -97,12 +96,14 @@ export async function patch(step, { at, fields, rename = {}, plan }) {
97
96
  if (!named)
98
97
  throw new SanomaError("invalid_input", `${at.file}#${at.export} is not a declaration`);
99
98
  const paths = [...Object.keys(fields), ...Object.keys(rename)];
100
- // A plan is a column change's: it goes on the change only as the plan of this collection's
101
- // declaration, each of its changes to a field this patch edits, so the review says what merges.
99
+ // A plan is a column change's: only of this collection's declaration, each of its changes to a
100
+ // field this patch edits, so the review says what merges and the records follow what is written.
102
101
  const collection = description.collections.find((c) => c.declared?.at.file === at.file && c.declared.at.export === at.export);
103
- const parsed = TableChangePlan.safeParse(plan).data;
104
- const planned = parsed?.collection === collection?.name &&
105
- parsed?.changes.every((change) => paths.includes(`fields.${change.kind === "rename" ? change.from : change.kind === "convert" ? change.key : change.field}`));
102
+ if (plan &&
103
+ (plan.collection !== collection?.name ||
104
+ !plan.changes.every((change) => paths.includes(`fields.${change.kind === "rename" ? change.from : change.kind === "convert" ? change.key : change.field}`)))) {
105
+ throw new SanomaError("invalid_input", `The plan is not of the fields this saves in ${at.export}`);
106
+ }
106
107
  const message = `Change ${paths.join(", ")} of ${at.export === "default" ? at.file : at.export}`;
107
108
  /**
108
109
  * The file under `dir` as it is, and with the fields set and renamed; refused, saying why, when
@@ -143,7 +144,7 @@ export async function patch(step, { at, fields, rename = {}, plan }) {
143
144
  // No page for its pull request's status to link: the app's origin is no fact the worker has,
144
145
  // and a run's input is its starter's to choose.
145
146
  return {
146
- change: await client.openChange({ id, title: message, ...(planned && { plan }) }, { startedBy: by }),
147
+ change: await client.openChange({ id, title: message, ...(plan && { plan }) }, { startedBy: by }),
147
148
  };
148
149
  }
149
150
  catch (err) {
@@ -154,13 +155,89 @@ export async function patch(step, { at, fields, rename = {}, plan }) {
154
155
  }
155
156
  return step.serially(async () => {
156
157
  const { before, text } = await edited(root);
157
- const rules = isRules(at.file) || mayDeclarePeople(before) || peopleSources(root).has(at.file);
158
- if (rules && by.groups?.includes(ADMIN) !== true) {
159
- throw new SanomaError("not_approver", `A change to ${at.file} waits for an admin, and this company has no remote to review on`, { approver: { group: ADMIN } });
160
- }
158
+ if (isRules(at.file) || mayDeclarePeople(before) || peopleSources(root).has(at.file))
159
+ adminOnly(by, at.file);
161
160
  return written(step, at.file, text, message);
162
161
  });
163
162
  }
163
+ const savesDrafts = (source) => !!source?.draft &&
164
+ !!source.drafts &&
165
+ !!source.diff &&
166
+ !!source.merge &&
167
+ !!source.saved &&
168
+ !!source.revert &&
169
+ !!source.closeDraft;
170
+ /**
171
+ * A chat's draft saved, as the run's actor, the chat's person (or, for an undo of a commit their
172
+ * `chat` saved, that commit reverted first in the draft of its own, `undoDraftOf`, left as it is
173
+ * when a retry finds it open). With a remote a connector reviews changes on, its change is opened
174
+ * as saved at `head` (`ChangeInput.save`), which the policy decides: the change's run id. Otherwise
175
+ * saving is publishing: the draft at `head` merged into the checkout and closed (`Source.merge`),
176
+ * a change to the rules only by someone in `admin` (`not_approver` for anyone else, as for a
177
+ * form's Save), `main` pushed to `origin` when there is one (a push that fails is said in the
178
+ * output, never the save's failure), and the worker started again on the files (`reload`). A run
179
+ * that merged already (cut short after it) answers with that commit. Refused for a draft of
180
+ * another person's chat, a commit their chat did not save, and once the draft has moved on from
181
+ * `head`.
182
+ */
183
+ export async function saveDraft(step, { id, title, head, undo, chat = id, page }) {
184
+ const { client, source, by, reload, runId } = step;
185
+ if (!savesDrafts(source))
186
+ throw new Error("This instance's repository cannot save a draft");
187
+ if ((await client.chats.get(chat))?.person !== by.id) {
188
+ throw new SanomaError("invalid_input", `No draft of yours is ${chat}`);
189
+ }
190
+ if (undo !== undefined && !(await client.savedAs(chat, undo))) {
191
+ throw new SanomaError("invalid_input", `${undo.slice(0, 7)} is not a commit your chat ${chat} saved`);
192
+ }
193
+ /** What a merge landed as: `main` pushed to `origin` when it has one, then the worker started again on it. */
194
+ const landed = async ({ revision, files }) => {
195
+ const notPushed = source.pushOrigin && (await source.remoteUrl?.()) !== undefined
196
+ ? await source.pushOrigin().then(() => undefined, errorMessage)
197
+ : undefined;
198
+ reload?.();
199
+ return { revision, files, running: reload !== undefined, ...(notPushed !== undefined && { notPushed }) };
200
+ };
201
+ const merged = await source.saved(runId);
202
+ if (merged)
203
+ return landed(merged);
204
+ if (undo !== undefined && !(await source.drafts()).includes(id)) {
205
+ // A revert that fails closes its draft, so a retry reverts again.
206
+ await step.serially(() => source.revert(id, { sha: undo, author: by.id }).catch(async (err) => {
207
+ await source.closeDraft(id);
208
+ throw err;
209
+ }));
210
+ }
211
+ /** The draft's change, as long as it is still at `head`, the commit the person saved. */
212
+ const saving = async () => {
213
+ const diff = await source.diff(id);
214
+ if (head !== undefined && diff.head !== head) {
215
+ throw new SanomaError("invalid_input", "The draft has changed since: save it from its latest card");
216
+ }
217
+ return diff;
218
+ };
219
+ if (await reviewsChanges(step, source)) {
220
+ const input = { id, title, save: (await saving()).head, ...(page !== undefined && { page }) };
221
+ return { change: await client.openChange(input, { startedBy: by }) };
222
+ }
223
+ const saved = await step.serially(async () => {
224
+ const [diff, draft] = await Promise.all([saving(), source.draft(id)]);
225
+ if (await editsRules(source.root, draft.root, diff.files))
226
+ adminOnly(by, "the policies or the people");
227
+ const { revision } = await source.merge(id, { head: diff.head, title, author: by.id, run: runId });
228
+ return { revision, files: diff.files };
229
+ });
230
+ return landed(saved);
231
+ }
232
+ /**
233
+ * Refuses (`not_approver`) a change to the rules (`what` it edits) by someone outside `admin`:
234
+ * without a remote, nothing would review it.
235
+ */
236
+ function adminOnly(by, what) {
237
+ if (by.groups?.includes(ADMIN) === true)
238
+ return;
239
+ throw new SanomaError("not_approver", `A change to ${what} waits for an admin, and this company has no remote to review on`, { approver: { group: ADMIN } });
240
+ }
164
241
  /**
165
242
  * Whether a change can be reviewed: the repository drafts and has a remote that a connector's
166
243
  * remote half is for (`remoteFor`), as opening a change needs.
@@ -1 +1 @@
1
- {"version":3,"file":"writes.js","sourceRoot":"","sources":["../../src/steps/writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,KAAK,EAGL,YAAY,EACZ,OAAO,EACP,gBAAgB,EAGhB,aAAa,EACb,SAAS,EACT,WAAW,GAGZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,0FAA0F;AAC1F,mGAAmG;AACnG,8FAA8F;AAC9F,gGAAgG;AAChG,0BAA0B;AAE1B,2FAA2F;AAC3F,M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C,CAAC;QACvG,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACnG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,EAAwB,EAAE,IAAY;IACvD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI;QAAE,OAAO;IAChD,MAAM,IAAI,WAAW,CACnB,cAAc,EACd,eAAe,IAAI,kEAAkE,EACrF,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAC/B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAkB,EAAE,MAAc;IACxE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAChD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;IACvC,OAAO,GAAG,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC;AAC7E,CAAC"}
@@ -1 +1 @@
1
- "/assets/style-CCDLLPgG.css"
1
+ "/assets/style-DaqPHcI1.css"
package/app/src/api.ts CHANGED
@@ -16,11 +16,22 @@ import type {
16
16
  PreviewRequest,
17
17
  Principal,
18
18
  RunSummary,
19
+ SanomaError,
20
+ SaveView,
19
21
  } from "sanoma/workflows";
20
22
  import type { ConfigDescription, PermissionsGrid, Span } from "sanoma/workflows/describe";
21
23
  import { ConfigDescriptionSchema } from "sanoma/workflows/description";
22
24
  import type { RunCheck, Scenario } from "sanoma/workflows/scenario";
23
- import { EFFECTS, RUN_STATUSES, type Saved } from "sanoma/workflows/shared";
25
+ import {
26
+ COMMIT_ID,
27
+ DRAFT_ID,
28
+ EFFECTS,
29
+ errorCode,
30
+ errorMessage,
31
+ RUN_STATUSES,
32
+ type Saved,
33
+ vendorCodeOf,
34
+ } from "sanoma/workflows/shared";
24
35
  import { z } from "zod";
25
36
  import { ColumnChange } from "./components/grid/plan.ts";
26
37
 
@@ -155,6 +166,25 @@ export interface ChangeDetail extends ChangeView {
155
166
  edits: string[];
156
167
  }
157
168
 
169
+ /**
170
+ * A save of a chat's draft as `getSaves` reads it: the client's `SaveView`, and the config's
171
+ * workflows whose files it saved, by name (none for a save that opened a change).
172
+ */
173
+ export interface SaveDetail extends SaveView {
174
+ edits: string[];
175
+ }
176
+
177
+ /**
178
+ * What saving a chat's draft takes (`saveDraftFn`): the chat's id, and the draft's commit its card
179
+ * showed (`head`), or, to undo what it saved, that commit on `main` (`undo`).
180
+ */
181
+ export const SaveDraftRequest = z.object({
182
+ id: z.string().regex(DRAFT_ID),
183
+ head: z.string().regex(COMMIT_ID).optional(),
184
+ undo: z.string().regex(COMMIT_ID).optional(),
185
+ });
186
+ export type SaveDraftRequest = z.input<typeof SaveDraftRequest>;
187
+
158
188
  /** One run as `getRun` reads it: the run, its ledger, its approvals and a sandbox run's checks. */
159
189
  export interface RunDetail {
160
190
  run: RunSummary;
@@ -178,8 +208,16 @@ export interface RunDetail {
178
208
  * those that did not load), or the scenarios could not be read at all.
179
209
  */
180
210
  checksError?: string;
211
+ /** For a queued apply, the apply it waits for: one runs at a time (`ApplyAhead`). */
212
+ ahead?: ApplyAhead;
181
213
  }
182
214
 
215
+ /**
216
+ * The apply that a queued apply waits for, as the page names it: live applies run one at a time
217
+ * across the company's workers, so a second waits until this one ends.
218
+ */
219
+ export type ApplyAhead = Pick<RunSummary, "runId" | "status" | "startedBy" | "createdAt">;
220
+
183
221
  /**
184
222
  * A scenario as the page lists it: what it says and the input its run starts with, not how the
185
223
  * worker seeds and checks it.
@@ -190,6 +228,8 @@ export type ScenarioEntry = Pick<Scenario, "name" | "workflow" | "file" | "text"
190
228
  export interface ScenariosResponse {
191
229
  scenarios: ScenarioEntry[];
192
230
  errors: { file: string; message: string }[];
231
+ /** The world (`scenarios/world.feature`) a demo opens on (`sanoma demo`): its name and its Givens' steps, when the root has one that compiles. */
232
+ world?: { name: string; steps: string[] };
193
233
  }
194
234
 
195
235
  /**
@@ -429,7 +469,7 @@ export const INFRA = "resources/sanoma/infra.ts";
429
469
  export const DECLARE_BOX = `Coding agents work in a box of their own on a live instance, and this company declares none: declare one in ${INFRA} (\`export const box = agent37.instance({})\`, with the agent37 connector in sanoma.config.ts) and set AGENT37_API_KEY`;
430
470
 
431
471
  /**
432
- * Why a host of type `hostType` that stops when quiet has no Wakeup, `wakes` being the connected
472
+ * Why a host of type `hostType` that stops when idle has no Wakeup, `wakes` being the connected
433
473
  * wakeups and the host types each wakes, when known: going live's refusal to declare one, and
434
474
  * Hosting's notice on a host declared without one.
435
475
  */
@@ -483,11 +523,15 @@ export interface GoLiveChoices {
483
523
  /** An apply run as going live (on Hosting) follows it: its status, the plan it waits on, and what it did. */
484
524
  export interface GoLiveRun {
485
525
  runId: string;
526
+ /** Its workflow: `apply`, or the built-in going live that started it, before its apply. */
527
+ workflow: string;
486
528
  status: RunSummary["status"];
487
529
  /** What it asks a person to approve, in the Inbox; the plan. */
488
530
  pending?: { approvalId: string; plan?: ApplyPlan };
489
531
  results?: ApplyResult[];
490
532
  error?: string;
533
+ /** For a queued apply, the apply it waits for. */
534
+ ahead?: ApplyAhead;
491
535
  }
492
536
 
493
537
  /**
@@ -523,6 +567,40 @@ export interface GoLiveProgress {
523
567
  /** Where the host answers, from the last apply that made or changed it, and whether `/healthz` answers. */
524
568
  host: { url: string; healthy: boolean } | null;
525
569
  }
570
+ /**
571
+ * Where a company is, read from facts, never from how it was made (`companyStateOf`): `local`,
572
+ * nothing bound to run it online; `deploying`, going live's run under way; `live`, its host bound
573
+ * (or this instance a hosted one); `failed`, going live's latest run failed and its host is not bound.
574
+ */
575
+ export type CompanyPhase = "local" | "deploying" | "live" | "failed";
576
+
577
+ /** What going live makes, in its order: the progress list's lines. */
578
+ export const GO_LIVE_LINES = ["repository", "database", "host", "signIn"] as const;
579
+
580
+ /** A company's state (`getCompanyState`): the bar's badge, Home's last step and Hosting's panel. */
581
+ export interface CompanyState {
582
+ state: CompanyPhase;
583
+ /** Live, and this instance is on this computer: a copy the person drafts changes in. */
584
+ draftingCopy: boolean;
585
+ /** The host `infra.ts` declares: Sanoma Cloud's (its type binds its own bootstrap), one of the company's own accounts, or none. */
586
+ declared: "cloud" | "own" | null;
587
+ /** How far going live is, a line each thing it makes: done or not. */
588
+ lines: { line: (typeof GO_LIVE_LINES)[number]; done: boolean }[];
589
+ /** Going live's latest run: its apply once it started one, else the run itself; none before going live. */
590
+ run: GoLiveRun | null;
591
+ /**
592
+ * Where the host answers, and whether `/healthz` did (unknown until asked): only when Hosting
593
+ * asks (`force`), so the badge never wakes a host that stops when idle.
594
+ */
595
+ host: { url: string; healthy?: boolean } | null;
596
+ }
597
+
598
+ /** Home's setup card, in its order: each step ticked from facts (`setupProgress`). */
599
+ export const SETUP_STEPS = ["start", "agent", "try", "teammate", "online"] as const;
600
+ export type SetupStep = (typeof SETUP_STEPS)[number];
601
+ /** Whether each of Home's setup steps is done (`getSetupProgress`). */
602
+ export type SetupProgress = Record<SetupStep, boolean>;
603
+
526
604
  /** Said at the top of `infra.ts` when it declares an existing database, and on the page. */
527
605
  export const PASSWORD_NOTE = [
528
606
  "The database password is declared as a generated secret, since Supabase never reads it back.",
@@ -554,8 +632,15 @@ export type CallRequest = z.infer<typeof CallRequest>;
554
632
  export const HistoryRequest = z.object({ name: z.string().min(1), key: z.string().min(1) });
555
633
  export type HistoryRequest = z.infer<typeof HistoryRequest>;
556
634
 
557
- /** What `proposeColumnChangeFn` takes: a change to the columns of the collection `collection`. */
558
- export const ProposeColumnChange = z.object({ collection: z.string().min(1), change: ColumnChange });
635
+ /** What `getColumnPlan` takes: a change to the columns of the collection `collection`, to plan over its records. */
636
+ export const ColumnPlanRequest = z.object({ collection: z.string().min(1), change: ColumnChange });
637
+ export type ColumnPlanRequest = z.infer<typeof ColumnPlanRequest>;
638
+
639
+ /**
640
+ * What `proposeColumnChangeFn` takes: the change, and with a `clear` decision `clears`, how many
641
+ * values the person was shown it leaves empty (`getColumnPlan`'s count of those that won't convert).
642
+ */
643
+ export const ProposeColumnChange = ColumnPlanRequest.extend({ clears: z.number().int().min(0).optional() });
559
644
  export type ProposeColumnChange = z.infer<typeof ProposeColumnChange>;
560
645
 
561
646
  /** A field one write changed: its value before and after, each absent where the field was not set. */
@@ -675,6 +760,105 @@ export class ApiError extends Error {
675
760
  export const errorBodyOf = (err: unknown): ErrorResponse | undefined =>
676
761
  err instanceof ApiError ? err.body : undefined;
677
762
 
763
+ const STATUS: Partial<Record<NonNullable<ErrorResponse["code"]>, number>> = {
764
+ invalid_input: 400,
765
+ not_approver: 403,
766
+ not_admitted: 403,
767
+ policy_denied: 403,
768
+ run_not_found: 404,
769
+ no_pending_approval: 404,
770
+ already_decided: 409,
771
+ approval_withdrawn: 409,
772
+ run_ended: 409,
773
+ run_running: 409,
774
+ approval_pending: 409,
775
+ };
776
+
777
+ /**
778
+ * An ApiError for any error: the runtime's codes get their status, and anything else is a 500.
779
+ * A 500 answers only that something went wrong: its message may name internal details (a
780
+ * database host, say), so the detail goes to the log (`toApiError`), not the caller.
781
+ */
782
+ export function asApiError(err: unknown): ApiError {
783
+ if (err instanceof ApiError) return err;
784
+ const failure = err as { name?: string; code?: string; problem?: string } | null;
785
+ // These two boundaries deliberately discard provider errors. Reconstruct their safe reason
786
+ // rather than forwarding a message/cause that could include submitted authentication data.
787
+ if (failure?.name === "AuthenticationError") {
788
+ const problems = [
789
+ "missing",
790
+ "expired",
791
+ "revoked",
792
+ "rejected",
793
+ "wrong_account",
794
+ "scope_changed",
795
+ "uncertain",
796
+ "unavailable",
797
+ "unsupported",
798
+ ];
799
+ const problem = problems.includes(failure.problem ?? "") ? failure.problem! : "unavailable";
800
+ return new ApiError(400, { error: `Authentication: ${problem.replaceAll("_", " ")}` });
801
+ }
802
+ if (failure?.name === "SecretStoreError") {
803
+ const codes = [
804
+ "invalid_configuration",
805
+ "unavailable",
806
+ "denied",
807
+ "conflict",
808
+ "read_only",
809
+ "unsupported",
810
+ "too_large",
811
+ "invalid_value",
812
+ ];
813
+ const reason = codes.includes(failure.code ?? "") ? failure.code! : "unavailable";
814
+ return new ApiError(reason === "conflict" ? 409 : 400, { error: `Secret store: ${reason.replaceAll("_", " ")}` });
815
+ }
816
+ // A collection's record changed since the caller read it (`ifRecord`), or there already
817
+ // (`ifAbsent`): the caller's to resolve, with the record as it stands when the error carries it,
818
+ // or, for a batch, each entry's.
819
+ const vendorCode = vendorCodeOf(err);
820
+ if (vendorCode === "record_changed" || vendorCode === "record_exists") {
821
+ const { current, conflicts } = err as Pick<ErrorResponse, "current" | "conflicts">;
822
+ return new ApiError(409, {
823
+ error: errorMessage(err),
824
+ code: vendorCode,
825
+ ...(current !== undefined && { current }),
826
+ ...(Array.isArray(conflicts) && { conflicts }),
827
+ });
828
+ }
829
+ const code = errorCode(err);
830
+ const status = (code && STATUS[code]) || 500;
831
+ if (status === 500) return new ApiError(500, { error: "Something went wrong", ...(code ? { code } : {}) });
832
+ const body: ErrorResponse = { error: errorMessage(err), code };
833
+ // Read by property, not instanceof: DBOS hands a run's errors back as copies.
834
+ const data: Record<string, unknown> = (err as Partial<SanomaError>).data ?? {};
835
+ if (Array.isArray(data.issues)) body.issues = data.issues as InputIssue[];
836
+ // A batch's refusal names every entry the policy denied, saves and deletes alike.
837
+ if (code === "policy_denied" && Array.isArray(data.denied)) body.denied = data.denied.map(String);
838
+ if (typeof data.field === "string") body.field = data.field;
839
+ if (code === "not_approver") {
840
+ body.approver = data.approver as ErrorResponse["approver"];
841
+ if (typeof data.reason === "string") body.reason = data.reason;
842
+ }
843
+ if ((code === "approval_pending" || code === "run_running") && typeof data.runId === "string")
844
+ body.runId = data.runId;
845
+ return new ApiError(status, body);
846
+ }
847
+
848
+ /**
849
+ * What `.result` answers for a run that failed or was cancelled: the runtime's answer when its
850
+ * error has a code with a status of its own (`policy_denied`, 403), else a 422 with the run's
851
+ * failure as the run recorded it and its code (`driver_failed`), if any. The failure is the
852
+ * run's answer, so the caller sees it (a 500 would hide it, and a client would try again).
853
+ */
854
+ export function runFailure(run: Pick<RunSummary, "runId" | "status" | "error">, err: unknown): ApiError {
855
+ const answered = asApiError(err);
856
+ if (answered.status < 500) return answered;
857
+ const code = errorCode(err);
858
+ const error = run.error ?? `Run ${run.runId} ${run.status === "cancelled" ? "was cancelled" : "failed"}`;
859
+ return new ApiError(422, { error, ...(code && { code }), runId: run.runId });
860
+ }
861
+
678
862
  /** A run's short name, for a title: "Run" and its id's first 8 characters (a UUID's first group). */
679
863
  export const runName = (runId: string) => `Run ${runId.slice(runId.lastIndexOf(":") + 1).slice(0, 8)}`;
680
864