sanoma 0.11.21 → 0.11.22

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 (417) hide show
  1. package/README.md +2 -0
  2. package/app/README.md +2 -2
  3. package/app/dist/api.d.ts +16 -2
  4. package/app/dist/api.js +1 -1
  5. package/app/dist/client/assets/ArrowDown.es-BOfBLlTP.js +1 -0
  6. package/app/dist/client/assets/CaretDown.es-D12mWb2j.js +1 -0
  7. package/app/dist/client/assets/CatchBoundary-Cb__yx-s.js +1 -0
  8. package/app/dist/client/assets/Copy.es-CvUujKw7.js +1 -0
  9. package/app/dist/client/assets/DialogTitle-Dz3loDe5.js +1 -0
  10. package/app/dist/client/assets/FloppyDisk.es-CDyDob8p.js +1 -0
  11. package/app/dist/client/assets/Globe.es-C1pgZCGM.js +1 -0
  12. package/app/dist/client/assets/MagnifyingGlass.es-CZ3i6pz0.js +1 -0
  13. package/app/dist/client/assets/Play.es-DGJ1CGhp.js +1 -0
  14. package/app/dist/client/assets/Plug.es-BPhGL8MK.js +1 -0
  15. package/app/dist/client/assets/Plus.es-i3Vaa2WW.js +1 -0
  16. package/app/dist/client/assets/Separator-Cu9cQDBN.js +1 -0
  17. package/app/dist/client/assets/X.es-B7rq0E_-.js +1 -0
  18. package/app/dist/client/assets/_id-C4bMZ73g.js +1 -0
  19. package/app/dist/client/assets/_id-CUaJYD_3.js +1 -0
  20. package/app/dist/client/assets/_id-DRetx-BJ.js +1 -0
  21. package/app/dist/client/assets/_id-mm7bTIIl.js +2 -0
  22. package/app/dist/client/assets/_id-tN6nFEpD.js +1 -0
  23. package/app/dist/client/assets/_name-BOi2qVWk.js +1 -0
  24. package/app/dist/client/assets/_name-CBI1waPs.js +4 -0
  25. package/app/dist/client/assets/_name-CrsiaFT6.js +1 -0
  26. package/app/dist/client/assets/_name-TzQfjXo8.js +1 -0
  27. package/app/dist/client/assets/_vendor-C3TGvx4w.js +1 -0
  28. package/app/dist/client/assets/_vendor-sHwAlFSF.js +1 -0
  29. package/app/dist/client/assets/app-chrome-_ahvxx73.js +5 -0
  30. package/app/dist/client/assets/app-scope-Bht7PIkQ.js +1 -0
  31. package/app/dist/client/assets/approval-BFFM_yEl.js +1 -0
  32. package/app/dist/client/assets/apps-CpdXjc1j.js +1 -0
  33. package/app/dist/client/assets/button-D5kdANef.js +1 -0
  34. package/app/dist/client/assets/change-glance-CdkbSGxZ.js +1 -0
  35. package/app/dist/client/assets/changes-C_K2tazO.js +1 -0
  36. package/app/dist/client/assets/changes-DFcdyDL_.js +1 -0
  37. package/app/dist/client/assets/chat-Djbdaxw8.js +14 -0
  38. package/app/dist/client/assets/chat-button-DNusaP5n.js +1 -0
  39. package/app/dist/client/assets/chat-prompt-z0XJPDtH.js +1 -0
  40. package/app/dist/client/assets/{code-BVYaiQEr.js → code-CT4-YDKq.js} +2 -2
  41. package/app/dist/client/assets/common-DHOhx6Zn.js +3 -0
  42. package/app/dist/client/assets/composite-9cNA7N0P.js +1 -0
  43. package/app/dist/client/assets/connect-DHUdrwwW.js +1 -0
  44. package/app/dist/client/assets/connections-fGNKJl3J.js +5 -0
  45. package/app/dist/client/assets/connectors-CuS1paNm.js +1 -0
  46. package/app/dist/client/assets/credentials-Cb7Lnfxk.js +1 -0
  47. package/app/dist/client/assets/css-BGIxQoYs.js +1 -0
  48. package/app/dist/client/assets/css-DgaLhXQH.js +1 -0
  49. package/app/dist/client/assets/data-DZ-ufRXn.js +1 -0
  50. package/app/dist/client/assets/decidable-OFQBEcco.js +1 -0
  51. package/app/dist/client/assets/declaration-form-D2ZMEVC6.js +1 -0
  52. package/app/dist/client/assets/dialog-B5pmfCdJ.js +1 -0
  53. package/app/dist/client/assets/diff-woXpYk--.js +1 -0
  54. package/app/dist/client/assets/engine-CBuzy-Ik.js +1 -0
  55. package/app/dist/client/assets/existing-BaPrTDs8.js +1 -0
  56. package/app/dist/client/assets/fence-CMhOJv7H.js +157 -0
  57. package/app/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
  58. package/app/dist/client/assets/github-light-EUqPIrTm.js +1 -0
  59. package/app/dist/client/assets/graph-B5TYhcqD.js +7 -0
  60. package/app/dist/client/assets/grid-diff-wo26YSgM.js +1 -0
  61. package/app/dist/client/assets/held-card-HrJ6QpRY.js +1 -0
  62. package/app/dist/client/assets/highlighted-body-JLMTFACH-CjeaSnZq.js +1 -0
  63. package/app/dist/client/assets/hosting-Beoi95m6.js +1 -0
  64. package/app/dist/client/assets/html-BHZv6uqE.js +1 -0
  65. package/app/dist/client/assets/import-8WDFPfe6.js +1 -0
  66. package/app/dist/client/assets/inbox-B9hsZPsC.js +1 -0
  67. package/app/dist/client/assets/inbox-DM2npRZI.js +1 -0
  68. package/app/dist/client/assets/index-CHKfukjt.js +10 -0
  69. package/app/dist/client/assets/item-B4QRpXse.js +1 -0
  70. package/app/dist/client/assets/javascript-BzbQS41l.js +1 -0
  71. package/app/dist/client/assets/javascript-CpIGwZ_Y.js +1 -0
  72. package/app/dist/client/assets/json-qhed-kSA.js +1 -0
  73. package/app/dist/client/assets/jsx-Bz0zcwM4.js +1 -0
  74. package/app/dist/client/assets/kit-n8CE0xEs.js +1 -0
  75. package/app/dist/client/assets/lazyRouteComponent-DezoGNoN.js +1 -0
  76. package/app/dist/client/assets/markdown-BYOwaDjH.js +1 -0
  77. package/app/dist/client/assets/markdown-DS_nKu0s.js +164 -0
  78. package/app/dist/client/assets/mermaid-WFAXDIZX-DQBKIf0O.js +1 -0
  79. package/app/dist/client/assets/motion-D6e1hqz4.js +1 -0
  80. package/app/dist/client/assets/people-BiiQfYJ8.js +1 -0
  81. package/app/dist/client/assets/permissions-BmKxEfBi.js +2 -0
  82. package/app/dist/client/assets/permissions-grid-B755bq5J.js +1 -0
  83. package/app/dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  84. package/app/dist/client/assets/python-gzcpVVnB.js +1 -0
  85. package/app/dist/client/assets/queries-DGlVu9wp.js +57 -0
  86. package/app/dist/client/assets/react-dom-D6fTz1bt.js +1 -0
  87. package/app/dist/client/assets/route-BSe5L2p4.js +1 -0
  88. package/app/dist/client/assets/route-Ds87ixtB.js +1 -0
  89. package/app/dist/client/assets/runs-table-DMiD4HeY.js +1 -0
  90. package/app/dist/client/assets/scenario-DrgmfuFx.js +1 -0
  91. package/app/dist/client/assets/scenario-graph-Blv2e1PV.js +1 -0
  92. package/app/dist/client/assets/separator-Bdtc7rou.js +1 -0
  93. package/app/dist/client/assets/{sheet-BYL9XU5s.js → sheet-BKUFUA1l.js} +1 -1
  94. package/app/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
  95. package/app/dist/client/assets/site-icon-1Mcc1UIb.js +1 -0
  96. package/app/dist/client/assets/sites.index-K4mrFsLr.js +1 -0
  97. package/app/dist/client/assets/spinner-XaRXIj9W.js +1 -0
  98. package/app/dist/client/assets/sql-CEbI0hMM.js +1 -0
  99. package/app/dist/client/assets/start-form-CJ6VmNPY.js +1 -0
  100. package/app/dist/client/assets/store-BT988jIX.js +1 -0
  101. package/app/dist/client/assets/style-CTcG_5y0.css +2 -0
  102. package/app/dist/client/assets/table-B81tv0LG.js +1 -0
  103. package/app/dist/client/assets/textarea-CRpYU-qx.js +1 -0
  104. package/app/dist/client/assets/tsx-udAQXfEw.js +1 -0
  105. package/app/dist/client/assets/typescript-bsJCZSQ-.js +1 -0
  106. package/app/dist/client/assets/{useLoaderData-BQd5yMlA.js → useLoaderData-BsksXf-p.js} +1 -1
  107. package/app/dist/client/assets/useOpenInteractionType-UhakpAXY.js +1 -0
  108. package/app/dist/client/assets/useRegisterFieldControl-DIkKUJkh.js +1 -0
  109. package/app/dist/client/assets/useValueChanged-DBqn456b.js +1 -0
  110. package/app/dist/client/assets/utils-BRvE9-Fo.js +1 -0
  111. package/app/dist/client/assets/who-are-you-DUoVqvfP.js +1 -0
  112. package/app/dist/client/assets/workflow-lQtyyxKx.js +1 -0
  113. package/app/dist/client/assets/workflow-view-hk_RU9WF.js +1 -0
  114. package/app/dist/client/assets/workflows-DFB7lzzN.js +1 -0
  115. package/app/dist/client/assets/yaml-rwi0_p6S.js +1 -0
  116. package/app/dist/index.d.ts +4 -4
  117. package/app/dist/lib/chat.d.ts +64 -19
  118. package/app/dist/lib/chat.js +54 -18
  119. package/app/dist/lib/chat.js.map +1 -1
  120. package/app/dist/server/assets/{_id-wuJIq2ZZ.js → _id--MWJXj9R.js} +2 -2
  121. package/app/dist/server/assets/{_id-ce1EGp7Y.js → _id-BEGe86NW.js} +2 -2
  122. package/app/dist/server/assets/{_id-BViXAagq.js → _id-CbO7Ok0w.js} +12 -10
  123. package/app/dist/server/assets/{_id-Dt9tTylX.js → _id-DwdpIYKk.js} +2 -2
  124. package/app/dist/server/assets/{_id-wB8khGTz.js → _id-fK_nPFHK.js} +6 -6
  125. package/app/dist/server/assets/{_name-D_-MhjNf.js → _name-BzD9TxVC.js} +17 -17
  126. package/app/dist/server/assets/{_name-BqFwnyf7.js → _name-ClgMsl5m.js} +2 -2
  127. package/app/dist/server/assets/{_name-BGagGBjX.js → _name-DdFVsjcj.js} +7 -7
  128. package/app/dist/server/assets/{_name-DntbHE-b.js → _name-Dyh4G9Oy.js} +10 -11
  129. package/app/dist/server/assets/{_tanstack-start-manifest_v-BljuBM-G.js → _tanstack-start-manifest_v-DUtnBg7y.js} +101 -91
  130. package/app/dist/server/assets/{_vendor-CNB03LWX.js → _vendor-DyeUY8kH.js} +8 -8
  131. package/app/dist/server/assets/{_vendor-CcEviOki.js → _vendor-W3KKSusM.js} +2 -2
  132. package/app/dist/server/assets/{actor-D6iA0pDg.js → actor-BlaOwG6A.js} +1 -1
  133. package/app/dist/server/assets/app-chrome-BJlxsc9y.js +2116 -0
  134. package/app/dist/server/assets/{app-scope-CXIgOFmi.js → app-scope-ASuhE3xI.js} +2 -2
  135. package/app/dist/server/assets/{apply-plan-ybBda6vQ.js → apply-plan-Djw1tNPD.js} +8 -7
  136. package/app/dist/server/assets/{approval-Su315ikC.js → approval-BjTnfr1U.js} +15 -13
  137. package/app/dist/server/assets/{apps-xwQAehch.js → apps-C28F9Y5C.js} +7 -7
  138. package/app/dist/server/assets/button-Xwx3rpQ0.js +43 -0
  139. package/app/dist/server/assets/change-glance-Bc4htVPy.js +54 -0
  140. package/app/dist/server/assets/{change-glance-CpArIbGS.js → changes-B5P8BJSf.js} +2 -54
  141. package/app/dist/server/assets/{changes-Bc_OiDBD.js → changes-tbeMKxjY.js} +8 -7
  142. package/app/dist/server/assets/{chat-DMN_hoKm.js → chat-BNMeLc9V.js} +108 -30
  143. package/app/dist/server/assets/{chat-button-LtA80MoR.js → chat-button-SluTWK8R.js} +2 -2
  144. package/app/dist/server/assets/{code-COyt8L-n.js → code-hVpCkmAZ.js} +1 -1
  145. package/app/dist/server/assets/{common-CWHLj7KV.js → common-DpZcJvCy.js} +26 -24
  146. package/app/dist/server/assets/{connect-BpPiu5s6.js → connect-Cljunav2.js} +11 -10
  147. package/app/dist/server/assets/{connections-DBgb1bvX.js → connections-Cfz5LMy5.js} +12 -11
  148. package/app/dist/server/assets/{connectors-5a5_SlHO.js → connectors-tt9BF9L1.js} +8 -8
  149. package/app/dist/server/assets/{credentials-ud_Y68hx.js → credentials-CYUFAVU8.js} +10 -9
  150. package/app/dist/server/assets/{data-aEdhwcqy.js → data-D91ZZ5St.js} +7 -7
  151. package/app/dist/server/assets/{declaration-form-Dfg1yNuY.js → declaration-form-BzISD6gw.js} +7 -6
  152. package/app/dist/server/assets/{dialog-BGjiw3Dx.js → dialog-T0bzlKzs.js} +2 -2
  153. package/app/dist/server/assets/{dropdown-menu-DAC3LWas.js → dropdown-menu-RGvPORm4.js} +1 -1
  154. package/app/dist/server/assets/{existing-B4d4NrC8.js → existing-BZym0xE2.js} +8 -7
  155. package/app/dist/server/assets/fence-Br7MPP41.js +130 -0
  156. package/app/dist/server/assets/{field-C0Xx_90s.js → field-DFpkT1id.js} +1 -1
  157. package/app/dist/server/assets/{functions-BvFYzabD.js → functions-sf07C1qn.js} +2 -2
  158. package/app/dist/server/assets/{graph-qYOdoz2s.js → graph-C1Cl7owl.js} +5 -5
  159. package/app/dist/server/assets/{grid-diff-jTvp-8wS.js → grid-diff-D5bQDKl2.js} +1 -1
  160. package/app/dist/server/assets/held-card-CDewk4rs.js +75 -0
  161. package/app/dist/server/assets/{hosting-bbn9UvDc.js → hosting-O-l2L0ec.js} +16 -14
  162. package/app/dist/server/assets/{import-DIwvzHb6.js → import-qvpEIYFx.js} +8 -8
  163. package/app/dist/server/assets/{inbox-D6R6sWBB.js → inbox-BcJxCIPm.js} +8 -8
  164. package/app/dist/server/assets/{inbox-Dj-5FleF.js → inbox-BvpSeC3M.js} +2 -2
  165. package/app/dist/server/assets/{input-D63gF3G2.js → input-CF-vX8Xp.js} +1 -1
  166. package/app/dist/server/assets/{item-BDSXoEr_.js → item-LBDNja5f.js} +1 -1
  167. package/app/dist/server/assets/{kit-D6EulwBe.js → kit-DlT_THim.js} +2 -2
  168. package/app/dist/server/assets/markdown-BExKjghi.js +116 -0
  169. package/app/dist/server/assets/{middleware-B8JRLyxx.js → middleware-B6RPW0fH.js} +1 -1
  170. package/app/dist/server/assets/{people-CkU_AxrV.js → people-C8VXQrKg.js} +13 -12
  171. package/app/dist/server/assets/{permissions-BfMcQqQb.js → permissions-COAiOoCB.js} +9 -8
  172. package/app/dist/server/assets/{permissions-grid-DWP9FAAS.js → permissions-grid-CcYUiqhD.js} +4 -4
  173. package/app/dist/server/assets/{button-f9Lc8qLl.js → queries-DJcZ4mzA.js} +3 -45
  174. package/app/dist/server/assets/{route-BTT7nMJq.js → route-DOqitvxL.js} +2 -2
  175. package/app/dist/server/assets/{route-CF_8jQYY.js → route-aa9MThMA.js} +2 -2
  176. package/app/dist/server/assets/{router-BvYtxrVN.js → router-Co6gRNI1.js} +80 -46
  177. package/app/dist/server/assets/{runs-table-BBudn12Y.js → runs-table-BtGm2KOO.js} +6 -6
  178. package/app/dist/server/assets/{scenario-BXGTSTiP.js → scenario-DidUafqw.js} +5 -5
  179. package/app/dist/server/assets/{separator-8MZ7vR3f.js → separator-Cf98V8ie.js} +1 -1
  180. package/app/dist/server/assets/{sheet-5Cyp-4UW.js → sheet-DTOG7OHQ.js} +2 -2
  181. package/app/dist/server/assets/{sites.index-1l0BtgVf.js → sites.index-4TK8c0QC.js} +4 -4
  182. package/app/dist/server/assets/{spinner-C1ZW08lp.js → spinner-016IPVi-.js} +1 -1
  183. package/app/dist/server/assets/{start-CSU4irVK.js → start-VfVsXenI.js} +2 -2
  184. package/app/dist/server/assets/{start-form-DI60UOrc.js → start-form-CUeEdeP7.js} +10 -9
  185. package/app/dist/server/assets/{table-DtPk_h_5.js → table-y-dGlLx6.js} +1 -1
  186. package/app/dist/server/assets/{textarea-f0Ip5ed1.js → textarea-B02joDnr.js} +1 -1
  187. package/app/dist/server/assets/utils-CHesvfjo.js +138 -0
  188. package/app/dist/server/assets/{who-are-you-ZGyMnpVi.js → who-are-you-DW5qmIzp.js} +8 -7
  189. package/app/dist/server/assets/{workflow-Z99QWO42.js → workflow-BRu7ljgU.js} +5 -5
  190. package/app/dist/server/assets/{workflow-view-C8X8U11S.js → workflow-view-yF48p1lu.js} +14 -13
  191. package/app/dist/server/assets/{workflows-C0kJoGf1.js → workflows-DL-TJFLt.js} +13 -14
  192. package/app/dist/server/chat.d.ts +6 -1
  193. package/app/dist/server/chat.js +39 -20
  194. package/app/dist/server/chat.js.map +1 -1
  195. package/app/dist/server/server.js +48 -48
  196. package/app/dist/steps/agent/acp.d.ts +3 -97
  197. package/app/dist/steps/agent/acp.js +19 -49
  198. package/app/dist/steps/agent/acp.js.map +1 -1
  199. package/app/dist/steps/agent/checkout.d.ts +18 -1
  200. package/app/dist/steps/agent/checkout.js +17 -0
  201. package/app/dist/steps/agent/checkout.js.map +1 -1
  202. package/app/dist/steps/agent/harness.d.ts +2 -4
  203. package/app/dist/steps/agent/harness.js +45 -61
  204. package/app/dist/steps/agent/harness.js.map +1 -1
  205. package/app/dist/steps/agent/prompt.d.ts +1 -1
  206. package/app/dist/steps/agent/prompt.js +35 -14
  207. package/app/dist/steps/agent/prompt.js.map +1 -1
  208. package/app/dist/steps/agent/transcript.d.ts +10 -1
  209. package/app/dist/steps/agent/transcript.js +75 -2
  210. package/app/dist/steps/agent/transcript.js.map +1 -1
  211. package/app/dist/steps/agent/turn.d.ts +4 -6
  212. package/app/dist/steps/agent/turn.js +14 -16
  213. package/app/dist/steps/agent/turn.js.map +1 -1
  214. package/app/dist/stylesheet.json +1 -1
  215. package/app/src/api.ts +1 -1
  216. package/app/src/components/app-chrome.tsx +28 -13
  217. package/app/src/components/common.tsx +1 -24
  218. package/app/src/components/logo.tsx +25 -0
  219. package/app/src/components/shell/chat-parts.tsx +185 -126
  220. package/app/src/components/shell/chat-prompt.ts +6 -2
  221. package/app/src/components/shell/chat.tsx +154 -220
  222. package/app/src/components/shell/composer.tsx +140 -0
  223. package/app/src/components/shell/connect-agent.tsx +157 -0
  224. package/app/src/components/shell/engine-mark.tsx +9 -0
  225. package/app/src/components/shell/fence.tsx +25 -0
  226. package/app/src/components/shell/held-card.tsx +58 -0
  227. package/app/src/components/shell/markdown.tsx +152 -0
  228. package/app/src/components/shell/nav-user.tsx +11 -1
  229. package/app/src/components/shell/prefs.ts +9 -1
  230. package/app/src/components/shell/thread.tsx +174 -0
  231. package/app/src/components/ui/bubble.tsx +117 -0
  232. package/app/src/components/ui/code-block.tsx +235 -0
  233. package/app/src/components/ui/input-group.tsx +136 -0
  234. package/app/src/components/ui/marker.tsx +67 -0
  235. package/app/src/components/ui/message-scroller.tsx +117 -0
  236. package/app/src/components/ui/message.tsx +74 -0
  237. package/app/src/components/ui/trace.tsx +133 -0
  238. package/app/src/hooks/use-highlighted-code.ts +72 -0
  239. package/app/src/index.ts +4 -4
  240. package/app/src/lib/chat.ts +110 -22
  241. package/app/src/lib/cn-tables.ts +23 -23
  242. package/app/src/lib/highlighter.tsx +114 -0
  243. package/app/src/routes/__root.tsx +7 -4
  244. package/app/src/routes/connectors/index.tsx +1 -1
  245. package/app/src/routes/hosting/index.tsx +6 -9
  246. package/app/src/server/chat.ts +41 -19
  247. package/app/src/steps/agent/acp.ts +10 -80
  248. package/app/src/steps/agent/checkout.ts +30 -0
  249. package/app/src/steps/agent/harness.ts +53 -78
  250. package/app/src/steps/agent/prompt.ts +42 -14
  251. package/app/src/steps/agent/transcript.ts +90 -3
  252. package/app/src/steps/agent/turn.ts +18 -16
  253. package/app/src/worker/app.ts +6 -5
  254. package/dist/cli.js +18 -6
  255. package/dist/cli.js.map +1 -1
  256. package/dist/serve.js +1 -1
  257. package/dist/serve.js.map +1 -1
  258. package/dist/worker-port.d.ts +16 -2
  259. package/dist/worker-port.js +44 -5
  260. package/dist/worker-port.js.map +1 -1
  261. package/package.json +7 -3
  262. package/testing/README.md +3 -3
  263. package/testing/dist/build.d.ts +3 -3
  264. package/testing/dist/build.js +4 -4
  265. package/testing/dist/build.js.map +1 -1
  266. package/testing/dist/host.d.ts +34 -21
  267. package/testing/dist/host.js +135 -75
  268. package/testing/dist/host.js.map +1 -1
  269. package/workflows/CLOUD-IDENTITY.md +15 -20
  270. package/workflows/README.md +9 -7
  271. package/workflows/dist/client.d.ts +5 -3
  272. package/workflows/dist/client.js +4 -3
  273. package/workflows/dist/client.js.map +1 -1
  274. package/workflows/dist/cloud-identity.d.ts +5 -2
  275. package/workflows/dist/cloud-identity.js +7 -4
  276. package/workflows/dist/cloud-identity.js.map +1 -1
  277. package/workflows/dist/config.d.ts +7 -1
  278. package/workflows/dist/config.js +24 -1
  279. package/workflows/dist/config.js.map +1 -1
  280. package/workflows/dist/db/company.d.ts +1 -1
  281. package/workflows/dist/db/company.js +1 -1
  282. package/workflows/dist/db/identity.d.ts +2 -2
  283. package/workflows/dist/db/identity.js +2 -2
  284. package/workflows/dist/db/identity.js.map +1 -1
  285. package/workflows/dist/deadlines.d.ts +7 -2
  286. package/workflows/dist/deadlines.js +14 -5
  287. package/workflows/dist/deadlines.js.map +1 -1
  288. package/workflows/dist/describe.js +15 -3
  289. package/workflows/dist/describe.js.map +1 -1
  290. package/workflows/dist/description.d.ts +37 -2
  291. package/workflows/dist/description.js +22 -1
  292. package/workflows/dist/description.js.map +1 -1
  293. package/workflows/dist/host.d.ts +7 -6
  294. package/workflows/dist/host.js +1 -1
  295. package/workflows/dist/host.js.map +1 -1
  296. package/workflows/dist/identity-provisioning.d.ts +2 -5
  297. package/workflows/dist/identity-provisioning.js +16 -20
  298. package/workflows/dist/identity-provisioning.js.map +1 -1
  299. package/workflows/dist/index.d.ts +3 -3
  300. package/workflows/dist/index.js +1 -1
  301. package/workflows/dist/index.js.map +1 -1
  302. package/workflows/dist/op.d.ts +92 -1
  303. package/workflows/dist/op.js +19 -6
  304. package/workflows/dist/op.js.map +1 -1
  305. package/workflows/dist/renewal.d.ts +1 -1
  306. package/workflows/dist/renewal.js +1 -1
  307. package/workflows/dist/runtime-ops.d.ts +3 -4
  308. package/workflows/dist/runtime-ops.js +4 -4
  309. package/workflows/dist/runtime-ops.js.map +1 -1
  310. package/workflows/dist/schedules.d.ts +1 -1
  311. package/workflows/dist/schedules.js +1 -1
  312. package/workflows/dist/supervisor.d.ts +21 -18
  313. package/workflows/dist/supervisor.js +20 -22
  314. package/workflows/dist/supervisor.js.map +1 -1
  315. package/workflows/dist/vendor-info.d.ts +12 -3
  316. package/workflows/dist/vendor-info.js +20 -4
  317. package/workflows/dist/vendor-info.js.map +1 -1
  318. package/workflows/dist/worker.d.ts +11 -1
  319. package/workflows/dist/worker.js +9 -3
  320. package/workflows/dist/worker.js.map +1 -1
  321. package/workflows/src/client.ts +9 -6
  322. package/workflows/src/cloud-identity.ts +7 -4
  323. package/workflows/src/config.ts +36 -1
  324. package/workflows/src/db/company.ts +1 -1
  325. package/workflows/src/db/identity.ts +2 -2
  326. package/workflows/src/deadlines.ts +18 -8
  327. package/workflows/src/describe.ts +16 -3
  328. package/workflows/src/description.ts +25 -1
  329. package/workflows/src/host.ts +7 -6
  330. package/workflows/src/identity-provisioning.ts +19 -30
  331. package/workflows/src/index.ts +7 -1
  332. package/workflows/src/op.ts +104 -10
  333. package/workflows/src/renewal.ts +1 -1
  334. package/workflows/src/runtime-ops.ts +5 -5
  335. package/workflows/src/schedules.ts +1 -1
  336. package/workflows/src/supervisor.ts +40 -38
  337. package/workflows/src/vendor-info.ts +20 -5
  338. package/workflows/src/worker.ts +22 -5
  339. package/app/dist/client/assets/ArrowUp.es-DOgvoS0P.js +0 -1
  340. package/app/dist/client/assets/Copy.es-B0D5SwiQ.js +0 -1
  341. package/app/dist/client/assets/DialogTitle-BgjYK22C.js +0 -1
  342. package/app/dist/client/assets/FloppyDisk.es-DnuNe_a8.js +0 -1
  343. package/app/dist/client/assets/Globe.es-B6x2e4-a.js +0 -1
  344. package/app/dist/client/assets/MagnifyingGlass.es-DoNoHEhT.js +0 -1
  345. package/app/dist/client/assets/Play.es-BwXalGBh.js +0 -1
  346. package/app/dist/client/assets/Plug.es-CaZsN5P-.js +0 -1
  347. package/app/dist/client/assets/Plus.es-w9VPpTJB.js +0 -1
  348. package/app/dist/client/assets/Separator-BAhKFgSd.js +0 -1
  349. package/app/dist/client/assets/X.es-DKMYClf-.js +0 -1
  350. package/app/dist/client/assets/_id-BSRAaWtO.js +0 -1
  351. package/app/dist/client/assets/_id-BjDP-cPH.js +0 -1
  352. package/app/dist/client/assets/_id-BudM76zX.js +0 -1
  353. package/app/dist/client/assets/_id-C37U5bBa.js +0 -1
  354. package/app/dist/client/assets/_id-lmg24JVh.js +0 -2
  355. package/app/dist/client/assets/_name-CylqFo_t.js +0 -1
  356. package/app/dist/client/assets/_name-D8Gl8iwy.js +0 -4
  357. package/app/dist/client/assets/_name-DdPCU8pt.js +0 -1
  358. package/app/dist/client/assets/_name-TteWQXe0.js +0 -1
  359. package/app/dist/client/assets/_vendor-BLxW83yk.js +0 -1
  360. package/app/dist/client/assets/_vendor-Bq3uZU4-.js +0 -1
  361. package/app/dist/client/assets/app-chrome-H8uZ4dHI.js +0 -16
  362. package/app/dist/client/assets/app-scope-BeUW_8Qh.js +0 -1
  363. package/app/dist/client/assets/approval-DpgmTc63.js +0 -1
  364. package/app/dist/client/assets/apps-CoWzNm8M.js +0 -1
  365. package/app/dist/client/assets/change-glance-DbYcBT7H.js +0 -1
  366. package/app/dist/client/assets/changes-DIJvP7wQ.js +0 -1
  367. package/app/dist/client/assets/chat-button-BgpOfYh1.js +0 -1
  368. package/app/dist/client/assets/chat-prompt-hiawXcK0.js +0 -1
  369. package/app/dist/client/assets/common-Dw2i6XKZ.js +0 -3
  370. package/app/dist/client/assets/composite-D9GNDzFj.js +0 -1
  371. package/app/dist/client/assets/connect-CIq2KJTz.js +0 -1
  372. package/app/dist/client/assets/connections-iqd2XbWQ.js +0 -5
  373. package/app/dist/client/assets/connectors-rI8_D1n1.js +0 -1
  374. package/app/dist/client/assets/credentials-26vu6Fv5.js +0 -1
  375. package/app/dist/client/assets/data-sDMlKaLV.js +0 -1
  376. package/app/dist/client/assets/decidable-zcYI7bY8.js +0 -1
  377. package/app/dist/client/assets/declaration-form-BtSVvxhq.js +0 -1
  378. package/app/dist/client/assets/dialog-DskpUgkl.js +0 -1
  379. package/app/dist/client/assets/existing-BD3VgJ_8.js +0 -1
  380. package/app/dist/client/assets/graph-Prxl3c55.js +0 -7
  381. package/app/dist/client/assets/grid-diff-SMsvea6t.js +0 -1
  382. package/app/dist/client/assets/hosting-BBHUppH-.js +0 -1
  383. package/app/dist/client/assets/import-B92fd4Tl.js +0 -1
  384. package/app/dist/client/assets/inbox-57oGZtxE.js +0 -1
  385. package/app/dist/client/assets/inbox-B2AMNtk5.js +0 -1
  386. package/app/dist/client/assets/index-Bn3XeKy8.js +0 -10
  387. package/app/dist/client/assets/kit-BsK6VZTQ.js +0 -1
  388. package/app/dist/client/assets/lazyRouteComponent-Uri98HNq.js +0 -1
  389. package/app/dist/client/assets/motion-C8lNeYvK.js +0 -1
  390. package/app/dist/client/assets/people-ISOMYCTu.js +0 -1
  391. package/app/dist/client/assets/permissions-Cenat84K.js +0 -2
  392. package/app/dist/client/assets/permissions-grid-B2GtGwzv.js +0 -1
  393. package/app/dist/client/assets/route-BP1XwaTB.js +0 -1
  394. package/app/dist/client/assets/route-KVU6QgwJ.js +0 -1
  395. package/app/dist/client/assets/runs-table-35lNzKLn.js +0 -1
  396. package/app/dist/client/assets/scenario-DSwsavxS.js +0 -1
  397. package/app/dist/client/assets/scenario-graph-CAzWOtqV.js +0 -1
  398. package/app/dist/client/assets/separator-BlwkzEY0.js +0 -1
  399. package/app/dist/client/assets/site-icon-DZvOfBvU.js +0 -1
  400. package/app/dist/client/assets/sites.index-CcNo6N8u.js +0 -1
  401. package/app/dist/client/assets/spinner-BGy6LWIW.js +0 -1
  402. package/app/dist/client/assets/start-form-Bgo9I63s.js +0 -1
  403. package/app/dist/client/assets/store-BGu0d2Ld.js +0 -57
  404. package/app/dist/client/assets/style-CCDLLPgG.css +0 -2
  405. package/app/dist/client/assets/table-DjbI5VTn.js +0 -1
  406. package/app/dist/client/assets/textarea-DXO0eUdp.js +0 -1
  407. package/app/dist/client/assets/useOpenInteractionType-Bin8RjM5.js +0 -1
  408. package/app/dist/client/assets/useRegisterFieldControl-CQPTOU7Z.js +0 -1
  409. package/app/dist/client/assets/useValueChanged-DMkuvFZG.js +0 -1
  410. package/app/dist/client/assets/utils-CMsCvwYQ.js +0 -1
  411. package/app/dist/client/assets/who-are-you-Bt1WI3Cz.js +0 -1
  412. package/app/dist/client/assets/workflow-BJpO61A-.js +0 -1
  413. package/app/dist/client/assets/workflow-view-DP-UlRiH.js +0 -1
  414. package/app/dist/client/assets/workflows-BLCBgxbx.js +0 -1
  415. package/app/dist/server/assets/app-chrome-BYS81Vnx.js +0 -1410
  416. package/app/dist/server/assets/native-select-DLa-He0n.js +0 -37
  417. package/app/dist/server/assets/utils-wksS9pYh.js +0 -138
