@open-mercato/cezar 0.19.0-pr1908.4332 → 0.19.0-pr1908.4707
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/account-identity.js +3 -0
- package/dist/agent-config/account-identity.js.map +1 -1
- package/dist/agent-config/catalog.d.ts +7 -1
- package/dist/agent-config/catalog.js +174 -4
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/gemini.d.ts +8 -0
- package/dist/agent-config/model-settings/gemini.js +16 -0
- package/dist/agent-config/model-settings/gemini.js.map +1 -0
- package/dist/agent-config/model-settings/kimi.d.ts +7 -0
- package/dist/agent-config/model-settings/kimi.js +13 -0
- package/dist/agent-config/model-settings/kimi.js.map +1 -0
- package/dist/agent-config/model-settings/omp.d.ts +11 -0
- package/dist/agent-config/model-settings/omp.js +17 -0
- package/dist/agent-config/model-settings/omp.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +6 -0
- package/dist/agent-config/model-settings/shared.js +17 -3
- package/dist/agent-config/model-settings/shared.js.map +1 -1
- package/dist/agent-config/models.js +6 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/agent-config/validate.js +15 -0
- package/dist/agent-config/validate.js.map +1 -1
- package/dist/automations/automation-cli.d.ts +2 -0
- package/dist/automations/automation-cli.js +82 -2
- package/dist/automations/automation-cli.js.map +1 -1
- package/dist/automations/deferred-start.d.ts +5 -4
- package/dist/automations/deferred-start.js +5 -1
- package/dist/automations/deferred-start.js.map +1 -1
- package/dist/automations/paused-work.d.ts +24 -0
- package/dist/automations/paused-work.js +61 -0
- package/dist/automations/paused-work.js.map +1 -0
- package/dist/automations/pr-head.d.ts +3 -0
- package/dist/automations/pr-head.js +8 -4
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +1 -0
- package/dist/automations/prompts.js.map +1 -1
- package/dist/automations/store.d.ts +16 -0
- package/dist/automations/store.js +44 -0
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/task-template.js +1 -0
- package/dist/automations/task-template.js.map +1 -1
- package/dist/automations/templates.js +1 -0
- package/dist/automations/templates.js.map +1 -1
- package/dist/automations/types.d.ts +24 -0
- package/dist/automations/types.js +2 -0
- package/dist/automations/types.js.map +1 -1
- package/dist/automations/validate-input.d.ts +188 -0
- package/dist/automations/validate-input.js +85 -0
- package/dist/automations/validate-input.js.map +1 -0
- package/dist/config.d.ts +12 -5
- package/dist/config.js +4 -12
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +9 -0
- package/dist/contract/agent-profiles.d.ts +74 -20
- package/dist/contract/agent.d.ts +12 -0
- package/dist/contract/artifacts.d.ts +138 -0
- package/dist/contract/assets.d.ts +83 -0
- package/dist/contract/automations.d.ts +158 -0
- package/dist/contract/dashboard-costs.d.ts +2 -0
- package/dist/contract/dashboard.d.ts +8 -0
- package/dist/contract/deferred-start.d.ts +33 -0
- package/dist/contract/dispatch.d.ts +9 -0
- package/dist/contract/events.d.ts +6 -0
- package/dist/contract/github.d.ts +13 -0
- package/dist/contract/health.d.ts +12 -0
- package/dist/contract/impact.d.ts +134 -0
- package/dist/contract/index.d.ts +6 -0
- package/dist/contract/index.js +2955 -2547
- package/dist/contract/managers.d.ts +79 -0
- package/dist/contract/runners.d.ts +15 -0
- package/dist/contract/runs.d.ts +292 -0
- package/dist/contract/skills.d.ts +67 -0
- package/dist/contract/telemetry.d.ts +5 -1
- package/dist/contract/transfer.d.ts +1932 -0
- package/dist/contract/workflows.d.ts +87 -0
- package/dist/contract/workspace-layouts.d.ts +6 -0
- package/dist/contract/workspace.d.ts +111 -37
- package/dist/core/agent-env.js +43 -1
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-errors.d.ts +3 -0
- package/dist/core/agent-errors.js +13 -0
- package/dist/core/agent-errors.js.map +1 -1
- package/dist/core/agent-model-policy.d.ts +1 -1
- package/dist/core/agent-model-policy.js +1 -1
- package/dist/core/agent-model-policy.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +19 -3
- package/dist/core/agent-profiles.js +27 -3
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +44 -10
- package/dist/core/agent-runner.js +21 -7
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/antigravity-runner.js +2 -1
- package/dist/core/antigravity-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -2
- package/dist/core/backend-detect.js +80 -1
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.js +30 -3
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-model-catalog.d.ts +6 -1
- package/dist/core/claude-model-catalog.js +20 -0
- package/dist/core/claude-model-catalog.js.map +1 -1
- package/dist/core/claude-usage-status.d.ts +8 -0
- package/dist/core/claude-usage-status.js +48 -0
- package/dist/core/claude-usage-status.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +8 -0
- package/dist/core/codex-app-server-runner.js +84 -13
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-model-catalog.js +42 -0
- package/dist/core/codex-model-catalog.js.map +1 -1
- package/dist/core/codex-ui-mapper.d.ts +7 -0
- package/dist/core/codex-ui-mapper.js +12 -2
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/copilot-acp-runner.js +5 -1
- package/dist/core/copilot-acp-runner.js.map +1 -1
- package/dist/core/cursor-agent-runner.js +5 -1
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/gemini-acp-runner.d.ts +37 -0
- package/dist/core/gemini-acp-runner.js +537 -0
- package/dist/core/gemini-acp-runner.js.map +1 -0
- package/dist/core/gemini-credentials.d.ts +21 -0
- package/dist/core/gemini-credentials.js +80 -0
- package/dist/core/gemini-credentials.js.map +1 -0
- package/dist/core/gemini-sessions.d.ts +18 -0
- package/dist/core/gemini-sessions.js +41 -0
- package/dist/core/gemini-sessions.js.map +1 -0
- package/dist/core/gemini-ui-mapper.d.ts +30 -0
- package/dist/core/gemini-ui-mapper.js +80 -0
- package/dist/core/gemini-ui-mapper.js.map +1 -0
- package/dist/core/junie-runner.js +2 -1
- package/dist/core/junie-runner.js.map +1 -1
- package/dist/core/kimi-home.d.ts +7 -0
- package/dist/core/kimi-home.js +13 -0
- package/dist/core/kimi-home.js.map +1 -0
- package/dist/core/kimi-model-catalog.d.ts +17 -0
- package/dist/core/kimi-model-catalog.js +45 -0
- package/dist/core/kimi-model-catalog.js.map +1 -0
- package/dist/core/kimi-runner.d.ts +90 -0
- package/dist/core/kimi-runner.js +874 -0
- package/dist/core/kimi-runner.js.map +1 -0
- package/dist/core/kimi-ui-mapper.d.ts +71 -0
- package/dist/core/kimi-ui-mapper.js +399 -0
- package/dist/core/kimi-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.js +11 -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/omp-rpc-runner.d.ts +41 -0
- package/dist/core/omp-rpc-runner.js +451 -0
- package/dist/core/omp-rpc-runner.js.map +1 -0
- package/dist/core/omp-ui-mapper.d.ts +56 -0
- package/dist/core/omp-ui-mapper.js +468 -0
- package/dist/core/omp-ui-mapper.js.map +1 -0
- package/dist/core/opencode-http.d.ts +2 -0
- package/dist/core/opencode-http.js +2 -2
- package/dist/core/opencode-http.js.map +1 -1
- package/dist/core/opencode-server-runner.d.ts +3 -1
- package/dist/core/opencode-server-runner.js +197 -25
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/opencode-v2-events.d.ts +11 -0
- package/dist/core/opencode-v2-events.js +105 -0
- package/dist/core/opencode-v2-events.js.map +1 -0
- package/dist/core/pi-runner.js +5 -1
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/private-mcp.d.ts +1 -1
- package/dist/core/private-mcp.js +2 -2
- package/dist/core/private-mcp.js.map +1 -1
- package/dist/core/process-signals.d.ts +29 -0
- package/dist/core/process-signals.js +85 -0
- package/dist/core/process-signals.js.map +1 -0
- package/dist/core/provider-auth.d.ts +25 -2
- package/dist/core/provider-auth.js +132 -12
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.d.ts +1 -0
- package/dist/core/runner-factory.js +38 -1
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.d.ts +8 -0
- package/dist/core/runner-model-catalog.js +3 -0
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/tool-display.js +2 -0
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.d.ts +2 -2
- package/dist/core/usage-limit.js +5 -3
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/data-gitignore.d.ts +1 -1
- package/dist/data-gitignore.js +1 -0
- package/dist/data-gitignore.js.map +1 -1
- package/dist/dispatch/engine.d.ts +4 -0
- package/dist/dispatch/engine.js +9 -0
- package/dist/dispatch/engine.js.map +1 -1
- package/dist/e2e-setup.d.ts +8 -3
- package/dist/e2e-setup.js +31 -16
- package/dist/e2e-setup.js.map +1 -1
- package/dist/handoff.d.ts +2 -2
- package/dist/handoff.js +5 -5
- package/dist/handoff.js.map +1 -1
- package/dist/impact/demo-review.json +781 -0
- package/dist/impact/diff.d.ts +21 -0
- package/dist/impact/diff.js +81 -0
- package/dist/impact/diff.js.map +1 -0
- package/dist/impact/evidence.d.ts +67 -0
- package/dist/impact/evidence.js +238 -0
- package/dist/impact/evidence.js.map +1 -0
- package/dist/impact/impact-cli.d.ts +12 -0
- package/dist/impact/impact-cli.js +141 -0
- package/dist/impact/impact-cli.js.map +1 -0
- package/dist/impact/launch.d.ts +46 -0
- package/dist/impact/launch.js +145 -0
- package/dist/impact/launch.js.map +1 -0
- package/dist/impact/model.d.ts +551 -0
- package/dist/impact/model.js +188 -0
- package/dist/impact/model.js.map +1 -0
- package/dist/impact/publish.d.ts +30 -0
- package/dist/impact/publish.js +119 -0
- package/dist/impact/publish.js.map +1 -0
- package/dist/impact/render.d.ts +41 -0
- package/dist/impact/render.js +109 -0
- package/dist/impact/render.js.map +1 -0
- package/dist/impact/template.html +670 -0
- package/dist/impact/validate.d.ts +25 -0
- package/dist/impact/validate.js +273 -0
- package/dist/impact/validate.js.map +1 -0
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/managers/engine.js +5 -2
- package/dist/managers/engine.js.map +1 -1
- package/dist/pack-check.d.ts +1 -0
- package/dist/pack-check.js +14 -0
- package/dist/pack-check.js.map +1 -1
- package/dist/paths.d.ts +6 -0
- package/dist/paths.js +19 -1
- package/dist/paths.js.map +1 -1
- package/dist/runs/agent-error-telemetry.js +7 -4
- package/dist/runs/agent-error-telemetry.js.map +1 -1
- package/dist/runs/agent-tmpdir.d.ts +25 -6
- package/dist/runs/agent-tmpdir.js +136 -25
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/artifacts.d.ts +52 -0
- package/dist/runs/artifacts.js +243 -0
- package/dist/runs/artifacts.js.map +1 -0
- package/dist/runs/event-history.d.ts +12 -0
- package/dist/runs/event-history.js +61 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/project-assets.d.ts +9 -0
- package/dist/runs/project-assets.js +57 -0
- package/dist/runs/project-assets.js.map +1 -0
- package/dist/runs/review-gate.d.ts +10 -0
- package/dist/runs/review-gate.js +12 -0
- package/dist/runs/review-gate.js.map +1 -1
- package/dist/runs/store.d.ts +70 -4
- package/dist/runs/store.js +139 -26
- package/dist/runs/store.js.map +1 -1
- package/dist/server/agent-setup.d.ts +1 -1
- package/dist/server/agent-setup.js +2 -1
- package/dist/server/agent-setup.js.map +1 -1
- package/dist/server/artifacts.d.ts +33 -0
- package/dist/server/artifacts.js +133 -0
- package/dist/server/artifacts.js.map +1 -0
- package/dist/server/dashboard.d.ts +5 -0
- package/dist/server/forge/github-assets.d.ts +7 -0
- package/dist/server/forge/github-assets.js +100 -0
- package/dist/server/forge/github-assets.js.map +1 -0
- package/dist/server/forge/github.d.ts +11 -0
- package/dist/server/forge/github.js +42 -0
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/open-in-app.js +3 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/provider-action-gate.js +12 -4
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +10012 -6701
- package/dist/server/server.js +353 -193
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +5 -5
- package/dist/server/star-count.js +5 -5
- package/dist/server/star-count.js.map +1 -1
- package/dist/server-install/steps.js +1 -0
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills-provision.js +7 -1
- package/dist/skills-provision.js.map +1 -1
- package/dist/skills.d.ts +10 -6
- package/dist/skills.js +11 -6
- package/dist/skills.js.map +1 -1
- package/dist/transfer/automations-file.d.ts +46 -0
- package/dist/transfer/automations-file.js +172 -0
- package/dist/transfer/automations-file.js.map +1 -0
- package/dist/transfer/config-bundle.d.ts +100 -0
- package/dist/transfer/config-bundle.js +430 -0
- package/dist/transfer/config-bundle.js.map +1 -0
- package/dist/webhooks/outbox.js +83 -63
- package/dist/webhooks/outbox.js.map +1 -1
- package/dist/workflows/graph.d.ts +27 -0
- package/dist/workflows/load.js +2 -2
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/resume-fallback.d.ts +13 -6
- package/dist/workflows/resume-fallback.js +26 -6
- package/dist/workflows/resume-fallback.js.map +1 -1
- package/dist/workflows/run.d.ts +121 -10
- package/dist/workflows/run.js +363 -61
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/templates.d.ts +27 -16
- package/dist/workflows/templates.js +17 -0
- package/dist/workflows/templates.js.map +1 -1
- package/dist/workflows/types.d.ts +21 -0
- package/dist/workflows/types.js +3 -1
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +27 -15
- package/dist/workspace/agent-accounts.js +4 -14
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.js +3 -0
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +12 -6
- package/dist/workspace/config.js +3 -13
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/dashboard-costs.d.ts +1 -0
- package/dist/workspace/dashboard-costs.js +1 -0
- package/dist/workspace/dashboard-costs.js.map +1 -1
- package/dist/workspace/dashboard-insights.d.ts +1 -0
- package/dist/workspace/dashboard-insights.js +5 -2
- package/dist/workspace/dashboard-insights.js.map +1 -1
- package/dist/workspace/dashboard-overview.js +2 -0
- package/dist/workspace/dashboard-overview.js.map +1 -1
- package/dist/workspace/dashboard.d.ts +1 -0
- package/package.json +5 -4
- package/scripts/check-pack.mjs +3 -2
- package/scripts/copy-assets.mjs +17 -0
- package/scripts/mock-claude.mjs +106 -1
- package/scripts/mock-gemini-acp.mjs +195 -0
- package/scripts/mock-kimi-acp.mjs +126 -0
- package/scripts/mock-omp-rpc.mjs +194 -0
- package/skills/change-impact/SKILL.md +117 -0
- package/skills/change-impact/references/analysis-contract.md +141 -0
- package/skills/change-impact/references/public-api.md +92 -0
- package/skills/change-impact/references/visual-contract.md +71 -0
- package/web/dist/assets/{active-forge-DEmP_h4r.js → active-forge-DO2AaQ-s.js} +1 -1
- package/web/dist/assets/agent-task-pickers-CZpw4vcZ.js +1 -0
- package/web/dist/assets/{alert-dialog-BZkKvKiu.js → alert-dialog-BihfE0uZ.js} +1 -1
- package/web/dist/assets/arrow-down-DACdHKjc.js +1 -0
- package/web/dist/assets/arrow-left-BtT8zuL0.js +1 -0
- package/web/dist/assets/arrow-up-BAPSgozC.js +1 -0
- package/web/dist/assets/ask-answer-Co3javaA.js +1 -0
- package/web/dist/assets/{ask-card-CfNUHYt9.js → ask-card-DLtNyMH_.js} +2 -2
- package/web/dist/assets/assets-view-CLCckPll.js +1 -0
- package/web/dist/assets/{automation-format-BPrWgGBz.js → automation-format-BXwiLf2G.js} +1 -1
- package/web/dist/assets/automations-route-JizzZrRf.js +1 -0
- package/web/dist/assets/blink-1oEUjxch.webp +0 -0
- package/web/dist/assets/blink-B4Y4PYCR.webp +0 -0
- package/web/dist/assets/blink-BpqW08tf.webp +0 -0
- package/web/dist/assets/blink-C380t2a5.webp +0 -0
- package/web/dist/assets/blink-CLn5VMYQ.webp +0 -0
- package/web/dist/assets/blink-Cn_tI5Yd.webp +0 -0
- package/web/dist/assets/blink-D4EaTnc2.webp +0 -0
- package/web/dist/assets/blink-DY4Sm5aw.webp +0 -0
- package/web/dist/assets/blink-mcM10OfP.webp +0 -0
- package/web/dist/assets/body-CXEwT_gR.webp +0 -0
- package/web/dist/assets/body-D-UrLURv.webp +0 -0
- package/web/dist/assets/body-D7Q8eJDv.webp +0 -0
- package/web/dist/assets/body-DdNSx4-d.webp +0 -0
- package/web/dist/assets/body-DlFNtp32.webp +0 -0
- package/web/dist/assets/body-EreQeu3g.webp +0 -0
- package/web/dist/assets/body-Goc64z5o.webp +0 -0
- package/web/dist/assets/body-_FLmHm_q.webp +0 -0
- package/web/dist/assets/body-v5xTmq5E.webp +0 -0
- package/web/dist/assets/{bot-qZRkHkDp.js → bot-Cm-PLA1M.js} +1 -1
- package/web/dist/assets/{button-BrxohNcK.js → button-BqkA8Ovk.js} +1 -1
- package/web/dist/assets/{centered-state-CSW_o4N7.js → centered-state-CquGIOsq.js} +1 -1
- package/web/dist/assets/check-B1z-_MCO.js +1 -0
- package/web/dist/assets/chevron-left-CDAxCC2p.js +1 -0
- package/web/dist/assets/chevron-right-DPaV033p.js +1 -0
- package/web/dist/assets/chunk-KS7C4IRE-DtL2Gzw3.js +3 -0
- package/web/dist/assets/{circle-alert-COKQc-87.js → circle-alert-B7VNkPC2.js} +1 -1
- package/web/dist/assets/circle-check-LWKCYKhA.js +1 -0
- package/web/dist/assets/{collapsible-BJ0sxcz9.js → collapsible-BuSDxSYs.js} +1 -1
- package/web/dist/assets/command-CfdVVS0V.js +1 -0
- package/web/dist/assets/{commit-list-HXZj01RO.js → commit-list-D5Nuv2HC.js} +1 -1
- package/web/dist/assets/compare-variants-BBOnUKfp.js +1 -0
- package/web/dist/assets/composer-BPIW4tmM.js +18 -0
- package/web/dist/assets/composer-attachments-DyC9yyGs.js +3 -0
- package/web/dist/assets/concerned-BIuYysOA.webp +0 -0
- package/web/dist/assets/concerned-BWTrkjRS.webp +0 -0
- package/web/dist/assets/concerned-BW_ywmzK.webp +0 -0
- package/web/dist/assets/concerned-CXQVACqJ.webp +0 -0
- package/web/dist/assets/concerned-DdsJa1t2.webp +0 -0
- package/web/dist/assets/concerned-Dlln-1nu.webp +0 -0
- package/web/dist/assets/concerned-DrSCYUQV.webp +0 -0
- package/web/dist/assets/concerned-TOjmS1qX.webp +0 -0
- package/web/dist/assets/concerned-tIx9dV3J.webp +0 -0
- package/web/dist/assets/dashboard-B_ytEQ_y.js +44 -0
- package/web/dist/assets/diff-BQScRHXz.js +3 -0
- package/web/dist/assets/diff-stat-CxDTnfya.js +1 -0
- package/web/dist/assets/diff-view-8m9Rnct7.js +13 -0
- package/web/dist/assets/{directional-usage-BtjgT5nc.js → directional-usage-BerE4wJK.js} +1 -1
- package/web/dist/assets/dist-Br4Ra_c5.js +1 -0
- package/web/dist/assets/{download-DH68Y5Vz.js → download-HBguClwD.js} +1 -1
- package/web/dist/assets/dropdown-menu-CDv5Teql.js +1 -0
- package/web/dist/assets/excited-8dK2gfAF.webp +0 -0
- package/web/dist/assets/excited-B-w6ozXs.webp +0 -0
- package/web/dist/assets/excited-B4Sch7Ub.webp +0 -0
- package/web/dist/assets/excited-BPQk8ECE.webp +0 -0
- package/web/dist/assets/excited-BRFi0cue.webp +0 -0
- package/web/dist/assets/excited-BvbUAHvw.webp +0 -0
- package/web/dist/assets/excited-CCH-VUDr.webp +0 -0
- package/web/dist/assets/excited-TMExhEMj.webp +0 -0
- package/web/dist/assets/excited-cSRbau5J.webp +0 -0
- package/web/dist/assets/{external-link-BVYdhpSK.js → external-link-Bclznsu3.js} +1 -1
- package/web/dist/assets/file-preview-DQ7iQhe0.js +2 -0
- package/web/dist/assets/{file-DYpKJvYs.js → file-rCLi_p-R.js} +1 -1
- package/web/dist/assets/file-tree-Bm38qEZP.js +1 -0
- package/web/dist/assets/focused-XMnI1Trp.webp +0 -0
- package/web/dist/assets/{folder-CeFUSrsO.js → folder-leteY9jH.js} +1 -1
- package/web/dist/assets/follow-up-engine-Q1EcpRpB.js +1 -0
- package/web/dist/assets/git-pull-request-CURFMFaU.js +1 -0
- package/web/dist/assets/{git-pull-request-draft-DL1VMp1L.js → git-pull-request-draft-BZgJrUou.js} +1 -1
- package/web/dist/assets/git-tab-loading-CF0flOMS.js +1 -0
- package/web/dist/assets/github-DcvXvc4J.js +1 -0
- package/web/dist/assets/happy-B7LJPne_.webp +0 -0
- package/web/dist/assets/happy-CCpAho8w.webp +0 -0
- package/web/dist/assets/happy-Ch9wxHii.webp +0 -0
- package/web/dist/assets/happy-CnoCjXOf.webp +0 -0
- package/web/dist/assets/happy-DVeEwiyo.webp +0 -0
- package/web/dist/assets/happy-URIT6hFl.webp +0 -0
- package/web/dist/assets/happy-ZufSdCLm.webp +0 -0
- package/web/dist/assets/happy-kfLwwDLp.webp +0 -0
- package/web/dist/assets/happy-nVffy2Sx.webp +0 -0
- package/web/dist/assets/{host-usage-o1rC0TiP.js → host-usage-CX8OXl8q.js} +1 -1
- package/web/dist/assets/icon-tooltip-BMkyRHLt.js +1 -0
- package/web/dist/assets/impact-control-Deh1F44q.js +1 -0
- package/web/dist/assets/impact-model-Dj6tIycu.js +1 -0
- package/web/dist/assets/index-DuW72uFI.js +33 -0
- package/web/dist/assets/index-jRkTI5kE.css +2 -0
- package/web/dist/assets/{input-BxjGaO_P.js → input-BO795Un9.js} +1 -1
- package/web/dist/assets/laptop-D2EKUOdE.webp +0 -0
- package/web/dist/assets/layers-YoqiEcNh.js +1 -0
- package/web/dist/assets/layout-cards-Cvq2XaJL.js +1 -0
- package/web/dist/assets/{layout-grid-C4d5rrDE.js → layout-grid-CSvbdC6i.js} +1 -1
- package/web/dist/assets/left-BBmAC9hS.webp +0 -0
- package/web/dist/assets/left-BUX98ijg.webp +0 -0
- package/web/dist/assets/left-CCrTs359.webp +0 -0
- package/web/dist/assets/left-CxWtAZHp.webp +0 -0
- package/web/dist/assets/left-DDCoVDRG.webp +0 -0
- package/web/dist/assets/left-DFGwPnRL.webp +0 -0
- package/web/dist/assets/left-D_qxT7z_.webp +0 -0
- package/web/dist/assets/left-QXVHT2zO.webp +0 -0
- package/web/dist/assets/left-S_rwAL-X.webp +0 -0
- package/web/dist/assets/leg-left-0EW5L4pu.webp +0 -0
- package/web/dist/assets/leg-left-BGo9dZbQ.webp +0 -0
- package/web/dist/assets/leg-left-BZ8ETYLj.webp +0 -0
- package/web/dist/assets/leg-left-BahG1x_b.webp +0 -0
- package/web/dist/assets/leg-left-C-DJQ3Pt.webp +0 -0
- package/web/dist/assets/leg-left-C6ZvH8fW.webp +0 -0
- package/web/dist/assets/leg-left-DsfFyCf7.webp +0 -0
- package/web/dist/assets/leg-left-Iq6VC-OZ.webp +0 -0
- package/web/dist/assets/leg-left-rVU9cV-d.webp +0 -0
- package/web/dist/assets/leg-right-2MnCGKHj.webp +0 -0
- package/web/dist/assets/leg-right-BCgv_Tjj.webp +0 -0
- package/web/dist/assets/leg-right-BOxKTHZ9.webp +0 -0
- package/web/dist/assets/leg-right-BeDSbUV7.webp +0 -0
- package/web/dist/assets/leg-right-BwrF93s6.webp +0 -0
- package/web/dist/assets/leg-right-CU-y_n5h.webp +0 -0
- package/web/dist/assets/leg-right-DKSfNi2y.webp +0 -0
- package/web/dist/assets/leg-right-Dq0ze2e4.webp +0 -0
- package/web/dist/assets/leg-right-t34e1CvD.webp +0 -0
- package/web/dist/assets/lib-BQXq3kEf.js +1 -0
- package/web/dist/assets/loader-circle-DjzuGw6j.js +1 -0
- package/web/dist/assets/manager-chat-C4QqN-w6.js +1 -0
- package/web/dist/assets/manager-index-BGNDfiIy.js +1 -0
- package/web/dist/assets/manager-new-Dek6H9Bg.js +2 -0
- package/web/dist/assets/managers-Dufza9IX.js +1 -0
- package/web/dist/assets/{markdown-Di8pirEb.js → markdown-CP2EQDsL.js} +1 -1
- package/web/dist/assets/{markdown-rDA5iFAU.js → markdown-YWy3FUHK.js} +2 -2
- package/web/dist/assets/mascot-picker-0_LGzV_f.js +1 -0
- package/web/dist/assets/{message-square-CstvkIHe.js → message-square-beq8DjLH.js} +1 -1
- package/web/dist/assets/new-task-form-BgMiEphZ.js +2 -0
- package/web/dist/assets/pencil-RUM53auZ.js +1 -0
- package/web/dist/assets/picker-pill-BO6YUs1F.js +1 -0
- package/web/dist/assets/play-Cj3p2Q5t.js +1 -0
- package/web/dist/assets/plus-Bdmhj8CR.js +1 -0
- package/web/dist/assets/portrait-BJ2e30PF.webp +0 -0
- package/web/dist/assets/portrait-BeDbYw8Z.webp +0 -0
- package/web/dist/assets/portrait-Bq7D7LzX.webp +0 -0
- package/web/dist/assets/portrait-C6HtaggP.webp +0 -0
- package/web/dist/assets/portrait-CcOzDXGs.webp +0 -0
- package/web/dist/assets/portrait-D44z6yep.webp +0 -0
- package/web/dist/assets/portrait-DHLQRy13.webp +0 -0
- package/web/dist/assets/portrait-DU3qlTxc.webp +0 -0
- package/web/dist/assets/portrait-q94U_uD6.webp +0 -0
- package/web/dist/assets/project-router-xmadY-N9.js +1 -0
- package/web/dist/assets/queries-ba5qZ3kd.js +1 -0
- package/web/dist/assets/reasoning-effort-pill-B8Z1RaXL.js +1 -0
- package/web/dist/assets/reference-chip-C9pVQk05.js +1 -0
- package/web/dist/assets/reference-conflict-action-DxUm18aD.js +1 -0
- package/web/dist/assets/repo-git-DFf8ZGZv.js +1 -0
- package/web/dist/assets/right-BFOa1Ihi.webp +0 -0
- package/web/dist/assets/right-BLsBZrK1.webp +0 -0
- package/web/dist/assets/right-BVU3rYuj.webp +0 -0
- package/web/dist/assets/right-BbES4jIG.webp +0 -0
- package/web/dist/assets/right-C2klSA-G.webp +0 -0
- package/web/dist/assets/right-Cte2BTL5.webp +0 -0
- package/web/dist/assets/right-Dz7jYN17.webp +0 -0
- package/web/dist/assets/right-W2oGaUHb.webp +0 -0
- package/web/dist/assets/right-XJjUU0AU.webp +0 -0
- package/web/dist/assets/run-actions-CLIUiXwS.js +1 -0
- package/web/dist/assets/{run-diff-CFHlmgGA.js → run-diff-CxS_a1EO.js} +2 -2
- package/web/dist/assets/{save-C4TDysfG.js → save-zfKVAo2Y.js} +1 -1
- package/web/dist/assets/{scroll-within-D3mqUngk.js → scroll-within-DhWf-4MN.js} +1 -1
- package/web/dist/assets/search-CCE2KMtX.js +1 -0
- package/web/dist/assets/{search-x-BkezzsKh.js → search-x-BxcYdvqm.js} +1 -1
- package/web/dist/assets/{settings-2-DIHmg7wZ.js → settings-2-B0yYRU0q.js} +1 -1
- package/web/dist/assets/sheet-DxqNqi5S.js +1 -0
- package/web/dist/assets/skills-BmQ9hZ2c.js +1 -0
- package/web/dist/assets/sortable.esm-Dj7Kk-Wk.js +5 -0
- package/web/dist/assets/square--LrBHma0.js +1 -0
- package/web/dist/assets/standing-C42GacCE.webp +0 -0
- package/web/dist/assets/standing-C5Tul1Nv.webp +0 -0
- package/web/dist/assets/standing-CUU2Jka6.webp +0 -0
- package/web/dist/assets/standing-Ca5nprIS.webp +0 -0
- package/web/dist/assets/standing-CgOaMKRT.webp +0 -0
- package/web/dist/assets/standing-ClF4PE2-.webp +0 -0
- package/web/dist/assets/standing-CoS9fBjb.webp +0 -0
- package/web/dist/assets/standing-DZrhVTuG.webp +0 -0
- package/web/dist/assets/standing-MhG0Chks.webp +0 -0
- package/web/dist/assets/status-dot-Dxb9pPsK.js +1 -0
- package/web/dist/assets/tabs-CmEFauE4.js +1 -0
- package/web/dist/assets/{tag-B56iP2zA.js → tag-TWBVKabJ.js} +1 -1
- package/web/dist/assets/task-commits-sdhrDSta.js +1 -0
- package/web/dist/assets/{task-graph-ZjFyDrAV.js → task-graph-DqXUw-PM.js} +1 -1
- package/web/dist/assets/task-notes-ur3eZYQs.js +1 -0
- package/web/dist/assets/task-workspace-BvamqKbw.js +28 -0
- package/web/dist/assets/terminal-CmRAOyqu.js +1 -0
- package/web/dist/assets/terminal-drawer-BiRjtnip.js +1 -0
- package/web/dist/assets/{terminal-pane-CeYi-FvS.js → terminal-pane-YnSc_Vhs.js} +2 -2
- package/web/dist/assets/{textarea-BXN4nZ0d.js → textarea-C58jseO-.js} +1 -1
- package/web/dist/assets/toaster-5ad4wwJ9.js +1 -0
- package/web/dist/assets/tooltip-45rfBiq8.js +1 -0
- package/web/dist/assets/tracker-CcyqVPEo.js +4 -0
- package/web/dist/assets/triangle-alert-C1mTIqxM.js +1 -0
- package/web/dist/assets/typing-left-BWPbVi7e.webp +0 -0
- package/web/dist/assets/typing-right-HDY0V90O.webp +0 -0
- package/web/dist/assets/{upload-D_kW6AjR.js → upload-C2gxSnMR.js} +1 -1
- package/web/dist/assets/use-now-DD2atNhs.js +1 -0
- package/web/dist/assets/utils-Br_dqwn-.js +60 -0
- package/web/dist/assets/{workflow-j8scU63W.js → workflow-WvO4bTRt.js} +1 -1
- package/web/dist/assets/workflow-graph-B2oESW5u.js +13 -0
- package/web/dist/assets/worktree-lifecycle-BxYvSKsA.js +1 -0
- package/web/dist/assets/{worktree-lifecycle-operation-mYB7KCpQ.js → worktree-lifecycle-operation-BRID04bW.js} +1 -1
- package/web/dist/assets/x-CZSnHsZ4.js +1 -0
- package/web/dist/assets/{zoomable-image-CW-pQ6ZO.js → zoomable-image-DCITEnK-.js} +1 -1
- package/web/dist/index.html +70 -60
- package/web/dist/assets/agent-task-pickers-8skJH9bS.js +0 -1
- package/web/dist/assets/arrow-down-cBTb_EjO.js +0 -1
- package/web/dist/assets/arrow-left-BvR1Oqhc.js +0 -1
- package/web/dist/assets/arrow-up-Cn0IS81u.js +0 -1
- package/web/dist/assets/ask-answer-Cfb0vEFv.js +0 -1
- package/web/dist/assets/automations-route-B4axw9eb.js +0 -1
- package/web/dist/assets/check-B5omShEO.js +0 -1
- package/web/dist/assets/chevron-left-D74_-PJ_.js +0 -1
- package/web/dist/assets/chevron-right-C3fLn_fF.js +0 -1
- package/web/dist/assets/circle-check-j6r9xbE5.js +0 -1
- package/web/dist/assets/compare-variants-CDrFR7P_.js +0 -1
- package/web/dist/assets/composer-GntpkeQD.js +0 -18
- package/web/dist/assets/composer-attachments-Xa-qW8Eq.js +0 -3
- package/web/dist/assets/dashboard-CJW-Xk7f.js +0 -44
- package/web/dist/assets/diff-RPASOQVF.js +0 -3
- package/web/dist/assets/diff-view-Ckaab4uQ.js +0 -13
- package/web/dist/assets/file-preview-DOSEbcqV.js +0 -2
- package/web/dist/assets/git-tab-loading-DhclV71X.js +0 -1
- package/web/dist/assets/git-toolbar-Bk-3i42V.js +0 -1
- package/web/dist/assets/github-TdBnzj-H.js +0 -1
- package/web/dist/assets/icon-tooltip-CUJLXOxf.js +0 -1
- package/web/dist/assets/index-CDhEdFaZ.js +0 -33
- package/web/dist/assets/index-Dk1VTlxY.css +0 -2
- package/web/dist/assets/layout-cards-BYOEsNbu.js +0 -1
- package/web/dist/assets/lib-D2__YoPr.js +0 -1
- package/web/dist/assets/loader-circle-DCpZCAyT.js +0 -1
- package/web/dist/assets/manager-chat-B1Taq3Eg.js +0 -1
- package/web/dist/assets/manager-index-COwisKDf.js +0 -1
- package/web/dist/assets/manager-new-BdJPiBs2.js +0 -2
- package/web/dist/assets/manager-pickers-CvYpd5cU.js +0 -1
- package/web/dist/assets/managers-CDiETPHi.js +0 -1
- package/web/dist/assets/pencil-DWtoOm2f.js +0 -1
- package/web/dist/assets/picker-pill-DQICTO2N.js +0 -1
- package/web/dist/assets/play-BYwEI1EA.js +0 -1
- package/web/dist/assets/plus-BPopgSYQ.js +0 -1
- package/web/dist/assets/popover-DzdYqnHw.js +0 -1
- package/web/dist/assets/project-router-CmpQcVZp.js +0 -1
- package/web/dist/assets/queries-DOHu2y2B.js +0 -1
- package/web/dist/assets/reference-chip-ty5g_OLC.js +0 -1
- package/web/dist/assets/reference-conflict-action-B2LrO-o3.js +0 -1
- package/web/dist/assets/repo-git-CyoBxHfP.js +0 -1
- package/web/dist/assets/sheet-7RYAcp_E.js +0 -1
- package/web/dist/assets/skills-BBqk5FoM.js +0 -1
- package/web/dist/assets/sortable.esm-O2daV3YI.js +0 -5
- package/web/dist/assets/square-BPbl10lx.js +0 -1
- package/web/dist/assets/status-dot-C_5ryAFi.js +0 -1
- package/web/dist/assets/tabs-EEnYYrJF.js +0 -1
- package/web/dist/assets/task-commits-DFalvqkF.js +0 -1
- package/web/dist/assets/task-notes-DRDKGsIw.js +0 -1
- package/web/dist/assets/task-workspace-D2ak5sTE.js +0 -28
- package/web/dist/assets/terminal-B-JX8x9P.js +0 -1
- package/web/dist/assets/terminal-drawer-S0cBMANF.js +0 -1
- package/web/dist/assets/toaster-DrFdGtNN.js +0 -3
- package/web/dist/assets/tooltip-p6YPEpXC.js +0 -1
- package/web/dist/assets/tracker-CFDEuaFt.js +0 -4
- package/web/dist/assets/triangle-alert-Crbc2knA.js +0 -1
- package/web/dist/assets/use-now-DQpgbshl.js +0 -1
- package/web/dist/assets/utils-Df_1kJEk.js +0 -60
- package/web/dist/assets/workflow-graph-Cye5SBdg.js +0 -13
- package/web/dist/assets/worktree-lifecycle-Da61xsLH.js +0 -1
- package/web/dist/assets/x-sQR-jRBj.js +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-drawer-BiRjtnip.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/queries-ba5qZ3kd.js","assets/utils-Br_dqwn-.js","assets/bundle-mjs-rHxsej31.js","assets/button-BqkA8Ovk.js","assets/dist-Br4Ra_c5.js","assets/dropdown-menu-CDv5Teql.js","assets/external-link-Bclznsu3.js","assets/loader-circle-DjzuGw6j.js","assets/play-Cj3p2Q5t.js","assets/plus-Bdmhj8CR.js","assets/square--LrBHma0.js","assets/terminal-CmRAOyqu.js","assets/x-CZSnHsZ4.js","assets/alert-dialog-BihfE0uZ.js","assets/tabs-CmEFauE4.js","assets/input-BO795Un9.js","assets/icon-tooltip-BMkyRHLt.js","assets/tooltip-45rfBiq8.js","assets/drawer-state-DasOAIpO.js","assets/terminal-pane-YnSc_Vhs.js","assets/preload-helper-Czpn1I53.js","assets/host-usage-CX8OXl8q.js","assets/use-desktop-BNN3U2y9.js","assets/clipboard-DvCUPLwM.js","assets/terminal-pane-BrP-ENHg.css","assets/assets-view-CLCckPll.js","assets/chunk-KS7C4IRE-DtL2Gzw3.js","assets/run-actions-CLIUiXwS.js","assets/bot-Cm-PLA1M.js","assets/folder-leteY9jH.js","assets/download-HBguClwD.js","assets/file-preview-DQ7iQhe0.js","assets/triangle-alert-C1mTIqxM.js","assets/centered-state-CquGIOsq.js","assets/markdown-YWy3FUHK.js","assets/chunk-BO2N2NFS-Bde6epwZ.js","assets/lib-BxQXEXDF.js","assets/file-rCLi_p-R.js","assets/layers-YoqiEcNh.js","assets/follow-up-engine-Q1EcpRpB.js","assets/new-task-form-BgMiEphZ.js","assets/toaster-5ad4wwJ9.js","assets/picker-pill-BO6YUs1F.js","assets/search-CCE2KMtX.js","assets/lib-BQXq3kEf.js","assets/reasoning-effort-pill-B8Z1RaXL.js","assets/project-router-xmadY-N9.js","assets/format-DHK74MwW.js","assets/index-DuW72uFI.js","assets/worktree-lifecycle-BxYvSKsA.js","assets/managers-Dufza9IX.js","assets/sortable.esm-Dj7Kk-Wk.js","assets/sheet-DxqNqi5S.js","assets/git-tab-loading-CF0flOMS.js","assets/arrow-left-BtT8zuL0.js","assets/reference-chip-C9pVQk05.js","assets/circle-check-LWKCYKhA.js","assets/git-pull-request-CURFMFaU.js","assets/git-pull-request-draft-BZgJrUou.js","assets/use-now-DD2atNhs.js","assets/status-dot-Dxb9pPsK.js","assets/check-B1z-_MCO.js","assets/pencil-RUM53auZ.js","assets/reference-conflict-action-DxUm18aD.js","assets/ask-answer-Co3javaA.js","assets/impact-model-Dj6tIycu.js","assets/active-forge-DO2AaQ-s.js","assets/upload-C2gxSnMR.js","assets/diff-stat-CxDTnfya.js","assets/layout-grid-CSvbdC6i.js","assets/search-x-BxcYdvqm.js","assets/textarea-C58jseO-.js","assets/workflow-WvO4bTRt.js","assets/collapsible-BuSDxSYs.js","assets/composer-attachments-DyC9yyGs.js","assets/directional-usage-BerE4wJK.js","assets/use-submit-shortcut-BJ10ZshV.js","assets/token-metrics-DXeuToH8.js","assets/arrow-down-DACdHKjc.js","assets/worktree-lifecycle-operation-BRID04bW.js","assets/arrow-up-BAPSgozC.js","assets/chevron-right-DPaV033p.js","assets/message-square-beq8DjLH.js","assets/composer-BPIW4tmM.js","assets/command-CfdVVS0V.js","assets/index-jRkTI5kE.css","assets/task-graph-DqXUw-PM.js","assets/workflow-graph-B2oESW5u.js","assets/settings-2-B0yYRU0q.js","assets/save-zfKVAo2Y.js","assets/tag-TWBVKabJ.js","assets/workflow-graph-DLioOiRN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$i as r,An as i,At as a,Ba as o,C as s,Ci as c,F as l,Fa as u,Ga as d,H as f,Ii as p,Ir as m,It as h,K as g,Kt as _,Lr as v,Qn as y,Ri as b,Sa as x,Sr as S,St as C,Tt as w,Xi as T,Y as E,_i as D,bi as O,co as k,d as A,dn as ee,dr as te,ea as j,er as ne,fi as M,ft as N,gi as P,hi as F,ia as I,ja as re,jr as L,kn as R,kt as ie,oo as ae,pi as oe,pn as se,pr as z,pt as B,r as V,so as H,tr as ce,uo as U,vi as le,w as ue,wt as W,yi as G}from"./queries-ba5qZ3kd.js";import{It as de,_t as fe,c as K,n as pe,t as q,tt as me}from"./utils-Br_dqwn-.js";import{t as he}from"./preload-helper-Czpn1I53.js";import{d as ge,f as _e,l as ve,n as ye,p as be}from"./chunk-KS7C4IRE-DtL2Gzw3.js";import{a as xe,d as Se,i as Ce,l as we,o as Te,r as Ee,t as De,u as Oe}from"./sheet-DxqNqi5S.js";import{t as ke}from"./use-desktop-BNN3U2y9.js";import{N as Ae,t as J}from"./button-BqkA8Ovk.js";import{$ as je,B as Me,C as Ne,E as Pe,F as Fe,G as Ie,H as Le,I as Re,J as ze,K as Be,L as Ve,M as He,N as Ue,O as We,P as Ge,Q as Ke,R as qe,S as Je,T as Ye,U as Xe,V as Ze,W as Qe,X as $e,Y as et,Z as tt,_ as nt,_t as rt,b as it,d as at,et as ot,ft as st,ht as ct,it as lt,k as ut,l as dt,mt as ft,n as pt,nt as mt,p as ht,q as gt,r as _t,rt as vt,tt as yt,u as bt,ut as xt,v as St,vt as Ct,w as wt,x as Tt,y as Et,z as Dt}from"./git-tab-loading-CF0flOMS.js";import{t as Ot}from"./arrow-down-DACdHKjc.js";import{t as kt}from"./arrow-left-BtT8zuL0.js";import{a as At,f as jt,h as Mt,i as Nt,l as Pt,m as Ft,n as It,p as Lt,r as Rt,s as zt}from"./worktree-lifecycle-operation-BRID04bW.js";import{s as Bt}from"./reference-chip-C9pVQk05.js";import{t as Vt}from"./bot-Cm-PLA1M.js";import{O as Ht,T as Ut,a as Wt,b as Gt,d as Kt,g as qt,j as Jt,k as Yt,m as Xt}from"./run-actions-CLIUiXwS.js";import{t as Zt}from"./check-B1z-_MCO.js";import{s as Qt}from"./dist-Br4Ra_c5.js";import{t as $t}from"./chevron-right-DPaV033p.js";import{t as en}from"./circle-check-LWKCYKhA.js";import{i as tn,l as nn,n as rn,r as an,s as on,t as sn}from"./dropdown-menu-CDv5Teql.js";import{n as cn,t as ln}from"./pencil-RUM53auZ.js";import{t as un}from"./external-link-Bclznsu3.js";import{d as dn,h as fn,l as pn,n as mn,o as hn,r as gn,t as _n,v as vn,y as yn}from"./impact-model-Dj6tIycu.js";import{a as bn,i as xn,n as Sn,r as Cn}from"./file-preview-DQ7iQhe0.js";import{t as wn}from"./file-rCLi_p-R.js";import{a as Tn,c as En,i as Dn,o as On,r as kn,s as An,t as jn}from"./file-tree-Bm38qEZP.js";import{t as Mn}from"./folder-leteY9jH.js";import{n as Nn}from"./upload-C2gxSnMR.js";import{t as Pn}from"./git-pull-request-CURFMFaU.js";import{t as Fn}from"./layout-grid-CSvbdC6i.js";import{t as In}from"./loader-circle-DjzuGw6j.js";import{t as Ln}from"./message-square-beq8DjLH.js";import{C as Rn,t as zn}from"./composer-BPIW4tmM.js";import{t as Bn}from"./play-Cj3p2Q5t.js";import{t as Vn}from"./plus-Bdmhj8CR.js";import{a as Hn,d as Un,f as Wn,n as Gn,o as Kn,r as qn,s as Jn,t as Yn}from"./follow-up-engine-Q1EcpRpB.js";import{t as Xn}from"./search-x-BxcYdvqm.js";import{t as Zn}from"./search-CCE2KMtX.js";import{t as Qn}from"./terminal-CmRAOyqu.js";import{n as $n,t as er}from"./textarea-C58jseO-.js";import{t as tr}from"./triangle-alert-C1mTIqxM.js";import{t as nr}from"./x-CZSnHsZ4.js";import{i as rr,n as ir,r as ar,t as or}from"./tooltip-45rfBiq8.js";import{n as sr,r as cr,t as lr}from"./collapsible-BuSDxSYs.js";import{a as ur,c as dr,i as fr,n as pr,o as mr,r as hr,s as gr,t as _r}from"./alert-dialog-BihfE0uZ.js";import{A as vr,D as yr,E as br,O as xr,T as Sr,k as Cr,l as wr,o as Tr,y as Er}from"./use-now-DD2atNhs.js";import{i as Dr,r as Or,t as kr}from"./tabs-CmEFauE4.js";import{t as Ar}from"./input-BO795Un9.js";import{r as Y}from"./toaster-5ad4wwJ9.js";import{L as jr,R as Mr}from"./new-task-form-BgMiEphZ.js";import{t as Nr}from"./status-dot-Dxb9pPsK.js";import{c as Pr,s as Fr,t as Ir}from"./project-router-xmadY-N9.js";import{t as Lr}from"./use-submit-shortcut-BJ10ZshV.js";import{t as Rr}from"./icon-tooltip-BMkyRHLt.js";import{n as zr,r as Br}from"./drawer-state-DasOAIpO.js";import{t as Vr}from"./lib-BQXq3kEf.js";import{t as Hr}from"./clipboard-DvCUPLwM.js";import{n as Ur,t as Wr}from"./centered-state-CquGIOsq.js";import{t as Gr}from"./markdown-YWy3FUHK.js";import{t as Kr}from"./markdown-CP2EQDsL.js";import{t as qr}from"./zoomable-image-DCITEnK-.js";import{n as Jr,t as Yr}from"./types-BTlmexWF.js";import{t as Xr}from"./run-diff-CxS_a1EO.js";import{t as Zr}from"./diff-BQScRHXz.js";import{a as Qr,c as $r,d as ei,f as ti,i as ni,l as ri,o as ii,p as ai,s as oi,t as si,u as ci}from"./ask-card-DLtNyMH_.js";import{i as li,r as ui,t as di}from"./task-commits-sdhrDSta.js";import{n as fi,r as pi,t as mi}from"./layout-cards-Cvq2XaJL.js";var hi=120;function gi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _i(e){let t=e.replace(/\s+/g,` `).trim();return t.length>hi?`${t.slice(0,hi-1)}…`:t}function X(e,...t){if(gi(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return _i(t)}}function vi(e){if(!gi(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return _i(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return _i(e.join(` `))}}function yi(e){if(!gi(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)gi(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function bi(e){return X(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function xi(e,t){return t?`${e} ${t}`:e}function Si(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:xi(`Ran`,vi(t)),subtitle:X(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:xi(`Edit`,X(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:xi(`Write`,X(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:xi(`Edit`,X(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=yi(t);return{toolKind:`edit`,title:xi(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:xi(`Read`,X(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:xi(`View image`,X(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:xi(`Search`,X(t,`pattern`,`query`)),subtitle:X(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:xi(`Fetch`,X(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:xi(`Web search`,X(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=X(t,`subagent_type`,`subagentType`),i=X(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=X(t,`skill`,`name`,`command`);return{toolKind:`skill`,title:e?`Skill: ${e}`:`Skill`,subtitle:X(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=X(t,`server`),n=X(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:bi(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()!==``?_i(e):`Tool`,subtitle:bi(t)}}var Ci=Ae(`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`}]]),wi=Ae(`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`}]]),Ti=Ae(`file-braces`,[[`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:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Ei=Ae(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Di=Ae(`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`}]]),Oi=Ae(`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`}]]),ki=Ae(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Ai=Ae(`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`}]]),Z=e(t(),1);function ji(e,t,n){let[r,i]=(0,Z.useState)({key:n,value:e}),a=(0,Z.useRef)(e);a.current=e;let o=(0,Z.useRef)(n);o.current=n;let s=(0,Z.useRef)(0),c=(0,Z.useRef)(void 0),l=(0,Z.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,Z.useEffect)(()=>{if(!l.current){l.current=!0;return}clearTimeout(c.current),c.current=void 0,s.current=Date.now()},[r]),(0,Z.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,Z.useEffect)(()=>()=>clearTimeout(c.current),[]),r.value}var Mi=5,Ni=120,Pi=200,Fi=5e3,Ii=15e3,Li=[];function Ri(...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 zi(e){let t=-1/0;for(let n of e){if(n.seq<=t)return!1;t=n.seq}return!0}function Bi(e){for(let t=e.length-1;t>=0;--t)if(e[t].newerCursor===void 0)return e[t]}function Vi(...e){if(!e.every(zi))return Ri(...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 Hi(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=we(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(we(e)??``);return t!==void 0&&t>e.seq}).map(({seq:e})=>e)}function Ui(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 Ri(e,t);r=n.seq}return e.length===0||t[0].seq>n?[...e,...t]:Vi(e,t)}function Wi(e){let t=K(),n=U(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=[`run-history-tail`,t,e],o=ae({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>F(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Mi,retry:1}),s=k({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>P(e,{signal:t}),retry:1}),c=o.isError&&o.data===void 0&&!o.isFetchPreviousPageError&&!o.isFetchNextPageError&&!o.isRefetchError,l=s.isError&&s.data===void 0&&!s.isRefetchError,u=o.data?.pages??[],d=(0,Z.useRef)(void 0),f=`${t}\0${e??``}`,p=(0,Z.useRef)({key:f,fallbackLatched:!1}),m=(0,Z.useRef)(Promise.resolve()),h=(0,Z.useRef)(0);p.current.key!==f&&(p.current={key:f,fallbackLatched:!1},m.current=Promise.resolve(),h.current+=1,d.current=void 0),(c||l)&&(p.current.fallbackLatched=!0);let g=p.current.fallbackLatched,_=(0,Z.useCallback)(e=>{let t=m.current,n;return m.current=new Promise(e=>{n=e}),t.then(e).finally(n)},[]),v=Bi(u),y=u.length>0?n.getQueryData(a):void 0;v&&(!d.current||v.asOfSeq>=d.current.asOfSeq)?d.current=v:y&&(!d.current||y.asOfSeq>=d.current.asOfSeq)&&(d.current=y);let b=d.current??v??y??(u.length>0?u.at(-1):void 0),x=(0,Z.useRef)(void 0),S=(0,Z.useCallback)(async t=>{if(e===void 0||x.current===f)return!1;x.current=f;let i=h.current,o=new AbortController,s;try{let c=await Promise.race([F(e,void 0,{signal:o.signal}),new Promise((e,t)=>{s=setTimeout(()=>{o.abort(),t(Error(`history compaction timed out`))},Ii)})]);if(p.current.key!==f||h.current!==i)return!1;let l=n.getQueryData(r),u=Bi(l?.pages??[]),m=n.getQueryData(a);if(Math.max(u?.asOfSeq??-1/0,m?.asOfSeq??-1/0,d.current?.asOfSeq??-1/0)>=c.asOfSeq)return!1;let g=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>Mi;)e.shift(),t.shift();return{pages:e,pageParams:t}})():{pages:[c],pageParams:[void 0]};return n.setQueryData(r,g),n.setQueryData(a,c),d.current=c,Hi(t,g.pages.flatMap(e=>e.events),c.asOfSeq)}catch{return!1}finally{clearTimeout(s),x.current===f&&(x.current=void 0)}},[r,f,n,e,a]),C=(0,Z.useCallback)(e=>{let t=V.runs.detail(e.id);n.getQueryData(t)!==void 0&&n.setQueryData(t,t=>t===void 0?e:te(t,e))},[n]),w=Se(b&&!g?e:void 0,b?{cursor:b.liveCursor,afterSeq:b.asOfSeq,compactWhenOver:Fi,compactAt:Pi,onCompact:S,onRun:C}:{onRun:C}),[T,E]=(0,Z.useState)(void 0),D=(0,Z.useCallback)(()=>E(f),[f]),O=Se(g?e:void 0,{onRun:C,onTruncated:D}),A=ji(w,Ni,e),ee=ji(O,Ni,e),j=(0,Z.useRef)({runId:void 0,scope:t,events:[]});(j.current.runId!==e||j.current.scope!==t)&&(j.current={runId:e,scope:t,events:[]}),g||(j.current.events=A);let ne=g?j.current.events:Li,M=(0,Z.useMemo)(()=>{let e=u.map(e=>e.events);return b!==void 0&&!u.includes(b)&&e.push(b.events),Ri(...e)},[b,u]);(0,Z.useEffect)(()=>{let e=Bi(u);e&&n.setQueryData(a,e)},[u,n,e,t]);let N=(0,Z.useMemo)(()=>g?Vi(M,ne,ee):Ui(M,A),[g,ee,ne,A,M]),I=(0,Z.useMemo)(()=>{if(g)return N;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return Vi(e,N.filter(({seq:e})=>e>t),A.filter(({seq:e})=>e<=t))},[s.data,g,A,N]),re=(0,Z.useCallback)(async()=>{let e=f,t=h.current,i=Bi(n.getQueryData(r)?.pages??[]);i&&n.setQueryData(a,i);try{await _(()=>o.fetchPreviousPage())}finally{if(p.current.key!==e||h.current!==t)return;let i=d.current;if(!i)return;n.setQueryData(r,e=>{if(!e)return e;let t=Bi(e.pages),n=t?e.pages.indexOf(t):-1;if(n<0||e.pages[n].asOfSeq>=i.asOfSeq)return e;let r=[...e.pages];return r[n]=i,{...e,pages:r}})}},[_,o.fetchPreviousPage,r,n,a]),L=(0,Z.useCallback)(async()=>{h.current+=1,m.current=Promise.resolve();let e=e=>d.current??Bi(e)??n.getQueryData(a),t=n.getQueryData(r);if(!e(t?.pages??[])){d.current=void 0,n.removeQueries({queryKey:a,exact:!0}),n.resetQueries({queryKey:r,exact:!0});return}if(t?.pages.length===1&&t.pages[0]===e(t.pages)&&!o.isFetchingPreviousPage)return;await n.cancelQueries({queryKey:r,exact:!0});let i=e(n.getQueryData(r)?.pages??[]);i&&(n.setQueryData(r,{pages:[i],pageParams:[void 0]}),n.setQueryData(a,i),d.current=i)},[o.isFetchingPreviousPage,r,n,a]);return{visibleEvents:N,currentEvents:I,isPending:!g&&o.isPending,contextPending:!g&&s.isPending,fallback:g,fallbackTruncated:g&&T===f,hasOlder:!g&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:re,jumpToLatest:L,retainedPages:u.length}}var Gi=`design-picks`,Ki=(e,t)=>typeof e==`string`?e.slice(0,t):``,qi=e=>typeof e==`number`&&Number.isFinite(e)?Math.round(e):0;function Ji(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ki(t.selector,400),r=Ki(t.tag,40);if(n===``||r===``)return null;let i=t.rect??{},a=t.viewport??{},o={};if(t.styles!==null&&typeof t.styles==`object`)for(let[e,n]of Object.entries(t.styles).slice(0,30))typeof n==`string`&&/^[a-z-]{1,40}$/.test(e)&&(o[e]=n.slice(0,160));return{url:Ki(t.url,2e3),selector:n,tag:r,text:Ki(t.text,200),html:Ki(t.html,1600),styles:o,rect:{x:qi(i.x),y:qi(i.y),width:qi(i.width),height:qi(i.height)},viewport:{width:qi(a.width),height:qi(a.height)},components:Array.isArray(t.components)?t.components.filter(e=>typeof e==`string`).slice(0,6).map(e=>e.slice(0,80)):[],source:Ki(t.source,300),...typeof t.mark==`string`&&/^[a-z0-9-]{1,24}$/.test(t.mark)?{mark:t.mark}:{}}}function Yi(e){let t=e.selector.split(` > `).at(-1)??e.tag;return e.components[0]?`${e.components[0]} · ${t}`:t}var Xi=`Elements selected in the app preview:`;function Zi(e,t){let n=Math.max(0,...(e.match(/`+/g)??[]).map(e=>e.length)),r="`".repeat(Math.max(3,n+1));return`${r}${t}\n${e}\n${r}`}var Qi=e=>e.split(`
|
|
3
|
+
`).map(e=>e===``?``:` ${e}`).join(`
|
|
4
|
+
`);function $i(e){return e.length===0?``:`${Xi}\n\n${e.map(e=>{let t=[`- \`${e.selector}\`${e.url?` on ${e.url}`:``}`];e.components.length>0?t.push(` component: ${[...e.components].reverse().join(` › `)}${e.source?` (${e.source})`:``}`):e.source&&t.push(` source: ${e.source}`),t.push(` box: ${e.rect.width}×${e.rect.height} at ${e.rect.x},${e.rect.y} (viewport ${e.viewport.width}×${e.viewport.height})`),e.text&&t.push(` text: ${JSON.stringify(e.text)}`);let n=Object.entries(e.styles);return n.length>0&&t.push(` styles: ${n.map(([e,t])=>`${e}: ${t}`).join(`; `)}`),`${t.join(`
|
|
5
|
+
`)}\n\n${Qi(Zi(e.html,`html`))}`}).join(`
|
|
6
|
+
|
|
7
|
+
`)}`}function ea(e,t){let n=$i(t);if(n===``)return e;let r=e.trim()===``?n:`${e}\n\n${n}`;if(r.length>1e5)throw Error(`Too long with the ${t.length===1?`selected element`:`${t.length} selected elements`} attached — remove some of them.`);return r}var Q=n(),ta=12e3,na=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[?::1\]?|.+\.local)$/i;function ra({state:e,onChange:t,onPickElement:n,designMarks:r,renderDesignNote:i,onDesignEscape:a,designTray:o,renderEmpty:s}){let c=e.tabs.length>0?e.tabs:[``],u=Math.min(e.active,c.length-1),d=c[u]??``,[f,m]=(0,Z.useState)(d),[h,g]=(0,Z.useState)(d===``?`idle`:`loading`),[_,v]=(0,Z.useState)(0),[y,b]=(0,Z.useState)(d),x=l(),S=(0,Z.useRef)(null),[C,w]=(0,Z.useState)({}),T=C[u]??fa(d),E=T.position>0,D=T.position>=0&&T.position<T.stack.length-1,[O,k]=(0,Z.useState)(null),A=(0,Z.useRef)(0),ee=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(S.current&&S.current.index===u&&S.current.url===d){S.current=null;return}S.current=null,m(d),b(d),g(d===``?`idle`:`loading`),ee.current&&v(e=>e+1),ee.current=!0},[u,d]);let te=x.data?.capabilities?.localHandoff??!0,[j,ne]=(0,Z.useState)(()=>new Set),M=y!==``&&!te&&wa(y)&&!j.has(ba(y)??``),[N,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[re,L]=(0,Z.useState)(!1),R=(0,Z.useRef)(null),ie=(0,Z.useRef)(null),ae=n!==void 0,oe=ae&&(x.data?.capabilities?.designMode??!1),se=oe?null:x.data?.capabilities?.localHandoff===!1?`Design Mode needs a local cockpit — a hosted one cannot reach the task's local dev server`:`Design Mode is turned off on this cockpit (CEZ_DESIGN_MODE=0)`,z=ga(y),B=oe&&N&&z!==null,V=(0,Z.useRef)(()=>!1);V.current=()=>!oe||z===null?!1:(N||jr(`shortcut`),P(e=>!e),!0),(0,Z.useEffect)(()=>{if(!ae)return;let e=e=>{e.repeat||e.defaultPrevented||!aa(e)||document.querySelector(`[role="dialog"]:not([data-slot="browser-design-note"]), [role="alertdialog"]`)||V.current()&&e.preventDefault()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ae]);let H=F!==null&&F.upstream===z?F.origin:null,ce=B&&H===null,U=(0,Z.useCallback)(e=>H!==null&&z!==null?H+e.slice(z.length):e,[H,z]),le=U(y),ue=`${va(le)}#${_}`,W=O??y;(0,Z.useEffect)(()=>{k(null),A.current=0},[ue]),(0,Z.useEffect)(()=>{if(!B||z===null)return;let e=!1;return p({target:z,parentOrigin:window.location.origin}).then(t=>{e||I({upstream:z,origin:t.origin})}).catch(t=>{e||(P(!1),Y(t instanceof Error&&t.message?t.message:`Design Mode could not start.`,{tone:`danger`}))}),()=>{e=!0}},[B,_,z]),(0,Z.useEffect)(()=>L(!1),[ue]),(0,Z.useEffect)(()=>{!re||H===null||R.current?.contentWindow?.postMessage({source:`cezar-design-host`,type:`set-active`,active:B},H)},[B,H,re]);let G=i!==void 0,[de,fe]=(0,Z.useState)(!1),[K,pe]=(0,Z.useState)(null),[me,he]=(0,Z.useState)({}),[ge,_e]=(0,Z.useState)(!1),ve=(0,Z.useRef)(null),ye=(0,Z.useRef)(null),[be,xe]=(0,Z.useState)(null),Se=(0,Z.useCallback)(()=>fe(!1),[]),Ce=r??sa,we=K!==null&&Ce.some(e=>e.key===K),Te=G&&oe&&de&&we,Ee=K===null?void 0:me[K],De=G&&H!==null&&ge?Ce.filter(e=>e.draft&&!(e.key in me)):sa,Oe=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{we?Oe.current=K:de&&Oe.current===K&&fe(!1)},[K,we,de]),(0,Z.useEffect)(()=>{he({}),_e(!1)},[ue]),(0,Z.useLayoutEffect)(()=>{if(!Te)return;let e=ve.current,t=ye.current;!e||!t||xe(da(Ee,{width:e.clientWidth,height:e.clientHeight},{width:t.offsetWidth,height:t.offsetHeight}))},[K,Ee,Te]);let ke=be!==null;(0,Z.useEffect)(()=>{Te&&ke&&ye.current?.querySelector(`textarea`)?.focus()},[K,Te,ke]);let Ae=JSON.stringify(Ce.map(({key:e,n:t,selector:n,path:r})=>({key:e,n:t,selector:n,path:r}))),je=(0,Z.useCallback)(()=>{H!==null&&R.current?.contentWindow?.postMessage({source:`cezar-design-host`,type:`set-marks`,marks:JSON.parse(Ae)},H)},[Ae,H]);(0,Z.useEffect)(()=>{re&&je()},[re,je]);let Me=(0,Z.useRef)(null);Me.current=Te?K:null,(0,Z.useEffect)(()=>{if(H===null)return;let e=e=>{if(e.origin!==H||e.source!==R.current?.contentWindow)return;let t=e.data;if(!(typeof t!=`object`||!t||t.source!==`cezar-design`)){if(t.type===`ready`)L(!0);else if(t.type===`toggle`)P(!1);else if(t.type===`cancel`)Me.current===null?P(!1):(a?.(Me.current),fe(!1));else if(t.type===`mark-clicked`&&typeof t.key==`string`)pe(t.key),fe(!0);else if(t.type===`rects`)he(ca(t.rects)),_e(!0);else if(t.type===`picked`){let e=Ji(t.element);if(!e||!n?.(e)){je();return}if(!G){Y(`Element picked.`);return}let r=e.mark;r!==void 0&&he(t=>({...t,[r]:e.rect})),pe(r??null),fe(!0)}}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[G,H,a,n,je]);let Ne=(0,Z.useCallback)(()=>{N||I(null)},[N]);(0,Z.useEffect)(()=>{if(h!==`loading`||y===``||M)return;let e=setTimeout(()=>g(`failed`),ta);return()=>clearTimeout(e)},[M,_,h,y]);let Pe=(0,Z.useCallback)(n=>{c[u]===n||n.length>We||(S.current={index:u,url:n},t({...e,tabs:c.map((e,t)=>t===u?n:e)}))},[u,t,e,c]),Fe=(0,Z.useCallback)(e=>{if(h===`idle`&&!M&&e!==W&&ya(W,e)){k(null),b(e),m(e),e===y&&R.current&&(R.current.src=U(e)),Pe(e);return}Ne(),k(null),b(e),m(e),g(`loading`),v(e=>e+1)},[U,Pe,M,Ne,W,h,y]),Ie=(0,Z.useCallback)(e=>{let t=ha(e);t!==null&&(w(e=>{let n=e[u]??fa(d),r=n.stack.slice(0,n.position+1);if(r[r.length-1]===t)return e;let i=[...r,t].slice(-pa);return{...e,[u]:{stack:i,position:i.length-1}}}),Fe(t))},[u,d,Fe]),Le=(0,Z.useCallback)(e=>{let t=T.position+e,n=T.stack[t];n!==void 0&&(w(e=>({...e,[u]:{stack:T.stack,position:t}})),Fe(n))},[u,T.position,T.stack,Fe]),Re=(0,Z.useCallback)(()=>{y!==``&&(A.current+=1,g(`idle`),Pe(W))},[Pe,W,y]),ze=(0,Z.useCallback)((e,t)=>{k(e),m(t=>t===W||document.activeElement!==ie.current?e:t),w(n=>{let r=n[u]??fa(d);if(r.stack[r.position]===e)return n;let i;if(r.stack[r.position-1]===e&&t===`pop`)i={stack:r.stack,position:r.position-1};else if(r.stack[r.position+1]===e&&t===`pop`)i={stack:r.stack,position:r.position+1};else if(t===`push`||t===`load`&&A.current>0||r.position<0){let t=[...r.stack.slice(0,r.position+1),e].slice(-pa);i={stack:t,position:t.length-1}}else i={stack:r.stack.map((t,n)=>n===r.position?e:t),position:r.position};return{...n,[u]:i}}),h===`idle`&&Pe(e)},[u,d,Pe,W,h]),Be=ba(le);(0,Z.useEffect)(()=>{if(Be===null)return;let e=e=>{if(e.origin!==Be||e.source!==R.current?.contentWindow)return;let t=e.data;if(typeof t!=`object`||!t||t.source!==`cezar-preview`||t.type!==`location`||typeof t.url!=`string`)return;let n=xa(t.url,Be,H===null?null:z);n!==null&&ze(n,typeof t.how==`string`?t.how:`replace`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[ze,Be,H,z]);let Ve=(0,Z.useCallback)(()=>{c.length>=Ye||t({tabs:[...c,``],active:c.length})},[t,c]),He=(0,Z.useCallback)(e=>{let n=c.filter((t,n)=>n!==e);if(n.length===0){t(Ze()),w({});return}t({tabs:n,active:e<u?u-1:Math.min(u,n.length-1)}),w(t=>{let n={};for(let[r,i]of Object.entries(t)){let t=Number(r);t!==e&&(n[t>e?t-1:t]=i)}return n})},[u,t,c]);return(0,Q.jsxs)(`div`,{"data-slot":`browser-view`,className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsx)(kr,{value:String(u),onValueChange:n=>t({...e,active:Number(n)}),className:`shrink-0 gap-0`,children:(0,Q.jsxs)(Or,{"aria-label":`Browser tabs`,className:`flex w-full justify-start gap-0.5 overflow-x-auto rounded-none bg-transparent px-3 py-0`,children:[c.map((n,r)=>(0,Q.jsxs)(`div`,{"data-slot":`browser-tab`,"data-active":r===u?``:void 0,className:q(`group flex h-6 shrink-0 items-center rounded-sm pl-2 pr-0.5 text-xs font-medium`,r===u?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(Dr,{value:String(r),onClick:()=>{r!==u&&t({...e,active:r})},title:n||`New tab`,className:`inline-block h-auto max-w-32 flex-none truncate rounded-none border-0 p-0 text-xs font-medium text-inherit hover:text-inherit focus-visible:underline focus-visible:ring-0 focus-visible:outline-0 data-[state=active]:bg-transparent data-[state=active]:font-medium data-[state=active]:text-inherit group-data-[variant=default]/tabs-list:data-[state=active]:shadow-none`,children:ma(n)}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close tab ${ma(n)}`,onClick:()=>He(r),className:q(`ml-1 size-4 rounded text-inherit opacity-0 transition-opacity hover:bg-background hover:text-inherit focus-visible:opacity-100 group-hover:opacity-100`,r===u&&`opacity-60`),children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3`})})]},r)),c.length<Ye?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`New tab`,title:`New tab`,onClick:Ve,className:`size-6 rounded`,children:(0,Q.jsx)(Vn,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-border/70 px-3 pb-2`,children:[(0,Q.jsx)(oa,{label:`Back`,disabled:!E,onClick:()=>Le(-1),icon:(0,Q.jsx)(kt,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Q.jsx)(oa,{label:`Forward`,disabled:!D,onClick:()=>Le(1),icon:(0,Q.jsx)(Mt,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Q.jsx)(oa,{label:`Reload`,onClick:()=>{y!==``&&(Ne(),k(null),b(W),m(W),g(`loading`),v(e=>e+1))},icon:(0,Q.jsx)(Wn,{"aria-hidden":`true`,className:q(`size-3.5`,h===`loading`&&`animate-spin`)})}),(0,Q.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault(),Ie(f)},children:(0,Q.jsx)(Ar,{ref:ie,value:f,onChange:e=>m(e.target.value),placeholder:`Enter an address, e.g. http://localhost:3000`,"aria-label":`Address`,spellCheck:!1,className:`h-8 text-ui focus-visible:ring-ring/30 md:text-ui`})}),ae?(0,Q.jsxs)(J,{type:`button`,"data-slot":`browser-design-toggle`,variant:B?`primary`:`outline`,size:`sm`,"aria-pressed":B,disabled:se!==null||z===null,title:se??(z===null?`Design Mode works on local http:// addresses`:B?`Stop selecting elements (${Er(ia)} or Esc)`:`Click an element of the page to send it to the agent (${Er(ia)})`),onClick:()=>{N||jr(`button`),P(e=>!e)},className:`ml-1 disabled:opacity-40`,children:[(0,Q.jsx)(bn,{"aria-hidden":`true`,className:`size-3.5`}),`Design Mode`,(0,Q.jsx)(`kbd`,{"data-slot":`browser-design-key`,"aria-hidden":`true`,className:`ml-0.5 rounded border border-current/25 px-1 font-sans text-micro leading-4 opacity-70`,children:Er(ia)})]}):null]}),(0,Q.jsxs)(`div`,{ref:ve,className:`relative min-h-0 flex-1`,children:[M?(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(tr,{}),tone:`neutral`,heading:`h2`,title:`This address points at the machine you are sitting at`,subtitle:`This cockpit runs remotely, so a local address opens on your computer rather than on the task's host. Forward the port from your computer first:`,children:(0,Q.jsx)(Ca,{url:y,onTunneled:()=>{let e=ba(y);e&&ne(t=>new Set(t).add(e))}})}):y===``&&s?s(Ie):y===``?(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(Jt,{}),tone:`neutral`,heading:`h2`,title:`Empty tab`,subtitle:te?`Enter the address of the task's app, e.g. http://localhost:3000 — then switch on Design Mode to point at an element and tell the agent what to change.`:`Enter the address of the task's app, e.g. http://localhost:3000. This cockpit runs remotely: start the app in the task's terminal (on a hosted cockpit it needs CEZ_TERMINAL=1), and cezar shows the SSH command that forwards its port to you.`}):(0,Q.jsxs)(Q.Fragment,{children:[h===`failed`?(0,Q.jsxs)(`div`,{"data-slot":`browser-failed`,className:`absolute inset-x-0 top-0 z-10 border-b border-border bg-background px-3 py-2 text-xs text-soft-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Could not open`}),` — the page did not respond or does not allow embedding. The address is still in the bar; you can fix it.`]}):null,De.length>0?(0,Q.jsx)(`div`,{"data-slot":`browser-design-adrift`,className:`absolute bottom-3 left-3 z-10 flex max-w-[60%] flex-wrap gap-1.5`,children:De.map(e=>(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,title:`A note in progress — its element could not be found on this page`,onClick:()=>{pe(e.key),fe(!0)},className:`max-w-48`,children:(0,Q.jsxs)(`span`,{className:`truncate`,children:[`Draft · `,e.label]})},e.key))}):null,oe&&o?(0,Q.jsx)(`div`,{className:`absolute right-3 bottom-3 z-10`,children:o}):null,B&&h===`idle`&&!Te&&De.length===0&&!o?(0,Q.jsx)(`p`,{"data-slot":`browser-design-hint`,className:`pointer-events-none absolute bottom-3 left-1/2 z-10 -translate-x-1/2 rounded-full border border-border bg-background/95 px-3 py-1 text-xs whitespace-nowrap text-soft-foreground shadow-sm`,children:G?`Click an element to write a note about it · Esc to stop`:`Click an element to pick it · Esc to stop`}):null,ce?null:(0,Q.jsx)(`iframe`,{ref:R,src:le,title:`Preview`,onLoad:Re,sandbox:`allow-same-origin allow-scripts allow-forms allow-modals allow-popups`,allow:``,referrerPolicy:`no-referrer`,className:q(`size-full border-0`,h===`loading`&&`invisible`)},ue),h===`loading`?(0,Q.jsx)(`p`,{className:`absolute inset-0 grid place-items-center text-xs text-soft-foreground`,children:`Loading…`}):null]}),Te?(0,Q.jsx)(`div`,{ref:ye,"data-slot":`browser-design-note`,role:`dialog`,"aria-label":`Note about the selected elements`,style:be?{left:be.left,top:be.top}:{left:0,top:0,visibility:`hidden`},className:`absolute z-20 w-[min(360px,calc(100%-16px))] rounded-xl border border-border bg-background shadow-lg`,children:K===null?null:i({mark:K,close:Se})}):null]})]})}var ia=`Alt+D`;function aa(e){return(e.code?e.code===`KeyD`:e.key===`d`||e.key===`D`)&&e.altKey&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey}function oa({label:e,icon:t,onClick:n,disabled:r}){return(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e,title:e,onClick:n,disabled:r,className:`disabled:opacity-40`,children:t})}var sa=[];function ca(e){let t={};if(!Array.isArray(e))return t;for(let n of e.slice(0,50)){if(typeof n!=`object`||!n)continue;let e=n;if(typeof e.key!=`string`||!/^[a-z0-9-]{1,24}$/.test(e.key))continue;let r=e=>typeof e==`number`&&Number.isFinite(e)?e:0;t[e.key]={x:r(e.x),y:r(e.y),width:r(e.width),height:r(e.height)}}return t}var la=10,ua=8;function da(e,t,n){let r=Math.max(ua,t.width-n.width-ua),i=Math.max(ua,t.height-n.height-ua);if(!e)return{left:r,top:i};let a=(e,t)=>Math.min(Math.max(e,ua),t),o=e.y+e.height+la,s=e.y-la-n.height,c=o+n.height+ua<=t.height?o:s>=ua?s:o;return{left:a(e.x,r),top:a(c,i)}}function fa(e){return e===``?{stack:[],position:-1}:{stack:[e],position:0}}var pa=50;function ma(e){if(e===``)return`New tab`;try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname;return`${t.host}${n}`}catch{return e}}function ha(e){let t=e.trim();if(t===``)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//i.test(t);if(!n&&/^[a-z][a-z0-9+.-]*:(?!\d)/i.test(t))return null;let r=n?t:`http://${t}`,i;try{i=new URL(r)}catch{return null}return i.protocol!==`http:`&&i.protocol!==`https:`?null:i.toString()}function ga(e){if(e===``)return null;try{let t=new URL(e);return t.protocol!==`http:`||!_a.test(t.hostname)?null:t.origin}catch{return null}}var _a=/^(localhost|127\.0\.0\.1|\[::1\])$/i;function va(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}function ya(e,t){return e!==``&&t.includes(`#`)&&va(e)===va(t)}function ba(e){try{let t=new URL(e).origin;return t===`null`?null:t}catch{return null}}function xa(e,t,n){let r;try{r=new URL(e)}catch{return null}if(r.origin!==t)return null;let i=r.pathname+r.search+r.hash;return ha((n??t)+i)}function Sa(e,t){try{let n=new URL(e),r=n.port||(n.protocol===`https:`?`443`:`80`);return`ssh -N -L ${r}:localhost:${r} ${t||`<host>`}`}catch{return null}}function Ca({url:e,onTunneled:t}){let n=Sa(e,window.location.hostname);return n?(0,Q.jsxs)(`div`,{"data-slot":`browser-tunnel`,className:`flex w-full flex-col items-center gap-3`,children:[(0,Q.jsx)(`code`,{className:`w-full rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs break-all text-foreground select-all`,children:n}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{navigator.clipboard?.writeText(n).then(()=>Y(`Copied the SSH command.`),()=>Y(`Could not copy — select the command instead.`,{tone:`danger`}))},children:`Copy command`}),(0,Q.jsx)(J,{type:`button`,size:`sm`,"data-action":`browser-tunnel-open`,onClick:t,children:`The tunnel is open — show it here`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,asChild:!0,children:(0,Q.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:`Open in a new tab`})})]})]}):null}function wa(e){try{return na.test(new URL(e).hostname)}catch{return!1}}var Ta=5,Ea=[{scope:`project`,title:`Team`,detail:`Saved in the repo's .ai/cezar/config.json. Commit it and everyone gets the same Start app.`},{scope:`personal`,title:`Only me`,detail:`Saved in your ~/.cezar/config.json, and used instead of the team recipe.`}];function Da({open:e,onOpenChange:t,suggestion:n,onSaved:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(`project`),[l,u]=(0,Z.useState)([``]),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(!1),_=e=>{let t=e??n;u(t.services.length>0?[...t.services]:[``]),f(t.url??``)};(0,Z.useEffect)(()=>{if(!e)return;m(null);let t=!1;return c().then(e=>{if(t)return;a(e);let n=e.personal?`personal`:`project`;s(n),_(e[n])}).catch(e=>!t&&m(e instanceof Error?e.message:String(e))),()=>{t=!0}},[e]);let v=async e=>{g(!0),m(null);try{a(await re({scope:o,recipe:e})),r(),t(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}},y=l.map(e=>e.trim()).filter(Boolean),b=d.trim(),x=b!==``&&!/^https?:\/\/\S+$/.test(b);return(0,Q.jsx)(Sr,{open:e,onOpenChange:t,children:(0,Q.jsxs)(br,{className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Cr,{children:[(0,Q.jsx)(vr,{children:`Start recipe`}),(0,Q.jsx)(yr,{children:`What starts this project's app for the Preview. Each command runs in its own terminal tab of the task. Installing dependencies is not part of it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Who uses this recipe`,className:`grid grid-cols-2 gap-2`,children:Ea.map(e=>{let t=e.scope===`personal`&&i?.personalAvailable===!1,n=o===e.scope;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,disabled:t,onClick:()=>{s(e.scope),_(i?.[e.scope]??null)},className:q(`flex flex-col gap-1 rounded-md border p-2.5 text-left text-xs transition-colors disabled:opacity-50`,n?`border-foreground/40 bg-muted`:`border-border hover:bg-muted/50`),children:[(0,Q.jsxs)(`span`,{className:`font-medium text-foreground`,children:[e.title,i?.[e.scope]?(0,Q.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:`· saved`}):null]}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:t?`This project is not in your project list.`:e.detail})]},e.scope)})}),(0,Q.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`legend`,{className:`mb-1.5 text-xs font-medium text-foreground`,children:`Services`}),l.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(Ar,{value:e,onChange:e=>u(n=>n.map((n,r)=>r===t?e.target.value:n)),placeholder:t===0?`npm run dev`:`npm run api`,"aria-label":`Service ${t+1}`,spellCheck:!1,className:`h-8 font-mono text-xs md:text-xs`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove service ${t+1}`,disabled:l.length===1,onClick:()=>u(e=>e.filter((e,n)=>n!==t)),children:(0,Q.jsx)(nr,{"aria-hidden":`true`})})]},t)),(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`xs`,className:`self-start text-muted-foreground`,disabled:l.length>=Ta,onClick:()=>u(e=>[...e,``]),children:[(0,Q.jsx)(Vn,{"aria-hidden":`true`}),`Add service`]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Address to show (optional)`}),(0,Q.jsx)(Ar,{value:d,onChange:e=>f(e.target.value),placeholder:`http://localhost:5173 — empty: the first address a service prints`,"aria-label":`Address to show`,"aria-invalid":x,spellCheck:!1,className:`h-8 font-mono text-xs md:text-xs`}),x?(0,Q.jsx)(`span`,{className:`text-danger`,children:`Start it with http:// or https://`}):null]}),p?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:p}):null]}),(0,Q.jsxs)(xr,{className:`gap-2 sm:justify-between`,children:[i?.[o]?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,disabled:h,onClick:()=>void v(null),children:[`Remove `,o===`project`?`team`:`your`,` recipe`]}):(0,Q.jsx)(`span`,{}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{type:`button`,disabled:h||y.length===0||x,onClick:()=>void v({services:y,...b?{url:b}:{}}),children:`Save`})]})]})]})})}var Oa=1e3,ka=12e4,Aa=6e5,ja=[`dev`,`start`,`serve`,`preview`,`run`],Ma=e=>`cez:preview-run:${e??`default`}`;function Na(e){try{return window.localStorage.getItem(Ma(e))}catch{return null}}function Pa(e,t){try{window.localStorage.setItem(Ma(e),t)}catch{}}function Fa(e){for(let t of ja){let n=e.find(e=>RegExp(`^(npm run|make) ${t}$`).test(e.command));if(n)return n.command}return null}function Ia(e,t){try{let n=new URL(e),r=new URL(t),i=e=>e.hostname===`127.0.0.1`||e.hostname===`[::1]`?`localhost`:e.hostname,a=e=>e.port||(e.protocol===`https:`?`443`:`80`);return n.protocol===r.protocol&&i(n)===i(r)&&a(n)===a(r)}catch{return!1}}function La(e,t,n){let r=e.filter(e=>Date.parse(e.lastSeenAt)>=t&&e.running!==!1);return n?r.some(e=>Ia(e.url,n))?n:null:(r.find(e=>e.running===!0)??r[0])?.url??null}function Ra({runId:e,projectId:t,onOpen:n,onShowTerminal:r,setup:i}){let a=i?.phase===`setup`&&i.needsAttention,o=i?.phase===`setup`&&!i.needsAttention&&i.activeOperationId!==void 0,[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(()=>Na(t)),[g,_]=(0,Z.useState)(``),[y,b]=(0,Z.useState)({kind:`idle`}),[x,S]=(0,Z.useState)(!1),C=(0,Z.useCallback)(()=>{let t=!1;return G(e).then(e=>{t||(c(e.commands),u(e.install??null),p(e.recipe??null))}).catch(()=>!t&&c([])),()=>{t=!0}},[e]);(0,Z.useEffect)(()=>C(),[C]);let w=m??(s?Fa(s):null),T=(0,Z.useRef)(null),E=(0,Z.useRef)([]);(0,Z.useEffect)(()=>()=>{T.current=null;for(let e of E.current)clearTimeout(e)},[]);let D=(0,Z.useCallback)((r,i={})=>{let a=r.services.map(e=>e.trim()).filter(Boolean);if(a.length===0)return;let o={};T.current=o;let s=()=>T.current===o,c=e=>E.current.push(setTimeout(e,Oa)),f={services:a,...r.url?{url:r.url}:{}};i.remember&&a[0]&&(Pa(t,a[0]),h(a[0]));let p=async t=>{let n=await le(e).catch(()=>null);for(let[e,r]of t.entries()){let t=n?.sessions.find(e=>e.id===r)?.exitCode;if(t!=null)return{index:e,code:t}}return null},m=async()=>{b({kind:`starting`,plan:f});let t=Date.now()-1e3,r=[];for(let t of a){let n=await v(e,{});if(!s())return;r.push(n.id),await d(e,n.id,`${t}\r`)}let i=async()=>{if(!s())return;if(Date.now()-t>ka){b({kind:`no-address`,plan:f});return}let o=await O(e).catch(()=>null);if(!s())return;let l=o?La(o.urls,t,f.url):null;if(l){T.current=null,n(l);return}let u=await p(r);if(s()){if(u){b({kind:`exited`,command:a[u.index],code:u.code});return}c(()=>void i())}};await i()};(async()=>{if(!l)return m();b({kind:`installing`,install:l,plan:f});let t=Date.now(),n=await v(e,{});if(!s())return;await d(e,n.id,`${l} && exit 0 || exit 1\r`);let r=async()=>{if(!s())return;if(Date.now()-t>Aa){b({kind:`no-address`,plan:f});return}let e=await p([n.id]);if(s()){if(!e)return c(()=>void r());if(e.code!==0){b({kind:`exited`,command:l,code:e.code});return}u(null),await m()}};c(()=>void r())})().catch(()=>{s()&&b({kind:`failed`})})},[l,n,t,e]),k=(s??[]).filter(e=>f!==null||e.command!==w),A=r?(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:[(0,Q.jsx)(Qn,{"aria-hidden":`true`}),`Show terminal`]}):null,ee=(0,Q.jsx)(Da,{open:x,onOpenChange:S,suggestion:f?{services:f.services,...f.url?{url:f.url}:{}}:{services:w?[w]:[``]},onSaved:C});if(y.kind===`installing`||y.kind===`starting`){let e=y.plan.services.join(` · `);return(0,Q.jsx)(za,{icon:(0,Q.jsx)(In,{"aria-hidden":`true`,className:`size-5 motion-safe:animate-spin`}),title:y.kind===`installing`?`Installing dependencies (${y.install})`:`Starting ${e}`,subtitle:y.kind===`installing`?`This worktree has no dependencies yet. ${e} starts as soon as they are installed.`:`Running in ${y.plan.services.length>1?`new terminal tabs`:`a new terminal tab`} of this task. The page opens here as soon as the app is up${y.plan.url?` at ${y.plan.url}`:``}.`,children:A})}let te=y.kind===`exited`?`${y.command} exited with code ${y.code} before the app was up.`:y.kind===`no-address`?`${y.plan.services.join(` · `)} is still running, but ${y.plan.url?`nothing answered at ${y.plan.url}`:`printed no address`} yet. Enter it above, or check the terminal.`:y.kind===`failed`?`Could not open a terminal for this task.`:null,j=(0,Q.jsxs)(sn,{children:[(0,Q.jsx)(nn,{asChild:!0,children:(0,Q.jsxs)(J,{type:`button`,variant:f||w?`outline`:`primary`,size:`sm`,"data-action":`run-app-other`,disabled:o,children:[f||w?`Other command`:`Choose a command`,(0,Q.jsx)(Qt,{"aria-hidden":`true`})]})}),(0,Q.jsxs)(rn,{align:`center`,className:`max-h-80 w-80 overflow-y-auto`,children:[(0,Q.jsx)(tn,{children:`Project commands`}),k.length===0?(0,Q.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-soft-foreground`,children:s===null?`Looking…`:`No other commands in package.json or a Makefile.`}):k.map(e=>(0,Q.jsxs)(an,{onSelect:()=>D({services:[e.command]},{remember:!0}),className:`flex-col items-start gap-0`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:e.command}),(0,Q.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[e.source,e.detail?` — ${e.detail}`:``]})]},`${e.source}:${e.command}`)),(0,Q.jsx)(on,{}),(0,Q.jsx)(tn,{className:`font-normal text-soft-foreground`,children:`Custom command`}),(0,Q.jsx)(`form`,{className:`px-2 pb-1`,onSubmit:e=>{e.preventDefault(),D({services:[g]},{remember:!0}),_(``)},children:(0,Q.jsx)(Ar,{value:g,onChange:e=>_(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`e.g. npm run dev`,"aria-label":`Custom command`,spellCheck:!1,className:`h-8 px-2 font-mono text-xs shadow-none focus-visible:ring-0 md:text-xs`})})]})]}),ne=l?` Installs its dependencies first (${l}).`:``,M=o?`This worktree's setup scripts are still running. Start the app when they finish.`:a?`This worktree's setup needs attention — retry it from the task's Chat, or start the app anyway.`:null;return(0,Q.jsxs)(za,{icon:(0,Q.jsx)(Bn,{"aria-hidden":`true`,className:`size-5`}),title:f?`Start the app`:`Run the app`,subtitle:te??(f?`${f.scope===`personal`?`Your`:`This project's`} start recipe runs each service in its own terminal tab and opens ${f.url??`the address it prints`}.${ne}`:`Starts the task's app in a terminal of its worktree and opens the address it prints.${ne} Or enter an address above.`),children:[M?(0,Q.jsx)(`p`,{"data-slot":`run-app-setup`,role:`status`,className:`max-w-md text-xs text-foreground`,children:M}):null,f?(0,Q.jsx)(`ul`,{"data-slot":`start-app-services`,className:`flex flex-col gap-0.5 font-mono text-xs text-foreground`,children:f.services.map((e,t)=>(0,Q.jsx)(`li`,{children:e},t))}):null,(0,Q.jsxs)(`div`,{"data-slot":`run-app-actions`,className:`flex flex-wrap items-center justify-center gap-2`,children:[f?(0,Q.jsxs)(J,{type:`button`,size:`sm`,"data-action":`start-app`,disabled:o,onClick:()=>D(f),children:[(0,Q.jsx)(Bn,{"aria-hidden":`true`}),`Start app`]}):w?(0,Q.jsxs)(J,{type:`button`,size:`sm`,"data-action":`run-app`,disabled:o,onClick:()=>D({services:[w]},{remember:!0}),children:[(0,Q.jsx)(Bn,{"aria-hidden":`true`}),`Run `,(0,Q.jsx)(`code`,{className:`font-mono text-label`,children:w})]}):null,j,te?A:null]}),(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`xs`,"data-action":`edit-start-app`,className:`text-muted-foreground`,onClick:()=>S(!0),children:[(0,Q.jsx)(ln,{"aria-hidden":`true`}),f?`Edit start recipe`:`Save a start recipe for this project`]}),ee]})}function za({icon:e,title:t,subtitle:n,children:r}){return(0,Q.jsxs)(`div`,{"data-slot":`run-app`,className:`flex h-full flex-col items-center justify-center gap-3 px-6 py-8 text-center`,children:[(0,Q.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:t}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),r]})}var Ba={running:{label:`In progress`,tone:`pending`,pulse:!0},asking:{label:`Agent is waiting for your answer`,tone:`violet`},done:{label:`Done`,tone:`success`}};function Va({note:e,notes:t,onClose:n}){let r=e.phase===`draft`,i=e.text.trim()===``,a=r&&!e.added,o=()=>{a&&t.discard(e.key),n()},s=()=>{t.discard(e.key),n()},c=()=>{if(e.added)return n();i||(t.markAdded(e.key),n())},l=r?null:Ba[e.phase];return(0,Q.jsxs)(`div`,{"data-slot":`design-note`,"data-phase":e.phase,className:`flex flex-col gap-2 p-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.number===void 0?null:(0,Q.jsxs)(`span`,{"data-slot":`design-note-number`,"aria-label":`Note ${e.number}`,className:`flex h-[21px] shrink-0 items-center gap-1 rounded-md bg-primary pr-[7px] pl-1.5 text-xs leading-none font-bold text-primary-foreground`,children:[(0,Q.jsx)(Ln,{"aria-hidden":`true`,className:`size-3`,strokeWidth:2.5}),e.number]}),(0,Q.jsx)(`span`,{"data-slot":`design-note-element`,className:`min-w-0 flex-1 truncate font-mono text-meta font-medium text-foreground`,title:e.pick.selector,children:Yi(e.pick)}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-6`,"aria-label":a?`Discard note`:`Close`,title:a?`Discard this note and deselect the element (Esc)`:`Close (Esc)`,onClick:o,children:(0,Q.jsx)(nr,{"aria-hidden":`true`})})]}),l?(0,Q.jsxs)(`p`,{"data-slot":`design-note-status`,className:`flex items-center gap-1.5 text-soft-foreground`,children:[(0,Q.jsx)(Nr,{tone:l.tone,pulse:l.pulse??!1}),l.label]}):null,r?(0,Q.jsx)(er,{value:e.text,onChange:n=>t.setText(e.key,n.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),o()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),c())},placeholder:`What should change here?`,readOnly:e.sending===!0,"aria-label":`Note for the agent`,autoFocus:!0,rows:3,className:`min-h-16 resize-none text-ui md:text-ui`}):(0,Q.jsx)(`p`,{"data-slot":`design-note-text`,className:`max-h-40 overflow-y-auto rounded-md border border-border bg-muted/40 px-2 py-1.5 text-ui break-words whitespace-pre-wrap text-foreground`,children:e.text}),r?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e.added?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`text-soft-foreground hover:text-danger`,disabled:e.sending===!0,onClick:s,children:[(0,Q.jsx)($n,{"aria-hidden":`true`}),`Delete`]}):(0,Q.jsx)(`span`,{}),(0,Q.jsx)(J,{type:`button`,size:`sm`,disabled:!e.added&&i,title:e.added?`Done (Ctrl/⌘+Enter)`:`Add note (Ctrl/⌘+Enter)`,onClick:c,children:e.added?`Done`:`Add note`})]}):null]})}function Ha({notes:e}){let t=e.sending;if(e.ready===0&&!t)return null;let n=async()=>{if(!t)try{await e.sendAll()}catch(e){Y(e instanceof Error&&e.message?e.message:`Could not send the notes.`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{"data-slot":`design-notes-tray`,className:`flex items-center gap-2 rounded-xl border border-border bg-background/95 py-1.5 pr-1.5 pl-3 text-xs shadow-lg`,children:[(0,Q.jsx)(Ln,{"aria-hidden":`true`,className:`size-3.5 text-soft-foreground`}),(0,Q.jsxs)(`span`,{className:`text-foreground`,children:[e.ready,` `,e.ready===1?`note`:`notes`]}),(0,Q.jsxs)(J,{type:`button`,size:`sm`,disabled:t,onClick:()=>void n(),children:[(0,Q.jsx)(Un,{"aria-hidden":`true`}),t?`Sending…`:`Send to agent`]})]})}var Ua=2e4,Wa=new Map;function Ga(e){let t=Wa.get(e);return t||(t={drafts:void 0,sent:[],counter:0,listeners:new Set,chain:Promise.resolve(),timer:void 0,version:0,inFlight:null},Wa.set(e,t)),t}function Ka(e){if(e===``)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t.slice(0,12)){if(typeof e!=`object`||!e)continue;let t=e,r=Ji(t.pick);!r||r.mark===void 0||n.push({key:r.mark,pick:{...r,mark:r.mark},text:typeof t.text==`string`?t.text.slice(0,Ua):``,...t.added===!0?{added:!0}:{}})}return n}var qa=e=>e.length===0?``:JSON.stringify(e.map(e=>({pick:e.pick,text:e.text,...e.added?{added:!0}:{}}))),Ja=e=>{try{return new URL(e).pathname}catch{return}};function Ya(e){return ea(e.text.trim(),[{...e.pick,id:e.key}])}function Xa(e){if(e.length===1)return Ya(e[0]);let t=e.map((e,t)=>`## Note ${t+1}\n\n${Ya(e)}`).join(`
|
|
8
|
+
|
|
9
|
+
`);if(t.length>1e5)throw Error(`Too long with ${e.length} notes — send fewer at once.`);return t}function Za(e,t,n){let r=t.status===`running`,i=!1,a=e.map(e=>{let a=e;return a.phase===`asking`&&r&&(a={...a,phase:`running`,sawRunning:!0}),a.phase===`running`&&(r?a.sawRunning||(a={...a,sawRunning:!0}):(a.sawRunning||n-(a.deliveredAt??n)>Qa)&&(a={...a,phase:t.asking?`asking`:`done`})),a!==e&&(i=!0),a}),o=a.filter(e=>e.phase===`running`||e.phase===`asking`),s=Math.max(...o.map(e=>e.deliveredAt??0));return o.some(e=>(e.deliveredAt??0)<s)&&(a=a.map(e=>o.includes(e)&&(e.deliveredAt??0)<s?{...e,phase:`done`}:e),i=!0),i?a:e}var Qa=15e3;function $a(e){let t=e.id,n=Ga(t),i=ie(t),a=i.data?.surfaces?.[Gi]?.text;(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>(n.listeners.add(e),()=>n.listeners.delete(e)),[n]),()=>n.version);let o=(0,Z.useCallback)(()=>{n.version++,n.listeners.forEach(e=>e())},[n]);(0,Z.useEffect)(()=>{!i.isSuccess||n.drafts!==void 0||(n.drafts=Ka(typeof a==`string`?a:``),o())},[i.isSuccess,o,n,a]);let s=(0,Z.useCallback)(e=>{clearTimeout(n.timer),n.timer=setTimeout(()=>{let e=qa(n.drafts??[]);e.length>1e5||(n.chain=n.chain.catch(()=>{}).then(()=>r(t,Gi,{text:e,images:[]})).catch(()=>{}))},e)},[t,n]),c=qn(e,(0,Z.useCallback)((e,n,r)=>L(t,{text:e,idempotencyKey:r}),[t]),{surface:null}),l=(0,Z.useRef)(c);l.current=c;let u=e.status===`waiting`&&e.askParked===!0;(0,Z.useEffect)(()=>{let t=Za(n.sent,{status:e.status,asking:u},Date.now());t!==n.sent&&(n.sent=t,o())},[u,o,e.status,n,n.version]);let d=(0,Z.useCallback)(e=>n.drafts===void 0?(Y(`Still loading this task — click the element again in a moment.`),!1):e.mark===void 0?!1:n.drafts.length>=12?(Y(`12 notes are already open — send or close some first.`,{tone:`danger`}),!1):(n.drafts=[...n.drafts,{key:e.mark,pick:{...e,mark:e.mark},text:``}],o(),s(0),!0),[s,o,n]),f=(0,Z.useCallback)((e,t)=>{n.inFlight?.has(e)||!n.drafts?.some(t=>t.key===e)||(n.drafts=n.drafts.map(n=>n.key===e?{...n,text:t.slice(0,Ua)}:n),o(),s(500))},[s,o,n]),p=(0,Z.useCallback)(e=>{n.drafts?.some(t=>t.key===e&&!t.added)&&(n.drafts=n.drafts.map(t=>t.key===e?{...t,added:!0}:t),o(),s(0))},[s,o,n]),m=(0,Z.useCallback)(e=>{n.inFlight?.has(e)||!n.drafts?.some(t=>t.key===e)||(n.drafts=n.drafts.filter(t=>t.key!==e),o(),s(0))},[s,o,n]),h=(0,Z.useCallback)(async()=>{if(n.inFlight!==null)return;let e=(n.drafts??[]).filter(e=>e.text.trim()!==``);if(e.length===0)return;let t=Xa(e),r=new Set(e.map(e=>e.key));n.inFlight=r,o();try{await l.current(t,[])}finally{n.inFlight=null,o()}let i=Date.now();n.sent=[...n.sent,...e.map(e=>({key:e.key,pick:e.pick,text:e.text.trim(),number:++n.counter,sawRunning:!1,phase:`running`,deliveredAt:i}))],n.drafts=(n.drafts??[]).filter(e=>!r.has(e.key)),o(),s(0)},[s,o,n]),g=(0,Z.useMemo)(()=>[...(n.drafts??[]).map(e=>({...e,phase:`draft`,...n.inFlight?.has(e.key)?{sending:!0}:{}})),...n.sent],[n,n.version]);return{notes:g,marks:(0,Z.useMemo)(()=>g.map(e=>e.phase===`draft`?{key:e.key,selector:e.pick.selector,path:Ja(e.pick.url),label:Yi(e.pick),draft:!0}:{key:e.key,n:e.number,label:Yi(e.pick),draft:!1}),[g]),note:(0,Z.useCallback)(e=>g.find(t=>t.key===e),[g]),addDraft:d,setText:f,markAdded:p,discard:m,ready:g.filter(e=>e.phase===`draft`&&e.text.trim()!==``).length,sending:n.inFlight!==null,sendAll:h}}var eo=`diff-comments`;function to(e){if(e===``)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.id!=`string`||typeof t.path!=`string`||t.side!==`old`&&t.side!==`new`||typeof t.line!=`number`||typeof t.body!=`string`||n.push({id:t.id,path:t.path,side:t.side,line:t.line,body:t.body,excerpt:typeof t.excerpt==`string`?t.excerpt:``,...typeof t.oldPath==`string`&&t.oldPath!==``?{oldPath:t.oldPath}:{},...no(t.start)?{start:{side:t.start.side,line:t.start.line}}:{}})}return n}function no(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.side===`old`||t.side===`new`)&&typeof t.line==`number`}function ro(e){return Jr(e,e.start)}function io(e){let t=e=>e.side===`old`?0:1,n=e=>e.start??e;return[...e].sort((e,r)=>e.path.localeCompare(r.path)||t(n(e))-t(n(r))||n(e).line-n(r).line)}var ao=`Review comments on the diff:`;function oo(e){return e.length===0?``:`${ao}\n\n${io(e).map(e=>{let t=e.side===`old`?`\`${e.oldPath??e.path}\` line ${e.line} (removed line${e.oldPath?`, renamed to \`${e.path}\``:``})`:`\`${e.path}\` line ${e.line}`;return`- ${e.start?mo(e):t}:\n\n${go(ho(e.excerpt))}\n\n${go(e.body)}`}).join(`
|
|
10
|
+
|
|
11
|
+
`)}`}var so=/^- `([^`]+)` (.+):$/;function co(e){let t=e.indexOf(`${ao}\n\n`);if(t===-1||t>0&&e[t-1]!==`
|
|
12
|
+
`)return;let n=e.slice(0,t).trim(),r=e.slice(t+28+2).split(`
|
|
13
|
+
`),i=[],a=0;for(;a<r.length;){let e=so.exec(r[a]??``);if(!e){if((r[a]??``).trim()===``){a++;continue}return}a++;let t=[];for(;a<r.length&&!so.test(r[a]??``);)t.push((r[a]??``).replace(/^ {2}/,``)),a++;i.push(lo(e[1],e[2],t))}return i.length>0?{lead:n,items:i}:void 0}function lo(e,t,n){let r=/renamed to `([^`]+)`/.exec(t)?.[1],i=/lines? (\d+)/.exec(t),a=t.startsWith(`removed `)||t.includes(`(removed line`)?`old`:`new`,o=n;for(;o[0]?.trim()===``;)o=o.slice(1);let s=``,c=/^(`{3,})\s*$/.exec(o[0]??``);if(c){let e=o.findIndex((e,t)=>t>0&&e.trim()===c[1]);s=o.slice(1,e===-1?void 0:e).join(`
|
|
14
|
+
`),o=e===-1?[]:o.slice(e+1)}else{let e=[];for(;o[0]?.startsWith(`> `);)e.push(o[0].slice(2)),o=o.slice(1);s=e.join(`
|
|
15
|
+
`)}return{path:r??e,label:t,...i?{line:Number(i[1])}:{},side:a,excerpt:s,body:o.join(`
|
|
16
|
+
`).trim()}}function uo(e,t){let n=oo(t);return n===``?e:e.trim()===``?n:`${e}\n\n${n}`}function fo(e){return/^\/([A-Za-z0-9][A-Za-z0-9._-]*)(?=\s|$)/.exec(e.trimStart())?.[1]}function po(e,t){let n=fo(e);return n===void 0||(t?.includes(n)??!1)}function mo(e){let t=e.side===`old`||e.start?.side===`old`,n=e.oldPath&&t?` (removed lines numbered in \`${e.oldPath}\`)`:``;return`\`${e.path}\` ${ro(e)}${n}`}function ho(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(e=>e.length)),n="`".repeat(Math.max(3,t+1));return`${n}\n${yo(e).split(`
|
|
17
|
+
`).map(e=>e.trimEnd()).join(`
|
|
18
|
+
`)}\n${n}`}function go(e){return e.split(`
|
|
19
|
+
`).map(e=>` ${e}`).join(`
|
|
20
|
+
`)}var _o=1e3;function vo(e,t=200){let n=yo(e);return n.length<=t?n:`${n.slice(0,t)}…`}function yo(e){return e.replace(/^(?:[ \t]*\r?\n)+/,``).replace(/\s+$/,``)}function bo(e,t){let n=uo(e,t);if(n.length>1e5)throw Error(`Too long with the ${t.length===1?`diff comment`:`${t.length} diff comments`} attached — shorten the message or remove some comments.`);return n}function xo(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}var So=new WeakMap;function Co(e){let t=So.get(e);return t||(t={lists:new Map,listeners:new Map,chains:new Map,removed:new Map,base:new Map,pending:new Map},So.set(e,t)),t}var wo=[];function To(e){let t=U(),n=Co(t),i=ie(e===``?void 0:e),a=i.data?.surfaces?.[eo]?.text,o=(0,Z.useMemo)(()=>to(typeof a==`string`?a:``),[a]),s=(0,Z.useSyncExternalStore)((0,Z.useCallback)(t=>{let r=n.listeners.get(e)??new Set;return r.add(t),n.listeners.set(e,r),()=>r.delete(t)},[e,n]),()=>n.lists.get(e));(0,Z.useEffect)(()=>{if(!i.isSuccess)return;let t=n.lists.get(e);if(t===void 0){n.lists.set(e,o),n.base.set(e,o),n.listeners.get(e)?.forEach(e=>e());return}if((n.pending.get(e)??0)>0)return;let r=Do(t,o,n.base.get(e)??[],n.removed.get(e));n.base.set(e,o),r!==t&&(n.lists.set(e,r),n.listeners.get(e)?.forEach(e=>e()))},[i.isSuccess,e,o,n]),(0,Z.useEffect)(()=>{if(e===``)return;let n=()=>{document.visibilityState===`visible`&&t.invalidateQueries({queryKey:V.runs.drafts(e)})};return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},[t,e]);let c=s??(i.isSuccess?o:wo),l=(0,Z.useCallback)(()=>n.lists.get(e)??o,[e,o,n]),u=(0,Z.useCallback)(r=>{n.lists.set(e,r),n.listeners.get(e)?.forEach(e=>e());let i=Eo(r);t.setQueryData(V.runs.drafts(e),e=>{let t={...e?.surfaces??{}};return i===``?delete t[eo]:t[eo]={text:i,images:[],updatedAt:new Date().toISOString()},{surfaces:t}})},[t,e,n]),d=(0,Z.useCallback)((t,i=[])=>{if(Eo(t).length>1e5)return Y(`Too many comments to keep as a draft — send the ones you have first.`,{tone:`danger`}),!1;if(i.length>0){let t=n.removed.get(e)??new Set;for(let e of i)t.add(e);n.removed.set(e,t)}u(t),n.pending.set(e,(n.pending.get(e)??0)+1);let a=(n.chains.get(e)??Promise.resolve()).catch(()=>{}).then(async()=>{let i=n.lists.get(e)??t,a=i;try{let t=(await M(e)).surfaces?.[eo]?.text;a=Do(i,to(typeof t==`string`?t:``),n.base.get(e)??[],n.removed.get(e))}catch{}a!==i&&u(a);let o=Eo(a);o.length>1e5||(await r(e,eo,{text:o,images:[]}),n.base.set(e,a))}).catch(()=>{}).finally(()=>{n.pending.set(e,Math.max(0,(n.pending.get(e)??1)-1))});return n.chains.set(e,a),!0},[u,e,n]),f=(0,Z.useCallback)(e=>d([...l(),{...e,body:e.body.slice(0,Yr),excerpt:vo(e.excerpt,e.start?_o:200),id:xo()}]),[l,d]),p=(0,Z.useCallback)((e,t)=>d(l().map(n=>n.id===e?{...n,body:t.slice(0,Yr)}:n)),[l,d]),m=(0,Z.useCallback)(e=>void d(l().filter(t=>t.id!==e),[e]),[l,d]),h=(0,Z.useCallback)(()=>void d([],l().map(e=>e.id)),[l,d]),g=(0,Z.useCallback)(async e=>{let t=l(),n=await e(t);if(t.length>0){let e=new Map(t.map(e=>[e.id,e.body])),n=l();d(n.filter(t=>e.get(t.id)!==t.body),n.filter(t=>e.get(t.id)===t.body).map(e=>e.id))}return n},[l,d]);return{ready:s!==void 0||i.isSuccess,comments:c,add:f,update:p,remove:m,clear:h,submit:g}}function Eo(e){return e.length===0?``:JSON.stringify(e)}function Do(e,t,n,r){let i=new Map(n.map(e=>[e.id,e])),a=new Map(t.map(e=>[e.id,e])),o=[];for(let t of e){let e=i.get(t.id),n=a.get(t.id);if(e&&!n)continue;let r=!e||e.body!==t.body;o.push(n&&!r?n:t)}let s=new Set(e.map(e=>e.id));for(let e of t)!s.has(e.id)&&!r?.has(e.id)&&o.push(e);return o.length===e.length&&o.every((t,n)=>t===e[n]||JSON.stringify(t)===JSON.stringify(e[n]))?e:o}function Oo({items:e}){let{id:t}=_e();return(0,Q.jsxs)(`div`,{"data-slot":`review-comments`,className:`mt-1 flex flex-col gap-2 text-left`,children:[(0,Q.jsxs)(`p`,{className:`text-label font-medium text-muted-foreground`,children:[e.length,` `,e.length===1?`comment`:`comments`,` on the diff`]}),e.map((e,n)=>(0,Q.jsxs)(`div`,{"data-slot":`review-comment`,className:`overflow-hidden rounded-lg border border-border bg-background/60`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 border-b border-border/60 px-2.5 py-1.5 text-label`,children:[(0,Q.jsx)(wn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),t?(0,Q.jsx)(Ir,{to:ko(t,e),className:`min-w-0 truncate font-mono font-medium text-foreground underline-offset-2 hover:underline`,title:`Open ${e.path} on the Changes tab`,children:e.path}):(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:e.path}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`· `,e.label]})]}),e.excerpt===``?null:(0,Q.jsx)(`pre`,{"data-slot":`review-comment-code`,className:`max-h-48 overflow-auto border-b border-border/60 bg-muted/40 px-2.5 py-1.5 font-mono text-label leading-[1.6] whitespace-pre text-muted-foreground`,children:e.excerpt}),(0,Q.jsx)(`p`,{"data-slot":`review-comment-body`,className:`px-2.5 py-2 break-words whitespace-pre-wrap text-foreground`,children:e.body})]},n))]})}function ko(e,t){let n=new URLSearchParams({file:t.path,side:t.side});return t.line!==void 0&&n.set(`line`,String(t.line)),t.commentId!==void 0&&n.set(`comment`,t.commentId),`/tasks/${e}/changes?${n.toString()}`}function Ao(e){let t=e.get(`file`);if(!t)return;let n=Number(e.get(`line`)),r=e.get(`comment`);return{path:t,side:e.get(`side`)===`old`?`old`:`new`,...Number.isInteger(n)&&n>0?{line:n}:{},...r?{commentId:r}:{}}}function jo({runId:e,comments:t,onRemove:n,onOpen:r}){return t.length===0?null:(0,Q.jsx)(ar,{delayDuration:300,children:io(t).map(t=>{let i=t.path.split(`/`).at(-1)??t.path,a=e=>e===`old`?`−`:`+`,o=`${i} ${t.start&&(t.start.side!==t.side||t.start.line!==t.line)?t.start.side===t.side?`${a(t.side)}${t.start.line}–${t.line}`:`${a(t.start.side)}${t.start.line}–${a(t.side)}${t.line}`:`${a(t.side)}${t.line}`}`,s=ro(t);return(0,Q.jsxs)(or,{children:[(0,Q.jsx)(rr,{asChild:!0,children:(0,Q.jsxs)(`span`,{"data-slot":`diff-comment-chip`,className:`flex h-8 max-w-[260px] items-center overflow-hidden rounded-md border border-border bg-muted/40 text-xs text-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-full items-center border-r border-border px-2 text-muted-foreground`,children:(0,Q.jsx)(wn,{className:`size-3.5`})}),r?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(t),className:`min-w-0 truncate px-2 font-medium hover:underline`,"aria-label":`Show comment on ${t.path} ${s}`,children:o}):(0,Q.jsx)(Ir,{to:ko(e,{path:t.path,side:t.side,line:t.line,commentId:t.id}),className:`min-w-0 truncate px-2 font-medium hover:underline`,"aria-label":`Comment on ${t.path} ${s}`,children:o}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove comment on ${i} ${s}`,onClick:()=>n(t.id),className:`flex h-full items-center px-1.5 text-soft-foreground hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3.5`})})]})}),(0,Q.jsx)(ir,{side:`top`,sideOffset:6,className:`max-w-[320px] text-left`,children:(0,Q.jsxs)(`div`,{"data-slot":`diff-comment-tooltip`,className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-meta text-contrast-foreground/80`,children:[t.path,` · `,s]}),(0,Q.jsx)(`span`,{className:`line-clamp-6 break-words whitespace-pre-wrap`,children:t.body})]})})]},t.id)})})}function Mo({run:e,draft:t,diffComments:n,continueAction:r,getMentionCandidates:i,onSendingChange:a,onOpenComment:o}){let s=e.status===`running`||e.status===`waiting`,c=e.status===`queued`,l=!s&&!c&&r.available,u=l&&r.canContinue,d=qn(e,r.continueWith),f=n.comments.length>0,p=_(f),m=(0,Z.useMemo)(()=>Array.isArray(p.data)?p.data.map(e=>e.name):void 0,[p.data]),h=Ut(e),g=s&&!h.usable,v=l&&!r.canContinue,y=g||v,b=g?h.reason:r.reason,x=u?r.pills:(0,Q.jsxs)(Q.Fragment,{children:[y&&!r.providerPending?(0,Q.jsx)(Ir,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Q.jsx)(at,{run:e})]}),S=ht(e),C=e.status===`running`||e.status===`queued`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(zn,{value:t.text,onValueChange:t.setText,images:t.images,onImagesChange:t.setImages,onSubmit:async(e,r,i)=>{if(i?.quickReply)return d(e,r);a?.(!0);try{return await t.submit(()=>f&&!po(e,m)?(Y(`Diff comments kept — /${fo(e)} is a command, so they go with your next message.`),d(e,r)):n.submit(async t=>d(bo(e,t),r)))}finally{a?.(!1)}},draftItems:f?(0,Q.jsx)(jo,{runId:e.id,comments:n.comments,onRemove:n.remove,onOpen:o}):void 0,disabled:y||!s&&!c&&!u,disabledReason:y?b:`Session closed — no session to resume.`,footerEnd:x,allowEmptySubmit:u||f,sendAriaLabel:u?`Continue`:`Send`,sendShortcut:`↵`,stop:C?{label:`Stop the run`,onStop:S.request,pending:S.pending}:void 0,placeholder:c?`Add to the prompt — sent when the run starts…`:u?`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:i}),S.dialog]})}function No({children:e,overlay:t,floating:n=!1,className:r,style:i,ref:a}){return(0,Q.jsxs)(`div`,{ref:a,"data-slot":`thread-dock`,"data-floating":n||void 0,style:i,className:q(`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`,n&&`pointer-events-none bg-transparent max-md:border-t-0 [&_[data-slot=composer]]:shadow-lg`,r),children:[t,(0,Q.jsx)(`div`,{className:q(`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 md:gap-2.5`,n&&`pointer-events-auto`),children:e})]})}function Po({run:e,embedded:t=!1,stateKey:n}){let r=l();B();let i=w(e.id,qt(e.status)),a=ke(),[o,s]=(0,Z.useState)(`unified`),[c,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=li(n,null),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),[_,v]=Tn(),y=Dn(_),S=To(e.id),{add:C}=S,T=(0,Z.useCallback)(e=>{let t=C(e);return t&&Mr(e.start?`multi_line`:`single_line`),t},[C]),E=S.comments.length,D=bt(e.id,`composer`),[O,k]=(0,Z.useState)(!1),[A,ee]=(0,Z.useState)(!1);E>0&&!A&&ee(!0),A&&E===0&&!D.hasDraft&&!O&&ee(!1);let te=E>0||O||A&&D.hasDraft,[j,ne]=(0,Z.useState)(0),M=(0,Z.useCallback)(e=>{if(!e){ne(0);return}if(ne(e.offsetHeight),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>ne(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),N=(0,Z.useMemo)(()=>{let e=new Map;for(let t of S.comments)e.set(t.path,(e.get(t.path)??0)+1);return e},[S.comments]);U();let P=H({mutationFn:t=>b(e.id,t),onError:e=>Y(e.message,{tone:`danger`})}),F=i.isError&&i.error instanceof z&&i.error.status===409,I=i.data?.files??Io,re=i.data?.baseSha,L=(0,Z.useDeferredValue)(I,Io),R=L!==I,ie=!i.isPending&&!i.isError&&I.length>0,ae=(0,Z.useMemo)(()=>jn(I),[I]),oe=(0,Z.useMemo)(()=>I.some(Kr),[I]),se=a?o:`unified`,V=!a||c,ce=(0,Z.useCallback)(e=>{let t=h.current;`side`in e&&t?.reveal?t.reveal(e):t?.scrollToPath(e.path)},[]),[le,ue]=(0,Z.useState)(null),W=(0,Z.useCallback)(e=>{h.current&&!R?ce(e):ue(e)},[R,ce]);(0,Z.useEffect)(()=>{if(le===null||R)return;let e=0,t=setInterval(()=>{!h.current&&++e<40||(clearInterval(t),ce(le),ue(null))},75);return()=>clearInterval(t)},[R,ce,le]);let G=e=>{m(e),W({path:e})},de=(0,Z.useCallback)(e=>{m(e.path),W(e)},[W,m]),[fe]=be(),K=(0,Z.useMemo)(()=>Ao(fe),[fe]),pe=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{if(!K||!ie||R)return;let e=fe.toString();if(pe.current===e)return;let t=0,n=setInterval(()=>{!h.current&&++t<40||(clearInterval(n),pe.current=e,de(K))},75);return()=>clearInterval(n)},[R,ie,de,fe,K]),(0,Q.jsxs)(`div`,{"data-route":`task-changes`,className:q(`flex min-h-full flex-col md:h-full`,t&&`@container`),children:[t?null:(0,Q.jsx)(_t,{run:e,tab:`changes`}),(0,Q.jsx)(dn,{branch:e.branch,stat:i.data?.stat,mode:se,wrap:V,preview:d,onModeChange:s,onWrapChange:u,onPreviewChange:oe?f:void 0}),i.data?.repointedHead?(0,Q.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,Q.jsx)(`code`,{children:i.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:i.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,i.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):i.isError?(0,Q.jsx)(Wr,{icon:F?(0,Q.jsx)(vn,{}):(0,Q.jsx)(Nn,{}),tone:F?`neutral`:`danger`,heading:`h2`,title:F?`No changes to show`:`Could not load the changes`,subtitle:i.error.message}):I.length===0?(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(vn,{}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:pb-[calc(1rem_+_var(--changes-dock,0px))] md:px-6 md:py-0`,style:{"--changes-dock":`${te?j:0}px`},children:[(0,Q.jsx)(`aside`,{ref:g,"data-slot":`changes-tree-pane`,style:y.style,className:q(`hidden w-60 max-w-[60%] shrink-0 overflow-y-auto overscroll-contain pt-4 pb-[calc(1rem_+_var(--changes-dock,0px))]`,t?`md:@xl:block @4xl:w-72`:`md:block lg:w-72`,y.className),children:(0,Q.jsx)(On,{root:ae,selected:p,onSelect:G,commentCounts:N})}),(0,Q.jsx)(kn,{paneRef:g,width:_,onWidthChange:v,className:q(`hidden`,t?`md:@xl:block`:`md:block`)}),(0,Q.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":a?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:L.length===0?(0,Q.jsxs)(`p`,{"data-slot":`diff-rendering`,className:`px-1 pt-4 text-xs text-soft-foreground`,children:[`Rendering `,I.length.toLocaleString(),` `,I.length===1?`file`:`files`,`…`]}):(0,Q.jsx)(Zr,{files:L,viewRef:h,mode:se,wrap:V,preview:a&&oe&&d,loadFileText:t=>Lo(e.id,t),imageSrc:t=>x(e.id,t),oldImageSrc:re?t=>x(e.id,t,re):void 0,onOpenInApp:r.data?.capabilities.localHandoff?e=>P.mutate(e):void 0,comments:S.comments,onAddComment:S.ready?T:void 0,onEditComment:S.update,onRemoveComment:S.remove,className:`min-w-0 md:pt-4 md:pb-[calc(1rem_+_var(--changes-dock,0px))] [&_[data-slot=diff-comment-editor]]:scroll-mb-[var(--changes-dock,0px)] [&_[data-slot=diff-line-comment]]:scroll-mb-[var(--changes-dock,0px)] [&_[data-slot=diff-line]]:scroll-mb-[var(--changes-dock,0px)]`},e.id)})]}),te?(0,Q.jsx)(No,{ref:M,floating:!0,className:`mt-auto`,style:{marginTop:ie&&j?-j:void 0},children:(0,Q.jsx)(Fo,{run:e,draft:D,diffComments:S,onSendingChange:k,onOpenComment:e=>de({path:e.path,side:e.side,line:e.line,commentId:e.id}),getMentionCandidates:()=>I.map(e=>e.path)})}):null]})}function Fo(e){let t=Yn(e.run);return Tr(),(0,Q.jsx)(Mo,{...e,continueAction:t})}var Io=[];async function Lo(e,t){try{let n=await oe(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}function Ro({runId:e,selected:t,onSelect:n}){return(0,Q.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-ui`,children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,Q.jsx)(zo,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function zo({runId:e,path:t,depth:n,selected:r,onSelect:i}){let o=a(e,t);return o.isPending?(0,Q.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,Q.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,Q.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,Q.jsx)(Q.Fragment,{children:o.data.entries.map(a=>a.type===`dir`?(0,Q.jsx)(Bo,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,Q.jsx)(Vo,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Bo({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,Z.useState)(!1);return(0,Q.jsxs)(`li`,{children:[(0,Q.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,Q.jsx)($t,{"aria-hidden":`true`,className:q(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,Q.jsx)(Mn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,Q.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,Q.jsx)(zo,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function Vo({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=xn(t)?An:wn;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:q(`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,Q.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-meta tabular-nums text-soft-foreground`,children:Cn(n)})]})})}function Ho({run:e,embedded:t=!1,stateKey:n}){let r=a(e.id,``),[i,o]=li(n,null),s=ke(),c=(0,Z.useRef)(null),[l,u]=Tn(),d=Dn(l),f=r.isError&&r.error instanceof z&&r.error.status===409;return(0,Q.jsxs)(`div`,{"data-route":`task-files`,className:q(`flex min-h-full flex-col md:h-full`,t&&`@container`),children:[t?null:(0,Q.jsx)(_t,{run:e,tab:`files`}),r.isPending?(0,Q.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):r.isError?(0,Q.jsx)(Wr,{icon:f?(0,Q.jsx)(En,{}):(0,Q.jsx)(tr,{}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No files to browse`:`Could not load the files`,subtitle:r.error.message}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-4 md:flex-row md:px-6 md:py-0`,children:[(0,Q.jsx)(`aside`,{ref:c,"data-slot":`files-tree-pane`,style:d.style,className:q(`w-full shrink-0 md:max-w-[60%] md:overflow-y-auto md:overscroll-contain md:py-4`,t?`md:w-44 @xl:w-60 @4xl:w-72`:`md:w-60 lg:w-72`,d.className),children:(0,Q.jsx)(Ro,{runId:e.id,selected:i,onSelect:o})}),(0,Q.jsx)(kn,{paneRef:c,width:l,onWidthChange:u,className:`hidden md:block`}),(0,Q.jsx)(`div`,{"data-slot":`file-preview-pane`,...s?{role:`region`,"aria-label":`File preview`,tabIndex:0}:{},className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,Q.jsx)(`div`,{className:`md:py-4`,children:(0,Q.jsx)(Sn,{source:{kind:`run`,runId:e.id},path:i,className:`min-w-0`})})})]})]})}var Uo=2e3;function Wo(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 Go(e){let{lastEnd:t,lastStart:n}=Wo(e);return t>n?t:0}function Ko(e){let{lastEnd:t,lastStart:n}=Wo(e);return n>t?n:0}function qo(e,t){let n=U(),r=(0,Z.useMemo)(()=>Go(t),[t]),i=(0,Z.useMemo)(()=>Ko(t),[t]),a=e?.id,o=e?.status;(0,Z.useEffect)(()=>{if(a===void 0||o===void 0||o===`queued`||!(o===`running`||o===`waiting`?r>0:i>0))return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:V.runs.detail(a)}),n.invalidateQueries({queryKey:V.runs.list()})},Uo);return()=>clearTimeout(e)},[r,i,a,o,n])}var Jo={html:Ei,markdown:Ft,image:An,json:Ti,other:wn},Yo=3;function Xo({runId:e}){let t=W(e).data?.artifacts??[];if(t.length===0)return null;let n=t.filter(e=>!e.name.includes(`/`)||e.kind===`html`||e.kind===`markdown`);if(n.length===0)return null;let r=Jn(n).slice(0,Yo).reverse(),i=t.length-r.length;return(0,Q.jsxs)(`div`,{"data-slot":`thread-artifacts`,className:`flex flex-col gap-2 py-2`,children:[r.map(t=>{let n=Jo[t.kind],r=`/tasks/${e}/assets/${encodeURIComponent(t.name)}`;return(0,Q.jsxs)(`div`,{"data-slot":`thread-artifact-card`,"data-artifact":t.name,className:`flex items-center gap-3 rounded-lg border border-border bg-card px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,Q.jsx)(n,{className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate text-ui font-medium text-foreground`,children:Kn(t)}),(0,Q.jsxs)(`span`,{className:`truncate font-mono text-meta text-muted-foreground`,children:[Hn[t.kind],` · `,t.name]})]}),(0,Q.jsx)(J,{asChild:!0,variant:`outline`,size:`sm`,className:`shrink-0`,children:(0,Q.jsx)(Ir,{to:r,"data-action":`open-artifact`,"aria-label":`Open ${Kn(t)} in Assets`,children:`Open`})})]},t.name)}),i>0?(0,Q.jsxs)(Ir,{to:`/tasks/${e}/assets`,"data-action":`open-assets`,className:`self-start text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[i,` more in Assets`]}):null]})}function Zo({run:e}){let t=U(),n=H({mutationFn:()=>S(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:V.runs.detail(e.id)}),t.invalidateQueries({queryKey:V.runs.list()}),Y(`This task will not resume itself`)},onError:e=>Y(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Q.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,Q.jsx)(Nr,{tone:`pending`,pulse:!0}),(0,Q.jsxs)(`span`,{children:[e.autoResumeReason===`transient`?`Temporary provider failure — this task retries automatically at`:`Usage limit reached — this task resumes automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Q.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,Q.jsx)(ye,{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`})]})}function Qo(e){let t=U();return H({mutationFn:()=>u(e),onSuccess:()=>t.invalidateQueries({queryKey:V.runs.all}),onError:e=>Y(e.message,{tone:`danger`})})}function $o(e){let t=U();return H({mutationFn:()=>T(e),onSuccess:()=>t.invalidateQueries({queryKey:V.runs.all}),onError:e=>Y(e.message,{tone:`danger`})})}function es({run:e}){let t=e.status===`done`||e.status===`review`||e.status===`failed`||e.status===`cancelled`;return e.workflow!==`e2e-setup`||!t?null:(0,Q.jsx)(ts,{run:e})}function ts({run:e}){let t=!!s().data?.configFile,n=e.status===`done`||e.status===`review`,r=e.steps.find(e=>e.status===`failed`&&e.id!==`pr`),i=e.pullRequestUrl&&/^https?:\/\//.test(e.pullRequestUrl)?e.pullRequestUrl:void 0,a=(0,Q.jsx)(Ir,{className:`font-medium underline underline-offset-2`,to:`/settings/integrations`,children:`Settings → External integrations`});return(0,Q.jsxs)(`div`,{"data-slot":`e2e-setup-verdict`,"data-verdict":n?`works`:`not-working`,role:`status`,className:q(`mt-4 flex gap-3 rounded-lg border p-4 text-sm`,n?`border-success/40 bg-success/5`:`border-danger/40 bg-danger/5`),children:[n?(0,Q.jsx)(en,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":!0}):(0,Q.jsx)(Bt,{className:`mt-0.5 size-5 shrink-0 text-danger`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-semibold`,children:n?`e2e works`:e.status===`cancelled`?`e2e is not set up — the setup was cancelled`:`e2e is not working yet`}),n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`The config loads and the smoke test passed in a real browser.`}),(0,Q.jsx)(`p`,{className:`mt-1`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[`It is live in this project: pick the `,(0,Q.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]}):i?(0,Q.jsxs)(Q.Fragment,{children:[`One step left: merge the `,(0,Q.jsx)(`a`,{className:`font-medium underline underline-offset-2`,href:i,target:`_blank`,rel:`noreferrer`,children:`draft PR`}),`. Then pick the `,(0,Q.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`One step left: merge branch `,(0,Q.jsx)(`code`,{children:e.branch??`of this task`}),` (or open a draft PR from the header). Then pick the `,(0,Q.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]})})]}):e.status===`cancelled`?(0,Q.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Start it again from `,a,`.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[`“`,r.name,`” did not pass — its output is above.`]}):`The setup stopped before it could prove e2e works — the reason is above.`}),(0,Q.jsxs)(`p`,{className:`mt-1`,children:[`Continue this task to fix it, or set it up again from `,a,`.`]})]})]})]})}var ns=e=>e.kind===`tool`,rs=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,is=(e,t,n)=>`${e} ${e===1?t:n}`;function as(e,t){let n=[];return e>0&&n.push(is(e,`file`,`files`)),t>0&&n.push(is(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function os(e){return`${e} earlier tool call${e===1?``:`s`}`}var ss=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`,`Skill:`];function cs(e){for(let t of ss)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t.endsWith(`:`)?t.slice(0,-1):t,detail:e.slice(t.length+1)};return{verb:e}}function ls(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(ns).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:as(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)ns(e)&&rs(e)&&!r.has(e.id)?o.push(e):(s(),ns(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 us=new Map,ds=(0,Z.createContext)(null);function fs(){return(0,Z.useContext)(ds)}function ps({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>us.get(e)?.get(t),set:(t,n)=>{let r=us.get(e)??new Map;r.set(t,n),us.set(e,r)}}),[e]);return(0,Q.jsx)(ds.Provider,{value:n,children:t})}var ms=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),hs=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),gs=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),_s=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),vs=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function ys(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function bs(e){let t=ys(e);return t===void 0?void 0:ms.format(t)}function xs(e){let t=ys(e);return t===void 0?void 0:hs.format(t)}var Ss=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Cs(e){let t=ys(e);return t===void 0?void 0:Ss(t)}function ws(e,t=new Date){let n=ys(e);if(n===void 0)return;let r=Ss(n);return r===Ss(t)?`Today`:r===Ss(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?gs:_s).format(n)}function Ts(e,t){let n=ys(e),r=ys(t);if(!(n===void 0||r===void 0))return Ds(Math.round((r.getTime()-n.getTime())/1e3))}function Es(e,t){let n=ys(e);if(n!==void 0)return Ds(Math.floor((t-n.getTime())/1e3))}function Ds(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 Os(e=1e3){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ks({ts:e}){let t=bs(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:xs(e),className:`text-meta leading-none text-soft-foreground`,children:t})}function As({startedAt:e,completedAt:t}){let n=bs(t);if(n===void 0)return null;let r=Ts(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-meta leading-none text-soft-foreground`,children:[(0,Q.jsx)(`time`,{dateTime:t,title:xs(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function js({ts:e}){let t=ws(e),n=ys(e);if(t===void 0||n===void 0)return null;let r=vs.format(n);return(0,Q.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-meta font-medium text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Q.jsx)(`time`,{dateTime:Cs(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function Ms({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,Z.useState)(!1),[p,m]=(0,Z.useState)(e),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(),y=bt(c??``,l??``,{enabled:i!==void 0&&c!==void 0&&l!==void 0}),b=`${c??``} ${l??``}`,[x,S]=(0,Z.useState)(b);x!==b&&(S(b),f(!1),m(e),v(void 0)),(0,Z.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,Q.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-ui leading-[1.55] md:max-w-[70%]`,children:[(0,Q.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-ui outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Q.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Q.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,Q.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,Q.jsx)(In,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Q.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-ui leading-[1.55] md:max-w-[70%]`,children:[i||a?(0,Q.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,Q.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,Q.jsx)(Ai,{className:`size-3.5`})}):null,a?(0,Q.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,Q.jsx)($n,{className:`size-3.5`})}):null]}):null,_?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,(0,Q.jsx)(Ns,{text:e}),n.length>0?(0,Q.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>fe(e.split(`/`).pop()??``)?(0,Q.jsx)(qr,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.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,Q.jsx)(Rn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Q.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null,r===void 0?null:(0,Q.jsx)(`span`,{className:`mt-1 flex justify-end`,children:(0,Q.jsx)(ks,{ts:r})})]})}function Ns({text:e}){let t=(0,Z.useMemo)(()=>co(e),[e]);return t?(0,Q.jsxs)(Q.Fragment,{children:[t.lead===``?null:(0,Q.jsx)(Gr,{breaks:!0,children:t.lead}),(0,Q.jsx)(Oo,{items:t.items})]}):(0,Q.jsx)(Gr,{breaks:!0,children:e})}function Ps({text:e}){return(0,Q.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-lead leading-[1.65]`,children:(0,Q.jsx)(Gr,{children:e})})}function Fs({note:e}){return(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:q(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:e.tone===`info`?`text-foreground`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:e.tone===`info`?`⇄ `:`· `,e.text]})}var Is={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`,omp:`OMP`,antigravity:`Antigravity CLI`,gemini:`Gemini CLI`,kimi:`Kimi Code`};function Ls({incident:e}){if(e.profileId!==void 0)return(0,Q.jsx)(Rs,{incident:e,profileId:e.profileId});let t=Is[e.provider];return(0,Q.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,Q.jsxs)(`p`,{className:`text-ui font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Q.jsx)(Ir,{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 Rs({incident:e,profileId:t}){let n=A(),r=Is[e.provider];return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,"data-profile-id":t,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-ui font-semibold text-foreground`,children:[`This run needed `,r,` account “`,n.data?.profiles.find(n=>n.id===t&&n.provider===e.provider)?.label??t,`” to be signed in`]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Sign that account in again before retrying.`}),(0,Q.jsx)(ye,{to:`/settings/global/accounts`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open agent accounts`})]})}var zs={claude:!0,codex:!1,junie:!1,opencode:!0,cursor:!0,pi:!1,copilot:!1,omp:!1,antigravity:!1,gemini:!1,kimi:!1};function Bs({incident:e}){let t=Is[e.provider],[n,r]=(0,Z.useState)(null),i=H({mutationFn:()=>o(e.provider),onSuccess:()=>{r(null),Y(`Updating ${t} in a terminal. Continue the task once it finishes.`)},onError:e=>r({message:e.message,command:e instanceof z?e.command:void 0})}),a=async e=>{try{await Hr(e),Y(`Command copied`)}catch{Y(`Could not copy the command`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`agent-update-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-ui font-semibold text-foreground`,children:[t,` needs an update`]}),zs[e.provider]?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Update it, then continue the task.`}),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2`,disabled:i.isPending,onClick:()=>i.mutate(),children:[`Update `,t]})]}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Update it the way you installed it, then continue the task.`}),n?(0,Q.jsxs)(`div`,{"data-slot":`agent-update-manual`,className:`mt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:n.message}),n.command?(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-foreground`,children:n.command}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void a(n.command),children:`Copy`})]}):null]}):null]})}function Vs({text:e}){let t=(0,Z.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
21
|
+
`,1)[0]??``,r=n.length<e.length;return(0,Q.jsxs)(lr,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Q.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-ui text-soft-foreground hover:text-muted-foreground`,children:[(0,Q.jsx)($t,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Q.jsx)(Gr,{inline:!0,children:n})}),r?(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Q.jsx)(cr,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Q.jsx)(sr,{children:(0,Q.jsx)(`div`,{className:`px-6 py-1.5 text-ui leading-[1.6] text-soft-foreground`,children:(0,Q.jsx)(Gr,{children:e})})})]})}function Hs({since:e,lastActivityAt:t}={}){let n=Os(),r=Es(e,n),i=Es(t,n),a=bs(t);return(0,Q.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-1 text-ui text-soft-foreground`,children:[(0,Q.jsx)(In,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Q.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`}),r===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`working-elapsed`,title:`Started ${xs(e)}`,className:`font-mono text-xs tabular-nums`,children:r}),i!==void 0&&a!==void 0?(0,Q.jsxs)(`span`,{"data-slot":`working-last-activity`,title:xs(t),className:`text-xs`,children:[`· last activity `,a,` (`,i,` ago)`]}):null]})}var Us={read:Ft,edit:Ai,delete:$n,move:Di,search:Zn,execute:Ht,think:Ci,fetch:Jt,task:Vt,skill:Yt,plan:Oi,other:fn},Ws=e=>e.split(`
|
|
22
|
+
`).length;function Gs({text:e,streaming:t}){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Ws(e),s=!t&&!n&&o>12;return(0,Q.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Qr(e.currentTarget)}:void 0,className:q(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Q.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Q.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,Q.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-meta font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Ks({diffs:e}){return(0,Q.jsx)(Q.Fragment,{children:e.map((e,t)=>(0,Q.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-meta text-soft-foreground`,children:e.path}),(0,Q.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...qs(e.oldText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...qs(e.newText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
23
|
+
`).map((e,t)=>(0,Q.jsx)(Js,{text:e},t))})]},`${e.path}:${t}`))})}function qs(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
24
|
+
`)}function Js({text:e}){return(0,Q.jsx)(`span`,{className:q(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Ys(e){if(e.toolKind!==`execute`)return;let t=e.input,n=typeof t==`object`&&t&&`command`in t?t.command:void 0,r=typeof n==`string`?n:Array.isArray(n)&&n.every(e=>typeof e==`string`)?n.join(` `):cs(e.title).detail;return r!==void 0&&r.trim()!==``?r:void 0}function Xs({command:e,reveal:t=!1}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:`Copy command`,onClick:()=>{Hr(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>Y(`Copy failed — the browser blocked clipboard access.`,{tone:`danger`}))},className:q(`mt-[3px] mr-1.5 shrink-0 rounded p-1 text-soft-foreground hover:bg-muted hover:text-foreground`,t&&!n&&`[@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/tool-row:opacity-100 [@media(hover:hover)]:group-focus-within/tool-row:opacity-100`),children:n?(0,Q.jsx)(Zt,{"aria-hidden":!0,className:`size-3.5`}):(0,Q.jsx)(cn,{"aria-hidden":!0,className:`size-3.5`})})}function Zs(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Qs({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=fs(),[a,o]=(0,Z.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=Ys(e),{verb:u,detail:d}=cs(e.title),f=l!==void 0&&(l!==d||l.includes(`
|
|
25
|
+
`)||l.length>80),p=l!==void 0&&f,m=f||e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,h=m&&(a??Zs(e)),g=h&&p?l:void 0,_=Us[e.toolKind]??fn;return(0,Q.jsxs)(lr,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:h,onOpenChange:s,className:q(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,Q.jsxs)(`div`,{className:`group/tool-row flex min-w-0 items-start`,children:[(0,Q.jsxs)(cr,{disabled:!m,className:q(`group flex min-h-[28px] w-full min-w-0 gap-1.5 px-2.5 py-0.5 text-left text-ui enabled:hover:bg-muted`,g===void 0?`items-center`:`items-start [&>svg]:mt-[7px] [&>span]:mt-[2px]`),children:[(0,Q.jsx)($t,{"aria-hidden":!0,className:q(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!m&&`invisible`)}),(0,Q.jsx)(_,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:q(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),g===void 0?d===void 0?null:(0,Q.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:d}):(0,Q.jsx)(`code`,{"data-slot":`tool-command`,className:`max-h-48 min-w-0 overflow-y-auto py-1 font-mono text-xs leading-[1.6] whitespace-pre-wrap break-all text-muted-foreground`,children:g}),(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,Q.jsx)(In,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,Q.jsx)(`span`,{"data-slot":`tool-exit`,className:q(`rounded-full px-2 py-px font-mono text-micro font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),l===void 0?null:(0,Q.jsx)(Xs,{command:l,reveal:g===void 0})]}),(0,Q.jsx)(sr,{children:(0,Q.jsxs)(`div`,{className:`border-t border-border bg-card-2 empty:hidden`,children:[e.error!==void 0&&e.error!==``?(0,Q.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,Q.jsx)(Ks,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,Q.jsx)(Gs,{text:e.output,streaming:c}):null,t.length>0?(0,Q.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 $s({group:e,scope:t}){return(0,Q.jsxs)(lr,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,Q.jsxs)(cr,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-ui font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)($t,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,Q.jsx)(sr,{children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,Q.jsx)(Qs,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function ec({count:e,children:t}){return(0,Q.jsxs)(lr,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,Q.jsxs)(cr,{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,Q.jsx)($t,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),os(e)]}),(0,Q.jsx)(sr,{children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function tc({image:e}){return(0,Q.jsx)(qr,{"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`})}var nc=120,rc=e=>e!==`pending`&&e!==`running`,ic=e=>e.kind===`tool`&&e.toolKind===`task`,ac=e=>ic(e)&&e.parentItemId===void 0,oc=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function sc(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>ac(e)&&t.has(e.id)))return n;return 0}function cc(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 lc(e){if(e.kind===`tool`)return uc(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
26
|
+
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return uc(n)}}}function uc(e){return e.length>nc?`${e.slice(0,nc-1).trimEnd()}…`:e}function dc(e,t=!1){let n=_c(e,e=>e.items.some(ac));if(n===-1)return[];let r=e=>!t&&!rc(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(ac);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(ac)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?sc(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!oc(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=>pc(e,c.get(e.id)??[],t))}function fc(e){let t=new Map;for(let n of e)for(let e of n.items){if(e.kind!==`tool`||e.toolKind!==`skill`||e.parentItemId!==void 0||e.status===`failed`||e.status===`declined`)continue;let n=cs(e.title).detail??e.title;t.has(n)||t.set(n,{id:e.id,name:n})}return[...t.values()]}function pc(e,t,n){let r={id:e.id,title:cs(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=cc(e);i!==void 0&&(r.agentType=i),n&&!rc(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=lc(t[e]);if(n!==void 0){r.activity=n;break}}return r}function mc(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function hc(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function gc(e){return e.find(e=>!rc(e.status))??e[0]}function _c(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function vc(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&ac(e));if(i!==void 0)return pc(i,yc(e,t),n)}}function yc(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&ac(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)oc(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var bc=new Map,xc=!1;function Sc({runId:e,agents:t,onSelect:n}){let[r,i]=(0,Z.useState)(()=>bc.get(e)??xc),a=t.every(e=>e.status!==`pending`&&e.status!==`running`),o=(0,Z.useRef)(a);if((0,Z.useEffect)(()=>{!o.current&&a&&i(t=>t&&(bc.set(e,!1),!1)),o.current=a},[a,e]),t.length===0)return null;let{done:s,total:c}=mc(t),l=gc(t);return(0,Q.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,Q.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(bc.set(e,!t),!t)),"aria-expanded":r,className:q(`flex w-full items-center gap-2 px-3.5 text-left text-ui`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Q.jsx)(Vt,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,Q.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,s,`/`,c]}),!r&&l!==void 0?(0,Q.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,hc(l)]}):null,(0,Q.jsx)(Qt,{"aria-hidden":!0,className:q(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Q.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,Q.jsx)(Cc,{agent:e,onSelect:n},e.id))}):null]})}function Cc({agent:e,onSelect:t}){let n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wc,{status:e.status,stalled:e.stalled===!0}),(0,Q.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 eyebrow text-muted-foreground`,children:e.agentType}),(0,Q.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:hc(e)}),(0,Q.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Q.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-ui`,children:t?(0,Q.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,Q.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function wc({status:e,stalled:t=!1}){return t?(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Q.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Q.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Q.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,Q.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Q.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var Tc=new Map;function Ec(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function Dc(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function Oc(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function kc({runId:e,entries:t,settled:n=!1}){let[r,i]=(0,Z.useState)(()=>Tc.get(e)??Ec());if(t.length===0)return null;let{done:a,total:o}=Dc(t),s=n?void 0:Oc(t),c=n&&a<o;return(0,Q.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,Q.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-0.5 md:h-[3px]`,style:{background:`var(--grad)`}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Tc.set(e,!t),!t)),"aria-expanded":r,className:q(`flex w-full items-center gap-2 px-3.5 text-left text-ui`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,Q.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),c?(0,Q.jsx)(`span`,{"data-slot":`plan-unfinished`,className:`shrink-0 text-soft-foreground`,children:`· left unfinished`}):null,!r&&s!==void 0?(0,Q.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,s.activeForm??s.content]}):null,(0,Q.jsx)(Qt,{"aria-hidden":!0,className:q(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Q.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,Q.jsx)(Ac,{entry:e,settled:n},`${t}:${e.content}`))}):null]})}function Ac({entry:e,settled:t}){let n=t&&e.status===`in_progress`?`pending`:e.status;return(0,Q.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:q(`flex min-h-5 min-w-0 items-center gap-2.5 text-ui`,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,Q.jsx)(jc,{status:n}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),n===`in_progress`?(0,Q.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 eyebrow text-muted-foreground`,children:`in progress`}):null]})}function jc({status:e}){return e===`cancelled`?(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Q.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Q.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Q.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,Q.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Q.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Q.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,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function Mc({skills:e}){return e.length===0?null:(0,Q.jsxs)(`section`,{"data-slot":`skills-dock`,className:`flex min-w-0 items-center gap-2 overflow-hidden rounded-lg border border-border bg-card px-3.5 py-2 text-ui shadow-xs`,children:[(0,Q.jsx)(Yt,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 font-semibold`,children:e.length===1?`Skill`:`Skills`}),(0,Q.jsxs)(`span`,{"data-slot":`skills-names`,className:`min-w-0 truncate text-muted-foreground`,children:[`· `,e.map(e=>e.name).join(` · `)]})]})}function Nc(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(!Nc(e[n],t[n]))return!1;return!0}if(!Pc(e)||!Pc(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)||!Nc(e[r],t[r]))return!1;return!0}function Pc(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Fc(){return typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`overflow-anchor`,`auto`)}function Ic(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Z.useRef)(null),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(!0),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(null),h=(0,Z.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,Z.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,Z.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=$r(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,Z.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,Z.useCallback)(()=>{d.current&&g()},[g]),b=(0,Z.useRef)(!1),x=(0,Z.useRef)(!1),S=(0,Z.useRef)(void 0),C=(0,Z.useRef)(!1),w=(0,Z.useRef)(!1),T=(0,Z.useRef)(!1),E=(0,Z.useRef)(void 0),D=(0,Z.useRef)(0),O=(0,Z.useRef)(a);O.current=a;let k=(0,Z.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,Z.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=ni(i,k(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e&&!d.current){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(ei(e.scrollTop,i,a,k(e),r))}b.current=!1})})},[k,r,h]);(0,Z.useEffect)(()=>()=>clearTimeout(S.current),[]);let ee=(0,Z.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,Z.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,Z.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=!Fc(),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()},ee=e=>{if(e.deltaY<0){b();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&ii(t)&&A()}else O()},te=!1,j=e=>{te=e.target instanceof Node&&t.contains(e.target)},ne=e=>{let n=e.target,r=n===document.body||n===document.documentElement;!(n instanceof Node&&t.contains(n))&&!(r&&te)||([`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(b(),!e.repeat&&ii(t)&&A()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&O())},M=()=>{v=!0,T.current=!1,y=t.scrollTop,Qr(t,80)||(b(),O())},N=()=>{v=!1},P=e=>{C.current=!1,w.current=!0,_=e.touches[0]?.clientY??null},F=()=>{w.current&&(w.current=!1,d.current&&f.current===null&&g())},I=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(_!==null&&n>_+1?(b(),!C.current&&ii(t)&&(C.current=!0,A())):_!==null&&n<_-1&&O(),_=n)},re=()=>{v&&!T.current&&t.scrollTop<y&&ii(t)&&(T.current=!0,A()),y=t.scrollTop;let n=Qr(t,80);n&&f.current===null&&(d.current||Date.now()-p<2e3)&&(d.current=!0),u(!n),f.current===null&&ci(e,{top:t.scrollTop,atBottom:n}),c()};t.addEventListener(`scroll`,re,{passive:!0}),t.addEventListener(`wheel`,ee,{passive:!0}),t.addEventListener(`touchstart`,P,{passive:!0}),t.addEventListener(`touchmove`,I,{passive:!0}),window.addEventListener(`touchend`,F,{passive:!0}),window.addEventListener(`touchcancel`,F,{passive:!0}),t.addEventListener(`pointerdown`,M,{passive:!0}),window.addEventListener(`pointerup`,N,{passive:!0}),window.addEventListener(`pointerdown`,j,{capture:!0,passive:!0}),window.addEventListener(`keydown`,ne);let L;return typeof ResizeObserver<`u`&&(L=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()}),L.observe(n)),c(),()=>{cancelAnimationFrame(D.current),D.current=0,E.current=void 0,t.removeEventListener(`scroll`,re),t.removeEventListener(`wheel`,ee),t.removeEventListener(`touchstart`,P),t.removeEventListener(`touchmove`,I),window.removeEventListener(`touchend`,F),window.removeEventListener(`touchcancel`,F),t.removeEventListener(`pointerdown`,M),window.removeEventListener(`pointerup`,N),window.removeEventListener(`pointerdown`,j,{capture:!0}),window.removeEventListener(`keydown`,ne),L?.disconnect()}},[e,s,A,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:ee,loadOlder:A,restickIfStuck:y}}function Lc({runId:e,rows:t,mode:n,controls:r}){if(n===`virtual`)return(0,Q.jsx)(Rc,{runId:e,rows:t,controls:r});let i=ai(Fc());return(0,Q.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,Q.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:i,children:e.node},e.key))})}function Rc({runId:e,rows:t,controls:n}){let r=(0,Z.useRef)(null),[i]=(0,Z.useState)(()=>oi(e,t.length)),a=(0,Z.useRef)(t.length);a.current=t.length;let o=(0,Z.useRef)(null),s=(0,Z.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(ri(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,Z.useState)(0);return(0,Z.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,Q.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,Q.jsx)(Vr,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,Q.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 zc({onJump:e}){return(0,Q.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,Q.jsx)(Ot,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function Bc(e,t){let n=[];(e.task||e.taskImages?.length)&&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 Vc(e,t){return[{id:`agent:${e}`,entries:t}]}function Hc(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function Uc(e,t){let n=[],r;for(let t of e){let e=Hc(t),i=Cs(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 ls([...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 Wc({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c,rowModels:l}){let u=(0,Z.useMemo)(()=>l??Uc(n,e),[l,n,e]),d=Ic(`${e}:${t}`,{surface:r}),f=s??d,p=(0,Z.useMemo)(()=>u.map(t=>({key:t.key,node:(0,Q.jsx)(Kc,{runId:e,row:t,actions:o?.[t.key],renderAsk:a})})),[o,a,u,e]),m=c??ti(``,p.length),h=p.length===0?i??null:(0,Q.jsx)(Lc,{runId:`${e}:${t}`,rows:p,mode:m,controls:f});return(0,Q.jsx)(ps,{runId:e,children:r===`panel`?(0,Q.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,Q.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:h}),f.pillVisible?(0,Q.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Q.jsx)(zc,{onJump:f.jumpToLatest})}):null]}):h})}function Gc({runId:e,row:t,actions:n,renderAsk:r}){return qc(e,t,n,r)}var Kc=(0,Z.memo)(Gc,(e,t)=>e.runId===t.runId&&e.actions===t.actions&&e.renderAsk===t.renderAsk&&Nc(e.row,t.row));function qc(e,t,n,r){switch(t.content.kind){case`user-message`:return(0,Q.jsx)(Jc,{runId:e,message:t.content.message,actions:n});case`day-separator`:return(0,Q.jsx)(js,{ts:t.content.ts});case`turn-time`:return(0,Q.jsx)(As,{completedAt:t.content.completedAt,...t.content.startedAt===void 0?{}:{startedAt:t.content.startedAt}});case`block`:return(0,Q.jsx)(Yc,{block:t.content.block,scope:t.scope,renderAsk:r});default:return Qc(t.content)}}function Jc({runId:e,message:t,actions:n}){return(0,Q.jsx)(Ms,{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 Yc=(0,Z.memo)(function e({block:t,scope:n,renderAsk:r}){switch(t.kind){case`entry`:return(0,Q.jsx)(Zc,{entry:t.entry,scope:n,renderAsk:r});case`tool-card`:return(0,Q.jsx)(Qs,{item:t.item,nested:t.children,cacheKey:`${n}:${t.id}`,renderNested:(e,t)=>(0,Q.jsx)(Xc,{entries:e,scope:t,renderAsk:r})});case`context-group`:return(0,Q.jsx)($s,{group:t,scope:n});case`streak`:return(0,Q.jsx)(ec,{count:t.count,children:t.blocks.map(t=>(0,Q.jsx)(e,{block:t,scope:n,renderAsk:r},t.id))});default:return Qc(t)}},$c);function Xc({entries:e,scope:t,renderAsk:n}){return ls([...e]).map(e=>(0,Q.jsx)(Yc,{block:e,scope:t,renderAsk:n},e.id))}function Zc({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Q.jsx)(Ps,{text:e.text}):(0,Q.jsx)(Ms,{text:e.text});case`reasoning`:return(0,Q.jsx)(Vs,{text:e.text});case`tool`:return(0,Q.jsx)(Qs,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,Q.jsx)(Fs,{note:e});case`image`:return(0,Q.jsx)(tc,{image:e});case`ask`:return n===void 0?(0,Q.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,Q.jsx)(Ls,{incident:e});case`agent-update-required`:return(0,Q.jsx)(Bs,{incident:e});default:return Qc(e)}}function Qc(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function $c(e,t){return e.scope===t.scope&&tl(e.block,t.block)&&(!el(t.block)||e.renderAsk===t.renderAsk)}function el(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(el)}function tl(e,t){if(e.kind!==t.kind||e.id!==t.id)return!1;switch(t.kind){case`entry`:return rl(e.kind===`entry`?e.entry:void 0,t.entry);case`tool-card`:return e.kind===`tool-card`&&pl(e.item,t.item)&&nl(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)=>pl(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)=>tl(e,t.blocks[n]));default:return!1}}function nl(e,t){return e.length===t.length&&e.every((e,n)=>rl(e,t[n]))}function rl(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`&&fl(e,t,il);case`reasoning`:return e.kind===`reasoning`&&fl(e,t,al);case`tool`:return e.kind===`tool`&&pl(e,t);case`note`:return e.kind===`note`&&fl(e,t,ol);case`image`:return e.kind===`image`&&fl(e,t,sl);case`ask`:return e.kind===`ask`&&fl(e,t,cl);case`provider-auth-required`:return e.kind===`provider-auth-required`&&fl(e,t,ll);case`agent-update-required`:return e.kind===`agent-update-required`&&fl(e,t,ul);default:return!1}}var il={kind:!0,id:!0,role:!0,text:!0,phase:!0,parentItemId:!0},al={kind:!0,id:!0,text:!0,parentItemId:!0},ol={kind:!0,id:!0,text:!0,tone:!0},sl={kind:!0,id:!0,url:!0,name:!0},cl={kind:!0,id:!0,questions:!0,resolved:!0,answer:!0,fromWorkflow:!0},ll={kind:!0,id:!0,provider:!0,authFailureId:!0,profileId:!0},ul={kind:!0,id:!0,provider:!0},dl={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 fl(e,t,n){return Object.keys(n).every(n=>e[n]===t[n])}function pl(e,t){return fl(e,t,dl)}function ml({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,Q.jsx)(De,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,Q.jsx)(Ee,{"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,Q.jsx)(hl,{runId:e,renderAsk:t,agent:n,entries:r})})})}function hl({runId:e,renderAsk:t,agent:n,entries:r}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(xe,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Q.jsxs)(Te,{className:`flex min-w-0 items-center gap-2 text-lead`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 eyebrow text-muted-foreground`,children:n.agentType})]}),(0,Q.jsxs)(Ce,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(gl,{status:n.status}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Q.jsx)(Wc,{runId:e,viewId:`agent:${n.id}`,sections:Vc(n.id,r),mode:`panel`,renderAsk:t,empty:(0,Q.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-ui text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function gl({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Q.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:q(`rounded-full px-2 py-0.5 eyebrow`,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 _l({run:e,diffComments:t}){return(0,Q.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,Q.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,Q.jsx)(yn,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,Q.jsxs)(`p`,{className:`min-w-0 text-ui`,children:[(0,Q.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,Q.jsx)(Xr,{runId:e.id}),(0,Q.jsx)(vl,{run:e,diffComments:t})]})}function vl({run:e,diffComments:t}){let n=U(),r=(0,Z.useRef)(null),i=bt(e.id,`review-notes`),a=i.text,o=i.setText,[s,c]=(0,Z.useState)(null),l=dt(e.id),u=Gn(e),d=qn(e,(0,Z.useCallback)((t,n,r)=>L(e.id,{text:t,runner:u.runnerOverride,idempotencyKey:r}),[e.id,u.runnerOverride]),{surface:`review`}),f=()=>n.invalidateQueries({queryKey:V.runs.all}),p=H({mutationFn:async e=>{if(!u.canContinue)return null;let n=async t=>{let n=`Review feedback:\n${bo(e,t)}`;if(n.length>1e5)throw Error(`Too long with the diff comments attached — shorten the notes or remove some comments.`);return d(n,[])};return i.submit(()=>t?t.submit(n):n([]))},onSuccess:e=>{e!==null&&f()},onError:e=>Y(e.message,{tone:`danger`})}),h=xt(e),g=H({mutationFn:()=>m(e.id),onSuccess:e=>{Y(`Draft PR created — ${e.url}`),f()},onError:e=>{e instanceof z&&e.manual!==void 0&&c(e.manual),Y(e.message,{tone:`danger`})}}),_=g.isPending||h.pending!==null,v=()=>h.byAgent?h.onAction(`create-draft-pr`):g.mutate(),y=t?.comments.length??0,b=()=>{let e=a.trim();if(e.length===0&&y===0){Y(`Write what to change first.`),r.current?.focus();return}p.mutate(e)};return(0,Q.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(er,{ref:r,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{Lr({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(),b())},className:`min-h-[52px] text-ui`}),y>0?(0,Q.jsxs)(`p`,{"data-slot":`review-diff-comments`,className:`text-xs text-muted-foreground`,children:[`+ `,y,` `,y===1?`comment`:`comments`,` on the diff — sent back with these notes.`]}):null,u.canContinue?null:(0,Q.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:u.reason}),u.providerPending?null:(0,Q.jsx)(Ir,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(J,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:u.reason??`Send the notes back into the agent's session`,"aria-describedby":u.canContinue?void 0:`review-provider-guidance`,disabled:p.isPending||!u.canContinue,onClick:b,children:[(0,Q.jsx)(wi,{"aria-hidden":`true`}),`Send back`]}),pe(e.pullRequestUrl)?(0,Q.jsx)(J,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Q.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,Q.jsx)(un,{"aria-hidden":`true`}),`PR ↗`]})}):e.subject?null:(0,Q.jsxs)(J,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:h.byAgent?`Ask the agent to push the branch and open a draft PR`:`Push the branch and open a draft PR`,disabled:_,"aria-busy":_||void 0,onClick:v,children:[_?(0,Q.jsx)(In,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(Pn,{"aria-hidden":`true`}),_?pn[`create-draft-pr`]:`Draft PR`]}),(0,Q.jsxs)(J,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:Wt(`review`),disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,Q.jsx)(Zt,{"aria-hidden":`true`}),`Accept`]})]}),s===null?null:(0,Q.jsx)(yl,{command:s})]})}function yl({command:e}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{Hr(e).then(()=>Y(`Command copied to clipboard.`)).catch(()=>Y(`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-meta text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(cn,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function bl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var xl=1500;function Sl({status:e}){let t=(0,Z.useRef)(e),[n,r]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||bl())return;r(!0);let i=setTimeout(()=>r(!1),xl);return()=>clearTimeout(i)},[e]),n?(0,Q.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,Q.jsx)(Ur,{}),(0,Q.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,Q.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-ui font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}var Cl=/\b\d+\.\d+(?:\.\d+)?\+? or (?:newer|later|higher|above) is required\b|\brequires? (?:version |v)?\d+\.\d+(?:\.\d+)? or (?:newer|later|higher)\b/i;function wl(e){return Cl.test(e)}function Tl(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function El(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}var Dl=/^(?:continue failed|run stopped|step (?:"[^"]+"|\S+) failed)(?: — |: )/;function Ol(e){let t=e.trim();for(;Dl.test(t);)t=t.replace(Dl,``).trim();return t}function kl(e,t,n=!1,r=!1,i){switch(e){case`waiting`:return{state:`waiting`};case`failed`:if(n)return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your answer, which reopens it`};if(r)return{state:`closed`,tone:`dim`,label:`Closed after inactivity — Continue to pick it up`};let e=t&&i?.turns.at(-1)?.items.some(e=>e.kind===`note`&&(e.tone===`danger`||Dl.test(e.text))&&Ol(e.text)===Ol(t));return{state:`closed`,tone:`danger`,label:t&&!e?`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 Al(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function jl(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ml(e){let t=de.safeParse(e);return t.success?t.data:void 0}var Nl=e=>Al(e)&&typeof e.header==`string`&&Array.isArray(e.options);function Pl(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(`
|
|
27
|
+
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
28
|
+
`):n}function Fl(e){let t=e=>Pl(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 Il(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var Ll=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,Rl=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function zl(e){if(!Al(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Al(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:Rl.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function Bl(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=Ml(t.runner),d=new WeakSet,f=(e,t)=>{let n=l();u===void 0||d.has(n)||!wl(e)||(d.add(n),n.entries.push({origin:`meta`,entry:{kind:`agent-update-required`,id:`${t}:update`,provider:u}}))},p=new WeakMap,m=(e,t,n)=>{let r=l(),i=p.get(r);i||(i=new Map,p.set(r,i));let a=JSON.stringify([e.stepId,t]),o=i.get(a)??{v1:0,v2:0};i.set(a,o);let s=n===`v1`?`v2`:`v1`;return o[s]>0?(--o[s],!0):(o[n]+=1,!1)},h=(e,t)=>Oe(e.stepId,t),g=(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=jl(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=jl(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=jl(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=jl(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(!Al(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=h(t,i.id);g(r.get(a)?.turn??l(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(h(t,e)),i=$(t.delta)??``;if(!n||i===``||!Ll(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(Vl.has(n))break;let i=Si(n,t.input);if(i.toolKind===`plan`){let n=zl(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=Il(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:t.tone===`info`?`info`:`dim`;l().entries.push({origin:`meta`,...t.type===`lifecycle`&&Dl.test(e)?{failure:{message:Ol(e),stepId:t.stepId,summary:!0}}:{},entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=$(t.message)??``;if(e===``||m(t,e,`v1`))break;l().entries.push({origin:`meta`,failure:{message:Ol(e),stepId:t.stepId,summary:!1},entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}}),f(e,`v1:${t.seq}`);break}case`session.error`:{let e=$(t.message)??``;if(e===``||t.fatal===!0&&m(t,e,`v2`))break;l().entries.push({origin:`meta`,...t.fatal===!0?{failure:{message:Ol(e),stepId:t.stepId,summary:!1}}:{},entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}}),f(e,`v2:${t.seq}`);break}case`session.started`:{u=Ml(t.backend)??u;let e=n.at(-1);e&&p.delete(e);break}case`step-end`:{if(t.status!==`failed`||t.idleClosed===!0)break;let e=$(t.error)?` — ${$(t.error)}`:``;l().entries.push({origin:`meta`,...$(t.error)?{failure:{message:Ol($(t.error)),stepId:t.stepId,summary:!0}}:{},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=Ml(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;let r=$(t.profileId);l().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n,...r!==void 0&&r.length<=128?{profileId:r}:{}}});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(Nl)?n:n.filter(Nl);if(r.length===0)break;let i={kind:`ask`,id:e,questions:r,resolved:!1,...t.source===`workflow`?{fromWorkflow:!0}:{}};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){let t=e.entries.flatMap(({failure:e})=>e&&!e.summary?[e]:[]);if(e.entries=e.entries.filter(({failure:e})=>!e?.summary||!t.some(t=>t.message===e.message&&(e.stepId===void 0||t.stepId===e.stepId))),!e.v2Items)continue;let n=new Set;for(let{origin:t,entry:r}of e.entries)t===`v2`&&r.kind===`message`&&n.add(Pl(r.text,!0).trim());n.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&n.has(Pl(e.entry.text,!0).trim()))),Fl(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:Pl(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i},...s===void 0?{}:{lastEventAt:s}}}var Vl=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function Hl({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:a,embedded:o=!1}){let s=kl(e.status,e.error,ne(e),ce(e),t),c=(0,Z.useCallback)(()=>a?.(e.id),[a,e.id]),l=Tl(n),u=y(e),d=l!==void 0&&l.length>0?Dc(l):void 0,f=e.status===`running`||e.status===`waiting`,p=e.status===`queued`,m=Yn(e),h=!f&&!p&&m.available,_=h&&m.canContinue,v=qn(e,m.continueWith,{surface:null}),b=!!e.worktreeLifecycle?.activeOperationId,x=!f&&e.status!==`queued`,S=(0,Z.useMemo)(()=>dc(n.turns,x),[n.turns,x]),C=(0,Z.useMemo)(()=>fc(n.turns),[n.turns]),[w,T]=(0,Z.useState)(void 0),[D,O]=(0,Z.useState)(e.id);D!==e.id&&(O(e.id),T(void 0));let k=(0,Z.useMemo)(()=>w===void 0?void 0:vc(n.turns,w,x),[n.turns,w,x]),A=(0,Z.useMemo)(()=>w===void 0?[]:yc(n.turns,w),[n.turns,w]),ee=bt(e.id,`composer`),te=To(e.id),{mutateAsync:j}=g(e.id),{mutateAsync:M}=ue(e.id),{mutateAsync:P}=N(e.id),F=(0,Z.useMemo)(()=>p?{onEditTask:async e=>{await j({task:e})},onEditMessage:(e,t)=>M({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>P(e).then(()=>void 0)}:void 0,[p,j,M,P]),I=(0,Z.useMemo)(()=>Bc(e,t),[e,t]),re=(0,Z.useMemo)(()=>Uc(I,e.id),[I,e.id]),L=(0,Z.useCallback)(t=>(0,Q.jsx)(si,{ask:t,run:e}),[e]),ie=(0,Z.useMemo)(()=>{if(F===void 0)return;let t={task:{onEdit:F.onEditTask,editLabel:`Edit the prompt`,draftSurface:`task-prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>F.onEditMessage(n.id,e),onRemove:()=>F.onRemoveMessage(n.id),draftSurface:`message:${n.id}`};return t},[F,e.queuedMessages]),ae=R(e,E()),{search:oe}=ve(),se=ti(oe,re.length),z=Ic(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:re.map(({key:e})=>e)});return Tr(z.restickIfStuck),(0,Q.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[o?null:(0,Q.jsx)(_t,{run:e,planTally:d,onMarkedUnread:c,continuationEngine:_?m.pills:void 0}),(0,Q.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:[e.worktreeLifecycle?(0,Q.jsx)(It,{worktreeId:e.worktreeLifecycle.worktreeId,operationId:e.worktreeLifecycle.activeOperationId,worktreePath:e.worktreePath,taskTitle:e.title??e.task}):null,r?(0,Q.jsx)(ql,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,fallbackTruncated:r.fallbackTruncated,retainedPages:r.retainedPages,onLoad:z.loadOlder}):null,(0,Q.jsx)(Wc,{runId:e.id,viewId:`main`,sections:I,mode:`document`,renderAsk:L,messageActions:ie,scrollControls:z,renderMode:se,rowModels:re}),(0,Q.jsx)(Xo,{runId:e.id}),t.turns.length===0?e.status===`queued`?(0,Q.jsx)(Yl,{run:e}):(0,Q.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`&&!b?(0,Q.jsx)(Hs,{since:Jl(e,n),lastActivityAt:n.lastEventAt}):null,(0,Q.jsx)(es,{run:e}),s&&s.state===`closed`?(0,Q.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":s.state,className:q(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,s.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[(0,Q.jsx)(Wl,{label:s.label,offerContinue:s.tone===`danger`&&!e.autoResumeAt,onContinue:h?()=>v(``,[]):void 0,blockedReason:_?void 0:m.providerPending?`Checking the agent provider…`:m.reason??`Connect an agent provider to continue.`}),pe(i(e))?(0,Q.jsx)(`a`,{"data-slot":`pr-link`,href:i(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,pe(ae)?(0,Q.jsx)(`a`,{"data-slot":`issue-link`,href:ae,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`&&!b&&e.worktree!==!1?(0,Q.jsx)(_l,{run:e,diffComments:te}):null]}),(0,Q.jsx)(Sl,{status:e.status}),(0,Q.jsx)(ml,{runId:e.id,renderAsk:L,agent:k,entries:A,onClose:()=>T(void 0)}),(0,Q.jsxs)(No,{overlay:z.pillVisible?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,Q.jsx)(zc,{onJump:z.jumpToLatest})}):null,children:[(0,Q.jsx)(Sc,{runId:e.id,agents:S,onSelect:T},`agents:${e.id}`),(0,Q.jsx)(Mc,{skills:C}),l!==void 0&&l.length>0?(0,Q.jsx)(kc,{runId:e.id,entries:l,settled:x},e.id):null,(0,Q.jsx)(Zo,{run:e}),!b&&u?(0,Q.jsxs)(`div`,{"data-slot":`budget-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Nr,{tone:`pending`,pulse:!0}),`Budget reached — spent $`,u.spent.toFixed(2),` of $`,u.ceiling.toFixed(2),`; send a message to continue.`,e.status===`waiting`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(Kl,{runId:e.id})]}):null]}):!b&&e.status===`waiting`?(0,Q.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Nr,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(Kl,{runId:e.id})]}):null,p?(0,Q.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Nr,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,b?(0,Q.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Resolve the worktree operation above before continuing this task.`}):(0,Q.jsx)(Mo,{run:e,draft:ee,diffComments:te,continueAction:m,getMentionCandidates:()=>El(t)})]})]})}var Ul=/— continue to /i;function Wl({label:e,offerContinue:t=!1,onContinue:n,blockedReason:r}){let i=n?Ul.exec(e):null;if(!n)return(0,Q.jsx)(`span`,{children:e});if(!i)return t?(0,Q.jsxs)(`span`,{children:[e,` `,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` `,(0,Q.jsx)(Gl,{onContinue:n,blockedReason:r})]}):(0,Q.jsx)(`span`,{children:e});let a=e.slice(0,i.index),o=e.slice(i.index+i[0].length);return(0,Q.jsxs)(`span`,{children:[a,`—`,` `,(0,Q.jsx)(Gl,{onContinue:n,blockedReason:r}),` to `,o]})}function Gl({onContinue:e,blockedReason:t}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`footer-continue`,disabled:n||t!==void 0,title:t??`Reopen the session and pick up where it stopped`,onClick:()=>{r(!0),e().catch(e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`})).finally(()=>r(!1))},className:`rounded-sm font-semibold underline underline-offset-2 hover:brightness-125 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-not-allowed disabled:no-underline disabled:opacity-60`,children:`Continue`})}function Kl({runId:e}){let t=dt(e);return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`end-session`,title:`Close the session — the task finishes (or goes to review if it changed files)`,disabled:t.isPending,onClick:()=>t.mutate(),className:`rounded-sm font-medium text-foreground underline-offset-2 hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:opacity-60`,children:`End session`})}function ql({hasOlder:e,loading:t,error:n,fallback:r,fallbackTruncated:i,retainedPages:a,onLoad:o}){return r?(0,Q.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:i?`Progressive history is unavailable; showing only the most recent part of the session.`:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,Q.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-meta text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Q.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":a,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:o,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,Q.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Jl(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 Yl({run:e}){let t=Kt(h().data??[],e.id),n=Qo(e.id),r=$o(e.id);return(0,Q.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Q.jsx)(Nr,{tone:`pending`,pulse:!0}),(0,Q.jsx)(`p`,{className:`text-ui font-medium`,children:Nt(e.queueWaitReason)??`Waiting for a free agent slot${t===void 0?``:` — #${t} in queue`}`}),(0,Q.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · `,e.queueWaitReason?`starts automatically when the account and a slot are available`:`starts automatically when a slot frees up`]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-center gap-2`,children:[!e.queueWaitReason&&(0,Q.jsx)(J,{"data-slot":`start-now`,size:`sm`,variant:`outline`,disabled:n.isPending||n.isSuccess,onClick:()=>n.mutate(),title:`Start this task now, over the parallel-task limit`,children:`Start now`}),Xt(e).promote&&(0,Q.jsx)(J,{"data-slot":`promote-run`,size:`sm`,variant:`ghost`,disabled:r.isPending,onClick:()=>r.mutate(),title:`Start this task in the next free slot, ahead of the rest of the queue`,children:`Run First`})]})]})}var Xl=(0,Z.createContext)(null);function Zl(){return(0,Z.useContext)(Xl)}function Ql(e,t){let n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(null);return(0,Z.useLayoutEffect)(()=>{if(!e){i(null);return}let t=n.current?.closest(`[data-slot="panel"]`)??n.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>{let e=t.getBoundingClientRect();i({top:e.top,left:e.left,width:e.width,height:e.height})};r();let a=new ResizeObserver(r);return a.observe(t),window.addEventListener(`resize`,r),()=>{a.disconnect(),window.removeEventListener(`resize`,r)}},[e]),(0,Z.useEffect)(()=>{if(!e)return;let n=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]`)||t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),{ref:n,covering:e&&r!==null,style:e&&r?r:void 0}}function $l({className:e}){let t=Zl();return t?.maximized?(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`xs`,"data-action":`exit-full-view`,title:`Exit full view (Esc)`,onClick:t.toggle,className:q(`shrink-0 text-foreground`,e),children:[(0,Q.jsx)(ki,{"aria-hidden":`true`}),`Exit full view`]}):null}var eu=[];function tu(e){return Array.isArray(e)?e.flatMap(e=>{let t=me.safeParse(e);return t.success?[t.data]:[]}):[]}function nu(){let e=U(),t=ee(),n=Z.useRef(0),r=Z.useRef(Promise.resolve()),i=t.data?.savedLayouts,a=Z.useMemo(()=>i?tu(i).filter(e=>!Xe(e.name)&&e.columns.every(e=>Qe(e.view))):eu,[i]),o=Z.useCallback(t=>{let i=e.getQueryData(se.uiState);if(i===void 0)return;let a=t(tu(i.savedLayouts)).slice(0,50);e.setQueryData(se.uiState,{...i,savedLayouts:a});let o=++n.current,s=r.current.then(async()=>{let t=await I({savedLayouts:a},{keepalive:!0});o===n.current&&e.setQueryData(se.uiState,t)});r.current=s.catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),o===n.current&&e.invalidateQueries({queryKey:se.uiState})})},[e]);return{saved:a,save:Z.useCallback(e=>o(t=>{let n={name:e.name,columns:e.columns.map(({view:e,width:t})=>({view:e,width:t}))},r=t.findIndex(t=>t.name===e.name);return r<0?[...t,n]:t.map((e,t)=>t===r?n:e)}),[o]),remove:Z.useCallback(e=>o(t=>t.filter(t=>t.name!==e)),[o])}}var ru=400,iu=1500,au=2e3,ou=3e4;function su(e){let[t,n]=(0,Z.useState)(qe),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(0),d=(0,Z.useRef)(null),f=(0,Z.useRef)({taskId:e,state:null});f.current.taskId!==e&&(f.current={taskId:e,state:null},n(qe()),i(!1),o(!1),c(!1),u(0)),(0,Z.useEffect)(()=>{let t=!1,r=null;d.current=null;let a=t=>{f.current={taskId:e,state:t},g.current=t,h.current={taskId:e,state:t},n(t),i(!0)},o=async n=>{let i;try{i=await D(e)}catch{if(t)return;n===0&&a(qe()),c(!0),r=setTimeout(()=>void o(n+1),Math.min(ou,au*2**n));return}t||(d.current=e,p.current&&clearTimeout(p.current),p.current=null,c(!1),!(n>0&&i.layouts===null)&&(a(i.layouts===null?qe():je(i.layouts)),n>0&&u(e=>e+1)))};return o(0),()=>{t=!0,r&&clearTimeout(r)}},[e]);let p=(0,Z.useRef)(null),m=(0,Z.useRef)(0),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),_=(0,Z.useCallback)((e,t,n=!1)=>{if(d.current!==e)return;g.current=t;let r=m.current+=1,i=t=>{r===m.current&&f.current.taskId===e&&o(t)},a=o=>{(n?j(e,t,{keepalive:n}):j(e,t)).then(()=>i(!1)).catch(e=>{if(r===m.current){if(e?.status===400)return i(!0);if(o>0){setTimeout(()=>{r===m.current&&a(o-1)},iu);return}i(!0)}})};a(1)},[]),v=(0,Z.useCallback)((e=!1)=>{let t=h.current;!t||t.state===g.current||(p.current&&clearTimeout(p.current),p.current=null,_(t.taskId,t.state,e))},[_]);(0,Z.useEffect)(()=>{if(!(!r||f.current.taskId!==e||t===f.current.state))return h.current={taskId:e,state:t},p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,_(e,t)},ru),()=>{p.current&&clearTimeout(p.current),p.current=null}},[r,_,e,t,s]),(0,Z.useEffect)(()=>{let e=()=>v(!0);return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),v()}},[v,e]);let y=(0,Z.useCallback)(e=>{n(t=>t.active?e(t,t.active):t)},[]);return{state:t,ready:r,saveFailed:a,loadFailed:s,replaced:l,layout:He(t),addLayout:(0,Z.useCallback)(e=>n(t=>Ge(t,e)),[]),closeLayout:(0,Z.useCallback)(e=>n(t=>Ve(t,e)),[]),selectLayout:(0,Z.useCallback)(e=>n(t=>ot(t,e)),[]),renameLayout:(0,Z.useCallback)((e,t)=>n(n=>tt(n,e,t)),[]),applySaved:(0,Z.useCallback)(e=>n(t=>Fe(t,e)),[]),keepAs:(0,Z.useCallback)(e=>n(t=>Ie(t,e)),[]),addColumn:(0,Z.useCallback)(e=>y((t,n)=>Ue(t,n,e)),[y]),closeColumn:(0,Z.useCallback)(e=>y((t,n)=>Re(t,n,e)),[y]),setColumnView:(0,Z.useCallback)((e,t)=>y((n,r)=>mt(n,r,e,t)),[y]),resizeColumns:(0,Z.useCallback)((e,t)=>y((n,r)=>Ke(n,r,e,t)),[y]),moveColumn:(0,Z.useCallback)((e,t)=>y((n,r)=>gt(n,r,e,t)),[y]),openDeepLink:(0,Z.useCallback)(e=>n(t=>et(t,e)),[]),dropView:(0,Z.useCallback)((e,t,r)=>n(n=>Me(n,e,t,r)),[]),setColumnBrowser:(0,Z.useCallback)((e,t)=>y((n,r)=>yt(n,r,e,t)),[y]),openInBrowser:(0,Z.useCallback)(e=>{let t=h.current?.state;return!t||$e(t,e)===null?!1:(n(t=>$e(t,e)??t),!0)},[]),openBeside:(0,Z.useCallback)(e=>{let t=h.current?.state??f.current.state;if(!t)return null;let r=ze(t,e);return r?(n(t=>ze(t,e)?.state??t),{name:r.name,index:r.index}):null},[])}}function cu({view:e,columns:t,onDrop:n}){let r=t.length>=Pe;return(0,Q.jsx)(`div`,{"data-slot":`view-drop-zones`,className:`absolute inset-0 z-30 flex gap-px bg-background/40 backdrop-blur-[1px]`,children:(t.length===0?[{width:100,zones:[{key:`only`,at:0,mode:`insert`,label:`Open ${lt(e)} here`}]}]:t.map((t,n)=>{let i={key:`replace:${n}`,at:n,mode:`replace`,label:t.view===e?lt(e):`Replace ${lt(t.view)}`,hint:r?`${Pe} columns is the limit`:void 0},a=r?[i]:[{key:`insert:${n}`,at:n,mode:`insert`,label:`Beside`,hint:`left`},i,{key:`insert:${n+1}:${n}`,at:n+1,mode:`insert`,label:`Beside`,hint:`right`}];return{width:t.width,zones:a}})).map((e,t)=>(0,Q.jsx)(`div`,{style:{flexBasis:`${e.width}%`},className:q(`grid min-w-0 grow gap-1.5 p-2.5`,e.zones.length===3?`grid-cols-[26%_1fr_26%]`:`grid-cols-1`),children:e.zones.map(e=>(0,Q.jsx)(lu,{zone:e,onDrop:n},e.key))},t))})}function lu({zone:e,onDrop:t}){let{over:n,reset:r,handlers:i}=pi(e=>e.dataTransfer.types.includes(fi));return(0,Q.jsxs)(`div`,{"data-drop-zone":e.mode,...i,onDragOver:e=>{e.dataTransfer.types.includes(`text/cez-view`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},onDrop:n=>{r();let i=n.dataTransfer.getData(fi);Qe(i)&&(n.preventDefault(),t(i,e.at,e.mode))},className:q(`flex flex-col items-center justify-center rounded-lg border-[1.5px] border-dashed border-border bg-background/80 p-2 text-center text-xs font-medium text-muted-foreground transition-colors`,n&&`border-foreground/60 bg-muted text-foreground`),children:[e.label,e.hint?(0,Q.jsx)(`span`,{className:`text-meta font-normal opacity-80`,children:e.hint}):null]})}var uu=1024;function du({columns:e,actions:t,renderView:n,headerExtras:r}){let i=ke(uu),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(0),[c,l]=(0,Z.useState)(null),u=c===null?null:Math.min(c,e.length),d=e.length+(u===null?0:1)<Pe,f=n=>{if(u===null)return;let r=u;l(null),t.addColumn(n),r<e.length&&t.moveColumn(e.length,r)},p=(n,r)=>(0,Q.jsx)(pu,{index:n,column:r,count:e.length,actions:t});if(e.length===0)return(0,Q.jsx)(`div`,{"data-slot":`workspace-columns`,className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(it,{onPick:t.addColumn})});let m=e.length+(u===null?0:1),h=e=>u===null?e.width:100/m,g=(0,Q.jsxs)(`header`,{className:`flex h-8 shrink-0 items-center gap-1.5 border-b border-border/70 bg-background pl-4 pr-1.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(Fn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`New window`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close new window`,title:`Close`,onClick:()=>l(null),className:`text-soft-foreground`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3.5`})})]}),_=u===null?null:(0,Q.jsxs)(`div`,{"data-slot":`workspace-column`,"data-pending":``,className:`relative flex min-w-0 flex-col border-l border-border/70 first:border-l-0`,style:{width:`${100/m}%`},children:[g,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,Q.jsx)(it,{scope:`window`,onPick:f})})]},`pending`);if(!i){let i=e.map((e,t)=>t);u!==null&&i.splice(u,0,`pending`);let a=Math.min(o,i.length-1),c=i[a],m=c===`pending`?null:e[c];return(0,Q.jsxs)(`div`,{"data-slot":`workspace-columns`,"data-narrow":``,className:`flex min-h-0 flex-1 flex-col`,children:[i.length>1?(0,Q.jsx)(kr,{value:String(a),onValueChange:e=>s(Number(e)),className:`shrink-0 gap-0`,children:(0,Q.jsx)(Or,{"aria-label":`Windows of this layout`,className:`grid w-full auto-cols-fr grid-flow-col gap-1 rounded-none border-b border-border bg-transparent px-3 py-1.5 group-data-[orientation=horizontal]/tabs:h-auto`,children:i.map((t,n)=>{let r=t===`pending`?Fn:St[e[t].view];return(0,Q.jsxs)(Dr,{value:String(n),className:`h-auto min-w-0 rounded-md border-0 px-2 py-1 text-xs data-[state=active]:bg-muted data-[state=active]:font-medium group-data-[variant=default]/tabs-list:data-[state=active]:shadow-none`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:t===`pending`?`New window`:lt(e[t].view)})]},n)})})}):null,m===null?(0,Q.jsxs)(Q.Fragment,{children:[g,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,Q.jsx)(it,{scope:`window`,onPick:f})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fu,{index:c,column:m,count:e.length,actions:t,menu:e.length>1?p(c,m):null,onSplit:()=>{l(c+1),s(c+1)},canSplit:d,grip:!1,extras:r?.(m.view,c)}),(0,Q.jsx)(`div`,{"data-slot":`main`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n(m.view,c,m)})]})]})}return(0,Q.jsxs)(`div`,{ref:a,"data-slot":`workspace-columns`,className:`flex min-h-0 flex-1 items-stretch`,children:[e.flatMap((i,o)=>[o===u?_:null,(0,Q.jsxs)(`div`,{"data-slot":`workspace-column`,"data-view":i.view,className:`relative flex min-w-0 flex-col border-l border-border/70 first:border-l-0`,style:{width:`${h(i)}%`},children:[o>0&&u===null?(0,Q.jsx)(mu,{index:o-1,width:e[o-1].width,pair:e[o-1].width+i.width,rowRef:a,onResize:t.resizeColumns}):null,(0,Q.jsx)(fu,{index:o,column:i,count:e.length,actions:t,menu:e.length>1?p(o,i):null,onSplit:()=>l(o+1),canSplit:d,trailing:o===e.length-1?(0,Q.jsx)($l,{className:`ml-1.5`}):null,extras:r?.(i.view,o)}),(0,Q.jsx)(`div`,{"data-slot":`main`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Xl.Provider,{value:null,children:n(i.view,o,i)})})]},o)]),u===e.length?_:null]})}function fu({index:e,column:t,count:n,actions:r,menu:i,trailing:a,onSplit:o,canSplit:s=!0,grip:c=!0,extras:l}){let{over:u,reset:d,handlers:f}=pi(e=>e.dataTransfer.types.includes(`text/cez-column`)),p=St[t.view],m=t=>{t.dataTransfer.setData(`text/cez-column`,String(e)),t.dataTransfer.effectAllowed=`move`};return(0,Q.jsxs)(`header`,{"data-slot":`workspace-column-header`,onDragOver:e=>{e.dataTransfer.types.includes(`text/cez-column`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},...f,onDrop:t=>{if(d(),!t.dataTransfer.types.includes(`text/cez-column`))return;let n=t.dataTransfer.getData(`text/cez-column`),i=Number(n);n===``||!Number.isInteger(i)||(t.preventDefault(),r.moveColumn(i,e))},className:q(`group/column flex h-8 shrink-0 items-center gap-0.5 border-b border-border/70 bg-background pl-4 pr-1.5`,u&&`bg-muted`),children:[n>1&&c?(0,Q.jsx)(`span`,{draggable:!0,onDragStart:m,title:`Drag to reorder`,className:`-ml-2 flex h-full shrink-0 cursor-grab items-center text-soft-foreground/70 active:cursor-grabbing`,children:(0,Q.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5`})}):null,n===1?null:(0,Q.jsxs)(sn,{children:[(0,Q.jsx)(nn,{asChild:!0,children:(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`change-view`,"aria-label":`${lt(t.view)} — change view`,className:`-ml-1.5 h-6 gap-1.5 px-1.5 text-xs font-medium text-muted-foreground hover:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground`,children:[(0,Q.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:lt(t.view)}),(0,Q.jsx)(Qt,{"aria-hidden":`true`,className:`size-3 shrink-0 opacity-60`})]})}),(0,Q.jsxs)(rn,{align:`start`,className:`w-48`,children:[(0,Q.jsx)(tn,{children:`Change view`}),(0,Q.jsx)(Et,{onPick:t=>r.setColumnView(e,t),disabled:t.view})]})]}),(0,Q.jsx)(`span`,{draggable:n>1&&c,onDragStart:m,className:q(`h-full min-w-0 flex-1`,n>1&&c&&`cursor-grab active:cursor-grabbing`)}),l,o?(0,Q.jsx)(ar,{children:(0,Q.jsxs)(or,{children:[(0,Q.jsx)(rr,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-action":`split-view`,"aria-label":`Split view`,disabled:!s,onClick:o,className:`text-soft-foreground hover:text-foreground`,children:(0,Q.jsx)(Ct,{"aria-hidden":`true`,className:`size-3.5`})})})}),(0,Q.jsx)(ir,{side:`bottom`,children:s?`Split view (\\)`:`At most ${Pe} windows`})]})}):null,i,n>1?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close ${lt(t.view)}`,title:`Close view`,onClick:()=>r.closeColumn(e),className:`text-soft-foreground`,children:(0,Q.jsx)(nr,{"aria-hidden":`true`,className:`size-3.5`})}):null,a]})}function pu({index:e,column:t,count:n,actions:r}){return(0,Q.jsxs)(sn,{children:[(0,Q.jsx)(nn,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`size-6 shrink-0 text-soft-foreground hover:text-foreground`,"aria-label":`Column menu ${lt(t.view)}`,children:(0,Q.jsx)(rt,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Q.jsxs)(rn,{align:`end`,className:`w-52`,children:[n>1?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(an,{disabled:e===0,onSelect:()=>r.moveColumn(e,e-1),children:[(0,Q.jsx)(kt,{"aria-hidden":`true`}),`Move left`]}),(0,Q.jsxs)(an,{disabled:e===n-1,onSelect:()=>r.moveColumn(e,e+1),children:[(0,Q.jsx)(Mt,{"aria-hidden":`true`}),`Move right`]})]}):null,(0,Q.jsx)(on,{}),(0,Q.jsxs)(an,{onSelect:()=>r.closeColumn(e),children:[(0,Q.jsx)(nr,{"aria-hidden":`true`}),`Close view`]})]})]})}function mu({index:e,width:t,pair:n,rowRef:r,onResize:i}){let a=(0,Z.useRef)(null),o=e=>{e.button===0&&(a.current={x:e.clientX,width:t},e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault(),e.currentTarget.focus())},s=n=>{let o=a.current,s=r.current;if(!o||!s)return;let c=s.getBoundingClientRect().width;c<=0||i(e,o.width+(n.clientX-o.x)/c*100-t)},c=e=>{a.current&&(a.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Q.jsx)(`div`,{"data-slot":`column-divider`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize column ${e+1}`,"aria-valuenow":Math.round(t),"aria-valuemin":Math.round(Dt(n)),"aria-valuemax":Math.round(n-Dt(n)),tabIndex:0,onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,onKeyDown:t=>{let n=t.shiftKey?10:2,r=t.key===`ArrowLeft`?-n:t.key===`ArrowRight`?n:null;r!==null&&(t.preventDefault(),i(e,r))},title:`Drag to resize — arrow keys adjust precisely`,className:`absolute inset-y-0 -left-[5px] z-20 w-[9px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}function hu(e,t,n){let r=(0,Z.useRef)({runId:e.id,without:!1,fired:!1});r.current.runId!==e.id&&(r.current={runId:e.id,without:!1,fired:!1});let i=e.subject!==void 0,a=(0,Z.useRef)(n);a.current=n,(0,Z.useEffect)(()=>{if(!i||t===void 0)return;let n=r.current;if(!t){n.without=!0;return}!n.without||n.fired||mn(e.id)||(n.fired=!0,hn(e.id),a.current())},[t,e.id,i])}var gu=(0,Z.lazy)(()=>he(()=>import(`./terminal-drawer-BiRjtnip.js`).then(e=>({default:e.TerminalDrawer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))),_u=(0,Z.lazy)(()=>he(()=>import(`./assets-view-CLCckPll.js`).then(e=>({default:e.AssetsView})),__vite__mapDeps([28,1,2,3,4,5,29,23,6,30,31,8,7,9,32,33,34,35,36,37,16,38,39,40,41,10,42,43,24,25,44,45,46,47,48,15,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,20,71,19,72,73,14,74,75,76,77,78,79,80,26,81,82,83,84,85,86,12,13,87,11,17,18,88]))),vu=(0,Z.lazy)(()=>he(()=>import(`./task-graph-DqXUw-PM.js`).then(e=>({default:e.TaskGraphView})),__vite__mapDeps([89,1,2,3,4,5,56,29,23,52,6,57,58,59,60,61,35,62,7,15,63,31,30,8,9,32,64,65,66,44,67,43,24,25,68,69,49,70,10,20,50,71,19,41,72,73,14,74,75,76,16,77,78,79,80,45,46,47,26,36,90,33,91,85,11,12,92,13,93,18,51,53,54,55,81,82,83,84,40,86,87,17,48,37,38,39,88,94])));function yu({view:e}){let{id:t}=_e(),n=C(t),r=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{r.current!==t&&(r.current=void 0)},[t]);let i=(0,Z.useCallback)(e=>{r.current=e},[]),{mutate:a}=f();if((0,Z.useEffect)(()=>{n.data&&r.current!==n.data.id&&Gt(n.data)&&a(n.data.id)},[a,n.data?.id,n.data?.status,n.data?.finishedAt,n.data?.seenAt,n.data?.archived,t]),n.isPending)return(0,Q.jsx)(bu,{view:e});if(n.isError){let e=n.error instanceof z&&n.error.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-workspace`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(Wr,{icon:e?(0,Q.jsx)(Xn,{}):(0,Q.jsx)(ft,{}),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.`:n.error.message,actions:(0,Q.jsx)(J,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Ir,{to:`/`,children:`Back to tasks`})})})})}return(0,Q.jsx)(xu,{run:n.data,deepLinkView:e,onMarkedUnread:i})}function bu({view:e}){return e===`files`?(0,Q.jsx)(pt,{tab:`files`}):e===`terminal`?(0,Q.jsx)(pt,{tab:`terminal`}):e===`browser`||e===`assets`?(0,Q.jsx)(pt,{tab:`preview`}):e===`changes`||e===`commits`||e===`graph`?(0,Q.jsx)(pt,{tab:`changes`}):(0,Q.jsx)(Rt,{})}function xu({run:e,deepLinkView:t,onMarkedUnread:n}){let r=su(e.id),{openDeepLink:i,addLayout:a,closeLayout:o,selectLayout:s,setColumnBrowser:c,openInBrowser:u,applySaved:d,keepAs:f}=r,p=nu(),{save:m,remove:h}=p,g=r.state,_=(r.layout?.columns.length??0)>0,v=(0,Z.useCallback)(e=>{let t=vt(g,e);t&&(m(t),f(t.name))},[f,g,m]),y=l().data?.capabilities?.terminal===!0,b=(0,Z.useMemo)(()=>ut.filter(e=>e!==`terminal`||y),[y]),x=ge(),S=(0,Z.useRef)(null),C=(0,Z.useRef)(new Map),w=(0,Z.useRef)(e.id);w.current!==e.id&&(w.current=e.id,C.current=new Map,S.current=null),(0,Z.useEffect)(()=>{if(!r.ready)return;if(t){S.current?.runId!==e.id&&(S.current={runId:e.id,name:r.state.active});let n=C.current.get(t);n!==void 0&&r.state.layouts.some(e=>e.name===n)?s(n):i(t);return}let n=S.current;S.current=null,x===`POP`&&n&&n.runId===e.id&&n.name!==r.state.active&&s(n.name)},[t,r.ready,r.replaced,x,i,e.id,s]),(0,Z.useEffect)(()=>{if(!r.ready||!t||C.current.has(t))return;let e=r.layout;e&&e.columns.length===1&&e.columns[0]?.view===t&&C.current.set(t,e.name)},[t,r.layout,r.ready]);let T=(0,Z.useCallback)(()=>n(e.id),[n,e.id]),E=(0,Z.useMemo)(()=>wt.filter(t=>b.includes(t)&&(t!==`graph`||!!e.workflowDef)),[b,e.workflowDef]),D=r.ready?r.layout?Le(r.layout):`session`:null,O=(0,Z.useMemo)(()=>r.state.layouts.filter(e=>Le(e)===null),[r.state.layouts]),k=(0,Z.useCallback)(()=>a(),[a]),{hints:A,show:ee}=Ne((0,Z.useMemo)(()=>Tt(E),[E])),te=Pr(),[j,ne]=(0,Z.useState)(null),M=(0,Z.useCallback)(e=>{setTimeout(()=>ne(e),0)},[]),N=(0,Z.useCallback)(()=>ne(null),[]),P=r.dropView,F=(0,Z.useRef)({runId:e.id,current:r.state.active,previous:null});F.current.runId===e.id?F.current.current!==r.state.active&&(F.current={runId:e.id,current:r.state.active,previous:F.current.current}):F.current={runId:e.id,current:r.state.active,previous:null};let I=(0,Z.useCallback)(e=>{if(D!==e)return null;let t=F.current.previous,n=t===null?void 0:r.state.layouts.find(e=>e.name===t);return n&&!(n.columns.length===1&&n.columns[0]?.view===e)?(s(n.name),n.columns.length):(i(e===`session`?`changes`:`session`),1)},[D,r.state.layouts,i,s]),re=(0,Z.useCallback)((e,t,n)=>{if(ne(null),n===`insert`&&I(e)!==null){P(e,t===0?0:Pe,n);return}P(e,t,n)},[I,P]),L=(0,Z.useCallback)(e=>{let t=I(e)??r.layout?.columns.length??0;P(e,t,`insert`)},[I,P,r.layout?.columns.length]),R=r.layout?.columns.length??0,ie=D===null&&R>1?r.closeColumn:void 0,[ae,oe]=(0,Z.useState)(()=>zr(e.id)),se=(0,Z.useRef)(e.id);se.current!==e.id&&(se.current=e.id,oe(zr(e.id)));let z=(0,Z.useCallback)(t=>{oe(n=>{let r={...n,...t};return Br(e.id,r),r})},[e.id]),B=r.layout?.columns.some(e=>e.view===`terminal`)??!1,V=Fr(),H=y&&ae.open&&!B,[ce,U]=(0,Z.useState)(!1),le=(0,Z.useRef)(e.id);le.current!==e.id&&(le.current=e.id,U(!1));let ue=(0,Z.useCallback)(()=>U(!1),[]),G=(0,Z.useCallback)(()=>U(e=>!e),[]),de=Ql(ce,ue),fe=(0,Z.useMemo)(()=>({maximized:ce,toggle:G}),[ce,G]),K=ae.open,pe=(0,Z.useCallback)(()=>{B||z({open:!K})},[K,B,z]),{closeColumn:me}=r,he=r.layout?.columns,_e=(0,Z.useCallback)(()=>{z({open:!0});let e=he?.findIndex(e=>e.view===`terminal`)??-1;e<0||(D!==null||he.length===1?i(`session`):me(e))},[me,D,i,he,z]),ve=(0,Z.useMemo)(()=>H||B?[`terminal`]:[],[H,B]),ye=W(e.id).data,be=ye?.artifacts?.length??0;hu(e,Array.isArray(ye?.artifacts)?ye.artifacts.some(e=>e.name===_n):void 0,()=>te(gn(e.id)));let xe=(0,Z.useMemo)(()=>be>0?{assets:be}:void 0,[be]),Se=(0,Z.useMemo)(()=>(0,Q.jsx)(mi,{layouts:O,active:r.state.active,fixedViews:E,fixedActive:D,onViews:ve,onSelectFixed:i,onSelect:s,onClose:o,saved:p.saved,onApplySaved:d,onSaveCurrent:_?v:void 0,onDeleteSaved:h,notesHref:`/tasks/${e.id}/notes`,onViewDragStart:M,onViewDragEnd:N,onOpenBeside:L,onColumnDropClose:ie,keyHints:A,showKeyHints:ee,badges:xe}),[xe,O,r.state.active,E,D,ve,i,s,o,p.saved,d,_,v,h,e.id,M,N,L,ie,A,ee]),Ce=(0,Z.useMemo)(()=>(0,Q.jsx)(J,{variant:`ghost`,size:`icon-sm`,"data-action":`maximize-layout`,"aria-label":`Full view`,title:`Full view — hide everything but this layout (F)`,className:`text-muted-foreground`,onClick:G,children:(0,Q.jsx)(ct,{"aria-hidden":`true`})}),[G]),we=(0,Z.useMemo)(()=>[...E.map(e=>({select:()=>i(e),active:D===e})),...O.map(e=>({select:()=>s(e.name),active:D===null&&e.name===r.state.active}))],[E,O,D,r.state.active,i,s]),Te=(0,Z.useMemo)(()=>[...Je(E).map(t=>t===`notes`?()=>te(`/tasks/${e.id}/notes`):()=>i(t))],[E,i,te,e.id]),Ee=(0,Z.useRef)({stripOrder:we,numbered:Te,toggleMaximized:G,terminalAllowed:y,toggleDrawer:pe});Ee.current={stripOrder:we,numbered:Te,toggleMaximized:G,terminalAllowed:y,toggleDrawer:pe},(0,Z.useEffect)(()=>{let e=e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.repeat||e.defaultPrevented||wr(e.target)||document.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]`))return;let t=Ee.current,n=document.querySelector(Cu),r=t.stripOrder.findIndex(e=>e.active),i=e=>{if(t.stripOrder.length===0)return;let n=(Math.max(r,0)+e+t.stripOrder.length)%t.stripOrder.length;t.stripOrder[n].select()};if(/^[1-9]$/.test(e.key)){let n=t.numbered[Number(e.key)-1];if(!n)return;n()}else if(e.key===`[`)i(-1);else if(e.key===`]`)i(1);else if(e.key===`f`||e.key===`F`)t.toggleMaximized();else if(e.key===`\\`){let e=n?.querySelectorAll(`[data-action="split-view"]:not(:disabled)`),t=e?.[e.length-1];if(!t)return;t.click()}else if(e.key===`/`){let e=n?.querySelector(`[data-slot="composer"] textarea, [data-slot="composer-input"]`);if(!e)return;e.focus()}else if(e.key==="`"){if(!t.terminalAllowed)return;t.toggleDrawer()}else return;e.preventDefault()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let De=To(e.id),[Oe,ke]=(0,Z.useState)(null),Ae=r.layout?.columns,je=(0,Z.useCallback)((e,t)=>{let n=Ae?.[e]?.view===`changes`,i=Ae?.filter(e=>e.view===`changes`).length===1;if(n&&i&&De.comments.length>0){ke({index:e,view:t});return}r.setColumnView(e,t)},[Ae,De.comments.length,r.setColumnView]),Me=(0,Z.useMemo)(()=>({addColumn:D===null?r.addColumn:e=>P(e,R,`insert`),closeColumn:r.closeColumn,setColumnView:je,resizeColumns:r.resizeColumns,moveColumn:r.moveColumn}),[D,P,R,r.addColumn,r.closeColumn,je,r.resizeColumns,r.moveColumn]),Fe=r.openBeside,Ie=(0,Z.useCallback)(t=>{let n=Fe(t.view);n&&ui(`${e.id}:${n.name}:${n.index}:${t.view}`,t.value)},[Fe,e.id]);(0,Z.useEffect)(()=>jt(e.id),[e.id]),(0,Z.useEffect)(()=>{if(!r.ready)return;let t=zt(e.id);t&&Ie({view:`files`,value:t})},[r.ready,Ie,e.id]),(0,Z.useEffect)(()=>{let t=()=>document.querySelector(Cu),n=()=>{let e=t()?.querySelectorAll(`[data-action="split-view"]:not(:disabled)`);return e?.[e.length-1]??null},a=()=>t()?.querySelector(`[data-slot="composer"] textarea, [data-slot="composer-input"]`)??null,o={runId:e.id,views:E,activeView:D,openView:i,openViewBeside:L,layouts:O.map(e=>({name:e.name,label:Be(e.name),active:D===null&&e.name===r.state.active})),selectLayout:s,maximized:ce,toggleMaximized:G,get splitView(){return n()?()=>n()?.click():null},terminal:{allowed:y,open:K,inColumn:B,toggle:pe,openInColumn:()=>{z({open:!1}),Fe(`terminal`)}},get focusComposer(){return a()?()=>a()?.focus():null},openFile:e=>Ie({view:`files`,value:e}),markedUnread:T};return At(o),()=>Pt(o)});let Re=r.state.active,ze=Ae?.some(e=>e.view===`session`)?`session`:`changes`,Ve=$a(e),{addDraft:He,discard:Ue,note:We,marks:Ge}=Ve,Ke=(0,Z.useCallback)(e=>{let t=We(e);t?.phase===`draft`&&!t.added&&Ue(e)},[Ue,We]),qe=Tu(e.id,r.layout?Re:null,r.state.layouts),Ye=(0,Z.useCallback)(e=>e===`terminal`&&y?(0,Q.jsx)(Rr,{label:`Move to bottom — under every view`,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-action":`terminal-to-drawer`,"aria-label":`Move to bottom`,onClick:_e,className:`text-soft-foreground hover:text-foreground`,children:(0,Q.jsx)(st,{"aria-hidden":`true`,className:`size-3.5`})})}):null,[_e,y]),Xe=(0,Z.useCallback)((t,r,i,a)=>{switch(t){case`session`:return(0,Q.jsx)(Ou,{run:e,onMarkedUnread:n,onOpenReference:Ie});case`changes`:return(0,Q.jsx)(Po,{run:e,embedded:!0,stateKey:`${e.id}:${a}:${r}:changes`},e.id);case`commits`:return(0,Q.jsx)(di,{run:e,embedded:!0,stateKey:`${e.id}:${a}:${r}:commits`});case`files`:return(0,Q.jsx)(Ho,{run:e,embedded:!0,stateKey:`${e.id}:${a}:${r}:files`});case`graph`:return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Du,{title:`Loading graph…`}),children:(0,Q.jsx)(vu,{run:e,embedded:!0})});case`assets`:return(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Du,{title:`Loading assets…`}),children:(0,Q.jsx)(_u,{runId:e.id,run:e,routed:i.width>=100})});case`terminal`:return y?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Du,{title:`Loading terminal…`}),children:(0,Q.jsx)(gu,{runId:e.id,height:0,onHeightChange:Su,onOpenInBrowser:u,fill:!0})}):(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(Qn,{}),tone:`neutral`,heading:`h2`,title:`Terminal disabled`,subtitle:`The terminal is off on this cockpit — it is off in hosted mode unless CEZ_TERMINAL=1.`});case`browser`:return(0,Q.jsx)(ra,{state:i.browser??Ze(),onChange:e=>c(r,e),onPickElement:He,designMarks:Ge,onDesignEscape:Ke,designTray:Ve.ready>0||Ve.sending?(0,Q.jsx)(Ha,{notes:Ve}):null,renderEmpty:y?t=>(0,Q.jsx)(Ra,{runId:e.id,projectId:V,onOpen:t,setup:e.worktreeLifecycle,onShowTerminal:B?void 0:()=>z({open:!0})}):void 0,renderDesignNote:({mark:e,close:t})=>{let n=We(e);return n?(0,Q.jsx)(Va,{note:n,notes:Ve,onClose:t}):null}})}},[He,Ge,Ve,Ke,We,n,u,Ie,e,c,y,V,B,z]);return(0,Q.jsxs)(`div`,{"data-route":`task-workspace`,"data-run-id":e.id,className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsx)(_t,{run:e,tab:ze,onMarkedUnread:T,tabs:Se,headerActions:Ce,wide:!0}),r.loadFailed?(0,Q.jsx)(`div`,{"data-slot":`layouts-unloaded`,role:`status`,className:`shrink-0 border-b border-border bg-muted/40 px-4 py-1.5 text-xs text-muted-foreground sm:px-6`,children:`This task's saved layouts could not be loaded yet — retrying. Changes made meanwhile are not saved.`}):null,r.saveFailed?(0,Q.jsx)(`div`,{"data-slot":`layouts-unsaved`,role:`status`,className:`shrink-0 border-b border-border bg-muted/40 px-4 py-1.5 text-xs text-muted-foreground sm:px-6`,children:`This layout could not be saved on this host — it keeps working in this tab, but will not come back after a refresh.`}):null,(0,Q.jsx)(nt.Provider,{value:b,children:(0,Q.jsx)(Xl.Provider,{value:fe,children:(0,Q.jsxs)(`div`,{ref:de.ref,"data-slot":`workspace-stage`,"data-maximized":de.covering?``:void 0,style:de.style,className:q(`relative flex min-h-0 flex-1 flex-col`,de.covering&&`fixed z-40 overflow-hidden bg-background md:rounded-xl md:border md:border-border/70`),children:[r.ready?r.layout?qe.map(e=>(0,Q.jsx)(Eu,{layout:e,active:e.name===Re,actions:Me,renderView:Xe,headerExtras:Ye},e.name)):(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(Fn,{}),tone:`neutral`,heading:`h2`,title:`No layouts`,subtitle:`You closed every layout of this task. Create a new one, or come back later — the task will open with a Chat layout.`,actions:(0,Q.jsx)(J,{variant:`outline`,onClick:k,children:`New layout`})}):(0,Q.jsx)(bu,{view:t}),j?(0,Q.jsx)(cu,{view:j,columns:r.layout?.columns??[],onDrop:re}):null,de.covering&&D!==null?(0,Q.jsx)($l,{className:`absolute top-2 right-3 z-20 bg-card shadow-sm`}):null]})})}),(0,Q.jsx)(_r,{open:Oe!==null,onOpenChange:e=>!e&&ke(null),children:(0,Q.jsxs)(fr,{children:[(0,Q.jsxs)(gr,{children:[(0,Q.jsx)(dr,{children:`You have an unsent comment`}),(0,Q.jsxs)(ur,{children:[De.comments.length===1?`One comment on the changes has not been sent yet.`:`${De.comments.length} comments on the changes have not been sent yet.`,` `,`This is the last column showing them.`]})]}),(0,Q.jsxs)(mr,{children:[(0,Q.jsx)(hr,{children:`Go back`}),(0,Q.jsx)(pr,{onClick:()=>{Oe&&r.setColumnView(Oe.index,Oe.view),ke(null)},children:`Change anyway`})]})]})}),H?(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(gu,{runId:e.id,height:ae.height,onHeightChange:e=>z({height:e}),onClose:()=>z({open:!1}),onMoveToColumn:()=>{z({open:!1}),Fe(`terminal`)},onOpenInBrowser:u})}):null]})}var Su=()=>{},Cu=`[data-slot="workspace-stage"] [data-slot="workspace-layout"][data-active]`;function wu(e){return e.columns.every(e=>e.view!==`terminal`&&e.view!==`browser`)}function Tu(e,t,n){let[r,i]=(0,Z.useState)({runId:e,names:[]}),a=r.runId===e?r.names:[];return t!==null&&a[0]!==t&&i({runId:e,names:[t,...a.filter(e=>e!==t)].slice(0,5)}),n.filter(e=>e.name===t||a.includes(e.name)&&wu(e))}function Eu({layout:e,active:t,actions:n,renderView:r,headerExtras:i}){let a=e.name,o=(0,Z.useCallback)((e,t,n)=>r(e,t,n,a),[r,a]);return(0,Q.jsx)(Z.Activity,{mode:t?`visible`:`hidden`,children:(0,Q.jsx)(`div`,{"data-slot":`workspace-layout`,"data-active":t?``:void 0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(du,{columns:e.columns,actions:n,renderView:o,headerExtras:i})})})}function Du({title:e}){return(0,Q.jsx)(Wr,{icon:(0,Q.jsx)(In,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:e})}function Ou({run:e,onMarkedUnread:t,onOpenReference:n}){let r=Wi(e.id),i=(0,Z.useMemo)(()=>Bl(r.visibleEvents,{activeTurn:e.status===`running`,runner:e.runner}),[r.visibleEvents,e.status,e.runner]),a=(0,Z.useMemo)(()=>Bl(r.currentEvents,{activeTurn:e.status===`running`,runner:e.runner}),[r.currentEvents,e.status,e.runner]);if(qo(e,r.visibleEvents),r.isPending)return(0,Q.jsx)(Rt,{});let o=t=>{let n=t.target instanceof Element?t.target.closest(`[data-streamdown="inline-code"]`):null;if(!(n instanceof HTMLElement)||n.closest(`[data-slot="user-message"]`))return null;let r=ku(n.textContent??``,e.worktreePath??void 0);return r?{node:n,reference:r}:null};return(0,Q.jsx)(`div`,{className:`contents`,onPointerOver:e=>{let t=o(e);t&&!t.node.dataset.open&&(t.node.dataset.open=t.reference.view,t.node.title=t.reference.view===`files`?`Open in Files`:`Open in Commits`)},onClick:e=>{if(!n||window.getSelection()?.toString())return;let t=o(e);t&&n(t.reference)},children:(0,Q.jsx)(Hl,{run:e,thread:i,currentThread:a,history:r,onMarkedUnread:t,embedded:!0})})}function ku(e,t){let n=e.trim();if(n.length<3||n.length>260||/\s/.test(n))return null;if(/^[0-9a-f]{7,40}$/.test(n)&&/[a-f]/.test(n)&&/[0-9]/.test(n))return{view:`commits`,value:n};let r=n.replace(/:\d+(?::\d+)?$/,``);return t&&r.startsWith(`${t}/`)&&(r=r.slice(t.length+1)),r.startsWith(`/`)||r.startsWith(`~`)||/^[a-z]+:\/\//i.test(r)||(r=r.replace(/^\.\//,``),r.startsWith(`..`))||!/^[\w@.+\-()[\]]+(?:\/[\w@.+\-()[\]]+)*\.[A-Za-z][A-Za-z0-9]{0,7}$/.test(r)||!r.includes(`/`)&&!/\.(?:tsx?|jsx?|mjs|cjs|json|md|mdx|css|scss|html|ya?ml|toml|py|rs|go|rb|java|kt|swift|sh|sql|lock|txt|env|svg|png|jpe?g)$/i.test(r)?null:{view:`files`,value:r}}export{yu as TaskWorkspaceRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as e}from"./button-BqkA8Ovk.js";var t=e(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{F as r,Ga as i,La as a,Lr as o,bi as s,vi as c,yi as l}from"./queries-ba5qZ3kd.js";import{t as u}from"./utils-Br_dqwn-.js";import{N as d,t as f}from"./button-BqkA8Ovk.js";import{s as p}from"./dist-Br4Ra_c5.js";import{h as m,i as h,l as g,n as _,r as v,s as y,t as b}from"./dropdown-menu-CDv5Teql.js";import{t as x}from"./external-link-Bclznsu3.js";import{t as ee}from"./loader-circle-DjzuGw6j.js";import{t as S}from"./play-Cj3p2Q5t.js";import{t as C}from"./plus-Bdmhj8CR.js";import{t as te}from"./square--LrBHma0.js";import{t as ne}from"./terminal-CmRAOyqu.js";import{t as w}from"./x-CZSnHsZ4.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as re}from"./alert-dialog-BihfE0uZ.js";import{i as M,r as ie,t as ae}from"./tabs-CmEFauE4.js";import{t as N}from"./input-BO795Un9.js";import{t as oe}from"./icon-tooltip-BMkyRHLt.js";import{t as P}from"./drawer-state-DasOAIpO.js";import{TerminalPane as F}from"./terminal-pane-YnSc_Vhs.js";var I=d(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),L=e(t(),1),R=n(),z=3e3;function B({runId:e,onOpen:t}){let[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{let t=!0,n=()=>{s(e).then(e=>{t&&r(e.urls)}).catch(()=>{})};n();let i=setInterval(n,z);return()=>{t=!1,clearInterval(i)}},[e]),n.length===0?null:(0,R.jsxs)(`div`,{"data-slot":`detected-urls`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border/70 px-3 py-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Detected addresses`}),n.map(e=>(0,R.jsxs)(`span`,{"data-slot":`detected-url`,"data-running":e.running===!0?``:void 0,className:`flex items-center gap-1.5 rounded-sm bg-muted/60 py-0.5 pr-0.5 pl-2 text-xs`,children:[(0,R.jsx)(m,{"aria-hidden":`true`,className:u(`size-2`,e.running===!0?`fill-success text-success`:e.running===!1?`fill-muted text-muted-foreground`:`text-soft-foreground`)}),(0,R.jsx)(`span`,{className:`font-mono`,children:e.url}),(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.running===!0?`running`:e.running===!1?`not responding`:`…`}),(0,R.jsx)(f,{asChild:!0,variant:`ghost`,size:`xs`,className:`h-auto px-1.5 py-0.5 text-[length:inherit] hover:bg-background`,children:(0,R.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${e.url} in Browser`,children:[(0,R.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Open in Browser`})]})}),(0,R.jsxs)(f,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Open ${e.url} in Preview`,onClick:()=>a(!t(e.url)),className:`h-auto px-1.5 py-0.5 text-[length:inherit] hover:bg-background`,children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Open Preview`})]})]},e.url)),i?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No room to open it here — this layout has three columns, or its Preview is out of tabs.`}):null]})}function V({runId:e,onRun:t}){let[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(``),o=(0,L.useCallback)(()=>{l(e).then(e=>r(e.commands)).catch(()=>{})},[e]);return(0,R.jsxs)(b,{onOpenChange:e=>e&&o(),children:[(0,R.jsx)(g,{asChild:!0,children:(0,R.jsxs)(f,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Run`,(0,R.jsx)(p,{"aria-hidden":`true`,className:`size-3`})]})}),(0,R.jsxs)(_,{align:`end`,className:`max-h-80 w-80 overflow-y-auto`,children:[(0,R.jsx)(h,{children:`Project commands`}),n.length===0?(0,R.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-soft-foreground`,children:`No commands found in package.json or a Makefile. Type your own below.`}):n.map(e=>(0,R.jsxs)(v,{onSelect:()=>t(e.command),className:`flex-col items-start gap-0`,children:[(0,R.jsx)(`span`,{className:`font-mono text-xs`,children:e.command}),(0,R.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[e.source,e.detail?` — ${e.detail}`:``]})]},`${e.source}:${e.command}`)),(0,R.jsx)(y,{}),(0,R.jsx)(h,{className:`font-normal text-soft-foreground`,children:`Custom command`}),(0,R.jsx)(`form`,{className:`px-2 pb-1`,onSubmit:e=>{e.preventDefault();let n=i.trim();n!==``&&(a(``),t(n))},children:(0,R.jsx)(N,{value:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`e.g. npm run dev`,"aria-label":`Custom command`,spellCheck:!1,className:`h-8 px-2 font-mono text-xs shadow-none focus-visible:ring-0 md:text-xs`})})]})]})}var H=2e3;function U({runId:e,height:t,onHeightChange:n,onClose:s,onMoveToColumn:l,onOpenInBrowser:d,fill:p=!1}){let[m,y]=(0,L.useState)([]),[x,S]=(0,L.useState)(null),[M,N]=(0,L.useState)(null),[P,z]=(0,L.useState)(!0),[U,K]=(0,L.useState)(null),q=r(),J=typeof window>`u`?`this host`:window.location.host,Y=(q.data?.repo?.root??q.data?.repoRoot??``).split(/[\\/]/).filter(Boolean).pop()??`project`;(0,L.useEffect)(()=>{let t=!1;return z(!0),N(null),y([]),S(null),(async()=>{try{let n=await c(e);if(t)return;if(!n.available){N(n.reason??`The terminal is not available in this cockpit.`);return}se(n.shells??[]);let r=n.sessions.filter(e=>e.exitCode===null),i=r.length>0?r:[await o(e,{})];if(t)return;y(i),S(i[0]?.id??null)}catch(e){t||N(e instanceof Error?e.message:String(e))}finally{t||z(!1)}})(),()=>{t=!0}},[e]),(0,L.useEffect)(()=>{if(M||P)return;let t=!0,n=setInterval(()=>{c(e).then(e=>{!t||!e.available||(y(e.sessions),S(t=>t&&e.sessions.some(e=>e.id===t)?t:e.sessions[0]?.id??null))}).catch(()=>{})},H);return()=>{t=!1,clearInterval(n)}},[e,P,M]);let[X,se]=(0,L.useState)([]),Z=(0,L.useCallback)(t=>{o(e,t?{shell:t}:{}).then(e=>{y(t=>[...t,e]),S(e.id)}).catch(e=>{N(e instanceof Error?e.message:String(e))})},[e]);(0,L.useEffect)(()=>{if(M)return;let e=e=>{!e.shiftKey||!(e.ctrlKey||e.metaKey)||e.code===`Backquote`&&(e.preventDefault(),Z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Z,M]);let Q=(0,L.useCallback)(t=>{K(null),a(e,t.id).catch(()=>{}),y(e=>{let n=e.findIndex(e=>e.id===t.id),r=e.filter(e=>e.id!==t.id);return r.length===0?s?.():n>=0&&S(e=>e===t.id?r[Math.min(n,r.length-1)]?.id??null:e),r})},[s,e]),ce=(0,L.useCallback)(t=>{o(e,{}).then(async n=>{y(e=>[...e,n]),S(n.id),await i(e,n.id,`${t}\r`)}).catch(()=>{})},[e]),$=m.find(e=>e.id===x)??null;return(0,R.jsxs)(`section`,{"data-slot":`terminal-drawer`,"aria-label":`Terminal`,"data-fill":p?``:void 0,className:u(`relative flex flex-col bg-background`,p?`h-full min-h-0`:`shrink-0 border-t border-border shadow-[0_-12px_24px_-20px_rgb(var(--shadow-color)/0.35)]`),style:p?void 0:{height:`${t}px`},children:[p?null:(0,R.jsx)(G,{height:t,onHeightChange:n}),M?null:(0,R.jsx)(B,{runId:e,onOpen:d}),(0,R.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-1.5 pl-3 pr-2`,children:[(0,R.jsx)(ne,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsx)(ae,{value:x??``,onValueChange:S,className:`min-w-0 flex-1 gap-0`,children:(0,R.jsxs)(ie,{"aria-label":`Terminal tabs`,className:`flex w-full min-w-0 justify-start gap-0.5 overflow-x-auto rounded-none bg-transparent p-0 group-data-[orientation=horizontal]/tabs:h-auto`,children:[m.map(e=>(0,R.jsx)(W,{session:e,active:e.id===x,onSelect:()=>S(e.id),onClose:()=>e.busy===!1?Q(e):K(e)},e.id)),M?null:X.length>1?(0,R.jsxs)(b,{children:[(0,R.jsx)(g,{asChild:!0,children:(0,R.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`New terminal tab`,title:`New terminal tab — pick a shell`,className:`rounded`,children:(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,R.jsxs)(_,{align:`start`,className:`w-56`,children:[(0,R.jsx)(h,{children:`New tab`}),X.map((e,t)=>(0,R.jsxs)(v,{"data-shell":e,onSelect:()=>Z(e),children:[(0,R.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e}),t===0?(0,R.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-soft-foreground`,children:`default`}):null]},e))]})]}):(0,R.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`New terminal tab`,title:`New terminal tab`,onClick:()=>Z(),className:`rounded`,children:(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`})})]})}),$?(0,R.jsx)(`span`,{className:`hidden max-w-[34%] shrink lg:block`,title:`${J} · ${Y} · ${$.cwd}`,children:(0,R.jsxs)(`span`,{className:`block truncate text-meta text-soft-foreground`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:J}),` · `,Y,` · `,$.cwd]})}):null,M?null:(0,R.jsx)(V,{runId:e,onRun:ce}),$?.busy===!0?(0,R.jsxs)(f,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,title:`Interrupt the command (Ctrl-C)`,onClick:()=>void i(e,$.id,``).catch(()=>{}),children:[(0,R.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),`Stop`]}):null,l?(0,R.jsx)(oe,{label:`Move to column — beside the current view`,children:(0,R.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-action":`terminal-to-column`,"aria-label":`Move to column`,onClick:l,className:`rounded text-soft-foreground hover:text-foreground`,children:(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`})})}):null,s?(0,R.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Hide terminal`,title:`Hide terminal — processes keep running`,onClick:s,className:`rounded`,children:(0,R.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`})}):null]}),M?(0,R.jsx)(`p`,{"data-slot":`terminal-unavailable`,className:`px-3 py-4 text-xs text-soft-foreground`,children:M}):P?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-soft-foreground`,children:[(0,R.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 animate-spin`}),`Starting the shell…`]}):(0,R.jsx)(`div`,{"data-slot":`terminal-surface`,className:`relative mx-2 mb-2 min-h-0 flex-1 overflow-hidden rounded-lg border border-border/70 bg-card-2`,children:m.map(t=>(0,R.jsx)(F,{runId:e,session:t,active:t.id===x},t.id))}),(0,R.jsx)(re,{open:U!==null,onOpenChange:e=>!e&&K(null),children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(j,{children:[(0,R.jsx)(E,{children:U?.busy===!0?`Something is running in this tab`:`Close this tab?`}),(0,R.jsx)(T,{children:U?.busy===!0?`“${U.label}” is still running. Closing the tab stops that process and everything it started.`:`This host cannot tell whether something is still running in this shell. Closing the tab stops the shell and everything it started.`})]}),(0,R.jsxs)(k,{children:[(0,R.jsx)(A,{children:`Cancel`}),(0,R.jsx)(O,{onClick:()=>U&&Q(U),children:`Close anyway`})]})]})})]})}function W({session:e,active:t,onSelect:n,onClose:r}){return(0,R.jsxs)(`div`,{"data-slot":`terminal-tab`,"data-active":t?``:void 0,className:u(`group flex h-7 shrink-0 items-center rounded-md border border-transparent pl-2.5 pr-1 text-xs font-medium transition-colors`,t?`border-border/70 bg-card-2 text-foreground shadow-2xs`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,R.jsx)(M,{value:e.id,onClick:n,title:e.exitCode===null?e.label:`${e.label} — exited (${e.exitCode})`,className:`inline-block h-auto max-w-40 flex-none truncate rounded-none border-0 p-0 text-xs font-medium text-inherit hover:text-inherit focus-visible:underline focus-visible:ring-0 focus-visible:outline-0 data-[state=active]:bg-transparent data-[state=active]:font-medium data-[state=active]:text-inherit group-data-[variant=default]/tabs-list:data-[state=active]:shadow-none`,children:e.label}),(0,R.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close ${e.label}`,onClick:r,className:u(`ml-1 size-4 rounded text-inherit opacity-0 transition-opacity hover:bg-background hover:text-inherit focus-visible:opacity-100 group-hover:opacity-100`,t&&`opacity-60`),children:(0,R.jsx)(w,{"aria-hidden":`true`,className:`size-3`})})]})}function G({height:e,onHeightChange:t}){let n=(0,L.useRef)(null),r=t=>{t.button===0&&(n.current={y:t.clientY,height:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(P(r.height-(e.clientY-r.y)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,R.jsx)(`div`,{"data-slot":`drawer-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize terminal`,"aria-valuenow":e,"aria-valuemin":120,"aria-valuemax":640,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.shiftKey?64:16,i=n.key===`ArrowUp`?e+r:n.key===`ArrowDown`?e-r:n.key===`Home`?640:n.key===`End`?120:null;i!==null&&(n.preventDefault(),t(P(i)))},title:`Drag to resize — arrow keys adjust precisely`,className:`absolute inset-x-0 -top-[3px] z-20 h-[5px] cursor-row-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}export{U as TerminalDrawer};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ga as r,hn as i,oa as a,va as o}from"./queries-ba5qZ3kd.js";import{t as s}from"./utils-Br_dqwn-.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{o as l}from"./host-usage-CX8OXl8q.js";import{t as u}from"./clipboard-DvCUPLwM.js";var d=e(t(),1),f=n(),p=400,m=`\r
|
|
2
2
|
[... earlier output fell out of the scrollback ...]\r
|
|
3
|
-
`;function h(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim(),n=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],r={};for(let e of n)r[e]=t(`--term-${e}`),r[`bright${e[0].toUpperCase()}${e.slice(1)}`]=t(`--term-bright-${e}`);return{background:t(`--card-2`),foreground:t(`--foreground`),cursor:t(`--primary-strong`),cursorAccent:t(`--card-2`),selectionBackground:t(`--term-selection`),...r}}function g({runId:e,session:t,active:n,io:g}){let _=l(),v=(0,d.useRef)(null);v.current=g??{read:n=>
|
|
3
|
+
`;function h(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim(),n=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],r={};for(let e of n)r[e]=t(`--term-${e}`),r[`bright${e[0].toUpperCase()}${e.slice(1)}`]=t(`--term-bright-${e}`);return{background:t(`--card-2`),foreground:t(`--foreground`),cursor:t(`--primary-strong`),cursorAccent:t(`--card-2`),selectionBackground:t(`--term-selection`),...r}}function g({runId:e,session:t,active:n,io:g}){let _=l(),v=(0,d.useRef)(null);v.current=g??{read:n=>a(e,t.id,n),write:n=>r(e,t.id,n),resize:(n,r)=>o(e,t.id,n,r)};let y=(0,d.useRef)(null),b=(0,d.useRef)(null),x=(0,d.useRef)(null),S=(0,d.useRef)(null),C=(0,d.useRef)(null),w=(0,d.useRef)(0),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=y.current;if(!e)return;let t=!1,n;return(async()=>{let[{Terminal:r},{FitAddon:i}]=await Promise.all([c(()=>import(`./xterm-U4TA8lIC.js`),[]),c(()=>import(`./addon-fit-DIOBYJe3.js`),[])]);if(t)return;let a=new r({cursorBlink:!0,cursorStyle:`bar`,cursorWidth:2,fontSize:12.5,lineHeight:1.35,letterSpacing:0,fontFamily:`'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace`,theme:h(),scrollback:5e3}),o=new MutationObserver(()=>{a.options.theme=h()});o.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-accent`]}),x.current=o;let s=new i;a.loadAddon(s),a.open(e),b.current=a,S.current=()=>{e.clientHeight>0&&e.clientWidth>0&&s.fit()},C.current=()=>a.focus(),a.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`||!e.metaKey&&!e.ctrlKey)return!0;let t=e.key.toLowerCase();return e.metaKey||e.shiftKey?t===`c`&&a.hasSelection()?(u(a.getSelection()).catch(()=>{}),!1):t!==`v`:!0});let l=({cols:e,rows:t})=>{v.current.resize(e,t).catch(()=>{})};a.onResize(l),a.onData(e=>{v.current.write(e).catch(()=>{})}),S.current(),l({cols:a.cols,rows:a.rows}),E(!0);let d=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>S.current?.());d?.observe(e),n=()=>{d?.disconnect(),a.dispose()}})(),()=>{t=!0,x.current?.disconnect(),x.current=null,b.current=null,S.current=null,C.current=null,E(!1),n?.()}},[e,t.id]),(0,d.useEffect)(()=>{!n||!T||(S.current?.(),C.current?.())},[n,T]);let k=(0,d.useRef)(!1),A=(0,d.useRef)(!1),j=(0,d.useCallback)(async()=>{if(k.current){A.current=!0;return}k.current=!0;try{do{A.current=!1;let e=await v.current.read(w.current);w.current=e.cursor,e.truncated&&b.current?.write(m),e.data&&b.current?.write(e.data)}while(A.current)}finally{k.current=!1}},[e,t.id]);return(0,d.useEffect)(()=>{if(!T||!n||_===void 0)return;let e=!0,r=()=>{e&&j().catch(()=>{})};r();let a=t.topic;if(a===null)return()=>{e=!1};if(_===`local`&&!D){let t=i(a,r,()=>O(!0));return()=>{e=!1,t()}}let o=setInterval(r,p);return()=>{e=!1,clearInterval(o)}},[n,j,T,t.topic,D,_]),(0,f.jsx)(`div`,{"data-slot":`terminal-screen`,"data-session":t.id,className:s(`absolute inset-0 overflow-hidden p-3`,n?`visible`:`invisible pointer-events-none`,t.exitCode!==null&&`opacity-60`),children:(0,f.jsx)(`div`,{ref:y,className:`size-full`})})}export{g as TerminalPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./utils-
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./utils-Br_dqwn-.js";import{N as r}from"./button-BqkA8Ovk.js";var i=r(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:n(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-Br_dqwn-.js";var i=e(t(),1),a=n(),o=5e3,s=200,c=[],l=1,u=new Set,d=new Set;function f(e){c=e;for(let e of u)e()}function p(e){return u.add(e),()=>u.delete(e)}var m=new Set;function h(e){return m.add(e),()=>m.delete(e)}function g(e,t){let n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)}var _=new Set([`Failed to fetch`,`network error`,`Load failed`,`The network connection was lost.`,`NetworkError when attempting to fetch resource.`]),v=`cannot reach the cezar server — check the connection and try again`;function y(e){return _.has(e.trim())?v:e}function b(e,t={}){let n=y(e),r={id:l++,message:n,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},i=t.durationMs??o;if(f([...c,r]),r.tone===`danger`&&!t.reported&&!t.expected)for(let e of m)try{e(n)}catch{}g(()=>{f(c.map(e=>e.id===r.id?{...e,exiting:!0}:e)),g(()=>f(c.filter(e=>e.id!==r.id)),s)},i)}function x(){let e=(0,i.useSyncExternalStore)(p,()=>c);return e.length===0?null:(0,a.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed top-[calc(61px+env(safe-area-inset-top))] right-[calc(16px+env(safe-area-inset-right))] z-[60] flex flex-col items-end gap-2 md:top-[calc(16px+env(safe-area-inset-top))]`,children:e.map(e=>(0,a.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:r(`pointer-events-auto max-w-[min(360px,calc(100vw-32px))] rounded-md px-3.5 py-2.5 text-ui font-medium shadow-modal`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-200`,`motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:slide-out-to-right-4`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:[e.message,e.action?(0,a.jsxs)(a.Fragment,{children:[` `,(0,a.jsx)(`a`,{"data-slot":`toast-action`,href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,className:`font-semibold underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:e.action.label})]}):null]},e.id))})}export{h as n,b as r,x as t};
|