@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,513 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './task-view.css';
|
|
4
|
+
|
|
5
|
+
import { Fragment } from 'preact';
|
|
6
|
+
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
|
7
|
+
|
|
8
|
+
import { serverEvents } from '@coder/client';
|
|
9
|
+
import { LogView, type TaskDisplayRow } from '@coder/core/task/log-view';
|
|
10
|
+
import { client } from '@/utils/client';
|
|
11
|
+
import { formatDate, formatDuration, reasonText } from '@/utils/format';
|
|
12
|
+
import { Link } from '@wular/pnext/link';
|
|
13
|
+
import { useSearchParams } from '@wular/pnext/navigation/client';
|
|
14
|
+
import type { TaskLog, TaskRow } from '@coder/client/types';
|
|
15
|
+
import { iAgent, iCheck, iCopy, iDown } from '@/comps/ui/icons';
|
|
16
|
+
import { Badge } from '@/comps/ui/badge';
|
|
17
|
+
import { Card, Loading } from '@/comps/ui/card';
|
|
18
|
+
import { Collapse } from '@/comps/ui/collapse';
|
|
19
|
+
import { Icon } from '@/comps/ui/icon';
|
|
20
|
+
import { Menu } from '@/comps/ui/menu';
|
|
21
|
+
import { Back, PageHead } from '@/comps/frame/page-head';
|
|
22
|
+
import { backFrom } from '@/comps/frame/heads';
|
|
23
|
+
import { markdown } from '@/app/dash/agents/agent/instructions';
|
|
24
|
+
import { Status } from '@/app/dash/tasks/list/status';
|
|
25
|
+
import { folderName, sourceLabel, taskActive, taskTitle } from '@/app/dash/tasks/list/task';
|
|
26
|
+
import { Approval, TaskActions, useAction } from './task-actions';
|
|
27
|
+
import { Activity } from './activity';
|
|
28
|
+
import { toastError, watchTask } from '@/comps/frame/task-toasts';
|
|
29
|
+
|
|
30
|
+
const TABS = ['Conversation', 'Activity'];
|
|
31
|
+
|
|
32
|
+
type Tab = 'conversation' | 'activity';
|
|
33
|
+
|
|
34
|
+
function messageOf(value: unknown, fallback: string): string {
|
|
35
|
+
if (typeof value === 'string') return value;
|
|
36
|
+
if (!value || typeof value !== 'object') return fallback;
|
|
37
|
+
const record = value as Record<string, unknown>;
|
|
38
|
+
for (const key of ['output', 'answer', 'message'])
|
|
39
|
+
if (typeof record[key] === 'string') return record[key];
|
|
40
|
+
return fallback;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A result's message as pretty JSON when it is JSON, else as markdown. */
|
|
44
|
+
type Finding = {
|
|
45
|
+
file: string;
|
|
46
|
+
line: number;
|
|
47
|
+
severity: string;
|
|
48
|
+
category?: string;
|
|
49
|
+
summary: string;
|
|
50
|
+
failure_scenario?: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const isFindings = (json: unknown): json is { findings: Finding[] } =>
|
|
54
|
+
typeof json === 'object' &&
|
|
55
|
+
json !== null &&
|
|
56
|
+
Array.isArray((json as { findings?: unknown }).findings) &&
|
|
57
|
+
(json as { findings: unknown[] }).findings.every(
|
|
58
|
+
f => typeof f === 'object' && f !== null && 'file' in f && 'summary' in f,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
/** A review.s findings, one per changed line, worst first. */
|
|
62
|
+
function Findings({ findings }: { findings: Finding[] }) {
|
|
63
|
+
if (!findings.length) return <p class="body muted">No findings.</p>;
|
|
64
|
+
return (
|
|
65
|
+
<ul class="findings">
|
|
66
|
+
{findings.map((f, index) => (
|
|
67
|
+
<li key={index} class={`finding ${f.severity}`}>
|
|
68
|
+
<p class="finding-head">
|
|
69
|
+
<span class="sev">{f.severity}</span>
|
|
70
|
+
<span class="loc">
|
|
71
|
+
{f.file}:{f.line}
|
|
72
|
+
</span>
|
|
73
|
+
{f.category ? <span class="cat">{f.category}</span> : null}
|
|
74
|
+
</p>
|
|
75
|
+
<p class="finding-sum">{f.summary}</p>
|
|
76
|
+
{f.failure_scenario ? <p class="finding-why muted">{f.failure_scenario}</p> : null}
|
|
77
|
+
</li>
|
|
78
|
+
))}
|
|
79
|
+
</ul>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function ResultBody({ value }: { value: unknown }) {
|
|
84
|
+
const text = messageOf(value, 'Result received.');
|
|
85
|
+
let json: unknown;
|
|
86
|
+
if (/^\s*[[{]/.test(text))
|
|
87
|
+
try {
|
|
88
|
+
json = JSON.parse(text);
|
|
89
|
+
} catch {}
|
|
90
|
+
if (isFindings(json)) return <Findings findings={json.findings} />;
|
|
91
|
+
if (json && typeof json === 'object')
|
|
92
|
+
return <pre class="body json">{JSON.stringify(json, null, 2)}</pre>;
|
|
93
|
+
return <div class="body md">{markdown(text)}</div>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Back to where the task was opened from: a `back` path, a `from` list, or Tasks. */
|
|
97
|
+
function TaskBack() {
|
|
98
|
+
const search = useSearchParams();
|
|
99
|
+
return (
|
|
100
|
+
<Back
|
|
101
|
+
{...backFrom(search.get('from'), { href: '/dash/tasks', params: {}, label: 'Tasks' })}
|
|
102
|
+
back={search.get('back')}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function CopyId({ id }: { id: string }) {
|
|
108
|
+
const [copied, setCopied] = useState(false);
|
|
109
|
+
const label = copied ? 'Copied' : 'Copy task id';
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (!copied) return;
|
|
112
|
+
const timer = setTimeout(() => setCopied(false), 1500);
|
|
113
|
+
return () => clearTimeout(timer);
|
|
114
|
+
}, [copied]);
|
|
115
|
+
return (
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
class={copied ? 'copy copied' : 'copy'}
|
|
119
|
+
aria-label={label}
|
|
120
|
+
title={label}
|
|
121
|
+
onClick={() => void navigator.clipboard.writeText(id).then(() => setCopied(true))}
|
|
122
|
+
>
|
|
123
|
+
<Icon d={copied ? iCheck : iCopy} />
|
|
124
|
+
</button>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** The task's one-row head: back, title, status, source and agent, its actions, and a muted line with id, created time and duration. */
|
|
129
|
+
function TaskHead({ task, tz }: { task: TaskRow; tz: string }) {
|
|
130
|
+
const live = taskActive(task);
|
|
131
|
+
const source = task.task.event?.integration ?? task.task.source;
|
|
132
|
+
const kind = task.task.event?.type ?? (task.task.flow !== 'default' ? task.task.flow : undefined);
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<PageHead
|
|
136
|
+
back={<TaskBack />}
|
|
137
|
+
title={taskTitle(task).split('\n')[0]}
|
|
138
|
+
meta={
|
|
139
|
+
<>
|
|
140
|
+
<Status status={task.status} />
|
|
141
|
+
{task.archivedAt ? <Badge>archived</Badge> : null}
|
|
142
|
+
</>
|
|
143
|
+
}
|
|
144
|
+
lead={
|
|
145
|
+
<>
|
|
146
|
+
<span class="task-id">{task.task.id}</span>
|
|
147
|
+
<CopyId id={task.task.id} />
|
|
148
|
+
<span>{formatDate(task.createdAt, tz)}</span>
|
|
149
|
+
{task.startedAt && task.finishedAt ? (
|
|
150
|
+
<span>{formatDuration(task.finishedAt - task.startedAt)}</span>
|
|
151
|
+
) : null}
|
|
152
|
+
<span>{kind ? `${sourceLabel(source)} ${kind}` : sourceLabel(source)}</span>
|
|
153
|
+
{task.task.cwd ? <span title={task.task.cwd}>{folderName(task.task.cwd)}</span> : null}
|
|
154
|
+
<Link
|
|
155
|
+
class="agent-link"
|
|
156
|
+
href="/dash/agents/[slug]"
|
|
157
|
+
params={{ slug: task.task.agent }}
|
|
158
|
+
search={{ from: `/dash/tasks/${task.task.id}` }}
|
|
159
|
+
>
|
|
160
|
+
<Icon d={iAgent} />
|
|
161
|
+
{task.task.agent}
|
|
162
|
+
</Link>
|
|
163
|
+
</>
|
|
164
|
+
}
|
|
165
|
+
actions={<TaskActions task={task} live={live} />}
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Display rows for the lines so far; new lines only extend them. */
|
|
171
|
+
function useDisplayRows(lines: TaskLog[]) {
|
|
172
|
+
const view = useRef<{ log: LogView; rows: TaskDisplayRow[]; seen: number }>();
|
|
173
|
+
return useMemo(() => {
|
|
174
|
+
const state = (view.current ??= { log: new LogView(), rows: [], seen: 0 });
|
|
175
|
+
for (const line of lines.slice(state.seen)) state.rows.push(...state.log.reduce(line));
|
|
176
|
+
state.seen = lines.length;
|
|
177
|
+
return [...state.rows];
|
|
178
|
+
}, [lines]);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** A task as a conversation with its activity; the box at the bottom steers, asks, or continues. */
|
|
182
|
+
export function TaskView({ initial, tz }: { initial: TaskRow; tz: string }) {
|
|
183
|
+
const [task, setTask] = useState(initial);
|
|
184
|
+
const [lines, setLines] = useState(initial.logs ?? []);
|
|
185
|
+
const [complete, setComplete] = useState((initial.logs?.length ?? 0) < LOG_CHUNK);
|
|
186
|
+
const [tab, setTab] = useState<Tab>('conversation');
|
|
187
|
+
const [sent, setSent] = useState<Array<{ kind: string; text: string; turn: number }>>([]);
|
|
188
|
+
const [sending, setSending] = useState(false);
|
|
189
|
+
const [asking, setAsking] = useState(0);
|
|
190
|
+
// Answers already there at open have no known question; later ones pair with this session's asks in order.
|
|
191
|
+
const knownAnswers = useRef(task.answer?.length ?? 0);
|
|
192
|
+
const [ask, setAsk] = useState(false);
|
|
193
|
+
const [status, setStatus] = useState('');
|
|
194
|
+
const after = useRef(initial.logs?.at(-1)?.seq ?? -1);
|
|
195
|
+
const input = useRef<HTMLTextAreaElement>(null);
|
|
196
|
+
const reply = useRef<HTMLFormElement>(null);
|
|
197
|
+
// The jump button floats above the reply box, however tall it grows.
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
const form = reply.current;
|
|
200
|
+
const page = form?.closest<HTMLElement>('.page');
|
|
201
|
+
if (!form || !page) return;
|
|
202
|
+
const observer = new ResizeObserver(() =>
|
|
203
|
+
page.style.setProperty('--reply', `${form.offsetHeight}px`),
|
|
204
|
+
);
|
|
205
|
+
observer.observe(form);
|
|
206
|
+
return () => observer.disconnect();
|
|
207
|
+
}, [task.task.flow]);
|
|
208
|
+
const action = useAction(task.task.id);
|
|
209
|
+
const live = taskActive(task);
|
|
210
|
+
const replies = task.task.flow === 'default';
|
|
211
|
+
const rows = useDisplayRows(lines);
|
|
212
|
+
useEffect(() => watchTask(task.task.id, task.status, taskTitle(task)), [task.status]);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
if (action.error) toastError('Not sent', action.error);
|
|
215
|
+
}, [action.error]);
|
|
216
|
+
|
|
217
|
+
const append = (more: TaskLog[]) => {
|
|
218
|
+
const fresh = more.filter(line => line.seq > after.current);
|
|
219
|
+
if (!fresh.length) return;
|
|
220
|
+
after.current = fresh.at(-1)!.seq;
|
|
221
|
+
setLines(value => [...value, ...fresh]);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
if (live && replies) input.current?.focus();
|
|
226
|
+
}, []);
|
|
227
|
+
|
|
228
|
+
// Older lines a chunk at a time, then the stream follows the run.
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
if (complete) return;
|
|
231
|
+
void client.tasks
|
|
232
|
+
.logs(task.task.id, after.current, LOG_CHUNK)
|
|
233
|
+
.then(more => {
|
|
234
|
+
append(more);
|
|
235
|
+
if (more.length < LOG_CHUNK) setComplete(true);
|
|
236
|
+
})
|
|
237
|
+
.catch(reason => setStatus(reasonText(reason)));
|
|
238
|
+
}, [complete, lines.length]);
|
|
239
|
+
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (!complete || !live) return;
|
|
242
|
+
const abort = new AbortController();
|
|
243
|
+
const follow = async () => {
|
|
244
|
+
while (!abort.signal.aborted) {
|
|
245
|
+
try {
|
|
246
|
+
const response = await client.tasks.stream(task.task.id, after.current, abort.signal);
|
|
247
|
+
if (!response.ok || !response.body) {
|
|
248
|
+
setStatus('Live updates stopped.');
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
setStatus('');
|
|
252
|
+
for await (const event of serverEvents(response.body)) {
|
|
253
|
+
if (event.event === 'log') append([JSON.parse(event.data)]);
|
|
254
|
+
else if (event.event === 'status')
|
|
255
|
+
setTask(current => ({ ...current, ...JSON.parse(event.data) }));
|
|
256
|
+
else if (event.event === 'end') return;
|
|
257
|
+
}
|
|
258
|
+
} catch {
|
|
259
|
+
if (abort.signal.aborted) return;
|
|
260
|
+
}
|
|
261
|
+
setStatus('Reconnecting.');
|
|
262
|
+
await new Promise(done => setTimeout(done, 1000));
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
void follow();
|
|
266
|
+
return () => abort.abort();
|
|
267
|
+
}, [complete, live]);
|
|
268
|
+
|
|
269
|
+
const turns = task.turns ?? [
|
|
270
|
+
{
|
|
271
|
+
prompt: task.task.prompt ?? task.task.event?.text ?? taskTitle(task),
|
|
272
|
+
result: task.result,
|
|
273
|
+
error: task.error,
|
|
274
|
+
finishedAt: task.finishedAt,
|
|
275
|
+
},
|
|
276
|
+
];
|
|
277
|
+
|
|
278
|
+
const send = async () => {
|
|
279
|
+
const text = input.current?.value.trim();
|
|
280
|
+
if (!text || sending) return;
|
|
281
|
+
const kind = live ? (ask ? 'ask' : 'steer') : 'continue';
|
|
282
|
+
if (kind === 'ask') {
|
|
283
|
+
// A question never blocks the box: it shows at once and its answer lands under it.
|
|
284
|
+
input.current!.value = '';
|
|
285
|
+
setSent(value => [...value, { kind, text, turn: turns.length - 1 }]);
|
|
286
|
+
setAsking(count => count + 1);
|
|
287
|
+
void action.run(kind, { question: text }).then(ok => {
|
|
288
|
+
setAsking(count => count - 1);
|
|
289
|
+
if (ok) return setTab('conversation');
|
|
290
|
+
setSent(value => value.filter(message => message.text !== text || message.kind !== kind));
|
|
291
|
+
});
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
setSending(true);
|
|
295
|
+
const ok = await action.run(kind, { text }).finally(() => setSending(false));
|
|
296
|
+
if (!ok) return;
|
|
297
|
+
input.current!.value = '';
|
|
298
|
+
if (kind === 'continue')
|
|
299
|
+
setTask(current => ({
|
|
300
|
+
...current,
|
|
301
|
+
status: 'queued',
|
|
302
|
+
result: undefined,
|
|
303
|
+
error: undefined,
|
|
304
|
+
finishedAt: undefined,
|
|
305
|
+
turns: [
|
|
306
|
+
...turns.map((turn, index) =>
|
|
307
|
+
index === turns.length - 1
|
|
308
|
+
? { ...turn, finishedAt: turn.finishedAt ?? Date.now() }
|
|
309
|
+
: turn,
|
|
310
|
+
),
|
|
311
|
+
{ prompt: text },
|
|
312
|
+
],
|
|
313
|
+
}));
|
|
314
|
+
else {
|
|
315
|
+
setSent(value => [...value, { kind, text, turn: turns.length - 1 }]);
|
|
316
|
+
setTab('activity');
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// The menu hands focus back to its button as it closes, so the box takes it after.
|
|
321
|
+
const pickMode = (next: boolean) => {
|
|
322
|
+
setAsk(next);
|
|
323
|
+
setTimeout(() => input.current?.focus());
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const result = task.result;
|
|
327
|
+
return (
|
|
328
|
+
<>
|
|
329
|
+
<TaskHead task={task} tz={tz} />
|
|
330
|
+
{task.fallbacks?.map((fallback, index) => (
|
|
331
|
+
<p key={index} class="flash" role="status">
|
|
332
|
+
{fallback.engine} was unavailable. {fallback.detail} This task is using {fallback.next}.
|
|
333
|
+
</p>
|
|
334
|
+
))}
|
|
335
|
+
<nav class="tabs" role="tablist" aria-label="Task">
|
|
336
|
+
{TABS.map(label => {
|
|
337
|
+
const key = label.toLowerCase() as Tab;
|
|
338
|
+
return (
|
|
339
|
+
<button
|
|
340
|
+
key={key}
|
|
341
|
+
type="button"
|
|
342
|
+
role="tab"
|
|
343
|
+
aria-selected={tab === key}
|
|
344
|
+
aria-current={tab === key ? 'page' : undefined}
|
|
345
|
+
onClick={() => setTab(key)}
|
|
346
|
+
>
|
|
347
|
+
{label}
|
|
348
|
+
</button>
|
|
349
|
+
);
|
|
350
|
+
})}
|
|
351
|
+
</nav>
|
|
352
|
+
{status ? (
|
|
353
|
+
<p class="flash err" role="status">
|
|
354
|
+
{status}
|
|
355
|
+
</p>
|
|
356
|
+
) : null}
|
|
357
|
+
{tab === 'activity' ? (
|
|
358
|
+
<Activity rows={rows} live={live} tz={tz} />
|
|
359
|
+
) : (
|
|
360
|
+
<div class="convo">
|
|
361
|
+
{turns.map((turn, index) => {
|
|
362
|
+
const last = index === turns.length - 1;
|
|
363
|
+
return (
|
|
364
|
+
<Fragment key={index}>
|
|
365
|
+
<div class="turn prompt">
|
|
366
|
+
<p class="who">Prompt</p>
|
|
367
|
+
<Collapse class="prose">{turn.prompt}</Collapse>
|
|
368
|
+
</div>
|
|
369
|
+
{last && task.approval ? <Approval task={task} /> : null}
|
|
370
|
+
{last
|
|
371
|
+
? (task.answer ?? []).slice(0, knownAnswers.current).map((answer, index) => (
|
|
372
|
+
<div key={`a${index}`} class="turn answer">
|
|
373
|
+
<p class="who">Answer</p>
|
|
374
|
+
<div class="prose">{messageOf(answer, 'Answer received.')}</div>
|
|
375
|
+
</div>
|
|
376
|
+
))
|
|
377
|
+
: null}
|
|
378
|
+
{sent
|
|
379
|
+
.filter(message => message.turn === index)
|
|
380
|
+
.map((message, index) => {
|
|
381
|
+
const asked =
|
|
382
|
+
message.kind === 'ask'
|
|
383
|
+
? sent.filter(each => each.kind === 'ask').indexOf(message)
|
|
384
|
+
: -1;
|
|
385
|
+
const answer =
|
|
386
|
+
asked < 0 ? undefined : task.answer?.[knownAnswers.current + asked];
|
|
387
|
+
return (
|
|
388
|
+
<div key={index} class={asked < 0 ? 'turn you' : 'turn you qa'}>
|
|
389
|
+
<p class="who">{message.kind === 'ask' ? 'You asked' : 'You steered'}</p>
|
|
390
|
+
<div class="prose">{message.text}</div>
|
|
391
|
+
{asked < 0 ? null : (
|
|
392
|
+
<div class="answer">
|
|
393
|
+
<p class="who">Answer</p>
|
|
394
|
+
{answer === undefined ? (
|
|
395
|
+
<Loading
|
|
396
|
+
inline
|
|
397
|
+
dots
|
|
398
|
+
label="Answering without interrupting the run."
|
|
399
|
+
/>
|
|
400
|
+
) : (
|
|
401
|
+
<div class="prose">{messageOf(answer, 'Answer received.')}</div>
|
|
402
|
+
)}
|
|
403
|
+
</div>
|
|
404
|
+
)}
|
|
405
|
+
</div>
|
|
406
|
+
);
|
|
407
|
+
})}
|
|
408
|
+
{turn.result ? (
|
|
409
|
+
<Card title="Result">
|
|
410
|
+
<ResultBody value={turn.result} />
|
|
411
|
+
</Card>
|
|
412
|
+
) : last && live ? (
|
|
413
|
+
<Card title="Result">
|
|
414
|
+
<div class="body waiting">
|
|
415
|
+
<Loading
|
|
416
|
+
inline
|
|
417
|
+
dots
|
|
418
|
+
label="The result appears here when the task finishes."
|
|
419
|
+
/>
|
|
420
|
+
</div>
|
|
421
|
+
</Card>
|
|
422
|
+
) : null}
|
|
423
|
+
{turn.error ? (
|
|
424
|
+
<Card tone="danger" title="Error">
|
|
425
|
+
<div class="body prose">{turn.error}</div>
|
|
426
|
+
</Card>
|
|
427
|
+
) : null}
|
|
428
|
+
</Fragment>
|
|
429
|
+
);
|
|
430
|
+
})}
|
|
431
|
+
</div>
|
|
432
|
+
)}
|
|
433
|
+
{replies ? (
|
|
434
|
+
<form
|
|
435
|
+
ref={reply}
|
|
436
|
+
class="reply"
|
|
437
|
+
onSubmit={event => {
|
|
438
|
+
event.preventDefault();
|
|
439
|
+
void send();
|
|
440
|
+
}}
|
|
441
|
+
>
|
|
442
|
+
<div class="reply-box">
|
|
443
|
+
{live ? (
|
|
444
|
+
<Menu
|
|
445
|
+
summary={
|
|
446
|
+
<>
|
|
447
|
+
{ask ? 'Ask' : 'Steer'}
|
|
448
|
+
<Icon d={iDown} />
|
|
449
|
+
</>
|
|
450
|
+
}
|
|
451
|
+
summaryClass="mode"
|
|
452
|
+
label="Send as"
|
|
453
|
+
align="up"
|
|
454
|
+
wide
|
|
455
|
+
>
|
|
456
|
+
<button
|
|
457
|
+
type="button"
|
|
458
|
+
class="pop-item rich"
|
|
459
|
+
role="menuitemradio"
|
|
460
|
+
aria-checked={!ask}
|
|
461
|
+
onClick={() => pickMode(false)}
|
|
462
|
+
>
|
|
463
|
+
<span class="grow">
|
|
464
|
+
Steer<small>Change course while it works.</small>
|
|
465
|
+
</span>
|
|
466
|
+
<Icon d={iCheck} />
|
|
467
|
+
</button>
|
|
468
|
+
<button
|
|
469
|
+
type="button"
|
|
470
|
+
class="pop-item rich"
|
|
471
|
+
role="menuitemradio"
|
|
472
|
+
aria-checked={ask}
|
|
473
|
+
onClick={() => pickMode(true)}
|
|
474
|
+
>
|
|
475
|
+
<span class="grow">
|
|
476
|
+
Ask<small>A question that does not interrupt it.</small>
|
|
477
|
+
</span>
|
|
478
|
+
<Icon d={iCheck} />
|
|
479
|
+
</button>
|
|
480
|
+
</Menu>
|
|
481
|
+
) : null}
|
|
482
|
+
<textarea
|
|
483
|
+
ref={input}
|
|
484
|
+
rows={1}
|
|
485
|
+
aria-label="Message"
|
|
486
|
+
autofocus={live}
|
|
487
|
+
placeholder={
|
|
488
|
+
live
|
|
489
|
+
? ask
|
|
490
|
+
? 'Ask about the run without interrupting it.'
|
|
491
|
+
: 'Steer the agent while it works.'
|
|
492
|
+
: 'Continue the conversation.'
|
|
493
|
+
}
|
|
494
|
+
onKeyDown={event => {
|
|
495
|
+
if (event.key !== 'Enter' || event.shiftKey || event.isComposing) return;
|
|
496
|
+
event.preventDefault();
|
|
497
|
+
void send();
|
|
498
|
+
}}
|
|
499
|
+
/>
|
|
500
|
+
<button class="btn sm" disabled={sending} aria-busy={sending || asking > 0}>
|
|
501
|
+
Send
|
|
502
|
+
</button>
|
|
503
|
+
</div>
|
|
504
|
+
</form>
|
|
505
|
+
) : (
|
|
506
|
+
<p class="muted no-reply">This flow takes no follow-ups.</p>
|
|
507
|
+
)}
|
|
508
|
+
</>
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** Lines per request when a task's log loads or follows. */
|
|
513
|
+
export const LOG_CHUNK = 500;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ServerClient } from '@coder/client';
|
|
2
|
+
import type { AgentRow, RunnerRow } from '@coder/client/types';
|
|
3
|
+
|
|
4
|
+
import { localServer } from '@/api/types';
|
|
5
|
+
import { NO_MODELS, modelsByEngine } from '@/app/dash/settings/model-options';
|
|
6
|
+
import type { Choice, Defaults, Lists } from './composer';
|
|
7
|
+
|
|
8
|
+
export const PLACEHOLDER = 'What should the agent do? Type / for flows and reviews.';
|
|
9
|
+
|
|
10
|
+
export const CHOICE: Choice = {
|
|
11
|
+
repo: '',
|
|
12
|
+
cwd: '',
|
|
13
|
+
agent: 'coder',
|
|
14
|
+
engine: '',
|
|
15
|
+
model: '',
|
|
16
|
+
effort: '',
|
|
17
|
+
permissions: '',
|
|
18
|
+
runner: '',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** The composer's last choice, from its cookie. */
|
|
22
|
+
export function savedChoice(cookie: string): Partial<Choice> {
|
|
23
|
+
const raw = cookie.match(/(?:^|; )compose=([^;]*)/)?.[1];
|
|
24
|
+
try {
|
|
25
|
+
return raw ? JSON.parse(decodeURIComponent(raw)) : {};
|
|
26
|
+
} catch {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Defaults first, then by name. */
|
|
32
|
+
export const sortedRunners = (rows: RunnerRow[]) =>
|
|
33
|
+
[...rows].sort((a, b) => Number(b.default) - Number(a.default) || a.name.localeCompare(b.name));
|
|
34
|
+
|
|
35
|
+
/** Runners as [id, name]; unset is the requester's default, named. */
|
|
36
|
+
export const runnerOptions = (rows: RunnerRow[]): [string, string][] => {
|
|
37
|
+
const own = rows.find(row => row.default);
|
|
38
|
+
return [
|
|
39
|
+
['', own ? `Default · ${own.name}` : 'Default'],
|
|
40
|
+
...sortedRunners(rows)
|
|
41
|
+
.filter(row => row !== own)
|
|
42
|
+
.map((row): [string, string] => [row.id, row.name]),
|
|
43
|
+
];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** Every agent as [id, name]; a failed read leaves the list empty. */
|
|
47
|
+
export const agentChoices = (api: ServerClient): Promise<[string, string][]> =>
|
|
48
|
+
api.agents.list().then(
|
|
49
|
+
(rows: AgentRow[] | { items: AgentRow[] }) =>
|
|
50
|
+
(Array.isArray(rows) ? rows : rows.items).map((agent): [string, string] => [
|
|
51
|
+
agent.id,
|
|
52
|
+
agent.name,
|
|
53
|
+
]),
|
|
54
|
+
() => [],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
/** No credential can run a task yet; a local server runs on the machine's own sign-ins. */
|
|
58
|
+
export const credentialMissing = (api: ServerClient) =>
|
|
59
|
+
Promise.all([
|
|
60
|
+
api.credentials.list().catch(() => undefined),
|
|
61
|
+
api.me().catch(() => undefined),
|
|
62
|
+
]).then(([credentials, me]) => credentials?.length === 0 && !(me && localServer(me)));
|
|
63
|
+
|
|
64
|
+
/** What the composer offers and falls back to, read in one go. */
|
|
65
|
+
export async function loadComposer(api: ServerClient, agents = agentChoices(api)) {
|
|
66
|
+
const [config, catalog, ids, repos, models, runners, flows, folders] = await Promise.all([
|
|
67
|
+
api.config.get().catch(() => undefined),
|
|
68
|
+
api.integrations.list().catch(() => []),
|
|
69
|
+
agents,
|
|
70
|
+
api.repositories.list().catch(() => []),
|
|
71
|
+
api.models.list().catch(() => NO_MODELS),
|
|
72
|
+
api.runners.list().then(
|
|
73
|
+
rows => rows.items,
|
|
74
|
+
() => [],
|
|
75
|
+
),
|
|
76
|
+
api.flows.list().catch(() => []),
|
|
77
|
+
api.folders.list().catch(() => undefined),
|
|
78
|
+
]);
|
|
79
|
+
const data: Lists = {
|
|
80
|
+
agents: ids,
|
|
81
|
+
repos: repos.map(entry => entry.repo),
|
|
82
|
+
models: modelsByEngine(models),
|
|
83
|
+
runners: runnerOptions(runners),
|
|
84
|
+
flows: flows.map(flow => flow.name),
|
|
85
|
+
folders,
|
|
86
|
+
};
|
|
87
|
+
const defaults: Defaults = {
|
|
88
|
+
engine: config?.effective.chain?.[0] ?? 'claude',
|
|
89
|
+
engines: config?.effective.engines ?? {},
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
data,
|
|
93
|
+
defaults,
|
|
94
|
+
connectLabel: catalog.find(entry => entry.repositories)?.installLabel ?? 'Connect repositories',
|
|
95
|
+
};
|
|
96
|
+
}
|