@humwick/server 0.130.0 → 0.130.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/docs/guides/tools-administration.md +6 -1
- package/docs/guides/tools-coordination.md +1 -0
- package/docs/guides/tools-tasks.md +8 -0
- package/docs/guides/workflows.md +58 -0
- package/docs/openapi.json +414 -1
- package/package.json +8 -17
- package/public/assets/{MessageBubble-BWpoBjl4.js → MessageBubble-BWLqMGKG.js} +2 -2
- package/public/assets/{PlanGraphPanel-C0auck3n.js → PlanGraphPanel-3TlIQpjk.js} +2 -2
- package/public/assets/{TraceView-DBnOx7AQ.js → TraceView-Wimm0Czv.js} +2 -2
- package/public/assets/{VaultDecisionCard-0kp2oNBC.js → VaultDecisionCard-Bau_vNax.js} +2 -2
- package/public/assets/{activity-yLztXEBt.js → activity-CrSurn-r.js} +2 -2
- package/public/assets/{agent-lineage-BbJDR1dW.js → agent-lineage-CknAJKcb.js} +2 -2
- package/public/assets/agent-liveness-CaNwK0Zf.js +2 -0
- package/public/assets/{agent-name-CTZBrSD9.js → agent-name-DKbiIhBo.js} +2 -2
- package/public/assets/agent-profiles-DwF6EQ4R.js +2 -0
- package/public/assets/{agent-project-badge-9TqzUUYE.js → agent-project-badge-Diz4Sjjb.js} +2 -2
- package/public/assets/{agent-tools-D4n40pn8.js → agent-tools-CRhpRQza.js} +2 -2
- package/public/assets/{agent-type-icon-D6FUarOf.js → agent-type-icon-LrUEU3lB.js} +2 -2
- package/public/assets/{agents-BYDslkJc.js → agents-B-v66C-4.js} +2 -2
- package/public/assets/{analytics-B-XSbEMC.js → analytics-BqCb-LKi.js} +2 -2
- package/public/assets/{artifact-viewer-DdWIfV6M.js → artifact-viewer-kf4pGuAR.js} +2 -2
- package/public/assets/{artifacts-oBOqks-2.js → artifacts-D32zyw4Y.js} +2 -2
- package/public/assets/{artifacts-DPN1q4pA.js → artifacts-DJevXcvg.js} +2 -2
- package/public/assets/{automation-4KcRFXEu.js → automation-BpRajx_5.js} +2 -2
- package/public/assets/{backlog-Cw9xPTCF.js → backlog-D_UjTdzX.js} +2 -2
- package/public/assets/{busy-health-CTu32MZt.js → busy-health-N3VEh4ao.js} +2 -2
- package/public/assets/{channels-BiXzg1G9.js → channels-9jopungq.js} +2 -2
- package/public/assets/{chat-Ctk2qwvA.js → chat-CSXrTB3C.js} +2 -2
- package/public/assets/{code-preview-Bm1wWqAp.js → code-preview-p1NnmqK0.js} +2 -2
- package/public/assets/{connectors-C36ax4Vw.js → connectors-CZdqlDNL.js} +2 -2
- package/public/assets/{cosmos-Jj9LK2Wf.js → cosmos-BgdsE4dG.js} +2 -2
- package/public/assets/{crate-agent-H6S7-B9T.js → crate-agent-30aXTKva.js} +2 -2
- package/public/assets/{dependency-graph-Cd1E23wa.js → dependency-graph-B_jvw2GE.js} +2 -2
- package/public/assets/{deploys-Bwfq146q.js → deploys-DoN6bAb5.js} +2 -2
- package/public/assets/{display-CfO7rTuF.js → display-BrKWFGJz.js} +2 -2
- package/public/assets/{files-DhhZI2Ih.js → files-D6XEu8Ng.js} +2 -2
- package/public/assets/fleet-C7jQWbw2.js +2 -0
- package/public/assets/{fleet-metrics-BkHP-P3R.js → fleet-metrics-BiDs3MLx.js} +2 -2
- package/public/assets/{formatted-body-Cm1RrzmN.js → formatted-body-CQBwc1fb.js} +3 -3
- package/public/assets/{formatted-body-impl-DQiOuOD1.js → formatted-body-impl-DyG0WsQS.js} +2 -2
- package/public/assets/{host-providers-dialog-CHqwXTov.js → host-providers-dialog-DKaW31dN.js} +2 -2
- package/public/assets/index-CRHep3M9.js +15 -0
- package/public/assets/index-MYAIwYTX.css +2 -0
- package/public/assets/{insights-fH1EL-qZ.js → insights-CzrtkpOE.js} +2 -2
- package/public/assets/{integrations-C5Oix6ng.js → integrations-aVsUmigt.js} +2 -2
- package/public/assets/{issue-ref-chip-ODyondIa.js → issue-ref-chip-BnSlM_95.js} +2 -2
- package/public/assets/{log-viewer-Cvfy6PW7.js → log-viewer-qe7Ee47Z.js} +2 -2
- package/public/assets/{maintenance-D8CDH5wZ.js → maintenance-NfjqFZAk.js} +2 -2
- package/public/assets/{managed-agents-egllbpij.js → managed-agents-BiH0HgaE.js} +2 -2
- package/public/assets/{markdown-preview-CYSFgVgK.js → markdown-preview-BixaT3Xr.js} +3 -3
- package/public/assets/{markdown-preview-impl-BteVIjX4.js → markdown-preview-impl-DNGlWIS3.js} +2 -2
- package/public/assets/{memory-C8WmXsyr.js → memory-DNsCl6UX.js} +2 -2
- package/public/assets/{messages-BzQdqlO6.js → messages-DopU1L1X.js} +2 -2
- package/public/assets/{orchestrators-B1HxzkNw.js → orchestrators-Cq7ckLQT.js} +2 -2
- package/public/assets/{overview-DCUnI4Z7.js → overview-C1DCTzzV.js} +2 -2
- package/public/assets/{pairs-ftCd2XcD.js → pairs-DE_m6rrE.js} +2 -2
- package/public/assets/{profile-icon-B2zH8DMH.js → profile-icon-B3rfh77F.js} +2 -2
- package/public/assets/project-profile-instructions-DQWZE0kA.js +2 -0
- package/public/assets/projects-Br2Bd2h1.js +2 -0
- package/public/assets/{prompt-settings-Bftq9czX.js → prompt-settings-BKvFsvGD.js} +2 -2
- package/public/assets/provider-display-DsuWMvVL.js +2 -0
- package/public/assets/{registry-DWCU5c8q.js → registry-Cw38_6gW.js} +2 -2
- package/public/assets/run-card-CpKqRbhg.js +2 -0
- package/public/assets/scroll-text-BKXS1ahr.js +2 -0
- package/public/assets/{secrets-C7GIUATz.js → secrets-DxI-vzSq.js} +2 -2
- package/public/assets/{service-access-settings-C3aujqTG.js → service-access-settings-D9s_VJbd.js} +2 -2
- package/public/assets/{settings-C6sZ9eBa.js → settings-CKZTVGIx.js} +2 -2
- package/public/assets/{shipping-Bu8p1gEw.js → shipping-B9YtnwtG.js} +2 -2
- package/public/assets/{stats-V9Z-GxUd.js → stats-DyUBKyWI.js} +2 -2
- package/public/assets/{status-dot-CVv0iGHL.js → status-dot-DYqlEUhJ.js} +2 -2
- package/public/assets/{store-BvtFdlGX.js → store-DcClXLH0.js} +3 -3
- package/public/assets/{tasks-CXU75HRF.js → tasks-Bh7Chr4-.js} +2 -2
- package/public/assets/{teams-BPf976zb.js → teams-bowI7qVY.js} +2 -2
- package/public/assets/{terminal-viewer-DE9BOe-8.js → terminal-viewer-BgVLHdsU.js} +3 -3
- package/public/assets/{terminal-viewer-impl-D04pjmGh.js → terminal-viewer-impl-Dz22UPy6.js} +2 -2
- package/public/assets/token-estimate-Co-Jdphh.js +2 -0
- package/public/assets/{use-agent-terminal-B1yR456R.js → use-agent-terminal-DSQQ-iY7.js} +2 -2
- package/public/assets/{use-decisions-D-S4tpDf.js → use-decisions-samMQhQf.js} +2 -2
- package/public/assets/use-project-list-59LheVP7.js +2 -0
- package/public/assets/{use-selectors-CnrAk2YP.js → use-selectors-BZa25xEB.js} +2 -2
- package/public/assets/{user-avatar-nBFIcR4M.js → user-avatar-DHxlvUvV.js} +2 -2
- package/public/assets/versioned-prompt-editor-BmED5DnJ.js +8 -0
- package/public/assets/{work-queue-TCjJxeT-.js → work-queue-CSvpuNLz.js} +2 -2
- package/public/assets/{workflow-marker-Cf3Hf2fN.js → workflow-marker-DAZcj5qt.js} +2 -2
- package/public/assets/{workflows-CXQX20Qj.js → workflows-DdmxRSyg.js} +2 -2
- package/public/assets/{workspaces-qSYzKYMA.js → workspaces-BxeKfVuF.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +31 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/plugins/claude/hooks/gate-run-guard.provisioned.mjs +31 -1
- package/runner/src/adapters/claude-effort.ts +2 -4
- package/runner/src/adapters/codex-launch-config.ts +4 -5
- package/runner/src/adapters/codex.ts +1 -1
- package/runner/src/adapters/opencode-provider.ts +7 -22
- package/runner/src/adapters/opencode.ts +4 -4
- package/runner/src/agent-runner/credentials.ts +42 -12
- package/runner/src/agent-runner/inbox.ts +27 -0
- package/runner/src/agent-runner/lifecycle-milestones.ts +0 -2
- package/runner/src/bin/claude.ts +4 -0
- package/runner/src/bin/codex.ts +4 -0
- package/runner/src/bin/opencode.ts +4 -0
- package/runner/src/index.ts +5 -2
- package/runner/src/provider-setup.ts +34 -0
- package/runner/src/providers.ts +2 -1
- package/runner/src/runner-core.ts +18 -23
- package/runner/src/spawn-input.ts +2 -1
- package/runner/src/test-run-dedup.ts +59 -56
- package/scripts/cd-config.ts +24 -3
- package/scripts/gate-run-lease.ts +10 -7
- package/scripts/gate.sh +5 -1
- package/src/branch-land-notice.ts +93 -0
- package/src/branch-landed.ts +7 -76
- package/src/bus.ts +19 -20
- package/src/cd-deploy-notify.ts +30 -2
- package/src/cd-host-lag-notify.ts +7 -6
- package/src/ci/incidents.ts +2 -2
- package/src/ci/monitor.ts +5 -8
- package/src/ci/root-missing.ts +2 -7
- package/src/ci/transition-notify.ts +7 -39
- package/src/cli/cd-pauses.ts +19 -0
- package/src/cli/orchestrator.ts +1 -1
- package/src/cli/state.ts +2 -19
- package/src/cli/task-edit.ts +22 -0
- package/src/cli/task.ts +3 -1
- package/src/cli/workflow.ts +8 -2
- package/src/commands-db.ts +10 -6
- package/src/commands-write.ts +8 -0
- package/src/config-store-write.ts +13 -1
- package/src/config-store.ts +25 -14
- package/src/db/activity-async.ts +6 -1
- package/src/db/activity-write-ops.ts +13 -1
- package/src/db/activity.ts +1 -14
- package/src/db/agent-lifecycle-write-ops.ts +1 -0
- package/src/db/agent-meta.ts +2 -2
- package/src/db/agent-ownership-write-ops.ts +4 -0
- package/src/db/agent-search.ts +1 -15
- package/src/db/agents-async.ts +58 -7
- package/src/db/agents-write-ops.ts +28 -5
- package/src/db/agents.ts +81 -54
- package/src/db/artifacts-write-ops.ts +8 -3
- package/src/db/bus-outbox-write-ops.ts +1 -0
- package/src/db/channels-write-ops.ts +4 -0
- package/src/db/ci-incidents-async.ts +5 -5
- package/src/db/ci-incidents-write-ops.ts +2 -2
- package/src/db/claude-api-budget-ops.ts +5 -5
- package/src/db/claude-app-oauth.ts +4 -4
- package/src/db/codex-reset-consumes-write-ops.ts +3 -0
- package/src/db/command-row.ts +10 -2
- package/src/db/commands-list-query.ts +2 -0
- package/src/db/commands-spawn-read.ts +1 -1
- package/src/db/commands-write-ops.ts +21 -0
- package/src/db/config-store-write-ops.ts +9 -2
- package/src/db/continuation-archives-async.ts +5 -0
- package/src/db/continuation-archives-write-ops.ts +9 -0
- package/src/db/continuations.ts +2 -2
- package/src/db/db-writer-worker.ts +8 -1
- package/src/db/delivery-write-ops.ts +5 -0
- package/src/db/deploy-events-async.ts +1 -0
- package/src/db/deploy-events-read-ops.ts +2 -1
- package/src/db/deploy-events.ts +35 -4
- package/src/db/hosts-registration.ts +10 -2
- package/src/db/hosts-write-ops.ts +14 -0
- package/src/db/hosts.ts +9 -6
- package/src/db/inbox-write-ops.ts +4 -0
- package/src/db/inbox.ts +0 -14
- package/src/db/index.ts +2 -0
- package/src/db/insights-write-ops.ts +1 -0
- package/src/db/integrations-async.ts +8 -0
- package/src/db/integrations-ops.ts +15 -0
- package/src/db/integrations.ts +15 -21
- package/src/db/issue-lifecycle.ts +3 -4
- package/src/db/issue-refs-async.ts +20 -0
- package/src/db/issue-refs-write-ops.ts +29 -0
- package/src/db/issue-refs.ts +7 -8
- package/src/db/long-running-work.ts +2 -2
- package/src/db/macos-privacy.ts +1 -1
- package/src/db/main-connection-writes.ts +23 -2
- package/src/db/maintenance-job-reconcile.ts +61 -0
- package/src/db/maintenance-job-runs-async.ts +14 -0
- package/src/db/maintenance-job-write-ops.ts +9 -0
- package/src/db/mappers.ts +2 -14
- package/src/db/merge-lease.ts +1 -15
- package/src/db/message-reads-write-ops.ts +3 -0
- package/src/db/message-write-ops.ts +4 -0
- package/src/db/migrations.ts +7 -15
- package/src/db/orchestrators-async.ts +7 -3
- package/src/db/orchestrators-write-ops.ts +7 -1
- package/src/db/orchestrators.ts +21 -77
- package/src/db/pairs.ts +1 -13
- package/src/db/project-profile-instructions.ts +50 -0
- package/src/db/prompt-versions-ops.ts +1 -0
- package/src/db/prompt-versions.ts +9 -2
- package/src/db/provider-catalog-write-ops.ts +4 -4
- package/src/db/provider-config-history.ts +8 -3
- package/src/db/provider-flap-messages-write-ops.ts +1 -0
- package/src/db/provider-model-seed.ts +34 -0
- package/src/db/provider-quota-lease-write-ops.ts +1 -0
- package/src/db/provider-quota-write-ops.ts +2 -0
- package/src/db/provisioning-write-ops.ts +9 -8
- package/src/db/read-op-marshaling-fixtures.ts +5 -0
- package/src/db/read-ops.ts +4 -0
- package/src/db/routing-policy.ts +3 -4
- package/src/db/schema.ts +9 -3
- package/src/db/secrets-broker-write-ops.ts +5 -5
- package/src/db/secrets-vault-write.ts +7 -7
- package/src/db/services-write-ops.ts +3 -0
- package/src/db/spawn-delegation-state.ts +11 -4
- package/src/db/spawn-tree-cleanup.ts +3 -0
- package/src/db/stats-async.ts +4 -3
- package/src/db/task-entity.ts +23 -2
- package/src/db/task-list.ts +3 -1
- package/src/db/tasks.ts +1 -17
- package/src/db/team-spawn-delegation.ts +1 -1
- package/src/db/teams-write-ops.ts +4 -4
- package/src/db/timer-cutover-write-ops.ts +7 -0
- package/src/db/timer-ingress-write-ops.ts +9 -0
- package/src/db/timer-ingress.ts +7 -1
- package/src/db/timer-operator-write-ops.ts +14 -0
- package/src/db/timer-transfer-write-ops.ts +4 -0
- package/src/db/timer-write-ops.ts +14 -0
- package/src/db/token-db-write-ops.ts +21 -0
- package/src/db/token-standing.ts +15 -11
- package/src/db/user-settings-write-ops.ts +1 -0
- package/src/db/vault-backup.ts +2 -2
- package/src/db/vault-expiry.ts +2 -2
- package/src/db/vault-health.ts +3 -3
- package/src/db/vault-token-ops.ts +8 -8
- package/src/db/web-tool-call-ops.ts +3 -3
- package/src/db/workflow-contact.ts +1 -1
- package/src/db/workflow-task-read-ops.ts +30 -0
- package/src/db/write-ops.ts +15 -1
- package/src/db/writer-fault-seam.ts +5 -2
- package/src/db/writer-gateway.ts +21 -12
- package/src/dispatch-availability.ts +10 -6
- package/src/ephemeral/{landing-ingress-proof-worker.ts → landing-ingress-proof.test-fixture.ts} +4 -2
- package/src/host/disk-alert.ts +121 -0
- package/src/lifecycle-manager.ts +3 -2
- package/src/maintenance/cd-watcher.ts +3 -3
- package/src/maintenance/critical-job-watchdog.ts +16 -17
- package/src/maintenance/index.ts +1 -0
- package/src/maintenance/jobs.ts +3 -2
- package/src/maintenance/scheduler.ts +84 -128
- package/src/maintenance/stalled-delivery-pager.ts +6 -5
- package/src/maintenance/workspaces.ts +1 -1
- package/src/managed-policy.ts +31 -27
- package/src/mcp/index.ts +5 -2
- package/src/mcp/output-descriptions.ts +8 -8
- package/src/mcp/presentation.ts +4 -4
- package/src/mcp/project-profile-instructions.ts +32 -0
- package/src/mcp/tool-groups.ts +1 -1
- package/src/mcp/tools-spawn.ts +4 -3
- package/src/mcp-agent-action.ts +1 -2
- package/src/mcp-host-tools.ts +1 -1
- package/src/mcp-issue-ref-tools.ts +12 -11
- package/src/mcp-maintenance-tools.ts +2 -2
- package/src/mcp-profile-trust-tools.ts +4 -4
- package/src/mcp-provider-catalog.ts +2 -2
- package/src/mcp-task-tools.ts +11 -5
- package/src/mcp-team-template-tools.ts +3 -3
- package/src/mcp-workflow-tools.ts +10 -3
- package/src/notification-types.ts +2 -1
- package/src/operator-alarm.ts +26 -11
- package/src/package-pack.ts +42 -39
- package/src/project-instructions.ts +4 -0
- package/src/project-profile-instruction-text.ts +6 -0
- package/src/project-profile-instructions.ts +20 -0
- package/src/provider-catalog-store.ts +3 -49
- package/src/provider-config-store.ts +12 -11
- package/src/provider-model-seed.ts +1 -18
- package/src/provider-quota-config-store.ts +5 -4
- package/src/provider-secrets.test-fixture.ts +3 -3
- package/src/recipe-runner.ts +2 -2
- package/src/repo-config-source.ts +10 -4
- package/src/routes/agent-profiles.ts +6 -6
- package/src/routes/agents-spawn.ts +1 -1
- package/src/routes/agents.ts +6 -6
- package/src/routes/commands-listing.ts +4 -0
- package/src/routes/commands.ts +2 -2
- package/src/routes/continuation-archives.ts +2 -2
- package/src/routes/host-resource-control.ts +4 -1
- package/src/routes/index.ts +10 -1
- package/src/routes/integrations.ts +24 -50
- package/src/routes/issue-refs.ts +7 -7
- package/src/routes/orchestrator-bootstrap.ts +3 -3
- package/src/routes/orchestrator-host-registration.ts +2 -2
- package/src/routes/orchestrator-host-utilization.ts +3 -1
- package/src/routes/orchestrator-proxy.ts +2 -2
- package/src/routes/orchestrator.ts +4 -4
- package/src/routes/project-profile-instructions.ts +27 -0
- package/src/routes/project-trust.ts +2 -2
- package/src/routes/provider-config.ts +9 -8
- package/src/routes/provider-quota-config.ts +2 -2
- package/src/routes/settings.ts +5 -5
- package/src/routes/stats.ts +6 -6
- package/src/routes/task-http.ts +15 -1
- package/src/routes/task-issues.ts +11 -26
- package/src/routes/tasks.ts +22 -53
- package/src/routes/team-templates.ts +5 -5
- package/src/routes/teams-config.ts +2 -2
- package/src/routes/tokens.ts +12 -5
- package/src/routes/workflows.ts +20 -5
- package/src/routing-policy-normalize.ts +1 -2
- package/src/routing-step-defaults.ts +0 -2
- package/src/runner-token-mint-limit.ts +63 -0
- package/src/runtime-grant.ts +4 -2
- package/src/runtime-tokens.ts +50 -9
- package/src/security.ts +13 -20
- package/src/server-background.ts +1 -1
- package/src/server.ts +5 -2
- package/src/services/host-utilization.ts +23 -0
- package/src/services/idle-epics.ts +5 -6
- package/src/services/issue-lifecycle.ts +57 -61
- package/src/services/issue-refs.ts +9 -13
- package/src/services/kernel-timers-cutover-chaos-worker.ts +12 -7
- package/src/services/kernel-timers-ingress.ts +1 -1
- package/src/services/kernel-timers-request-key-migration-chaos-worker.ts +4 -1
- package/src/services/landed-ancestry.ts +19 -3
- package/src/services/memory-areas.ts +15 -51
- package/src/services/plan-ci-notice.ts +57 -0
- package/src/services/plan-ci-recovery.ts +2 -55
- package/src/services/plan-wake-digest.ts +1 -0
- package/src/services/profile-trust.ts +4 -3
- package/src/services/project-config-read.ts +70 -0
- package/src/services/project-profile-instructions.ts +54 -0
- package/src/services/provisioning-harness/budget-baseline.json +4 -4
- package/src/services/restart-spawn.ts +61 -49
- package/src/services/self-care-state.ts +2 -1
- package/src/services/self-effort.ts +5 -5
- package/src/services/send-message.ts +5 -1
- package/src/services/spawn-agent.ts +13 -2
- package/src/services/spawn-chain-inspector.ts +6 -13
- package/src/services/spawn-policy.ts +68 -0
- package/src/services/spawn-tree-cleanup.ts +2 -2
- package/src/services/task-dispatch.ts +3 -0
- package/src/services/task-state-reconcile.ts +6 -14
- package/src/services/team-templates.ts +9 -8
- package/src/services/transient-agent-reaper.ts +3 -1
- package/src/services/workflow-auto-start.ts +25 -13
- package/src/services/workflow-ci-main.ts +1 -1
- package/src/services/workflow-deferred-cleanup.ts +4 -2
- package/src/services/workflow-effect-driver.ts +2 -0
- package/src/services/workflow-effects.ts +18 -11
- package/src/services/workflow-land-notice.ts +10 -0
- package/src/services/workflow-pause-text.ts +43 -0
- package/src/services/workflow-reconcile.ts +13 -11
- package/src/services/workflow-run-view.ts +2 -0
- package/src/services/workflow-runs.ts +29 -13
- package/src/services/workflow-supervisor-state.ts +5 -0
- package/src/services/workflow-supervisor.ts +7 -3
- package/src/settings/registry.ts +1 -2
- package/src/spawn-command.ts +4 -4
- package/src/spawn-models.ts +10 -12
- package/src/spawn-placement.ts +1 -1
- package/src/spawn-targets.ts +1 -1
- package/src/startup-context-injection.ts +1 -0
- package/src/state-adoption/cd-cutover.ts +53 -7
- package/src/state-adoption/fleet-cutover.ts +35 -0
- package/src/state-adoption/fleet-plan.ts +36 -0
- package/src/state-adoption/index.ts +2 -2
- package/src/state-adoption/linux-plan.ts +2 -2
- package/src/state-adoption/linux.ts +2 -2
- package/src/state-adoption/macos-plan.ts +2 -2
- package/src/state-adoption/macos.ts +1 -1
- package/src/steward.ts +7 -6
- package/src/task-dispatch-live.ts +1 -1
- package/src/task-dispatcher.ts +1 -1
- package/src/teams-config-store.ts +4 -3
- package/src/token-db-write.ts +10 -0
- package/src/workspace-command-settle.ts +2 -1
- package/src/workspace-steward-wake.ts +2 -2
- package/node_modules/@humwick/kernel/LICENSE +0 -167
- package/node_modules/@humwick/kernel/async-entity-persistence.ts +0 -344
- package/node_modules/@humwick/kernel/async-event-log.ts +0 -107
- package/node_modules/@humwick/kernel/automations.pilot.ts +0 -147
- package/node_modules/@humwick/kernel/config.ts +0 -111
- package/node_modules/@humwick/kernel/contract.ts +0 -572
- package/node_modules/@humwick/kernel/control-authz.ts +0 -281
- package/node_modules/@humwick/kernel/control.ts +0 -645
- package/node_modules/@humwick/kernel/effects.ts +0 -493
- package/node_modules/@humwick/kernel/event-log.ts +0 -319
- package/node_modules/@humwick/kernel/http-transport.ts +0 -384
- package/node_modules/@humwick/kernel/identity-grammar.ts +0 -20
- package/node_modules/@humwick/kernel/identity.ts +0 -248
- package/node_modules/@humwick/kernel/index.ts +0 -28
- package/node_modules/@humwick/kernel/kernel-persistence.ts +0 -181
- package/node_modules/@humwick/kernel/landing-incident.ts +0 -306
- package/node_modules/@humwick/kernel/landing.ts +0 -953
- package/node_modules/@humwick/kernel/manifest-validation.ts +0 -460
- package/node_modules/@humwick/kernel/mcp-transport.ts +0 -109
- package/node_modules/@humwick/kernel/message-authority-chaos-worker.ts +0 -200
- package/node_modules/@humwick/kernel/message-authority.ts +0 -281
- package/node_modules/@humwick/kernel/module-host.ts +0 -722
- package/node_modules/@humwick/kernel/openapi-init.ts +0 -14
- package/node_modules/@humwick/kernel/package.json +0 -47
- package/node_modules/@humwick/kernel/persistence-schema.ts +0 -248
- package/node_modules/@humwick/kernel/persistence.ts +0 -510
- package/node_modules/@humwick/kernel/registry.ts +0 -60
- package/node_modules/@humwick/kernel/sqlite-kernel-persistence.ts +0 -499
- package/node_modules/@humwick/kernel/sqlite-module-host.ts +0 -87
- package/node_modules/@humwick/kernel/timers-chaos-worker.ts +0 -186
- package/node_modules/@humwick/kernel/timers.pilot.ts +0 -1411
- package/node_modules/@humwick/kernel/workflow-activation.ts +0 -25
- package/node_modules/@humwick/kernel/workflow-backstop.ts +0 -40
- package/node_modules/@humwick/kernel/workflow-cancel-tree.ts +0 -20
- package/node_modules/@humwick/kernel/workflow-chaos-worker.ts +0 -213
- package/node_modules/@humwick/kernel/workflow-composition.ts +0 -231
- package/node_modules/@humwick/kernel/workflow-container.ts +0 -72
- package/node_modules/@humwick/kernel/workflow-control.test-fixture.ts +0 -42
- package/node_modules/@humwick/kernel/workflow-control.ts +0 -178
- package/node_modules/@humwick/kernel/workflow-definition.ts +0 -507
- package/node_modules/@humwick/kernel/workflow-dispatch.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-foreach.ts +0 -167
- package/node_modules/@humwick/kernel/workflow-journal-codec.ts +0 -339
- package/node_modules/@humwick/kernel/workflow-journal.ts +0 -922
- package/node_modules/@humwick/kernel/workflow-lane.ts +0 -48
- package/node_modules/@humwick/kernel/workflow-lease-owner.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-recovery.test-fixture.ts +0 -19
- package/node_modules/@humwick/kernel/workflow-runtime.ts +0 -938
- package/node_modules/@humwick/kernel/workflow-script.ts +0 -11
- package/node_modules/@humwick/kernel/workflow-state.ts +0 -299
- package/node_modules/@humwick/kernel/workflow-step-commit.ts +0 -195
- package/node_modules/@humwick/kernel/workflow-transitions.ts +0 -317
- package/node_modules/@humwick/kernel/workflow-values.ts +0 -153
- package/node_modules/@humwick/kernel/workflow.pilot.ts +0 -376
- package/node_modules/@humwick/offload/LICENSE +0 -167
- package/node_modules/@humwick/offload/README.md +0 -57
- package/node_modules/@humwick/offload/dist/async-runner.d.ts +0 -18
- package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/async-runner.js +0 -158
- package/node_modules/@humwick/offload/dist/async-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.d.ts +0 -25
- package/node_modules/@humwick/offload/dist/envelope.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.js +0 -80
- package/node_modules/@humwick/offload/dist/envelope.js.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +0 -10
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +0 -59
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +0 -1
- package/node_modules/@humwick/offload/dist/index.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/index.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/index.js +0 -5
- package/node_modules/@humwick/offload/dist/index.js.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +0 -62
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.js +0 -295
- package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/types.d.ts +0 -111
- package/node_modules/@humwick/offload/dist/types.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/types.js +0 -176
- package/node_modules/@humwick/offload/dist/types.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts +0 -23
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.js +0 -435
- package/node_modules/@humwick/offload/dist/worker-pool.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +0 -2
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.js +0 -27
- package/node_modules/@humwick/offload/dist/worker-runtime.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/worker.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.js +0 -1
- package/node_modules/@humwick/offload/dist/worker.js.map +0 -1
- package/node_modules/@humwick/offload/package.json +0 -46
- package/node_modules/@humwick/offload/src/async-runner.ts +0 -170
- package/node_modules/@humwick/offload/src/envelope.ts +0 -92
- package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +0 -49
- package/node_modules/@humwick/offload/src/index.ts +0 -4
- package/node_modules/@humwick/offload/src/subprocess-runner.ts +0 -334
- package/node_modules/@humwick/offload/src/types.ts +0 -235
- package/node_modules/@humwick/offload/src/worker-pool.ts +0 -463
- package/node_modules/@humwick/offload/src/worker-runtime.ts +0 -32
- package/node_modules/@humwick/offload/src/worker.ts +0 -5
- package/public/assets/agent-liveness-DyqxfB-t.js +0 -2
- package/public/assets/agent-profiles-BpI_jTxq.js +0 -2
- package/public/assets/fleet-BL4UXS_k.js +0 -2
- package/public/assets/index-B7ZerHLY.css +0 -2
- package/public/assets/index-BK0WV6hF.js +0 -15
- package/public/assets/projects-B_lmcqfO.js +0 -2
- package/public/assets/provider-display-DbLWpP3j.js +0 -2
- package/public/assets/run-card-CO_bguQf.js +0 -2
- package/public/assets/use-project-list-B-T2Bnnn.js +0 -2
- package/public/assets/versioned-prompt-editor-Diu8BIaM.js +0 -8
- package/runner/src/gate-run-lease-probe.ts +0 -38
- package/src/db/claude-catalog-reconcile.ts +0 -27
- package/src/routing-model-aliases.ts +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./react-dom-DSFxiC7T.js";import{Nt as a,jt as o,t as s}from"./store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./react-dom-DSFxiC7T.js";import{Nt as a,jt as o,t as s}from"./store-DcClXLH0.js";import{O as c}from"./provider-display-DsuWMvVL.js";import{o as l}from"./artifacts-D32zyw4Y.js";import{F as u,J as d,S as f,_ as p,p as ee}from"./display-BrKWFGJz.js";import{n as m}from"./api-CIIVBtAV.js";import{n as h,t as g}from"./radio-Bn0_qc0G.js";import{t as _}from"./arrow-right-vFsRqG8V.js";import{D as v,G as y,I as te,N as ne,O as b,T as x,c as S,h as C,j as re,k as w,m as ie,n as T,p as E,v as D,w as O}from"./TraceView-Wimm0Czv.js";import{t as k}from"./brain-CagXMEKE.js";import{t as A}from"./chevron-right-iljytE0x.js";import{t as j}from"./circle-alert-CryagaZd.js";import{t as M}from"./file-text-CKuoMR2U.js";import{t as N}from"./git-merge-C7eIG425.js";import{t as P}from"./loader-circle-BfPd4kOD.js";import{t as ae}from"./plug-zap-V0wMDJ-G.js";import{t as oe}from"./smile-plus-q6EQBXHZ.js";import{t as F}from"./triangle-alert-BBNhfgMi.js";import{t as I}from"./agent-type-icon-LrUEU3lB.js";import{t as se}from"./volume-2-XrcRKD9Z.js";import{t as L}from"./zoom-in-Bs8Qv8VL.js";import{n as R,t as z}from"./task-chip-CYj0mpoL.js";import{t as B}from"./formatted-body-CQBwc1fb.js";import{t as ce}from"./user-avatar-DHxlvUvV.js";var V=e(n(),1),H=e(i(),1),U=`[data-testid="chat-scroller"]`,W=`data-anchor-step`,G=e=>({[W]:e}),K=90,q=15,J=[`wheel`,`touchstart`,`pointerdown`,`keydown`],Y=new Map;function X(e,t){return Y.set(e,t),()=>void Y.delete(e)}var Z=(e,t)=>e.getBoundingClientRect().top-t.getBoundingClientRect().top;function le(e,t){let n=e.getBoundingClientRect(),r=null,i=Array.from(e.querySelectorAll(`[${W}]`)).filter(e=>e.getAttribute(W)!==t).map(e=>({el:e,top:e.getBoundingClientRect().top,bottom:e.getBoundingClientRect().bottom})).sort((e,t)=>e.top-t.top),a=null;for(let e of i){if(e.bottom>n.top&&e.top<n.bottom){a=e;break}e.bottom<=n.top&&(!r||e.bottom>r.bottom)&&(r=e)}if(a??=r,!a)return null;let o=a.el;return{find:()=>o.isConnected?o:null,offset:a.top-n.top}}function ue(e){let t=e.getBoundingClientRect(),n=t.top+t.height/2,r=new Set;return Array.from(e.querySelectorAll(`[data-msg-id]`)).filter(e=>!r.has(e.dataset.msgId)&&!!r.add(e.dataset.msgId)).map(e=>{let r=e.getBoundingClientRect();return{id:e.dataset.msgId,offset:r.top-t.top,distance:Math.abs((r.top+r.bottom)/2-n)}}).sort((e,t)=>e.distance-t.distance)}function de(e,t,n){let r=()=>{let r=n.find();if(!r)return!1;let i=Z(r,e)-n.offset;return Math.abs(i)<=.5?!1:(t.nudge(i),!0)};r();let i=0,a=()=>{cancelAnimationFrame(i),t.pin(null);for(let t of J)e.removeEventListener(t,a)};for(let t of J)e.addEventListener(t,a,{passive:!0});let o=0,s=0,c=()=>{if(o=r()?0:o+1,!e.isConnected||!n.find()||o>=q||++s>=K)return a();i=requestAnimationFrame(c)};i=requestAnimationFrame(c)}function fe(e,t,n){let r=e.closest(U),i=r&&Y.get(r),a=r&&i&&r.dataset.scrollMode===`anchored`?le(r,t):null;(0,H.flushSync)(n),r&&i&&a&&de(r,i,a)}function pe(e){let t=Array.from(Y,([e,t])=>({scroller:e,owner:t,rows:e.dataset.scrollMode===`anchored`?ue(e):[]})).filter(({rows:e})=>e.length);for(let{owner:e,rows:n}of t)e.pin(n.map(({id:e})=>Number(e)));(0,H.flushSync)(e);for(let{scroller:e,owner:n,rows:r}of t){let t=t=>()=>e.querySelector(`[data-msg-id="${CSS.escape(t)}"]`),i=r.find(({id:e})=>t(e)());i?de(e,n,{find:t(i.id),offset:i.offset}):n.pin(null)}}var Q=r();function me(e){let t=new Set,n=(()=>{try{return window.localStorage.getItem(e)===`on`}catch{return!1}})(),r=()=>t.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,t=>{t.key===e&&(n=t.newValue===`on`,r())}),{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>n,toggle(){n=!n;try{window.localStorage.setItem(e,n?`on`:`off`)}catch{}r()}}}var he=me(`humwick:chat-hide-tools`),ge=me(`humwick:chat-hide-reasoning`);function _e(e){return[(0,V.useSyncExternalStore)(e.subscribe,e.get,()=>!1),e.toggle]}function ve(e){return e.split(`
|
|
2
2
|
`).find(e=>e.trim())?.trim()??`thinking`}function ye({step:e,issueRepo:t}){return(0,Q.jsx)(ie,{id:`reasoning-step-${e.id}`,icon:k,label:`thinking`,summary:ve(e.text),tone:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`,children:(0,Q.jsx)(B,{text:e.text,issueRepo:t,className:`italic break-words min-w-0 text-xs leading-relaxed`})})}function be({hidden:e,count:n,kind:r,onToggle:i}){return(0,Q.jsxs)(`button`,{...G(`control`),onClick:t=>fe(t.currentTarget,e?null:r,i),className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,Q.jsx)(A,{className:t(`w-3 h-3 shrink-0 transition-transform`,!e&&`rotate-90`)}),(0,Q.jsx)(`span`,{children:e?`show ${n} ${r} step${n===1?``:`s`}`:`hide ${r} steps`})]})}function xe({steps:e,showReasoning:t,issueRepo:n}){let[r,i]=_e(he),[a,o]=_e(ge),s=t?e:e.filter(e=>e.kind!==`reasoning`);if(!s.length)return null;let c=s.filter(e=>e.kind===`tool`).length,l=s.filter(e=>e.kind===`reasoning`).length;return(0,Q.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,Q.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[s.map(e=>(e.kind===`reasoning`?a:e.kind===`tool`&&r)?null:(0,Q.jsx)(`div`,{...G(e.kind),children:e.kind===`narration`?(0,Q.jsx)(B,{text:e.text,issueRepo:n,className:`text-sm leading-relaxed break-words text-foreground/90 min-w-0`}):e.kind===`reasoning`?(0,Q.jsx)(ye,{step:e,issueRepo:n}):(0,Q.jsx)(E,{step:e})},e.id)),l>0&&(0,Q.jsx)(be,{hidden:a,count:l,kind:`reasoning`,onToggle:o}),c>0&&(0,Q.jsx)(be,{hidden:r,count:c,kind:`tool`,onToggle:i})]})})}var Se={memory:`memories`,"memory-area":`memories`,instructions:`startup`,context:`startup`,tools:`injected`,comms:`injected`,knowledge:`injected`},Ce={narration:`narration`,tool:`tools`,reasoning:`reasoning`};function we(e){return e.startsWith(`workflow.`)||e.startsWith(`plan.`)?`workflow`:e===`branch.landed`||e===`landed-failure`||e===`task.steward-rekey`||e.startsWith(`workspace.`)||e.startsWith(`ci.`)||e.startsWith(`cd.`)?`land`:e.startsWith(`task.`)?`task`:e.startsWith(`agent.`)||e.startsWith(`team.`)||e.startsWith(`managed-policy.`)?`agents`:`other`}function Te(e){let t=e.payload??{};return typeof t.notificationKind==`string`?t.notificationKind:typeof t.kind==`string`?t.kind:``}function Ee(e,t){if(D(e))return we(Te(e));if(e.kind===`session`){let t=e.payload?.session;return t?.type===`relay-injection`?Se[t.relayInjection?.category]??`injected`:Ce[t?.type??``]??null}let n=e.from===t?e.to:e.from;return n&&n!==`system`&&!c(n)?`agentMessages`:null}function De(e,t,n){if(e.kind!==`session`&&e.deliveryStatus===`history`&&!n.undelivered)return!1;let r=Ee(e,t);return r===null||n[r]}var Oe={"branch.landed":N,"context.warning":F,"agent.context_threshold":F,"agent.rate_limit_resume":ae},ke={"branch.landed":`branch landed`,"context.warning":`context warning`,"agent.context_threshold":`context threshold reached`,"task.status-pulse":`Status Pulse`};function Ae(e){return e.payload?.kind===`agent.self_resume_continuation`?e.payload.delivery?.state===`ingested`?`self-resume continuation ingested`:`self-resume continuation stored / recoverable`:null}function je(e){return e.replace(/[._-]+/g,` `).trim()}function Me(e,t,n){return Ae(e)??ke[t]??(je(t)||e.subject?.trim()||n||`notice #${e.id}`)}function Ne(e,t){return t===e?``:t.startsWith(`${e}:`)?t.slice(e.length+1).trim():t}function Pe(e){return e.length?e.map(e=>[e.taskId==null?null:`T${e.taskId}`,e.transition,e.title].filter(Boolean).join(` `)).join(` · `):`update`}var $=e=>typeof e==`string`?e:``,Fe=[`sha`,`landedSha`,`newHeadSha`,`sourceHeadSha`,`greenHeadSha`,`gitSha`],Ie=[`taskId`,`runId`,`agentId`,`author`,`workspaceId`,`branch`,`base`,`commandId`,...Fe];function Le(e){let t=e.payload??{},n=Te(e),r=typeof t.taskId==`number`&&Number.isSafeInteger(t.taskId)?t.taskId:void 0,i=Fe.map(e=>$(t[e])).find(Boolean)??``,a=e.body.split(`
|
|
3
3
|
`).find(e=>e.trim())?.replace(/`/g,``).trim()??``;return n===`branch.landed`&&$(t.branch)&&(a=`${$(t.branch)} → ${$(t.base)||`base`}`),n===`task.status-pulse`&&(a=Pe(Array.isArray(t.events)?t.events:[])),{kind:n,summary:a,agentId:$(t.agentId)||$(t.author)||$(t.memberId),taskId:r,taskLabel:$(t.taskLabel)||void 0,runId:$(t.runId),sha:i}}function Re(e){let t=e.payload?.routing;return!t||typeof t!=`object`||Array.isArray(t)?``:$(t.reason)}function ze({msg:e}){let t=e.payload??{},{routing:n,...r}=t,i=Re(e),a=Ie.flatMap(e=>t[e]==null||t[e]===``?[]:[[e,String(t[e])]]);return(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-current/10 pt-2`,children:[e.body.trim()&&(0,Q.jsx)(B,{text:e.body,className:`break-words text-xs leading-relaxed text-foreground/85`}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-[11px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`message`}),(0,Q.jsxs)(`dd`,{className:`font-mono`,children:[`#`,e.id,` · `,e.deliveryStatus??`pending`]}),a.map(([e,t])=>(0,Q.jsxs)(`div`,{className:`contents`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:t})]},e)),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`why here`}),(0,Q.jsx)(`dd`,{children:i})]})]}),(0,Q.jsx)(C,{value:r,className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})]})}function Be({msg:e}){let n=Le(e),r=`notice-${e.id}`,i=s(e=>e.chatExpandedItems.includes(r)),a=s(e=>e.toggleChatItemExpanded),o=s(e=>e.openTaskDetailById),c=s(e=>e.showWorkflowRun),l=Oe[n.kind]??g,u=Me(e,n.kind,n.summary),d=Ne(u,n.summary),f=n.kind===`branch.landed`,p=e.deliveryStatus===`history`;return(0,Q.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,Q.jsxs)(`div`,{"data-testid":`chat-notice`,"data-notice-kind":n.kind,className:t(`w-full min-w-0 max-w-full rounded-lg border px-2.5 py-1.5 text-xs md:max-w-[85%]`,f?`border-tone-success/35 bg-tone-success/10 text-tone-success-fg`:`border-border bg-muted/20 text-muted-foreground`,p&&`border-dashed opacity-80`),children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(r),className:`flex min-w-0 flex-1 basis-full items-center gap-1.5 text-left @2xl/chat:basis-56`,children:[(0,Q.jsx)(A,{className:t(`h-3.5 w-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,Q.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:u}),d&&(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/75`,children:d})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[n.agentId&&(0,Q.jsx)(T,{agentId:n.agentId,className:`text-current`}),n.taskId!=null&&(0,Q.jsx)(z,{id:n.taskId,title:n.taskLabel,compact:!0,onClick:()=>o(n.taskId)}),n.runId&&(0,Q.jsx)(R,{label:n.runId,compact:!0,title:`Workflow run ${n.runId}`,ariaLabel:`Open workflow run ${n.runId}`,onClick:()=>void c(n.runId)}),n.sha&&(0,Q.jsx)(`span`,{className:`rounded bg-current/10 px-1 font-mono text-[10px]`,title:n.sha,children:n.sha.slice(0,7)}),f&&e.payload?.pushed===!1&&(0,Q.jsx)(`span`,{className:`text-tone-warning-fg`,title:`Local-only land — not pushed to origin`,children:`local only`}),p&&(0,Q.jsx)(`span`,{className:`rounded border border-current/30 px-1 text-[10px]`,title:`Settled as history: this notice never reached the agent's turn`,children:`not delivered`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(e.occurredAt??e.createdAt)})]})]}),i&&(0,Q.jsx)(ze,{msg:e})]})})}function Ve(){return(0,V.useSyncExternalStore)(e=>o.subscribe(e),()=>o.getPlayingKey(),()=>null)}function He({msg:e,peer:t}){return(0,Q.jsx)(S,{msg:e,issueRepo:s(e=>e.agentsById[t]?.issueRepo)})}function Ue({agent:e,onClick:n}){let r=!!(n&&e);return(0,Q.jsx)(`button`,{type:`button`,title:e?e.label||e.name||e.id:void 0,onClick:n,disabled:!r,className:t(`shrink-0 self-end transition-opacity`,r?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,Q.jsx)(I,{agent:e})})}function We({agentId:e,onOpen:t}){let n=s(t=>t.agentsById[e]??null);return(0,Q.jsx)(Ue,{agent:n,onClick:n?()=>t(n):void 0})}function Ge({attachment:e,outbound:n}){let r=e.title||e.artifactId;return e.kind===`image`?(0,Q.jsx)(Ke,{artifactId:e.artifactId,title:r}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>l(e.artifactId),className:t(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors`,n?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[(0,Q.jsx)(M,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),(0,Q.jsx)(A,{className:`h-3.5 w-3.5 shrink-0`})]})}function Ke({artifactId:e,title:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let t=!1,n=null;return o(null),i(null),m(`/artifacts/${encodeURIComponent(e)}/content`).then(e=>{t||(n=URL.createObjectURL(e),i(n))},e=>{t||o(e.message)}),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e]),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left relative`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`img`,{src:r,alt:n,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,Q.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,Q.jsx)(L,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,Q.jsxs)(`span`,{className:t(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,a?`text-tone-danger-fg`:`text-muted-foreground`),children:[a?(0,Q.jsx)(j,{className:`h-4 w-4`}):(0,Q.jsx)(P,{className:`h-4 w-4 animate-spin`}),a||`Loading image`]})})}function qe({open:e,onToggle:n,onReact:r}){return(0,Q.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Q.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:n,className:t(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,Q.jsx)(oe,{className:`h-3 w-3`})}),e&&(0,Q.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:O.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>r(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}function Je({msg:e,peer:n}){let[r,i]=(0,V.useState)(!1),a=s(e=>e.agentsById),o=s(e=>e.openAgentDetail),c=e.from===n,l=(c?e.to:e.from)||``,d=a[c?n:l]?.issueRepo??a[n]?.issueRepo,f=!l||l===`broadcast`||l.includes(`:`),p=u(e),m=x(e.occurredAt??e.createdAt),g=c?_:h,v=a[e.from??``]??null;function y(e){e.stopPropagation(),v&&o(v)}return(0,Q.jsx)(`div`,{"data-msg-id":e.id,className:`flex justify-center mb-1.5`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-[94%] rounded-md border border-border/50 bg-muted/15 px-2.5 py-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs cursor-pointer select-none`,onClick:()=>i(e=>!e),children:[(0,Q.jsx)(A,{className:t(`h-3 w-3 shrink-0 text-muted-foreground/60 transition-transform`,r&&`rotate-90`)}),(0,Q.jsx)(`button`,{type:`button`,title:v?v.label||v.name||v.id:void 0,disabled:!v,onClick:y,className:t(`shrink-0 transition-opacity`,v?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,Q.jsx)(I,{agent:v,className:`!w-4 !h-4 !rounded-sm opacity-70`})}),(0,Q.jsx)(g,{className:`h-3 w-3 shrink-0 text-muted-foreground/70`}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`Message `,c?`to`:`from`]}),f?(0,Q.jsx)(`span`,{className:`shrink-0 font-medium text-muted-foreground`,children:ee(l,a)}):(0,Q.jsx)(T,{agentId:l,className:`shrink-0 px-0.5 text-foreground/80`,noIcon:!0}),!r&&(0,Q.jsx)(`span`,{className:`min-w-24 flex-1 truncate text-muted-foreground/50`,children:p}),(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/40`,children:m})]}),r&&(0,Q.jsx)(`div`,{className:`mt-1.5 pl-5`,children:(0,Q.jsx)(B,{text:p,rawBody:e.body,issueRepo:d,className:`text-sm leading-relaxed text-foreground/90`})})]})})}var Ye=(0,V.memo)(function({msg:e,peer:n,showAvatar:r=!1,onOpenReferencedPath:i,onPreviewReferencedPath:l,onPreviewReferencedPathEnd:ee}){if(!c(e.from)&&!c(e.to))return(0,Q.jsx)(Je,{msg:e,peer:n});let m=e.kind===`session`?e.payload?.session:void 0;if(m?.type===`prompt`&&m?.origin===`provider`)return(0,Q.jsx)(He,{msg:e,peer:n});let h=c(e.from),g=s(e=>e.reactToMessage),_=s(e=>e.voiceTtsEnabled),S=Ve(),C=s(e=>{let t=e.agentsById[n]?.meta?.cwd;return typeof t==`string`?t:``}),ie=s(e=>e.agentsById[n]?.issueRepo),T=s(e=>e.usersById),E=s(e=>e.users.length>1),D=h?d(e.from,T):void 0,O=s(e=>e.openAgentDetail);s(e=>e.openTaskDetailById);let[k,A]=(0,V.useState)(!1),j=(0,V.useRef)(null),M=(0,V.useRef)(null),N=(0,V.useRef)(!1),P=u(e),ae=x(e.occurredAt??e.createdAt),oe=re(e),F=v(e,a(s(e=>e.sessionUser))),I=h?ne(e,n):null,L=I?.icon,z=S===String(e.id),H=_&&!h&&!w(e)&&P.trim().length>0;function U(t){t.stopPropagation(),z?o.bargeIn():o.speak(e.body,String(e.id))}(0,V.useEffect)(()=>{if(!k)return;function e(e){b()||j.current&&!j.current.contains(e.target)&&A(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[k]);function W(e){return te(C||`/`,e)}function G(e,t){let n=W(e);i?.(n,t)}function K(e,t,n){let r=W(e);l?.(r,t,n)}function q(t){g(e,t),A(!1)}function J(e){e.button===0&&(M.current={x:e.clientX,y:e.clientY},N.current=!1)}function Y(e){let t=M.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(N.current=!0)}function X(t){if(!(w(e)||h)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(N.current||b()){N.current=!1;return}A(e=>!e)}}let Z=r&&!w(e);return(0,Q.jsxs)(`div`,{"data-msg-id":e.id,className:t(`group/msg flex mb-3 items-end`,h?`justify-end`:`justify-start`,Z&&`gap-1.5`),children:[!h&&Z&&(0,Q.jsx)(We,{agentId:n,onOpen:O}),(0,Q.jsxs)(`div`,{ref:j,className:t(`relative`,h?`max-w-full md:max-w-[75%]`:`max-w-[calc(100%-2rem)] md:max-w-[calc(75%-2rem)]`),children:[H&&(0,Q.jsx)(`button`,{type:`button`,title:z?`Stop playback`:`Play aloud`,onClick:U,className:t(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,z?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:z?(0,Q.jsx)(y,{className:`h-3.5 w-3.5 animate-pulse`}):(0,Q.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:t(`rounded-2xl px-3.5 py-2 text-sm select-text`,!h&&!w(e)&&`cursor-pointer`,h?`tone-on-primary bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:J,onPointerMove:Y,onClick:X,children:[h&&E&&(0,Q.jsx)(`p`,{className:`text-[11px] font-semibold mb-0.5 text-right`,children:f(e.from,T)}),e.subject&&(0,Q.jsx)(`p`,{className:t(`text-xs font-semibold mb-1`,h?`text-primary-foreground`:`text-muted-foreground`),children:e.subject}),(0,Q.jsx)(B,{text:P,rawBody:e.body,issueRepo:ie,className:`leading-relaxed`,onPrimary:h,onOpenPath:G,onPreviewPath:K,onPreviewPathEnd:ee,resolvePathTitle:(e,t)=>`${W(e)}${t?`:${t}`:``}`}),oe.map(t=>(0,Q.jsx)(Ge,{attachment:t,outbound:h},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,Q.jsxs)(`p`,{className:t(`text-xs mt-1 flex items-center gap-1.5`,h?`justify-end text-primary-foreground`:`justify-end text-muted-foreground`),children:[(0,Q.jsx)(R,{label:p(e.id),title:`Message id`,compact:!0}),(0,Q.jsx)(`span`,{children:ae}),I&&L&&(0,Q.jsxs)(`span`,{className:t(`inline-flex items-center gap-1`,I.tone!==`muted`&&`text-primary-foreground`,I.tone===`danger`&&`font-semibold`),title:I.title,children:[(0,Q.jsx)(L,{className:`h-3 w-3`}),I.label]})]})]}),!w(e)&&F.length>0&&(0,Q.jsxs)(`div`,{className:t(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,h?`justify-end pr-2`:`justify-start pl-2`),children:[!h&&(0,Q.jsx)(qe,{open:k,onToggle:()=>A(e=>!e),onReact:q}),F.map(e=>(0,Q.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>q(e.emoji),className:t(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,Q.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,Q.jsx)(`span`,{children:e.count})]},e.emoji))]}),!w(e)&&!h&&F.length===0&&(0,Q.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,Q.jsx)(qe,{open:k,onToggle:()=>A(e=>!e),onReact:q})})]}),h&&Z&&(0,Q.jsx)(`span`,{className:`shrink-0 self-end opacity-60`,children:(0,Q.jsx)(ce,{user:D,address:e.from,distinct:E})})]})});export{pe as a,xe as i,Be as n,X as o,De as r,Ye as t};
|
|
4
|
-
//# sourceMappingURL=MessageBubble-
|
|
4
|
+
//# sourceMappingURL=MessageBubble-BWLqMGKG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,St as a,d as o,f as s,p as c,t as l}from"./store-BvtFdlGX.js";import"./provider-display-DbLWpP3j.js";import{ct as u,et as d,h as f,v as p,vt as m}from"./display-CfO7rTuF.js";import{t as h}from"./api-CIIVBtAV.js";import{i as ee,n as g,r as _,t as v}from"./list-todo-9qT0fgxZ.js";import{t as y}from"./archive-CIuPSvmx.js";import{t as b}from"./check-B3M9Ug1P.js";import{t as x}from"./chevron-down-BoG3JCZn.js";import{t as S}from"./chevron-up-Bv3yC5ma.js";import{t as C}from"./issue-ref-chip-ODyondIa.js";import{t as w}from"./circle-UESLMi2-.js";import{t as te}from"./git-branch-yxhV0m8E.js";import{r as T}from"./workflow-marker-Cf3Hf2fN.js";import{t as E}from"./x-Bge17hWJ.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{t as O}from"./agent-name-CTZBrSD9.js";var k=[`reserved`,`running`,`escalated`,`ci-blocked`];function A(e){return k.includes(e)}var j=e(n(),1);function M(e){if(typeof window>`u`)return()=>{};let t=window.matchMedia(m);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function N(){return(0,j.useSyncExternalStore)(M,()=>typeof window<`u`&&window.matchMedia(m).matches,()=>!1)}var P=r(),F={open:{label:`open`,className:`border-border bg-muted/40 text-muted-foreground`},"conformance-pending":{label:`conformance pending`,className:`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`},done:{label:`done`,className:`border-tone-success/40 bg-tone-success/10 text-tone-success-fg`}};function I({completion:e}){let n=F[e];return(0,P.jsx)(`span`,{className:t(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:n.label})}function ne({plan:e,onArchive:t}){let n=e.nodes.length;if(!n||e.nodes.some(e=>e.status!==`landed`))return null;let r=`${n} node${n===1?``:`s`}`;return e.completion===`conformance-pending`?(0,P.jsxs)(`div`,{role:`status`,className:`mb-2 rounded-md border border-tone-warning/30 bg-tone-warning/10 px-2.5 py-1.5 text-[11px] text-tone-warning-fg`,children:[`All `,r,` landed — conformance pending. The plan is not done until its acceptance check passes.`]}):e.completion&&e.completion!==`done`?null:(0,P.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md border border-tone-success/30 bg-tone-success/10 px-2.5 py-1.5`,children:[(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-tone-success-fg`,children:[e.completion===`done`?`Acceptance passed`:`All ${r} landed`,` — archive this plan?`]}),(0,P.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded border border-tone-success/40 bg-tone-success/15 px-2 py-0.5 text-[10px] font-medium text-tone-success-fg hover:bg-tone-success/20 hover:text-tone-success-fg`,children:`Archive plan`})]})}function L({check:e}){let t=`command`in e;return(0,P.jsx)(`code`,{className:`block max-w-full truncate rounded-sm bg-muted/60 px-1 py-px font-mono text-[10px] text-muted-foreground`,title:t?e.command:e.path,children:t?`$ ${e.command}`:e.path})}function re({plan:e}){let n=e.acceptance??[];if(!n.length)return null;let r=e.conformance,i=r?r.planVersion!==e.version:!1,a=new Map(r?.items.map(e=>[e.id,e])??[]),o=n.filter(e=>a.get(e.id)?.status===`met`).length;return(0,P.jsxs)(`section`,{"aria-label":`Plan acceptance`,className:`mt-2 rounded-md border border-border bg-background/60 px-2.5 py-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,P.jsx)(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Acceptance`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:r?`${o}/${n.length} met`:`${n.length} item${n.length===1?``:`s`} · not checked yet`})]}),r&&(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{children:`Last verdict`}),(0,P.jsx)(`span`,{className:t(`rounded-sm px-1 py-px font-semibold uppercase tracking-wide`,r.verdict===`pass`?`bg-tone-success/15 text-tone-success-fg`:`bg-tone-danger/15 text-tone-danger-fg`),children:r.verdict}),(0,P.jsxs)(`span`,{children:[`on main `,(0,P.jsx)(`code`,{className:`font-mono`,children:r.mainSha.slice(0,9)})]}),(0,P.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`by `,r.by]}),(0,P.jsx)(`span`,{title:p(r.at),children:d(Date.now(),r.at)}),i&&(0,P.jsxs)(`span`,{className:`rounded-sm bg-tone-warning/15 px-1 py-px text-tone-warning-fg`,title:`The plan changed after this verdict; a new check is needed.`,children:[`stale · v`,r.planVersion,`, plan now v`,e.version]})]}),(0,P.jsx)(`ul`,{className:`max-h-48 space-y-1 overflow-auto`,children:n.map(e=>{let n=a.get(e.id);return(0,P.jsxs)(`li`,{className:t(`flex min-w-0 gap-1.5`,i&&`opacity-70`),children:[(0,P.jsx)(`span`,{className:`mt-px shrink-0`,"aria-label":n?.status??`not checked`,children:n?.status===`met`?(0,P.jsx)(b,{className:`h-3.5 w-3.5 text-tone-success-fg`}):n?.status===`unmet`?(0,P.jsx)(E,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,P.jsx)(w,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,P.jsxs)(`div`,{className:`text-[11px] leading-snug text-foreground`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[10px] text-muted-foreground`,children:e.id}),e.text]}),e.check&&(0,P.jsx)(L,{check:e.check}),n?.note&&(0,P.jsx)(`div`,{className:`text-[10px] leading-snug text-muted-foreground`,children:n.note})]})]},e.id)})})]})}function ie({listId:e,plans:n,shownId:r,open:i,onToggle:a}){let o=n.findIndex(e=>e.id===r)+1;return(0,P.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":i,"aria-controls":e,"aria-label":`Switch plan (${n.length} active)`,title:`${n.length} active plans`,className:t(`flex h-6 shrink-0 items-center gap-0.5 rounded border border-border px-1.5 text-[10px] font-medium tabular-nums`,`text-muted-foreground hover:bg-muted/60 hover:text-foreground`,i&&`bg-muted/60 text-foreground`),children:[o>0?`${o}/${n.length}`:n.length,(0,P.jsx)(_,{className:`h-3 w-3`})]})}function R({listId:e,plans:n,shownId:r,onChoose:a,className:o}){let s=i();return(0,P.jsx)(`ul`,{id:e,"aria-label":`Active plans`,className:t(`overflow-hidden rounded-md border border-border bg-background/95`,o),children:n.map(e=>{let n=e.id===r,i=`${e.nodeCount} node${e.nodeCount===1?``:`s`}`;return(0,P.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),"aria-current":n?`true`:void 0,className:t(`flex min-h-11 w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left sm:min-h-0`,n?`bg-muted/50`:`hover:bg-muted/40`),children:[(0,P.jsx)(b,{className:t(`h-3.5 w-3.5 shrink-0 text-foreground`,!n&&`invisible`),"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-[12px] font-medium leading-tight text-foreground`,children:e.title||`Untitled plan`}),(0,P.jsxs)(`span`,{className:`block truncate text-[10px] leading-tight text-muted-foreground`,children:[i,` · updated `,d(s,e.updatedAt)]})]}),e.completion&&(0,P.jsx)(I,{completion:e.completion})]})},e.id)})})}function z(e){return new Map((e.dispatch?.slots??[]).flatMap(e=>e.runId?[[e.taskId,e.runId]]:[]))}function B({runId:e,label:n,className:r}){let i=l(e=>e.showWorkflowRun);return(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void i(e),title:`Open workflow run ${e}`,"aria-label":`Open workflow run ${e}`,className:t(`wf-marker inline-flex min-w-0 items-center gap-0.5 rounded-sm border border-border/70 px-1 py-px text-[9px] font-medium text-muted-foreground hover:text-foreground`,r),children:[(0,P.jsx)(T,{className:`h-2.5 w-2.5 shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n??e})]})}function ae({plan:e}){let t=e.dispatch;if(!t)return null;let n=t.slots.filter(e=>A(e.status)).length;return(0,P.jsxs)(`div`,{"data-testid":`plan-dispatch`,className:`mb-2 flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Autopilot `,t.state]}),(0,P.jsxs)(`span`,{children:[n,`/`,t.concurrency,` running`]}),t.slots.filter(e=>e.ciBlock).map(e=>(0,P.jsxs)(`span`,{className:`text-tone-warning-fg`,title:e.ciBlock.sha,children:[`T`,e.taskId,` CI blocked · `,e.ciBlock.sha.slice(0,12),` · `,e.ciBlock.incidentIds.join(`, `),` · `,e.ciBlock.retriedAt===void 0?`retry on clearance`:`exact SHA retried; awaiting pass`]},e.taskId)),t.audit&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`audit T`,t.audit.taskId,t.audit.verdict?` · ${t.audit.verdict}`:``,t.audit.runId&&(0,P.jsx)(B,{runId:t.audit.runId,label:`audit run`})]})]})}var V=4,H={satisfied:`text-tone-success-fg`,waiting:`text-tone-warning-fg`,unreachable:`text-tone-danger-fg`};function U(e){return e.verdict.state===`unreachable`?`unreachable · ${e.verdict.reason}`:e.verdict.state}function W({entry:e,now:n,nodeLabels:r}){let i=l(e=>e.openTaskDetailById),a=e.waitingSince===void 0?``:f(n,e.waitingSince);return(0,P.jsxs)(`li`,{"data-testid":`plan-external`,"data-verdict":e.verdict.state,title:e.projectId?`Project ${e.projectId}`:void 0,className:`min-w-0 rounded-md border border-dashed border-border bg-background/60 px-2 py-1.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full min-w-0 items-baseline gap-1.5 text-left`,title:`Open T${e.taskId}`,children:[(0,P.jsxs)(`span`,{className:`shrink-0 text-[11px] font-semibold tabular-nums text-foreground`,children:[`T`,e.taskId]}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:e.title??`title hidden`})]}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`font-medium`,H[e.verdict.state]),children:U(e)}),(0,P.jsxs)(`span`,{children:[`stage `,e.stage]}),(0,P.jsxs)(`span`,{children:[`needs `,e.requiredStage]}),a&&(0,P.jsxs)(`span`,{title:`How long this plan has waited on it`,children:[`waiting `,a]}),(0,P.jsxs)(`span`,{className:`truncate`,children:[`→ `,e.dependents.map(e=>r.get(e)??e).join(`, `)]})]})]})}function G({plan:e}){let[t,n]=(0,j.useState)(!1),r=a(e=>e.now),i=e.external;if(!i?.length)return null;let o=e.externalCount??i.length,s=t?i:i.slice(0,V),c=new Map(e.nodes.map(e=>[e.id,e.label])),l=i.length-s.length,u=o-i.length;return(0,P.jsxs)(`div`,{"data-testid":`plan-externals`,className:`mb-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),(0,P.jsxs)(`span`,{children:[`Waits on other work (`,o,`)`]})]}),(0,P.jsx)(`ul`,{className:`grid gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(W,{entry:e,now:r,nodeLabels:c},e.taskId))}),(l>0||t&&i.length>V||u>0)&&(0,P.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(l>0||t)&&i.length>V&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`rounded border border-border bg-muted/30 px-1.5 py-0.5 font-medium hover:bg-muted/50 hover:text-foreground`,children:t?`Show fewer`:`+ ${l} more`}),u>0&&(0,P.jsxs)(`span`,{children:[u,` more not listed`]})]})]})}var K=196,q=84,J=52,Y=16,X=14,Z=[`landed`,`in-progress`,`pending`,`blocked`],Q={landed:{label:`landed`,dot:`bg-tone-success`,accent:`border-l-tone-success`,text:`text-tone-success-fg`,wire:`#34d399`},"in-progress":{label:`in progress`,dot:`bg-tone-sky`,accent:`border-l-tone-sky`,text:`text-tone-sky-fg`,wire:`#38bdf8`},pending:{label:`pending`,dot:`bg-tone-warning`,accent:`border-l-tone-warning`,text:`text-tone-warning-fg`,wire:`#fbbf24`},blocked:{label:`blocked`,dot:`bg-tone-danger`,accent:`border-l-tone-danger`,text:`text-tone-danger-fg`,wire:`#f87171`}},oe=new Set([...u,`completed`]);function $(e){return oe.has(e.status)}function se(e,t){return t?e:e.filter(e=>!$(e))}function ce(e){return e?e.label||(e.policyName?`policy:${e.policyName}`:e.agentId||``):``}function le({owner:e}){let t=l(t=>e?.agentId?t.agentsById[e.agentId]:void 0),n=ce(e);return!t&&!n?null:(0,P.jsx)(O,{agent:t,fallback:n,className:`text-[10px] text-muted-foreground`})}function ue(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Map(e.nodes.map((e,t)=>[e.id,t])),r=new Map,i=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.edges)!t.has(n.from)||!t.has(n.to)||(r.set(n.from,[...r.get(n.from)??[],n.to]),i.set(n.to,(i.get(n.to)??0)+1));let a=new Map(e.nodes.map(e=>[e.id,0])),o=e.nodes.filter(e=>(i.get(e.id)??0)===0).map(e=>e.id),s=new Set;for(;o.length;){let e=o.shift();s.add(e);let t=a.get(e)??0;for(let n of r.get(e)??[])a.set(n,Math.max(a.get(n)??0,t+1)),i.set(n,(i.get(n)??0)-1),(i.get(n)??0)===0&&o.push(n)}let c=Math.max(0,...Array.from(a.values()))+1;for(let t of e.nodes)s.has(t.id)||a.set(t.id,c++);let l=new Map;for(let t of e.nodes){let e=a.get(t.id)??0;l.set(e,[...l.get(e)??[],t])}let u=[...l.entries()].sort(([e],[t])=>e-t),d=Math.max(1,...u.map(([,e])=>e.length)),f=[];u.forEach(([e,t],r)=>{let i=[...t].sort((e,t)=>(e.lane||``).localeCompare(t.lane||``)||(n.get(e.id)??0)-(n.get(t.id)??0)),a=(d-i.length)*100/2;i.forEach((t,n)=>{f.push({node:t,layer:e,x:X+r*248,y:X+a+n*100})})});let p=u.length;return{nodes:f,width:Math.max(320,X*2+p*K+Math.max(0,p-1)*J),height:Math.max(112,X*2+d*q+Math.max(0,d-1)*Y)}}function de(e,t){let n=e.x+K,r=e.y+q/2,i=t.x,a=t.y+q/2,o=n+Math.max(20,(i-n)/2);return`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`}function fe({threadId:e,teamId:n,channel:r}){let i=n?s(n,r):e?o(e,r):``,a=l(e=>n?c(e,i):i?e.plansByThread[i]:null),u=l(e=>n?e.planListsByTeam[i]?.plans:void 0),d=l(e=>e.fetchPlan),f=l(e=>e.fetchTeamPlanList),p=l(e=>e.chooseTeamPlan),[m,h]=(0,j.useState)(!1),g=(0,j.useId)(),_=l(e=>e.setPlanArchived),v=l(e=>e.planCollapsed),b=l(e=>e.setPlanCollapsed),w=l(e=>e.issueRefsById),T=l(e=>e.deliverableTasks),E=l(e=>e.openTaskDetailById),O=N(),[k,A]=(0,j.useState)(!1),M=v??O;(0,j.useEffect)(()=>{if(n){d({teamId:n,channel:r}),f({teamId:n,channel:r});return}e&&d({threadId:e,channel:r})},[r,d,f,n,e]);let F=(0,j.useMemo)(()=>a?ue(a):null,[a]),L=(0,j.useMemo)(()=>a?z(a):new Map,[a]),V=(0,j.useMemo)(()=>new Map(F?.nodes.map(e=>[e.node.id,e])??[]),[F]),H=(0,j.useMemo)(()=>{if(!a)return[];let e=new Map;for(let t of a.nodes)e.set(t.status,(e.get(t.status)??0)+1);return Z.filter(t=>e.has(t)).map(t=>({status:t,count:e.get(t)??0}))},[a]);if(!a||!F)return null;if(a.archived&&!k)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`flex min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground`,"aria-expanded":`false`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold uppercase tracking-wider`,children:`Show archived plan (1)`}),(0,P.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`})]})});if(a.archived)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-muted-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:`Archived plan`})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:`archived`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground`,"aria-expanded":`true`,children:`Hide`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!1),title:`Unarchive plan`,"aria-label":`Unarchive plan`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(ee,{className:`h-3.5 w-3.5`})})]})});let U=a.nodes.length,W=H.find(e=>e.status===`landed`)?.count??0,J=`${U} node${U===1?``:`s`}${W>0?` · ${W} landed`:``}`,Y=n&&u&&u.length>1?u:null,X=!!(Y&&m);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(ne,{plan:a,onArchive:()=>void _(a.id,!0)}),(0,P.jsx)(ae,{plan:a}),(0,P.jsxs)(`div`,{className:t(`flex min-w-0 items-center gap-2`,(!M||X)&&`mb-2`),children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(te,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:M?J:a.objective||J})]})]}),H.length>0&&(0,P.jsx)(`div`,{className:`hidden shrink-0 items-center gap-2.5 sm:flex`,children:H.map(({status:e,count:n})=>(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,Q[e].dot)}),(0,P.jsx)(`span`,{className:t(`font-medium tabular-nums`,Q[e].text),children:n}),(0,P.jsx)(`span`,{children:Q[e].label})]},e))}),a.completion&&(0,P.jsx)(I,{completion:a.completion}),Y&&(0,P.jsx)(ie,{listId:g,plans:Y,shownId:a.id,open:m,onToggle:()=>h(!m)}),(0,P.jsxs)(`span`,{className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,children:[`v`,a.version]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!0),title:`Archive plan`,"aria-label":`Archive plan`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(y,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:M?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),Y&&X&&(0,P.jsx)(R,{listId:g,className:M?void 0:`mb-2`,plans:Y,shownId:a.id,onChoose:e=>{h(!1),p({teamId:n,channel:r},e)}}),!M&&(0,P.jsx)(G,{plan:a}),M?null:a.nodes.length===0?(0,P.jsx)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-3 text-center text-xs text-muted-foreground`,children:`No nodes yet — the plan graph fills in as the team is composed.`}):(0,P.jsx)(`div`,{className:`max-h-[min(46vh,360px)] overflow-auto`,children:(0,P.jsxs)(`div`,{className:`relative`,style:{width:F.width,height:F.height},children:[(0,P.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0`,width:F.width,height:F.height,"aria-hidden":`true`,children:[(0,P.jsx)(`defs`,{children:Z.map(e=>(0,P.jsx)(`marker`,{id:`plan-arrow-${e}`,viewBox:`0 0 8 8`,refX:`6.5`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,P.jsx)(`path`,{d:`M0 0 L8 4 L0 8 z`,fill:Q[e].wire})},e))}),a.edges.map(e=>{let t=V.get(e.from),n=V.get(e.to);if(!t||!n)return null;let r=Q[t.node.status];return(0,P.jsx)(`path`,{d:de(t,n),stroke:r.wire,strokeOpacity:.7,strokeWidth:2,fill:`none`,strokeLinecap:`round`,markerEnd:`url(#plan-arrow-${t.node.status})`},`${e.from}->${e.to}`)})]}),F.nodes.map(({node:e,x:n,y:r})=>{let i=Q[e.status],a=e.refs?.issueId?w[e.refs.issueId]:null,o=e.refs?.taskId?parseInt(e.refs.taskId,10):null,s=o==null?void 0:T.find(e=>e.id===o)?.title,c=o==null?void 0:L.get(o);return(0,P.jsxs)(`article`,{className:t(`group absolute flex flex-col justify-between rounded-md border border-l-[3px] bg-background/95 p-2`,`shadow-sm transition-all hover:-translate-y-px hover:border-border hover:shadow-md hover:bg-background`,i.accent),style:{left:n,top:r,width:K,height:q},title:e.scopeBlurb||e.label,children:[(0,P.jsx)(`div`,{className:`truncate text-xs font-semibold leading-tight text-foreground`,children:e.label}),(e.scopeBlurb||e.id)&&(0,P.jsx)(`div`,{className:`truncate text-[10px] leading-tight text-muted-foreground`,children:e.scopeBlurb||e.id}),(a||o!=null)&&(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:[a&&(0,P.jsx)(C,{issueRef:a,compact:!0,className:`max-w-full`}),o!=null&&(0,P.jsx)(D,{id:o,title:s,onClick:()=>E(o),className:`max-w-full`}),c&&(0,P.jsx)(B,{runId:c,label:`run`})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1.5`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 shrink-0 rounded-full`,i.dot)}),(0,P.jsx)(`span`,{className:t(`text-[10px] font-medium`,i.text),children:i.label})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(le,{owner:e.ownerRef}),e.lane&&(0,P.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted/70 px-1 py-px text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.lane})]})]})]},e.id)})]})}),!M&&(0,P.jsx)(re,{plan:a})]})}function pe({agentId:e}){let n=l(e=>e.openTaskDetailById),r=l(e=>e.sessionTasksCollapsed),i=l(e=>e.setSessionTasksCollapsed),a=l(e=>e.deliverableTasks),[o,s]=(0,j.useState)([]),[c,u]=(0,j.useState)(!1);(0,j.useEffect)(()=>{let t=!1;return h(`GET`,`/task-entities?createdBy=`+encodeURIComponent(e)+`&limit=500`).then(e=>{t||s(e)}).catch(()=>{}),()=>{t=!0}},[e]);let d=new Map(o.map(e=>[e.id,e]));for(let t of a)t.createdBy===e&&(!d.has(t.id)||Number(t.updatedAt)>=Number(d.get(t.id).updatedAt))&&d.set(t.id,t);let f=[...d.values()];if(f.length===0)return null;let p=f.filter($).length,m=se(f,c);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":!r,"aria-label":r?`Expand session tasks`:`Collapse session tasks`,className:t(`flex w-full min-w-0 items-center gap-2 text-left`,!r&&`mb-1.5`),children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(v,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`span`,{className:`flex-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Tasks from this session (`,m.length,`)`]}),(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:r?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),!r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{tasks:m,onOpen:n}),p>0&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`mt-1.5 rounded border border-border bg-muted/30 px-2 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground`,"aria-pressed":c,children:c?`Hide ${p} closed`:`+ ${p} closed`})]})]})}function me({tasks:e,onOpen:t}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:[{label:`In progress`,tasks:e.filter(e=>e.status===`in_progress`||e.status===`claimed`)},{label:`Needs validation`,tasks:e.filter(e=>e.status===`validating`)},{label:`Waiting`,tasks:e.filter(e=>![`in_progress`,`claimed`,`validating`].includes(e.status)&&!$(e))},{label:`Closed`,tasks:e.filter($)}].filter(e=>e.tasks.length).map(e=>(0,P.jsxs)(`section`,{"aria-label":e.label,children:[(0,P.jsxs)(`h3`,{className:`mb-1 text-[10px] text-muted-foreground`,children:[e.label,` (`,e.tasks.length,`)`]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tasks.map(e=>(0,P.jsx)(D,{id:e.id,title:e.title,status:e.status,onClick:()=>t(e.id),compact:!0},e.id))})]},e.label))})}export{pe as n,N as r,fe as t};
|
|
2
|
-
//# sourceMappingURL=PlanGraphPanel-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,St as a,d as o,f as s,p as c,t as l}from"./store-DcClXLH0.js";import"./provider-display-DsuWMvVL.js";import{ct as u,et as d,h as f,v as p,vt as m}from"./display-BrKWFGJz.js";import{t as h}from"./api-CIIVBtAV.js";import{i as ee,n as g,r as _,t as v}from"./list-todo-9qT0fgxZ.js";import{t as y}from"./archive-CIuPSvmx.js";import{t as b}from"./check-B3M9Ug1P.js";import{t as x}from"./chevron-down-BoG3JCZn.js";import{t as S}from"./chevron-up-Bv3yC5ma.js";import{t as C}from"./issue-ref-chip-BnSlM_95.js";import{t as w}from"./circle-UESLMi2-.js";import{t as te}from"./git-branch-yxhV0m8E.js";import{r as T}from"./workflow-marker-DAZcj5qt.js";import{t as E}from"./x-Bge17hWJ.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{t as O}from"./agent-name-DKbiIhBo.js";var k=[`reserved`,`running`,`escalated`,`ci-blocked`];function A(e){return k.includes(e)}var j=e(n(),1);function M(e){if(typeof window>`u`)return()=>{};let t=window.matchMedia(m);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function N(){return(0,j.useSyncExternalStore)(M,()=>typeof window<`u`&&window.matchMedia(m).matches,()=>!1)}var P=r(),F={open:{label:`open`,className:`border-border bg-muted/40 text-muted-foreground`},"conformance-pending":{label:`conformance pending`,className:`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`},done:{label:`done`,className:`border-tone-success/40 bg-tone-success/10 text-tone-success-fg`}};function I({completion:e}){let n=F[e];return(0,P.jsx)(`span`,{className:t(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:n.label})}function ne({plan:e,onArchive:t}){let n=e.nodes.length;if(!n||e.nodes.some(e=>e.status!==`landed`))return null;let r=`${n} node${n===1?``:`s`}`;return e.completion===`conformance-pending`?(0,P.jsxs)(`div`,{role:`status`,className:`mb-2 rounded-md border border-tone-warning/30 bg-tone-warning/10 px-2.5 py-1.5 text-[11px] text-tone-warning-fg`,children:[`All `,r,` landed — conformance pending. The plan is not done until its acceptance check passes.`]}):e.completion&&e.completion!==`done`?null:(0,P.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md border border-tone-success/30 bg-tone-success/10 px-2.5 py-1.5`,children:[(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-tone-success-fg`,children:[e.completion===`done`?`Acceptance passed`:`All ${r} landed`,` — archive this plan?`]}),(0,P.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded border border-tone-success/40 bg-tone-success/15 px-2 py-0.5 text-[10px] font-medium text-tone-success-fg hover:bg-tone-success/20 hover:text-tone-success-fg`,children:`Archive plan`})]})}function L({check:e}){let t=`command`in e;return(0,P.jsx)(`code`,{className:`block max-w-full truncate rounded-sm bg-muted/60 px-1 py-px font-mono text-[10px] text-muted-foreground`,title:t?e.command:e.path,children:t?`$ ${e.command}`:e.path})}function re({plan:e}){let n=e.acceptance??[];if(!n.length)return null;let r=e.conformance,i=r?r.planVersion!==e.version:!1,a=new Map(r?.items.map(e=>[e.id,e])??[]),o=n.filter(e=>a.get(e.id)?.status===`met`).length;return(0,P.jsxs)(`section`,{"aria-label":`Plan acceptance`,className:`mt-2 rounded-md border border-border bg-background/60 px-2.5 py-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,P.jsx)(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Acceptance`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:r?`${o}/${n.length} met`:`${n.length} item${n.length===1?``:`s`} · not checked yet`})]}),r&&(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{children:`Last verdict`}),(0,P.jsx)(`span`,{className:t(`rounded-sm px-1 py-px font-semibold uppercase tracking-wide`,r.verdict===`pass`?`bg-tone-success/15 text-tone-success-fg`:`bg-tone-danger/15 text-tone-danger-fg`),children:r.verdict}),(0,P.jsxs)(`span`,{children:[`on main `,(0,P.jsx)(`code`,{className:`font-mono`,children:r.mainSha.slice(0,9)})]}),(0,P.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`by `,r.by]}),(0,P.jsx)(`span`,{title:p(r.at),children:d(Date.now(),r.at)}),i&&(0,P.jsxs)(`span`,{className:`rounded-sm bg-tone-warning/15 px-1 py-px text-tone-warning-fg`,title:`The plan changed after this verdict; a new check is needed.`,children:[`stale · v`,r.planVersion,`, plan now v`,e.version]})]}),(0,P.jsx)(`ul`,{className:`max-h-48 space-y-1 overflow-auto`,children:n.map(e=>{let n=a.get(e.id);return(0,P.jsxs)(`li`,{className:t(`flex min-w-0 gap-1.5`,i&&`opacity-70`),children:[(0,P.jsx)(`span`,{className:`mt-px shrink-0`,"aria-label":n?.status??`not checked`,children:n?.status===`met`?(0,P.jsx)(b,{className:`h-3.5 w-3.5 text-tone-success-fg`}):n?.status===`unmet`?(0,P.jsx)(E,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,P.jsx)(w,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,P.jsxs)(`div`,{className:`text-[11px] leading-snug text-foreground`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[10px] text-muted-foreground`,children:e.id}),e.text]}),e.check&&(0,P.jsx)(L,{check:e.check}),n?.note&&(0,P.jsx)(`div`,{className:`text-[10px] leading-snug text-muted-foreground`,children:n.note})]})]},e.id)})})]})}function ie({listId:e,plans:n,shownId:r,open:i,onToggle:a}){let o=n.findIndex(e=>e.id===r)+1;return(0,P.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":i,"aria-controls":e,"aria-label":`Switch plan (${n.length} active)`,title:`${n.length} active plans`,className:t(`flex h-6 shrink-0 items-center gap-0.5 rounded border border-border px-1.5 text-[10px] font-medium tabular-nums`,`text-muted-foreground hover:bg-muted/60 hover:text-foreground`,i&&`bg-muted/60 text-foreground`),children:[o>0?`${o}/${n.length}`:n.length,(0,P.jsx)(_,{className:`h-3 w-3`})]})}function R({listId:e,plans:n,shownId:r,onChoose:a,className:o}){let s=i();return(0,P.jsx)(`ul`,{id:e,"aria-label":`Active plans`,className:t(`overflow-hidden rounded-md border border-border bg-background/95`,o),children:n.map(e=>{let n=e.id===r,i=`${e.nodeCount} node${e.nodeCount===1?``:`s`}`;return(0,P.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),"aria-current":n?`true`:void 0,className:t(`flex min-h-11 w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left sm:min-h-0`,n?`bg-muted/50`:`hover:bg-muted/40`),children:[(0,P.jsx)(b,{className:t(`h-3.5 w-3.5 shrink-0 text-foreground`,!n&&`invisible`),"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-[12px] font-medium leading-tight text-foreground`,children:e.title||`Untitled plan`}),(0,P.jsxs)(`span`,{className:`block truncate text-[10px] leading-tight text-muted-foreground`,children:[i,` · updated `,d(s,e.updatedAt)]})]}),e.completion&&(0,P.jsx)(I,{completion:e.completion})]})},e.id)})})}function z(e){return new Map((e.dispatch?.slots??[]).flatMap(e=>e.runId?[[e.taskId,e.runId]]:[]))}function B({runId:e,label:n,className:r}){let i=l(e=>e.showWorkflowRun);return(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void i(e),title:`Open workflow run ${e}`,"aria-label":`Open workflow run ${e}`,className:t(`wf-marker inline-flex min-w-0 items-center gap-0.5 rounded-sm border border-border/70 px-1 py-px text-[9px] font-medium text-muted-foreground hover:text-foreground`,r),children:[(0,P.jsx)(T,{className:`h-2.5 w-2.5 shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n??e})]})}function ae({plan:e}){let t=e.dispatch;if(!t)return null;let n=t.slots.filter(e=>A(e.status)).length;return(0,P.jsxs)(`div`,{"data-testid":`plan-dispatch`,className:`mb-2 flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Autopilot `,t.state]}),(0,P.jsxs)(`span`,{children:[n,`/`,t.concurrency,` running`]}),t.slots.filter(e=>e.ciBlock).map(e=>(0,P.jsxs)(`span`,{className:`text-tone-warning-fg`,title:e.ciBlock.sha,children:[`T`,e.taskId,` CI blocked · `,e.ciBlock.sha.slice(0,12),` · `,e.ciBlock.incidentIds.join(`, `),` · `,e.ciBlock.retriedAt===void 0?`retry on clearance`:`exact SHA retried; awaiting pass`]},e.taskId)),t.audit&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`audit T`,t.audit.taskId,t.audit.verdict?` · ${t.audit.verdict}`:``,t.audit.runId&&(0,P.jsx)(B,{runId:t.audit.runId,label:`audit run`})]})]})}var V=4,H={satisfied:`text-tone-success-fg`,waiting:`text-tone-warning-fg`,unreachable:`text-tone-danger-fg`};function U(e){return e.verdict.state===`unreachable`?`unreachable · ${e.verdict.reason}`:e.verdict.state}function W({entry:e,now:n,nodeLabels:r}){let i=l(e=>e.openTaskDetailById),a=e.waitingSince===void 0?``:f(n,e.waitingSince);return(0,P.jsxs)(`li`,{"data-testid":`plan-external`,"data-verdict":e.verdict.state,title:e.projectId?`Project ${e.projectId}`:void 0,className:`min-w-0 rounded-md border border-dashed border-border bg-background/60 px-2 py-1.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full min-w-0 items-baseline gap-1.5 text-left`,title:`Open T${e.taskId}`,children:[(0,P.jsxs)(`span`,{className:`shrink-0 text-[11px] font-semibold tabular-nums text-foreground`,children:[`T`,e.taskId]}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:e.title??`title hidden`})]}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`font-medium`,H[e.verdict.state]),children:U(e)}),(0,P.jsxs)(`span`,{children:[`stage `,e.stage]}),(0,P.jsxs)(`span`,{children:[`needs `,e.requiredStage]}),a&&(0,P.jsxs)(`span`,{title:`How long this plan has waited on it`,children:[`waiting `,a]}),(0,P.jsxs)(`span`,{className:`truncate`,children:[`→ `,e.dependents.map(e=>r.get(e)??e).join(`, `)]})]})]})}function G({plan:e}){let[t,n]=(0,j.useState)(!1),r=a(e=>e.now),i=e.external;if(!i?.length)return null;let o=e.externalCount??i.length,s=t?i:i.slice(0,V),c=new Map(e.nodes.map(e=>[e.id,e.label])),l=i.length-s.length,u=o-i.length;return(0,P.jsxs)(`div`,{"data-testid":`plan-externals`,className:`mb-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),(0,P.jsxs)(`span`,{children:[`Waits on other work (`,o,`)`]})]}),(0,P.jsx)(`ul`,{className:`grid gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(W,{entry:e,now:r,nodeLabels:c},e.taskId))}),(l>0||t&&i.length>V||u>0)&&(0,P.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(l>0||t)&&i.length>V&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`rounded border border-border bg-muted/30 px-1.5 py-0.5 font-medium hover:bg-muted/50 hover:text-foreground`,children:t?`Show fewer`:`+ ${l} more`}),u>0&&(0,P.jsxs)(`span`,{children:[u,` more not listed`]})]})]})}var K=196,q=84,J=52,Y=16,X=14,Z=[`landed`,`in-progress`,`pending`,`blocked`],Q={landed:{label:`landed`,dot:`bg-tone-success`,accent:`border-l-tone-success`,text:`text-tone-success-fg`,wire:`#34d399`},"in-progress":{label:`in progress`,dot:`bg-tone-sky`,accent:`border-l-tone-sky`,text:`text-tone-sky-fg`,wire:`#38bdf8`},pending:{label:`pending`,dot:`bg-tone-warning`,accent:`border-l-tone-warning`,text:`text-tone-warning-fg`,wire:`#fbbf24`},blocked:{label:`blocked`,dot:`bg-tone-danger`,accent:`border-l-tone-danger`,text:`text-tone-danger-fg`,wire:`#f87171`}},oe=new Set([...u,`completed`]);function $(e){return oe.has(e.status)}function se(e,t){return t?e:e.filter(e=>!$(e))}function ce(e){return e?e.label||(e.policyName?`policy:${e.policyName}`:e.agentId||``):``}function le({owner:e}){let t=l(t=>e?.agentId?t.agentsById[e.agentId]:void 0),n=ce(e);return!t&&!n?null:(0,P.jsx)(O,{agent:t,fallback:n,className:`text-[10px] text-muted-foreground`})}function ue(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Map(e.nodes.map((e,t)=>[e.id,t])),r=new Map,i=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.edges)!t.has(n.from)||!t.has(n.to)||(r.set(n.from,[...r.get(n.from)??[],n.to]),i.set(n.to,(i.get(n.to)??0)+1));let a=new Map(e.nodes.map(e=>[e.id,0])),o=e.nodes.filter(e=>(i.get(e.id)??0)===0).map(e=>e.id),s=new Set;for(;o.length;){let e=o.shift();s.add(e);let t=a.get(e)??0;for(let n of r.get(e)??[])a.set(n,Math.max(a.get(n)??0,t+1)),i.set(n,(i.get(n)??0)-1),(i.get(n)??0)===0&&o.push(n)}let c=Math.max(0,...Array.from(a.values()))+1;for(let t of e.nodes)s.has(t.id)||a.set(t.id,c++);let l=new Map;for(let t of e.nodes){let e=a.get(t.id)??0;l.set(e,[...l.get(e)??[],t])}let u=[...l.entries()].sort(([e],[t])=>e-t),d=Math.max(1,...u.map(([,e])=>e.length)),f=[];u.forEach(([e,t],r)=>{let i=[...t].sort((e,t)=>(e.lane||``).localeCompare(t.lane||``)||(n.get(e.id)??0)-(n.get(t.id)??0)),a=(d-i.length)*100/2;i.forEach((t,n)=>{f.push({node:t,layer:e,x:X+r*248,y:X+a+n*100})})});let p=u.length;return{nodes:f,width:Math.max(320,X*2+p*K+Math.max(0,p-1)*J),height:Math.max(112,X*2+d*q+Math.max(0,d-1)*Y)}}function de(e,t){let n=e.x+K,r=e.y+q/2,i=t.x,a=t.y+q/2,o=n+Math.max(20,(i-n)/2);return`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`}function fe({threadId:e,teamId:n,channel:r}){let i=n?s(n,r):e?o(e,r):``,a=l(e=>n?c(e,i):i?e.plansByThread[i]:null),u=l(e=>n?e.planListsByTeam[i]?.plans:void 0),d=l(e=>e.fetchPlan),f=l(e=>e.fetchTeamPlanList),p=l(e=>e.chooseTeamPlan),[m,h]=(0,j.useState)(!1),g=(0,j.useId)(),_=l(e=>e.setPlanArchived),v=l(e=>e.planCollapsed),b=l(e=>e.setPlanCollapsed),w=l(e=>e.issueRefsById),T=l(e=>e.deliverableTasks),E=l(e=>e.openTaskDetailById),O=N(),[k,A]=(0,j.useState)(!1),M=v??O;(0,j.useEffect)(()=>{if(n){d({teamId:n,channel:r}),f({teamId:n,channel:r});return}e&&d({threadId:e,channel:r})},[r,d,f,n,e]);let F=(0,j.useMemo)(()=>a?ue(a):null,[a]),L=(0,j.useMemo)(()=>a?z(a):new Map,[a]),V=(0,j.useMemo)(()=>new Map(F?.nodes.map(e=>[e.node.id,e])??[]),[F]),H=(0,j.useMemo)(()=>{if(!a)return[];let e=new Map;for(let t of a.nodes)e.set(t.status,(e.get(t.status)??0)+1);return Z.filter(t=>e.has(t)).map(t=>({status:t,count:e.get(t)??0}))},[a]);if(!a||!F)return null;if(a.archived&&!k)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`flex min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground`,"aria-expanded":`false`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold uppercase tracking-wider`,children:`Show archived plan (1)`}),(0,P.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`})]})});if(a.archived)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-muted-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:`Archived plan`})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:`archived`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground`,"aria-expanded":`true`,children:`Hide`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!1),title:`Unarchive plan`,"aria-label":`Unarchive plan`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(ee,{className:`h-3.5 w-3.5`})})]})});let U=a.nodes.length,W=H.find(e=>e.status===`landed`)?.count??0,J=`${U} node${U===1?``:`s`}${W>0?` · ${W} landed`:``}`,Y=n&&u&&u.length>1?u:null,X=!!(Y&&m);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(ne,{plan:a,onArchive:()=>void _(a.id,!0)}),(0,P.jsx)(ae,{plan:a}),(0,P.jsxs)(`div`,{className:t(`flex min-w-0 items-center gap-2`,(!M||X)&&`mb-2`),children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(te,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:M?J:a.objective||J})]})]}),H.length>0&&(0,P.jsx)(`div`,{className:`hidden shrink-0 items-center gap-2.5 sm:flex`,children:H.map(({status:e,count:n})=>(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,Q[e].dot)}),(0,P.jsx)(`span`,{className:t(`font-medium tabular-nums`,Q[e].text),children:n}),(0,P.jsx)(`span`,{children:Q[e].label})]},e))}),a.completion&&(0,P.jsx)(I,{completion:a.completion}),Y&&(0,P.jsx)(ie,{listId:g,plans:Y,shownId:a.id,open:m,onToggle:()=>h(!m)}),(0,P.jsxs)(`span`,{className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,children:[`v`,a.version]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!0),title:`Archive plan`,"aria-label":`Archive plan`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(y,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:M?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),Y&&X&&(0,P.jsx)(R,{listId:g,className:M?void 0:`mb-2`,plans:Y,shownId:a.id,onChoose:e=>{h(!1),p({teamId:n,channel:r},e)}}),!M&&(0,P.jsx)(G,{plan:a}),M?null:a.nodes.length===0?(0,P.jsx)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-3 text-center text-xs text-muted-foreground`,children:`No nodes yet — the plan graph fills in as the team is composed.`}):(0,P.jsx)(`div`,{className:`max-h-[min(46vh,360px)] overflow-auto`,children:(0,P.jsxs)(`div`,{className:`relative`,style:{width:F.width,height:F.height},children:[(0,P.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0`,width:F.width,height:F.height,"aria-hidden":`true`,children:[(0,P.jsx)(`defs`,{children:Z.map(e=>(0,P.jsx)(`marker`,{id:`plan-arrow-${e}`,viewBox:`0 0 8 8`,refX:`6.5`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,P.jsx)(`path`,{d:`M0 0 L8 4 L0 8 z`,fill:Q[e].wire})},e))}),a.edges.map(e=>{let t=V.get(e.from),n=V.get(e.to);if(!t||!n)return null;let r=Q[t.node.status];return(0,P.jsx)(`path`,{d:de(t,n),stroke:r.wire,strokeOpacity:.7,strokeWidth:2,fill:`none`,strokeLinecap:`round`,markerEnd:`url(#plan-arrow-${t.node.status})`},`${e.from}->${e.to}`)})]}),F.nodes.map(({node:e,x:n,y:r})=>{let i=Q[e.status],a=e.refs?.issueId?w[e.refs.issueId]:null,o=e.refs?.taskId?parseInt(e.refs.taskId,10):null,s=o==null?void 0:T.find(e=>e.id===o)?.title,c=o==null?void 0:L.get(o);return(0,P.jsxs)(`article`,{className:t(`group absolute flex flex-col justify-between rounded-md border border-l-[3px] bg-background/95 p-2`,`shadow-sm transition-all hover:-translate-y-px hover:border-border hover:shadow-md hover:bg-background`,i.accent),style:{left:n,top:r,width:K,height:q},title:e.scopeBlurb||e.label,children:[(0,P.jsx)(`div`,{className:`truncate text-xs font-semibold leading-tight text-foreground`,children:e.label}),(e.scopeBlurb||e.id)&&(0,P.jsx)(`div`,{className:`truncate text-[10px] leading-tight text-muted-foreground`,children:e.scopeBlurb||e.id}),(a||o!=null)&&(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:[a&&(0,P.jsx)(C,{issueRef:a,compact:!0,className:`max-w-full`}),o!=null&&(0,P.jsx)(D,{id:o,title:s,onClick:()=>E(o),className:`max-w-full`}),c&&(0,P.jsx)(B,{runId:c,label:`run`})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1.5`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 shrink-0 rounded-full`,i.dot)}),(0,P.jsx)(`span`,{className:t(`text-[10px] font-medium`,i.text),children:i.label})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(le,{owner:e.ownerRef}),e.lane&&(0,P.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted/70 px-1 py-px text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.lane})]})]})]},e.id)})]})}),!M&&(0,P.jsx)(re,{plan:a})]})}function pe({agentId:e}){let n=l(e=>e.openTaskDetailById),r=l(e=>e.sessionTasksCollapsed),i=l(e=>e.setSessionTasksCollapsed),a=l(e=>e.deliverableTasks),[o,s]=(0,j.useState)([]),[c,u]=(0,j.useState)(!1);(0,j.useEffect)(()=>{let t=!1;return h(`GET`,`/task-entities?createdBy=`+encodeURIComponent(e)+`&limit=500`).then(e=>{t||s(e)}).catch(()=>{}),()=>{t=!0}},[e]);let d=new Map(o.map(e=>[e.id,e]));for(let t of a)t.createdBy===e&&(!d.has(t.id)||Number(t.updatedAt)>=Number(d.get(t.id).updatedAt))&&d.set(t.id,t);let f=[...d.values()];if(f.length===0)return null;let p=f.filter($).length,m=se(f,c);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":!r,"aria-label":r?`Expand session tasks`:`Collapse session tasks`,className:t(`flex w-full min-w-0 items-center gap-2 text-left`,!r&&`mb-1.5`),children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(v,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`span`,{className:`flex-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Tasks from this session (`,m.length,`)`]}),(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:r?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),!r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{tasks:m,onOpen:n}),p>0&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`mt-1.5 rounded border border-border bg-muted/30 px-2 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground`,"aria-pressed":c,children:c?`Hide ${p} closed`:`+ ${p} closed`})]})]})}function me({tasks:e,onOpen:t}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:[{label:`In progress`,tasks:e.filter(e=>e.status===`in_progress`||e.status===`claimed`)},{label:`Needs validation`,tasks:e.filter(e=>e.status===`validating`)},{label:`Waiting`,tasks:e.filter(e=>![`in_progress`,`claimed`,`validating`].includes(e.status)&&!$(e))},{label:`Closed`,tasks:e.filter($)}].filter(e=>e.tasks.length).map(e=>(0,P.jsxs)(`section`,{"aria-label":e.label,children:[(0,P.jsxs)(`h3`,{className:`mb-1 text-[10px] text-muted-foreground`,children:[e.label,` (`,e.tasks.length,`)`]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tasks.map(e=>(0,P.jsx)(D,{id:e.id,title:e.title,status:e.status,onClick:()=>t(e.id),compact:!0},e.id))})]},e.label))})}export{pe as n,N as r,fe as t};
|
|
2
|
+
//# sourceMappingURL=PlanGraphPanel-3TlIQpjk.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{d as a,t as o}from"./store-BvtFdlGX.js";import{O as s,S as c,y as l}from"./provider-display-DbLWpP3j.js";import{B as u,E as d,F as f,W as p,Y as m,_ as h,f as g,j as _,mt as v,tt as y,z as b}from"./display-CfO7rTuF.js";import{n as x,t as S}from"./radio-Bn0_qc0G.js";import{t as C}from"./brain-CagXMEKE.js";import{t as w}from"./check-B3M9Ug1P.js";import{t as T}from"./chevron-down-BoG3JCZn.js";import{t as E}from"./chevron-right-iljytE0x.js";import{t as D}from"./chevron-up-Bv3yC5ma.js";import{t as O}from"./circle-alert-CryagaZd.js";import{t as k}from"./circle-check-CkUkN96J.js";import{t as ee}from"./circle-UESLMi2-.js";import{t as te}from"./clock-BWPPBh1_.js";import{t as ne}from"./file-pen-Crunre5f.js";import{t as A}from"./file-text-CKuoMR2U.js";import{t as re}from"./list-checks-CwnS3hly.js";import{t as ie}from"./plus-D5Ek4e2S.js";import{t as ae}from"./plug-vIyO9_P8.js";import{t as oe}from"./search-DjzbnTbf.js";import{t as se}from"./sparkles-CzwR10ZU.js";import{t as ce}from"./agent-type-icon-D6FUarOf.js";import{t as le}from"./users-C7B3u9jv.js";import{t as j}from"./wrench-C7-4CgnY.js";import{t as ue}from"./agent-name-CTZBrSD9.js";import{t as de}from"./code-preview-Bm1wWqAp.js";import{t as M}from"./formatted-body-Cm1RrzmN.js";var fe=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),N=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),pe=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),me=t(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),he=t(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ge=t(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),P=t(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),F=t(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),I=t(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=e(r(),1);function _e(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ve(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function ye(e,t){return e.filter(e=>e.status===`online`&&p(t,e.baseDir)).sort((e,t)=>b(t.baseDir).length-b(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function be(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function xe(){return typeof window<`u`&&!!window.getSelection()?.toString()}function Se(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var Ce=[`👍`,`❤️`,`✅`,`👀`];function we(e,t=v){let n=new Map;for(let r of e.reactions||[]){let e=u(r.emoji),i=n.get(e)??{emoji:e,count:0,mine:!1,actors:[]};i.count+=1,i.mine=i.mine||r.actorId===t,i.actors.push(r.actorId),n.set(e,i)}return[...n.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function Te(e){return _(e)}function Ee(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>!s(e));if(i||a){let e=i?r:n.find(e=>!s(e));return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:N}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:N};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:te};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:O}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:w}}function De(e){let t=y(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,y(t.updatedAt||t.createdAt)),t)}function Oe(e){return e?e.messages.reduce((e,t)=>Math.max(e,De(t)),0):0}function ke(e,t,n){return(e-t)*n}function Ae(e){if(!e)return 0;let t=0;for(let n of e.messages)d(n)&&(t=Math.max(t,y(n.createdAt)));return t}function R(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function je(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Me(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let o=i.filter(e=>e.threadId).reverse(),s=o.find(e=>!!r[a(e.threadId,e.channel)])??o[0];return s?.threadId?{threadId:s.threadId,...s.channel?{channel:s.channel}:{}}:null}var Ne={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},Pe=new Set(Object.keys(Ne)),Fe=3e3;function z(e){return new Date(e.occurredAt??e.createdAt).getTime()}function B(e){return typeof e.seq==`number`&&Number.isFinite(e.seq)?e.seq:void 0}function Ie(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:z(e),turnId:typeof t.turnId==`string`?t.turnId:void 0,...t.type===`tool`?{category:t.toolCategory??`generic`,...t.status===`running`||t.status===`completed`||t.status===`failed`||t.status===`cancelled`?{status:t.status}:{},...t.params===void 0?{}:{params:t.params}}:{}}}function Le(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:z(e)}}function Re(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`relay-injection`)return null;let n=t.relayInjection&&typeof t.relayInjection==`object`&&!Array.isArray(t.relayInjection)?t.relayInjection:{},r=c(n.category)?n.category:`context`,i=typeof n.timestamp==`number`&&Number.isFinite(n.timestamp)?n.timestamp:z(e),a=n.detail&&typeof n.detail==`object`&&!Array.isArray(n.detail)?n.detail:{};return{id:e.id,category:r,summary:typeof n.summary==`string`&&n.summary.trim()?n.summary:e.body,detail:a,agentId:typeof n.agentId==`string`&&n.agentId?n.agentId:e.from,timestamp:i}}function ze(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`prompt-resolution`)return null;let n=t.promptResolution&&typeof t.promptResolution==`object`&&!Array.isArray(t.promptResolution)?t.promptResolution:{},r=n.kind===`questions`||n.kind===`plan`||n.kind===`command`||n.kind===`tool`?n.kind:`tool`,i=typeof n.title==`string`&&n.title.trim()?n.title:`Prompt resolved`,a=typeof n.decisionLabel==`string`&&n.decisionLabel.trim()?n.decisionLabel:typeof t.label==`string`&&t.label.trim()?t.label:`Resolved`,o=n.answers&&typeof n.answers==`object`&&!Array.isArray(n.answers)?n.answers:{};return{id:e.id,title:i,kind:r,body:typeof n.promptBody==`string`?n.promptBody:typeof n.body==`string`?n.body:e.body,toolName:typeof n.toolName==`string`&&n.toolName.trim()?n.toolName:i,decisionLabel:a,questions:Be(n.questions,o,a),timestamp:z(e)}}function Be(e,t,n){let r=(Array.isArray(e)?e:[]).map((e,r)=>{let i=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=typeof i.question==`string`&&i.question.trim()?i.question.trim():typeof i.header==`string`&&i.header.trim()?i.header.trim():`Question ${r+1}`,o=t[a]??t[String(i.question??``)]??t[String(i.header??``)];return{question:a,answer:typeof o==`string`&&o.trim()?o.trim():n}});return r.length?r:Object.entries(t).map(([e,t])=>({question:e,answer:t}))}function V(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function H(e){return e.kind===`system`&&e.from===`system`}var Ve=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function U(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function He(e){let t=e.filter(e=>Pe.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=Fe)||n.push(e);return n}function Ue(e){if(!l(e.payload))return null;let{windowId:t,groupOrder:n,source:r}=e.payload.finality,i=e.payload.session??e.payload.responseCapture;return{msg:e,windowId:t,groupOrder:n,source:r,confidence:i?.confidence===`definitive`||i?.confidence===`reconstructed`?i.confidence:void 0}}function We(e){let t=new Map;if(e.forEach((e,n)=>{if(e.type!==`message`)return;let r=Ue(e.msg);if(!r)return;let i=t.get(r.windowId)??[];i.push(n),t.set(r.windowId,i)}),t.size===0)return e;let n=new Map,r=new Set;for(let[i,a]of t){let t=new Set(a.map(t=>e[t].msg.id)),o=a.filter(n=>{let r=e[n].msg.sourceMessageId;return!(typeof r==`number`&&t.has(r))}),s=o.length>0?o:a,c=s.map(t=>Ue(e[t].msg)).sort((e,t)=>e.groupOrder-t.groupOrder),l=Math.min(...s),u=Math.min(...s.map(t=>z(e[t].msg)));n.set(l,{type:`work-final`,keyMessageId:e[l].msg.id,windowId:i,members:c,timestamp:u});for(let e of a)e!==l&&r.add(e)}let i=[];return e.forEach((e,t)=>{r.has(t)||i.push(n.get(t)??e)}),i}function Ge(e,t,n,r=[],i){let a=i?.historyStart!==!1,o=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,y(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;o.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)o.push({ts:y(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&o.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;o.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let c=i?.spawnedBy?.agentId,u=null,d=1/0;if(a)for(let t of e){if(t.id<0||t.kind===`session`||H(t)||_(t)||!(s(t.from)||c!==void 0&&t.from===c)||!f(t).trim())continue;let e=z(t);e<d&&(d=e,u=t.id)}let p=new Map,h=new Map,g=[],v=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n={id:t.id,body:t.body.trim()},r=h.get(e.turnId)??[];r.push(n),h.set(e.turnId,r),g.push(n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=p.get(e.turnId)??[];n.push(t.body.trim()),p.set(e.turnId,n)}}let b=new Map;for(let[e,t]of p){let n=(h.get(e)??[]).map(e=>e.body);b.set(e,t.map(e=>V(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=V(t.body,(h.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&v.set(t.id,n)}let x=new Set;for(let[e,t]of b){let n=h.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!x.has(r.id)&&m(e,r.body)){x.add(r.id);break}}}let S=[],C=new Map;for(let t of e){if(!l(t.payload))continue;let e=f(t).trim();if(!e)continue;S.push(e);let n=C.get(t.from)??new Set;n.add(e),C.set(t.from,n)}for(let e of g)x.has(e.id)||S.some(t=>m(t,e.body))&&x.add(e.id);let w=new Map,T=[];for(let t of e){if(i?.include&&t.id!==u&&!i.include(t))continue;if(H(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(Ve.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=z(t);if(!r){o.push({ts:i,seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let a=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=w.get(r);if(s)s.entry.status=a,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i,s.seq=B(t),s.id=t.id;else{let e={ts:i,seq:B(t),id:t.id,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:a,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};w.set(r,e),o.push(e)}continue}o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let e=Le(t);if(e){T.push(e);continue}let n=Ie(t);if(n){if(n.kind===`narration`&&x.has(n.id))continue;o.push({ts:n.ts,seq:B(t),id:t.id,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}let r=Re(t);if(r){o.push({ts:r.timestamp,seq:B(t),id:t.id,entry:{type:`relay-injection`,event:r}});continue}let a=ze(t);if(a){o.push({ts:a.timestamp,seq:B(t),id:t.id,entry:{type:`prompt-resolution`,event:a}});continue}if(!l(t.payload)&&C.get(t.from)?.has(f(t).trim()))continue;if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`&&!l(t.payload)){let e=v.get(t.id);if(e&&e!==t.body){o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`message`,msg:{...t,body:e}}});continue}}}let s=t.id===u?`initial-prompt`:`message`;o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:s,msg:t}})}for(let e of He([...t,...T]))o.push({ts:e.timestamp,entry:{type:`status`,event:e}});for(let e of i?.effortChanges??[])o.push({ts:e.at,entry:{type:`effort-change`,change:e}});let E={created:0,date:1,"import-boundary":2,"imported-message":3,"initial-prompt":4,message:4,activity:4,notice:4,"agent-action":4,"relay-injection":4,"prompt-resolution":4,status:5,"effort-change":4,"work-final":4};o.sort((e,t)=>{let n=e.ts-t.ts;return n===0?e.seq!==void 0&&t.seq!==void 0&&e.seq!==t.seq?e.seq-t.seq:E[e.entry.type]-E[t.entry.type]||(e.id??0)-(t.id??0):n});let D=a?0:o.findIndex(e=>e.id!==void 0),O=[],k=a||D<0?``:U(o[D].ts);for(let{ts:e,entry:t}of D<0?[]:o.slice(D,i?.historyEnd===!1?o.map(e=>e.id!==void 0).lastIndexOf(!0)+1:o.length)){if(t.type===`created`){O.push(t);continue}let n=U(e);if(n!==k&&(O.push({type:`date`,date:n,timestamp:e}),k=n),t.type===`activity`){let e=O[O.length-1];if(e&&e.type===`activity`&&Qe(e,t)){e.steps.push(...t.steps);continue}}O.push(t)}return We(O)}function W(e){return e.type===`message`||e.type===`initial-prompt`?`msg-${e.msg.id}`:e.type===`notice`?`notice-${e.msg.id}`:e.type===`relay-injection`?`relay-injection-${e.event.id}`:e.type===`prompt-resolution`?`prompt-resolution-${e.event.id}`:e.type===`agent-action`?`agent-action-${e.direction}-${e.agentId}`:e.type===`activity`?`act-${e.steps[0]?.id??e.timestamp}`:e.type===`import-boundary`?`import-${e.history.id}`:e.type===`imported-message`?`import-msg-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`:e.type===`status`?`status-${e.event.id}`:e.type===`effort-change`?`effort-${e.change.commandId}`:e.type===`date`?`date-${e.date}`:e.type===`work-final`?`msg-${e.keyMessageId??Math.min(...e.members.map(e=>e.msg.id))}`:`created-${e.timestamp}`}function Ke(e,t){if(e===t)return!0;if(e.type!==t.type)return!1;switch(e.type){case`message`:case`initial-prompt`:case`notice`:return e.msg===t.msg;case`relay-injection`:return e.event===t.event;case`prompt-resolution`:return e.event===t.event;case`agent-action`:{let n=t;return e.direction===n.direction&&e.agentId===n.agentId&&e.provider===n.provider&&e.status===n.status&&e.reason===n.reason&&e.timestamp===n.timestamp}case`activity`:{let n=t;return e.steps===n.steps&&e.timestamp===n.timestamp}case`import-boundary`:{let n=t;return e.history===n.history&&e.timestamp===n.timestamp}case`imported-message`:{let n=t;return e.history===n.history&&e.entry===n.entry}case`status`:return e.event===t.event;case`effort-change`:return e.change===t.change;case`date`:{let n=t;return e.date===n.date&&e.timestamp===n.timestamp}case`created`:return e.timestamp===t.timestamp;case`work-final`:{let n=t;return e.windowId===n.windowId&&e.members===n.members&&e.timestamp===n.timestamp}}}function qe(e){return e.type===`initial-prompt`?[`initprompt-${e.msg.id}`]:e.type===`work-final`?[`work-final-${e.windowId}`]:[]}function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Je(e){if(e.type===`message`||e.type===`initial-prompt`||e.type===`notice`){let t=G(e.msg.id);return t===null?[]:[t]}if(e.type===`relay-injection`||e.type===`prompt-resolution`)return[e.event.id];if(e.type===`activity`)return e.steps.map(e=>e.id).filter(Number.isFinite);if(e.type===`imported-message`){let t=G(e.entry.message?.id);return t===null?[]:[t]}return e.type===`work-final`?e.members.map(e=>e.msg.id).filter(e=>G(e)!==null):[]}function K(e){let t=Je(e);return t.length?{messageId:Math.min(...t),endMessageId:Math.max(...t)}:null}function Ye(e,t,n){let r=[...t].sort((e,t)=>e.dataIndex-t.dataIndex),i=r.findIndex(e=>e.bottom>n+1);if(i<0)return null;let a=t=>e[r[t].dataIndex],o=e=>{let t=a(e);return!!t&&K(t)!==null},s=-1;o(i)&&(s=i);for(let e=i-1;s<0&&e>=0;--e)o(e)&&(s=e);for(let e=i+1;s<0&&e<r.length;e+=1)o(e)&&(s=e);if(s<0){let e=a(i);return{topKey:e?W(e):null,offset:Math.max(0,Math.round(n-r[i].top))}}let c=a(s),l=K(c);return{topKey:W(c),anchorMessageId:l.messageId,anchorEndMessageId:l.endMessageId,offset:Math.round(n-r[s].top)}}function Xe(e,t){let n=G(t.messageId);if(n!==null){let r=G(t.endMessageId),i=r!==null&&r>=n?r:n,a=-1,o=-1/0;for(let t=0;t<e.length;t+=1){let r=Je(e[t]);if(r.some(e=>e>=n&&e<=i))return t;let s=r.filter(e=>e<=n).sort((e,t)=>t-e)[0];s!==void 0&&s>o&&(o=s,a=t)}if(a>=0)return a}if(t.topKey){let n=e.findIndex(e=>W(e)===t.topKey||qe(e).includes(t.topKey));if(n>=0)return n}return-1}function Ze(e){return e.type===`message`||e.type===`initial-prompt`||e.type===`notice`?(e.msg.subject?`${e.msg.subject} `:``)+f(e.msg):e.type===`imported-message`?f(e.entry.message):e.type===`activity`?e.steps.map(e=>[e.label,e.text].filter(Boolean).join(` `)).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{d as a,t as o}from"./store-DcClXLH0.js";import{O as s,S as c,y as l}from"./provider-display-DsuWMvVL.js";import{B as u,E as d,F as f,W as p,Y as m,_ as h,f as g,j as _,mt as v,tt as y,z as b}from"./display-BrKWFGJz.js";import{n as x,t as S}from"./radio-Bn0_qc0G.js";import{t as C}from"./brain-CagXMEKE.js";import{t as w}from"./check-B3M9Ug1P.js";import{t as T}from"./chevron-down-BoG3JCZn.js";import{t as E}from"./chevron-right-iljytE0x.js";import{t as D}from"./chevron-up-Bv3yC5ma.js";import{t as O}from"./circle-alert-CryagaZd.js";import{t as k}from"./circle-check-CkUkN96J.js";import{t as ee}from"./circle-UESLMi2-.js";import{t as te}from"./clock-BWPPBh1_.js";import{t as ne}from"./file-pen-Crunre5f.js";import{t as A}from"./file-text-CKuoMR2U.js";import{t as re}from"./list-checks-CwnS3hly.js";import{t as ie}from"./plus-D5Ek4e2S.js";import{t as ae}from"./plug-vIyO9_P8.js";import{t as oe}from"./search-DjzbnTbf.js";import{t as se}from"./sparkles-CzwR10ZU.js";import{t as ce}from"./agent-type-icon-LrUEU3lB.js";import{t as le}from"./users-C7B3u9jv.js";import{t as j}from"./wrench-C7-4CgnY.js";import{t as ue}from"./agent-name-DKbiIhBo.js";import{t as de}from"./code-preview-p1NnmqK0.js";import{t as M}from"./formatted-body-CQBwc1fb.js";var fe=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),N=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),pe=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),me=t(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),he=t(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ge=t(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),P=t(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),F=t(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),I=t(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=e(r(),1);function _e(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ve(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function ye(e,t){return e.filter(e=>e.status===`online`&&p(t,e.baseDir)).sort((e,t)=>b(t.baseDir).length-b(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function be(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function xe(){return typeof window<`u`&&!!window.getSelection()?.toString()}function Se(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var Ce=[`👍`,`❤️`,`✅`,`👀`];function we(e,t=v){let n=new Map;for(let r of e.reactions||[]){let e=u(r.emoji),i=n.get(e)??{emoji:e,count:0,mine:!1,actors:[]};i.count+=1,i.mine=i.mine||r.actorId===t,i.actors.push(r.actorId),n.set(e,i)}return[...n.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function Te(e){return _(e)}function Ee(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>!s(e));if(i||a){let e=i?r:n.find(e=>!s(e));return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:N}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:N};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:te};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:O}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:w}}function De(e){let t=y(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,y(t.updatedAt||t.createdAt)),t)}function Oe(e){return e?e.messages.reduce((e,t)=>Math.max(e,De(t)),0):0}function ke(e,t,n){return(e-t)*n}function Ae(e){if(!e)return 0;let t=0;for(let n of e.messages)d(n)&&(t=Math.max(t,y(n.createdAt)));return t}function R(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function je(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Me(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let o=i.filter(e=>e.threadId).reverse(),s=o.find(e=>!!r[a(e.threadId,e.channel)])??o[0];return s?.threadId?{threadId:s.threadId,...s.channel?{channel:s.channel}:{}}:null}var Ne={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},Pe=new Set(Object.keys(Ne)),Fe=3e3;function z(e){return new Date(e.occurredAt??e.createdAt).getTime()}function B(e){return typeof e.seq==`number`&&Number.isFinite(e.seq)?e.seq:void 0}function Ie(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:z(e),turnId:typeof t.turnId==`string`?t.turnId:void 0,...t.type===`tool`?{category:t.toolCategory??`generic`,...t.status===`running`||t.status===`completed`||t.status===`failed`||t.status===`cancelled`?{status:t.status}:{},...t.params===void 0?{}:{params:t.params}}:{}}}function Le(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:z(e)}}function Re(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`relay-injection`)return null;let n=t.relayInjection&&typeof t.relayInjection==`object`&&!Array.isArray(t.relayInjection)?t.relayInjection:{},r=c(n.category)?n.category:`context`,i=typeof n.timestamp==`number`&&Number.isFinite(n.timestamp)?n.timestamp:z(e),a=n.detail&&typeof n.detail==`object`&&!Array.isArray(n.detail)?n.detail:{};return{id:e.id,category:r,summary:typeof n.summary==`string`&&n.summary.trim()?n.summary:e.body,detail:a,agentId:typeof n.agentId==`string`&&n.agentId?n.agentId:e.from,timestamp:i}}function ze(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`prompt-resolution`)return null;let n=t.promptResolution&&typeof t.promptResolution==`object`&&!Array.isArray(t.promptResolution)?t.promptResolution:{},r=n.kind===`questions`||n.kind===`plan`||n.kind===`command`||n.kind===`tool`?n.kind:`tool`,i=typeof n.title==`string`&&n.title.trim()?n.title:`Prompt resolved`,a=typeof n.decisionLabel==`string`&&n.decisionLabel.trim()?n.decisionLabel:typeof t.label==`string`&&t.label.trim()?t.label:`Resolved`,o=n.answers&&typeof n.answers==`object`&&!Array.isArray(n.answers)?n.answers:{};return{id:e.id,title:i,kind:r,body:typeof n.promptBody==`string`?n.promptBody:typeof n.body==`string`?n.body:e.body,toolName:typeof n.toolName==`string`&&n.toolName.trim()?n.toolName:i,decisionLabel:a,questions:Be(n.questions,o,a),timestamp:z(e)}}function Be(e,t,n){let r=(Array.isArray(e)?e:[]).map((e,r)=>{let i=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=typeof i.question==`string`&&i.question.trim()?i.question.trim():typeof i.header==`string`&&i.header.trim()?i.header.trim():`Question ${r+1}`,o=t[a]??t[String(i.question??``)]??t[String(i.header??``)];return{question:a,answer:typeof o==`string`&&o.trim()?o.trim():n}});return r.length?r:Object.entries(t).map(([e,t])=>({question:e,answer:t}))}function V(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function H(e){return e.kind===`system`&&e.from===`system`}var Ve=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function U(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function He(e){let t=e.filter(e=>Pe.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=Fe)||n.push(e);return n}function Ue(e){if(!l(e.payload))return null;let{windowId:t,groupOrder:n,source:r}=e.payload.finality,i=e.payload.session??e.payload.responseCapture;return{msg:e,windowId:t,groupOrder:n,source:r,confidence:i?.confidence===`definitive`||i?.confidence===`reconstructed`?i.confidence:void 0}}function We(e){let t=new Map;if(e.forEach((e,n)=>{if(e.type!==`message`)return;let r=Ue(e.msg);if(!r)return;let i=t.get(r.windowId)??[];i.push(n),t.set(r.windowId,i)}),t.size===0)return e;let n=new Map,r=new Set;for(let[i,a]of t){let t=new Set(a.map(t=>e[t].msg.id)),o=a.filter(n=>{let r=e[n].msg.sourceMessageId;return!(typeof r==`number`&&t.has(r))}),s=o.length>0?o:a,c=s.map(t=>Ue(e[t].msg)).sort((e,t)=>e.groupOrder-t.groupOrder),l=Math.min(...s),u=Math.min(...s.map(t=>z(e[t].msg)));n.set(l,{type:`work-final`,keyMessageId:e[l].msg.id,windowId:i,members:c,timestamp:u});for(let e of a)e!==l&&r.add(e)}let i=[];return e.forEach((e,t)=>{r.has(t)||i.push(n.get(t)??e)}),i}function Ge(e,t,n,r=[],i){let a=i?.historyStart!==!1,o=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,y(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;o.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)o.push({ts:y(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&o.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;o.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let c=i?.spawnedBy?.agentId,u=null,d=1/0;if(a)for(let t of e){if(t.id<0||t.kind===`session`||H(t)||_(t)||!(s(t.from)||c!==void 0&&t.from===c)||!f(t).trim())continue;let e=z(t);e<d&&(d=e,u=t.id)}let p=new Map,h=new Map,g=[],v=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n={id:t.id,body:t.body.trim()},r=h.get(e.turnId)??[];r.push(n),h.set(e.turnId,r),g.push(n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=p.get(e.turnId)??[];n.push(t.body.trim()),p.set(e.turnId,n)}}let b=new Map;for(let[e,t]of p){let n=(h.get(e)??[]).map(e=>e.body);b.set(e,t.map(e=>V(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=V(t.body,(h.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&v.set(t.id,n)}let x=new Set;for(let[e,t]of b){let n=h.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!x.has(r.id)&&m(e,r.body)){x.add(r.id);break}}}let S=[],C=new Map;for(let t of e){if(!l(t.payload))continue;let e=f(t).trim();if(!e)continue;S.push(e);let n=C.get(t.from)??new Set;n.add(e),C.set(t.from,n)}for(let e of g)x.has(e.id)||S.some(t=>m(t,e.body))&&x.add(e.id);let w=new Map,T=[];for(let t of e){if(i?.include&&t.id!==u&&!i.include(t))continue;if(H(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(Ve.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=z(t);if(!r){o.push({ts:i,seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let a=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=w.get(r);if(s)s.entry.status=a,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i,s.seq=B(t),s.id=t.id;else{let e={ts:i,seq:B(t),id:t.id,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:a,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};w.set(r,e),o.push(e)}continue}o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let e=Le(t);if(e){T.push(e);continue}let n=Ie(t);if(n){if(n.kind===`narration`&&x.has(n.id))continue;o.push({ts:n.ts,seq:B(t),id:t.id,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}let r=Re(t);if(r){o.push({ts:r.timestamp,seq:B(t),id:t.id,entry:{type:`relay-injection`,event:r}});continue}let a=ze(t);if(a){o.push({ts:a.timestamp,seq:B(t),id:t.id,entry:{type:`prompt-resolution`,event:a}});continue}if(!l(t.payload)&&C.get(t.from)?.has(f(t).trim()))continue;if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`&&!l(t.payload)){let e=v.get(t.id);if(e&&e!==t.body){o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`message`,msg:{...t,body:e}}});continue}}}let s=t.id===u?`initial-prompt`:`message`;o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:s,msg:t}})}for(let e of He([...t,...T]))o.push({ts:e.timestamp,entry:{type:`status`,event:e}});for(let e of i?.effortChanges??[])o.push({ts:e.at,entry:{type:`effort-change`,change:e}});let E={created:0,date:1,"import-boundary":2,"imported-message":3,"initial-prompt":4,message:4,activity:4,notice:4,"agent-action":4,"relay-injection":4,"prompt-resolution":4,status:5,"effort-change":4,"work-final":4};o.sort((e,t)=>{let n=e.ts-t.ts;return n===0?e.seq!==void 0&&t.seq!==void 0&&e.seq!==t.seq?e.seq-t.seq:E[e.entry.type]-E[t.entry.type]||(e.id??0)-(t.id??0):n});let D=a?0:o.findIndex(e=>e.id!==void 0),O=[],k=a||D<0?``:U(o[D].ts);for(let{ts:e,entry:t}of D<0?[]:o.slice(D,i?.historyEnd===!1?o.map(e=>e.id!==void 0).lastIndexOf(!0)+1:o.length)){if(t.type===`created`){O.push(t);continue}let n=U(e);if(n!==k&&(O.push({type:`date`,date:n,timestamp:e}),k=n),t.type===`activity`){let e=O[O.length-1];if(e&&e.type===`activity`&&Qe(e,t)){e.steps.push(...t.steps);continue}}O.push(t)}return We(O)}function W(e){return e.type===`message`||e.type===`initial-prompt`?`msg-${e.msg.id}`:e.type===`notice`?`notice-${e.msg.id}`:e.type===`relay-injection`?`relay-injection-${e.event.id}`:e.type===`prompt-resolution`?`prompt-resolution-${e.event.id}`:e.type===`agent-action`?`agent-action-${e.direction}-${e.agentId}`:e.type===`activity`?`act-${e.steps[0]?.id??e.timestamp}`:e.type===`import-boundary`?`import-${e.history.id}`:e.type===`imported-message`?`import-msg-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`:e.type===`status`?`status-${e.event.id}`:e.type===`effort-change`?`effort-${e.change.commandId}`:e.type===`date`?`date-${e.date}`:e.type===`work-final`?`msg-${e.keyMessageId??Math.min(...e.members.map(e=>e.msg.id))}`:`created-${e.timestamp}`}function Ke(e,t){if(e===t)return!0;if(e.type!==t.type)return!1;switch(e.type){case`message`:case`initial-prompt`:case`notice`:return e.msg===t.msg;case`relay-injection`:return e.event===t.event;case`prompt-resolution`:return e.event===t.event;case`agent-action`:{let n=t;return e.direction===n.direction&&e.agentId===n.agentId&&e.provider===n.provider&&e.status===n.status&&e.reason===n.reason&&e.timestamp===n.timestamp}case`activity`:{let n=t;return e.steps===n.steps&&e.timestamp===n.timestamp}case`import-boundary`:{let n=t;return e.history===n.history&&e.timestamp===n.timestamp}case`imported-message`:{let n=t;return e.history===n.history&&e.entry===n.entry}case`status`:return e.event===t.event;case`effort-change`:return e.change===t.change;case`date`:{let n=t;return e.date===n.date&&e.timestamp===n.timestamp}case`created`:return e.timestamp===t.timestamp;case`work-final`:{let n=t;return e.windowId===n.windowId&&e.members===n.members&&e.timestamp===n.timestamp}}}function qe(e){return e.type===`initial-prompt`?[`initprompt-${e.msg.id}`]:e.type===`work-final`?[`work-final-${e.windowId}`]:[]}function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Je(e){if(e.type===`message`||e.type===`initial-prompt`||e.type===`notice`){let t=G(e.msg.id);return t===null?[]:[t]}if(e.type===`relay-injection`||e.type===`prompt-resolution`)return[e.event.id];if(e.type===`activity`)return e.steps.map(e=>e.id).filter(Number.isFinite);if(e.type===`imported-message`){let t=G(e.entry.message?.id);return t===null?[]:[t]}return e.type===`work-final`?e.members.map(e=>e.msg.id).filter(e=>G(e)!==null):[]}function K(e){let t=Je(e);return t.length?{messageId:Math.min(...t),endMessageId:Math.max(...t)}:null}function Ye(e,t,n){let r=[...t].sort((e,t)=>e.dataIndex-t.dataIndex),i=r.findIndex(e=>e.bottom>n+1);if(i<0)return null;let a=t=>e[r[t].dataIndex],o=e=>{let t=a(e);return!!t&&K(t)!==null},s=-1;o(i)&&(s=i);for(let e=i-1;s<0&&e>=0;--e)o(e)&&(s=e);for(let e=i+1;s<0&&e<r.length;e+=1)o(e)&&(s=e);if(s<0){let e=a(i);return{topKey:e?W(e):null,offset:Math.max(0,Math.round(n-r[i].top))}}let c=a(s),l=K(c);return{topKey:W(c),anchorMessageId:l.messageId,anchorEndMessageId:l.endMessageId,offset:Math.round(n-r[s].top)}}function Xe(e,t){let n=G(t.messageId);if(n!==null){let r=G(t.endMessageId),i=r!==null&&r>=n?r:n,a=-1,o=-1/0;for(let t=0;t<e.length;t+=1){let r=Je(e[t]);if(r.some(e=>e>=n&&e<=i))return t;let s=r.filter(e=>e<=n).sort((e,t)=>t-e)[0];s!==void 0&&s>o&&(o=s,a=t)}if(a>=0)return a}if(t.topKey){let n=e.findIndex(e=>W(e)===t.topKey||qe(e).includes(t.topKey));if(n>=0)return n}return-1}function Ze(e){return e.type===`message`||e.type===`initial-prompt`||e.type===`notice`?(e.msg.subject?`${e.msg.subject} `:``)+f(e.msg):e.type===`imported-message`?f(e.entry.message):e.type===`activity`?e.steps.map(e=>[e.label,e.text].filter(Boolean).join(` `)).join(`
|
|
2
2
|
`):e.type===`relay-injection`?`${e.event.category} ${e.event.summary}\n${JSON.stringify(e.event.detail)}`:e.type===`prompt-resolution`?[e.event.title,e.event.decisionLabel,e.event.body,...e.event.questions.map(e=>`${e.question} ${e.answer}`)].filter(Boolean).join(`
|
|
3
3
|
`):e.type===`work-final`?e.members.map(e=>f(e.msg)).join(`
|
|
4
4
|
`):e.type===`effort-change`?`Effort ${e.change.previousEffort} → ${e.change.effort} ${e.change.reason??``}`:``}function Qe(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}var q=i(),$e=5;function J(e,t=0){if(t>=$e)return e;if(typeof e==`string`){let n=e.trim();if(!(n.startsWith(`{`)&&n.endsWith(`}`)||n.startsWith(`[`)&&n.endsWith(`]`)))return e;try{return J(JSON.parse(n),t+1)}catch{return e}}if(Array.isArray(e))return e.map(e=>J(e,t+1));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=J(i,t+1);return n}return e}function et(e){try{return JSON.stringify(J(e),null,2)}catch{return typeof e==`string`?e:String(e)}}function Y({value:e,compact:t=!0,className:n}){return(0,q.jsx)(`div`,{className:n,children:(0,q.jsx)(de,{content:(0,L.useMemo)(()=>et(e),[e]),path:`payload.json`,mediaType:`application/json`,compact:t})})}function X({id:e,icon:t,label:r,summary:i,trailing:a,children:s,tone:c,defaultExpanded:l=!1,expanded:u,onExpandedChange:d,wrapHeader:f=!1,className:p}){let m=u!==void 0,[h,g]=(0,L.useState)(l),_=o(t=>e?t.chatExpandedItems.includes(e):!1),v=o(e=>e.toggleChatItemExpanded),y=m?u:e?_:h;function b(){m?d?.(!y):e?v(e):g(e=>!e)}let x=(t||r)&&(0,q.jsxs)(`span`,{className:n(`flex gap-1.5`,f?`min-w-0 max-w-full items-start`:`shrink-0 items-center`),children:[t&&(0,q.jsx)(t,{className:n(`h-3.5 w-3.5 shrink-0`,f&&`mt-px`)}),r&&(0,q.jsx)(`span`,{className:n(`font-medium`,!f&&`shrink-0`),children:r})]});return(0,q.jsxs)(`div`,{className:n(`w-full rounded-lg border px-2.5 py-1.5 text-xs shadow-sm`,f&&`@container/ci`,c,p),children:[(0,q.jsxs)(`button`,{type:`button`,className:n(`flex w-full min-w-0 items-center gap-1.5 text-left`,f&&`relative flex-wrap gap-y-1 pr-5`),"aria-expanded":y,onClick:b,children:[x,(0,q.jsx)(`span`,{className:n(`min-w-0 flex-1 truncate text-foreground/80`,f&&`@max-[30rem]/ci:basis-full`),children:i}),a&&(0,q.jsx)(`span`,{className:n(`text-muted-foreground/60`,f?`min-w-0`:`shrink-0`),children:a}),(0,q.jsx)(E,{className:n(`h-3.5 w-3.5 transition-transform`,f?`absolute right-0 top-[3px]`:`shrink-0`,y&&`rotate-90`)})]}),y&&(0,q.jsx)(`div`,{className:`mt-2`,children:s})]})}function Z(e,t=0){return typeof e==`number`&&Number.isFinite(e)?e:t}function Q(e,t=``){return typeof e==`string`?e:t}function tt(e,t){return e===`memory`&&!!t&&typeof t==`object`&&t.source===`memory-preamble`}function nt(e){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.scopes)?e.scopes:[],r=Array.isArray(e.filtered)?e.filtered:[],i=Array.isArray(e.instructionSlugs)?e.instructionSlugs:[];return{event:Q(e.event)||void 0,skipped:Q(e.skipped)||void 0,projectMemoryEnabled:typeof e.projectMemoryEnabled==`boolean`?e.projectMemoryEnabled:void 0,tokens:Z(e.tokens),omitted:Z(e.omitted),omittedByReason:e.omittedByReason??void 0,demoted:Z(e.demoted),demotedByReason:e.demotedByReason??void 0,budgets:e.budgets??void 0,instructionTokens:Z(e.instructionTokens),instructionSlugs:i.map(e=>{let t=e??{};return{slug:Q(t.slug,`(unnamed)`),resolved:Q(t.resolved)||void 0,status:Q(t.status,`unknown`),tokens:Z(t.tokens)}}),entries:t.map(e=>{let t=e??{};return{id:Q(t.id)||void 0,title:Q(t.title,`(untitled)`),cell:Q(t.cell,`—`),kind:Q(t.kind)||void 0,tier:t.tier===`pinned`?`pinned`:`indexed`,tokens:Z(t.tokens),fullTokens:typeof t.fullTokens==`number`?t.fullTokens:void 0,rendered:t.rendered===!0,demoted:t.demoted===!0,demotedReason:t.demotedReason===`total`?`total`:t.demotedReason===`budget`?`budget`:void 0,omittedReason:t.omittedReason===`index`?`index`:void 0}}),scopes:n.map(e=>{let t=e??{};return{cell:Q(t.cell,`—`),budget:Z(t.budget),candidates:Z(t.candidates),rendered:Z(t.rendered),tokens:Z(t.tokens),omitted:Z(t.omitted)}}),filtered:r.map(e=>{let t=e??{};return{id:Q(t.id)||void 0,title:Q(t.title)||void 0,cell:Q(t.cell,`—`),reason:Q(t.reason,`unknown`)}}),content:Q(e.content)||void 0,injectedCount:typeof e.injectedCount==`number`?e.injectedCount:void 0,pinnedTokens:typeof e.pinnedTokens==`number`?e.pinnedTokens:void 0,indexedTokens:typeof e.indexedTokens==`number`?e.indexedTokens:void 0,filteredCount:typeof e.filteredCount==`number`?e.filteredCount:void 0,entriesTotal:typeof e.entriesTotal==`number`?e.entriesTotal:void 0,contentTruncated:e.contentTruncated===!0||void 0}}var rt={status:`not active`,sensitive:`sensitive — never injected`,never:`retrieval-only (inject:never)`,expired:`expired`,audience:`addressed to other profiles`},it={budget:`demoted — over its cell budget`,total:`demoted — over the whole-block cap`};function $({label:e,value:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:t})]})}function at({detail:e}){let t=nt(e),n=t.entries.filter(e=>e.rendered),r=t.entries.filter(e=>!e.rendered),i=t.injectedCount??n.length,a=t.pinnedTokens??n.filter(e=>e.tier===`pinned`).reduce((e,t)=>e+t.tokens,0),o=t.indexedTokens??n.filter(e=>e.tier===`indexed`).reduce((e,t)=>e+t.tokens,0),s=t.filteredCount??t.filtered.length,c=t.entriesTotal??t.entries.length,l=Math.max(0,c-t.entries.length),u=Math.max(0,s-t.filtered.length);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-border/60 bg-background/75 p-3 text-xs`,children:[t.skipped&&(0,q.jsxs)(`div`,{className:`rounded border border-tone-warning/25 bg-tone-warning/10 px-2 py-1 text-tone-warning-fg`,children:[`not injected — `,t.skipped===`unchanged`?`the resolved set is unchanged since the last injection, so the block already in context was not re-sent`:t.skipped===`inject-unsupported`?`this provider does not accept context injection; the spawn-time block is all it has`:`nothing resolved for this identity`]}),t.projectMemoryEnabled===!1&&(0,q.jsx)(`div`,{className:`w-fit rounded-full border border-tone-warning/25 bg-tone-warning/10 px-2 py-0.5 text-[10px] font-medium text-tone-warning-fg`,children:`Project memory excluded · Project Instructions is off`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,q.jsx)($,{label:`Total cost`,value:`${t.tokens+t.instructionTokens}t`}),t.instructionSlugs.length>0&&(0,q.jsx)($,{label:`Instructions`,value:[`${t.instructionTokens}t`,t.instructionSlugs.filter(e=>e.status!==`rendered`).map(e=>`${e.slug} ${e.status}`).join(` · `)].filter(Boolean).join(` · `)}),(0,q.jsx)($,{label:`Injected`,value:`${i} ${i===1?`entry`:`entries`}`}),(0,q.jsx)($,{label:`Pinned / indexed`,value:`${a}t / ${o}t`}),t.budgets?.total?(0,q.jsx)($,{label:`Block cap`,value:t.budgets.baseReserved?`${t.budgets.total}t · ${t.budgets.baseReserved}t base reserve`:`${t.budgets.total}t`}):null,t.demoted?(0,q.jsx)($,{label:`Demoted to index`,value:[`${t.demoted}`,t.demotedByReason?.budget?`${t.demotedByReason.budget} cell`:``,t.demotedByReason?.total?`${t.demotedByReason.total} cap`:``].filter(Boolean).join(` · `)}):null,t.omitted>0&&(0,q.jsx)($,{label:`Omitted`,value:[`${t.omitted}`,t.omittedByReason?.index?`${t.omittedByReason.index} index cap`:``].filter(Boolean).join(` · `)}),s>0&&(0,q.jsx)($,{label:`Not injectable`,value:`${s}`})]}),t.filtered.length>0&&(0,q.jsxs)(`details`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-[10px] uppercase tracking-wide text-muted-foreground`,children:[`Filtered before budgeting (`,s,`)`]}),(0,q.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[t.filtered.map((e,t)=>(0,q.jsxs)(`span`,{className:`rounded border border-border/60 bg-muted/40 px-2 py-0.5 text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.title??e.id??`(withheld)`}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.cell}),` · `,rt[e.reason]??e.reason]},e.id??`${e.reason}-${t}`)),u>0&&(0,q.jsxs)(`span`,{className:`rounded border border-dashed border-border/60 px-2 py-0.5 text-muted-foreground/80`,children:[`… `,u,` more`]})]})]}),t.scopes.length>0&&(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.scopes.map(e=>(0,q.jsxs)(`span`,{className:`rounded border border-border/60 bg-muted/40 px-2 py-0.5 tabular-nums`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.cell}),` `,e.rendered,`/`,e.candidates,` · `,e.tokens,`t`,(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/`,e.budget,`t`]})]},e.cell))}),t.entries.length>0&&(0,q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,q.jsxs)(`table`,{className:`w-full min-w-[24rem] border-collapse text-left`,children:[(0,q.jsx)(`thead`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Entry`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Cell`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Tier`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 text-right font-normal`,children:`Tokens`})]})}),(0,q.jsxs)(`tbody`,{children:[[...n,...r].map((e,t)=>(0,q.jsxs)(`tr`,{className:e.rendered?``:`text-muted-foreground/70 line-through decoration-muted-foreground/40`,children:[(0,q.jsxs)(`td`,{className:`py-0.5 pr-2`,children:[e.title,e.rendered&&e.demoted&&e.demotedReason&&(0,q.jsxs)(`span`,{className:`ml-1 no-underline text-tone-sky-fg`,children:[`(`,it[e.demotedReason],`)`]}),!e.rendered&&(0,q.jsx)(`span`,{className:`ml-1 no-underline text-tone-warning-fg`,children:`(omitted — over the index cap)`})]}),(0,q.jsx)(`td`,{className:`py-0.5 pr-2`,children:e.cell}),(0,q.jsx)(`td`,{className:`py-0.5 pr-2`,children:e.tier}),(0,q.jsxs)(`td`,{className:`py-0.5 pr-2 text-right tabular-nums`,children:[e.tokens,`t`,e.tier===`indexed`&&e.fullTokens?(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` / `,e.fullTokens,`t full`]}):null]})]},e.id??`${e.title}-${t}`)),l>0&&(0,q.jsx)(`tr`,{className:`text-muted-foreground/70`,children:(0,q.jsxs)(`td`,{className:`py-0.5 pr-2`,colSpan:4,children:[`… `,l,` more`]})})]})]})}),t.content&&(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:[`Injected block`,t.contentTruncated?` (truncated)`:``]}),(0,q.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded border border-border/60 bg-muted/30 p-2`,children:t.content})]})]})}var ot={online:`text-tone-success-fg`,offline:`text-tone-neutral-fg`,shutdown:`text-tone-neutral-fg`,restarted:`text-tone-info-fg`,"compaction-requested":`text-tone-neutral-fg`,compacting:`text-tone-warning-fg`,compacted:`text-tone-warning-fg`,"compaction-stalled":`text-tone-danger-fg`,"clear-requested":`text-tone-neutral-fg`,"clearing-context":`text-tone-warning-fg`,"context-cleared":`text-tone-warning-fg`,"clear-stalled":`text-tone-danger-fg`,"shutting-down":`text-tone-neutral-fg`};function st(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===U(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===U(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function ct({event:e}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(ee,{className:n(`w-2 h-2 fill-current`,ot[e.status]||`text-tone-neutral-fg`)}),(0,q.jsx)(`span`,{children:Ne[e.status]||e.status}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:R(e.timestamp)})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function lt({agentId:e,fallbackLabel:t,className:r,noIcon:i}){let a=o(t=>t.agentsById[e])||null,s=o(e=>e.openInboxThread),c=o(e=>e.switchView),l=a?g(a):t||e;return(0,q.jsxs)(`button`,{type:`button`,className:n(`inline-flex max-w-full items-center gap-1 rounded px-1 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground`,r),onClick:t=>{t.stopPropagation(),s(e),c(`chat`)},title:`Open chat for ${l}`,children:[!i&&(0,q.jsx)(ce,{agent:a,className:`w-4 h-4 text-[10px]`}),i?(0,q.jsx)(ue,{agent:a,fallback:l,className:`max-w-[160px]`}):(0,q.jsx)(`span`,{className:`max-w-[160px] truncate`,children:l})]})}var ut={"spawned-child":{ready:`spawned`,exited:`spawned · exited`,failed:`spawn failed`},"spawned-by":{ready:`spawned by`,exited:`spawned by`,failed:`spawned by`}},dt={"spawned-child-ready":ie,"spawned-child-exited":P,"spawned-child-failed":O,"spawned-by-ready":x,"spawned-by-exited":x,"spawned-by-failed":x},ft={"spawned-child-ready":`text-tone-success-fg`,"spawned-child-exited":`text-tone-neutral-fg`,"spawned-child-failed":`text-tone-danger-fg`,"spawned-by-ready":`text-tone-info-fg`,"spawned-by-exited":`text-tone-info-fg`,"spawned-by-failed":`text-tone-info-fg`};function pt({entry:e}){let t=`${e.direction}-${e.status}`,r=ut[e.direction]?.[e.status]??e.direction,i=dt[t]??S,a=ft[t]??`text-muted-foreground`,o=e.status===`failed`;return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:n(`flex items-center gap-1.5 rounded-full border bg-muted/30 px-2.5 py-1 text-xs`,o?`border-tone-danger/30`:`border-border`),children:[(0,q.jsx)(i,{className:n(`h-3 w-3 shrink-0`,a)}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:r}),(0,q.jsx)(lt,{agentId:e.agentId}),e.reason&&o&&(0,q.jsxs)(`span`,{className:`text-tone-danger-fg max-w-[120px] truncate`,title:e.reason,children:[`— `,e.reason]}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0`,children:R(e.timestamp)})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var mt={memory:C,"memory-area":F,instructions:A,tools:j,comms:S,knowledge:fe,context:he},ht={memory:`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,"memory-area":`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,instructions:`border-tone-sky/25 bg-tone-sky/10 text-tone-sky-fg`,tools:`border-tone-warning/25 bg-tone-warning/10 text-tone-warning-fg`,comms:`border-tone-violet/25 bg-tone-violet/10 text-tone-violet-fg`,knowledge:`border-tone-cyan/25 bg-tone-cyan/10 text-tone-cyan-fg`,context:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`};function gt({entry:e}){let t=e.event,n=mt[t.category]??se,r=ht[t.category]??ht.context,i=tt(t.category,t.detail);return(0,q.jsx)(`div`,{className:`flex justify-center py-2 my-1`,children:(0,q.jsx)(X,{id:`relay-injection-${t.id}`,icon:n,label:t.category,summary:t.summary,trailing:R(t.timestamp),tone:r,className:`max-w-[85%] md:max-w-[75%]`,children:i?(0,q.jsx)(at,{detail:t.detail}):(0,q.jsx)(Y,{value:t.detail,className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})})})}var _t={"mcp-tool-search":oe,"mcp-tool-call":ae,"cli-bash":I,edit:ne,read:A,plan:re,"ask-user-question":pe,"agent-spawn":le,generic:j},vt={"mcp-tool-search":`border-tone-sky/25 bg-tone-sky/10 text-tone-sky-fg`,"mcp-tool-call":`border-tone-violet/25 bg-tone-violet/10 text-tone-violet-fg`,"cli-bash":`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,edit:`border-tone-warning/25 bg-tone-warning/10 text-tone-warning-fg`,read:`border-tone-cyan/25 bg-tone-cyan/10 text-tone-cyan-fg`,plan:`border-tone-indigo/25 bg-tone-indigo/10 text-tone-indigo-fg`,"ask-user-question":`border-tone-rose/25 bg-tone-rose/10 text-tone-rose-fg`,"agent-spawn":`border-tone-orange/25 bg-tone-orange/10 text-tone-orange-fg`,generic:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`};function yt(e){let t=(e.label??``).trim(),n=e.text.trim();return t&&n&&n!==t?`${t} — ${n}`:t||n||`tool`}function bt(e){let t={tool:e.label||`tool`,category:e.category??`generic`};return e.status&&(t.status=e.status),e.text.trim()&&(t.command=e.text),e.params!==void 0&&(t.params=e.params),t}var xt={failed:`border-tone-danger/30 bg-tone-danger/10 text-tone-danger-fg`,cancelled:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`};function St({step:e}){let t=e.category??`generic`,n=_t[t]??j,r=e.status&&xt[e.status]||vt[t]||vt.generic,i=e.status===`failed`?`${t} · failed`:e.status===`cancelled`?`${t} · cancelled`:t;return(0,q.jsx)(X,{id:`tool-step-${e.id}`,icon:n,label:i,summary:yt(e),tone:r,children:(0,q.jsx)(Y,{value:bt(e),className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})})}function Ct({blockedLabel:e,onInterrupt:t,activityKey:n}){return e?(0,q.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-tone-danger/30 px-4`,children:[(0,q.jsx)(O,{className:`w-3.5 h-3.5 text-tone-danger-fg`}),(0,q.jsxs)(`span`,{className:`text-xs text-tone-danger-fg`,children:[`blocked: `,e]})]})}):(0,q.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_3]`}),(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_0.2s_3]`}),(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_0.4s_3]`})]},n??void 0),(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),t&&(0,q.jsxs)(`button`,{onClick:t,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-tone-danger-fg hover:bg-tone-danger/10 transition-colors`,children:[(0,q.jsx)(me,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}function wt({entry:e}){let{event:t}=e,n=t.kind===`questions`,r=n?t.title:t.kind===`plan`?`Plan prompt`:`${t.toolName} permission`;return(0,q.jsx)(`div`,{className:`flex justify-center py-1.5`,children:(0,q.jsxs)(`div`,{className:`w-full max-w-2xl rounded-md border border-border bg-muted/20 px-3 py-2 text-sm`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(k,{className:`h-3.5 w-3.5 text-tone-success-fg`}),(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),(0,q.jsx)(`span`,{children:t.decisionLabel}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/60`,children:R(t.timestamp)})]}),n&&t.questions.length>0?(0,q.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:t.questions.map((e,t)=>(0,q.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.question}),(0,q.jsx)(`div`,{className:`text-sm text-foreground`,children:e.answer})]},`${e.question}-${t}`))}):t.body.trim()?(0,q.jsx)(`div`,{className:`mt-2 max-h-48 overflow-auto rounded border border-border/70 bg-background/40 px-2 py-1.5 text-sm`,children:(0,q.jsx)(M,{text:t.body})}):null]})})}function Tt({date:e}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:st(e)}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Et({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Dt({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(ge,{className:`h-3 w-3`}),(0,q.jsxs)(`span`,{children:[`forked history from `,t]}),(0,q.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ot({entry:e,sourceLabel:t,issueRepo:r}){let i=e.message,a=f(i),o=s(e.originalFrom);return(0,q.jsx)(`div`,{className:n(`flex mb-3 opacity-80`,o?`justify-end`:`justify-start`),children:(0,q.jsx)(`div`,{className:`max-w-full md:max-w-[75%]`,children:(0,q.jsxs)(`div`,{className:n(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,o?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,q.jsxs)(`div`,{className:n(`mb-1 text-[10px] uppercase tracking-normal`,o?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,o?`you`:t||e.originalFrom]}),(0,q.jsx)(M,{text:a,rawBody:i.body,issueRepo:r,className:`leading-relaxed`}),(0,q.jsxs)(`p`,{className:n(`mt-1 flex items-center justify-end gap-1.5 text-xs`,o?`text-primary/60`:`text-muted-foreground`),children:[(0,q.jsx)(`span`,{className:`opacity-40`,children:h(e.originalMessageId)}),(0,q.jsx)(`span`,{children:R(e.originalCreatedAt)})]})]})})})}function kt({msg:e,issueRepo:t}){let n=f(e),r=R(e.occurredAt??e.createdAt);return(0,q.jsx)(`div`,{"data-msg-id":e.id,className:`mb-3`,children:(0,q.jsxs)(`div`,{className:`rounded-xl border border-primary/30 bg-primary/[0.06] px-3.5 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-primary/80`,children:[(0,q.jsx)(se,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:`Initial prompt`}),(0,q.jsx)(`span`,{className:`ml-auto text-[10px] font-normal normal-case text-muted-foreground/60`,children:r})]}),(0,q.jsx)(M,{text:n,rawBody:e.body,issueRepo:t,className:`text-sm leading-relaxed text-foreground`})]})})}function At({scrollEl:e,timeline:t,issueRepo:r,onScrollToOriginal:i}){let[a,o]=(0,L.useState)(!0),[c,l]=(0,L.useState)(!0),[u,d]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`&&n.type!==`initial-prompt`)&&s(n.msg.from))return{id:n.msg.id,body:f(n.msg),rawBody:n.msg.body,key:W(n)}}return null},[t]);if((0,L.useEffect)(()=>{if(!y||!e){o(!0);return}let t=null,n=null,r=()=>{l(e.scrollTop<(u?.offsetHeight??0));let r=e.querySelector(`[data-msg-id="${y.id}"]`);if(!r){t?.disconnect(),t=null,n=null,o(!1);return}let i=r.getBoundingClientRect(),a=e.getBoundingClientRect();v(i.top<a.top),r!==n&&(t?.disconnect(),n=r,t=new IntersectionObserver(([e])=>{e&&o(e.isIntersecting)},{root:e,threshold:0}),t.observe(r))};return r(),e.addEventListener(`scroll`,r,{passive:!0}),()=>{t?.disconnect(),e.removeEventListener(`scroll`,r)}},[y?.id,e,u]),!y||!y.body.trim())return null;let b=p?.id===y.id&&p.value,x=h?.id!==y.id||h.value;function S(){y&&i?.(y.key)}let C=_?`↑`:`↓`,w=a||c;return x?(0,q.jsx)(`div`,{ref:d,"aria-hidden":w,className:n(`absolute inset-x-0 top-0 z-10 flex border-b border-border bg-card/90 backdrop-blur`,w&&`invisible`),children:(0,q.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary transition-colors`,onClick:()=>g({id:y.id,value:!1}),children:[(0,q.jsx)(`span`,{children:`Your prompt`}),(0,q.jsx)(T,{className:`w-3 h-3`})]})}):(0,q.jsxs)(`section`,{ref:d,"aria-hidden":w,className:n(`absolute inset-x-0 top-0 z-10 flex flex-col border-b border-border bg-card/90 px-3 py-2 backdrop-blur`,w&&`invisible`),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,q.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,q.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:S,children:[C,` scroll to original`]}),(0,q.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>g({id:y.id,value:!0}),title:`Minimize`,children:(0,q.jsx)(D,{className:`w-3 h-3`})})]}),(0,q.jsx)(`div`,{className:n(`cursor-pointer`,b?`max-h-48 overflow-y-auto`:`line-clamp-2`),onClick:()=>m({id:y.id,value:!b}),children:(0,q.jsx)(M,{text:y.body,rawBody:y.rawBody,issueRepo:r,className:`text-sm text-foreground leading-snug`})})]})}var jt=(0,L.memo)(At);export{Ae as A,I as B,Ze as C,we as D,ke as E,Me as F,me as G,P as H,_e as I,fe as J,pe as K,je as L,ye as M,Ee as N,xe as O,ve as P,be as R,W as S,R as T,ge as U,F as V,he as W,Ye as _,Tt as a,Ke as b,kt as c,ct as d,jt as f,Ge as g,Y as h,Et as i,Se as j,Te as k,wt as l,X as m,lt as n,Dt as o,St as p,N as q,Ct as r,Ot as s,pt as t,gt as u,H as v,Ce as w,K as x,Xe as y,Oe as z};
|
|
5
|
-
//# sourceMappingURL=TraceView-
|
|
5
|
+
//# sourceMappingURL=TraceView-Wimm0Czv.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{Ct as n,X as r,Z as i,q as a,t as o}from"./store-
|
|
2
|
-
//# sourceMappingURL=VaultDecisionCard-
|
|
1
|
+
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{Ct as n,X as r,Z as i,q as a,t as o}from"./store-DcClXLH0.js";import{et as s,h as c,v as l}from"./display-BrKWFGJz.js";import{s as u}from"./api-CIIVBtAV.js";import{t as d}from"./external-link-BRfu-fHG.js";import{t as f}from"./key-round-CcSxl5qr.js";import{t as p}from"./lock-BW8MPKw_.js";import{t as m}from"./x-Bge17hWJ.js";import{t as h}from"./button-Do6Z3vvn.js";import{t as g}from"./badge-DqJRtj_p.js";import{t as _}from"./agent-name-DKbiIhBo.js";import{t as v}from"./formatted-body-CQBwc1fb.js";var y=t();function b({decision:t,className:b}){let x=n(),S=o(e=>e.agentsById[t.filedBy]),C=o(e=>e.declineVaultRequest),{name:w,scope:T}=i(t.title),E=a(t,x);return(0,y.jsxs)(`div`,{"data-testid":`decision-card-${t.id}`,"data-kind":`vault`,className:e(`rounded-xl bg-card ring-1 ring-tone-sky/40 px-3.5 py-3 text-sm`,b),children:[(0,y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,y.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-tone-sky-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`font-medium text-foreground break-words`,children:[`Set secret `,(0,y.jsx)(`code`,{className:`break-all`,children:w})]}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,y.jsx)(g,{variant:`outline`,className:`h-4 border-tone-sky/50 px-1 text-[10px] text-tone-sky-fg`,children:`Secret`}),(0,y.jsx)(g,{variant:`outline`,className:`h-4 px-1 text-[10px]`,children:T}),(0,y.jsxs)(`span`,{children:[`#`,t.id]}),(0,y.jsxs)(`span`,{children:[`· asked by `,(0,y.jsx)(_,{agent:S,fallback:t.filedBy})]}),(0,y.jsxs)(`span`,{children:[`· `,s(x,t.createdAt)]}),t.expiresAt!==void 0&&t.status===`open`&&(0,y.jsxs)(`span`,{"data-testid":`vault-expiry`,title:l(t.expiresAt),className:E?`text-tone-warning-fg`:void 0,children:[`· `,E?`expired ${s(x,t.expiresAt)}`:`expires in ${c(t.expiresAt,x)}`]})]})]})]}),t.context&&(0,y.jsx)(v,{text:t.context,rawBody:t.context,className:`mt-2 text-[13px] leading-relaxed text-foreground/90`}),(0,y.jsxs)(`p`,{className:`mt-2 flex items-start gap-1.5 text-xs text-muted-foreground`,children:[(0,y.jsx)(p,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,y.jsx)(`span`,{children:`Enter the value on the one-time page. It does not go through chat and the agent never sees it.`})]}),(0,y.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[t.formUrl&&t.status===`open`&&!E?(0,y.jsxs)(`a`,{href:r(t.formUrl,u()),target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:h-8 sm:w-auto`,children:[(0,y.jsx)(d,{className:`h-3.5 w-3.5`}),`Open secure form`]}):(0,y.jsx)(`p`,{"data-testid":`vault-form-unavailable`,className:`text-xs text-tone-warning-fg`,children:E?`This request expired. Ask the agent to request the secret again.`:t.status===`open`?`The form link is only shown to the operator token.`:`This request is closed.`}),t.status===`open`&&(0,y.jsxs)(h,{type:`button`,variant:`ghost`,onClick:()=>{C(t.id)},className:`h-11 w-full text-muted-foreground sm:h-8 sm:w-auto`,children:[(0,y.jsx)(m,{className:`h-3.5 w-3.5`}),`Decline`]})]})]})}export{b as t};
|
|
2
|
+
//# sourceMappingURL=VaultDecisionCard-Bau_vNax.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-
|
|
2
|
-
//# sourceMappingURL=activity-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-DcClXLH0.js";import{et as o,mt as s,v as c}from"./display-BrKWFGJz.js";import{t as l}from"./scroll-area-CIN4KQse.js";import{t as u}from"./activity-TMzFOdh2.js";import{t as d}from"./radio-Bn0_qc0G.js";import{K as f,a as p,d as m,g as h,t as g}from"./TraceView-Wimm0Czv.js";import{t as _}from"./braces-BOks9SsY.js";import{t as v}from"./clipboard-list-W2YeUsxT.js";import{n as y,t as b}from"./flame-CxBuz46L.js";import{t as x}from"./link-6RR7Hy3-.js";import{t as S}from"./message-circle-wjztgHBe.js";import{t as C}from"./message-square-reply-B9Z4cbQx.js";import{n as w}from"./agent-type-icon-LrUEU3lB.js";import{t as T}from"./button-Do6Z3vvn.js";import{t as E}from"./badge-DqJRtj_p.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{n as O}from"./agent-name-DKbiIhBo.js";import{r as k,t as A}from"./card-C4QJ4hCW.js";import{i as j,n as M,t as N}from"./MessageBubble-BWLqMGKG.js";var P=e(n(),1),F=r(),I={question:f,reply:C,message:S,operator:w,pair:x,task:v,state:d},L={question:`bg-tone-info/10 text-tone-info-fg border-tone-info/20`,reply:`bg-tone-success/10 text-tone-success-fg border-tone-success/20`,message:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,operator:`bg-tone-purple/10 text-tone-purple-fg border-tone-purple/20`,pair:`bg-tone-yellow/10 text-tone-yellow-fg border-tone-yellow/20`,task:`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/20`,state:`bg-tone-cyan/10 text-tone-cyan-fg border-tone-cyan/20`},R=[`question`,`reply`,`message`,`operator`,`pair`,`task`,`state`],z=[`chat`,`session`,`system`,`task`];function B(e){let t=e?.surface;if(!t||typeof t!=`object`)return null;let n=t,r=[];return typeof n.component==`string`&&r.push(n.component),typeof n.view==`string`&&n.view!==n.component&&r.push(n.view),typeof n.session==`string`&&r.push(`tab ${n.session.slice(0,6)}`),typeof n.client==`string`&&r.push(`client ${n.client.slice(0,6)}`),r.length?r.join(` · `):null}function V({entry:e,agentsById:t}){if(e.type===`notice`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(M,{msg:e.msg})});if(e.type===`agent-action`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(g,{entry:e})});if(e.type===`activity`)return(0,F.jsx)(`div`,{className:`px-1 opacity-60`,children:(0,F.jsx)(j,{steps:e.steps,showReasoning:!1})});if(e.type===`status`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(m,{event:e.event})});if(e.type===`date`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(p,{date:e.date})});if(e.type===`created`||e.type===`import-boundary`||e.type===`imported-message`||e.type!==`message`)return null;let{msg:n}=e;return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 mb-0.5`,children:[(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.from,children:(0,F.jsx)(O,{target:n.from,agentsById:t})}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`→`}),(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.to,children:(0,F.jsx)(O,{target:n.to,agentsById:t})}),(0,F.jsx)(E,{variant:`outline`,className:`text-[10px] px-1 py-0 shrink-0 ml-1`,children:n.kind})]}),(0,F.jsx)(N,{msg:n,peer:s})]})}function H(){let e=i(e=>e.messages),t=i(e=>e.agentsById),[n,r]=(0,P.useState)(``),[a,o]=(0,P.useState)(``),s=(0,P.useMemo)(()=>{let t=e;if(n){let e=n.toLowerCase();t=t.filter(t=>t.from.toLowerCase().includes(e)||t.to.toLowerCase().includes(e))}return a&&(t=t.filter(e=>e.kind===a)),t},[e,n,a]),c=(0,P.useMemo)(()=>h(s,[]),[s]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`input`,{type:`text`,className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm w-44`,placeholder:`Filter by agent…`,value:n,onChange:e=>r(e.target.value)}),(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>o(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`All kinds`}),z.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:s.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-1 pr-2`,children:[c.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No messages yet`}),c.map((e,n)=>(0,F.jsx)(V,{entry:e,agentsById:t},n))]})})]})}function U(){let e=a(),t=i(e=>e.activityFilter),n=i(e=>e.activityEvents),r=i(e=>e.operatorActivity),s=i(e=>e.set),d=i(e=>e.openActivityItem),f=i(e=>e.openTaskDetailById),p=i(e=>e.exportActivity),m=(0,P.useMemo)(()=>{let e=[...n,...r],t=new Set,i=[];for(let n of e){let e=n.clientId||String(n.id);t.has(e)||(t.add(e),i.push(n))}return i.map(e=>({...e,ts:e.ts??new Date(e.createdAt).getTime()})).sort((e,t)=>(t.ts??0)-(e.ts??0))},[n,r]),h=(0,P.useMemo)(()=>t?m.filter(e=>e.kind===t):m,[m,t]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:t,onChange:e=>s({activityFilter:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`All types`}),R.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`markdown`),children:[(0,F.jsx)(y,{className:`w-4 h-4 mr-1`}),` Markdown`]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`json`),children:[(0,F.jsx)(_,{className:`w-4 h-4 mr-1`}),` JSON`]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:h.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[h.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No activity yet`}),h.map(t=>{let n=I[t.kind]||u,r=L[t.kind]||L.message,i=B(t.metadata);return(0,F.jsx)(A,{className:`cursor-pointer hover:bg-accent/40 transition-colors`,onClick:()=>d(t),children:(0,F.jsxs)(k,{className:`p-3 flex gap-3`,children:[(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center w-7 h-7 rounded-md border shrink-0 mt-0.5 ${r}`,children:(0,F.jsx)(n,{className:`w-3.5 h-3.5`})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-sm truncate`,children:t.title}),(0,F.jsx)(E,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${r}`,children:t.kind}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground ml-auto shrink-0`,title:c(t.ts??t.createdAt),children:o(e,t.ts??t.createdAt)})]}),t.body&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:t.body}),t.meta&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 font-mono truncate`,children:t.meta}),i&&(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 truncate`,title:i,children:[(0,F.jsx)(`span`,{className:`opacity-70`,children:`via`}),` `,i]}),t.taskId!=null&&(0,F.jsx)(`div`,{className:`mt-1`,children:(0,F.jsx)(D,{id:t.taskId,onClick:()=>f(t.taskId)})})]})]})},t.clientId||t.id)})]})})]})}function W(){let[e,n]=(0,P.useState)(`firehose`);return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`firehose`?(0,F.jsx)(b,{className:`w-5 h-5 text-muted-foreground`}):(0,F.jsx)(u,{className:`w-5 h-5 text-muted-foreground`}),(0,F.jsx)(`h2`,{className:`text-lg font-semibold`,children:e===`firehose`?`Firehose`:`Events`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-input overflow-hidden`,children:[(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`firehose`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`firehose`),children:`Firehose`}),(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`events`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`events`),children:`Events`})]})]}),e===`firehose`?(0,F.jsx)(H,{}):(0,F.jsx)(U,{})]})}export{W as ActivityView};
|
|
2
|
+
//# sourceMappingURL=activity-CrSurn-r.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,u as t}from"./dist-DeW2Y1R5.js";import{P as n}from"./provider-display-
|
|
2
|
-
//# sourceMappingURL=agent-lineage-
|
|
1
|
+
import{n as e,u as t}from"./dist-DeW2Y1R5.js";import{P as n}from"./provider-display-DsuWMvVL.js";import{Z as r,f as i,t as a}from"./display-BrKWFGJz.js";import{t as o}from"./agent-liveness-CaNwK0Zf.js";import{t as s}from"./cpu-Dndy84IU.js";import{t as c}from"./eye-BAP6fHrX.js";import{t as l}from"./git-branch-yxhV0m8E.js";import{t as u}from"./layers-DEfClY-v.js";import{t as d}from"./lock-BW8MPKw_.js";import{t as f}from"./rocket-BmO1qSu-.js";import{t as p}from"./terminal-Bl2u7KxT.js";import{t as m}from"./badge-DqJRtj_p.js";var h=e(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),g=e(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),_=e(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),v=e(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),y=e(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),b=e(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),x=t();function S({agent:e,compact:t=!1}){let n=N(e);return n.length===0?null:(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.slice(0,t?4:void 0).map(e=>(0,x.jsx)(m,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})}function C({agent:e,compact:t=!1,className:n=``}){let r=T(e);return(0,x.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 ${n}`,children:r.map(e=>{let n=e.Icon;return(0,x.jsxs)(`span`,{title:e.title,className:`inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-md border px-1.5 text-[10px] leading-none ${e.className}`,children:[(0,x.jsx)(n,{className:`h-3 w-3 shrink-0`}),!t&&(0,x.jsx)(`span`,{children:e.label})]},e.key)})})}function w({agent:e}){let t=e.context;if(!t)return null;let n=I(t);if(n===null)return(0,x.jsxs)(`div`,{className:`space-y-1`,title:L(t),children:[(0,x.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:`collecting`}),(0,x.jsx)(`span`,{children:`--`})]}),(0,x.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full w-0 bg-muted-foreground/30`})})]});let r=Math.round(n*100),i=r>=80?`bg-tone-danger`:r>=60?`bg-tone-yellow`:`bg-tone-success`;return(0,x.jsxs)(`div`,{className:`space-y-1`,title:L(t),children:[(0,x.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:t.lifecycleState}),(0,x.jsxs)(`span`,{children:[r,`%`]})]}),(0,x.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full ${i}`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})})]})}function T(e){let t=D(e),n=O(e),r=k(e);return[{key:`origin`,label:t?`Relay`:`External`,title:t?`Humwick spawned this agent`:`Externally started agent registered with Humwick`,Icon:t?f:_,className:t?`border-tone-sky/30 bg-tone-sky/10 text-tone-sky-fg`:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`},n,...E(e),r]}function E(e){let t=e.meta?.launchMode;return t===`headless`?[{key:`launchMode`,label:`Headless`,title:`Launch mode: headless (persistent pipe, no terminal)`,Icon:s,className:`border-tone-fuchsia/30 bg-tone-fuchsia/10 text-tone-fuchsia-fg`}]:t===`interactive`?[{key:`launchMode`,label:`Interactive`,title:`Launch mode: interactive (terminal)`,Icon:p,className:`border-tone-teal/30 bg-tone-teal/10 text-tone-teal-fg`}]:[]}function D(e){return typeof e.meta?.spawnRequestId==`string`||typeof e.meta?.policyName==`string`||typeof e.meta?.automationRunId==`string`}function O(e){let t=String(e.providerCapabilities?.session?.approvalMode||e.meta?.approvalMode||`guarded`).toLowerCase();return t===`open`?{key:`approval`,label:`Open`,title:`Approval mode: open`,Icon:y,className:`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`}:t===`read-only`?{key:`approval`,label:`Read-only`,title:`Approval mode: read-only`,Icon:c,className:`border-tone-info/30 bg-tone-info/10 text-tone-info-fg`}:{key:`approval`,label:`Guarded`,title:`Approval mode: guarded`,Icon:d,className:`border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`}}function k(e){let t=A(e.meta?.workspace),r=n(t.requestedMode)||n(e.meta?.workspaceMode),i=n(t.mode),a=r&&r!==`inherit`?r:i&&r!==`inherit`?i:`default`;return a===`isolated`?{key:`workspace`,label:`Isolated`,title:`Workspace: isolated worktree`,Icon:l,iconColor:`text-tone-violet-fg`,className:`border-tone-violet/30 bg-tone-violet/10 text-tone-violet-fg`}:a===`shared`?{key:`workspace`,label:`Shared`,title:`Workspace: shared repo checkout`,Icon:b,iconColor:`text-tone-cyan-fg`,className:`border-tone-cyan/30 bg-tone-cyan/10 text-tone-cyan-fg`}:{key:`workspace`,label:`Default`,title:i?`Workspace: default/inherit, resolved to ${i}`:`Workspace: default/inherit`,Icon:u,iconColor:`text-tone-neutral-fg`,className:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`}}function A(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function j(e){let t=A(e.meta?.workspace),i=n(e.branchWorkspaceProjectRoot)||n(t.repoRoot)||n(t.sourceCwd)||n(e.meta?.cwd);return i?r(i,2):``}function M(e){return!!(e.context||e.providerCapabilities?.context)}function N(e){let t=e.providerCapabilities,n=e.context,r=[];t?.lifecycle.managed?r.push(`managed`):t&&r.push(`bridge`),t?.session?.approvalMode===`read-only`?r.push(`read-only`):t?.session?.fileWrite&&r.push(`write`),t?.session?.shell&&r.push(`shell`),(t?.model?.alias||t?.model?.id)&&r.push(String(t.model.alias||t.model.id));let i=a(e).length;if(i&&r.push(i===1?`1 subagent`:`${i} subagents`),n){let e=I(n);r.push(e===null?`ctx collecting`:`${Math.round(e*100)}% ctx`)}return r}function P({context:e,expected:t=!!e,size:n=26,className:r}){let i=I(e);if(i===null&&!t)return null;let a=n>=24?3:2.5,o=n/2,s=o-a,c=2*Math.PI*s,l=i===null?c:c*(1-i),u=i===null,d=u?`text-muted-foreground`:i>.8?`text-tone-danger-fg`:i>.5?`text-tone-yellow-fg`:`text-tone-success-fg`,f=u?null:Math.round(i*100);return(0,x.jsxs)(`div`,{className:`relative shrink-0 ${u?`opacity-70`:``} ${r??``}`,style:{width:n,height:n},title:L(e),children:[(0,x.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:`rotate-[-90deg]`,children:[(0,x.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,className:`stroke-muted-foreground/20`}),(0,x.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,strokeDasharray:c,strokeDashoffset:l,strokeLinecap:`round`,className:`${d} stroke-current transition-all duration-500`})]}),(0,x.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-semibold leading-none ${u?`text-muted-foreground`:d}`,style:{fontSize:n>=24?8:7},children:u?`?`:f})]})}function F(e){let t=e.context;return!t?.tokensUsed&&!t?.tokensMax?null:t.tokensUsed&&t.tokensMax?`${R(t.tokensUsed)} / ${R(t.tokensMax)}`:t.tokensUsed?R(t.tokensUsed):t.tokensMax?R(t.tokensMax):null}function I(e){return!e||typeof e.utilization!=`number`||!Number.isFinite(e.utilization)?null:Math.min(1,Math.max(0,e.utilization))}function L(e){if(!e)return`Context: collecting; provider has not reported usage yet`;let t=I(e),n=`${e.source}/${e.confidence}`,r=Number.isFinite(e.lastUpdatedAt)?new Date(e.lastUpdatedAt).toLocaleString():`unknown`;return t===null?`Context: unknown; ${n}; updated ${r}`:`Context: ${Math.round(t*100)}%; ${n}; updated ${r}`}function R(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function z(e,t){return!!e.spawnedBy&&o(t,e)}function B(e,t){let n=new Map;for(let r of e){if(!r.spawnedBy||!z(r,t))continue;let e=n.get(r.spawnedBy);e?e.push(r):n.set(r.spawnedBy,[r])}return n}function V(e,t,n,r=new Set){let i=B(e,n),a=[],o=new Set,s=U(e,n).map(e=>({agent:e,depth:0,parent:e.spawnedBy?t[e.spawnedBy]??null:null})).reverse();for(;s.length;){let e=s.pop();if(o.has(e.agent.id))continue;o.add(e.agent.id);let t=i.get(e.agent.id)??[];if(r.has(e.agent.id))a.push({...e,children:t,folded:t.length?H(e.agent.id,i):void 0});else{a.push({...e,children:t});for(let n=t.length-1;n>=0;n--)s.push({agent:t[n],depth:e.depth+1,parent:e.agent})}}return a}function H(e,t){let n=[],r=new Set([e]),i=[...t.get(e)??[]].reverse();for(;i.length;){let e=i.pop();if(r.has(e.id))continue;r.add(e.id),n.push(e);let a=t.get(e.id)??[];for(let e=a.length-1;e>=0;e--)i.push(a[e])}return n}function U(e,t){let n=new Set(e.map(e=>e.id));return e.filter(e=>e.spawnedBy&&!z(e,t)?!1:!z(e,t)||!e.spawnedBy||!n.has(e.spawnedBy))}function W(e){return[...e].sort((e,t)=>i(e).localeCompare(i(t)))}export{g as _,S as a,P as c,k as d,F as f,_ as g,v as h,U as i,M as l,y as m,B as n,C as o,b as p,W as r,w as s,V as t,j as u,h as v};
|
|
2
|
+
//# sourceMappingURL=agent-lineage-CknAJKcb.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{$ as n,f as r,p as i}from"./display-
|
|
2
|
-
//# sourceMappingURL=agent-name-
|
|
1
|
+
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{$ as n,f as r,p as i}from"./display-BrKWFGJz.js";import{t as a}from"./workflow-marker-DAZcj5qt.js";var o=t();function s({agent:t,fallback:n,className:i}){return(0,o.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 align-bottom`,children:[(0,o.jsx)(`span`,{className:e(`truncate`,i),children:t?r(t):n??`?`}),(0,o.jsx)(a,{agent:t})]})}function c({target:t,agentsById:r,className:a}){let c=n(t,r);return c?(0,o.jsx)(s,{agent:c,className:a}):(0,o.jsx)(`span`,{className:e(`truncate`,a),children:i(t,r)})}export{c as n,s as t};
|
|
2
|
+
//# sourceMappingURL=agent-name-DKbiIhBo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-DcClXLH0.js";import{M as i,r as a,t as o}from"./provider-display-DsuWMvVL.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dialog-uuJ9_geR.js";import{t as m}from"./chevron-right-iljytE0x.js";import{t as h}from"./copy-DFxhHRtV.js";import{t as g}from"./download-KgtpDbt5.js";import{t as _}from"./eye-BAP6fHrX.js";import{n as v,t as y}from"./user-cog-CKcouW1J.js";import{t as b}from"./loader-circle-BfPd4kOD.js";import{t as x}from"./pencil-B1Hf2V_J.js";import{t as S}from"./plus-D5Ek4e2S.js";import{t as C}from"./trash-2-FbcSq927.js";import{t as w}from"./button-Do6Z3vvn.js";import{t as T}from"./badge-DqJRtj_p.js";import{t as E}from"./project-profile-instructions-DQWZE0kA.js";var D=e(t(),1),O=n();function k(e){let t=o(),n=e.provider??``;return n&&n!==`any`&&t.includes(n)?n:t[0]??n}function A(e){if(Array.isArray(e))return e.map(A);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n===`files`&&Array.isArray(r)?t[n]=r.map(e=>{if(e&&typeof e==`object`&&typeof e.content==`string`){let t=e.content;return{...e,content:`<${t.length} chars elided>`}}return A(e)}):t[n]=A(r);return t}return e}function j({profile:e,open:t,onOpenChange:n}){let m=r(e=>e.apiCall),[h,_]=(0,D.useState)(()=>k(e)),[v,y]=(0,D.useState)(!1),[x,S]=(0,D.useState)(null),[C,T]=(0,D.useState)(null),E=(0,D.useCallback)(async t=>{y(!0),S(null);try{let n=await m(`GET`,`/agent-profiles/${encodeURIComponent(e.name)}/resolved?provider=${t}`);T(n.profile)}catch(e){T(null),S(i(e))}finally{y(!1)}},[m,e.name]);(0,D.useEffect)(()=>{if(t){let t=k(e);_(t),E(t)}},[t,e,E]);function j(e){e!==h&&(_(e),E(e))}function M(){if(!C)return;let t=new Blob([JSON.stringify(C,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.name}.${h}.resolved.json`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}let N=C?JSON.stringify(A(C),null,2):``;return(0,O.jsx)(p,{open:t,onOpenChange:n,children:(0,O.jsxs)(d,{className:`max-w-3xl`,children:[(0,O.jsxs)(u,{children:[(0,O.jsxs)(f,{className:`font-mono text-sm`,children:[e.name,` — resolved projection`]}),(0,O.jsxs)(c,{children:[`The fully-resolved agent-profile projection (`,(0,O.jsx)(`code`,{children:`withResolvedProvisioning`}),`) for the selected provider. File contents are elided below; download the full JSON for the complete bundle.`]})]}),(0,O.jsxs)(l,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Provider`}),(0,O.jsx)(`div`,{className:`flex items-center gap-1`,children:o().map(e=>(0,O.jsx)(w,{variant:e===h?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs`,disabled:v,onClick:()=>j(e),children:a(e)},e))}),(0,O.jsx)(`div`,{className:`flex-1`}),(0,O.jsxs)(w,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:v||!C,onClick:M,children:[(0,O.jsx)(g,{className:`h-3.5 w-3.5`}),`Download full JSON`]})]}),(0,O.jsx)(`div`,{className:`min-h-[16rem] rounded-md border border-border bg-muted/30 p-3`,children:v?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(b,{className:`h-3.5 w-3.5 animate-spin`}),`Resolving projection…`]}):x?(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:x}):C?(0,O.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed`,children:N}):(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No projection available.`})})]}),(0,O.jsx)(s,{children:(0,O.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>n(!1),children:`Close`})})]})})}function M({relay:e}){return(0,O.jsx)(`div`,{className:`flex items-center gap-1`,children:[{key:`ctx`,on:e.context},{key:`skl`,on:e.skills},{key:`plg`,on:e.plugins},{key:`stl`,on:e.statusLine}].map(e=>(0,O.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.on?`bg-tone-success`:`bg-muted-foreground/30`}`,title:`${e.key}: ${e.on?`on`:`off`}`},e.key))})}function N({profile:e}){let t=r(e=>e.openProfileModal),n=r(e=>e.deleteProfile),i=e.builtIn===!0,[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`group flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-4 ${s?`sm:col-span-2 lg:col-span-3`:``}`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-2 gap-y-1`,children:[(0,O.jsxs)(`div`,{className:`min-w-[10rem] flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,O.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":!0,children:e.icon?.trim()||`•`}),(0,O.jsx)(`span`,{className:`min-w-0 font-mono text-sm font-medium [overflow-wrap:anywhere]`,children:e.name}),i&&(0,O.jsx)(T,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`}),e.overridden&&(0,O.jsx)(T,{variant:`outline`,className:`text-[10px] border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`,children:`Overridden`})]}),e.description&&(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,O.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5 opacity-100 transition-opacity [@media(hover:hover)]:sm:opacity-0 [@media(hover:hover)]:sm:group-hover:opacity-100 [@media(hover:hover)]:sm:group-focus-within:opacity-100`,children:[(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`View`,onClick:()=>t(`view`,e),children:(0,O.jsx)(_,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Edit`,onClick:()=>t(`edit`,e),children:(0,O.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Duplicate`,onClick:()=>t(`duplicate`,e),children:(0,O.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Resolved projection`,onClick:()=>o(!0),children:(0,O.jsx)(v,{className:`h-3.5 w-3.5`})}),(!i||e.overridden)&&(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 text-destructive`,title:i?`Reset to default`:`Delete`,onClick:()=>n(e),children:(0,O.jsx)(C,{className:`h-3.5 w-3.5`})})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,O.jsx)(T,{variant:`outline`,children:e.provider||`any`}),(0,O.jsxs)(T,{variant:`outline`,children:[`fs: `,e.permissions.filesystem]}),e.permissions.mode&&(0,O.jsx)(T,{variant:`outline`,children:e.permissions.mode})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Relay `,(0,O.jsx)(M,{relay:e.relay})]}),e.instructions.globalInstructions===`ignore`&&(0,O.jsx)(`span`,{className:`text-tone-warning-fg`,children:`global: ignore`}),Object.keys(e.env||{}).length>0&&(0,O.jsxs)(`span`,{children:[Object.keys(e.env).length,` env vars`]})]}),(0,O.jsxs)(`div`,{className:`-mx-1 border-t border-border pt-2`,children:[(0,O.jsxs)(w,{variant:`ghost`,size:`sm`,className:`h-8 gap-1 px-1 text-xs`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,O.jsx)(m,{className:`h-3.5 w-3.5 transition-transform ${s?`rotate-90`:``}`}),`Project instructions`]}),s&&(0,O.jsx)(`div`,{className:`px-1 pt-1`,children:(0,O.jsx)(E,{profile:e.name})})]}),(0,O.jsx)(j,{profile:e,open:a,onOpenChange:o})]})}function P(){let e=r(e=>e.agentProfiles),t=r(e=>e.openProfileModal),n=e.filter(e=>e.builtIn),i=e.filter(e=>!e.builtIn);return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,O.jsx)(y,{className:`h-5 w-5 text-primary`}),`Agent Profiles`]}),(0,O.jsx)(T,{variant:`outline`,children:e.length}),(0,O.jsx)(`div`,{className:`flex-1`}),(0,O.jsxs)(w,{size:`sm`,className:`gap-1`,onClick:()=>t(`create`),children:[(0,O.jsx)(S,{className:`h-3.5 w-3.5`}),`Create Profile`]})]}),n.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Built-in`}),(0,O.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:n.map(e=>(0,O.jsx)(N,{profile:e},e.name))})]}),i.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Custom`}),(0,O.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(e=>(0,O.jsx)(N,{profile:e},e.name))})]}),e.length===0&&(0,O.jsx)(`div`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`No agent profiles found. Create one to configure agent behavior.`})]})}export{P as AgentProfilesView};
|
|
2
|
+
//# sourceMappingURL=agent-profiles-DwF6EQ4R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-
|
|
2
|
-
//# sourceMappingURL=agent-project-badge-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-DcClXLH0.js";import{t as a}from"./boxes-Cv7Wq3h4.js";var o=t(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),s=e(n(),1),c=r();function l({agent:e,className:t=``,onNavigate:n}){let r=typeof e.meta?.cwd==`string`?e.meta.cwd:``,o=i(e=>r?e.projectByCwd[r]:null),l=i(e=>e.fetchProjectForCwd),u=i(e=>e.openProjectFocus);return(0,s.useEffect)(()=>{r&&l(r)},[r,l]),o?(0,c.jsxs)(`button`,{type:`button`,title:`Project: ${o.title||o.slug} — open in Projects`,onClick:e=>{e.stopPropagation(),n?.(),u(o.id)},className:`inline-flex h-5 max-w-full items-center gap-1 rounded-full border border-tone-indigo/30 bg-tone-indigo/10 px-1.5 text-[10px] font-medium text-tone-indigo-fg transition-colors hover:bg-tone-indigo/20 ${t}`,children:[(0,c.jsx)(a,{className:`h-3 w-3 shrink-0`}),(0,c.jsx)(`span`,{className:`truncate`,children:o.title||o.slug})]}):null}export{o as n,l as t};
|
|
2
|
+
//# sourceMappingURL=agent-project-badge-Diz4Sjjb.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-BvtFdlGX.js";import{et as o,v as s,y as c}from"./display-CfO7rTuF.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./globe-Cl5fXtqs.js";import{t as d}from"./refresh-cw-CfpvQcUn.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{n as m}from"./agent-name-CTZBrSD9.js";var h=e(n(),1),g={total:0,perDay:[],perBackend:[],topErrors:[],agents:[],statuses:[]};function _(e){let[t,n]=(0,h.useState)([]),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(g),[s,c]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)([]),_=(0,h.useRef)(!1),v=(0,h.useRef)(0),{tool:y,windowMs:b,status:x,agentId:S,backend:C}=e,w=(0,h.useCallback)(async e=>{if(_.current)return;_.current=!0;let t=++v.current;p(!0);let r=Date.now()-b,a=new URLSearchParams({since:String(r),limit:`1000`});for(let[e,t]of Object.entries({tool:y,status:x,agentId:S,backend:C}))t&&a.set(e,t);let s=m.current.filter(e=>e.time>=r);e&&(a.set(`beforeTime`,String(e.beforeTime)),a.set(`beforeId`,e.beforeId));try{let u=async()=>{let n=await l(`GET`,`/web-tool-calls?${a}`),r=[...n.calls];for(;!e&&s[0]&&n.nextCursor&&!n.calls.some(e=>e.id===s[0].id)&&n.calls.at(-1).time>=s[0].time;)if(a.set(`beforeTime`,String(n.nextCursor.beforeTime)),a.set(`beforeId`,n.nextCursor.beforeId),n=await l(`GET`,`/web-tool-calls?${a}`),r.push(...n.calls),t!==v.current)return{calls:[],nextCursor:null};return{calls:r,nextCursor:n.nextCursor}},f=new URLSearchParams({since:String(r)});y&&f.set(`tool`,y);let[p,h,g]=await Promise.all([u(),e?Promise.resolve(null):l(`GET`,`/web-tool-calls/summary?${f}`),e?Promise.resolve(null):l(`GET`,`/web-search/budget`)]);if(t!==v.current)return;let _=new Map(s.map(e=>[e.id,e]));for(let e of p.calls)_.set(e.id,e);let b=[..._.values()].sort((e,t)=>t.time-e.time||(e.id<t.id?1:e.id>t.id?-1:0));m.current=b,n(b),e||s.length===0?i(p.nextCursor):i(e=>e&&e.beforeTime>=r?e:null),h&&o(h),g&&c(g),d(null)}catch(e){t===v.current&&d(e.message)}finally{t===v.current&&(_.current=!1,p(!1))}},[y,b,x,S,C]);return(0,h.useEffect)(()=>{w();let e=setInterval(()=>{document.visibilityState!==`hidden`&&w()},1e4);return()=>{clearInterval(e),v.current++,_.current=!1}},[w]),{calls:t,cursor:r,summary:a,budget:s,error:u,loading:f,refresh:()=>w(),loadOlder:()=>r?w(r):Promise.resolve()}}var v=r(),y=1440*60*1e3,b=[[`24h`,y],[`7d`,7*y],[`30d`,30*y]],x=[[``,`All web tools`],[`search`,`Web search`],[`fetch`,`Web fetch`]],S=`h-8 min-w-0 rounded-md border border-input bg-background px-2 text-sm`;function C({budget:e}){if(!e)return null;let n=Math.min(100,Math.round(e.requests/e.cap*100)),r=n>=100?`danger`:n>=80?`warning`:`success`;return(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`brave-budget`,children:[(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Brave budget · `,e.month,` (UTC)`]}),(0,v.jsxs)(`div`,{className:`mt-1 text-lg font-semibold`,children:[e.requests,` / `,e.cap,` `,(0,v.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`requests (`,n,`%)`]})]}),(0,v.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:t(`h-full`,`bg-tone-${r}`),style:{width:`${n}%`}})})]})}function w({summary:e,budget:n}){let r=Math.max(1,...e.perDay.map(e=>e.calls));return(0,v.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,v.jsx)(C,{budget:n}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Calls per day`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perDay.slice(0,7).map(e=>(0,v.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`w-20 shrink-0 font-mono text-muted-foreground`,children:e.day.slice(5)}),(0,v.jsx)(`span`,{className:`h-2 rounded-full bg-tone-info`,style:{width:`${Math.max(2,e.calls/r*60)}%`}}),(0,v.jsx)(`span`,{children:e.calls})]},e.day)),e.perDay.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error rate per backend`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perBackend.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono`,children:e.backend}),(0,v.jsxs)(`span`,{className:t(e.errors>0&&`font-semibold text-tone-danger-fg`),children:[Math.round(e.errors/e.calls*100),`% · `,e.errors,`/`,e.calls]})]},e.backend)),e.perBackend.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Top errors`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.topErrors.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono text-tone-danger-fg`,children:e.status}),(0,v.jsx)(`span`,{children:e.count})]},e.status)),e.topErrors.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No errors`})]})]})]})}function T({label:e,children:t}){return(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,v.jsx)(`dd`,{className:`break-words font-mono`,children:t})]})}function E({call:e,now:n,open:r,onToggle:a}){let l=i(e=>e.agentsById),u=e.status===`success`;return(0,v.jsxs)(`li`,{className:t(`rounded-md border border-border`,!u&&`border-tone-danger/40 bg-tone-danger/5`),"data-testid":`tool-call-row`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 px-3 py-2 text-left`,"aria-expanded":r,onClick:a,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,v.jsx)(p,{className:t(`border`,u?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-tone-danger/40 bg-tone-danger/10 text-tone-danger-fg`),children:e.status}),(0,v.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,v.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e.backend}),(0,v.jsx)(`span`,{className:`min-w-0 max-w-[10rem] truncate`,children:(0,v.jsx)(m,{target:e.agentId,agentsById:l})}),(0,v.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,title:s(e.time),children:[o(n,e.time),` · `,e.durationMs,` ms`]})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-sm`,title:e.input,children:e.input})]}),r&&(0,v.jsxs)(`dl`,{className:`grid gap-2 border-t border-border px-3 py-2 text-xs sm:grid-cols-2`,children:[(0,v.jsx)(T,{label:`Time`,children:s(e.time)}),(0,v.jsx)(T,{label:`Provider / model / effort`,children:[e.provider,e.model,e.effort].map(e=>e??`–`).join(` / `)}),(0,v.jsx)(T,{label:`Input`,children:e.input}),(0,v.jsx)(T,{label:`Result size`,children:c(e.resultSize)}),(0,v.jsx)(T,{label:`Cache hit`,children:e.cacheHit===null?`unknown`:e.cacheHit?`yes`:`no`}),(0,v.jsx)(T,{label:`Fallback chain`,children:e.fallbackChain.length?e.fallbackChain.join(` → `):`–`}),e.error&&(0,v.jsx)(T,{label:`Error`,children:e.error}),(0,v.jsx)(T,{label:`Call id`,children:e.id})]})]})}function D(){let[e,t]=(0,h.useState)({tool:``,windowMs:y,status:``,agentId:``,backend:``});return(0,v.jsx)(O,{filters:e,onFilters:t},JSON.stringify(e))}function O({filters:e,onFilters:n}){let r=a(),{tool:i,windowMs:o,status:s,agentId:c,backend:l}=e,{calls:m,cursor:g,summary:y,budget:C,error:T,loading:D,refresh:O,loadOlder:k}=_(e),[A,j]=(0,h.useState)(null),M=y.perBackend.reduce((e,t)=>e+t.errors,0);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,v.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agent Tools`}),(0,v.jsx)(p,{variant:`secondary`,children:y.total}),M>0&&(0,v.jsxs)(p,{variant:`destructive`,children:[M,` errors`]})]}),(0,v.jsxs)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void O(),children:[(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`select`,{"aria-label":`Tool`,className:S,value:i,onChange:t=>n({...e,tool:t.target.value}),children:x.map(([e,t])=>(0,v.jsx)(`option`,{value:e,children:t},e))}),(0,v.jsx)(`select`,{"aria-label":`Time window`,className:S,value:o,onChange:t=>n({...e,windowMs:Number(t.target.value)}),children:b.map(([e,t])=>(0,v.jsx)(`option`,{value:t,children:e},e))}),(0,v.jsxs)(`select`,{"aria-label":`Status`,className:S,value:s,onChange:t=>n({...e,status:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any status`}),(0,v.jsx)(`option`,{value:`error`,children:`All errors`}),y.statuses.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Agent`,className:t(S,`max-w-[10rem]`),value:c,onChange:t=>n({...e,agentId:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any agent`}),y.agents.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Backend`,className:S,value:l,onChange:t=>n({...e,backend:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any backend`}),y.perBackend.map(e=>(0,v.jsx)(`option`,{value:e.backend,children:e.backend},e.backend))]})]}),T&&(0,v.jsx)(`div`,{className:`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-2 text-sm text-tone-danger-fg`,children:T}),(0,v.jsx)(w,{summary:y,budget:C}),m.length===0?(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:D?`Loading calls…`:`No tool calls match`}):(0,v.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,v.jsx)(E,{call:e,now:r,open:A===e.id,onToggle:()=>j(A===e.id?null:e.id)},e.id))}),g&&(0,v.jsx)(`div`,{className:`text-center`,children:(0,v.jsx)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void k(),children:`Load older calls`})})]})}export{D as AgentToolsView};
|
|
2
|
-
//# sourceMappingURL=agent-tools-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-DcClXLH0.js";import{et as o,v as s,y as c}from"./display-BrKWFGJz.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./globe-Cl5fXtqs.js";import{t as d}from"./refresh-cw-CfpvQcUn.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{n as m}from"./agent-name-DKbiIhBo.js";var h=e(n(),1),g={total:0,perDay:[],perBackend:[],topErrors:[],agents:[],statuses:[]};function _(e){let[t,n]=(0,h.useState)([]),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(g),[s,c]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)([]),_=(0,h.useRef)(!1),v=(0,h.useRef)(0),{tool:y,windowMs:b,status:x,agentId:S,backend:C}=e,w=(0,h.useCallback)(async e=>{if(_.current)return;_.current=!0;let t=++v.current;p(!0);let r=Date.now()-b,a=new URLSearchParams({since:String(r),limit:`1000`});for(let[e,t]of Object.entries({tool:y,status:x,agentId:S,backend:C}))t&&a.set(e,t);let s=m.current.filter(e=>e.time>=r);e&&(a.set(`beforeTime`,String(e.beforeTime)),a.set(`beforeId`,e.beforeId));try{let u=async()=>{let n=await l(`GET`,`/web-tool-calls?${a}`),r=[...n.calls];for(;!e&&s[0]&&n.nextCursor&&!n.calls.some(e=>e.id===s[0].id)&&n.calls.at(-1).time>=s[0].time;)if(a.set(`beforeTime`,String(n.nextCursor.beforeTime)),a.set(`beforeId`,n.nextCursor.beforeId),n=await l(`GET`,`/web-tool-calls?${a}`),r.push(...n.calls),t!==v.current)return{calls:[],nextCursor:null};return{calls:r,nextCursor:n.nextCursor}},f=new URLSearchParams({since:String(r)});y&&f.set(`tool`,y);let[p,h,g]=await Promise.all([u(),e?Promise.resolve(null):l(`GET`,`/web-tool-calls/summary?${f}`),e?Promise.resolve(null):l(`GET`,`/web-search/budget`)]);if(t!==v.current)return;let _=new Map(s.map(e=>[e.id,e]));for(let e of p.calls)_.set(e.id,e);let b=[..._.values()].sort((e,t)=>t.time-e.time||(e.id<t.id?1:e.id>t.id?-1:0));m.current=b,n(b),e||s.length===0?i(p.nextCursor):i(e=>e&&e.beforeTime>=r?e:null),h&&o(h),g&&c(g),d(null)}catch(e){t===v.current&&d(e.message)}finally{t===v.current&&(_.current=!1,p(!1))}},[y,b,x,S,C]);return(0,h.useEffect)(()=>{w();let e=setInterval(()=>{document.visibilityState!==`hidden`&&w()},1e4);return()=>{clearInterval(e),v.current++,_.current=!1}},[w]),{calls:t,cursor:r,summary:a,budget:s,error:u,loading:f,refresh:()=>w(),loadOlder:()=>r?w(r):Promise.resolve()}}var v=r(),y=1440*60*1e3,b=[[`24h`,y],[`7d`,7*y],[`30d`,30*y]],x=[[``,`All web tools`],[`search`,`Web search`],[`fetch`,`Web fetch`]],S=`h-8 min-w-0 rounded-md border border-input bg-background px-2 text-sm`;function C({budget:e}){if(!e)return null;let n=Math.min(100,Math.round(e.requests/e.cap*100)),r=n>=100?`danger`:n>=80?`warning`:`success`;return(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`brave-budget`,children:[(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Brave budget · `,e.month,` (UTC)`]}),(0,v.jsxs)(`div`,{className:`mt-1 text-lg font-semibold`,children:[e.requests,` / `,e.cap,` `,(0,v.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`requests (`,n,`%)`]})]}),(0,v.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:t(`h-full`,`bg-tone-${r}`),style:{width:`${n}%`}})})]})}function w({summary:e,budget:n}){let r=Math.max(1,...e.perDay.map(e=>e.calls));return(0,v.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,v.jsx)(C,{budget:n}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Calls per day`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perDay.slice(0,7).map(e=>(0,v.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`w-20 shrink-0 font-mono text-muted-foreground`,children:e.day.slice(5)}),(0,v.jsx)(`span`,{className:`h-2 rounded-full bg-tone-info`,style:{width:`${Math.max(2,e.calls/r*60)}%`}}),(0,v.jsx)(`span`,{children:e.calls})]},e.day)),e.perDay.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error rate per backend`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perBackend.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono`,children:e.backend}),(0,v.jsxs)(`span`,{className:t(e.errors>0&&`font-semibold text-tone-danger-fg`),children:[Math.round(e.errors/e.calls*100),`% · `,e.errors,`/`,e.calls]})]},e.backend)),e.perBackend.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Top errors`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.topErrors.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono text-tone-danger-fg`,children:e.status}),(0,v.jsx)(`span`,{children:e.count})]},e.status)),e.topErrors.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No errors`})]})]})]})}function T({label:e,children:t}){return(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,v.jsx)(`dd`,{className:`break-words font-mono`,children:t})]})}function E({call:e,now:n,open:r,onToggle:a}){let l=i(e=>e.agentsById),u=e.status===`success`;return(0,v.jsxs)(`li`,{className:t(`rounded-md border border-border`,!u&&`border-tone-danger/40 bg-tone-danger/5`),"data-testid":`tool-call-row`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 px-3 py-2 text-left`,"aria-expanded":r,onClick:a,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,v.jsx)(p,{className:t(`border`,u?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-tone-danger/40 bg-tone-danger/10 text-tone-danger-fg`),children:e.status}),(0,v.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,v.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e.backend}),(0,v.jsx)(`span`,{className:`min-w-0 max-w-[10rem] truncate`,children:(0,v.jsx)(m,{target:e.agentId,agentsById:l})}),(0,v.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,title:s(e.time),children:[o(n,e.time),` · `,e.durationMs,` ms`]})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-sm`,title:e.input,children:e.input})]}),r&&(0,v.jsxs)(`dl`,{className:`grid gap-2 border-t border-border px-3 py-2 text-xs sm:grid-cols-2`,children:[(0,v.jsx)(T,{label:`Time`,children:s(e.time)}),(0,v.jsx)(T,{label:`Provider / model / effort`,children:[e.provider,e.model,e.effort].map(e=>e??`–`).join(` / `)}),(0,v.jsx)(T,{label:`Input`,children:e.input}),(0,v.jsx)(T,{label:`Result size`,children:c(e.resultSize)}),(0,v.jsx)(T,{label:`Cache hit`,children:e.cacheHit===null?`unknown`:e.cacheHit?`yes`:`no`}),(0,v.jsx)(T,{label:`Fallback chain`,children:e.fallbackChain.length?e.fallbackChain.join(` → `):`–`}),e.error&&(0,v.jsx)(T,{label:`Error`,children:e.error}),(0,v.jsx)(T,{label:`Call id`,children:e.id})]})]})}function D(){let[e,t]=(0,h.useState)({tool:``,windowMs:y,status:``,agentId:``,backend:``});return(0,v.jsx)(O,{filters:e,onFilters:t},JSON.stringify(e))}function O({filters:e,onFilters:n}){let r=a(),{tool:i,windowMs:o,status:s,agentId:c,backend:l}=e,{calls:m,cursor:g,summary:y,budget:C,error:T,loading:D,refresh:O,loadOlder:k}=_(e),[A,j]=(0,h.useState)(null),M=y.perBackend.reduce((e,t)=>e+t.errors,0);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,v.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agent Tools`}),(0,v.jsx)(p,{variant:`secondary`,children:y.total}),M>0&&(0,v.jsxs)(p,{variant:`destructive`,children:[M,` errors`]})]}),(0,v.jsxs)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void O(),children:[(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`select`,{"aria-label":`Tool`,className:S,value:i,onChange:t=>n({...e,tool:t.target.value}),children:x.map(([e,t])=>(0,v.jsx)(`option`,{value:e,children:t},e))}),(0,v.jsx)(`select`,{"aria-label":`Time window`,className:S,value:o,onChange:t=>n({...e,windowMs:Number(t.target.value)}),children:b.map(([e,t])=>(0,v.jsx)(`option`,{value:t,children:e},e))}),(0,v.jsxs)(`select`,{"aria-label":`Status`,className:S,value:s,onChange:t=>n({...e,status:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any status`}),(0,v.jsx)(`option`,{value:`error`,children:`All errors`}),y.statuses.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Agent`,className:t(S,`max-w-[10rem]`),value:c,onChange:t=>n({...e,agentId:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any agent`}),y.agents.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Backend`,className:S,value:l,onChange:t=>n({...e,backend:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any backend`}),y.perBackend.map(e=>(0,v.jsx)(`option`,{value:e.backend,children:e.backend},e.backend))]})]}),T&&(0,v.jsx)(`div`,{className:`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-2 text-sm text-tone-danger-fg`,children:T}),(0,v.jsx)(w,{summary:y,budget:C}),m.length===0?(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:D?`Loading calls…`:`No tool calls match`}):(0,v.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,v.jsx)(E,{call:e,now:r,open:A===e.id,onToggle:()=>j(A===e.id?null:e.id)},e.id))}),g&&(0,v.jsx)(`div`,{className:`text-center`,children:(0,v.jsx)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void k(),children:`Load older calls`})})]})}export{D as AgentToolsView};
|
|
2
|
+
//# sourceMappingURL=agent-tools-CRhpRQza.js.map
|