@wular/coder 0.3.18 → 0.4.1
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.
- package/README.md +18 -16
- package/bin/coder.mjs +3 -1
- package/dist/actions-Mk3FSlpJ.js +20 -0
- package/dist/adapter-B0oYCI0S.js +1 -0
- package/dist/adapter-BKVzTDnn.js +1 -0
- package/dist/adapter-DPInwbJG.js +1 -0
- package/dist/adapter-DaiJMOYo.js +1 -0
- package/dist/adapter-PeKziOUg.js +1 -0
- package/dist/add-BxpLHnvD.js +1 -0
- package/dist/add-CE-70LFs.js +1 -0
- package/dist/add-U-pty9qJ.js +6 -0
- package/dist/add-ej0X9e3a.js +1 -0
- package/dist/add-json-CEa-6luW.js +1 -0
- package/dist/agent-BsYx3Odz.js +3 -0
- package/dist/agent-JdtZozvP.js +1 -0
- package/dist/alias-DX-Bm86x.js +2 -0
- package/dist/app-BT5f7zL5.js +1 -0
- package/dist/approvals-C-AvFt6s.js +2 -0
- package/dist/approve-DOmpQRNd.js +2 -0
- package/dist/apps-CjfrZyM5.js +1 -0
- package/dist/archive-BUB8gFKD.js +4 -0
- package/dist/archive-BziJ1rQ-.js +3 -0
- package/dist/archive-sweep-CtBcARgN.js +1 -0
- package/dist/args-BOEEdpWk.js +1 -0
- package/dist/ask-dE3U3ss2.js +4 -0
- package/dist/auth-BFny--17.js +1 -0
- package/dist/auth-DWHIzqbA.js +1 -0
- package/dist/builtin/coder/agent.json +24 -0
- package/dist/builtin/coder/system.md +17 -0
- package/dist/chat-3Znsevah.js +1 -0
- package/dist/chat-B_yhNTo0.js +13 -0
- package/dist/chat-bridge-BS9WtP3X.js +2 -0
- package/dist/cli-BilSDkvE.js +9 -0
- package/dist/cli.d.ts +71 -1
- package/dist/cli.js +1 -91
- package/dist/client-D9IoAuDD.js +1 -0
- package/dist/config-Da_cwoxI.js +3 -0
- package/dist/create-C_iMJV4Y.js +1 -0
- package/dist/credentials-B1jv6dkg.js +1 -0
- package/dist/dash/manifest.json +3427 -0
- package/dist/dash/public/assets/apple-touch-icon.png +0 -0
- package/dist/dash/public/assets/chunks/agent-pills-c9c4ac4d4a10df83.js +1 -0
- package/dist/dash/public/assets/chunks/agent-settings-form-8be2ddab074aba6d.js +1 -0
- package/dist/dash/public/assets/chunks/agents-grid-951584b6f4c4314e.js +1 -0
- package/dist/dash/public/assets/chunks/badge-676b01e0c615bf7b.js +1 -0
- package/dist/dash/public/assets/chunks/card-e0901d68b79dfa93.js +1 -0
- package/dist/dash/public/assets/chunks/combo-41234c24668b1db1.js +1 -0
- package/dist/dash/public/assets/chunks/composer-5534be50bc12385e.js +1 -0
- package/dist/dash/public/assets/chunks/composer-d10d4b1d54c4f751.js +1 -0
- package/dist/dash/public/assets/chunks/composer-data-6f7608fed13f3dd7.js +1 -0
- package/dist/dash/public/assets/chunks/confirm-f2fe4ba9905a89c6.js +1 -0
- package/dist/dash/public/assets/chunks/connect-apps-aa2a3d82e48ed8c3.js +1 -0
- package/dist/dash/public/assets/chunks/connect-repositories-5389ec8701a3deac.js +1 -0
- package/dist/dash/public/assets/chunks/credentials-list-bc5bfcab058176c5.js +2 -0
- package/dist/dash/public/assets/chunks/custom-range-4761ab14f05149df.js +1 -0
- package/dist/dash/public/assets/chunks/editor-bfe8cd854f8001be.js +7 -0
- package/dist/dash/public/assets/chunks/engines-list-f1191390f5715b39.js +1 -0
- package/dist/dash/public/assets/chunks/field-901f1f35c18c39c9.js +1 -0
- package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +1 -0
- package/dist/dash/public/assets/chunks/heads-f3bcd289663d48fa.js +1 -0
- package/dist/dash/public/assets/chunks/instructions-052fa45a9daf6db6.js +2 -0
- package/dist/dash/public/assets/chunks/instructions-d0a4b0d95009c262.js +1 -0
- package/dist/dash/public/assets/chunks/list-1d259660d7612c5f.js +1 -0
- package/dist/dash/public/assets/chunks/mcp-list-e3bebbbe831393b8.js +1 -0
- package/dist/dash/public/assets/chunks/model-options-15c53331a2f28a4f.js +1 -0
- package/dist/dash/public/assets/chunks/models-list-44f857a469ca04d5.js +1 -0
- package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +1 -0
- package/dist/dash/public/assets/chunks/platform-actions-d1426602049926d2.js +1 -0
- package/dist/dash/public/assets/chunks/runners-list-1901af8a5dea1f09.js +1 -0
- package/dist/dash/public/assets/chunks/runtime-246221e985d863e5-1.js +2 -0
- package/dist/dash/public/assets/chunks/segmented-358ff2b4992b8384.js +1 -0
- package/dist/dash/public/assets/chunks/select-7ae25fd8a7d6c338.js +1 -0
- package/dist/dash/public/assets/chunks/sentinel-c972a33dc69a5135.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-246221e985d863e5-2.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-88cce66bb3cfe1e5.js +5 -0
- package/dist/dash/public/assets/chunks/shared-init-8f2ac936c95a7f7b.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-ffb3397e494137c9.js +2 -0
- package/dist/dash/public/assets/chunks/tail-7c27aab8ba268bd9.js +1 -0
- package/dist/dash/public/assets/chunks/task-actions-8e1d93c788d001df.js +1 -0
- package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +1 -0
- package/dist/dash/public/assets/chunks/task-view-6d7618d2820a5cb4.js +3 -0
- package/dist/dash/public/assets/chunks/tasks-list-f4784e5cbd0ed785.js +1 -0
- package/dist/dash/public/assets/chunks/toolbar-a75d2570f07cbb70.js +1 -0
- package/dist/dash/public/assets/chunks/versions-list-fc2e0d2a7382e049.js +1 -0
- package/dist/dash/public/assets/chunks/wular-pnext-246221e985d863e5-0.js +1 -0
- package/dist/dash/public/assets/connect-382b1729a7ae7808.css +1 -0
- package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +1 -0
- package/dist/dash/public/assets/dash-account-04859899c1838ada.css +1 -0
- package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +1 -0
- package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +1 -0
- package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +1 -0
- package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +1 -0
- package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +1 -0
- package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +1 -0
- package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +1 -0
- package/dist/dash/public/assets/favicon.ico +0 -0
- package/dist/dash/public/assets/favicon.svg +1 -0
- package/dist/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/dist/dash/public/assets/global-d2adbf01910d9df5.css +1 -0
- package/dist/dash/public/assets/login-c129b1ce237be260.css +1 -0
- package/dist/dash/public/assets/pnext-client-03b03b254e525e82.js +1 -0
- package/dist/dash/public/assets/pnext-client-1b9ab0963a8ff77b.js +1 -0
- package/dist/dash/public/assets/pnext-client-1c7859bb888f4ef0.js +1 -0
- package/dist/dash/public/assets/pnext-client-3c748afe963fb05d.js +1 -0
- package/dist/dash/public/assets/pnext-client-4f47c2cae220f107.js +1 -0
- package/dist/dash/public/assets/pnext-client-6ab9fd9b53b794d2.js +1 -0
- package/dist/dash/public/assets/pnext-client-6c241786342498e4.js +1 -0
- package/dist/dash/public/assets/pnext-client-80b56d420f02b808.js +1 -0
- package/dist/dash/public/assets/pnext-client-83135c17bae850a3.js +1 -0
- package/dist/dash/public/assets/pnext-client-8e6fa4302ae0396f.js +1 -0
- package/dist/dash/public/assets/pnext-client-932c9d8cc0717fc8.js +1 -0
- package/dist/dash/public/assets/pnext-client-a42ae63d4de113f9.js +1 -0
- package/dist/dash/public/assets/pnext-client-d2ee6f8c1e337032.js +1 -0
- package/dist/dash/public/assets/pnext-client-d513f65ec23b7f20.js +1 -0
- package/dist/dash/public/assets/pnext-client-ecb88e2a8a109954.js +1 -0
- package/dist/dash/public/assets/pnext-client-f1545ee6270bbf9a.js +1 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +30 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +2704 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +208 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +834 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +35 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +1582 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +131 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +437 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +25 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +831 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +724 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +22 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +172 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +378 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +89 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +6270 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +1198 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +61 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +5151 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +20 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +438 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +17 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +107 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +183 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +647 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +129 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +7146 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +2397 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +220 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +72 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +231 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +627 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +265 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +18 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +16 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +17 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +219 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +16 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +48 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +963 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +26 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +12579 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +505 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +54 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +15 -0
- package/dist/default-Bobztoxf.js +1 -0
- package/dist/default-vYPT26DR.js +1 -0
- package/dist/delete-D8gEwoOj.js +4 -0
- package/dist/delete-z1_86nf6.js +2 -0
- package/dist/disable-DVKd-0Xb.js +1 -0
- package/dist/discover-Df-a8K4R.js +3 -0
- package/dist/discover-Dvr_3_Xr.js +1 -0
- package/dist/dispatch-BKeAch9E.js +14 -0
- package/dist/docs-BX65z2Iu.js +2 -0
- package/dist/docs-DKJnqZqt.js +2 -0
- package/dist/enable-C8Zf_wpN.js +1 -0
- package/dist/env-CRf6wkM2.js +1 -0
- package/dist/exec-RZFLclKX.js +11 -0
- package/dist/executor-BvAA7Cgw.js +10 -0
- package/dist/flow/builtin/review.d.ts +157 -0
- package/dist/flow/builtin/review.js +19 -0
- package/dist/flow/index.d.ts +1 -1
- package/dist/flow/index.js +1 -1
- package/dist/flow-17k25MHt.js +1 -0
- package/dist/github-actions-DwUzm4hC.js +24 -0
- package/dist/http-Bkg_OQ6r.js +1 -0
- package/dist/{index-BQ-b77or.d.ts → index-CZjFX5zV.d.ts} +116 -238
- package/dist/init-CoMfFxbG.js +1 -0
- package/dist/integrations-5xCaXSd-.js +1 -0
- package/dist/integrations-BAgdVDhj.js +5 -0
- package/dist/lib/broker.js +3 -3
- package/dist/list-BAKvxSbh.js +4 -0
- package/dist/list-BYiG8Zav.js +2 -0
- package/dist/list-BxEywhHU.js +1 -0
- package/dist/list-C5w01-8q.js +1 -0
- package/dist/list-CIW2joV1.js +1 -0
- package/dist/list-DX-z3SBp.js +3 -0
- package/dist/list-DpCf4G-H.js +4 -0
- package/dist/list-VToARh3C.js +1 -0
- package/dist/load-BpEsAn51.js +2 -0
- package/dist/local-H3uvqEbq.js +1 -0
- package/dist/log-view-dg0TlKLA.js +1 -0
- package/dist/login-BFxX4jJy.js +1 -0
- package/dist/login-DkkslfBx.js +1 -0
- package/dist/logout-BHAtw4Z8.js +1 -0
- package/dist/maintenance-C5FklUw3.js +1 -0
- package/dist/match-CXAjDhg7.js +1 -0
- package/dist/mcp-BgKb2Cdk.js +1 -0
- package/dist/mcp-CCZOAo06.js +1 -0
- package/dist/mcp-server-DGzme0YX.js +1 -0
- package/dist/migrate-C4vM7DQN.js +2 -0
- package/dist/migrate-N-85_N7J.js +1 -0
- package/dist/model-Bs1StDo3.js +1 -0
- package/dist/models-_5LVGC3m.js +1 -0
- package/dist/output-BKeyLbvt.js +5 -0
- package/dist/prompt-CEuBMNhk.js +7 -0
- package/dist/push-CUC55Bqd.js +1 -0
- package/dist/queue-6io_NOP3.js +116 -0
- package/dist/refresh-BIrmrWYq.js +1 -0
- package/dist/remote-miQNTVRa.js +1 -0
- package/dist/remove-B93LNkZI.js +1 -0
- package/dist/remove-C5_xggx7.js +1 -0
- package/dist/remove-CuH8a3L9.js +1 -0
- package/dist/remove-eQ8y5C5p.js +1 -0
- package/dist/rename-CYfy03FE.js +1 -0
- package/dist/result-BEtQZHaY.js +5 -0
- package/dist/result-BzaM3inj.js +15 -0
- package/dist/resume-DYzKvyEw.js +3 -0
- package/dist/review-oIBeECZE.js +7 -0
- package/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
- package/dist/rotate-key-IdMYH7gg.js +1 -0
- package/dist/run-BDYl0CKl.js +2 -0
- package/dist/run-CTtd0Znc.js +5 -0
- package/dist/run-CawRGnOg.js +2 -0
- package/dist/runner-D7ScbIHJ.js +1 -0
- package/dist/runner-sUpWJ_k0.js +1 -0
- package/dist/schema-CU2iFkp8.js +1 -0
- package/dist/sdk.d.ts +1166 -191
- package/dist/sdk.js +1 -1
- package/dist/serve-BTeomYxW.js +1 -0
- package/dist/serve-CE8YV2e9.js +1 -0
- package/dist/serve-CPnmrKyf.js +2 -0
- package/dist/serve-CQKZxzFE.js +4 -0
- package/dist/serve-GmRO89s5.js +12 -0
- package/dist/server-Kb22cWfF.js +1 -0
- package/dist/setup-host-GFTUzzZJ.js +6 -0
- package/dist/shared-DVtzWhUT.js +1 -0
- package/dist/show-CMUg8SJu.js +1 -0
- package/dist/show-COTZEYgc.js +1 -0
- package/dist/status-D26U--p8.js +1 -0
- package/dist/steer-C6uARLp5.js +4 -0
- package/dist/stop-BrGI3hSS.js +1 -0
- package/dist/stop-ByCAlbmN.js +3 -0
- package/dist/store-B94tSate.js +42 -0
- package/dist/store-DzqXS2wT.js +8 -0
- package/dist/task-C6VAg5WU.js +1 -0
- package/dist/task-CgOKgkEG.js +1 -0
- package/dist/task-DeglY79z.js +5 -0
- package/dist/test-NEbhlxvo.js +1 -0
- package/dist/tools-D0Zfs8Hx.js +1 -0
- package/dist/types-D0q15RJa.js +1 -0
- package/dist/types-I5Cwtl_K.d.ts +389 -0
- package/dist/unalias-C9NqmSDq.js +1 -0
- package/dist/update-BTxYQj7Z.js +2 -0
- package/dist/upgrade-hA0yWBvx.js +2 -0
- package/dist/usage-BhqoCjvE.js +1 -0
- package/dist/usage-C4d9X2Uq.js +1 -0
- package/dist/watch-CSdj24ct.js +5 -0
- package/dist/watch-DtRuC0Wc.js +8 -0
- package/dist/wire-BeT1Axeo.js +1 -0
- package/dist/worker-CXndxmGF.js +9 -0
- package/dist/worker-DX7P9kWl.js +1 -0
- package/dist/workflow-Dcmdooi8.js +1 -0
- package/docs/agents/coder.md +26 -0
- package/docs/agents/index.md +120 -0
- package/docs/config.md +51 -30
- package/docs/dash.md +64 -0
- package/docs/flows.md +20 -15
- package/docs/mcp.md +62 -0
- package/docs/models.md +41 -23
- package/docs/review.md +41 -0
- package/docs/sdk.md +57 -38
- package/docs/self-host.md +188 -0
- package/migrations/0000_initial.sql +252 -0
- package/migrations/meta/0000_snapshot.json +1787 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +37 -7
- package/plugins/agents/skills/coder/SKILL.md +14 -60
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/commands/setup.md +2 -2
- package/plugins/claude/skills/dispatch/SKILL.md +14 -58
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/README.md +5 -5
- package/plugins/cursor/assets/logo.png +0 -0
- package/plugins/cursor/skills/coder/SKILL.md +14 -59
- package/src/client/index.ts +573 -0
- package/src/client/types.ts +506 -0
- package/src/core/errors.ts +72 -0
- package/src/core/task/log-view.ts +173 -0
- package/src/server/auth/sign-in.ts +14 -0
- package/src/server/dash/api/load.ts +62 -0
- package/src/server/dash/api/types.ts +11 -0
- package/src/server/dash/app/connect/page.tsx +42 -0
- package/src/server/dash/app/dash/account/loading.tsx +11 -0
- package/src/server/dash/app/dash/account/notify.tsx +42 -0
- package/src/server/dash/app/dash/account/page.css +81 -0
- package/src/server/dash/app/dash/account/page.tsx +126 -0
- package/src/server/dash/app/dash/account/sign-out.tsx +24 -0
- package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +10 -0
- package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +143 -0
- package/src/server/dash/app/dash/agents/(list)/connect-apps.tsx +46 -0
- package/src/server/dash/app/dash/agents/(list)/loading.tsx +14 -0
- package/src/server/dash/app/dash/agents/(list)/page.css +72 -0
- package/src/server/dash/app/dash/agents/(list)/page.tsx +89 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +135 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.css +21 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.tsx +173 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/loading.tsx +18 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.css +87 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.tsx +258 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/platform-actions.tsx +111 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.css +114 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.tsx +294 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/page.tsx +54 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/page.tsx +14 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.css +12 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.tsx +163 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/versions-list.tsx +53 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/page.tsx +91 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.css +27 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.tsx +133 -0
- package/src/server/dash/app/dash/agents/agent/hero.css +40 -0
- package/src/server/dash/app/dash/agents/agent/hero.tsx +60 -0
- package/src/server/dash/app/dash/agents/agent/instructions.css +29 -0
- package/src/server/dash/app/dash/agents/agent/instructions.tsx +82 -0
- package/src/server/dash/app/dash/agents/editor/connect-repositories.ts +16 -0
- package/src/server/dash/app/dash/agents/editor/editor.css +263 -0
- package/src/server/dash/app/dash/agents/editor/editor.tsx +774 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.css +48 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.tsx +253 -0
- package/src/server/dash/app/dash/agents/editor/names.ts +35 -0
- package/src/server/dash/app/dash/agents/new/loading.tsx +25 -0
- package/src/server/dash/app/dash/agents/new/page.tsx +72 -0
- package/src/server/dash/app/dash/layout.css +265 -0
- package/src/server/dash/app/dash/layout.tsx +332 -0
- package/src/server/dash/app/dash/page.tsx +14 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.css +94 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +619 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials.tsx +36 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.css +16 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.tsx +135 -0
- package/src/server/dash/app/dash/settings/[tab]/list.css +98 -0
- package/src/server/dash/app/dash/settings/[tab]/list.tsx +215 -0
- package/src/server/dash/app/dash/settings/[tab]/loading.tsx +6 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.css +43 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.tsx +290 -0
- package/src/server/dash/app/dash/settings/[tab]/models-list.tsx +513 -0
- package/src/server/dash/app/dash/settings/[tab]/page.tsx +89 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.css +153 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +457 -0
- package/src/server/dash/app/dash/settings/layout.tsx +50 -0
- package/src/server/dash/app/dash/settings/model-options.ts +117 -0
- package/src/server/dash/app/dash/settings/page.tsx +7 -0
- package/src/server/dash/app/dash/settings/settings-head.tsx +24 -0
- package/src/server/dash/app/dash/settings/tunnel-guide.tsx +28 -0
- package/src/server/dash/app/dash/tasks/[id]/activity.tsx +202 -0
- package/src/server/dash/app/dash/tasks/[id]/loading.tsx +31 -0
- package/src/server/dash/app/dash/tasks/[id]/page.tsx +30 -0
- package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +164 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.css +407 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +513 -0
- package/src/server/dash/app/dash/tasks/composer-data.ts +96 -0
- package/src/server/dash/app/dash/tasks/composer.css +316 -0
- package/src/server/dash/app/dash/tasks/composer.tsx +890 -0
- package/src/server/dash/app/dash/tasks/list/status.css +50 -0
- package/src/server/dash/app/dash/tasks/list/status.tsx +20 -0
- package/src/server/dash/app/dash/tasks/list/task.ts +45 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.css +85 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +402 -0
- package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +96 -0
- package/src/server/dash/app/dash/tasks/page.tsx +53 -0
- package/src/server/dash/app/dash/token-from-hash.tsx +17 -0
- package/src/server/dash/app/dash/usage/custom-range.tsx +63 -0
- package/src/server/dash/app/dash/usage/day-chart.css +109 -0
- package/src/server/dash/app/dash/usage/day-chart.tsx +110 -0
- package/src/server/dash/app/dash/usage/loading.tsx +17 -0
- package/src/server/dash/app/dash/usage/metric.ts +13 -0
- package/src/server/dash/app/dash/usage/page.tsx +117 -0
- package/src/server/dash/app/dash/usage/range-bar.css +13 -0
- package/src/server/dash/app/dash/usage/range-bar.tsx +69 -0
- package/src/server/dash/app/dash/usage/stats.css +52 -0
- package/src/server/dash/app/dash/usage/stats.tsx +19 -0
- package/src/server/dash/app/dash/usage/top-agents.css +40 -0
- package/src/server/dash/app/dash/usage/top-agents.tsx +138 -0
- package/src/server/dash/app/dash/usage/usage.css +0 -0
- package/src/server/dash/app/globals.css +692 -0
- package/src/server/dash/app/layout.tsx +52 -0
- package/src/server/dash/app/login/page.css +26 -0
- package/src/server/dash/app/login/page.tsx +57 -0
- package/src/server/dash/app/page.tsx +5 -0
- package/src/server/dash/app/responsive.css +49 -0
- package/src/server/dash/app/zone.tsx +13 -0
- package/src/server/dash/comps/frame/auth-panel.css +60 -0
- package/src/server/dash/comps/frame/auth-panel.tsx +44 -0
- package/src/server/dash/comps/frame/drawer.css +28 -0
- package/src/server/dash/comps/frame/drawer.tsx +39 -0
- package/src/server/dash/comps/frame/heads.ts +41 -0
- package/src/server/dash/comps/frame/loading-card.tsx +65 -0
- package/src/server/dash/comps/frame/page-head.css +83 -0
- package/src/server/dash/comps/frame/page-head.tsx +71 -0
- package/src/server/dash/comps/frame/stream.tsx +50 -0
- package/src/server/dash/comps/frame/task-toasts.tsx +214 -0
- package/src/server/dash/comps/frame/theme-choices.tsx +46 -0
- package/src/server/dash/comps/nav/current-link.tsx +53 -0
- package/src/server/dash/comps/nav/side-toggle.tsx +30 -0
- package/src/server/dash/comps/nav/to.ts +22 -0
- package/src/server/dash/comps/ui/badge.css +64 -0
- package/src/server/dash/comps/ui/badge.tsx +41 -0
- package/src/server/dash/comps/ui/card.css +93 -0
- package/src/server/dash/comps/ui/card.tsx +77 -0
- package/src/server/dash/comps/ui/collapse.css +32 -0
- package/src/server/dash/comps/ui/collapse.tsx +49 -0
- package/src/server/dash/comps/ui/combo.tsx +154 -0
- package/src/server/dash/comps/ui/confirm.css +36 -0
- package/src/server/dash/comps/ui/confirm.tsx +67 -0
- package/src/server/dash/comps/ui/field.css +25 -0
- package/src/server/dash/comps/ui/field.tsx +34 -0
- package/src/server/dash/comps/ui/icon.css +22 -0
- package/src/server/dash/comps/ui/icon.tsx +17 -0
- package/src/server/dash/comps/ui/icons.ts +44 -0
- package/src/server/dash/comps/ui/menu.css +178 -0
- package/src/server/dash/comps/ui/menu.tsx +152 -0
- package/src/server/dash/comps/ui/segmented.css +44 -0
- package/src/server/dash/comps/ui/segmented.tsx +58 -0
- package/src/server/dash/comps/ui/select.css +103 -0
- package/src/server/dash/comps/ui/select.tsx +250 -0
- package/src/server/dash/comps/ui/sentinel.css +58 -0
- package/src/server/dash/comps/ui/sentinel.tsx +67 -0
- package/src/server/dash/comps/ui/tabs.css +81 -0
- package/src/server/dash/comps/ui/tabs.tsx +32 -0
- package/src/server/dash/comps/ui/tail.css +12 -0
- package/src/server/dash/comps/ui/tail.tsx +37 -0
- package/src/server/dash/comps/ui/toast.css +72 -0
- package/src/server/dash/comps/ui/toolbar.css +143 -0
- package/src/server/dash/comps/ui/toolbar.tsx +93 -0
- package/src/server/dash/package.json +5 -0
- package/src/server/dash/pnext-env.d.ts +4 -0
- package/src/server/dash/pnext.config.ts +5 -0
- package/src/server/dash/public/assets/apple-touch-icon.png +0 -0
- package/src/server/dash/public/assets/favicon.ico +0 -0
- package/src/server/dash/public/assets/favicon.svg +1 -0
- package/src/server/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/src/server/dash/tsconfig.json +10 -0
- package/src/server/dash/utils/client.ts +19 -0
- package/src/server/dash/utils/format.ts +75 -0
- package/src/server/dash/utils/paged.ts +184 -0
- package/src/server/dash/utils/range.ts +117 -0
- package/dist/app-server-CW93J9zJ.js +0 -3
- package/dist/runtime-D-U1DNkI.js +0 -26
- package/dist/upgrade-DOj06r5b.js +0 -37
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { CoderError } from '../core/errors';
|
|
2
|
+
import type {
|
|
3
|
+
RunnerSpec,
|
|
4
|
+
RunnerPairing,
|
|
5
|
+
RunnerInput,
|
|
6
|
+
RunnerUpdate,
|
|
7
|
+
RunnerTest,
|
|
8
|
+
ClientTypes,
|
|
9
|
+
PushResult,
|
|
10
|
+
AgentCardRow,
|
|
11
|
+
AgentRow,
|
|
12
|
+
AgentSettings,
|
|
13
|
+
AgentQuery,
|
|
14
|
+
TaskQuery,
|
|
15
|
+
PageQuery,
|
|
16
|
+
ImportAgent,
|
|
17
|
+
Paged,
|
|
18
|
+
TaskRow,
|
|
19
|
+
TasksPage,
|
|
20
|
+
VersionRow,
|
|
21
|
+
IntegrationInfo,
|
|
22
|
+
AppRow,
|
|
23
|
+
InstallationRow,
|
|
24
|
+
StoredRow,
|
|
25
|
+
Me,
|
|
26
|
+
EngineStatus,
|
|
27
|
+
LocalFolder,
|
|
28
|
+
LocalFolders,
|
|
29
|
+
Config,
|
|
30
|
+
ConfigShape,
|
|
31
|
+
ModelsShape,
|
|
32
|
+
ProbeResult,
|
|
33
|
+
McpRows,
|
|
34
|
+
Found,
|
|
35
|
+
UsageQuery,
|
|
36
|
+
UsageReport,
|
|
37
|
+
UsagePage,
|
|
38
|
+
TaskInput,
|
|
39
|
+
TaskLog,
|
|
40
|
+
} from './types';
|
|
41
|
+
|
|
42
|
+
export class ClientError extends CoderError {
|
|
43
|
+
constructor(
|
|
44
|
+
status: number,
|
|
45
|
+
message: string,
|
|
46
|
+
readonly authenticate = '',
|
|
47
|
+
hint?: string,
|
|
48
|
+
) {
|
|
49
|
+
super('server', message, { status, ...(hint ? { hint } : {}) });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ClientAuth = { token: string } | { cookie: true };
|
|
54
|
+
export interface ClientOptions {
|
|
55
|
+
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
56
|
+
organization?: string;
|
|
57
|
+
onError?(error: ClientError): void;
|
|
58
|
+
renewal?: { expiresAt(): number; renew(): Promise<string> };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function isLoopbackServer(server: string): boolean {
|
|
62
|
+
try {
|
|
63
|
+
const host = new URL(server).hostname.toLowerCase();
|
|
64
|
+
return host === 'localhost' || host === '[::1]' || /^127(?:\.\d{1,3}){3}$/.test(host);
|
|
65
|
+
} catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function validateUrl(raw: string): string {
|
|
71
|
+
let url: URL;
|
|
72
|
+
try {
|
|
73
|
+
url = new URL(raw);
|
|
74
|
+
} catch {
|
|
75
|
+
throw new CoderError(
|
|
76
|
+
'invalid-option',
|
|
77
|
+
'Give the server as a URL, e.g. https://agents.example.com.',
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopbackServer(url.origin)))
|
|
81
|
+
throw new CoderError(
|
|
82
|
+
'invalid-option',
|
|
83
|
+
'Coder servers require HTTPS unless they are loopback.',
|
|
84
|
+
{ hint: 'Use https://, or http://localhost for a local server.' },
|
|
85
|
+
);
|
|
86
|
+
if (url.username || url.password || url.search || url.hash)
|
|
87
|
+
throw new CoderError(
|
|
88
|
+
'invalid-option',
|
|
89
|
+
'The server must be an origin without credentials, query, or fragment.',
|
|
90
|
+
);
|
|
91
|
+
return url.toString().replace(/\/+$/, '');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const credentialPath = (label: string, suffix: string, workspace?: boolean) =>
|
|
95
|
+
`/admin/credentials/${encodeURIComponent(label)}${suffix}${workspace ? '?workspace' : ''}`;
|
|
96
|
+
|
|
97
|
+
const queryPath = (path: string, options: object) => {
|
|
98
|
+
const query = new URLSearchParams();
|
|
99
|
+
if ('cursor' in options && typeof options.cursor === 'string')
|
|
100
|
+
query.set('cursor', options.cursor);
|
|
101
|
+
for (const [key, value] of Object.entries(options))
|
|
102
|
+
if (key !== 'cursor' && value !== undefined && value !== false && value !== '')
|
|
103
|
+
query.set(key, value === true ? '1' : Array.isArray(value) ? value.join(',') : String(value));
|
|
104
|
+
return `${path}?${query}`;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const DONE = new Set<TaskRow['status']>(['completed', 'failed', 'cancelled']);
|
|
108
|
+
|
|
109
|
+
/** Typed HTTP routes with bearer or same-origin cookie authentication. */
|
|
110
|
+
export class ServerClient<D extends ClientTypes = ClientTypes> {
|
|
111
|
+
readonly url: string;
|
|
112
|
+
|
|
113
|
+
private readonly fetchImpl: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
114
|
+
private readonly organization?: string;
|
|
115
|
+
private readonly renewal?: ClientOptions['renewal'];
|
|
116
|
+
|
|
117
|
+
private readonly onError?: ClientOptions['onError'];
|
|
118
|
+
private token?: string;
|
|
119
|
+
private readonly cookie: boolean;
|
|
120
|
+
|
|
121
|
+
constructor(url: string, auth: ClientAuth, options: ClientOptions = {}) {
|
|
122
|
+
this.cookie = 'cookie' in auth;
|
|
123
|
+
this.url = url ? validateUrl(url) : '';
|
|
124
|
+
if (!this.cookie && !this.url)
|
|
125
|
+
throw new CoderError('invalid-option', 'Bearer clients need a server URL.');
|
|
126
|
+
this.token = 'token' in auth ? auth.token : undefined;
|
|
127
|
+
this.fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
|
|
128
|
+
this.organization = options.organization;
|
|
129
|
+
this.renewal = options.renewal;
|
|
130
|
+
this.onError = options.onError;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private request<T>(path: string, init: RequestInit = {}): Promise<T> {
|
|
134
|
+
const pending = this.read<T>(path, init);
|
|
135
|
+
pending.catch(() => {});
|
|
136
|
+
return pending;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private async read<T>(path: string, init: RequestInit): Promise<T> {
|
|
140
|
+
if (this.renewal && this.renewal.expiresAt() - Date.now() < 30_000)
|
|
141
|
+
this.token = await this.renewal.renew();
|
|
142
|
+
let response = await this.send(path, init);
|
|
143
|
+
// RFC 6750: an expired or too old token is refreshed once and the call retried.
|
|
144
|
+
if (
|
|
145
|
+
response.status === 401 &&
|
|
146
|
+
this.renewal &&
|
|
147
|
+
/invalid_token/.test(response.headers.get('www-authenticate') ?? '')
|
|
148
|
+
) {
|
|
149
|
+
this.token = await this.renewal.renew();
|
|
150
|
+
response = await this.send(path, init);
|
|
151
|
+
}
|
|
152
|
+
const text = await response.text().catch(() => '');
|
|
153
|
+
let body = {} as T & { error?: string; message?: string; hint?: string };
|
|
154
|
+
let plain: string | undefined;
|
|
155
|
+
try {
|
|
156
|
+
if (text && response.status !== 204) body = JSON.parse(text);
|
|
157
|
+
} catch {
|
|
158
|
+
if (response.ok)
|
|
159
|
+
throw new CoderError(
|
|
160
|
+
'server',
|
|
161
|
+
`The server answered ${response.status} with a body that is not JSON.`,
|
|
162
|
+
);
|
|
163
|
+
if (this.cookie && text) plain = text;
|
|
164
|
+
}
|
|
165
|
+
if (!response.ok) {
|
|
166
|
+
const error = new ClientError(
|
|
167
|
+
response.status,
|
|
168
|
+
body.error ?? body.message ?? plain ?? `The server answered ${response.status}.`,
|
|
169
|
+
response.headers.get('www-authenticate') ?? '',
|
|
170
|
+
body.hint,
|
|
171
|
+
);
|
|
172
|
+
this.onError?.(error);
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
return body;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private send(path: string, init: RequestInit): Promise<Response> {
|
|
179
|
+
const headers = new Headers(init.headers);
|
|
180
|
+
if (init.body && !headers.has('content-type')) headers.set('content-type', 'application/json');
|
|
181
|
+
if (!this.cookie) headers.set('authorization', `Bearer ${this.token}`);
|
|
182
|
+
if (this.organization) headers.set('x-coder-organization', this.organization);
|
|
183
|
+
return this.fetchImpl(`${this.url}${path}`, {
|
|
184
|
+
...init,
|
|
185
|
+
headers,
|
|
186
|
+
...(this.cookie ? { credentials: 'same-origin' as const } : {}),
|
|
187
|
+
}).catch((error: Error) => {
|
|
188
|
+
if (error instanceof CoderError || error.name === 'AbortError') throw error;
|
|
189
|
+
throw new CoderError(
|
|
190
|
+
'server',
|
|
191
|
+
this.url
|
|
192
|
+
? `No Coder server answers at ${this.url}: ${error.message}`
|
|
193
|
+
: 'The server did not answer. Check the connection and try again.',
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private post<T>(path: string, body?: unknown): Promise<T> {
|
|
199
|
+
return this.request<T>(path, {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** `GET /me`: who the token belongs to. */
|
|
206
|
+
me(): Promise<Me> {
|
|
207
|
+
return this.request('/me');
|
|
208
|
+
}
|
|
209
|
+
info(): Promise<{ wular: string | null }> {
|
|
210
|
+
return this.request('/api/auth/capabilities');
|
|
211
|
+
}
|
|
212
|
+
linkAccount(token: string): Promise<{ platform: string; platformUserId: string }> {
|
|
213
|
+
return this.post('/connect', { token });
|
|
214
|
+
}
|
|
215
|
+
signOut(): Promise<{ url?: string }> {
|
|
216
|
+
return this.post('/api/auth/sign-out', {});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
readonly agents = {
|
|
220
|
+
list: <Q extends AgentQuery = AgentQuery>(
|
|
221
|
+
options?: Q,
|
|
222
|
+
): Promise<
|
|
223
|
+
Q extends { cursor: string }
|
|
224
|
+
? Paged<AgentCardRow> & {
|
|
225
|
+
connectable?: Array<{ id: string; integration: string }>;
|
|
226
|
+
}
|
|
227
|
+
: D['agent'][]
|
|
228
|
+
> =>
|
|
229
|
+
this.request(
|
|
230
|
+
queryPath('/admin/agents', {
|
|
231
|
+
...options,
|
|
232
|
+
...(options?.connect ? { connect: 1 } : {}),
|
|
233
|
+
}),
|
|
234
|
+
),
|
|
235
|
+
get: <Q extends { versions?: boolean; content?: boolean } = {}>(
|
|
236
|
+
slug: string,
|
|
237
|
+
options?: Q,
|
|
238
|
+
): Promise<Q extends { versions: false } ? AgentRow : D['detail']> =>
|
|
239
|
+
this.request(
|
|
240
|
+
queryPath(`/admin/agents/${encodeURIComponent(slug)}`, {
|
|
241
|
+
...(options?.versions === false ? { versions: 0 } : {}),
|
|
242
|
+
...(options?.content === false ? { content: 0 } : {}),
|
|
243
|
+
}),
|
|
244
|
+
),
|
|
245
|
+
versions: (slug: string, options: PageQuery = {}): Promise<Paged<VersionRow>> =>
|
|
246
|
+
this.request(queryPath(`/admin/agents/${encodeURIComponent(slug)}/versions`, options)),
|
|
247
|
+
remove: (slug: string): Promise<{ ok: true }> =>
|
|
248
|
+
this.request(`/admin/agents/${encodeURIComponent(slug)}`, {
|
|
249
|
+
method: 'DELETE',
|
|
250
|
+
}),
|
|
251
|
+
preview: (repo: string, ref?: string): Promise<{ agents: ImportAgent[] }> =>
|
|
252
|
+
this.request(queryPath('/admin/agents/import', { repo, ref })),
|
|
253
|
+
version: (slug: string, version: number): Promise<D['version']> =>
|
|
254
|
+
this.request(`/admin/agents/${encodeURIComponent(slug)}/versions/${version}`),
|
|
255
|
+
/** Upload one agent's contents; a new version only when something changed. */
|
|
256
|
+
put: (
|
|
257
|
+
slug: string,
|
|
258
|
+
body: {
|
|
259
|
+
definition: unknown;
|
|
260
|
+
systemPrompt: string;
|
|
261
|
+
files?: Record<string, string>;
|
|
262
|
+
name?: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
},
|
|
265
|
+
): Promise<PushResult> =>
|
|
266
|
+
this.request<Omit<PushResult, 'id'>>(`/admin/agents/${encodeURIComponent(slug)}`, {
|
|
267
|
+
method: 'PUT',
|
|
268
|
+
body: JSON.stringify(body),
|
|
269
|
+
}).then(result => ({
|
|
270
|
+
id: slug,
|
|
271
|
+
version: result.version,
|
|
272
|
+
unchanged: result.unchanged,
|
|
273
|
+
})),
|
|
274
|
+
settings: (slug: string, settings: AgentSettings): Promise<D['record']> =>
|
|
275
|
+
this.request(`/admin/agents/${encodeURIComponent(slug)}/settings`, {
|
|
276
|
+
method: 'PATCH',
|
|
277
|
+
body: JSON.stringify(settings),
|
|
278
|
+
}),
|
|
279
|
+
import: (repo: string, ref?: string, agents?: string[]): Promise<{ imported: string[] }> =>
|
|
280
|
+
this.post('/admin/agents/import', {
|
|
281
|
+
repo,
|
|
282
|
+
ref,
|
|
283
|
+
...(agents ? { agents } : {}),
|
|
284
|
+
}),
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
readonly folders = {
|
|
288
|
+
list: (): Promise<LocalFolders> => this.request('/admin/folders'),
|
|
289
|
+
check: (
|
|
290
|
+
path: string,
|
|
291
|
+
): Promise<{ ok: true; folder: LocalFolder } | { ok: false; detail: string }> =>
|
|
292
|
+
this.post('/admin/folders/check', { path }),
|
|
293
|
+
/** Clones an https or ssh git URL with the server machine's git logins, or fetches it again. */
|
|
294
|
+
clone: (
|
|
295
|
+
url: string,
|
|
296
|
+
): Promise<{ ok: true; folder: LocalFolder } | { ok: false; detail: string }> =>
|
|
297
|
+
this.post('/admin/folders/clone', { url }),
|
|
298
|
+
/** Opens the folder dialog on the server's machine; a closed dialog answers `{ ok: false, detail: "" }`. */
|
|
299
|
+
pick: (): Promise<{ ok: true; folder: LocalFolder } | { ok: false; detail: string }> =>
|
|
300
|
+
this.post('/admin/folders/pick', {}),
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
readonly tasks = {
|
|
304
|
+
run: (input: TaskInput): Promise<D['task']> => this.post('/admin/tasks', input),
|
|
305
|
+
list: <Q extends TaskQuery = TaskQuery>(
|
|
306
|
+
options?: Q,
|
|
307
|
+
): Promise<Q extends { cursor: string } ? TasksPage : D['task'][]> =>
|
|
308
|
+
this.request(
|
|
309
|
+
queryPath('/admin/tasks', {
|
|
310
|
+
limit: 20,
|
|
311
|
+
...options,
|
|
312
|
+
...(options?.archived ? { archived: 1 } : {}),
|
|
313
|
+
...(options?.summary ? { summary: 1 } : {}),
|
|
314
|
+
...(options?.counts ? { counts: 1 } : {}),
|
|
315
|
+
}),
|
|
316
|
+
),
|
|
317
|
+
get: (id: string): Promise<D['task']> => this.request(`/admin/tasks/${encodeURIComponent(id)}`),
|
|
318
|
+
logs: (id: string, after = -1, limit?: number): Promise<TaskLog[]> =>
|
|
319
|
+
this.request(
|
|
320
|
+
queryPath(`/admin/tasks/${encodeURIComponent(id)}/logs`, {
|
|
321
|
+
after,
|
|
322
|
+
limit,
|
|
323
|
+
}),
|
|
324
|
+
),
|
|
325
|
+
stream: (id: string, after = -1, signal?: AbortSignal): Promise<Response> =>
|
|
326
|
+
this.send(`/admin/tasks/${encodeURIComponent(id)}/stream?after=${after}`, {
|
|
327
|
+
headers: { accept: 'text/event-stream' },
|
|
328
|
+
signal,
|
|
329
|
+
}),
|
|
330
|
+
cancel: (id: string): Promise<{ ok: true }> =>
|
|
331
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/cancel`),
|
|
332
|
+
steer: (id: string, text: string) =>
|
|
333
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/steer`, { text }),
|
|
334
|
+
ask: (id: string, question: string) =>
|
|
335
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/ask`, { question }),
|
|
336
|
+
approve: (id: string, approvalId: string, decision: 'accept' | 'decline') =>
|
|
337
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/approve`, {
|
|
338
|
+
approvalId,
|
|
339
|
+
decision,
|
|
340
|
+
}),
|
|
341
|
+
archive: (id: string): Promise<{ ok: true }> =>
|
|
342
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/archive`),
|
|
343
|
+
delete: (id: string): Promise<{ ok: true }> =>
|
|
344
|
+
this.request(`/admin/tasks/${encodeURIComponent(id)}`, {
|
|
345
|
+
method: 'DELETE',
|
|
346
|
+
}),
|
|
347
|
+
/** Start a task from a prompt, or a flow with `flow` and `args`. */
|
|
348
|
+
create: <T extends TaskInput | { agent: string; event: D['event'] }>(
|
|
349
|
+
input: T,
|
|
350
|
+
): Promise<T extends { event: D['event'] } ? { tasks: string[] } : D['task']> =>
|
|
351
|
+
this.post('/admin/tasks', input),
|
|
352
|
+
/** Ask a finished task something new, on the same thread. */
|
|
353
|
+
continue: (
|
|
354
|
+
id: string,
|
|
355
|
+
text: string,
|
|
356
|
+
options: { outputSchema?: object } = {},
|
|
357
|
+
): Promise<D['task']> =>
|
|
358
|
+
this.post(`/admin/tasks/${encodeURIComponent(id)}/continue`, { text, ...options }),
|
|
359
|
+
/** Follow the task's event stream until it ends; `onLog` sees each log line as it lands. */
|
|
360
|
+
wait: async (
|
|
361
|
+
id: string,
|
|
362
|
+
options: { onLog?: (line: TaskLog) => void } = {},
|
|
363
|
+
): Promise<D['task']> => {
|
|
364
|
+
let after = -1;
|
|
365
|
+
for (;;) {
|
|
366
|
+
const response = await this.tasks.stream(id, after);
|
|
367
|
+
if (!response.ok || !response.body) {
|
|
368
|
+
// `get` renews an expired token before the stream is asked again.
|
|
369
|
+
const status = await this.tasks.get(id);
|
|
370
|
+
if (DONE.has(status.status)) return status;
|
|
371
|
+
if (response.status === 401) continue;
|
|
372
|
+
throw new CoderError('server', `The task stream answered ${response.status}.`);
|
|
373
|
+
}
|
|
374
|
+
let ended = false;
|
|
375
|
+
for await (const event of serverEvents(response.body)) {
|
|
376
|
+
if (event.event === 'log') {
|
|
377
|
+
const line = JSON.parse(event.data) as TaskLog;
|
|
378
|
+
after = line.seq;
|
|
379
|
+
options.onLog?.(line);
|
|
380
|
+
} else if (event.event === 'end') ended = true;
|
|
381
|
+
}
|
|
382
|
+
if (ended) return this.tasks.get(id);
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
readonly credentials = {
|
|
388
|
+
list: <Q extends PageQuery = PageQuery>(
|
|
389
|
+
options?: Q,
|
|
390
|
+
): Promise<Q extends { cursor: string } ? Paged<D['credential']> : D['credential'][]> =>
|
|
391
|
+
this.request(queryPath('/admin/credentials', options ?? {})),
|
|
392
|
+
add: (input: {
|
|
393
|
+
label?: string;
|
|
394
|
+
env: Record<string, string>;
|
|
395
|
+
engine: 'claude' | 'codex' | 'custom';
|
|
396
|
+
workspace?: boolean;
|
|
397
|
+
noCheck?: boolean;
|
|
398
|
+
default?: boolean;
|
|
399
|
+
}): Promise<{ ok: true; label: string }> => this.post('/admin/credentials', input),
|
|
400
|
+
remove: (label: string, { workspace }: { workspace?: boolean } = {}): Promise<{ ok: true }> =>
|
|
401
|
+
this.request(credentialPath(label, '', workspace), { method: 'DELETE' }),
|
|
402
|
+
setDefault: (
|
|
403
|
+
label: string,
|
|
404
|
+
{ workspace }: { workspace?: boolean } = {},
|
|
405
|
+
): Promise<{ ok: true }> => this.post(credentialPath(label, '/default', workspace)),
|
|
406
|
+
login: (engine: 'claude' | 'codex'): Promise<D['login']> =>
|
|
407
|
+
this.post('/admin/logins', { engine }),
|
|
408
|
+
loginStatus: (id: string): Promise<D['login']> =>
|
|
409
|
+
this.request(`/admin/logins/${encodeURIComponent(id)}`),
|
|
410
|
+
loginCode: (id: string, code: string): Promise<{ ok: true }> =>
|
|
411
|
+
this.post(`/admin/logins/${encodeURIComponent(id)}`, { code }),
|
|
412
|
+
cancelLogin: (id: string): Promise<{ ok: true }> =>
|
|
413
|
+
this.request(`/admin/logins/${encodeURIComponent(id)}`, {
|
|
414
|
+
method: 'DELETE',
|
|
415
|
+
}),
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
readonly runners = {
|
|
419
|
+
list: (): Promise<{ items: D['runner'][]; catalog: RunnerSpec[] }> =>
|
|
420
|
+
this.request('/admin/runners'),
|
|
421
|
+
add: (input: RunnerInput): Promise<D['runner']> => this.post('/admin/runners', input),
|
|
422
|
+
pair: (input: { name?: string; scope: RunnerInput['scope'] }): Promise<RunnerPairing> =>
|
|
423
|
+
this.post('/admin/runners/pair', input),
|
|
424
|
+
update: (id: string, input: RunnerUpdate): Promise<D['runner']> =>
|
|
425
|
+
this.request(`/admin/runners/${encodeURIComponent(id)}`, {
|
|
426
|
+
method: 'PATCH',
|
|
427
|
+
body: JSON.stringify(input),
|
|
428
|
+
}),
|
|
429
|
+
test: (id: string): Promise<RunnerTest> =>
|
|
430
|
+
this.post(`/admin/runners/${encodeURIComponent(id)}/test`, {}),
|
|
431
|
+
remove: (id: string): Promise<{ ok: true }> =>
|
|
432
|
+
this.request(`/admin/runners/${encodeURIComponent(id)}`, { method: 'DELETE' }),
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
readonly integrations = {
|
|
436
|
+
list: (): Promise<IntegrationInfo[]> => this.request('/admin/integrations'),
|
|
437
|
+
};
|
|
438
|
+
readonly repositories = {
|
|
439
|
+
list: (): Promise<Array<{ repo: string; integration: string }>> =>
|
|
440
|
+
this.request('/admin/repositories'),
|
|
441
|
+
};
|
|
442
|
+
readonly engines = {
|
|
443
|
+
status: (): Promise<EngineStatus> => this.request('/admin/engines/status'),
|
|
444
|
+
login: (engine: string): Promise<EngineStatus> =>
|
|
445
|
+
this.post(`/admin/engines/${encodeURIComponent(engine)}/login`, {}),
|
|
446
|
+
logout: (engine: string): Promise<EngineStatus> =>
|
|
447
|
+
this.post(`/admin/engines/${encodeURIComponent(engine)}/logout`, {}),
|
|
448
|
+
};
|
|
449
|
+
readonly apps = {
|
|
450
|
+
list: (agent?: string): Promise<Array<StoredRow<AppRow>>> =>
|
|
451
|
+
this.request(queryPath('/admin/apps', { agent })),
|
|
452
|
+
install: (id: string, back?: string): Promise<{ url: string }> =>
|
|
453
|
+
this.post(queryPath(`/admin/apps/${encodeURIComponent(id)}/install`, { back })),
|
|
454
|
+
};
|
|
455
|
+
readonly installations = {
|
|
456
|
+
list: (agent?: string): Promise<Array<StoredRow<InstallationRow>>> =>
|
|
457
|
+
this.request(queryPath('/admin/installations', { agent })),
|
|
458
|
+
};
|
|
459
|
+
readonly connections = {
|
|
460
|
+
add: (body: {
|
|
461
|
+
installation: string;
|
|
462
|
+
integration: string;
|
|
463
|
+
token: string;
|
|
464
|
+
account?: string;
|
|
465
|
+
}): Promise<{ ok: true }> => this.post('/admin/connections', body),
|
|
466
|
+
};
|
|
467
|
+
readonly config = {
|
|
468
|
+
get: (): Promise<ConfigShape> => this.request('/admin/config'),
|
|
469
|
+
put: (body: Config): Promise<Config> =>
|
|
470
|
+
this.request('/admin/config', {
|
|
471
|
+
method: 'PUT',
|
|
472
|
+
body: JSON.stringify(body),
|
|
473
|
+
}),
|
|
474
|
+
patch: (body: import('./types').ConfigPatch): Promise<Config> =>
|
|
475
|
+
this.request('/admin/config', {
|
|
476
|
+
method: 'PATCH',
|
|
477
|
+
headers: { 'content-type': 'application/merge-patch+json' },
|
|
478
|
+
body: JSON.stringify(body),
|
|
479
|
+
}),
|
|
480
|
+
};
|
|
481
|
+
readonly models = {
|
|
482
|
+
list: (): Promise<ModelsShape> => this.request('/admin/models'),
|
|
483
|
+
add: (body: {
|
|
484
|
+
name: string;
|
|
485
|
+
baseUrl: string;
|
|
486
|
+
model: string;
|
|
487
|
+
envKey?: string;
|
|
488
|
+
}): Promise<Config> => this.post('/admin/models', body),
|
|
489
|
+
probe: (body: { baseUrl: string; envKey?: string; key?: string }): Promise<ProbeResult> =>
|
|
490
|
+
this.post('/admin/models/probe', body),
|
|
491
|
+
remove: (name: string): Promise<Config> =>
|
|
492
|
+
this.request(`/admin/models/${encodeURIComponent(name)}`, {
|
|
493
|
+
method: 'DELETE',
|
|
494
|
+
}),
|
|
495
|
+
alias: (name: string, spec: string): Promise<Config> =>
|
|
496
|
+
this.post(`/admin/models/${encodeURIComponent(name)}/alias`, { spec }),
|
|
497
|
+
enable: (name: string): Promise<Config> =>
|
|
498
|
+
this.post(`/admin/models/${encodeURIComponent(name)}/enable`),
|
|
499
|
+
disable: (name: string): Promise<Config> =>
|
|
500
|
+
this.post(`/admin/models/${encodeURIComponent(name)}/disable`),
|
|
501
|
+
};
|
|
502
|
+
readonly mcp = {
|
|
503
|
+
list: (): Promise<McpRows> => this.request('/admin/mcp'),
|
|
504
|
+
add: (body: { name: string } & McpRows[string]): Promise<Config> =>
|
|
505
|
+
this.post('/admin/mcp', body),
|
|
506
|
+
remove: (name: string): Promise<Config> =>
|
|
507
|
+
this.request(`/admin/mcp/${encodeURIComponent(name)}`, {
|
|
508
|
+
method: 'DELETE',
|
|
509
|
+
}),
|
|
510
|
+
search: (q: string): Promise<Found[]> => this.request(queryPath('/admin/mcp-registry', { q })),
|
|
511
|
+
};
|
|
512
|
+
readonly flows = {
|
|
513
|
+
list: (repo?: string): Promise<Array<{ name: string; scope: string }>> =>
|
|
514
|
+
this.request(queryPath('/admin/flows', { repo })),
|
|
515
|
+
run: (name: string, body: TaskInput): Promise<D['task']> =>
|
|
516
|
+
this.post(`/admin/flows/${encodeURIComponent(name)}/run`, body),
|
|
517
|
+
};
|
|
518
|
+
readonly pulls = {
|
|
519
|
+
list: (repo: string): Promise<Array<{ number: number; title: string }>> =>
|
|
520
|
+
this.request(queryPath('/admin/pulls', { repo })),
|
|
521
|
+
};
|
|
522
|
+
review(body: TaskInput & { repo: string; pr: number; post?: boolean }): Promise<D['task']> {
|
|
523
|
+
return this.post('/admin/review', body);
|
|
524
|
+
}
|
|
525
|
+
usage<Q extends UsageQuery = {}>(
|
|
526
|
+
options: Q = {} as Q,
|
|
527
|
+
): Promise<
|
|
528
|
+
Q extends { cursor: string }
|
|
529
|
+
? UsagePage
|
|
530
|
+
: Q extends
|
|
531
|
+
| { until: number }
|
|
532
|
+
| { agent: string }
|
|
533
|
+
| { tz: string }
|
|
534
|
+
| { parts: string[] }
|
|
535
|
+
| { top: number }
|
|
536
|
+
| { by: 'day' }
|
|
537
|
+
? UsageReport
|
|
538
|
+
: D['usage']
|
|
539
|
+
> {
|
|
540
|
+
return this.request(
|
|
541
|
+
queryPath('/admin/usage/totals', {
|
|
542
|
+
...options,
|
|
543
|
+
since: options.since ?? Date.now() - 7 * 24 * 60 * 60 * 1000,
|
|
544
|
+
}),
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
usageRows(installation?: string): Promise<Array<StoredRow<D['usageRow']>>> {
|
|
548
|
+
return this.request(queryPath('/admin/usage', { installation }));
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** Server-Sent Events from a response body, one `{ event, data }` per message. */
|
|
553
|
+
export async function* serverEvents(
|
|
554
|
+
body: ReadableStream<Uint8Array>,
|
|
555
|
+
): AsyncGenerator<{ event: string; data: string }> {
|
|
556
|
+
const decoder = new TextDecoder();
|
|
557
|
+
let buffer = '';
|
|
558
|
+
for await (const chunk of body as unknown as AsyncIterable<Uint8Array>) {
|
|
559
|
+
buffer += decoder.decode(chunk, { stream: true });
|
|
560
|
+
let end: number;
|
|
561
|
+
while ((end = buffer.indexOf('\n\n')) >= 0) {
|
|
562
|
+
const block = buffer.slice(0, end);
|
|
563
|
+
buffer = buffer.slice(end + 2);
|
|
564
|
+
let event = 'message';
|
|
565
|
+
const data: string[] = [];
|
|
566
|
+
for (const line of block.split('\n')) {
|
|
567
|
+
if (line.startsWith('event: ')) event = line.slice(7);
|
|
568
|
+
else if (line.startsWith('data: ')) data.push(line.slice(6));
|
|
569
|
+
}
|
|
570
|
+
if (data.length) yield { event, data: data.join('\n') };
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|