@humwick/server 0.130.1 → 0.130.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/docs/guides/tools-administration.md +4 -0
- package/docs/guides/tools-coordination.md +1 -0
- package/docs/guides/tools-tasks.md +8 -0
- package/docs/guides/workflows.md +58 -0
- package/docs/openapi.json +414 -1
- package/package.json +8 -17
- package/public/assets/{MessageBubble-BWpoBjl4.js → MessageBubble-BWLqMGKG.js} +2 -2
- package/public/assets/{PlanGraphPanel-C0auck3n.js → PlanGraphPanel-3TlIQpjk.js} +2 -2
- package/public/assets/{TraceView-DBnOx7AQ.js → TraceView-Wimm0Czv.js} +2 -2
- package/public/assets/{VaultDecisionCard-0kp2oNBC.js → VaultDecisionCard-Bau_vNax.js} +2 -2
- package/public/assets/{activity-yLztXEBt.js → activity-CrSurn-r.js} +2 -2
- package/public/assets/{agent-lineage-BbJDR1dW.js → agent-lineage-CknAJKcb.js} +2 -2
- package/public/assets/agent-liveness-CaNwK0Zf.js +2 -0
- package/public/assets/{agent-name-CTZBrSD9.js → agent-name-DKbiIhBo.js} +2 -2
- package/public/assets/agent-profiles-DwF6EQ4R.js +2 -0
- package/public/assets/{agent-project-badge-9TqzUUYE.js → agent-project-badge-Diz4Sjjb.js} +2 -2
- package/public/assets/{agent-tools-D4n40pn8.js → agent-tools-CRhpRQza.js} +2 -2
- package/public/assets/{agent-type-icon-D6FUarOf.js → agent-type-icon-LrUEU3lB.js} +2 -2
- package/public/assets/{agents-BYDslkJc.js → agents-B-v66C-4.js} +2 -2
- package/public/assets/{analytics-B-XSbEMC.js → analytics-BqCb-LKi.js} +2 -2
- package/public/assets/{artifact-viewer-DdWIfV6M.js → artifact-viewer-kf4pGuAR.js} +2 -2
- package/public/assets/{artifacts-oBOqks-2.js → artifacts-D32zyw4Y.js} +2 -2
- package/public/assets/{artifacts-DPN1q4pA.js → artifacts-DJevXcvg.js} +2 -2
- package/public/assets/{automation-4KcRFXEu.js → automation-BpRajx_5.js} +2 -2
- package/public/assets/{backlog-Cw9xPTCF.js → backlog-D_UjTdzX.js} +2 -2
- package/public/assets/{busy-health-CTu32MZt.js → busy-health-N3VEh4ao.js} +2 -2
- package/public/assets/{channels-BiXzg1G9.js → channels-9jopungq.js} +2 -2
- package/public/assets/{chat-Ctk2qwvA.js → chat-CSXrTB3C.js} +2 -2
- package/public/assets/{code-preview-Bm1wWqAp.js → code-preview-p1NnmqK0.js} +2 -2
- package/public/assets/{connectors-C36ax4Vw.js → connectors-CZdqlDNL.js} +2 -2
- package/public/assets/{cosmos-Jj9LK2Wf.js → cosmos-BgdsE4dG.js} +2 -2
- package/public/assets/{crate-agent-H6S7-B9T.js → crate-agent-30aXTKva.js} +2 -2
- package/public/assets/{dependency-graph-Cd1E23wa.js → dependency-graph-B_jvw2GE.js} +2 -2
- package/public/assets/{deploys-Bwfq146q.js → deploys-DoN6bAb5.js} +2 -2
- package/public/assets/{display-CfO7rTuF.js → display-BrKWFGJz.js} +2 -2
- package/public/assets/{files-DhhZI2Ih.js → files-D6XEu8Ng.js} +2 -2
- package/public/assets/{fleet-B_rFEbnL.js → fleet-C7jQWbw2.js} +2 -2
- package/public/assets/{fleet-metrics-BkHP-P3R.js → fleet-metrics-BiDs3MLx.js} +2 -2
- package/public/assets/{formatted-body-Cm1RrzmN.js → formatted-body-CQBwc1fb.js} +3 -3
- package/public/assets/{formatted-body-impl-DQiOuOD1.js → formatted-body-impl-DyG0WsQS.js} +2 -2
- package/public/assets/{host-providers-dialog-CHqwXTov.js → host-providers-dialog-DKaW31dN.js} +2 -2
- package/public/assets/index-CRHep3M9.js +15 -0
- package/public/assets/index-MYAIwYTX.css +2 -0
- package/public/assets/{insights-fH1EL-qZ.js → insights-CzrtkpOE.js} +2 -2
- package/public/assets/{integrations-C5Oix6ng.js → integrations-aVsUmigt.js} +2 -2
- package/public/assets/{issue-ref-chip-ODyondIa.js → issue-ref-chip-BnSlM_95.js} +2 -2
- package/public/assets/{log-viewer-Cvfy6PW7.js → log-viewer-qe7Ee47Z.js} +2 -2
- package/public/assets/{maintenance-D8CDH5wZ.js → maintenance-NfjqFZAk.js} +2 -2
- package/public/assets/{managed-agents-egllbpij.js → managed-agents-BiH0HgaE.js} +2 -2
- package/public/assets/{markdown-preview-CYSFgVgK.js → markdown-preview-BixaT3Xr.js} +3 -3
- package/public/assets/{markdown-preview-impl-BteVIjX4.js → markdown-preview-impl-DNGlWIS3.js} +2 -2
- package/public/assets/{memory-C8WmXsyr.js → memory-DNsCl6UX.js} +2 -2
- package/public/assets/{messages-BzQdqlO6.js → messages-DopU1L1X.js} +2 -2
- package/public/assets/{orchestrators-B1HxzkNw.js → orchestrators-Cq7ckLQT.js} +2 -2
- package/public/assets/{overview-DCUnI4Z7.js → overview-C1DCTzzV.js} +2 -2
- package/public/assets/{pairs-ftCd2XcD.js → pairs-DE_m6rrE.js} +2 -2
- package/public/assets/{profile-icon-B2zH8DMH.js → profile-icon-B3rfh77F.js} +2 -2
- package/public/assets/project-profile-instructions-DQWZE0kA.js +2 -0
- package/public/assets/projects-Br2Bd2h1.js +2 -0
- package/public/assets/{prompt-settings-Bftq9czX.js → prompt-settings-BKvFsvGD.js} +2 -2
- package/public/assets/provider-display-DsuWMvVL.js +2 -0
- package/public/assets/{registry-DWCU5c8q.js → registry-Cw38_6gW.js} +2 -2
- package/public/assets/run-card-CpKqRbhg.js +2 -0
- package/public/assets/scroll-text-BKXS1ahr.js +2 -0
- package/public/assets/{secrets-C7GIUATz.js → secrets-DxI-vzSq.js} +2 -2
- package/public/assets/{service-access-settings-C3aujqTG.js → service-access-settings-D9s_VJbd.js} +2 -2
- package/public/assets/{settings-C6sZ9eBa.js → settings-CKZTVGIx.js} +2 -2
- package/public/assets/{shipping-Bu8p1gEw.js → shipping-B9YtnwtG.js} +2 -2
- package/public/assets/{stats-V9Z-GxUd.js → stats-DyUBKyWI.js} +2 -2
- package/public/assets/{status-dot-CVv0iGHL.js → status-dot-DYqlEUhJ.js} +2 -2
- package/public/assets/{store-BvtFdlGX.js → store-DcClXLH0.js} +3 -3
- package/public/assets/{tasks-CXU75HRF.js → tasks-Bh7Chr4-.js} +2 -2
- package/public/assets/{teams-BPf976zb.js → teams-bowI7qVY.js} +2 -2
- package/public/assets/{terminal-viewer-DE9BOe-8.js → terminal-viewer-BgVLHdsU.js} +3 -3
- package/public/assets/{terminal-viewer-impl-D04pjmGh.js → terminal-viewer-impl-Dz22UPy6.js} +2 -2
- package/public/assets/token-estimate-Co-Jdphh.js +2 -0
- package/public/assets/{use-agent-terminal-B1yR456R.js → use-agent-terminal-DSQQ-iY7.js} +2 -2
- package/public/assets/{use-decisions-D-S4tpDf.js → use-decisions-samMQhQf.js} +2 -2
- package/public/assets/use-project-list-59LheVP7.js +2 -0
- package/public/assets/{use-selectors-CnrAk2YP.js → use-selectors-BZa25xEB.js} +2 -2
- package/public/assets/{user-avatar-nBFIcR4M.js → user-avatar-DHxlvUvV.js} +2 -2
- package/public/assets/versioned-prompt-editor-BmED5DnJ.js +8 -0
- package/public/assets/{work-queue-TCjJxeT-.js → work-queue-CSvpuNLz.js} +2 -2
- package/public/assets/{workflow-marker-Cf3Hf2fN.js → workflow-marker-DAZcj5qt.js} +2 -2
- package/public/assets/{workflows-CXQX20Qj.js → workflows-DdmxRSyg.js} +2 -2
- package/public/assets/{workspaces-qSYzKYMA.js → workspaces-BxeKfVuF.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +31 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/plugins/claude/hooks/gate-run-guard.provisioned.mjs +31 -1
- package/runner/src/adapters/claude-effort.ts +2 -4
- package/runner/src/adapters/codex-launch-config.ts +4 -5
- package/runner/src/adapters/codex.ts +1 -1
- package/runner/src/adapters/opencode-provider.ts +7 -22
- package/runner/src/adapters/opencode.ts +4 -4
- package/runner/src/agent-runner/credentials.ts +42 -12
- package/runner/src/agent-runner/inbox.ts +27 -0
- package/runner/src/agent-runner/lifecycle-milestones.ts +0 -2
- package/runner/src/bin/claude.ts +4 -0
- package/runner/src/bin/codex.ts +4 -0
- package/runner/src/bin/opencode.ts +4 -0
- package/runner/src/index.ts +5 -2
- package/runner/src/provider-setup.ts +34 -0
- package/runner/src/providers.ts +2 -1
- package/runner/src/runner-core.ts +18 -23
- package/runner/src/spawn-input.ts +2 -1
- package/runner/src/test-run-dedup.ts +59 -56
- package/scripts/cd-config.ts +8 -0
- package/scripts/gate-run-lease.ts +10 -7
- package/scripts/gate.sh +5 -1
- package/src/branch-land-notice.ts +93 -0
- package/src/branch-landed.ts +7 -76
- package/src/bus.ts +19 -20
- package/src/cd-deploy-notify.ts +30 -2
- package/src/cd-host-lag-notify.ts +7 -6
- package/src/ci/incidents.ts +2 -2
- package/src/ci/monitor.ts +5 -8
- package/src/ci/root-missing.ts +2 -7
- package/src/ci/transition-notify.ts +7 -39
- package/src/cli/cd-pauses.ts +19 -0
- package/src/cli/orchestrator.ts +1 -1
- package/src/cli/state.ts +2 -19
- package/src/cli/task-edit.ts +22 -0
- package/src/cli/task.ts +3 -1
- package/src/cli/workflow.ts +8 -2
- package/src/commands-db.ts +3 -3
- package/src/config-store-write.ts +13 -1
- package/src/config-store.ts +25 -14
- package/src/db/activity-async.ts +6 -1
- package/src/db/activity-write-ops.ts +12 -1
- package/src/db/activity.ts +1 -14
- package/src/db/agent-search.ts +1 -15
- package/src/db/agents-async.ts +52 -5
- package/src/db/agents-write-ops.ts +12 -3
- package/src/db/agents.ts +81 -54
- package/src/db/ci-incidents-async.ts +5 -5
- package/src/db/ci-incidents-write-ops.ts +2 -2
- package/src/db/command-row.ts +10 -2
- package/src/db/commands-list-query.ts +2 -0
- package/src/db/commands-spawn-read.ts +1 -1
- package/src/db/config-store-write-ops.ts +7 -2
- package/src/db/continuation-archives-async.ts +5 -0
- package/src/db/continuation-archives-write-ops.ts +7 -0
- package/src/db/continuations.ts +2 -2
- package/src/db/db-writer-worker.ts +8 -1
- package/src/db/deploy-events-async.ts +1 -0
- package/src/db/deploy-events-read-ops.ts +2 -1
- package/src/db/deploy-events.ts +35 -4
- package/src/db/hosts-registration.ts +10 -2
- package/src/db/hosts.ts +9 -6
- package/src/db/inbox.ts +0 -14
- package/src/db/index.ts +2 -0
- package/src/db/integrations-async.ts +8 -0
- package/src/db/integrations-ops.ts +15 -0
- package/src/db/integrations.ts +15 -21
- package/src/db/issue-lifecycle.ts +3 -4
- package/src/db/issue-refs-async.ts +20 -0
- package/src/db/issue-refs-write-ops.ts +29 -0
- package/src/db/issue-refs.ts +7 -8
- package/src/db/long-running-work.ts +2 -2
- package/src/db/main-connection-writes.ts +23 -2
- package/src/db/maintenance-job-reconcile.ts +61 -0
- package/src/db/maintenance-job-runs-async.ts +14 -0
- package/src/db/maintenance-job-write-ops.ts +9 -0
- package/src/db/mappers.ts +2 -14
- package/src/db/merge-lease.ts +1 -15
- package/src/db/migrations.ts +7 -15
- package/src/db/orchestrators.ts +4 -72
- package/src/db/pairs.ts +1 -13
- package/src/db/project-profile-instructions.ts +50 -0
- package/src/db/prompt-versions.ts +9 -2
- package/src/db/provider-config-history.ts +8 -3
- package/src/db/provider-model-seed.ts +34 -0
- package/src/db/read-op-marshaling-fixtures.ts +5 -0
- package/src/db/read-ops.ts +4 -0
- package/src/db/routing-policy.ts +2 -3
- package/src/db/schema.ts +9 -3
- package/src/db/spawn-delegation-state.ts +11 -4
- package/src/db/stats-async.ts +4 -3
- package/src/db/task-entity.ts +23 -2
- package/src/db/task-list.ts +3 -1
- package/src/db/tasks.ts +1 -17
- package/src/db/timer-ingress.ts +7 -1
- package/src/db/token-db-write-ops.ts +17 -0
- package/src/db/token-standing.ts +15 -11
- package/src/db/workflow-contact.ts +1 -1
- package/src/db/workflow-task-read-ops.ts +30 -0
- package/src/db/write-ops.ts +6 -0
- package/src/db/writer-gateway.ts +17 -11
- package/src/dispatch-availability.ts +10 -6
- package/src/ephemeral/{landing-ingress-proof-worker.ts → landing-ingress-proof.test-fixture.ts} +4 -2
- package/src/host/disk-alert.ts +121 -0
- package/src/lifecycle-manager.ts +3 -2
- package/src/maintenance/cd-watcher.ts +3 -3
- package/src/maintenance/critical-job-watchdog.ts +16 -17
- package/src/maintenance/index.ts +1 -0
- package/src/maintenance/jobs.ts +3 -2
- package/src/maintenance/scheduler.ts +84 -128
- package/src/maintenance/stalled-delivery-pager.ts +6 -5
- package/src/maintenance/workspaces.ts +1 -1
- package/src/managed-policy.ts +31 -27
- package/src/mcp/index.ts +5 -2
- package/src/mcp/output-descriptions.ts +8 -8
- package/src/mcp/presentation.ts +4 -4
- package/src/mcp/project-profile-instructions.ts +32 -0
- package/src/mcp/tool-groups.ts +1 -1
- package/src/mcp/tools-spawn.ts +4 -3
- package/src/mcp-agent-action.ts +1 -2
- package/src/mcp-issue-ref-tools.ts +12 -11
- package/src/mcp-maintenance-tools.ts +2 -2
- package/src/mcp-profile-trust-tools.ts +4 -4
- package/src/mcp-provider-catalog.ts +2 -2
- package/src/mcp-task-tools.ts +11 -5
- package/src/mcp-team-template-tools.ts +3 -3
- package/src/mcp-workflow-tools.ts +10 -3
- package/src/notification-types.ts +2 -1
- package/src/operator-alarm.ts +26 -11
- package/src/project-instructions.ts +4 -0
- package/src/project-profile-instruction-text.ts +6 -0
- package/src/project-profile-instructions.ts +20 -0
- package/src/provider-catalog-store.ts +3 -49
- package/src/provider-config-store.ts +12 -11
- package/src/provider-model-seed.ts +1 -18
- package/src/provider-quota-config-store.ts +5 -4
- package/src/provider-secrets.test-fixture.ts +3 -3
- package/src/recipe-runner.ts +2 -2
- package/src/repo-config-source.ts +10 -4
- package/src/routes/agent-profiles.ts +6 -6
- package/src/routes/agents-spawn.ts +1 -1
- package/src/routes/agents.ts +6 -6
- package/src/routes/commands-listing.ts +4 -0
- package/src/routes/commands.ts +2 -2
- package/src/routes/continuation-archives.ts +2 -2
- package/src/routes/index.ts +10 -1
- package/src/routes/integrations.ts +24 -50
- package/src/routes/issue-refs.ts +7 -7
- package/src/routes/orchestrator-bootstrap.ts +1 -1
- package/src/routes/orchestrator-host-registration.ts +2 -2
- package/src/routes/orchestrator-host-utilization.ts +3 -1
- package/src/routes/orchestrator-proxy.ts +2 -2
- package/src/routes/orchestrator.ts +2 -2
- package/src/routes/project-profile-instructions.ts +27 -0
- package/src/routes/project-trust.ts +2 -2
- package/src/routes/provider-config.ts +6 -6
- package/src/routes/provider-quota-config.ts +2 -2
- package/src/routes/settings.ts +5 -5
- package/src/routes/stats.ts +6 -6
- package/src/routes/task-http.ts +15 -1
- package/src/routes/task-issues.ts +11 -26
- package/src/routes/tasks.ts +22 -53
- package/src/routes/team-templates.ts +5 -5
- package/src/routes/teams-config.ts +2 -2
- package/src/routes/tokens.ts +12 -5
- package/src/routes/workflows.ts +20 -5
- package/src/routing-policy-normalize.ts +1 -2
- package/src/routing-step-defaults.ts +0 -2
- package/src/runner-token-mint-limit.ts +63 -0
- package/src/runtime-grant.ts +4 -2
- package/src/runtime-tokens.ts +39 -7
- package/src/security.ts +13 -20
- package/src/server-background.ts +1 -1
- package/src/server.ts +5 -2
- package/src/services/host-utilization.ts +23 -0
- package/src/services/idle-epics.ts +5 -6
- package/src/services/issue-lifecycle.ts +57 -61
- package/src/services/issue-refs.ts +9 -13
- package/src/services/kernel-timers-cutover-chaos-worker.ts +10 -7
- package/src/services/kernel-timers-ingress.ts +1 -1
- package/src/services/landed-ancestry.ts +19 -3
- package/src/services/memory-areas.ts +15 -51
- package/src/services/plan-ci-notice.ts +57 -0
- package/src/services/plan-ci-recovery.ts +2 -55
- package/src/services/plan-wake-digest.ts +1 -0
- package/src/services/profile-trust.ts +4 -3
- package/src/services/project-config-read.ts +70 -0
- package/src/services/project-profile-instructions.ts +54 -0
- package/src/services/provisioning-harness/budget-baseline.json +4 -4
- package/src/services/restart-spawn.ts +61 -49
- package/src/services/self-care-state.ts +2 -1
- package/src/services/self-effort.ts +5 -5
- package/src/services/send-message.ts +5 -1
- package/src/services/spawn-agent.ts +13 -2
- package/src/services/spawn-chain-inspector.ts +6 -13
- package/src/services/spawn-policy.ts +68 -0
- package/src/services/spawn-tree-cleanup.ts +2 -2
- package/src/services/task-dispatch.ts +3 -0
- package/src/services/task-state-reconcile.ts +6 -14
- package/src/services/team-templates.ts +9 -8
- package/src/services/transient-agent-reaper.ts +3 -1
- package/src/services/workflow-auto-start.ts +25 -13
- package/src/services/workflow-ci-main.ts +1 -1
- package/src/services/workflow-deferred-cleanup.ts +4 -2
- package/src/services/workflow-effect-driver.ts +2 -0
- package/src/services/workflow-effects.ts +18 -11
- package/src/services/workflow-land-notice.ts +10 -0
- package/src/services/workflow-pause-text.ts +43 -0
- package/src/services/workflow-reconcile.ts +13 -11
- package/src/services/workflow-run-view.ts +2 -0
- package/src/services/workflow-runs.ts +29 -13
- package/src/services/workflow-supervisor-state.ts +5 -0
- package/src/services/workflow-supervisor.ts +7 -3
- package/src/settings/registry.ts +1 -2
- package/src/spawn-command.ts +4 -4
- package/src/spawn-models.ts +10 -12
- package/src/spawn-placement.ts +1 -1
- package/src/spawn-targets.ts +1 -1
- package/src/startup-context-injection.ts +1 -0
- package/src/state-adoption/cd-cutover.ts +53 -7
- package/src/state-adoption/fleet-cutover.ts +35 -0
- package/src/state-adoption/fleet-plan.ts +36 -0
- package/src/state-adoption/index.ts +2 -2
- package/src/state-adoption/linux-plan.ts +2 -2
- package/src/state-adoption/linux.ts +2 -2
- package/src/state-adoption/macos-plan.ts +2 -2
- package/src/state-adoption/macos.ts +1 -1
- package/src/steward.ts +7 -6
- package/src/task-dispatch-live.ts +1 -1
- package/src/task-dispatcher.ts +1 -1
- package/src/teams-config-store.ts +4 -3
- package/src/token-db-write.ts +10 -0
- package/src/workspace-command-settle.ts +2 -1
- package/src/workspace-steward-wake.ts +2 -2
- package/node_modules/@humwick/kernel/LICENSE +0 -167
- package/node_modules/@humwick/kernel/async-entity-persistence.ts +0 -344
- package/node_modules/@humwick/kernel/async-event-log.ts +0 -107
- package/node_modules/@humwick/kernel/automations.pilot.ts +0 -147
- package/node_modules/@humwick/kernel/config.ts +0 -111
- package/node_modules/@humwick/kernel/contract.ts +0 -572
- package/node_modules/@humwick/kernel/control-authz.ts +0 -281
- package/node_modules/@humwick/kernel/control.ts +0 -645
- package/node_modules/@humwick/kernel/effects.ts +0 -493
- package/node_modules/@humwick/kernel/event-log.ts +0 -319
- package/node_modules/@humwick/kernel/http-transport.ts +0 -384
- package/node_modules/@humwick/kernel/identity-grammar.ts +0 -20
- package/node_modules/@humwick/kernel/identity.ts +0 -248
- package/node_modules/@humwick/kernel/index.ts +0 -28
- package/node_modules/@humwick/kernel/kernel-persistence.ts +0 -181
- package/node_modules/@humwick/kernel/landing-incident.ts +0 -306
- package/node_modules/@humwick/kernel/landing.ts +0 -953
- package/node_modules/@humwick/kernel/manifest-validation.ts +0 -460
- package/node_modules/@humwick/kernel/mcp-transport.ts +0 -109
- package/node_modules/@humwick/kernel/message-authority-chaos-worker.ts +0 -200
- package/node_modules/@humwick/kernel/message-authority.ts +0 -281
- package/node_modules/@humwick/kernel/module-host.ts +0 -722
- package/node_modules/@humwick/kernel/openapi-init.ts +0 -14
- package/node_modules/@humwick/kernel/package.json +0 -39
- package/node_modules/@humwick/kernel/persistence-schema.ts +0 -248
- package/node_modules/@humwick/kernel/persistence.ts +0 -510
- package/node_modules/@humwick/kernel/registry.ts +0 -60
- package/node_modules/@humwick/kernel/sqlite-kernel-persistence.ts +0 -499
- package/node_modules/@humwick/kernel/sqlite-module-host.ts +0 -87
- package/node_modules/@humwick/kernel/timers-chaos-worker.ts +0 -186
- package/node_modules/@humwick/kernel/timers.pilot.ts +0 -1411
- package/node_modules/@humwick/kernel/workflow-activation.ts +0 -25
- package/node_modules/@humwick/kernel/workflow-backstop.ts +0 -40
- package/node_modules/@humwick/kernel/workflow-cancel-tree.ts +0 -20
- package/node_modules/@humwick/kernel/workflow-chaos-worker.ts +0 -213
- package/node_modules/@humwick/kernel/workflow-composition.ts +0 -231
- package/node_modules/@humwick/kernel/workflow-container.ts +0 -72
- package/node_modules/@humwick/kernel/workflow-control.test-fixture.ts +0 -42
- package/node_modules/@humwick/kernel/workflow-control.ts +0 -178
- package/node_modules/@humwick/kernel/workflow-definition.ts +0 -507
- package/node_modules/@humwick/kernel/workflow-dispatch.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-foreach.ts +0 -167
- package/node_modules/@humwick/kernel/workflow-journal-codec.ts +0 -339
- package/node_modules/@humwick/kernel/workflow-journal.ts +0 -922
- package/node_modules/@humwick/kernel/workflow-lane.ts +0 -48
- package/node_modules/@humwick/kernel/workflow-lease-owner.ts +0 -60
- package/node_modules/@humwick/kernel/workflow-recovery.test-fixture.ts +0 -19
- package/node_modules/@humwick/kernel/workflow-runtime.ts +0 -938
- package/node_modules/@humwick/kernel/workflow-script.ts +0 -11
- package/node_modules/@humwick/kernel/workflow-state.ts +0 -299
- package/node_modules/@humwick/kernel/workflow-step-commit.ts +0 -195
- package/node_modules/@humwick/kernel/workflow-transitions.ts +0 -317
- package/node_modules/@humwick/kernel/workflow-values.ts +0 -153
- package/node_modules/@humwick/kernel/workflow.pilot.ts +0 -376
- package/node_modules/@humwick/offload/LICENSE +0 -167
- package/node_modules/@humwick/offload/README.md +0 -57
- package/node_modules/@humwick/offload/dist/async-runner.d.ts +0 -18
- package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/async-runner.js +0 -158
- package/node_modules/@humwick/offload/dist/async-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.d.ts +0 -25
- package/node_modules/@humwick/offload/dist/envelope.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/envelope.js +0 -80
- package/node_modules/@humwick/offload/dist/envelope.js.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +0 -10
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +0 -59
- package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +0 -1
- package/node_modules/@humwick/offload/dist/index.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/index.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/index.js +0 -5
- package/node_modules/@humwick/offload/dist/index.js.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +0 -62
- package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/subprocess-runner.js +0 -295
- package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +0 -1
- package/node_modules/@humwick/offload/dist/types.d.ts +0 -111
- package/node_modules/@humwick/offload/dist/types.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/types.js +0 -176
- package/node_modules/@humwick/offload/dist/types.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts +0 -23
- package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-pool.js +0 -435
- package/node_modules/@humwick/offload/dist/worker-pool.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +0 -2
- package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker-runtime.js +0 -27
- package/node_modules/@humwick/offload/dist/worker-runtime.js.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.d.ts +0 -5
- package/node_modules/@humwick/offload/dist/worker.d.ts.map +0 -1
- package/node_modules/@humwick/offload/dist/worker.js +0 -1
- package/node_modules/@humwick/offload/dist/worker.js.map +0 -1
- package/node_modules/@humwick/offload/package.json +0 -42
- package/node_modules/@humwick/offload/src/async-runner.ts +0 -170
- package/node_modules/@humwick/offload/src/envelope.ts +0 -92
- package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +0 -49
- package/node_modules/@humwick/offload/src/index.ts +0 -4
- package/node_modules/@humwick/offload/src/subprocess-runner.ts +0 -334
- package/node_modules/@humwick/offload/src/types.ts +0 -235
- package/node_modules/@humwick/offload/src/worker-pool.ts +0 -463
- package/node_modules/@humwick/offload/src/worker-runtime.ts +0 -32
- package/node_modules/@humwick/offload/src/worker.ts +0 -5
- package/public/assets/agent-liveness-DyqxfB-t.js +0 -2
- package/public/assets/agent-profiles-BpI_jTxq.js +0 -2
- package/public/assets/index-B7ZerHLY.css +0 -2
- package/public/assets/index-BU3uWo2t.js +0 -15
- package/public/assets/projects-B_lmcqfO.js +0 -2
- package/public/assets/provider-display-DbLWpP3j.js +0 -2
- package/public/assets/run-card-CO_bguQf.js +0 -2
- package/public/assets/use-project-list-B-T2Bnnn.js +0 -2
- package/public/assets/versioned-prompt-editor-Diu8BIaM.js +0 -8
- package/runner/src/gate-run-lease-probe.ts +0 -38
- package/src/db/claude-catalog-reconcile.ts +0 -27
- package/src/routing-model-aliases.ts +0 -21
|
@@ -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 c(e){return e===`user`||typeof e==`string`&&e.startsWith(`user:`)}function ee(e){if(e===`user`)return i;if(typeof e==`string`&&e.startsWith(`user:`))return e.slice(5)||`default`}function te(e){return e===`user`||e===o(`default`)||e===`user:`?a:e}var ne=[`system`,`control`,`session`];function re(e){return ne.includes(e??``)}var ie=[`memory`,`memory-area`,`instructions`,`tools`,`comms`,`knowledge`,`context`];function ae(e){return typeof e==`string`&&ie.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 u(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 d=[`decisions`,`actions`,`escalations`,`finalReports`,`failures`];Object.freeze({decisions:`all`,actions:`all`,escalations:`all`,finalReports:`all`,failures:`all`});var ce=/^[a-z][a-z0-9-]*$/,f=new Map,p=[`CLAUDE_CODE_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`,`ANTHROPIC_AUTH_TOKEN`];function m(e){if(!ce.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(f.has(e.id))throw Error(`provider already registered: ${e.id}`);f.set(e.id,e)}function h(e){return f.get(e)}function g(){return[...f.values()]}function le(e,t){let n=f.get(e)?.capabilityDefaults.session?.shellMode,r=t===`read-only`?n?.readOnly:n?.[t];return!!(r&&r!==`unsupported`)}function _(e){return[`open`,`guarded`,`read-only`].filter(t=>le(e,t))}var v=[`low`,`medium`,`high`,`max`],y=[`low`,`medium`,`high`,`xhigh`,`max`],b={value:2e5,source:`catalog`,confidence:`declared`},x={value:1e6,source:`catalog`,confidence:`declared`},ue={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},S=[{name:`five_hour`,unit:`%`,reset:!0},{name:`seven_day`,unit:`%`,reset:!0}];function C(e){return{...e?{limits:e}:{},capabilities:ue}}var w={id:`claude`,credentialEnvKeys:p,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:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`opus-5.5`,label:`Opus 5.5`,providerModel:`claude-opus-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`sonnet-5.5`,label:`Sonnet 5.5`,providerModel:`claude-sonnet-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`fable-5.1`,label:`Fable 5.1`,providerModel:`claude-fable-5-1`,efforts:y,defaultEffort:`high`,...C({contextWindowTokens:x})},{alias:`fable-5`,label:`Fable 5`,providerModel:`claude-fable-5`,efforts:y,defaultEffort:`medium`,unavailable:`suspended by export-control directive, 2026-06-12`,...C({contextWindowTokens:x})},{alias:`opus-4.8`,label:`Opus 4.8`,providerModel:`claude-opus-4-8`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:b})},{alias:`opus-4.8[1m]`,label:`Opus 4.8 1M`,providerModel:`claude-opus-4-8[1m]`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`opus-4.7`,label:`Opus 4.7`,providerModel:`claude-opus-4-7`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:b})},{alias:`opus-4.7[1m]`,label:`Opus 4.7 1M`,providerModel:`claude-opus-4-7[1m]`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`opus-4.6`,label:`Opus 4.6`,providerModel:`claude-opus-4-6`,efforts:v,defaultEffort:`medium`,...C({contextWindowTokens:b})},{alias:`opus-4.6[1m]`,label:`Opus 4.6 1M`,providerModel:`claude-opus-4-6[1m]`,efforts:v,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`sonnet-5`,label:`Sonnet 5`,providerModel:`claude-sonnet-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:b})},{alias:`sonnet-5[1m]`,label:`Sonnet 5 1M`,providerModel:`claude-sonnet-5[1m]`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`haiku`,label:`Haiku`,providerModel:`claude-haiku-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`fable`,label:`Fable`,providerModel:`claude-fable-5-1`,efforts:y,defaultEffort:`high`,...C({contextWindowTokens:x})},{alias:`opus`,label:`Opus`,providerModel:`claude-opus-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`opus[1m]`,label:`Opus 1M`,providerModel:`claude-opus-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`sonnet`,label:`Sonnet`,providerModel:`claude-sonnet-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})},{alias:`sonnet[1m]`,label:`Sonnet 1M`,providerModel:`claude-sonnet-5-5`,efforts:y,defaultEffort:`medium`,...C({contextWindowTokens:x})}]},quotaWindows:[...S],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:[...S]},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`]}},probe:{command:`claude`,args:[`--version`],healthCheck:`claude --version`,featureChecks:[{name:`rig`,command:`claude-rig`,homeDir:`.claude-rig`}],authCheck:{command:`claude`,args:[`auth`,`status`,`--json`],loginArgs:[`auth`,`login`]}},quotaPoll:{strategy:`none`},shim:{kind:`claude-relay`},mcpToolManifest:{clientNativeToolDeferral:!0,runnerManagedToolDeferral:!1}};m(w),m({...w,id:`claude-b`,label:`Claude B`,home:{...w.home,configDir:`.claude-b`,dedicatedHome:!0}}),m({...w,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:[...p,`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:{...w.home,configDir:`.claude-api`,sourceEnvVar:`CLAUDE_API_CONFIG_DIR`,dedicatedHome:!0,authItems:[]},launchModes:void 0,quotaWindows:[],capabilityDefaults:{...w.capabilityDefaults,quota:{supported:!1,source:`runtime`,unit:`USD`,windows:[]}}});var T=[`low`,`medium`,`high`,`xhigh`],E={value:2e5,source:`catalog`,confidence:`declared`},D={value:5e5,source:`catalog`,confidence:`declared`},de={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},O=[{name:`primary`,unit:`%`,reset:!0},{name:`secondary`,unit:`%`,reset:!0}];function k(e){return{...e?{limits:e}:{},capabilities:de}}m({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:T,defaultEffort:`medium`,...k({contextWindowTokens:D})},{alias:`luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-6-sol`,label:`GPT-6 Sol`,providerModel:`gpt-6-sol`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-6.1-sol`,label:`GPT-6.1 Sol`,providerModel:`gpt-6.1-sol`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:D})},{alias:`gpt-6-luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,providerModel:`gpt-5.6-terra`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.5`,label:`GPT-5.5`,providerModel:`gpt-5.5`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.4`,label:`GPT-5.4`,providerModel:`gpt-5.4`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.4-mini`,label:`GPT-5.4 Mini`,providerModel:`gpt-5.4-mini`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.3-codex`,label:`GPT-5.3 Codex`,providerModel:`gpt-5.3-codex`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})},{alias:`gpt-5.3-codex-spark`,label:`GPT-5.3 Codex Spark`,providerModel:`gpt-5.3-codex-spark`,efforts:T,defaultEffort:`high`,...k({contextWindowTokens:E})},{alias:`gpt-5.2`,label:`GPT-5.2`,providerModel:`gpt-5.2`,efforts:T,defaultEffort:`medium`,...k({contextWindowTokens:E})}]},quotaWindows:[...O],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:[...O]},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 A={mode:`attach`,attach:{create:!0,read:!0,write:!0,detach:!0}},j=`opencode-ai@latest`;m({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:A,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:[j],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 M=[{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)`}],fe={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`estimated`};function N(e,t){return{alias:e,label:t,providerModel:e,efforts:[],capabilities:fe}}m({id:`opencode-go`,label:`OpenCode Go`,icon:`⚡`,defaultEnabled:!1,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`glm-5.3-flash`,models:[N(`claude-haiku-5-5`,`Claude Haiku 5.5`),N(`deepseek-v4-pro`,`DeepSeek V4 Pro`),N(`deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`),N(`gemini-4-argon-contributor`,`Gemini 4 Argon Contributor`),N(`glm-5.2`,`GLM-5.2`),N(`glm-5.3`,`GLM-5.3`),N(`glm-5.3-flash`,`GLM-5.3 Flash`),N(`gpt-5.6-luna`,`GPT-5.6 Luna`),N(`gpt-6-luna`,`GPT-6 Luna`),N(`grok-4.6`,`Grok 4.6`),N(`grok-4.7`,`Grok 4.7`),N(`hy3`,`Hy3`),N(`hy4-preview`,`Hy4 Preview`),N(`kimi-k2.7-code`,`Kimi K2.7 Code`),N(`kimi-k3`,`Kimi K3`),N(`longcat-2.0`,`LongCat 2.0`),N(`mimo-v2.5`,`MiMo V2.5`),N(`mimo-v2.5-pro`,`MiMo V2.5 Pro`),N(`mimo-v2.6-flash`,`MiMo V2.6 Flash`),N(`mimo-v2.6-pro`,`MiMo V2.6 Pro`),N(`minimax-m2.7`,`MiniMax M2.7`),N(`minimax-m3`,`MiniMax M3`),N(`muse-spark-1.2-contributor`,`Muse Spark 1.2 Contributor`),N(`muse-spark-1.3-contributor`,`Muse Spark 1.3 Contributor`),N(`qwen3.7-plus`,`Qwen3.7 Plus`),N(`qwen3.8-flash`,`Qwen3.8 Flash`),N(`qwen3.8-max`,`Qwen3.8 Max`),N(`space-bunny`,`Space Bunny`)]},quotaWindows:[...M],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:[...M]},terminal:A,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:[j],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 P={value:1e6,source:`catalog`,confidence:`declared`},F={value:131072,source:`catalog`,confidence:`declared`},pe={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},me={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},I=[{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`}];m({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:P,maxOutputTokens:F},capabilities:pe},{alias:`glm-5.3-flash`,label:`GLM-5.3 Flash`,providerModel:`glm-5.3-flash`,efforts:[],limits:{contextWindowTokens:P,maxOutputTokens:F},capabilities:me}]},quotaWindows:[...I],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:[...I]},terminal:A,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:[j],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 L={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}},R=class extends Error{candidates;constructor(e,t){super(e),this.candidates=t,this.name=`OpenCodeModelResolutionError`}},z=8;function B(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 he(e,t,n){let r=e.trim();if(!r)throw new R(`OpenCode model id is empty.`,[]);let i=r.indexOf(`/`),a=i>0?r.slice(0,i):void 0;if(!n)return a&&(a===t||L[a]!==void 0)?B(r,t):{backendID:t,modelID:r,qualified:`${t}/${r}`};if(n.models.has(r))return B(r,t);if(n.models.has(`${t}/${r}`))return{backendID:t,modelID:r,qualified:`${t}/${r}`};if(a&&n.providers.has(a))return B(r,t);if(!a){let e=[...n.models].filter(e=>e.slice(e.indexOf(`/`)+1)===r);if(e.length===1)return B(e[0],t);if(e.length>1){let t=e.sort().slice(0,z);throw new R(`OpenCode model "${r}" is ambiguous on this host (${n.source} registry); qualify it as one of: ${t.join(`, `)}.`,t)}}let o=ge(r,n),s=o.length?` Did you mean: ${o.join(`, `)}?`:``;throw new R(`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 ge(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,z)}var _e=[`off`,`quiet`,`normal`,`verbose`];g().map(e=>e.id);var V=[`narration`,`tools`,`reasoning`,`memories`,`startup`,`injected`,`agentMessages`,`workflow`,`land`,`task`,`agents`,`other`,`undelivered`],ve=[`workflow`,`land`,`task`,`agents`,`other`];function H(e){return Object.fromEntries(V.map(t=>[t,e(t)]))}var U=H(e=>ve.includes(e)),W={calm:U,everything:H(()=>!0)};function ye(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return H(e=>typeof t[e]==`boolean`?t[e]:U[e])}function be(e){for(let[t,n]of Object.entries(W))if(V.every(t=>n[t]===e[t]))return t;return null}function xe(e,t){let n=e?.opencodeProviderID,r=t?.trim();if(!(!n||!r))return he(r,n).qualified}function Se(e){return!e?.disabled}var Ce=.1,we=.9,G=.8,K=.4,q=256e3,J=1e6;function Te(){return g().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 Ee(e){let t=De(e);return{selfCompactUtilization:t,warnUtilization:Oe(t),hardBackstopUtilization:Math.max(we,t)}}function De(e){return!Number.isFinite(e)||!e||e<=q?G:e>=J?K:Y(G-(e-q)/(J-q)*(G-K))}function Oe(e){return Y(Math.max(0,e-Ce))}function Y(e){return Math.round(e*1e3)/1e3}function X(e,t){if(e)return(t??Te()).find(t=>t.provider===e)}function ke(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=Ae(e,t,n.requireUnambiguous),a=je(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 Ae(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 je(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 Me(e){return!e.disabled&&!e.unavailable}function Ne(e){let t=e.defaultModel,n=t?e.models.find(e=>e.alias===t):void 0;return n&&Me(n)?{alias:n.alias,preferred:t,fellBack:!1}:{alias:void 0,preferred:t,fellBack:!0}}function Pe(e){return h(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 Fe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}var $=new Map(g().map((e,t)=>[e.id,Q[t%Q.length]]));function Ie(e){return e?h(e)?.label??e.charAt(0).toUpperCase()+e.slice(1):`Unknown provider`}function Le(e){let t=$.get(e);if(t)return t;let n=Q[Fe(e)%Q.length];return $.set(e,n),n}function Re(){return g().map(e=>e.id)}function ze(e){return h(e)}function Be(e,t){let n=e?.id||e?.alias;if(!e||!n)return;let r=X(e.provider,t),i=r?ke(r,[e.alias||``,n]):void 0;return{label:i?.label||n,...i?{entry:i}:{}}}export{o as A,se as C,te as D,a as E,n as M,e as N,c as O,t as P,ae as S,i as T,_,Pe as a,u as b,X as c,Ne as d,U as f,_e as g,ye as h,ze as i,r as j,ee as k,Se as l,be as m,Le as n,Be as o,W as p,Ie as r,Ee as s,Re as t,xe as u,d as v,s as w,re as x,l as y};
|
|
2
|
+
//# sourceMappingURL=provider-display-DsuWMvVL.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-DsuWMvVL.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-Cw38_6gW.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-DcClXLH0.js";import{h as a}from"./display-BrKWFGJz.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./agent-liveness-CaNwK0Zf.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-DAZcj5qt.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./input-CsTB6jIx.js";import{t as v}from"./crate-agent-30aXTKva.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=e=>e.kind===`agent`?`/agents/${encodeURIComponent(e.agentId)}/spawn-budget`:`/workflows/runs/${encodeURIComponent(e.runId)}/budget`;function C(e,t){return e.kind===`agent`?t.budgets.find(t=>t.subtreeAgentId===e.agentId):t}function w(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 T({target:e}){return(0,b.jsx)(E,{target:e},S(e))}function E({target:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)(),[a,s]=(0,y.useState)(``),c=S(e);if((0,y.useEffect)(()=>{let t=!0,r=()=>o(`GET`,c).then(r=>{t&&n(C(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(C(e,r)??t),i(void 0),s(``)}catch(e){s(e instanceof Error?e.message:`Could not save the budget`)}},u=w(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 D({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 O=`land`,k=`ci-main`,A={pass:`CI pass`,fail:`CI red`,none:`no CI`};function j(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:O},...e.ciMain?[{name:k}]:[]],i=!!e.landedSha||e.status===`done`||e.step===`ci-main`;return r.map(t=>{let r=t.name===`ci-main`&&e.output?.ci?A[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 M(e){if(e.status!==`running`||!e.awaiting)return;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 N(e){return e.reapedAt?`reaped`:e.exitedAt?`exited`:e.keptAt?`kept`:e.readyAt?`ready`:`starting`}function P(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 F=[`provider`,`model`,`effort`,`orchestratorId`],I={start:`start call`,resume:`resume`,team:`team default`,global:`global default`,workflow:`workflow file`};function L(e){let t=F.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]} (${I[e.from[t]??`workflow`]})`).join(`, `)}}function R(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?`, ${A[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 z={done:`done`,current:`current step`,waiting:`not reached`,stopped:`stopped here`};function B({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)(D,{text:t,className:`font-medium`})]})}function V({node:e,run:t}){let n=e.state===`current`?M(t):void 0,r=L(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}: ${z[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)(D,{text:e.name,className:`text-sm font-semibold`}),e.role&&(0,b.jsx)(D,{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 H({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:j(e).map(t=>(0,b.jsx)(V,{node:t,run:e},t.name))})}function U({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=P(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,`, `,N(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 W({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 G({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)(D,{text:e.workflow})]}),(0,b.jsx)(`div`,{className:`min-w-0 flex-1 text-sm`,children:(0,b.jsx)(B,{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)(D,{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)(T,{target:{kind:`run`,runId:e.runId}}),(0,b.jsx)(W,{run:e}),(0,b.jsx)(H,{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)(U,{run:e,agentsById:t,now:n})]})}function K({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)(D,{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)(B,{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:R(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)(T,{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)(D,{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{D as a,k as i,G as n,B as r,K as t};
|
|
2
|
+
//# sourceMappingURL=run-card-CpKqRbhg.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./dist-DeW2Y1R5.js";var t=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]);export{t};
|
|
2
|
+
//# sourceMappingURL=scroll-text-BKXS1ahr.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-BvtFdlGX.js";import{M as N}from"./provider-display-DbLWpP3j.js";import{et as P,f as F,v as I}from"./display-CfO7rTuF.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-0kp2oNBC.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-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-DxI-vzSq.js.map
|
package/public/assets/{service-access-settings-C3aujqTG.js → service-access-settings-D9s_VJbd.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{et as a,h as o,v as s}from"./display-CfO7rTuF.js";import{t as c}from"./api-CIIVBtAV.js";import{t as l}from"./button-Do6Z3vvn.js";import{t as u}from"./textarea-hs6Mpyfl.js";var d=t(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),f=t(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),p=t(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),m=t(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),h=t(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),g=t(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=t(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),v=t(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),y=e(r(),1),b=i(),x={healthy:`bg-tone-success/10 text-tone-success-fg`,degraded:`bg-tone-warning/10 text-tone-warning-fg`,unknown:`bg-tone-neutral/10 text-tone-neutral-fg`,down:`bg-tone-danger/10 text-tone-danger-fg`},S={healthy:`Healthy`,degraded:`Degraded`,unknown:`Unknown`,down:`Down`},C=[`healthy`,`degraded`,`unknown`,`down`],w=e=>e.reduce((e,t)=>C.indexOf(t)>C.indexOf(e)?t:e,`healthy`),T={not_configured:`No service catalog is configured`,host_unconfigured:`No broker host is set in the catalog (broker.orchestratorId)`,host_unobserved:`Broker host has not reported yet`,host_stale:`Broker host report is out of date`,host_probe_failed:`Broker host health could not be read`,native_down:`Agent Vault service is not running`,watchdog_down:`Freshness watchdog is not running`,ingress_closed:`Proxy ingress is closed`,refresh_missing:`No upstream credential refresh state on the host`,refresh_invalid:`Upstream credential refresh state is unreadable`,refresh_failed:`Upstream credential refresh failed`,refresh_in_progress:`Upstream credential refresh in progress`,credential_expired:`Upstream credential has expired`,vault_unobserved:`Vault has not been checked yet`,vault_stale:`Vault check is out of date`,vault_unreachable:`Vault control API is unreachable`,sync_unknown:`Vault reports no sync state`,sync_failed:`Last credential sync failed`,sync_stale:`No credential sync in the last 15 minutes`,logs_failed:`Request log collection failed`,logs_lagging:`Request log collection is behind`,logs_backlog:`More request logs are waiting to be collected`};function E({state:e}){return(0,b.jsx)(`span`,{className:n(`rounded px-1.5 py-0.5 text-xs font-medium`,x[e]),children:S[e]})}function D({reasons:e}){return e.length?(0,b.jsx)(`ul`,{className:`list-disc pl-5 text-xs`,children:e.map(e=>(0,b.jsx)(`li`,{children:T[e]??e},e))}):null}function O({now:e,at:t,empty:n=`Never`}){return t?(0,b.jsx)(`time`,{dateTime:new Date(t).toISOString(),title:s(t),children:t>e?`in ${o(t,e)}`:a(e,t)}):(0,b.jsx)(b.Fragment,{children:n})}async function k(e){try{return{value:await e}}catch(e){return{error:e.message}}}async function A(e){let t=new URLSearchParams({limit:`50`,...e?{profile:e}:{}}),[n,r]=await Promise.all([k(c(`GET`,`/service-access/health`)),k(c(`GET`,`/service-access/logs?${t}`))]);return{health:n,logs:r}}function j({profile:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1);function f(e){n(e.health),`value`in e.logs?(i(e.logs.value),o(``)):(i(null),o(e.logs.error))}(0,y.useEffect)(()=>{let t=!0;return A(e).then(e=>{t&&f(e)}),()=>{t=!1}},[e]);async function p(){d(!0);try{f(await A(e))}finally{d(!1)}}async function m(){if(r?.next){d(!0);try{let t=await c(`GET`,`/service-access/logs?${new URLSearchParams({limit:`50`,before:r.next,...e?{profile:e}:{}})}`);i({logs:[...r.logs,...t.logs],...t.next?{next:t.next}:{}}),o(``)}catch(e){o(e.message)}finally{d(!1)}}}let h=t&&`value`in t?t.value:null,g=t&&`error`in t?t.error:``,_=h?.evaluatedAt??0,v=h?.vaults.filter(t=>!e||t.profile===e)??[],x=h?.host,S=g?`unknown`:e&&h?w([v[0]?.state??`unknown`,x?.state??`unknown`]):h?.state;return(0,b.jsxs)(`section`,{"aria-label":`Service access health`,className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h3`,{className:`font-semibold`,children:e?`Vault health`:`Health`}),S&&(0,b.jsx)(E,{state:S}),h&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Checked `,s(_)]}),(0,b.jsx)(l,{size:`sm`,variant:`outline`,disabled:u,onClick:p,children:`Refresh`})]}),g&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Health unavailable: `,g]}),h&&!e&&(0,b.jsx)(D,{reasons:h.reasons}),x&&(0,b.jsxs)(`div`,{"aria-label":`Broker host`,className:`rounded border p-2 text-sm space-y-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`strong`,{children:[`Broker host `,x.orchestratorId]}),(0,b.jsx)(E,{state:x.state})]}),x.units?(0,b.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3 text-xs`,children:[(0,b.jsx)(`dt`,{children:`Proxy ingress`}),(0,b.jsx)(`dd`,{children:x.units.ingress===`active`?`Open`:`Closed (${x.units.ingress})`}),(0,b.jsx)(`dt`,{children:`Agent Vault`}),(0,b.jsx)(`dd`,{children:x.units.native}),(0,b.jsx)(`dt`,{children:`Watchdog`}),(0,b.jsx)(`dd`,{children:x.units.watchdog}),(0,b.jsx)(`dt`,{children:`Credential refresh`}),(0,b.jsxs)(`dd`,{children:[x.refresh?.status??`unknown`,x.refresh?.phase?` (${x.refresh.phase})`:``,x.refresh?.lastSuccessAt?(0,b.jsxs)(b.Fragment,{children:[`, last success `,(0,b.jsx)(O,{now:_,at:x.refresh.lastSuccessAt})]}):null]}),(0,b.jsx)(`dt`,{children:`Upstream credential expiry`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:x.refresh?.credentialExpiresAt,empty:`Unknown`})}),(0,b.jsx)(`dt`,{children:`Host checked`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:x.checkedAt||void 0})})]}):(0,b.jsxs)(`p`,{className:`text-xs`,children:[`Host checked `,(0,b.jsx)(O,{now:_,at:x.checkedAt||void 0}),x.error?` · ${x.error}`:``]}),e&&(0,b.jsx)(D,{reasons:x.reasons})]}),v.map(e=>(0,b.jsxs)(`div`,{"aria-label":`Vault ${e.profile}`,className:`rounded border p-2 text-sm space-y-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`strong`,{children:e.profile}),(0,b.jsx)(E,{state:e.state}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.vault})]}),(0,b.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3 text-xs`,children:[(0,b.jsx)(`dt`,{children:`Credential sync`}),(0,b.jsx)(`dd`,{children:e.error?`Unreachable (${e.error})`:e.sync?(0,b.jsxs)(b.Fragment,{children:[e.sync.failed?`failed`:e.sync.status,`, `,(0,b.jsx)(O,{now:_,at:e.sync.syncedAt})]}):`Unknown`}),(0,b.jsx)(`dt`,{children:`Request logs`}),(0,b.jsxs)(`dd`,{children:[e.logs.stored,` stored, collected `,(0,b.jsx)(O,{now:_,at:e.logs.collectedAt}),e.logs.backlog?`, backlog pending`:``,e.logs.evicted?`, ${e.logs.evicted} removed by the storage cap`:``,e.logs.error?` · ${e.logs.error}`:``]}),(0,b.jsx)(`dt`,{children:`Vault checked`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:e.checkedAt})})]}),(0,b.jsx)(D,{reasons:e.reasons})]},e.vault)),h&&e&&!v.length&&(0,b.jsx)(`p`,{className:`text-sm`,children:`No vault for this profile yet. Save the profile and reconcile.`}),(r||a)&&(0,b.jsxs)(`section`,{"aria-label":`Unattributed request logs`,className:`space-y-1`,children:[(0,b.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Request logs (unattributed)`}),a&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-xs`,children:[`Request logs unavailable: `,a]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Logged per vault and profile. A request is not linked to the agent that made it. Paths omit query strings and credential-like parts.`}),r?.logs.length?(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`text-left`,children:[(0,b.jsx)(`th`,{className:`pr-2`,children:`Time`}),!e&&(0,b.jsx)(`th`,{className:`pr-2`,children:`Profile`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Request`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Service`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Status`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Latency`}),(0,b.jsx)(`th`,{children:`Attribution`})]})}),(0,b.jsx)(`tbody`,{children:r.logs.map(t=>(0,b.jsxs)(`tr`,{className:`border-t align-top`,children:[(0,b.jsx)(`td`,{className:`pr-2 whitespace-nowrap`,children:(0,b.jsx)(`time`,{dateTime:new Date(t.at).toISOString(),children:s(t.at)})}),!e&&(0,b.jsx)(`td`,{className:`pr-2`,children:t.profile}),(0,b.jsxs)(`td`,{className:`pr-2 break-all`,children:[t.method,` `,t.host,t.path]}),(0,b.jsx)(`td`,{className:`pr-2`,children:t.service??`Unmatched`}),(0,b.jsxs)(`td`,{className:`pr-2`,children:[t.status||`—`,t.errorCode?` ${t.errorCode}`:``]}),(0,b.jsxs)(`td`,{className:`pr-2`,children:[t.latencyMs,` ms`]}),(0,b.jsx)(`td`,{children:`Unattributed`})]},`${t.vault}:${t.id}`))})]})}):r&&(0,b.jsx)(`p`,{className:`text-xs`,children:`No requests logged.`}),r?.next&&(0,b.jsx)(l,{size:`sm`,variant:`outline`,disabled:u,onClick:m,children:`Load older`})]})]})}var M={catalog:{broker:{controlUrl:``,proxyUrl:``,caFingerprint:``,projectId:``},services:[]},profiles:{}};function N({states:e,profile:t}){return(0,b.jsx)(`div`,{className:`space-y-2`,children:e.filter(e=>!t||e.profile===t).map(e=>(0,b.jsxs)(`div`,{className:`rounded border p-2 text-sm`,children:[(0,b.jsx)(`strong`,{children:e.profile}),`: `,e.services.join(`, `)||`No services`,` — `,e.status,(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Vault: `,e.vault]}),(0,b.jsxs)(`div`,{className:`break-all text-xs`,children:[`Desired: `,e.desiredRevision]}),(0,b.jsxs)(`div`,{className:`break-all text-xs`,children:[`Applied: `,e.appliedRevision??`None`]}),e.error&&(0,b.jsxs)(`div`,{role:`alert`,children:[e.error.code,`: `,e.error.message]})]},e.profile))})}function P(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(`{"service":"fixture","profile":"sec-ops","ungrantedProfile":"worker","negativePath":"/missing-rule"}`),[o,s]=(0,y.useState)(``),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1);async function h(){let e=await c(`GET`,`/service-access`);t(e),r(JSON.stringify(e.catalog?{catalog:e.catalog,profiles:Object.fromEntries(e.profiles.map(e=>[e.profile,{services:e.services,...e.vaultOverride?{vault:e.vaultOverride}:{}}]))}:M,null,2))}(0,y.useEffect)(()=>{h().catch(e=>s(e.message))},[]);async function g(e){m(!0),s(``),f(``);try{await c(`POST`,`/service-access/${e}`,e===`apply`?JSON.parse(n):e===`test`?JSON.parse(i):{}),f(e===`test`?`Probe passed: positive, missing rule and ungranted profile`:`Service access applied`),await h()}catch(e){s(e.message);try{t(await c(`GET`,`/service-access`))}catch{}}finally{m(!1)}}return(0,b.jsxs)(`section`,{className:`space-y-3`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Service access`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Profile services use Agent Vault. Enter Infisical key references and dummy variables only. Broker environment and secretPath select the existing store; profile vault adopts an existing native vault. Set broker orchestratorId to apply the same binding to its refresh job and watchdog and to show their health.`}),(0,b.jsxs)(`label`,{className:`block text-sm`,children:[`Catalog and profile mappings (JSON)`,(0,b.jsx)(u,{"aria-label":`Catalog and profile mappings (JSON)`,rows:16,value:n,onChange:e=>r(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(l,{disabled:p||!e,onClick:()=>g(`apply`),children:`Save and apply`}),(0,b.jsx)(l,{variant:`outline`,disabled:p||!e?.catalog,onClick:()=>g(`reconcile`),children:`Reconcile`}),(0,b.jsx)(l,{variant:`outline`,disabled:p,onClick:()=>{s(``),h().catch(e=>s(e.message))},children:`Reload`})]}),o&&(0,b.jsx)(`p`,{role:`alert`,children:o}),d&&(0,b.jsx)(`p`,{role:`status`,children:d}),e&&(0,b.jsx)(N,{states:e.profiles}),e?.catalog&&(0,b.jsx)(j,{}),!!e?.cleanup?.length&&(0,b.jsxs)(`section`,{"aria-label":`Removed profile cleanup`,className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`font-semibold`,children:`Removed profile cleanup`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`These profiles were removed. Their vault cleanup stays visible here and is excluded from editable mappings.`}),(0,b.jsx)(N,{states:e.cleanup})]}),(0,b.jsxs)(`label`,{className:`block text-sm`,children:[`Fixture probe (JSON)`,(0,b.jsx)(u,{"aria-label":`Fixture probe (JSON)`,value:i,onChange:e=>a(e.target.value)})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Uses safe GETs against your fixture/test service: granted path, missing rule, ungranted profile. The service must reject dummy auth with 401 or 403.`}),(0,b.jsx)(l,{variant:`outline`,disabled:p||!e?.catalog,onClick:()=>g(`test`),children:`Test fixture`})]})}function F({profile:e,onChange:t,readOnly:n}){let[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(``);(0,y.useEffect)(()=>{let e=!0;return c(`GET`,`/service-access`).then(t=>{e&&i(t)}).catch(t=>{e&&o(t.message)}),()=>{e=!1}},[]);let s=e.serviceAccess?.services??[];return(0,b.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,b.jsx)(`p`,{children:`Standing access through this profile. Save the profile, then reconcile in Settings → Service access.`}),(0,b.jsxs)(`label`,{className:`block`,children:[`Native vault (optional)`,(0,b.jsx)(`input`,{"aria-label":`Native vault (optional)`,className:`ml-2 rounded border bg-background p-1`,disabled:n,value:e.serviceAccess?.vault??``,placeholder:`Derived from profile name`,onChange:e=>t({services:s,...e.target.value?{vault:e.target.value}:{}})})]}),r?.catalog?.services.map(r=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,disabled:n,checked:s.includes(r.name),onChange:n=>t({...e.serviceAccess,services:n.target.checked?[...s,r.name]:s.filter(e=>e!==r.name)})}),r.name,` (`,r.host,r.path,`)`]},r.name)),!r?.catalog&&(0,b.jsx)(`p`,{children:`No catalog configured. Open Settings → Service access.`}),s.filter(e=>!r?.catalog?.services.some(t=>t.name===e)).map(e=>(0,b.jsxs)(`p`,{children:[`Unknown service: `,e]},e)),a&&(0,b.jsx)(`p`,{role:`alert`,children:a}),r&&(0,b.jsx)(N,{states:r.profiles,profile:e.name}),r?.catalog&&r.profiles.some(t=>t.profile===e.name)&&(0,b.jsx)(j,{profile:e.name})]})}export{g as a,p as c,_ as i,f as l,P as n,h as o,v as r,m as s,F as t,d as u};
|
|
2
|
-
//# sourceMappingURL=service-access-settings-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{et as a,h as o,v as s}from"./display-BrKWFGJz.js";import{t as c}from"./api-CIIVBtAV.js";import{t as l}from"./button-Do6Z3vvn.js";import{t as u}from"./textarea-hs6Mpyfl.js";var d=t(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),f=t(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),p=t(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),m=t(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),h=t(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),g=t(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=t(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),v=t(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),y=e(r(),1),b=i(),x={healthy:`bg-tone-success/10 text-tone-success-fg`,degraded:`bg-tone-warning/10 text-tone-warning-fg`,unknown:`bg-tone-neutral/10 text-tone-neutral-fg`,down:`bg-tone-danger/10 text-tone-danger-fg`},S={healthy:`Healthy`,degraded:`Degraded`,unknown:`Unknown`,down:`Down`},C=[`healthy`,`degraded`,`unknown`,`down`],w=e=>e.reduce((e,t)=>C.indexOf(t)>C.indexOf(e)?t:e,`healthy`),T={not_configured:`No service catalog is configured`,host_unconfigured:`No broker host is set in the catalog (broker.orchestratorId)`,host_unobserved:`Broker host has not reported yet`,host_stale:`Broker host report is out of date`,host_probe_failed:`Broker host health could not be read`,native_down:`Agent Vault service is not running`,watchdog_down:`Freshness watchdog is not running`,ingress_closed:`Proxy ingress is closed`,refresh_missing:`No upstream credential refresh state on the host`,refresh_invalid:`Upstream credential refresh state is unreadable`,refresh_failed:`Upstream credential refresh failed`,refresh_in_progress:`Upstream credential refresh in progress`,credential_expired:`Upstream credential has expired`,vault_unobserved:`Vault has not been checked yet`,vault_stale:`Vault check is out of date`,vault_unreachable:`Vault control API is unreachable`,sync_unknown:`Vault reports no sync state`,sync_failed:`Last credential sync failed`,sync_stale:`No credential sync in the last 15 minutes`,logs_failed:`Request log collection failed`,logs_lagging:`Request log collection is behind`,logs_backlog:`More request logs are waiting to be collected`};function E({state:e}){return(0,b.jsx)(`span`,{className:n(`rounded px-1.5 py-0.5 text-xs font-medium`,x[e]),children:S[e]})}function D({reasons:e}){return e.length?(0,b.jsx)(`ul`,{className:`list-disc pl-5 text-xs`,children:e.map(e=>(0,b.jsx)(`li`,{children:T[e]??e},e))}):null}function O({now:e,at:t,empty:n=`Never`}){return t?(0,b.jsx)(`time`,{dateTime:new Date(t).toISOString(),title:s(t),children:t>e?`in ${o(t,e)}`:a(e,t)}):(0,b.jsx)(b.Fragment,{children:n})}async function k(e){try{return{value:await e}}catch(e){return{error:e.message}}}async function A(e){let t=new URLSearchParams({limit:`50`,...e?{profile:e}:{}}),[n,r]=await Promise.all([k(c(`GET`,`/service-access/health`)),k(c(`GET`,`/service-access/logs?${t}`))]);return{health:n,logs:r}}function j({profile:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1);function f(e){n(e.health),`value`in e.logs?(i(e.logs.value),o(``)):(i(null),o(e.logs.error))}(0,y.useEffect)(()=>{let t=!0;return A(e).then(e=>{t&&f(e)}),()=>{t=!1}},[e]);async function p(){d(!0);try{f(await A(e))}finally{d(!1)}}async function m(){if(r?.next){d(!0);try{let t=await c(`GET`,`/service-access/logs?${new URLSearchParams({limit:`50`,before:r.next,...e?{profile:e}:{}})}`);i({logs:[...r.logs,...t.logs],...t.next?{next:t.next}:{}}),o(``)}catch(e){o(e.message)}finally{d(!1)}}}let h=t&&`value`in t?t.value:null,g=t&&`error`in t?t.error:``,_=h?.evaluatedAt??0,v=h?.vaults.filter(t=>!e||t.profile===e)??[],x=h?.host,S=g?`unknown`:e&&h?w([v[0]?.state??`unknown`,x?.state??`unknown`]):h?.state;return(0,b.jsxs)(`section`,{"aria-label":`Service access health`,className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h3`,{className:`font-semibold`,children:e?`Vault health`:`Health`}),S&&(0,b.jsx)(E,{state:S}),h&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Checked `,s(_)]}),(0,b.jsx)(l,{size:`sm`,variant:`outline`,disabled:u,onClick:p,children:`Refresh`})]}),g&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Health unavailable: `,g]}),h&&!e&&(0,b.jsx)(D,{reasons:h.reasons}),x&&(0,b.jsxs)(`div`,{"aria-label":`Broker host`,className:`rounded border p-2 text-sm space-y-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`strong`,{children:[`Broker host `,x.orchestratorId]}),(0,b.jsx)(E,{state:x.state})]}),x.units?(0,b.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3 text-xs`,children:[(0,b.jsx)(`dt`,{children:`Proxy ingress`}),(0,b.jsx)(`dd`,{children:x.units.ingress===`active`?`Open`:`Closed (${x.units.ingress})`}),(0,b.jsx)(`dt`,{children:`Agent Vault`}),(0,b.jsx)(`dd`,{children:x.units.native}),(0,b.jsx)(`dt`,{children:`Watchdog`}),(0,b.jsx)(`dd`,{children:x.units.watchdog}),(0,b.jsx)(`dt`,{children:`Credential refresh`}),(0,b.jsxs)(`dd`,{children:[x.refresh?.status??`unknown`,x.refresh?.phase?` (${x.refresh.phase})`:``,x.refresh?.lastSuccessAt?(0,b.jsxs)(b.Fragment,{children:[`, last success `,(0,b.jsx)(O,{now:_,at:x.refresh.lastSuccessAt})]}):null]}),(0,b.jsx)(`dt`,{children:`Upstream credential expiry`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:x.refresh?.credentialExpiresAt,empty:`Unknown`})}),(0,b.jsx)(`dt`,{children:`Host checked`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:x.checkedAt||void 0})})]}):(0,b.jsxs)(`p`,{className:`text-xs`,children:[`Host checked `,(0,b.jsx)(O,{now:_,at:x.checkedAt||void 0}),x.error?` · ${x.error}`:``]}),e&&(0,b.jsx)(D,{reasons:x.reasons})]}),v.map(e=>(0,b.jsxs)(`div`,{"aria-label":`Vault ${e.profile}`,className:`rounded border p-2 text-sm space-y-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`strong`,{children:e.profile}),(0,b.jsx)(E,{state:e.state}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.vault})]}),(0,b.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3 text-xs`,children:[(0,b.jsx)(`dt`,{children:`Credential sync`}),(0,b.jsx)(`dd`,{children:e.error?`Unreachable (${e.error})`:e.sync?(0,b.jsxs)(b.Fragment,{children:[e.sync.failed?`failed`:e.sync.status,`, `,(0,b.jsx)(O,{now:_,at:e.sync.syncedAt})]}):`Unknown`}),(0,b.jsx)(`dt`,{children:`Request logs`}),(0,b.jsxs)(`dd`,{children:[e.logs.stored,` stored, collected `,(0,b.jsx)(O,{now:_,at:e.logs.collectedAt}),e.logs.backlog?`, backlog pending`:``,e.logs.evicted?`, ${e.logs.evicted} removed by the storage cap`:``,e.logs.error?` · ${e.logs.error}`:``]}),(0,b.jsx)(`dt`,{children:`Vault checked`}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(O,{now:_,at:e.checkedAt})})]}),(0,b.jsx)(D,{reasons:e.reasons})]},e.vault)),h&&e&&!v.length&&(0,b.jsx)(`p`,{className:`text-sm`,children:`No vault for this profile yet. Save the profile and reconcile.`}),(r||a)&&(0,b.jsxs)(`section`,{"aria-label":`Unattributed request logs`,className:`space-y-1`,children:[(0,b.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Request logs (unattributed)`}),a&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-xs`,children:[`Request logs unavailable: `,a]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Logged per vault and profile. A request is not linked to the agent that made it. Paths omit query strings and credential-like parts.`}),r?.logs.length?(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`text-left`,children:[(0,b.jsx)(`th`,{className:`pr-2`,children:`Time`}),!e&&(0,b.jsx)(`th`,{className:`pr-2`,children:`Profile`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Request`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Service`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Status`}),(0,b.jsx)(`th`,{className:`pr-2`,children:`Latency`}),(0,b.jsx)(`th`,{children:`Attribution`})]})}),(0,b.jsx)(`tbody`,{children:r.logs.map(t=>(0,b.jsxs)(`tr`,{className:`border-t align-top`,children:[(0,b.jsx)(`td`,{className:`pr-2 whitespace-nowrap`,children:(0,b.jsx)(`time`,{dateTime:new Date(t.at).toISOString(),children:s(t.at)})}),!e&&(0,b.jsx)(`td`,{className:`pr-2`,children:t.profile}),(0,b.jsxs)(`td`,{className:`pr-2 break-all`,children:[t.method,` `,t.host,t.path]}),(0,b.jsx)(`td`,{className:`pr-2`,children:t.service??`Unmatched`}),(0,b.jsxs)(`td`,{className:`pr-2`,children:[t.status||`—`,t.errorCode?` ${t.errorCode}`:``]}),(0,b.jsxs)(`td`,{className:`pr-2`,children:[t.latencyMs,` ms`]}),(0,b.jsx)(`td`,{children:`Unattributed`})]},`${t.vault}:${t.id}`))})]})}):r&&(0,b.jsx)(`p`,{className:`text-xs`,children:`No requests logged.`}),r?.next&&(0,b.jsx)(l,{size:`sm`,variant:`outline`,disabled:u,onClick:m,children:`Load older`})]})]})}var M={catalog:{broker:{controlUrl:``,proxyUrl:``,caFingerprint:``,projectId:``},services:[]},profiles:{}};function N({states:e,profile:t}){return(0,b.jsx)(`div`,{className:`space-y-2`,children:e.filter(e=>!t||e.profile===t).map(e=>(0,b.jsxs)(`div`,{className:`rounded border p-2 text-sm`,children:[(0,b.jsx)(`strong`,{children:e.profile}),`: `,e.services.join(`, `)||`No services`,` — `,e.status,(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Vault: `,e.vault]}),(0,b.jsxs)(`div`,{className:`break-all text-xs`,children:[`Desired: `,e.desiredRevision]}),(0,b.jsxs)(`div`,{className:`break-all text-xs`,children:[`Applied: `,e.appliedRevision??`None`]}),e.error&&(0,b.jsxs)(`div`,{role:`alert`,children:[e.error.code,`: `,e.error.message]})]},e.profile))})}function P(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(`{"service":"fixture","profile":"sec-ops","ungrantedProfile":"worker","negativePath":"/missing-rule"}`),[o,s]=(0,y.useState)(``),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1);async function h(){let e=await c(`GET`,`/service-access`);t(e),r(JSON.stringify(e.catalog?{catalog:e.catalog,profiles:Object.fromEntries(e.profiles.map(e=>[e.profile,{services:e.services,...e.vaultOverride?{vault:e.vaultOverride}:{}}]))}:M,null,2))}(0,y.useEffect)(()=>{h().catch(e=>s(e.message))},[]);async function g(e){m(!0),s(``),f(``);try{await c(`POST`,`/service-access/${e}`,e===`apply`?JSON.parse(n):e===`test`?JSON.parse(i):{}),f(e===`test`?`Probe passed: positive, missing rule and ungranted profile`:`Service access applied`),await h()}catch(e){s(e.message);try{t(await c(`GET`,`/service-access`))}catch{}}finally{m(!1)}}return(0,b.jsxs)(`section`,{className:`space-y-3`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Service access`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Profile services use Agent Vault. Enter Infisical key references and dummy variables only. Broker environment and secretPath select the existing store; profile vault adopts an existing native vault. Set broker orchestratorId to apply the same binding to its refresh job and watchdog and to show their health.`}),(0,b.jsxs)(`label`,{className:`block text-sm`,children:[`Catalog and profile mappings (JSON)`,(0,b.jsx)(u,{"aria-label":`Catalog and profile mappings (JSON)`,rows:16,value:n,onChange:e=>r(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(l,{disabled:p||!e,onClick:()=>g(`apply`),children:`Save and apply`}),(0,b.jsx)(l,{variant:`outline`,disabled:p||!e?.catalog,onClick:()=>g(`reconcile`),children:`Reconcile`}),(0,b.jsx)(l,{variant:`outline`,disabled:p,onClick:()=>{s(``),h().catch(e=>s(e.message))},children:`Reload`})]}),o&&(0,b.jsx)(`p`,{role:`alert`,children:o}),d&&(0,b.jsx)(`p`,{role:`status`,children:d}),e&&(0,b.jsx)(N,{states:e.profiles}),e?.catalog&&(0,b.jsx)(j,{}),!!e?.cleanup?.length&&(0,b.jsxs)(`section`,{"aria-label":`Removed profile cleanup`,className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`font-semibold`,children:`Removed profile cleanup`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`These profiles were removed. Their vault cleanup stays visible here and is excluded from editable mappings.`}),(0,b.jsx)(N,{states:e.cleanup})]}),(0,b.jsxs)(`label`,{className:`block text-sm`,children:[`Fixture probe (JSON)`,(0,b.jsx)(u,{"aria-label":`Fixture probe (JSON)`,value:i,onChange:e=>a(e.target.value)})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Uses safe GETs against your fixture/test service: granted path, missing rule, ungranted profile. The service must reject dummy auth with 401 or 403.`}),(0,b.jsx)(l,{variant:`outline`,disabled:p||!e?.catalog,onClick:()=>g(`test`),children:`Test fixture`})]})}function F({profile:e,onChange:t,readOnly:n}){let[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(``);(0,y.useEffect)(()=>{let e=!0;return c(`GET`,`/service-access`).then(t=>{e&&i(t)}).catch(t=>{e&&o(t.message)}),()=>{e=!1}},[]);let s=e.serviceAccess?.services??[];return(0,b.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,b.jsx)(`p`,{children:`Standing access through this profile. Save the profile, then reconcile in Settings → Service access.`}),(0,b.jsxs)(`label`,{className:`block`,children:[`Native vault (optional)`,(0,b.jsx)(`input`,{"aria-label":`Native vault (optional)`,className:`ml-2 rounded border bg-background p-1`,disabled:n,value:e.serviceAccess?.vault??``,placeholder:`Derived from profile name`,onChange:e=>t({services:s,...e.target.value?{vault:e.target.value}:{}})})]}),r?.catalog?.services.map(r=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,disabled:n,checked:s.includes(r.name),onChange:n=>t({...e.serviceAccess,services:n.target.checked?[...s,r.name]:s.filter(e=>e!==r.name)})}),r.name,` (`,r.host,r.path,`)`]},r.name)),!r?.catalog&&(0,b.jsx)(`p`,{children:`No catalog configured. Open Settings → Service access.`}),s.filter(e=>!r?.catalog?.services.some(t=>t.name===e)).map(e=>(0,b.jsxs)(`p`,{children:[`Unknown service: `,e]},e)),a&&(0,b.jsx)(`p`,{role:`alert`,children:a}),r&&(0,b.jsx)(N,{states:r.profiles,profile:e.name}),r?.catalog&&r.profiles.some(t=>t.profile===e.name)&&(0,b.jsx)(j,{profile:e.name})]})}export{g as a,p as c,_ as i,f as l,P as n,h as o,v as r,m as s,F as t,d as u};
|
|
2
|
+
//# sourceMappingURL=service-access-settings-D9s_VJbd.js.map
|