@humwick/server 0.130.2 → 0.130.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/prompts/manifest.json +1 -0
- package/bundled/prompts/task.hydration.md +1 -1
- package/bundled/roles/builder.md +1 -1
- package/docs/guides/sub-coordinators.md +12 -5
- package/docs/guides/tools-coordination.md +1 -0
- package/docs/guides/workflows.md +16 -0
- package/docs/openapi.json +175 -4
- package/package.json +8 -7
- package/public/assets/{MessageBubble-BWLqMGKG.js → MessageBubble-BOkmEvgZ.js} +2 -2
- package/public/assets/{PlanGraphPanel-3TlIQpjk.js → PlanGraphPanel-BkaDJp0r.js} +2 -2
- package/public/assets/{TraceView-Wimm0Czv.js → TraceView-B99Uu2yT.js} +2 -2
- package/public/assets/{VaultDecisionCard-Bau_vNax.js → VaultDecisionCard-DUIfTTFF.js} +2 -2
- package/public/assets/{activity-CrSurn-r.js → activity-ZIX0N1El.js} +2 -2
- package/public/assets/{agent-lineage-CknAJKcb.js → agent-lineage-kq9TPYFw.js} +2 -2
- package/public/assets/agent-liveness-DSQY1Aa_.js +2 -0
- package/public/assets/{agent-name-DKbiIhBo.js → agent-name-C_7F4DFR.js} +2 -2
- package/public/assets/{agent-profiles-DwF6EQ4R.js → agent-profiles-BNOcrGcY.js} +2 -2
- package/public/assets/{agent-project-badge-Diz4Sjjb.js → agent-project-badge-B6yAh70a.js} +2 -2
- package/public/assets/{agent-tools-CRhpRQza.js → agent-tools-CcrhmOzF.js} +2 -2
- package/public/assets/{agent-type-icon-LrUEU3lB.js → agent-type-icon-CXSLrKiq.js} +2 -2
- package/public/assets/{agents-B-v66C-4.js → agents-DIZG97_X.js} +2 -2
- package/public/assets/{analytics-BqCb-LKi.js → analytics-rasmoPjR.js} +2 -2
- package/public/assets/{artifact-viewer-kf4pGuAR.js → artifact-viewer-tBpTrEPb.js} +2 -2
- package/public/assets/{artifacts-DJevXcvg.js → artifacts-BNkrynP1.js} +2 -2
- package/public/assets/{artifacts-D32zyw4Y.js → artifacts-Bjq-ZyBA.js} +2 -2
- package/public/assets/{automation-BpRajx_5.js → automation-Cx422L3L.js} +2 -2
- package/public/assets/{backlog-D_UjTdzX.js → backlog-RuFQ8PUu.js} +2 -2
- package/public/assets/{busy-health-N3VEh4ao.js → busy-health-BvNQ9g5x.js} +2 -2
- package/public/assets/{channels-9jopungq.js → channels-DNbKAS0I.js} +2 -2
- package/public/assets/{chat-CSXrTB3C.js → chat-Bp3Fx73h.js} +3 -3
- package/public/assets/{code-preview-p1NnmqK0.js → code-preview-KIRZA6cz.js} +2 -2
- package/public/assets/{connectors-CZdqlDNL.js → connectors-k7vO4vvc.js} +2 -2
- package/public/assets/{cosmos-BgdsE4dG.js → cosmos-BuVoq1aw.js} +2 -2
- package/public/assets/{crate-agent-30aXTKva.js → crate-agent-irqlt4NH.js} +2 -2
- package/public/assets/{dependency-graph-B_jvw2GE.js → dependency-graph-D_rurNBz.js} +2 -2
- package/public/assets/{deploys-DoN6bAb5.js → deploys-yzZqIpxE.js} +2 -2
- package/public/assets/{display-BrKWFGJz.js → display-BemJG1f_.js} +2 -2
- package/public/assets/{files-D6XEu8Ng.js → files-DXWcrxOz.js} +2 -2
- package/public/assets/{fleet-C7jQWbw2.js → fleet-TEuOCZXE.js} +2 -2
- package/public/assets/{fleet-metrics-BiDs3MLx.js → fleet-metrics-BGoDAFI-.js} +2 -2
- package/public/assets/{formatted-body-impl-DyG0WsQS.js → formatted-body-impl-BB9eq9nN.js} +2 -2
- package/public/assets/{formatted-body-CQBwc1fb.js → formatted-body-qy2nTD_1.js} +3 -3
- package/public/assets/{host-providers-dialog-DKaW31dN.js → host-providers-dialog-BGPHxuwT.js} +2 -2
- package/public/assets/{index-CRHep3M9.js → index-BC5XZc0z.js} +5 -5
- package/public/assets/{index-MYAIwYTX.css → index-D8Rp9pz2.css} +1 -1
- package/public/assets/{insights-CzrtkpOE.js → insights-C-KQG0h-.js} +2 -2
- package/public/assets/{integrations-aVsUmigt.js → integrations-ClPRPyKU.js} +2 -2
- package/public/assets/{issue-ref-chip-BnSlM_95.js → issue-ref-chip-DbH8J9Ak.js} +2 -2
- package/public/assets/{log-viewer-qe7Ee47Z.js → log-viewer-PH4zVn24.js} +2 -2
- package/public/assets/{maintenance-NfjqFZAk.js → maintenance-5lV43uTL.js} +2 -2
- package/public/assets/{managed-agents-BiH0HgaE.js → managed-agents-BdgU35aX.js} +2 -2
- package/public/assets/{markdown-preview-BixaT3Xr.js → markdown-preview-DNT4OUwQ.js} +3 -3
- package/public/assets/{markdown-preview-impl-DNGlWIS3.js → markdown-preview-impl-CnCcPy0A.js} +2 -2
- package/public/assets/{memory-DNsCl6UX.js → memory--GgWH1gH.js} +2 -2
- package/public/assets/{messages-DopU1L1X.js → messages-CzFl_97O.js} +2 -2
- package/public/assets/{orchestrators-Cq7ckLQT.js → orchestrators-CVvJVkzv.js} +2 -2
- package/public/assets/overview-DsrZvE86.js +2 -0
- package/public/assets/{pairs-DE_m6rrE.js → pairs-D2d0d2py.js} +2 -2
- package/public/assets/{profile-icon-B3rfh77F.js → profile-icon-_SMuSbYF.js} +2 -2
- package/public/assets/{project-profile-instructions-DQWZE0kA.js → project-profile-instructions-Apn15y43.js} +2 -2
- package/public/assets/{projects-Br2Bd2h1.js → projects-D3B6kto5.js} +2 -2
- package/public/assets/{prompt-settings-BKvFsvGD.js → prompt-settings-DnPB6Ez6.js} +2 -2
- package/public/assets/provider-display-bWwiuedV.js +2 -0
- package/public/assets/{registry-Cw38_6gW.js → registry-D790cIhN.js} +2 -2
- package/public/assets/run-card-BCro-Odj.js +2 -0
- package/public/assets/{secrets-DxI-vzSq.js → secrets-CVXvfvbU.js} +2 -2
- package/public/assets/{service-access-settings-D9s_VJbd.js → service-access-settings-D3Xxqb9w.js} +2 -2
- package/public/assets/{settings-CKZTVGIx.js → settings-CoUC7Jci.js} +2 -2
- package/public/assets/shipping-D_Lp9n_J.js +2 -0
- package/public/assets/{stats-DyUBKyWI.js → stats-CXiNjB9S.js} +2 -2
- package/public/assets/{status-dot-DYqlEUhJ.js → status-dot-C703YIy1.js} +2 -2
- package/public/assets/store-BgDALGIX.js +9 -0
- package/public/assets/{tasks-Bh7Chr4-.js → tasks-DO0WpJCx.js} +2 -2
- package/public/assets/{teams-bowI7qVY.js → teams-FGkdi_tL.js} +2 -2
- package/public/assets/{terminal-viewer-BgVLHdsU.js → terminal-viewer-Dh8dSC7e.js} +3 -3
- package/public/assets/{terminal-viewer-impl-Dz22UPy6.js → terminal-viewer-impl-B5Zriip3.js} +2 -2
- package/public/assets/{use-agent-terminal-DSQQ-iY7.js → use-agent-terminal-CRUVDvLC.js} +2 -2
- package/public/assets/{use-decisions-samMQhQf.js → use-decisions-CoaqRh4l.js} +2 -2
- package/public/assets/{use-project-list-59LheVP7.js → use-project-list-X-BgT53X.js} +2 -2
- package/public/assets/{use-selectors-BZa25xEB.js → use-selectors-0X_UZkk-.js} +2 -2
- package/public/assets/{user-avatar-DHxlvUvV.js → user-avatar-CkLhVBGu.js} +2 -2
- package/public/assets/{versioned-prompt-editor-BmED5DnJ.js → versioned-prompt-editor-BkTi7eim.js} +2 -2
- package/public/assets/{work-queue-CSvpuNLz.js → work-queue-DDOLEyKo.js} +2 -2
- package/public/assets/{workflow-marker-DAZcj5qt.js → workflow-marker-CzOsB8BM.js} +2 -2
- package/public/assets/{workflows-DdmxRSyg.js → workflows-DJilvmRM.js} +2 -2
- package/public/assets/{workspaces-BxeKfVuF.js → workspaces-CHcfbLR3.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +29 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapters/claude-api.ts +1 -1
- package/runner/src/adapters/claude-headless.ts +1 -1
- package/runner/src/adapters/claude-launch-exit.ts +26 -0
- package/runner/src/adapters/claude-session-probe.ts +1 -1
- package/runner/src/adapters/claude-tmux.ts +38 -10
- package/runner/src/adapters/claude.ts +28 -75
- package/runner/src/adapters/provider-quota-harvest.ts +20 -71
- package/runner/src/agent-runner/lifecycle-milestones.ts +2 -2
- package/runner/src/agent-runner/liveness-exchange.ts +104 -0
- package/runner/src/claude-system-prompt.ts +49 -0
- package/runner/src/launch-assembly.ts +14 -10
- package/runner/src/profile-home.ts +1 -1
- package/runner/src/project-instructions.ts +2 -2
- package/runner/src/provider-command.ts +18 -0
- package/runner/src/provider-setup.ts +3 -2
- package/runner/src/runner-core.ts +14 -15
- package/runner/src/runner-helpers.ts +0 -8
- package/runner/src/session-scratch.ts +6 -2
- package/runner/test-support/provisioning-context.ts +4 -2
- package/runner/test-support/runner-harness.ts +2 -1
- package/scripts/steward-policy-cleanup.ts +2 -2
- package/src/agent-authz.ts +2 -2
- package/src/agent-drive-arbiter.ts +3 -8
- package/src/agent-exit-cleanup-async.ts +2 -2
- package/src/agent-exit-cleanup.ts +23 -19
- package/src/agent-lifecycle-events.ts +112 -85
- package/src/agent-ref.ts +3 -2
- package/src/agent-status-events.ts +43 -14
- package/src/auth/login-link.ts +35 -0
- package/src/auth/password.ts +4 -3
- package/src/auth/session-refresh.ts +1 -1
- package/src/auth/session.test-fixture.ts +2 -2
- package/src/auth/session.ts +7 -7
- package/src/automations/crud.ts +8 -81
- package/src/automations/dispatch.ts +33 -58
- package/src/automations/index.ts +1 -1
- package/src/automations/persistence.ts +65 -0
- package/src/automations/precheck.ts +18 -16
- package/src/automations/read-async.ts +11 -0
- package/src/automations/reconcile.ts +30 -39
- package/src/automations/storage.ts +33 -10
- package/src/automations/write-async.ts +33 -0
- package/src/branch-land-notice.ts +3 -3
- package/src/branch-landed.ts +25 -23
- package/src/bus.ts +21 -19
- package/src/cd-deploy-notify.ts +2 -2
- package/src/ci/notifications.ts +4 -4
- package/src/ci/root-missing.ts +3 -3
- package/src/ci/transition-notify.ts +5 -5
- package/src/claude-app/oauth-http.ts +3 -3
- package/src/cli/index.ts +7 -1
- package/src/cli/init.ts +53 -0
- package/src/cli/orchestrator.ts +1 -7
- package/src/cli/setup.ts +6 -4
- package/src/cli/workflow.ts +12 -3
- package/src/commands-db.ts +4 -4
- package/src/commands-write.ts +8 -0
- package/src/compaction-watch.ts +10 -8
- package/src/config-store-write.ts +2 -2
- package/src/config.ts +4 -11
- package/src/connectors.ts +10 -8
- package/src/context-advisory.ts +22 -21
- package/src/db/agent-action-write.ts +36 -0
- package/src/db/agent-control-async.ts +9 -0
- package/src/db/agent-control-write.ts +49 -0
- package/src/db/agent-effort-observe.ts +22 -0
- package/src/db/agent-meta.ts +14 -3
- package/src/db/agents-async.ts +8 -5
- package/src/db/agents.ts +15 -12
- package/src/db/auth-identities.ts +2 -2
- package/src/db/automation-read-ops.ts +11 -0
- package/src/db/automation-write-ops.ts +46 -0
- package/src/db/blackboard.ts +2 -2
- package/src/db/browser-session-write.ts +32 -0
- package/src/db/bus-outbox-write-ops.ts +3 -1
- package/src/db/checkout-refresh-schema.ts +47 -0
- package/src/db/checkout-refresh.ts +5 -5
- package/src/db/command-agent-profile-backfill.ts +39 -0
- package/src/db/command-agent-profiles.ts +5 -1
- package/src/db/command-retention.ts +126 -0
- package/src/db/commands-planner-stats.test-fixture.ts +8 -0
- package/src/db/commands-read-ops.ts +16 -0
- package/src/db/connection.ts +1 -182
- package/src/db/context-carry-write.ts +74 -0
- package/src/db/continuations.ts +4 -4
- package/src/db/db-error-registry.ts +12 -0
- package/src/db/gateway.ts +26 -133
- package/src/db/history-retention-ops.ts +13 -0
- package/src/db/inbox-async.ts +2 -2
- package/src/db/inbox-read-ops.ts +1 -1
- package/src/db/inbox.ts +9 -3
- package/src/db/issue-associations.ts +2 -2
- package/src/db/issue-refs-async.ts +4 -1
- package/src/db/issue-refs-read-ops.ts +6 -0
- package/src/db/issue-refs.ts +8 -8
- package/src/db/kernel-event-log-schema.ts +2 -0
- package/src/db/land-boundaries.ts +51 -5
- package/src/db/land-gate-attestations.ts +2 -2
- package/src/db/landing-receipts.ts +2 -2
- package/src/db/lifecycle-context-write.ts +5 -0
- package/src/db/lifecycle-tail-async.ts +76 -0
- package/src/db/lifecycle-tail-write-ops.ts +62 -0
- package/src/db/lifecycle-write-window.ts +2 -1
- package/src/db/lineage-pair-dedupe-sql.ts +3 -3
- package/src/db/main-connection-mode.ts +11 -0
- package/src/db/main-connection-writes.ts +20 -2
- package/src/db/maintenance-job-runs-async.ts +2 -2
- package/src/db/maintenance-job-write-ops.ts +1 -1
- package/src/db/maintenance-pauses.ts +2 -2
- package/src/db/message-send.ts +4 -0
- package/src/db/messages.ts +31 -25
- package/src/db/migrations.ts +18 -1
- package/src/db/notification-write-ops.ts +19 -0
- package/src/db/operator-answer-write.ts +19 -0
- package/src/db/orchestrators.ts +10 -4
- package/src/db/pairs-async.ts +22 -1
- package/src/db/pairs-write-ops.ts +8 -3
- package/src/db/pairs.ts +41 -48
- package/src/db/plan-dispatch-schema.ts +5 -1
- package/src/db/plan-ready-notices.ts +43 -0
- package/src/db/plan-tools-include-migration.ts +36 -0
- package/src/db/plans-write-ops.ts +2 -0
- package/src/db/presence-buffer.ts +5 -0
- package/src/db/presence-loop.ts +18 -23
- package/src/db/presence-write.ts +0 -6
- package/src/db/project-entries-async.ts +14 -0
- package/src/db/project-entries-read-ops.ts +5 -1
- package/src/db/project-entries-write-ops.ts +8 -0
- package/src/db/project-entries.ts +15 -12
- package/src/db/project-journal.ts +2 -2
- package/src/db/project-trust-approvals.ts +2 -2
- package/src/db/prompt-templates.ts +4 -4
- package/src/db/read-op-marshaling-fixtures.ts +18 -0
- package/src/db/read-ops.ts +4 -0
- package/src/db/retention.ts +13 -2
- package/src/db/review-publish-write.ts +8 -0
- package/src/db/runtime-admin-async.ts +19 -0
- package/src/db/runtime-admin-write-ops.ts +36 -0
- package/src/db/runtime-tail-async.ts +288 -0
- package/src/db/runtime-tail-write-ops.ts +97 -0
- package/src/db/schema.ts +4 -1
- package/src/db/spawn-budget.ts +5 -0
- package/src/db/spawn-delegation.ts +3 -12
- package/src/db/sql-audit-indexes.ts +3 -0
- package/src/db/stats-async.ts +5 -3
- package/src/db/task-entity.ts +5 -4
- package/src/db/team-claim-policy.ts +60 -0
- package/src/db/teams-async.ts +4 -0
- package/src/db/teams-write-ops.ts +4 -0
- package/src/db/terminal-events.ts +15 -0
- package/src/db/timer-cutover-bodies.ts +292 -0
- package/src/db/timer-cutover-core.ts +37 -278
- package/src/db/timer-cutover-state.ts +40 -0
- package/src/db/timer-cutover-write-ops.ts +1 -40
- package/src/db/token-db-write-ops.ts +2 -0
- package/src/db/token-standing-async.ts +12 -0
- package/src/db/token-standing.ts +6 -9
- package/src/db/token-usage-retention.ts +33 -0
- package/src/db/token-usage-write-ops.ts +1 -1
- package/src/db/token-usage.ts +4 -1
- package/src/db/user-invites-async.ts +13 -0
- package/src/db/user-invites.ts +3 -3
- package/src/db/users.ts +14 -6
- package/src/db/workflow-execution.ts +3 -3
- package/src/db/workspaces.ts +8 -5
- package/src/db/write-ops.ts +31 -12
- package/src/db/writer-fault-seam.ts +2 -9
- package/src/db/writer-fault-test-ops.ts +18 -0
- package/src/db/writer-gateway.ts +42 -46
- package/src/dev.ts +12 -16
- package/src/event-loop-lag.ts +4 -2
- package/src/event-loop-yield.ts +2 -2
- package/src/events.ts +10 -8
- package/src/host-provider-store.ts +5 -4
- package/src/hub-metrics-report.ts +5 -1
- package/src/hub-metrics.ts +38 -18
- package/src/init.ts +299 -0
- package/src/injection-sweep-pacing.ts +6 -8
- package/src/invite-link.ts +16 -9
- package/src/land-gate-notifications.ts +11 -10
- package/src/land-gate-queue-progress.ts +3 -3
- package/src/land-settle-dispatch.ts +52 -92
- package/src/lifecycle-context-pressure.ts +11 -10
- package/src/lifecycle-manager.ts +104 -98
- package/src/maintenance/breaker.ts +18 -16
- package/src/maintenance/checkout-refresh.ts +18 -1
- package/src/maintenance/critical-job-watchdog.ts +3 -3
- package/src/maintenance/events.ts +3 -3
- package/src/maintenance/history-retention-job.ts +30 -0
- package/src/maintenance/jobs.ts +29 -67
- package/src/maintenance/long-running-work.ts +3 -1
- package/src/maintenance/offline-agent-prune-job.ts +28 -0
- package/src/maintenance/orphaned-sessions.ts +5 -4
- package/src/maintenance/pauses.ts +4 -10
- package/src/maintenance/plan-ready-notice-job.ts +71 -0
- package/src/maintenance/scheduler.ts +18 -13
- package/src/maintenance/stalled-delivery-pager.ts +4 -4
- package/src/maintenance/teams.ts +19 -30
- package/src/maintenance/workspaces.ts +17 -27
- package/src/managed-policy-escalation.ts +7 -7
- package/src/managed-policy.ts +3 -3
- package/src/managed-provider-gate.ts +5 -4
- package/src/managed-spawn-reservation.ts +5 -4
- package/src/mcp/index.ts +8 -8
- package/src/mcp/output-descriptions.ts +1 -1
- package/src/mcp/presentation.ts +2 -1
- package/src/mcp/runtime-output.ts +6 -1
- package/src/mcp/self-care-visibility.ts +2 -2
- package/src/mcp/spawn-targets-matrix.ts +10 -1
- package/src/mcp/tool-groups.ts +3 -2
- package/src/mcp/tool-roles.ts +81 -0
- package/src/mcp/tools-workspace.ts +1 -1
- package/src/mcp-blackboard-tools.ts +6 -5
- package/src/mcp-decision-tools.ts +7 -7
- package/src/mcp-egress-tools.ts +10 -9
- package/src/mcp-issue-activity-tools.ts +2 -2
- package/src/mcp-issue-association-tools.ts +4 -4
- package/src/mcp-issue-ref-tools.ts +3 -3
- package/src/mcp-merge-tools.ts +5 -5
- package/src/mcp-notification-subscription-tools.ts +14 -15
- package/src/mcp-output-levels.test-fixture.ts +1 -1
- package/src/mcp-profile-trust-tools.ts +1 -1
- package/src/mcp-project-journal-tools.ts +4 -12
- package/src/mcp-project-tools.ts +17 -18
- package/src/mcp-routing-policy-tools.ts +3 -2
- package/src/mcp-team-tools.ts +6 -6
- package/src/mcp-workflow-tools.ts +5 -3
- package/src/memory-area-injection.ts +13 -12
- package/src/memory-boundary-capture.ts +6 -6
- package/src/memory-injection.ts +45 -43
- package/src/merge-pause-maintenance.ts +5 -4
- package/src/notification-router.ts +44 -17
- package/src/notify.ts +5 -5
- package/src/observed-reset-refresh.ts +4 -4
- package/src/operator-alarm.ts +2 -5
- package/src/project-ingest.ts +6 -6
- package/src/project-instructions.ts +8 -1
- package/src/project-trust.ts +12 -11
- package/src/prompt-resolver.ts +3 -3
- package/src/provider-quota-async.ts +5 -7
- package/src/provider-timeline-event.ts +4 -7
- package/src/quota-band-delivery.ts +2 -2
- package/src/recipe-runner.ts +4 -3
- package/src/retention-config-store.ts +4 -3
- package/src/reviewer-pipeline.ts +11 -10
- package/src/routes/_route.ts +4 -4
- package/src/routes/_shared.ts +13 -12
- package/src/routes/agent-effort.ts +5 -5
- package/src/routes/agent-heartbeat-quota.ts +23 -0
- package/src/routes/agent-keep.ts +1 -1
- package/src/routes/agent-reporting.ts +1 -1
- package/src/routes/agent-self-effort.ts +5 -5
- package/src/routes/agent-sessions.ts +24 -24
- package/src/routes/agents-spawn.ts +1 -1
- package/src/routes/agents.ts +17 -119
- package/src/routes/auth.ts +44 -17
- package/src/routes/authority-audit.ts +2 -2
- package/src/routes/automations.ts +6 -5
- package/src/routes/channel-binding-delete.ts +1 -1
- package/src/routes/channel-output.ts +3 -3
- package/src/routes/claude-api-budget.ts +5 -5
- package/src/routes/commands-listing.ts +1 -1
- package/src/routes/commands.ts +29 -27
- package/src/routes/context-resets.ts +2 -2
- package/src/routes/coordinator-teams.ts +1 -1
- package/src/routes/decisions.ts +2 -2
- package/src/routes/host-providers.ts +18 -0
- 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 +7 -3
- package/src/routes/integrations.ts +9 -7
- package/src/routes/issue-activity.ts +2 -2
- package/src/routes/issue-associations.ts +4 -4
- package/src/routes/issue-refs.ts +3 -3
- package/src/routes/kernel-timers-operator.ts +1 -1
- package/src/routes/memory.ts +1 -1
- package/src/routes/merges.ts +11 -11
- package/src/routes/messages.ts +23 -17
- package/src/routes/orchestrator-bootstrap.ts +3 -1
- package/src/routes/orchestrator-host-registration.ts +2 -0
- package/src/routes/orchestrator-host-utilization.ts +2 -2
- package/src/routes/orchestrator-proxy.ts +2 -2
- package/src/routes/orchestrator.ts +27 -18
- package/src/routes/pairs.ts +8 -8
- package/src/routes/project-profile-instructions.ts +1 -1
- package/src/routes/project-trust.ts +1 -1
- package/src/routes/projects.ts +16 -16
- package/src/routes/prompt-templates.ts +12 -12
- package/src/routes/provider-quotas.ts +10 -10
- package/src/routes/run-command.ts +1 -1
- package/src/routes/secrets-backup.ts +4 -5
- package/src/routes/secrets-import.ts +3 -4
- package/src/routes/secrets-vault.ts +12 -14
- package/src/routes/settings.ts +1 -1
- package/src/routes/shipping.ts +9 -1
- package/src/routes/spawn-policy.ts +8 -7
- package/src/routes/sse.ts +2 -2
- package/src/routes/team-templates.ts +7 -7
- package/src/routes/teams.ts +10 -10
- package/src/routes/tokens.ts +18 -17
- package/src/routes/users.ts +24 -24
- package/src/routes/viewer-read.ts +3 -3
- package/src/routes/web-tool-calls.ts +4 -4
- package/src/routes/workflows.ts +2 -2
- package/src/routes/workspaces.ts +17 -16
- package/src/routing-policy-push.ts +6 -6
- package/src/runtime-grant.ts +17 -11
- package/src/runtime-install.ts +30 -0
- package/src/runtime-tokens.ts +20 -28
- package/src/secrets-broker/config.ts +1 -1
- package/src/secrets-broker/service.ts +2 -2
- package/src/security.ts +3 -1
- package/src/self-resume-carry.ts +21 -110
- package/src/self-resume-supersede.ts +4 -3
- package/src/self-resume.ts +54 -66
- package/src/server-background.ts +1 -1
- package/src/server.ts +25 -26
- 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/auth-context.ts +6 -0
- package/src/services/browser-inventory.ts +3 -3
- package/src/services/browser-session-state.ts +3 -2
- package/src/services/browser-session.ts +21 -27
- package/src/services/bus-command-update.ts +9 -9
- package/src/services/checkout-refresh-state.ts +1 -0
- package/src/services/checkout-refresh.test-fixture.ts +3 -2
- package/src/services/command-host.ts +7 -2
- package/src/services/coordinator-digest.ts +3 -2
- package/src/services/dispatch-command.ts +12 -13
- package/src/services/effective-launch-driver.ts +14 -9
- package/src/services/host-changed-paths.test-fixture.ts +5 -6
- package/src/services/host-project-readiness.ts +2 -2
- package/src/services/host-providers.ts +1 -1
- package/src/services/host-utilization.ts +9 -9
- package/src/services/idle-agent-digest.ts +17 -12
- package/src/services/idle-epics.ts +4 -4
- package/src/services/interrupt-agent.ts +12 -9
- package/src/services/issue-activity.ts +3 -3
- package/src/services/issue-associations.ts +15 -18
- package/src/services/issue-lifecycle-comments.ts +3 -2
- package/src/services/issue-lifecycle.ts +14 -13
- package/src/services/issue-refs.ts +4 -5
- package/src/services/kernel-timers-cutover-chaos-worker.ts +1 -1
- package/src/services/kernel-timers-ingress-chaos-worker.ts +6 -1
- package/src/services/kernel-timers-ingress.ts +3 -3
- package/src/services/kernel-timers-message-authority-chaos-worker.ts +3 -10
- package/src/services/kernel-timers-operator-chaos-worker.ts +3 -2
- package/src/services/kernel-timers-outbox.ts +1 -1
- package/src/services/kernel-timers-stage10-operator.ts +1 -1
- package/src/services/kernel-timers.ts +4 -3
- package/src/services/land-gate-placement.ts +11 -2
- package/src/services/land-issue-relations.ts +5 -4
- package/src/services/land-restart-retry.ts +7 -6
- package/src/services/landed-ancestry.ts +6 -5
- package/src/services/legacy-landing-host.ts +4 -1
- package/src/services/legacy-landing-recovery.ts +8 -6
- package/src/services/managed-running.ts +17 -17
- package/src/services/memory-areas.ts +3 -3
- package/src/services/merge-pause.ts +9 -15
- package/src/services/operator-decisions.ts +37 -41
- package/src/services/orchestrator-registration-recovery.ts +6 -2
- package/src/services/orchestrator-upgrade.ts +14 -12
- package/src/services/permission-decision.ts +4 -3
- package/src/services/plan-ci-notice.ts +1 -1
- package/src/services/plan-conformance.ts +4 -4
- package/src/services/plan-dispatch-policy.ts +10 -3
- package/src/services/plan-dispatch.ts +35 -14
- package/src/services/plan-graph.ts +39 -261
- package/src/services/plan-import.ts +1 -1
- package/src/services/plan-live-bindings.ts +8 -37
- package/src/services/plan-task-create.ts +1 -1
- package/src/services/plan-terminal-refs.ts +2 -12
- package/src/services/plan-wake-digest.ts +8 -3
- package/src/services/profile-trust.ts +2 -2
- package/src/services/project.ts +11 -10
- package/src/services/prompt-templates.ts +6 -5
- package/src/services/provider-api-key.ts +73 -0
- package/src/services/provider-hold-nudge.ts +9 -9
- package/src/services/provider-hold-record.ts +13 -12
- package/src/services/provider-state-audit.ts +19 -18
- package/src/services/provisioning-harness/driver.ts +1 -1
- package/src/services/provisioning-harness/fixture-matrix.ts +3 -3
- package/src/services/provisioning-harness/lifecycle.ts +24 -22
- package/src/services/provisioning-harness/prepare.ts +16 -17
- package/src/services/rate-limit-resume.ts +10 -9
- package/src/services/red-main-auto-revert.ts +7 -5
- package/src/services/red-main-controller-deps.ts +20 -3
- package/src/services/red-main-incident.ts +3 -1
- package/src/services/red-main-quarantine.ts +2 -3
- package/src/services/register-agent.ts +22 -22
- package/src/services/restart-project-role.ts +1 -1
- package/src/services/restart-spawn.ts +17 -16
- package/src/services/review-publish.ts +7 -24
- package/src/services/review-ref-reconcile.ts +29 -38
- package/src/services/runtime-dependency-alert.ts +27 -0
- package/src/services/scheduler-command.ts +11 -9
- package/src/services/scheduler.ts +5 -5
- package/src/services/self-effort-grant.ts +5 -25
- package/src/services/send-message.ts +16 -33
- package/src/services/shutdown-agent.ts +17 -14
- package/src/services/spawn-agent.ts +12 -41
- package/src/services/spawn-chain-inspector.ts +1 -1
- package/src/services/spawn-cwd-placement.ts +21 -5
- package/src/services/spawn-issue-activity.ts +8 -6
- package/src/services/spawn-launch.ts +17 -1
- package/src/services/spawn-loss-escalation.ts +1 -1
- package/src/services/spawn-registration-watchdog.ts +2 -2
- package/src/services/spawn-repo-probe.ts +7 -5
- package/src/services/spawn-tree-cleanup.ts +7 -8
- package/src/services/steward-reaper.ts +4 -4
- package/src/services/task-context-hydration.ts +25 -1
- package/src/services/task-delivery.ts +20 -34
- package/src/services/task-entity.ts +40 -203
- package/src/services/task-issue-link.ts +13 -20
- package/src/services/task-issue-weave.ts +12 -11
- package/src/services/task-lifecycle.ts +27 -31
- package/src/services/task-repo-cwd.ts +37 -0
- package/src/services/task-review-hold.ts +4 -17
- package/src/services/task-semantic-events.ts +13 -11
- package/src/services/task-state-reconcile.ts +3 -4
- package/src/services/task-validation.ts +2 -2
- package/src/services/team-templates.ts +5 -5
- package/src/services/team.ts +31 -98
- package/src/services/terminal-provider-exit.ts +6 -5
- package/src/services/timer-message-fire-chaos-worker.ts +7 -3
- package/src/services/timer-message-fire-outbox.ts +1 -1
- package/src/services/transient-agent-reaper.ts +22 -19
- package/src/services/turn-reconcile-audit.ts +9 -9
- package/src/services/user-onboarding.ts +8 -6
- package/src/services/user-profile.ts +6 -9
- package/src/services/work-finality.ts +16 -4
- package/src/services/workflow-auto-start.ts +2 -1
- package/src/services/workflow-caller.ts +61 -4
- package/src/services/workflow-child-proof-worker.ts +1 -1
- package/src/services/workflow-control-proof-worker.ts +1 -1
- package/src/services/workflow-coordinator.ts +8 -2
- package/src/services/workflow-decisions.ts +5 -5
- package/src/services/workflow-deferred-cleanup.ts +1 -1
- package/src/services/workflow-effect-driver.ts +42 -19
- package/src/services/workflow-effects.ts +41 -27
- package/src/services/workflow-pins.ts +7 -4
- package/src/services/workflow-reconcile.ts +1 -0
- package/src/services/workflow-resume-pins.ts +3 -3
- package/src/services/workflow-routing-defaults.ts +18 -0
- package/src/services/workflow-run-view.ts +4 -3
- package/src/services/workflow-run.test-fixture.ts +1 -1
- package/src/services/workflow-runs.ts +34 -22
- package/src/services/workflow-supervisor-state.ts +21 -1
- package/src/services/workflow-supervisor.ts +4 -3
- package/src/services/workspace-recovery.ts +4 -3
- package/src/setup.ts +47 -8
- package/src/spawn-admission.ts +10 -2
- package/src/spawn-placement.ts +27 -9
- package/src/spawn-targets.ts +8 -8
- package/src/sse-agent-status.ts +15 -6
- package/src/sse.ts +49 -24
- package/src/startup-context-injection.ts +61 -57
- package/src/steward-handoff.ts +4 -3
- package/src/steward-policy-cleanup.ts +9 -8
- package/src/steward.ts +2 -2
- package/src/task-dispatch-live.ts +5 -2
- package/src/task-dispatcher.ts +2 -2
- package/src/token-db.ts +2 -2
- package/src/token-usage-async.ts +2 -4
- package/src/user-awaiting-reply.ts +5 -5
- package/src/utils.ts +7 -0
- package/src/workspace-actions.ts +24 -29
- package/src/workspace-auto-merge.ts +14 -12
- package/src/workspace-changed-paths-client.ts +16 -5
- package/src/workspace-cleanup-stale.ts +30 -7
- package/src/workspace-command-settle.ts +24 -16
- package/src/workspace-config.ts +1 -1
- package/src/workspace-conflict-resolver.ts +9 -7
- package/src/workspace-dead-owner-recovery.ts +5 -4
- package/src/workspace-escalation.ts +12 -11
- package/src/workspace-human-escalation.ts +3 -3
- package/src/workspace-land-gate-watchdog.ts +3 -3
- package/src/workspace-land-refusal.ts +20 -0
- package/src/workspace-land-stopped.ts +1 -0
- package/src/workspace-merge.ts +10 -26
- package/src/workspace-nothing-to-land-notice.ts +2 -2
- package/src/workspace-orphans.ts +18 -37
- package/src/workspace-pr-completion.ts +10 -8
- package/src/workspace-rekey.ts +3 -3
- package/src/workspace-steward-failure.ts +2 -2
- package/src/workspace-steward-wake.ts +2 -2
- package/public/assets/agent-liveness-CaNwK0Zf.js +0 -2
- package/public/assets/overview-C1DCTzzV.js +0 -2
- package/public/assets/provider-display-DsuWMvVL.js +0 -2
- package/public/assets/run-card-CpKqRbhg.js +0 -2
- package/public/assets/shipping-B9YtnwtG.js +0 -2
- package/public/assets/store-DcClXLH0.js +0 -9
- package/runner/src/agent-runner/http-liveness.ts +0 -85
- package/src/db/on-loop-write-transaction.ts +0 -34
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=project-profile-instructions-
|
|
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-BgDALGIX.js";import{M as i}from"./provider-display-bWwiuedV.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-BkTi7eim.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-Apn15y43.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}from"./store-DcClXLH0.js";import{M as i}from"./provider-display-DsuWMvVL.js";import{n as a,t as o}from"./use-project-list-59LheVP7.js";import{et as s}from"./display-BrKWFGJz.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-DQWZE0kA.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-
|
|
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-BgDALGIX.js";import{M as i}from"./provider-display-bWwiuedV.js";import{n as a,t as o}from"./use-project-list-X-BgT53X.js";import{et as s}from"./display-BemJG1f_.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-Apn15y43.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-D3B6kto5.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-DsuWMvVL.js";import{et as a}from"./display-BrKWFGJz.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-BmED5DnJ.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-bWwiuedV.js";import{et as a}from"./display-BemJG1f_.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-BkTi7eim.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-DnPB6Ez6.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function n(e){return e instanceof Error?e.message:String(e)}var r=`provider-enablement`,i=`default`,a=`user`;function o(e){return`user:${e}`}var s=o(`claude-app`);function ee(e){return e===`user`||typeof e==`string`&&e.startsWith(`user:`)}function te(e){if(e===`user`)return i;if(typeof e==`string`&&e.startsWith(`user:`))return e.slice(5)||`default`}function ne(e){return e===`user`||e===o(`default`)||e===`user:`?a:e}var re=[`system`,`control`,`session`];function ie(e){return re.includes(e??``)}var c=[`memory`,`memory-area`,`instructions`,`tools`,`comms`,`knowledge`,`context`];function ae(e){return typeof e==`string`&&c.includes(e)}function oe(t){return e(t)&&(t.turnFinal===!0||t.final===!0)}function l(t){return e(t)&&e(t.finality)}function se(t){if(!e(t))return!1;if(l(t))return!0;let n=t.session;return e(n)&&n.final===!0&&n.turnFinal!==!0}function ce(t){if(t.messageType===`final-turn`)return!0;let n=e(t.payload?.responseCapture)?t.payload.responseCapture:void 0;return oe(n)&&n.type===`response`}var le=[`decisions`,`actions`,`escalations`,`finalReports`,`failures`];Object.freeze({decisions:`all`,actions:`all`,escalations:`all`,finalReports:`all`,failures:`all`});var ue=/^[a-z][a-z0-9-]*$/,u=new Map,d=[`CLAUDE_CODE_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`,`ANTHROPIC_AUTH_TOKEN`];function f(e){if(!ue.test(e.id))throw Error(`invalid provider id: ${e.id}`);if(!e.label.trim())throw Error(`provider ${e.id} is missing a label`);if(!e.icon.trim())throw Error(`provider ${e.id} is missing an icon`);if(u.has(e.id))throw Error(`provider already registered: ${e.id}`);u.set(e.id,e)}function p(e){return u.get(e)}function m(){return[...u.values()]}function de(e,t){let n=u.get(e)?.capabilityDefaults.session?.shellMode,r=t===`read-only`?n?.readOnly:n?.[t];return!!(r&&r!==`unsupported`)}function h(e){return[`open`,`guarded`,`read-only`].filter(t=>de(e,t))}var g=`opencode-ai@latest`,fe=`@anthropic-ai/claude-code@latest`,_=[`low`,`medium`,`high`,`max`],v=[`low`,`medium`,`high`,`xhigh`,`max`],y={value:2e5,source:`catalog`,confidence:`declared`},b={value:1e6,source:`catalog`,confidence:`declared`},pe={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},x=[{name:`five_hour`,unit:`%`,reset:!0},{name:`seven_day`,unit:`%`,reset:!0}];function S(e){return{...e?{limits:e}:{},capabilities:pe}}var C={id:`claude`,credentialEnvKeys:d,label:`Claude`,icon:`🟠`,launchModes:[`interactive`,`headless`],effortSwitch:!0,launch:{managedPolicyPrompt:{alwaysOn:`append-system-prompt`},taskHydration:{channel:`append-system-prompt`}},catalog:{defaultModel:`sonnet`,models:[{alias:`haiku-5.5`,label:`Haiku 5.5`,providerModel:`claude-haiku-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-5.5`,label:`Opus 5.5`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet-5.5`,label:`Sonnet 5.5`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`fable-5.1`,label:`Fable 5.1`,providerModel:`claude-fable-5-1`,efforts:v,defaultEffort:`high`,...S({contextWindowTokens:b})},{alias:`fable-5`,label:`Fable 5`,providerModel:`claude-fable-5`,efforts:v,defaultEffort:`medium`,unavailable:`suspended by export-control directive, 2026-06-12`,...S({contextWindowTokens:b})},{alias:`opus-4.8`,label:`Opus 4.8`,providerModel:`claude-opus-4-8`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.8[1m]`,label:`Opus 4.8 1M`,providerModel:`claude-opus-4-8[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-4.7`,label:`Opus 4.7`,providerModel:`claude-opus-4-7`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.7[1m]`,label:`Opus 4.7 1M`,providerModel:`claude-opus-4-7[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-4.6`,label:`Opus 4.6`,providerModel:`claude-opus-4-6`,efforts:_,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.6[1m]`,label:`Opus 4.6 1M`,providerModel:`claude-opus-4-6[1m]`,efforts:_,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet-5`,label:`Sonnet 5`,providerModel:`claude-sonnet-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`sonnet-5[1m]`,label:`Sonnet 5 1M`,providerModel:`claude-sonnet-5[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`haiku`,label:`Haiku`,providerModel:`claude-haiku-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`fable`,label:`Fable`,providerModel:`claude-fable-5-1`,efforts:v,defaultEffort:`high`,...S({contextWindowTokens:b})},{alias:`opus`,label:`Opus`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus[1m]`,label:`Opus 1M`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet`,label:`Sonnet`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet[1m]`,label:`Sonnet 1M`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})}]},quotaWindows:[...x],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:{when:`headless`,value:!0,otherwise:!1},restartHard:{when:`headless`,value:!0,otherwise:!1},semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:{when:`approval:not-read-only`,value:!0,otherwise:!1},shell:!0,shellMode:{open:`unrestricted`,guarded:`guarded`,readOnly:`read-only-guarded`}},context:{managed:`headless`,compact:{when:`headless`,value:!0,otherwise:!1},clear:{when:`headless`,value:!0,otherwise:!1},inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`probe`,unit:`%`,windows:[...x]},terminal:{mode:`live`,condition:`headless`,live:{read:!0,write:!0}},liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!0,slashCommands:!0}},slashCommands:[`/clear`,`/compact`,`/model`,`/help`],resume:{supported:!0,idFormat:`uuid-v4`,idPattern:`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`},home:{configDir:`.claude`,envPrefix:`CLAUDE`,configDirEnvVar:`CLAUDE_CONFIG_DIR`,quotaCredentialFile:`.credentials.json`,authItems:[`.credentials.json`,`statsig`],globalInstructionFiles:[`CLAUDE.md`]},provisioning:{pluginManifestPath:`.claude-plugin/plugin.json`,bundledPlugin:{ref:`agent-relay-claude-plugin`,dir:`runner/plugins/claude`,title:`Humwick Claude plugin`,description:`Bundled Humwick Claude plugin, materialized whole through the provisioning registry.`,omitFiles:[`monitors/relay-monitor.provisioned.mjs`,`hooks/gate-run-guard.provisioned.mjs`,`hooks/kill-guard.provisioned.mjs`],fileOverrides:[{path:`monitors/relay-monitor.ts`,sourcePath:`monitors/relay-monitor.provisioned.mjs`},{path:`hooks/gate-run-guard.ts`,sourcePath:`hooks/gate-run-guard.provisioned.mjs`},{path:`hooks/kill-guard.ts`,sourcePath:`hooks/kill-guard.provisioned.mjs`}]},bundledHooks:[{ref:`agent-relay-rg-r-guard`,dir:`runner/hooks/rg-r-guard`,title:`Humwick baseline hook: rg -r guard`,description:"Baseline Humwick PreToolUse hook that blocks the ripgrep `rg -r` replace footgun.",baseline:!0},{ref:`agent-relay-fff-search-redirect`,dir:`runner/hooks/fff-search-redirect`,title:`Humwick fff search redirect`,description:`Redirects standalone repository searches to fff for Claude profiles with a configured fff MCP server.`,omitFiles:[`fff-search-redirect.test.ts`]},{ref:`agent-relay-web-tools-redirect`,dir:`runner/hooks/web-tools-redirect`,title:`Humwick web tools redirect`,description:`Redirects built-in WebSearch/WebFetch to the profile's Relay web_search and local-first page reader tools (#3024).`,omitFiles:[`web-tools-redirect.test.ts`]}]},upgrade:{packages:[`agent-relay-runner`,`agent-relay-plugin`],detectPackages:[`agent-relay-runner`],detectCommands:[`claude`]},harness:{upgrade:{strategy:`self-update`,args:[`update`],packages:[fe]}},probe:{command:`claude`,args:[`--version`],healthCheck:`claude --version`,authCheck:{command:`claude`,args:[`auth`,`status`,`--json`],loginArgs:[`auth`,`login`]}},quotaPoll:{strategy:`none`},shim:{kind:`claude-relay`},mcpToolManifest:{clientNativeToolDeferral:!0,runnerManagedToolDeferral:!1}};f(C),f({...C,id:`claude-b`,label:`Claude B`,home:{...C.home,configDir:`.claude-b`,dedicatedHome:!0}}),f({...C,id:`claude-api`,label:`Claude API`,automaticFamilyRouting:!1,defaultEnabled:!1,resume:{supported:!1},credentialEnvKeys:[`ANTHROPIC_API_KEY`],apiAuth:{keyPrefix:`sk-ant-`,keyEnvVar:`ANTHROPIC_API_KEY`,defaultKeyFile:`~/.config/agent-relay/secrets/anthropic-api.key`,unsetEnvKeys:[...d,`ANTHROPIC_BASE_URL`,`CLAUDE_CODE_USE_BEDROCK`,`CLAUDE_CODE_USE_VERTEX`,`CLAUDE_CODE_USE_FOUNDRY`,`ANTHROPIC_CUSTOM_HEADERS`,`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`]},home:{...C.home,configDir:`.claude-api`,sourceEnvVar:`CLAUDE_API_CONFIG_DIR`,dedicatedHome:!0,authItems:[]},harness:{upgrade:{...C.harness.upgrade,installWhenMissing:!0}},launchModes:void 0,quotaWindows:[],capabilityDefaults:{...C.capabilityDefaults,quota:{supported:!1,source:`runtime`,unit:`USD`,windows:[]}}});var w=[`low`,`medium`,`high`,`xhigh`],T={value:2e5,source:`catalog`,confidence:`declared`},E={value:5e5,source:`catalog`,confidence:`declared`},me={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},D=[{name:`primary`,unit:`%`,reset:!0},{name:`secondary`,unit:`%`,reset:!0}];function O(e){return{...e?{limits:e}:{},capabilities:me}}f({id:`codex`,credentialEnvKeys:[`OPENAI_API_KEY`],label:`Codex`,icon:`⌨️`,launchModes:[`interactive`,`headless`],launch:{secretEnvRequiresManagedHome:!0,managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`sol`,models:[{alias:`sol`,label:`GPT-6.1 Sol`,providerModel:`gpt-6.1-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:E})},{alias:`luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-6-sol`,label:`GPT-6 Sol`,providerModel:`gpt-6-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-6.1-sol`,label:`GPT-6.1 Sol`,providerModel:`gpt-6.1-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:E})},{alias:`gpt-6-luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,providerModel:`gpt-5.6-terra`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.5`,label:`GPT-5.5`,providerModel:`gpt-5.5`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.4`,label:`GPT-5.4`,providerModel:`gpt-5.4`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.4-mini`,label:`GPT-5.4 Mini`,providerModel:`gpt-5.4-mini`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.3-codex`,label:`GPT-5.3 Codex`,providerModel:`gpt-5.3-codex`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.3-codex-spark`,label:`GPT-5.3 Codex Spark`,providerModel:`gpt-5.3-codex-spark`,efforts:w,defaultEffort:`high`,...O({contextWindowTokens:T})},{alias:`gpt-5.2`,label:`GPT-5.2`,providerModel:`gpt-5.2`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})}]},quotaWindows:[...D],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:{when:`approval:not-read-only`,value:!0,otherwise:!1},shell:{when:`approval:not-read-only`,value:!0,otherwise:!1},shellMode:{open:`unrestricted`,guarded:`guarded`,readOnly:`none`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`probe`,unit:`%`,windows:[...D]},terminal:{mode:`attach`,attach:{create:!0,read:!0,write:!0,detach:!0}},liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!0,slashCommands:!0}},slashCommands:[`/compact`,`/new`],resume:{supported:!0,idFormat:`codex-thread-id`,idPattern:`[\\w-]+`},home:{configDir:`.codex`,envPrefix:`CODEX`,configDirEnvVar:`CODEX_HOME`,quotaCredentialFile:`auth.json`,authItems:[`auth.json`,`installation_id`],globalInstructionFiles:[`AGENTS.md`]},provisioning:{pluginManifestPath:`.codex-plugin/plugin.json`,bundledSkills:{refPrefix:`agent-relay-codex-`,dir:`runner/plugins/codex/skills`,titlePrefix:`Humwick Codex skill: `,description:`Bundled Humwick Codex skill, materialized through the provisioning registry.`,entryFile:`SKILL.md`},bundledHooks:[{ref:`agent-relay-rg-r-guard`,dir:`runner/hooks/rg-r-guard`,title:`Humwick baseline hook: rg -r guard`,description:"Baseline Humwick PreToolUse hook that blocks the ripgrep `rg -r` replace footgun.",baseline:!0}]},upgrade:{packages:[`agent-relay-runner`,`agent-relay-codex`],detectPackages:[`agent-relay-runner`,`agent-relay-codex`],detectCommands:[`codex-relay`,`agent-relay-runner`]},harness:{upgrade:{strategy:`self-update`,args:[`update`]}},probe:{command:`codex`,args:[`--version`],healthCheck:`codex --version`,authCheck:{command:`codex`,args:[`login`,`status`],loginArgs:[`login`]}},quotaPoll:{strategy:`codex-app-server`},resetCredits:{supported:!0},shim:{kind:`codex-relay`,extraBinPaths:[`codex/bin/codex`],cleanLegacyHooks:!0},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!0,runnerManagedToolDeferralRoute:`meta-only-callmux`}});var k={mode:`attach`,attach:{create:!0,read:!0,write:!0,detach:!0}};f({id:`opencode`,label:`OpenCode`,icon:`⚡`,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`muse-spark`,models:[{alias:`muse-spark`,label:`Muse Spark 1.3 Contributor`,providerModel:`meta/muse-spark-1.3-contributor`,efforts:[],limits:{contextWindowTokens:{value:1048576,source:`catalog`,confidence:`declared`},maxOutputTokens:{value:943718,source:`catalog`,confidence:`declared`}},capabilities:{modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`estimated`}},{alias:`openai/gpt-6.1-sol`,label:`GPT-6.1 Sol · OpenAI API`,providerModel:`openai/gpt-6.1-sol`,efforts:[],limits:{contextWindowTokens:{value:272e3,source:`catalog`,confidence:`declared`},maxOutputTokens:{value:128e3,source:`catalog`,confidence:`declared`}}}]},quotaWindows:[],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!1,source:`runtime`,unit:`%`,windows:[]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.config/opencode`,envPrefix:`OPENCODE`},opencode:{opencodeProviderID:`openrouter`,apiKeyEnvVar:`OPENROUTER_API_KEY`},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`none`},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}});var A=[{name:`rolling`,unit:`%`,reset:!0,description:`Rolling 5-hour usage window`},{name:`weekly`,unit:`%`,reset:!0,description:`Weekly usage window`},{name:`monthly`,unit:`%`,reset:!0,description:`Monthly usage window (display-only)`}],he={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`estimated`};function j(e,t){return{alias:e,label:t,providerModel:e,efforts:[],capabilities:he}}f({id:`opencode-go`,label:`OpenCode Go`,icon:`⚡`,defaultEnabled:!1,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`glm-5.3-flash`,models:[j(`claude-haiku-5-5`,`Claude Haiku 5.5`),j(`deepseek-v4-pro`,`DeepSeek V4 Pro`),j(`deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`),j(`gemini-4-argon-contributor`,`Gemini 4 Argon Contributor`),j(`glm-5.2`,`GLM-5.2`),j(`glm-5.3`,`GLM-5.3`),j(`glm-5.3-flash`,`GLM-5.3 Flash`),j(`gpt-5.6-luna`,`GPT-5.6 Luna`),j(`gpt-6-luna`,`GPT-6 Luna`),j(`grok-4.6`,`Grok 4.6`),j(`grok-4.7`,`Grok 4.7`),j(`hy3`,`Hy3`),j(`hy4-preview`,`Hy4 Preview`),j(`kimi-k2.7-code`,`Kimi K2.7 Code`),j(`kimi-k3`,`Kimi K3`),j(`longcat-2.0`,`LongCat 2.0`),j(`mimo-v2.5`,`MiMo V2.5`),j(`mimo-v2.5-pro`,`MiMo V2.5 Pro`),j(`mimo-v2.6-flash`,`MiMo V2.6 Flash`),j(`mimo-v2.6-pro`,`MiMo V2.6 Pro`),j(`minimax-m2.7`,`MiniMax M2.7`),j(`minimax-m3`,`MiniMax M3`),j(`muse-spark-1.2-contributor`,`Muse Spark 1.2 Contributor`),j(`muse-spark-1.3-contributor`,`Muse Spark 1.3 Contributor`),j(`qwen3.7-plus`,`Qwen3.7 Plus`),j(`qwen3.8-flash`,`Qwen3.8 Flash`),j(`qwen3.8-max`,`Qwen3.8 Max`),j(`space-bunny`,`Space Bunny`)]},quotaWindows:[...A],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`runtime`,unit:`%`,windows:[...A]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.local/share/opencode`,envPrefix:`OPENCODE_GO`,quotaCredentialFile:`auth.json`},opencode:{opencodeProviderID:`opencode-go`,apiKeyEnvVar:`OPENCODE_API_KEY`,hostAuth:!0},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`opencode-go`},quotaAlsoWith:`opencode`,mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}});var M={value:1e6,source:`catalog`,confidence:`declared`},N={value:131072,source:`catalog`,confidence:`declared`},ge={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},P={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},F=[{name:`five_hour`,unit:`%`,reset:!0,description:`Rolling 5-hour credit window`},{name:`seven_day`,unit:`%`,reset:!0,description:`Weekly credits, reset from the subscription timestamp`}];f({id:`zai`,label:`z.ai`,icon:`🟣`,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`glm-5.3-flash`,models:[{alias:`glm-5.3`,label:`GLM-5.3`,providerModel:`glm-5.3`,efforts:[],limits:{contextWindowTokens:M,maxOutputTokens:N},capabilities:ge},{alias:`glm-5.3-flash`,label:`GLM-5.3 Flash`,providerModel:`glm-5.3-flash`,efforts:[],limits:{contextWindowTokens:M,maxOutputTokens:N},capabilities:P}]},quotaWindows:[...F],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`runtime`,unit:`%`,windows:[...F]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.config/opencode`,envPrefix:`ZAI`,quotaCredentialFile:`auth.json`},opencode:{opencodeProviderID:`zai`,baseURL:`https://api.z.ai/api/coding/paas/v4`,npm:`@ai-sdk/openai-compatible`,apiKeyEnvVar:`ZAI_API_KEY`},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`zai`},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}}),Object.freeze({codex:{"gpt-5.6-terra":`sol`,"gpt-5.6-sol":`sol`,"gpt-6-sol":`sol`,"gpt-6.1-sol":`sol`,"gpt-5.6-luna":`luna`,"gpt-6-luna":`luna`},claude:{"opus-4.8":`opus`,"sonnet-5":`sonnet`,"fable-5":`fable`},"claude-b":{"opus-4.8":`opus`,"sonnet-5":`sonnet`,"fable-5":`fable`}});var I={opencode:{envVar:`OPENCODE_API_KEY`},"opencode-go":{envVar:`OPENCODE_API_KEY`},anthropic:{envVar:`ANTHROPIC_API_KEY`},openai:{envVar:`OPENAI_API_KEY`},openrouter:{envVar:`OPENROUTER_API_KEY`},google:{envVar:`GOOGLE_GENERATIVE_AI_API_KEY`},mistral:{envVar:`MISTRAL_API_KEY`},deepseek:{envVar:`DEEPSEEK_API_KEY`},xai:{envVar:`XAI_API_KEY`},groq:{envVar:`GROQ_API_KEY`},azure:{envVar:`AZURE_API_KEY`},moonshotai:{envVar:`MOONSHOT_API_KEY`},cerebras:{envVar:`CEREBRAS_API_KEY`},cohere:{envVar:`COHERE_API_KEY`},"fireworks-ai":{envVar:`FIREWORKS_API_KEY`},togetherai:{envVar:`TOGETHER_API_KEY`},chutes:{envVar:`CHUTES_API_KEY`},zai:{envVar:`ZAI_API_KEY`,custom:!0}},L=class extends Error{candidates;constructor(e,t){super(e),this.candidates=t,this.name=`OpenCodeModelResolutionError`}},R=8;function z(e,t){let n=e.indexOf(`/`);return n<=0?{backendID:t,modelID:e,qualified:`${t}/${e}`}:{backendID:e.slice(0,n),modelID:e.slice(n+1),qualified:e}}function _e(e,t,n){let r=e.trim();if(!r)throw new L(`OpenCode model id is empty.`,[]);let i=r.indexOf(`/`),a=i>0?r.slice(0,i):void 0;if(!n)return a&&(a===t||I[a]!==void 0)?z(r,t):{backendID:t,modelID:r,qualified:`${t}/${r}`};if(n.models.has(r))return z(r,t);if(n.models.has(`${t}/${r}`))return{backendID:t,modelID:r,qualified:`${t}/${r}`};if(a&&n.providers.has(a))return z(r,t);if(!a){let e=[...n.models].filter(e=>e.slice(e.indexOf(`/`)+1)===r);if(e.length===1)return z(e[0],t);if(e.length>1){let t=e.sort().slice(0,R);throw new L(`OpenCode model "${r}" is ambiguous on this host (${n.source} registry); qualify it as one of: ${t.join(`, `)}.`,t)}}let o=ve(r,n),s=o.length?` Did you mean: ${o.join(`, `)}?`:``;throw new L(`OpenCode model "${r}" is not available on this host (${n.source} registry: backend "${a??t}" is not a known opencode provider and no listed model matches).${s}`,o)}function ve(e,t){let n=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(!n)return[];let r=[],i=[];for(let e of t.models){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();t===n?r.push(e):t.includes(n)&&i.push(e)}return[...r.sort(),...i.sort()].slice(0,R)}var ye=[`off`,`quiet`,`normal`,`verbose`];m().map(e=>e.id);var B=[`narration`,`tools`,`reasoning`,`memories`,`startup`,`injected`,`agentMessages`,`workflow`,`land`,`task`,`agents`,`other`,`undelivered`],be=[`workflow`,`land`,`task`,`agents`,`other`];function V(e){return Object.fromEntries(B.map(t=>[t,e(t)]))}var H=V(e=>be.includes(e)),U={calm:H,everything:V(()=>!0)};function W(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return V(e=>typeof t[e]==`boolean`?t[e]:H[e])}function xe(e){for(let[t,n]of Object.entries(U))if(B.every(t=>n[t]===e[t]))return t;return null}function Se(e,t){let n=e?.opencodeProviderID,r=t?.trim();if(!(!n||!r))return _e(r,n).qualified}function Ce(e){return!e?.disabled}var we=.1,Te=.9,G=.8,K=.4,q=256e3,J=1e6;function Ee(){return m().map(e=>({provider:e.id,label:e.label,models:[],...e.opencode?.opencodeProviderID?{opencodeProviderID:e.opencode.opencodeProviderID}:{},...e.launchModes?.length?{launchModes:[...e.launchModes]}:{},...e.effortSwitch?{effortSwitch:!0}:{}}))}function De(e){let t=Oe(e);return{selfCompactUtilization:t,warnUtilization:ke(t),hardBackstopUtilization:Math.max(Te,t)}}function Oe(e){return!Number.isFinite(e)||!e||e<=q?G:e>=J?K:Y(G-(e-q)/(J-q)*(G-K))}function ke(e){return Y(Math.max(0,e-we))}function Y(e){return Math.round(e*1e3)/1e3}function X(e,t){if(e)return(t??Ee()).find(t=>t.provider===e)}function Ae(e,t,n={}){let r=(Array.isArray(t)?t:t?[t]:[]).map(e=>e.trim()).filter(Boolean);if(r.length){for(let t of r){let i=je(e,t,n.requireUnambiguous),a=Me(e,i,r,n.observedWindowTokens);if(a)return a;if(i)return i}if(!(n.requireUnambiguous||n.exactOnly))for(let t of r){let n=e.models.find(e=>e.alias.startsWith(t+`-`));if(n)return n}}}function je(e,t,n=!1){let r=t.toLowerCase(),i=e.models.find(e=>e.alias===t)??e.models.find(e=>e.alias.toLowerCase()===r);if(i)return i;let a=e.models.filter(e=>e.providerModel.toLowerCase()===r);if(a.length>1&&n)throw Error(`ambiguous ${e.provider} provider model: ${t} (select an alias: ${a.map(e=>e.alias).join(`, `)})`);return a[0]}function Me(e,t,n,r){if(!Number.isFinite(r)||!r)return;if(t?.limits?.contextWindowTokens?.value===r)return t;let i=new Set([...t?[t.alias,t.providerModel]:[],...n].map(Z));return e.models.find(e=>e.limits?.contextWindowTokens?.value===r&&(i.has(Z(e.alias))||i.has(Z(e.providerModel))))}function Z(e){return e.trim().toLowerCase().replace(/\[[^\]]+\]$/,``)}function Ne(e){return!e.disabled&&!e.unavailable}function Pe(e){let t=e.defaultModel,n=t?e.models.find(e=>e.alias===t):void 0;return n&&Ne(n)?{alias:n.alias,preferred:t,fellBack:!1}:{alias:void 0,preferred:t,fellBack:!0}}function Fe(e){return p(e)?.resetCredits?.supported===!0}var Q=[`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,`bg-tone-sky/10 text-tone-sky-fg border-tone-sky/30`,`bg-tone-violet/10 text-tone-violet-fg border-tone-violet/30`,`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,`bg-tone-rose/10 text-tone-rose-fg border-tone-rose/30`];function Ie(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}var $=new Map(m().map((e,t)=>[e.id,Q[t%Q.length]]));function Le(e){return e?p(e)?.label??e.charAt(0).toUpperCase()+e.slice(1):`Unknown provider`}function Re(e){let t=$.get(e);if(t)return t;let n=Q[Ie(e)%Q.length];return $.set(e,n),n}function ze(){return m().map(e=>e.id)}function Be(e){return p(e)}function Ve(e,t){let n=e?.id||e?.alias;if(!e||!n)return;let r=X(e.provider,t),i=r?Ae(r,[e.alias||``,n]):void 0;return{label:i?.label||n,...i?{entry:i}:{}}}export{o as A,se as C,ne as D,a as E,n as M,e as N,ee as O,t as P,ae as S,i as T,h as _,Fe as a,ce as b,X as c,Pe as d,H as f,ye as g,W as h,Be as i,r as j,te as k,Ce as l,xe as m,Re as n,Ve as o,U as p,Le as r,De as s,ze as t,Se as u,le as v,s as w,ie as x,l as y};
|
|
2
|
+
//# sourceMappingURL=provider-display-bWwiuedV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{M as r,n as i,t as a}from"./provider-display-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{M as r,n as i,t as a}from"./provider-display-bWwiuedV.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./label-BPBzm9FJ.js";import{t as c}from"./switch-DuCA7mrB.js";import{t as l}from"./circle-alert-CryagaZd.js";import{n as u,t as d}from"./package-plus-C1AKMjsl.js";import{t as f}from"./clock-BWPPBh1_.js";import{t as p}from"./download-KgtpDbt5.js";import{t as m}from"./play-BbT8m7A0.js";import{t as h}from"./plus-D5Ek4e2S.js";import{t as g}from"./refresh-cw-CfpvQcUn.js";import{t as _}from"./button-Do6Z3vvn.js";import{t as v}from"./badge-DqJRtj_p.js";import{t as y}from"./input-CsTB6jIx.js";import{t as b}from"./textarea-hs6Mpyfl.js";import{o as x,r as S,s as C,t as w}from"./card-C4QJ4hCW.js";var T=e(t(),1),E=n(),D=[{value:`none`,label:`None (host must already provide it)`},{value:`npm-global`,label:`npm install -g (pinned version)`},{value:`download`,label:`Download + checksum`},{value:`bundled`,label:`Bundled with relay`}],O=[`stdio`,`ws`,`http`],k=[`shared`,`per-agent`],A=[`none`,`tcp`,`http`];function j(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function M(e){let t={};for(let n of e.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);r<=0||(t[e.slice(0,r).trim()]=e.slice(r+1).trim())}return t}var N=[{value:`all`,label:`All`},{value:`skill`,label:`Skills`},{value:`plugin`,label:`Plugins`},{value:`mcp`,label:`MCP`},{value:`hook`,label:`Hooks`}],P=[`any`,...a()];function F(e){return e===`skill`?`bg-tone-info/10 text-tone-info-fg border-tone-info/30`:e===`plugin`?`bg-tone-violet/10 text-tone-violet-fg border-tone-violet/30`:e===`hook`?`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`}function I(e){return e===`any`?`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`:i(e)}function L(e){return e===`approved`?`bg-tone-success/10 text-tone-success-fg border-tone-success/30`:e===`rejected`?`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`:`bg-tone-yellow/10 text-tone-yellow-fg border-tone-yellow/30`}function R({status:e}){return e===`valid`?(0,E.jsx)(u,{className:`h-3.5 w-3.5 text-tone-success-fg`}):e===`invalid`?(0,E.jsx)(l,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,E.jsx)(f,{className:`h-3.5 w-3.5 text-tone-neutral-fg`})}var z={kind:`skill`,slug:``,title:``},B={githubUrl:``,ref:`main`,subpath:``,provider:`any`,versionConstraint:``},V={command:``,args:``,url:``,approvalStatus:`pending`,versionConstraint:``,setupKind:`none`,setupPkg:``,setupVersion:``,setupUrl:``,setupSha256:``,setupBin:``,runCommand:``,runArgs:``,runEnv:``,runTransport:`stdio`,healthProbeKind:`none`,healthProbePath:``,listenerMode:`shared`,applicabilityProviders:``,applicabilityProfiles:``};function H({variant:e,onToggle:t,onUpdate:n,onValidate:r,busy:i}){let a=i===e.id,o=e.kind===`mcp`?e.definition:void 0;return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${I(e.provider)}`,children:e.provider}),(0,E.jsx)(`span`,{className:`text-xs font-medium font-mono`,children:e.name}),e.approvalStatus&&(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${L(e.approvalStatus)}`,children:e.approvalStatus}),(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-1 ml-auto`,children:[(0,E.jsx)(R,{status:e.validationStatus}),e.validationStatus??`unvalidated`]}),(0,E.jsx)(c,{size:`sm`,checked:e.enabled,disabled:a,onCheckedChange:n=>t(e.id,n)})]}),(e.sourceUrl||e.sourceRef)&&(0,E.jsxs)(`div`,{className:`text-[10px] text-muted-foreground font-mono truncate`,title:e.sourceUrl,children:[e.sourceUrl,e.sourceRef?`@${e.resolvedRef??e.sourceRef}`:``,e.sourceSubpath?` · ${e.sourceSubpath}`:``]}),o&&(o.setup||o.runConfig||o.applicability)&&(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o.setup&&(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-sky/10 text-tone-sky-fg border-tone-sky/30`,children:[`setup: `,o.setup.kind]}),o.runConfig&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-teal/10 text-tone-teal-fg border-tone-teal/30`,children:[`transport: `,o.runConfig.transport]}),(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-teal/10 text-tone-teal-fg border-tone-teal/30`,children:[`listener: `,o.runConfig.listenerMode]})]}),o.applicability?.providers?.length?(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-fuchsia/10 text-tone-fuchsia-fg border-tone-fuchsia/30`,children:[`providers: `,o.applicability.providers.join(`, `)]}):null,o.applicability?.profiles?.length?(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-fuchsia/10 text-tone-fuchsia-fg border-tone-fuchsia/30`,children:[`profiles: `,o.applicability.profiles.join(`, `)]}):null]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:a||!e.sourceRef,onClick:()=>n(e.id),title:`Pull latest from source ref`,children:[(0,E.jsx)(p,{className:`h-3 w-3 mr-1`}),`Update ref`]}),(0,E.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:a,onClick:()=>r(e.id),children:[(0,E.jsx)(m,{className:`h-3 w-3 mr-1`}),`Validate`]})]})]})}function U({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`New Capability`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Kind`}),(0,E.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.kind,onChange:e=>t({kind:e.target.value}),children:[(0,E.jsx)(`option`,{value:`skill`,children:`Skill`}),(0,E.jsx)(`option`,{value:`plugin`,children:`Plugin`}),(0,E.jsx)(`option`,{value:`mcp`,children:`MCP Server`}),(0,E.jsx)(`option`,{value:`hook`,children:`Hook`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Slug`}),(0,E.jsx)(y,{value:e.slug,onChange:e=>t({slug:e.target.value}),placeholder:`my-capability`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Title (optional)`}),(0,E.jsx)(y,{value:e.title,onChange:e=>t({title:e.target.value}),placeholder:`My Capability`,className:`mt-1 text-sm`})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.slug.trim(),children:i?`Creating…`:`Create`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function W({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`Import from GitHub`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`GitHub URL`}),(0,E.jsx)(y,{value:e.githubUrl,onChange:e=>t({githubUrl:e.target.value}),placeholder:`https://github.com/owner/repo`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Ref`}),(0,E.jsx)(y,{value:e.ref,onChange:e=>t({ref:e.target.value}),placeholder:`main`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Subpath (optional)`}),(0,E.jsx)(y,{value:e.subpath,onChange:e=>t({subpath:e.target.value}),placeholder:`skills/my-skill`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Provider`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.provider,onChange:e=>t({provider:e.target.value}),children:P.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version constraint (optional)`}),(0,E.jsx)(y,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.githubUrl.trim()||!e.ref.trim(),children:i?`Importing…`:`Import`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function G({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`Add MCP Server Variant`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Command (for stdio type)`}),(0,E.jsx)(y,{value:e.command,onChange:e=>t({command:e.target.value}),placeholder:`npx -y @modelcontextprotocol/server-foo`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Args (space-separated, overrides command split)`}),(0,E.jsx)(y,{value:e.args,onChange:e=>t({args:e.target.value}),placeholder:`--port 3000`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`URL (for http/sse type)`}),(0,E.jsx)(y,{value:e.url,onChange:e=>t({url:e.target.value}),placeholder:`http://localhost:3000/mcp`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Approval status`}),(0,E.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.approvalStatus,onChange:e=>t({approvalStatus:e.target.value}),children:[(0,E.jsx)(`option`,{value:`pending`,children:`Pending`}),(0,E.jsx)(`option`,{value:`approved`,children:`Approved`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version constraint (optional)`}),(0,E.jsx)(y,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`border-t border-border pt-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Setup recipe — how a host without this server obtains it`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Recipe kind`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.setupKind,onChange:e=>t({setupKind:e.target.value}),children:D.map(e=>(0,E.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),e.setupKind===`npm-global`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Package`}),(0,E.jsx)(y,{value:e.setupPkg,onChange:e=>t({setupPkg:e.target.value}),placeholder:`@scope/mcp-server`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version (exact, pinned)`}),(0,E.jsx)(y,{value:e.setupVersion,onChange:e=>t({setupVersion:e.target.value}),placeholder:`1.2.3`,className:`mt-1 text-sm font-mono`})]})]}),e.setupKind===`download`&&(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Download URL (https)`}),(0,E.jsx)(y,{value:e.setupUrl,onChange:e=>t({setupUrl:e.target.value}),placeholder:`https://example.com/server.tar.gz`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`sha256 checksum`}),(0,E.jsx)(y,{value:e.setupSha256,onChange:e=>t({setupSha256:e.target.value}),placeholder:`64 hex chars`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Binary name`}),(0,E.jsx)(y,{value:e.setupBin,onChange:e=>t({setupBin:e.target.value}),placeholder:`server-bin`,className:`mt-1 text-sm font-mono`})]})]})]}),(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground pt-1`,children:`Run config — how the orchestrator launches + supervises it`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Launch command`}),(0,E.jsx)(y,{value:e.runCommand,onChange:e=>t({runCommand:e.target.value}),placeholder:`server-bin`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Launch args (space-separated)`}),(0,E.jsx)(y,{value:e.runArgs,onChange:e=>t({runArgs:e.target.value}),placeholder:`--stdio`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Env (one KEY=VALUE per line; use secret:/env:/file: refs for secrets, never literal values)`}),(0,E.jsx)(b,{value:e.runEnv,onChange:e=>t({runEnv:e.target.value}),placeholder:`API_TOKEN=secret:my-server-token
|
|
3
3
|
MODE=server`,className:`mt-1 text-sm font-mono`,rows:2})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Transport`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.runTransport,onChange:e=>t({runTransport:e.target.value}),children:O.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Listener mode`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.listenerMode,onChange:e=>t({listenerMode:e.target.value}),children:k.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Health probe`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.healthProbeKind,onChange:e=>t({healthProbeKind:e.target.value}),children:A.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]})]}),e.healthProbeKind===`http`&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Health probe path`}),(0,E.jsx)(y,{value:e.healthProbePath,onChange:e=>t({healthProbePath:e.target.value}),placeholder:`/health`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground pt-1`,children:`Applicability — which profiles/providers may use this server (empty = unrestricted)`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Providers (comma-separated)`}),(0,E.jsx)(y,{value:e.applicabilityProviders,onChange:e=>t({applicabilityProviders:e.target.value}),placeholder:`claude, codex`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Profiles (comma-separated)`}),(0,E.jsx)(y,{value:e.applicabilityProfiles,onChange:e=>t({applicabilityProfiles:e.target.value}),placeholder:`worker, coordinator`,className:`mt-1 text-sm font-mono`})]})]})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.command.trim()&&!e.url.trim(),children:i?`Adding…`:`Add MCP Variant`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function K(){let[e,t]=(0,T.useState)([]),[n,i]=(0,T.useState)(`all`),[a,s]=(0,T.useState)(``),[c,l]=(0,T.useState)(!0),[u,f]=(0,T.useState)(null),[p,m]=(0,T.useState)(`none`),[y,b]=(0,T.useState)(!1),[D,O]=(0,T.useState)(null),[k,A]=(0,T.useState)(null),[P,I]=(0,T.useState)(z),[L,R]=(0,T.useState)(B),[K,q]=(0,T.useState)(V);async function J(){f(null);try{let e=await o(`GET`,`/provisioning/capabilities${n===`all`?``:`?kind=${n}`}`);t(e.capabilities),!a&&e.capabilities.length>0&&s(e.capabilities[0].capability.id)}catch(e){f(r(e))}finally{l(!1)}}(0,T.useEffect)(()=>{l(!0),J()},[n]);let Y=e.find(e=>e.capability.id===a)??null;function X(e){m(e),O(null),b(!1),I(z),R(B),q(V)}async function Z(){b(!0),O(null);try{await o(`POST`,`/provisioning/capabilities`,{kind:P.kind,slug:P.slug.trim(),title:P.title.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}async function Q(){if(Y){b(!0),O(null);try{await o(`POST`,`/provisioning/capabilities/${encodeURIComponent(Y.capability.id)}/variants/import`,{githubUrl:L.githubUrl.trim(),ref:L.ref.trim(),subpath:L.subpath.trim()||void 0,provider:L.provider,versionConstraint:L.versionConstraint.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}}async function ee(){if(Y){b(!0),O(null);try{let e={};if(K.url.trim())e.type=`http`,e.url=K.url.trim();else{e.type=`stdio`;let t=K.command.trim().split(/\s+/);e.command=t[0];let n=K.args.trim()?K.args.trim().split(/\s+/):t.slice(1);n.length>0&&(e.args=n)}let t;K.setupKind===`npm-global`?t={kind:`npm-global`,pkg:K.setupPkg.trim(),version:K.setupVersion.trim()}:K.setupKind===`download`?t={kind:`download`,url:K.setupUrl.trim(),sha256:K.setupSha256.trim(),bin:K.setupBin.trim()}:K.setupKind===`bundled`&&(t={kind:`bundled`});let n;if(K.runCommand.trim()){let e=M(K.runEnv);n={command:K.runCommand.trim(),...K.runArgs.trim()?{args:K.runArgs.trim().split(/\s+/)}:{},...Object.keys(e).length?{env:e}:{},transport:K.runTransport,...K.healthProbeKind===`none`?{}:{healthProbe:{kind:K.healthProbeKind,...K.healthProbePath.trim()?{path:K.healthProbePath.trim()}:{}}},listenerMode:K.listenerMode}}let r=j(K.applicabilityProviders),i=j(K.applicabilityProfiles),a=r.length||i.length?{...r.length?{providers:r}:{},...i.length?{profiles:i}:{}}:void 0;await o(`POST`,`/provisioning/capabilities/${encodeURIComponent(Y.capability.id)}/variants/mcp`,{server:e,...t?{setup:t}:{},...n?{runConfig:n}:{},...a?{applicability:a}:{},approvalStatus:K.approvalStatus,versionConstraint:K.versionConstraint.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}}async function te(e,n){A(e);try{await o(`PATCH`,`/provisioning/variants/${encodeURIComponent(e)}`,{enabled:n}),t(t=>t.map(t=>({...t,variants:t.variants.map(t=>t.id===e?{...t,enabled:n}:t)})))}catch(e){f(r(e))}finally{A(null)}}async function ne(e){let t=Y?.variants.find(t=>t.id===e);if(t?.sourceRef){A(e);try{await o(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/update`,{ref:t.sourceRef,subpath:t.sourceSubpath}),await J()}catch(e){f(r(e))}finally{A(null)}}}async function re(e){A(e);try{await o(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/validate`,{}),await J()}catch(e){f(r(e))}finally{A(null)}}let $=Y?.capability;return(0,E.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(d,{className:`size-5 text-primary`}),(0,E.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Registry`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`provisioning capability registry`}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[N.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>i(e.value),className:`rounded-md border px-2.5 py-1 text-xs transition-colors ${n===e.value?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent`}`,children:e.label},e.value)),(0,E.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void J(),children:(0,E.jsx)(g,{className:`size-4`})})]})]}),u&&(0,E.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:u}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[300px_1fr]`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:[e.length,` capabilities`]}),(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(`new-capability`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`New`]})]}),p===`new-capability`&&(0,E.jsx)(U,{form:P,onChange:e=>I(t=>({...t,...e})),onSubmit:()=>void Z(),onCancel:()=>m(`none`),busy:y,error:D}),c&&e.length===0&&(0,E.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading…`}),!c&&e.length===0&&(0,E.jsx)(w,{children:(0,E.jsx)(S,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No capabilities yet. Click New to create one.`})}),e.map(({capability:e,variants:t})=>(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{s(e.id),m(`none`)},className:`w-full rounded-md border p-3 text-left transition-colors ${a===e.id?`border-primary/50 bg-primary/5`:`border-border bg-card/60 hover:bg-accent`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${F(e.kind)}`,children:e.kind}),(0,E.jsx)(`span`,{className:`text-xs font-medium font-mono truncate flex-1`,children:e.slug}),(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[t.length,`v`]})]}),e.title&&(0,E.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground truncate`,children:e.title}),(0,E.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.status===`active`?`bg-tone-success`:`bg-tone-neutral`}`}),(0,E.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]})]},e.id))]}),$?(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(w,{children:[(0,E.jsx)(x,{children:(0,E.jsxs)(C,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:F($.kind),children:$.kind}),(0,E.jsx)(`span`,{className:`font-mono text-base`,children:$.slug}),$.title&&(0,E.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`· `,$.title]}),(0,E.jsx)(v,{variant:$.status===`active`?`secondary`:`outline`,className:`ml-auto text-[10px]`,children:$.status})]})}),$.description&&(0,E.jsx)(S,{className:`pt-0 text-sm text-muted-foreground`,children:$.description})]}),(0,E.jsxs)(w,{children:[(0,E.jsx)(x,{children:(0,E.jsxs)(C,{className:`flex items-center gap-2 text-base`,children:[`Variants`,(0,E.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,Y?.variants.length??0,`)`]}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(p===`import-github`?`none`:`import-github`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`GitHub`]}),$.kind===`mcp`&&(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(p===`import-mcp`?`none`:`import-mcp`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`MCP Server`]})]})]})}),(0,E.jsxs)(S,{className:`space-y-3`,children:[p===`import-github`&&(0,E.jsx)(W,{form:L,onChange:e=>R(t=>({...t,...e})),onSubmit:()=>void Q(),onCancel:()=>m(`none`),busy:y,error:D}),p===`import-mcp`&&(0,E.jsx)(G,{form:K,onChange:e=>q(t=>({...t,...e})),onSubmit:()=>void ee(),onCancel:()=>m(`none`),busy:y,error:D}),Y&&Y.variants.length===0&&p===`none`&&(0,E.jsxs)(`div`,{className:`py-6 text-center text-sm text-muted-foreground`,children:[`No variants yet. Add one via GitHub import`,$.kind===`mcp`?` or MCP Server`:``,`.`]}),Y?.variants.map(e=>(0,E.jsx)(H,{variant:e,onToggle:(e,t)=>void te(e,t),onUpdate:e=>void ne(e),onValidate:e=>void re(e),busy:k},e.id))]})]})]}):!c&&(0,E.jsx)(w,{children:(0,E.jsx)(S,{className:`py-16 text-center text-sm text-muted-foreground`,children:`Select a capability to view details and variants.`})})]})]})}export{K as RegistryView};
|
|
4
|
-
//# sourceMappingURL=registry-
|
|
4
|
+
//# sourceMappingURL=registry-D790cIhN.js.map
|
|
@@ -0,0 +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}from"./store-BgDALGIX.js";import{h as a}from"./display-BemJG1f_.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./agent-liveness-DSQY1Aa_.js";import{t as c}from"./check-B3M9Ug1P.js";import{n as l,t as u}from"./octagon-x-B5lnUY-8.js";import{t as d}from"./inbox-Dfwk3Gt8.js";import{t as f}from"./pause-DttnHD4c.js";import{t as p}from"./play-BbT8m7A0.js";import{t as m}from"./rotate-ccw-CtD77qkX.js";import{n as h}from"./workflow-marker-CzOsB8BM.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./input-CsTB6jIx.js";import{t as v}from"./crate-agent-irqlt4NH.js";var y=e(n(),1),b=r();function x({runId:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)();async function a(e,t){try{let r=new URLSearchParams({verbose:`true`,...t}),a=await o(`GET`,`/workflows/runs/${encodeURIComponent(e)}?${r}`);n(e=>t&&e&&e.runId===a.runId?{...a,activations:t.activationCursor?[...e.activations??[],...a.activations??[]]:a.activations,children:t.childCursor?[...e.children??[],...a.children??[]]:a.children,itemResults:t.resultsCursor?[...e.itemResults??[],...a.itemResults??[]]:a.itemResults}:a),i(void 0)}catch(e){i(e.message)}}async function s(e,n){try{await o(`POST`,`/workflows/runs/${encodeURIComponent(t.runId)}/${e}`,{...n?{activationId:n}:{}}),await a(t.runId)}catch(e){i(e.message)}}return(0,b.jsxs)(`details`,{className:`text-xs`,onToggle:n=>{n.currentTarget.open&&!t&&a(e)},children:[(0,b.jsx)(`summary`,{className:`cursor-pointer`,children:`Workflow inputs, children and results`}),r&&(0,b.jsx)(`p`,{role:`alert`,children:r}),t&&(0,b.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,b.jsxs)(`p`,{children:[t.runId,`: `,t.status]}),(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId),children:`Refresh run`}),[`running`,`escalated`].includes(t.status)&&(0,b.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`cancel`),children:`Cancel run`}),t.cleanup&&(0,b.jsxs)(`p`,{children:[`Cleanup: `,t.cleanup.status,t.cleanup.error?` — ${t.cleanup.error}`:``]}),t.parentRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.parentRunId),children:[`Parent `,t.parentRunId]}),t.rootRunId&&t.rootRunId!==t.runId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(t.rootRunId),children:[`Root `,t.rootRunId]}),(0,b.jsx)(`ul`,{"aria-label":`Child workflows`,children:t.children?.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(e.runId),children:[e.workflow,`: `,e.runId]}),` — `,e.status,e.reason&&(0,b.jsx)(`p`,{children:e.reason})]},e.runId))}),t.childrenCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{childCursor:t.childrenCursor}),children:`More children`}),(0,b.jsx)(`ul`,{"aria-label":`Workflow activations`,children:t.activations?.map(e=>(0,b.jsxs)(`li`,{children:[e.path,`: `,e.state,e.needs?.length?(0,b.jsxs)(`span`,{children:[` · needs `,e.needs.join(`, `),` (`,e.remaining??0,` remaining)`]}):null,e.outcome?` (${e.outcome})`:``,e.container&&(0,b.jsxs)(`p`,{children:[e.container.settled,`/`,e.container.total,` settled · `,e.container.live,` active · `,e.container.failed,` failed`,e.container.winner?` · winner ${e.container.winner}`:``,e.container.stopped?` · admissions stopped`:``,` `,(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:e.id}),children:`Item results`})]}),e.childRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(e.childRunId),children:[`Child `,e.childRunId]}),e.parentId&&e.state===`failed`&&t.status===`escalated`&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`resume`,e.id),children:[`Retry item `,e.key??e.index]}),e.error&&(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.error,null,2)})]},e.id))}),t.activationsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{activationCursor:t.activationsCursor}),children:`More activations`}),t.itemResults&&(0,b.jsx)(`ol`,{"aria-label":`Item results`,children:t.itemResults.map(e=>(0,b.jsxs)(`li`,{children:[e.key,`: `,e.status,(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.outputs??e.error??{},null,2)})]},e.key))}),t.itemResultsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:t.resultsRef,resultsCursor:t.itemResultsCursor}),children:`More item results`}),(0,b.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap`,children:JSON.stringify({inputs:t.inputs,outputs:t.outputs??t.output},null,2)})]})]})}var S=[`provider`,`model`,`effort`,`orchestratorId`,`profile`],C={provider:`Provider`,model:`Model`,effort:`Effort`,orchestratorId:`Host`,profile:`Profile`};function w({runId:e,step:t}){let n=i(e=>e.updateWorkflowPins),[r,a]=(0,y.useState)(()=>Object.fromEntries(S.map(e=>[e,t.pin?.[e]??``]))),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null);return(0,b.jsxs)(`details`,{className:`rounded border border-border p-2`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer text-xs`,children:[`Change `,t.name,` pins`]}),(0,b.jsxs)(`form`,{className:`mt-2 flex flex-wrap gap-2`,onSubmit:async i=>{i.preventDefault(),s(!0),l(null);try{await n(e,{[t.name]:Object.fromEntries(S.filter(e=>r[e]?.trim()).map(e=>[e,r[e].trim()]))})}catch(e){l(e.message)}finally{s(!1)}},children:[S.map(e=>(0,b.jsxs)(`label`,{className:`text-xs`,children:[C[e],(0,b.jsx)(_,{"aria-label":`${t.name} ${C[e]}`,value:r[e]??``,onChange:t=>a({...r,[e]:t.target.value})})]},e)),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:o,children:o?`Saving…`:`Save ${t.name} pins`}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`w-full text-xs text-destructive`,children:c})]})]})}function T({run:e}){let t=e.status===`running`?e.steps.filter(e=>e.started===!1&&e.role):[];return!t.length&&!e.pinChanges?.length?null:(0,b.jsxs)(`div`,{className:`space-y-2`,children:[t.map(t=>(0,b.jsx)(w,{runId:e.runId,step:t},t.name)),!!e.pinChanges?.length&&(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-xs`,children:`Pin history`}),(0,b.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:e.pinChanges.map((e,t)=>(0,b.jsxs)(`li`,{children:[e.by,` · `,new Date(e.at).toLocaleString(),` · `,Object.entries(e.pins).map(([e,t])=>`${e}: ${S.filter(e=>t[e]).map(e=>`${C[e]} ${t[e]}`).join(`, `)||`workflow defaults`}`).join(`; `),e.note?` · ${e.note}`:``]},t))})]})]})}var E=e=>e.kind===`agent`?`/agents/${encodeURIComponent(e.agentId)}/spawn-budget`:`/workflows/runs/${encodeURIComponent(e.runId)}/budget`;function D(e,t){return e.kind===`agent`?t.budgets.find(t=>t.subtreeAgentId===e.agentId):t}function O(e){return[e.unknownReports?`${e.unknownReports} report${e.unknownReports===1?``:`s`} without counts`:``,e.unreportedReports?`${e.unreportedReports} not yet stored`:``,e.busyAgents?`${e.busyAgents} agent${e.busyAgents===1?``:`s`} mid-turn`:``].filter(Boolean).join(`, `)}function k({target:e}){return(0,b.jsx)(A,{target:e},E(e))}function A({target:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)(),[a,s]=(0,y.useState)(``),c=E(e);if((0,y.useEffect)(()=>{let t=!0,r=()=>o(`GET`,c).then(r=>{t&&n(D(e,r))},()=>{t&&n(void 0)});r().catch(()=>{});let i=setInterval(r,3e4);return()=>{t=!1,clearInterval(i)}},[c]),!t)return null;let l=async a=>{a.preventDefault();let l=Number(r);if(!Number.isSafeInteger(l)||l<=0){s(`Enter a whole number of tokens above 0`);return}try{let r=await o(`PATCH`,c,{tokenCap:l});n(D(e,r)??t),i(void 0),s(``)}catch(e){s(e instanceof Error?e.message:`Could not save the budget`)}},u=O(t),d=Math.min(100,Math.round(t.tokens/t.tokenCap*100));return(0,b.jsxs)(`section`,{"aria-label":`Token budget`,"data-testid":`delegated-budget`,"data-exhausted":t.exhausted,className:`space-y-2 rounded-md border p-3 text-xs`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h3`,{className:`font-medium`,children:`Token budget`}),t.exhausted&&(0,b.jsx)(`span`,{"data-testid":`budget-exhausted`,className:`rounded border border-tone-danger/30 bg-tone-danger/10 px-1.5 py-0.5 font-medium text-tone-danger-fg`,children:`Exhausted: new spawns refused`}),t.partlyUnknown&&(0,b.jsx)(`span`,{"data-testid":`budget-unknown`,title:u,className:`rounded border border-tone-warning/30 bg-tone-warning/10 px-1.5 py-0.5 text-tone-warning-fg`,children:`Partly unknown`})]}),(0,b.jsxs)(`p`,{"data-testid":`budget-spend`,className:`tabular-nums`,children:[t.partlyUnknown?`At least `:``,t.tokens.toLocaleString(),` of `,t.tokenCap.toLocaleString(),` tokens observed`]}),(0,b.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t.tokenCap,"aria-valuenow":Math.min(t.tokens,t.tokenCap),className:`h-1.5 overflow-hidden rounded bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full ${t.exhausted?`bg-tone-danger`:`bg-tone-info`}`,style:{width:`${d}%`}})}),u&&(0,b.jsxs)(`p`,{className:`text-muted-foreground`,children:[`True spend is higher than shown: `,u,`.`]}),r===void 0?(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>i(String(t.tokenCap)),children:`Edit cap`}):(0,b.jsxs)(`form`,{onSubmit:l,className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`label`,{className:`sr-only`,htmlFor:`budget-cap-${c}`,children:`Token cap`}),(0,b.jsx)(_,{id:`budget-cap-${c}`,inputMode:`numeric`,className:`h-8 w-36`,value:r,onChange:e=>i(e.target.value)}),(0,b.jsx)(g,{type:`submit`,size:`sm`,children:`Save`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{i(void 0),s(``)},children:`Cancel`})]}),a&&(0,b.jsx)(`p`,{role:`alert`,className:`text-tone-danger-fg`,children:a}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:`Soft cap: running work finishes; raising it lets new spawns through.`})]})}function j({text:e,className:n}){return(0,b.jsx)(`span`,{className:t(`block min-w-0 max-w-full truncate`,n),title:e,children:e})}var M=`land`,N=`ci-main`,P={pass:`CI pass`,fail:`CI red`,none:`no CI`};function F(e){let t=e.rounds.find(t=>t.round===e.round)?.steps??[],n=new Map(t.map(e=>[e.step,e.outcome])),r=e.stations?e.stations.map(t=>e.steps.find(e=>e.name===t)??{name:t}):[...e.steps,{name:M},...e.ciMain?[{name:N}]:[]],i=!!e.landedSha||e.status===`done`||e.step===`ci-main`;return r.map(t=>{let r=t.name===`ci-main`&&e.output?.ci?P[e.output.ci.status]:void 0,a=t.name===`land`&&i?`landed`:r??n.get(t.name),o={...t,state:`waiting`,...a?{outcome:a}:{}};return e.status===`running`?o.state=t.name===e.step?`current`:a?`done`:`waiting`:e.status===`done`?o.state=`done`:o.state=t.name===e.step?`stopped`:a?`done`:`waiting`,o})}function I(e){if(e.status!==`running`||!e.awaiting)return;if(e.awaiting.slot)return`Waiting for a slot on ${e.awaiting.slot.host}`;let{kind:t,taskId:n,timedOutAt:r}=e.awaiting,i=t===`landed`?`Waiting for the land`:t===`ci`?`Waiting for CI on main${e.awaiting.sha?` at ${e.awaiting.sha.slice(0,7)}`:``}`:t===`decision`?`Waiting for the operator decision`:t===`script`?`Waiting for the script`:t===`closed`?`Closing the Task and delivering issues`:`Waiting for a delivery${n?` on T${n}`:``}`;return r?`${i}, past its time limit`:i}function L(e){return e.reapedAt?`reaped`:e.exitedAt?`exited`:e.keptAt?`kept`:e.readyAt?`ready`:`starting`}function R(e){let t=e.crossProvider?.fallback?e.crossProvider:void 0;return e.provider?t?{label:`${e.provider}, same as ${t.step}`,title:`Prefers a provider other than ${t.step}'s ${t.avoided}${t.reason?`: ${t.reason}`:``}`}:{label:e.provider}:{}}var z=[`provider`,`model`,`effort`,`orchestratorId`],B={start:`start call`,resume:`resume`,team:`team default`,global:`global default`,workflow:`workflow file`};function V(e){let t=z.filter(t=>e?.[t]);if(!(!e||!t.length))return{label:`Pinned: ${t.map(t=>t===`orchestratorId`?`on ${e[t]}`:e[t]).join(` `)}`,title:t.map(t=>`${t===`orchestratorId`?`host`:t} ${e[t]} (${B[e.from[t]??`workflow`]})`).join(`, `)}}function H(e){if(e.status===`done`){if(e.step===`close`)return`Verified and closed`;if(e.scriptRuns?.length&&!e.output?.landedSha)return`Done`;let t=e.output?.ci?`, ${P[e.output.ci.status]}`:``;return e.output?.nothingToLand&&e.output.landedSha?`Nothing to land, on main at ${e.output.landedSha.slice(0,7)}`:e.output?.landedSha?`Landed ${e.output.landedSha.slice(0,7)}${t}`:`Done`}return e.status===`escalated`?`Escalated`:e.status===`cancelled`?`Cancelled`:e.status===`failed`?`Failed`:`Running`}var U={done:`done`,current:`current step`,waiting:`not reached`,stopped:`stopped here`};function W({taskId:e,title:t}){let n=i(e=>e.openTaskDetailById);return(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex min-w-0 max-w-full items-baseline gap-1.5 rounded text-left hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[(0,b.jsxs)(`span`,{className:`shrink-0 rounded bg-muted px-1 font-mono text-[11px] tabular-nums text-muted-foreground`,children:[`T`,e]}),t&&(0,b.jsx)(j,{text:t,className:`font-medium`})]})}function G({node:e,run:t}){let n=e.state===`current`?I(t):void 0,r=V(e.pin);return(0,b.jsxs)(`li`,{"data-testid":`workflow-node-${e.name}`,"data-state":e.state,className:`wf-station flex min-w-0 items-start gap-2 sm:flex-col sm:items-center sm:text-center`,children:[(0,b.jsxs)(`span`,{className:`wf-stop grid h-8 w-8 shrink-0 place-items-center rounded-full`,"aria-label":`${e.name}: ${U[e.state]}`,role:`img`,children:[e.state===`done`&&(0,b.jsx)(c,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`stopped`&&(0,b.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`waiting`&&(0,b.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`current`&&(0,b.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-current`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(j,{text:e.name,className:`text-sm font-semibold`}),e.role&&(0,b.jsx)(j,{text:`${e.role}${e.gate?`, gate ${e.gate}`:``}`,className:`text-xs text-muted-foreground`}),r&&(0,b.jsx)(`div`,{"data-testid":`workflow-node-pin`,className:`truncate text-xs text-muted-foreground`,title:r.title,children:r.label}),e.outcome&&(0,b.jsx)(`div`,{className:`wf-outcome truncate text-xs font-medium`,"data-outcome":e.outcome,children:e.outcome}),n&&(0,b.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n})]})]})}function K({run:e}){return(0,b.jsx)(`ol`,{"aria-label":`Steps`,className:`wf-line grid gap-3 sm:auto-cols-fr sm:grid-flow-col`,children:F(e).map(t=>(0,b.jsx)(G,{node:t,run:e},t.name))})}function q({run:e,agentsById:t,now:n}){return e.agents.length?(0,b.jsx)(`ul`,{"aria-label":`Step agents`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:e.agents.map(r=>{let i=r.agentId?t[r.agentId]:void 0,a=R(r);return(0,b.jsxs)(`li`,{"data-testid":`workflow-agent`,className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,b.jsx)(h,{workflow:e.workflow,step:r.step}),r.agentId?(0,b.jsx)(v,{holder:{id:r.agentId,...i?{agent:i}:{},live:s(n,i)},workflowMarker:!1}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`spawning`}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:r.keptReason,children:[r.step,`, round `,r.round,`, `,L(r)]}),r.routingSources&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:Object.entries(r.routingSources).map(([e,t])=>`${e}: ${t}`).join(`, `),children:[`via `,r.routingSources.provider]}),a.label&&(0,b.jsx)(`span`,{"data-testid":`workflow-agent-provider`,className:`shrink-0 text-muted-foreground`,title:a.title,children:a.label})]},r.spawnRequestId)})}):(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No step agent yet.`})}function J({run:e}){let t=i(e=>e.pauseWorkflowRun),[n,r]=(0,y.useState)(null);return e.status===`running`?e.paused?(0,b.jsxs)(`div`,{"data-testid":`workflow-paused`,className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Paused by `,e.paused.by,` since `,new Date(e.paused.at).toLocaleString(),`: `,e.paused.reason]}),(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void t(e.runId,null),children:[(0,b.jsx)(p,{"aria-hidden":!0}),`Resume`]})]}):n===null?(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>r(``),children:[(0,b.jsx)(f,{"aria-hidden":!0}),`Pause`]}):(0,b.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:i=>{i.preventDefault(),n.trim()&&t(e.runId,n.trim()).then(()=>r(null))},children:[(0,b.jsx)(_,{autoFocus:!0,"aria-label":`Pause reason`,placeholder:`Why does this run wait, and for what?`,value:n,onChange:e=>r(e.target.value),className:`min-w-48 flex-1`}),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:!n.trim(),children:`Pause run`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Cancel`})]}):null}function Y({run:e,agentsById:t,now:n,project:r}){return(0,b.jsxs)(`article`,{"data-testid":`workflow-run-${e.runId}`,"aria-label":`${e.workflow} on T${e.taskId}`,className:`wf-run space-y-3 rounded-lg p-3`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,b.jsxs)(`h3`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-sm font-semibold`,children:[(0,b.jsx)(h,{workflow:e.workflow,className:`h-3.5 w-3.5 shrink-0`}),(0,b.jsx)(j,{text:e.workflow})]}),(0,b.jsx)(`div`,{className:`min-w-0 flex-1 text-sm`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-muted-foreground`,children:[(0,b.jsxs)(`span`,{"data-testid":`workflow-round`,className:`flex items-center gap-1`,title:`A loop back to an earlier step starts a new round`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Round `,e.round]}),(0,b.jsxs)(`span`,{"data-testid":`workflow-held`,className:`flex items-center gap-1`,title:`Messages the run kept instead of waking the coordinator`,children:[(0,b.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.heldCount,` held`]}),(0,b.jsxs)(`span`,{title:`Started ${new Date(e.createdAt).toLocaleString()}`,children:[`Started `,a(n,e.createdAt),` ago`]}),r&&(0,b.jsx)(j,{text:r})]})]}),e.callerAgentId&&(0,b.jsxs)(`p`,{"data-testid":`workflow-caller`,className:`text-xs text-muted-foreground`,children:[`Caller: `,e.callerAgentId,` · up to `,e.maxLiveAgents??2,` live agents`]}),e.budget&&(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}}),(0,b.jsx)(J,{run:e}),(0,b.jsx)(K,{run:e}),(0,b.jsx)(T,{run:e}),e.rootRunId&&(0,b.jsx)(x,{runId:e.runId}),e.overdueAt!==void 0&&(0,b.jsx)(`p`,{"data-testid":`workflow-backstop`,className:`text-xs text-muted-foreground`,title:`Backstop ${new Date(e.overdueAt).toLocaleString()}`,children:e.overdueNotifiedAt===void 0?`Backstop ${new Date(e.overdueAt).toLocaleString()}`:`Overdue: coordinator notified`}),(0,b.jsx)(q,{run:e,agentsById:t,now:n})]})}function X({runs:e,now:t,projectTitles:n}){return e.length?(0,b.jsx)(`ul`,{"aria-label":`Finished runs`,className:`divide-y divide-border rounded-lg border border-border bg-card`,children:e.map(e=>(0,b.jsxs)(`li`,{"data-testid":`workflow-recent-${e.runId}`,"data-status":e.status,className:`wf-ledger flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`ship-lamp h-2 w-2 shrink-0 rounded-full`,"data-status":e.status===`done`?`success`:e.status===`escalated`?`failing`:`unknown`,"aria-hidden":!0}),(0,b.jsx)(j,{text:e.workflow,className:`font-medium sm:w-28 sm:shrink-0`}),(0,b.jsx)(`div`,{className:`order-last w-full min-w-0 pl-5 sm:order-none sm:w-auto sm:flex-1 sm:pl-0`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsx)(`span`,{className:`ml-auto shrink-0 font-medium sm:ml-0`,title:e.output?.landedSha,children:H(e)}),(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.round===1?`1 round`:`${e.round} rounds`}),(0,b.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,title:new Date(e.updatedAt).toLocaleString(),children:[a(t,e.updatedAt),` ago`]}),e.projectId&&n.get(e.projectId)&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.get(e.projectId)}),e.budget&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}})}),e.rootRunId&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(x,{runId:e.runId})}),e.reason&&(0,b.jsx)(j,{text:e.reason,className:`order-last w-full pl-5 text-xs text-muted-foreground`})]},e.runId))}):(0,b.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-sm text-muted-foreground`,children:`No finished runs yet.`})}export{j as a,N as i,Y as n,W as r,X as t};
|
|
2
|
+
//# sourceMappingURL=run-card-BCro-Odj.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{$ as r,B as i,Ct as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,P as h,Q as g,R as _,U as v,V as y,W as b,X as x,Y as S,Z as C,at as w,et as T,it as E,j as D,nt as O,rt as k,t as A,tt as j,z as M}from"./store-DcClXLH0.js";import{M as N}from"./provider-display-DsuWMvVL.js";import{et as P,f as F,v as I}from"./display-BrKWFGJz.js";import{s as L,t as R}from"./api-CIIVBtAV.js";import{t as z}from"./archive-CIuPSvmx.js";import{t as B}from"./external-link-BRfu-fHG.js";import{n as V,t as ee}from"./shield-alert-B9jCWcKW.js";import{t as te}from"./key-round-CcSxl5qr.js";import{t as H}from"./loader-circle-BfPd4kOD.js";import{t as U}from"./lock-BW8MPKw_.js";import{t as ne}from"./pencil-B1Hf2V_J.js";import{t as W}from"./plus-D5Ek4e2S.js";import{t as re}from"./refresh-cw-CfpvQcUn.js";import{t as ie}from"./rotate-cw-FPtkDewA.js";import{t as ae}from"./trash-2-FbcSq927.js";import{t as oe}from"./triangle-alert-BBNhfgMi.js";import{t as G}from"./button-Do6Z3vvn.js";import{t as K}from"./badge-DqJRtj_p.js";import{t as q}from"./input-CsTB6jIx.js";import{t as se}from"./textarea-hs6Mpyfl.js";import{t as ce}from"./VaultDecisionCard-Bau_vNax.js";var J=e(t(),1),Y=n();function le({url:e}){return(0,Y.jsxs)(`a`,{"data-testid":`source-link`,href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex min-h-9 max-w-full items-center gap-1 text-xs text-primary underline-offset-2 hover:underline sm:min-h-0`,children:[(0,Y.jsx)(B,{className:`h-3 w-3 shrink-0`}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-all`,children:[`Open the source page: `,e]})]})}function ue({rotate:e,projectId:t,environment:n=`prod`,sourceUrl:r,disabled:i,onClose:a}){let o=A(e=>e.fetchOpenDecisions),[s,c]=(0,J.useState)(e??``),[l,u]=(0,J.useState)(e?`Rotate ${e}`:``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),v=y.test(s),b=v&&l.trim().length>0&&!i&&!d;async function S(){if(b){f(!0),m(``);try{let e=await _(s,l.trim(),t,n);g({name:e.name,formUrl:e.formUrl}),o()}catch(e){m(N(e))}finally{f(!1)}}}return(0,Y.jsx)(`div`,{"data-testid":`secret-request-panel`,className:`rounded-lg border border-border bg-card/60 p-3 text-sm`,children:h?(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`p`,{children:[`Request filed for `,(0,Y.jsx)(`code`,{className:`break-all`,children:h.name}),`. Open the form and enter the value there. The link works once, until it expires or the request is withdrawn. The form has optional expiry, revision and source URL fields, and shows the fingerprint after you save.`]}),h.formUrl?(0,Y.jsxs)(`a`,{href:x(h.formUrl,L()),target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:h-8 sm:w-auto`,children:[(0,Y.jsx)(B,{className:`h-3.5 w-3.5`}),`Open secure form`]}):(0,Y.jsx)(`p`,{className:`text-xs text-tone-warning-fg`,children:`The form link is only shown to the operator token.`}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:a,children:`Close`})})]}):(0,Y.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,Y.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e?`Rotate ${e}`:`Request a new secret`}),!e&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(q,{"aria-label":`Secret name`,"aria-invalid":s!==``&&!v,placeholder:`NAME or NAME@environment`,autoComplete:`off`,spellCheck:!1,value:s,onChange:e=>c(e.target.value),className:`font-mono`}),s!==``&&!v&&(0,Y.jsx)(`p`,{className:`mt-1 text-[11px] text-tone-danger-fg`,children:`Start with a letter or underscore; then letters, digits, _ . - (up to 256). Optional @environment: 1–32 lowercase letters, digits or hyphens.`})]}),r&&(0,Y.jsx)(le,{url:r}),(0,Y.jsx)(se,{"aria-label":`Reason`,rows:2,placeholder:`Why is it needed?`,value:l,maxLength:4096,onChange:e=>u(e.target.value)}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`You enter the value on the next page. Do not paste it here.`]}),p&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:p}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!b,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[d&&(0,Y.jsx)(H,{className:`animate-spin`}),e?`Request rotation`:`Request secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:a,className:`h-9 sm:h-8`,children:`Cancel`})]})]})})}function de({projects:e,defaultProjectId:t=``,onClose:n}){let r=A(e=>e.fetchVault),[i,a]=(0,J.useState)(`infisical`),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(`prod`),[u,d]=(0,J.useState)(`/`),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`codex`),[g,_]=(0,J.useState)(t),[v,y]=(0,J.useState)(`prod`),[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(null),O=i===`infisical`?{kind:i,project:o,environment:c,path:u}:{kind:i,host:f,provider:m},k=b&&JSON.stringify(b.source)===JSON.stringify(O)?b:null;async function j(){C(!0),T(``),x(null);try{let{names:e}=await R(`POST`,`/secrets/import/preview`,{source:O});x({source:O,names:e,picked:[]})}catch(e){T(N(e))}finally{C(!1)}}async function M(){if(!k?.picked.length)return;C(!0),T(``);let e={source:k.source,names:k.picked,environment:v,scope:g?`project`:`global`,...g?{project:g}:{}};try{D(await R(`POST`,`/secrets/import`,e)),r()}catch(e){T(N(e))}finally{C(!1)}}return(0,Y.jsx)(`section`,{"data-testid":`secret-import-panel`,"aria-label":`Import secrets`,className:`space-y-3 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:E?(0,Y.jsxs)(Y.Fragment,{children:[E.secrets.map(e=>(0,Y.jsxs)(`p`,{children:[`Imported `,e.name,` v`,e.version]},e.name)),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Import secrets`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose existing names. Relay moves the values directly into encrypted storage. Import selected approves the whole batch.`}),(0,Y.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Import source`,value:i,onChange:e=>a(e.target.value),className:`h-9 w-full rounded-md border border-input bg-background px-3`,children:[(0,Y.jsx)(`option`,{value:`infisical`,children:`Infisical path`}),(0,Y.jsx)(`option`,{value:`provider-config`,children:`Provider config`})]}),i===`infisical`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{"aria-label":`Infisical project`,placeholder:`Infisical project ID, slug or name`,value:o,onChange:e=>s(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source environment`,placeholder:`Source environment`,value:c,onChange:e=>l(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source path`,placeholder:`/path`,value:u,onChange:e=>d(e.target.value)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{"aria-label":`Source host`,placeholder:`Host ID or hostname`,value:f,onChange:e=>p(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source provider`,placeholder:`Provider`,value:m,onChange:e=>h(e.target.value)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Imported env entries are replaced with secret: references.`})]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,onClick:()=>void j(),children:`Load names`}),k&&(0,Y.jsx)(`div`,{className:`space-y-1`,children:k.names.length===0?(0,Y.jsx)(`p`,{children:`No importable names at this source.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:()=>x({...k,picked:k.names}),children:`Select all`}),k.names.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 break-all`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:k.picked.includes(e),onChange:t=>x({...k,picked:t.target.checked?[...k.picked,e]:k.picked.filter(t=>t!==e)})}),e]},e))]})}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[`Target scope`,(0,Y.jsxs)(`select`,{"aria-label":`Target scope`,value:g,onChange:e=>_(e.target.value),className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,Y.jsx)(`option`,{value:``,children:`Global`}),e.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[`Project: `,e.title||e.slug||e.id]},e.id))]})]}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[`Target environment`,(0,Y.jsx)(q,{"aria-label":`Target environment`,value:v,onChange:e=>y(e.target.value)})]})]}),w&&(0,Y.jsx)(`p`,{role:`alert`,className:`break-words text-xs text-tone-danger-fg`,children:w}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:S||!k?.picked.length||!v,onClick:()=>void M(),children:`Import selected`}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,disabled:S,onClick:n,children:`Cancel`})]})]})})}var fe={"no-recipient":`No backup recipient is set, so no backup is written. Add your age public key in Settings → Secrets → Vault backup.`,stale:`The last successful backup is more than 48 hours old.`};function pe({status:e,disabled:t}){let n=A(e=>e.fetchVault),r=a(),[i,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),l=e.lastSuccess;async function u(){o(!0),c(``);try{await D()}catch(e){c(N(e))}finally{o(!1),n()}}return(0,Y.jsxs)(`section`,{"data-testid":`vault-backup`,"aria-label":`Vault backup`,className:`space-y-1.5 rounded-lg border px-3 py-2.5 text-sm ${e.warning?`border-tone-warning/40 bg-tone-warning/10`:`border-border bg-card`}`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(z,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),` Backup`]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,disabled:t||i||!e.recipientFingerprint,onClick:()=>void u(),children:i?`Backing up…`:`Back up now`})]}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`dt`,{children:`Last backup`}),(0,Y.jsx)(`dd`,{"data-testid":`vault-backup-last`,className:`min-w-0 break-words text-foreground`,children:l?(0,Y.jsxs)(`span`,{title:I(l.at),children:[P(r,l.at),` · `,l.secrets,` secret`,l.secrets===1?``:`s`]}):`Never`}),(0,Y.jsx)(`dt`,{children:`Recipient`}),(0,Y.jsx)(`dd`,{"data-testid":`vault-backup-recipient`,className:`min-w-0 break-all font-mono text-foreground`,children:e.recipientFingerprint??`Not set`}),(0,Y.jsx)(`dt`,{children:`Kept`}),(0,Y.jsxs)(`dd`,{className:`min-w-0 break-all`,children:[e.files,` of `,e.keep,` in `,e.directory]})]}),e.warning&&(0,Y.jsx)(`p`,{role:`status`,className:`text-xs text-tone-warning-fg`,children:fe[e.warning]}),e.lastError&&(!l||e.lastError.at>l.at)&&(0,Y.jsxs)(`p`,{className:`break-words text-xs text-tone-danger-fg`,children:[`Last attempt failed `,P(r,e.lastError.at),`: `,e.lastError.message]}),s&&(0,Y.jsx)(`p`,{role:`alert`,className:`break-words text-xs text-tone-danger-fg`,children:s})]})}function X({draft:e,onChange:t,collapsible:n=!0}){let r=(0,Y.jsxs)(`div`,{"data-testid":`metadata-fields`,className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:`Expires on`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(q,{"aria-label":`Expires on`,type:`date`,value:e.expiresDate,onChange:n=>t({...e,expiresDate:n.target.value,expiresBad:n.target.validity.badInput}),className:`text-foreground`}),(0,Y.jsx)(q,{"aria-label":`Expiry time (optional)`,type:`time`,value:e.expiresTime,onChange:n=>t({...e,expiresTime:n.target.value}),className:`w-32 shrink-0 text-foreground`})]}),(0,Y.jsx)(`p`,{className:`text-[11px]`,children:`In your time zone. Without a time it expires at the end of that day.`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Revision`,(0,Y.jsx)(q,{"aria-label":`Revision`,maxLength:500,autoComplete:`off`,placeholder:`Vendor revision or number`,value:e.revision,onChange:n=>t({...e,revision:n.target.value}),className:`text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Source URL`,(0,Y.jsx)(q,{"aria-label":`Source URL`,type:`url`,inputMode:`url`,maxLength:2048,autoComplete:`off`,spellCheck:!1,placeholder:`https://vendor.example/keys`,value:e.sourceUrl,onChange:n=>t({...e,sourceUrl:n.target.value}),className:`font-mono text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":`Show last four characters`,checked:e.hintEnabled,onChange:n=>t({...e,hintEnabled:n.target.checked}),className:`h-4 w-4`}),`Show the last four characters as a hint`]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Stored as plain text, readable by agents. Never put a credential here.`})]});return n?(0,Y.jsxs)(`details`,{className:`rounded-md border border-border/60 px-2.5 py-1.5`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Optional metadata`}),(0,Y.jsx)(`div`,{className:`mt-2`,children:r})]}):r}var me=e=>e.title||e.slug||e.id;function he({projects:e,defaultProjectId:t=``,onClose:n}){let i=A(e=>e.fetchVault),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(t),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),[m,h]=(0,J.useState)(r),[g,_]=(0,J.useState)(!1),[v,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(null),C=y.test(a),w=O(m),T=C&&d.length>0&&!w&&!g;async function D(){if(T){_(!0),b(``);try{let[t,n=`prod`]=a.split(`@`),r=await p({name:t,environment:n,value:d,projectId:s||void 0,description:l.trim()||void 0,metadata:k(m)}),o=e.find(e=>e.id===s);S({name:a,where:o?me(o):`global`,signature:E(r.fingerprint,r.hint)}),f(``),i()}catch(e){b(N(e))}finally{_(!1)}}}return x?(0,Y.jsxs)(`div`,{"data-testid":`secret-new-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:[(0,Y.jsxs)(`p`,{children:[`Saved `,(0,Y.jsx)(`code`,{className:`break-all`,children:x.name}),` (`,x.where,`). Agents use it as `,(0,Y.jsxs)(`code`,{className:`break-all`,children:[`secret:`,x.name]}),`. The value is not shown again.`]}),x.signature&&(0,Y.jsxs)(`p`,{"data-testid":`saved-signature`,className:`text-xs text-muted-foreground`,children:[`Fingerprint `,(0,Y.jsx)(`code`,{children:x.signature}),`. Compare it with the key where you copied it from.`]}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(`form`,{"data-testid":`secret-new-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),D()},children:[(0,Y.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:`New secret`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(q,{"aria-label":`Secret name`,"aria-invalid":a!==``&&!C,placeholder:`NAME or NAME@environment`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value),className:`font-mono`}),a!==``&&!C&&(0,Y.jsx)(`p`,{className:`mt-1 text-[11px] text-tone-danger-fg`,children:`Start with a letter or underscore; then letters, digits, _ . - (up to 256). Optional @environment: 1–32 lowercase letters, digits or hyphens.`})]}),(0,Y.jsxs)(`select`,{"aria-label":`Scope`,value:s,onChange:e=>c(e.target.value),className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,Y.jsx)(`option`,{value:``,children:`Global (all projects)`}),e.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[`Project: `,me(e)]},e.id))]}),(0,Y.jsx)(q,{"aria-label":`Description`,placeholder:`Description (optional)`,maxLength:500,autoComplete:`off`,value:l,onChange:e=>u(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Value`,type:`password`,placeholder:`Value`,autoComplete:`new-password`,spellCheck:!1,value:d,onChange:e=>f(e.target.value),className:`font-mono`}),(0,Y.jsx)(X,{draft:m,onChange:h}),w&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:w}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`Stored encrypted. It is never shown again, only replaced with Rotate.`]}),v&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:v}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!T,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[g&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:n,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ge({secret:e,scopedRef:t,onClose:n}){let{name:r,projectId:i,environment:a}=e,o=A(e=>e.fetchVault),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(()=>T(e.metadata,e.hintEnabled)),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(!1),x=O(d,e),S=s.length>0&&!x&&!p;async function C(){if(S){m(!0),g(``);try{let n=await M(t,s,l.trim()||void 0,k(d,e));v({version:n.version,signature:E(n.fingerprint,n.hint)}),c(``),o()}catch(e){g(N(e))}finally{m(!1)}}}return y?(0,Y.jsx)(ue,{rotate:r,projectId:i,environment:a,sourceUrl:e.metadata.sourceUrl,onClose:n}):_?(0,Y.jsxs)(`div`,{"data-testid":`secret-rotate-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`break-all`,children:r}),` is now v`,_.version,`. The value is not shown again.`]}),_.signature&&(0,Y.jsxs)(`p`,{"data-testid":`saved-signature`,className:`text-xs text-muted-foreground`,children:[`Fingerprint `,(0,Y.jsx)(`code`,{children:_.signature}),`. Compare it with the key where you copied it from.`]}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(`form`,{"data-testid":`secret-rotate-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,Y.jsxs)(`div`,{className:`text-xs font-medium text-foreground`,children:[`Rotate `,r]}),e.metadata.sourceUrl&&(0,Y.jsx)(le,{url:e.metadata.sourceUrl}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`New value`,(0,Y.jsx)(q,{"aria-label":`New value`,type:`password`,autoComplete:`new-password`,spellCheck:!1,value:s,onChange:e=>c(e.target.value),className:`font-mono text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Reason (optional)`,(0,Y.jsx)(q,{"aria-label":`Reason (optional)`,maxLength:500,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),className:`text-foreground`})]}),(0,Y.jsx)(X,{draft:d,onChange:f}),x&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:x}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`Stored encrypted as the next version. It is never shown again.`]}),h&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:h}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!S,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[p&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save new value`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:n,className:`h-9 sm:h-8`,children:`Cancel`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>b(!0),className:`text-xs text-primary underline-offset-2 hover:underline`,children:`Ask someone else to provide it`})]})}function Z({actor:e,labels:t}){let n=A(t=>t.agentsById[e]),r=A(e=>e.openAgentDetail),i=c(e)??(n?e.replace(/^agent-/,``):null);if(!i)return(0,Y.jsx)(`span`,{className:`break-all`,children:e});let a=n?F(n):t?.[e],o=a?`${a} · ${i}`:`agent · ${i}`;return n?(0,Y.jsx)(`button`,{type:`button`,"data-testid":`vault-actor`,"data-agent":`live`,title:e,onClick:()=>r(n),className:`min-w-0 break-words text-left text-primary underline-offset-2 hover:underline`,children:o}):(0,Y.jsx)(`span`,{"data-testid":`vault-actor`,"data-agent":`gone`,title:e,className:`min-w-0 break-words`,children:o})}function _e({secret:e,onClose:t,onDeleted:n}){let r=A(e=>e.fetchVault),i=a(),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),f=o===e.name&&!c;async function p(){if(f){l(!0),d(``);try{await m(g(e)),n(),r()}catch(e){d(N(e)),l(!1)}}}return(0,Y.jsxs)(`form`,{"data-testid":`secret-delete-panel`,className:`space-y-2 rounded-lg border border-tone-danger/40 bg-tone-danger/10 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs font-medium text-tone-danger-fg`,children:[(0,Y.jsx)(oe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),`Delete `,e.name,` and all `,e.version,` version`,e.version===1?``:`s`]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This cannot be undone. Agents that use `,(0,Y.jsxs)(`code`,{className:`break-all`,children:[`secret:`,e.name,e.environment===`prod`?``:`@${e.environment}`]}),` will fail with “not found”.`]}),e.lastResolved&&(0,Y.jsxs)(`p`,{"data-testid":`delete-in-use`,className:`text-xs text-tone-warning-fg`,children:[`In use: last used `,P(i,e.lastResolved.at),` by `,(0,Y.jsx)(Z,{actor:e.lastResolved.actor}),`.`]}),(0,Y.jsx)(q,{"aria-label":`Type ${e.name} to confirm`,placeholder:`Type ${e.name} to confirm`,autoComplete:`off`,spellCheck:!1,value:o,onChange:e=>s(e.target.value),className:`font-mono`}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:u}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,variant:`destructive`,disabled:!f,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[c&&(0,Y.jsx)(H,{className:`animate-spin`}),`Delete secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:t,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ve({secret:e,onClose:t,onSaved:n}){let r=A(e=>e.fetchVault),[i,a]=(0,J.useState)(()=>T(e.metadata,e.hintEnabled)),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),u=O(i,e),d=u?void 0:k(i,e);async function f(){if(!(!d||o)){s(!0),l(``);try{await h(g(e),d),r(),n()}catch(e){l(N(e)),s(!1)}}}return(0,Y.jsxs)(`form`,{"data-testid":`secret-metadata-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,Y.jsxs)(`div`,{className:`text-xs font-medium text-foreground`,children:[`Edit metadata of `,e.name]}),(0,Y.jsx)(X,{draft:i,onChange:a,collapsible:!1}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:u}),c&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:c}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!d||o,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[o&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save metadata`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:t,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ye({history:e}){return e.error?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-tone-danger-fg break-words`,children:e.error}):e.rows?e.rows.length?(0,Y.jsx)(`ul`,{"data-testid":`audit-list`,className:`mt-2 divide-y divide-border/60 rounded-md border border-border/60 text-xs`,"aria-label":`History of ${e.name}`,children:e.rows.map(t=>(0,Y.jsxs)(`li`,{"data-testid":`audit-row`,className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2.5 py-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-muted-foreground`,children:I(t.createdAt)}),(0,Y.jsx)(K,{variant:t.outcome===`ok`?`secondary`:`destructive`,className:`h-4 px-1 text-[10px]`,children:v(t.action)}),t.version!==void 0&&(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`v`,t.version]}),t.version!==void 0&&(t.action===`set`||t.action===`rotated`)&&e.versions?.[t.version]&&(0,Y.jsx)(`code`,{"data-testid":`audit-signature`,className:`text-[11px] text-muted-foreground`,children:e.versions[t.version]}),(0,Y.jsx)(Z,{actor:t.actor,labels:e.labels}),t.outcome!==`ok`&&(0,Y.jsx)(`span`,{className:`text-tone-danger-fg`,children:t.outcome}),(0,Y.jsx)(be,{row:t,labels:e.labels})]},t.id))}):(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No audit rows yet.`}):(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Loading history…`})}function be({row:e,labels:t}){let{decisionId:n,requestedBy:r}=s(e),i=A(e=>n!==void 0&&e.openDecisions.some(e=>e.id===n));if(r)return(0,Y.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[`requested by `,(0,Y.jsx)(Z,{actor:r,labels:t})]});if(n!==void 0)return i?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.querySelector(`[data-testid="decision-card-${n}"]`)?.scrollIntoView({block:`center`}),className:`text-primary underline-offset-2 hover:underline`,children:[`decision #`,n]}):(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`decision #`,n]});let a=b(e);return a?(0,Y.jsx)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:a}):null}var xe=`humwick-vault-filter`;function Se(){try{let e=JSON.parse(localStorage.getItem(xe)??`null`);return{tab:e?.tab===`project`?`project`:`global`,projectId:typeof e?.projectId==`string`?e.projectId:``}}catch{return{tab:`global`,projectId:``}}}function Ce(e){try{localStorage.setItem(xe,JSON.stringify(e))}catch{}}var Q=e=>e.title||e.slug||e.id;function we(e,t,n){let r=new Map(e.map(e=>[e.id,e]));for(let e of t)e.projectId&&!r.has(e.projectId)&&r.set(e.projectId,{id:e.projectId,title:e.projectName??``,slug:``});return n&&!r.has(n)&&r.set(n,{id:n,title:``,slug:``}),[...r.values()].sort((e,t)=>Q(e).localeCompare(Q(t)))}function Te(){let e=A(e=>e.vault),t=A(e=>e.vaultProjects),n=A(e=>e.vaultBackup),r=A(e=>e.fetchVault),p=A(e=>e.agentsById),m=A(e=>e.openDecisions),h=a(),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[x,w]=(0,J.useState)(Se),T=e.status===`key-problem`,D=e.status===`ready`?e.secrets:[],O=D.some(e=>e.environment&&e.environment!==`prod`),k=we(t,D,x.projectId),j=x.tab===`project`&&!x.projectId&&k[0]?{tab:`project`,projectId:k[0].id}:x,M=D.filter(e=>S(e,j)),P=m.filter(u).filter(e=>S(C(e.title),j)),F=D.filter(e=>e.projectId).length,I=j.tab===`project`?j.projectId:void 0;function L(e){w(e),Ce(e),v(null),b(null)}function R(e){b(t=>t?.name===e&&t.rows?t:{name:e}),f(e).then(t=>b(n=>n?.name===e?{...n,versions:Object.fromEntries(t.map(e=>[e.version,E(e.fingerprint,e.hint)]))}:n)).catch(()=>{}),l(e).then(t=>{b(n=>n?.name===e?{...n,rows:t}:n);let n=[...new Set(t.flatMap(e=>[e.actor,s(e).requestedBy??``]))].filter(e=>c(e)&&!p[e]);n.length&&o(n).then(t=>b(n=>n?.name===e?{...n,labels:t}:n))},t=>b(n=>n?.name===e?{name:e,error:N(t)}:n))}function z(e){y?.name===e?b(null):R(e)}function B(e){v(t=>t&&t.kind===e.kind&&(!(`ref`in t)||`ref`in e&&t.ref===e.ref)?null:e)}function V(){r(),y&&R(y.name)}return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(te,{className:`h-5 w-5 text-muted-foreground`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Secrets`}),e.status===`ready`&&(0,Y.jsx)(K,{variant:`secondary`,children:M.length})]}),(e.status===`ready`||T)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,onClick:V,children:[(0,Y.jsx)(re,{className:`h-3.5 w-3.5`}),` Refresh`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,disabled:T,onClick:()=>B({kind:`request`}),children:[(0,Y.jsx)(W,{className:`h-3.5 w-3.5`}),` Request secret`]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,disabled:T,onClick:()=>B({kind:`import`}),children:`Import`}),(0,Y.jsxs)(G,{size:`sm`,disabled:T,onClick:()=>B({kind:`new`}),children:[(0,Y.jsx)(W,{className:`h-3.5 w-3.5`}),` New secret`]})]})]}),e.status===`ready`&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{role:`tablist`,"aria-label":`Secret scope`,className:`inline-flex rounded-md border border-border p-0.5`,children:[(0,Y.jsx)(Ee,{selected:x.tab===`global`,onClick:()=>L({...x,tab:`global`}),children:`Global`}),(0,Y.jsxs)(Ee,{selected:x.tab===`project`,onClick:()=>L({...x,tab:`project`}),children:[`Project`,F>0?` (${F})`:``]})]}),x.tab===`project`&&(0,Y.jsxs)(`select`,{"aria-label":`Project`,value:j.projectId,onChange:e=>L({tab:`project`,projectId:e.target.value}),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm sm:h-8 sm:max-w-xs`,children:[k.length===0&&(0,Y.jsx)(`option`,{value:``,children:`No projects`}),k.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:Q(e)},e.id))]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Names and versions only. Values are never shown, here or anywhere else in Relay.`}),e.status===`unknown`&&(0,Y.jsx)($,{children:`Loading…`}),e.status===`off`&&(0,Y.jsxs)($,{testId:`vault-off`,title:`The secrets vault is off`,children:[`The vault is on by default. Remove `,(0,Y.jsx)(`code`,{children:`AGENT_RELAY_SECRETS_VAULT=0`}),` from the hub environment and restart Relay to turn it on. This page needs an operator token with the secrets scope.`]}),e.status===`error`&&(0,Y.jsx)($,{testId:`vault-error`,title:`Could not read the vault`,tone:`danger`,children:e.message}),e.status===`key-problem`&&(0,Y.jsxs)($,{testId:`vault-key-problem`,title:i[e.code].title,tone:`danger`,children:[i[e.code].body,` Setting and using secrets is paused until then.`]}),n&&(e.status===`ready`||T)&&(0,Y.jsx)(pe,{status:n,disabled:T}),_?.kind===`request`&&(0,Y.jsx)(ue,{disabled:T,projectId:I,onClose:()=>v(null)}),_?.kind===`import`&&!T&&(0,Y.jsx)(de,{projects:k,defaultProjectId:I,onClose:()=>v(null)}),_?.kind===`new`&&!T&&(0,Y.jsx)(he,{projects:k,defaultProjectId:I,onClose:()=>v(null)}),P.length>0&&(0,Y.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Pending requests`,children:[(0,Y.jsxs)(`h3`,{className:`text-sm font-medium text-tone-warning-fg`,children:[`Waiting for a value (`,d(P,h),`)`]}),P.map(e=>(0,Y.jsx)(ce,{decision:e},`${e.id}:${e.updatedAt}`))]}),e.status===`ready`&&(M.length===0?(0,Y.jsx)($,{testId:`vault-empty`,children:j.tab===`project`?`No secrets in this project yet. Create one, request one, or let an agent ask for it.`:`No global secrets yet. Create one, request one, or let an agent ask for it.`}):(0,Y.jsx)(`ul`,{className:`space-y-2`,"aria-label":`Secrets`,children:M.map(e=>{let t=g(e);return(0,Y.jsx)(De,{secret:e,showEnvironment:O,open:y?.name===t?y:null,panel:_&&`ref`in _&&_.ref===t?_.kind:null,onRotate:()=>B({kind:`rotate`,ref:t}),onEditMetadata:()=>B({kind:`metadata`,ref:t}),onMetadataSaved:()=>{v(null),y?.name===t&&R(t)},onDelete:()=>B({kind:`delete`,ref:t}),onHistory:()=>z(t),onClosePanel:()=>v(null),onDeleted:()=>{v(null),y?.name===t&&b(null)}},t)})}))]})}function Ee({selected:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:`h-8 rounded px-3 text-sm font-medium sm:h-7 ${e?`bg-secondary text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:n})}function $({title:e,tone:t,testId:n,children:r}){return(0,Y.jsxs)(`div`,{"data-testid":n,role:t===`danger`?`alert`:void 0,className:t===`danger`?`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-3 text-sm text-tone-danger-fg`:`rounded-md border border-border px-3 py-6 text-center text-sm text-muted-foreground`,children:[e&&(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(ee,{className:`h-4 w-4 shrink-0`}),e]}),(0,Y.jsx)(`div`,{className:`break-words`,children:r})]})}function De({secret:e,showEnvironment:t,open:n,panel:r,onRotate:i,onEditMetadata:o,onMetadataSaved:s,onDelete:c,onHistory:l,onClosePanel:u,onDeleted:d}){let f=a();return(0,Y.jsxs)(`li`,{"data-testid":`secret-row`,"data-secret":e.name,"data-environment":e.environment??`prod`,"data-scope":e.projectId?`project`:`global`,className:`rounded-lg border border-border bg-card px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`code`,{className:`break-all text-sm font-medium`,children:e.name}),(0,Y.jsx)(K,{variant:`outline`,className:`h-4 px-1 text-[10px]`,children:e.projectId?`project: ${e.projectName??e.projectId}`:`global`}),(0,Y.jsxs)(K,{variant:`secondary`,className:`h-4 px-1 text-[10px]`,children:[`v`,e.version]}),e.metadata?.expiresAt&&Date.parse(e.metadata.expiresAt)<=f&&(0,Y.jsx)(K,{variant:`destructive`,className:`h-4 px-1 text-[10px]`,children:`Expired`}),t&&(0,Y.jsx)(K,{"data-testid":`secret-environment`,variant:`outline`,className:`h-4 px-1 text-[10px]`,children:e.environment??`prod`})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{title:I(e.updatedAt),children:[e.version>1?`Rotated`:`Set`,` `,P(f,e.updatedAt)]}),(0,Y.jsx)(`span`,{children:` · `}),e.lastResolved?(0,Y.jsxs)(`span`,{title:I(e.lastResolved.at),children:[`Last used `,P(f,e.lastResolved.at),` by `,(0,Y.jsx)(Z,{actor:e.lastResolved.actor})]}):(0,Y.jsx)(`span`,{children:`Not used yet`})]}),(0,Y.jsx)(Oe,{secret:e,now:f})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,"aria-expanded":r===`rotate`,onClick:i,className:`h-8`,children:[(0,Y.jsx)(ie,{className:`h-3.5 w-3.5`}),`Rotate`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":r===`metadata`,onClick:o,className:`h-8`,children:[(0,Y.jsx)(ne,{className:`h-3.5 w-3.5`}),`Edit metadata`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":!!n,onClick:l,className:`h-8`,children:[(0,Y.jsx)(V,{className:`h-3.5 w-3.5`}),`History`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":r===`delete`,onClick:c,className:`h-8 text-tone-danger-fg`,children:[(0,Y.jsx)(ae,{className:`h-3.5 w-3.5`}),`Delete`]})]})]}),r===`rotate`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(ge,{secret:e,scopedRef:g(e),onClose:u})}),r===`metadata`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(ve,{secret:e,onClose:u,onSaved:s})}),r===`delete`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(_e,{secret:e,onClose:u,onDeleted:d})}),n&&(0,Y.jsx)(ye,{history:n})]})}function Oe({secret:e,now:t}){let{expiresAt:n,revision:r,sourceUrl:i}=e.metadata,a=w(n,t),o=E(e.fingerprint,e.hint);return!o&&!a&&!r&&!i?null:(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground`,children:[o&&(0,Y.jsx)(`code`,{"data-testid":`secret-signature`,title:`Fingerprint (first 6 of SHA-256) and last 4 characters`,children:o}),a&&(a.expired?(0,Y.jsxs)(K,{"data-testid":`secret-expiry`,"data-expired":`true`,variant:`destructive`,title:I(new Date(n).getTime()),className:`h-4 px-1 text-[10px]`,children:[`Expired · `,a.label.replace(/^expired /,``),` (`,j(n),`)`]}):(0,Y.jsxs)(`span`,{"data-testid":`secret-expiry`,"data-expired":`false`,title:I(new Date(n).getTime()),children:[a.label,` (`,j(n),`)`]})),r&&(0,Y.jsxs)(`span`,{"data-testid":`secret-revision`,className:`break-all`,children:[`rev `,r]}),i&&(0,Y.jsxs)(`a`,{"data-testid":`source-link`,href:i,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex min-h-6 items-center gap-0.5 text-primary underline-offset-2 hover:underline`,children:[(0,Y.jsx)(B,{className:`h-3 w-3 shrink-0`}),`Source`]})]})}export{Te as SecretsView};
|
|
2
|
-
//# sourceMappingURL=secrets-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{$ as r,B as i,Ct as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,P as h,Q as g,R as _,U as v,V as y,W as b,X as x,Y as S,Z as C,at as w,et as T,it as E,j as D,nt as O,rt as k,t as A,tt as j,z as M}from"./store-BgDALGIX.js";import{M as N}from"./provider-display-bWwiuedV.js";import{et as P,f as F,v as I}from"./display-BemJG1f_.js";import{s as L,t as R}from"./api-CIIVBtAV.js";import{t as z}from"./archive-CIuPSvmx.js";import{t as B}from"./external-link-BRfu-fHG.js";import{n as V,t as ee}from"./shield-alert-B9jCWcKW.js";import{t as te}from"./key-round-CcSxl5qr.js";import{t as H}from"./loader-circle-BfPd4kOD.js";import{t as U}from"./lock-BW8MPKw_.js";import{t as ne}from"./pencil-B1Hf2V_J.js";import{t as W}from"./plus-D5Ek4e2S.js";import{t as re}from"./refresh-cw-CfpvQcUn.js";import{t as ie}from"./rotate-cw-FPtkDewA.js";import{t as ae}from"./trash-2-FbcSq927.js";import{t as oe}from"./triangle-alert-BBNhfgMi.js";import{t as G}from"./button-Do6Z3vvn.js";import{t as K}from"./badge-DqJRtj_p.js";import{t as q}from"./input-CsTB6jIx.js";import{t as se}from"./textarea-hs6Mpyfl.js";import{t as ce}from"./VaultDecisionCard-DUIfTTFF.js";var J=e(t(),1),Y=n();function le({url:e}){return(0,Y.jsxs)(`a`,{"data-testid":`source-link`,href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex min-h-9 max-w-full items-center gap-1 text-xs text-primary underline-offset-2 hover:underline sm:min-h-0`,children:[(0,Y.jsx)(B,{className:`h-3 w-3 shrink-0`}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-all`,children:[`Open the source page: `,e]})]})}function ue({rotate:e,projectId:t,environment:n=`prod`,sourceUrl:r,disabled:i,onClose:a}){let o=A(e=>e.fetchOpenDecisions),[s,c]=(0,J.useState)(e??``),[l,u]=(0,J.useState)(e?`Rotate ${e}`:``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),v=y.test(s),b=v&&l.trim().length>0&&!i&&!d;async function S(){if(b){f(!0),m(``);try{let e=await _(s,l.trim(),t,n);g({name:e.name,formUrl:e.formUrl}),o()}catch(e){m(N(e))}finally{f(!1)}}}return(0,Y.jsx)(`div`,{"data-testid":`secret-request-panel`,className:`rounded-lg border border-border bg-card/60 p-3 text-sm`,children:h?(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`p`,{children:[`Request filed for `,(0,Y.jsx)(`code`,{className:`break-all`,children:h.name}),`. Open the form and enter the value there. The link works once, until it expires or the request is withdrawn. The form has optional expiry, revision and source URL fields, and shows the fingerprint after you save.`]}),h.formUrl?(0,Y.jsxs)(`a`,{href:x(h.formUrl,L()),target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:h-8 sm:w-auto`,children:[(0,Y.jsx)(B,{className:`h-3.5 w-3.5`}),`Open secure form`]}):(0,Y.jsx)(`p`,{className:`text-xs text-tone-warning-fg`,children:`The form link is only shown to the operator token.`}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:a,children:`Close`})})]}):(0,Y.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,Y.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e?`Rotate ${e}`:`Request a new secret`}),!e&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(q,{"aria-label":`Secret name`,"aria-invalid":s!==``&&!v,placeholder:`NAME or NAME@environment`,autoComplete:`off`,spellCheck:!1,value:s,onChange:e=>c(e.target.value),className:`font-mono`}),s!==``&&!v&&(0,Y.jsx)(`p`,{className:`mt-1 text-[11px] text-tone-danger-fg`,children:`Start with a letter or underscore; then letters, digits, _ . - (up to 256). Optional @environment: 1–32 lowercase letters, digits or hyphens.`})]}),r&&(0,Y.jsx)(le,{url:r}),(0,Y.jsx)(se,{"aria-label":`Reason`,rows:2,placeholder:`Why is it needed?`,value:l,maxLength:4096,onChange:e=>u(e.target.value)}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`You enter the value on the next page. Do not paste it here.`]}),p&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:p}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!b,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[d&&(0,Y.jsx)(H,{className:`animate-spin`}),e?`Request rotation`:`Request secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:a,className:`h-9 sm:h-8`,children:`Cancel`})]})]})})}function de({projects:e,defaultProjectId:t=``,onClose:n}){let r=A(e=>e.fetchVault),[i,a]=(0,J.useState)(`infisical`),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(`prod`),[u,d]=(0,J.useState)(`/`),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`codex`),[g,_]=(0,J.useState)(t),[v,y]=(0,J.useState)(`prod`),[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(null),O=i===`infisical`?{kind:i,project:o,environment:c,path:u}:{kind:i,host:f,provider:m},k=b&&JSON.stringify(b.source)===JSON.stringify(O)?b:null;async function j(){C(!0),T(``),x(null);try{let{names:e}=await R(`POST`,`/secrets/import/preview`,{source:O});x({source:O,names:e,picked:[]})}catch(e){T(N(e))}finally{C(!1)}}async function M(){if(!k?.picked.length)return;C(!0),T(``);let e={source:k.source,names:k.picked,environment:v,scope:g?`project`:`global`,...g?{project:g}:{}};try{D(await R(`POST`,`/secrets/import`,e)),r()}catch(e){T(N(e))}finally{C(!1)}}return(0,Y.jsx)(`section`,{"data-testid":`secret-import-panel`,"aria-label":`Import secrets`,className:`space-y-3 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:E?(0,Y.jsxs)(Y.Fragment,{children:[E.secrets.map(e=>(0,Y.jsxs)(`p`,{children:[`Imported `,e.name,` v`,e.version]},e.name)),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Import secrets`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose existing names. Relay moves the values directly into encrypted storage. Import selected approves the whole batch.`}),(0,Y.jsxs)(`fieldset`,{disabled:S,className:`space-y-2`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Import source`,value:i,onChange:e=>a(e.target.value),className:`h-9 w-full rounded-md border border-input bg-background px-3`,children:[(0,Y.jsx)(`option`,{value:`infisical`,children:`Infisical path`}),(0,Y.jsx)(`option`,{value:`provider-config`,children:`Provider config`})]}),i===`infisical`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{"aria-label":`Infisical project`,placeholder:`Infisical project ID, slug or name`,value:o,onChange:e=>s(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source environment`,placeholder:`Source environment`,value:c,onChange:e=>l(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source path`,placeholder:`/path`,value:u,onChange:e=>d(e.target.value)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{"aria-label":`Source host`,placeholder:`Host ID or hostname`,value:f,onChange:e=>p(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Source provider`,placeholder:`Provider`,value:m,onChange:e=>h(e.target.value)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Imported env entries are replaced with secret: references.`})]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,onClick:()=>void j(),children:`Load names`}),k&&(0,Y.jsx)(`div`,{className:`space-y-1`,children:k.names.length===0?(0,Y.jsx)(`p`,{children:`No importable names at this source.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:()=>x({...k,picked:k.names}),children:`Select all`}),k.names.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 break-all`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:k.picked.includes(e),onChange:t=>x({...k,picked:t.target.checked?[...k.picked,e]:k.picked.filter(t=>t!==e)})}),e]},e))]})}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[`Target scope`,(0,Y.jsxs)(`select`,{"aria-label":`Target scope`,value:g,onChange:e=>_(e.target.value),className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,Y.jsx)(`option`,{value:``,children:`Global`}),e.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[`Project: `,e.title||e.slug||e.id]},e.id))]})]}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[`Target environment`,(0,Y.jsx)(q,{"aria-label":`Target environment`,value:v,onChange:e=>y(e.target.value)})]})]}),w&&(0,Y.jsx)(`p`,{role:`alert`,className:`break-words text-xs text-tone-danger-fg`,children:w}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:S||!k?.picked.length||!v,onClick:()=>void M(),children:`Import selected`}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,disabled:S,onClick:n,children:`Cancel`})]})]})})}var fe={"no-recipient":`No backup recipient is set, so no backup is written. Add your age public key in Settings → Secrets → Vault backup.`,stale:`The last successful backup is more than 48 hours old.`};function pe({status:e,disabled:t}){let n=A(e=>e.fetchVault),r=a(),[i,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),l=e.lastSuccess;async function u(){o(!0),c(``);try{await D()}catch(e){c(N(e))}finally{o(!1),n()}}return(0,Y.jsxs)(`section`,{"data-testid":`vault-backup`,"aria-label":`Vault backup`,className:`space-y-1.5 rounded-lg border px-3 py-2.5 text-sm ${e.warning?`border-tone-warning/40 bg-tone-warning/10`:`border-border bg-card`}`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(z,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),` Backup`]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,disabled:t||i||!e.recipientFingerprint,onClick:()=>void u(),children:i?`Backing up…`:`Back up now`})]}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`dt`,{children:`Last backup`}),(0,Y.jsx)(`dd`,{"data-testid":`vault-backup-last`,className:`min-w-0 break-words text-foreground`,children:l?(0,Y.jsxs)(`span`,{title:I(l.at),children:[P(r,l.at),` · `,l.secrets,` secret`,l.secrets===1?``:`s`]}):`Never`}),(0,Y.jsx)(`dt`,{children:`Recipient`}),(0,Y.jsx)(`dd`,{"data-testid":`vault-backup-recipient`,className:`min-w-0 break-all font-mono text-foreground`,children:e.recipientFingerprint??`Not set`}),(0,Y.jsx)(`dt`,{children:`Kept`}),(0,Y.jsxs)(`dd`,{className:`min-w-0 break-all`,children:[e.files,` of `,e.keep,` in `,e.directory]})]}),e.warning&&(0,Y.jsx)(`p`,{role:`status`,className:`text-xs text-tone-warning-fg`,children:fe[e.warning]}),e.lastError&&(!l||e.lastError.at>l.at)&&(0,Y.jsxs)(`p`,{className:`break-words text-xs text-tone-danger-fg`,children:[`Last attempt failed `,P(r,e.lastError.at),`: `,e.lastError.message]}),s&&(0,Y.jsx)(`p`,{role:`alert`,className:`break-words text-xs text-tone-danger-fg`,children:s})]})}function X({draft:e,onChange:t,collapsible:n=!0}){let r=(0,Y.jsxs)(`div`,{"data-testid":`metadata-fields`,className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:`Expires on`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(q,{"aria-label":`Expires on`,type:`date`,value:e.expiresDate,onChange:n=>t({...e,expiresDate:n.target.value,expiresBad:n.target.validity.badInput}),className:`text-foreground`}),(0,Y.jsx)(q,{"aria-label":`Expiry time (optional)`,type:`time`,value:e.expiresTime,onChange:n=>t({...e,expiresTime:n.target.value}),className:`w-32 shrink-0 text-foreground`})]}),(0,Y.jsx)(`p`,{className:`text-[11px]`,children:`In your time zone. Without a time it expires at the end of that day.`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Revision`,(0,Y.jsx)(q,{"aria-label":`Revision`,maxLength:500,autoComplete:`off`,placeholder:`Vendor revision or number`,value:e.revision,onChange:n=>t({...e,revision:n.target.value}),className:`text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Source URL`,(0,Y.jsx)(q,{"aria-label":`Source URL`,type:`url`,inputMode:`url`,maxLength:2048,autoComplete:`off`,spellCheck:!1,placeholder:`https://vendor.example/keys`,value:e.sourceUrl,onChange:n=>t({...e,sourceUrl:n.target.value}),className:`font-mono text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":`Show last four characters`,checked:e.hintEnabled,onChange:n=>t({...e,hintEnabled:n.target.checked}),className:`h-4 w-4`}),`Show the last four characters as a hint`]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Stored as plain text, readable by agents. Never put a credential here.`})]});return n?(0,Y.jsxs)(`details`,{className:`rounded-md border border-border/60 px-2.5 py-1.5`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Optional metadata`}),(0,Y.jsx)(`div`,{className:`mt-2`,children:r})]}):r}var me=e=>e.title||e.slug||e.id;function he({projects:e,defaultProjectId:t=``,onClose:n}){let i=A(e=>e.fetchVault),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(t),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),[m,h]=(0,J.useState)(r),[g,_]=(0,J.useState)(!1),[v,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(null),C=y.test(a),w=O(m),T=C&&d.length>0&&!w&&!g;async function D(){if(T){_(!0),b(``);try{let[t,n=`prod`]=a.split(`@`),r=await p({name:t,environment:n,value:d,projectId:s||void 0,description:l.trim()||void 0,metadata:k(m)}),o=e.find(e=>e.id===s);S({name:a,where:o?me(o):`global`,signature:E(r.fingerprint,r.hint)}),f(``),i()}catch(e){b(N(e))}finally{_(!1)}}}return x?(0,Y.jsxs)(`div`,{"data-testid":`secret-new-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:[(0,Y.jsxs)(`p`,{children:[`Saved `,(0,Y.jsx)(`code`,{className:`break-all`,children:x.name}),` (`,x.where,`). Agents use it as `,(0,Y.jsxs)(`code`,{className:`break-all`,children:[`secret:`,x.name]}),`. The value is not shown again.`]}),x.signature&&(0,Y.jsxs)(`p`,{"data-testid":`saved-signature`,className:`text-xs text-muted-foreground`,children:[`Fingerprint `,(0,Y.jsx)(`code`,{children:x.signature}),`. Compare it with the key where you copied it from.`]}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(`form`,{"data-testid":`secret-new-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),D()},children:[(0,Y.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:`New secret`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(q,{"aria-label":`Secret name`,"aria-invalid":a!==``&&!C,placeholder:`NAME or NAME@environment`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value),className:`font-mono`}),a!==``&&!C&&(0,Y.jsx)(`p`,{className:`mt-1 text-[11px] text-tone-danger-fg`,children:`Start with a letter or underscore; then letters, digits, _ . - (up to 256). Optional @environment: 1–32 lowercase letters, digits or hyphens.`})]}),(0,Y.jsxs)(`select`,{"aria-label":`Scope`,value:s,onChange:e=>c(e.target.value),className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,Y.jsx)(`option`,{value:``,children:`Global (all projects)`}),e.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[`Project: `,me(e)]},e.id))]}),(0,Y.jsx)(q,{"aria-label":`Description`,placeholder:`Description (optional)`,maxLength:500,autoComplete:`off`,value:l,onChange:e=>u(e.target.value)}),(0,Y.jsx)(q,{"aria-label":`Value`,type:`password`,placeholder:`Value`,autoComplete:`new-password`,spellCheck:!1,value:d,onChange:e=>f(e.target.value),className:`font-mono`}),(0,Y.jsx)(X,{draft:m,onChange:h}),w&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:w}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`Stored encrypted. It is never shown again, only replaced with Rotate.`]}),v&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:v}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!T,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[g&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:n,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ge({secret:e,scopedRef:t,onClose:n}){let{name:r,projectId:i,environment:a}=e,o=A(e=>e.fetchVault),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(()=>T(e.metadata,e.hintEnabled)),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(!1),x=O(d,e),S=s.length>0&&!x&&!p;async function C(){if(S){m(!0),g(``);try{let n=await M(t,s,l.trim()||void 0,k(d,e));v({version:n.version,signature:E(n.fingerprint,n.hint)}),c(``),o()}catch(e){g(N(e))}finally{m(!1)}}}return y?(0,Y.jsx)(ue,{rotate:r,projectId:i,environment:a,sourceUrl:e.metadata.sourceUrl,onClose:n}):_?(0,Y.jsxs)(`div`,{"data-testid":`secret-rotate-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`break-all`,children:r}),` is now v`,_.version,`. The value is not shown again.`]}),_.signature&&(0,Y.jsxs)(`p`,{"data-testid":`saved-signature`,className:`text-xs text-muted-foreground`,children:[`Fingerprint `,(0,Y.jsx)(`code`,{children:_.signature}),`. Compare it with the key where you copied it from.`]}),(0,Y.jsx)(G,{size:`sm`,variant:`ghost`,onClick:n,children:`Close`})]}):(0,Y.jsxs)(`form`,{"data-testid":`secret-rotate-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,Y.jsxs)(`div`,{className:`text-xs font-medium text-foreground`,children:[`Rotate `,r]}),e.metadata.sourceUrl&&(0,Y.jsx)(le,{url:e.metadata.sourceUrl}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`New value`,(0,Y.jsx)(q,{"aria-label":`New value`,type:`password`,autoComplete:`new-password`,spellCheck:!1,value:s,onChange:e=>c(e.target.value),className:`font-mono text-foreground`})]}),(0,Y.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Reason (optional)`,(0,Y.jsx)(q,{"aria-label":`Reason (optional)`,maxLength:500,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),className:`text-foreground`})]}),(0,Y.jsx)(X,{draft:d,onChange:f}),x&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:x}),(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(U,{className:`mt-0.5 h-3 w-3 shrink-0`}),`Stored encrypted as the next version. It is never shown again.`]}),h&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:h}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!S,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[p&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save new value`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:n,className:`h-9 sm:h-8`,children:`Cancel`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>b(!0),className:`text-xs text-primary underline-offset-2 hover:underline`,children:`Ask someone else to provide it`})]})}function Z({actor:e,labels:t}){let n=A(t=>t.agentsById[e]),r=A(e=>e.openAgentDetail),i=c(e)??(n?e.replace(/^agent-/,``):null);if(!i)return(0,Y.jsx)(`span`,{className:`break-all`,children:e});let a=n?F(n):t?.[e],o=a?`${a} · ${i}`:`agent · ${i}`;return n?(0,Y.jsx)(`button`,{type:`button`,"data-testid":`vault-actor`,"data-agent":`live`,title:e,onClick:()=>r(n),className:`min-w-0 break-words text-left text-primary underline-offset-2 hover:underline`,children:o}):(0,Y.jsx)(`span`,{"data-testid":`vault-actor`,"data-agent":`gone`,title:e,className:`min-w-0 break-words`,children:o})}function _e({secret:e,onClose:t,onDeleted:n}){let r=A(e=>e.fetchVault),i=a(),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),f=o===e.name&&!c;async function p(){if(f){l(!0),d(``);try{await m(g(e)),n(),r()}catch(e){d(N(e)),l(!1)}}}return(0,Y.jsxs)(`form`,{"data-testid":`secret-delete-panel`,className:`space-y-2 rounded-lg border border-tone-danger/40 bg-tone-danger/10 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs font-medium text-tone-danger-fg`,children:[(0,Y.jsx)(oe,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),`Delete `,e.name,` and all `,e.version,` version`,e.version===1?``:`s`]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This cannot be undone. Agents that use `,(0,Y.jsxs)(`code`,{className:`break-all`,children:[`secret:`,e.name,e.environment===`prod`?``:`@${e.environment}`]}),` will fail with “not found”.`]}),e.lastResolved&&(0,Y.jsxs)(`p`,{"data-testid":`delete-in-use`,className:`text-xs text-tone-warning-fg`,children:[`In use: last used `,P(i,e.lastResolved.at),` by `,(0,Y.jsx)(Z,{actor:e.lastResolved.actor}),`.`]}),(0,Y.jsx)(q,{"aria-label":`Type ${e.name} to confirm`,placeholder:`Type ${e.name} to confirm`,autoComplete:`off`,spellCheck:!1,value:o,onChange:e=>s(e.target.value),className:`font-mono`}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:u}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,variant:`destructive`,disabled:!f,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[c&&(0,Y.jsx)(H,{className:`animate-spin`}),`Delete secret`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:t,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ve({secret:e,onClose:t,onSaved:n}){let r=A(e=>e.fetchVault),[i,a]=(0,J.useState)(()=>T(e.metadata,e.hintEnabled)),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),u=O(i,e),d=u?void 0:k(i,e);async function f(){if(!(!d||o)){s(!0),l(``);try{await h(g(e),d),r(),n()}catch(e){l(N(e)),s(!1)}}}return(0,Y.jsxs)(`form`,{"data-testid":`secret-metadata-panel`,className:`space-y-2 rounded-lg border border-border bg-card/60 p-3 text-sm`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,Y.jsxs)(`div`,{className:`text-xs font-medium text-foreground`,children:[`Edit metadata of `,e.name]}),(0,Y.jsx)(X,{draft:i,onChange:a,collapsible:!1}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg`,children:u}),c&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-tone-danger-fg break-words`,children:c}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(G,{type:`submit`,size:`sm`,disabled:!d||o,className:`h-9 flex-1 sm:h-8 sm:flex-none`,children:[o&&(0,Y.jsx)(H,{className:`animate-spin`}),`Save metadata`]}),(0,Y.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:t,className:`h-9 sm:h-8`,children:`Cancel`})]})]})}function ye({history:e}){return e.error?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-tone-danger-fg break-words`,children:e.error}):e.rows?e.rows.length?(0,Y.jsx)(`ul`,{"data-testid":`audit-list`,className:`mt-2 divide-y divide-border/60 rounded-md border border-border/60 text-xs`,"aria-label":`History of ${e.name}`,children:e.rows.map(t=>(0,Y.jsxs)(`li`,{"data-testid":`audit-row`,className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2.5 py-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-muted-foreground`,children:I(t.createdAt)}),(0,Y.jsx)(K,{variant:t.outcome===`ok`?`secondary`:`destructive`,className:`h-4 px-1 text-[10px]`,children:v(t.action)}),t.version!==void 0&&(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`v`,t.version]}),t.version!==void 0&&(t.action===`set`||t.action===`rotated`)&&e.versions?.[t.version]&&(0,Y.jsx)(`code`,{"data-testid":`audit-signature`,className:`text-[11px] text-muted-foreground`,children:e.versions[t.version]}),(0,Y.jsx)(Z,{actor:t.actor,labels:e.labels}),t.outcome!==`ok`&&(0,Y.jsx)(`span`,{className:`text-tone-danger-fg`,children:t.outcome}),(0,Y.jsx)(be,{row:t,labels:e.labels})]},t.id))}):(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No audit rows yet.`}):(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Loading history…`})}function be({row:e,labels:t}){let{decisionId:n,requestedBy:r}=s(e),i=A(e=>n!==void 0&&e.openDecisions.some(e=>e.id===n));if(r)return(0,Y.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[`requested by `,(0,Y.jsx)(Z,{actor:r,labels:t})]});if(n!==void 0)return i?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.querySelector(`[data-testid="decision-card-${n}"]`)?.scrollIntoView({block:`center`}),className:`text-primary underline-offset-2 hover:underline`,children:[`decision #`,n]}):(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`decision #`,n]});let a=b(e);return a?(0,Y.jsx)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:a}):null}var xe=`humwick-vault-filter`;function Se(){try{let e=JSON.parse(localStorage.getItem(xe)??`null`);return{tab:e?.tab===`project`?`project`:`global`,projectId:typeof e?.projectId==`string`?e.projectId:``}}catch{return{tab:`global`,projectId:``}}}function Ce(e){try{localStorage.setItem(xe,JSON.stringify(e))}catch{}}var Q=e=>e.title||e.slug||e.id;function we(e,t,n){let r=new Map(e.map(e=>[e.id,e]));for(let e of t)e.projectId&&!r.has(e.projectId)&&r.set(e.projectId,{id:e.projectId,title:e.projectName??``,slug:``});return n&&!r.has(n)&&r.set(n,{id:n,title:``,slug:``}),[...r.values()].sort((e,t)=>Q(e).localeCompare(Q(t)))}function Te(){let e=A(e=>e.vault),t=A(e=>e.vaultProjects),n=A(e=>e.vaultBackup),r=A(e=>e.fetchVault),p=A(e=>e.agentsById),m=A(e=>e.openDecisions),h=a(),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[x,w]=(0,J.useState)(Se),T=e.status===`key-problem`,D=e.status===`ready`?e.secrets:[],O=D.some(e=>e.environment&&e.environment!==`prod`),k=we(t,D,x.projectId),j=x.tab===`project`&&!x.projectId&&k[0]?{tab:`project`,projectId:k[0].id}:x,M=D.filter(e=>S(e,j)),P=m.filter(u).filter(e=>S(C(e.title),j)),F=D.filter(e=>e.projectId).length,I=j.tab===`project`?j.projectId:void 0;function L(e){w(e),Ce(e),v(null),b(null)}function R(e){b(t=>t?.name===e&&t.rows?t:{name:e}),f(e).then(t=>b(n=>n?.name===e?{...n,versions:Object.fromEntries(t.map(e=>[e.version,E(e.fingerprint,e.hint)]))}:n)).catch(()=>{}),l(e).then(t=>{b(n=>n?.name===e?{...n,rows:t}:n);let n=[...new Set(t.flatMap(e=>[e.actor,s(e).requestedBy??``]))].filter(e=>c(e)&&!p[e]);n.length&&o(n).then(t=>b(n=>n?.name===e?{...n,labels:t}:n))},t=>b(n=>n?.name===e?{name:e,error:N(t)}:n))}function z(e){y?.name===e?b(null):R(e)}function B(e){v(t=>t&&t.kind===e.kind&&(!(`ref`in t)||`ref`in e&&t.ref===e.ref)?null:e)}function V(){r(),y&&R(y.name)}return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(te,{className:`h-5 w-5 text-muted-foreground`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Secrets`}),e.status===`ready`&&(0,Y.jsx)(K,{variant:`secondary`,children:M.length})]}),(e.status===`ready`||T)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,onClick:V,children:[(0,Y.jsx)(re,{className:`h-3.5 w-3.5`}),` Refresh`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,disabled:T,onClick:()=>B({kind:`request`}),children:[(0,Y.jsx)(W,{className:`h-3.5 w-3.5`}),` Request secret`]}),(0,Y.jsx)(G,{size:`sm`,variant:`outline`,disabled:T,onClick:()=>B({kind:`import`}),children:`Import`}),(0,Y.jsxs)(G,{size:`sm`,disabled:T,onClick:()=>B({kind:`new`}),children:[(0,Y.jsx)(W,{className:`h-3.5 w-3.5`}),` New secret`]})]})]}),e.status===`ready`&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{role:`tablist`,"aria-label":`Secret scope`,className:`inline-flex rounded-md border border-border p-0.5`,children:[(0,Y.jsx)(Ee,{selected:x.tab===`global`,onClick:()=>L({...x,tab:`global`}),children:`Global`}),(0,Y.jsxs)(Ee,{selected:x.tab===`project`,onClick:()=>L({...x,tab:`project`}),children:[`Project`,F>0?` (${F})`:``]})]}),x.tab===`project`&&(0,Y.jsxs)(`select`,{"aria-label":`Project`,value:j.projectId,onChange:e=>L({tab:`project`,projectId:e.target.value}),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm sm:h-8 sm:max-w-xs`,children:[k.length===0&&(0,Y.jsx)(`option`,{value:``,children:`No projects`}),k.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:Q(e)},e.id))]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Names and versions only. Values are never shown, here or anywhere else in Relay.`}),e.status===`unknown`&&(0,Y.jsx)($,{children:`Loading…`}),e.status===`off`&&(0,Y.jsxs)($,{testId:`vault-off`,title:`The secrets vault is off`,children:[`The vault is on by default. Remove `,(0,Y.jsx)(`code`,{children:`AGENT_RELAY_SECRETS_VAULT=0`}),` from the hub environment and restart Relay to turn it on. This page needs an operator token with the secrets scope.`]}),e.status===`error`&&(0,Y.jsx)($,{testId:`vault-error`,title:`Could not read the vault`,tone:`danger`,children:e.message}),e.status===`key-problem`&&(0,Y.jsxs)($,{testId:`vault-key-problem`,title:i[e.code].title,tone:`danger`,children:[i[e.code].body,` Setting and using secrets is paused until then.`]}),n&&(e.status===`ready`||T)&&(0,Y.jsx)(pe,{status:n,disabled:T}),_?.kind===`request`&&(0,Y.jsx)(ue,{disabled:T,projectId:I,onClose:()=>v(null)}),_?.kind===`import`&&!T&&(0,Y.jsx)(de,{projects:k,defaultProjectId:I,onClose:()=>v(null)}),_?.kind===`new`&&!T&&(0,Y.jsx)(he,{projects:k,defaultProjectId:I,onClose:()=>v(null)}),P.length>0&&(0,Y.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Pending requests`,children:[(0,Y.jsxs)(`h3`,{className:`text-sm font-medium text-tone-warning-fg`,children:[`Waiting for a value (`,d(P,h),`)`]}),P.map(e=>(0,Y.jsx)(ce,{decision:e},`${e.id}:${e.updatedAt}`))]}),e.status===`ready`&&(M.length===0?(0,Y.jsx)($,{testId:`vault-empty`,children:j.tab===`project`?`No secrets in this project yet. Create one, request one, or let an agent ask for it.`:`No global secrets yet. Create one, request one, or let an agent ask for it.`}):(0,Y.jsx)(`ul`,{className:`space-y-2`,"aria-label":`Secrets`,children:M.map(e=>{let t=g(e);return(0,Y.jsx)(De,{secret:e,showEnvironment:O,open:y?.name===t?y:null,panel:_&&`ref`in _&&_.ref===t?_.kind:null,onRotate:()=>B({kind:`rotate`,ref:t}),onEditMetadata:()=>B({kind:`metadata`,ref:t}),onMetadataSaved:()=>{v(null),y?.name===t&&R(t)},onDelete:()=>B({kind:`delete`,ref:t}),onHistory:()=>z(t),onClosePanel:()=>v(null),onDeleted:()=>{v(null),y?.name===t&&b(null)}},t)})}))]})}function Ee({selected:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:`h-8 rounded px-3 text-sm font-medium sm:h-7 ${e?`bg-secondary text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:n})}function $({title:e,tone:t,testId:n,children:r}){return(0,Y.jsxs)(`div`,{"data-testid":n,role:t===`danger`?`alert`:void 0,className:t===`danger`?`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-3 text-sm text-tone-danger-fg`:`rounded-md border border-border px-3 py-6 text-center text-sm text-muted-foreground`,children:[e&&(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(ee,{className:`h-4 w-4 shrink-0`}),e]}),(0,Y.jsx)(`div`,{className:`break-words`,children:r})]})}function De({secret:e,showEnvironment:t,open:n,panel:r,onRotate:i,onEditMetadata:o,onMetadataSaved:s,onDelete:c,onHistory:l,onClosePanel:u,onDeleted:d}){let f=a();return(0,Y.jsxs)(`li`,{"data-testid":`secret-row`,"data-secret":e.name,"data-environment":e.environment??`prod`,"data-scope":e.projectId?`project`:`global`,className:`rounded-lg border border-border bg-card px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`code`,{className:`break-all text-sm font-medium`,children:e.name}),(0,Y.jsx)(K,{variant:`outline`,className:`h-4 px-1 text-[10px]`,children:e.projectId?`project: ${e.projectName??e.projectId}`:`global`}),(0,Y.jsxs)(K,{variant:`secondary`,className:`h-4 px-1 text-[10px]`,children:[`v`,e.version]}),e.metadata?.expiresAt&&Date.parse(e.metadata.expiresAt)<=f&&(0,Y.jsx)(K,{variant:`destructive`,className:`h-4 px-1 text-[10px]`,children:`Expired`}),t&&(0,Y.jsx)(K,{"data-testid":`secret-environment`,variant:`outline`,className:`h-4 px-1 text-[10px]`,children:e.environment??`prod`})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{title:I(e.updatedAt),children:[e.version>1?`Rotated`:`Set`,` `,P(f,e.updatedAt)]}),(0,Y.jsx)(`span`,{children:` · `}),e.lastResolved?(0,Y.jsxs)(`span`,{title:I(e.lastResolved.at),children:[`Last used `,P(f,e.lastResolved.at),` by `,(0,Y.jsx)(Z,{actor:e.lastResolved.actor})]}):(0,Y.jsx)(`span`,{children:`Not used yet`})]}),(0,Y.jsx)(Oe,{secret:e,now:f})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Y.jsxs)(G,{size:`sm`,variant:`outline`,"aria-expanded":r===`rotate`,onClick:i,className:`h-8`,children:[(0,Y.jsx)(ie,{className:`h-3.5 w-3.5`}),`Rotate`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":r===`metadata`,onClick:o,className:`h-8`,children:[(0,Y.jsx)(ne,{className:`h-3.5 w-3.5`}),`Edit metadata`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":!!n,onClick:l,className:`h-8`,children:[(0,Y.jsx)(V,{className:`h-3.5 w-3.5`}),`History`]}),(0,Y.jsxs)(G,{size:`sm`,variant:`ghost`,"aria-expanded":r===`delete`,onClick:c,className:`h-8 text-tone-danger-fg`,children:[(0,Y.jsx)(ae,{className:`h-3.5 w-3.5`}),`Delete`]})]})]}),r===`rotate`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(ge,{secret:e,scopedRef:g(e),onClose:u})}),r===`metadata`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(ve,{secret:e,onClose:u,onSaved:s})}),r===`delete`&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(_e,{secret:e,onClose:u,onDeleted:d})}),n&&(0,Y.jsx)(ye,{history:n})]})}function Oe({secret:e,now:t}){let{expiresAt:n,revision:r,sourceUrl:i}=e.metadata,a=w(n,t),o=E(e.fingerprint,e.hint);return!o&&!a&&!r&&!i?null:(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground`,children:[o&&(0,Y.jsx)(`code`,{"data-testid":`secret-signature`,title:`Fingerprint (first 6 of SHA-256) and last 4 characters`,children:o}),a&&(a.expired?(0,Y.jsxs)(K,{"data-testid":`secret-expiry`,"data-expired":`true`,variant:`destructive`,title:I(new Date(n).getTime()),className:`h-4 px-1 text-[10px]`,children:[`Expired · `,a.label.replace(/^expired /,``),` (`,j(n),`)`]}):(0,Y.jsxs)(`span`,{"data-testid":`secret-expiry`,"data-expired":`false`,title:I(new Date(n).getTime()),children:[a.label,` (`,j(n),`)`]})),r&&(0,Y.jsxs)(`span`,{"data-testid":`secret-revision`,className:`break-all`,children:[`rev `,r]}),i&&(0,Y.jsxs)(`a`,{"data-testid":`source-link`,href:i,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex min-h-6 items-center gap-0.5 text-primary underline-offset-2 hover:underline`,children:[(0,Y.jsx)(B,{className:`h-3 w-3 shrink-0`}),`Source`]})]})}export{Te as SecretsView};
|
|
2
|
+
//# sourceMappingURL=secrets-CVXvfvbU.js.map
|