@open-mercato/cezar 0.13.0 → 0.14.0
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 +3 -2
- package/dist/agent-config/catalog.d.ts +4 -0
- package/dist/agent-config/catalog.js +85 -3
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/copilot.d.ts +15 -0
- package/dist/agent-config/model-settings/copilot.js +25 -0
- package/dist/agent-config/model-settings/copilot.js.map +1 -0
- package/dist/agent-config/model-settings/junie.d.ts +12 -0
- package/dist/agent-config/model-settings/junie.js +18 -0
- package/dist/agent-config/model-settings/junie.js.map +1 -0
- package/dist/agent-config/models.js +4 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/automations/prompts.d.ts +2 -2
- package/dist/automations/prompts.js +1 -1
- package/dist/automations/types.d.ts +12 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +4 -0
- package/dist/contract/agent-profiles.d.ts +30 -0
- package/dist/contract/automations.d.ts +32 -0
- package/dist/contract/dashboard-insights.d.ts +186 -0
- package/dist/contract/dashboard.d.ts +88 -0
- package/dist/contract/dispatch.d.ts +6 -0
- package/dist/contract/health.d.ts +8 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +249 -72
- package/dist/contract/runs.d.ts +144 -0
- package/dist/contract/self-update.d.ts +111 -2
- package/dist/contract/skills.d.ts +19 -0
- package/dist/contract/star-count.d.ts +18 -0
- package/dist/contract/workflows.d.ts +12 -0
- package/dist/contract/workspace.d.ts +42 -2
- package/dist/core/acp-client.d.ts +99 -0
- package/dist/core/acp-client.js +198 -0
- package/dist/core/acp-client.js.map +1 -0
- package/dist/core/acp-ui-mapper.d.ts +95 -0
- package/dist/core/acp-ui-mapper.js +444 -0
- package/dist/core/acp-ui-mapper.js.map +1 -0
- package/dist/core/agent-env.js +10 -0
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +10 -0
- package/dist/core/agent-profiles.js +16 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +5 -3
- package/dist/core/agent-runner.js +5 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -3
- package/dist/core/backend-detect.js +61 -2
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +5 -2
- package/dist/core/claude-cli-runner.js +11 -6
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-ui-mapper.d.ts +14 -0
- package/dist/core/claude-ui-mapper.js +102 -11
- package/dist/core/claude-ui-mapper.js.map +1 -1
- package/dist/core/codex-app-server-transport.js +8 -4
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +60 -0
- package/dist/core/copilot-acp-runner.js +528 -0
- package/dist/core/copilot-acp-runner.js.map +1 -0
- package/dist/core/copilot-ui-mapper.d.ts +47 -0
- package/dist/core/copilot-ui-mapper.js +111 -0
- package/dist/core/copilot-ui-mapper.js.map +1 -0
- package/dist/core/cursor-agent-runner.js +4 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +9 -0
- package/dist/core/disclaim-spawn.js +53 -0
- package/dist/core/disclaim-spawn.js.map +1 -0
- package/dist/core/junie-acp-transport.d.ts +58 -0
- package/dist/core/junie-acp-transport.js +179 -0
- package/dist/core/junie-acp-transport.js.map +1 -0
- package/dist/core/junie-auth-probe.d.ts +12 -0
- package/dist/core/junie-auth-probe.js +30 -0
- package/dist/core/junie-auth-probe.js.map +1 -0
- package/dist/core/junie-model-catalog.d.ts +10 -0
- package/dist/core/junie-model-catalog.js +104 -0
- package/dist/core/junie-model-catalog.js.map +1 -0
- package/dist/core/junie-runner.d.ts +45 -0
- package/dist/core/junie-runner.js +533 -0
- package/dist/core/junie-runner.js.map +1 -0
- package/dist/core/junie-ui-mapper.d.ts +132 -0
- package/dist/core/junie-ui-mapper.js +459 -0
- package/dist/core/junie-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.js +17 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +10 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-server-runner.js +4 -4
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +4 -4
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +16 -2
- package/dist/core/provider-auth.js +113 -7
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.js +6 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.js +12 -8
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/tool-display.js +6 -1
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +6 -2
- package/dist/git-diff-base.js +23 -2
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +21 -2
- package/dist/git-worktree.js +68 -5
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/paths.js +2 -0
- package/dist/paths.js.map +1 -1
- package/dist/runs/event-history.js +3 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/store.d.ts +42 -3
- package/dist/runs/store.js +112 -6
- package/dist/runs/store.js.map +1 -1
- package/dist/self-update/checkouts.d.ts +53 -0
- package/dist/self-update/checkouts.js +268 -0
- package/dist/self-update/checkouts.js.map +1 -0
- package/dist/self-update/cli.d.ts +5 -3
- package/dist/self-update/cli.js +75 -8
- package/dist/self-update/cli.js.map +1 -1
- package/dist/self-update/layout.d.ts +33 -1
- package/dist/self-update/layout.js +102 -3
- package/dist/self-update/layout.js.map +1 -1
- package/dist/self-update/pulls.d.ts +40 -0
- package/dist/self-update/pulls.js +127 -0
- package/dist/self-update/pulls.js.map +1 -0
- package/dist/self-update/service.d.ts +26 -3
- package/dist/self-update/service.js +85 -9
- package/dist/self-update/service.js.map +1 -1
- package/dist/server/dashboard.d.ts +107 -0
- package/dist/server/dashboard.js +2 -1
- package/dist/server/dashboard.js.map +1 -1
- package/dist/server/forge/github.js +4 -1
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/fs-browse.d.ts +3 -1
- package/dist/server/fs-browse.js +27 -5
- package/dist/server/fs-browse.js.map +1 -1
- package/dist/server/open-in-app.js +2 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/provider-action-gate.js +5 -1
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +880 -511
- package/dist/server/server.js +40 -5
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +67 -0
- package/dist/server/star-count.js +186 -0
- package/dist/server/star-count.js.map +1 -0
- package/dist/skills-banner.d.ts +19 -0
- package/dist/skills-banner.js +24 -0
- package/dist/skills-banner.js.map +1 -1
- package/dist/workflows/run.d.ts +0 -2
- package/dist/workflows/run.js +45 -29
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +6 -0
- package/dist/workspace/agent-accounts.d.ts +9 -1
- package/dist/workspace/agent-accounts.js +2 -0
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.d.ts +2 -2
- package/dist/workspace/agent-profiles.js +25 -6
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +9 -1
- package/dist/workspace/config.js +10 -3
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/dashboard-insights.d.ts +42 -0
- package/dist/workspace/dashboard-insights.js +220 -0
- package/dist/workspace/dashboard-insights.js.map +1 -0
- package/dist/workspace/dashboard.d.ts +71 -1
- package/dist/workspace/dashboard.js +14 -1
- package/dist/workspace/dashboard.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +3 -0
- package/dist/workspace/semaphore.js +8 -1
- package/dist/workspace/semaphore.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +34 -1
- package/scripts/mock-copilot-acp.mjs +190 -0
- package/scripts/mock-junie-acp.mjs +208 -0
- package/web/dist/assets/agent-task-pickers-BeQi-UTm.js +1 -0
- package/web/dist/assets/alert-dialog-CnRAuqwb.js +1 -0
- package/web/dist/assets/arrow-down-Da0kNRNH.js +1 -0
- package/web/dist/assets/arrow-left-BIZHhBIP.js +1 -0
- package/web/dist/assets/automation-format-CfPmkcsg.js +1 -0
- package/web/dist/assets/automations-route-AMJbFP53.js +1 -0
- package/web/dist/assets/centered-state-3r2Kaar_.js +1 -0
- package/web/dist/assets/chevron-left-DLAUPC66.js +1 -0
- package/web/dist/assets/chevron-right-KVZcXiPL.js +1 -0
- package/web/dist/assets/{circle-x-C9UoMP1V.js → circle-x-C0Jm5Ppb.js} +1 -1
- package/web/dist/assets/collapsible-DG_SIWqU.js +1 -0
- package/web/dist/assets/command-Dfln3D4A.js +1 -0
- package/web/dist/assets/{commit-list-BSfPsVsu.js → commit-list-_RA72yB_.js} +1 -1
- package/web/dist/assets/compare-variants-D6Ji6od4.js +1 -0
- package/web/dist/assets/dashboard-B3-tPimG.js +44 -0
- package/web/dist/assets/dialog-CiDREdUK.js +1 -0
- package/web/dist/assets/{diff-I0xowULh.js → diff-CxdyRumG.js} +2 -2
- package/web/dist/assets/diff-controls-DqJMMV4z.js +1 -0
- package/web/dist/assets/{diff-stat-yKn7joEr.js → diff-stat-Hupj4hxh.js} +1 -1
- package/web/dist/assets/{diff-view-DjvMeW1M.js → diff-view-BBYT5k6c.js} +1 -1
- package/web/dist/assets/dist-BqMwqJFX.js +1 -0
- package/web/dist/assets/dist-DpiX6WjA.js +1 -0
- package/web/dist/assets/{download-BcgZ2yk4.js → download-BR7EN9gW.js} +1 -1
- package/web/dist/assets/dropdown-menu-Ci4HFML0.js +1 -0
- package/web/dist/assets/editable-title-DDtUgRKZ.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-g4O4NlLV.js → ellipsis-vertical-DBklom4U.js} +1 -1
- package/web/dist/assets/facet-filter-CfI4QvOd.js +1 -0
- package/web/dist/assets/{file-wXNeZwi7.js → file-CZb7cKNH.js} +1 -1
- package/web/dist/assets/{file-text-DV1gE2L6.js → file-text-Dm6CrEGW.js} +1 -1
- package/web/dist/assets/{folder-wjVId5un.js → folder-zQj-FYOo.js} +1 -1
- package/web/dist/assets/{git-pull-request-BBEDdTLK.js → git-pull-request-AhwzJc7s.js} +1 -1
- package/web/dist/assets/git-toolbar-j7gKkhGL.js +1 -0
- package/web/dist/assets/github-De-DFy8s.js +1 -0
- package/web/dist/assets/{image-preview-u1f-wzxC.js → image-preview-Dd3NVB7N.js} +1 -1
- package/web/dist/assets/index-HS1hr5Sz.js +12 -0
- package/web/dist/assets/index-YwgrLyBj.css +2 -0
- package/web/dist/assets/loader-circle-sk4vKJKp.js +1 -0
- package/web/dist/assets/{markdown-Bnm47qUl.js → markdown-DjNR-1p8.js} +2 -2
- package/web/dist/assets/new-task-form-vLs2G1_z.js +1 -0
- package/web/dist/assets/picker-pill-VW-M1ZiV.js +1 -0
- package/web/dist/assets/{pill-7dm3vWF7.js → pill-CPl6sysj.js} +1 -1
- package/web/dist/assets/popover-CNGONAql.js +1 -0
- package/web/dist/assets/project-router-dCZQu1wQ.js +1 -0
- package/web/dist/assets/{prompt-templates-BMZ5q5H_.js → prompt-templates-jNjVTAws.js} +1 -1
- package/web/dist/assets/{refresh-cw-C69euZ2H.js → refresh-cw-BfkEydKA.js} +1 -1
- package/web/dist/assets/repo-git-BZWZ6_pR.js +1 -0
- package/web/dist/assets/{run-diff-CoNVGn23.js → run-diff-u_roDsAJ.js} +2 -2
- package/web/dist/assets/run-header-Br1yJR0m.js +1 -0
- package/web/dist/assets/{search-x-BNLFOxI6.js → search-x-CT0NTqK1.js} +1 -1
- package/web/dist/assets/segmented-IDD4ucht.js +1 -0
- package/web/dist/assets/skills-Dsi5YdLG.js +1 -0
- package/web/dist/assets/{sparkles-ChorK-gZ.js → sparkles-CvOeAoyJ.js} +1 -1
- package/web/dist/assets/{square-terminal-C7KCPznz.js → square-terminal-eSs8YYZe.js} +1 -1
- package/web/dist/assets/{tab-link-E5O2Cesc.js → tab-link-CPF6ORha.js} +1 -1
- package/web/dist/assets/task-changes-DIT9Y1rh.js +1 -0
- package/web/dist/assets/task-commits-B4VvdiHH.js +1 -0
- package/web/dist/assets/task-files-BMm9C0DW.js +2 -0
- package/web/dist/assets/task-thread-RXabJAt0.js +9 -0
- package/web/dist/assets/{textarea-DLAfWPb0.js → textarea-DtBqPhIs.js} +1 -1
- package/web/dist/assets/thread-loading-Dnxb6Ar-.js +1 -0
- package/web/dist/assets/toaster-CfRVb8vH.js +43 -0
- package/web/dist/assets/token-metrics-DldVlr6m.js +1 -0
- package/web/dist/assets/tooltip-_O50N3pt.js +1 -0
- package/web/dist/assets/tracker-J0fdcH1G.js +4 -0
- package/web/dist/assets/{trash-2-_vwSMdPG.js → trash-2-CUH7GOVh.js} +1 -1
- package/web/dist/assets/{triangle-alert-fBRUkB46.js → triangle-alert-D5K_zyD3.js} +1 -1
- package/web/dist/assets/{upload-B4OIpdyq.js → upload-D7_n-9cl.js} +1 -1
- package/web/dist/assets/{use-now-sqAvRMna.js → use-now-3lElDuTi.js} +1 -1
- package/web/dist/assets/utils-BXvEm7Ve.js +64 -0
- package/web/dist/assets/workflows-D-dx9c_0.js +7 -0
- package/web/dist/assets/x-kLybIvX4.js +1 -0
- package/web/dist/assets/{zoomable-image-X81SApIg.js → zoomable-image-CnyQ9wyw.js} +1 -1
- package/web/dist/index.html +38 -36
- package/web/dist/assets/agent-task-pickers-DQ1qvgrD.js +0 -1
- package/web/dist/assets/alert-dialog-B_2uU4Bg.js +0 -1
- package/web/dist/assets/arrow-down-DieVZxSE.js +0 -1
- package/web/dist/assets/arrow-left-C8M0efjn.js +0 -1
- package/web/dist/assets/automation-format-CzinzpHK.js +0 -1
- package/web/dist/assets/automations-route-DYHUjV9R.js +0 -1
- package/web/dist/assets/centered-state-DJLgwvA4.js +0 -43
- package/web/dist/assets/chevron-left-BhXrOEE3.js +0 -1
- package/web/dist/assets/chevron-right-B3Ta8VKK.js +0 -1
- package/web/dist/assets/collapsible-BcKvItwg.js +0 -1
- package/web/dist/assets/command-BvGGv2_u.js +0 -1
- package/web/dist/assets/compare-variants-DBvMYMs3.js +0 -1
- package/web/dist/assets/dashboard-CGaFh4RV.js +0 -44
- package/web/dist/assets/dialog-B6NgKh0-.js +0 -1
- package/web/dist/assets/diff-controls-DskkZqmD.js +0 -1
- package/web/dist/assets/dist-BvXEdcbG.js +0 -1
- package/web/dist/assets/dist-CTksUkKh.js +0 -1
- package/web/dist/assets/dropdown-menu-B7HeKCfN.js +0 -1
- package/web/dist/assets/editable-title-BHbHmSIK.js +0 -1
- package/web/dist/assets/facet-filter-DZ3wfvN9.js +0 -1
- package/web/dist/assets/git-toolbar-EZuX4Cuz.js +0 -1
- package/web/dist/assets/github-zcLRxv77.js +0 -1
- package/web/dist/assets/index-BrZhA4_u.css +0 -2
- package/web/dist/assets/index-CSNFuBvj.js +0 -12
- package/web/dist/assets/loader-circle-Cwgo6onL.js +0 -1
- package/web/dist/assets/new-task-form-CQODCzBP.js +0 -1
- package/web/dist/assets/picker-pill-DNB9ETjS.js +0 -1
- package/web/dist/assets/popover-BRq6QnwI.js +0 -1
- package/web/dist/assets/project-router-I8Pbsrxy.js +0 -1
- package/web/dist/assets/repo-git-G436Abni.js +0 -1
- package/web/dist/assets/run-header-CxdaA86t.js +0 -1
- package/web/dist/assets/skills-C_kBDesq.js +0 -1
- package/web/dist/assets/task-changes-Bhw4Ysvg.js +0 -1
- package/web/dist/assets/task-commits-DBuGXuGm.js +0 -1
- package/web/dist/assets/task-files-CYDbeffM.js +0 -2
- package/web/dist/assets/task-thread-RuxHMJgN.js +0 -9
- package/web/dist/assets/thread-loading-BAuVAbcA.js +0 -1
- package/web/dist/assets/token-metrics-rVl4kXe_.js +0 -1
- package/web/dist/assets/tooltip-Bdl8mQG8.js +0 -1
- package/web/dist/assets/tracker-DJ8JW59-.js +0 -4
- package/web/dist/assets/utils-DoBmOlX3.js +0 -64
- package/web/dist/assets/workflows-C54D7mlm.js +0 -7
- package/web/dist/assets/x-HXr9KZBr.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./utils-DoBmOlX3.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e,r as t}from"./utils-DoBmOlX3.js";var n=t(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),r=t(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),i=`quick-task`;function a(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var o=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`cursor`,label:`cursor`,desc:`Cursor Agent CLI`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`}],s={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`}]},c={claude:/^claude[-.]/,codex:/^gpt[-.]/},l=[`opencode`,`pi`];function u(e,t){return!e||s[t].some(t=>t.id===e)||c[t]?.test(e)?!1:Object.entries(s).some(([n,r])=>n!==t&&!l.includes(n)&&r.some(t=>t.id!==``&&t.id===e))||Object.entries(c).some(([n,r])=>n!==t&&r.test(e))}function d(t,n,r=[]){let i=s[t]??s.claude,a=e(t)?n?.models??[]:[],o=a.length>0?[f(i)]:[...i],c=new Set(o.map(e=>e.id));for(let e of a)!e.id||c.has(e.id)||(c.add(e.id),o.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let e of r)!e||c.has(e)||u(e,t)||(c.add(e),o.push({id:e,label:e,desc:`Custom or legacy model`}));return o}function f(e){return e.find(e=>e.id===``)??{id:``,label:`auto`,desc:``}}var p={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`};function m(t,n,r=!1){if(!e(t))return;let i=p[t];if(n?.stale)return`Using cached ${i} model list`;if(r||n?.source===`unavailable`)return`Latest ${i} models unavailable`}function h(e){let t=o.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function g(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function _(e,t,n=!1){return!n&&e===t?void 0:e}function v(e,t,n,r){let i=d(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function y(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function b(e,t,n){return e&&y(e,t,n)?e:null}function x(e){let{task:t,source:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,agentProfile:c,variants:l,images:u,worktree:d,autonomous:f,generateFollowups:p,todoId:m,dispatch:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,runner:_(a,s,o),agentProfile:c||void 0,variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,worktree:d===!1&&l<=1?!1:void 0,autonomous:f===!0||void 0,generateFollowups:p!==!1&&void 0,todoId:m||void 0,dispatch:h??void 0}}function S(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}export{d as a,g as c,S as d,i as f,m as i,b as l,n as m,h as n,a as o,r as p,x as r,v as s,o as t,_ as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Tt as r,z as i}from"./centered-state-DJLgwvA4.js";import{r as a,t as o}from"./utils-DoBmOlX3.js";import{s}from"./popover-BRq6QnwI.js";import{a as c,c as l,n as u,o as d,r as f,t as p}from"./dropdown-menu-B7HeKCfN.js";import{t as m}from"./new-task-form-CQODCzBP.js";import{u as h}from"./command-BvGGv2_u.js";var g=a(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function _(){let e=i(),t=r(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),a=t.data?.info?.root;return{accounts:n,repoAccount:a?e.data?.selections?.[a]:void 0}}function v(e,t){return e.filter(e=>e.provider===t).length>1}var y=e(t(),1),b=n(),x=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-55`,S=(0,b.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function C({active:e=!1,skill:t=!1,dashed:n=!1,chevron:r=!1,icon:i,className:a,children:s,type:c=`button`,...l}){return(0,b.jsxs)(`button`,{type:c,"data-slot":`chip`,"data-active":e?`true`:void 0,"data-skill":t?`true`:void 0,className:o(x,e&&`border-foreground font-semibold text-foreground`,t&&`border-violet font-mono font-semibold text-foreground`,n&&`border-dashed`,a),...l,children:[i,s,r?S:null]})}function w({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:s=!1,hint:m,disabledHint:g,status:_,searchPlaceholder:v}){let[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D=(0,y.useRef)(null),O=(0,y.useRef)(null),k=v?i.filter(e=>e.label.toLowerCase().includes(T.trim().toLowerCase())):i;if((0,y.useEffect)(()=>{if(!C||!v)return;let e=window.setTimeout(()=>D.current?.focus());return()=>window.clearTimeout(e)},[C,v]),s)return(0,b.jsx)(`span`,{"data-slot":e,"aria-label":t,title:g??m,className:`${x} cursor-default hover:bg-card hover:text-muted-foreground`,children:n});let A=(0,b.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?g:m,className:x,children:[n,S]});return o?(0,b.jsx)(`span`,{title:g,className:`inline-flex`,children:A}):(0,b.jsxs)(p,{open:C,onOpenChange:e=>{w(e),e||E(``)},children:[(0,b.jsx)(l,{asChild:!0,children:A}),(0,b.jsxs)(u,{ref:O,align:`start`,"data-testid":`${e}-menu`,children:[v?(0,b.jsxs)(`div`,{className:`mb-1 flex h-9 items-center gap-2 border-b border-border px-2`,children:[(0,b.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,b.jsx)(`input`,{ref:D,type:`search`,"aria-label":v,placeholder:v,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=O.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-full min-w-48 bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}):null,(0,b.jsx)(c,{value:r,onValueChange:a,children:k.map(e=>(0,b.jsx)(d,{value:e.value,className:`gap-2.5`,children:(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,b.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),v&&k.length===0?(0,b.jsx)(`p`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No branches found.`}):null,_?(0,b.jsx)(f,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:_}):null]})]})}var T=(e,t)=>t===null?e:`${e}:${t}`;function E({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o}){let s=m.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:T(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:T(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),c=a??o?.[t]??`default`,l=s.some(e=>e.value===T(t,c))?T(t,c):T(t,null);return(0,b.jsx)(w,{slot:`runner-pill`,ariaLabel:`Runner`,label:s.find(e=>e.value===l)?.label??t,value:l,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:s})}export{x as a,g as c,S as i,E as n,v as o,C as r,_ as s,w as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,s as f,u as p,w as m,x as h,y as g}from"./centered-state-DJLgwvA4.js";import{r as _,t as v}from"./utils-DoBmOlX3.js";import{a as y,i as b,n as ee,r as x,t as S}from"./dist-CTksUkKh.js";var C=_(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),w=_(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),T=e(t(),1),E=n(),D=`Popover`,[O,te]=a(D,[y]),k=y(),[A,j]=O(D),M=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!1}=e,c=k(t),l=T.useRef(null),[d,f]=T.useState(!1),[p,m]=i({prop:r,defaultProp:a??!1,onChange:o,caller:D});return(0,E.jsx)(b,{...c,children:(0,E.jsx)(A,{scope:t,contentId:u(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:T.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:d,onCustomAnchorAdd:T.useCallback(()=>f(!0),[]),onCustomAnchorRemove:T.useCallback(()=>f(!1),[]),modal:s,children:n})})};M.displayName=D;var N=`PopoverAnchor`,P=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(N,n),a=k(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return T.useEffect(()=>(o(),()=>s()),[o,s]),(0,E.jsx)(S,{...a,...r,ref:t})});P.displayName=N;var F=`PopoverTrigger`,I=T.forwardRef((e,t)=>{let{__scopePopover:n,...i}=e,a=j(F,n),o=k(n),s=r(t,a.triggerRef),c=(0,E.jsx)(h.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Z(a.open),...i,ref:s,onClick:g(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,E.jsx)(S,{asChild:!0,...o,children:c})});I.displayName=F;var L=`PopoverPortal`,[R,z]=O(L,{forceMount:void 0}),B=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=j(L,t);return(0,E.jsx)(R,{scope:t,forceMount:n,children:(0,E.jsx)(l,{present:n||a.open,children:(0,E.jsx)(p,{asChild:!0,container:i,children:r})})})};B.displayName=L;var V=`PopoverContent`,H=T.forwardRef((e,t)=>{let n=z(V,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=j(V,e.__scopePopover);return(0,E.jsx)(l,{present:r||a.open,children:a.modal?(0,E.jsx)(W,{...i,ref:t}):(0,E.jsx)(G,{...i,ref:t})})});H.displayName=V;var U=m(`PopoverContent.RemoveScroll`),W=T.forwardRef((e,t)=>{let n=j(V,e.__scopePopover),i=T.useRef(null),a=r(t,i),s=T.useRef(!1);return T.useEffect(()=>{let e=i.current;if(e)return f(e)},[]),(0,E.jsx)(o,{as:U,allowPinchZoom:!0,children:(0,E.jsx)(K,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;s.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),G=T.forwardRef((e,t)=>{let n=j(V,e.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return(0,E.jsx)(K,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),K=T.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,...m}=e,h=j(V,n),g=k(n);return d(),(0,E.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,E.jsx)(c,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,E.jsx)(x,{"data-state":Z(h.open),role:`dialog`,id:h.contentId,...g,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),q=`PopoverClose`,J=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(q,n);return(0,E.jsx)(h.button,{type:`button`,...r,ref:t,onClick:g(e.onClick,()=>i.onOpenChange(!1))})});J.displayName=q;var Y=`PopoverArrow`,X=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=k(n);return(0,E.jsx)(ee,{...i,...r,ref:t})});X.displayName=Y;function Z(e){return e?`open`:`closed`}var Q=M,ne=P,re=I,ie=B,ae=H;function $(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function oe(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=$(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t($(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function se(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:$(e)}:{top:0,bottom:0}}function ce(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function le(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(se(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function ue(){let[e,t]=(0,T.useState)({top:0,bottom:0});return(0,T.useEffect)(()=>le(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function de(e){let t=(0,T.useRef)(e);t.current=e,(0,T.useEffect)(()=>{let e=document.documentElement;return oe(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function fe({...e}){return(0,E.jsx)(Q,{"data-slot":`popover`,...e})}function pe({...e}){return(0,E.jsx)(re,{"data-slot":`popover-trigger`,...e})}function me({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=ue();return(0,E.jsx)(ie,{children:(0,E.jsx)(ae,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:ce(a,r),className:v(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function he({...e}){return(0,E.jsx)(ne,{"data-slot":`popover-anchor`,...e})}export{de as a,pe as i,he as n,w as o,me as r,C as s,fe as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ci as r,Ln as i,Si as a,_i as o,gi as s,hi as c,xi as l}from"./centered-state-DJLgwvA4.js";var u=e(t(),1),d=n(),f=/^\/p\/([^/]+)(?=\/|$)/;function p(e){let t=f.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function m(e){let t=f.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function h(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function g(e,t){return e===null?t:typeof t==`string`?h(e,t):t.pathname===void 0?t:{...t,pathname:h(e,t.pathname)}}function _(){let{projectId:e}=i(),{pathname:t}=a();return e??p(t)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(e){let{pathname:t}=a();return(0,u.useMemo)(()=>l(e,m(t)),[e,t])}function b({to:e,...t}){let n=v();return(0,d.jsx)(c,{...t,to:n(e)})}function x({to:e,...t}){let n=v();return(0,d.jsx)(s,{...t,to:n(e)})}function S({to:e,...t}){let n=v();return(0,d.jsx)(o,{...t,to:n(e)})}function C(){let e=r(),t=v();return(0,u.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{g as a,C as c,p as i,y as l,x as n,m as o,S as r,_ as s,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Ai as i,Br as a,Di as o,Dt as s,Et as c,J as l,M as u,Rn as d,Tt as f,a as p,et as m,i as h,k as g,t as _,wi as v}from"./centered-state-DJLgwvA4.js";import{n as y,t as b}from"./utils-DoBmOlX3.js";import{t as x}from"./arrow-left-C8M0efjn.js";import{n as S,r as C,t as w}from"./diff-controls-DskkZqmD.js";import{t as T}from"./git-pull-request-BBEDdTLK.js";import{t as E}from"./search-x-BNLFOxI6.js";import{t as D}from"./triangle-alert-fBRUkB46.js";import{t as O}from"./project-router-I8Pbsrxy.js";import{t as k}from"./diff-stat-yKn7joEr.js";import{Q as A,V as j,X as M,Y as N,o as P,q as F}from"./index-CSNFuBvj.js";import{t as I}from"./diff-I0xowULh.js";import{t as L}from"./tab-link-E5O2Cesc.js";import{i as R,r as z,t as B}from"./git-toolbar-EZuX4Cuz.js";import{t as V}from"./commit-list-BSfPsVsu.js";var H=e(t(),1),U=n();function W({repo:e,info:t}){let n=m(),s=i(),c=e=>h(e.message,{tone:`danger`}),l=o({mutationFn:e=>r({name:e}),onSuccess:async e=>{h(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([s.invalidateQueries({queryKey:u.repo}),s.invalidateQueries({queryKey:u.health})]),s.setQueryData(u.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),s.setQueryData(u.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:c}),d=o({mutationFn:e=>a({baseBranch:e}),onSuccess:e=>{h(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),s.invalidateQueries({queryKey:u.repo})},onError:c}),[f,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(``),x=v.trim().toLowerCase(),S=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,U.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,U.jsx)(j,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:v,onChange:e=>y(e.target.value),className:`mt-2 max-w-xl`}),(0,U.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[S.map(e=>{let n=e===t.branch;return(0,U.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,U.jsx)(N,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-xs`,n&&`font-semibold`),children:e}),n?(0,U.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,U.jsx)(g,{"aria-hidden":`true`,className:`size-3`}),`current`]}):(0,U.jsx)(p,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:l.isPending,onClick:()=>l.mutate(e),children:`Switch`})]},e)}),S.length===0?(0,U.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,v.trim(),`”.`]}):null]}),(0,U.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&l.mutate(t,{onSuccess:()=>_(``)})},children:[(0,U.jsx)(j,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:f,onChange:e=>_(e.target.value)}),(0,U.jsxs)(p,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!f.trim()||l.isPending,children:[(0,U.jsx)(F,{"aria-hidden":`true`}),`Create`]})]})]}),(0,U.jsxs)(`div`,{className:`max-w-md`,children:[(0,U.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,U.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:d.isPending,onChange:e=>d.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,U.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,U.jsx)(G,{}):null]})}function G(){let e=l({limit:20});return(0,U.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,U.jsx)(K,{pr:e},e.number))}):(0,U.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function K({pr:e}){let t=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(T,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,U.jsx)(q,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,U.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:y(e.url)?(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:b(n,`hover:bg-muted`),children:t}):(0,U.jsx)(`span`,{className:n,children:t})})}function q({checks:e}){return(0,U.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:b(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function J(){let e=c(),t=A(),[n,r]=(0,H.useState)(`unified`),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),l=(0,H.useRef)(null),u=e.isError&&e.error instanceof d&&e.error.status===409,f=e.data?.files??[],p=(0,H.useMemo)(()=>z(f),[f]),m=t?n:`unified`,h=!t||i;return(0,U.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,U.jsx)(B,{stat:e.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(S,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,U.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,U.jsx)(_,{icon:u?(0,U.jsx)(M,{}):(0,U.jsx)(D,{}),tone:u?`neutral`:`danger`,heading:`h2`,title:u?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,U.jsx)(_,{icon:(0,U.jsx)(M,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:[(0,U.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`sticky top-28 hidden max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] w-60 shrink-0 overflow-y-auto overscroll-contain md:block lg:w-72`,children:(0,U.jsx)(R,{root:p,selected:o,onSelect:e=>{s(e),l.current?.scrollToPath(e)}})}),(0,U.jsx)(I,{files:f,viewRef:l,mode:m,wrap:h,className:`min-w-0 flex-1`})]})]})}function Y({log:e}){let{sha:t}=v();return t?(0,U.jsx)(X,{sha:t}):e.length===0?(0,U.jsx)(_,{icon:(0,U.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,U.jsx)(V,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})}function X({sha:e}){let t=s(e),n=A(),[r,i]=(0,H.useState)(`unified`),[a,o]=(0,H.useState)(!1),c=t.isError&&t.error instanceof d&&t.error.status===409,l=n?r:`unified`,u=!n||a;return(0,U.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(p,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,U.jsxs)(O,{to:`/git/commits`,children:[(0,U.jsx)(x,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,U.jsx)(k,{stat:t.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(S,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,U.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,U.jsx)(_,{icon:c?(0,U.jsx)(E,{}):(0,U.jsx)(D,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,U.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,U.jsx)(_,{icon:(0,U.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,U.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,U.jsx)(I,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function Z({tab:e}){let t=f();if(t.isPending)return(0,U.jsx)(P,{});if(t.isError)return(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(_,{icon:(0,U.jsx)(D,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,U.jsx)(Q,{repo:t.data,info:n,tab:e}):(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(_,{icon:(0,U.jsx)(N,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Q({repo:e,info:t,tab:n}){return(0,U.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,U.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,U.jsx)(w,{branch:t.branch}),t.remote?(0,U.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,U.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,U.jsx)(L,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(L,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(L,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,U.jsx)(J,{}):n===`commits`?(0,U.jsx)(Y,{log:e.log}):(0,U.jsx)(W,{repo:e,info:t})]})}export{Z as RepoGitRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Di as i,H as a,Hn as o,It as s,M as c,Mr as l,Pt as u,Rn as d,Rr as f,Sn as p,Vr as m,Wn as h,Zn as g,_n as _,_r as v,_t as y,a as b,ar as ee,at as x,bn as S,ct as C,et as w,hn as T,i as E,ir as D,jn as O,jr as k,k as A,kn as j,lt as M,mt as N,pi as P,sr as te,st as ne,ut as F,wn as I,yn as re,z as ie,zt as L}from"./centered-state-DJLgwvA4.js";import{W as ae,n as oe,r as R,t as z}from"./utils-DoBmOlX3.js";import{A as se,E as ce,T as le,_ as B,d as ue,f as de,g as fe,j as V,k as pe,n as me,r as H,s as he,t as ge,v as _e,y as ve}from"./editable-title-BHbHmSIK.js";import{a as U,i as ye,n as be,r as xe,s as Se,t as Ce}from"./tooltip-Bdl8mQG8.js";import{s as W}from"./popover-BRq6QnwI.js";import{n as we,t as Te}from"./circle-x-C9UoMP1V.js";import{c as Ee,h as De,i as G,n as Oe,r as K,s as q,t as ke}from"./dropdown-menu-B7HeKCfN.js";import{n as Ae,t as je}from"./trash-2-_vwSMdPG.js";import{t as Me}from"./ellipsis-vertical-g4O4NlLV.js";import{t as Ne}from"./file-text-DV1gE2L6.js";import{t as Pe}from"./loader-circle-Cwgo6onL.js";import{c as Fe,m as Ie}from"./new-task-form-CQODCzBP.js";import{t as Le}from"./square-terminal-C7KCPznz.js";import{n as Re,r as ze,t as Be}from"./collapsible-BcKvItwg.js";import{a as Ve,c as He,i as Ue,n as We,o as Ge,r as Ke,s as qe,t as Je}from"./alert-dialog-B_2uU4Bg.js";import{c as Ye,t as J}from"./project-router-I8Pbsrxy.js";import{i as Xe,n as Y,t as Ze}from"./token-metrics-rVl4kXe_.js";import{t as Qe}from"./diff-stat-yKn7joEr.js";import{n as $e,t as et}from"./pill-7dm3vWF7.js";import{t as tt}from"./markdown-Bnm47qUl.js";import{t as X}from"./tab-link-E5O2Cesc.js";var nt=R(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),rt=R(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),it=R(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Z=e(t(),1);function at(e,t=null){let n=N(),r=P(n.data),i=e.runner??`claude`,a=Fe(t,r,i),o=r.includes(i),s=n.isSuccess&&r.length>0,c=n.isPending?`Checking agent providers…`:n.isError?`Provider authentication could not be verified.`:s?void 0:`Connect an agent provider to continue.`;return{runners:r,currentRunner:i,runner:a,currentRunnerConnected:o,canContinue:s,providerPending:n.isPending,providerError:n.isError,reason:c,runnerOverride:t!==null||!o?a:void 0}}var Q=n();function $(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function ot(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function st({steps:e}){if(e.length===0)return null;let t=ot(e)*100;return(0,Q.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,Q.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":$(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,Q.jsx)(ct,{visual:$(t.status)}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,Q.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,Q.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,Q.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function ct({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,Q.jsx)(we,{"aria-hidden":!0,className:z(t,`text-success`)});case`active`:return(0,Q.jsx)(Pe,{role:`status`,"aria-label":`Step running`,className:z(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,Q.jsx)(Te,{"aria-hidden":!0,className:z(t,`text-danger`)});case`pending`:return(0,Q.jsx)(De,{"aria-hidden":!0,className:z(t,`text-soft-foreground`)})}}function lt(e){let t=e.findIndex(e=>$(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>$(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function ut({visual:e}){return(0,Q.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:z(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var dt=new Map;function ft({runId:e,steps:t}){let[n,r]=(0,Z.useState)(()=>dt.get(e)??!1);if(t.length===0)return null;let i=t=>{dt.set(e,t),r(t)},a=lt(t),o=t[a],s=ot(t)*100;return(0,Q.jsxs)(Be,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,Q.jsxs)(ze,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-7 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:min-h-[30px] md:gap-2.5`,children:[(0,Q.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,Q.jsx)(ut,{visual:$(e.status)},e.id))}),(0,Q.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,Q.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,Q.jsx)(W,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(Re,{children:(0,Q.jsx)(`div`,{className:`pt-2`,children:(0,Q.jsx)(st,{steps:t})})})]})}function pt(e){let t=r();return i({mutationFn:()=>te(e),onSuccess:()=>t.invalidateQueries({queryKey:c.runs.all}),onError:e=>E(e.message,{tone:`danger`})})}function mt(e){let t=[];for(let n of e)n.id!==void 0&&t.push({id:n.id,mediaType:n.mediaType,name:n.name,bytes:0});return t}function ht(e,t,{enabled:n=!0}={}){let i=r(),a=n&&e!==``&&t!==``,o=u(a?e:void 0),s=o.data?.surfaces?.[t],[l,d]=(0,Z.useState)(``),[p,h]=(0,Z.useState)([]),g=`${e} ${t}`,[_,y]=(0,Z.useState)(g),b=(0,Z.useRef)(!1),x=(0,Z.useRef)(void 0),S=(0,Z.useRef)(!1),C=(0,Z.useRef)(null),w=(0,Z.useRef)(Promise.resolve()),T=(0,Z.useRef)({runId:e,surface:t,text:l,images:p});T.current.text=l,T.current.images=p;let E=(0,Z.useRef)([]);if(_!==g){if(y(g),C.current!==null){clearTimeout(C.current),C.current=null;let e=T.current;E.current=[...E.current.filter(t=>t.runId!==e.runId||t.surface!==e.surface),{runId:e.runId,surface:e.surface,text:e.text,images:e.images.map(e=>e.id).filter(e=>e!==void 0)}]}d(``),h([]),b.current=!1,S.current=!1,T.current={runId:e,surface:t,text:``,images:[]}}let D=(0,Z.useCallback)((e,t,n)=>{i.setQueryData(c.runs.drafts(e),e=>{let r={...e?.surfaces??{}};return n===null||n.text===``&&n.images.length===0?delete r[t]:r[t]={...n,updatedAt:new Date().toISOString()},{surfaces:r}})},[i]),O=(0,Z.useRef)(D);O.current=D;let k=(0,Z.useRef)(a);k.current=a;let A=(0,Z.useCallback)((e,t,n,r)=>{k.current&&(w.current=w.current.catch(()=>{}).then(()=>m(e,t,n,r?{keepalive:!0}:void 0)).then(n=>O.current(e,t,n)).catch(()=>{}))},[]),j=(0,Z.useCallback)(()=>{C.current!==null&&(clearTimeout(C.current),C.current=null)},[]),M=(0,Z.useCallback)(e=>{j();let t=T.current;A(t.runId,t.surface,{text:t.text,images:t.images.map(e=>e.id).filter(e=>e!==void 0)},e)},[j,A]),N=(0,Z.useCallback)(()=>{j(),C.current=setTimeout(()=>{C.current=null,!S.current&&M()},500)},[j,M]),P=(0,Z.useCallback)((n,r)=>{b.current=!0,k.current&&(D(e,t,{text:n,images:mt(r)}),N())},[D,e,N,t]),te=(0,Z.useCallback)(e=>{d(e),T.current={...T.current,text:e},P(e,T.current.images)},[P]),ne=(0,Z.useCallback)((n,r=`edit`)=>{let i=T.current.images.map(e=>e.id).filter(e=>e!==void 0&&!n.some(t=>t.id===e));if(h(n),T.current={...T.current,images:n},P(T.current.text,n),r!==`submit`&&k.current)for(let n of i)ee(e,t,n).catch(()=>{});let a=e,o=t;for(let e of n)e.id!==void 0||!k.current||f(a,o,{mediaType:e.mediaType,data:e.data,name:e.name}).then(t=>{T.current.runId!==a||T.current.surface!==o||(h(n=>{let r=n.map(n=>n===e?{...n,id:t.id}:n);return T.current={...T.current,images:r},r}),P(T.current.text,T.current.images))}).catch(()=>{})},[P,e,t]),F=(0,Z.useCallback)(()=>{j(),S.current=!1,d(``),h([]),T.current={...T.current,text:``,images:[]},b.current=!1,x.current=g,D(e,t,null),A(e,t,{text:``,images:[]})},[D,j,g,e,t,A]),I=(0,Z.useCallback)(async e=>{S.current=!0,j();try{let t=await e();return S.current=!1,F(),t}catch(e){throw S.current=!1,N(),e}},[j,F,N]);return(0,Z.useEffect)(()=>{if(E.current.length===0)return;let e=E.current;E.current=[];for(let t of e)A(t.runId,t.surface,{text:t.text,images:t.images})}),(0,Z.useEffect)(()=>{if(x.current===g||s===void 0||(x.current=g,b.current))return;let n=typeof s.text==`string`?s.text:``,r=Array.isArray(s.images)?s.images:[];if(d(n),T.current={...T.current,text:n},r.length===0)return;let i=!0;return Promise.all(r.slice(0,4).map(async n=>{try{let r=await v(e,t,n.id),i=ae(r.mediaType),a=r.name!==``&&r.name!==H(r.mediaType,i);return{id:r.id,mediaType:r.mediaType,data:r.data,name:r.name||H(r.mediaType,i),...a?{originalName:r.name}:{},...i?{preview:`data:${r.mediaType};base64,${r.data}`}:{},isImage:i}}catch{return null}})).then(e=>{let t=e.filter(e=>e!==null);!i||t.length===0||b.current||(h(t),T.current={...T.current,images:t})}),()=>{i=!1}},[s,g,e,t]),(0,Z.useEffect)(()=>{let e=()=>{C.current===null||S.current||M(!0)},t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,e),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,e)}},[M]),(0,Z.useEffect)(()=>()=>{C.current!==null&&M()},[M]),{ready:!a||o.isSuccess||o.isError,hasDraft:l!==``||p.length>0,text:l,setText:te,images:p,setImages:ne,submit:I,clear:F}}var gt=new Map,_t=Object.values({run:(e,t)=>e.run===t.run,tab:(e,t)=>e.tab===t.tab,onMarkedUnread:(e,t)=>e.onMarkedUnread===t.onMarkedUnread,continuationEngine:(e,t)=>e.continuationEngine===t.continuationEngine,planTally:(e,t)=>e.planTally?.done===t.planTally?.done&&e.planTally?.total===t.planTally?.total}),vt=(0,Z.memo)(yt,(e,t)=>_t.every(n=>n(e,t)));function yt({run:e,planTally:t,tab:n=`session`,onMarkedUnread:r,continuationEngine:i}){let a=Y(e),o=B(e),s=fe(e),[c,l]=(0,Z.useState)(!1),u=xt(e,r),[,d]=(0,Z.useReducer)(e=>e+1,0),f=(0,Z.useId)(),p=gt.get(e.id)??!1,m=()=>{gt.set(e.id,!p),d()},h=L((0,Z.useMemo)(()=>t=>e.status===`queued`?j(t).get(e.id):void 0,[e.id,e.status])).data,g=w(),_=Ze(g.data);return(0,Q.jsxs)(`header`,{"data-slot":`run-header`,className:`relative z-20 border-b border-border bg-background/95 px-3 pt-2 backdrop-blur md:sticky md:top-0 md:px-6 md:pt-3`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-[var(--measure)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ct,{run:e}),(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[t?(0,Q.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`hidden text-[11px] text-soft-foreground tabular-nums md:inline`,children:[`Plan `,t.done,`/`,t.total]}):null,(0,Q.jsxs)(et,{dot:a.tone,pulse:a.pulse,children:[a.label,h===void 0?``:` #${h}`]}),(0,Q.jsx)(b,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":p?`Hide run details`:`Show run details`,"aria-controls":f,"aria-expanded":p,onClick:m,children:(0,Q.jsx)(W,{"aria-hidden":`true`,className:z(`transition-transform`,p&&`rotate-180`)})}),(0,Q.jsx)(At,{run:e,actions:u,onToggleNotes:()=>l(e=>!e)})]})]}),(0,Q.jsx)(`div`,{id:f,"data-slot":`run-details`,className:z(p?`block`:`hidden`,`md:block`),children:(0,Q.jsx)(Tt,{run:e,continuationEngine:i,showTokens:_.tokens,showCost:_.cost,automationsAvailable:g.data?.capabilities?.automations===!0})}),(0,Q.jsx)(Ot,{run:e}),(0,Q.jsx)(Et,{run:e}),(0,Q.jsx)(Dt,{run:e}),(0,Q.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-1.5 flex items-end gap-1 md:mt-2.5`,children:[(0,Q.jsx)(X,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,Q.jsx)(X,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(X,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(X,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),(0,Q.jsxs)(`div`,{"data-slot":`run-actions`,className:`ml-auto hidden items-center gap-1 pb-1 md:flex`,children:[o.finish?(0,Q.jsxs)(b,{variant:`outline`,size:`sm`,title:de(e.status),onClick:()=>u.finish.mutate(),children:[(0,Q.jsx)(A,{"aria-hidden":`true`}),`Finish`]}):null,o.continueRun?(0,Q.jsxs)(b,{variant:`outline`,size:`sm`,title:u.continuation.reason??`Reopen the session`,disabled:u.continueRun.isPending||!u.continuation.canContinue,onClick:()=>u.continueRun.mutate(),children:[(0,Q.jsx)(Ie,{"aria-hidden":`true`}),`Continue`]}):null,(0,Q.jsx)(bt,{run:e,canResume:o.terminal,onResume:()=>u.terminal.mutate()}),(0,Q.jsxs)(b,{variant:`ghost`,size:`sm`,title:`Handoff notes — what the agent did and what's left`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,Q.jsx)(Ne,{"aria-hidden":`true`}),`Notes`]}),o.markUnread?(0,Q.jsxs)(b,{variant:`ghost`,size:`sm`,title:`Put this task back in the unread list`,disabled:u.markUnread.isPending,onClick:()=>u.markUnread.mutate(),children:[(0,Q.jsx)(rt,{"aria-hidden":`true`}),`Mark unread`]}):null,o.pin?(0,Q.jsxs)(b,{variant:`ghost`,size:`sm`,"data-slot":`pin-run`,"aria-pressed":!!e.pinned,title:e.pinned?`Unpin from the top of this project’s task list`:`Pin to the top of this project’s task list`,disabled:u.pin.isPending,onClick:()=>u.pin.mutate(),children:[e.pinned?(0,Q.jsx)(it,{"aria-hidden":`true`}):(0,Q.jsx)(le,{"aria-hidden":`true`}),e.pinned?`Unpin`:`Pin`]}):null,o.archive?(0,Q.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:()=>u.archive.mutate(),children:[e.archived?(0,Q.jsx)(V,{"aria-hidden":`true`}):(0,Q.jsx)(se,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,o.cancel?(0,Q.jsxs)(b,{variant:`danger-ghost`,size:`sm`,onClick:()=>u.setConfirming(`cancel`),children:[(0,Q.jsx)(nt,{"aria-hidden":`true`}),`Cancel`]}):null,o.deleteRun?(0,Q.jsxs)(b,{variant:`danger-ghost`,size:`sm`,onClick:()=>u.setConfirming(`delete`),children:[(0,Q.jsx)(je,{"aria-hidden":`true`}),`Delete`]}):null]})]}),e.steps.length>0?(0,Q.jsx)(`div`,{className:`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,children:(0,Q.jsx)(ft,{runId:e.id,steps:e.steps})}):null,s?(0,Q.jsx)(Mt,{hint:s}):null,c?(0,Q.jsx)(Nt,{runId:e.id}):null]}),(0,Q.jsx)(jt,{run:e,actions:u})]})}function bt({run:e,canResume:t,onResume:n}){let r=ne(),a=N(),o=i({mutationFn:t=>k(e.id,t),onError:e=>E(e.message,{tone:`danger`})}),s=P(a.data),c=e=>!a.isSuccess||s.includes(e??`claude`),l=t&&c(e.runner),u=e.worktreePath?(r.data?.targets??[]).filter(e=>{let t=ve(e.id);return t===void 0||c(t)}).map(t=>({target:t,...ue(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];return!l&&u.length===0?null:(0,Q.jsx)(_e,{choices:u,onPick:e=>o.mutate(e),title:`Resume in a terminal, or open the worktree locally`,leading:l?(0,Q.jsxs)(K,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Q.jsx)(Le,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,trailing:e.worktreePath?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{}),(0,Q.jsxs)(K,{onSelect:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>E(`Worktree path copied`)).catch(()=>E(`Path: ${t}`))},children:[(0,Q.jsx)(Ae,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null})}function xt(e,t){let n=r(),a=Ye(),[s,u]=(0,Z.useState)(null),f=()=>n.invalidateQueries({queryKey:c.runs.all}),p=e=>{e instanceof d&&e.status===409&&f(),E(e.message,{tone:`danger`})},m=pt(e.id),_=at(e),v=i({mutationFn:async()=>_.canContinue?g(e.id,{runner:_.runnerOverride}):null,onSuccess:e=>{e!==null&&f()},onError:p}),y=i({mutationFn:()=>o(e.id,!e.archived),onSuccess:f,onError:p}),b=M(),ee={isPending:b.isPending,mutate:()=>b.mutate({id:e.id,pinned:!e.pinned},{onError:p})},S=x();return{finish:m,continuation:_,continueRun:v,archive:y,pin:ee,markUnread:{isPending:S.isPending,mutate:()=>{t?.(),S.mutate(e.id,{onError:p})}},cancel:i({mutationFn:()=>h(e.id),onSuccess:f,onError:p}),delete:i({mutationFn:()=>D(e.id),onSuccess:()=>{f(),a(`/`)},onError:p}),terminal:i({mutationFn:()=>l(e.id),onError:e=>{if(e instanceof d&&e.command){St(e.command,`No terminal found — command copied to clipboard.`);return}p(e)}}),confirming:s,setConfirming:u}}async function St(e,t){try{await navigator.clipboard.writeText(e),E(t)}catch{E(`Run manually: ${e}`)}}function Ct({run:e}){let t=C(e.id),n=O(e),r=ht(e.id,`title`),i=me(n,e=>t.mutate({title:e},{onError:e=>E(e.message,{tone:`danger`})})),a={...i,setDraft:e=>{i.setDraft(e),r.setText(e)},commit:()=>{i.commit(),r.clear()},cancel:()=>{i.cancel(),r.clear()}},o=(0,Z.useRef)(i.beginWith);o.current=i.beginWith;let s=i.editing;return(0,Z.useEffect)(()=>{s||!r.ready||!r.hasDraft||o.current(r.text)},[r.hasDraft,r.ready,r.text,s]),i.editing?(0,Q.jsx)(ge,{editor:a,className:`flex-1 text-[15px] font-semibold`}):(0,Q.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-[15px] font-semibold`,title:e.task,children:n}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ce,{className:`size-3.5`,"aria-hidden":`true`})})]})}function wt({branch:e}){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),(0,Q.jsx)(xe,{children:(0,Q.jsxs)(Ce,{open:r,onOpenChange:e=>{e&&a.current===null&&n(!1),i(e)},children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`branch-chip`,className:`cursor-copy rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,"aria-label":`Copy branch name ${e}`,onClick:()=>{if(!navigator.clipboard){E(`Branch: ${e}`);return}navigator.clipboard.writeText(e).then(()=>{n(!0),i(!0),a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,i(!1)},1500)}).catch(()=>E(`Branch: ${e}`))},children:[e,(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:t?`Branch name copied`:``})]})}),(0,Q.jsx)(be,{children:t?`Copied`:`Copy branch name`})]})})}function Tt({run:e,showTokens:t,showCost:n,automationsAvailable:r,continuationEngine:i}){let a=F(),o=y(),s=(0,Z.useMemo)(()=>p(e,a),[e,a]),c=(0,Z.useMemo)(()=>o===void 0?[]:s.map(e=>({projectId:o,kind:e.kind,number:e.number})),[s,o]),l=[(0,Q.jsx)(`span`,{children:I(e)},`workflow`)],u=e.branch;u&&l.push((0,Q.jsx)(wt,{branch:u},`branch`));let d=s.filter(e=>e.kind===`PR`);for(let t of d)l.push((0,Q.jsx)(U,{reference:t,taskTitle:O(e),className:`h-5`,conflictAction:(0,Q.jsx)(he,{run:e,prNumber:t.number})},`pr-${t.number}`));let f=S(e);f&&oe(f)&&!d.some(e=>e.url===f)&&l.push((0,Q.jsx)(U,{reference:{kind:`PR`,url:f},taskTitle:O(e),className:`h-5`},`pr`));let m=re(e,a);if(m&&oe(m)){let t=_(m);l.push((0,Q.jsx)(U,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:m},taskTitle:O(e),className:`h-5`},`issue`))}e.diffStat&&l.push((0,Q.jsx)(Qe,{stat:e.diffStat},`diff`)),e.automation&&l.push(r?(0,Q.jsx)(J,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,Q.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let h=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&h.push((0,Q.jsx)($e,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&h.push((0,Q.jsx)(`span`,{className:`tabular-nums`,children:T(e.costUsd)},`cost`)),(0,Q.jsx)(Se,{projectId:o,requests:c,children:(0,Q.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[l.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[h.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Q.jsx)(kt,{run:e,continuationEngine:i})]})]})})}function Et({run:e}){let t=L(),n=e.dispatch?.parentRunId;if(n===void 0)return null;let r=(t.data??[]).find(e=>e.id===n),i=r?Y(r):null;return(0,Q.jsxs)(`div`,{"data-slot":`dispatch-parent-line`,className:`mt-1 flex min-w-0 items-center gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Dispatched by`}),(0,Q.jsxs)(J,{to:`/tasks/${n}`,"data-slot":`dispatch-parent`,"data-run-id":n,className:`inline-flex min-w-0 items-center gap-1.5 truncate hover:text-foreground`,children:[i?(0,Q.jsx)(Xe,{tone:i.tone,pulse:i.pulse}):null,(0,Q.jsx)(`span`,{className:`truncate`,children:r?O(r):n})]})]})}function Dt({run:e}){let t=(L().data??[]).filter(t=>t.dispatch?.parentRunId===e.id);return t.length===0?null:(0,Q.jsxs)(`div`,{"data-slot":`dispatch-children`,className:`mt-1 flex min-w-0 items-center gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Subtasks`}),(0,Q.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-hidden`,children:t.map(e=>{let t=Y(e);return(0,Q.jsxs)(J,{to:`/tasks/${e.id}`,"data-slot":`dispatch-child`,"data-run-id":e.id,title:`${O(e)} — ${t.label}`,className:`inline-flex max-w-52 items-center gap-1.5 truncate hover:text-foreground`,children:[(0,Q.jsx)(Xe,{tone:t.tone,pulse:t.pulse}),(0,Q.jsx)(`span`,{className:`truncate`,children:O(e)})]},e.id)})})]})}function Ot({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,Q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,Q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,Q.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,Q.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function kt({run:e,continuationEngine:t}){let n=a(),r=ie(),i=e.runner??n.data?.defaultRunner??`claude`,o=e.model??`auto`,s=[...e.steps].reverse().find(e=>e.profileId)?.profileId,c=s===void 0?void 0:s==="default"?`default`:r.data?.profiles.find(e=>e.id===s)?.label??`${s} (removed)`,l=e.modelIdentity&&e.modelIdentity!==o?e.modelIdentity:void 0,u=[i,c,o].filter(Boolean).join(` · `);return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:u,"aria-label":`Agent: ${i}, ${c?`account ${c}, `:``}model ${o}`,className:`flex min-w-0 shrink items-center gap-1.5 rounded-sm px-1 py-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,Q.jsx)(pe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:u})]})}),(0,Q.jsxs)(Oe,{align:`end`,className:`min-w-[9rem]`,children:[(0,Q.jsxs)(G,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),c?(0,Q.jsxs)(G,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,c]}):null,(0,Q.jsxs)(G,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,o]}),l?(0,Q.jsxs)(G,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,l]}):null,t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{}),(0,Q.jsx)(G,{className:`pb-1 text-[11px] font-normal text-muted-foreground`,children:`Next continuation`}),(0,Q.jsx)(`div`,{"data-slot":`agent-badge-engine-picker`,className:`px-2 pb-1`,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:t})]}):null]})]})}function At({run:e,actions:t,onToggleNotes:n}){let r=B(e);return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsx)(b,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,Q.jsx)(Me,{"aria-hidden":`true`})})}),(0,Q.jsxs)(Oe,{align:`end`,"data-slot":`run-actions-menu`,children:[r.finish?(0,Q.jsxs)(K,{onSelect:()=>t.finish.mutate(),children:[(0,Q.jsx)(A,{"aria-hidden":`true`}),` Finish`]}):null,r.continueRun?(0,Q.jsxs)(K,{disabled:!t.continuation.canContinue||t.continueRun.isPending,title:t.continuation.reason,onSelect:()=>t.continueRun.mutate(),children:[(0,Q.jsx)(Ie,{"aria-hidden":`true`}),` Continue`]}):null,r.terminal?(0,Q.jsxs)(K,{onSelect:()=>t.terminal.mutate(),children:[(0,Q.jsx)(Le,{"aria-hidden":`true`}),` Terminal`]}):null,(0,Q.jsxs)(K,{onSelect:n,children:[(0,Q.jsx)(Ne,{"aria-hidden":`true`}),` Notes`]}),r.markUnread?(0,Q.jsxs)(K,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Q.jsx)(rt,{"aria-hidden":`true`}),` Mark unread`]}):null,r.pin?(0,Q.jsxs)(K,{"data-slot":`pin-run`,"aria-pressed":!!e.pinned,disabled:t.pin.isPending,onSelect:()=>t.pin.mutate(),children:[e.pinned?(0,Q.jsx)(it,{"aria-hidden":`true`}):(0,Q.jsx)(le,{"aria-hidden":`true`}),e.pinned?`Unpin`:`Pin`]}):null,r.archive?(0,Q.jsxs)(K,{onSelect:()=>t.archive.mutate(),children:[e.archived?(0,Q.jsx)(V,{"aria-hidden":`true`}):(0,Q.jsx)(se,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,r.cancel||r.deleteRun?(0,Q.jsx)(q,{}):null,r.cancel?(0,Q.jsxs)(K,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,Q.jsx)(nt,{"aria-hidden":`true`}),` Cancel`]}):null,r.deleteRun?(0,Q.jsxs)(K,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Q.jsx)(je,{"aria-hidden":`true`}),` Delete`]}):null]})]})}function jt({run:e,actions:t}){let n=t.confirming;return(0,Q.jsx)(Je,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(He,{children:n===`delete`?`Delete this task?`:`Cancel this task?`}),(0,Q.jsx)(Ve,{children:n===`delete`?(0,Q.jsxs)(Q.Fragment,{children:[`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,Q.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:O(e),children:O(e)})]}):`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ke,{children:`Keep it`}),(0,Q.jsx)(We,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{n===`delete`?t.delete.mutate():t.cancel.mutate(),t.setConfirming(null)},children:n===`delete`?`Delete`:`Cancel the run`})]})]})})}function Mt({hint:e}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void St(e,`Command copied to clipboard.`),className:`mb-2 flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(Ae,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}function Nt({runId:e}){let t=s(e);return(0,Q.jsx)(`div`,{"data-slot":`notes-panel`,className:`mb-3 max-h-72 overflow-y-auto rounded-md border border-border bg-card px-4 py-3`,children:t.isPending?(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):t.isError?(0,Q.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}):t.data.trim().length>0?(0,Q.jsx)(tt,{children:t.data}):(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})})}export{at as i,ht as n,pt as r,vt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Di as i,Kt as a,Ln as o,M as s,Ti as c,Wr as l,a as u,an as d,er as f,i as p,nt as m,pt as h,qn as g,qr as _,qt as v,rn as y,sn as b,t as x,zn as S}from"./centered-state-DJLgwvA4.js";import{t as C}from"./utils-DoBmOlX3.js";import{t as w}from"./arrow-left-C8M0efjn.js";import{n as T}from"./circle-x-C9UoMP1V.js";import{t as E}from"./download-BcgZ2yk4.js";import{d as D,p as O}from"./new-task-form-CQODCzBP.js";import{t as k}from"./refresh-cw-C69euZ2H.js";import{t as A}from"./sparkles-ChorK-gZ.js";import{t as j}from"./triangle-alert-fBRUkB46.js";import{a as M,i as N,o as P,r as F,s as I,t as L}from"./dialog-B6NgKh0-.js";import{c as R,t as z}from"./project-router-I8Pbsrxy.js";import{i as B,n as V,o as H,p as U}from"./skills-9oR_oHse.js";import{V as W,c as G,n as K,u as q}from"./index-CSNFuBvj.js";import{t as ee}from"./skill-empty-hint-oOtzR3v0.js";var J=e(t(),1),Y=n(),te=`https://github.com/open-mercato/skills`;function ne(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return ne(e)??[...t]}function re({projectId:e}){let t=r(),n=d(),i=m(),[a,o]=(0,J.useState)(``),c=v(e,!!e),u=i.data??[],f=(0,J.useMemo)(()=>u.map(e=>e.name),[u]),h=(0,J.useRef)([]);h.current=f;let g=(0,J.useMemo)(()=>new Set(X(n.data,f)),[n.data,f]),_=(0,J.useRef)(Promise.resolve()),y=(0,J.useRef)(0),S=(0,J.useCallback)(e=>{let n=b.uiState,r=t.getQueryData(n),i=e(X(r,h.current));t.setQueryData(n,{...r,importedSkills:i});let a=++y.current;_.current=_.current.then(async()=>{try{let e=await l({importedSkills:i});a===y.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:s.skills}))}catch(e){p(e instanceof Error?e.message:String(e),{tone:`danger`}),a===y.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,J.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),T=f.length>0&&f.every(e=>g.has(e)),E=(0,J.useCallback)(()=>{if(T){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[T,S]);if(i.isError)return(0,Y.jsx)(x,{icon:(0,Y.jsx)(j,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:i.error.message});let D=a.trim().toLowerCase(),O=D?u.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):u;return(0,Y.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,Y.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,Y.jsx)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,Y.jsx)(ie,{projectId:e,state:c.data,loadError:c.error}),(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what cezar shows; updates refresh installed skill files.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>o(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:f.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,Y.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:i.isPending?(0,Y.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=g.has(e.name);return(0,Y.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,Y.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,Y.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:u.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ie({projectId:e,state:t,loadError:n}){let a=r(),o=R(),c=(0,J.useRef)(0),[l,d]=(0,J.useState)(!1),m=i({mutationFn:()=>f({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{d(!1),o(D(e))},onError:e=>p(e.message,{tone:`danger`})}),h=(t,n)=>{n.seq===c.current&&(a.setQueryData(b.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(a.invalidateQueries({queryKey:s.skills}),p(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),d(!0)))},_=(e,t)=>{t.seq===c.current&&p(e.message,{tone:`danger`})},v=i({mutationFn:t=>g(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>_(e,t)}),y=i({mutationFn:t=>S(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>_(e,t)}),x=e=>{let n=++c.current;e===`apply`?y.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):v.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,E=t?.status===`error`,O=w&&(t?.available||E),A=y.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],z=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,Y.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,Y.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>Z(e.scope)).join(`, `),z.length?`; updated: ${z.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,Y.jsxs)(u,{"data-action":`skills-update-apply`,size:`sm`,disabled:A,onClick:()=>x(`apply`),children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:C(`size-3.5`,A&&`motion-safe:animate-spin`)}),A?`Updating…`:E?`Retry`:`Update now`]}):t?.status===`current`?(0,Y.jsx)(u,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:v.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,Y.jsx)(u,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:v.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,Y.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,Y.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,Y.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,Y.jsx)(T,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,Y.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,Y.jsx)(L,{open:l,onOpenChange:e=>m.isPending?void 0:d(e),children:(0,Y.jsxs)(F,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,Y.jsxs)(P,{children:[(0,Y.jsx)(I,{children:`Apply the upgrade notes now?`}),(0,Y.jsxs)(N,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,Y.jsxs)(M,{children:[(0,Y.jsx)(u,{type:`button`,variant:`outline`,disabled:m.isPending,onClick:()=>d(!1),children:`No`}),(0,Y.jsx)(u,{type:`button`,disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,Y.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Y.jsx)(oe,{})]})}function oe(){let e=a(),t=y(),n=m(),[l]=c(),[u,d]=(0,J.useState)(``),f=r(),g=h(),v=o().projectId??g.data?.bootProject??``,b=i({mutationFn:()=>_(),onSuccess:e=>{f.setQueryData(s.skills,e),p(`Team skills refreshed.`)},onError:e=>p(e.message,{tone:`danger`})});if(e.isError)return(0,Y.jsx)(x,{icon:(0,Y.jsx)(j,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let S=H(e.data??[]),T=(n.data?.length??0)>0,D=l.get(`skill`),M=D===Q||D===$||D!==null&&S.some(e=>e.name===D)?D:S[0]?.name??(T?$:Q),N=S.find(e=>e.name===M)??null,P=V(S,u);return(0,Y.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,D===null?`flex`:`hidden md:flex`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,Y.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:u,onChange:e=>d(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:b.isPending,onClick:()=>b.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:C(`size-3`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Y.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):P.length>0?P.map(e=>(0,Y.jsx)(se,{skill:e,active:M===e.name},e.path)):(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:S.length>0?`(no skills match)`:(0,Y.jsx)(ee,{})})}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,Y.jsxs)(z,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":M===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,M===$&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(E,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,Y.jsxs)(z,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":M===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,M===Q&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,Y.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,D===null?`hidden md:flex`:`flex`),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(z,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),M===$?(0,Y.jsx)(re,{projectId:v}):M===Q?(0,Y.jsx)(K,{skills:S}):N?(0,Y.jsx)(G,{skill:N,usedBy:U(t.data?.workflows??[],N.name)}):e.isPending?null:(0,Y.jsx)(x,{icon:(0,Y.jsx)(A,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=B(e);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(z,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,Y.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Y.jsx)(q,{source:e.source,className:`ml-auto`})]}),e.description?(0,Y.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Ar as i,At as a,Di as o,M as s,Mr as c,Rn as l,Tt as u,Yn as d,a as f,ei as p,et as m,i as h,jn as g,kt as _,t as v,tr as y,vr as b,wi as x,zr as S}from"./centered-state-DJLgwvA4.js";import{m as C,p as w}from"./editable-title-BHbHmSIK.js";import{t as T}from"./run-header-CxdaA86t.js";import{r as ee}from"./diff-controls-DskkZqmD.js";import{a as E,i as D,o as O,r as k,s as A,t as j}from"./dialog-B6NgKh0-.js";import{t as M}from"./textarea-DLAfWPb0.js";import{t as N}from"./use-submit-shortcut-BJ10ZshV.js";import{Q as P,X as F,i as I,r as L}from"./index-CSNFuBvj.js";import{t as R}from"./diff-I0xowULh.js";import{i as z,n as B,r as V}from"./git-toolbar-EZuX4Cuz.js";var H=e(t(),1),U=e=>e===`running`||e===`queued`||e===`waiting`,W=`no worktree — this task ran directly in the repo working tree`;function G(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${W}`)}function K(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${W}`)}function q(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${W}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?U(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function J(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:G(e),n=e.prUrl?[G(e),K(e)]:[K(e),q(e)],r=[];if(e.localHandoff){let t=e.hasSession?U(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Y=n();function te({run:e,open:t,onOpenChange:n}){let i=r(),[a,c]=(0,H.useState)(``),l=g(e),u=(0,H.useRef)(l);u.current=l,(0,H.useEffect)(()=>{t&&c(u.current)},[t]);let p=o({mutationFn:t=>d(e.id,t),onSuccess:t=>{h(`Committed ${t.sha.slice(0,7)}`),n(!1),i.invalidateQueries({queryKey:s.runs.changes(e.id)}),i.invalidateQueries({queryKey:s.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),m=()=>{let e=a.trim();e.length===0||p.isPending||p.mutate(e)};return(0,Y.jsx)(j,{open:t,onOpenChange:n,children:(0,Y.jsxs)(k,{"data-slot":`commit-dialog`,children:[(0,Y.jsxs)(O,{children:[(0,Y.jsx)(A,{children:`Commit changes`}),(0,Y.jsxs)(D,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Y.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Y.jsx)(M,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>c(e.target.value),onKeyDown:e=>{N({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())}}),(0,Y.jsxs)(E,{children:[(0,Y.jsx)(f,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(f,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||p.isPending,onClick:m,children:p.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=x(),t=_(e);return t.isPending?(0,Y.jsx)(I,{tab:`changes`}):t.isError?(0,Y.jsx)(L,{tab:`changes`,error:t.error}):(0,Y.jsx)(Z,{run:t.data})}function Z({run:e}){let t=m(),n=u(),d=a(e.id,w(e.status)),f=P(),[g,_]=(0,H.useState)(`unified`),[b,x]=(0,H.useState)(!1),[E,D]=(0,H.useState)(null),[O,k]=(0,H.useState)(!1),A=(0,H.useRef)(null),j=r(),M=()=>j.invalidateQueries({queryKey:s.runs.all}),N=e=>h(e.message,{tone:`danger`}),I=o({mutationFn:()=>S(e.id),onSuccess:e=>h(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:N}),L=o({mutationFn:()=>y(e.id),onSuccess:e=>{h(`Draft PR created — ${e.url}`),M()},onError:N}),U=o({mutationFn:()=>c(e.id),onError:e=>{if(e instanceof l&&e.command){navigator.clipboard.writeText(e.command).then(()=>h(`No terminal found — command copied to clipboard.`)).catch(()=>h(`Run manually: ${e.command}`));return}N(e)}}),W=o({mutationFn:t=>i(e.id,t),onError:N}),G=d.isError&&d.error instanceof l&&d.error.status===409,K=J({status:e.status,hasWorktree:!!e.worktreePath&&!G,branch:e.branch,changedFiles:d.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:C(e)!==void 0,prUrl:e.pullRequestUrl}),q=e=>{switch(e){case`commit`:k(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:U.mutate();break;case`view-pr`:break}},X=d.data?.files??[],Z=(0,H.useMemo)(()=>V(X),[X]),Q=f?g:`unified`,$=!f||b;return(0,Y.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(T,{run:e,tab:`changes`}),(0,Y.jsx)(B,{bar:K,branch:e.branch,stat:d.data?.stat,mode:Q,wrap:$,onModeChange:_,onWrapChange:x,onAction:q}),d.data?.repointedHead?(0,Y.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-6`,children:[`HEAD is on `,(0,Y.jsx)(`code`,{children:d.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Y.jsx)(`code`,{children:d.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,d.isPending?(0,Y.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):d.isError?(0,Y.jsx)(v,{icon:G?(0,Y.jsx)(F,{}):(0,Y.jsx)(ee,{}),tone:G?`neutral`:`danger`,heading:`h2`,title:G?`No changes to show`:`Could not load the changes`,subtitle:d.error.message}):X.length===0?(0,Y.jsx)(v,{icon:(0,Y.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:[(0,Y.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`sticky top-40 hidden max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] w-60 shrink-0 overflow-y-auto overscroll-contain md:block lg:w-72`,children:(0,Y.jsx)(z,{root:Z,selected:E,onSelect:e=>{D(e),A.current?.scrollToPath(e)}})}),(0,Y.jsx)(R,{files:X,viewRef:A,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>p(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>W.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,Y.jsx)(te,{run:e,open:O,onOpenChange:k})]})}async function ne(e,t){try{let n=await b(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Mt as r,Rn as i,a,jt as o,kt as s,t as c,wi as l}from"./centered-state-DJLgwvA4.js";import{p as u}from"./editable-title-BHbHmSIK.js";import{t as d}from"./arrow-left-C8M0efjn.js";import{t as f}from"./run-header-CxdaA86t.js";import{n as p,r as m}from"./diff-controls-DskkZqmD.js";import{t as h}from"./search-x-BNLFOxI6.js";import{t as g}from"./triangle-alert-fBRUkB46.js";import{t as _}from"./project-router-I8Pbsrxy.js";import{t as v}from"./diff-stat-yKn7joEr.js";import{Q as y,i as b,r as x}from"./index-CSNFuBvj.js";import{t as S}from"./diff-I0xowULh.js";import{t as C}from"./commit-list-BSfPsVsu.js";var w=e(t(),1),T=n();function E(){let{id:e}=l(),t=s(e);return t.isPending?(0,T.jsx)(b,{tab:`changes`}):t.isError?(0,T.jsx)(x,{tab:`changes`,error:t.error}):(0,T.jsx)(D,{run:t.data})}function D({run:e}){let{sha:t}=l(),n=r(e.id,u(e.status));return(0,T.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,T.jsx)(f,{run:e,tab:`commits`}),t?(0,T.jsx)(O,{runId:e.id,sha:t}):n.isPending?(0,T.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,T.jsx)(c,{icon:(0,T.jsx)(m,{}),tone:n.error instanceof i&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof i&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,T.jsx)(c,{icon:(0,T.jsx)(m,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,T.jsx)(C,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))})]})}function O({runId:e,sha:t}){let n=o(e,t),r=y(),[s,l]=(0,w.useState)(`unified`),[u,f]=(0,w.useState)(!1),b=n.isError&&n.error instanceof i&&n.error.status===409,x=r?s:`unified`,C=!r||u;return(0,T.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,T.jsx)(a,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,T.jsxs)(_,{to:`/tasks/${e}/commits`,children:[(0,T.jsx)(d,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,T.jsx)(v,{stat:n.data.stat}):null,(0,T.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,T.jsx)(p,{mode:s,wrap:u,onModeChange:l,onWrapChange:f})})]}),n.isPending?(0,T.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,T.jsx)(c,{icon:b?(0,T.jsx)(h,{}):(0,T.jsx)(g,{}),tone:b?`neutral`:`danger`,heading:`h2`,title:b?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,T.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,T.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,T.jsx)(c,{icon:(0,T.jsx)(m,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,T.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:(0,T.jsx)(S,{files:n.data.files,mode:x,wrap:C,className:`min-w-0`})})]})]})}export{E as TaskCommitsRoute};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Rn as i,ei as a,kt as o,t as s,wi as c}from"./centered-state-DJLgwvA4.js";import{r as l,t as u}from"./utils-DoBmOlX3.js";import{t as d}from"./chevron-right-B3Ta8VKK.js";import{t as f}from"./run-header-CxdaA86t.js";import{t as p}from"./file-wXNeZwi7.js";import{t as m}from"./folder-wjVId5un.js";import{t as h}from"./triangle-alert-fBRUkB46.js";import{a as g,i as _,r as v}from"./highlighter-CdHqIwFr.js";import{i as y,r as b}from"./index-CSNFuBvj.js";var x=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),T=l(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let a=r(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(a.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(a.isError){let e=a.error instanceof i&&a.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:a.error.message})})}return a.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:a.data,className:n}):null}function P({runId:e,entry:t,className:n}){let r=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),r===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,M.jsx)(s,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,M.jsx)(s,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
|
|
2
|
-
`).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>g(e),[e]),i=n.length>I,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:_(t,r)?.tokens??n}function R({path:e,text:t}){let n=L(e,t);return(0,M.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex px-4`,children:[(0,M.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,M.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function z({runId:e,selected:t,onSelect:n}){return(0,M.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function B({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t);return o.isPending?(0,M.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):o.isError?(0,M.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,M.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,M.jsx)(M.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,M.jsx)(V,{runId:e,name:r.name,path:t===``?r.name:`${t}/${r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,M.jsx)(H,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function V({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,D.useState)(!1);return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,M.jsx)(d,{"aria-hidden":`true`,className:u(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,M.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function H({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=k(t)?T:p;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:u(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+r*14}px`},children:[(0,M.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,M.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:j(n)})]})})}function U(){let{id:e}=c(),t=o(e);return t.isPending?(0,M.jsx)(y,{tab:`files`}):t.isError?(0,M.jsx)(b,{tab:`files`,error:t.error}):(0,M.jsx)(W,{run:t.data})}function W({run:e}){let t=r(e.id,``),[n,a]=(0,D.useState)(null),o=t.isError&&t.error instanceof i&&t.error.status===409;return(0,M.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,M.jsx)(f,{run:e,tab:`files`}),t.isPending?(0,M.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,M.jsx)(s,{icon:o?(0,M.jsx)(w,{}):(0,M.jsx)(h,{}),tone:o?`neutral`:`danger`,heading:`h2`,title:o?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,M.jsx)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:(0,M.jsx)(z,{runId:e.id,selected:n,onSelect:a})}),(0,M.jsx)(N,{runId:e.id,path:n,className:`min-w-0 flex-1`})]})]})}export{U as TaskFilesRoute};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Di as i,Ei as a,H as o,K as s,M as c,Oi as l,P as u,Rn as d,Rt as f,Si as p,Un as m,Wt as h,Zn as g,a as _,bn as v,br as y,ct as b,hi as x,i as S,it as C,k as w,kt as T,n as E,t as D,tr as O,ut as k,wi as A,wt as j,yn as M,yr as N,zt as P}from"./centered-state-DJLgwvA4.js";import{U as F,c as I,n as L,r as R,t as z}from"./utils-DoBmOlX3.js";import{a as ee,d as B,i as V,l as H,n as te,o as ne,s as re,u as ie}from"./use-now-sqAvRMna.js";import{C as ae,D as U,_ as oe,b as se,f as ce,h as le,k as ue,m as de,u as fe}from"./editable-title-BHbHmSIK.js";import{t as pe}from"./arrow-down-DieVZxSE.js";import{n as me,o as he,t as ge}from"./thread-loading-BAuVAbcA.js";import{a as _e,s as ve}from"./popover-BRq6QnwI.js";import{t as ye}from"./chevron-right-B3Ta8VKK.js";import{i as be,n as xe,r as Se,t as Ce}from"./run-header-CxdaA86t.js";import{m as we}from"./dropdown-menu-B7HeKCfN.js";import{n as Te,t as Ee}from"./trash-2-_vwSMdPG.js";import{c as De,n as Oe,o as ke,s as Ae,t as je}from"./picker-pill-DNB9ETjS.js";import{t as Me}from"./file-text-DV1gE2L6.js";import{t as Ne}from"./git-pull-request-BBEDdTLK.js";import{t as Pe}from"./loader-circle-Cwgo6onL.js";import{a as Fe,i as Ie,s as Le}from"./new-task-form-CQODCzBP.js";import{t as Re}from"./search-x-BNLFOxI6.js";import{u as ze}from"./command-BvGGv2_u.js";import{t as Be}from"./square-terminal-C7KCPznz.js";import{n as Ve,r as He,t as Ue}from"./collapsible-BcKvItwg.js";import{t as W}from"./project-router-I8Pbsrxy.js";import{i as We}from"./token-metrics-rVl4kXe_.js";import{t as Ge}from"./textarea-DLAfWPb0.js";import{t as Ke}from"./use-submit-shortcut-BJ10ZshV.js";import{t as qe}from"./markdown-Bnm47qUl.js";import{t as Je}from"./lib-BQXq3kEf.js";import{t as Ye}from"./zoomable-image-X81SApIg.js";import{t as Xe}from"./run-diff-CoNVGn23.js";var Ze=120;function Qe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $e(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ze?`${t.slice(0,Ze-1)}…`:t}function G(e,...t){if(Qe(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return $e(t)}}function et(e){if(!Qe(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return $e(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return $e(e.join(` `))}}function tt(e){if(!Qe(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Qe(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function nt(e){return G(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function K(e,t){return t?`${e} ${t}`:e}function rt(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:K(`Ran`,et(t)),subtitle:G(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:K(`Write`,G(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=tt(t);return{toolKind:`edit`,title:K(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:K(`Read`,G(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:K(`View image`,G(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:K(`Search`,G(t,`pattern`,`query`)),subtitle:G(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:K(`Fetch`,G(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:K(`Web search`,G(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=G(t,`subagent_type`,`subagentType`),i=G(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=G(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:G(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=G(t,`server`),n=G(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:nt(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?$e(e):`Tool`,subtitle:nt(t)}}var it=R(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),at=R(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),ot=R(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),st=R(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),ct=R(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),lt=R(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),ut=R(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),q=e(t(),1);function dt(e,t,n){let[r,i]=(0,q.useState)({key:n,value:e}),a=(0,q.useRef)(e);a.current=e;let o=(0,q.useRef)(n);o.current=n;let s=(0,q.useRef)(0),c=(0,q.useRef)(void 0),l=(0,q.useRef)(!1),u=!Object.is(r.value,e);return r.key===n?u&&c.current===void 0&&Date.now()-s.current>=t&&i({key:n,value:e}):i({key:n,value:e}),(0,q.useEffect)(()=>{if(!l.current){l.current=!0;return}clearTimeout(c.current),c.current=void 0,s.current=Date.now()},[r]),(0,q.useEffect)(()=>{if(Object.is(r.value,e)||c.current!==void 0)return;let n=Math.max(0,s.current+t-Date.now());c.current=setTimeout(()=>{c.current=void 0,s.current=Date.now(),i({key:o.current,value:a.current})},n)},[r,e,t]),(0,q.useEffect)(()=>()=>clearTimeout(c.current),[]),r.value}var ft=5,pt=120,mt=200,ht=5e3,gt=15e3,_t=[];function vt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function yt(e){let t=-1/0;for(let n of e){if(n.seq<=t)return!1;t=n.seq}return!0}function J(e){for(let t=e.length-1;t>=0;--t)if(e[t].newerCursor===void 0)return e[t]}function bt(...e){if(!e.every(yt))return vt(...e);let t=e.map(()=>0),n=[];for(;;){let r=1/0;for(let n=0;n<e.length;n+=1){let i=e[n][t[n]];i!==void 0&&i.seq<r&&(r=i.seq)}if(r===1/0)return n;let i;for(let n=0;n<e.length;n+=1){let a=e[n][t[n]];a?.seq===r&&(i=a,t[n]=t[n]+1)}i!==void 0&&n.push(i)}}function xt(e,t,n=-1/0){let r=new Set(t.map(({seq:e})=>e)),i=new Map;for(let e of t){if(e.type!==`item.updated`&&e.type!==`item.completed`)continue;let t=H(e);t!==void 0&&i.set(t,Math.max(i.get(t)??-1/0,e.seq))}return e.filter(e=>{if(r.has(e.seq)||e.seq<=n&&e.type!==`item.delta`&&e.type!==`item.updated`)return!0;if(e.type!==`item.delta`&&e.type!==`item.updated`)return!1;let t=i.get(H(e)??``);return t!==void 0&&t>e.seq}).map(({seq:e})=>e)}function St(e,t){if(t.length===0)return e.slice();let n=e.at(-1)?.seq??-1/0,r=-1/0;for(let n of t){if(n.seq<=r)return vt(e,t);r=n.seq}return e.length===0||t[0].seq>n?[...e,...t]:bt(e,t)}function Ct(e){let t=I(),n=r(),i=[`run-history`,t,e],o=[`run-history-context`,t,e],s=[`run-history-tail`,t,e],c=a({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>N(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:ft,retry:1}),u=l({queryKey:o,enabled:e!==void 0,queryFn:({signal:t})=>y(e,{signal:t}),retry:1}),d=c.isError&&c.data===void 0&&!c.isFetchPreviousPageError&&!c.isFetchNextPageError&&!c.isRefetchError,f=u.isError&&u.data===void 0&&!u.isRefetchError,p=c.data?.pages??[],m=(0,q.useRef)(void 0),h=`${t}\0${e??``}`,g=(0,q.useRef)({key:h,fallbackLatched:!1}),_=(0,q.useRef)(Promise.resolve()),v=(0,q.useRef)(0);g.current.key!==h&&(g.current={key:h,fallbackLatched:!1},_.current=Promise.resolve(),v.current+=1,m.current=void 0),(d||f)&&(g.current.fallbackLatched=!0);let b=g.current.fallbackLatched,x=(0,q.useCallback)(e=>{let t=_.current,n;return _.current=new Promise(e=>{n=e}),t.then(e).finally(n)},[]),S=J(p),C=p.length>0?n.getQueryData(s):void 0;S&&(!m.current||S.asOfSeq>=m.current.asOfSeq)?m.current=S:C&&(!m.current||C.asOfSeq>=m.current.asOfSeq)&&(m.current=C);let w=m.current??S??C??(p.length>0?p.at(-1):void 0),T=(0,q.useRef)(void 0),E=(0,q.useCallback)(async t=>{if(e===void 0||T.current===h)return!1;T.current=h;let r=v.current,a=new AbortController,o;try{let c=await Promise.race([N(e,void 0,{signal:a.signal}),new Promise((e,t)=>{o=setTimeout(()=>{a.abort(),t(Error(`history compaction timed out`))},gt)})]);if(g.current.key!==h||v.current!==r)return!1;let l=n.getQueryData(i),u=J(l?.pages??[]),d=n.getQueryData(s);if(Math.max(u?.asOfSeq??-1/0,d?.asOfSeq??-1/0,m.current?.asOfSeq??-1/0)>=c.asOfSeq)return!1;let f=l?(()=>{let e=[...l.pages],t=[...l.pageParams],n=u?e.indexOf(u):-1;for(n>=0?(e[n]=c,t[n]=void 0):(e.push(c),t.push(void 0));e.length>ft;)e.shift(),t.shift();return{pages:e,pageParams:t}})():{pages:[c],pageParams:[void 0]};return n.setQueryData(i,f),n.setQueryData(s,c),m.current=c,xt(t,f.pages.flatMap(e=>e.events),c.asOfSeq)}catch{return!1}finally{clearTimeout(o),a.abort(),T.current===h&&(T.current=void 0)}},[i,h,n,e,s]),D=B(w&&!b?e:void 0,w?{cursor:w.liveCursor,afterSeq:w.asOfSeq,compactWhenOver:ht,compactAt:mt,onCompact:E}:{}),O=B(b?e:void 0),k=dt(D,pt,e),A=dt(O,pt,e),j=(0,q.useRef)({runId:void 0,scope:t,events:[]});(j.current.runId!==e||j.current.scope!==t)&&(j.current={runId:e,scope:t,events:[]}),b||(j.current.events=k);let M=b?j.current.events:_t,P=(0,q.useMemo)(()=>{let e=p.map(e=>e.events);return w!==void 0&&!p.includes(w)&&e.push(w.events),vt(...e)},[w,p]);(0,q.useEffect)(()=>{let e=J(p);e&&n.setQueryData(s,e)},[p,n,e,t]);let F=(0,q.useMemo)(()=>b?bt(P,M,A):St(P,k),[b,A,M,k,P]),L=(0,q.useMemo)(()=>{if(b)return F;let e=u.data?.contextEvents??[],t=u.data?.asOfSeq??0;return bt(e,F.filter(({seq:e})=>e>t),k.filter(({seq:e})=>e<=t))},[u.data,b,k,F]),R=(0,q.useCallback)(async()=>{let e=h,t=v.current,r=J(n.getQueryData(i)?.pages??[]);r&&n.setQueryData(s,r);try{await x(()=>c.fetchPreviousPage())}finally{if(g.current.key!==e||v.current!==t)return;let r=m.current;if(!r)return;n.setQueryData(i,e=>{if(!e)return e;let t=J(e.pages),n=t?e.pages.indexOf(t):-1;if(n<0||e.pages[n].asOfSeq>=r.asOfSeq)return e;let i=[...e.pages];return i[n]=r,{...e,pages:i}})}},[x,c.fetchPreviousPage,i,n,s]),z=(0,q.useCallback)(async()=>{v.current+=1,_.current=Promise.resolve(),m.current=void 0,n.removeQueries({queryKey:s,exact:!0}),n.resetQueries({queryKey:i,exact:!0})},[i,n,s]);return{visibleEvents:F,currentEvents:L,isPending:!b&&c.isPending,contextPending:!b&&u.isPending,fallback:b,hasOlder:!b&&!!c.hasPreviousPage,isFetchingOlder:c.isFetchingPreviousPage,olderError:c.isFetchPreviousPageError?c.error instanceof Error?c.error.message:`Could not load earlier items`:void 0,loadOlder:R,jumpToLatest:z,retainedPages:p.length}}var Y=n();function wt({run:e}){let t=r(),n=i({mutationFn:()=>m(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:c.runs.detail(e.id)}),t.invalidateQueries({queryKey:c.runs.list()}),S(`This task will not resume itself`)},onError:e=>S(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let a=new Date(e.autoResumeAt);if(!Number.isFinite(a.getTime()))return null;let o=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(a);return(0,Y.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(We,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Y.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:o})]}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Y.jsx)(x,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var Tt=e=>e.kind===`tool`,Et=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Dt=(e,t,n)=>`${e} ${e===1?t:n}`;function Ot(e,t){let n=[];return e>0&&n.push(Dt(e,`file`,`files`)),t>0&&n.push(Dt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function kt(e){return`${e} earlier tool call${e===1?``:`s`}`}var At=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function jt(e){for(let t of At)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Mt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Tt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Ot(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)Tt(e)&&Et(e)&&!r.has(e.id)?o.push(e):(s(),Tt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Nt=new Map,Pt=(0,q.createContext)(null);function Ft(){return(0,q.useContext)(Pt)}function It({runId:e,children:t}){let n=(0,q.useMemo)(()=>({get:t=>Nt.get(e)?.get(t),set:(t,n)=>{let r=Nt.get(e)??new Map;r.set(t,n),Nt.set(e,r)}}),[e]);return(0,Y.jsx)(Pt.Provider,{value:n,children:t})}function Lt(e){let t=`flex w-full flex-col pb-2.5`;return e?`${t} [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`:t}function Rt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function zt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Bt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Vt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Ht(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Ut=new Map;function Wt(e,t){Ut.set(e,t)}function Gt(e){return Ut.get(e)}var Kt=new Map;function qt(e,t){Kt.set(e,t)}function Jt(e,t){let n=Kt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var Yt=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Xt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Zt=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Qt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),$t=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function X(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function en(e){let t=X(e);return t===void 0?void 0:Yt.format(t)}function tn(e){let t=X(e);return t===void 0?void 0:Xt.format(t)}var nn=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function rn(e){let t=X(e);return t===void 0?void 0:nn(t)}function an(e,t=new Date){let n=X(e);if(n===void 0)return;let r=nn(n);return r===nn(t)?`Today`:r===nn(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Zt:Qt).format(n)}function on(e,t){let n=X(e),r=X(t);if(!(n===void 0||r===void 0))return cn(Math.round((r.getTime()-n.getTime())/1e3))}function sn(e,t){let n=X(e);if(n!==void 0)return cn(Math.floor((t-n.getTime())/1e3))}function cn(e){if(e<0)return;if(e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${String(e%60).padStart(2,`0`)}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,`0`)}m`}function ln(e=1e3){let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function un({ts:e}){let t=en(e);return t===void 0?null:(0,Y.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:tn(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function dn({startedAt:e,completedAt:t}){let n=en(t);if(n===void 0)return null;let r=on(e,t);return(0,Y.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Y.jsx)(`time`,{dateTime:t,title:tn(t),children:n}),r===void 0?null:(0,Y.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function fn({ts:e}){let t=an(e),n=X(e);if(t===void 0||n===void 0)return null;let r=$t.format(n);return(0,Y.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Y.jsx)(`time`,{dateTime:rn(e),title:r,children:t}),(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function pn({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:o=`Edit message`,removeLabel:s=`Remove message`,draftRunId:c,draftSurface:l}){let u=t-n.length,[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(e),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(),y=xe(c??``,l??``,{enabled:i!==void 0&&c!==void 0&&l!==void 0}),b=`${c??``} ${l??``}`,[x,S]=(0,q.useState)(b);x!==b&&(S(b),f(!1),m(e),v(void 0)),(0,q.useEffect)(()=>{d||!y.ready||!y.hasDraft||(m(y.text),v(void 0),f(!0))},[d,y.hasDraft,y.ready,y.text]);let C=e=>{m(e),y.setText(e)},w=()=>{m(e),v(void 0),f(!0)},T=async()=>{let t=p.trim();if(!t||t===e){y.clear(),f(!1);return}g(!0),v(void 0);try{await y.submit(()=>i?.(t)??Promise.resolve()),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},E=()=>{y.clear(),f(!1)},D=async()=>{g(!0),v(void 0);try{await a?.(),y.clear()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,Y.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),E()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),T())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:E,disabled:h,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:h,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Y.jsx)(Pe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[i||a?(0,Y.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,Y.jsx)(`button`,{type:`button`,"aria-label":o,onClick:w,disabled:h,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(lt,{className:`size-3.5`})}):null,a?(0,Y.jsx)(`button`,{type:`button`,"aria-label":s,onClick:()=>void D(),disabled:h,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Ee,{className:`size-3.5`})}):null]}):null,_?(0,Y.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,(0,Y.jsx)(qe,{breaks:!0,children:e}),n.length>0?(0,Y.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>F(e.split(`/`).pop()??``)?(0,Y.jsx)(Ye,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Y.jsxs)(`a`,{href:e,download:!0,"data-slot":`user-file`,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(he,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Y.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null,r===void 0?null:(0,Y.jsx)(`span`,{className:`mt-1 flex justify-end`,children:(0,Y.jsx)(un,{ts:r})})]})}function mn({text:e}){return(0,Y.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,Y.jsx)(qe,{children:e})})}function hn({note:e}){return(0,Y.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:z(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var gn={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`};function _n({incident:e}){let t=gn[e.provider];return(0,Y.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Y.jsx)(W,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function vn({text:e}){let t=(0,q.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
-
`,1)[0]??``,r=n.length<e.length;return(0,Y.jsxs)(Ue,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Y.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(ye,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Y.jsx)(qe,{inline:!0,children:n})}),r?(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Y.jsx)(He,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Y.jsx)(Ve,{children:(0,Y.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Y.jsx)(qe,{children:e})})})]})}function yn({since:e,lastActivityAt:t}={}){let n=ln(),r=sn(e,n),i=sn(t,n),a=en(t);return(0,Y.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-1 text-[13px] text-soft-foreground`,children:[(0,Y.jsx)(Pe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`}),r===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`working-elapsed`,title:`Started ${tn(e)}`,className:`font-mono text-xs tabular-nums`,children:r}),i!==void 0&&a!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`working-last-activity`,title:tn(t),className:`text-xs`,children:[`· last activity `,a,` (`,i,` ago)`]}):null]})}var bn={read:Me,edit:lt,delete:Ee,move:ot,search:ze,execute:Be,think:it,fetch:U,task:ue,plan:st,other:ut},xn=e=>e.split(`
|
|
3
|
-
`).length;function Sn({text:e,streaming:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null),a=(0,q.useRef)(!0);(0,q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=xn(e),s=!t&&!n&&o>12;return(0,Y.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Vt(e.currentTarget)}:void 0,className:z(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Y.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Y.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Cn({diffs:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,Y.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...wn(e.oldText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...wn(e.newText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
-
`).map((e,t)=>(0,Y.jsx)(Tn,{text:e},t))})]},`${e.path}:${t}`))})}function wn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
-
`)}function Tn({text:e}){return(0,Y.jsx)(`span`,{className:z(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function En(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Dn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=Ft(),[a,o]=(0,q.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??En(e)),{verb:d,detail:f}=jt(e.title),p=bn[e.toolKind]??ut;return(0,Y.jsxs)(Ue,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:z(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,Y.jsxs)(He,{disabled:!l,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,Y.jsx)(ye,{"aria-hidden":!0,className:z(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,Y.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:z(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,Y.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,Y.jsx)(Pe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,Y.jsx)(`span`,{"data-slot":`tool-exit`,className:z(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,Y.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,Y.jsx)(Cn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,Y.jsx)(Sn,{text:e.output,streaming:c}):null,t.length>0?(0,Y.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function On({group:e,scope:t}){return(0,Y.jsxs)(Ue,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,Y.jsxs)(He,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(ye,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,Y.jsx)(Ve,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,Y.jsx)(Dn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function kn({count:e,children:t}){return(0,Y.jsxs)(Ue,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,Y.jsxs)(He,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(ye,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),kt(e)]}),(0,Y.jsx)(Ve,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function An({image:e}){return(0,Y.jsx)(Ye,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function jn(e){return e===`running`||e===`waiting`||e===`queued`?`live`:`continue`}function Mn(e,t){let n=r(),{mutateAsync:i}=h(e.id),{continueWith:a}=t;return(0,q.useCallback)(async(t,r)=>{let o=e=>e===`live`?i({text:t,images:r}):a(t,r),s=jn(e.status);try{return await o(s)}catch(i){if(!(i instanceof d)||i.status!==409)throw i;let a;try{a=await n.fetchQuery({...u(e.id),staleTime:0})}catch{throw i}let c=jn(a.status);if(c===s||c===`live`&&t.trim()===``&&r.length===0||c===`continue`&&de(a)===void 0)throw i;return await o(c)}},[a,n,e.id,e.status,i])}function Nn(e){let t=r(),n=oe(e).continueRun,a=o(),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),h=be(e,s),{runners:_,canContinue:v,currentRunner:y,runner:b}=h,x=f(b,n),S=a.data?.modelsLocked===!0,C=b!==y,w=!S&&!C&&e.model?{...a.data?.defaultModels,[b]:e.model}:a.data?.defaultModels,T=S?null:u,E=Fe(b,x.data,[T,w?.[b]]),D=Le(T,b,w,x.data),{accounts:O,repoAccount:k}=Ae(),A=[...e.steps].reverse().find(e=>e.profileId)?.profileId??e.agentProfile??`default`,j=C?k:{...k,[y]:A},M=O.some(e=>e.provider===b&&e.id===p)?p:null,N=i({mutationFn:({text:t,images:n})=>v?g(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:h.runnerOverride,model:!S&&u!==null?D:void 0,agentProfile:M??void 0}):Promise.reject(Error(h.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:c.runs.all})});return{available:n,canContinue:v,reason:h.reason,providerPending:h.providerPending,pills:(0,Y.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[_.length>1||_.some(e=>ke(O,e))?(0,Y.jsx)(Oe,{runners:_,value:b,accounts:O,account:M,repoAccount:j,onPick:(e,t)=>{m(t),e!==b&&(l(e),d(null))}}):null,(0,Y.jsx)(je,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:E.find(e=>e.id===D)?.label??`auto`,value:D,readOnly:S,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>d(e),options:E.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ie(b,x.data,x.isError)})]}),continueWith:(e,t)=>N.mutateAsync({text:e,images:t})}}var Pn=120,Fn=e=>e!==`pending`&&e!==`running`,In=e=>e.kind===`tool`&&e.toolKind===`task`,Z=e=>In(e)&&e.parentItemId===void 0,Ln=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Rn(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Z(e)&&t.has(e.id)))return n;return 0}function zn(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Bn(e){if(e.kind===`tool`)return Vn(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
6
|
-
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return Vn(n)}}}function Vn(e){return e.length>Pn?`${e.slice(0,Pn-1).trimEnd()}…`:e}function Hn(e,t=!1){let n=qn(e,e=>e.items.some(Z));if(n===-1)return[];let r=e=>!t&&!Fn(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Z);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Z)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?Rn(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Ln(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Un(e,c.get(e.id)??[],t))}function Un(e,t,n){let r={id:e.id,title:jt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=zn(e);i!==void 0&&(r.agentType=i),n&&!Fn(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Bn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Wn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Gn(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Kn(e){return e.find(e=>!Fn(e.status))??e[0]}function qn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function Jn(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Z(e));if(i!==void 0)return Un(i,Yn(e,t),n)}}function Yn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Z(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Ln(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Xn=new Map,Zn=!1;function Qn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,q.useState)(()=>Xn.get(e)??Zn);if(t.length===0)return null;let{done:a,total:o}=Wn(t),s=Kn(t);return(0,Y.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Xn.set(e,!t),!t)),"aria-expanded":r,className:z(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(ue,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,Y.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Gn(s)]}):null,(0,Y.jsx)(ve,{"aria-hidden":!0,className:z(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Y.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,Y.jsx)($n,{agent:e,onSelect:n},e.id))}):null]})}function $n({agent:e,onSelect:t}){let n=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(er,{status:e.status,stalled:e.stalled===!0}),(0,Y.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,Y.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Gn(e)}),(0,Y.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Y.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,Y.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function er({status:e,stalled:t=!1}){return t?(0,Y.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var tr=new Map;function nr(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function rr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function ir(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function ar({runId:e,entries:t,settled:n=!1}){let[r,i]=(0,q.useState)(()=>tr.get(e)??nr());if(t.length===0)return null;let{done:a,total:o}=rr(t),s=n?void 0:ir(t),c=n&&a<o;return(0,Y.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":r?`open`:`collapsed`,"data-settled":n?`true`:void 0,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-0.5 md:h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(tr.set(e,!t),!t)),"aria-expanded":r,className:z(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,Y.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),c?(0,Y.jsx)(`span`,{"data-slot":`plan-unfinished`,className:`shrink-0 text-soft-foreground`,children:`· left unfinished`}):null,!r&&s!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,s.activeForm??s.content]}):null,(0,Y.jsx)(ve,{"aria-hidden":!0,className:z(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Y.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,Y.jsx)(or,{entry:e,settled:n},`${t}:${e.content}`))}):null]})}function or({entry:e,settled:t}){let n=t&&e.status===`in_progress`?`pending`:e.status;return(0,Y.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:z(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,n===`completed`&&`text-soft-foreground line-through`,n===`in_progress`&&`font-medium`,n===`pending`&&`text-muted-foreground`,n===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,Y.jsx)(sr,{status:n}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),n===`in_progress`?(0,Y.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function sr({status:e}){return e===`cancelled`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Y.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Y.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function cr(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!cr(e[n],t[n]))return!1;return!0}if(!lr(e)||!lr(t))return!1;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!cr(e[r],t[r]))return!1;return!0}function lr(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(){return typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`overflow-anchor`,`auto`)}function dr(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,q.useRef)(null),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),d=(0,q.useRef)(!0),f=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,q.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,q.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=Gt(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,q.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,q.useCallback)(()=>{d.current&&g()},[g]),b=(0,q.useRef)(!1),x=(0,q.useRef)(!1),S=(0,q.useRef)(void 0),C=(0,q.useRef)(!1),w=(0,q.useRef)(!1),T=(0,q.useRef)(!1),E=(0,q.useRef)(void 0),D=(0,q.useRef)(0),O=(0,q.useRef)(a);O.current=a;let k=(0,q.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),A=(0,q.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=zt(i,k(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:O.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(Bt(e.scrollTop,i,a,k(e),r))}b.current=!1})})},[k,r,h]);(0,q.useEffect)(()=>()=>clearTimeout(S.current),[]);let j=(0,q.useCallback)(()=>{o.current&&(f.current=null,d.current=!0,(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{let e=o.current;e?.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`})})}))},[i]);return(0,q.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,q.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=!ur(),i=(e,t)=>{if(typeof document.elementsFromPoint==`function`){let n=document.elementsFromPoint(t.left+t.width/2,t.top+1).map(e=>e.closest(`[data-slot="thread-row"][data-row-key]`)).find(t=>t!==null&&e.contains(t));if(n){let e=n.getBoundingClientRect();return{key:n.dataset.rowKey,top:e.top,bottom:e.bottom}}return}return k(e).find(({bottom:e})=>e>t.top)},a=(e,t)=>{let n=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(t):t.replace(/["\\]/g,`\\$&`),r=e.querySelector(`[data-slot="thread-row"][data-row-key="${n}"]`);if(!r)return;let i=r.getBoundingClientRect();return{key:t,top:i.top,bottom:i.bottom}},c=()=>{!r||d.current||f.current!==null||D.current===0&&(D.current=requestAnimationFrame(()=>{D.current=0;let e=o.current;if(!e||d.current)return;let t=e.getBoundingClientRect(),n=i(e,t);E.current=n===void 0?void 0:{key:n.key,offset:n.top-t.top}}))},l=()=>{let e=E.current;if(!r||e===void 0||m.current)return;let n=t.getBoundingClientRect().top,i=a(t,e.key),o=i===void 0?t.scrollTop:t.scrollTop+(i.top-n-e.offset);Math.abs(o-t.scrollTop)>=1&&h(o)},p=0,_=null,v=!1,y=t.scrollTop,b=()=>{f.current=null,d.current=!1,p=0},O=()=>{p=Date.now()},j=e=>{if(e.deltaY<0){b();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&Rt(t)&&A()}else O()},M=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(b(),!e.repeat&&Rt(t)&&A()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&O()},N=()=>{v=!0,T.current=!1,y=t.scrollTop,Vt(t,80)||(b(),O())},P=()=>{v=!1},F=e=>{C.current=!1,w.current=!0,_=e.touches[0]?.clientY??null},I=()=>{w.current&&(w.current=!1,d.current&&f.current===null&&g())},L=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(_!==null&&n>_+1?(b(),!C.current&&Rt(t)&&(C.current=!0,A())):_!==null&&n<_-1&&O(),_=n)},R=()=>{v&&!T.current&&t.scrollTop<y&&Rt(t)&&(T.current=!0,A()),y=t.scrollTop;let n=Vt(t,80);n&&f.current===null&&(d.current||Date.now()-p<2e3)&&(d.current=!0),u(!n),f.current===null&&Wt(e,{top:t.scrollTop,atBottom:n}),c()};t.addEventListener(`scroll`,R,{passive:!0}),t.addEventListener(`wheel`,j,{passive:!0}),t.addEventListener(`touchstart`,F,{passive:!0}),t.addEventListener(`touchmove`,L,{passive:!0}),window.addEventListener(`touchend`,I,{passive:!0}),window.addEventListener(`touchcancel`,I,{passive:!0}),t.addEventListener(`pointerdown`,N,{passive:!0}),window.addEventListener(`pointerup`,P,{passive:!0}),t.addEventListener(`keydown`,M);let z;return typeof ResizeObserver<`u`&&(z=new ResizeObserver(()=>{let e=f.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;h(Math.min(e,n)),n>=e&&(f.current=null,c())}else d.current?w.current||g():l()}),z.observe(n)),c(),()=>{cancelAnimationFrame(D.current),D.current=0,E.current=void 0,t.removeEventListener(`scroll`,R),t.removeEventListener(`wheel`,j),t.removeEventListener(`touchstart`,F),t.removeEventListener(`touchmove`,L),window.removeEventListener(`touchend`,I),window.removeEventListener(`touchcancel`,I),t.removeEventListener(`pointerdown`,N),window.removeEventListener(`pointerup`,P),t.removeEventListener(`keydown`,M),z?.disconnect()}},[e,s,A,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:j,loadOlder:A,restickIfStuck:y}}function fr({runId:e,rows:t,mode:n,controls:r}){if(n===`virtual`)return(0,Y.jsx)(pr,{runId:e,rows:t,controls:r});let i=Lt(ur());return(0,Y.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,Y.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:i,children:e.node},e.key))})}function pr({runId:e,rows:t,controls:n}){let r=(0,q.useRef)(null),[i]=(0,q.useState)(()=>Jt(e,t.length)),a=(0,q.useRef)(t.length);a.current=t.length;let o=(0,q.useRef)(null),s=(0,q.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(qt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,Y.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,Y.jsx)(Je,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,Y.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function mr({onJump:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,Y.jsx)(pe,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function hr(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images,...e.userMessage.ts===void 0?{}:{ts:e.userMessage.ts}}},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.completed?.ts===void 0?{}:{completedAt:e.completed.ts},entries:e.items});return n}function gr(e,t){return[{id:`agent:${e}`,entries:t}]}function _r(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function vr(e,t){let n=[],r;for(let t of e){let e=_r(t),i=rn(e);i!==void 0&&e!==void 0&&(r===void 0||i>r)&&(r!==void 0&&n.push({key:`${t.id}:day-separator`,scope:t.id,content:{kind:`day-separator`,ts:e}}),r=i),t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of Mt([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}});t.completedAt!==void 0&&n.push({key:`${t.id}:turn-time`,scope:t.id,content:{kind:`turn-time`,completedAt:t.completedAt,...t.startedAt===void 0?{}:{startedAt:t.startedAt}}})}return n}function yr({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c,rowModels:l}){let u=(0,q.useMemo)(()=>l??vr(n,e),[l,n,e]),d=dr(`${e}:${t}`,{surface:r}),f=s??d,p=(0,q.useMemo)(()=>u.map(t=>({key:t.key,node:(0,Y.jsx)(xr,{runId:e,row:t,actions:o?.[t.key],renderAsk:a})})),[o,a,u,e]),m=c??Ht(``,p.length),h=p.length===0?i??null:(0,Y.jsx)(fr,{runId:`${e}:${t}`,rows:p,mode:m,controls:f});return(0,Y.jsx)(It,{runId:e,children:r===`panel`?(0,Y.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:h}),f.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Y.jsx)(mr,{onJump:f.jumpToLatest})}):null]}):h})}function br({runId:e,row:t,actions:n,renderAsk:r}){return Sr(e,t,n,r)}var xr=(0,q.memo)(br,(e,t)=>e.runId===t.runId&&e.actions===t.actions&&e.renderAsk===t.renderAsk&&cr(e.row,t.row));function Sr(e,t,n,r){switch(t.content.kind){case`user-message`:return(0,Y.jsx)(Cr,{runId:e,message:t.content.message,actions:n});case`day-separator`:return(0,Y.jsx)(fn,{ts:t.content.ts});case`turn-time`:return(0,Y.jsx)(dn,{completedAt:t.content.completedAt,...t.content.startedAt===void 0?{}:{startedAt:t.content.startedAt}});case`block`:return(0,Y.jsx)(wr,{block:t.content.block,scope:t.scope,renderAsk:r});default:return Dr(t.content)}}function Cr({runId:e,message:t,actions:n}){return(0,Y.jsx)(pn,{text:t.text,imageCount:t.imageCount,images:t.images,...t.ts===void 0?{}:{ts:t.ts},onEdit:n?.onEdit,onRemove:n?.onRemove,editLabel:n?.editLabel,removeLabel:n?.removeLabel,draftRunId:n?.draftSurface===void 0?void 0:e,draftSurface:n?.draftSurface})}var wr=(0,q.memo)(function e({block:t,scope:n,renderAsk:r}){switch(t.kind){case`entry`:return(0,Y.jsx)(Er,{entry:t.entry,scope:n,renderAsk:r});case`tool-card`:return(0,Y.jsx)(Dn,{item:t.item,nested:t.children,cacheKey:`${n}:${t.id}`,renderNested:(e,t)=>(0,Y.jsx)(Tr,{entries:e,scope:t,renderAsk:r})});case`context-group`:return(0,Y.jsx)(On,{group:t,scope:n});case`streak`:return(0,Y.jsx)(kn,{count:t.count,children:t.blocks.map(t=>(0,Y.jsx)(e,{block:t,scope:n,renderAsk:r},t.id))});default:return Dr(t)}},Or);function Tr({entries:e,scope:t,renderAsk:n}){return Mt([...e]).map(e=>(0,Y.jsx)(wr,{block:e,scope:t,renderAsk:n},e.id))}function Er({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Y.jsx)(mn,{text:e.text}):(0,Y.jsx)(pn,{text:e.text});case`reasoning`:return(0,Y.jsx)(vn,{text:e.text});case`tool`:return(0,Y.jsx)(Dn,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,Y.jsx)(hn,{note:e});case`image`:return(0,Y.jsx)(An,{image:e});case`ask`:return n===void 0?(0,Y.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,Y.jsx)(_n,{incident:e});default:return Dr(e)}}function Dr(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Or(e,t){return e.scope===t.scope&&Ar(e.block,t.block)&&(!kr(t.block)||e.renderAsk===t.renderAsk)}function kr(e){return e.kind===`entry`?e.entry.kind===`ask`:e.kind===`tool-card`?e.children.some(e=>e.kind===`ask`):e.kind!==`context-group`&&e.blocks.some(kr)}function Ar(e,t){if(e.kind!==t.kind||e.id!==t.id)return!1;switch(t.kind){case`entry`:return Mr(e.kind===`entry`?e.entry:void 0,t.entry);case`tool-card`:return e.kind===`tool-card`&&Br(e.item,t.item)&&jr(e.children,t.children);case`context-group`:return e.kind===`context-group`&&e.files===t.files&&e.searches===t.searches&&e.label===t.label&&e.tools.length===t.tools.length&&e.tools.every((e,n)=>Br(e,t.tools[n]));case`streak`:return e.kind===`streak`&&e.count===t.count&&e.blocks.length===t.blocks.length&&e.blocks.every((e,n)=>Ar(e,t.blocks[n]));default:return!1}}function jr(e,t){return e.length===t.length&&e.every((e,n)=>Mr(e,t[n]))}function Mr(e,t){if(e===void 0||e.kind!==t.kind||e.id!==t.id)return!1;switch(t.kind){case`message`:return e.kind===`message`&&Q(e,t,Nr);case`reasoning`:return e.kind===`reasoning`&&Q(e,t,Pr);case`tool`:return e.kind===`tool`&&Br(e,t);case`note`:return e.kind===`note`&&Q(e,t,Fr);case`image`:return e.kind===`image`&&Q(e,t,Ir);case`ask`:return e.kind===`ask`&&Q(e,t,Lr);case`provider-auth-required`:return e.kind===`provider-auth-required`&&Q(e,t,Rr);default:return!1}}var Nr={kind:!0,id:!0,role:!0,text:!0,phase:!0,parentItemId:!0},Pr={kind:!0,id:!0,text:!0,parentItemId:!0},Fr={kind:!0,id:!0,text:!0,tone:!0},Ir={kind:!0,id:!0,url:!0,name:!0},Lr={kind:!0,id:!0,questions:!0,resolved:!0,answer:!0},Rr={kind:!0,id:!0,provider:!0,authFailureId:!0},zr={kind:!0,id:!0,name:!0,toolKind:!0,title:!0,status:!0,input:!0,output:!0,error:!0,diffs:!0,locations:!0,exitCode:!0,parentItemId:!0};function Q(e,t,n){return Object.keys(n).every(n=>e[n]===t[n])}function Br(e,t){return Q(e,t,zr)}function Vr({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,Y.jsx)(te,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,Y.jsx)(V,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,Y.jsx)(Hr,{runId:e,renderAsk:t,agent:n,entries:r})})})}function Hr({runId:e,renderAsk:t,agent:n,entries:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(ne,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Y.jsxs)(re,{className:`flex min-w-0 items-center gap-2 text-[15px]`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,Y.jsxs)(ee,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(Ur,{status:n.status}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Y.jsx)(yr,{runId:e,viewId:`agent:${n.id}`,sections:gr(n.id,r),mode:`panel`,renderAsk:t,empty:(0,Y.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function Ur({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Y.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:z(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function Wr({run:e}){return(0,Y.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,Y.jsx)(De,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,Y.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,Y.jsx)(Xe,{runId:e.id}),(0,Y.jsx)(Gr,{run:e})]})}function Gr({run:e}){let t=r(),n=(0,q.useRef)(null),a=xe(e.id,`review-notes`),o=a.text,s=a.setText,[l,u]=(0,q.useState)(null),f=Se(e.id),p=be(e),m=()=>t.invalidateQueries({queryKey:c.runs.all}),h=i({mutationFn:async t=>p.canContinue?a.submit(()=>g(e.id,{text:`Review feedback:\n${t}`,runner:p.runnerOverride})):null,onSuccess:e=>{e!==null&&m()},onError:e=>S(e.message,{tone:`danger`})}),v=i({mutationFn:()=>O(e.id),onSuccess:e=>{S(`Draft PR created — ${e.url}`),m()},onError:e=>{e instanceof d&&e.manual!==void 0&&u(e.manual),S(e.message,{tone:`danger`})}}),y=()=>{let e=o.trim();if(e.length===0){S(`Write what to change first.`),n.current?.focus();return}h.mutate(e)};return(0,Y.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(Ge,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{Ke({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`min-h-[52px] text-[13px]`}),p.canContinue?null:(0,Y.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:p.reason}),p.providerPending?null:(0,Y.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(_,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:p.reason??`Send the notes back into the agent's session`,"aria-describedby":p.canContinue?void 0:`review-provider-guidance`,disabled:h.isPending||!p.canContinue,onClick:y,children:[(0,Y.jsx)(at,{"aria-hidden":`true`}),`Send back`]}),L(e.pullRequestUrl)?(0,Y.jsx)(_,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`}),`PR ↗`]})}):(0,Y.jsxs)(_,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:v.isPending,onClick:()=>v.mutate(),children:[(0,Y.jsx)(Ne,{"aria-hidden":`true`}),`Draft PR`]}),(0,Y.jsxs)(_,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:ce(`review`),disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),`Accept`]})]}),l===null?null:(0,Y.jsx)(Kr,{command:l})]})}function Kr({command:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(Te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function qr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Jr=1500;function Yr({status:e}){let t=(0,q.useRef)(e),[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||qr())return;r(!0);let i=setTimeout(()=>r(!1),Jr);return()=>clearTimeout(i)},[e]),n?(0,Y.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,Y.jsx)(E,{}),(0,Y.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,Y.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}function Xr(e,t){return`${e.header}: ${t.join(`, `)}`}function Zr({ask:e,run:t}){return e.resolved?(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,Y.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,Y.jsx)(Qr,{ask:e,run:t})}function Qr({ask:e,run:t}){let n=fe(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,q.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>Xr(e,o[t]??[])).join(`
|
|
7
|
-
`)),d=n.mode===`resume`;return(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,Y.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,Y.jsx)($r,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(Xr(e,i)):c(t,i))}},e.id??t))}),a?d?(0,Y.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,Y.jsx)(_,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,Y.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,Y.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:n.reason}),(0,Y.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,Y.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,Y.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function $r({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,Y.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,Y.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,Y.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,Y.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,Y.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:z(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,Y.jsx)(`span`,{"aria-hidden":!0,className:z(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,Y.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var ei=2e3;function ti(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return{lastEnd:t,lastStart:n}}function ni(e){let{lastEnd:t,lastStart:n}=ti(e);return t>n?t:0}function ri(e){let{lastEnd:t,lastStart:n}=ti(e);return n>t?n:0}function ii(e,t){let n=r(),i=(0,q.useMemo)(()=>ni(t),[t]),a=(0,q.useMemo)(()=>ri(t),[t]),o=e?.id,s=e?.status;(0,q.useEffect)(()=>{if(o===void 0||s===void 0||s===`queued`||!(s===`running`||s===`waiting`?i>0:a>0))return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:c.runs.detail(o)}),n.invalidateQueries({queryKey:c.runs.list()})},ei);return()=>clearTimeout(e)},[i,a,o,s,n])}function ai(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function oi(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function si(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function ci(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function li(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function ui(e){return e===`claude`||e===`codex`||e===`opencode`||e===`cursor`||e===`pi`?e:void 0}var di=e=>ci(e)&&typeof e.header==`string`&&Array.isArray(e.options);function fi(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
|
|
8
|
-
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
9
|
-
`):n}function pi(e){let t=e=>fi(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function mi(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var hi=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,gi=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function _i(e){if(!ci(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!ci(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:gi.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function vi(e,t={}){let n=[],r=new Map,i,a=0,o,s,c=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},l=()=>n.at(-1)??c(),u=(e,t)=>ie(e.stepId,t),d=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(s=li(t.ts)??s,t.type){case`user-message`:{let e=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=c(t.seq),r=li(t.ts);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...r===void 0?{}:{ts:r}},r!==void 0&&(n.startedAt=r);break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1),i=r&&r.turnId===void 0&&!r.v2Items?r:c(t.seq);i.turnId=e;let a=li(t.ts);i.startedAt===void 0&&a!==void 0&&(i.startedAt=a);break}case`turn.completed`:{let e=$(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);if(i){let e=li(t.ts);i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...e===void 0?{}:{ts:e}}}break}case`item.started`:case`item.updated`:case`item.completed`:{if(!ci(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=u(t,i.id);d(r.get(a)?.turn??l(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(u(t,e)),i=$(t.delta)??``;if(!n||i===``||!hi(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=l(),n=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=l();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(yi.has(n))break;let i=rt(n,t.input);if(i.toolKind===`plan`){let n=_i(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get($(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=mi(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:`dim`;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=$(t.message)??``;if(e===``)break;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(t.message)??``;if(e===``)break;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=$(t.error)?` — ${$(t.error)}`:``;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:$(t.text)??``,exitCode:n};l().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=ui(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;l().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(t.name);r!==void 0&&(n.name=r),l().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(l().planEntries=t.entries);break;case`session.ended`:i={reason:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions,r=n.every(di)?n:n.filter(di);if(r.length===0)break;let i={kind:`ask`,id:e,questions:r,resolved:!1};l().entries.push({origin:`meta`,entry:i}),o=i;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(fi(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(fi(e.entry.text,!0).trim()))),pi(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:fi(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i},...s===void 0?{}:{lastEventAt:s}}}var yi=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function bi(){let{id:e}=A(),t=T(e),n=Ct(e),r=t.data?.status,i=(0,q.useMemo)(()=>vi(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,q.useMemo)(()=>vi(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,q.useRef)(void 0),s=(0,q.useCallback)(e=>{o.current=e},[]),{mutate:c}=C();if((0,q.useEffect)(()=>{t.data&&o.current!==t.data.id&&ae(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),ii(t.data,n.visibleEvents),t.isPending)return(0,Y.jsx)(ge,{});if(t.isError){let e=t.error instanceof d&&t.error.status===404;return(0,Y.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(D,{icon:e?(0,Y.jsx)(Re,{}):(0,Y.jsx)(ct,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,Y.jsx)(_,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(W,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,Y.jsx)(ge,{}):(0,Y.jsx)(xi,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}function xi({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){let a=si(e.status,e.error),o=(0,q.useCallback)(()=>i?.(e.id),[i,e.id]),c=ai(n),l=c!==void 0&&c.length>0?rr(c):void 0,u=e.status===`running`||e.status===`waiting`,d=e.status===`queued`,f=Nn(e),m=!u&&!d&&f.available,h=m&&f.canContinue,g=!u&&e.status!==`queued`,_=(0,q.useMemo)(()=>Hn(n.turns,g),[n.turns,g]),[y,x]=(0,q.useState)(void 0),[S,C]=(0,q.useState)(e.id);S!==e.id&&(C(e.id),x(void 0));let w=(0,q.useMemo)(()=>y===void 0?void 0:Jn(n.turns,y,g),[n.turns,y,g]),T=(0,q.useMemo)(()=>y===void 0?[]:Yn(n.turns,y),[n.turns,y]),E=Mn(e,f),D=xe(e.id,`composer`),O=se(e),A=u&&!O.usable,N=m&&!f.canContinue,P=A||N,F=A?O.reason:f.reason,{mutateAsync:I}=b(e.id),{mutateAsync:R}=s(e.id),{mutateAsync:ee}=j(e.id),B=(0,q.useMemo)(()=>d?{onEditTask:async e=>{await I({task:e})},onEditMessage:(e,t)=>R({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ee(e).then(()=>void 0)}:void 0,[d,I,R,ee]),V=(0,q.useMemo)(()=>hr(e,t),[e,t]),H=(0,q.useMemo)(()=>vr(V,e.id),[V,e.id]),te=(0,q.useCallback)(t=>(0,Y.jsx)(Zr,{ask:t,run:e}),[e]),ne=(0,q.useMemo)(()=>{if(B===void 0)return;let t={task:{onEdit:B.onEditTask,editLabel:`Edit the prompt`,draftSurface:`task-prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>B.onEditMessage(n.id,e),onRemove:()=>B.onRemoveMessage(n.id),draftSurface:`message:${n.id}`};return t},[B,e.queuedMessages]),re=M(e,k()),{search:ie}=p(),ae=Ht(ie,H.length),U=dr(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:H.map(({key:e})=>e)});return _e(U.restickIfStuck),(0,Y.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(Ce,{run:e,planTally:l,onMarkedUnread:o,continuationEngine:h?f.pills:void 0}),(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-3 py-3 md:gap-3.5 md:px-6 md:py-5`,children:[r?(0,Y.jsx)(Si,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:U.loadOlder}):null,(0,Y.jsx)(yr,{runId:e.id,viewId:`main`,sections:V,mode:`document`,renderAsk:te,messageActions:ne,scrollControls:U,renderMode:ae,rowModels:H}),t.turns.length===0?e.status===`queued`?(0,Y.jsx)(wi,{run:e}):(0,Y.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,Y.jsx)(yn,{since:Ci(e,n),lastActivityAt:n.lastEventAt}):null,a&&a.state===`closed`?(0,Y.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":a.state,className:z(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,a.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[a.label,L(v(e))?(0,Y.jsx)(`a`,{"data-slot":`pr-link`,href:v(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,L(re)?(0,Y.jsx)(`a`,{"data-slot":`issue-link`,href:re,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,Y.jsx)(Wr,{run:e}):null]}),(0,Y.jsx)(Yr,{status:e.status}),(0,Y.jsx)(Vr,{runId:e.id,renderAsk:te,agent:w,entries:T,onClose:()=>x(void 0)}),(0,Y.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-3 pt-1 pb-2 max-md:border-t max-md:border-border md:px-6 md:pt-1.5 md:pb-4`,children:[U.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,Y.jsx)(mr,{onJump:U.jumpToLatest})}):null,(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 md:gap-2.5`,children:[(0,Y.jsx)(Qn,{runId:e.id,agents:_,onSelect:x},`agents:${e.id}`),c!==void 0&&c.length>0?(0,Y.jsx)(ar,{runId:e.id,entries:c,settled:g},e.id):null,(0,Y.jsx)(wt,{run:e}),e.status===`waiting`?(0,Y.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(We,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,d?(0,Y.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(We,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,Y.jsx)(me,{value:D.text,onValueChange:D.setText,images:D.images,onImagesChange:D.setImages,onSubmit:(e,t)=>D.submit(()=>E(e,t)),disabled:P||!u&&!d&&!h,disabledReason:P?F:`Session closed — no session to resume.`,footerEnd:P&&!f.providerPending?(0,Y.jsx)(W,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):h?f.pills:void 0,allowEmptySubmit:h,sendAriaLabel:h?`Continue`:`Send`,placeholder:d?`Add to the prompt — sent when the run starts…`:h?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>oi(t)})]})]})]})}function Si({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,Y.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,Y.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Y.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,Y.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Ci(e,t){let n=t.turns.at(-1);return n===void 0?e.startedAt:n.completed===void 0?n.startedAt??e.startedAt:n.completed.ts??e.startedAt}function wi({run:e}){let t=le(P().data??[],e.id);return(0,Y.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Y.jsx)(We,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,Y.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{bi as TaskThreadRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Hr as i,Kt as a,M as o,a as s,en as ee,i as c,k as te,t as l}from"./centered-state-DJLgwvA4.js";import{r as u,t as d}from"./utils-DoBmOlX3.js";import{t as f}from"./use-now-sqAvRMna.js";import{a as ne,i as re,o as ie}from"./editable-title-BHbHmSIK.js";import{n as ae,r as oe,t as se}from"./popover-BRq6QnwI.js";import{t as p}from"./loader-circle-Cwgo6onL.js";import{o as ce,s as le,t as ue}from"./command-BvGGv2_u.js";import{t as m}from"./x-HXr9KZBr.js";import{i as de,n as fe,r as pe,t as me}from"./skills-9oR_oHse.js";import{i as he}from"./prompt-templates-BMZ5q5H_.js";import{t as ge}from"./use-submit-shortcut-BJ10ZshV.js";var h=u(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),_e=u(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),g=u(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),_=e(t(),1);function v(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function y(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function b(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||v(e.target)&&!y(e.target))}function ve(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{b(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function x(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||v(e.target))}function ye(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function be(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{x(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var S=new Set([`/`,`@`]);function xe(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(S.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Se(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function C(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function w(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ce(e){let[t,n]=_.useState(null),r=_.useRef(null),i=_.useRef(``),[a]=_.useState(()=>C()!==void 0),o=_.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return _.useEffect(()=>o,[o]),{supported:a,recording:t,start:_.useCallback(()=>{if(r.current)return;let t=C();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=w(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:_.useCallback(()=>o(),[o]),finish:_.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function T(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var E=n(),we={KeyA:`Yes, approved.`,KeyC:`Continue.`};function D({onSubmit:e,value:t,onValueChange:n,images:te,onImagesChange:l,autoFocus:u=!1,footerStart:f,footerEnd:p,sendAriaLabel:y=`Send`,disabled:b=!1,disabledReason:ve=`Session closed — Continue to reopen.`,allowEmptySubmit:x=!1,placeholder:ye=`Reply — / for skills, @ for files…`,ariaLabel:be=`Reply to the agent`,autocompleteSkills:S=!0,quickReplies:C=!1,getMentionCandidates:w,ref:T}){let[D,O]=(0,_.useState)(``),k=t??D,A=(0,_.useRef)(k);A.current=k;let j=(0,_.useRef)(n);j.current=n;let M=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(A.current):e;O(t),j.current?.(t)},[]),[De,Oe]=(0,_.useState)([]),N=te??De,P=(0,_.useRef)(N);P.current=N;let F=(0,_.useRef)(l);F.current=l;let I=(0,_.useCallback)((e,t=`edit`)=>{let n=typeof e==`function`?e(P.current):e;P.current=n,Oe(n),F.current?.(n,t)},[]),[L,ke]=(0,_.useState)(!1),[R,z]=(0,_.useState)(null),[Ae,je]=(0,_.useState)(``),[Me,Ne]=(0,_.useState)(!1),B=(0,_.useRef)(null),Pe=(0,_.useRef)(null),V=(0,_.useRef)(null),H=(0,_.useRef)(new Map),U=a(S&&Me),W=ee(),Fe=r(),G=Ce(e=>c(e,{tone:`danger`}));(0,_.useEffect)(()=>{u&&B.current?.focus()},[]),(0,_.useImperativeHandle)(T,()=>({insertAtCaret:e=>{let t=B.current,n=he(A.current,t?.selectionStart??A.current.length,e);M(n.text),V.current=n.caret,t?.focus()}}),[M]);let Ie=(0,_.useCallback)(()=>{let e=B.current;if(!e||b){z(null);return}let t=xe(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!S||t?.trigger===`@`&&w===void 0)return z(null);t?.trigger===`/`&&Ne(!0),z(t)},[S,b,w]),K=(0,_.useMemo)(()=>R===null?[]:R.trigger===`/`?fe(U.data??[],R.query,W.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:de(e)})):(w?.()??[]).filter(e=>pe(e,R.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[w,U.data,R,W.data?.skillUsage]),q=K.some(e=>e.value===Ae)?Ae:K[0]?.value,J=R!==null,Y=(0,_.useCallback)(()=>z(null),[]),Le=e=>{let t=B.current;if(!t||R===null)return;let n=t.selectionStart??t.value.length,r=Se(t.value,R,n,e.insert);R.trigger===`/`&&W.data!==void 0&&i({skillUsage:me(W.data.skillUsage,e.insert)}).then(()=>Fe.invalidateQueries({queryKey:o.uiState})).catch(()=>{}),M(r.text),V.current=r.caret,z(null),t.focus()};(0,_.useEffect)(()=>{!J||q==null||H.current.get(q)?.scrollIntoView({block:`nearest`})},[q,J]),(0,_.useLayoutEffect)(()=>{let e=V.current,t=B.current;e!==null&&t&&(t.setSelectionRange(e,e),V.current=null)},[k]),(0,_.useLayoutEffect)(()=>{let e=B.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[k]);let X=(0,_.useCallback)((e,t=`file`)=>{if(b)return;let n=ne(e,P.current.length);for(let e of n.rejected)c(e,{tone:`danger`});for(let e of n.accepted)re(e,t).then(e=>I(t=>t.length>=4?t:[...t,e]))},[b]),Re=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),X(t,`clipboard`))},ze=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),X(t))},Z=(0,_.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(b||L)&&!(i===``&&n.length===0&&!x)){ke(!0);try{await e(i,n.map(ie))}catch(e){c(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(M(e=>e===``?t:`${t}\n${e}`),I(e=>[...n,...e].slice(0,4)))}finally{ke(!1)}}},[x,L,b,e]),Be=(0,_.useCallback)(()=>{if(k.trim()===``&&N.length===0&&!x)return;let e=k,t=N;M(``),I([],`submit`),z(null),Z(e,t,!0)},[x,N,Z,k]),Ve=e=>{if(J){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),K.length===0)return;let t=K.findIndex(e=>e.value===q),n=e.key===`ArrowDown`?1:-1,r=K[(t+n+K.length)%K.length];je(r.value);return}if(e.key===`Escape`){e.preventDefault(),Y();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=K.find(e=>e.value===q);if(t){e.preventDefault(),Le(t);return}Y()}}ge({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Be())};(0,_.useEffect)(()=>{if(!C||b)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||v(e.target))return;let t=we[e.code];t!==void 0&&(e.preventDefault(),Z(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,C,Z]);let Q=e=>{let t=G.finish();if(t===``)return;let n=k.trim()===``?t:`${k.replace(/\s*$/,``)} ${t}`;if(e){M(``),I([],`submit`),Z(n,N,!0);return}M(n),V.current=n.length,B.current?.focus()},$=G.recording;return(0,E.jsxs)(se,{open:J,onOpenChange:e=>e?void 0:Y(),children:[(0,E.jsx)(ae,{asChild:!0,children:(0,E.jsxs)(`div`,{ref:Pe,"data-slot":`composer`,"data-disabled":b||void 0,onDrop:ze,onDragOver:e=>e.preventDefault(),className:d(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,b&&`opacity-80`),children:[N.length>0?(0,E.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:N.map((e,t)=>(0,E.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:d(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>I(e=>e.filter((e,n)=>n!==t)),children:[e.isImage?(0,E.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,E.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,E.jsx)(m,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,E.jsx)(`textarea`,{ref:B,rows:1,value:k,disabled:b,"aria-label":be,placeholder:b?ve:ye,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{M(e.target.value),Ie()},onKeyDown:Ve,onSelect:Ie,onPaste:Re}),$?(0,E.jsx)(Ee,{transcript:$.transcript,startedAt:$.startedAt,onCancel:G.cancel,onInsert:()=>Q(!1),onInsertAndSend:()=>Q(!0)}):(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,E.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,E.jsx)(Te,{disabled:b,onFiles:X}),f]}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[G.supported?(0,E.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,disabled:b,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:G.start,children:[(0,E.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,p?(0,E.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:p}):null,(0,E.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":y,disabled:b||L||k.trim()===``&&N.length===0&&!x,className:`size-8`,onClick:Be,children:(0,E.jsx)(h,{"aria-hidden":`true`})})]})]})]})}),(0,E.jsx)(oe,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{Pe.current?.contains(e.target)&&e.preventDefault()},children:(0,E.jsx)(ue,{shouldFilter:!1,value:q??``,onValueChange:je,children:(0,E.jsx)(le,{"data-slot":`composer-menu`,"data-trigger":R?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:K.length===0?(0,E.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:R?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:U.isPending?`Loading skills…`:`No matching skills.`}):K.map(e=>(0,E.jsxs)(ce,{ref:t=>{t?H.current.set(e.value,t):H.current.delete(e.value)},value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>Le(e),children:[(0,E.jsx)(`span`,{className:d(`shrink-0 truncate`,e.emphasized&&`font-semibold`,R?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Te({disabled:e,onFiles:t}){let n=(0,_.useRef)(null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,E.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ee({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=f(1e3);return(0,E.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,E.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:T(t,a)}),(0,E.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,E.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,E.jsx)(m,{"aria-hidden":`true`})}),(0,E.jsx)(s,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,E.jsx)(te,{"aria-hidden":`true`})}),(0,E.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,E.jsx)(h,{"aria-hidden":`true`})})]})}function O(){return(0,E.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,E.jsx)(l,{icon:(0,E.jsx)(p,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{be as a,ve as i,D as n,g as o,ye as r,h as s,O as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{O as n}from"./centered-state-DJLgwvA4.js";import{t as r}from"./utils-DoBmOlX3.js";e();var i=t(),a=n(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending`,danger:`bg-danger`,violet:`bg-violet`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function o({className:e,tone:t=`neutral`,pulse:n=!1,...o}){return(0,i.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:r(a({tone:t,pulse:n,className:e})),...o})}var s={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function c(e){return!1}function l(e){return!1}function u(e){return c(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:l(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function d(e){return s[u(e).bucket]<=s.waiting}function f(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}export{o as i,u as n,d as r,f as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,Fn as i,Pn as a,T as o,_ as s,b as c,f as l,g as u,h as d,u as f,vt as p,x as m,y as h}from"./centered-state-DJLgwvA4.js";import{n as g,r as _,t as v}from"./utils-DoBmOlX3.js";import{n as y,o as b,r as x,t as S}from"./popover-BRq6QnwI.js";import{n as C,t as w}from"./circle-x-C9UoMP1V.js";import{t as T}from"./git-pull-request-BBEDdTLK.js";import{t as ee}from"./triangle-alert-fBRUkB46.js";import{a as E,i as D,n as te,r as ne,t as re}from"./dist-CTksUkKh.js";import{i as ie}from"./token-metrics-rVl4kXe_.js";var O=_(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),k=_(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),ae=_(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),oe=_(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),se=_(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),ce=_(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),A=e(t(),1),j=n(),M=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),le=`VisuallyHidden`,N=A.forwardRef((e,t)=>(0,j.jsx)(m.span,{...e,ref:t,style:{...M,...e.style}}));N.displayName=le;var ue=N,[P,de]=c(`Tooltip`,[E]),F=E(),I=`TooltipProvider`,fe=700,L=`tooltip.open`,[pe,R]=P(I),z=e=>{let{__scopeTooltip:t,delayDuration:n=fe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=A.useRef(!0),s=A.useRef(!1),c=A.useRef(0);return A.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,j.jsx)(pe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:A.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:A.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:A.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};z.displayName=I;var B=`Tooltip`,[me,V]=P(B),H=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=R(B,e.__scopeTooltip),u=F(t),[f,p]=A.useState(null),m=d(),h=A.useRef(0),g=o??l.disableHoverableContent,_=c??l.delayDuration,v=A.useRef(!1),[y,b]=s({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(L))):l.onClose(),a?.(e)},caller:B}),x=A.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=A.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=A.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=A.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return A.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,j.jsx)(D,{...u,children:(0,j.jsx)(me,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:f,onTriggerChange:p,onTriggerEnter:A.useCallback(()=>{l.isOpenDelayedRef.current?w():S()},[l.isOpenDelayedRef,w,S]),onTriggerLeave:A.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};H.displayName=B;var U=`TooltipTrigger`,W=A.forwardRef((e,t)=>{let{__scopeTooltip:n,...i}=e,a=V(U,n),o=R(U,n),s=F(n),c=r(t,A.useRef(null),a.onTriggerChange),l=A.useRef(!1),u=A.useRef(!1),d=A.useCallback(()=>l.current=!1,[]);return A.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,j.jsx)(re,{asChild:!0,...s,children:(0,j.jsx)(m.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:h(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:h(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:h(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:h(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:h(e.onBlur,a.onClose),onClick:h(e.onClick,a.onClose)})})});W.displayName=U;var G=`TooltipPortal`,[he,ge]=P(G,{forceMount:void 0}),K=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=V(G,t);return(0,j.jsx)(he,{scope:t,forceMount:n,children:(0,j.jsx)(u,{present:n||a.open,children:(0,j.jsx)(f,{asChild:!0,container:i,children:r})})})};K.displayName=G;var q=`TooltipContent`,J=A.forwardRef((e,t)=>{let n=ge(q,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=V(q,e.__scopeTooltip);return(0,j.jsx)(u,{present:r||o.open,children:o.disableHoverableContent?(0,j.jsx)(Y,{side:i,...a,ref:t}):(0,j.jsx)(_e,{side:i,...a,ref:t})})}),_e=A.forwardRef((e,t)=>{let n=V(q,e.__scopeTooltip),i=R(q,e.__scopeTooltip),a=A.useRef(null),o=r(t,a),[s,c]=A.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=i,p=A.useCallback(()=>{c(null),f(!1)},[f]),m=A.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Se(r,xe(r,n.getBoundingClientRect())),a=Ce(t.getBoundingClientRect()),o=Te([...i,...a]);c(o),f(!0)},[f]);return A.useEffect(()=>()=>p(),[p]),A.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),A.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!we(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,j.jsx)(Y,{...e,ref:o})}),[ve,ye]=P(B,{isInside:!1}),be=o(`TooltipContent`),Y=A.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=V(q,n),u=F(n),{onClose:d}=c;return A.useEffect(()=>(document.addEventListener(L,d),()=>document.removeEventListener(L,d)),[d]),A.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,d]),(0,j.jsx)(l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,j.jsxs)(ne,{"data-state":c.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,j.jsx)(be,{children:r}),(0,j.jsx)(ve,{scope:n,isInside:!0,children:(0,j.jsx)(ue,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});J.displayName=q;var X=`TooltipArrow`,Z=A.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(n);return ye(X,n).isInside?null:(0,j.jsx)(te,{...i,...r,ref:t})});Z.displayName=X;function xe(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Se(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Ce(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function we(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Te(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ee(t)}function Ee(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var De=z,Oe=H,ke=W,Ae=K,je=J,Me=Z,Q=(0,A.createContext)(null);function Ne({children:e}){let[t,n]=(0,A.useState)(()=>new Map),r=(0,A.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,A.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=p((0,A.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,A.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,j.jsx)(Q.Provider,{value:o,children:e})}var $=(0,A.createContext)(null);function Pe({projectId:e,requests:t,children:n}){let r=(0,A.useContext)(Q),i=(0,A.useId)(),a=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),o=r?.publish,s=r?.retract;(0,A.useEffect)(()=>{if(!(!o||!s))return o(i,t),()=>s(i)},[o,s,i,a]);let c=p(r?Fe:t),l=r?.lookup??c,u=(0,A.useMemo)(()=>({lookup:l,projectId:e}),[l,e]);return(0,j.jsx)($.Provider,{value:u,children:n})}var Fe=[];function Ie(e,t,n){let r=(0,A.useContext)($),i=n??r?.projectId;return!r||!i||t===void 0?Le:r.lookup({projectId:i,kind:e,number:t})}var Le=Object.freeze({state:`idle`}),Re={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},ze={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},Be={draft:se,"review-required":T,"changes-requested":ce,"checks-pending":null,"checks-failing":w,ready:C,merged:ae,closed:oe,open:b,completed:C,"not-planned":k};function Ve({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:o,projectId:s,className:c,compact:l=!1}){let{kind:u,number:d,url:f}=e,p=Ie(u,d,s),m=n??p.status,h=i(m),_=u===`PR`&&(r??p.conflicting)===!0,y=_?a:h,b=v(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,Re[y?.tone??`violet`],c),x=qe(p,y,_?h:void 0),S=d?`${!l&&u===`Issue`?`Issue `:``}#${d}`:u,C=u===`PR`?`pull request`:`issue`,w=`Open the ${C} for ${t}${y?` — ${y.label}`:``}`,T=(0,j.jsxs)(j.Fragment,{children:[_?(0,j.jsx)(ee,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,j.jsx)(Ye,{status:y?m:void 0}),S]}),E=!f||!g(f)?(0,j.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,..._?{"data-conflicting":`true`}:{},"aria-label":y?`${C} ${S} — ${y.label}`:void 0,className:b,children:T}):(0,j.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,..._?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:x?void 0:f,"aria-label":w,className:v(b,ze[y?.tone??`violet`]),children:[T,(0,j.jsx)(O,{className:`size-2.5`,"aria-hidden":`true`})]});if(!x)return E;let D=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,x.headline]}),(0,j.jsx)(`span`,{className:`block`,children:x.detail}),x.also?(0,j.jsx)(`span`,{className:`block opacity-70`,children:x.also}):null,f&&g(f)?(0,j.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,j.jsx)(Ke,{chip:E,action:_?o:void 0,state:p.state,children:D})}var He=(0,A.createContext)(()=>{});function Ue(){return(0,A.useContext)(He)}var We=150,Ge=120;function Ke({chip:e,action:t,state:n,children:r}){let[i,a]=(0,A.useState)(!1),o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(void 0),l=(0,A.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,A.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,A.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,j.jsxs)(S,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,j.jsx)(y,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,We)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Ge)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,j.jsxs)(x,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Ge)},children:[(0,j.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,j.jsx)(He.Provider,{value:u,children:t}):null]})]})}function qe(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Je(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Je(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Ye({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,j.jsx)(ie,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=Be[e];return t?(0,j.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}function Xe({delayDuration:e=0,...t}){return(0,j.jsx)(De,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ze({...e}){return(0,j.jsx)(Oe,{"data-slot":`tooltip`,...e})}function Qe({...e}){return(0,j.jsx)(ke,{"data-slot":`tooltip-trigger`,...e})}function $e({className:e,sideOffset:t=0,children:n,...r}){return(0,j.jsx)(Ae,{children:(0,j.jsxs)(je,{"data-slot":`tooltip-content`,sideOffset:t,className:v(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,j.jsx)(Me,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}export{Ve as a,Ne as c,O as d,Qe as i,M as l,$e as n,Ue as o,Xe as r,Pe as s,Ze as t,k as u};
|