@@ -0,0 +1,114 @@
1
+ import * as React from "react";
2
+ import { createHighlighterCore, type GrammarState, type HighlighterCore } from "shiki/core";
3
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
4
+
5
+ // Add the languages you need. Each one loads the first time it is used.
6
+ const languages = {
7
+ bash: () => import("shiki/langs/shellscript.mjs"),
8
+ css: () => import("shiki/langs/css.mjs"),
9
+ diff: () => import("shiki/langs/diff.mjs"),
10
+ html: () => import("shiki/langs/html.mjs"),
11
+ javascript: () => import("shiki/langs/javascript.mjs"),
12
+ json: () => import("shiki/langs/json.mjs"),
13
+ jsx: () => import("shiki/langs/jsx.mjs"),
14
+ markdown: () => import("shiki/langs/markdown.mjs"),
15
+ python: () => import("shiki/langs/python.mjs"),
16
+ sql: () => import("shiki/langs/sql.mjs"),
17
+ tsx: () => import("shiki/langs/tsx.mjs"),
18
+ typescript: () => import("shiki/langs/typescript.mjs"),
19
+ yaml: () => import("shiki/langs/yaml.mjs"),
20
+ };
21
+
22
+ const aliases: Record<string, keyof typeof languages> = {
23
+ js: "javascript",
24
+ md: "markdown",
25
+ py: "python",
26
+ sh: "bash",
27
+ shell: "bash",
28
+ shellscript: "bash",
29
+ ts: "typescript",
30
+ yml: "yaml",
31
+ zsh: "bash",
32
+ };
33
+
34
+ let highlighter: Promise<HighlighterCore> | undefined;
35
+
36
+ function getHighlighter() {
37
+ highlighter ??= createHighlighterCore({
38
+ themes: [import("shiki/themes/github-light.mjs"), import("shiki/themes/github-dark.mjs")],
39
+ langs: [],
40
+ engine: createJavaScriptRegexEngine({ forgiving: true }),
41
+ });
42
+
43
+ return highlighter;
44
+ }
45
+
46
+ function getLanguage(language: string) {
47
+ const name = language.toLowerCase();
48
+
49
+ if (name === "ansi") {
50
+ return name;
51
+ }
52
+
53
+ if (name in languages) {
54
+ return name as keyof typeof languages;
55
+ }
56
+
57
+ return aliases[name] ?? null;
58
+ }
59
+
60
+ // Loads a language and returns a highlighter for it, or null for a language
61
+ // that is not listed.
62
+ export async function loadHighlighter(language: string) {
63
+ const lang = getLanguage(language);
64
+
65
+ if (!lang) {
66
+ return null;
67
+ }
68
+
69
+ const shiki = await getHighlighter();
70
+
71
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) {
72
+ await shiki.loadLanguage(languages[lang]);
73
+ }
74
+
75
+ return {
76
+ // Returns one React node per line, and the grammar state after the last
77
+ // line. Pass that state back to continue where the code left off.
78
+ highlight(code: string, state?: GrammarState) {
79
+ const tokenize = (text: string) =>
80
+ shiki.codeToTokens(text, {
81
+ lang,
82
+ themes: { light: "github-light", dark: "github-dark" },
83
+ defaultColor: false,
84
+ grammarState: state,
85
+ }).tokens;
86
+
87
+ // ANSI has no grammar state, so each line is tokenized on its own and
88
+ // gets the same colors whether it arrives in one piece or streams.
89
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
90
+
91
+ return {
92
+ lines: tokens.map((line) =>
93
+ line.map((token, index) => (
94
+ <span
95
+ key={index}
96
+ style={token.htmlStyle as React.CSSProperties}
97
+ className="text-(--shiki-light) dark:text-(--shiki-dark)"
98
+ >
99
+ {token.content}
100
+ </span>
101
+ )),
102
+ ),
103
+ state: shiki.getLastGrammarState(tokens),
104
+ };
105
+ },
106
+ };
107
+ }
108
+
109
+ // Returns one React node per line, or null for a language that is not listed.
110
+ export async function highlightCode(code: string, language: string) {
111
+ const highlighter = await loadHighlighter(language);
112
+
113
+ return highlighter ? highlighter.highlight(code).lines : null;
114
+ }
@@ -5,7 +5,7 @@ import { getCookie } from "@tanstack/react-start/server";
5
5
  import { ThemeProvider } from "next-themes";
