@humwick/server 0.130.2 → 0.130.3
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/bundled/prompts/manifest.json +1 -0
- package/bundled/prompts/task.hydration.md +1 -1
- package/bundled/roles/builder.md +1 -1
- package/docs/guides/sub-coordinators.md +12 -5
- package/docs/guides/tools-coordination.md +1 -0
- package/docs/guides/workflows.md +16 -0
- package/docs/openapi.json +73 -4
- package/package.json +8 -7
- package/public/assets/{MessageBubble-BWLqMGKG.js → MessageBubble-Bq9kr21N.js} +2 -2
- package/public/assets/{PlanGraphPanel-3TlIQpjk.js → PlanGraphPanel-Dqiroy06.js} +2 -2
- package/public/assets/{TraceView-Wimm0Czv.js → TraceView-DYU962-H.js} +2 -2
- package/public/assets/{VaultDecisionCard-Bau_vNax.js → VaultDecisionCard-DhPfzioE.js} +2 -2
- package/public/assets/{activity-CrSurn-r.js → activity-DzCcQTee.js} +2 -2
- package/public/assets/{agent-lineage-CknAJKcb.js → agent-lineage-SgDt9i3T.js} +2 -2
- package/public/assets/agent-liveness-Bq-s73jW.js +2 -0
- package/public/assets/{agent-name-DKbiIhBo.js → agent-name-CcY3Aijy.js} +2 -2
- package/public/assets/{agent-profiles-DwF6EQ4R.js → agent-profiles-cxtRBn6O.js} +2 -2
- package/public/assets/{agent-project-badge-Diz4Sjjb.js → agent-project-badge-DGYbIhaI.js} +2 -2
- package/public/assets/{agent-tools-CRhpRQza.js → agent-tools-DHbftV0N.js} +2 -2
- package/public/assets/{agent-type-icon-LrUEU3lB.js → agent-type-icon-CY113sp-.js} +2 -2
- package/public/assets/{agents-B-v66C-4.js → agents-BPzY7IlQ.js} +2 -2
- package/public/assets/{analytics-BqCb-LKi.js → analytics-DENFPv_a.js} +2 -2
- package/public/assets/{artifact-viewer-kf4pGuAR.js → artifact-viewer-KRvSc7sl.js} +2 -2
- package/public/assets/{artifacts-DJevXcvg.js → artifacts-C9gSmL3s.js} +2 -2
- package/public/assets/{artifacts-D32zyw4Y.js → artifacts-DT-HkI5O.js} +2 -2
- package/public/assets/{automation-BpRajx_5.js → automation-BsmjQhKD.js} +2 -2
- package/public/assets/{backlog-D_UjTdzX.js → backlog-8NYH_62t.js} +2 -2
- package/public/assets/{busy-health-N3VEh4ao.js → busy-health-D3hwvYb4.js} +2 -2
- package/public/assets/{channels-9jopungq.js → channels-DCJ5WL7O.js} +2 -2
- package/public/assets/{chat-CSXrTB3C.js → chat-DAIl357U.js} +3 -3
- package/public/assets/{code-preview-p1NnmqK0.js → code-preview-CzrZfr9U.js} +2 -2
- package/public/assets/{connectors-CZdqlDNL.js → connectors-xTxtlyou.js} +2 -2
- package/public/assets/{cosmos-BgdsE4dG.js → cosmos-BpebFLK2.js} +2 -2
- package/public/assets/{crate-agent-30aXTKva.js → crate-agent-BHvI5wXC.js} +2 -2
- package/public/assets/{dependency-graph-B_jvw2GE.js → dependency-graph-DGT0o3wJ.js} +2 -2
- package/public/assets/{deploys-DoN6bAb5.js → deploys-hqWOHSHE.js} +2 -2
- package/public/assets/{display-BrKWFGJz.js → display-CDeH4I8T.js} +2 -2
- package/public/assets/{files-D6XEu8Ng.js → files-BTeGVmTg.js} +2 -2
- package/public/assets/{fleet-C7jQWbw2.js → fleet-DgXtNgCa.js} +2 -2
- package/public/assets/{fleet-metrics-BiDs3MLx.js → fleet-metrics-BHEt5yc_.js} +2 -2
- package/public/assets/{formatted-body-CQBwc1fb.js → formatted-body-MLtodyPp.js} +3 -3
- package/public/assets/{formatted-body-impl-DyG0WsQS.js → formatted-body-impl-CAe664Z8.js} +2 -2
- package/public/assets/{host-providers-dialog-DKaW31dN.js → host-providers-dialog-mapF4Fj9.js} +2 -2
- package/public/assets/{index-CRHep3M9.js → index-CqqgOI5R.js} +5 -5
- package/public/assets/{insights-CzrtkpOE.js → insights-DNyf7IzF.js} +2 -2
- package/public/assets/{integrations-aVsUmigt.js → integrations-DlYOHq7T.js} +2 -2
- package/public/assets/{issue-ref-chip-BnSlM_95.js → issue-ref-chip-CeWBNWn7.js} +2 -2
- package/public/assets/{log-viewer-qe7Ee47Z.js → log-viewer-Cib8nqdE.js} +2 -2
- package/public/assets/{maintenance-NfjqFZAk.js → maintenance-DSn1cPm7.js} +2 -2
- package/public/assets/{managed-agents-BiH0HgaE.js → managed-agents-C3CkM81m.js} +2 -2
- package/public/assets/{markdown-preview-BixaT3Xr.js → markdown-preview-W4VQQPAv.js} +3 -3
- package/public/assets/{markdown-preview-impl-DNGlWIS3.js → markdown-preview-impl-CMsTdhjq.js} +2 -2
- package/public/assets/{memory-DNsCl6UX.js → memory-BV17qtO4.js} +2 -2
- package/public/assets/{messages-DopU1L1X.js → messages-Bm_1AqSA.js} +2 -2
- package/public/assets/{orchestrators-Cq7ckLQT.js → orchestrators-Dg-vfP09.js} +2 -2
- package/public/assets/{overview-C1DCTzzV.js → overview-DcYCrvlr.js} +2 -2
- package/public/assets/{pairs-DE_m6rrE.js → pairs-8o9nuG3V.js} +2 -2
- package/public/assets/{profile-icon-B3rfh77F.js → profile-icon-BsRyBMea.js} +2 -2
- package/public/assets/{project-profile-instructions-DQWZE0kA.js → project-profile-instructions-DETKFn_E.js} +2 -2
- package/public/assets/{projects-Br2Bd2h1.js → projects-M_m6AHws.js} +2 -2
- package/public/assets/{prompt-settings-BKvFsvGD.js → prompt-settings-C_mNCgeL.js} +2 -2
- package/public/assets/provider-display-BEeLXC_D.js +2 -0
- package/public/assets/{registry-Cw38_6gW.js → registry-DDHHHE5N.js} +2 -2
- package/public/assets/run-card-Dt4I4jaP.js +2 -0
- package/public/assets/{secrets-DxI-vzSq.js → secrets-BkVwxI5O.js} +2 -2
- package/public/assets/{service-access-settings-D9s_VJbd.js → service-access-settings-Crq-6a-B.js} +2 -2
- package/public/assets/{settings-CKZTVGIx.js → settings-CYcavMFu.js} +2 -2
- package/public/assets/shipping-H6gzEeZB.js +2 -0
- package/public/assets/{stats-DyUBKyWI.js → stats-BJVeWkpV.js} +2 -2
- package/public/assets/{status-dot-DYqlEUhJ.js → status-dot-BcHyw1Vw.js} +2 -2
- package/public/assets/store-DKPDIZBe.js +9 -0
- package/public/assets/{tasks-Bh7Chr4-.js → tasks-qJjlQPpx.js} +2 -2
- package/public/assets/{teams-bowI7qVY.js → teams-Cd5Sk1uX.js} +2 -2
- package/public/assets/{terminal-viewer-BgVLHdsU.js → terminal-viewer-CpY5_m7W.js} +3 -3
- package/public/assets/{terminal-viewer-impl-Dz22UPy6.js → terminal-viewer-impl-DI_2llFR.js} +2 -2
- package/public/assets/{use-agent-terminal-DSQQ-iY7.js → use-agent-terminal-0yJA_buM.js} +2 -2
- package/public/assets/{use-decisions-samMQhQf.js → use-decisions-uJXHf34W.js} +2 -2
- package/public/assets/{use-project-list-59LheVP7.js → use-project-list-CpWl6eHQ.js} +2 -2
- package/public/assets/{use-selectors-BZa25xEB.js → use-selectors-BdxBW8mL.js} +2 -2
- package/public/assets/{user-avatar-DHxlvUvV.js → user-avatar-3IndfpOc.js} +2 -2
- package/public/assets/{versioned-prompt-editor-BmED5DnJ.js → versioned-prompt-editor-CIVg7XB1.js} +2 -2
- package/public/assets/{work-queue-CSvpuNLz.js → work-queue-B9rnLwHZ.js} +2 -2
- package/public/assets/{workflow-marker-DAZcj5qt.js → workflow-marker-X8wxyhzC.js} +2 -2
- package/public/assets/{workflows-DdmxRSyg.js → workflows-o5YyMFW7.js} +2 -2
- package/public/assets/{workspaces-BxeKfVuF.js → workspaces-CzEGoAng.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +28 -28
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapters/claude-headless.ts +1 -1
- package/runner/src/adapters/claude-launch-exit.ts +26 -0
- package/runner/src/adapters/claude-session-probe.ts +1 -1
- package/runner/src/adapters/claude-tmux.ts +38 -10
- package/runner/src/adapters/claude.ts +28 -75
- package/runner/src/adapters/provider-quota-harvest.ts +20 -71
- package/runner/src/agent-runner/lifecycle-milestones.ts +2 -2
- package/runner/src/agent-runner/liveness-exchange.ts +104 -0
- package/runner/src/claude-system-prompt.ts +49 -0
- package/runner/src/launch-assembly.ts +14 -10
- package/runner/src/profile-home.ts +1 -1
- package/runner/src/project-instructions.ts +2 -2
- package/runner/src/provider-command.ts +18 -0
- package/runner/src/provider-setup.ts +2 -1
- package/runner/src/runner-core.ts +14 -15
- package/runner/src/runner-helpers.ts +0 -8
- package/runner/src/session-scratch.ts +6 -2
- package/runner/test-support/provisioning-context.ts +4 -2
- package/runner/test-support/runner-harness.ts +2 -1
- package/scripts/steward-policy-cleanup.ts +2 -2
- package/src/agent-authz.ts +2 -2
- package/src/agent-drive-arbiter.ts +3 -8
- package/src/agent-exit-cleanup-async.ts +2 -2
- package/src/agent-exit-cleanup.ts +23 -19
- package/src/agent-lifecycle-events.ts +112 -85
- package/src/agent-ref.ts +3 -2
- package/src/agent-status-events.ts +43 -14
- package/src/auth/password.ts +4 -3
- package/src/auth/session-refresh.ts +1 -1
- package/src/auth/session.test-fixture.ts +2 -2
- package/src/auth/session.ts +7 -7
- package/src/automations/crud.ts +8 -81
- package/src/automations/dispatch.ts +33 -58
- package/src/automations/index.ts +1 -1
- package/src/automations/persistence.ts +65 -0
- package/src/automations/precheck.ts +18 -16
- package/src/automations/read-async.ts +11 -0
- package/src/automations/reconcile.ts +30 -39
- package/src/automations/storage.ts +33 -10
- package/src/automations/write-async.ts +33 -0
- package/src/branch-land-notice.ts +3 -3
- package/src/branch-landed.ts +25 -23
- package/src/bus.ts +21 -19
- package/src/cd-deploy-notify.ts +2 -2
- package/src/ci/notifications.ts +4 -4
- package/src/ci/root-missing.ts +3 -3
- package/src/ci/transition-notify.ts +5 -5
- package/src/claude-app/oauth-http.ts +3 -3
- package/src/cli/workflow.ts +12 -3
- package/src/commands-db.ts +4 -4
- package/src/commands-write.ts +8 -0
- package/src/compaction-watch.ts +10 -8
- package/src/config-store-write.ts +2 -2
- package/src/config.ts +4 -11
- package/src/connectors.ts +10 -8
- package/src/context-advisory.ts +22 -21
- package/src/db/agent-action-write.ts +36 -0
- package/src/db/agent-control-async.ts +9 -0
- package/src/db/agent-control-write.ts +49 -0
- package/src/db/agent-effort-observe.ts +22 -0
- package/src/db/agent-meta.ts +14 -3
- package/src/db/agents-async.ts +8 -5
- package/src/db/agents.ts +15 -12
- package/src/db/auth-identities.ts +2 -2
- package/src/db/automation-read-ops.ts +11 -0
- package/src/db/automation-write-ops.ts +46 -0
- package/src/db/blackboard.ts +2 -2
- package/src/db/browser-session-write.ts +32 -0
- package/src/db/bus-outbox-write-ops.ts +3 -1
- package/src/db/checkout-refresh-schema.ts +47 -0
- package/src/db/checkout-refresh.ts +5 -5
- package/src/db/command-agent-profile-backfill.ts +39 -0
- package/src/db/command-agent-profiles.ts +5 -1
- package/src/db/command-retention.ts +126 -0
- package/src/db/commands-planner-stats.test-fixture.ts +8 -0
- package/src/db/commands-read-ops.ts +16 -0
- package/src/db/connection.ts +1 -182
- package/src/db/context-carry-write.ts +74 -0
- package/src/db/continuations.ts +4 -4
- package/src/db/db-error-registry.ts +12 -0
- package/src/db/gateway.ts +26 -133
- package/src/db/history-retention-ops.ts +13 -0
- package/src/db/inbox-async.ts +2 -2
- package/src/db/inbox-read-ops.ts +1 -1
- package/src/db/inbox.ts +9 -3
- package/src/db/issue-associations.ts +2 -2
- package/src/db/issue-refs-async.ts +4 -1
- package/src/db/issue-refs-read-ops.ts +6 -0
- package/src/db/issue-refs.ts +8 -8
- package/src/db/kernel-event-log-schema.ts +2 -0
- package/src/db/land-boundaries.ts +51 -5
- package/src/db/land-gate-attestations.ts +2 -2
- package/src/db/landing-receipts.ts +2 -2
- package/src/db/lifecycle-context-write.ts +5 -0
- package/src/db/lifecycle-tail-async.ts +76 -0
- package/src/db/lifecycle-tail-write-ops.ts +62 -0
- package/src/db/lifecycle-write-window.ts +2 -1
- package/src/db/lineage-pair-dedupe-sql.ts +3 -3
- package/src/db/main-connection-mode.ts +11 -0
- package/src/db/main-connection-writes.ts +20 -2
- package/src/db/maintenance-job-runs-async.ts +2 -2
- package/src/db/maintenance-job-write-ops.ts +1 -1
- package/src/db/maintenance-pauses.ts +2 -2
- package/src/db/message-send.ts +4 -0
- package/src/db/messages.ts +31 -25
- package/src/db/migrations.ts +18 -1
- package/src/db/notification-write-ops.ts +19 -0
- package/src/db/operator-answer-write.ts +19 -0
- package/src/db/orchestrators.ts +10 -4
- package/src/db/pairs-async.ts +22 -1
- package/src/db/pairs-write-ops.ts +8 -3
- package/src/db/pairs.ts +41 -48
- package/src/db/plan-dispatch-schema.ts +5 -1
- package/src/db/plan-ready-notices.ts +43 -0
- package/src/db/plan-tools-include-migration.ts +36 -0
- package/src/db/plans-write-ops.ts +2 -0
- package/src/db/presence-buffer.ts +5 -0
- package/src/db/presence-loop.ts +18 -23
- package/src/db/presence-write.ts +0 -6
- package/src/db/project-entries-async.ts +14 -0
- package/src/db/project-entries-read-ops.ts +5 -1
- package/src/db/project-entries-write-ops.ts +8 -0
- package/src/db/project-entries.ts +15 -12
- package/src/db/project-journal.ts +2 -2
- package/src/db/project-trust-approvals.ts +2 -2
- package/src/db/prompt-templates.ts +4 -4
- package/src/db/read-op-marshaling-fixtures.ts +18 -0
- package/src/db/read-ops.ts +4 -0
- package/src/db/retention.ts +13 -2
- package/src/db/review-publish-write.ts +8 -0
- package/src/db/runtime-admin-async.ts +19 -0
- package/src/db/runtime-admin-write-ops.ts +36 -0
- package/src/db/runtime-tail-async.ts +288 -0
- package/src/db/runtime-tail-write-ops.ts +97 -0
- package/src/db/schema.ts +4 -1
- package/src/db/spawn-budget.ts +5 -0
- package/src/db/spawn-delegation.ts +1 -11
- package/src/db/sql-audit-indexes.ts +3 -0
- package/src/db/stats-async.ts +5 -3
- package/src/db/task-entity.ts +5 -4
- package/src/db/team-claim-policy.ts +60 -0
- package/src/db/teams-async.ts +4 -0
- package/src/db/teams-write-ops.ts +4 -0
- package/src/db/terminal-events.ts +15 -0
- package/src/db/timer-cutover-bodies.ts +292 -0
- package/src/db/timer-cutover-core.ts +37 -278
- package/src/db/timer-cutover-state.ts +40 -0
- package/src/db/timer-cutover-write-ops.ts +1 -40
- package/src/db/token-db-write-ops.ts +2 -0
- package/src/db/token-standing-async.ts +12 -0
- package/src/db/token-standing.ts +6 -9
- package/src/db/token-usage-retention.ts +33 -0
- package/src/db/token-usage-write-ops.ts +1 -1
- package/src/db/token-usage.ts +4 -1
- package/src/db/user-invites-async.ts +13 -0
- package/src/db/user-invites.ts +3 -3
- package/src/db/users.ts +14 -6
- package/src/db/workspaces.ts +8 -5
- package/src/db/write-ops.ts +31 -12
- package/src/db/writer-fault-seam.ts +2 -9
- package/src/db/writer-fault-test-ops.ts +18 -0
- package/src/db/writer-gateway.ts +42 -46
- package/src/dev.ts +8 -3
- package/src/event-loop-lag.ts +4 -2
- package/src/event-loop-yield.ts +2 -2
- package/src/events.ts +10 -8
- package/src/host-provider-store.ts +5 -4
- package/src/hub-metrics-report.ts +5 -1
- package/src/hub-metrics.ts +38 -18
- package/src/injection-sweep-pacing.ts +6 -8
- package/src/land-gate-notifications.ts +11 -10
- package/src/land-gate-queue-progress.ts +3 -3
- package/src/land-settle-dispatch.ts +52 -92
- package/src/lifecycle-context-pressure.ts +11 -10
- package/src/lifecycle-manager.ts +104 -98
- package/src/maintenance/breaker.ts +18 -16
- package/src/maintenance/checkout-refresh.ts +18 -1
- package/src/maintenance/critical-job-watchdog.ts +3 -3
- package/src/maintenance/events.ts +3 -3
- package/src/maintenance/history-retention-job.ts +30 -0
- package/src/maintenance/jobs.ts +29 -67
- package/src/maintenance/long-running-work.ts +3 -1
- package/src/maintenance/offline-agent-prune-job.ts +28 -0
- package/src/maintenance/orphaned-sessions.ts +5 -4
- package/src/maintenance/pauses.ts +4 -10
- package/src/maintenance/plan-ready-notice-job.ts +71 -0
- package/src/maintenance/scheduler.ts +18 -13
- package/src/maintenance/stalled-delivery-pager.ts +4 -4
- package/src/maintenance/teams.ts +19 -30
- package/src/maintenance/workspaces.ts +17 -27
- package/src/managed-policy-escalation.ts +7 -7
- package/src/managed-policy.ts +3 -3
- package/src/managed-provider-gate.ts +5 -4
- package/src/managed-spawn-reservation.ts +5 -4
- package/src/mcp/index.ts +8 -8
- package/src/mcp/output-descriptions.ts +1 -1
- package/src/mcp/presentation.ts +2 -1
- package/src/mcp/runtime-output.ts +6 -1
- package/src/mcp/self-care-visibility.ts +2 -2
- package/src/mcp/spawn-targets-matrix.ts +10 -1
- package/src/mcp/tool-groups.ts +3 -2
- package/src/mcp/tool-roles.ts +81 -0
- package/src/mcp/tools-workspace.ts +1 -1
- package/src/mcp-blackboard-tools.ts +6 -5
- package/src/mcp-decision-tools.ts +7 -7
- package/src/mcp-egress-tools.ts +10 -9
- package/src/mcp-issue-activity-tools.ts +2 -2
- package/src/mcp-issue-association-tools.ts +4 -4
- package/src/mcp-issue-ref-tools.ts +3 -3
- package/src/mcp-merge-tools.ts +5 -5
- package/src/mcp-notification-subscription-tools.ts +14 -15
- package/src/mcp-output-levels.test-fixture.ts +1 -1
- package/src/mcp-profile-trust-tools.ts +1 -1
- package/src/mcp-project-journal-tools.ts +4 -12
- package/src/mcp-project-tools.ts +17 -18
- package/src/mcp-routing-policy-tools.ts +3 -2
- package/src/mcp-team-tools.ts +6 -6
- package/src/mcp-workflow-tools.ts +5 -3
- package/src/memory-area-injection.ts +13 -12
- package/src/memory-boundary-capture.ts +6 -6
- package/src/memory-injection.ts +45 -43
- package/src/merge-pause-maintenance.ts +5 -4
- package/src/notification-router.ts +44 -17
- package/src/notify.ts +5 -5
- package/src/observed-reset-refresh.ts +4 -4
- package/src/operator-alarm.ts +2 -5
- package/src/project-ingest.ts +6 -6
- package/src/project-instructions.ts +8 -1
- package/src/project-trust.ts +12 -11
- package/src/prompt-resolver.ts +3 -3
- package/src/provider-quota-async.ts +5 -7
- package/src/provider-timeline-event.ts +4 -7
- package/src/quota-band-delivery.ts +2 -2
- package/src/recipe-runner.ts +4 -3
- package/src/retention-config-store.ts +4 -3
- package/src/reviewer-pipeline.ts +11 -10
- package/src/routes/_route.ts +4 -4
- package/src/routes/_shared.ts +13 -12
- package/src/routes/agent-effort.ts +5 -5
- package/src/routes/agent-heartbeat-quota.ts +23 -0
- package/src/routes/agent-keep.ts +1 -1
- package/src/routes/agent-reporting.ts +1 -1
- package/src/routes/agent-self-effort.ts +5 -5
- package/src/routes/agent-sessions.ts +24 -24
- package/src/routes/agents-spawn.ts +1 -1
- package/src/routes/agents.ts +17 -119
- package/src/routes/auth.ts +14 -15
- package/src/routes/authority-audit.ts +2 -2
- package/src/routes/automations.ts +6 -5
- package/src/routes/channel-binding-delete.ts +1 -1
- package/src/routes/channel-output.ts +3 -3
- package/src/routes/claude-api-budget.ts +5 -5
- package/src/routes/commands-listing.ts +1 -1
- package/src/routes/commands.ts +29 -27
- package/src/routes/context-resets.ts +2 -2
- package/src/routes/coordinator-teams.ts +1 -1
- package/src/routes/decisions.ts +2 -2
- package/src/routes/host-secret-files.ts +1 -1
- package/src/routes/hosts.ts +11 -11
- package/src/routes/inbox.ts +3 -2
- package/src/routes/index.ts +2 -1
- package/src/routes/integrations.ts +9 -7
- package/src/routes/issue-activity.ts +2 -2
- package/src/routes/issue-associations.ts +4 -4
- package/src/routes/issue-refs.ts +3 -3
- package/src/routes/kernel-timers-operator.ts +1 -1
- package/src/routes/memory.ts +1 -1
- package/src/routes/merges.ts +11 -11
- package/src/routes/messages.ts +23 -17
- package/src/routes/orchestrator-bootstrap.ts +1 -1
- package/src/routes/orchestrator-host-registration.ts +2 -0
- package/src/routes/orchestrator-host-utilization.ts +2 -2
- package/src/routes/orchestrator-proxy.ts +2 -2
- package/src/routes/orchestrator.ts +27 -18
- package/src/routes/pairs.ts +8 -8
- package/src/routes/project-profile-instructions.ts +1 -1
- package/src/routes/project-trust.ts +1 -1
- package/src/routes/projects.ts +16 -16
- package/src/routes/prompt-templates.ts +12 -12
- package/src/routes/provider-quotas.ts +10 -10
- package/src/routes/run-command.ts +1 -1
- package/src/routes/secrets-backup.ts +2 -2
- package/src/routes/secrets-import.ts +1 -1
- package/src/routes/secrets-vault.ts +7 -7
- package/src/routes/settings.ts +1 -1
- package/src/routes/shipping.ts +9 -1
- package/src/routes/spawn-policy.ts +8 -7
- package/src/routes/sse.ts +2 -2
- package/src/routes/team-templates.ts +7 -7
- package/src/routes/teams.ts +10 -10
- package/src/routes/tokens.ts +18 -17
- package/src/routes/users.ts +24 -24
- package/src/routes/viewer-read.ts +3 -3
- package/src/routes/web-tool-calls.ts +4 -4
- package/src/routes/workflows.ts +2 -2
- package/src/routes/workspaces.ts +17 -16
- package/src/routing-policy-push.ts +6 -6
- package/src/runtime-grant.ts +17 -11
- package/src/runtime-tokens.ts +20 -28
- package/src/secrets-broker/config.ts +1 -1
- package/src/secrets-broker/service.ts +2 -2
- package/src/security.ts +3 -1
- package/src/self-resume-carry.ts +21 -110
- package/src/self-resume-supersede.ts +4 -3
- package/src/self-resume.ts +54 -66
- package/src/server-background.ts +1 -1
- package/src/server.ts +21 -22
- package/src/services/agent-action.ts +12 -31
- package/src/services/agent-effort.ts +7 -32
- package/src/services/agent-hang-watchdog-job.ts +2 -2
- package/src/services/agent-heartbeat.ts +166 -0
- package/src/services/agent-reporting.ts +1 -1
- package/src/services/browser-inventory.ts +3 -3
- package/src/services/browser-session-state.ts +3 -2
- package/src/services/browser-session.ts +21 -27
- package/src/services/bus-command-update.ts +9 -9
- package/src/services/checkout-refresh-state.ts +1 -0
- package/src/services/checkout-refresh.test-fixture.ts +3 -2
- package/src/services/command-host.ts +7 -2
- package/src/services/coordinator-digest.ts +3 -2
- package/src/services/dispatch-command.ts +12 -13
- package/src/services/effective-launch-driver.ts +14 -9
- package/src/services/host-changed-paths.test-fixture.ts +5 -6
- package/src/services/host-project-readiness.ts +2 -2
- package/src/services/host-providers.ts +1 -1
- package/src/services/host-utilization.ts +9 -9
- package/src/services/idle-agent-digest.ts +17 -12
- package/src/services/idle-epics.ts +4 -4
- package/src/services/interrupt-agent.ts +12 -9
- package/src/services/issue-activity.ts +3 -3
- package/src/services/issue-associations.ts +15 -18
- package/src/services/issue-lifecycle-comments.ts +3 -2
- package/src/services/issue-lifecycle.ts +14 -13
- package/src/services/issue-refs.ts +4 -5
- package/src/services/kernel-timers-cutover-chaos-worker.ts +1 -1
- package/src/services/kernel-timers-ingress-chaos-worker.ts +6 -1
- package/src/services/kernel-timers-ingress.ts +3 -3
- package/src/services/kernel-timers-message-authority-chaos-worker.ts +3 -10
- package/src/services/kernel-timers-operator-chaos-worker.ts +3 -2
- package/src/services/kernel-timers-outbox.ts +1 -1
- package/src/services/kernel-timers-stage10-operator.ts +1 -1
- package/src/services/kernel-timers.ts +4 -3
- package/src/services/land-gate-placement.ts +11 -2
- package/src/services/land-issue-relations.ts +5 -4
- package/src/services/land-restart-retry.ts +7 -6
- package/src/services/landed-ancestry.ts +6 -5
- package/src/services/legacy-landing-host.ts +4 -1
- package/src/services/legacy-landing-recovery.ts +8 -6
- package/src/services/managed-running.ts +17 -17
- package/src/services/memory-areas.ts +3 -3
- package/src/services/merge-pause.ts +9 -15
- package/src/services/operator-decisions.ts +37 -41
- package/src/services/orchestrator-registration-recovery.ts +6 -2
- package/src/services/orchestrator-upgrade.ts +14 -12
- package/src/services/permission-decision.ts +4 -3
- package/src/services/plan-ci-notice.ts +1 -1
- package/src/services/plan-conformance.ts +4 -4
- package/src/services/plan-dispatch-policy.ts +10 -3
- package/src/services/plan-dispatch.ts +35 -14
- package/src/services/plan-graph.ts +39 -261
- package/src/services/plan-import.ts +1 -1
- package/src/services/plan-live-bindings.ts +8 -37
- package/src/services/plan-task-create.ts +1 -1
- package/src/services/plan-terminal-refs.ts +2 -12
- package/src/services/plan-wake-digest.ts +8 -3
- package/src/services/profile-trust.ts +2 -2
- package/src/services/project.ts +11 -10
- package/src/services/prompt-templates.ts +6 -5
- package/src/services/provider-hold-nudge.ts +9 -9
- package/src/services/provider-hold-record.ts +13 -12
- package/src/services/provider-state-audit.ts +19 -18
- package/src/services/provisioning-harness/driver.ts +1 -1
- package/src/services/provisioning-harness/fixture-matrix.ts +3 -3
- package/src/services/provisioning-harness/lifecycle.ts +24 -22
- package/src/services/provisioning-harness/prepare.ts +16 -17
- package/src/services/rate-limit-resume.ts +10 -9
- package/src/services/red-main-auto-revert.ts +7 -5
- package/src/services/red-main-controller-deps.ts +20 -3
- package/src/services/red-main-incident.ts +3 -1
- package/src/services/red-main-quarantine.ts +2 -3
- package/src/services/register-agent.ts +22 -22
- package/src/services/restart-project-role.ts +1 -1
- package/src/services/restart-spawn.ts +17 -16
- package/src/services/review-publish.ts +7 -24
- package/src/services/review-ref-reconcile.ts +29 -38
- package/src/services/runtime-dependency-alert.ts +27 -0
- package/src/services/scheduler-command.ts +11 -9
- package/src/services/scheduler.ts +5 -5
- package/src/services/self-effort-grant.ts +5 -25
- package/src/services/send-message.ts +16 -33
- package/src/services/shutdown-agent.ts +17 -14
- package/src/services/spawn-agent.ts +12 -41
- package/src/services/spawn-chain-inspector.ts +1 -1
- package/src/services/spawn-cwd-placement.ts +21 -5
- package/src/services/spawn-issue-activity.ts +8 -6
- package/src/services/spawn-launch.ts +17 -1
- package/src/services/spawn-loss-escalation.ts +1 -1
- package/src/services/spawn-registration-watchdog.ts +2 -2
- package/src/services/spawn-repo-probe.ts +7 -5
- package/src/services/spawn-tree-cleanup.ts +7 -8
- package/src/services/steward-reaper.ts +4 -4
- package/src/services/task-context-hydration.ts +25 -1
- package/src/services/task-delivery.ts +20 -34
- package/src/services/task-entity.ts +40 -203
- package/src/services/task-issue-link.ts +13 -20
- package/src/services/task-issue-weave.ts +12 -11
- package/src/services/task-lifecycle.ts +27 -31
- package/src/services/task-repo-cwd.ts +37 -0
- package/src/services/task-review-hold.ts +4 -17
- package/src/services/task-semantic-events.ts +13 -11
- package/src/services/task-state-reconcile.ts +3 -4
- package/src/services/task-validation.ts +2 -2
- package/src/services/team-templates.ts +5 -5
- package/src/services/team.ts +31 -98
- package/src/services/terminal-provider-exit.ts +6 -5
- package/src/services/timer-message-fire-chaos-worker.ts +7 -3
- package/src/services/timer-message-fire-outbox.ts +1 -1
- package/src/services/transient-agent-reaper.ts +22 -19
- package/src/services/turn-reconcile-audit.ts +9 -9
- package/src/services/user-onboarding.ts +8 -6
- package/src/services/user-profile.ts +6 -9
- package/src/services/work-finality.ts +16 -4
- package/src/services/workflow-auto-start.ts +2 -1
- package/src/services/workflow-caller.ts +61 -4
- package/src/services/workflow-child-proof-worker.ts +1 -1
- package/src/services/workflow-control-proof-worker.ts +1 -1
- package/src/services/workflow-coordinator.ts +8 -2
- package/src/services/workflow-decisions.ts +5 -5
- package/src/services/workflow-deferred-cleanup.ts +1 -1
- package/src/services/workflow-effect-driver.ts +42 -19
- package/src/services/workflow-effects.ts +41 -27
- package/src/services/workflow-pins.ts +7 -4
- package/src/services/workflow-reconcile.ts +1 -0
- package/src/services/workflow-resume-pins.ts +3 -3
- package/src/services/workflow-routing-defaults.ts +18 -0
- package/src/services/workflow-run-view.ts +4 -3
- package/src/services/workflow-run.test-fixture.ts +1 -1
- package/src/services/workflow-runs.ts +34 -22
- package/src/services/workflow-supervisor-state.ts +21 -1
- package/src/services/workflow-supervisor.ts +4 -3
- package/src/services/workspace-recovery.ts +4 -3
- package/src/spawn-admission.ts +10 -2
- package/src/spawn-placement.ts +27 -9
- package/src/spawn-targets.ts +8 -8
- package/src/sse-agent-status.ts +15 -6
- package/src/sse.ts +49 -24
- package/src/startup-context-injection.ts +61 -57
- package/src/steward-handoff.ts +4 -3
- package/src/steward-policy-cleanup.ts +9 -8
- package/src/steward.ts +2 -2
- package/src/task-dispatch-live.ts +5 -2
- package/src/task-dispatcher.ts +2 -2
- package/src/token-db.ts +2 -2
- package/src/token-usage-async.ts +2 -4
- package/src/user-awaiting-reply.ts +5 -5
- package/src/workspace-actions.ts +24 -29
- package/src/workspace-auto-merge.ts +14 -12
- package/src/workspace-changed-paths-client.ts +16 -5
- package/src/workspace-cleanup-stale.ts +30 -7
- package/src/workspace-command-settle.ts +24 -16
- package/src/workspace-config.ts +1 -1
- package/src/workspace-conflict-resolver.ts +9 -7
- package/src/workspace-dead-owner-recovery.ts +5 -4
- package/src/workspace-escalation.ts +12 -11
- package/src/workspace-human-escalation.ts +3 -3
- package/src/workspace-land-gate-watchdog.ts +3 -3
- package/src/workspace-land-refusal.ts +20 -0
- package/src/workspace-land-stopped.ts +1 -0
- package/src/workspace-merge.ts +10 -26
- package/src/workspace-nothing-to-land-notice.ts +2 -2
- package/src/workspace-orphans.ts +18 -37
- package/src/workspace-pr-completion.ts +10 -8
- package/src/workspace-rekey.ts +3 -3
- package/src/workspace-steward-failure.ts +2 -2
- package/src/workspace-steward-wake.ts +2 -2
- package/public/assets/agent-liveness-CaNwK0Zf.js +0 -2
- package/public/assets/provider-display-DsuWMvVL.js +0 -2
- package/public/assets/run-card-CpKqRbhg.js +0 -2
- package/public/assets/shipping-B9YtnwtG.js +0 -2
- package/public/assets/store-DcClXLH0.js +0 -9
- package/runner/src/agent-runner/http-liveness.ts +0 -85
- package/src/db/on-loop-write-transaction.ts +0 -34
|
@@ -1,2 +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}from"./provider-display-DsuWMvVL.js";import{et as a}from"./display-BrKWFGJz.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./switch-DuCA7mrB.js";import{t as c}from"./lightbulb-RDhZ4p-D.js";import{t as l}from"./refresh-cw-CfpvQcUn.js";import{t as u}from"./button-Do6Z3vvn.js";import{t as d}from"./badge-DqJRtj_p.js";import{t as f}from"./input-CsTB6jIx.js";import{o as p,r as m,s as h,t as g}from"./card-C4QJ4hCW.js";var _=e(t(),1),v=n(),y={rounds:`Held deliveries per Task until GO (hold cleared); re-delivery without another review still counts as a round.`,review:`Elapsed time from the first held delivery to GO (hold cleared), for Tasks approved in the range.`,cycle:`Elapsed time from Task creation to its first landed-on-main event, for Tasks first landed in the range.`,gates:`Failed delivery/recorded gates; land-gate failures not included yet. Counts recorded failures up to first landing per Task landed in the range.`};function b(e){return e==null?`—`:e.toLocaleString(void 0,{maximumFractionDigits:2})}function x(e){return e==null?`—`:e>=864e5?`${b(e/864e5)}d`:e>=36e5?`${b(e/36e5)}h`:`${b(e/6e4)}m`}function S({stats:e}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`td`,{className:`p-2`,children:[b(e.reviewRounds?.avg),` / `,b(e.reviewRounds?.median),` / `,b(e.reviewRounds?.max)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[x(e.reviewTimeMs?.median),` / `,x(e.reviewTimeMs?.p90)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[x(e.cycleTimeMs?.median),` / `,x(e.cycleTimeMs?.p90)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[b(e.gateFailures?.perLandedTask),` (`,b(e.gateFailures?.total),` total)`]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[e.reviewedTasks,` / `,e.landedTasks]})]})}function C(){let e=r(e=>e.connected),t=r(e=>e.openTaskDetailById),[n,i]=(0,_.useState)(30),[a,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(null),f=`${n}:${a}:${c}`,b=u?.key===f?u.data:void 0,x=u?.key===f?u.error:void 0;(0,_.useEffect)(()=>{if(!e)return;let t=!1;return o(`GET`,`/metrics/delivery-quality?windowDays=${n}${a?`&projectId=${encodeURIComponent(a)}`:``}`).then(e=>{t||d({key:f,data:e})}).catch(e=>{t||d({key:f,error:e instanceof Error?e.message:`Request failed`})}),()=>{t=!0}},[e,n,a,c,f]);let C=(b?.tasks??[]).filter(e=>e.reviewRounds!=null&&(e.awaitingGo||e.goAt!=null&&e.goAt>=b.since&&e.goAt<=b.until));return(0,v.jsxs)(g,{children:[(0,v.jsxs)(p,{children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{children:`Delivery quality`}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs`,children:[(0,v.jsxs)(`select`,{"aria-label":`Delivery quality project`,className:`bg-background border rounded p-1`,value:a,onChange:e=>s(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`All projects`}),(u?.data?.projects??[]).map(e=>(0,v.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,v.jsx)(`select`,{"aria-label":`Delivery quality time range`,className:`bg-background border rounded p-1`,value:n,onChange:e=>i(Number(e.target.value)),children:[7,30,90,365].map(e=>(0,v.jsxs)(`option`,{value:e,children:[`Last `,e,` days`]},e))}),(0,v.jsx)(`button`,{className:`border rounded px-2`,onClick:()=>l(e=>e+1),children:`Reload delivery quality`})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reviews are grouped by GO date; land metrics by first landing date. Weeks start Monday (UTC). Pending reviews appear below and are excluded from GO statistics.`})]}),(0,v.jsx)(m,{className:`space-y-4`,children:x?(0,v.jsxs)(`p`,{role:`alert`,children:[`Could not load delivery quality: `,x]}):b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`overflow-x-auto`,children:(0,v.jsxs)(`table`,{className:`w-full text-xs tabular-nums text-left`,children:[(0,v.jsx)(`caption`,{className:`text-left pb-2 text-muted-foreground`,children:`Range totals and weekly trend — “—” means no samples.`}),(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{className:`border-b`,children:[(0,v.jsx)(`th`,{className:`p-2`,children:`Period`}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.rounds,tabIndex:0,children:[`Review rounds to GO`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`avg / median / max`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.review,tabIndex:0,children:[`Review time`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`median / p90`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.cycle,tabIndex:0,children:[`Cycle time`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`median / p90`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.gates,tabIndex:0,children:[`Gate failures`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`per landed Task`})]}),(0,v.jsxs)(`th`,{className:`p-2`,children:[`Samples`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`GO / landed`})]})]})}),(0,v.jsxs)(`tbody`,{children:[(0,v.jsxs)(`tr`,{className:`border-b font-medium`,children:[(0,v.jsx)(`th`,{className:`p-2`,children:`Selected range`}),(0,v.jsx)(S,{stats:b.summary})]}),b.weeks.map(e=>(0,v.jsxs)(`tr`,{className:`border-b border-border/40`,children:[(0,v.jsxs)(`th`,{className:`p-2 font-normal`,children:[`Week of `,new Date(e.start).toISOString().slice(0,10)]}),(0,v.jsx)(S,{stats:e.summary})]},e.start))]})]})}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium`,children:`Most review rounds`}),C.length===0?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No held deliveries in this range.`}):(0,v.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs`,children:C.map(e=>(0,v.jsxs)(`li`,{children:[(0,v.jsxs)(`button`,{className:`text-primary hover:underline text-left`,onClick:()=>t(e.taskId),children:[`T`,e.taskId,`: `,e.title]}),` — `,e.reviewRounds,` rounds`,e.awaitingGo?` · awaiting GO`:``]},e.taskId))})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b.growthUnavailableReason})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e?`Loading delivery quality…`:`Connect to load delivery quality.`})})]})}var w={enabled:!0,contextRatio:{enabled:!0},introspection:{enabled:!0,minTurns:4,minContextRemaining:.15}};function T(e){return!e||Object.keys(e).length===0?`—`:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`number`?Math.round(t*1e3)/1e3:String(t)}`).join(` `)}function E(){let[e,t]=(0,_.useState)(w),[n,r]=(0,_.useState)(0),[y,b]=(0,_.useState)([]),[x,S]=(0,_.useState)([]),[E,D]=(0,_.useState)([]),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(()=>Date.now());async function R(){F(null);try{let e=new URLSearchParams;O&&e.set(`project`,O),A&&e.set(`signal`,A);let n=e.toString(),[i,a]=await Promise.all([o(`GET`,`/insights/config`),o(`GET`,`/insights/observations${n?`?${n}`:``}`)]);t(i.value),r(i.version),b(a.observations),S(a.stats),D(a.projects),L(Date.now())}catch(e){F(i(e))}}(0,_.useEffect)(()=>{R()},[O,A]);async function z(n){N(!0),F(null);let a=e;t(n);try{let e=await o(`PUT`,`/insights/config`,{value:n,updatedBy:`dashboard`});t(e.value),r(e.version)}catch(e){t(a),F(i(e))}finally{N(!1)}}let B=(0,_.useMemo)(()=>[...new Set(x.map(e=>e.signal))].sort(),[x]),V=(0,_.useMemo)(()=>x.filter(e=>e.project===null),[x]),H=(0,_.useMemo)(()=>x.filter(e=>e.project!==null),[x]);return(0,v.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(c,{className:`size-5 text-primary`}),(0,v.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Insights`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`continuous self-improvement`})]}),(0,v.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>void R(),children:[(0,v.jsx)(l,{className:`size-4`}),` Refresh`]})]}),P&&(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:P}),(0,v.jsx)(C,{}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsxs)(h,{className:`flex items-center justify-between`,children:[(0,v.jsx)(`span`,{children:`Features`}),(0,v.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`config v`,n,` · saved by `,e&&`dashboard`]})]})}),(0,v.jsxs)(m,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`Insights enabled`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Master switch. When off, no signals are recorded regardless of the toggles below.`})]}),(0,v.jsx)(s,{checked:e.enabled,disabled:M,onCheckedChange:t=>void z({...e,enabled:t})})]}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border pt-3`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`Context-gathering ratio`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Server-side: read/search vs. action before first substantive move, per session.`})]}),(0,v.jsx)(s,{checked:e.contextRatio.enabled,disabled:M||!e.enabled,onCheckedChange:t=>void z({...e,contextRatio:{enabled:t}})})]}),(0,v.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`End-of-session introspection`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Agent-authored 3-field artifact at session end. Gated below.`})]}),(0,v.jsx)(s,{checked:e.introspection.enabled,disabled:M||!e.enabled,onCheckedChange:t=>void z({...e,introspection:{...e.introspection,enabled:t}})})]}),(0,v.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-4`,children:[(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[`min turns`,(0,v.jsx)(f,{type:`number`,className:`h-7 w-20`,value:e.introspection.minTurns,disabled:M||!e.enabled||!e.introspection.enabled,onChange:n=>t({...e,introspection:{...e.introspection,minTurns:Number(n.target.value)}}),onBlur:()=>void z(e)})]}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[`min context remaining (0–1)`,(0,v.jsx)(f,{type:`number`,step:`0.05`,min:`0`,max:`1`,className:`h-7 w-24`,value:e.introspection.minContextRemaining,disabled:M||!e.enabled||!e.introspection.enabled,onChange:n=>t({...e,introspection:{...e.introspection,minContextRemaining:Number(n.target.value)}}),onBlur:()=>void z(e)})]})]})]})]})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsx)(h,{children:`Signals`})}),(0,v.jsx)(m,{children:V.length===0?(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No observations yet — they appear after sessions end with Insights enabled.`}):(0,v.jsx)(`div`,{className:`space-y-4`,children:V.map(e=>(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,v.jsx)(d,{variant:`secondary`,children:e.signal}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.count,` obs · `,e.avgRatio===null?`no ratio`:`avg ratio ${e.avgRatio.toFixed(2)}`,` · `,a(I,e.lastAt)]})]}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2 pl-2`,children:H.filter(t=>t.signal===e.signal).map(t=>(0,v.jsxs)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:[t.project,`: `,t.count,t.avgRatio===null?``:` · ${t.avgRatio.toFixed(2)}`]},`${e.signal}-${t.project}`))})]},e.signal))})})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsxs)(h,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsx)(`span`,{children:`Observations`}),(0,v.jsxs)(`select`,{className:`h-7 rounded border border-border bg-background px-2 text-xs`,value:O,onChange:e=>k(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`all projects`}),E.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{className:`h-7 rounded border border-border bg-background px-2 text-xs`,value:A,onChange:e=>j(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`all signals`}),B.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]})]})}),(0,v.jsx)(m,{children:y.length===0?(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No observations match.`}):(0,v.jsx)(`div`,{className:`overflow-x-auto`,children:(0,v.jsxs)(`table`,{className:`w-full min-w-[680px] text-left text-xs`,children:[(0,v.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,v.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`when`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`project`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`signal`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`src`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`value`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`outcome`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`session`})]})}),(0,v.jsx)(`tbody`,{children:y.map(e=>(0,v.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:a(I,e.createdAt)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap`,children:e.project}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap`,children:(0,v.jsx)(d,{variant:`outline`,children:e.signal})}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:e.source}),(0,v.jsx)(`td`,{className:`py-1 pr-3 font-mono`,children:T(e.value)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 font-mono text-muted-foreground`,children:T(e.outcome)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:e.agentId??e.sessionId.slice(0,12)})]},e.id))})]})})})]})]})}export{E as InsightsView};
|
|
2
|
-
//# sourceMappingURL=insights-
|
|
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-DKPDIZBe.js";import{M as i}from"./provider-display-BEeLXC_D.js";import{et as a}from"./display-CDeH4I8T.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./switch-DuCA7mrB.js";import{t as c}from"./lightbulb-RDhZ4p-D.js";import{t as l}from"./refresh-cw-CfpvQcUn.js";import{t as u}from"./button-Do6Z3vvn.js";import{t as d}from"./badge-DqJRtj_p.js";import{t as f}from"./input-CsTB6jIx.js";import{o as p,r as m,s as h,t as g}from"./card-C4QJ4hCW.js";var _=e(t(),1),v=n(),y={rounds:`Held deliveries per Task until GO (hold cleared); re-delivery without another review still counts as a round.`,review:`Elapsed time from the first held delivery to GO (hold cleared), for Tasks approved in the range.`,cycle:`Elapsed time from Task creation to its first landed-on-main event, for Tasks first landed in the range.`,gates:`Failed delivery/recorded gates; land-gate failures not included yet. Counts recorded failures up to first landing per Task landed in the range.`};function b(e){return e==null?`—`:e.toLocaleString(void 0,{maximumFractionDigits:2})}function x(e){return e==null?`—`:e>=864e5?`${b(e/864e5)}d`:e>=36e5?`${b(e/36e5)}h`:`${b(e/6e4)}m`}function S({stats:e}){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`td`,{className:`p-2`,children:[b(e.reviewRounds?.avg),` / `,b(e.reviewRounds?.median),` / `,b(e.reviewRounds?.max)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[x(e.reviewTimeMs?.median),` / `,x(e.reviewTimeMs?.p90)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[x(e.cycleTimeMs?.median),` / `,x(e.cycleTimeMs?.p90)]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[b(e.gateFailures?.perLandedTask),` (`,b(e.gateFailures?.total),` total)`]}),(0,v.jsxs)(`td`,{className:`p-2`,children:[e.reviewedTasks,` / `,e.landedTasks]})]})}function C(){let e=r(e=>e.connected),t=r(e=>e.openTaskDetailById),[n,i]=(0,_.useState)(30),[a,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(null),f=`${n}:${a}:${c}`,b=u?.key===f?u.data:void 0,x=u?.key===f?u.error:void 0;(0,_.useEffect)(()=>{if(!e)return;let t=!1;return o(`GET`,`/metrics/delivery-quality?windowDays=${n}${a?`&projectId=${encodeURIComponent(a)}`:``}`).then(e=>{t||d({key:f,data:e})}).catch(e=>{t||d({key:f,error:e instanceof Error?e.message:`Request failed`})}),()=>{t=!0}},[e,n,a,c,f]);let C=(b?.tasks??[]).filter(e=>e.reviewRounds!=null&&(e.awaitingGo||e.goAt!=null&&e.goAt>=b.since&&e.goAt<=b.until));return(0,v.jsxs)(g,{children:[(0,v.jsxs)(p,{children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{children:`Delivery quality`}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs`,children:[(0,v.jsxs)(`select`,{"aria-label":`Delivery quality project`,className:`bg-background border rounded p-1`,value:a,onChange:e=>s(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`All projects`}),(u?.data?.projects??[]).map(e=>(0,v.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,v.jsx)(`select`,{"aria-label":`Delivery quality time range`,className:`bg-background border rounded p-1`,value:n,onChange:e=>i(Number(e.target.value)),children:[7,30,90,365].map(e=>(0,v.jsxs)(`option`,{value:e,children:[`Last `,e,` days`]},e))}),(0,v.jsx)(`button`,{className:`border rounded px-2`,onClick:()=>l(e=>e+1),children:`Reload delivery quality`})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reviews are grouped by GO date; land metrics by first landing date. Weeks start Monday (UTC). Pending reviews appear below and are excluded from GO statistics.`})]}),(0,v.jsx)(m,{className:`space-y-4`,children:x?(0,v.jsxs)(`p`,{role:`alert`,children:[`Could not load delivery quality: `,x]}):b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`overflow-x-auto`,children:(0,v.jsxs)(`table`,{className:`w-full text-xs tabular-nums text-left`,children:[(0,v.jsx)(`caption`,{className:`text-left pb-2 text-muted-foreground`,children:`Range totals and weekly trend — “—” means no samples.`}),(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{className:`border-b`,children:[(0,v.jsx)(`th`,{className:`p-2`,children:`Period`}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.rounds,tabIndex:0,children:[`Review rounds to GO`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`avg / median / max`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.review,tabIndex:0,children:[`Review time`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`median / p90`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.cycle,tabIndex:0,children:[`Cycle time`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`median / p90`})]}),(0,v.jsxs)(`th`,{className:`p-2`,title:y.gates,tabIndex:0,children:[`Gate failures`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`per landed Task`})]}),(0,v.jsxs)(`th`,{className:`p-2`,children:[`Samples`,(0,v.jsx)(`br`,{}),(0,v.jsx)(`span`,{className:`font-normal`,children:`GO / landed`})]})]})}),(0,v.jsxs)(`tbody`,{children:[(0,v.jsxs)(`tr`,{className:`border-b font-medium`,children:[(0,v.jsx)(`th`,{className:`p-2`,children:`Selected range`}),(0,v.jsx)(S,{stats:b.summary})]}),b.weeks.map(e=>(0,v.jsxs)(`tr`,{className:`border-b border-border/40`,children:[(0,v.jsxs)(`th`,{className:`p-2 font-normal`,children:[`Week of `,new Date(e.start).toISOString().slice(0,10)]}),(0,v.jsx)(S,{stats:e.summary})]},e.start))]})]})}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium`,children:`Most review rounds`}),C.length===0?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No held deliveries in this range.`}):(0,v.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs`,children:C.map(e=>(0,v.jsxs)(`li`,{children:[(0,v.jsxs)(`button`,{className:`text-primary hover:underline text-left`,onClick:()=>t(e.taskId),children:[`T`,e.taskId,`: `,e.title]}),` — `,e.reviewRounds,` rounds`,e.awaitingGo?` · awaiting GO`:``]},e.taskId))})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b.growthUnavailableReason})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e?`Loading delivery quality…`:`Connect to load delivery quality.`})})]})}var w={enabled:!0,contextRatio:{enabled:!0},introspection:{enabled:!0,minTurns:4,minContextRemaining:.15}};function T(e){return!e||Object.keys(e).length===0?`—`:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`number`?Math.round(t*1e3)/1e3:String(t)}`).join(` `)}function E(){let[e,t]=(0,_.useState)(w),[n,r]=(0,_.useState)(0),[y,b]=(0,_.useState)([]),[x,S]=(0,_.useState)([]),[E,D]=(0,_.useState)([]),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(()=>Date.now());async function R(){F(null);try{let e=new URLSearchParams;O&&e.set(`project`,O),A&&e.set(`signal`,A);let n=e.toString(),[i,a]=await Promise.all([o(`GET`,`/insights/config`),o(`GET`,`/insights/observations${n?`?${n}`:``}`)]);t(i.value),r(i.version),b(a.observations),S(a.stats),D(a.projects),L(Date.now())}catch(e){F(i(e))}}(0,_.useEffect)(()=>{R()},[O,A]);async function z(n){N(!0),F(null);let a=e;t(n);try{let e=await o(`PUT`,`/insights/config`,{value:n,updatedBy:`dashboard`});t(e.value),r(e.version)}catch(e){t(a),F(i(e))}finally{N(!1)}}let B=(0,_.useMemo)(()=>[...new Set(x.map(e=>e.signal))].sort(),[x]),V=(0,_.useMemo)(()=>x.filter(e=>e.project===null),[x]),H=(0,_.useMemo)(()=>x.filter(e=>e.project!==null),[x]);return(0,v.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(c,{className:`size-5 text-primary`}),(0,v.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Insights`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`continuous self-improvement`})]}),(0,v.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>void R(),children:[(0,v.jsx)(l,{className:`size-4`}),` Refresh`]})]}),P&&(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:P}),(0,v.jsx)(C,{}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsxs)(h,{className:`flex items-center justify-between`,children:[(0,v.jsx)(`span`,{children:`Features`}),(0,v.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`config v`,n,` · saved by `,e&&`dashboard`]})]})}),(0,v.jsxs)(m,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`Insights enabled`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Master switch. When off, no signals are recorded regardless of the toggles below.`})]}),(0,v.jsx)(s,{checked:e.enabled,disabled:M,onCheckedChange:t=>void z({...e,enabled:t})})]}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border pt-3`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`Context-gathering ratio`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Server-side: read/search vs. action before first substantive move, per session.`})]}),(0,v.jsx)(s,{checked:e.contextRatio.enabled,disabled:M||!e.enabled,onCheckedChange:t=>void z({...e,contextRatio:{enabled:t}})})]}),(0,v.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium`,children:`End-of-session introspection`}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Agent-authored 3-field artifact at session end. Gated below.`})]}),(0,v.jsx)(s,{checked:e.introspection.enabled,disabled:M||!e.enabled,onCheckedChange:t=>void z({...e,introspection:{...e.introspection,enabled:t}})})]}),(0,v.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-4`,children:[(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[`min turns`,(0,v.jsx)(f,{type:`number`,className:`h-7 w-20`,value:e.introspection.minTurns,disabled:M||!e.enabled||!e.introspection.enabled,onChange:n=>t({...e,introspection:{...e.introspection,minTurns:Number(n.target.value)}}),onBlur:()=>void z(e)})]}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[`min context remaining (0–1)`,(0,v.jsx)(f,{type:`number`,step:`0.05`,min:`0`,max:`1`,className:`h-7 w-24`,value:e.introspection.minContextRemaining,disabled:M||!e.enabled||!e.introspection.enabled,onChange:n=>t({...e,introspection:{...e.introspection,minContextRemaining:Number(n.target.value)}}),onBlur:()=>void z(e)})]})]})]})]})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsx)(h,{children:`Signals`})}),(0,v.jsx)(m,{children:V.length===0?(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No observations yet — they appear after sessions end with Insights enabled.`}):(0,v.jsx)(`div`,{className:`space-y-4`,children:V.map(e=>(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,v.jsx)(d,{variant:`secondary`,children:e.signal}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.count,` obs · `,e.avgRatio===null?`no ratio`:`avg ratio ${e.avgRatio.toFixed(2)}`,` · `,a(I,e.lastAt)]})]}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2 pl-2`,children:H.filter(t=>t.signal===e.signal).map(t=>(0,v.jsxs)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:[t.project,`: `,t.count,t.avgRatio===null?``:` · ${t.avgRatio.toFixed(2)}`]},`${e.signal}-${t.project}`))})]},e.signal))})})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(p,{children:(0,v.jsxs)(h,{className:`flex flex-wrap items-center gap-3`,children:[(0,v.jsx)(`span`,{children:`Observations`}),(0,v.jsxs)(`select`,{className:`h-7 rounded border border-border bg-background px-2 text-xs`,value:O,onChange:e=>k(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`all projects`}),E.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{className:`h-7 rounded border border-border bg-background px-2 text-xs`,value:A,onChange:e=>j(e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:`all signals`}),B.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]})]})}),(0,v.jsx)(m,{children:y.length===0?(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No observations match.`}):(0,v.jsx)(`div`,{className:`overflow-x-auto`,children:(0,v.jsxs)(`table`,{className:`w-full min-w-[680px] text-left text-xs`,children:[(0,v.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,v.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`when`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`project`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`signal`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`src`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`value`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`outcome`}),(0,v.jsx)(`th`,{className:`py-1 pr-3 font-medium`,children:`session`})]})}),(0,v.jsx)(`tbody`,{children:y.map(e=>(0,v.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:a(I,e.createdAt)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap`,children:e.project}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap`,children:(0,v.jsx)(d,{variant:`outline`,children:e.signal})}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:e.source}),(0,v.jsx)(`td`,{className:`py-1 pr-3 font-mono`,children:T(e.value)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 font-mono text-muted-foreground`,children:T(e.outcome)}),(0,v.jsx)(`td`,{className:`py-1 pr-3 whitespace-nowrap text-muted-foreground`,children:e.agentId??e.sessionId.slice(0,12)})]},e.id))})]})})})]})]})}export{E as InsightsView};
|
|
2
|
+
//# sourceMappingURL=insights-DNyf7IzF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"./dist-DeW2Y1R5.js";import{t}from"./store-
|
|
2
|
-
//# sourceMappingURL=integrations-
|
|
1
|
+
import{u as e}from"./dist-DeW2Y1R5.js";import{t}from"./store-DKPDIZBe.js";import{nt as n,w as r}from"./display-CDeH4I8T.js";import{t as i}from"./activity-TMzFOdh2.js";import{t as a}from"./arrow-right-vFsRqG8V.js";import{t as o}from"./circle-alert-CryagaZd.js";import{t as s}from"./circle-check-CkUkN96J.js";import{t as c}from"./eye-BAP6fHrX.js";import{t as l}from"./list-checks-CwnS3hly.js";import{t as u}from"./messages-square-DVM1ZtcI.js";import{t as d}from"./plug-zap-V0wMDJ-G.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{o as m,r as h,s as g,t as _}from"./card-C4QJ4hCW.js";var v=e(),y={PlugZap:d,AlertCircle:o,Activity:i,Eye:c,CircleCheck:s};function b(){let e=t(e=>e.integrations),i=t(e=>e.channels),o=t(e=>e.set),s=t(e=>e.switchView),c=e.reduce((e,t)=>e+(t.taskStats?.waitingTasks||0),0),b=new Set(i.map(e=>e.type)),x=e.filter(e=>b.has(e.name)).length;function S(e){o({taskSourceFilter:e}),s(`tasks`)}return(0,v.jsxs)(`div`,{className:`space-y-6`,children:[x>0&&(0,v.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg border border-tone-info/20 bg-tone-info/5 text-sm`,children:[(0,v.jsx)(u,{className:`w-4 h-4 text-tone-info-fg shrink-0`}),(0,v.jsxs)(`span`,{className:`text-muted-foreground flex-1`,children:[(0,v.jsx)(`span`,{className:`text-foreground font-medium`,children:x}),` integration`,x===1?``:`s`,` have active channels — view them in Channels for live status and routing detail.`]}),(0,v.jsxs)(f,{variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1 text-tone-info-fg hover:text-tone-info-fg shrink-0`,onClick:()=>void s(`channels`),children:[`Channels`,(0,v.jsx)(a,{className:`w-3 h-3`})]})]}),(0,v.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Integrations`}),(0,v.jsxs)(p,{variant:`outline`,className:`text-xs`,children:[e.length,` total`]}),c>0&&(0,v.jsxs)(p,{className:`bg-tone-yellow/20 text-tone-yellow-fg border-tone-yellow/30 text-xs`,children:[c,` waiting`]})]})}),e.length===0?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,v.jsx)(d,{className:`w-10 h-10 text-tone-neutral-fg mb-3`}),(0,v.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No integrations configured`})]}):(0,v.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>{let t=r(e),i=y[e.icon||t.icon]||y[t.icon]||d,a=e.taskStats||{};return(0,v.jsxs)(_,{className:`flex flex-col border-l-2`,style:{borderLeftColor:e.accentColor||void 0},children:[(0,v.jsxs)(m,{children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(g,{className:`text-sm font-medium truncate`,children:e.displayName||e.name}),e.description&&(0,v.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,v.jsx)(i,{className:`w-3.5 h-3.5 ${n(t.tone)}`}),(0,v.jsx)(`span`,{className:`text-xs ${n(t.tone)}`,children:t.label})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.configured&&(0,v.jsx)(p,{variant:`outline`,className:`text-xs text-tone-success-fg border-tone-success/30`,children:`configured`}),e.observed&&(0,v.jsx)(p,{variant:`outline`,className:`text-xs text-tone-info-fg border-tone-info/30`,children:`observed`}),!e.enabled&&(0,v.jsx)(p,{variant:`outline`,className:`text-xs text-tone-danger-fg border-tone-danger/30`,children:`disabled`}),e.type&&(0,v.jsx)(p,{variant:`secondary`,className:`text-xs`,children:e.type}),e.tags?.map(e=>(0,v.jsxs)(p,{variant:`outline`,className:`text-xs text-tone-neutral-fg`,children:[`#`,e]},e))]})]}),(0,v.jsxs)(h,{className:`flex-1 space-y-3`,children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-4 gap-2 text-center`,children:[(0,v.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,v.jsx)(`p`,{className:`text-base font-semibold tabular-nums`,children:a.tasks??0}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`tasks`})]}),(0,v.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,v.jsx)(`p`,{className:`text-base font-semibold tabular-nums text-tone-info-fg`,children:a.openTasks??0}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`open`})]}),(0,v.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,v.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(a.waitingTasks??0)>0?`text-tone-yellow-fg`:``}`,children:a.waitingTasks??0}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`waiting`})]}),(0,v.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,v.jsx)(`p`,{className:`text-base font-semibold tabular-nums ${(a.failedTasks??0)>0?`text-tone-danger-fg`:``}`,children:a.failedTasks??0}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`failed`})]})]}),(e.scopes?.length>0||e.targets?.length>0||e.channels?.length>0)&&(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[e.scopes?.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.scopes.map(e=>(0,v.jsx)(p,{variant:`outline`,className:`text-xs text-tone-neutral-fg`,children:e},e))}),e.targets?.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.targets.map(e=>(0,v.jsx)(p,{variant:`secondary`,className:`text-xs`,children:e},e))}),e.channels?.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.channels.map(e=>(0,v.jsxs)(p,{className:`text-xs bg-tone-info/10 text-tone-info-fg border-tone-info/20`,children:[`#`,e]},e))})]})]}),(a.tasks??0)>0&&(0,v.jsx)(`div`,{className:`px-4 pb-4`,children:(0,v.jsxs)(f,{variant:`outline`,size:`sm`,className:`w-full gap-1.5`,onClick:()=>S(a.source||e.name),children:[(0,v.jsx)(l,{className:`w-3.5 h-3.5`}),`Show tasks`]})})]},e.name)})})]})}export{b as IntegrationsView};
|
|
2
|
+
//# sourceMappingURL=integrations-DlYOHq7T.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t,u as n}from"./dist-DeW2Y1R5.js";import{et as r,v as i}from"./display-
|
|
1
|
+
import{n as e,o as t,u as n}from"./dist-DeW2Y1R5.js";import{et as r,v as i}from"./display-CDeH4I8T.js";import{t as a}from"./external-link-BRfu-fHG.js";import{n as o}from"./task-chip-CYj0mpoL.js";var s=e(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),c=n();function l({className:e}){return(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,c.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})}var u={github:l},d=s;function f({provider:e,className:n}){return(0,c.jsx)(u[e]??d,{className:t(`shrink-0`,n)})}var p={open:`bg-tone-success`,closed:`bg-tone-neutral`,unknown:`bg-tone-warning`},m=1440*60*1e3;function h(e,t){return{id:``,provider:`github`,repo:e,externalKey:t,url:`https://github.com/${e}/issues/${t}`,status:`unknown`,createdAt:0,updatedAt:0}}function g(e){return`${e.repo}#${e.externalKey}`}function _(e,t){return e.statusSyncedAt?`Status synced ${r(t,e.statusSyncedAt)} (${i(e.statusSyncedAt)})`:`Status not yet synced`}function v({issueRef:e,now:n=Date.now(),compact:i=!1,showSync:s=!1,className:l}){let u=g(e),d=!e.statusSyncedAt||n-e.statusSyncedAt>m,h=[e.title?`${u}: ${e.title}`:u,`Status: ${e.status}`,_(e,n)].join(`
|
|
2
2
|
`);return(0,c.jsx)(o,{label:u,href:e.url,title:h,ariaLabel:`Open ${u}`,compact:i,className:l,icon:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{"aria-hidden":!0,className:t(`h-1.5 w-1.5 shrink-0 rounded-full`,p[e.status])}),(0,c.jsx)(f,{provider:e.provider,className:i?`h-2.5 w-2.5`:`h-3 w-3`})]}),detail:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 opacity-70`,children:e.status}),s&&(0,c.jsxs)(`span`,{className:t(`shrink-0 tabular-nums`,d?`opacity-45`:`opacity-65`),children:[(0,c.jsx)(`span`,{"aria-hidden":!0,className:`mr-1 opacity-60`,children:`·`}),e.statusSyncedAt?r(n,e.statusSyncedAt):`unsynced`]})]}),trailing:(0,c.jsx)(a,{className:t(`shrink-0`,i?`h-2 w-2`:`ml-0.5 h-2.5 w-2.5`)})})}export{h as n,s as r,v as t};
|
|
3
|
-
//# sourceMappingURL=issue-ref-chip-
|
|
3
|
+
//# sourceMappingURL=issue-ref-chip-CeWBNWn7.js.map
|
|
@@ -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"./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"./store-DKPDIZBe.js";import{M as a}from"./provider-display-BEeLXC_D.js";import{m as o}from"./display-CDeH4I8T.js";import{t as s}from"./brain-CagXMEKE.js";import{t as c}from"./download-KgtpDbt5.js";import{t as l}from"./pause-DttnHD4c.js";import{t as u}from"./play-BbT8m7A0.js";import{t as d}from"./search-DjzbnTbf.js";import{t as f}from"./terminal-Bl2u7KxT.js";import{t as p}from"./button-Do6Z3vvn.js";import{t as m}from"./input-CsTB6jIx.js";var h=e(n(),1),g=r();function _({orchestratorId:e,session:n,lines:r=200}){let _=i(e=>e.apiCall),[v,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(`provider`),[E,D]=(0,h.useState)(null);async function O(){if(!S)try{let t=await _(`GET`,`/orchestrators/${encodeURIComponent(e)}/logs/${encodeURIComponent(n)}?lines=${r}${w===`mirror`?`&stream=mirror`:``}`);y(t.lines||[]),D(null)}catch(e){D(a(e))}}(0,h.useEffect)(()=>{O();let e=setInterval(()=>void O(),1500);return()=>clearInterval(e)},[e,n,S,w]);let k=b?v.filter(e=>e.toLowerCase().includes(b.toLowerCase())):v;return(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,g.jsx)(d,{className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(m,{className:`pl-8`,value:b,onChange:e=>x(e.target.value),placeholder:`Search logs`})]}),(0,g.jsxs)(`div`,{className:`flex rounded-md border border-border overflow-hidden`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>T(`provider`),title:`Provider output`,className:t(`flex items-center gap-1 px-2 py-1.5 text-xs`,w===`provider`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,g.jsx)(f,{className:`h-3.5 w-3.5`}),` Output`]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>T(`mirror`),title:`Session-mirror diagnostics (clean)`,className:t(`flex items-center gap-1 px-2 py-1.5 text-xs border-l border-border`,w===`mirror`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,g.jsx)(s,{className:`h-3.5 w-3.5`}),` Mirror`]})]}),(0,g.jsx)(p,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>C(e=>!e),title:S?`Resume logs`:`Pause logs`,children:S?(0,g.jsx)(u,{className:`h-4 w-4`}):(0,g.jsx)(l,{className:`h-4 w-4`})}),(0,g.jsx)(p,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>o(`${n}.log`,v.join(`
|
|
2
2
|
`),`text/plain`),title:`Download logs`,children:(0,g.jsx)(c,{className:`h-4 w-4`})})]}),E&&(0,g.jsx)(`div`,{className:`text-sm text-destructive`,children:E}),(0,g.jsx)(`pre`,{className:`max-h-96 overflow-auto rounded-md border border-border bg-muted p-3 text-xs leading-5 text-foreground`,children:k.join(`
|
|
3
3
|
`)||`No log output`})]})}export{_ as t};
|
|
4
|
-
//# sourceMappingURL=log-viewer-
|
|
4
|
+
//# sourceMappingURL=log-viewer-Cib8nqdE.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-DcClXLH0.js";import{et as o,v as s}from"./display-BrKWFGJz.js";import{t as c}from"./scroll-area-CIN4KQse.js";import{t as l}from"./activity-TMzFOdh2.js";import{t as u}from"./circle-check-CkUkN96J.js";import{t as d}from"./clock-3-BH47318N.js";import{n as f,t as p}from"./shield-alert-B9jCWcKW.js";import{t as m}from"./pause-DttnHD4c.js";import{t as h}from"./play-BbT8m7A0.js";import{t as g}from"./refresh-cw-CfpvQcUn.js";import{t as _}from"./triangle-alert-BBNhfgMi.js";import{t as v}from"./wrench-C7-4CgnY.js";import{t as y}from"./button-Do6Z3vvn.js";import{t as b}from"./badge-DqJRtj_p.js";import{t as x}from"./input-CsTB6jIx.js";var S=e(n(),1),C=r(),w={succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,running:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,idle:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,skipped:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,disabled:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,paused:`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,"paused (indefinite)":`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`};function T(e,t){return e.pause?e.pause.expiresAt===void 0?`indefinite`:e.pause.expiresAt<=t?`lapsed`:`timed`:`none`}function E(){let e=a(),t=i(e=>e.maintenanceJobs),n=i(e=>e.maintenanceRunning),r=i(e=>e.maintenanceRecentRuns),o=i(e=>e.fetchMaintenanceJobs),s=i(e=>e.fetchMaintenanceRunning),l=i(e=>e.runMaintenanceJob),u=(0,S.useMemo)(()=>({failed:t.filter(e=>e.lastStatus===`failed`).length,running:t.filter(e=>e.running||e.lastStatus===`running`).length,dueSoon:t.filter(t=>t.nextRunAt&&t.nextRunAt<=e+300*1e3).length,paused:t.filter(t=>T(t,e)!==`none`).length,heldCritical:t.filter(t=>t.critical&&[`indefinite`,`lapsed`].includes(T(t,e))).length}),[t,e]);return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,C.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,C.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Maintenance`}),(0,C.jsx)(b,{variant:`secondary`,children:t.length}),u.running>0&&(0,C.jsxs)(b,{className:`border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:[u.running,` running`]}),u.failed>0&&(0,C.jsxs)(b,{variant:`destructive`,children:[u.failed,` failing`]}),u.dueSoon>0&&(0,C.jsxs)(b,{className:`border border-tone-yellow/30 bg-tone-yellow/10 text-tone-yellow-fg`,children:[u.dueSoon,` due soon`]}),u.paused>0&&(0,C.jsxs)(b,{className:`border border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`,children:[u.paused,` paused`]}),u.heldCritical>0&&(0,C.jsxs)(b,{variant:`destructive`,children:[(0,C.jsx)(p,{className:`mr-1 h-3 w-3`}),u.heldCritical,` critical job held`]})]}),(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>{o(),s()},children:[(0,C.jsx)(g,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,C.jsx)(O,{jobs:t,openRuns:n,recentRuns:r,now:e}),(0,C.jsx)(c,{className:`h-[calc(100dvh-10rem)]`,children:t.length===0?(0,C.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No maintenance jobs registered`}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{className:`hidden overflow-x-auto rounded-md border border-border md:block`,children:(0,C.jsxs)(`table`,{className:`w-full min-w-[980px] text-sm`,children:[(0,C.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Last run`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Next run`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Duration`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Result`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Action`})]})}),(0,C.jsx)(`tbody`,{children:t.map(t=>(0,C.jsx)(M,{job:t,now:e,onRun:()=>void l(t.id)},t.id))})]})}),(0,C.jsx)(`div`,{className:`space-y-3 md:hidden`,children:t.map(t=>(0,C.jsx)(j,{job:t,now:e,onRun:()=>void l(t.id)},t.id))})]})})]})}var D=20;function O({jobs:e,openRuns:t,recentRuns:n,now:r}){let i=(0,S.useMemo)(()=>new Map(e.map(e=>[e.id,e.title])),[e]),a=(0,S.useMemo)(()=>{let e=new Map;for(let r of[...n,...t])e.set(r.runId,r);return[...e.values()].sort((e,t)=>t.startedAt-e.startedAt).slice(0,D)},[t,n]);return a.length===0?null:(0,C.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2`,children:[(0,C.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Run registry`}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`— what actually ran, for attributing a stall after the fact`}),t.length>0&&(0,C.jsxs)(b,{className:`border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:[t.length,` in flight`]})]}),(0,C.jsx)(`ul`,{className:`max-h-40 divide-y divide-border overflow-y-auto text-xs`,children:a.map(e=>{let t=e.finishedAt===void 0;return(0,C.jsxs)(`li`,{className:`flex items-center justify-between gap-2 px-3 py-1.5`,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:i.get(e.jobId)??e.jobId}),(0,C.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,title:s(e.startedAt),children:o(r,e.startedAt)}),t?(0,C.jsx)(b,{className:`shrink-0 border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:`running`}):(0,C.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[Math.max(0,e.finishedAt-e.startedAt),`ms`,e.blockMs===void 0?``:` · ${Math.round(e.blockMs)}ms block`]})]},e.runId)})})]})}function k(e,t=Date.now()){let n=T(e,t);return n===`indefinite`||n===`lapsed`?`paused (indefinite)`:n===`timed`?`paused`:e.running?`running`:e.enabled?e.lastStatus:`disabled`}function A({status:e}){return(0,C.jsxs)(b,{variant:`outline`,className:t(`border`,w[e]||w.idle),children:[F(e),e]})}function j({job:e,now:t,onRun:n}){let r=k(e,t);return(0,C.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,C.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description}),(0,C.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,C.jsx)(A,{status:r})]}),e.consecutiveFailures>0&&(0,C.jsxs)(`div`,{className:`mt-2 text-xs text-tone-danger-fg`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]}),(0,C.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last run`}),(0,C.jsx)(`dd`,{children:e.lastRunAt?(0,C.jsx)(`span`,{title:s(e.lastRunAt),children:o(t,e.lastRunAt)}):`never`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next run`}),(0,C.jsx)(`dd`,{children:e.nextRunAt?(0,C.jsx)(`span`,{title:s(e.nextRunAt),children:L(t,e.nextRunAt)}):`-`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Duration`}),(0,C.jsxs)(`dd`,{children:[e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`,e.lastBlockMs!==void 0&&(0,C.jsxs)(`span`,{className:`text-muted-foreground/70`,title:`synchronous event-loop block time`,children:[` · `,e.lastBlockMs,`ms block`]})]})]})]}),(0,C.jsxs)(`div`,{className:`mt-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Result`}),e.lastError?(0,C.jsx)(`div`,{className:`mt-0.5 text-xs text-tone-danger-fg line-clamp-3`,children:e.lastError}):(0,C.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3`,children:I(e)})]}),(0,C.jsx)(P,{job:e,now:t}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-end gap-1.5`,children:[(0,C.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running||T(e,t)!==`none`,onClick:n,children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Run`]}),(0,C.jsx)(N,{job:e,now:t})]})]})}function M({job:e,now:t,onRun:n}){let r=k(e,t);return(0,C.jsxs)(`tr`,{className:`border-t border-border align-top`,children:[(0,C.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.title}),e.critical&&(0,C.jsx)(b,{variant:`outline`,className:`border border-tone-danger/30 bg-tone-danger/10 text-[10px] text-tone-danger-fg`,children:`critical`})]}),(0,C.jsx)(`div`,{className:`mt-0.5 max-w-md text-xs text-muted-foreground`,children:e.description}),(0,C.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,C.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,C.jsx)(A,{status:r}),(0,C.jsx)(P,{job:e,now:t}),e.consecutiveFailures>0&&(0,C.jsxs)(`div`,{className:`mt-1 text-xs text-tone-danger-fg`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]})]}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastRunAt?(0,C.jsx)(`span`,{title:s(e.lastRunAt),children:o(t,e.lastRunAt)}):`never`}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.nextRunAt?(0,C.jsx)(`span`,{title:s(e.nextRunAt),children:L(t,e.nextRunAt)}):`-`}),(0,C.jsxs)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:[e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`,e.lastBlockMs!==void 0&&(0,C.jsxs)(`div`,{className:`text-[10px] text-muted-foreground/70`,title:`synchronous event-loop block time`,children:[e.lastBlockMs,`ms block`]})]}),(0,C.jsx)(`td`,{className:`px-3 py-3`,children:e.lastError?(0,C.jsx)(`div`,{className:`max-w-sm text-xs text-tone-danger-fg line-clamp-3`,children:e.lastError}):(0,C.jsx)(`div`,{className:`max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3`,children:I(e)})}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,C.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,C.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running||T(e,t)!==`none`,onClick:n,children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Run`]}),(0,C.jsx)(N,{job:e,now:t})]})})]})}function N({job:e,now:t}){let n=i(e=>e.pauseMaintenanceJob),r=i(e=>e.resumeMaintenanceJob),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(``);if(T(e,t)!==`none`)return(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>void r(e.id),children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Resume`]});if(!a)return(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>o(!0),children:[(0,C.jsx)(m,{className:`h-3.5 w-3.5`}),` Pause`]});let l=t=>{let r=s.trim();r&&(n(e.id,t?{reason:r,indefinite:!0}:{reason:r}),c(``),o(!1))};return(0,C.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,C.jsx)(x,{autoFocus:!0,value:s,placeholder:`Why is this being stopped? (required)`,className:`h-7 w-64 text-xs`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l(!1),e.key===`Escape`&&o(!1)}}),(0,C.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,C.jsx)(y,{size:`sm`,variant:`outline`,disabled:!s.trim(),onClick:()=>l(!1),children:`Pause 2h`}),(0,C.jsx)(y,{size:`sm`,variant:`outline`,disabled:!s.trim(),onClick:()=>l(!0),children:`Indefinitely`}),(0,C.jsx)(y,{size:`sm`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`})]})]})}function P({job:e,now:n}){let r=T(e,n);if(r===`none`||!e.pause)return null;let i=r===`indefinite`?`indefinitely — never lapses on its own`:r===`lapsed`?`expired ${o(n,e.pause.expiresAt)} and not resumed`:`until ${s(e.pause.expiresAt)}`;return(0,C.jsxs)(`div`,{className:t(`mt-1 text-xs`,r===`timed`?`text-tone-warning-fg`:`text-tone-danger-fg`),children:[`Paused by `,e.pause.holder,` `,i,` — `,e.pause.reason]})}function F(e){return e.startsWith(`paused`)?(0,C.jsx)(m,{className:`mr-1 h-3 w-3`}):e===`succeeded`?(0,C.jsx)(u,{className:`mr-1 h-3 w-3`}):e===`running`?(0,C.jsx)(l,{className:`mr-1 h-3 w-3`}):e===`failed`?(0,C.jsx)(_,{className:`mr-1 h-3 w-3`}):(0,C.jsx)(d,{className:`mr-1 h-3 w-3`})}function I(e){if(!e.lastResult)return`-`;let t=Object.entries(e.lastResult).filter(([,e])=>Array.isArray(e)?e.length>0:e!=null&&e!==0).map(([e,t])=>`${e}: ${Array.isArray(t)?t.length:String(t)}`);return t.length?t.join(`, `):`no changes`}function L(e,t){if(t<=e)return`due now`;let n=Math.max(0,(t-e)/1e3);return n<60?`in ${Math.ceil(n)}s`:n<3600?`in ${Math.ceil(n/60)}m`:n<86400?`in ${Math.ceil(n/3600)}h`:`in ${Math.ceil(n/86400)}d`}export{E as MaintenanceView};
|
|
2
|
-
//# sourceMappingURL=maintenance-
|
|
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-DKPDIZBe.js";import{et as o,v as s}from"./display-CDeH4I8T.js";import{t as c}from"./scroll-area-CIN4KQse.js";import{t as l}from"./activity-TMzFOdh2.js";import{t as u}from"./circle-check-CkUkN96J.js";import{t as d}from"./clock-3-BH47318N.js";import{n as f,t as p}from"./shield-alert-B9jCWcKW.js";import{t as m}from"./pause-DttnHD4c.js";import{t as h}from"./play-BbT8m7A0.js";import{t as g}from"./refresh-cw-CfpvQcUn.js";import{t as _}from"./triangle-alert-BBNhfgMi.js";import{t as v}from"./wrench-C7-4CgnY.js";import{t as y}from"./button-Do6Z3vvn.js";import{t as b}from"./badge-DqJRtj_p.js";import{t as x}from"./input-CsTB6jIx.js";var S=e(n(),1),C=r(),w={succeeded:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,running:`bg-tone-info/10 text-tone-info-fg border-tone-info/30`,failed:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`,idle:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,skipped:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`,disabled:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,paused:`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,"paused (indefinite)":`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`};function T(e,t){return e.pause?e.pause.expiresAt===void 0?`indefinite`:e.pause.expiresAt<=t?`lapsed`:`timed`:`none`}function E(){let e=a(),t=i(e=>e.maintenanceJobs),n=i(e=>e.maintenanceRunning),r=i(e=>e.maintenanceRecentRuns),o=i(e=>e.fetchMaintenanceJobs),s=i(e=>e.fetchMaintenanceRunning),l=i(e=>e.runMaintenanceJob),u=(0,S.useMemo)(()=>({failed:t.filter(e=>e.lastStatus===`failed`).length,running:t.filter(e=>e.running||e.lastStatus===`running`).length,dueSoon:t.filter(t=>t.nextRunAt&&t.nextRunAt<=e+300*1e3).length,paused:t.filter(t=>T(t,e)!==`none`).length,heldCritical:t.filter(t=>t.critical&&[`indefinite`,`lapsed`].includes(T(t,e))).length}),[t,e]);return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,C.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,C.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Maintenance`}),(0,C.jsx)(b,{variant:`secondary`,children:t.length}),u.running>0&&(0,C.jsxs)(b,{className:`border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:[u.running,` running`]}),u.failed>0&&(0,C.jsxs)(b,{variant:`destructive`,children:[u.failed,` failing`]}),u.dueSoon>0&&(0,C.jsxs)(b,{className:`border border-tone-yellow/30 bg-tone-yellow/10 text-tone-yellow-fg`,children:[u.dueSoon,` due soon`]}),u.paused>0&&(0,C.jsxs)(b,{className:`border border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`,children:[u.paused,` paused`]}),u.heldCritical>0&&(0,C.jsxs)(b,{variant:`destructive`,children:[(0,C.jsx)(p,{className:`mr-1 h-3 w-3`}),u.heldCritical,` critical job held`]})]}),(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>{o(),s()},children:[(0,C.jsx)(g,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,C.jsx)(O,{jobs:t,openRuns:n,recentRuns:r,now:e}),(0,C.jsx)(c,{className:`h-[calc(100dvh-10rem)]`,children:t.length===0?(0,C.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No maintenance jobs registered`}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{className:`hidden overflow-x-auto rounded-md border border-border md:block`,children:(0,C.jsxs)(`table`,{className:`w-full min-w-[980px] text-sm`,children:[(0,C.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Last run`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Next run`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Duration`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Result`}),(0,C.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Action`})]})}),(0,C.jsx)(`tbody`,{children:t.map(t=>(0,C.jsx)(M,{job:t,now:e,onRun:()=>void l(t.id)},t.id))})]})}),(0,C.jsx)(`div`,{className:`space-y-3 md:hidden`,children:t.map(t=>(0,C.jsx)(j,{job:t,now:e,onRun:()=>void l(t.id)},t.id))})]})})]})}var D=20;function O({jobs:e,openRuns:t,recentRuns:n,now:r}){let i=(0,S.useMemo)(()=>new Map(e.map(e=>[e.id,e.title])),[e]),a=(0,S.useMemo)(()=>{let e=new Map;for(let r of[...n,...t])e.set(r.runId,r);return[...e.values()].sort((e,t)=>t.startedAt-e.startedAt).slice(0,D)},[t,n]);return a.length===0?null:(0,C.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2`,children:[(0,C.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Run registry`}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`— what actually ran, for attributing a stall after the fact`}),t.length>0&&(0,C.jsxs)(b,{className:`border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:[t.length,` in flight`]})]}),(0,C.jsx)(`ul`,{className:`max-h-40 divide-y divide-border overflow-y-auto text-xs`,children:a.map(e=>{let t=e.finishedAt===void 0;return(0,C.jsxs)(`li`,{className:`flex items-center justify-between gap-2 px-3 py-1.5`,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:i.get(e.jobId)??e.jobId}),(0,C.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,title:s(e.startedAt),children:o(r,e.startedAt)}),t?(0,C.jsx)(b,{className:`shrink-0 border border-tone-info/30 bg-tone-info/10 text-tone-info-fg`,children:`running`}):(0,C.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[Math.max(0,e.finishedAt-e.startedAt),`ms`,e.blockMs===void 0?``:` · ${Math.round(e.blockMs)}ms block`]})]},e.runId)})})]})}function k(e,t=Date.now()){let n=T(e,t);return n===`indefinite`||n===`lapsed`?`paused (indefinite)`:n===`timed`?`paused`:e.running?`running`:e.enabled?e.lastStatus:`disabled`}function A({status:e}){return(0,C.jsxs)(b,{variant:`outline`,className:t(`border`,w[e]||w.idle),children:[F(e),e]})}function j({job:e,now:t,onRun:n}){let r=k(e,t);return(0,C.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,C.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description}),(0,C.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,C.jsx)(A,{status:r})]}),e.consecutiveFailures>0&&(0,C.jsxs)(`div`,{className:`mt-2 text-xs text-tone-danger-fg`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]}),(0,C.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last run`}),(0,C.jsx)(`dd`,{children:e.lastRunAt?(0,C.jsx)(`span`,{title:s(e.lastRunAt),children:o(t,e.lastRunAt)}):`never`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next run`}),(0,C.jsx)(`dd`,{children:e.nextRunAt?(0,C.jsx)(`span`,{title:s(e.nextRunAt),children:L(t,e.nextRunAt)}):`-`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{className:`text-muted-foreground`,children:`Duration`}),(0,C.jsxs)(`dd`,{children:[e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`,e.lastBlockMs!==void 0&&(0,C.jsxs)(`span`,{className:`text-muted-foreground/70`,title:`synchronous event-loop block time`,children:[` · `,e.lastBlockMs,`ms block`]})]})]})]}),(0,C.jsxs)(`div`,{className:`mt-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Result`}),e.lastError?(0,C.jsx)(`div`,{className:`mt-0.5 text-xs text-tone-danger-fg line-clamp-3`,children:e.lastError}):(0,C.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3`,children:I(e)})]}),(0,C.jsx)(P,{job:e,now:t}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-end gap-1.5`,children:[(0,C.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running||T(e,t)!==`none`,onClick:n,children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Run`]}),(0,C.jsx)(N,{job:e,now:t})]})]})}function M({job:e,now:t,onRun:n}){let r=k(e,t);return(0,C.jsxs)(`tr`,{className:`border-t border-border align-top`,children:[(0,C.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.title}),e.critical&&(0,C.jsx)(b,{variant:`outline`,className:`border border-tone-danger/30 bg-tone-danger/10 text-[10px] text-tone-danger-fg`,children:`critical`})]}),(0,C.jsx)(`div`,{className:`mt-0.5 max-w-md text-xs text-muted-foreground`,children:e.description}),(0,C.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,C.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,C.jsx)(A,{status:r}),(0,C.jsx)(P,{job:e,now:t}),e.consecutiveFailures>0&&(0,C.jsxs)(`div`,{className:`mt-1 text-xs text-tone-danger-fg`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]})]}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastRunAt?(0,C.jsx)(`span`,{title:s(e.lastRunAt),children:o(t,e.lastRunAt)}):`never`}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.nextRunAt?(0,C.jsx)(`span`,{title:s(e.nextRunAt),children:L(t,e.nextRunAt)}):`-`}),(0,C.jsxs)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:[e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`,e.lastBlockMs!==void 0&&(0,C.jsxs)(`div`,{className:`text-[10px] text-muted-foreground/70`,title:`synchronous event-loop block time`,children:[e.lastBlockMs,`ms block`]})]}),(0,C.jsx)(`td`,{className:`px-3 py-3`,children:e.lastError?(0,C.jsx)(`div`,{className:`max-w-sm text-xs text-tone-danger-fg line-clamp-3`,children:e.lastError}):(0,C.jsx)(`div`,{className:`max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3`,children:I(e)})}),(0,C.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,C.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,C.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running||T(e,t)!==`none`,onClick:n,children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Run`]}),(0,C.jsx)(N,{job:e,now:t})]})})]})}function N({job:e,now:t}){let n=i(e=>e.pauseMaintenanceJob),r=i(e=>e.resumeMaintenanceJob),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(``);if(T(e,t)!==`none`)return(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>void r(e.id),children:[(0,C.jsx)(h,{className:`h-3.5 w-3.5`}),` Resume`]});if(!a)return(0,C.jsxs)(y,{size:`sm`,variant:`outline`,onClick:()=>o(!0),children:[(0,C.jsx)(m,{className:`h-3.5 w-3.5`}),` Pause`]});let l=t=>{let r=s.trim();r&&(n(e.id,t?{reason:r,indefinite:!0}:{reason:r}),c(``),o(!1))};return(0,C.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,C.jsx)(x,{autoFocus:!0,value:s,placeholder:`Why is this being stopped? (required)`,className:`h-7 w-64 text-xs`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l(!1),e.key===`Escape`&&o(!1)}}),(0,C.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,C.jsx)(y,{size:`sm`,variant:`outline`,disabled:!s.trim(),onClick:()=>l(!1),children:`Pause 2h`}),(0,C.jsx)(y,{size:`sm`,variant:`outline`,disabled:!s.trim(),onClick:()=>l(!0),children:`Indefinitely`}),(0,C.jsx)(y,{size:`sm`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`})]})]})}function P({job:e,now:n}){let r=T(e,n);if(r===`none`||!e.pause)return null;let i=r===`indefinite`?`indefinitely — never lapses on its own`:r===`lapsed`?`expired ${o(n,e.pause.expiresAt)} and not resumed`:`until ${s(e.pause.expiresAt)}`;return(0,C.jsxs)(`div`,{className:t(`mt-1 text-xs`,r===`timed`?`text-tone-warning-fg`:`text-tone-danger-fg`),children:[`Paused by `,e.pause.holder,` `,i,` — `,e.pause.reason]})}function F(e){return e.startsWith(`paused`)?(0,C.jsx)(m,{className:`mr-1 h-3 w-3`}):e===`succeeded`?(0,C.jsx)(u,{className:`mr-1 h-3 w-3`}):e===`running`?(0,C.jsx)(l,{className:`mr-1 h-3 w-3`}):e===`failed`?(0,C.jsx)(_,{className:`mr-1 h-3 w-3`}):(0,C.jsx)(d,{className:`mr-1 h-3 w-3`})}function I(e){if(!e.lastResult)return`-`;let t=Object.entries(e.lastResult).filter(([,e])=>Array.isArray(e)?e.length>0:e!=null&&e!==0).map(([e,t])=>`${e}: ${Array.isArray(t)?t.length:String(t)}`);return t.length?t.join(`, `):`no changes`}function L(e,t){if(t<=e)return`due now`;let n=Math.max(0,(t-e)/1e3);return n<60?`in ${Math.ceil(n)}s`:n<3600?`in ${Math.ceil(n/60)}m`:n<86400?`in ${Math.ceil(n/3600)}h`:`in ${Math.ceil(n/86400)}d`}export{E as MaintenanceView};
|
|
2
|
+
//# sourceMappingURL=maintenance-DSn1cPm7.js.map
|
|
@@ -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,wt as a}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,wt as a}from"./store-DKPDIZBe.js";import{N as o}from"./provider-display-BEeLXC_D.js";import{et as s,r as c,tt as l,v as u}from"./display-CDeH4I8T.js";import{n as d}from"./host-mTgRw7xh.js";import{t as f}from"./api-CIIVBtAV.js";import{t as p}from"./activity-TMzFOdh2.js";import{t as m}from"./file-text-CKuoMR2U.js";import{t as h}from"./pencil-B1Hf2V_J.js";import{t as g}from"./play-BbT8m7A0.js";import{t as _}from"./plus-D5Ek4e2S.js";import{t as v}from"./rotate-cw-FPtkDewA.js";import{t as y}from"./server-CZIRjFyY.js";import{t as b}from"./square-Bqly37YM.js";import{t as x}from"./stethoscope-SCBrnQQ8.js";import{t as S}from"./terminal-Bl2u7KxT.js";import{t as C}from"./trash-2-FbcSq927.js";import{t as w}from"./triangle-alert-BBNhfgMi.js";import{t as T}from"./button-Do6Z3vvn.js";import{t as E}from"./badge-DqJRtj_p.js";import{t as D}from"./copy-button-CjOj4HEf.js";import{t as O}from"./terminal-viewer-CpY5_m7W.js";import{t as k}from"./log-viewer-Cib8nqdE.js";import{t as A}from"./busy-health-D3hwvYb4.js";var j=e(n(),1),M=r(),N={running:`bg-tone-success/15 text-tone-success-fg border-tone-success/30`,starting:`bg-tone-info/15 text-tone-info-fg border-tone-info/30`,stopping:`bg-tone-yellow/15 text-tone-yellow-fg border-tone-yellow/30`,backoff:`bg-tone-danger/15 text-tone-danger-fg border-tone-danger/30`,failed:`bg-tone-danger/15 text-tone-danger-fg border-tone-danger/30`,stopped:`bg-muted text-muted-foreground border-border`};function P({status:e}){return(0,M.jsx)(`span`,{className:t(`inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium`,N[e]),children:e})}var F={running:`bg-tone-success/20 text-tone-success-fg`,starting:`bg-tone-info/20 text-tone-info-fg`,stopping:`bg-tone-yellow/20 text-tone-yellow-fg`,stopped:`bg-tone-neutral/20 text-tone-neutral-fg`,backoff:`bg-tone-danger/20 text-tone-danger-fg`,failed:`bg-tone-danger/20 text-tone-danger-fg`};function I({item:e,agent:t,orchestrators:n,now:r,onClose:i,initialDiagnostics:a}){let[o,c]=(0,j.useState)(a??null),[l,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(a){c(a);return}let t=!1;return h(!0),_(null),f(`GET`,`/spawn-policy/`+encodeURIComponent(e.policy.name)+`/diagnostics?limit=80`).then(e=>{t||c(e)}).catch(e=>{t||(c(null),_(e.message))}).finally(()=>{t||h(!1)}),()=>{t=!0}},[e.policy.name,e.state.updatedAt,a]);let v=n.find(t=>t.id===e.policy.orchestratorId),b=(0,j.useMemo)(()=>L(e,v),[e,v]),S=o?.timeline??[],C=z(S,t),O=o?.crashReport??null,N=R(e,b),I=t?A(r,t):null;return(0,M.jsxs)(`section`,{className:`rounded-md border border-border bg-card p-3 space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsxs)(`h2`,{className:`flex items-center gap-1.5 text-sm font-semibold`,children:[(0,M.jsx)(x,{className:`h-4 w-4 text-muted-foreground`}),e.policy.label||e.policy.name,` Diagnostics`]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Spawn config, live attachments, recent lifecycle, and logs.`})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(D,{value:()=>V(e,t,v,b,S,O,C),label:`Copy Bundle`,showText:!0,size:`sm`,variant:`outline`,className:`h-8 text-xs`}),(0,M.jsx)(T,{variant:`outline`,size:`sm`,onClick:i,children:`Close`})]})]}),g&&(0,M.jsx)(`div`,{className:`rounded border border-tone-danger/20 bg-tone-danger/5 px-2 py-1.5 text-xs text-tone-danger-fg`,children:g}),l&&!o&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading diagnostics...`}),(0,M.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,M.jsx)(H,{title:`Spawn Command`,icon:(0,M.jsx)(m,{className:`h-3.5 w-3.5`}),children:(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-xs`,children:[(0,M.jsx)(U,{label:`Provider`,value:e.policy.provider}),e.policy.model&&(0,M.jsx)(U,{label:`Model`,value:e.policy.model}),e.policy.effort&&(0,M.jsx)(U,{label:`Effort`,value:e.policy.effort}),(0,M.jsx)(U,{label:`Approval`,value:e.policy.permissionMode}),(0,M.jsx)(U,{label:`Mode`,value:e.policy.mode}),e.policy.profile&&(0,M.jsx)(U,{label:`Profile`,value:e.policy.profile}),e.policy.rig&&(0,M.jsx)(U,{label:`Rig`,value:e.policy.rig}),(0,M.jsx)(U,{label:`CWD`,value:e.policy.cwd,className:`col-span-2`,mono:!0}),e.policy.providerArgs.length>0&&(0,M.jsx)(U,{label:`Provider Args`,value:e.policy.providerArgs.join(` `),className:`col-span-2`,mono:!0}),e.policy.tags.length>0&&(0,M.jsx)(W,{label:`Tags`,values:e.policy.tags}),e.policy.capabilities.length>0&&(0,M.jsx)(W,{label:`Caps`,values:e.policy.capabilities})]})}),(0,M.jsx)(H,{title:`Runtime`,icon:(0,M.jsx)(y,{className:`h-3.5 w-3.5`}),children:(0,M.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`Lifecycle`}),(0,M.jsx)(P,{status:e.state.status}),(0,M.jsx)(E,{className:F[e.state.status]||`bg-tone-neutral/20 text-tone-neutral-fg`,children:e.state.status})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[(0,M.jsx)(U,{label:`Orchestrator`,value:v?`${v.hostname} (${v.id})`:e.policy.orchestratorId}),v?.version&&(0,M.jsx)(U,{label:`Orch Version`,value:v.version}),b?.pid&&(0,M.jsx)(U,{label:`PID`,value:String(b.pid),mono:!0}),b?.supervisor&&(0,M.jsx)(U,{label:`Supervisor`,value:b.supervisor}),b?.systemdUnit&&(0,M.jsx)(U,{label:`Systemd`,value:b.systemdUnit,mono:!0,className:`col-span-2`}),b?.sessionName&&(0,M.jsx)(U,{label:`Session`,value:b.sessionName,mono:!0}),b?.terminalSession&&(0,M.jsx)(U,{label:`Terminal`,value:b.terminalAvailable?`${b.terminalSession} (available)`:`${b.terminalSession} (not attachable)`,mono:!0}),b?.spawnRequestId&&(0,M.jsx)(U,{label:`Spawn ID`,value:b.spawnRequestId,mono:!0,className:`col-span-2`}),b?.startedAt&&(0,M.jsx)(U,{label:`Started`,value:u(b.startedAt)}),b?.toolchain&&(0,M.jsx)(U,{label:`Toolchain`,value:d(b.toolchain.tools),mono:!0,className:`col-span-2`}),e.state.restartCount!==void 0&&(0,M.jsx)(U,{label:`Restarts`,value:String(e.state.restartCount)}),e.state.consecutiveFailures!==void 0&&(0,M.jsx)(U,{label:`Failures`,value:String(e.state.consecutiveFailures)}),e.state.backoffUntil&&(0,M.jsx)(U,{label:`Backoff`,value:e.state.backoffUntil>r?s(r,e.state.backoffUntil):`expired`})]}),I&&(0,M.jsxs)(`div`,{className:`rounded border border-tone-yellow/20 bg-tone-yellow/5 px-2 py-1.5 text-tone-yellow-fg`,children:[`Stuck busy: `,I.kind,` stale for `,s(r,r-I.staleForMs)]}),e.state.lastError&&(0,M.jsx)(G,{title:`Last Error`,body:e.state.lastError})]})})]}),(C||O)&&(0,M.jsx)(H,{title:`Post-Mortem`,icon:(0,M.jsx)(w,{className:`h-3.5 w-3.5`}),children:(0,M.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[O&&(0,M.jsxs)(`div`,{className:`rounded border border-tone-danger/20 bg-tone-danger/5 px-2 py-1.5`,children:[(0,M.jsx)(`div`,{className:`font-medium text-tone-danger-fg`,children:O.diagnosis.summary}),(0,M.jsxs)(`div`,{className:`mt-0.5 text-tone-danger-fg`,children:[`Cause `,O.diagnosis.cause,` · `,O.diagnosis.confidence]})]}),C&&(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[(0,M.jsx)(U,{label:`Exit`,value:C.lastError,className:`col-span-2`}),C.detectedAt&&(0,M.jsx)(U,{label:`Detected`,value:s(r,C.detectedAt)}),typeof C.runtimeMs==`number`&&(0,M.jsx)(U,{label:`Runtime`,value:`${Math.max(0,Math.round(C.runtimeMs/1e3))}s`}),C.systemd?.unit&&(0,M.jsx)(U,{label:`Unit`,value:C.systemd.unit,mono:!0,className:`col-span-2`}),C.systemd?.result&&(0,M.jsx)(U,{label:`Systemd Result`,value:C.systemd.result}),C.logFile&&(0,M.jsx)(U,{label:`Log`,value:C.logFile,mono:!0,className:`col-span-2`})]}),C?.logTail?.length?(0,M.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words rounded border border-border bg-muted p-2 text-[11px] leading-4 text-foreground`,children:C.logTail.slice(-8).join(`
|
|
2
2
|
`)}):null]})}),(0,M.jsx)(H,{title:`Recent Events (${S.length})`,icon:(0,M.jsx)(p,{className:`h-3.5 w-3.5`}),children:S.length===0?(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No recent lifecycle events or command outcomes.`}):(0,M.jsx)(`div`,{className:`space-y-1`,children:S.slice(0,12).map((e,t)=>(0,M.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_5rem_1fr] gap-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:s(r,e.ts)}),(0,M.jsx)(E,{variant:`outline`,className:`h-5 justify-center text-[10px]`,children:e.source}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,title:e.title,children:e.title}),e.detail&&(0,M.jsx)(`div`,{className:`break-words text-muted-foreground`,children:e.detail.length>160?e.detail.slice(0,160)+`...`:e.detail}),typeof e.metadata?.id==`string`&&(0,M.jsxs)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:[`command `,e.metadata.id]})]})]},`${e.source}-${e.ts}-${e.kind}-${t}`))})}),v&&N&&(0,M.jsx)(H,{title:`Log Tail`,icon:(0,M.jsx)(m,{className:`h-3.5 w-3.5`}),children:(0,M.jsx)(k,{orchestratorId:v.id,session:N,lines:120})})]})}function L(e,t){return t?.managedAgents.find(t=>t.policyName===e.policy.name||e.state.agentId&&t.agentId===e.state.agentId||e.state.spawnRequestId&&t.spawnRequestId===e.state.spawnRequestId||e.state.tmuxSession&&(t.sessionName===e.state.tmuxSession||t.tmuxSession===e.state.tmuxSession))}function R(e,t){return t?.terminalSession||t?.sessionName||t?.tmuxSession||e.state.tmuxSession}function z(e,t){let n=B(t?.meta?.lastExit);if(n)return n;for(let t of e){let e=B(t.metadata?.lastExit);if(e)return e}return null}function B(e){if(!o(e)||typeof e.lastError!=`string`)return null;let t=o(e.systemd)?e.systemd:void 0;return{lastError:e.lastError,detectedAt:typeof e.detectedAt==`number`?e.detectedAt:void 0,runtimeMs:typeof e.runtimeMs==`number`?e.runtimeMs:void 0,logFile:typeof e.logFile==`string`?e.logFile:void 0,logBytes:typeof e.logBytes==`number`?e.logBytes:void 0,logEmpty:typeof e.logEmpty==`boolean`?e.logEmpty:void 0,logTail:Array.isArray(e.logTail)?e.logTail.filter(e=>typeof e==`string`):void 0,systemd:t?{unit:typeof t.unit==`string`?t.unit:void 0,activeState:typeof t.activeState==`string`?t.activeState:void 0,subState:typeof t.subState==`string`?t.subState:void 0,result:typeof t.result==`string`?t.result:void 0}:void 0,unavailable:Array.isArray(e.unavailable)?e.unavailable.filter(e=>typeof e==`string`):void 0}}function V(e,t,n,r,i,a,o){let s=[`# Managed Agent Diagnostics`,`Policy: ${e.policy.name}`,`Lifecycle: ${e.state.status}`,`Provider: ${e.policy.provider}`,`CWD: ${e.policy.cwd}`,`Approval: ${e.policy.permissionMode}`];if(e.policy.model&&s.push(`Model: ${e.policy.model}`),e.policy.effort&&s.push(`Effort: ${e.policy.effort}`),e.policy.profile&&s.push(`Profile: ${e.policy.profile}`),e.policy.tags.length&&s.push(`Tags: ${e.policy.tags.join(`, `)}`),e.policy.capabilities.length&&s.push(`Caps: ${e.policy.capabilities.join(`, `)}`),t&&s.push(`Agent: ${t.id} (${t.status})`),n&&s.push(`Orchestrator: ${n.hostname} (${n.id})`,`Orchestrator status: ${n.status}`),r&&(s.push(``,`## Runtime`),r.pid&&s.push(`PID: ${r.pid}`),r.supervisor&&s.push(`Supervisor: ${r.supervisor}`),r.systemdUnit&&s.push(`Systemd: ${r.systemdUnit}`),r.sessionName&&s.push(`Session: ${r.sessionName}`),r.terminalSession&&s.push(`Terminal: ${r.terminalSession} (${r.terminalAvailable?`available`:`not attachable`})`),r.spawnRequestId&&s.push(`Spawn request: ${r.spawnRequestId}`),r.toolchain&&s.push(`Toolchain: ${d(r.toolchain.tools)}`)),(e.state.lastError||a||o)&&(s.push(``,`## Post-Mortem`),e.state.lastError&&s.push(`Last error: ${e.state.lastError}`),a&&s.push(`Crash: ${a.diagnosis.cause}/${a.diagnosis.confidence} - ${a.diagnosis.summary}`),o?.lastError&&s.push(`Exit: ${o.lastError}`),o?.logTail?.length&&s.push(``,`Log tail:`,...o.logTail.slice(-8))),i.length){s.push(``,`## Recent Events`);for(let e of i.slice(0,12)){let t=typeof e.metadata?.id==`string`?` (${e.metadata.id})`:``;s.push(`- ${new Date(l(e.ts)).toISOString()} [${e.source}] ${e.title}${t}${e.detail?`: ${e.detail}`:``}`)}}return s.join(`
|
|
3
3
|
`)}function H({title:e,icon:t,children:n}){return(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-2.5`,children:[(0,M.jsxs)(`h3`,{className:`mb-2 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[t,e]}),n]})}function U({label:e,value:t,className:n=``,mono:r=!1}){return(0,M.jsxs)(`div`,{className:`min-w-0 ${n}`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,M.jsx)(`div`,{className:`truncate ${r?`font-mono`:``}`,title:t,children:t})]})}function W({label:e,values:t}){return(0,M.jsxs)(`div`,{className:`col-span-2`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,M.jsx)(`div`,{className:`mt-0.5 flex flex-wrap gap-1`,children:t.map(e=>(0,M.jsx)(E,{variant:`outline`,className:`text-[10px]`,children:e},e))})]})}function G({title:e,body:t}){return(0,M.jsxs)(`div`,{className:`rounded border border-tone-danger/20 bg-tone-danger/5 px-2 py-1.5`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,M.jsx)(`div`,{className:`mt-0.5 break-words text-tone-danger-fg`,children:t})]})}function K(e,t){let n=t?.meta?.tmuxSession;return typeof n==`string`&&n.trim()?n:e.state.tmuxSession}function q(e,t){return t?.providerCapabilities?.terminal?.attach?.create===!0?!0:K(e,t)?!!t?.providerCapabilities?.terminal?.live?.read:!1}function J(e,t){return c(t,q(e,t))}function Y(){let e=i(e=>e.managedPolicies),t=i(e=>e.agentsById),n=i(e=>e.orchestrators),r=i(e=>e.fetchManagedPolicies),o=i(e=>e.fetchOrchestrators),s=i(e=>e.apiCall),c=i(e=>e.openPolicyCreate),l=i(e=>e.openPolicyEdit),d=i(e=>e.deletePolicy),f=i(e=>e.showError),p=a(),[y,w]=(0,j.useState)(null),[E,D]=(0,j.useState)(null),[A,N]=(0,j.useState)(null),[F,L]=(0,j.useState)(null);(0,j.useEffect)(()=>{Promise.all([r(),o()])},[]);async function R(e,t){await s(`POST`,`/spawn-policy/${encodeURIComponent(e)}/${t}`,{surface:{component:`managed-agents`}}),await r()}async function z(e,t){let n=K(e,t);if(!t?.id){if(!n)return;D({item:e,mode:`live`,session:n,orchestratorId:e.policy.orchestratorId,interactive:!1,canWrite:!1});return}if(t.providerCapabilities?.terminal?.attach?.create!==!0){if(!n)return;let r=J(e,t);D({item:e,mode:`live`,session:n,orchestratorId:e.policy.orchestratorId,interactive:r,canWrite:r,agentId:t.id});return}if(!A){N(e.policy.name);try{let n=await s(`POST`,`/agents/`+encodeURIComponent(t.id)+`/terminal-session`),r=J(e,t);D({item:e,mode:n.mode,session:n.session,orchestratorId:n.orchestratorId,interactive:n.interactive||r,canWrite:r,agentId:t.id})}catch(e){f(`Terminal Failed`,e.message,e)}finally{N(null)}}}function B(e){if(e)return;let t=E;D(null),t?.agentId&&t.mode===`guest`&&s(`DELETE`,`/agents/`+encodeURIComponent(t.agentId)+`/terminal-session/`+encodeURIComponent(t.session)).catch(()=>{})}let V=F?e.find(e=>e.policy.name===F)??null:null;return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Managed Agents`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Spawn policies, lifecycle state, and headless session logs.`})]}),(0,M.jsxs)(T,{onClick:c,size:`sm`,children:[(0,M.jsx)(_,{className:`h-4 w-4 mr-1`}),`Create Policy`]})]}),e.length===0&&(0,M.jsx)(`div`,{className:`rounded-md border border-border px-3 py-8 text-center text-sm text-muted-foreground`,children:`No managed agents configured`}),(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let n=e.state.agentId?t[e.state.agentId]:void 0;return(0,M.jsxs)(`div`,{className:`rounded-md border border-border bg-card p-3 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.policy.label||e.policy.name}),(0,M.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[e.policy.mode,` · `,e.policy.cwd]})]}),(0,M.jsx)(P,{status:e.state.status})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1 text-xs`,children:[(0,M.jsx)(`div`,{className:`text-muted-foreground`,children:`Provider`}),(0,M.jsx)(`div`,{children:e.policy.provider}),(0,M.jsx)(`div`,{className:`text-muted-foreground`,children:`Agent`}),(0,M.jsx)(`div`,{className:`font-mono truncate`,children:e.state.agentId||`-`}),(0,M.jsx)(`div`,{className:`text-muted-foreground`,children:`Restarts`}),(0,M.jsx)(`div`,{children:e.state.restartCount}),(e.state.backoffUntil||e.state.lastError)&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`text-muted-foreground`,children:e.state.backoffUntil?`Backoff`:`Error`}),(0,M.jsx)(`div`,{className:`truncate`,children:e.state.backoffUntil?u(e.state.backoffUntil):e.state.lastError})]})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1 border-t border-border`,children:[(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>R(e.policy.name,`start`),title:`Start`,children:(0,M.jsx)(g,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>R(e.policy.name,`stop`),title:`Stop`,children:(0,M.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>R(e.policy.name,`restart`),title:`Restart`,children:(0,M.jsx)(v,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>w(e),disabled:!e.state.tmuxSession,title:`Logs`,children:(0,M.jsx)(m,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>void z(e,n),disabled:!q(e,n)||A===e.policy.name,title:`Terminal`,children:(0,M.jsx)(S,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:F===e.policy.name?`secondary`:`outline`,className:`h-7 w-7`,onClick:()=>L(t=>t===e.policy.name?null:e.policy.name),title:`Diagnostics`,children:(0,M.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>l(e.policy),title:`Edit`,children:(0,M.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,M.jsx)(T,{size:`icon`,variant:`outline`,className:`h-7 w-7`,onClick:()=>d(e.policy.name),title:`Delete`,children:(0,M.jsx)(C,{className:`h-3.5 w-3.5`})})]})]},e.policy.name)})}),V&&(0,M.jsx)(I,{item:V,agent:V.state.agentId?t[V.state.agentId]:void 0,orchestrators:n,now:p,onClose:()=>L(null)}),y?.state.tmuxSession&&(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[y.policy.name,` Logs`]}),(0,M.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>w(null),children:`Close`})]}),(0,M.jsx)(k,{orchestratorId:y.policy.orchestratorId,session:y.state.tmuxSession})]}),(0,M.jsx)(O,{open:!!E,onOpenChange:B,orchestratorId:E?.orchestratorId??``,session:E?.session??``,interactive:E?.interactive??!1,canWrite:E?.canWrite??!1,onSessionChanged:E?.agentId?()=>{let e=E;e&&e.agentId&&z(e.item,t[e.agentId])}:void 0})]})}export{Y as ManagedAgentsView};
|
|
4
|
-
//# sourceMappingURL=managed-agents-
|
|
4
|
+
//# sourceMappingURL=managed-agents-C3CkM81m.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./markdown-preview-impl-
|
|
2
|
-
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"./preload-helper-HclGiUj8.js";var a=t(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),o=e(n(),1),s=r(),c=(0,o.lazy)(()=>i(()=>import(`./markdown-preview-impl-
|
|
3
|
-
//# sourceMappingURL=markdown-preview-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./markdown-preview-impl-CMsTdhjq.js","./dist-DeW2Y1R5.js","./rolldown-runtime-QTnfLwEv.js","./zoomable-image-B3Og53nj.js","./react-dom-DSFxiC7T.js","./x-Bge17hWJ.js","./zoom-in-Bs8Qv8VL.js","./code-preview-CzrZfr9U.js","./store-DKPDIZBe.js","./provider-display-BEeLXC_D.js","./display-CDeH4I8T.js","./api-CIIVBtAV.js","./agent-liveness-Bq-s73jW.js","./themes-G5j9m1Ji.js","./loader-circle-BfPd4kOD.js","./copy-button-CjOj4HEf.js","./check-B3M9Ug1P.js","./copy-DFxhHRtV.js","./button-Do6Z3vvn.js","./preload-helper-HclGiUj8.js","./lib-G-25QXXf.js","./lib-D7DTGM1F.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
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"./preload-helper-HclGiUj8.js";var a=t(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),o=e(n(),1),s=r(),c=(0,o.lazy)(()=>i(()=>import(`./markdown-preview-impl-CMsTdhjq.js`).then(e=>({default:e.MarkdownPreview})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url));function l(e){return(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading preview…`}),children:(0,s.jsx)(c,{...e})})}export{a as n,l as t};
|
|
3
|
+
//# sourceMappingURL=markdown-preview-W4VQQPAv.js.map
|
package/public/assets/{markdown-preview-impl-DNGlWIS3.js → markdown-preview-impl-CMsTdhjq.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"./dist-DeW2Y1R5.js";import{t}from"./zoomable-image-B3Og53nj.js";import{t as n}from"./code-preview-
|
|
2
|
-
//# sourceMappingURL=markdown-preview-impl-
|
|
1
|
+
import{u as e}from"./dist-DeW2Y1R5.js";import{t}from"./zoomable-image-B3Og53nj.js";import{t as n}from"./code-preview-CzrZfr9U.js";import{i as r,n as i,r as a,t as o}from"./lib-G-25QXXf.js";var s=e(),c={...a,attributes:{...a.attributes,code:[...a.attributes?.code||[],[`className`,/^language-[\w-]+$/]]}};function l(e){return!e||!/^https?:\/\//i.test(e)?{}:{target:`_blank`,rel:`noreferrer`}}function u({content:e,path:a}){return(0,s.jsx)(`div`,{className:`markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6`,children:(0,s.jsx)(r,{remarkPlugins:[o],rehypePlugins:[[i,c]],components:{a({href:e,children:t}){return(0,s.jsx)(`a`,{href:e,...l(e),children:t})},img({src:e,alt:n}){return e?(0,s.jsx)(t,{src:e,alt:n,className:`max-w-full`}):null},code({className:e,children:t,...r}){let i=/language-([\w-]+)/.exec(e||``),o=String(t).replace(/\n$/,``);return i?(0,s.jsx)(n,{content:o,path:`${a}.${i[1]}`,languageHint:i[1],compact:!0}):(0,s.jsx)(`code`,{className:e,...r,children:t})}},children:e})})}export{u as MarkdownPreview};
|
|
2
|
+
//# sourceMappingURL=markdown-preview-impl-CMsTdhjq.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{r,t as i}from"./store-DcClXLH0.js";import{M as a}from"./provider-display-DsuWMvVL.js";import{a as o,c as s,d as c,f as l,i as u,n as d,o as f,r as p,s as m,t as h,u as g}from"./use-project-list-59LheVP7.js";import{t as _}from"./api-CIIVBtAV.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dialog-uuJ9_geR.js";import{n as T,t as E}from"./arrow-up-a-z-CKC2RCjD.js";import{t as D}from"./brain-circuit-CpQeSmp3.js";import{t as ee}from"./file-text-CKuoMR2U.js";import{t as O}from"./loader-circle-BfPd4kOD.js";import{t as te}from"./plus-D5Ek4e2S.js";import{t as k}from"./sparkles-CzwR10ZU.js";import{t as A}from"./button-Do6Z3vvn.js";import{t as j}from"./badge-DqJRtj_p.js";import{o as ne,r as M,s as re,t as N}from"./card-C4QJ4hCW.js";import{t as P}from"./esm-ZSuD7QuY.js";var F=e(t(),1),I=n();function L({projectId:e,projectName:t,open:n,onOpenChange:o}){let s=i(e=>e.agentProfiles),[c,l]=(0,F.useState)(``),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(null),[m,h]=(0,F.useState)(null),g=(0,F.useCallback)(async t=>{d(!0),p(null);try{let n=t?`?profile=${encodeURIComponent(t)}`:``,r=await _(`GET`,`/projects/${encodeURIComponent(e)}/injection-preview${n}`);h(r.composed)}catch(e){h(null),p(a(e))}finally{d(!1)}},[e]);(0,F.useEffect)(()=>{n&&(l(``),g(``))},[n,e,g]);function T(e){l(e),g(e)}let E=m?.entries.filter(e=>e.rendered)??[];return(0,I.jsx)(w,{open:n,onOpenChange:o,children:(0,I.jsxs)(S,{className:`max-w-3xl`,children:[(0,I.jsxs)(x,{children:[(0,I.jsxs)(C,{children:[`Analyze — `,t]}),(0,I.jsx)(y,{children:`The composed injection preview for a given agent profile — exactly what would render into that agent's memory block for this project.`})]}),(0,I.jsxs)(b,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Profile`}),(0,I.jsxs)(`select`,{className:`h-8 rounded-md border border-border bg-card px-2 text-sm text-foreground`,value:c,onChange:e=>T(e.target.value),disabled:u,children:[(0,I.jsx)(`option`,{value:``,children:`No profile (all-audience only)`}),r(s).map(e=>(0,I.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,I.jsx)(`div`,{className:`space-y-3`,children:u?(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,I.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),`Composing…`]}):f?(0,I.jsx)(`div`,{className:`text-xs text-destructive`,children:f}):m?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[E.length,` entries rendered`]}),(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[m.tokens,` tokens`]}),m.demoted>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[m.demoted,` demoted to index`]}),m.omitted>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px] border-tone-warning/30 text-tone-warning-fg`,children:[m.omitted,` omitted`]}),m.filtered.length>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px] border-tone-warning/30 text-tone-warning-fg`,children:[m.filtered.length,` filtered`]})]}),(0,I.jsx)(`div`,{className:`max-h-[24rem] overflow-auto rounded-md border border-border bg-muted/30 p-3`,children:m.block?(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed`,children:m.block}):(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Nothing would be injected for this profile — no entry matches its audience.`})}),m.filtered.length>0&&(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Filtered out`}),(0,I.jsx)(`div`,{className:`space-y-1`,children:m.filtered.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`flex-1 truncate`,children:e.title??`(sensitive — title withheld)`}),(0,I.jsx)(j,{variant:`outline`,className:`text-[10px]`,children:e.reason})]},e.id))})]})]}):(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No preview available.`})})]}),(0,I.jsx)(v,{children:(0,I.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>o(!1),children:`Close`})})]})})}function R({projectId:e,nameById:t,reload:n,onError:r}){let d=i(e=>e.openConfirm),[h,v]=(0,F.useState)(!1),[y,b]=(0,F.useState)(null),[x,S]=(0,F.useState)(()=>new Set),[C,w]=(0,F.useState)(`rule`),[D,O]=(0,F.useState)(null),[k,j]=(0,F.useState)(``),[P,L]=(0,F.useState)(`updatedAt`),[R,B]=(0,F.useState)(`desc`),V=`/projects/${encodeURIComponent(e)}/entries`,[H,ae]=(0,F.useState)([]),[oe,se]=(0,F.useState)(!0),[ce,le]=(0,F.useState)(()=>Date.now()),U=(0,F.useRef)(0),W=(0,F.useRef)(!0);async function G(){let e=++U.current,t=()=>W.current&&e===U.current;try{let e=await _(`GET`,`${V}?includeInherited=true`);t()&&(ae(e.entries),le(Date.now()))}catch(e){t()&&r(a(e))}finally{t()&&se(!1)}}(0,F.useEffect)(()=>(W.current=!0,G(),()=>{W.current=!1}),[V,n]);let K=(0,F.useMemo)(()=>c(H),[H]),q=D&&K.some(([e])=>e===D)?D:null,J=(0,F.useMemo)(()=>l(H),[H]),Y=J.some(([e])=>e===k)?k:``,X=(0,F.useMemo)(()=>H.filter(e=>(!q||e.areas?.includes(q))&&(!Y||e.tags.includes(Y))),[H,q,Y]),Z=(0,F.useMemo)(()=>{let e=new Map;for(let t of X){let n=t.source===`ingested`?`ingested`:t.kind;e.set(n,[...e.get(n)??[],t])}return e},[X]),Q=(0,F.useMemo)(()=>{let e=R===`asc`?1:-1;return[...Z.get(C)??[]].sort((t,n)=>(t[P]-n[P])*e)},[Z,C,P,R]);async function ue(e){await _(`POST`,V,m(e)),v(!1),await G()}async function $(e,t){await _(`PATCH`,`${V}/${encodeURIComponent(e)}`,m(t)),b(null),await G()}function de(e){let t=e.inject===`pinned`?`indexed`:`pinned`;$(e.id,{...s(e),inject:t}).catch(e=>r(a(e)))}function fe(e){d(`Remove Entry`,`Retract "${e.title}"? It stays in the ledger for audit but stops being injected.`,()=>{_(`DELETE`,`${V}/${encodeURIComponent(e.id)}`).then(G).catch(e=>r(a(e)))})}let pe=C===`ingested`?void 0:C;return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[H.length,` `,H.length===1?`entry`:`entries`]}),!h&&(0,I.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>v(!0),children:[(0,I.jsx)(te,{className:`size-4`}),` Add entry`]})]}),h&&(0,I.jsx)(o,{initial:s(void 0,pe),submitLabel:`Create`,onSubmit:ue,onCancel:()=>v(!1)}),oe&&H.length===0?(0,I.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading entries…`}):H.length===0?(0,I.jsx)(N,{children:(0,I.jsx)(M,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No entries yet. Add one above, or agents write durable rules, decisions, facts, and memory here via the relay MCP tools.`})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,I.jsx)(g,{counts:K,active:q,onChange:O}),J.length>0&&(0,I.jsxs)(`select`,{"aria-label":`Filter by tag`,className:`h-7 max-w-full rounded-md border border-border bg-card px-1.5 text-xs text-foreground`,value:Y,onChange:e=>j(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`All tags`}),J.map(([e,t])=>(0,I.jsxs)(`option`,{value:e,children:[e,` (`,t,`)`]},e))]})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-lg bg-muted p-1`,role:`group`,"aria-label":`Category`,children:u.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${C===e?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>w(e),children:[p[e],` `,(0,I.jsxs)(`span`,{className:`text-[10px] opacity-70`,children:[`(`,Z.get(e)?.length??0,`)`]})]},e))}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Sort`}),(0,I.jsxs)(`select`,{"aria-label":`Sort by`,className:`h-7 rounded-md border border-border bg-card px-1.5 text-xs text-foreground`,value:P,onChange:e=>L(e.target.value),children:[(0,I.jsx)(`option`,{value:`updatedAt`,children:`Updated`}),(0,I.jsx)(`option`,{value:`createdAt`,children:`Created`})]}),(0,I.jsx)(A,{variant:`outline`,size:`icon`,className:`h-7 w-7`,onClick:()=>B(e=>e===`asc`?`desc`:`asc`),title:R===`asc`?`Oldest first`:`Newest first`,children:R===`asc`?(0,I.jsx)(E,{className:`h-3.5 w-3.5`}):(0,I.jsx)(T,{className:`h-3.5 w-3.5`})})]})]}),(0,I.jsxs)(N,{children:[(0,I.jsx)(ne,{children:(0,I.jsxs)(re,{className:`flex items-center gap-2 text-base`,children:[C===`ingested`&&(0,I.jsx)(ee,{className:`size-4 text-tone-info-fg`}),p[C],(0,I.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,Q.length,`)`]})]})}),(0,I.jsx)(M,{className:`space-y-2`,children:Q.length===0?(0,I.jsx)(`div`,{className:`py-4 text-center text-sm text-muted-foreground`,children:`No entries in this category.`}):(0,I.jsx)(ie,{entries:Q,renderEntry:e=>(0,I.jsx)(f,{entry:e,ownerName:e.inherited?t.get(e.projectId):void 0,now:ce,editing:y===e.id,expanded:x.has(e.id),onToggleExpanded:()=>S(t=>z(t,e.id)),onEdit:()=>b(e.id),onDelete:()=>fe(e),onTogglePin:()=>de(e),onSubmitEdit:t=>$(e.id,t),onCancelEdit:()=>b(null),onAreaClick:e=>O(q===e?null:e)})})})]})]})]})}function z(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function ie({entries:e,renderEntry:t}){let n=(0,F.useRef)(null),r=P({count:e.length,getScrollElement:()=>n.current,getItemKey:t=>e[t].id,estimateSize:()=>120,gap:8,overscan:4});return(0,I.jsx)(`div`,{ref:n,"data-testid":`memory-entry-list`,className:`max-h-[calc(var(--app-h)*0.7)] overflow-y-auto`,children:(0,I.jsx)(`div`,{className:`relative w-full`,style:{height:r.getTotalSize()},children:r.getVirtualItems().map(n=>(0,I.jsx)(`div`,{"data-index":n.index,ref:r.measureElement,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${n.start}px)`},children:t(e[n.index])},n.key))})})}function B(){let e=d(),{projects:t,selectedId:n,loading:r,setError:i,refresh:a}=e,[o,s]=(0,F.useState)(0),[c,l]=(0,F.useState)(!1),u=t.find(e=>e.id===n),f=(0,F.useMemo)(()=>new Map(t.map(e=>[e.id,e.title||e.slug])),[t]);return(0,I.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,I.jsx)(h,{icon:(0,I.jsx)(D,{className:`size-5 text-primary`}),title:`Project Memories`,list:e,onRefresh:()=>{a(),s(e=>e+1)},actions:u&&(0,I.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>l(!0),children:[(0,I.jsx)(k,{className:`size-4`}),` Analyze`]})}),!r&&t.length===0&&(0,I.jsx)(N,{children:(0,I.jsx)(M,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No projects yet. Add one on the Projects page; its memories show up here.`})}),u&&(0,I.jsx)(R,{projectId:u.id,nameById:f,reload:o,onError:i},u.id),u&&(0,I.jsx)(L,{projectId:u.id,projectName:u.title||u.slug,open:c,onOpenChange:l})]})}export{B as MemoryView};
|
|
2
|
-
//# sourceMappingURL=memory-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{r,t as i}from"./store-DKPDIZBe.js";import{M as a}from"./provider-display-BEeLXC_D.js";import{a as o,c as s,d as c,f as l,i as u,n as d,o as f,r as p,s as m,t as h,u as g}from"./use-project-list-CpWl6eHQ.js";import{t as _}from"./api-CIIVBtAV.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dialog-uuJ9_geR.js";import{n as T,t as E}from"./arrow-up-a-z-CKC2RCjD.js";import{t as D}from"./brain-circuit-CpQeSmp3.js";import{t as ee}from"./file-text-CKuoMR2U.js";import{t as O}from"./loader-circle-BfPd4kOD.js";import{t as te}from"./plus-D5Ek4e2S.js";import{t as k}from"./sparkles-CzwR10ZU.js";import{t as A}from"./button-Do6Z3vvn.js";import{t as j}from"./badge-DqJRtj_p.js";import{o as ne,r as M,s as re,t as N}from"./card-C4QJ4hCW.js";import{t as P}from"./esm-ZSuD7QuY.js";var F=e(t(),1),I=n();function L({projectId:e,projectName:t,open:n,onOpenChange:o}){let s=i(e=>e.agentProfiles),[c,l]=(0,F.useState)(``),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(null),[m,h]=(0,F.useState)(null),g=(0,F.useCallback)(async t=>{d(!0),p(null);try{let n=t?`?profile=${encodeURIComponent(t)}`:``,r=await _(`GET`,`/projects/${encodeURIComponent(e)}/injection-preview${n}`);h(r.composed)}catch(e){h(null),p(a(e))}finally{d(!1)}},[e]);(0,F.useEffect)(()=>{n&&(l(``),g(``))},[n,e,g]);function T(e){l(e),g(e)}let E=m?.entries.filter(e=>e.rendered)??[];return(0,I.jsx)(w,{open:n,onOpenChange:o,children:(0,I.jsxs)(S,{className:`max-w-3xl`,children:[(0,I.jsxs)(x,{children:[(0,I.jsxs)(C,{children:[`Analyze — `,t]}),(0,I.jsx)(y,{children:`The composed injection preview for a given agent profile — exactly what would render into that agent's memory block for this project.`})]}),(0,I.jsxs)(b,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Profile`}),(0,I.jsxs)(`select`,{className:`h-8 rounded-md border border-border bg-card px-2 text-sm text-foreground`,value:c,onChange:e=>T(e.target.value),disabled:u,children:[(0,I.jsx)(`option`,{value:``,children:`No profile (all-audience only)`}),r(s).map(e=>(0,I.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,I.jsx)(`div`,{className:`space-y-3`,children:u?(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,I.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),`Composing…`]}):f?(0,I.jsx)(`div`,{className:`text-xs text-destructive`,children:f}):m?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[E.length,` entries rendered`]}),(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[m.tokens,` tokens`]}),m.demoted>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px]`,children:[m.demoted,` demoted to index`]}),m.omitted>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px] border-tone-warning/30 text-tone-warning-fg`,children:[m.omitted,` omitted`]}),m.filtered.length>0&&(0,I.jsxs)(j,{variant:`outline`,className:`text-[10px] border-tone-warning/30 text-tone-warning-fg`,children:[m.filtered.length,` filtered`]})]}),(0,I.jsx)(`div`,{className:`max-h-[24rem] overflow-auto rounded-md border border-border bg-muted/30 p-3`,children:m.block?(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed`,children:m.block}):(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Nothing would be injected for this profile — no entry matches its audience.`})}),m.filtered.length>0&&(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Filtered out`}),(0,I.jsx)(`div`,{className:`space-y-1`,children:m.filtered.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`flex-1 truncate`,children:e.title??`(sensitive — title withheld)`}),(0,I.jsx)(j,{variant:`outline`,className:`text-[10px]`,children:e.reason})]},e.id))})]})]}):(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No preview available.`})})]}),(0,I.jsx)(v,{children:(0,I.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>o(!1),children:`Close`})})]})})}function R({projectId:e,nameById:t,reload:n,onError:r}){let d=i(e=>e.openConfirm),[h,v]=(0,F.useState)(!1),[y,b]=(0,F.useState)(null),[x,S]=(0,F.useState)(()=>new Set),[C,w]=(0,F.useState)(`rule`),[D,O]=(0,F.useState)(null),[k,j]=(0,F.useState)(``),[P,L]=(0,F.useState)(`updatedAt`),[R,B]=(0,F.useState)(`desc`),V=`/projects/${encodeURIComponent(e)}/entries`,[H,ae]=(0,F.useState)([]),[oe,se]=(0,F.useState)(!0),[ce,le]=(0,F.useState)(()=>Date.now()),U=(0,F.useRef)(0),W=(0,F.useRef)(!0);async function G(){let e=++U.current,t=()=>W.current&&e===U.current;try{let e=await _(`GET`,`${V}?includeInherited=true`);t()&&(ae(e.entries),le(Date.now()))}catch(e){t()&&r(a(e))}finally{t()&&se(!1)}}(0,F.useEffect)(()=>(W.current=!0,G(),()=>{W.current=!1}),[V,n]);let K=(0,F.useMemo)(()=>c(H),[H]),q=D&&K.some(([e])=>e===D)?D:null,J=(0,F.useMemo)(()=>l(H),[H]),Y=J.some(([e])=>e===k)?k:``,X=(0,F.useMemo)(()=>H.filter(e=>(!q||e.areas?.includes(q))&&(!Y||e.tags.includes(Y))),[H,q,Y]),Z=(0,F.useMemo)(()=>{let e=new Map;for(let t of X){let n=t.source===`ingested`?`ingested`:t.kind;e.set(n,[...e.get(n)??[],t])}return e},[X]),Q=(0,F.useMemo)(()=>{let e=R===`asc`?1:-1;return[...Z.get(C)??[]].sort((t,n)=>(t[P]-n[P])*e)},[Z,C,P,R]);async function ue(e){await _(`POST`,V,m(e)),v(!1),await G()}async function $(e,t){await _(`PATCH`,`${V}/${encodeURIComponent(e)}`,m(t)),b(null),await G()}function de(e){let t=e.inject===`pinned`?`indexed`:`pinned`;$(e.id,{...s(e),inject:t}).catch(e=>r(a(e)))}function fe(e){d(`Remove Entry`,`Retract "${e.title}"? It stays in the ledger for audit but stops being injected.`,()=>{_(`DELETE`,`${V}/${encodeURIComponent(e.id)}`).then(G).catch(e=>r(a(e)))})}let pe=C===`ingested`?void 0:C;return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[H.length,` `,H.length===1?`entry`:`entries`]}),!h&&(0,I.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>v(!0),children:[(0,I.jsx)(te,{className:`size-4`}),` Add entry`]})]}),h&&(0,I.jsx)(o,{initial:s(void 0,pe),submitLabel:`Create`,onSubmit:ue,onCancel:()=>v(!1)}),oe&&H.length===0?(0,I.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading entries…`}):H.length===0?(0,I.jsx)(N,{children:(0,I.jsx)(M,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No entries yet. Add one above, or agents write durable rules, decisions, facts, and memory here via the relay MCP tools.`})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,I.jsx)(g,{counts:K,active:q,onChange:O}),J.length>0&&(0,I.jsxs)(`select`,{"aria-label":`Filter by tag`,className:`h-7 max-w-full rounded-md border border-border bg-card px-1.5 text-xs text-foreground`,value:Y,onChange:e=>j(e.target.value),children:[(0,I.jsx)(`option`,{value:``,children:`All tags`}),J.map(([e,t])=>(0,I.jsxs)(`option`,{value:e,children:[e,` (`,t,`)`]},e))]})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-lg bg-muted p-1`,role:`group`,"aria-label":`Category`,children:u.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${C===e?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>w(e),children:[p[e],` `,(0,I.jsxs)(`span`,{className:`text-[10px] opacity-70`,children:[`(`,Z.get(e)?.length??0,`)`]})]},e))}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Sort`}),(0,I.jsxs)(`select`,{"aria-label":`Sort by`,className:`h-7 rounded-md border border-border bg-card px-1.5 text-xs text-foreground`,value:P,onChange:e=>L(e.target.value),children:[(0,I.jsx)(`option`,{value:`updatedAt`,children:`Updated`}),(0,I.jsx)(`option`,{value:`createdAt`,children:`Created`})]}),(0,I.jsx)(A,{variant:`outline`,size:`icon`,className:`h-7 w-7`,onClick:()=>B(e=>e===`asc`?`desc`:`asc`),title:R===`asc`?`Oldest first`:`Newest first`,children:R===`asc`?(0,I.jsx)(E,{className:`h-3.5 w-3.5`}):(0,I.jsx)(T,{className:`h-3.5 w-3.5`})})]})]}),(0,I.jsxs)(N,{children:[(0,I.jsx)(ne,{children:(0,I.jsxs)(re,{className:`flex items-center gap-2 text-base`,children:[C===`ingested`&&(0,I.jsx)(ee,{className:`size-4 text-tone-info-fg`}),p[C],(0,I.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,Q.length,`)`]})]})}),(0,I.jsx)(M,{className:`space-y-2`,children:Q.length===0?(0,I.jsx)(`div`,{className:`py-4 text-center text-sm text-muted-foreground`,children:`No entries in this category.`}):(0,I.jsx)(ie,{entries:Q,renderEntry:e=>(0,I.jsx)(f,{entry:e,ownerName:e.inherited?t.get(e.projectId):void 0,now:ce,editing:y===e.id,expanded:x.has(e.id),onToggleExpanded:()=>S(t=>z(t,e.id)),onEdit:()=>b(e.id),onDelete:()=>fe(e),onTogglePin:()=>de(e),onSubmitEdit:t=>$(e.id,t),onCancelEdit:()=>b(null),onAreaClick:e=>O(q===e?null:e)})})})]})]})]})}function z(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function ie({entries:e,renderEntry:t}){let n=(0,F.useRef)(null),r=P({count:e.length,getScrollElement:()=>n.current,getItemKey:t=>e[t].id,estimateSize:()=>120,gap:8,overscan:4});return(0,I.jsx)(`div`,{ref:n,"data-testid":`memory-entry-list`,className:`max-h-[calc(var(--app-h)*0.7)] overflow-y-auto`,children:(0,I.jsx)(`div`,{className:`relative w-full`,style:{height:r.getTotalSize()},children:r.getVirtualItems().map(n=>(0,I.jsx)(`div`,{"data-index":n.index,ref:r.measureElement,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${n.start}px)`},children:t(e[n.index])},n.key))})})}function B(){let e=d(),{projects:t,selectedId:n,loading:r,setError:i,refresh:a}=e,[o,s]=(0,F.useState)(0),[c,l]=(0,F.useState)(!1),u=t.find(e=>e.id===n),f=(0,F.useMemo)(()=>new Map(t.map(e=>[e.id,e.title||e.slug])),[t]);return(0,I.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,I.jsx)(h,{icon:(0,I.jsx)(D,{className:`size-5 text-primary`}),title:`Project Memories`,list:e,onRefresh:()=>{a(),s(e=>e+1)},actions:u&&(0,I.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>l(!0),children:[(0,I.jsx)(k,{className:`size-4`}),` Analyze`]})}),!r&&t.length===0&&(0,I.jsx)(N,{children:(0,I.jsx)(M,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No projects yet. Add one on the Projects page; its memories show up here.`})}),u&&(0,I.jsx)(R,{projectId:u.id,nameById:f,reload:o,onError:i},u.id),u&&(0,I.jsx)(L,{projectId:u.id,projectName:u.title||u.slug,open:c,onOpenChange:l})]})}export{B as MemoryView};
|
|
2
|
+
//# sourceMappingURL=memory-BV17qtO4.js.map
|
|
@@ -1,2 +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,wt as i}from"./store-
|
|
2
|
-
//# sourceMappingURL=messages-
|
|
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,wt as i}from"./store-DKPDIZBe.js";import{O as a}from"./provider-display-BEeLXC_D.js";import{F as o,_ as s,et as c,f as l,v as u}from"./display-CDeH4I8T.js";import{n as d,t as f}from"./hash-CbtKih3g.js";import{t as p}from"./circle-check-CkUkN96J.js";import{t as m}from"./mail-DyaDmwfY.js";import{t as h}from"./message-square-reply-B9Z4cbQx.js";import{t as g}from"./pencil-B1Hf2V_J.js";import{t as _}from"./rotate-ccw-CtD77qkX.js";import{t as v}from"./trash-2-FbcSq927.js";import{t as y}from"./triangle-alert-BBNhfgMi.js";import{t as b}from"./x-Bge17hWJ.js";import{t as x}from"./button-Do6Z3vvn.js";import{t as S}from"./badge-DqJRtj_p.js";import{n as C,t as w}from"./agent-name-CcY3Aijy.js";import{o as T,p as E}from"./use-selectors-BdxBW8mL.js";import{t as D}from"./formatted-body-MLtodyPp.js";import{r as O,t as k}from"./card-C4QJ4hCW.js";var A=e(t(),1),j=n();function M(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 N(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function P(){let e=i(),t=r(e=>e.messages),n=r(e=>e.agentsById),a=r(e=>e.selectedAgent),o=r(e=>e.channelFilter),s=r(e=>e.tagFilter),c=r(e=>e.replyTo),u=r(e=>e.set),d=r(e=>e.openCompose),f=r(e=>e.startReply),p=r(e=>e.doClaim),_=r(e=>e.doDeliveryAction),v=r(e=>e.doDeleteMessage),y=r(e=>e.openThread),C=r(e=>e.cancelReply),D=T(),O=E(),k=(0,A.useMemo)(()=>{let e=[...t].sort((e,t)=>t.id-e.id);return a&&(e=e.filter(e=>e.from===a||e.to===a)),o&&(e=e.filter(e=>e.channel===o)),s&&(e=e.filter(e=>((n[e.from]||n[e.to])?.tags||[]).includes(s))),e},[t,a,o,s,n]),M=(0,A.useMemo)(()=>{let e=[],t=new Map;for(let n of k){let r=n.threadId??n.id;t.has(r)||t.set(r,[]),t.get(r).push(n),n.id===r&&e.push(n)}let n=new Set(e.map(e=>e.id));for(let t of k)!n.has(t.threadId??t.id)&&!e.find(e=>e.id===t.id)&&e.push(t);return e.sort((e,t)=>t.id-e.id),e.map(e=>({root:e,replies:(t.get(e.id)||[]).filter(t=>t.id!==e.id).sort((e,t)=>e.id-t.id)}))},[k]);function N(e){return(0,j.jsx)(w,{agent:n[e],fallback:e.slice(-10)})}let P=(0,A.useMemo)(()=>[...new Set(t.map(e=>e.channel).filter(Boolean))],[t]);return(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(m,{className:`w-5 h-5 text-muted-foreground`}),(0,j.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Messages`}),(0,j.jsx)(S,{variant:`secondary`,children:k.length})]}),(0,j.jsxs)(x,{size:`sm`,onClick:d,children:[(0,j.jsx)(g,{className:`w-4 h-4 mr-1`}),` Compose`]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>u({selectedAgent:e.target.value}),children:[(0,j.jsx)(`option`,{value:``,children:`All agents`}),D.map(e=>(0,j.jsx)(`option`,{value:e.id,children:l(e)},e.id))]}),(0,j.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:s,onChange:e=>u({tagFilter:e.target.value}),children:[(0,j.jsx)(`option`,{value:``,children:`All tags`}),O.map(e=>(0,j.jsxs)(`option`,{value:e,children:[`#`,e]},e))]}),(0,j.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:o,onChange:e=>u({channelFilter:e.target.value}),children:[(0,j.jsx)(`option`,{value:``,children:`All channels`}),P.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]})]}),c&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-tone-info/10 border border-tone-info/20 px-3 py-2 text-sm text-tone-info-fg`,children:[(0,j.jsx)(h,{className:`w-4 h-4 shrink-0`}),(0,j.jsxs)(`span`,{children:[`Replying to message #`,c.id,` from `,(0,j.jsx)(`strong`,{children:N(c.from)})]}),(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`ml-auto h-6 px-1.5`,onClick:C,children:(0,j.jsx)(b,{className:`w-3.5 h-3.5`})})]}),(0,j.jsx)(`div`,{className:`h-[calc(100dvh-15rem)] overflow-y-auto`,children:(0,j.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[M.length===0&&(0,j.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No messages`}),M.map(({root:t,replies:r})=>(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(F,{msg:t,now:e,agentLabel:N,agentsById:n,onReply:()=>f(t),onClaim:()=>p(t.id),onRetry:()=>_(t.id,`retry-now`),onReevaluate:()=>_(t.id,`re-evaluate`),onMarkDead:()=>_(t.id,`mark-dead`,`Marked dead from dashboard`),onClear:()=>_(t.id,`clear`,`Cleared after manual handling`),onDelete:()=>v(t.id),onThread:t.threadId?()=>y(t.threadId):void 0,replyCount:r.length}),r.map(t=>(0,j.jsx)(`div`,{className:`ml-6`,children:(0,j.jsx)(F,{msg:t,now:e,agentLabel:N,agentsById:n,onReply:()=>f(t),onClaim:()=>p(t.id),onRetry:()=>_(t.id,`retry-now`),onReevaluate:()=>_(t.id,`re-evaluate`),onMarkDead:()=>_(t.id,`mark-dead`,`Marked dead from dashboard`),onClear:()=>_(t.id,`clear`,`Cleared after manual handling`),onDelete:()=>v(t.id)})},t.id))]},t.id))]})})]})}function F({msg:e,now:t,agentLabel:n,agentsById:i,onReply:l,onClaim:m,onRetry:g,onReevaluate:y,onMarkDead:b,onClear:w,onDelete:T,onThread:E,replyCount:P}){let[F,L]=(0,A.useState)(!1),R=o(e),z=r(e=>e.openFilesAt);r(e=>e.openTaskDetailById);let B=e.deliveryStatus===`queued`||e.deliveryStatus===`failed`||e.deliveryStatus===`dead`||!!(e.deliveryLastError||e.deliveryPoisonReason),V=i[a(e.from)?e.to:e.from];function H(e){return M((typeof V?.meta?.cwd==`string`?V.meta.cwd:``)||`/`,e)}function U(e,t){let n=H(e);z({path:N(n),selectedPath:n,line:t,overlay:!0})}return(0,j.jsx)(k,{className:`group relative`,children:(0,j.jsxs)(O,{className:`p-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-xs text-muted-foreground mb-1`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:n(e.from)}),(0,j.jsx)(`span`,{children:`→`}),(0,j.jsx)(C,{target:e.to,agentsById:i}),e.channel&&(0,j.jsxs)(S,{variant:`outline`,className:`text-xs px-1.5 py-0 gap-0.5`,children:[(0,j.jsx)(f,{className:`w-2.5 h-2.5`}),e.channel]}),e.claimedBy&&(0,j.jsxs)(S,{variant:`outline`,className:`text-xs px-1.5 py-0 text-tone-success-fg border-tone-success/30`,children:[(0,j.jsx)(p,{className:`w-2.5 h-2.5 mr-0.5`}),`claimed`]}),B&&(0,j.jsx)(I,{msg:e,now:t}),e.subject&&(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:e.subject}),(0,j.jsxs)(`span`,{className:`ml-auto shrink-0`,title:u(e.createdAt),children:[(0,j.jsx)(`span`,{className:`opacity-40 mr-1`,children:s(e.id)}),c(t,e.createdAt)]})]}),R&&(0,j.jsx)(`div`,{className:`cursor-pointer`,onClick:()=>L(e=>!e),children:(0,j.jsx)(D,{text:R,rawBody:e.body,issueRepo:V?.issueRepo,className:`text-sm text-muted-foreground ${F?``:`max-h-[3.75rem] overflow-hidden`}`,onOpenPath:U,resolvePathTitle:(e,t)=>`${H(e)}${t?`:${t}`:``}`})})]}),(0,j.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity bg-card rounded-md shadow-sm border border-border px-1 py-0.5`,children:[(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:l,title:`Reply`,children:(0,j.jsx)(h,{className:`w-3.5 h-3.5`})}),e.claimable&&!e.claimedBy&&(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-tone-orange-fg hover:text-tone-orange-fg`,onClick:m,title:`Claim`,children:(0,j.jsx)(p,{className:`w-3.5 h-3.5`})}),e.payload?.channelReportSuppressed===!0&&(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:y,title:`Re-evaluate channel delivery`,children:`Re-evaluate`}),B&&e.payload?.channelReportSuppressed!==!0&&(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-tone-info-fg hover:text-tone-info-fg`,onClick:g,title:`Retry delivery now`,children:(0,j.jsx)(_,{className:`w-3.5 h-3.5`})}),e.deliveryStatus!==`dead`&&B&&(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-tone-danger-fg hover:text-tone-danger-fg`,onClick:b,title:`Mark dead`,children:(0,j.jsx)(d,{className:`w-3.5 h-3.5`})}),(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`)&&e.payload?.channelReportSuppressed!==!0&&(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-tone-success-fg hover:text-tone-success-fg`,onClick:w,title:`Clear after manual handling`,children:(0,j.jsx)(p,{className:`w-3.5 h-3.5`})}),E&&(P??0)>0&&(0,j.jsxs)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:E,title:`Thread`,children:[`+`,P]}),(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-tone-danger-fg hover:text-tone-danger-fg`,onClick:T,title:`Delete`,children:(0,j.jsx)(v,{className:`w-3.5 h-3.5`})})]})]})})}function I({msg:e,now:t}){let n=e.deliveryStatus||`pending`,r=e.deliveryPoisonReason||e.deliveryLastError||(e.deliveryNextRetryAt?`retry ${c(t,e.deliveryNextRetryAt)}`:void 0);return(0,j.jsxs)(S,{variant:`outline`,className:`text-xs px-1.5 py-0 ${n===`dead`?`text-tone-danger-fg border-tone-danger/30 bg-tone-danger/10`:n===`failed`?`text-tone-warning-fg border-tone-warning/30 bg-tone-warning/10`:`text-tone-info-fg border-tone-info/30 bg-tone-info/10`}`,title:r||n,children:[(0,j.jsx)(y,{className:`w-2.5 h-2.5 mr-0.5`}),n,e.deliveryAttempts?` ${e.deliveryAttempts}x`:``]})}export{P as MessagesView};
|
|
2
|
+
//# sourceMappingURL=messages-Bm_1AqSA.js.map
|
|
@@ -1,2 +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,wt as i}from"./store-DcClXLH0.js";import{H as a,V as o,et as s}from"./display-BrKWFGJz.js";import{t as c}from"./separator-t1cLZErD.js";import{t as l}from"./circle-arrow-up-B432r0Kk.js";import{t as u}from"./cpu-Dndy84IU.js";import{t as d}from"./hourglass-txu4ax6n.js";import{t as f}from"./pencil-B1Hf2V_J.js";import{t as p}from"./plus-D5Ek4e2S.js";import{t as m}from"./power-6tZOhYPg.js";import{t as h}from"./rotate-cw-FPtkDewA.js";import{t as g}from"./workflow-marker-DAZcj5qt.js";import{t as _}from"./server-CZIRjFyY.js";import{t as v}from"./triangle-alert-BBNhfgMi.js";import{t as y}from"./button-Do6Z3vvn.js";import{t as b}from"./badge-DqJRtj_p.js";import{t as x}from"./host-providers-dialog-DKaW31dN.js";import{o as S,r as C,s as w,t as T}from"./card-C4QJ4hCW.js";var E=e(t(),1),D=n();function O({queued:e}){let t=e.freeMemMb!==void 0&&e.minFreeMemMb!==void 0?` (${Math.round(e.freeMemMb)}MB / ${Math.round(e.minFreeMemMb)}MB min)`:``;return(0,D.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,D.jsx)(d,{className:`w-3.5 h-3.5 shrink-0 text-tone-warning-fg`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label||e.spawnRequestId?.slice(-12)||e.provider}),(0,D.jsx)(b,{variant:`outline`,className:`h-4 shrink-0 border-tone-warning/30 bg-tone-warning/15 text-[10px] text-tone-warning-fg`,children:`queued`})]}),(0,D.jsxs)(`div`,{className:`truncate text-[10px] text-muted-foreground`,title:e.reason,children:[e.provider,` · waiting for host memory`,t]})]})]})}function k({agent:e,orch:t}){let n=r(e=>e.orchestratorAction),i=r(e=>e.openFilesAt),a=r(t=>t.agentsById[e.agentId]);return(0,D.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,D.jsx)(u,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-xs font-medium`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e.label||e.agentId.slice(-12)}),(0,D.jsx)(g,{agent:a})]}),(0,D.jsxs)(`button`,{type:`button`,className:`max-w-full truncate text-left text-[10px] text-muted-foreground hover:text-foreground`,title:`Open ${e.cwd||t.baseDir} in Files`,onClick:n=>{n.stopPropagation(),i({orchestratorId:t.id,path:e.cwd||t.baseDir})},children:[e.provider,` · `,e.cwd||`~`]})]}),(0,D.jsxs)(`div`,{className:`flex gap-1`,children:[(0,D.jsx)(y,{size:`icon`,variant:`ghost`,className:`h-6 w-6`,title:`Restart agent`,onClick:r=>{r.stopPropagation(),n(t.id,`restart`,e.agentId,`orchestrators`)},children:(0,D.jsx)(h,{className:`w-3 h-3`})}),(0,D.jsx)(y,{size:`icon`,variant:`ghost`,className:`h-6 w-6 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Shutdown agent`,onClick:r=>{r.stopPropagation(),n(t.id,`shutdown`,e.agentId,`orchestrators`)},children:(0,D.jsx)(m,{className:`w-3 h-3`})})]})]})}function A({orch:e}){let t=i(),[n,u]=(0,E.useState)(!1),d=r(e=>e.orchestratorAction),A=r(e=>e.upgradeOrchestrator),j=r(e=>e.stats.version),M=r(e=>e.openOrchestratorSpawnFor),N=r(e=>e.openFilesAt),P=r(e=>e.deleteOrchestrator),F=r(e=>e.fetchHostProviders),I=r(e=>e.refreshOrchestratorProviders),L=r(e=>e.agentsById),R=a(e),z=o(e),B=e.status===`online`,V=e.package?.version||e.version,H=e.upgrade,U=H?.status===`pending`,W=B&&!!e.version&&!!j&&e.version!==j,G=B&&!U&&(W||H?.status===`failed`),K=Object.entries(e.contracts||{}).filter(([,e])=>typeof e==`number`),q=e.providerStatus||e.providers.map(t=>({name:t,available:!0,checkedAt:Number(e.lastSeen)||Date.now()})),J=e.managedAgents.map(e=>e.workspace?{agent:e,workspace:e.workspace}:null).filter(e=>!!(e?.workspace?.id||e?.workspace?.worktreePath));return(0,D.jsxs)(T,{className:`${B?``:`opacity-60`}`,children:[(0,D.jsx)(S,{className:`pb-2 pt-4 px-4`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded-md ${B?`bg-tone-success/10`:`bg-muted`}`,children:(0,D.jsx)(_,{className:`w-4 h-4 ${B?`text-tone-success-fg`:`text-tone-neutral-fg`}`})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(w,{className:`text-sm font-medium truncate`,children:e.hostname}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.id.slice(0,16),`…`]})]}),(0,D.jsx)(b,{className:`text-[10px] shrink-0 ${z}`,children:R})]})}),(0,D.jsxs)(C,{className:`px-4 pb-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,D.jsx)(`span`,{className:B?`text-tone-success-fg`:`text-tone-neutral-fg`,children:e.status}),V&&(0,D.jsxs)(`span`,{children:[e.package?.name||`orchestrator`,` v`,V]}),e.gitSha&&(0,D.jsx)(`span`,{className:`font-mono`,title:e.gitSha,children:e.gitSha.slice(0,12)}),U&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20 gap-1`,children:[(0,D.jsx)(l,{className:`w-3 h-3 animate-pulse`}),`upgrading → v`,H.desiredVersion]}),!U&&H?.status===`failed`&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20 gap-1`,title:H.error,children:[(0,D.jsx)(v,{className:`w-3 h-3`}),`upgrade failed`]}),!U&&W&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-info/10 text-tone-info-fg border-tone-info/20`,children:[`→ v`,j,` available`]}),(0,D.jsx)(`span`,{className:`ml-auto`,children:s(t,e.lastSeen)})]}),q.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:q.map(e=>(0,D.jsxs)(b,{variant:`secondary`,title:`degraded`in e&&e.degraded?e.degraded.reason:e.available?`version`in e&&e.version?e.version:e.name:`reason`in e&&e.reason?e.reason:`${e.name} unavailable`,className:`text-[10px] ${`degraded`in e&&e.degraded?`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20`:e.available?`bg-tone-success/10 text-tone-success-fg border-tone-success/20`:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20`}`,children:[e.name,`degraded`in e&&e.degraded?` (probe degraded)`:``]},e.name))}),K.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:K.map(([e,t])=>(0,D.jsxs)(b,{variant:`secondary`,className:`text-[10px]`,children:[e,`=`,t]},e))}),e.managedAgents.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Managed agents (`,e.managedAgents.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-0`,children:e.managedAgents.map(t=>(0,D.jsx)(k,{agent:t,orch:e},t.agentId))})]})]}),e.queuedSpawns&&e.queuedSpawns.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Queued spawns (`,e.queuedSpawns.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-0`,children:e.queuedSpawns.map((e,t)=>(0,D.jsx)(O,{queued:e},e.spawnRequestId||`${e.provider}-${t}`))})]})]}),J.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Workspaces (`,J.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-1`,children:J.map(({agent:t,workspace:n})=>(0,D.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 rounded border border-border/60 px-2 py-1.5 text-left hover:bg-accent/40`,onClick:()=>n.worktreePath&&void N({orchestratorId:e.id,path:n.worktreePath}),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,D.jsx)(`span`,{className:`truncate font-medium`,children:n.branch||t.label||t.agentId.slice(-12)}),(0,D.jsx)(g,{agent:L[t.agentId]}),n.status&&(0,D.jsx)(b,{variant:`outline`,className:`h-4 shrink-0 text-[10px]`,children:n.status})]}),(0,D.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:n.worktreePath||n.repoRoot})]},n.id||n.worktreePath))})]})]}),(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,title:`Edit host providers`,onClick:()=>{F(e.id),u(!0)},children:[(0,D.jsx)(f,{className:`w-3 h-3`}),`Edit host`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>M(e.id),children:[(0,D.jsx)(p,{className:`w-3 h-3`}),`Spawn agent`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>I(e.id),children:[(0,D.jsx)(h,{className:`w-3 h-3`}),`Refresh providers`]}),(G||U)&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,disabled:U,className:`h-7 text-xs gap-1 text-tone-info-fg hover:text-tone-info-fg border-tone-info/30 disabled:opacity-60`,title:U?`Upgrading to v${H.desiredVersion}…`:`Upgrade to v${j}`,onClick:()=>A(e.id),children:[(0,D.jsx)(l,{className:`w-3 h-3 ${U?`animate-pulse`:``}`}),U?`Upgrading…`:`Upgrade`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>d(e.id,`restart`,void 0,`orchestrators`),children:[(0,D.jsx)(h,{className:`w-3 h-3`}),`Restart all`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1 text-tone-danger-fg hover:text-tone-danger-fg border-tone-danger/30`,onClick:()=>d(e.id,`shutdown`,void 0,`orchestrators`),children:[(0,D.jsx)(m,{className:`w-3 h-3`}),`Shutdown all`]}),(0,D.jsx)(y,{size:`sm`,variant:`ghost`,className:`h-7 text-xs text-muted-foreground hover:text-tone-danger-fg`,onClick:()=>P(e.id),children:`Remove`})]})]}),(0,D.jsx)(x,{orchId:e.id,hostname:e.hostname,open:n,onOpenChange:u})]})}function j(){let e=r(e=>e.orchestrators),t=r(e=>e.openOrchestratorSpawn),n=r(e=>e.openOrchestratorInstall),i=e.filter(e=>e.status===`online`).length;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-semibold`,children:`Orchestrators`}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Multi-host agent lifecycle managers`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,D.jsxs)(b,{variant:`outline`,className:`text-xs`,children:[i,` online`]}),(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`gap-1`,onClick:n,children:[(0,D.jsx)(_,{className:`w-3.5 h-3.5`}),`Add`]}),(0,D.jsxs)(y,{size:`sm`,className:`gap-1`,onClick:t,children:[(0,D.jsx)(p,{className:`w-3.5 h-3.5`}),`Spawn`]})]})]}),e.length===0?(0,D.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No orchestrators registered.`}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,D.jsx)(A,{orch:e},e.id))})]})}export{j as OrchestratorsView};
|
|
2
|
-
//# sourceMappingURL=orchestrators-
|
|
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,wt as i}from"./store-DKPDIZBe.js";import{H as a,V as o,et as s}from"./display-CDeH4I8T.js";import{t as c}from"./separator-t1cLZErD.js";import{t as l}from"./circle-arrow-up-B432r0Kk.js";import{t as u}from"./cpu-Dndy84IU.js";import{t as d}from"./hourglass-txu4ax6n.js";import{t as f}from"./pencil-B1Hf2V_J.js";import{t as p}from"./plus-D5Ek4e2S.js";import{t as m}from"./power-6tZOhYPg.js";import{t as h}from"./rotate-cw-FPtkDewA.js";import{t as g}from"./workflow-marker-X8wxyhzC.js";import{t as _}from"./server-CZIRjFyY.js";import{t as v}from"./triangle-alert-BBNhfgMi.js";import{t as y}from"./button-Do6Z3vvn.js";import{t as b}from"./badge-DqJRtj_p.js";import{t as x}from"./host-providers-dialog-mapF4Fj9.js";import{o as S,r as C,s as w,t as T}from"./card-C4QJ4hCW.js";var E=e(t(),1),D=n();function O({queued:e}){let t=e.freeMemMb!==void 0&&e.minFreeMemMb!==void 0?` (${Math.round(e.freeMemMb)}MB / ${Math.round(e.minFreeMemMb)}MB min)`:``;return(0,D.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,D.jsx)(d,{className:`w-3.5 h-3.5 shrink-0 text-tone-warning-fg`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label||e.spawnRequestId?.slice(-12)||e.provider}),(0,D.jsx)(b,{variant:`outline`,className:`h-4 shrink-0 border-tone-warning/30 bg-tone-warning/15 text-[10px] text-tone-warning-fg`,children:`queued`})]}),(0,D.jsxs)(`div`,{className:`truncate text-[10px] text-muted-foreground`,title:e.reason,children:[e.provider,` · waiting for host memory`,t]})]})]})}function k({agent:e,orch:t}){let n=r(e=>e.orchestratorAction),i=r(e=>e.openFilesAt),a=r(t=>t.agentsById[e.agentId]);return(0,D.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,D.jsx)(u,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-xs font-medium`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e.label||e.agentId.slice(-12)}),(0,D.jsx)(g,{agent:a})]}),(0,D.jsxs)(`button`,{type:`button`,className:`max-w-full truncate text-left text-[10px] text-muted-foreground hover:text-foreground`,title:`Open ${e.cwd||t.baseDir} in Files`,onClick:n=>{n.stopPropagation(),i({orchestratorId:t.id,path:e.cwd||t.baseDir})},children:[e.provider,` · `,e.cwd||`~`]})]}),(0,D.jsxs)(`div`,{className:`flex gap-1`,children:[(0,D.jsx)(y,{size:`icon`,variant:`ghost`,className:`h-6 w-6`,title:`Restart agent`,onClick:r=>{r.stopPropagation(),n(t.id,`restart`,e.agentId,`orchestrators`)},children:(0,D.jsx)(h,{className:`w-3 h-3`})}),(0,D.jsx)(y,{size:`icon`,variant:`ghost`,className:`h-6 w-6 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Shutdown agent`,onClick:r=>{r.stopPropagation(),n(t.id,`shutdown`,e.agentId,`orchestrators`)},children:(0,D.jsx)(m,{className:`w-3 h-3`})})]})]})}function A({orch:e}){let t=i(),[n,u]=(0,E.useState)(!1),d=r(e=>e.orchestratorAction),A=r(e=>e.upgradeOrchestrator),j=r(e=>e.stats.version),M=r(e=>e.openOrchestratorSpawnFor),N=r(e=>e.openFilesAt),P=r(e=>e.deleteOrchestrator),F=r(e=>e.fetchHostProviders),I=r(e=>e.refreshOrchestratorProviders),L=r(e=>e.agentsById),R=a(e),z=o(e),B=e.status===`online`,V=e.package?.version||e.version,H=e.upgrade,U=H?.status===`pending`,W=B&&!!e.version&&!!j&&e.version!==j,G=B&&!U&&(W||H?.status===`failed`),K=Object.entries(e.contracts||{}).filter(([,e])=>typeof e==`number`),q=e.providerStatus||e.providers.map(t=>({name:t,available:!0,checkedAt:Number(e.lastSeen)||Date.now()})),J=e.managedAgents.map(e=>e.workspace?{agent:e,workspace:e.workspace}:null).filter(e=>!!(e?.workspace?.id||e?.workspace?.worktreePath));return(0,D.jsxs)(T,{className:`${B?``:`opacity-60`}`,children:[(0,D.jsx)(S,{className:`pb-2 pt-4 px-4`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded-md ${B?`bg-tone-success/10`:`bg-muted`}`,children:(0,D.jsx)(_,{className:`w-4 h-4 ${B?`text-tone-success-fg`:`text-tone-neutral-fg`}`})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(w,{className:`text-sm font-medium truncate`,children:e.hostname}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.id.slice(0,16),`…`]})]}),(0,D.jsx)(b,{className:`text-[10px] shrink-0 ${z}`,children:R})]})}),(0,D.jsxs)(C,{className:`px-4 pb-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,D.jsx)(`span`,{className:B?`text-tone-success-fg`:`text-tone-neutral-fg`,children:e.status}),V&&(0,D.jsxs)(`span`,{children:[e.package?.name||`orchestrator`,` v`,V]}),e.gitSha&&(0,D.jsx)(`span`,{className:`font-mono`,title:e.gitSha,children:e.gitSha.slice(0,12)}),U&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20 gap-1`,children:[(0,D.jsx)(l,{className:`w-3 h-3 animate-pulse`}),`upgrading → v`,H.desiredVersion]}),!U&&H?.status===`failed`&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20 gap-1`,title:H.error,children:[(0,D.jsx)(v,{className:`w-3 h-3`}),`upgrade failed`]}),!U&&W&&(0,D.jsxs)(b,{className:`text-[10px] bg-tone-info/10 text-tone-info-fg border-tone-info/20`,children:[`→ v`,j,` available`]}),(0,D.jsx)(`span`,{className:`ml-auto`,children:s(t,e.lastSeen)})]}),q.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:q.map(e=>(0,D.jsxs)(b,{variant:`secondary`,title:`degraded`in e&&e.degraded?e.degraded.reason:e.available?`version`in e&&e.version?e.version:e.name:`reason`in e&&e.reason?e.reason:`${e.name} unavailable`,className:`text-[10px] ${`degraded`in e&&e.degraded?`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20`:e.available?`bg-tone-success/10 text-tone-success-fg border-tone-success/20`:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20`}`,children:[e.name,`degraded`in e&&e.degraded?` (probe degraded)`:``]},e.name))}),K.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:K.map(([e,t])=>(0,D.jsxs)(b,{variant:`secondary`,className:`text-[10px]`,children:[e,`=`,t]},e))}),e.managedAgents.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Managed agents (`,e.managedAgents.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-0`,children:e.managedAgents.map(t=>(0,D.jsx)(k,{agent:t,orch:e},t.agentId))})]})]}),e.queuedSpawns&&e.queuedSpawns.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Queued spawns (`,e.queuedSpawns.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-0`,children:e.queuedSpawns.map((e,t)=>(0,D.jsx)(O,{queued:e},e.spawnRequestId||`${e.provider}-${t}`))})]})]}),J.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:[`Workspaces (`,J.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-1`,children:J.map(({agent:t,workspace:n})=>(0,D.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 rounded border border-border/60 px-2 py-1.5 text-left hover:bg-accent/40`,onClick:()=>n.worktreePath&&void N({orchestratorId:e.id,path:n.worktreePath}),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,D.jsx)(`span`,{className:`truncate font-medium`,children:n.branch||t.label||t.agentId.slice(-12)}),(0,D.jsx)(g,{agent:L[t.agentId]}),n.status&&(0,D.jsx)(b,{variant:`outline`,className:`h-4 shrink-0 text-[10px]`,children:n.status})]}),(0,D.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:n.worktreePath||n.repoRoot})]},n.id||n.worktreePath))})]})]}),(0,D.jsx)(c,{}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,title:`Edit host providers`,onClick:()=>{F(e.id),u(!0)},children:[(0,D.jsx)(f,{className:`w-3 h-3`}),`Edit host`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>M(e.id),children:[(0,D.jsx)(p,{className:`w-3 h-3`}),`Spawn agent`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>I(e.id),children:[(0,D.jsx)(h,{className:`w-3 h-3`}),`Refresh providers`]}),(G||U)&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,disabled:U,className:`h-7 text-xs gap-1 text-tone-info-fg hover:text-tone-info-fg border-tone-info/30 disabled:opacity-60`,title:U?`Upgrading to v${H.desiredVersion}…`:`Upgrade to v${j}`,onClick:()=>A(e.id),children:[(0,D.jsx)(l,{className:`w-3 h-3 ${U?`animate-pulse`:``}`}),U?`Upgrading…`:`Upgrade`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>d(e.id,`restart`,void 0,`orchestrators`),children:[(0,D.jsx)(h,{className:`w-3 h-3`}),`Restart all`]}),B&&(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1 text-tone-danger-fg hover:text-tone-danger-fg border-tone-danger/30`,onClick:()=>d(e.id,`shutdown`,void 0,`orchestrators`),children:[(0,D.jsx)(m,{className:`w-3 h-3`}),`Shutdown all`]}),(0,D.jsx)(y,{size:`sm`,variant:`ghost`,className:`h-7 text-xs text-muted-foreground hover:text-tone-danger-fg`,onClick:()=>P(e.id),children:`Remove`})]})]}),(0,D.jsx)(x,{orchId:e.id,hostname:e.hostname,open:n,onOpenChange:u})]})}function j(){let e=r(e=>e.orchestrators),t=r(e=>e.openOrchestratorSpawn),n=r(e=>e.openOrchestratorInstall),i=e.filter(e=>e.status===`online`).length;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-semibold`,children:`Orchestrators`}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Multi-host agent lifecycle managers`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,D.jsxs)(b,{variant:`outline`,className:`text-xs`,children:[i,` online`]}),(0,D.jsxs)(y,{size:`sm`,variant:`outline`,className:`gap-1`,onClick:n,children:[(0,D.jsx)(_,{className:`w-3.5 h-3.5`}),`Add`]}),(0,D.jsxs)(y,{size:`sm`,className:`gap-1`,onClick:t,children:[(0,D.jsx)(p,{className:`w-3.5 h-3.5`}),`Spawn`]})]})]}),e.length===0?(0,D.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No orchestrators registered.`}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,D.jsx)(A,{orch:e},e.id))})]})}export{j as OrchestratorsView};
|
|
2
|
+
//# sourceMappingURL=orchestrators-Dg-vfP09.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{A as i,Ct as a,J as o,K as s,t as c}from"./store-DcClXLH0.js";import{R as l,_ as u,b as d,et as f,f as p,it as m,tt as h,wt as g}from"./display-BrKWFGJz.js";import{t as _}from"./scroll-area-CIN4KQse.js";import{t as v}from"./separator-t1cLZErD.js";import{t as y}from"./activity-TMzFOdh2.js";import{t as b}from"./bot-B0NpDNhr.js";import{n as x,t as S}from"./zap-DGuDTw4w.js";import{t as ee}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as C}from"./inbox-Dfwk3Gt8.js";import{t as w}from"./link-6RR7Hy3-.js";import{t as T}from"./list-checks-CwnS3hly.js";import{t as E}from"./mail-DyaDmwfY.js";import{t as D}from"./message-square-C-1G8dMM.js";import{t as O}from"./triangle-alert-BBNhfgMi.js";import{t as k}from"./agent-type-icon-LrUEU3lB.js";import{t as A}from"./users-C7B3u9jv.js";import{t as j}from"./badge-DqJRtj_p.js";import{n as M,t as N}from"./agent-name-DKbiIhBo.js";import{i as P,l as F,r as I}from"./use-selectors-BZa25xEB.js";import{t as L}from"./status-dot-DYqlEUhJ.js";import{o as R,r as z,s as B,t as V}from"./card-C4QJ4hCW.js";import{i as H,t as U}from"./use-decisions-samMQhQf.js";var W=e(n(),1),G=r();function K(){let e=c(e=>e.openDecisions),n=c(e=>e.agentsById),r=c(e=>e.openInboxThread),i=c(e=>e.switchView),l=a(),[u,d]=(0,W.useState)(null);return e.length?(0,G.jsxs)(V,{"data-testid":`waiting-on-you`,className:`border-tone-warning/40`,children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium text-tone-warning-fg flex items-center gap-2`,children:[(0,G.jsx)(x,{className:`w-4 h-4`}),`Waiting on you (`,s(e,l),`)`]})}),(0,G.jsx)(z,{className:`px-4 pb-4 space-y-1.5`,children:e.map(e=>{let a=e.coordinatorId?n[e.coordinatorId]:void 0,s=u===e.id;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:t(`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/50`,s&&`bg-muted/40`),children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>d(s?null:e.id),children:[e.timeCritical&&(0,G.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-tone-danger-fg`,"aria-label":`time-critical`}),e.kind===`action`&&(0,G.jsx)(`span`,{title:o(e)?`Secret to enter`:`To do for you`,className:`shrink-0 rounded bg-tone-sky/15 px-1 text-[10px] font-medium leading-4 text-tone-sky-fg`,children:o(e)?`Secret`:`To do`}),(0,G.jsx)(`span`,{className:`truncate text-sm`,children:e.title}),(0,G.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[o(e)?(0,G.jsx)(N,{agent:n[e.filedBy],fallback:e.filedBy}):(0,G.jsx)(N,{agent:a,fallback:e.coordinatorId??`no coordinator`}),` · `,f(l,e.createdAt)]})]}),e.coordinatorId&&(0,G.jsx)(`button`,{type:`button`,title:`Open coordinator chat`,className:`shrink-0 rounded p-1 text-muted-foreground hover:text-foreground`,onClick:()=>{r(e.coordinatorId),i(`chat`)},children:(0,G.jsx)(D,{className:`h-3.5 w-3.5`})})]}),s&&(0,G.jsx)(H,{decision:e,className:`mt-1.5`},U(e))]},e.id)})})]}):null}function q(){let e=c(e=>e.stats),t=c(e=>e.agents),n=c(e=>e.messages),r=c(e=>e.health),o=a(),s=c(e=>e.agentsById),x=c(e=>e.switchView),S=c(e=>e.runHealthAction),N=c(e=>e.managedPolicies),H=c(e=>e.showOffline),U=F(),q=P(),J=I(),Y=(0,W.useMemo)(()=>{let e=m(t,!1,N);return H||(e=e.filter(e=>e.status!==`offline`)),[...e].sort((e,t)=>(g[e.status]??9)-(g[t.status]??9)||h(t.lastSeen)-h(e.lastSeen))},[t,H,N]),X=Y.slice(0,20),Z=[...n].sort((e,t)=>t.id-e.id).slice(0,15),Q=c(e=>i(e.sessionUser))&&r&&r.status!==`ok`?d(r.checks||[]):[];function $(e){x(e)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(K,{}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`agents`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(A,{className:`w-3.5 h-3.5`}),`Agents`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:Y.length}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[U,` online`]})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`agents`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(y,{className:`w-3.5 h-3.5`}),`Busy`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:q}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`in a turn now`})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`messages`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(D,{className:`w-3.5 h-3.5`}),`Messages 24h`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messagesLast24h??`—`}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`last 24 hours`})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`messages`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(E,{className:`w-3.5 h-3.5`}),`Total Messages`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messages??`—`}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`all time`})]})]})]}),(r?.gitSha||r?.mainSha)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground px-1`,children:[(0,G.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),r.gitSha?(0,G.jsxs)(`span`,{children:[`running `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.gitSha.slice(0,7)})]}):(0,G.jsx)(`span`,{children:`running sha unattested`}),r.mainSha===void 0?(0,G.jsx)(j,{variant:`outline`,className:`border-tone-neutral text-muted-foreground`,children:`main HEAD unknown`}):r.atMainHead===!0?(0,G.jsx)(j,{variant:`outline`,className:`border-tone-success/40 text-tone-success-fg`,children:`at origin/main HEAD`}):r.atMainHead===!1?(0,G.jsxs)(j,{variant:`outline`,className:`border-tone-yellow/40 text-tone-yellow-fg`,children:[`differs from origin/main (`,(0,G.jsx)(`span`,{className:`font-mono`,children:r.mainSha.slice(0,7)}),`)`]}):(0,G.jsxs)(j,{variant:`outline`,className:`border-tone-neutral text-muted-foreground`,children:[`origin/main `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.mainSha.slice(0,7)})]})]}),Q.length>0&&(0,G.jsxs)(V,{className:`border-tone-yellow/40 bg-tone-yellow/5`,children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium text-tone-yellow-fg flex items-center gap-2`,children:[(0,G.jsx)(O,{className:`w-4 h-4`}),`Health Alerts (`,Q.length,`)`]})}),(0,G.jsx)(z,{className:`px-4 pb-4 space-y-2`,children:Q.map(e=>(0,G.jsxs)(`div`,{className:`text-sm space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(j,{variant:`outline`,className:e.status===`error`?`border-tone-danger/40 text-tone-danger-fg`:`border-tone-yellow/40 text-tone-yellow-fg`,children:e.status}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.detail}),e.subjects.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.subjects.map(e=>(0,G.jsxs)(j,{variant:`secondary`,className:`max-w-full truncate text-[11px]`,title:[e.id,e.status,e.detail].filter(Boolean).join(` · `),children:[e.label||e.id,e.status?` · ${e.status}`:``,e.detail?` · ${e.detail}`:``]},e.id))}),e.actions.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-0.5`,children:e.actions.slice(0,3).map(e=>(0,G.jsx)(`button`,{onClick:()=>S(e),className:`text-xs text-tone-info-fg hover:text-tone-info-fg underline underline-offset-2`,children:e.label},e.label))})]},e.name))})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.unreadInbox>0?`border-tone-danger/40`:``}`,onClick:()=>$(`chat`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.unreadInbox>0?`bg-tone-danger/15`:`bg-muted`}`,children:(0,G.jsx)(C,{className:`w-4 h-4 ${J.unreadInbox>0?`text-tone-danger-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.unreadInbox}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Unread`})]})]})}),(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.pendingPairInvites>0?`border-tone-yellow/40`:``}`,onClick:()=>$(`pairs`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.pendingPairInvites>0?`bg-tone-yellow/15`:`bg-muted`}`,children:(0,G.jsx)(w,{className:`w-4 h-4 ${J.pendingPairInvites>0?`text-tone-yellow-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.pendingPairInvites}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Pair invites`})]})]})}),(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.claimableTasks>0?`border-tone-orange/40`:``}`,onClick:()=>$(`work`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.claimableTasks>0?`bg-tone-orange/15`:`bg-muted`}`,children:(0,G.jsx)(T,{className:`w-4 h-4 ${J.claimableTasks>0?`text-tone-orange-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.claimableTasks}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Claimable waiting`})]})]})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,G.jsxs)(V,{children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(b,{className:`w-4 h-4 text-muted-foreground`}),`Agents`,(0,G.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:X.length})]})}),(0,G.jsx)(z,{className:`px-0 pb-0`,children:(0,G.jsx)(_,{className:`h-[340px]`,children:X.length===0?(0,G.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No agents registered.`}):(0,G.jsx)(`div`,{className:`space-y-0`,children:X.map((e,t)=>(0,G.jsxs)(`div`,{children:[t>0&&(0,G.jsx)(v,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 hover:bg-muted/50 transition-colors cursor-pointer`,onClick:()=>c.getState().openAgentDetail(e),children:[(0,G.jsx)(L,{agent:e,now:o}),(0,G.jsx)(k,{agent:e}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium truncate`,children:p(e)}),e.tags.length>0&&(0,G.jsx)(`div`,{className:`flex gap-1 mt-0.5 flex-wrap`,children:e.tags.slice(0,2).map(e=>(0,G.jsx)(j,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})]}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:f(o,e.lastSeen)})]})]},e.id))})})})]}),(0,G.jsxs)(V,{children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(y,{className:`w-4 h-4 text-muted-foreground`}),`Recent Activity`,(0,G.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:Z.length})]})}),(0,G.jsx)(z,{className:`px-0 pb-0`,children:(0,G.jsx)(_,{className:`h-[340px]`,children:Z.length===0?(0,G.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No recent messages.`}):(0,G.jsx)(`div`,{className:`space-y-0`,children:Z.map((e,t)=>(0,G.jsxs)(`div`,{children:[t>0&&(0,G.jsx)(v,{}),(0,G.jsxs)(`div`,{className:`px-4 py-2.5 hover:bg-muted/50 transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground mb-0.5`,children:[(0,G.jsx)(`span`,{className:`text-foreground font-medium truncate max-w-[100px]`,children:(0,G.jsx)(M,{target:e.from,agentsById:s})}),(0,G.jsx)(`span`,{children:`→`}),(0,G.jsx)(`span`,{className:`truncate max-w-[100px]`,children:(0,G.jsx)(M,{target:e.to,agentsById:s})}),(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,G.jsx)(`span`,{className:`opacity-40 mr-1`,children:u(e.id)}),f(o,e.createdAt)]})]}),(0,G.jsx)(`div`,{className:`text-xs text-foreground line-clamp-2 leading-snug`,children:l(e)})]})]},e.id))})})})]})]})]})}export{q as OverviewView};
|
|
2
|
-
//# sourceMappingURL=overview-
|
|
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{A as i,Ct as a,J as o,K as s,t as c}from"./store-DKPDIZBe.js";import{R as l,_ as u,b as d,et as f,f as p,it as m,tt as h,wt as g}from"./display-CDeH4I8T.js";import{t as _}from"./scroll-area-CIN4KQse.js";import{t as v}from"./separator-t1cLZErD.js";import{t as y}from"./activity-TMzFOdh2.js";import{t as b}from"./bot-B0NpDNhr.js";import{n as x,t as S}from"./zap-DGuDTw4w.js";import{t as ee}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as C}from"./inbox-Dfwk3Gt8.js";import{t as w}from"./link-6RR7Hy3-.js";import{t as T}from"./list-checks-CwnS3hly.js";import{t as E}from"./mail-DyaDmwfY.js";import{t as D}from"./message-square-C-1G8dMM.js";import{t as O}from"./triangle-alert-BBNhfgMi.js";import{t as k}from"./agent-type-icon-CY113sp-.js";import{t as A}from"./users-C7B3u9jv.js";import{t as j}from"./badge-DqJRtj_p.js";import{n as M,t as N}from"./agent-name-CcY3Aijy.js";import{i as P,l as F,r as I}from"./use-selectors-BdxBW8mL.js";import{t as L}from"./status-dot-BcHyw1Vw.js";import{o as R,r as z,s as B,t as V}from"./card-C4QJ4hCW.js";import{i as H,t as U}from"./use-decisions-uJXHf34W.js";var W=e(n(),1),G=r();function K(){let e=c(e=>e.openDecisions),n=c(e=>e.agentsById),r=c(e=>e.openInboxThread),i=c(e=>e.switchView),l=a(),[u,d]=(0,W.useState)(null);return e.length?(0,G.jsxs)(V,{"data-testid":`waiting-on-you`,className:`border-tone-warning/40`,children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium text-tone-warning-fg flex items-center gap-2`,children:[(0,G.jsx)(x,{className:`w-4 h-4`}),`Waiting on you (`,s(e,l),`)`]})}),(0,G.jsx)(z,{className:`px-4 pb-4 space-y-1.5`,children:e.map(e=>{let a=e.coordinatorId?n[e.coordinatorId]:void 0,s=u===e.id;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:t(`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/50`,s&&`bg-muted/40`),children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>d(s?null:e.id),children:[e.timeCritical&&(0,G.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-tone-danger-fg`,"aria-label":`time-critical`}),e.kind===`action`&&(0,G.jsx)(`span`,{title:o(e)?`Secret to enter`:`To do for you`,className:`shrink-0 rounded bg-tone-sky/15 px-1 text-[10px] font-medium leading-4 text-tone-sky-fg`,children:o(e)?`Secret`:`To do`}),(0,G.jsx)(`span`,{className:`truncate text-sm`,children:e.title}),(0,G.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[o(e)?(0,G.jsx)(N,{agent:n[e.filedBy],fallback:e.filedBy}):(0,G.jsx)(N,{agent:a,fallback:e.coordinatorId??`no coordinator`}),` · `,f(l,e.createdAt)]})]}),e.coordinatorId&&(0,G.jsx)(`button`,{type:`button`,title:`Open coordinator chat`,className:`shrink-0 rounded p-1 text-muted-foreground hover:text-foreground`,onClick:()=>{r(e.coordinatorId),i(`chat`)},children:(0,G.jsx)(D,{className:`h-3.5 w-3.5`})})]}),s&&(0,G.jsx)(H,{decision:e,className:`mt-1.5`},U(e))]},e.id)})})]}):null}function q(){let e=c(e=>e.stats),t=c(e=>e.agents),n=c(e=>e.messages),r=c(e=>e.health),o=a(),s=c(e=>e.agentsById),x=c(e=>e.switchView),S=c(e=>e.runHealthAction),N=c(e=>e.managedPolicies),H=c(e=>e.showOffline),U=F(),q=P(),J=I(),Y=(0,W.useMemo)(()=>{let e=m(t,!1,N);return H||(e=e.filter(e=>e.status!==`offline`)),[...e].sort((e,t)=>(g[e.status]??9)-(g[t.status]??9)||h(t.lastSeen)-h(e.lastSeen))},[t,H,N]),X=Y.slice(0,20),Z=[...n].sort((e,t)=>t.id-e.id).slice(0,15),Q=c(e=>i(e.sessionUser))&&r&&r.status!==`ok`?d(r.checks||[]):[];function $(e){x(e)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(K,{}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`agents`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(A,{className:`w-3.5 h-3.5`}),`Agents`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:Y.length}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[U,` online`]})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`agents`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(y,{className:`w-3.5 h-3.5`}),`Busy`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:q}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`in a turn now`})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`messages`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(D,{className:`w-3.5 h-3.5`}),`Messages 24h`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messagesLast24h??`—`}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`last 24 hours`})]})]}),(0,G.jsxs)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors`,onClick:()=>$(`messages`),children:[(0,G.jsx)(R,{className:`pb-1 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(E,{className:`w-3.5 h-3.5`}),`Total Messages`]})}),(0,G.jsxs)(z,{className:`px-4 pb-4`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messages??`—`}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`all time`})]})]})]}),(r?.gitSha||r?.mainSha)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground px-1`,children:[(0,G.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),r.gitSha?(0,G.jsxs)(`span`,{children:[`running `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.gitSha.slice(0,7)})]}):(0,G.jsx)(`span`,{children:`running sha unattested`}),r.mainSha===void 0?(0,G.jsx)(j,{variant:`outline`,className:`border-tone-neutral text-muted-foreground`,children:`main HEAD unknown`}):r.atMainHead===!0?(0,G.jsx)(j,{variant:`outline`,className:`border-tone-success/40 text-tone-success-fg`,children:`at origin/main HEAD`}):r.atMainHead===!1?(0,G.jsxs)(j,{variant:`outline`,className:`border-tone-yellow/40 text-tone-yellow-fg`,children:[`differs from origin/main (`,(0,G.jsx)(`span`,{className:`font-mono`,children:r.mainSha.slice(0,7)}),`)`]}):(0,G.jsxs)(j,{variant:`outline`,className:`border-tone-neutral text-muted-foreground`,children:[`origin/main `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.mainSha.slice(0,7)})]})]}),Q.length>0&&(0,G.jsxs)(V,{className:`border-tone-yellow/40 bg-tone-yellow/5`,children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium text-tone-yellow-fg flex items-center gap-2`,children:[(0,G.jsx)(O,{className:`w-4 h-4`}),`Health Alerts (`,Q.length,`)`]})}),(0,G.jsx)(z,{className:`px-4 pb-4 space-y-2`,children:Q.map(e=>(0,G.jsxs)(`div`,{className:`text-sm space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(j,{variant:`outline`,className:e.status===`error`?`border-tone-danger/40 text-tone-danger-fg`:`border-tone-yellow/40 text-tone-yellow-fg`,children:e.status}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.detail}),e.subjects.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.subjects.map(e=>(0,G.jsxs)(j,{variant:`secondary`,className:`max-w-full truncate text-[11px]`,title:[e.id,e.status,e.detail].filter(Boolean).join(` · `),children:[e.label||e.id,e.status?` · ${e.status}`:``,e.detail?` · ${e.detail}`:``]},e.id))}),e.actions.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-0.5`,children:e.actions.slice(0,3).map(e=>(0,G.jsx)(`button`,{onClick:()=>S(e),className:`text-xs text-tone-info-fg hover:text-tone-info-fg underline underline-offset-2`,children:e.label},e.label))})]},e.name))})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.unreadInbox>0?`border-tone-danger/40`:``}`,onClick:()=>$(`chat`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.unreadInbox>0?`bg-tone-danger/15`:`bg-muted`}`,children:(0,G.jsx)(C,{className:`w-4 h-4 ${J.unreadInbox>0?`text-tone-danger-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.unreadInbox}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Unread`})]})]})}),(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.pendingPairInvites>0?`border-tone-yellow/40`:``}`,onClick:()=>$(`pairs`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.pendingPairInvites>0?`bg-tone-yellow/15`:`bg-muted`}`,children:(0,G.jsx)(w,{className:`w-4 h-4 ${J.pendingPairInvites>0?`text-tone-yellow-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.pendingPairInvites}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Pair invites`})]})]})}),(0,G.jsx)(V,{className:`cursor-pointer hover:border-tone-neutral transition-colors ${J.claimableTasks>0?`border-tone-orange/40`:``}`,onClick:()=>$(`work`),children:(0,G.jsxs)(z,{className:`p-4 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${J.claimableTasks>0?`bg-tone-orange/15`:`bg-muted`}`,children:(0,G.jsx)(T,{className:`w-4 h-4 ${J.claimableTasks>0?`text-tone-orange-fg`:`text-tone-neutral-fg`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-lg font-bold`,children:J.claimableTasks}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Claimable waiting`})]})]})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,G.jsxs)(V,{children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(b,{className:`w-4 h-4 text-muted-foreground`}),`Agents`,(0,G.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:X.length})]})}),(0,G.jsx)(z,{className:`px-0 pb-0`,children:(0,G.jsx)(_,{className:`h-[340px]`,children:X.length===0?(0,G.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No agents registered.`}):(0,G.jsx)(`div`,{className:`space-y-0`,children:X.map((e,t)=>(0,G.jsxs)(`div`,{children:[t>0&&(0,G.jsx)(v,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 hover:bg-muted/50 transition-colors cursor-pointer`,onClick:()=>c.getState().openAgentDetail(e),children:[(0,G.jsx)(L,{agent:e,now:o}),(0,G.jsx)(k,{agent:e}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium truncate`,children:p(e)}),e.tags.length>0&&(0,G.jsx)(`div`,{className:`flex gap-1 mt-0.5 flex-wrap`,children:e.tags.slice(0,2).map(e=>(0,G.jsx)(j,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})]}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:f(o,e.lastSeen)})]})]},e.id))})})})]}),(0,G.jsxs)(V,{children:[(0,G.jsx)(R,{className:`pb-2 pt-4 px-4`,children:(0,G.jsxs)(B,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(y,{className:`w-4 h-4 text-muted-foreground`}),`Recent Activity`,(0,G.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:Z.length})]})}),(0,G.jsx)(z,{className:`px-0 pb-0`,children:(0,G.jsx)(_,{className:`h-[340px]`,children:Z.length===0?(0,G.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No recent messages.`}):(0,G.jsx)(`div`,{className:`space-y-0`,children:Z.map((e,t)=>(0,G.jsxs)(`div`,{children:[t>0&&(0,G.jsx)(v,{}),(0,G.jsxs)(`div`,{className:`px-4 py-2.5 hover:bg-muted/50 transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground mb-0.5`,children:[(0,G.jsx)(`span`,{className:`text-foreground font-medium truncate max-w-[100px]`,children:(0,G.jsx)(M,{target:e.from,agentsById:s})}),(0,G.jsx)(`span`,{children:`→`}),(0,G.jsx)(`span`,{className:`truncate max-w-[100px]`,children:(0,G.jsx)(M,{target:e.to,agentsById:s})}),(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,G.jsx)(`span`,{className:`opacity-40 mr-1`,children:u(e.id)}),f(o,e.createdAt)]})]}),(0,G.jsx)(`div`,{className:`text-xs text-foreground line-clamp-2 leading-snug`,children:l(e)})]})]},e.id))})})})]})]})]})}export{q as OverviewView};
|
|
2
|
+
//# sourceMappingURL=overview-DcYCrvlr.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"./dist-DeW2Y1R5.js";import{t,wt as n}from"./store-
|
|
2
|
-
//# sourceMappingURL=pairs-
|
|
1
|
+
import{u as e}from"./dist-DeW2Y1R5.js";import{t,wt as n}from"./store-DKPDIZBe.js";import{bt as r,et as i,v as a}from"./display-CDeH4I8T.js";import{t as o}from"./scroll-area-CIN4KQse.js";import{t as s}from"./arrow-right-vFsRqG8V.js";import{t as c}from"./link-2-off-DfRF9Hwb.js";import{t as l}from"./link-6RR7Hy3-.js";import{t as u}from"./mail-DyaDmwfY.js";import{t as d}from"./user-plus-D9749q73.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{t as m}from"./agent-name-CcY3Aijy.js";import{o as h,r as g,t as _}from"./card-C4QJ4hCW.js";var v=e(),y=[{value:`open`,label:`Active & Pending`},{value:`active`,label:`Active`},{value:`pending`,label:`Pending`},{value:`ended`,label:`Ended`},{value:`rejected`,label:`Rejected`},{value:`expired`,label:`Expired`},{value:``,label:`All`}];function b(){let e=n(),r=t(e=>e.pairs),i=t(e=>e.agentsById),a=t(e=>e.pairStatusFilter),s=t(e=>e.set),c=t(e=>e.fetchPairs),u=t(e=>e.openPairInvite),h=t(e=>e.openPairMessage),g=t(e=>e.doAcceptPair),_=t(e=>e.doRejectPair),b=t(e=>e.doHangupPair),S=r.filter(e=>e.status===`pending`).length;function C(e){s({pairStatusFilter:e}),setTimeout(()=>c(),0)}function w(e){return(0,v.jsx)(m,{agent:i[e],fallback:e.slice(-10)})}return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(l,{className:`w-5 h-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Pair Sessions`}),S>0&&(0,v.jsxs)(p,{className:`bg-tone-yellow/20 text-tone-yellow-fg border-tone-yellow/30 border`,children:[S,` pending`]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>C(e.target.value),children:y.map(e=>(0,v.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,v.jsxs)(f,{size:`sm`,onClick:()=>u(),children:[(0,v.jsx)(d,{className:`w-4 h-4 mr-1`}),` Pair agents`]})]})]}),(0,v.jsx)(o,{className:`h-[calc(100dvh-11rem)]`,children:(0,v.jsxs)(`div`,{className:`space-y-3 pr-2`,children:[r.length===0&&(0,v.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No pair sessions`}),r.map(t=>(0,v.jsx)(x,{pair:t,now:e,agentName:w,onAccept:()=>g(t),onReject:()=>_(t),onMessage:()=>h(t),onHangup:()=>b(t)},t.id))]})})]})}function x({pair:e,now:t,agentName:n,onAccept:o,onReject:l,onMessage:d,onHangup:m}){let y=r[e.status]||`bg-tone-neutral/20 text-tone-neutral-fg`,b=e.status===`pending`,x=e.status===`active`;return(0,v.jsxs)(_,{children:[(0,v.jsx)(h,{className:`py-3 px-4 pb-0`,children:(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap flex-1 min-w-0`,children:[(0,v.jsx)(p,{className:`${y} border text-xs`,children:e.status}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm min-w-0`,children:[(0,v.jsx)(`span`,{className:`font-medium truncate max-w-[120px]`,title:e.requesterId,children:n(e.requesterId)}),(0,v.jsx)(s,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,v.jsx)(`span`,{className:`font-medium truncate max-w-[120px]`,title:e.targetId,children:n(e.targetId)})]})]}),(0,v.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,v.jsx)(`div`,{className:`text-xs font-mono text-muted-foreground/60 truncate max-w-[100px]`,children:e.id.slice(-10)}),(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,title:a(e.updatedAt),children:i(t,e.updatedAt)})]})]})}),(0,v.jsxs)(g,{className:`px-4 py-3`,children:[e.objective&&(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground mb-3 line-clamp-2`,children:e.objective}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[b&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(f,{size:`sm`,className:`bg-tone-success-fg hover:bg-tone-success-fg/90 text-background h-7 text-xs`,onClick:o,children:`Accept`}),(0,v.jsx)(f,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-tone-danger-fg hover:text-tone-danger-fg`,onClick:l,children:`Reject`})]}),x&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(f,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:d,children:[(0,v.jsx)(u,{className:`w-3.5 h-3.5 mr-1`}),` Message`]}),(0,v.jsxs)(f,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-tone-danger-fg hover:text-tone-danger-fg`,onClick:m,children:[(0,v.jsx)(c,{className:`w-3.5 h-3.5 mr-1`}),` Hang up`]})]})]})]})]})}export{b as PairsView};
|
|
2
|
+
//# sourceMappingURL=pairs-8o9nuG3V.js.map
|