@humwick/server 0.130.1 → 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/README.md +5 -0
- 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-administration.md +4 -0
- package/docs/guides/tools-coordination.md +2 -0
- package/docs/guides/tools-tasks.md +8 -0
- package/docs/guides/workflows.md +74 -0
- package/docs/openapi.json +486 -4
- package/package.json +10 -18
- package/public/assets/{MessageBubble-BWpoBjl4.js → MessageBubble-Bq9kr21N.js} +2 -2
- package/public/assets/{PlanGraphPanel-C0auck3n.js → PlanGraphPanel-Dqiroy06.js} +2 -2
- package/public/assets/{TraceView-DBnOx7AQ.js → TraceView-DYU962-H.js} +2 -2
- package/public/assets/{VaultDecisionCard-0kp2oNBC.js → VaultDecisionCard-DhPfzioE.js} +2 -2
- package/public/assets/{activity-yLztXEBt.js → activity-DzCcQTee.js} +2 -2
- package/public/assets/{agent-lineage-BbJDR1dW.js → agent-lineage-SgDt9i3T.js} +2 -2
- package/public/assets/agent-liveness-Bq-s73jW.js +2 -0
- package/public/assets/{agent-name-CTZBrSD9.js → agent-name-CcY3Aijy.js} +2 -2
- package/public/assets/agent-profiles-cxtRBn6O.js +2 -0
- package/public/assets/{agent-project-badge-9TqzUUYE.js → agent-project-badge-DGYbIhaI.js} +2 -2
- package/public/assets/{agent-tools-D4n40pn8.js → agent-tools-DHbftV0N.js} +2 -2
- package/public/assets/{agent-type-icon-D6FUarOf.js → agent-type-icon-CY113sp-.js} +2 -2
- package/public/assets/{agents-BYDslkJc.js → agents-BPzY7IlQ.js} +2 -2
- package/public/assets/{analytics-B-XSbEMC.js → analytics-DENFPv_a.js} +2 -2
- package/public/assets/{artifact-viewer-DdWIfV6M.js → artifact-viewer-KRvSc7sl.js} +2 -2
- package/public/assets/{artifacts-DPN1q4pA.js → artifacts-C9gSmL3s.js} +2 -2
- package/public/assets/{artifacts-oBOqks-2.js → artifacts-DT-HkI5O.js} +2 -2
- package/public/assets/{automation-4KcRFXEu.js → automation-BsmjQhKD.js} +2 -2
- package/public/assets/{backlog-Cw9xPTCF.js → backlog-8NYH_62t.js} +2 -2
- package/public/assets/{busy-health-CTu32MZt.js → busy-health-D3hwvYb4.js} +2 -2
- package/public/assets/{channels-BiXzg1G9.js → channels-DCJ5WL7O.js} +2 -2
- package/public/assets/{chat-Ctk2qwvA.js → chat-DAIl357U.js} +3 -3
- package/public/assets/{code-preview-Bm1wWqAp.js → code-preview-CzrZfr9U.js} +2 -2
- package/public/assets/{connectors-C36ax4Vw.js → connectors-xTxtlyou.js} +2 -2
- package/public/assets/{cosmos-Jj9LK2Wf.js → cosmos-BpebFLK2.js} +2 -2
- package/public/assets/{crate-agent-H6S7-B9T.js → crate-agent-BHvI5wXC.js} +2 -2
- package/public/assets/{dependency-graph-Cd1E23wa.js → dependency-graph-DGT0o3wJ.js} +2 -2
- package/public/assets/{deploys-Bwfq146q.js → deploys-hqWOHSHE.js} +2 -2
- package/public/assets/{display-CfO7rTuF.js → display-CDeH4I8T.js} +2 -2
- package/public/assets/{files-DhhZI2Ih.js → files-BTeGVmTg.js} +2 -2
- package/public/assets/{fleet-B_rFEbnL.js → fleet-DgXtNgCa.js} +2 -2
- package/public/assets/{fleet-metrics-BkHP-P3R.js → fleet-metrics-BHEt5yc_.js} +2 -2
- package/public/assets/{formatted-body-Cm1RrzmN.js → formatted-body-MLtodyPp.js} +3 -3
- package/public/assets/{formatted-body-impl-DQiOuOD1.js → formatted-body-impl-CAe664Z8.js} +2 -2
- package/public/assets/{host-providers-dialog-CHqwXTov.js → host-providers-dialog-mapF4Fj9.js} +2 -2
- package/public/assets/index-CqqgOI5R.js +15 -0
- package/public/assets/index-MYAIwYTX.css +2 -0
- package/public/assets/{insights-fH1EL-qZ.js → insights-DNyf7IzF.js} +2 -2
- package/public/assets/{integrations-C5Oix6ng.js → integrations-DlYOHq7T.js} +2 -2
- package/public/assets/{issue-ref-chip-ODyondIa.js → issue-ref-chip-CeWBNWn7.js} +2 -2
- package/public/assets/{log-viewer-Cvfy6PW7.js → log-viewer-Cib8nqdE.js} +2 -2
- package/public/assets/{maintenance-D8CDH5wZ.js → maintenance-DSn1cPm7.js} +2 -2
- package/public/assets/{managed-agents-egllbpij.js → managed-agents-C3CkM81m.js} +2 -2
- package/public/assets/{markdown-preview-CYSFgVgK.js → markdown-preview-W4VQQPAv.js} +3 -3
- package/public/assets/{markdown-preview-impl-BteVIjX4.js → markdown-preview-impl-CMsTdhjq.js} +2 -2
- package/public/assets/{memory-C8WmXsyr.js → memory-BV17qtO4.js} +2 -2
- package/public/assets/{messages-BzQdqlO6.js → messages-Bm_1AqSA.js} +2 -2
- package/public/assets/{orchestrators-B1HxzkNw.js → orchestrators-Dg-vfP09.js} +2 -2
- package/public/assets/{overview-DCUnI4Z7.js → overview-DcYCrvlr.js} +2 -2
- package/public/assets/{pairs-ftCd2XcD.js → pairs-8o9nuG3V.js} +2 -2
- package/public/assets/{profile-icon-B2zH8DMH.js → profile-icon-BsRyBMea.js} +2 -2
- package/public/assets/project-profile-instructions-DETKFn_E.js +2 -0
- package/public/assets/projects-M_m6AHws.js +2 -0
- package/public/assets/{prompt-settings-Bftq9czX.js → prompt-settings-C_mNCgeL.js} +2 -2
- package/public/assets/provider-display-BEeLXC_D.js +2 -0
- package/public/assets/{registry-DWCU5c8q.js → registry-DDHHHE5N.js} +2 -2
- package/public/assets/run-card-Dt4I4jaP.js +2 -0
- package/public/assets/scroll-text-BKXS1ahr.js +2 -0
- package/public/assets/{secrets-C7GIUATz.js → secrets-BkVwxI5O.js} +2 -2
- package/public/assets/{service-access-settings-C3aujqTG.js → service-access-settings-Crq-6a-B.js} +2 -2
- package/public/assets/{settings-C6sZ9eBa.js → settings-CYcavMFu.js} +2 -2
- package/public/assets/shipping-H6gzEeZB.js +2 -0
- package/public/assets/{stats-V9Z-GxUd.js → stats-BJVeWkpV.js} +2 -2
- package/public/assets/{status-dot-CVv0iGHL.js → status-dot-BcHyw1Vw.js} +2 -2
- package/public/assets/store-DKPDIZBe.js +9 -0
- package/public/assets/{tasks-CXU75HRF.js → tasks-qJjlQPpx.js} +2 -2
- package/public/assets/{teams-BPf976zb.js → teams-Cd5Sk1uX.js} +2 -2
- package/public/assets/{terminal-viewer-DE9BOe-8.js → terminal-viewer-CpY5_m7W.js} +3 -3
- package/public/assets/{terminal-viewer-impl-D04pjmGh.js → terminal-viewer-impl-DI_2llFR.js} +2 -2
- package/public/assets/token-estimate-Co-Jdphh.js +2 -0
- package/public/assets/{use-agent-terminal-B1yR456R.js → use-agent-terminal-0yJA_buM.js} +2 -2
- package/public/assets/{use-decisions-D-S4tpDf.js → use-decisions-uJXHf34W.js} +2 -2
- package/public/assets/use-project-list-CpWl6eHQ.js +2 -0
- package/public/assets/{use-selectors-CnrAk2YP.js → use-selectors-BdxBW8mL.js} +2 -2
- package/public/assets/{user-avatar-nBFIcR4M.js → user-avatar-3IndfpOc.js} +2 -2
- package/public/assets/versioned-prompt-editor-CIVg7XB1.js +8 -0
- package/public/assets/{work-queue-TCjJxeT-.js → work-queue-B9rnLwHZ.js} +2 -2
- package/public/assets/{workflow-marker-Cf3Hf2fN.js → workflow-marker-X8wxyhzC.js} +2 -2
- package/public/assets/{workflows-CXQX20Qj.js → workflows-o5YyMFW7.js} +2 -2
- package/public/assets/{workspaces-qSYzKYMA.js → workspaces-CzEGoAng.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +31 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/plugins/claude/hooks/gate-run-guard.provisioned.mjs +31 -1
- package/runner/src/adapters/claude-effort.ts +2 -4
- package/runner/src/adapters/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/codex-launch-config.ts +4 -5
- package/runner/src/adapters/codex.ts +1 -1
- package/runner/src/adapters/opencode-provider.ts +7 -22
- package/runner/src/adapters/opencode.ts +4 -4
- package/runner/src/adapters/provider-quota-harvest.ts +20 -71
- package/runner/src/agent-runner/credentials.ts +42 -12
- package/runner/src/agent-runner/inbox.ts +27 -0
- package/runner/src/agent-runner/lifecycle-milestones.ts +2 -4
- package/runner/src/agent-runner/liveness-exchange.ts +104 -0
- package/runner/src/bin/claude.ts +4 -0
- package/runner/src/bin/codex.ts +4 -0
- package/runner/src/bin/opencode.ts +4 -0
- package/runner/src/claude-system-prompt.ts +49 -0
- package/runner/src/index.ts +5 -2
- 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 +35 -0
- package/runner/src/providers.ts +2 -1
- package/runner/src/runner-core.ts +32 -38
- package/runner/src/runner-helpers.ts +0 -8
- package/runner/src/session-scratch.ts +6 -2
- package/runner/src/spawn-input.ts +2 -1
- package/runner/src/test-run-dedup.ts +59 -56
- package/runner/test-support/provisioning-context.ts +4 -2
- package/runner/test-support/runner-harness.ts +2 -1
- package/scripts/cd-config.ts +8 -0
- package/scripts/gate-run-lease.ts +10 -7
- package/scripts/gate.sh +5 -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 +93 -0
- package/src/branch-landed.ts +31 -98
- package/src/bus.ts +40 -39
- package/src/cd-deploy-notify.ts +32 -4
- package/src/cd-host-lag-notify.ts +7 -6
- package/src/ci/incidents.ts +2 -2
- package/src/ci/monitor.ts +5 -8
- package/src/ci/notifications.ts +4 -4
- package/src/ci/root-missing.ts +4 -9
- package/src/ci/transition-notify.ts +12 -44
- package/src/claude-app/oauth-http.ts +3 -3
- package/src/cli/cd-pauses.ts +19 -0
- package/src/cli/orchestrator.ts +1 -1
- package/src/cli/state.ts +2 -19
- package/src/cli/task-edit.ts +22 -0
- package/src/cli/task.ts +3 -1
- package/src/cli/workflow.ts +19 -4
- package/src/commands-db.ts +7 -7
- package/src/commands-write.ts +8 -0
- package/src/compaction-watch.ts +10 -8
- package/src/config-store-write.ts +13 -1
- package/src/config-store.ts +25 -14
- package/src/config.ts +4 -11
- package/src/connectors.ts +10 -8
- package/src/context-advisory.ts +22 -21
- package/src/db/activity-async.ts +6 -1
- package/src/db/activity-write-ops.ts +12 -1
- package/src/db/activity.ts +1 -14
- 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/agent-search.ts +1 -15
- package/src/db/agents-async.ts +59 -9
- package/src/db/agents-write-ops.ts +12 -3
- package/src/db/agents.ts +95 -65
- 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/ci-incidents-async.ts +5 -5
- package/src/db/ci-incidents-write-ops.ts +2 -2
- 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/command-row.ts +10 -2
- package/src/db/commands-list-query.ts +2 -0
- package/src/db/commands-planner-stats.test-fixture.ts +8 -0
- package/src/db/commands-read-ops.ts +16 -0
- package/src/db/commands-spawn-read.ts +1 -1
- package/src/db/config-store-write-ops.ts +7 -2
- package/src/db/connection.ts +1 -182
- package/src/db/context-carry-write.ts +74 -0
- package/src/db/continuation-archives-async.ts +5 -0
- package/src/db/continuation-archives-write-ops.ts +7 -0
- package/src/db/continuations.ts +6 -6
- package/src/db/db-error-registry.ts +12 -0
- package/src/db/db-writer-worker.ts +8 -1
- package/src/db/deploy-events-async.ts +1 -0
- package/src/db/deploy-events-read-ops.ts +2 -1
- package/src/db/deploy-events.ts +35 -4
- package/src/db/gateway.ts +26 -133
- package/src/db/history-retention-ops.ts +13 -0
- package/src/db/hosts-registration.ts +10 -2
- package/src/db/hosts.ts +9 -6
- package/src/db/inbox-async.ts +2 -2
- package/src/db/inbox-read-ops.ts +1 -1
- package/src/db/inbox.ts +9 -17
- package/src/db/index.ts +2 -0
- package/src/db/integrations-async.ts +8 -0
- package/src/db/integrations-ops.ts +15 -0
- package/src/db/integrations.ts +15 -21
- package/src/db/issue-associations.ts +2 -2
- package/src/db/issue-lifecycle.ts +3 -4
- package/src/db/issue-refs-async.ts +23 -0
- package/src/db/issue-refs-read-ops.ts +6 -0
- package/src/db/issue-refs-write-ops.ts +29 -0
- package/src/db/issue-refs.ts +15 -16
- 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/long-running-work.ts +2 -2
- package/src/db/main-connection-mode.ts +11 -0
- package/src/db/main-connection-writes.ts +41 -2
- package/src/db/maintenance-job-reconcile.ts +61 -0
- package/src/db/maintenance-job-runs-async.ts +14 -0
- package/src/db/maintenance-job-write-ops.ts +9 -0
- package/src/db/maintenance-pauses.ts +2 -2
- package/src/db/mappers.ts +2 -14
- package/src/db/merge-lease.ts +1 -15
- package/src/db/message-send.ts +4 -0
- package/src/db/messages.ts +31 -25
- package/src/db/migrations.ts +25 -16
- package/src/db/notification-write-ops.ts +19 -0
- package/src/db/operator-answer-write.ts +19 -0
- package/src/db/orchestrators.ts +14 -76
- package/src/db/pairs-async.ts +22 -1
- package/src/db/pairs-write-ops.ts +8 -3
- package/src/db/pairs.ts +42 -61
- 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-profile-instructions.ts +50 -0
- package/src/db/project-trust-approvals.ts +2 -2
- package/src/db/prompt-templates.ts +4 -4
- package/src/db/prompt-versions.ts +9 -2
- package/src/db/provider-config-history.ts +8 -3
- package/src/db/provider-model-seed.ts +34 -0
- package/src/db/read-op-marshaling-fixtures.ts +23 -0
- package/src/db/read-ops.ts +8 -0
- package/src/db/retention.ts +13 -2
- package/src/db/review-publish-write.ts +8 -0
- package/src/db/routing-policy.ts +2 -3
- 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 +13 -4
- package/src/db/spawn-budget.ts +5 -0
- package/src/db/spawn-delegation-state.ts +11 -4
- package/src/db/spawn-delegation.ts +1 -11
- package/src/db/sql-audit-indexes.ts +3 -0
- package/src/db/stats-async.ts +9 -6
- package/src/db/task-entity.ts +28 -6
- package/src/db/task-list.ts +3 -1
- package/src/db/tasks.ts +1 -17
- 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/timer-ingress.ts +7 -1
- package/src/db/token-db-write-ops.ts +19 -0
- package/src/db/token-standing-async.ts +12 -0
- package/src/db/token-standing.ts +21 -20
- 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/workflow-contact.ts +1 -1
- package/src/db/workflow-task-read-ops.ts +30 -0
- package/src/db/workspaces.ts +8 -5
- package/src/db/write-ops.ts +37 -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 +58 -56
- package/src/dev.ts +8 -3
- package/src/dispatch-availability.ts +10 -6
- package/src/ephemeral/{landing-ingress-proof-worker.ts → landing-ingress-proof.test-fixture.ts} +4 -2
- package/src/event-loop-lag.ts +4 -2
- package/src/event-loop-yield.ts +2 -2
- package/src/events.ts +10 -8
- package/src/host/disk-alert.ts +121 -0
- 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 +107 -100
- package/src/maintenance/breaker.ts +18 -16
- package/src/maintenance/cd-watcher.ts +3 -3
- package/src/maintenance/checkout-refresh.ts +18 -1
- package/src/maintenance/critical-job-watchdog.ts +19 -20
- package/src/maintenance/events.ts +3 -3
- package/src/maintenance/history-retention-job.ts +30 -0
- package/src/maintenance/index.ts +1 -0
- package/src/maintenance/jobs.ts +32 -69
- 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 +98 -137
- package/src/maintenance/stalled-delivery-pager.ts +10 -9
- package/src/maintenance/teams.ts +19 -30
- package/src/maintenance/workspaces.ts +18 -28
- package/src/managed-policy-escalation.ts +7 -7
- package/src/managed-policy.ts +32 -28
- package/src/managed-provider-gate.ts +5 -4
- package/src/managed-spawn-reservation.ts +5 -4
- package/src/mcp/index.ts +12 -9
- package/src/mcp/output-descriptions.ts +8 -8
- package/src/mcp/presentation.ts +6 -5
- package/src/mcp/project-profile-instructions.ts +32 -0
- 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 +4 -3
- package/src/mcp/tool-roles.ts +81 -0
- package/src/mcp/tools-spawn.ts +4 -3
- package/src/mcp/tools-workspace.ts +1 -1
- package/src/mcp-agent-action.ts +1 -2
- 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 +13 -12
- package/src/mcp-maintenance-tools.ts +2 -2
- 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 +5 -5
- package/src/mcp-project-journal-tools.ts +4 -12
- package/src/mcp-project-tools.ts +17 -18
- package/src/mcp-provider-catalog.ts +2 -2
- package/src/mcp-routing-policy-tools.ts +3 -2
- package/src/mcp-task-tools.ts +11 -5
- package/src/mcp-team-template-tools.ts +3 -3
- package/src/mcp-team-tools.ts +6 -6
- package/src/mcp-workflow-tools.ts +13 -4
- 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/notification-types.ts +2 -1
- package/src/notify.ts +5 -5
- package/src/observed-reset-refresh.ts +4 -4
- package/src/operator-alarm.ts +23 -11
- package/src/project-ingest.ts +6 -6
- package/src/project-instructions.ts +12 -1
- package/src/project-profile-instruction-text.ts +6 -0
- package/src/project-profile-instructions.ts +20 -0
- package/src/project-trust.ts +12 -11
- package/src/prompt-resolver.ts +3 -3
- package/src/provider-catalog-store.ts +3 -49
- package/src/provider-config-store.ts +12 -11
- package/src/provider-model-seed.ts +1 -18
- package/src/provider-quota-async.ts +5 -7
- package/src/provider-quota-config-store.ts +5 -4
- package/src/provider-secrets.test-fixture.ts +3 -3
- package/src/provider-timeline-event.ts +4 -7
- package/src/quota-band-delivery.ts +2 -2
- package/src/recipe-runner.ts +6 -5
- package/src/repo-config-source.ts +10 -4
- 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-profiles.ts +6 -6
- 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 +2 -2
- package/src/routes/agents.ts +19 -121
- 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 +5 -1
- package/src/routes/commands.ts +31 -29
- package/src/routes/context-resets.ts +2 -2
- package/src/routes/continuation-archives.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 +12 -2
- package/src/routes/integrations.ts +32 -56
- package/src/routes/issue-activity.ts +2 -2
- package/src/routes/issue-associations.ts +4 -4
- package/src/routes/issue-refs.ts +9 -9
- 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 +2 -2
- package/src/routes/orchestrator-host-registration.ts +4 -2
- package/src/routes/orchestrator-host-utilization.ts +5 -3
- package/src/routes/orchestrator-proxy.ts +4 -4
- package/src/routes/orchestrator.ts +28 -19
- package/src/routes/pairs.ts +8 -8
- package/src/routes/project-profile-instructions.ts +27 -0
- package/src/routes/project-trust.ts +3 -3
- package/src/routes/projects.ts +16 -16
- package/src/routes/prompt-templates.ts +12 -12
- package/src/routes/provider-config.ts +6 -6
- package/src/routes/provider-quota-config.ts +2 -2
- 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 +6 -6
- 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/stats.ts +6 -6
- package/src/routes/task-http.ts +15 -1
- package/src/routes/task-issues.ts +11 -26
- package/src/routes/tasks.ts +22 -53
- package/src/routes/team-templates.ts +12 -12
- package/src/routes/teams-config.ts +2 -2
- package/src/routes/teams.ts +10 -10
- package/src/routes/tokens.ts +30 -22
- 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 +22 -7
- package/src/routes/workspaces.ts +17 -16
- package/src/routing-policy-normalize.ts +1 -2
- package/src/routing-policy-push.ts +6 -6
- package/src/routing-step-defaults.ts +0 -2
- package/src/runner-token-mint-limit.ts +63 -0
- package/src/runtime-grant.ts +21 -13
- package/src/runtime-tokens.ts +59 -35
- package/src/secrets-broker/config.ts +1 -1
- package/src/secrets-broker/service.ts +2 -2
- package/src/security.ts +16 -21
- 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 +2 -2
- package/src/server.ts +26 -24
- 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 +27 -4
- package/src/services/idle-agent-digest.ts +17 -12
- package/src/services/idle-epics.ts +9 -10
- 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 +69 -72
- package/src/services/issue-refs.ts +10 -15
- package/src/services/kernel-timers-cutover-chaos-worker.ts +11 -8
- package/src/services/kernel-timers-ingress-chaos-worker.ts +6 -1
- package/src/services/kernel-timers-ingress.ts +4 -4
- 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 +25 -8
- 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 +17 -53
- 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 +57 -0
- package/src/services/plan-ci-recovery.ts +2 -55
- 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 +9 -3
- package/src/services/profile-trust.ts +6 -5
- package/src/services/project-config-read.ts +70 -0
- package/src/services/project-profile-instructions.ts +54 -0
- 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/budget-baseline.json +4 -4
- 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 +74 -61
- 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-care-state.ts +2 -1
- package/src/services/self-effort-grant.ts +5 -25
- package/src/services/self-effort.ts +5 -5
- package/src/services/send-message.ts +21 -34
- package/src/services/shutdown-agent.ts +17 -14
- package/src/services/spawn-agent.ts +25 -43
- package/src/services/spawn-chain-inspector.ts +7 -14
- 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-policy.ts +68 -0
- 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 +8 -9
- 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-dispatch.ts +3 -0
- 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 +8 -17
- package/src/services/task-validation.ts +2 -2
- package/src/services/team-templates.ts +12 -11
- 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 +25 -20
- 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 +26 -13
- package/src/services/workflow-caller.ts +61 -4
- package/src/services/workflow-child-proof-worker.ts +1 -1
- package/src/services/workflow-ci-main.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 +5 -3
- package/src/services/workflow-effect-driver.ts +42 -17
- package/src/services/workflow-effects.ts +58 -37
- package/src/services/workflow-land-notice.ts +10 -0
- package/src/services/workflow-pause-text.ts +43 -0
- package/src/services/workflow-pins.ts +7 -4
- package/src/services/workflow-reconcile.ts +14 -11
- 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 +6 -3
- package/src/services/workflow-run.test-fixture.ts +1 -1
- package/src/services/workflow-runs.ts +61 -33
- package/src/services/workflow-supervisor-state.ts +26 -1
- package/src/services/workflow-supervisor.ts +11 -6
- package/src/services/workspace-recovery.ts +4 -3
- package/src/settings/registry.ts +1 -2
- package/src/spawn-admission.ts +10 -2
- package/src/spawn-command.ts +4 -4
- package/src/spawn-models.ts +10 -12
- package/src/spawn-placement.ts +28 -10
- package/src/spawn-targets.ts +9 -9
- package/src/sse-agent-status.ts +15 -6
- package/src/sse.ts +49 -24
- package/src/startup-context-injection.ts +62 -57
- package/src/state-adoption/cd-cutover.ts +53 -7
- package/src/state-adoption/fleet-cutover.ts +35 -0
- package/src/state-adoption/fleet-plan.ts +36 -0
- package/src/state-adoption/index.ts +2 -2
- package/src/state-adoption/linux-plan.ts +2 -2
- package/src/state-adoption/linux.ts +2 -2
- package/src/state-adoption/macos-plan.ts +2 -2
- package/src/state-adoption/macos.ts +1 -1
- package/src/steward-handoff.ts +4 -3
- package/src/steward-policy-cleanup.ts +9 -8
- package/src/steward.ts +9 -8
- package/src/task-dispatch-live.ts +6 -3
- package/src/task-dispatcher.ts +3 -3
- package/src/teams-config-store.ts +4 -3
- package/src/token-db-write.ts +10 -0
- 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 +26 -17
- 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 +4 -4
- package/node_modules/@humwick/kernel/LICENSE +0 -167
- package/node_modules/@humwick/kernel/async-entity-persistence.ts +0 -344
- package/node_modules/@humwick/kernel/async-event-log.ts +0 -107
- package/node_modules/@humwick/kernel/automations.pilot.ts +0 -147
- package/node_modules/@humwick/kernel/config.ts +0 -111
- package/node_modules/@humwick/kernel/contract.ts +0 -572
- package/node_modules/@humwick/kernel/control-authz.ts +0 -281
- package/node_modules/@humwick/kernel/control.ts +0 -645
- package/node_modules/@humwick/kernel/effects.ts +0 -493
- package/node_modules/@humwick/kernel/event-log.ts +0 -319
- package/node_modules/@humwick/kernel/http-transport.ts +0 -384
- package/node_modules/@humwick/kernel/identity-grammar.ts +0 -20
- package/node_modules/@humwick/kernel/identity.ts +0 -248
- package/node_modules/@humwick/kernel/index.ts +0 -28
- package/node_modules/@humwick/kernel/kernel-persistence.ts +0 -181
- package/node_modules/@humwick/kernel/landing-incident.ts +0 -306
- package/node_modules/@humwick/kernel/landing.ts +0 -953
- package/node_modules/@humwick/kernel/manifest-validation.ts +0 -460
- package/node_modules/@humwick/kernel/mcp-transport.ts +0 -109
- package/node_modules/@humwick/kernel/message-authority-chaos-worker.ts +0 -200
- package/node_modules/@humwick/kernel/message-authority.ts +0 -281
- package/node_modules/@humwick/kernel/module-host.ts +0 -722
- package/node_modules/@humwick/kernel/openapi-init.ts +0 -14
- package/node_modules/@humwick/kernel/package.json +0 -39
- package/node_modules/@humwick/kernel/persistence-schema.ts +0 -248
- package/node_modules/@humwick/kernel/persistence.ts +0 -510
- package/node_modules/@humwick/kernel/registry.ts +0 -60
- package/node_modules/@humwick/kernel/sqlite-kernel-persistence.ts +0 -499
- package/node_modules/@humwick/kernel/sqlite-module-host.ts +0 -87
- package/node_modules/@humwick/kernel/timers-chaos-worker.ts +0 -186
- package/node_modules/@humwick/kernel/timers.pilot.ts +0 -1411
- package/node_modules/@humwick/kernel/workflow-activation.ts +0 -25
- package/node_modules/@humwick/kernel/workflow-backstop.ts +0 -40
- package/node_modules/@humwick/kernel/workflow-cancel-tree.ts +0 -20
- package/node_modules/@humwick/kernel/workflow-chaos-worker.ts +0 -213
- package/node_modules/@humwick/kernel/workflow-composition.ts +0 -231
- package/node_modules/@humwick/kernel/workflow-container.ts +0 -72
- package/node_modules/@humwick/kernel/workflow-control.test-fixture.ts +0 -42
- package/node_modules/@humwick/kernel/workflow-control.ts +0 -178
- package/node_modules/@humwick/kernel/workflow-definition.ts +0 -507
- package/node_modules/@humwick/kernel/workflow-dispatch.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-foreach.ts +0 -167
- package/node_modules/@humwick/kernel/workflow-journal-codec.ts +0 -339
- package/node_modules/@humwick/kernel/workflow-journal.ts +0 -922
- package/node_modules/@humwick/kernel/workflow-lane.ts +0 -48
- package/node_modules/@humwick/kernel/workflow-lease-owner.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-recovery.test-fixture.ts +0 -19
- package/node_modules/@humwick/kernel/workflow-runtime.ts +0 -938
- package/node_modules/@humwick/kernel/workflow-script.ts +0 -11
- package/node_modules/@humwick/kernel/workflow-state.ts +0 -299
- package/node_modules/@humwick/kernel/workflow-step-commit.ts +0 -195
- package/node_modules/@humwick/kernel/workflow-transitions.ts +0 -317
- package/node_modules/@humwick/kernel/workflow-values.ts +0 -153
- package/node_modules/@humwick/kernel/workflow.pilot.ts +0 -376
- package/node_modules/@humwick/offload/LICENSE +0 -167
- package/node_modules/@humwick/offload/README.md +0 -57
- package/node_modules/@humwick/offload/dist/async-runner.d.ts +0 -18
- package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/async-runner.js +0 -158
- package/node_modules/@humwick/offload/dist/async-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.d.ts +0 -25
- package/node_modules/@humwick/offload/dist/envelope.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.js +0 -80
- package/node_modules/@humwick/offload/dist/envelope.js.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +0 -10
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +0 -59
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +0 -1
- package/node_modules/@humwick/offload/dist/index.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/index.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/index.js +0 -5
- package/node_modules/@humwick/offload/dist/index.js.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +0 -62
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.js +0 -295
- package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/types.d.ts +0 -111
- package/node_modules/@humwick/offload/dist/types.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/types.js +0 -176
- package/node_modules/@humwick/offload/dist/types.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts +0 -23
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.js +0 -435
- package/node_modules/@humwick/offload/dist/worker-pool.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +0 -2
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.js +0 -27
- package/node_modules/@humwick/offload/dist/worker-runtime.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/worker.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.js +0 -1
- package/node_modules/@humwick/offload/dist/worker.js.map +0 -1
- package/node_modules/@humwick/offload/package.json +0 -42
- package/node_modules/@humwick/offload/src/async-runner.ts +0 -170
- package/node_modules/@humwick/offload/src/envelope.ts +0 -92
- package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +0 -49
- package/node_modules/@humwick/offload/src/index.ts +0 -4
- package/node_modules/@humwick/offload/src/subprocess-runner.ts +0 -334
- package/node_modules/@humwick/offload/src/types.ts +0 -235
- package/node_modules/@humwick/offload/src/worker-pool.ts +0 -463
- package/node_modules/@humwick/offload/src/worker-runtime.ts +0 -32
- package/node_modules/@humwick/offload/src/worker.ts +0 -5
- package/public/assets/agent-liveness-DyqxfB-t.js +0 -2
- package/public/assets/agent-profiles-BpI_jTxq.js +0 -2
- package/public/assets/index-B7ZerHLY.css +0 -2
- package/public/assets/index-BU3uWo2t.js +0 -15
- package/public/assets/projects-B_lmcqfO.js +0 -2
- package/public/assets/provider-display-DbLWpP3j.js +0 -2
- package/public/assets/run-card-CO_bguQf.js +0 -2
- package/public/assets/shipping-Bu8p1gEw.js +0 -2
- package/public/assets/store-BvtFdlGX.js +0 -9
- package/public/assets/use-project-list-B-T2Bnnn.js +0 -2
- package/public/assets/versioned-prompt-editor-Diu8BIaM.js +0 -8
- package/runner/src/agent-runner/http-liveness.ts +0 -85
- package/runner/src/gate-run-lease-probe.ts +0 -38
- package/src/db/claude-catalog-reconcile.ts +0 -27
- package/src/db/on-loop-write-transaction.ts +0 -34
- package/src/routing-model-aliases.ts +0 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-BvtFdlGX.js";import{et as o,v as s}from"./display-CfO7rTuF.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-BteVIjX4.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-BvtFdlGX.js";import{M as a}from"./provider-display-DbLWpP3j.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-B-T2Bnnn.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-BvtFdlGX.js";import{H as a,V as o,et as s}from"./display-CfO7rTuF.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-Cf3Hf2fN.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-CHqwXTov.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-BvtFdlGX.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-CfO7rTuF.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-D6FUarOf.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-CTZBrSD9.js";import{i as P,l as F,r as I}from"./use-selectors-CnrAk2YP.js";import{t as L}from"./status-dot-CVv0iGHL.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-D-S4tpDf.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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{t as n}from"./store-
|
|
2
|
-
//# sourceMappingURL=profile-icon-
|
|
1
|
+
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{t as n}from"./store-DKPDIZBe.js";var r=t(),i=`•`;function a(e){return n(t=>e&&t.agentProfiles.find(t=>t.name===e)?.icon?.trim()||null)}function o(e){return typeof e?.meta?.profile==`string`?e.meta.profile:void 0}function s({profile:t,className:n,title:o}){let s=a(t),c=o??(t?`Profile: ${t}`:`No profile`);return(0,r.jsx)(`span`,{role:`img`,"aria-label":c,title:c,className:e(`inline-flex items-center justify-center leading-none select-none`,!s&&`text-muted-foreground/70`,n),children:s??i})}export{o as n,s as t};
|
|
2
|
+
//# sourceMappingURL=profile-icon-BsRyBMea.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-DKPDIZBe.js";import{M as i}from"./provider-display-BEeLXC_D.js";import{t as a}from"./api-CIIVBtAV.js";import{t as o}from"./chevron-right-iljytE0x.js";import{t as s}from"./scroll-text-BKXS1ahr.js";import{t as c}from"./badge-DqJRtj_p.js";import{n as l}from"./token-estimate-Co-Jdphh.js";import{n as u}from"./versioned-prompt-editor-CIVg7XB1.js";import{o as d,r as f,s as p,t as m}from"./card-C4QJ4hCW.js";var h=e(t(),1),g=n();function _(e){return`/projects/${encodeURIComponent(e.projectId)}/profile-instructions/${encodeURIComponent(e.profile)}`}function v(e){let[t,n]=(0,h.useState)(),[r,o]=(0,h.useState)(``);(0,h.useEffect)(()=>{let t=!0;return a(`GET`,e).then(e=>{t&&n(e.instructions)},e=>{t&&o(i(e))}),()=>{t=!1}},[e]);function s(e){n(t=>t?.map(t=>t.projectId===e.projectId&&t.profile===e.profile?{...t,template:e.template,version:e.version,updatedAt:e.updatedAt}:t))}return{entries:t,error:r,saved:s}}function y({entry:e,label:t,open:n,onToggle:r,onSaved:i}){let a=e.template.trim()===``;return(0,g.jsxs)(`li`,{className:`min-w-0 rounded border border-border bg-card/60`,"data-testid":`profile-instructions-row`,children:[(0,g.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-9 w-full min-w-0 flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1.5 text-left hover:bg-muted/40`,children:[(0,g.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform ${n?`rotate-90`:``}`,"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0 text-xs font-medium [overflow-wrap:anywhere]`,children:t}),(0,g.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground`,children:[e.version>0&&(0,g.jsxs)(c,{variant:`outline`,className:`text-[10px]`,children:[`v`,e.version]}),(0,g.jsx)(`span`,{children:a?`empty`:l(e.template)})]})]}),!n&&!a&&(0,g.jsx)(`p`,{className:`line-clamp-2 whitespace-pre-wrap break-words px-2 pb-1.5 text-xs text-muted-foreground`,children:e.template.trim()}),n&&(0,g.jsx)(`div`,{className:`border-t border-border p-1.5`,children:(0,g.jsx)(u,{path:_(e),title:t,textLabel:`Project instructions`,saveLabel:`Save instructions`,onSaved:i})})]})}function b({entries:e,error:t}){return t?(0,g.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:t}):e?null:(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading…`})}function x({projectId:e}){let t=r(e=>e.agentProfiles),{entries:n,error:i,saved:a}=v(`/projects/${encodeURIComponent(e)}/profile-instructions`),[o,c]=(0,h.useState)(``),l=n?.filter(e=>e.template.trim()!==``).length??0,u=e=>t.find(t=>t.name===e)?.icon?.trim()||`•`;return(0,g.jsxs)(m,{children:[(0,g.jsxs)(d,{children:[(0,g.jsxs)(p,{className:`flex flex-wrap items-center gap-2 text-base`,children:[(0,g.jsx)(s,{className:`size-4 text-muted-foreground`}),` Profile instructions`,n&&(0,g.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,l,` of `,n.length,` set)`]})]}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Extra text for each agent profile, added after the profile's own instructions when an agent starts in this project. Empty adds nothing.`})]}),(0,g.jsxs)(f,{className:`space-y-1.5`,children:[(0,g.jsx)(b,{entries:n,error:i}),(0,g.jsx)(`ul`,{className:`space-y-1.5`,children:n?.map(e=>(0,g.jsx)(y,{entry:e,onSaved:a,label:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5`,children:u(e.profile)}),(0,g.jsx)(`span`,{className:`font-mono`,children:e.profile})]}),open:o===e.profile,onToggle:()=>c(o===e.profile?``:e.profile)},e.profile))})]})]})}function S({profile:e}){let{entries:t,error:n,saved:r}=v(`/agent-profiles/${encodeURIComponent(e)}/project-instructions`),[i,a]=(0,h.useState)(``),[o,s]=(0,h.useState)([]),c=t?.filter(e=>e.version>0||o.includes(e.projectId))??[],l=t?.filter(e=>!c.includes(e))??[],u=e=>e.projectTitle||e.projectSlug||e.projectId;return(0,g.jsxs)(`section`,{className:`space-y-1.5`,"aria-label":`Project instructions for ${e}`,children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Extra text added after this profile's instructions for agents started in one project.`}),(0,g.jsx)(b,{entries:t,error:n}),t&&c.length===0&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No project has text for this profile yet.`}),(0,g.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,g.jsx)(y,{entry:e,onSaved:r,label:u(e),open:i===e.projectId,onToggle:()=>a(i===e.projectId?``:e.projectId)},e.projectId))}),l.length>0&&(0,g.jsxs)(`label`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 text-xs`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Add text for`}),(0,g.jsxs)(`select`,{value:``,"aria-label":`Add text for another project`,className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-1.5 text-base text-foreground sm:h-7 sm:text-xs`,onChange:e=>{let t=e.target.value;t&&(s([...o,t]),a(t))},children:[(0,g.jsx)(`option`,{value:``,children:`Choose a project…`}),l.map(e=>(0,g.jsx)(`option`,{value:e.projectId,children:u(e)},e.projectId))]})]})]})}export{x as n,S as t};
|
|
2
|
+
//# sourceMappingURL=project-profile-instructions-DETKFn_E.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-DKPDIZBe.js";import{M as i}from"./provider-display-BEeLXC_D.js";import{n as a,t as o}from"./use-project-list-CpWl6eHQ.js";import{et as s}from"./display-CDeH4I8T.js";import{l as c,t as l}from"./api-CIIVBtAV.js";import{t as u}from"./label-BPBzm9FJ.js";import{t as d}from"./boxes-Cv7Wq3h4.js";import{t as f}from"./brain-circuit-CpQeSmp3.js";import{t as p}from"./folder-git-2-CJOmTT06.js";import{t as m}from"./button-Do6Z3vvn.js";import{t as h}from"./badge-DqJRtj_p.js";import{t as g}from"./copy-button-CjOj4HEf.js";import{t as _}from"./input-CsTB6jIx.js";import{o as v,r as y,s as b,t as x}from"./card-C4QJ4hCW.js";import{n as S}from"./project-profile-instructions-DETKFn_E.js";var C=e(t(),1),w=n();function T({project:e,roots:t,onChanged:n}){let a=r(e=>e.orchestrators),o=r(e=>e.authToken),[s,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)([]),[b,x]=(0,C.useState)([]),[S,T]=(0,C.useState)([]),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(!1),A=`/projects/${encodeURIComponent(e.id)}`,j=s||a.find(e=>e.status===`online`)?.id||``,M=t.filter(e=>!e.orchestratorId||e.orchestratorId===j),N=M.some(e=>e.rootPath===d)?d:M[0]?.rootPath||``,P=M.some(e=>e.rootPath===N&&e.orchestratorId===j);(0,C.useEffect)(()=>{let t=!0,n=()=>l(`GET`,`${A}/checkouts`).then(e=>{t&&(y(e.checkouts),x(e.refreshes??[]),T(e.enrollments??[]))}).catch(e=>{t&&D(i(e))}),r=c(o,{connected:()=>{n()},message:(t,r)=>{if(t===`config.changed`){let t=JSON.parse(r);t.namespace===`projects`&&t.key===e.id&&n();return}t.startsWith(`command.`)&&JSON.parse(r).command?.params.projectId===e.id&&n()}});return n(),()=>{t=!1,r.close()}},[e.id,A,o]);async function F(){k(!0),D(``);try{n((await l(`POST`,`${A}/archive`,{archived:e.status!==`archived`})).project)}catch(e){D(i(e))}finally{k(!1)}}async function I(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/bind`,{orchestratorId:j,rootPath:p??N});_(`Bound on ${j}: ${p??N}`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function L(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/unbind`,{orchestratorId:j,rootPath:N});_(`Unbound from ${j}: ${N}. Files kept.`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function R(){if(window.confirm(`Delete the checkout ${N} and its worktrees on ${j}? Unbind keeps the files.`)){k(!0),D(``);try{let{command:e}=await l(`DELETE`,`${A}/checkouts/${encodeURIComponent(j)}?deleteFiles=true&rootPath=${encodeURIComponent(N)}`),t=await l(`GET`,`${A}/checkouts`);y(t.checkouts.length?t.checkouts:[{commandId:e.id,type:e.type,status:e.status,orchestratorId:j,rootPath:N}])}catch(e){D(i(e))}finally{k(!1)}}}let z=v.some(e=>[`pending`,`accepted`,`running`].includes(e.status));return(0,w.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[(0,w.jsx)(m,{variant:`outline`,disabled:O,onClick:()=>void F(),children:e.status===`archived`?`Restore project`:`Archive project`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Archiving keeps checkouts and memory. Unbinding stops refresh, spawns and gates on that host and keeps its files. Deleting removes the checkout directory on that host and keeps project memory.`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`select`,{"aria-label":`Checkout host`,value:j,onChange:e=>u(e.target.value),className:`rounded-md border bg-background px-2 py-1`,children:[!j&&(0,w.jsx)(`option`,{value:``,children:`Choose a host`}),a.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[e.hostname,e.status===`online`?``:` (offline)`]},e.id))]}),t.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`select`,{"aria-label":`Checkout root`,value:N,onChange:e=>f(e.target.value),className:`max-w-full rounded-md border bg-background px-2 py-1`,children:M.map(e=>(0,w.jsx)(`option`,{value:e.rootPath,children:e.rootPath},e.rootPath))}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!P,onClick:()=>void L(),children:`Unbind from host (keep files)`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||z||!j||!N,onClick:()=>void R(),children:`Delete checkout files on host`})]}),(0,w.jsx)(`input`,{"aria-label":`Existing checkout root`,placeholder:`Absolute path to an existing checkout`,value:p??N,onChange:e=>h(e.target.value),className:`w-full min-w-0 rounded-md border bg-background px-2 py-1 sm:w-auto sm:min-w-64`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!j||!(p??N)||e.status!==`active`,onClick:()=>void I(),children:`Bind existing checkout`})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Binding verifies the checkout and its origin, then registers it on the selected host.`}),g&&(0,w.jsx)(`div`,{role:`status`,className:`text-sm`,children:g}),v.map(e=>(0,w.jsxs)(`div`,{role:[`failed`,`timed_out`,`canceled`].includes(e.status)?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — `,e.result?.action===`removed`?`Removed`:e.status,e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` — `,e.result?.errorCode,`: `,e.error]})]},e.commandId)),S.map(e=>(0,w.jsxs)(`div`,{role:e.disposition===`ambiguous`?`alert`:`status`,className:`text-sm`,children:[e.orchestratorId||`unknown host`,`: `,e.rootPath,` — Refresh enrollment `,e.disposition,` · `,e.reason]},JSON.stringify([e.orchestratorId,e.rootPath]))),b.map(e=>(0,w.jsxs)(`div`,{role:e.error||e.result?.reason&&e.health!==`unsupported`||e.health===`stale`?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — Checkout refresh `,e.result?.status??e.status,e.result&&(0,w.jsxs)(w.Fragment,{children:[e.health===`stale`&&(0,w.jsx)(`span`,{children:` · Refresh heartbeat stale`}),(0,w.jsxs)(`span`,{children:[` · Head `,e.result.headSha?.slice(0,12)??`unknown`,` · Target `,e.result.targetSha?.slice(0,12)??`unknown`,` · Behind `,e.result.behind??`unknown`]}),(0,w.jsxs)(`span`,{children:[` · Last success `,e.result.successAt?new Date(e.result.successAt).toLocaleString():`never`]}),e.result.dependency&&(0,w.jsxs)(`span`,{children:[` · Dependencies `,e.result.dependency.status]}),e.result.reason&&(0,w.jsxs)(`span`,{children:[` · `,e.result.reason]}),e.result.backups.map(e=>(0,w.jsxs)(`div`,{children:[`Backup: `,e.path,` → `,e.backup]},e.backup))]}),e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` · `,e.error]})]},e.commandId)),E&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:E})]})}function E({onCreated:e}){let t=r(e=>e.orchestrators),n=r(e=>e.authToken),a=r(e=>e.openOrchestratorSpawnAt),[o,s]=(0,C.useState)(!1),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(!1),[g,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(`private`),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(``),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(``),V=j??t.filter(e=>e.status===`online`).slice(0,1).map(e=>e.id);(0,C.useEffect)(()=>{if(!F)return;let e=!0,t=F.creation?[F.creation.commandId]:F.checkouts.flatMap(e=>e.commandId?[e.commandId]:[]),r=n=>{if(!e||!t.includes(n.id))return;R(e=>({...e,[n.id]:n}));let r=n.result;F.creation&&r?.onboarding&&I(r.onboarding)},a=t=>l(`GET`,`/commands/${encodeURIComponent(t)}`).then(r).catch(t=>{e&&B(i(t))}),o=()=>Promise.all(t.map(a)),s=c(n,{connected:()=>{o()},message:(e,n)=>{if(!e.startsWith(`command.`))return;let r=JSON.parse(n).command?.id;r&&t.includes(r)&&a(r)}});return o(),()=>{e=!1,s.close()}},[F,n]);async function H(t){t.preventDefault(),P(!0),B(``),R({}),I(null);try{let t=await l(`POST`,`/projects`,{...p?{create:{owner:g,name:y,visibility:x,...T.trim()?{template:T.trim()}:{}},...D?{setupTask:!0}:{}}:{url:d},...V.length===1?{orchestratorId:V[0]}:{hosts:V},...k.trim()?{slug:k.trim()}:{}});I(t),e()}catch(e){B(i(e))}finally{P(!1)}}let U=F?.creation?L[F.creation.commandId]:void 0,W=U?.result,G=W?.errorCode||U&&[`failed`,`timed_out`,`canceled`].includes(U.status),K=F?.creation&&(!U||[`pending`,`accepted`,`running`].includes(U.status))||F?.checkouts.some(e=>e.commandId&&(!L[e.commandId]||[`pending`,`accepted`,`running`].includes(L[e.commandId].status)));return(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!1),s(!0)},children:`Add project`}),(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!0),s(!0)},children:`New project`})]}),o&&(0,w.jsxs)(`form`,{onSubmit:H,className:`space-y-3 rounded-md border p-3`,children:[p?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-owner`,children:`GitHub owner`}),(0,w.jsx)(_,{id:`onboard-owner`,value:g,onChange:e=>v(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-name`,children:`Repository name`}),(0,w.jsx)(_,{id:`onboard-name`,value:y,onChange:e=>b(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-visibility`,children:`Visibility`}),(0,w.jsxs)(`select`,{id:`onboard-visibility`,className:`h-8 w-full rounded-md border border-border bg-card px-2 text-sm`,value:x,onChange:e=>S(e.target.value),children:[(0,w.jsx)(`option`,{value:`private`,children:`Private`}),(0,w.jsx)(`option`,{value:`public`,children:`Public`})]}),(0,w.jsx)(u,{htmlFor:`onboard-template`,children:`Template (optional, owner/repo)`}),(0,w.jsx)(_,{id:`onboard-template`,value:T,onChange:e=>E(e.target.value)}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),`Create a setup Task`]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-url`,children:`GitHub repository`}),(0,w.jsx)(_,{id:`onboard-url`,placeholder:`https://github.com/owner/repo`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,w.jsx)(u,{htmlFor:`onboard-slug`,children:`Slug (optional)`}),(0,w.jsx)(_,{id:`onboard-slug`,value:k,onChange:e=>A(e.target.value)}),(0,w.jsxs)(`fieldset`,{className:`space-y-1`,children:[(0,w.jsxs)(`legend`,{className:`flex w-full items-center gap-2`,children:[`Hosts`,(0,w.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select all online hosts`,onClick:()=>M(t.filter(e=>e.status===`online`).map(e=>e.id)),children:`all`}),(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select no hosts`,onClick:()=>M([]),children:`none`})]})]}),(0,w.jsx)(`div`,{className:`grid gap-x-4 gap-y-1 sm:grid-cols-2`,children:t.map(e=>(0,w.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(e.id),onChange:t=>M(t.target.checked?[...V,e.id]:V.filter(t=>t!==e.id))}),(0,w.jsxs)(`span`,{className:`truncate`,children:[e.hostname,e.status===`online`?``:` (offline)`]})]},e.id))})]}),(0,w.jsx)(m,{type:`submit`,disabled:N||!!K||!V.length,children:N?p?`Creating…`:`Adding…`:p?`Create`:`Add`})]}),z&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:z}),F?.creation&&(G?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[W?.errorCode?`${W.errorCode}: `:``,W?.error||U?.error||`Creation ${U?.status}. Check GitHub before retrying.`]}):(0,w.jsx)(`p`,{role:`status`,children:`Creating GitHub repository…`})),F?.setupTaskId&&(0,w.jsxs)(`p`,{children:[`Setup Task T`,F.setupTaskId,` created.`]}),F&&!F.creation&&(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,w.jsx)(`caption`,{className:`text-left`,children:`Host readiness`}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:`Host`}),(0,w.jsx)(`th`,{children:`Status`}),(0,w.jsx)(`th`,{children:`Checks`}),(0,w.jsx)(`th`,{children:`Action`})]})}),(0,w.jsx)(`tbody`,{children:F.checkouts.map(e=>{let n=e.commandId?L[e.commandId]:void 0,r=n?.result,i=t.find(t=>t.id===e.orchestratorId),o=n?.status===`succeeded`,s=e.errorCode??r?.errorCode,c=s||n&&[`failed`,`timed_out`,`canceled`].includes(n.status);return(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`row`,children:i?.hostname||e.orchestratorId}),(0,w.jsx)(`td`,{children:c?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[s?`${s}: `:``,e.error||n?.error||`Checkout ${n?.status}. Try again.`]}):(0,w.jsx)(`span`,{role:`status`,children:o?`Ready on ${i?.hostname||e.orchestratorId}`:`Preparing checkout…`})}),(0,w.jsx)(`td`,{children:(0,w.jsx)(`ul`,{children:r?.readiness?.map((e,t)=>(0,w.jsxs)(`li`,{children:[e.check,e.provider?` (${e.provider})`:``,`: `,e.status,` — `,e.detail]},t))})}),(0,w.jsx)(`td`,{children:o&&e.rootPath&&(0,w.jsx)(m,{onClick:()=>a({orchestratorId:e.orchestratorId,cwd:e.rootPath}),children:`Spawn agent here`})})]},e.orchestratorId)})})]})})]})}function D(){let e=a(),{projects:t,selectedId:n,loading:c,setError:u,refresh:_}=e,D=r(e=>e.set),O=r(e=>e.switchView),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(()=>Date.now());(0,C.useEffect)(()=>{if(!n){A(null);return}let e=!1;return l(`GET`,`/projects/${encodeURIComponent(n)}`).then(t=>{e||(A(t),M(Date.now()))}).catch(t=>{e||u(i(t))}),()=>{e=!0}},[n,u]);function N(e){O(`memory`),D({projectFocusId:e})}return(0,w.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,w.jsx)(o,{icon:(0,w.jsx)(d,{className:`size-5 text-primary`}),title:`Projects`,list:e,onRefresh:()=>void _()}),(0,w.jsx)(E,{onCreated:()=>{_()}}),!c&&t.length===0&&(0,w.jsx)(x,{children:(0,w.jsx)(y,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No projects yet. Add a GitHub repository or create a new one above.`})}),k&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,w.jsx)(`span`,{className:`min-w-0 break-words text-base font-semibold`,children:k.project.title||k.project.slug}),(0,w.jsx)(h,{variant:`outline`,className:`font-mono text-[10px]`,children:k.project.slug}),(0,w.jsx)(h,{variant:k.project.status===`active`?`secondary`:`outline`,className:`text-[10px]`,children:k.project.status}),(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`updated `,s(j,k.project.updatedAt)]}),(0,w.jsxs)(m,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:()=>N(k.project.id),children:[(0,w.jsx)(f,{className:`size-3.5`}),` Memories`]})]}),k.project.description&&(0,w.jsx)(`div`,{className:`line-clamp-2 break-words text-sm text-muted-foreground`,children:k.project.description}),k.project.issueRepo&&(0,w.jsxs)(`a`,{href:`https://github.com/${k.project.issueRepo}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex max-w-full items-center gap-1.5 text-primary hover:underline`,children:[(0,w.jsx)(p,{className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`truncate font-mono text-xs`,children:k.project.issueRepo})]})]}),(0,w.jsx)(T,{project:k.project,roots:k.roots,onChanged:(e,t)=>{A({...k,project:e,roots:t??k.roots}),_()}},k.project.id),(0,w.jsxs)(x,{children:[(0,w.jsx)(v,{children:(0,w.jsxs)(b,{className:`flex items-center gap-2 text-base`,children:[(0,w.jsx)(p,{className:`size-4 text-muted-foreground`}),` Roots`,(0,w.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,k.roots.length,`)`]})]})}),(0,w.jsx)(y,{children:k.roots.length===0?(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No roots bound. A project resolves to agents by the repo paths registered here.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:k.roots.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[e.orchestratorId&&(0,w.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-xs text-muted-foreground`,children:e.orchestratorId}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,title:e.rootPath,children:e.rootPath}),(0,w.jsx)(g,{value:e.rootPath,label:`Copy root path`,size:`icon`,className:`h-6 w-6`,iconClassName:`h-3 w-3`})]},JSON.stringify([e.orchestratorId,e.rootPath])))})})]}),(0,w.jsx)(S,{projectId:k.project.id},k.project.id)]})]})}export{D as ProjectsView};
|
|
2
|
+
//# sourceMappingURL=projects-M_m6AHws.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{M as i}from"./provider-display-DbLWpP3j.js";import{et as a}from"./display-CfO7rTuF.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./braces-BOks9SsY.js";import{t as c}from"./circle-alert-CryagaZd.js";import{t as l}from"./file-text-CKuoMR2U.js";import{t as u}from"./refresh-cw-CfpvQcUn.js";import{t as d}from"./rotate-ccw-CtD77qkX.js";import{t as f}from"./save-B_PGqSm4.js";import{t as p}from"./button-Do6Z3vvn.js";import{t as m}from"./badge-DqJRtj_p.js";import{t as h}from"./textarea-hs6Mpyfl.js";import{t as g}from"./versioned-prompt-editor-Diu8BIaM.js";import{a as _,i as ee,o as te,r as v,s as y,t as b}from"./card-C4QJ4hCW.js";var x=e(n(),1),S=r(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return Array.isArray(e)?[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r}):[]}function ne({template:e}){if(e.version===void 0)return null;let t=e.source===`bundled-fallback`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:t?`No saved version`:`v${e.version}`}),t&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Bundled fallback`}),e.bundledUpdateAvailable&&(0,S.jsx)(m,{className:`bg-tone-info/15 text-tone-info-fg hover:bg-tone-info/15`,children:`Update available`})]})}function E(){let[e,n]=(0,x.useState)([]),[r,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{let e=await o(`GET`,`/settings/prompts`);n(T(e.templates)),H(Date.now())}catch(e){O(i(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function re(e){I(e),A(``),M(``)}function $(e){n(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ie(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await o(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(i(e))}finally{B(``)}}}async function ae(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await o(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(i(e))}finally{B(``)}}}function oe(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(m,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(l,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(m,{variant:`outline`,className:t(`gap-1`,Z>0&&`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`),children:[Z,` modified`]}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:r,children:[(0,S.jsx)(u,{className:t(`size-4`,r&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),r&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(v,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let n=e.slug===q,r=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:t(`w-full rounded-xl border p-4 text-left transition-colors`,n?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>re(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),r&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Modified`}),(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:w(e.category)}),(0,S.jsx)(ne,{template:e})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),e.updatedAt>0&&(0,S.jsxs)(`span`,{children:[`Updated `,a(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(te,{className:`border-b border-border`,children:[(0,S.jsxs)(y,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Customized`}),X&&(0,S.jsx)(m,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(ee,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),J.version===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(v,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-tone-success/30 bg-tone-success/10 px-3 py-2 text-xs text-tone-success-fg`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(s,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(m,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-tone-warning/30 bg-tone-warning/10 px-3 py-2 text-xs text-tone-warning-fg`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(h,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(_,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${a(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void ae(),disabled:Q,children:[(0,S.jsx)(d,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(p,{variant:`outline`,size:`sm`,onClick:oe,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(p,{size:`sm`,onClick:()=>void ie(),disabled:!X||Q,children:[(0,S.jsx)(f,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(v,{className:`pt-4`,children:(0,S.jsx)(g,{slug:J.slug,onSaved:$},J.slug)})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
|
|
2
|
-
//# sourceMappingURL=prompt-settings-
|
|
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{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"./braces-BOks9SsY.js";import{t as c}from"./circle-alert-CryagaZd.js";import{t as l}from"./file-text-CKuoMR2U.js";import{t as u}from"./refresh-cw-CfpvQcUn.js";import{t as d}from"./rotate-ccw-CtD77qkX.js";import{t as f}from"./save-B_PGqSm4.js";import{t as p}from"./button-Do6Z3vvn.js";import{t as m}from"./badge-DqJRtj_p.js";import{t as h}from"./textarea-hs6Mpyfl.js";import{t as g}from"./versioned-prompt-editor-CIVg7XB1.js";import{a as _,i as ee,o as te,r as v,s as y,t as b}from"./card-C4QJ4hCW.js";var x=e(n(),1),S=r(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return Array.isArray(e)?[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r}):[]}function ne({template:e}){if(e.version===void 0)return null;let t=e.source===`bundled-fallback`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:t?`No saved version`:`v${e.version}`}),t&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Bundled fallback`}),e.bundledUpdateAvailable&&(0,S.jsx)(m,{className:`bg-tone-info/15 text-tone-info-fg hover:bg-tone-info/15`,children:`Update available`})]})}function E(){let[e,n]=(0,x.useState)([]),[r,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{let e=await o(`GET`,`/settings/prompts`);n(T(e.templates)),H(Date.now())}catch(e){O(i(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function re(e){I(e),A(``),M(``)}function $(e){n(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ie(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await o(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(i(e))}finally{B(``)}}}async function ae(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await o(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(i(e))}finally{B(``)}}}function oe(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(m,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(l,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(m,{variant:`outline`,className:t(`gap-1`,Z>0&&`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`),children:[Z,` modified`]}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:r,children:[(0,S.jsx)(u,{className:t(`size-4`,r&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),r&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(v,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let n=e.slug===q,r=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:t(`w-full rounded-xl border p-4 text-left transition-colors`,n?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>re(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),r&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Modified`}),(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:w(e.category)}),(0,S.jsx)(ne,{template:e})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),e.updatedAt>0&&(0,S.jsxs)(`span`,{children:[`Updated `,a(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(te,{className:`border-b border-border`,children:[(0,S.jsxs)(y,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Customized`}),X&&(0,S.jsx)(m,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(ee,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),J.version===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(v,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-tone-success/30 bg-tone-success/10 px-3 py-2 text-xs text-tone-success-fg`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(s,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(m,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-tone-warning/30 bg-tone-warning/10 px-3 py-2 text-xs text-tone-warning-fg`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(h,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(_,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${a(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void ae(),disabled:Q,children:[(0,S.jsx)(d,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(p,{variant:`outline`,size:`sm`,onClick:oe,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(p,{size:`sm`,onClick:()=>void ie(),disabled:!X||Q,children:[(0,S.jsx)(f,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(v,{className:`pt-4`,children:(0,S.jsx)(g,{slug:J.slug,onSaved:$},J.slug)})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
|
|
2
|
+
//# sourceMappingURL=prompt-settings-C_mNCgeL.js.map
|