@wular/coder 0.4.1 → 0.4.2

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 (244) hide show
  1. package/README.md +69 -70
  2. package/dist/{add-ej0X9e3a.js → add-C2y-mVzl.js} +1 -1
  3. package/dist/{add-U-pty9qJ.js → add-CLYTF_up.js} +1 -1
  4. package/dist/{add-CE-70LFs.js → add-DRsPpQFl.js} +1 -1
  5. package/dist/{add-BxpLHnvD.js → add-DkpUwhtO.js} +1 -1
  6. package/dist/{add-json-CEa-6luW.js → add-json-5uPnWPoD.js} +1 -1
  7. package/dist/{agent-BsYx3Odz.js → agent-hw3zKw8y.js} +1 -1
  8. package/dist/{agent-JdtZozvP.js → agent-r5mMcehf.js} +1 -1
  9. package/dist/{alias-DX-Bm86x.js → alias-_0Rwf2cA.js} +1 -1
  10. package/dist/{app-BT5f7zL5.js → app-oE8G1-bi.js} +1 -1
  11. package/dist/{approvals-C-AvFt6s.js → approvals-DbVrsxec.js} +1 -1
  12. package/dist/{approve-DOmpQRNd.js → approve-DeAhFL-m.js} +1 -1
  13. package/dist/{apps-CjfrZyM5.js → apps-eujHiNca.js} +1 -1
  14. package/dist/{archive-BziJ1rQ-.js → archive-BCUfymIB.js} +1 -1
  15. package/dist/{archive-BUB8gFKD.js → archive-DZ6vpMHb.js} +1 -1
  16. package/dist/{archive-sweep-CtBcARgN.js → archive-sweep-Cxbh8yAI.js} +1 -1
  17. package/dist/{ask-dE3U3ss2.js → ask-BU2WVxVM.js} +1 -1
  18. package/dist/auth-CBWTmAPA.js +1 -0
  19. package/dist/{auth-BFny--17.js → auth-Dmn2U7rr.js} +1 -1
  20. package/dist/{cli-BilSDkvE.js → cli-DWCR7iqa.js} +1 -1
  21. package/dist/cli.js +1 -1
  22. package/dist/{config-Da_cwoxI.js → config-12pK4qW7.js} +1 -1
  23. package/dist/{create-C_iMJV4Y.js → create-D3f6q0Yq.js} +1 -1
  24. package/dist/credentials-l6dsrZLL.js +1 -0
  25. package/dist/dash/manifest.json +744 -858
  26. package/dist/dash/public/assets/chunks/{agent-pills-c9c4ac4d4a10df83.js → agent-pills-dd0b7643e125bbf1.js} +1 -1
  27. package/dist/dash/public/assets/chunks/{agent-settings-form-8be2ddab074aba6d.js → agent-settings-form-45ae6aeaaed2b568.js} +1 -1
  28. package/dist/dash/public/assets/chunks/{agents-grid-951584b6f4c4314e.js → agents-grid-b906da80c31fc035.js} +1 -1
  29. package/dist/dash/public/assets/chunks/{combo-41234c24668b1db1.js → combo-952a457d52360d88.js} +1 -1
  30. package/dist/dash/public/assets/chunks/{composer-d10d4b1d54c4f751.js → composer-49f9e7c5c4dfda3b.js} +1 -1
  31. package/dist/dash/public/assets/chunks/{composer-5534be50bc12385e.js → composer-f331d00837143aee.js} +1 -1
  32. package/dist/dash/public/assets/chunks/{connect-apps-aa2a3d82e48ed8c3.js → connect-apps-661f3b3a85f1776a.js} +1 -1
  33. package/dist/dash/public/assets/chunks/{credentials-list-bc5bfcab058176c5.js → credentials-list-e6177d0943517929.js} +2 -2
  34. package/dist/dash/public/assets/chunks/{custom-range-4761ab14f05149df.js → custom-range-03ba6fb2ade7d282.js} +1 -1
  35. package/dist/dash/public/assets/chunks/{editor-bfe8cd854f8001be.js → editor-34cb529d6d8a4b09.js} +1 -1
  36. package/dist/dash/public/assets/chunks/{engines-list-f1191390f5715b39.js → engines-list-2f1acee3ecc8461a.js} +1 -1
  37. package/dist/dash/public/assets/chunks/{heads-f3bcd289663d48fa.js → heads-1570a3a6db331979.js} +1 -1
  38. package/dist/dash/public/assets/chunks/{list-1d259660d7612c5f.js → list-87b359bebd26986a.js} +1 -1
  39. package/dist/dash/public/assets/chunks/{mcp-list-e3bebbbe831393b8.js → mcp-list-b42f0d2ee463b37d.js} +1 -1
  40. package/dist/dash/public/assets/chunks/{models-list-44f857a469ca04d5.js → models-list-0669d26fd662aec3.js} +1 -1
  41. package/dist/dash/public/assets/chunks/{platform-actions-d1426602049926d2.js → platform-actions-c92ca3c6198a9387.js} +1 -1
  42. package/dist/dash/public/assets/chunks/{runners-list-1901af8a5dea1f09.js → runners-list-9fffa50432c470c9.js} +1 -1
  43. package/dist/dash/public/assets/chunks/{select-7ae25fd8a7d6c338.js → select-1013702bdfb1ade4.js} +1 -1
  44. package/dist/dash/public/assets/chunks/shared-init-20e199043ff5d00f.js +2 -0
  45. package/dist/dash/public/assets/chunks/{task-actions-8e1d93c788d001df.js → task-actions-a9603d520434baab.js} +1 -1
  46. package/dist/dash/public/assets/chunks/{task-view-6d7618d2820a5cb4.js → task-view-f7039cb330bcb0b5.js} +3 -3
  47. package/dist/dash/public/assets/chunks/{tasks-list-f4784e5cbd0ed785.js → tasks-list-2a905b4a0c3a9042.js} +1 -1
  48. package/dist/dash/public/assets/chunks/{toolbar-a75d2570f07cbb70.js → toolbar-f964fa864699f095.js} +1 -1
  49. package/dist/dash/public/assets/dash-49ca85b59ac65c20.css +1 -0
  50. package/dist/dash/public/assets/dash-account-96fc41be318839fa.css +1 -0
  51. package/dist/dash/public/assets/dash-agents-290a7b21c7dc0c92.css +1 -0
  52. package/dist/dash/public/assets/dash-agents-new-a7a07bf4ebda24c2.css +1 -0
  53. package/dist/dash/public/assets/dash-agents-param-slug-69a72fb0bbd14cc2.css +1 -0
  54. package/dist/dash/public/assets/dash-agents-param-slug-edit-397bdfb2f0ca328c.css +1 -0
  55. package/dist/dash/public/assets/dash-agents-param-slug-platforms-a7b3b7247c27f1d2.css +1 -0
  56. package/dist/dash/public/assets/dash-agents-param-slug-settings-8389b7d0555e8ccf.css +1 -0
  57. package/dist/dash/public/assets/dash-agents-param-slug-tasks-5987b8aea5e8f30d.css +1 -0
  58. package/dist/dash/public/assets/dash-agents-param-slug-usage-19abc69e1d4e6b0a.css +1 -0
  59. package/dist/dash/public/assets/dash-settings-53b8e6a8f656fa1a.css +1 -0
  60. package/dist/dash/public/assets/dash-settings-param-tab-ac61fdfdd6fd533f.css +1 -0
  61. package/dist/dash/public/assets/dash-tasks-cc0b1d32874b731c.css +1 -0
  62. package/dist/dash/public/assets/dash-tasks-param-id-02b8c7bd99cc1090.css +1 -0
  63. package/dist/dash/public/assets/dash-usage-884943221f76ad93.css +1 -0
  64. package/dist/dash/public/assets/pnext-client-17ba55bb57a1f4da.js +1 -0
  65. package/dist/dash/public/assets/{pnext-client-1b9ab0963a8ff77b.js → pnext-client-1afa4148bea69ad2.js} +1 -1
  66. package/dist/dash/public/assets/pnext-client-2693db10b197ade1.js +1 -0
  67. package/dist/dash/public/assets/pnext-client-43f52a07f8067b1b.js +1 -0
  68. package/dist/dash/public/assets/pnext-client-4594b693fe612835.js +1 -0
  69. package/dist/dash/public/assets/pnext-client-73f73e24f8141fb6.js +1 -0
  70. package/dist/dash/public/assets/pnext-client-7574da4651b40eae.js +1 -0
  71. package/dist/dash/public/assets/pnext-client-7b3a2c1092cbbb02.js +1 -0
  72. package/dist/dash/public/assets/pnext-client-816fe5fc96d3f768.js +1 -0
  73. package/dist/dash/public/assets/pnext-client-86cb956b448b0887.js +1 -0
  74. package/dist/dash/public/assets/pnext-client-8b64e3c030164288.js +1 -0
  75. package/dist/dash/public/assets/pnext-client-8f6161084c595a22.js +1 -0
  76. package/dist/dash/public/assets/pnext-client-9203ec11926e5d04.js +1 -0
  77. package/dist/dash/public/assets/pnext-client-a38b446f941d44df.js +1 -0
  78. package/dist/dash/public/assets/pnext-client-bd8d51aaa095e8a4.js +1 -0
  79. package/dist/dash/public/assets/pnext-client-e9821d1f1bdb281d.js +1 -0
  80. package/dist/dash/server/bundle-0.1.6-b29ec45cb963d47f/entry.js +2 -0
  81. package/dist/{default-vYPT26DR.js → default-CwQXCtoB.js} +1 -1
  82. package/dist/{default-Bobztoxf.js → default-De8FXiWz.js} +1 -1
  83. package/dist/{delete-z1_86nf6.js → delete-BD6AnCLg.js} +1 -1
  84. package/dist/{delete-D8gEwoOj.js → delete-cS01oOIb.js} +1 -1
  85. package/dist/{disable-DVKd-0Xb.js → disable-BMWWeYFQ.js} +1 -1
  86. package/dist/{discover-Df-a8K4R.js → discover-Cfx5RPU7.js} +1 -1
  87. package/dist/{docs-DKJnqZqt.js → docs-DWegDRiu.js} +1 -1
  88. package/dist/{enable-C8Zf_wpN.js → enable-Cfzeau2x.js} +1 -1
  89. package/dist/{flow-17k25MHt.js → flow-kAxxVOiR.js} +1 -1
  90. package/dist/{init-CoMfFxbG.js → init-C4tDFH4G.js} +1 -1
  91. package/dist/integrations-D-L3uQRj.js +1 -0
  92. package/dist/{list-BYiG8Zav.js → list-5Ljf9TxF.js} +2 -2
  93. package/dist/{list-BAKvxSbh.js → list-COAo7eZd.js} +1 -1
  94. package/dist/{list-DX-z3SBp.js → list-DuPqU3fk.js} +1 -1
  95. package/dist/{list-C5w01-8q.js → list-DzGuMkQy.js} +1 -1
  96. package/dist/{list-VToARh3C.js → list-J8d_zh-o.js} +1 -1
  97. package/dist/{list-BxEywhHU.js → list-vOvIpbOH.js} +1 -1
  98. package/dist/{list-CIW2joV1.js → list-vpyS-hv8.js} +1 -1
  99. package/dist/{list-DpCf4G-H.js → list-way5oLO0.js} +1 -1
  100. package/dist/{login-DkkslfBx.js → login-BBw95-S3.js} +1 -1
  101. package/dist/{login-BFxX4jJy.js → login-CNmeRAL7.js} +1 -1
  102. package/dist/{logout-BHAtw4Z8.js → logout-j0dTo_Ib.js} +1 -1
  103. package/dist/{maintenance-C5FklUw3.js → maintenance-DkLVtqM7.js} +1 -1
  104. package/dist/{mcp-CCZOAo06.js → mcp-CsmBtlW9.js} +1 -1
  105. package/dist/{migrate-C4vM7DQN.js → migrate-D4nzYhk8.js} +1 -1
  106. package/dist/{model-Bs1StDo3.js → model-B79MFtRV.js} +1 -1
  107. package/dist/{push-CUC55Bqd.js → push-DbdnbZYt.js} +1 -1
  108. package/dist/{queue-6io_NOP3.js → queue-C9fSdE_X.js} +27 -27
  109. package/dist/refresh-BDmap1RA.js +1 -0
  110. package/dist/{remove-B93LNkZI.js → remove-BNzbUhaK.js} +1 -1
  111. package/dist/{remove-eQ8y5C5p.js → remove-CLpL12Ya.js} +1 -1
  112. package/dist/{remove-CuH8a3L9.js → remove-CaYH9Cna.js} +1 -1
  113. package/dist/{remove-C5_xggx7.js → remove-D-QeeZQL.js} +1 -1
  114. package/dist/{rename-CYfy03FE.js → rename-Bhcb4t9F.js} +1 -1
  115. package/dist/{result-BEtQZHaY.js → result-BfTfJayl.js} +1 -1
  116. package/dist/{result-BzaM3inj.js → result-D8DsvJDu.js} +1 -1
  117. package/dist/{resume-DYzKvyEw.js → resume-aZ8yWDBh.js} +1 -1
  118. package/dist/{review-oIBeECZE.js → review-BEhDcX4b.js} +1 -1
  119. package/dist/{rotate-key-IdMYH7gg.js → rotate-key-BqnKhTK8.js} +1 -1
  120. package/dist/{run-CTtd0Znc.js → run-BWbabvub.js} +1 -1
  121. package/dist/{run-CawRGnOg.js → run-BdPjxaZU.js} +1 -1
  122. package/dist/{run-BDYl0CKl.js → run-Dqe38jX8.js} +1 -1
  123. package/dist/runner-BPpiJvHx.js +1 -0
  124. package/dist/sdk.js +1 -1
  125. package/dist/{serve-CPnmrKyf.js → serve-C0WC-QrV.js} +2 -2
  126. package/dist/{serve-GmRO89s5.js → serve-CcObDKKQ.js} +1 -1
  127. package/dist/{serve-CE8YV2e9.js → serve-Ck95047c.js} +1 -1
  128. package/dist/{serve-CQKZxzFE.js → serve-DA5I2qXj.js} +2 -2
  129. package/dist/{server-Kb22cWfF.js → server-BxLFZL80.js} +1 -1
  130. package/dist/{setup-host-GFTUzzZJ.js → setup-host-DLd_j2Uw.js} +1 -1
  131. package/dist/{shared-DVtzWhUT.js → shared-BLkGRKty.js} +1 -1
  132. package/dist/{show-COTZEYgc.js → show-DzoQIs75.js} +1 -1
  133. package/dist/{show-CMUg8SJu.js → show-FC3dJcD-.js} +1 -1
  134. package/dist/{status-D26U--p8.js → status-BU3DR1XU.js} +1 -1
  135. package/dist/{steer-C6uARLp5.js → steer-P_38hRRD.js} +1 -1
  136. package/dist/{stop-BrGI3hSS.js → stop-BJGDRPsp.js} +1 -1
  137. package/dist/{stop-ByCAlbmN.js → stop-BWY6k6v5.js} +1 -1
  138. package/dist/{store-DzqXS2wT.js → store-B3ZHoBJY.js} +4 -4
  139. package/dist/{store-B94tSate.js → store-BLi19UDE.js} +1 -1
  140. package/dist/{task-CgOKgkEG.js → task-b2BK481M.js} +1 -1
  141. package/dist/{test-NEbhlxvo.js → test-BrSrhop9.js} +1 -1
  142. package/dist/{tools-D0Zfs8Hx.js → tools-CgswhJzh.js} +1 -1
  143. package/dist/{unalias-C9NqmSDq.js → unalias-mMHXqok7.js} +1 -1
  144. package/dist/{update-BTxYQj7Z.js → update-DbOWToPy.js} +1 -1
  145. package/dist/{upgrade-hA0yWBvx.js → upgrade-D6oC9HQI.js} +2 -2
  146. package/dist/{usage-BhqoCjvE.js → usage-Cb8Dtv9V.js} +1 -1
  147. package/dist/{usage-C4d9X2Uq.js → usage-DMs-IIJC.js} +1 -1
  148. package/dist/{watch-DtRuC0Wc.js → watch-BcMQXGYO.js} +1 -1
  149. package/dist/{watch-CSdj24ct.js → watch-eE2XiwsC.js} +1 -1
  150. package/dist/{worker-DX7P9kWl.js → worker-DrucI22w.js} +1 -1
  151. package/dist/{workflow-Dcmdooi8.js → workflow-Cshghoas.js} +1 -1
  152. package/docs/cli.md +145 -0
  153. package/package.json +3 -2
  154. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  155. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  156. package/src/core/defaults.ts +25 -0
  157. package/src/server/dash/app/dash/layout.css +58 -1
  158. package/src/server/dash/app/dash/layout.tsx +16 -4
  159. package/src/server/dash/app/dash/settings/[tab]/page.tsx +1 -1
  160. package/src/server/dash/comps/nav/side-toggle.tsx +1 -1
  161. package/src/server/dash/comps/ui/menu.tsx +5 -1
  162. package/src/server/dash/comps/ui/toast.css +3 -2
  163. package/dist/auth-DWHIzqbA.js +0 -1
  164. package/dist/credentials-B1jv6dkg.js +0 -1
  165. package/dist/dash/public/assets/chunks/shared-init-ffb3397e494137c9.js +0 -2
  166. package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +0 -1
  167. package/dist/dash/public/assets/dash-account-04859899c1838ada.css +0 -1
  168. package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +0 -1
  169. package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +0 -1
  170. package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +0 -1
  171. package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +0 -1
  172. package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +0 -1
  173. package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +0 -1
  174. package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +0 -1
  175. package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +0 -1
  176. package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +0 -1
  177. package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +0 -1
  178. package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +0 -1
  179. package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +0 -1
  180. package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +0 -1
  181. package/dist/dash/public/assets/pnext-client-03b03b254e525e82.js +0 -1
  182. package/dist/dash/public/assets/pnext-client-1c7859bb888f4ef0.js +0 -1
  183. package/dist/dash/public/assets/pnext-client-3c748afe963fb05d.js +0 -1
  184. package/dist/dash/public/assets/pnext-client-4f47c2cae220f107.js +0 -1
  185. package/dist/dash/public/assets/pnext-client-6ab9fd9b53b794d2.js +0 -1
  186. package/dist/dash/public/assets/pnext-client-6c241786342498e4.js +0 -1
  187. package/dist/dash/public/assets/pnext-client-80b56d420f02b808.js +0 -1
  188. package/dist/dash/public/assets/pnext-client-83135c17bae850a3.js +0 -1
  189. package/dist/dash/public/assets/pnext-client-8e6fa4302ae0396f.js +0 -1
  190. package/dist/dash/public/assets/pnext-client-932c9d8cc0717fc8.js +0 -1
  191. package/dist/dash/public/assets/pnext-client-a42ae63d4de113f9.js +0 -1
  192. package/dist/dash/public/assets/pnext-client-d2ee6f8c1e337032.js +0 -1
  193. package/dist/dash/public/assets/pnext-client-d513f65ec23b7f20.js +0 -1
  194. package/dist/dash/public/assets/pnext-client-ecb88e2a8a109954.js +0 -1
  195. package/dist/dash/public/assets/pnext-client-f1545ee6270bbf9a.js +0 -1
  196. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +0 -30
  197. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +0 -2704
  198. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +0 -208
  199. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +0 -834
  200. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +0 -35
  201. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +0 -1582
  202. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +0 -131
  203. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +0 -437
  204. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +0 -25
  205. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +0 -831
  206. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +0 -724
  207. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +0 -22
  208. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +0 -172
  209. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +0 -378
  210. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +0 -89
  211. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +0 -6270
  212. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +0 -1198
  213. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +0 -61
  214. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +0 -5151
  215. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +0 -20
  216. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +0 -438
  217. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +0 -17
  218. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +0 -107
  219. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +0 -183
  220. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +0 -647
  221. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +0 -129
  222. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +0 -7146
  223. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +0 -2397
  224. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +0 -220
  225. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +0 -72
  226. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +0 -231
  227. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +0 -627
  228. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +0 -265
  229. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +0 -18
  230. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +0 -16
  231. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +0 -17
  232. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +0 -219
  233. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +0 -16
  234. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +0 -48
  235. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +0 -963
  236. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +0 -26
  237. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +0 -12579
  238. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +0 -505
  239. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +0 -54
  240. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +0 -15
  241. package/dist/integrations-5xCaXSd-.js +0 -1
  242. package/dist/refresh-BIrmrWYq.js +0 -1
  243. package/dist/runner-D7ScbIHJ.js +0 -1
  244. package/src/server/dash/app/dash/token-from-hash.tsx +0 -17