6
6
  import { lazy, type ReactNode } from "react";
7
7
  import { DENSITY_COOKIE } from "#/components/density.tsx";
8
- import { CHAT_COOKIE, chatPref, type ChatPref } from "#/components/shell/prefs.ts";
8
+ import { CHAT_COOKIE, chatPref, type ChatPref, ENGINE_COOKIE } from "#/components/shell/prefs.ts";
9
9
  import { defaultLocaleOf, type PageLanguages, pageLanguages, usePageLanguages } from "#/lib/locales.ts";
10
10
  import { alternatesOf } from "#/site-path.ts";
11
11
  import { ActorContext, useActorState } from "../actor.ts";
@@ -104,10 +104,11 @@ const APP_HEAD = {
104
104
 
105
105
  /**
106
106
  * What the app's root loader returns: whether the chat column was left open or folded (neither
107
- * until Chat is first used), and the density.
107
+ * until Chat is first used), the engine a new chat opens on (none until one is chosen), and the density.
108
108
  */
109
109
  interface Prefs {
110
110
  chat: ChatPref;
111
+ engine?: string;
111
112
  compact: boolean;
112
113
  }
113
114
 
@@ -156,8 +157,8 @@ function SiteActor({ children }: { children: ReactNode }) {
156
157
  }
157
158
 
158
159
  /**
159
- * Whether the chat column was left open or folded (its cookie, unset until Chat is used) and whether the
160
- * page is Compact (DensityProvider says why a cookie), from the request's cookies on the server
160
+ * Whether the chat column was left open or folded (its cookie, unset until Chat is used), the engine
161
+ * a new chat opens on (its cookie, unset until one is chosen) and whether the page is Compact (DensityProvider says why a cookie), from the request's cookies on the server
161
162
  * and `document.cookie` in the browser. Each takes its value once, as it mounts: the first render
162
163
  * is hydration, which has the server's answer; reading it in the browser too keeps a later
163
164
  * remount (an error boundary's retry, say) on the cookie's side for both.
@@ -165,10 +166,12 @@ function SiteActor({ children }: { children: ReactNode }) {
165
166
  const readPrefs = createIsomorphicFn()
166
167
  .server(() => ({
167
168
  chat: chatPref(getCookie(CHAT_COOKIE)),
169
+ engine: getCookie(ENGINE_COOKIE),
168
170
  compact: getCookie(DENSITY_COOKIE) === "compact",
169
171
  }))
170
172
  .client(() => ({
171
173
  chat: chatPref(cookieValue(CHAT_COOKIE)),
174
+ engine: cookieValue(ENGINE_COOKIE),
172
175
  compact: cookieValue(DENSITY_COOKIE) === "compact",
173
176
  }));
174
177
 
@@ -14,7 +14,6 @@ import {
14
14
  CrumbHeader,
15
15
  ExternalLink,
16
16
  LinkItem,
17
- Logo,
18
17
  Nothing,
19
18
  Notice,
20
19
  plural,
@@ -22,6 +21,7 @@ import {
22
21
  TierBadge,
23
22
  VendorLogo,
24
23
  } from "../../components/common.tsx";
24
+ import { Logo } from "../../components/logo.tsx";
25
25
  import { availableConnectorsQuery, configQuery, connectorsOf, credentialsQuery } from "../../queries.ts";
26
26
  import { SecretStorage } from "../../components/connections.tsx";
27
27
 
@@ -28,6 +28,7 @@ import { Card, CardAction, CardContent, CardHeader } from "#/components/ui/card.
28
28
  import { Skeleton } from "#/components/ui/skeleton.tsx";
29
29
  import { Spinner } from "#/components/ui/spinner.tsx";
30
30
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "#/components/ui/table.tsx";
31
+ import { boxless } from "#/lib/chat.ts";
31
32
  import { DRIFT_TONE } from "#/lib/tone.ts";
32
33
  import { type AppConfig, DECLARE_BOX, errorBodyOf, INFRA, noWakeup } from "../../api.ts";
33
34
  import {
@@ -262,9 +263,7 @@ function Hosting({
262
263
  <CrumbHeader action={action} />
263
264
  {children}
264
265
  {slots.goingLive && <GoLive />}
265
- {config.place === "live" && !slots.filled.some((slot) => slot.capability === "sandbox") && (
266
- <Notice>{DECLARE_BOX}.</Notice>
267
- )}
266
+ {boxless(config) && <Notice>{DECLARE_BOX}.</Notice>}
268
267
  {slots.filled.length > 0 && (
269
268
  <div className="grid gap-(--gap-region) md:grid-cols-2 2xl:grid-cols-4">
270
269
  {slots.filled.map(({ title, capability, resource }) => (
@@ -347,7 +346,7 @@ const plainValue = (value: unknown) =>
347
346
  /**
348
347
  * A slot's resource: its name (to its declaration), type, a few of its declared fields, its
349
348
  * binding, the latest check's verdict and the fields that differ; the host's with where the last
350
- * apply that made it says it answers, and its `lifetime`: always on, or stops when quiet, with
349
+ * apply that made it says it answers, and its `lifetime`: always on, or stops when idle, with
351
350
  * what starts it again, the Wakeup (`woken`: one naming this host is declared), or a notice that none does.
352
351
  */
353
352
  function SlotCard({
@@ -423,14 +422,12 @@ function SlotCard({
423
422
  {lifetime === "long-lived"
424
423
  ? "Always on"
425
424
  : woken
426
- ? "Stops when quiet; what is due while it sleeps is started by the Wakeup"
427
- : "Stops when quiet"}
425
+ ? "Stops when idle; what is due while it is stopped is started by the Wakeup"
426
+ : "Stops when idle"}
428
427
  </Fact>
429
428
  )}
430
429
  </Facts>
431
- {lifetime === "stops-when-quiet" && !woken && (
432
- <Notice>{noWakeup(`${resource.vendor}.${resource.type}`)}.</Notice>
433
- )}
430
+ {lifetime === "stops-on-exit" && !woken && <Notice>{noWakeup(`${resource.vendor}.${resource.type}`)}.</Notice>}
434
431
  {result?.error !== undefined ? (
435
432
  <p className="text-destructive">{result.error}</p>
436
433
  ) : (
@@ -13,14 +13,15 @@ import { ApiError } from "../api.ts";
13
13
  import type { AppContext } from "../context.ts";
14
14
  import {
15
15
  type ChatMessage,
16
- ENGINE_NAMES,
16
+ enginesHere,
17
17
  heldRunOf,
18
18
  noModelText,
19
19
  onModelConnector,
20
20
  textOf,
21
21
  unfinished,
22
+ written,
22
23
  } from "../lib/chat.ts";
23
- import { type ActorContext, parse, requireActor, toApiError } from "./core.ts";
24
+ import { type ActorContext, appConfig, parse, requireActor, toApiError } from "./core.ts";
24
25
  import { chatModel } from "./models.ts";
25
26
 
26
27
  // The operator agent's chat, as the app answers it: a turn is a run of the built-in `chat`, which
@@ -28,7 +29,7 @@ import { chatModel } from "./models.ts";
28
29
  // and the transcript to the database. The app checks the message, opens the chat, writes the
29
30
  // message to its transcript, starts the turn (`SanomaClient.startTurn`, which tells a turn under
30
31
  // way to stop) and streams the chunks back as the worker writes them; a code pasted on a sign-in
31
- // card goes to the run as a message.
32
+ // card goes to the run as a message. A chat may begin with the agent speaking first (`start`).
32
33
 
33
34
  /** A person's message, as a chat takes it: its id (the browser's, which names the turn's run) and its text. */
34
35
  const PersonMessage = z.object({
@@ -37,14 +38,20 @@ const PersonMessage = z.object({
37
38
  parts: z.array(z.object({ type: z.literal("text"), text: z.string() })).min(1),
38
39
  });
39
40
 
40
- /** What the browser sends: the chat's id (its own, for a new chat) and the person's new message. */
41
+ /** What the browser sends: the chat's id (its own, for a new chat) and the person's new message, or with `start` the agent's cue. */
41
42
  const ChatRequest = z.object({
42
43
  id: ChatTurnInput.shape.chat,
43
44
  message: z.unknown(),
44
45
  /** The engine a new chat opens on; a chat keeps the one it opened on. */
45
46
  engine: z.string().default("loop"),
47
+ /** The agent speaks first, in a chat the person has not written in yet: the message is its cue, whose text is `INTRO`. */
48
+ start: z.literal(true).optional(),
46
49
  });
47
50
 
51
+ /** What the agent is asked when it speaks first: the text of the turn's message, which the chat never shows (`isIntro`). */
52
+ export const INTRO =
53
+ "Introduce yourself to me in a few plain sentences: that you make the changes to this company when I ask, and what you read in it (its workflows, connectors and people). Then suggest up to four things I could ask you first, for a business like this one.";
54
+
48
55
  /**
49
56
  * How soon the reply's stream looks again for the chunks the worker writes, in ms: `POLL_MS` while
50
57
  * they come, twice as long after each look that found none, up to `QUIET_MS` (a turn may wait a
@@ -62,7 +69,10 @@ const STATUS_MS = 2_000;
62
69
  * (so a turn that fails keeps it), starts the turn's run on its id and answers with
63
70
  * the reply's stream, read from the database as the worker writes it (`replyStream`). A chat of
64
71
  * someone else is a 404; a turn of the loop while it has no model (`chatModel`), a 409 before
65
- * the chat opens.
72
+ * the chat opens. A `start` is the agent speaking first: the message sent is its cue, written as
73
+ * `INTRO` and marked (`isIntro`), in a new chat titled "Getting started" or one with no message of
74
+ * the person's yet (a sign-in it asked for has just finished, say), a 400 otherwise; and never
75
+ * while the loop has no model.
66
76
  */
67
77
  export async function postChat(request: Request, context: ActorContext & { site?: string }): Promise<Response> {
68
78
  const { app } = context;
@@ -73,28 +83,28 @@ export async function postChat(request: Request, context: ActorContext & { site?
73
83
  const { chats } = app.client;
74
84
  const chat = await chats.get(body.id);
75
85
  if (chat && chat.person !== principal.id) throw new ApiError(404, { error: `No chat ${body.id}` });
76
- const named = chat?.engine ?? body.engine;
77
- if (!Object.hasOwn(ENGINE_NAMES, named)) {
78
- throw invalid(`No engine ${named}: the engines are ${Object.keys(ENGINE_NAMES).join(", ")}`);
79
- }
80
- // A new one, by the person. The transcript, written by the worker, is not validated again.
81
- const checked = await safeValidateUIMessages<ChatMessage>({ messages: [body.message] });
82
- if (!checked.success) throw invalid(`Not a chat message: ${checked.error.message}`);
83
- // As a chat takes it: the person's text, under an id of letters, digits, _ and -.
84
- const turn = PersonMessage.safeParse(checked.data[0]);
85
- if (!turn.success) {
86
- throw invalid(`A chat takes the person's messages, as text: ${turn.error.issues[0]?.message ?? "not one"}`);
86
+ // A chat keeps its engine, whose turn says what it lacks; a new one opens only on one the composer offers here.
87
+ if (!chat) {
88
+ const here = enginesHere(appConfig(app)).map((engine) => engine.name);
89
+ if (!here.includes(body.engine))
90
+ throw invalid(`No engine ${body.engine} here: the engines are ${here.join(", ")}`);
87
91
  }
88
- const message = turn.data;
89
- const [had, model] = await Promise.all([
92
+ const named = chat?.engine ?? body.engine;
93
+ const sent = await personMessage(body.message);
94
+ const message: ChatMessage = body.start
95
+ ? { ...sent, parts: [{ type: "text", text: INTRO }], metadata: { intro: true } }
96
+ : sent;
97
+ const [had, wrote, model] = await Promise.all([
90
98
  chat ? chats.has(chat.id, message.id) : false,
99
+ chat && body.start ? app.client.chats.load(chat.id).then(written) : false,
91
100
  onModelConnector(named) ? chatModel(app) : undefined,
92
101
  ]);
93
102
  if (had) throw invalid(`The chat has a message ${message.id} already`);
103
+ if (wrote) throw invalid("The agent speaks first only in a chat you have not written in");
94
104
  // A valid message the loop cannot answer yet: refused before the chat opens, as the composer says.
95
105
  if (model && !model.ready) throw new ApiError(409, { error: noModelText(model.vendor) });
96
106
  if (!chat) {
97
- const title = textOf(message, " ").trim().slice(0, 80) || "A chat";
107
+ const title = body.start ? "Getting started" : textOf(message, " ").trim().slice(0, 80) || "A chat";
98
108
  await chats.open({ id: body.id, person: principal.id, engine: body.engine, title });
99
109
  }
100
110
  // In the transcript before the turn starts, so a turn that fails at once keeps it; the run is
@@ -108,6 +118,18 @@ export async function postChat(request: Request, context: ActorContext & { site?
108
118
  }
109
119
  }
110
120
 
121
+ /** The person's new message, checked (a 400 for one a chat does not take). The transcript, written by the worker, is not validated again. */
122
+ async function personMessage(sent: unknown): Promise<ChatMessage> {
123
+ const checked = await safeValidateUIMessages<ChatMessage>({ messages: [sent] });
124
+ if (!checked.success) throw invalid(`Not a chat message: ${checked.error.message}`);
125
+ // As a chat takes it: the person's text, under an id of letters, digits, _ and -.
126
+ const turn = PersonMessage.safeParse(checked.data[0]);
127
+ if (!turn.success) {
128
+ throw invalid(`A chat takes the person's messages, as text: ${turn.error.issues[0]?.message ?? "not one"}`);
129
+ }
130
+ return turn.data;
131
+ }
132
+
111
133
  /**
112
134
  * The reply of the turn `runId` as a UI message stream: the chunks the worker writes
113
135
  * (`Chats.chunks`), looked for less often while none come (`POLL_MS`), until the turn's stream
@@ -1,13 +1,14 @@
1
1
  import { basename, dirname, join } from "node:path";
2
2
  import { stripVTControlCharacters } from "node:util";
3
3
  import * as acp from "@agentclientprotocol/sdk";
4
- import type { Box, Principal, Process } from "sanoma/workflows";
4
+ import type { Box, OwnAgent, Principal, Process } from "sanoma/workflows";
5
5
  import { AGENTS as AGENTS_GROUP, errorMessage, isVisitor } from "sanoma/workflows/shared";
6
6
  import { createUIMessageStream, generateId, type UIMessageStreamWriter } from "ai";
7
7
  import { type ChatMessage, pathOf, type SignInCard, textOf } from "../../lib/chat.ts";
8
8
  import { homeOf, OWN_AGENTS_DIR, personBox } from "./box-session.ts";
9
9
  import { boxTurn, carryIn, carryOut } from "./carrier.ts";
10
10
  import {
11
+ agentOn,
11
12
  allowedPaths,
12
13
  mustAllow,
13
14
  NO_SHELL,
@@ -16,6 +17,7 @@ import {
16
17
  type RealPaths,
17
18
  realIn,
18
19
  showCommits,
20
+ type TurnAgent,
19
21
  turnMessage,
20
22
  } from "./checkout.ts";
21
23
  import { harnessInstructions } from "./prompt.ts";
@@ -35,77 +37,6 @@ import type { Engine, EngineTurn } from "./transcript.ts";
35
37
  // it runs through our terminal are its own, in the box. A sign-in it asks for is shown in the chat
36
38
  // as the vendor's own flow.
37
39
 
38
- /** How a person signs in to their agent from the chat. */
39
- type SignIn =
40
- /** The agent's own bin with these arguments, run by us with piped stdio, what it prints relayed into the card. */
41
- | { run: readonly string[] }
42
- /** The agent's terminal sign-in method of this id (`authMethods`, `type: "terminal"`): its own bin with the method's arguments, run as `run` is. */
43
- | { method: string }
44
- /** `authenticate` with this method: the agent sends the vendor's link and code as a URL elicitation. */
45
- | { authenticate: string }
46
- /** No sign-in through the chat (the vendor's needs a real terminal): the person runs this bin of the install once on this computer. */
47
- | { once: { bin: string; args: readonly string[]; after?: string } };
48
-
49
- /** A person's own coding agent, by its ACP entry. */
50
- interface OwnAgent {
51
- /** The vendor's name for it. */
52
- title: string;
53
- /** What is installed for it, each at the version it was tried with (installed without install scripts). */
54
- packages: readonly string[];
55
- /** The install's script to run once installed: the vendor's own `postinstall`, which the install skips. */
56
- setup?: string;
57
- /** Its ACP entry: a bin of the install (`node_modules/.bin`), and its arguments. */
58
- bin: string;
59
- args: readonly string[];
60
- signIn: SignIn;
61
- }
62
-
63
- /** The agents, by the name their engine takes (`acp-<name>`), with the versions spike S3 ran (2026-10-25). */
64
- export const OWN_AGENTS = {
65
- copilot: {
66
- title: "Copilot",
67
- packages: ["@github/copilot@1.0.103"],
68
- bin: "copilot",
69
- args: ["--acp"],
70
- // Its advertised method (`copilot login`) opens a browser on this machine; the device flow prints a link and a code.
71
- signIn: { run: ["login", "--device-code"] },
72
- },
73
- opencode: {
74
- title: "OpenCode",
75
- packages: ["opencode-ai@1.19.4"],
76
- setup: "node_modules/opencode-ai/postinstall.mjs",
77
- bin: "opencode",
78
- args: ["acp"],
79
- // Its free models need no sign-in; `auth login` prints nothing without a terminal.
80
- signIn: { once: { bin: "opencode", args: ["auth", "login"] } },
81
- },
82
- pi: {
83
- title: "Pi",
84
- packages: ["pi-acp@0.0.34", "@earendil-works/pi-coding-agent@1.4.0"],
85
- bin: "pi-acp",
86
- args: [],
87
- // Its terminal method (`pi-acp --terminal-login`) starts pi's interactive terminal UI, which prints nothing to a pipe.
88
- signIn: { once: { bin: "pi", args: [], after: "/login" } },
89
- },
90
- "claude-code": {
91
- title: "Claude Code",
92
- packages: ["@agentclientprotocol/claude-agent-acp@0.95.0"],
93
- bin: "claude-agent-acp",
94
- args: [],
95
- signIn: { method: "claude-ai-login" },
96
- },
97
- codex: {
98
- title: "Codex",
99
- packages: ["@agentclientprotocol/codex-acp@2.2.2"],
100
- bin: "codex-acp",
101
- args: [],
102
- signIn: { authenticate: "chat-gpt-device-code" },
103
- },
104
- } satisfies Record<string, OwnAgent>;
105
-
106
- /** An agent's name, its engine's being `acp-<name>`. */
107
- export type OwnAgentName = keyof typeof OWN_AGENTS;
108
-
109
40
  /** What this client says it can do: files and terminals (ours, by the checkout rule), terminal sign-in methods, and links to show. */
110
41
  const CAPABILITIES: acp.ClientCapabilities = {
111
42
  fs: { readTextFile: true, writeTextFile: true },
@@ -172,23 +103,22 @@ const SIGN_IN_FAILURES: [said: RegExp, words: string][] = [
172
103
  /** Each agent's install under way, by its box and directory: this process's cache, so two turns install it once. */
173
104
  const installs = new Map<string, Promise<void>>();
174
105
 
175
- /** The engine for `name` (`acp-<name>`): a turn of a chat through that person's own agent. */
106
+ /** The engine for the agent `id` (`acp-<id>`): a turn of a chat through that person's own agent. */
176
107
  export const acpEngine =
177
- (name: OwnAgentName): Engine =>
108
+ (id: string): Engine =>
178
109
  (turn) =>
179
110
  createUIMessageStream<ChatMessage>({
180
111
  onError: errorMessage,
181
- execute: ({ writer }) => runTurn(name, turn, writer),
112
+ execute: ({ writer }) => runTurn(agentOn(turn.step.resolved, id, "own"), turn, writer),
182
113
  });
183
114
 
184
115
  /** Whether `principal` is a person: not an agent, nor acting for someone, nor a visitor. Only a person's own plan is spent. */
185
116
  const isPerson = (principal: Principal) =>
186
117
  !isVisitor(principal) && !principal.groups?.includes(AGENTS_GROUP) && principal.onBehalfOf === undefined;
187
118
 
188
- async function runTurn(name: OwnAgentName, engineTurn: EngineTurn, writer: UIMessageStreamWriter<ChatMessage>) {
119
+ async function runTurn(agent: TurnAgent<"own">, engineTurn: EngineTurn, writer: UIMessageStreamWriter<ChatMessage>) {
189
120
  const { step, chat, messages } = engineTurn;
190
121
  const { by: principal, signal } = step;
191
- const agent: OwnAgent = OWN_AGENTS[name];
192
122
  if (!isPerson(principal)) {
193
123
  throw new Error(`${agent.title} runs on a person's own plan, and ${principal.id} is not a person`);
194
124
  }
@@ -211,7 +141,7 @@ async function runTurn(name: OwnAgentName, engineTurn: EngineTurn, writer: UIMes
211
141
  const boxHome = await homeOf(box);
212
142
  // The person's own agents' HOME, kept across turns in the box: their installs and sign-ins.
213
143
  const home = join(boxHome, OWN_AGENTS_DIR);
214
- const dir = join(home, name);
144
+ const dir = join(home, agent.id);
215
145
  // A first install under way is waited for even by a new message (it has a time limit of its
216
146
  // own): the box's stop would end it.
217
147
  const [cloned, installed, shimmed] = await Promise.allSettled([
@@ -261,7 +191,7 @@ async function runTurn(name: OwnAgentName, engineTurn: EngineTurn, writer: UIMes
261
191
 
262
192
  /** A turn's agent in the box and what it asked for: one ACP connection, its terminals and its sign-in. */
263
193
  class AcpTurn {
264
- readonly agent: OwnAgent;
194
+ readonly agent: TurnAgent<"own">;
265
195
  readonly relay: Relay;
266
196
  readonly signal: AbortSignal;
267
197
  readonly box: Box;
@@ -284,7 +214,7 @@ class AcpTurn {
284
214
  readonly #terminals = new Map<string, Started>();
285
215
 
286
216
  constructor(
287
- agent: OwnAgent,
217
+ agent: TurnAgent<"own">,
288
218
  relay: Relay,
289
219
  signal: AbortSignal,
290
220
  {
@@ -7,7 +7,9 @@ import {
7
7
  type CheckResult,
8
8
  type Draft,
9
9
  errorCode,
10
+ type InstalledAgent,
10
11
  type Principal,
12
+ type ResolvedConfig,
11
13
  type SanomaClient,
12
14
  type Source,
13
15
  } from "sanoma/workflows";
@@ -220,3 +222,31 @@ export async function showCommits(
220
222
  data: { draft: chat.id, branch: draft.branch, ...diff, checks: checked },
221
223
  });
222
224
  }
225
+
226
+ /** The plans a coding agent runs on, by its part's name: a person's own, the company's key. */
227
+ const PLANS = { own: "a person's own plan", onKey: "the company's key" } as const;
228
+
229
+ /** A coding agent's part for a plan as a turn runs it: its connector's facts, with its id and name. */
230
+ export type TurnAgent<P extends keyof typeof PLANS> = NonNullable<InstalledAgent[P]> & { id: string; title: string };
231
+
232
+ /**
233
+ * The coding agent `id`'s part for `plan`, as an installed connector gives it
234
+ * (`ResolvedConfig.agents`), with its id and name; without one, an error that says so, which the
235
+ * turn's reply shows.
236
+ */
237
+ export function agentOn<P extends keyof typeof PLANS>(
238
+ { agents }: Pick<ResolvedConfig, "agents">,
239
+ id: string,
240
+ plan: P,
241
+ ): TurnAgent<P> {
242
+ const agent = agents.get(id);
243
+ const part = agent?.[plan];
244
+ if (!part) {
245
+ throw new Error(
246
+ agent
247
+ ? `${agent.title} does not run on ${PLANS[plan]}`
248
+ : `No connector of this company gives the coding agent ${id}: add the connector that has it to sanoma.config.ts`,
249
+ );
250
+ }
251
+ return { ...part, id, title: agent.title };
252
+ }