@@ -1,45 +1,45 @@
1
- import{Bn as e,a as t,c as n}from"./store-DzqXS2wT.js";import{g as r,h as i,i as a,m as o,o as s,p as c,s as l}from"./schema-CU2iFkp8.js";import{i as u,r as d,t as f}from"./client-D9IoAuDD.js";import{b as p,c as m,f as h,m as g,v as _,y as v}from"./shared-DVtzWhUT.js";import{randomBytes as y}from"node:crypto";import{and as b,asc as x,desc as S,eq as C,getTableColumns as w,ilike as T,inArray as E,isNotNull as D,isNull as O,or as k,sql as A}from"drizzle-orm";import{CasingCache as j}from"drizzle-orm/casing";function M(e,t){if(typeof t==`number`)return A`to_jsonb(coalesce(case when jsonb_typeof(${e}) = 'number' then (${e} #>> '{}')::numeric end, 0) + ${t}::numeric)`;if(!t||typeof t!=`object`||Array.isArray(t))return e;let n=Object.entries(t).map(([t,n])=>A`${t}::text, ${M(A`(${e} -> ${t}::text)`,n)}`);return A`(case when jsonb_typeof(${e}) = 'object' then ${e} else '{}'::jsonb end || jsonb_build_object(${A.join(n,A`, `)}))`}var N=class{db;constructor(e){this.db=e}async metrics(e,t){let n=await this.db.select({status:c.status,total:A`count(*)::int`,recent:A`count(*) filter (where ${c.createdAt} >= ${new Date(t).toISOString()}::timestamptz)::int`}).from(c).where(C(c.organizationId,e)).groupBy(c.status),r={tasks:{queued:0,running:0,waiting:0,completed:0,failed:0,cancelled:0},queueDepth:0};for(let e of n)r.tasks[e.status]=e.recent,e.status===`queued`&&(r.queueDepth=e.total);return r}where(e,t){return b(C(c.organizationId,e),C(c.publicId,t))}fence(e,t,n={}){return b(this.where(e,t),n.generation===void 0?void 0:C(c.generation,n.generation),n.attempts===void 0?void 0:C(c.attempts,n.attempts),n.tokenHash===void 0?void 0:n.tokenHash===null?O(c.tokenHash):C(c.tokenHash,n.tokenHash),n.handle===void 0?void 0:n.handle===null?O(c.handle):C(c.handle,n.handle),n.lastSeenAt===void 0?void 0:n.lastSeenAt===null?O(c.lastSeenAt):C(c.lastSeenAt,new Date(n.lastSeenAt)),n.updatedAt===void 0?void 0:C(c.updatedAt,new Date(n.updatedAt)),n.statuses?E(c.status,n.statuses):void 0)}async enqueue(e,t,n,r,i){let a=this.insertion(e,t,n,r,i),[o]=i===void 0?await g(this.db,a):await d(this.db,[A`select pg_advisory_xact_lock(1, hashtext(${e}))`],a);if(!o?.allowed)throw Error(`Organization task queue is full`);return!!o.inserted}insertion(e,t,n,r,i,u){let d=t.event,f=new Date(n).toISOString(),p=e=>A`${e===void 0?null:JSON.stringify(e)}::jsonb`,m=r?A`
1
+ import{Bn as e,a as t,c as n}from"./store-B3ZHoBJY.js";import{g as r,h as i,i as a,m as o,o as s,p as c,s as l}from"./schema-CU2iFkp8.js";import{i as u,r as d,t as f}from"./client-D9IoAuDD.js";import{b as p,c as m,f as h,m as g,v as _,y as v}from"./shared-BLkGRKty.js";import{randomBytes as y}from"node:crypto";import{and as b,asc as x,desc as S,eq as C,getTableColumns as w,ilike as T,inArray as E,isNotNull as D,isNull as O,not as k,or as A,sql as j}from"drizzle-orm";import{CasingCache as M}from"drizzle-orm/casing";function N(e,t){if(typeof t==`number`)return j`to_jsonb(coalesce(case when jsonb_typeof(${e}) = 'number' then (${e} #>> '{}')::numeric end, 0) + ${t}::numeric)`;if(!t||typeof t!=`object`||Array.isArray(t))return e;let n=Object.entries(t).map(([t,n])=>j`${t}::text, ${N(j`(${e} -> ${t}::text)`,n)}`);return j`(case when jsonb_typeof(${e}) = 'object' then ${e} else '{}'::jsonb end || jsonb_build_object(${j.join(n,j`, `)}))`}var P=class{db;constructor(e){this.db=e}async metrics(e,t){let n=await this.db.select({status:c.status,total:j`count(*)::int`,recent:j`count(*) filter (where ${c.createdAt} >= ${new Date(t).toISOString()}::timestamptz)::int`}).from(c).where(C(c.organizationId,e)).groupBy(c.status),r={tasks:{queued:0,running:0,waiting:0,completed:0,failed:0,cancelled:0},queueDepth:0};for(let e of n)r.tasks[e.status]=e.recent,e.status===`queued`&&(r.queueDepth=e.total);return r}where(e,t){return b(C(c.organizationId,e),C(c.publicId,t))}fence(e,t,n={}){return b(this.where(e,t),n.generation===void 0?void 0:C(c.generation,n.generation),n.attempts===void 0?void 0:C(c.attempts,n.attempts),n.tokenHash===void 0?void 0:n.tokenHash===null?O(c.tokenHash):C(c.tokenHash,n.tokenHash),n.handle===void 0?void 0:n.handle===null?O(c.handle):C(c.handle,n.handle),n.lastSeenAt===void 0?void 0:n.lastSeenAt===null?O(c.lastSeenAt):C(c.lastSeenAt,new Date(n.lastSeenAt)),n.updatedAt===void 0?void 0:C(c.updatedAt,new Date(n.updatedAt)),n.statuses?E(c.status,n.statuses):void 0)}async enqueue(e,t,n,r,i){let a=this.insertion(e,t,n,r,i),[o]=i===void 0?await g(this.db,a):await d(this.db,[j`select pg_advisory_xact_lock(1, hashtext(${e}))`],a);if(!o?.allowed)throw Error(`Organization task queue is full`);return!!o.inserted}insertion(e,t,n,r,i,u){let d=t.event,f=new Date(n).toISOString(),p=e=>j`${e===void 0?null:JSON.stringify(e)}::jsonb`,m=r?j`
2
2
  receipt as (
3
3
  insert into ${a} (key, value, expires_at)
4
4
  select ${_(e,`delivery`,r.key)}, ${p({at:n})}, ${new Date(n+r.ttlMs).toISOString()}::timestamptz
5
- from capacity where allowed ${u?A`and (${u.create} or exists (select 1 from target))`:A``}
5
+ from capacity where allowed ${u?j`and (${u.create} or exists (select 1 from target))`:j``}
6
6
  on conflict (key) do update set value = excluded.value, expires_at = excluded.expires_at
7
7
  where ${a.expiresAt} <= ${f}::timestamptz
8
8
  returning key
9
- ),`:A``;return A`
10
- with ${u?A`target as materialized (${u.target}),`:A``} capacity as (
11
- select ${i===void 0?A`true`:A`(select count(*) from ${c} where organization_id = ${e} and status = 'queued') < ${i} ${r?A`or exists (select 1 from ${a} where key = ${_(e,`delivery`,r.key)} and expires_at > ${f}::timestamptz)`:A``}`} ${u?A`or exists (select 1 from target) or not ${u.create}`:A``} as allowed
12
- ), ${m} ${u?A`advanced as (
9
+ ),`:j``;return j`
10
+ with ${u?j`target as materialized (${u.target}),`:j``} capacity as (
11
+ select ${i===void 0?j`true`:j`(select count(*) from ${c} where organization_id = ${e} and status = 'queued') < ${i} ${r?j`or exists (select 1 from ${a} where key = ${_(e,`delivery`,r.key)} and expires_at > ${f}::timestamptz)`:j``}`} ${u?j`or exists (select 1 from target) or not ${u.create}`:j``} as allowed
12
+ ), ${m} ${u?j`advanced as (
13
13
  update ${c} set inbox_seq = inbox_seq + 1 where id in (select id from target) and exists (select 1 from receipt)
14
14
  returning id, inbox_seq, generation
15
15
  ), forwarded as (
16
16
  insert into ${o} (organization_id, task_id, seq, generation, at, kind, value)
17
17
  select ${e}, id, inbox_seq, generation, ${f}::timestamptz, 'steer', ${p({text:d?.text})} from advanced returning seq
18
- ),`:A``} inserted as (
18
+ ),`:j``} inserted as (
19
19
  insert into ${c} (organization_id, public_id, source, status, agent, flow, runner, permissions,
20
20
  app_id, installation_id, event, prompt, args, mcp, author, definition, credential, requester,
21
21
  runner_id, usage, tools, tool_scopes, context, files, attempts, created_at, updated_at)
22
22
  select ${e}, ${t.id}, ${t.source}, 'queued', ${t.agent}, ${t.flow}, ${t.runner}, ${t.permissions??null},
23
- ${d?A`coalesce((select id from ${s} where key = ${d.appId} and organization_id in (${e}, '')), 0)`:A`null`},
24
- ${d?A`coalesce((select id from ${l} where key = ${`${d.appId}:${d.installationId}`} and organization_id = ${e}), 0)`:A`null`},
23
+ ${d?j`coalesce((select id from ${s} where key = ${d.appId} and organization_id in (${e}, '')), 0)`:j`null`},
24
+ ${d?j`coalesce((select id from ${l} where key = ${`${d.appId}:${d.installationId}`} and organization_id = ${e}), 0)`:j`null`},
25
25
  ${p(d)}, ${t.prompt??null}, ${p(t.args)}, ${p(t.mcp)}, ${t.author??null}, ${p(t.definition)},
26
26
  ${t.credential??null}, ${t.requester??null}, ${t.runnerId??null}, ${p(t.usage)}, ${p(t.tools)},
27
27
  ${p(t.toolScopes)}, ${p(t.context)}, ${p(t.files)}, 0, ${f}::timestamptz, ${f}::timestamptz
28
- from capacity where allowed ${u?A`and ${u.create} and not exists (select 1 from target)`:A``} ${r?A`and exists (select 1 from receipt)`:A``}
28
+ from capacity where allowed ${u?j`and ${u.create} and not exists (select 1 from target)`:j``} ${r?j`and exists (select 1 from receipt)`:j``}
29
29
  returning id
30
- ) select allowed, exists (select 1 from inserted) as inserted ${u?A`, exists (select 1 from forwarded) as steered`:A``} from capacity`}async deliver(e,t,r,i,a,o,s=!0){if(!a)return s&&await this.enqueue(e,t,r,i,o)?{taskId:t.id}:{};let l=t.event,u=A`select id from ${c} where organization_id = ${e} and status in ('queued', 'running', 'waiting')
30
+ ) select allowed, exists (select 1 from inserted) as inserted ${u?j`, exists (select 1 from forwarded) as steered`:j``} from capacity`}async deliver(e,t,r,i,a,o,s=!0){if(!a)return s&&await this.enqueue(e,t,r,i,o)?{taskId:t.id}:{};let l=t.event,u=j`select id from ${c} where organization_id = ${e} and status in ('queued', 'running', 'waiting')
31
31
  and agent = ${t.agent} and source = ${t.source} and flow = 'default'
32
32
  and requester is not distinct from ${t.requester??null}
33
33
  and event->>'appId' is not distinct from ${l?.appId??null}
34
34
  and event->>'installationId' is not distinct from ${l?.installationId??null}
35
35
  and event->'chat'->'thread'->>'id' is not distinct from ${l?.chat?.thread.id??null}
36
36
  and event->'actor'->>'id' = ${l?.actor.id||null}
37
- order by created_at desc, public_id desc limit 1 for update`,f=this.insertion(e,t,r,i,o,{target:u,create:s}),p=[A`select pg_advisory_xact_lock(3, hashtext(${JSON.stringify([e,n(t)])}))`];o!==void 0&&s&&p.push(A`select pg_advisory_xact_lock(1, hashtext(${e}))`);let[m]=await d(this.db,p,f);if(!m?.allowed)throw Error(`Organization task queue is full`);return m.inserted?{taskId:t.id}:m.steered?{steered:!0}:{}}async claim(t,n,r=!1,i){let a=i===void 0?A`true`:A`(select count(*) from ${c} active where active.organization_id = ${c.organizationId} and active.status in ('running', 'waiting')) < ${i}`;if(!r){let[e]=await u(this.db,()=>g(this.db,A`select exists (select 1 from ${c} where status = 'queued' and ${a})
38
- and ${n===void 0?A`true`:A`(select count(*) from ${c} where status in ('running', 'waiting')) < ${n}`} as ready`));if(!e?.ready)return}let o=y(32).toString(`base64url`),s=A`translate(rtrim(replace(encode(convert_to(format('{"task":%s,"organization":%s,"attempt":%s}',
39
- to_json(public_id), to_json(organization_id), attempts + 1), 'UTF8'), 'base64'), E'\\n', ''), '='), '+/', '-_') || '.' || ${o}`,l=A`with stamp as materialized (select date_trunc('milliseconds', clock_timestamp()) as at), picked as materialized (
37
+ order by created_at desc, public_id desc limit 1 for update`,f=this.insertion(e,t,r,i,o,{target:u,create:s}),p=[j`select pg_advisory_xact_lock(3, hashtext(${JSON.stringify([e,n(t)])}))`];o!==void 0&&s&&p.push(j`select pg_advisory_xact_lock(1, hashtext(${e}))`);let[m]=await d(this.db,p,f);if(!m?.allowed)throw Error(`Organization task queue is full`);return m.inserted?{taskId:t.id}:m.steered?{steered:!0}:{}}async claim(t,n,r=!1,i){let a=i===void 0?j`true`:j`(select count(*) from ${c} active where active.organization_id = ${c.organizationId} and active.status in ('running', 'waiting')) < ${i}`;if(!r){let[e]=await u(this.db,()=>g(this.db,j`select exists (select 1 from ${c} where status = 'queued' and ${a})
38
+ and ${n===void 0?j`true`:j`(select count(*) from ${c} where status in ('running', 'waiting')) < ${n}`} as ready`));if(!e?.ready)return}let o=y(32).toString(`base64url`),s=j`translate(rtrim(replace(encode(convert_to(format('{"task":%s,"organization":%s,"attempt":%s}',
39
+ to_json(public_id), to_json(organization_id), attempts + 1), 'UTF8'), 'base64'), E'\\n', ''), '='), '+/', '-_') || '.' || ${o}`,l=j`with stamp as materialized (select date_trunc('milliseconds', clock_timestamp()) as at), picked as materialized (
40
40
  select id, ${s} as bearer from ${c} where status = 'queued'
41
41
  and ${a}
42
- ${n===void 0?A``:A`and (select count(*) from ${c} where status in ('running', 'waiting')) < ${n}`}
42
+ ${n===void 0?j``:j`and (select count(*) from ${c} where status in ('running', 'waiting')) < ${n}`}
43
43
  order by created_at, id limit 1 for update
44
44
  ), claimed as (
45
45
  update ${c} set status = 'running', attempts = attempts + 1, locked_at = (select at from stamp),
@@ -47,16 +47,16 @@ import{Bn as e,a as t,c as n}from"./store-DzqXS2wT.js";import{g as r,h as i,i as
47
47
  token_hash = translate(rtrim(encode(sha256(convert_to(picked.bearer, 'UTF8')), 'base64'), '='), '+/', '-_')
48
48
  from picked where ${c.id} = picked.id returning ${c}.*
49
49
  ) select to_jsonb(claimed) as record, exists (select 1 from ${c} where status = 'queued' and id <> claimed.id
50
- and ${i===void 0?A`true`:A`(select count(*) from ${c} active where active.organization_id = ${c.organizationId} and active.status in ('running', 'waiting')) + case when ${c.organizationId} = claimed.organization_id then 1 else 0 end < ${i}`})
51
- and ${n===void 0?A`true`:A`(select count(*) from ${c} where status in ('running', 'waiting')) + 1 < ${n}`} as more from claimed`,[m]=await d(this.db,n===void 0&&i===void 0?[]:[A`select pg_advisory_xact_lock(2, 0)`],l);if(!m)return;let h=new j(f),_=Object.fromEntries(Object.entries(w(c)).map(([e,t])=>{let n=m.record[h.getColumnCasing(t)];return[e,n===null?null:t.mapFromDriverValue(n)]}));return{organizationId:_.organizationId,status:p(_),token:e(_.publicId,_.organizationId,_.attempts,o).token,more:m.more}}async touch(e,t,n,r,i,a=!1){let o=E(c.status,[`running`,`waiting`]),s=new Date(i).toISOString(),[l]=await this.db.update(c).set({lastSeenAt:A`case when ${o} then ${s}::timestamptz else ${c.lastSeenAt} end`,updatedAt:A`case when ${o} then ${s}::timestamptz else ${c.updatedAt} end`}).where(this.fence(e,t,{tokenHash:n,attempts:r,statuses:a?[`running`,`waiting`,`completed`,`failed`,`cancelled`]:[`running`,`waiting`]})).returning();return l&&p(l)}async patchTask(e,t,n,r,i={}){let{answer:a,archivedAt:o,lastSeenAt:s,...l}=n,[u]=await this.db.update(c).set({...Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t??null])),...a===void 0?{}:{answer:A`coalesce(${c.answer}, '[]'::jsonb) || ${JSON.stringify([a])}::jsonb`},...Object.hasOwn(n,`archivedAt`)?{archivedAt:o===void 0?null:new Date(o)}:{},...Object.hasOwn(n,`lastSeenAt`)?{lastSeenAt:s===void 0?null:new Date(s)}:{},updatedAt:new Date(r)}).where(this.fence(e,t,i)).returning({id:c.id});return!!u}async requeue(e,t,n,r={}){let[i]=await this.db.update(c).set({status:`queued`,lockedAt:null,handle:null,tokenHash:null,lastSeenAt:null,updatedAt:new Date(n)}).where(this.fence(e,t,{...r,statuses:[`running`,`waiting`]})).returning({id:c.id});return!!i}async finish(e,t,n,r,i={}){let a=new Date(r),[o]=await this.db.update(c).set({status:n.status,result:n.result??null,error:n.error??null,tokens:n.tokens??null,lastSeenAt:a,lockedAt:null,finishedAt:a,updatedAt:a}).where(this.fence(e,t,{...i,statuses:[`queued`,`running`,`waiting`]})).returning({id:c.id});return!!o}async continueTask(e,t,n,r,i){let o=A`(select value from ${a} where key = ${v(e,`note`)} ||
50
+ and ${i===void 0?j`true`:j`(select count(*) from ${c} active where active.organization_id = ${c.organizationId} and active.status in ('running', 'waiting')) + case when ${c.organizationId} = claimed.organization_id then 1 else 0 end < ${i}`})
51
+ and ${n===void 0?j`true`:j`(select count(*) from ${c} where status in ('running', 'waiting')) + 1 < ${n}`} as more from claimed`,[m]=await d(this.db,n===void 0&&i===void 0?[]:[j`select pg_advisory_xact_lock(2, 0)`],l);if(!m)return;let h=new M(f),_=Object.fromEntries(Object.entries(w(c)).map(([e,t])=>{let n=m.record[h.getColumnCasing(t)];return[e,n===null?null:t.mapFromDriverValue(n)]}));return{organizationId:_.organizationId,status:p(_),token:e(_.publicId,_.organizationId,_.attempts,o).token,more:m.more}}async touch(e,t,n,r,i,a=!1){let o=E(c.status,[`running`,`waiting`]),s=new Date(i).toISOString(),[l]=await this.db.update(c).set({lastSeenAt:j`case when ${o} then ${s}::timestamptz else ${c.lastSeenAt} end`,updatedAt:j`case when ${o} then ${s}::timestamptz else ${c.updatedAt} end`}).where(this.fence(e,t,{tokenHash:n,attempts:r,statuses:a?[`running`,`waiting`,`completed`,`failed`,`cancelled`]:[`running`,`waiting`]})).returning();return l&&p(l)}async patchTask(e,t,n,r,i={}){let{answer:a,archivedAt:o,lastSeenAt:s,...l}=n,[u]=await this.db.update(c).set({...Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t??null])),...a===void 0?{}:{answer:j`coalesce(${c.answer}, '[]'::jsonb) || ${JSON.stringify([a])}::jsonb`},...Object.hasOwn(n,`archivedAt`)?{archivedAt:o===void 0?null:new Date(o)}:{},...Object.hasOwn(n,`lastSeenAt`)?{lastSeenAt:s===void 0?null:new Date(s)}:{},updatedAt:new Date(r)}).where(this.fence(e,t,i)).returning({id:c.id});return!!u}async requeue(e,t,n,r={}){let[i]=await this.db.update(c).set({status:`queued`,lockedAt:null,handle:null,tokenHash:null,lastSeenAt:null,updatedAt:new Date(n)}).where(this.fence(e,t,{...r,statuses:[`running`,`waiting`]})).returning({id:c.id});return!!i}async finish(e,t,n,r,i={}){let a=new Date(r),[o]=await this.db.update(c).set({status:n.status,result:n.result??null,error:n.error??null,tokens:n.tokens??null,lastSeenAt:a,lockedAt:null,finishedAt:a,updatedAt:a}).where(this.fence(e,t,{...i,statuses:[`queued`,`running`,`waiting`]})).returning({id:c.id});return!!o}async continueTask(e,t,n,r,i){let o=j`(select value from ${a} where key = ${v(e,`note`)} ||
52
52
  case when ${c.source} = ${c.event}->>'integration' then
53
53
  (${c.event}->>'appId') || ':' || (${c.event}->>'installationId') || ':' || coalesce(${c.event}->'chat'->'thread'->>'id', ${c.event}->>'deliveryId')
54
54
  else 'task:' || ${c.publicId} end
55
- and (${a.expiresAt} is null or ${a.expiresAt} > ${new Date(r).toISOString()}::timestamptz))`,s=A`(${JSON.stringify(n.context??{})}::jsonb - 'note') || jsonb_strip_nulls(jsonb_build_object('note', nullif(${o}, '""'::jsonb)))`,[l]=await this.db.update(c).set({prompt:n.prompt??null,context:s,status:`queued`,attempts:0,generation:A`${c.generation} + 1`,inboxAck:-1,result:null,error:null,tokens:null,handle:null,tokenHash:null,lastSeenAt:null,logCursor:null,lockedAt:null,startedAt:null,finishedAt:null,cancelRequestedAt:null,approval:null,answer:null,updatedAt:new Date(r)}).where(this.fence(e,t,{...i,statuses:[`completed`,`failed`,`cancelled`]})).returning({context:c.context});return l&&(n.context=l.context??void 0),!!l}async completeTask(e,t,n,i){let{outcome:s,usage:l,note:u}=n,d=new Date(i).toISOString(),f=u&&_(e,`note`,u.key),p=u?u.value?A`, note as (
55
+ and (${a.expiresAt} is null or ${a.expiresAt} > ${new Date(r).toISOString()}::timestamptz))`,s=j`(${JSON.stringify(n.context??{})}::jsonb - 'note') || jsonb_strip_nulls(jsonb_build_object('note', nullif(${o}, '""'::jsonb)))`,[l]=await this.db.update(c).set({prompt:n.prompt??null,context:s,status:`queued`,attempts:0,generation:j`${c.generation} + 1`,inboxAck:-1,result:null,error:null,tokens:null,handle:null,tokenHash:null,lastSeenAt:null,logCursor:null,lockedAt:null,startedAt:null,finishedAt:null,cancelRequestedAt:null,approval:null,answer:null,updatedAt:new Date(r)}).where(this.fence(e,t,{...i,statuses:[`completed`,`failed`,`cancelled`]})).returning({context:c.context});return l&&(n.context=l.context??void 0),!!l}async completeTask(e,t,n,i){let{outcome:s,usage:l,note:u}=n,d=new Date(i).toISOString(),f=u&&_(e,`note`,u.key),p=u?u.value?j`, note as (
56
56
  insert into ${a} (key, value, expires_at)
57
57
  select ${f}, ${JSON.stringify(u.value)}::jsonb, ${new Date(i+u.ttlMs).toISOString()}::timestamptz from finished
58
58
  on conflict (key) do update set value = excluded.value, expires_at = excluded.expires_at
59
- )`:A`, note as (delete from ${a} where key = ${f} and exists (select 1 from finished))`:A``,[m]=await g(this.db,A`
59
+ )`:j`, note as (delete from ${a} where key = ${f} and exists (select 1 from finished))`:j``,[m]=await g(this.db,j`
60
60
  with finished as (
61
61
  update ${c} set status = ${s.status}, result = ${JSON.stringify(s.result??null)}::jsonb,
62
62
  error = ${s.error??null}, tokens = ${JSON.stringify(s.tokens??null)}::jsonb,
@@ -69,9 +69,9 @@ import{Bn as e,a as t,c as n}from"./store-DzqXS2wT.js";import{g as r,h as i,i as
69
69
  ${l.credential}, ${l.runnerElapsedMs}, ${JSON.stringify(l.tokens??null)}::jsonb, ${new Date(l.at).toISOString()}::timestamptz, ${d}::timestamptz from finished
70
70
  on conflict (task_id) do update set installation_id = excluded.installation_id, agent = excluded.agent, target = excluded.target,
71
71
  engine = excluded.engine, model = excluded.model, credential = excluded.credential, runner_ms = ${r.runnerMs} + excluded.runner_ms,
72
- tokens = ${M(A`${r.tokens}`,l.tokens)}, at = excluded.at, updated_at = excluded.updated_at
72
+ tokens = ${N(j`${r.tokens}`,l.tokens)}, at = excluded.at, updated_at = excluded.updated_at
73
73
  ) ${p}
74
- select exists (select 1 from finished) as completed`);return!!m?.completed}async cancel(e,n,r,i={}){let a=new Date(r).toISOString(),[s]=await g(this.db,A`
74
+ select exists (select 1 from finished) as completed`);return!!m?.completed}async cancel(e,n,r,i={}){let a=new Date(r).toISOString(),[s]=await g(this.db,j`
75
75
  with cancelled as (
76
76
  update ${c} set status = case when status = 'queued' then 'cancelled' else status end,
77
77
  finished_at = case when status = 'queued' then ${a}::timestamptz else finished_at end,
@@ -81,23 +81,23 @@ import{Bn as e,a as t,c as n}from"./store-DzqXS2wT.js";import{g as r,h as i,i as
81
81
  ), message as (
82
82
  insert into ${o} (organization_id, task_id, seq, generation, kind, value, at)
83
83
  select ${e}, id, inbox_seq, generation, 'cancel', 'null'::jsonb, ${a}::timestamptz from cancelled where status in ('running', 'waiting')
84
- ) select exists(select 1 from cancelled) as accepted`);return!!s?.accepted}async cancelRequested(e,t){let[n]=await u(this.db,()=>this.db.select({at:c.cancelRequestedAt}).from(c).where(this.where(e,t)));return!!n?.at}filter(e,t){let n=t.status?[t.status]:t.statuses,r=t.q?.trim(),i=r&&`%${r.replace(/[\\%_]/g,`\\$&`)}%`;return b(C(c.organizationId,e),n?E(c.status,n):void 0,t.agent?C(c.agent,t.agent):void 0,t.source?C(c.source,t.source):void 0,t.archived===void 0?void 0:t.archived?D(c.archivedAt):O(c.archivedAt),i?k(T(A`${c.event}->>'text'`,i),T(c.prompt,i),T(c.agent,i),T(c.publicId,i)):void 0)}pageQuery(e,t){let{before:n}=t,r=t.summary?{publicId:c.publicId,source:c.source,agent:c.agent,flow:c.flow,prompt:c.prompt,event:A`case when ${c.event} is not null then jsonb_build_object('integration', ${c.event}->>'integration', 'type', ${c.event}->>'type', 'text', ${c.event}->>'text') end`.as(`event`),status:c.status,attempts:c.attempts,createdAt:c.createdAt,startedAt:c.startedAt,finishedAt:c.finishedAt}:w(c),i=this.db.select(r).from(c).where(b(this.filter(e,t),n?A`(${c.createdAt}, ${c.publicId}) < (${new Date(n.createdAt).toISOString()}::timestamptz, ${n.id})`:void 0)).orderBy(S(c.createdAt),S(c.publicId));return t.limit===void 0?i:i.limit(t.limit)}record(e,t){return t?m({task:m({id:e.publicId,source:e.source,agent:e.agent,flow:e.flow,prompt:e.prompt,event:e.event}),status:e.status,attempts:e.attempts,createdAt:h(e.createdAt),startedAt:e.startedAt?h(e.startedAt):void 0,finishedAt:e.finishedAt?h(e.finishedAt):void 0}):p(e)}async list(e,t={}){return(await u(this.db,()=>this.pageQuery(e,t))).map(e=>this.record(e,t.summary))}countQuery(e,n){return this.db.select({all:A`count(*)::int`.as(`all`),active:A`(count(*) filter (where ${E(c.status,t)}))::int`.as(`active`),waiting:A`(count(*) filter (where ${C(c.status,`waiting`)}))::int`.as(`waiting`)}).from(c).where(this.filter(e,n))}async counts(e,t={}){let[n]=await u(this.db,()=>this.countQuery(e,t));return n??{all:0,active:0,waiting:0}}async listWithCounts(e,t){let n=this.db.$with(`totals`).as(this.countQuery(e,t)),r=this.db.$with(`page`).as(this.pageQuery(e,{...t,limit:t.limit??20})),i=Object.fromEntries(Object.keys(r._.selectedFields).map(e=>[e,r[e]])),a=await u(this.db,()=>this.db.with(n,r).select({...i,all:n.all,active:n.active,waiting:n.waiting}).from(n).leftJoin(r,A`true`).orderBy(S(r.createdAt),S(r.publicId))),{all:o=0,active:s=0,waiting:c=0}=a[0]??{};return{items:a.filter(e=>e.publicId!==null&&e.publicId!==void 0).map(e=>this.record(e,t.summary)),counts:{all:o,active:s,waiting:c}}}async runningCount(){let[e]=await u(this.db,()=>this.db.select({value:A`count(*)::int`}).from(c).where(E(c.status,[`running`,`waiting`])));return e?.value??0}async running(){return(await u(this.db,()=>this.db.select().from(c).where(E(c.status,[`running`,`waiting`])))).map(e=>({organizationId:e.organizationId,status:p(e)}))}async appendLogs(e,t,n,r,a,o,s){let l=n.length?A`, inserted as (
84
+ ) select exists(select 1 from cancelled) as accepted`);return!!s?.accepted}async cancelRequested(e,t){let[n]=await u(this.db,()=>this.db.select({at:c.cancelRequestedAt}).from(c).where(this.where(e,t)));return!!n?.at}filter(e,t){let n=t.status?[t.status]:t.statuses,r=t.q?.trim(),i=r&&`%${r.replace(/[\\%_]/g,`\\$&`)}%`;return b(C(c.organizationId,e),n?E(c.status,n):void 0,t.agent?C(c.agent,t.agent):void 0,t.source?C(c.source,t.source):void 0,t.archived===void 0?void 0:t.archived?D(c.archivedAt):O(c.archivedAt),i?A(T(j`${c.event}->>'text'`,i),T(c.prompt,i),T(c.agent,i),T(c.publicId,i)):void 0)}pageQuery(e,n){let{before:r}=n,i=n.summary?{publicId:c.publicId,source:c.source,agent:c.agent,flow:c.flow,prompt:c.prompt,event:j`case when ${c.event} is not null then jsonb_build_object('integration', ${c.event}->>'integration', 'type', ${c.event}->>'type', 'text', ${c.event}->>'text') end`.as(`event`),status:c.status,attempts:c.attempts,createdAt:c.createdAt,startedAt:c.startedAt,finishedAt:c.finishedAt}:w(c),a=this.db.select(i).from(c).where(b(this.filter(e,n),r?this.after(r):void 0)).orderBy(S(E(c.status,t)),S(c.createdAt),S(c.publicId));return n.limit===void 0?a:a.limit(n.limit)}after(e){let n=j`(${c.createdAt}, ${c.publicId}) < (${new Date(e.createdAt).toISOString()}::timestamptz, ${e.id})`,r=E(c.status,t);return e.active?A(k(r),b(r,n)):b(k(r),n)}record(e,t){return t?m({task:m({id:e.publicId,source:e.source,agent:e.agent,flow:e.flow,prompt:e.prompt,event:e.event}),status:e.status,attempts:e.attempts,createdAt:h(e.createdAt),startedAt:e.startedAt?h(e.startedAt):void 0,finishedAt:e.finishedAt?h(e.finishedAt):void 0}):p(e)}async list(e,t={}){return(await u(this.db,()=>this.pageQuery(e,t))).map(e=>this.record(e,t.summary))}countQuery(e,n){return this.db.select({all:j`count(*)::int`.as(`all`),active:j`(count(*) filter (where ${E(c.status,t)}))::int`.as(`active`),waiting:j`(count(*) filter (where ${C(c.status,`waiting`)}))::int`.as(`waiting`)}).from(c).where(this.filter(e,n))}async counts(e,t={}){let[n]=await u(this.db,()=>this.countQuery(e,t));return n??{all:0,active:0,waiting:0}}async listWithCounts(e,n){let r=this.db.$with(`totals`).as(this.countQuery(e,n)),i=this.db.$with(`page`).as(this.pageQuery(e,{...n,limit:n.limit??20})),a=Object.fromEntries(Object.keys(i._.selectedFields).map(e=>[e,i[e]])),o=await u(this.db,()=>this.db.with(r,i).select({...a,all:r.all,active:r.active,waiting:r.waiting}).from(r).leftJoin(i,j`true`).orderBy(S(E(a.status,t)),S(i.createdAt),S(i.publicId))),{all:s=0,active:c=0,waiting:l=0}=o[0]??{};return{items:o.filter(e=>e.publicId!==null&&e.publicId!==void 0).map(e=>this.record(e,n.summary)),counts:{all:s,active:c,waiting:l}}}async runningCount(){let[e]=await u(this.db,()=>this.db.select({value:j`count(*)::int`}).from(c).where(E(c.status,[`running`,`waiting`])));return e?.value??0}async running(){return(await u(this.db,()=>this.db.select().from(c).where(E(c.status,[`running`,`waiting`])))).map(e=>({organizationId:e.organizationId,status:p(e)}))}async appendLogs(e,t,n,r,a,o,s){let l=n.length?j`, inserted as (
85
85
  insert into ${i} (organization_id, task_id, seq, at, level, line)
86
86
  select ${e}, accepted.id, entry.seq, to_timestamp(entry.at / 1000.0), entry.level, entry.line
87
87
  from accepted cross join jsonb_to_recordset(${JSON.stringify(n)}::jsonb) as entry(seq int, at bigint, level text, line text)
88
- )`:A``,[u]=await g(this.db,A`
88
+ )`:j``,[u]=await g(this.db,j`
89
89
  with accepted as (
90
90
  update ${c} set log_cursor = ${a.cursor}, log_seq = ${a.seq}, log_bytes = ${a.bytes}, updated_at = ${new Date(o).toISOString()}::timestamptz
91
91
  where ${this.fence(e,t,s)} and coalesce(log_seq, 0) = ${r.seq} and coalesce(log_cursor, -1) = ${r.cursor}
92
92
  returning id
93
- ) ${l} select exists (select 1 from accepted) as accepted`);return!!u?.accepted}async readInbox(e,n,r,i){return(await u(this.db,()=>this.db.select({seq:o.seq,generation:o.generation,at:o.at,kind:o.kind,value:o.value}).from(o).innerJoin(c,C(c.id,o.taskId)).where(b(this.where(e,n),C(c.generation,r),E(c.status,t),C(o.generation,r),A`${o.seq} > ${i}`)).orderBy(x(o.seq)).limit(100))).map(e=>({...e,at:h(e.at)}))}async appendInbox(e,n,r,i,a,s){let[l]=await g(this.db,A`
93
+ ) ${l} select exists (select 1 from accepted) as accepted`);return!!u?.accepted}async readInbox(e,n,r,i){return(await u(this.db,()=>this.db.select({seq:o.seq,generation:o.generation,at:o.at,kind:o.kind,value:o.value}).from(o).innerJoin(c,C(c.id,o.taskId)).where(b(this.where(e,n),C(c.generation,r),E(c.status,t),C(o.generation,r),j`${o.seq} > ${i}`)).orderBy(x(o.seq)).limit(100))).map(e=>({...e,at:h(e.at)}))}async appendInbox(e,n,r,i,a,s){let[l]=await g(this.db,j`
94
94
  with next as (
95
95
  update ${c} set inbox_seq = inbox_seq + 1 where ${this.fence(e,n,{generation:s,statuses:t})} returning id, inbox_seq, generation
96
96
  ) insert into ${o} (organization_id, task_id, seq, generation, kind, value, at)
97
- select ${e}, id, inbox_seq, generation, ${r}, ${JSON.stringify(i??null)}::jsonb, ${new Date(a).toISOString()}::timestamptz from next returning seq`);return l&&{seq:l.seq,generation:s,at:a,kind:r,value:i}}async fetchInbox(e,t,n,r,i){let[a]=await u(this.db,()=>g(this.db,A`
97
+ select ${e}, id, inbox_seq, generation, ${r}, ${JSON.stringify(i??null)}::jsonb, ${new Date(a).toISOString()}::timestamptz from next returning seq`);return l&&{seq:l.seq,generation:s,at:a,kind:r,value:i}}async fetchInbox(e,t,n,r,i){let[a]=await u(this.db,()=>g(this.db,j`
98
98
  select coalesce(jsonb_agg(jsonb_build_object('seq', i.seq, 'generation', i.generation, 'at', extract(epoch from i.at) * 1000, 'kind', i.kind, 'value', i.value) order by i.seq) filter (where i.seq is not null), '[]'::jsonb) as entries
99
99
  from ${c} left join ${o} i on i.task_id = ${c.id} and i.generation = ${c.generation} and i.seq > ${i}
100
- where ${this.fence(e,t,{tokenHash:n,attempts:r,statuses:[`running`,`waiting`]})} group by ${c.id}`));return a?.entries}async ackInbox(e,t,n,r){if(r.generation!==void 0&&r.generation!==n.generation)return!1;let[i]=await g(this.db,A`
100
+ where ${this.fence(e,t,{tokenHash:n,attempts:r,statuses:[`running`,`waiting`]})} group by ${c.id}`));return a?.entries}async ackInbox(e,t,n,r){if(r.generation!==void 0&&r.generation!==n.generation)return!1;let[i]=await g(this.db,j`
101
101
  with current as (
102
102
  select id from ${c} where ${this.fence(e,t,{...r,generation:n.generation,statuses:void 0})}
103
103
  and inbox_seq >= ${n.seq} and (status in ('running', 'waiting') or (status in ('completed', 'failed', 'cancelled') and inbox_ack >= ${n.seq})) for update
@@ -113,4 +113,4 @@ import{Bn as e,a as t,c as n}from"./store-DzqXS2wT.js";import{g as r,h as i,i as
113
113
  approval = case when exists(select 1 from applied where kind = 'approve' and value->>'approvalId' = ${c.approval}->>'id') then null else approval end,
114
114
  finished_at = case when exists(select 1 from applied where kind = 'cancel') then now() else finished_at end
115
115
  from answers where id in (select id from current)
116
- ) select exists (select 1 from current) as accepted`);return!!i?.accepted}async pendingInbox(){return(await u(this.db,()=>this.db.select().from(c).where(b(E(c.status,[`running`,`waiting`]),A`exists (select 1 from ${o} where ${o.taskId} = ${c.id} and ${o.generation} = ${c.generation})`)))).map(e=>({organizationId:e.organizationId,status:p(e)}))}};export{N as DrizzleQueue};
116
+ ) select exists (select 1 from current) as accepted`);return!!i?.accepted}async pendingInbox(){return(await u(this.db,()=>this.db.select().from(c).where(b(E(c.status,[`running`,`waiting`]),j`exists (select 1 from ${o} where ${o.taskId} = ${c.id} and ${o.generation} = ${c.generation})`)))).map(e=>({organizationId:e.organizationId,status:p(e)}))}};export{P as DrizzleQueue};
@@ -0,0 +1 @@
1
+ import{D as e,bn as t}from"./dispatch-BKeAch9E.js";import{i as n}from"./cli-DWCR7iqa.js";const r=n({name:`upgrade refresh`,options:{},run:()=>e(t())});export{r as commandRefreshUpdate};
@@ -1 +1 @@
1
- import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-BilSDkvE.js";import{p as r}from"./output-BKeyLbvt.js";import{n as i,o as a}from"./args-BOEEdpWk.js";import o from"node:process";const s={json:i,server:a,yes:i},c=t({name:`runner remove`,globalFlags:{cwd:!1},help:{usage:`coder runner remove <id> [--server [url]] [--json]`,flags:[n]},options:s,args:1,async run({options:t,args:[n]}){let{removeRunner:r}=await import(`./runner-sUpWJ_k0.js`).then(e=>e.a);if(!n)throw new e(`invalid-option`,`Missing runner id.`);return r(n,t)},print:(e,{args:[t]})=>o.stdout.write(`Removed ${r.bold(t)}.\n`)});export{c as commandRunnerRemove,s as runnerOptions};
1
+ import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-DWCR7iqa.js";import{p as r}from"./output-BKeyLbvt.js";import{n as i,o as a}from"./args-BOEEdpWk.js";import o from"node:process";const s={json:i,server:a,yes:i},c=t({name:`runner remove`,globalFlags:{cwd:!1},help:{usage:`coder runner remove <id> [--server [url]] [--json]`,flags:[n]},options:s,args:1,async run({options:t,args:[n]}){let{removeRunner:r}=await import(`./runner-sUpWJ_k0.js`).then(e=>e.a);if(!n)throw new e(`invalid-option`,`Missing runner id.`);return r(n,t)},print:(e,{args:[t]})=>o.stdout.write(`Removed ${r.bold(t)}.\n`)});export{c as commandRunnerRemove,s as runnerOptions};
@@ -1 +1 @@
1
- import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-BilSDkvE.js";import{p as r}from"./output-BKeyLbvt.js";import{n as i,o as a}from"./args-BOEEdpWk.js";import o from"node:process";const s={json:i,server:a,workspace:i,yes:i},c=()=>new e(`invalid-option`,`Missing credential label.`),l=t({name:`credentials remove`,globalFlags:{cwd:!1},help:{usage:`coder credentials remove <label> [--workspace] [--server [url]] [--json]`,flags:[[`--workspace`,`the workspace credential of that label`],n]},options:s,args:1,async run({options:e,args:[t]}){let{connect:n}=await import(`./remote-miQNTVRa.js`).then(e=>e.a);if(!t)throw c();return n(e).credentials.remove(t,e)},print:(e,{args:[t]})=>o.stdout.write(`Removed ${r.bold(t)}.\n`)});export{l as commandCredentialsRemove,s as credentialOptions,c as missingLabel};
1
+ import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-DWCR7iqa.js";import{p as r}from"./output-BKeyLbvt.js";import{n as i,o as a}from"./args-BOEEdpWk.js";import o from"node:process";const s={json:i,server:a,workspace:i,yes:i},c=()=>new e(`invalid-option`,`Missing credential label.`),l=t({name:`credentials remove`,globalFlags:{cwd:!1},help:{usage:`coder credentials remove <label> [--workspace] [--server [url]] [--json]`,flags:[[`--workspace`,`the workspace credential of that label`],n]},options:s,args:1,async run({options:e,args:[t]}){let{connect:n}=await import(`./remote-miQNTVRa.js`).then(e=>e.a);if(!t)throw c();return n(e).credentials.remove(t,e)},print:(e,{args:[t]})=>o.stdout.write(`Removed ${r.bold(t)}.\n`)});export{l as commandCredentialsRemove,s as credentialOptions,c as missingLabel};
@@ -1 +1 @@
1
- import{st as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-BilSDkvE.js";import{n,t as r}from"./args-BOEEdpWk.js";import i from"node:process";const a=t({name:`mcp remove`,helpName:`mcp rm`,help:{usage:`coder mcp rm <name> [--user] [--cwd <dir>]`,summary:"Remove `mcp.<name>` from the repo config (or the user config with --user).",flags:[[`--user`,`edit ~/.coder config`]]},options:{...r,user:n},args:1,run:({options:t,args:[n],cwd:r})=>e(r,n,t),print:({name:e,file:t})=>i.stdout.write(`Removed MCP server "${e}" from ${t}.\n`)});export{a as commandMcpRemove};
1
+ import{st as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-DWCR7iqa.js";import{n,t as r}from"./args-BOEEdpWk.js";import i from"node:process";const a=t({name:`mcp remove`,helpName:`mcp rm`,help:{usage:`coder mcp rm <name> [--user] [--cwd <dir>]`,summary:"Remove `mcp.<name>` from the repo config (or the user config with --user).",flags:[[`--user`,`edit ~/.coder config`]]},options:{...r,user:n},args:1,run:({options:t,args:[n],cwd:r})=>e(r,n,t),print:({name:e,file:t})=>i.stdout.write(`Removed MCP server "${e}" from ${t}.\n`)});export{a as commandMcpRemove};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DT7IzrpZ.js";import{i as t}from"./cli-BilSDkvE.js";import{p as n}from"./output-BKeyLbvt.js";import{i as r}from"./models-_5LVGC3m.js";import{n as i}from"./add-U-pty9qJ.js";import a from"node:process";var o=e({commandModelRemove:()=>s,printModelChange:()=>c});const s=t({name:`model remove`,help:{usage:`coder model remove <name>`,summary:`Remove a configured custom model.`,flags:[[`--workspace`,`target <repo>/.coder/config.json instead of the user file`]]},options:i,args:1,run:({options:e,args:[t],cwd:n})=>r(n,t,e),print:e=>c(`removed`,e.removed,e.file)});function c(e,t,r){a.stdout.write(`${e} ${n.cyan(t)} ${n.dim(`(${r})`)}\n`)}export{o as n,c as t};
1
+ import{t as e}from"./rolldown-runtime-DT7IzrpZ.js";import{i as t}from"./cli-DWCR7iqa.js";import{p as n}from"./output-BKeyLbvt.js";import{i as r}from"./models-_5LVGC3m.js";import{n as i}from"./add-CLYTF_up.js";import a from"node:process";var o=e({commandModelRemove:()=>s,printModelChange:()=>c});const s=t({name:`model remove`,help:{usage:`coder model remove <name>`,summary:`Remove a configured custom model.`,flags:[[`--workspace`,`target <repo>/.coder/config.json instead of the user file`]]},options:i,args:1,run:({options:e,args:[t],cwd:n})=>r(n,t,e),print:e=>c(`removed`,e.removed,e.file)});function c(e,t,r){a.stdout.write(`${e} ${n.cyan(t)} ${n.dim(`(${r})`)}\n`)}export{o as n,c as t};
@@ -1 +1 @@
1
- import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-BilSDkvE.js";import{p as r}from"./output-BKeyLbvt.js";import{runnerOptions as i}from"./remove-B93LNkZI.js";import a from"node:process";const o=t({name:`runner rename`,globalFlags:{cwd:!1},help:{usage:`coder runner rename <id> <name> [--server [url]] [--json]`,flags:[n]},options:i,args:2,async run({options:t,args:[n,r]}){let{updateRunner:i}=await import(`./runner-sUpWJ_k0.js`).then(e=>e.a);if(!n||!r)throw new e(`invalid-option`,`Usage: coder runner rename <id> <name>`);return i(n,{name:r},t)},print:(e,{args:[t]})=>a.stdout.write(`Renamed ${t} to ${r.bold(e.name)}.\n`)});export{o as commandRunnerRename};
1
+ import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t,t as n}from"./cli-DWCR7iqa.js";import{p as r}from"./output-BKeyLbvt.js";import{runnerOptions as i}from"./remove-BNzbUhaK.js";import a from"node:process";const o=t({name:`runner rename`,globalFlags:{cwd:!1},help:{usage:`coder runner rename <id> <name> [--server [url]] [--json]`,flags:[n]},options:i,args:2,async run({options:t,args:[n,r]}){let{updateRunner:i}=await import(`./runner-sUpWJ_k0.js`).then(e=>e.a);if(!n||!r)throw new e(`invalid-option`,`Usage: coder runner rename <id> <name>`);return i(n,{name:r},t)},print:(e,{args:[t]})=>a.stdout.write(`Renamed ${t} to ${r.bold(e.name)}.\n`)});export{o as commandRunnerRename};
@@ -1,4 +1,4 @@
1
- import{ln as e,xt as t}from"./dispatch-BKeAch9E.js";import{i as n}from"./cli-BilSDkvE.js";import{c as r,m as i,p as a,s as o}from"./output-BKeyLbvt.js";import{l as s,t as c}from"./args-BOEEdpWk.js";import{gateLine as l,gateRunningLine as u,paintPlain as d,printLedger as f,resultJson as p,stepSymbol as m,taskLabel as h,taskLine as g}from"./watch-CSdj24ct.js";import _ from"node:process";const v=n({name:`flow result`,help:{usage:`coder flow result [run-id] [--tail <n|all>] [--json]`,summary:`Show a flow run's status and result, with its tasks, gates, and token ledger.
1
+ import{ln as e,xt as t}from"./dispatch-BKeAch9E.js";import{i as n}from"./cli-DWCR7iqa.js";import{c as r,m as i,p as a,s as o}from"./output-BKeyLbvt.js";import{l as s,t as c}from"./args-BOEEdpWk.js";import{gateLine as l,gateRunningLine as u,paintPlain as d,printLedger as f,resultJson as p,stepSymbol as m,taskLabel as h,taskLine as g}from"./watch-eE2XiwsC.js";import _ from"node:process";const v=n({name:`flow result`,help:{usage:`coder flow result [run-id] [--tail <n|all>] [--json]`,summary:`Show a flow run's status and result, with its tasks, gates, and token ledger.
2
2
  --tail <n> caps the step rows (0 for the result alone). Defaults to the most
3
3
  recent run. To watch a run live, prefer \`coder flow watch\`.`,flags:[[`--tail <n|all>`,`show the last n step rows (default: all; 0 hides them)`]],examples:[[`coder flow result --tail 0`,`the most recent run's result, no step rows`]]},options:{...c,tail:s},args:1,async run({options:e,args:[n]}){let{runResult:r}=await import(`./executor-BvAA7Cgw.js`).then(e=>e.y),i=r(n);if(!i&&!e.json)throw new t(`flow-failed`,n?`No flow run "${n}".`:`No flow runs yet.`,{hint:`Run one: coder flow run <name>`});return i},json:e=>e&&p(e),print:(e,{options:t})=>b(e,t.tail)});function y(e,t=!1){let n=a;if(t)return e.map(d);let r=(t,n)=>{for(let r=t+1;r<e.length;r+=1){let t=e[r].depth;if(t<n)return!1;if(t===n)return!0}return!1};return e.map((e,t)=>{let i=``;for(let n=0;n<e.depth;n+=1)i+=r(t,n)?`│ `:` `;return i+=e.log?`│ `:r(t,e.depth)?`├─`:`└─`,`${n.dim(i)} ${e.body}`})}function b(t,n=`all`){let s=a,c=!_.stdout.isTTY;_.stdout.write(`${s.bold(`Flow`)} ${s.cyan(t.name)} ${s.dim(`(${t.runId})`)}. ${s.bold(i(t.status))}\n`);let d=t.steps,p=d.filter(t=>e.includes(t.status)).length,v=t.status===`running`?`${p}/${d.length} tasks`:`${t.taskCount} tasks`;if(_.stdout.write(`${s.dim(`started ${t.startedAt}${t.endedAt?` · ended ${t.endedAt}`:``} · ${v}`)}\n`),n!==0){let e=new Map,r=new Map,i=new Map,a=[];for(let n of t.events)if(n.kind===`task-start`){let t={name:h(n.name,n.prompt),engine:n.engine,depth:n.depth??0};e.set(n.taskId,t),r.set(n.taskId,t)}else if(n.kind===`task-end`){r.delete(n.taskId);let t=e.get(n.taskId);a.push({depth:t?.depth??0,body:g(m(n.status,c),t?.name??null,n.taskId,n.tokens,t?.engine)})}else if(n.kind===`gate-start`)i.set(n.gateId,{cmd:n.cmd,depth:n.depth??0});else if(n.kind===`gate`)n.gateId&&i.delete(n.gateId),a.push({depth:n.depth??0,body:l(n,c)});else if(n.kind===`log`)for(let e of n.message.split(`
4
4
  `))a.push({depth:n.depth??0,body:s.light(e),log:!0});else n.kind===`flow-start`&&a.push({depth:n.depth-1,body:s.bold(`flow ${n.name}`)});for(let[e,t]of r)a.push({depth:t.depth??0,body:g(m(`running`,c),t.name,e,null,t.engine)+(c?``:` ${s.light(`running`)}`)});for(let e of i.values())a.push({depth:e.depth,body:u(e.cmd,m(`running`,c))+(c?``:` ${s.light(`running`)}`)});if(!a.length)for(let e of n===`all`?d:d.slice(-n))a.push({depth:0,body:g(m(e.status,c),e.name,e.taskId??`-`,e.tokens)});let o=y(a,c),f=n===`all`?o:o.slice(-n);f.length&&_.stdout.write(`\n${f.join(`
@@ -1,4 +1,4 @@
1
- import{Dn as e,Nt as t,cn as n,wt as r}from"./dispatch-BKeAch9E.js";import{i,r as a}from"./cli-BilSDkvE.js";import{S as o,a as s,d as c,m as l,o as u,p as d,s as f,u as p,x as m,y as h}from"./output-BKeyLbvt.js";import{i as g,l as _,n as v,s as y,t as b}from"./args-BOEEdpWk.js";import x from"node:process";const S={server:g,workspace:y,yes:v};function C(e,t,n,r=d){let i=e?.error?.message??t;return e?.finalMessage||(i?`${r.red(`error:`)} ${i}`:n)}const w=1e3;function T(e,t=d,{truncate:n=!0}={}){let r=e=>e.split(`
1
+ import{Dn as e,Nt as t,cn as n,wt as r}from"./dispatch-BKeAch9E.js";import{i,r as a}from"./cli-DWCR7iqa.js";import{S as o,a as s,d as c,m as l,o as u,p as d,s as f,u as p,x as m,y as h}from"./output-BKeyLbvt.js";import{i as g,l as _,n as v,s as y,t as b}from"./args-BOEEdpWk.js";import x from"node:process";const S={server:g,workspace:y,yes:v};function C(e,t,n,r=d){let i=e?.error?.message??t;return e?.finalMessage||(i?`${r.red(`error:`)} ${i}`:n)}const w=1e3;function T(e,t=d,{truncate:n=!0}={}){let r=e=>e.split(`
2
2
  `).map(e=>` ${t.dim(e)}`);return!n||e.length<=w?[t.dim(`prompt:`),...r(e)]:[t.dim(`prompt:`),...r(e.slice(0,500).trimEnd()),t.light(` … <${e.length-w} chars trimmed> …`),...r(e.slice(-500).trimStart())]}function E(e,t=d){let n=[];e.permissions&&n.push([`perms`,e.permissions]),e.cwd&&n.push([`cwd`,e.cwd]);for(let t of e.addDirs??[])n.push([`add-dir`,t]);return n.map(([e,n])=>`${t.dim(e.padEnd(8))} ${n}`)}function D(e,t){if(t)return e.createdAt?`started ${s(r(e.createdAt))} ago`:``;let n=e.createdAt&&e.completedAt?Date.parse(e.completedAt)-Date.parse(e.createdAt):null;return[e.completedAt?`finished ${s(r(e.completedAt))} ago`:``,n!==null&&n>=0?`took ${s(n)}`:``].filter(Boolean).join(` · `)}function O(e,{status:r,tokens:i,tokenModel:a,files:o,live:s=!1,style:u=d}){let f=D(e,n.includes(e.status)||r===`waiting-approval`),m=e=>u.dim(e.padEnd(8));return[`${m(`task`)} ${u.cyan(e.id)}`,...e.name?[`${m(`name`)} ${e.name}`]:[],`${m(`status`)} ${l(r)}${f?` ${u.dim(`(${f})`)}`:``}`,`${m(`engine`)} ${t(e)}`,...E(e,u),...i?[`${m(`tokens`)} ${s?c(i):p(i,a??e.model)}${s?u.dim(` (so far)`):``}`]:[],...k(o,m,u)]}const k=(e,t,n)=>e?.length?[`${t(`files`)} ${e.join(`, `)} ${n.dim(`(shell edits not included)`)}`]:[];function A(e,{tokens:t,tokenModel:n,files:r,statusChanged:i=!0,style:a=d}){let o=e=>a.dim(e.padEnd(8)),c=e.createdAt&&e.completedAt?Date.parse(e.completedAt)-Date.parse(e.createdAt):null;return[...i?[`${o(`status`)} ${l(e.status)}${c!==null&&c>=0?` ${a.dim(`(took ${s(c)})`)}`:``}`]:[],...t?[`${o(`tokens`)} ${p(t,n??e.model)}`]:[],...k(r,o,a)]}function j(e,t=300,{plain:n=!1,style:r=d}={}){if(e.length<=t)return e;let i=`<${e.length-t} more chars>`;return`${e.slice(0,t)} ${n?i:r.dim(i)}`}const M=` `.repeat(8),N={assistant:`●`,reasoning:`✻`,tool:`→`,"tool-result":` `,usage:`·`,status:`·`,info:`·`,error:`✘`,steer:`⚑`};function P(e,t){let n=/^\x1b\[[0-9;]*m/.exec(t(``))?.[0];return t(n&&e.includes(F)?e.split(F).join(`${F}${n}`):e)}const F=`\x1B[0m`;function I(e,t,n,r,i=r.dim){if(!e)return``;let a=(e.length>t?e.slice(0,t):e).split(`
3
3
  `).map(e=>P(e,i));return e.length>t&&(a[a.length-1]+=` ${r.light(`<${e.length-t} more chars>`)}`),a.length>n?[...a.slice(0,n),r.light(`… +${a.length-n} more lines`)].join(`
4
4
  `):a.join(`
@@ -1,3 +1,3 @@
1
- import{i as e}from"./cli-BilSDkvE.js";import{printFollow as t,printRunSummary as n}from"./watch-CSdj24ct.js";import{RUN_FLAGS as r,hooks as i,parseRunArgs as a,printDetached as o,runOptions as s}from"./run-CTtd0Znc.js";const c=e({name:`flow resume`,help:{usage:`coder flow resume [run-id] [--wait] [--json] [--dry-run]`,summary:`Re-run a flow from its journal: finished steps replay instantly, the first
1
+ import{i as e}from"./cli-DWCR7iqa.js";import{printFollow as t,printRunSummary as n}from"./watch-eE2XiwsC.js";import{RUN_FLAGS as r,hooks as i,parseRunArgs as a,printDetached as o,runOptions as s}from"./run-BWbabvub.js";const c=e({name:`flow resume`,help:{usage:`coder flow resume [run-id] [--wait] [--json] [--dry-run]`,summary:`Re-run a flow from its journal: finished steps replay instantly, the first
2
2
  changed or new step onward runs live. Defaults to the most recent run.
3
3
  Accepts the same flags as flow run.`,flags:[[`--wait`,`follow the run in the foreground (Ctrl-C detaches; it keeps running)`],[`--concurrency <n>`,`tasks running at once`],[`--max-tasks <n>`,`total tasks the run may dispatch`]],examples:[[`coder flow resume`,`continue the most recent run`]]},options:r,args:1,async run({options:e,args:[n],cwd:r}){let{resumeRun:o}=await import(`./executor-BvAA7Cgw.js`).then(e=>e.y),c=await o(n,{...s(e,r),...e.args===void 0?{}:{args:a(e.args,[])}},i(e));return c.status===`running`&&c.watch&&await t(c.watch,e),c},print:e=>e.status===`running`?o(e):n(e)});export{c as commandResume};
@@ -1,4 +1,4 @@
1
- import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-BilSDkvE.js";import{c as n,n as r,s as i,t as a}from"./args-BOEEdpWk.js";import o from"node:process";import*as s from"zod/mini";function c(e){let{summary:t}=e,n=`\`${t.baseSha}\`${t.worktree?` through the working tree`:`..\`${t.headSha}\``}`,r=(t.warnings??[]).flatMap(e=>[e,``]);if(t.worktree&&!t.files)return`${[`# Coder review`,``,`Nothing to review from ${n}.`,``,...r,`Flow run: \`${e.runId}\``].join(`
1
+ import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-DWCR7iqa.js";import{c as n,n as r,s as i,t as a}from"./args-BOEEdpWk.js";import o from"node:process";import*as s from"zod/mini";function c(e){let{summary:t}=e,n=`\`${t.baseSha}\`${t.worktree?` through the working tree`:`..\`${t.headSha}\``}`,r=(t.warnings??[]).flatMap(e=>[e,``]);if(t.worktree&&!t.files)return`${[`# Coder review`,``,`Nothing to review from ${n}.`,``,...r,`Flow run: \`${e.runId}\``].join(`
2
2
  `)}\n`;let i=[`# Coder review`,``,`Reviewed ${n}${t.model?` with ${t.model}`:``} in ${(t.elapsedMs/1e3).toFixed(1)}s.`,``,...r,...e.findings.length?e.findings.flatMap(e=>[`- **${e.severity.toUpperCase()}** [\`${e.file}:${e.line}\`]. ${e.summary}`,` ${e.failure_scenario}`]):[`No findings after checking against the repository.`]];return t.posted!==void 0&&i.push(``,`Posted ${t.posted} new inline comment${t.posted===1?``:`s`}.`),i.push(``,`Flow run: \`${e.runId}\``),`${i.join(`
3
3
  `)}\n`}const l=t({name:`review`,help:{usage:`coder review [--base <ref>] [--head <ref>] [--pr <n|url>] [--since <sha>] [--path <p>]... [--exclude <p>]... [--post] [--json|--md] [--engine <name>] [--model <alias|slug>] [--effort <low|medium|high>] [--cwd <dir>]`,summary:`Review changed code with a read-only agent. Every reported finding is checked
4
4
  against the repository. Runs the built-in \`review\` flow. A local review covers
@@ -1 +1 @@
1
- import{i as e}from"./cli-BilSDkvE.js";import{n as t}from"./args-BOEEdpWk.js";import n from"node:process";const r=e({name:`server rotate-key`,globalFlags:{cwd:!1},help:{usage:`coder server rotate-key [--json]`,summary:`Re-seal stored app, installation, engine, and linked user secrets with the current key.`,env:[[`SERVER_ENCRYPTION_KEY`,`the new key`],[`SERVER_ENCRYPTION_KEY_PREVIOUS`,`the old key, still accepted while rotating`]]},options:{json:t},run:async()=>{let{rotateKey:e}=await import(`./maintenance-C5FklUw3.js`).then(e=>e.t);return e()},json:({moved:e})=>({ok:!0,moved:e}),print:({moved:e})=>n.stdout.write(`Re-sealed ${e} secret${e===1?``:`s`}.\n`)});export{r as commandServerRotateKey};
1
+ import{i as e}from"./cli-DWCR7iqa.js";import{n as t}from"./args-BOEEdpWk.js";import n from"node:process";const r=e({name:`server rotate-key`,globalFlags:{cwd:!1},help:{usage:`coder server rotate-key [--json]`,summary:`Re-seal stored app, installation, engine, and linked user secrets with the current key.`,env:[[`SERVER_ENCRYPTION_KEY`,`the new key`],[`SERVER_ENCRYPTION_KEY_PREVIOUS`,`the old key, still accepted while rotating`]]},options:{json:t},run:async()=>{let{rotateKey:e}=await import(`./maintenance-DkLVtqM7.js`).then(e=>e.t);return e()},json:({moved:e})=>({ok:!0,moved:e}),print:({moved:e})=>n.stdout.write(`Re-sealed ${e} secret${e===1?``:`s`}.\n`)});export{r as commandServerRotateKey};
@@ -1,4 +1,4 @@
1
- import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-BilSDkvE.js";import{p as n,s as r}from"./output-BKeyLbvt.js";import{n as i,s as a,t as o}from"./args-BOEEdpWk.js";import{FlowStepRenderer as s,printFollow as c,printRunSummary as l}from"./watch-CSdj24ct.js";import u from"node:process";const d={...o,args:a,wait:i,concurrency:a,"max-tasks":a,"dry-run":i};function f(t){let n={};for(let r of t){let t=r.indexOf(`=`);if(t===-1)throw new e(`invalid-option`,`Invalid argument "${r}": expected key=value.`,{hint:`Help: coder flow run --help`});let i=r.slice(0,t),a=r.slice(t+1);try{n[i]=JSON.parse(a)}catch{n[i]=a}}return n}function p(t,n){if(t!==void 0)try{return JSON.parse(t)}catch(t){throw new e(`invalid-option`,`Invalid --args JSON: ${t instanceof Error?t.message:String(t)}`)}return n.length?f(n):{}}const m=e=>e?Number(e):void 0,h=(e,t)=>({cwd:t,dryRun:e[`dry-run`],concurrency:m(e.concurrency),maxTasks:m(e[`max-tasks`]),argv:u.argv.slice(2),wait:e.wait}),g=e=>e[`dry-run`]&&!e.json?v():{},_=t({name:`flow run`,help:{usage:`coder flow run <name|path> [--args '<json>' | key=value...] [--wait] [--concurrency N] [--max-tasks N] [--json] [--dry-run]`,summary:`Run a flow: a TypeScript file that orchestrates many coder tasks with gates,
1
+ import{xt as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-DWCR7iqa.js";import{p as n,s as r}from"./output-BKeyLbvt.js";import{n as i,s as a,t as o}from"./args-BOEEdpWk.js";import{FlowStepRenderer as s,printFollow as c,printRunSummary as l}from"./watch-eE2XiwsC.js";import u from"node:process";const d={...o,args:a,wait:i,concurrency:a,"max-tasks":a,"dry-run":i};function f(t){let n={};for(let r of t){let t=r.indexOf(`=`);if(t===-1)throw new e(`invalid-option`,`Invalid argument "${r}": expected key=value.`,{hint:`Help: coder flow run --help`});let i=r.slice(0,t),a=r.slice(t+1);try{n[i]=JSON.parse(a)}catch{n[i]=a}}return n}function p(t,n){if(t!==void 0)try{return JSON.parse(t)}catch(t){throw new e(`invalid-option`,`Invalid --args JSON: ${t instanceof Error?t.message:String(t)}`)}return n.length?f(n):{}}const m=e=>e?Number(e):void 0,h=(e,t)=>({cwd:t,dryRun:e[`dry-run`],concurrency:m(e.concurrency),maxTasks:m(e[`max-tasks`]),argv:u.argv.slice(2),wait:e.wait}),g=e=>e[`dry-run`]&&!e.json?v():{},_=t({name:`flow run`,help:{usage:`coder flow run <name|path> [--args '<json>' | key=value...] [--wait] [--concurrency N] [--max-tasks N] [--json] [--dry-run]`,summary:`Run a flow: a TypeScript file that orchestrates many coder tasks with gates,
2
2
  journaling, and resume. Prints the run id and orchestrates in the background;
3
3
  --wait follows the run in the foreground with live progress (Ctrl-C detaches;
4
4
  it keeps running), and \`coder flow watch\` shows the same lines any time.
@@ -1,2 +1,2 @@
1
- import{p as e}from"./prompt-CEuBMNhk.js";import{i as t,r as n}from"./cli-BilSDkvE.js";import{p as r,s as i}from"./output-BKeyLbvt.js";import{i as a,n as o,s,t as c}from"./args-BOEEdpWk.js";import{printOutcome as l}from"./result-BzaM3inj.js";import{printLine as u}from"./watch-DtRuC0Wc.js";import d from"node:process";const f={...c,flow:s,server:a,workspace:s,wait:o,task:s,yes:o},p=t({name:`agent run --task`,options:f,run:async({options:e,cwd:t})=>{let{agents:n}=await import(`./agent-BsYx3Odz.js`).then(e=>e.t);return n.runTask(e.task,{cwd:t})}}),m=t({name:`agent run`,help:{usage:`coder agent run <agent> <file> [--server [url] [--wait]] [--flow <name>] [--json] [--cwd <dir>]`,summary:`Run a recorded platform event (AgentEvent JSON) through an agent. With --server it goes through your Coder server exactly like a webhook: real app, tokens, runner, and the reply is posted. Without it the engine runs here on the agent's prompt and this checkout, platform tools off, and the reply is printed.`,flags:[n,[`--wait`,`with --server: follow the task log here until it finishes, then print the reply`],[`--flow <name>`,`override the matched flow`]],examples:[[`coder agent run helper sample-slack-mention.json`,`offline: print what the agent would reply`],[`coder agent run helper event.json --server`,`for real, through the server`]]},options:f,args:2,run:async({options:e,args:[t,n],cwd:i})=>{let{agents:a}=await import(`./agent-BsYx3Odz.js`).then(e=>e.t);return a.run(t,n,{...e,cwd:i,organization:e.workspace,...e.json?{}:{onLog:e=>u(e,r),onDone:e=>l(e,r)}})},json:e=>Array.isArray(e)&&e.length===1?e[0]:e,print(t,{options:n}){if(!Array.isArray(t)){if(`tasks`in t){if(!t.tasks.length)return void d.stdout.write(`The server accepted the event but no agent matched it.
1
+ import{p as e}from"./prompt-CEuBMNhk.js";import{i as t,r as n}from"./cli-DWCR7iqa.js";import{p as r,s as i}from"./output-BKeyLbvt.js";import{i as a,n as o,s,t as c}from"./args-BOEEdpWk.js";import{printOutcome as l}from"./result-D8DsvJDu.js";import{printLine as u}from"./watch-BcMQXGYO.js";import d from"node:process";const f={...c,flow:s,server:a,workspace:s,wait:o,task:s,yes:o},p=t({name:`agent run --task`,options:f,run:async({options:e,cwd:t})=>{let{agents:n}=await import(`./agent-hw3zKw8y.js`).then(e=>e.t);return n.runTask(e.task,{cwd:t})}}),m=t({name:`agent run`,help:{usage:`coder agent run <agent> <file> [--server [url] [--wait]] [--flow <name>] [--json] [--cwd <dir>]`,summary:`Run a recorded platform event (AgentEvent JSON) through an agent. With --server it goes through your Coder server exactly like a webhook: real app, tokens, runner, and the reply is posted. Without it the engine runs here on the agent's prompt and this checkout, platform tools off, and the reply is printed.`,flags:[n,[`--wait`,`with --server: follow the task log here until it finishes, then print the reply`],[`--flow <name>`,`override the matched flow`]],examples:[[`coder agent run helper sample-slack-mention.json`,`offline: print what the agent would reply`],[`coder agent run helper event.json --server`,`for real, through the server`]]},options:f,args:2,run:async({options:e,args:[t,n],cwd:i})=>{let{agents:a}=await import(`./agent-hw3zKw8y.js`).then(e=>e.t);return a.run(t,n,{...e,cwd:i,organization:e.workspace,...e.json?{}:{onLog:e=>u(e,r),onDone:e=>l(e,r)}})},json:e=>Array.isArray(e)&&e.length===1?e[0]:e,print(t,{options:n}){if(!Array.isArray(t)){if(`tasks`in t){if(!t.tasks.length)return void d.stdout.write(`The server accepted the event but no agent matched it.
2
2
  `);d.stdout.write(`${r.bold(`Queued on the server`)} as task ${t.tasks.join(`, `)}.\n\n${i([`Watch it: coder task watch ${t.tasks[0]} --server ${e(n.server)}`],r)}\n`);return}t.reply===void 0?t.result!==void 0&&d.stdout.write(`${JSON.stringify(t.result,null,2)}\n`):d.stdout.write(`${t.reply.trim()}\n`)}}}),h=Object.assign(e=>(e.some(e=>e===`--task`||e.startsWith(`--task=`))?p:m)(e),{commandName:`agent run`,help:m.help});export{h as commandAgentRun};
@@ -1,2 +1,2 @@
1
- import{d as e,i as t,n,p as r}from"./cli-BilSDkvE.js";import{p as i,r as a,s as o,u as s}from"./output-BKeyLbvt.js";import{c,i as l,n as u,s as d,t as f}from"./args-BOEEdpWk.js";import{printOutcome as p}from"./result-BzaM3inj.js";import{printLine as m}from"./watch-DtRuC0Wc.js";import{TASK_FLAGS as h}from"./task-CgOKgkEG.js";import g from"node:process";function _(t){let n=e([{usage:`coder task result ${t} --wait`,blurb:`run in a background shell; returns with the answer or a pending approval`},{usage:`coder task steer ${t} "<follow-up>"`,blurb:`steer the task with a message (use 'ask' without interrupting main thread)`},{usage:`coder task stop ${t}`,blurb:`stop the task`},{usage:`coder task list`,blurb:`recent tasks`},{usage:`coder task --help`,blurb:`all task commands`}],i,i.blue);return[...r(`Next step`,n.slice(0,1),i),...r(`Related`,n.slice(1),i)].join(`
1
+ import{d as e,i as t,n,p as r}from"./cli-DWCR7iqa.js";import{p as i,r as a,s as o,u as s}from"./output-BKeyLbvt.js";import{c,i as l,n as u,s as d,t as f}from"./args-BOEEdpWk.js";import{printOutcome as p}from"./result-D8DsvJDu.js";import{printLine as m}from"./watch-BcMQXGYO.js";import{TASK_FLAGS as h}from"./task-b2BK481M.js";import g from"node:process";function _(t){let n=e([{usage:`coder task result ${t} --wait`,blurb:`run in a background shell; returns with the answer or a pending approval`},{usage:`coder task steer ${t} "<follow-up>"`,blurb:`steer the task with a message (use 'ask' without interrupting main thread)`},{usage:`coder task stop ${t}`,blurb:`stop the task`},{usage:`coder task list`,blurb:`recent tasks`},{usage:`coder task --help`,blurb:`all task commands`}],i,i.blue);return[...r(`Next step`,n.slice(0,1),i),...r(`Related`,n.slice(1),i)].join(`
2
2
  `)}function v(e,t){g.stdout.write(`${i.dim(`[coder]`)} task ${i.blue(e)} started in the background (${t}).\n`),g.stdout.write(`${_(e)}\n`)}function y(e){g.stderr.write(`${i.dim(`[coder]`)} Task ${i.cyan(e)} started and is waiting to finish. Press Ctrl-C to detach. It keeps running.\n`),g.stderr.write(`${_(e)}\n`)}function b(e){g.stderr.write(`\n${i.dim(`[coder] Detached. The task is still running.`)}\n\n${o([`Wait for the answer: coder task result ${e} --wait`],a)}\n`)}function x(e){g.stdout.write(`\n${e.finalMessage||(e.error?`${i.red(`error:`)} ${e.error}`:`(no final message)`)}\n\n`);let t=e.tokens?` tokens=${s(e.tokens,e.model)}`:``;g.stderr.write(`${i.dim(`[coder] task=${e.taskId} status=${e.status}${t}`)}\n`)}const S=t({name:`task run`,help:{usage:`coder task run "<task text>"`,summary:`Dispatch a coding task to the configured engine. Backgrounds by default and\nprints a task id; --wait runs in the foreground and prints the answer.\nShortcut: \`coder run "<text>"\`.\n\nWriting a task: one task per focused goal, independent goals as parallel runs.\nThe worker starts with nothing but the text, so include the goal, file paths,\nconstraints and any context only you have. Delegate rather than doing the work\nyourself first, however small it looks.\n\n${n}`,flags:[[`--output-schema <json>`,`JSON Schema for the task answer`],[`--name <name>`,`label the task (shown in list/result)`],[`--agent <id>`,`run as that agent: its system.md, engine settings, MCP servers and flows; flags override them`],[`--system <text>`,`standing instructions prepended to the task (kept out of prompt previews)`],...h,[`--server [url] [--workspace <slug>]`,`run the task on your Coder server and follow it here (--background prints its id); --resume continues a finished server task`],[`--repo <owner/name>`,`with --server: check out a repo from the workspace's installs`],[`--runner <name>`,`with --server: where it runs (a runner kind or a registered runner)`]],exitCodes:[[`0`,`The task started, or --wait printed a successful answer.`],[`1`,`Dispatch or the task failed.`],[`3`,`No engine could start; follow fallback.instructions in the JSON payload.`],[`4`,`An approval is pending; answer it, then run result --wait again.`],[`130`,`The foreground wait was detached and the task is still running.`]],examples:[[`coder run "add a /health endpoint"`,`dispatch in the background, print a task id`],[`coder result <task-id> --wait`,`then block until it finishes and print the answer`],[`coder run --wait "fix the failing test"`,`or block on the run itself`],[`coder task run --model luna --system "tests live in test/, don't touch anything outside of it" "rename foo to bar"`,`pick an engine via its model alias; --system adds standing instructions`],[`coder task run --agent reviewer "review the last commit"`,`run a repo agent from .coder/agents/reviewer`],[`coder run --add-dir ../api --add-dir ../shared "update the client for the new endpoint"`,`let the task reach sibling repos too`]]},options:{...f,agent:d,"output-schema":d,engine:d,model:d,effort:d,permissions:d,resume:d,host:d,name:d,system:d,mcp:d,"add-dir":c,background:u,wait:u,"simulate-approval":u,server:l,workspace:d,yes:u,repo:d,runner:d},args:1/0,async run({options:e,args:t}){let{tasks:n}=await import(`./task-C6VAg5WU.js`).then(e=>e.t),r=e.json,a;return g.on(`SIGINT`,()=>{a&&b(a),g.exit(130)}),n.run(t.join(` `).trim(),{cwd:e.cwd,agent:e.agent,outputSchema:e[`output-schema`]?JSON.parse(e[`output-schema`]):void 0,engine:e.engine,model:e.model,effort:e.effort,permissions:e.permissions,name:e.name,system:e.system,resume:e.resume,mcp:e.mcp,addDirs:e[`add-dir`],wait:e.server===void 0?e.wait:!e.background,simulateApproval:e[`simulate-approval`],repo:e.repo,runner:e.runner,server:e.server,yes:e.yes,organization:e.workspace,onFallback:({engine:e,detail:t,next:n})=>g.stderr.write(`[coder] ${e} failed to start (${t}); falling back to ${n}.\n`),onNote:e=>g.stderr.write(`[coder] ${e}\n`),onWaiting:e=>{a=e,r||y(e)},onLog:e=>r?g.stdout.write(`${JSON.stringify(e,null,2)}\n`):m(e,i)})},print(e,{options:t}){if(`attempts`in e)return t.background?void g.stdout.write(`${e.task.id}\n`):p(e,i);t.wait?x(e):v(e.taskId,e.status)},exit:(e,{options:t})=>(`attempts`in e?!t.background:t.wait)?e.status===`completed`?0:1:void 0});export{S as commandTask};
@@ -0,0 +1 @@
1
+ import{s as e}from"./cli-DWCR7iqa.js";const t=e(`runner`,{add:async()=>(await import(`./add-DkpUwhtO.js`)).commandRunnerAdd,default:async()=>(await import(`./default-De8FXiWz.js`)).commandRunnerDefault,test:async()=>(await import(`./test-BrSrhop9.js`)).commandRunnerTest,serve:async()=>(await import(`./serve-Ck95047c.js`)).commandRunnerServe,list:async()=>(await import(`./list-DzGuMkQy.js`)).commandRunnerList,rename:async()=>(await import(`./rename-Bhcb4t9F.js`)).commandRunnerRename,remove:async()=>(await import(`./remove-BNzbUhaK.js`)).commandRunnerRemove},{menu:[{usage:`add <kind>`,blurb:`connect a runner`},{usage:`default <id>`,blurb:`set the default in its scope`},{usage:`test <id>`,blurb:`check a runner connection`},{usage:`serve --url <public url>`,blurb:`run your server's tasks on this machine`},{usage:`list`,blurb:`list your runners and the workspace's`},{usage:`rename <id> <name>`,blurb:`rename a runner`},{usage:`remove <id>`,blurb:`remove a runner`}],description:[`Run your Coder server's tasks on your own machine, reached through any tunnel.`],exampleCommand:`runner serve`});export{t as commandRunner};
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- import{T as e,X as t,Z as n,it as r,ot as i,rt as a,st as o,w as s,xt as c}from"./dispatch-BKeAch9E.js";import{n as l,r as u,s as ee,t as d}from"./remote-miQNTVRa.js";import{n as f}from"./executor-BvAA7Cgw.js";import{n as p}from"./agent-BsYx3Odz.js";import{t as m}from"./docs-BX65z2Iu.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./models-_5LVGC3m.js";import{n as S}from"./task-C6VAg5WU.js";import C from"./flow/index.js";import{i as w,n as T,o as E,r as D,s as O,t as k}from"./runner-sUpWJ_k0.js";import{t as A}from"./serve-BTeomYxW.js";import{t as j}from"./github-actions-DwUzm4hC.js";import{n as M}from"./apps-CjfrZyM5.js";import{n as N,r as P}from"./maintenance-C5FklUw3.js";import{r as F,t as I}from"./serve-CQKZxzFE.js";import L from"node:path";import R from"node:process";function z(e){return e?L.resolve(e):R.cwd()}const B=S,V={add:(e,t)=>x(z(t.cwd),e,t),update:(e,t)=>b(z(t.cwd),e,t),remove:(e,t={})=>g(z(t.cwd),e,t),list:(e={})=>y(z(e.cwd)),alias:(e,t,n={})=>_(z(n.cwd),e,t,n),unalias:(e,t={})=>v(z(t.cwd),e,t),disable:(e,t={})=>h(z(t.cwd),e,!0,t),enable:(e,t={})=>h(z(t.cwd),e,!1,t)},H={get:(e,n={})=>t(z(n.cwd),e),set:(e,t,r={})=>n(z(r.cwd),e,t,r)},U={add:(e,t)=>a(z(t.cwd),e,t),addJson:(e,t,n={})=>r(z(n.cwd),e,t,n),list:(e={})=>i(z(e.cwd)),remove:(e,t={})=>o(z(t.cwd),e,t)};function W(e=[],t={}){return s(z(t.cwd),{hosts:e})}function G(t={}){return e(t)}function K(e,t={}){return m(e,t)}const q={async run(e={}){let t=await f(`review`,{cwd:e.cwd,args:e});return{...t.result,runId:t.runId}}},J=ee,Y={serve:I,migrate:N,rotateKey:P,workflow:()=>j,app:{create:M},handler:F},X={list:(e={})=>l(e).credentials.list(),add:d,remove:(e,t={})=>l(t).credentials.remove(e,t),default:(e,t={})=>l(t).credentials.setDefault(e,t),login:u},Z={list:(e={})=>l(e).folders.list(),check:(e,t={})=>l(t).folders.check(e)},Q={list:T,add:k,pair:D,update:O,default:(e,t={})=>O(e,{default:!0},t),test:E,rename:(e,t,n={})=>O(e,{name:t},n),remove:w,serve:A},$=p;var te={task:B,flow:C,model:V,config:H,mcp:U,setupHost:W,upgrade:G,docs:K,review:q,auth:J,agent:$,credentials:X,folders:Z,runner:Q,server:Y};export{c as CoderError,$ as agent,J as auth,H as config,X as credentials,te as default,K as docs,C as flow,Z as folders,U as mcp,V as model,q as review,Q as runner,Y as server,W as setupHost,B as task,G as upgrade};
1
+ import{T as e,X as t,Z as n,it as r,ot as i,rt as a,st as o,w as s,xt as c}from"./dispatch-BKeAch9E.js";import{n as l,r as u,s as ee,t as d}from"./remote-miQNTVRa.js";import{n as f}from"./executor-BvAA7Cgw.js";import{n as p}from"./agent-hw3zKw8y.js";import{t as m}from"./docs-BX65z2Iu.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./models-_5LVGC3m.js";import{n as S}from"./task-C6VAg5WU.js";import C from"./flow/index.js";import{i as w,n as T,o as E,r as D,s as O,t as k}from"./runner-sUpWJ_k0.js";import{t as A}from"./serve-BTeomYxW.js";import{t as j}from"./github-actions-DwUzm4hC.js";import{n as M}from"./apps-eujHiNca.js";import{n as N,r as P}from"./maintenance-DkLVtqM7.js";import{r as F,t as I}from"./serve-DA5I2qXj.js";import L from"node:path";import R from"node:process";function z(e){return e?L.resolve(e):R.cwd()}const B=S,V={add:(e,t)=>x(z(t.cwd),e,t),update:(e,t)=>b(z(t.cwd),e,t),remove:(e,t={})=>g(z(t.cwd),e,t),list:(e={})=>y(z(e.cwd)),alias:(e,t,n={})=>_(z(n.cwd),e,t,n),unalias:(e,t={})=>v(z(t.cwd),e,t),disable:(e,t={})=>h(z(t.cwd),e,!0,t),enable:(e,t={})=>h(z(t.cwd),e,!1,t)},H={get:(e,n={})=>t(z(n.cwd),e),set:(e,t,r={})=>n(z(r.cwd),e,t,r)},U={add:(e,t)=>a(z(t.cwd),e,t),addJson:(e,t,n={})=>r(z(n.cwd),e,t,n),list:(e={})=>i(z(e.cwd)),remove:(e,t={})=>o(z(t.cwd),e,t)};function W(e=[],t={}){return s(z(t.cwd),{hosts:e})}function G(t={}){return e(t)}function K(e,t={}){return m(e,t)}const q={async run(e={}){let t=await f(`review`,{cwd:e.cwd,args:e});return{...t.result,runId:t.runId}}},J=ee,Y={serve:I,migrate:N,rotateKey:P,workflow:()=>j,app:{create:M},handler:F},X={list:(e={})=>l(e).credentials.list(),add:d,remove:(e,t={})=>l(t).credentials.remove(e,t),default:(e,t={})=>l(t).credentials.setDefault(e,t),login:u},Z={list:(e={})=>l(e).folders.list(),check:(e,t={})=>l(t).folders.check(e)},Q={list:T,add:k,pair:D,update:O,default:(e,t={})=>O(e,{default:!0},t),test:E,rename:(e,t,n={})=>O(e,{name:t},n),remove:w,serve:A},$=p;var te={task:B,flow:C,model:V,config:H,mcp:U,setupHost:W,upgrade:G,docs:K,review:q,auth:J,agent:$,credentials:X,folders:Z,runner:Q,server:Y};export{c as CoderError,$ as agent,J as auth,H as config,X as credentials,te as default,K as docs,C as flow,Z as folders,U as mcp,V as model,q as review,Q as runner,Y as server,W as setupHost,B as task,G as upgrade};
@@ -1,2 +1,2 @@
1
- import{qt as e,xt as t}from"./dispatch-BKeAch9E.js";import{i as n}from"./prompt-CEuBMNhk.js";import{i as r}from"./cli-BilSDkvE.js";import{p as i,s as a}from"./output-BKeyLbvt.js";import{n as o,s,t as c}from"./args-BOEEdpWk.js";import l from"node:process";import*as u from"zod/mini";function d(t){let r=i,o=[...t.publicUrl===t.address?[]:[[`public`,t.publicUrl]],[`store`,t.database??(t.mode===`local`?e():t.store)],[`runner`,t.runner],...t.signIn?[[`sign-in`,t.signIn]]:[],...t.mintedToken?[[`token`,t.mintedToken]]:[]],s=Math.max(...o.map(([e])=>e.length))+2;l.stdout.write(`${r.bold({local:`Coder local server`,memory:`Coder test server`,cloud:`Coder server`}[t.mode])} ${r.dim(`listening on ${t.address}`)}\n`);for(let[e,t]of o)l.stdout.write(` ${r.light(e.padEnd(s))}${t}\n`);t.warnings.length&&l.stdout.write(`
2
- `);for(let e of t.warnings)l.stdout.write(` ${r.yellow(`!`)} ${e}\n`);if(t.cacheMigration?.then(e=>{(e.tasks||e.flows||e.files)&&l.stdout.write(`\n moved ${e.tasks.toLocaleString(`en-US`)} archived tasks to ${e.cache}\n`)}).catch(e=>l.stderr.write(`\n Cache migration failed: ${e instanceof Error?e.message:String(e)}\n`)),t.mode===`memory`&&l.stdout.write(`\n${a([`the CLI reaches this server with its token in ADMIN_TOKEN: coder task list --server ${t.publicUrl}`],r)}\n`),t.dashboard){let e=l.stdout.isTTY&&n(t.dashboard);l.stdout.write(e?`\nOpening the dashboard in your browser. If it doesn't open, go to:\n ${t.dashboard}\n`:`\n ${r.light(`dashboard`)} ${t.dashboard}\n`)}}const f=r({name:`server serve`,help:{usage:`coder server serve [--port <n>] [--host <address>] [--memory] [--runner <name>] [--json] [--cwd <dir>]`,summary:`Run the Coder server on Bun: the address platforms deliver events to, the dashboard, and the worker that runs tasks. With DATABASE_URL it is a full server with sign-in and workspaces. Without one it is the dashboard for this machine's CLI: its config, agents, tasks and engine logins, on loopback only. --memory makes a throwaway test server that keeps everything in memory. Configured through the environment; every variable is in coder docs self-host. It never migrates the database itself: coder server migrate does.`,flags:[[`--port <n>`,`listen port (default: PORT, else the port in a localhost PUBLIC_URL, else 8787)`],[`--host <address>`,`listen address (default: HOST, else 127.0.0.1 without a database, else every interface)`],[`--memory`,`a throwaway test server: everything in memory, no sign-in, admin token only`],[`--runner <name>`,`local, local-docker, vercel-sandbox, github-actions, or http`]],env:[[`PUBLIC_URL`,`the address platforms and browsers reach the server at (default http://localhost:<port>)`],[`PORT`,`listen port, as hosts set it (default 8787)`],[`HOST`,`listen address, as --host`],[`DATABASE_URL`,`Postgres, set up by coder server migrate; turns on sign-in and workspaces`],[`AUTH_WULAR_URL`,`the Wular Auth issuer people sign in with (default https://auth.wular.ai)`],[`SERVER_ENCRYPTION_KEY`,`encrypts stored secrets and derives the sign-in keys; required with DATABASE_URL (openssl rand -base64 32)`],[`RUNNER`,`where tasks run: local (default), local-docker, vercel-sandbox, github-actions, http`],[`MAX_TASKS, TASK_TIMEOUT, TASK_STALL, TASK_ATTEMPTS`,`runner capacity and lifecycle limits`],[`ADMIN_TOKEN`,`local and memory servers: the dashboard and CLI key; minted and shown when unset`],[`CODER_CACHE_HOME`,`archived tasks, flows and usage (default OS cache directory/wular-coder)`],[`WORK_DIR`,`where tasks check out repositories`],[`SERVER_NAME`,`what the dashboard calls this server (default Coder)`]],examples:[[`PUBLIC_URL=https://abc.ngrok.app coder server serve`,`receive GitHub and Slack events through a tunnel; the tunnel serves only their webhooks and callbacks`],[`PUBLIC_URL=https://agents.example.com DATABASE_URL=postgres://... coder server serve`,`on your own host, backed by Postgres`]]},options:{...c,port:u.optional(u.coerce.number().check(u.int(),u.positive())),host:s,runner:s,memory:o},async run({options:e,cwd:n}){let{rerunUnderBun:r}=await import(`./env-CRf6wkM2.js`).then(e=>e.t);if(await r(),e.memory&&!l.env.ADMIN_TOKEN&&!l.stdout.isTTY)throw new t(`invalid-option`,`Memory server needs an admin token: set ADMIN_TOKEN, or run in a terminal to get a printed one.`);let{serve:i}=await import(`./serve-CQKZxzFE.js`).then(e=>e.n),a=await i({cwd:n,port:e.port,...e.host?{host:e.host}:{},...e.runner?{runner:e.runner}:{},...e.memory?{memory:!0}:{}}),o=()=>void a.close().finally(()=>l.exit(0));return l.once(`SIGINT`,o),l.once(`SIGTERM`,o),a},json:e=>({ok:!0,address:e.address,publicUrl:e.publicUrl,runner:e.runner,store:e.store,mode:e.mode,maxTasks:e.maxTasks,...e.signIn?{signIn:e.signIn}:{},...e.mintedToken?{adminToken:e.mintedToken}:{},warnings:e.warnings}),print:d});export{f as commandServerServe};
1
+ import{qt as e,xt as t}from"./dispatch-BKeAch9E.js";import{i as n}from"./prompt-CEuBMNhk.js";import{i as r}from"./cli-DWCR7iqa.js";import{p as i,s as a}from"./output-BKeyLbvt.js";import{n as o,s,t as c}from"./args-BOEEdpWk.js";import l from"node:process";import*as u from"zod/mini";function d(t){let r=i,o=[...t.publicUrl===t.address?[]:[[`public`,t.publicUrl]],[`store`,t.database??(t.mode===`local`?e():t.store)],[`runner`,t.runner],...t.signIn?[[`sign-in`,t.signIn]]:[],...t.mintedToken?[[`token`,t.mintedToken]]:[]],s=Math.max(...o.map(([e])=>e.length))+2;l.stdout.write(`${r.bold({local:`Coder local server`,memory:`Coder test server`,cloud:`Coder server`}[t.mode])} ${r.dim(`listening on ${t.address}`)}\n`);for(let[e,t]of o)l.stdout.write(` ${r.light(e.padEnd(s))}${t}\n`);t.warnings.length&&l.stdout.write(`
2
+ `);for(let e of t.warnings)l.stdout.write(` ${r.yellow(`!`)} ${e}\n`);if(t.cacheMigration?.then(e=>{(e.tasks||e.flows||e.files)&&l.stdout.write(`\n moved ${e.tasks.toLocaleString(`en-US`)} archived tasks to ${e.cache}\n`)}).catch(e=>l.stderr.write(`\n Cache migration failed: ${e instanceof Error?e.message:String(e)}\n`)),t.mode===`memory`&&l.stdout.write(`\n${a([`the CLI reaches this server with its token in ADMIN_TOKEN: coder task list --server ${t.publicUrl}`],r)}\n`),t.dashboard){let e=l.stdout.isTTY&&n(t.dashboard);l.stdout.write(e?`\nOpening the dashboard in your browser. If it doesn't open, go to:\n ${t.dashboard}\n`:`\n ${r.light(`dashboard`)} ${t.dashboard}\n`)}}const f=r({name:`server serve`,help:{usage:`coder server serve [--port <n>] [--host <address>] [--memory] [--runner <name>] [--json] [--cwd <dir>]`,summary:`Run the Coder server on Bun: the address platforms deliver events to, the dashboard, and the worker that runs tasks. With DATABASE_URL it is a full server with sign-in and workspaces. Without one it is the dashboard for this machine's CLI: its config, agents, tasks and engine logins, on loopback only. --memory makes a throwaway test server that keeps everything in memory. Configured through the environment; every variable is in coder docs self-host. It never migrates the database itself: coder server migrate does.`,flags:[[`--port <n>`,`listen port (default: PORT, else the port in a localhost PUBLIC_URL, else 8787)`],[`--host <address>`,`listen address (default: HOST, else 127.0.0.1 without a database, else every interface)`],[`--memory`,`a throwaway test server: everything in memory, no sign-in, admin token only`],[`--runner <name>`,`local, local-docker, vercel-sandbox, github-actions, or http`]],env:[[`PUBLIC_URL`,`the address platforms and browsers reach the server at (default http://localhost:<port>)`],[`PORT`,`listen port, as hosts set it (default 8787)`],[`HOST`,`listen address, as --host`],[`DATABASE_URL`,`Postgres, set up by coder server migrate; turns on sign-in and workspaces`],[`AUTH_WULAR_URL`,`the Wular Auth issuer people sign in with (default https://auth.wular.ai)`],[`SERVER_ENCRYPTION_KEY`,`encrypts stored secrets and derives the sign-in keys; required with DATABASE_URL (openssl rand -base64 32)`],[`RUNNER`,`where tasks run: local (default), local-docker, vercel-sandbox, github-actions, http`],[`MAX_TASKS, TASK_TIMEOUT, TASK_STALL, TASK_ATTEMPTS`,`runner capacity and lifecycle limits`],[`ADMIN_TOKEN`,`local and memory servers: the dashboard and CLI key; minted and shown when unset`],[`CODER_CACHE_HOME`,`archived tasks, flows and usage (default OS cache directory/wular-coder)`],[`WORK_DIR`,`where tasks check out repositories`],[`SERVER_NAME`,`what the dashboard calls this server (default Coder)`]],examples:[[`PUBLIC_URL=https://abc.ngrok.app coder server serve`,`receive GitHub and Slack events through a tunnel; the tunnel serves only their webhooks and callbacks`],[`PUBLIC_URL=https://agents.example.com DATABASE_URL=postgres://... coder server serve`,`on your own host, backed by Postgres`]]},options:{...c,port:u.optional(u.coerce.number().check(u.int(),u.positive())),host:s,runner:s,memory:o},async run({options:e,cwd:n}){let{rerunUnderBun:r}=await import(`./env-CRf6wkM2.js`).then(e=>e.t);if(await r(),e.memory&&!l.env.ADMIN_TOKEN&&!l.stdout.isTTY)throw new t(`invalid-option`,`Memory server needs an admin token: set ADMIN_TOKEN, or run in a terminal to get a printed one.`);let{serve:i}=await import(`./serve-DA5I2qXj.js`).then(e=>e.n),a=await i({cwd:n,port:e.port,...e.host?{host:e.host}:{},...e.runner?{runner:e.runner}:{},...e.memory?{memory:!0}:{}}),o=()=>void a.close().finally(()=>l.exit(0));return l.once(`SIGINT`,o),l.once(`SIGTERM`,o),a},json:e=>({ok:!0,address:e.address,publicUrl:e.publicUrl,runner:e.runner,store:e.store,mode:e.mode,maxTasks:e.maxTasks,...e.signIn?{signIn:e.signIn}:{},...e.mintedToken?{adminToken:e.mintedToken}:{},warnings:e.warnings}),print:d});export{f as commandServerServe};
@@ -1,4 +1,4 @@
1
- import{En as e,G as t,On as n,Qt as r,Tt as i,b as a,bn as o,nt as s,tn as c,v as l,y as u,zt as d}from"./dispatch-BKeAch9E.js";import{i as f}from"./cli-BilSDkvE.js";import{s as p}from"./args-BOEEdpWk.js";import{n as m}from"./mcp-server-DGzme0YX.js";import h from"node:path";import g from"node:fs";import{spawn as _}from"node:child_process";import{randomUUID as v}from"node:crypto";function y(e){return h.join(e,`sidecar.json`)}function b(t){return e(y(t))??{sessionId:null,declineStreak:0}}async function x(e){let t=h.join(e,`sidecar.lock`),n=Date.now()+12e4;for(;;)try{return g.mkdirSync(t),()=>{try{g.rmdirSync(t)}catch{}}}catch{try{if(Date.now()-g.statSync(t).mtimeMs>9e4){g.rmdirSync(t);continue}}catch{continue}if(Date.now()>n)throw Error(`sidecar lock wait timed out`);await new Promise(e=>setTimeout(e,250))}}function S(e,n,r,i){return[`-p`,i,`--output-format`,`json`,`--model`,`sonnet`,`--effort`,`low`,r?`--resume`:`--session-id`,n,...t,`--add-dir`,e]}function C(e,t,n,r,i){let a=S(t,n,r,i);return new Promise((t,n)=>{let r=_(`claude`,a,{cwd:e,stdio:[`ignore`,`pipe`,`pipe`]}),i=``,o=``,s=setTimeout(()=>{r.kill(`SIGKILL`),n(Error(`sidecar call timed out`))},12e4);r.stdout.on(`data`,e=>i+=e),r.stderr.on(`data`,e=>o+=e),r.on(`error`,e=>{clearTimeout(s),n(e)}),r.on(`close`,e=>{if(clearTimeout(s),e!==0){n(Error(`sidecar claude exited ${e}: ${o.trim().slice(0,200)}`));return}try{let e=JSON.parse(i);if(e.is_error){n(Error(`sidecar turn errored: ${String(e.result??``).slice(0,200)}`));return}t(String(e.result??``))}catch{n(Error(`sidecar returned unparseable output`))}})})}function w(e){let t=e.match(/\{[^{}]*"decision"[^{}]*\}/);if(!t)return null;try{let e=JSON.parse(t[0]);if(e.decision===`accept`||e.decision===`decline`||e.decision===`escalate`)return{decision:e.decision,reason:String(e.reason??``)}}catch{}return null}async function T(e,t,r){let i=null;try{i=await x(t);let a=b(t);if(a.declineStreak>=3)return{decision:`escalate`,reason:`sidecar decline streak; needs human review`};if(!a.sessionId){let i=v();await C(e,t,i,!1,`You are the approval reviewer for a "coder" background coding task. The task runs inside an OS sandbox; you review only actions that escape it.
1
+ import{En as e,G as t,On as n,Qt as r,Tt as i,b as a,bn as o,nt as s,tn as c,v as l,y as u,zt as d}from"./dispatch-BKeAch9E.js";import{i as f}from"./cli-DWCR7iqa.js";import{s as p}from"./args-BOEEdpWk.js";import{n as m}from"./mcp-server-DGzme0YX.js";import h from"node:path";import g from"node:fs";import{spawn as _}from"node:child_process";import{randomUUID as v}from"node:crypto";function y(e){return h.join(e,`sidecar.json`)}function b(t){return e(y(t))??{sessionId:null,declineStreak:0}}async function x(e){let t=h.join(e,`sidecar.lock`),n=Date.now()+12e4;for(;;)try{return g.mkdirSync(t),()=>{try{g.rmdirSync(t)}catch{}}}catch{try{if(Date.now()-g.statSync(t).mtimeMs>9e4){g.rmdirSync(t);continue}}catch{continue}if(Date.now()>n)throw Error(`sidecar lock wait timed out`);await new Promise(e=>setTimeout(e,250))}}function S(e,n,r,i){return[`-p`,i,`--output-format`,`json`,`--model`,`sonnet`,`--effort`,`low`,r?`--resume`:`--session-id`,n,...t,`--add-dir`,e]}function C(e,t,n,r,i){let a=S(t,n,r,i);return new Promise((t,n)=>{let r=_(`claude`,a,{cwd:e,stdio:[`ignore`,`pipe`,`pipe`]}),i=``,o=``,s=setTimeout(()=>{r.kill(`SIGKILL`),n(Error(`sidecar call timed out`))},12e4);r.stdout.on(`data`,e=>i+=e),r.stderr.on(`data`,e=>o+=e),r.on(`error`,e=>{clearTimeout(s),n(e)}),r.on(`close`,e=>{if(clearTimeout(s),e!==0){n(Error(`sidecar claude exited ${e}: ${o.trim().slice(0,200)}`));return}try{let e=JSON.parse(i);if(e.is_error){n(Error(`sidecar turn errored: ${String(e.result??``).slice(0,200)}`));return}t(String(e.result??``))}catch{n(Error(`sidecar returned unparseable output`))}})})}function w(e){let t=e.match(/\{[^{}]*"decision"[^{}]*\}/);if(!t)return null;try{let e=JSON.parse(t[0]);if(e.decision===`accept`||e.decision===`decline`||e.decision===`escalate`)return{decision:e.decision,reason:String(e.reason??``)}}catch{}return null}async function T(e,t,r){let i=null;try{i=await x(t);let a=b(t);if(a.declineStreak>=3)return{decision:`escalate`,reason:`sidecar decline streak; needs human review`};if(!a.sessionId){let i=v();await C(e,t,i,!1,`You are the approval reviewer for a "coder" background coding task. The task runs inside an OS sandbox; you review only actions that escape it.
2
2
 
3
3
  Rules:
4
4
  - git stays read-only: decline any git write (commit/push/checkout/reset/...).
@@ -1 +1 @@
1
- import{i as e,t}from"./cli-BilSDkvE.js";import{p as n,s as r}from"./output-BKeyLbvt.js";import{n as i,o as a,s as o,t as s}from"./args-BOEEdpWk.js";import c from"node:process";import*as l from"zod/mini";const u=e({name:`runner serve`,help:{usage:`coder runner serve --url <public url> [--token <token>] [--runner-url <url>] [--port <n>] [--name <name>] [--workspace] [--server [url]] [--json]`,summary:`Run tasks on this machine with its own claude and codex logins. Expose the port with any tunnel (cloudflared, ngrok, Tailscale Funnel or a public VS Code port) and pass the tunnel's URL; each start registers the current URL, so a changing tunnel URL is fine. Choose a default with coder runner default. Tasks use their named runner, the agent setting, your default, the workspace default, then the server default.`,flags:[[`--url <public url>`,`the HTTPS address the server reaches this runner at`],[`--token <token>`,`one-use pairing token, --url is the Coder server`],[`--runner-url <url>`,`public tunnel address when pairing, or CODER_RUNNER_URL`],[`--port <n>`,`local port the tunnel forwards to (default 4100)`],[`--name <name>`,`shown in the dashboard (default: this machine's hostname)`],[`--workspace`,`run every member's tasks, not only yours (owners and admins)`],t],examples:[[`cloudflared tunnel --url http://localhost:4100`,`expose the port in one terminal`],[`coder runner serve --url https://abc.trycloudflare.com`,`then serve through it`]]},options:{...s,port:l.optional(l.coerce.number().check(l.int(),l.positive())),url:o,name:o,token:o,"runner-url":o,workspace:i,server:a,yes:i},async run({options:e}){let{serveRunner:t}=await import(`./serve-BTeomYxW.js`).then(e=>e.n),n=await t({...e,runnerUrl:e[`runner-url`]}),r=()=>void n.close().finally(()=>c.exit(0));return c.once(`SIGINT`,r),c.once(`SIGTERM`,r),n},json:({server:e,close:t,...n})=>({ok:!0,...n}),print:e=>c.stdout.write(`Runner ${n.bold(e.name)} serves ${e.server} at ${n.cyan(e.config.url??``)} (${e.scope}), listening on localhost:${e.port}.\n${r([`Tasks run here with this machine's own claude and codex logins`,`Stop with Ctrl-C; the server marks the runner offline`],n,n.cyan)}\n`)});export{u as commandRunnerServe};
1
+ import{i as e,t}from"./cli-DWCR7iqa.js";import{p as n,s as r}from"./output-BKeyLbvt.js";import{n as i,o as a,s as o,t as s}from"./args-BOEEdpWk.js";import c from"node:process";import*as l from"zod/mini";const u=e({name:`runner serve`,help:{usage:`coder runner serve --url <public url> [--token <token>] [--runner-url <url>] [--port <n>] [--name <name>] [--workspace] [--server [url]] [--json]`,summary:`Run tasks on this machine with its own claude and codex logins. Expose the port with any tunnel (cloudflared, ngrok, Tailscale Funnel or a public VS Code port) and pass the tunnel's URL; each start registers the current URL, so a changing tunnel URL is fine. Choose a default with coder runner default. Tasks use their named runner, the agent setting, your default, the workspace default, then the server default.`,flags:[[`--url <public url>`,`the HTTPS address the server reaches this runner at`],[`--token <token>`,`one-use pairing token, --url is the Coder server`],[`--runner-url <url>`,`public tunnel address when pairing, or CODER_RUNNER_URL`],[`--port <n>`,`local port the tunnel forwards to (default 4100)`],[`--name <name>`,`shown in the dashboard (default: this machine's hostname)`],[`--workspace`,`run every member's tasks, not only yours (owners and admins)`],t],examples:[[`cloudflared tunnel --url http://localhost:4100`,`expose the port in one terminal`],[`coder runner serve --url https://abc.trycloudflare.com`,`then serve through it`]]},options:{...s,port:l.optional(l.coerce.number().check(l.int(),l.positive())),url:o,name:o,token:o,"runner-url":o,workspace:i,server:a,yes:i},async run({options:e}){let{serveRunner:t}=await import(`./serve-BTeomYxW.js`).then(e=>e.n),n=await t({...e,runnerUrl:e[`runner-url`]}),r=()=>void n.close().finally(()=>c.exit(0));return c.once(`SIGINT`,r),c.once(`SIGTERM`,r),n},json:({server:e,close:t,...n})=>({ok:!0,...n}),print:e=>c.stdout.write(`Runner ${n.bold(e.name)} serves ${e.server} at ${n.cyan(e.config.url??``)} (${e.scope}), listening on localhost:${e.port}.\n${r([`Tasks run here with this machine's own claude and codex logins`,`Stop with Ctrl-C; the server marks the runner offline`],n,n.cyan)}\n`)});export{u as commandRunnerServe};