@ouro.bot/cli 0.1.0-alpha.125 → 0.1.0-alpha.1251
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/LICENSE +21 -0
- package/README.md +197 -30
- package/RepairGuide.ouro/agent.json +5 -0
- package/RepairGuide.ouro/psyche/IDENTITY.md +19 -0
- package/RepairGuide.ouro/psyche/SOUL.md +55 -0
- package/RepairGuide.ouro/skills/diagnose-broken-remote.md +63 -0
- package/RepairGuide.ouro/skills/diagnose-stacked-typed-issues.md +35 -0
- package/RepairGuide.ouro/skills/diagnose-sync-blocked.md +54 -0
- package/RepairGuide.ouro/skills/diagnose-vault-expired.md +60 -0
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +4 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +2 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
- package/assets/bluebubbles-host +264 -0
- package/assets/sanctuary-host-launcher.sh +16 -0
- package/changelog.json +7459 -25
- package/deploy/unraid/Dockerfile +85 -0
- package/deploy/unraid/INSTALL.md +64 -0
- package/deploy/unraid/README.txt +3032 -0
- package/deploy/unraid/audit-container-spec.sh +4 -0
- package/deploy/unraid/container-runtime.json +1 -0
- package/deploy/unraid/credit-gateway.md +95 -0
- package/deploy/unraid/docker-man-template-transaction.mjs +727 -0
- package/deploy/unraid/docker-man-template-xml.cjs +105 -0
- package/deploy/unraid/github_known_hosts +3 -0
- package/deploy/unraid/install.sh +274 -0
- package/deploy/unraid/migrate-sanctuary-bundle.mjs +63 -0
- package/deploy/unraid/ouro-events/bootstrap-spool.sh +92 -0
- package/deploy/unraid/ouro-events/emit-event.mjs +310 -0
- package/deploy/unraid/ouro-events/emit-usenet-event.sh +54 -0
- package/deploy/unraid/ouro-events/install-usenet-guard.sh +435 -0
- package/deploy/unraid/ouro-events/usenet-health.sh +176 -0
- package/deploy/unraid/ouro-sync-ssh +98 -0
- package/deploy/unraid/ouro-sync.sudoers +3 -0
- package/deploy/unraid/sanctuary-acceptance-adapter.sh +43 -0
- package/deploy/unraid/sanctuary-acceptance-contract.json +198 -0
- package/deploy/unraid/sanctuary-acceptance-harness.sh +23 -0
- package/deploy/unraid/sanctuary-authority-installation.json +36 -0
- package/deploy/unraid/sanctuary-authority-service.sh +30 -0
- package/deploy/unraid/sanctuary-butler-upgrade.mjs +1523 -0
- package/deploy/unraid/sanctuary-deployment-target.mjs +710 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +2562 -0
- package/deploy/unraid/sanctuary-safe-rename.py +24 -0
- package/deploy/unraid/sanctuary-sync-cutover.sh +1039 -0
- package/deploy/unraid/sanctuary-unit16-host-broker.mjs +2088 -0
- package/deploy/unraid/sanctuary-unit16-run.sh +570 -0
- package/deploy/unraid/sanctuary-unit18-target-audit.sh +27 -0
- package/deploy/unraid/sanctuary.ouro/agent.json +73 -0
- package/deploy/unraid/sanctuary.ouro/arc/README.md +3 -0
- package/deploy/unraid/sanctuary.ouro/awaiting/house-care-sweep.md +17 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +5 -0
- package/deploy/unraid/sanctuary.ouro/habits/sanctuary-health.md +8 -0
- package/deploy/unraid/sanctuary.ouro/mcp/media-mcp.mjs +2489 -0
- package/deploy/unraid/sanctuary.ouro/product/PRODUCT.md +13 -0
- package/deploy/unraid/sanctuary.ouro/provider-readiness.json +11 -0
- package/deploy/unraid/sanctuary.ouro/psyche/ASPIRATIONS.md +5 -0
- package/deploy/unraid/sanctuary.ouro/psyche/IDENTITY.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/LORE.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/SOUL.md +15 -0
- package/deploy/unraid/sanctuary.ouro/psyche/TACIT.md +3 -0
- package/deploy/unraid/sanctuary.ouro/state/policy/steward.json +7 -0
- package/deploy/unraid/sanctuary.ouro/tool-profiles.json +253 -0
- package/deploy/unraid/sanctuary.xml +30 -0
- package/dist/a2a/card.js +57 -0
- package/dist/a2a/client.js +290 -0
- package/dist/a2a/config.js +50 -0
- package/dist/a2a/delegated-command-grants.js +93 -0
- package/dist/a2a/delegated-command.js +197 -0
- package/dist/a2a/delegation-stores.js +56 -0
- package/dist/a2a/did-resolution.js +205 -0
- package/dist/a2a/escalation-grants.js +84 -0
- package/dist/a2a/escalation-wiring.js +60 -0
- package/dist/a2a/identity.js +258 -0
- package/dist/a2a/inbound-share.js +131 -0
- package/dist/a2a/mission-result-wire.js +265 -0
- package/dist/a2a/onboarding.js +133 -0
- package/dist/a2a/operator-trust.js +399 -0
- package/dist/a2a/outbox-client.js +59 -0
- package/dist/a2a/outbox-store.js +245 -0
- package/dist/a2a/outbox-wire.js +106 -0
- package/dist/a2a/pin-store.js +167 -0
- package/dist/a2a/refusals.js +53 -0
- package/dist/a2a/relay-client.js +106 -0
- package/dist/a2a/relay-config-vault.js +64 -0
- package/dist/a2a/relay-contacts.js +120 -0
- package/dist/a2a/relay-inbox.js +360 -0
- package/dist/a2a/relay-retirements.js +89 -0
- package/dist/a2a/replay-grant-holders.js +33 -0
- package/dist/a2a/replay-harness.js +188 -0
- package/dist/a2a/resolution-proof.js +53 -0
- package/dist/a2a/sealed-chat.js +114 -0
- package/dist/a2a/seen-ledger.js +214 -0
- package/dist/a2a/server.js +804 -0
- package/dist/a2a/task-store.js +69 -0
- package/dist/a2a/transport.js +100 -0
- package/dist/a2a/trust-commands.js +203 -0
- package/dist/a2a/trusted-files.js +185 -0
- package/dist/a2a/types.js +3 -0
- package/dist/arc/attention-types.js +8 -0
- package/dist/arc/cares.js +360 -0
- package/dist/arc/episodes.js +118 -0
- package/dist/arc/evolution.js +490 -0
- package/dist/arc/flight-recorder.js +1030 -0
- package/dist/arc/intentions.js +134 -0
- package/dist/arc/json-store.js +117 -0
- package/dist/arc/obligations.js +386 -0
- package/dist/arc/packets.js +336 -0
- package/dist/arc/presence.js +185 -0
- package/dist/arc/task-lifecycle.js +57 -0
- package/dist/commerce/store.js +755 -0
- package/dist/commerce/types.js +3 -0
- package/dist/gateway/keys.js +117 -0
- package/dist/gateway/server.js +429 -0
- package/dist/heart/active-work.js +431 -44
- package/dist/heart/agent-entry.js +253 -3
- package/dist/heart/approval-files.js +94 -0
- package/dist/heart/approval-store.js +957 -0
- package/dist/heart/atomic-file.js +115 -0
- package/dist/heart/attachments/downloaded-store.js +89 -0
- package/dist/heart/attachments/image-normalize.js +201 -0
- package/dist/heart/attachments/materialize.js +97 -0
- package/dist/heart/attachments/originals.js +102 -0
- package/dist/heart/attachments/render.js +29 -0
- package/dist/heart/attachments/sources/bluebubbles.js +155 -0
- package/dist/heart/attachments/sources/cli-local-file.js +78 -0
- package/dist/heart/attachments/sources/downloaded.js +76 -0
- package/dist/heart/attachments/sources/index.js +19 -0
- package/dist/heart/attachments/store.js +132 -0
- package/dist/heart/attachments/transcribe-audio.js +172 -0
- package/dist/heart/attachments/types.js +93 -0
- package/dist/heart/attachments/understand.js +195 -0
- package/dist/heart/auth/auth-flow.js +589 -0
- package/dist/heart/auth/github-device-login.js +104 -0
- package/dist/heart/autonomy-budget.js +478 -0
- package/dist/heart/awaiting/a2a-await-delivery.js +109 -0
- package/dist/heart/awaiting/await-alert.js +152 -0
- package/dist/heart/awaiting/await-expiry.js +143 -0
- package/dist/heart/awaiting/await-loader.js +91 -0
- package/dist/heart/awaiting/await-parser.js +152 -0
- package/dist/heart/awaiting/await-runtime-state.js +130 -0
- package/dist/heart/awaiting/await-scheduler.js +403 -0
- package/dist/heart/background-operations.js +281 -0
- package/dist/heart/bluebubbles-host-account.js +78 -0
- package/dist/heart/bridges/manager.js +137 -17
- package/dist/heart/bridges/store.js +14 -2
- package/dist/heart/bundle-state.js +168 -0
- package/dist/heart/chat-interaction.js +38 -0
- package/dist/heart/commitments.js +44 -14
- package/dist/heart/config-registry.js +340 -0
- package/dist/heart/config.js +195 -140
- package/dist/heart/context-loss-gauntlet.js +387 -0
- package/dist/heart/context-loss-sentinel.js +1200 -0
- package/dist/heart/core.js +2555 -611
- package/dist/heart/cross-chat-delivery.js +29 -22
- package/dist/heart/daemon/agent-config-check.js +494 -0
- package/dist/heart/daemon/agent-discovery.js +304 -3
- package/dist/heart/daemon/agent-home.js +409 -0
- package/dist/heart/daemon/agent-service.js +542 -0
- package/dist/heart/daemon/agentic-repair.js +548 -0
- package/dist/heart/daemon/await-private-wake.js +59 -0
- package/dist/heart/daemon/bluebubbles-cli-integration.js +71 -0
- package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
- package/dist/heart/daemon/bluebubbles-host-protocol.js +433 -0
- package/dist/heart/daemon/bluebubbles-host.js +273 -0
- package/dist/heart/daemon/boot-sync-probe.js +223 -0
- package/dist/heart/daemon/cadence.js +180 -0
- package/dist/heart/daemon/cli-arg-redaction.js +26 -0
- package/dist/heart/daemon/cli-defaults.js +956 -0
- package/dist/heart/daemon/cli-desk.js +331 -0
- package/dist/heart/daemon/cli-exec.js +9619 -0
- package/dist/heart/daemon/cli-gate.js +170 -0
- package/dist/heart/daemon/cli-help.js +793 -0
- package/dist/heart/daemon/cli-manifest.js +127 -0
- package/dist/heart/daemon/cli-parse.js +3536 -0
- package/dist/heart/daemon/cli-render-doctor.js +57 -0
- package/dist/heart/daemon/cli-render.js +823 -0
- package/dist/heart/daemon/cli-types.js +8 -0
- package/dist/heart/daemon/compile-cache.js +69 -0
- package/dist/heart/daemon/connect-bay.js +323 -0
- package/dist/heart/daemon/container-credential-bootstrap.js +273 -0
- package/dist/heart/daemon/container-healthcheck.js +112 -0
- package/dist/heart/daemon/container-runtime.js +97 -0
- package/dist/heart/daemon/container-spec-auditor-main.js +187 -0
- package/dist/heart/daemon/container-spec-auditor.js +257 -0
- package/dist/heart/daemon/daemon-bootstrap-startup.js +115 -0
- package/dist/heart/daemon/daemon-cli.js +29 -2400
- package/dist/heart/daemon/daemon-entry.js +1123 -11
- package/dist/heart/daemon/daemon-health.js +186 -0
- package/dist/heart/daemon/daemon-rollup.js +57 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +88 -13
- package/dist/heart/daemon/daemon-tombstone.js +236 -0
- package/dist/heart/daemon/daemon.js +2087 -129
- package/dist/heart/daemon/desk-admin.js +420 -0
- package/dist/heart/daemon/dns-workflow.js +394 -0
- package/dist/heart/daemon/doctor-types.js +8 -0
- package/dist/heart/daemon/doctor.js +1890 -0
- package/dist/heart/daemon/freshness.js +345 -0
- package/dist/heart/daemon/habit-private-wake.js +61 -0
- package/dist/heart/daemon/health-monitor.js +209 -12
- package/dist/heart/daemon/home-filesystem.js +93 -0
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +135 -1
- package/dist/heart/daemon/http-health-probe.js +80 -0
- package/dist/heart/daemon/human-command-screens.js +234 -0
- package/dist/heart/daemon/human-readiness.js +114 -0
- package/dist/heart/daemon/inner-status.js +78 -0
- package/dist/heart/daemon/interactive-repair.js +394 -0
- package/dist/heart/daemon/launchd.js +40 -8
- package/dist/heart/daemon/linux-service.js +382 -0
- package/dist/heart/daemon/log-tailer.js +79 -10
- package/dist/heart/daemon/logs-prune.js +132 -0
- package/dist/heart/daemon/mcp-canary.js +525 -0
- package/dist/heart/daemon/message-router.js +65 -5
- package/dist/heart/daemon/migrate-to-desk.js +848 -0
- package/dist/heart/daemon/os-cron-deps.js +139 -0
- package/dist/heart/daemon/os-cron.js +45 -15
- package/dist/heart/daemon/ouro-bot-entry.js +8 -3
- package/dist/heart/daemon/ouro-entry.js +32 -11
- package/dist/heart/daemon/plugin-cli.js +432 -0
- package/dist/heart/daemon/portable-git-install.js +265 -0
- package/dist/heart/daemon/portable-git.js +179 -0
- package/dist/heart/daemon/presence-daemon.js +265 -0
- package/dist/heart/daemon/presence-roster.js +259 -0
- package/dist/heart/daemon/presence.js +462 -0
- package/dist/heart/daemon/process-manager.js +763 -61
- package/dist/heart/daemon/provider-discovery.js +171 -0
- package/dist/heart/daemon/provider-ping-progress.js +83 -0
- package/dist/heart/daemon/prunable-bundle.js +144 -0
- package/dist/heart/daemon/pulse.js +511 -0
- package/dist/heart/daemon/readiness-repair.js +365 -0
- package/dist/heart/daemon/run-hooks.js +2 -0
- package/dist/heart/daemon/runtime-logging.js +48 -14
- package/dist/heart/daemon/runtime-metadata.js +2 -30
- package/dist/heart/daemon/runtime-mode.js +13 -2
- package/dist/heart/daemon/safe-mode.js +161 -0
- package/dist/heart/daemon/sanctuary-acceptance-adapter.js +2659 -0
- package/dist/heart/daemon/sanctuary-acceptance-harness.js +1832 -0
- package/dist/heart/daemon/sanctuary-acceptance-marker.js +267 -0
- package/dist/heart/daemon/sanctuary-acceptance-scenarios.js +956 -0
- package/dist/heart/daemon/sanctuary-authority-codec.js +86 -0
- package/dist/heart/daemon/sanctuary-authority-epoch.js +291 -0
- package/dist/heart/daemon/sanctuary-authority-installation.js +161 -0
- package/dist/heart/daemon/sanctuary-authority-ledger.js +241 -0
- package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +1348 -0
- package/dist/heart/daemon/sanctuary-authority-vault-migration.js +79 -0
- package/dist/heart/daemon/sanctuary-bundle-migration.js +974 -0
- package/dist/heart/daemon/sanctuary-host-authority.js +1008 -0
- package/dist/heart/daemon/sanctuary-host-detached-supervisor.js +493 -0
- package/dist/heart/daemon/sanctuary-host-executor.js +670 -0
- package/dist/heart/daemon/sanctuary-host-linux-kernel.js +334 -0
- package/dist/heart/daemon/sanctuary-host-supervisor-entry.js +207 -0
- package/dist/heart/daemon/sanctuary-host-supervisor.js +95 -0
- package/dist/heart/daemon/sanctuary-package-management.js +113 -0
- package/dist/heart/daemon/sanctuary-scheduler-liveness.js +227 -0
- package/dist/heart/daemon/sanctuary-scheduler-origin.js +132 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-entry.js +478 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-gateway.js +614 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-service.js +763 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver-entry.js +94 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver.js +294 -0
- package/dist/heart/daemon/sense-manager.js +890 -58
- package/dist/heart/daemon/session-id-resolver.js +131 -0
- package/dist/heart/daemon/skill-management-installer.js +1 -1
- package/dist/heart/daemon/socket-client.js +180 -12
- package/dist/heart/daemon/stale-bundle-prune.js +113 -0
- package/dist/heart/daemon/startup-tui.js +339 -0
- package/dist/heart/daemon/supercronic-supervisor.js +282 -0
- package/dist/heart/daemon/task-scheduler.js +117 -39
- package/dist/heart/daemon/terminal-ui.js +503 -0
- package/dist/heart/daemon/thoughts.js +138 -54
- package/dist/heart/daemon/up-progress.js +366 -0
- package/dist/heart/daemon/vault-items.js +56 -0
- package/dist/heart/daemon/vault-outage.js +74 -0
- package/dist/heart/delegation.js +1 -4
- package/dist/heart/external-events/router.js +1556 -0
- package/dist/heart/failure-reports.js +398 -0
- package/dist/heart/file-lock.js +109 -0
- package/dist/heart/frontend-approval-runtime.js +506 -0
- package/dist/heart/frontend-journal.js +215 -0
- package/dist/heart/frontend-session-service.js +330 -0
- package/dist/heart/frontend-socket-client.js +173 -0
- package/dist/heart/frontend-socket.js +434 -0
- package/dist/heart/frontend-turn-errors.js +20 -0
- package/dist/heart/habits/habit-cancel.js +810 -0
- package/dist/heart/habits/habit-lifecycle.js +1324 -0
- package/dist/heart/habits/habit-migration.js +194 -0
- package/dist/heart/habits/habit-parser.js +278 -0
- package/dist/heart/habits/habit-runtime-state.js +93 -0
- package/dist/heart/habits/habit-scheduler.js +667 -0
- package/dist/heart/habits/habit-session-summary.js +318 -0
- package/dist/heart/habits/habit-session.js +636 -0
- package/dist/heart/{daemon → hatch}/hatch-flow.js +68 -62
- package/dist/heart/{daemon → hatch}/hatch-specialist.js +6 -8
- package/dist/heart/{daemon → hatch}/specialist-prompt.js +13 -9
- package/dist/heart/{daemon → hatch}/specialist-tools.js +100 -20
- package/dist/heart/identity.js +337 -60
- package/dist/heart/kept-notes.js +289 -0
- package/dist/heart/kicks.js +1 -1
- package/dist/heart/machine-identity.js +175 -0
- package/dist/heart/mail-import-discovery.js +356 -0
- package/dist/heart/mailbox/mailbox-http-hooks.js +99 -0
- package/dist/heart/mailbox/mailbox-http-response.js +7 -0
- package/dist/heart/mailbox/mailbox-http-routes.js +406 -0
- package/dist/heart/mailbox/mailbox-http-static.js +103 -0
- package/dist/heart/mailbox/mailbox-http-transport.js +272 -0
- package/dist/heart/mailbox/mailbox-http.js +99 -0
- package/dist/heart/mailbox/mailbox-read.js +41 -0
- package/dist/heart/mailbox/mailbox-supervision.js +131 -0
- package/dist/heart/mailbox/mailbox-types.js +27 -0
- package/dist/heart/mailbox/mailbox-view.js +197 -0
- package/dist/heart/mailbox/readers/agent-machine.js +428 -0
- package/dist/heart/mailbox/readers/continuity-readers.js +329 -0
- package/dist/heart/mailbox/readers/mail.js +375 -0
- package/dist/heart/mailbox/readers/runtime-readers.js +823 -0
- package/dist/heart/mailbox/readers/sessions.js +231 -0
- package/dist/heart/mailbox/readers/shared.js +111 -0
- package/dist/heart/mcp/mcp-server.js +760 -0
- package/dist/heart/migrate-config.js +100 -0
- package/dist/heart/model-capabilities.js +98 -16
- package/dist/heart/model-limits.js +49 -0
- package/dist/heart/optional-packages.js +77 -0
- package/dist/heart/orientation-frame.js +381 -0
- package/dist/heart/platform.js +81 -0
- package/dist/heart/primitives.js +1 -1
- package/dist/heart/private-runtime/decision-renderer.js +158 -0
- package/dist/heart/private-runtime/index.js +18 -0
- package/dist/heart/private-runtime/ledger.js +212 -0
- package/dist/heart/private-runtime/policy.js +295 -0
- package/dist/heart/private-runtime/types.js +2 -0
- package/dist/heart/progress-story.js +1 -1
- package/dist/heart/provider-attempt.js +137 -0
- package/dist/heart/provider-binding-resolver.js +273 -0
- package/dist/heart/provider-credentials.js +449 -0
- package/dist/heart/provider-failover.js +260 -37
- package/dist/heart/provider-fallback.js +228 -0
- package/dist/heart/provider-models.js +96 -0
- package/dist/heart/provider-ping-child.js +125 -0
- package/dist/heart/provider-ping-entry.js +8 -0
- package/dist/heart/provider-ping.js +236 -89
- package/dist/heart/provider-readiness-cache.js +119 -0
- package/dist/heart/provider-visibility.js +188 -0
- package/dist/heart/providers/account-pool.js +717 -0
- package/dist/heart/providers/anthropic-token.js +15 -47
- package/dist/heart/providers/anthropic.js +243 -79
- package/dist/heart/providers/azure.js +20 -32
- package/dist/heart/providers/error-classification.js +129 -0
- package/dist/heart/providers/github-copilot.js +131 -36
- package/dist/heart/providers/minimax-vlm.js +189 -0
- package/dist/heart/providers/minimax.js +20 -28
- package/dist/heart/providers/openai-codex-token.js +349 -0
- package/dist/heart/providers/openai-codex.js +47 -58
- package/dist/heart/providers/openai-compatible.js +177 -0
- package/dist/heart/quota/fleet-readings.js +222 -0
- package/dist/heart/quota/tranche.js +59 -0
- package/dist/heart/reach-channel.js +85 -0
- package/dist/heart/reply-style.js +52 -0
- package/dist/heart/run-ledger.js +247 -0
- package/dist/heart/runtime-capability-check.js +170 -0
- package/dist/heart/runtime-credentials.js +647 -0
- package/dist/heart/runtime-cwd.js +87 -0
- package/dist/heart/sense-truth.js +26 -4
- package/dist/heart/session-activity.js +94 -24
- package/dist/heart/session-events.js +1600 -0
- package/dist/heart/session-playback-cli-main.js +5 -0
- package/dist/heart/session-playback-cli.js +36 -0
- package/dist/heart/session-playback.js +231 -0
- package/dist/heart/session-redaction-repair-cli-main.js +31 -0
- package/dist/heart/session-redaction-repair.js +552 -0
- package/dist/heart/session-stats-cli-main.js +5 -0
- package/dist/heart/session-stats.js +183 -0
- package/dist/heart/session-transcript.js +133 -0
- package/dist/heart/shelf-claims.js +124 -0
- package/dist/heart/shepherd/custody-types.js +2 -0
- package/dist/heart/shepherd/mandates.js +352 -0
- package/dist/heart/shepherd/operation-commands.js +19 -0
- package/dist/heart/shepherd/operations.js +137 -0
- package/dist/heart/shepherd/supervision.js +114 -0
- package/dist/heart/shepherd/types.js +2 -0
- package/dist/heart/shepherd-config.js +113 -0
- package/dist/heart/source-grounding.js +313 -0
- package/dist/heart/sqlite.js +18 -0
- package/dist/heart/start-of-turn-packet.js +372 -0
- package/dist/heart/steward-policy.js +656 -0
- package/dist/heart/streaming.js +634 -206
- package/dist/heart/structured-output.js +196 -0
- package/dist/heart/sync-classification.js +176 -0
- package/dist/heart/sync-health.js +152 -0
- package/dist/heart/sync-lock.js +431 -0
- package/dist/heart/sync.js +1579 -0
- package/dist/heart/target-resolution.js +11 -7
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -0
- package/dist/heart/timeouts.js +101 -0
- package/dist/heart/tool-activity-callbacks.js +59 -0
- package/dist/heart/tool-approval.js +382 -0
- package/dist/heart/tool-description.js +155 -0
- package/dist/heart/tool-friction.js +55 -0
- package/dist/heart/tool-images.js +42 -0
- package/dist/heart/tool-loop.js +13 -1
- package/dist/heart/tool-output-budget.js +41 -0
- package/dist/heart/turn-context.js +503 -0
- package/dist/heart/turn-execution-lease.js +30 -0
- package/dist/heart/versioning/host-self-update.js +118 -0
- package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +6 -5
- package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +3 -2
- package/dist/heart/versioning/ouro-path-installer.js +432 -0
- package/dist/heart/versioning/ouro-recovery-launcher.js +76 -0
- package/dist/heart/versioning/ouro-version-manager.js +432 -0
- package/dist/heart/versioning/release-sources.js +185 -0
- package/dist/heart/versioning/self-update-defaults.js +397 -0
- package/dist/heart/versioning/self-update.js +241 -0
- package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
- package/dist/heart/{daemon → versioning}/update-checker.js +12 -35
- package/dist/heart/versioning/update-hooks.js +160 -0
- package/dist/heart/versioning/update-state.js +134 -0
- package/dist/heart/versioning/updater-launchd.js +150 -0
- package/dist/heart/versioning/version-intent.js +114 -0
- package/dist/heart/work-card.js +380 -0
- package/dist/mailbox-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/mailbox-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/mailbox-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/mailbox-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/mailbox-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/mailbox-ui/assets/index-CwY8e-kL.css +1 -0
- package/dist/mailbox-ui/assets/index-ih7rCSLe.js +1 -0
- package/dist/mailbox-ui/assets/vendor-D_wlGdJf.js +65 -0
- package/dist/mailbox-ui/index.html +18 -0
- package/dist/mailroom/attention.js +167 -0
- package/dist/mailroom/autonomy.js +209 -0
- package/dist/mailroom/azure-sdk.js +27 -0
- package/dist/mailroom/blob-store.js +974 -0
- package/dist/mailroom/body-cache.js +61 -0
- package/dist/mailroom/cache-sync-cli.js +58 -0
- package/dist/mailroom/core.js +805 -0
- package/dist/mailroom/entry.js +160 -0
- package/dist/mailroom/file-store.js +568 -0
- package/dist/mailroom/hosted-cache-sync.js +384 -0
- package/dist/mailroom/mbox-import.js +393 -0
- package/dist/mailroom/migration.js +164 -0
- package/dist/mailroom/outbound.js +380 -0
- package/dist/mailroom/policy.js +263 -0
- package/dist/mailroom/reader.js +291 -0
- package/dist/mailroom/search-cache.js +513 -0
- package/dist/mailroom/search-relevance.js +319 -0
- package/dist/mailroom/smtp-ingress.js +176 -0
- package/dist/mailroom/source-state.js +176 -0
- package/dist/mailroom/sweep-orphans-cli.js +34 -0
- package/dist/mailroom/thread.js +109 -0
- package/dist/mailroom/travel-extract.js +89 -0
- package/dist/mind/bundle-manifest.js +25 -2
- package/dist/mind/context.js +328 -139
- package/dist/mind/desk-section.js +342 -0
- package/dist/mind/diary-integrity.js +60 -0
- package/dist/mind/{memory.js → diary.js} +68 -77
- package/dist/mind/embedding-provider.js +60 -0
- package/dist/mind/file-state.js +179 -0
- package/dist/mind/friend-link-codes.js +209 -0
- package/dist/mind/friend-merge.js +336 -0
- package/dist/mind/house-names.js +43 -0
- package/dist/mind/{associative-recall.js → note-search.js} +47 -58
- package/dist/mind/obligation-steering.js +15 -9
- package/dist/mind/outbound-record.js +168 -0
- package/dist/mind/pending.js +36 -10
- package/dist/mind/prompt-budget.js +511 -0
- package/dist/mind/prompt-refresh.js +3 -2
- package/dist/mind/prompt.js +986 -266
- package/dist/mind/provenance-trust.js +26 -0
- package/dist/mind/record-paths.js +312 -0
- package/dist/mind/scrutiny.js +121 -0
- package/dist/mind/session-transaction.js +642 -0
- package/dist/mind/token-estimate.js +17 -0
- package/dist/mind/where-am-i.js +147 -0
- package/dist/nerves/cli-logging.js +7 -1
- package/dist/nerves/coverage/audit-rules.js +15 -6
- package/dist/nerves/coverage/audit.js +28 -2
- package/dist/nerves/coverage/cli.js +1 -1
- package/dist/nerves/coverage/contract.js +5 -5
- package/dist/nerves/coverage/file-completeness.js +151 -5
- package/dist/nerves/coverage/run-artifacts.js +55 -35
- package/dist/nerves/coverage/source-scanner.js +4 -4
- package/dist/nerves/event-buffer.js +111 -0
- package/dist/nerves/index.js +293 -9
- package/dist/nerves/observation.js +20 -0
- package/dist/nerves/redact.js +79 -0
- package/dist/nerves/review/cli-main.js +5 -0
- package/dist/nerves/review/cli.js +156 -0
- package/dist/nerves/review/core.js +159 -0
- package/dist/nerves/runtime.js +12 -0
- package/dist/repertoire/ado-client.js +15 -56
- package/dist/repertoire/ado-semantic.js +19 -12
- package/dist/repertoire/api-client.js +97 -0
- package/dist/repertoire/auth-required.js +22 -0
- package/dist/repertoire/bitwarden-native.js +458 -0
- package/dist/repertoire/bitwarden-store.js +1296 -0
- package/dist/repertoire/bundle-templates.js +71 -0
- package/dist/repertoire/bw-installer.js +268 -0
- package/dist/repertoire/coding/codex-jsonl.js +64 -0
- package/dist/repertoire/coding/context-pack.js +80 -3
- package/dist/repertoire/coding/feedback.js +26 -5
- package/dist/repertoire/coding/index.js +15 -3
- package/dist/repertoire/coding/manager.js +19 -11
- package/dist/repertoire/coding/spawner.js +22 -5
- package/dist/repertoire/coding/tools.js +116 -16
- package/dist/repertoire/coding/workbench-client.js +272 -0
- package/dist/repertoire/coding/workbench-manager.js +346 -0
- package/dist/repertoire/commerce-errors.js +109 -0
- package/dist/repertoire/commerce-self-test.js +156 -0
- package/dist/repertoire/credential-access.js +183 -0
- package/dist/repertoire/deferred-tools.js +117 -0
- package/dist/repertoire/desk/classifier.js +362 -0
- package/dist/repertoire/duffel-client.js +185 -0
- package/dist/repertoire/github-client.js +14 -55
- package/dist/repertoire/graph-client.js +11 -52
- package/dist/repertoire/guardrails.js +1040 -69
- package/dist/repertoire/house-sweep.js +471 -0
- package/dist/repertoire/mcp-client.js +58 -5
- package/dist/repertoire/mcp-manager.js +426 -141
- package/dist/repertoire/mcp-tools.js +148 -0
- package/dist/repertoire/mcp-write-guard.js +46 -0
- package/dist/repertoire/plugin-mcp.js +175 -0
- package/dist/repertoire/plugins.js +253 -0
- package/dist/repertoire/relationship-authorization.js +322 -0
- package/dist/repertoire/sanctuary-container-policy.js +50 -0
- package/dist/repertoire/shell-sessions.js +135 -0
- package/dist/repertoire/skill-summaries.js +108 -0
- package/dist/repertoire/skills.js +48 -4
- package/dist/repertoire/stripe-client.js +163 -0
- package/dist/repertoire/tool-arguments.js +180 -0
- package/dist/repertoire/tool-limits.js +20 -0
- package/dist/repertoire/tool-results.js +29 -0
- package/dist/repertoire/tools-a2a.js +742 -0
- package/dist/repertoire/tools-app-sessions.js +188 -0
- package/dist/repertoire/tools-attachments.js +278 -0
- package/dist/repertoire/tools-awaiting.js +904 -0
- package/dist/repertoire/tools-base.js +83 -1378
- package/dist/repertoire/tools-bridge.js +144 -0
- package/dist/repertoire/tools-bundle.js +917 -0
- package/dist/repertoire/tools-chat.js +166 -0
- package/dist/repertoire/tools-commerce.js +253 -0
- package/dist/repertoire/tools-config.js +186 -0
- package/dist/repertoire/tools-continuity.js +602 -0
- package/dist/repertoire/tools-credential.js +383 -0
- package/dist/repertoire/tools-escalation.js +92 -0
- package/dist/repertoire/tools-evolution.js +527 -0
- package/dist/repertoire/tools-files.js +463 -0
- package/dist/repertoire/tools-flight.js +290 -0
- package/dist/repertoire/tools-flow.js +119 -0
- package/dist/repertoire/tools-friend-link.js +57 -0
- package/dist/repertoire/tools-github.js +7 -10
- package/dist/repertoire/tools-habits.js +103 -0
- package/dist/repertoire/tools-house-care.js +174 -0
- package/dist/repertoire/tools-mail.js +1842 -0
- package/dist/repertoire/tools-notes.js +501 -0
- package/dist/repertoire/tools-obligations.js +182 -0
- package/dist/repertoire/tools-orientation.js +31 -0
- package/dist/repertoire/tools-record.js +482 -0
- package/dist/repertoire/tools-rsvp.js +139 -0
- package/dist/repertoire/tools-runtime.js +238 -0
- package/dist/repertoire/tools-sanctuary-host.js +202 -0
- package/dist/repertoire/tools-session.js +1162 -0
- package/dist/repertoire/tools-shell.js +248 -0
- package/dist/repertoire/tools-shepherd-guidance.js +171 -0
- package/dist/repertoire/tools-shepherd.js +325 -0
- package/dist/repertoire/tools-steward-policy.js +147 -0
- package/dist/repertoire/tools-stripe.js +224 -0
- package/dist/repertoire/tools-surface.js +393 -0
- package/dist/repertoire/tools-teams.js +19 -45
- package/dist/repertoire/tools-telegram-contacts.js +37 -0
- package/dist/repertoire/tools-travel.js +125 -0
- package/dist/repertoire/tools-trip.js +982 -0
- package/dist/repertoire/tools-unraid.js +559 -0
- package/dist/repertoire/tools-user-profile.js +146 -0
- package/dist/repertoire/tools-vault.js +40 -0
- package/dist/repertoire/tools-voice-local.js +198 -0
- package/dist/repertoire/tools-voice.js +145 -0
- package/dist/repertoire/tools-web.js +230 -0
- package/dist/repertoire/tools.js +536 -157
- package/dist/repertoire/travel-api-client.js +360 -0
- package/dist/repertoire/unraid-client.js +155 -0
- package/dist/repertoire/unraid-restart.js +342 -0
- package/dist/repertoire/user-profile.js +131 -0
- package/dist/repertoire/vault-setup.js +298 -0
- package/dist/repertoire/vault-unlock.js +816 -0
- package/dist/rsvp/aisleplanner-client.js +354 -0
- package/dist/rsvp/cli.js +936 -0
- package/dist/rsvp/config.js +327 -0
- package/dist/rsvp/cutover.js +453 -0
- package/dist/rsvp/diagnostics.js +232 -0
- package/dist/rsvp/diff-renderer.js +176 -0
- package/dist/rsvp/habit-policy.js +110 -0
- package/dist/rsvp/habit-stage.js +123 -0
- package/dist/rsvp/incident-bundle.js +97 -0
- package/dist/rsvp/migration.js +204 -0
- package/dist/rsvp/native-habit-runner.js +630 -0
- package/dist/rsvp/outbound-state.js +628 -0
- package/dist/rsvp/query.js +118 -0
- package/dist/rsvp/replay.js +233 -0
- package/dist/rsvp/snapshot.js +232 -0
- package/dist/rsvp/spend-ledger.js +175 -0
- package/dist/scripts/claude-code-hook.js +41 -0
- package/dist/scripts/claude-code-stop-hook.js +47 -0
- package/dist/senses/a2a-entry.js +140 -0
- package/dist/senses/acp-server.js +386 -0
- package/dist/senses/app-sessions/client.js +128 -0
- package/dist/senses/app-sessions/digest-cards.js +187 -0
- package/dist/senses/app-sessions/digest-push.js +108 -0
- package/dist/senses/app-sessions/digest-sources.js +204 -0
- package/dist/senses/app-sessions/digest.js +284 -0
- package/dist/senses/app-sessions/run-command.js +51 -0
- package/dist/senses/app-sessions/sense.js +252 -0
- package/dist/senses/app-sessions/shepherd-cli.js +166 -0
- package/dist/senses/app-sessions/shepherd-rows.js +67 -0
- package/dist/senses/app-sessions/store.js +149 -0
- package/dist/senses/app-sessions/waiting-prompts.js +137 -0
- package/dist/senses/app-sessions/waiting-status.js +23 -0
- package/dist/senses/app-sessions-entry.js +86 -0
- package/dist/senses/attention-queue.js +186 -0
- package/dist/senses/await-turn-message.js +65 -0
- package/dist/senses/bluebubbles/active-turns.js +216 -0
- package/dist/senses/bluebubbles/attachment-cache.js +53 -0
- package/dist/senses/bluebubbles/attachment-download.js +143 -0
- package/dist/senses/{bluebubbles-client.js → bluebubbles/client.js} +373 -43
- package/dist/senses/bluebubbles/context-packet.js +207 -0
- package/dist/senses/bluebubbles/context-smoke.js +144 -0
- package/dist/senses/bluebubbles/entry.js +90 -0
- package/dist/senses/bluebubbles/host-account-verifier.js +88 -0
- package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +21 -3
- package/dist/senses/bluebubbles/index.js +4070 -0
- package/dist/senses/bluebubbles/latest-turn.js +311 -0
- package/dist/senses/bluebubbles/media.js +256 -0
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +147 -30
- package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +24 -13
- package/dist/senses/bluebubbles/outbound-state.js +335 -0
- package/dist/senses/bluebubbles/processed-log.js +133 -0
- package/dist/senses/bluebubbles/reactions.js +18 -0
- package/dist/senses/bluebubbles/replay.js +284 -0
- package/dist/senses/{bluebubbles-runtime-state.js → bluebubbles/runtime-state.js} +30 -2
- package/dist/senses/bluebubbles/semantic-receipts.js +1983 -0
- package/dist/senses/bluebubbles/send-file.js +20 -0
- package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
- package/dist/senses/bluebubbles/webhook-registration.js +257 -0
- package/dist/senses/bluebubbles-meta-guard.js +39 -0
- package/dist/senses/chat-file.js +75 -0
- package/dist/senses/cli/bracketed-paste.js +82 -0
- package/dist/senses/cli/image-paste.js +287 -0
- package/dist/senses/cli/image-ref-navigation.js +75 -0
- package/dist/senses/cli/ink-app.js +156 -0
- package/dist/senses/cli/inline-diff.js +64 -0
- package/dist/senses/cli/input-keys.js +174 -0
- package/dist/senses/cli/kill-ring.js +86 -0
- package/dist/senses/cli/message-list.js +51 -0
- package/dist/senses/cli/ouro-tui.js +607 -0
- package/dist/senses/cli/spinner-imperative.js +135 -0
- package/dist/senses/cli/spinner.js +101 -0
- package/dist/senses/cli/status-line.js +60 -0
- package/dist/senses/cli/streaming-markdown.js +526 -0
- package/dist/senses/cli/tool-display.js +85 -0
- package/dist/senses/cli/tool-render.js +85 -0
- package/dist/senses/cli/tui-store.js +252 -0
- package/dist/senses/cli/virtual-list.js +35 -0
- package/dist/senses/cli-entry.js +60 -8
- package/dist/senses/cli.js +607 -352
- package/dist/senses/commands.js +66 -3
- package/dist/senses/context-packet-ledger.js +367 -0
- package/dist/senses/context-packets.js +154 -0
- package/dist/senses/habit-lifecycle-guard.js +24 -0
- package/dist/senses/habit-turn-message.js +160 -0
- package/dist/senses/ingress-evidence.js +2 -0
- package/dist/senses/mail-entry.js +68 -0
- package/dist/senses/mail.js +524 -0
- package/dist/senses/ordinary-owner-decision.js +97 -0
- package/dist/senses/pipeline.js +1139 -273
- package/dist/senses/private-runtime-worker.js +857 -0
- package/dist/senses/private-runtime.js +1689 -0
- package/dist/senses/proactive-content-guard.js +51 -0
- package/dist/senses/repeat-while.js +36 -0
- package/dist/senses/root-host-approval-port.js +345 -0
- package/dist/senses/root-host-approval-runtime.js +393 -0
- package/dist/senses/sanctuary-authority-resident.js +102 -0
- package/dist/senses/sanctuary-download-credit-presentation.js +31 -0
- package/dist/senses/sanctuary-full-visibility-contract.js +302 -0
- package/dist/senses/sanctuary-grounding.js +118 -0
- package/dist/senses/sanctuary-health-acceptance-probe-entry.js +12 -0
- package/dist/senses/sanctuary-health-acceptance-probe.js +786 -0
- package/dist/senses/sanctuary-health-runner.js +106 -0
- package/dist/senses/sanctuary-health.js +442 -0
- package/dist/senses/sanctuary-house.js +97 -0
- package/dist/senses/sanctuary-install-state-contract.js +169 -0
- package/dist/senses/sanctuary-interactive-control.js +410 -0
- package/dist/senses/sanctuary-media-catalog-contract.js +268 -0
- package/dist/senses/sanctuary-media-optimization.js +517 -0
- package/dist/senses/sanctuary-runtime.js +390 -0
- package/dist/senses/sanctuary-sab.js +85 -0
- package/dist/senses/sanctuary-storage-optimization-contract.js +32 -0
- package/dist/senses/shared-turn.js +827 -0
- package/dist/senses/shepherd/agent-presentation.js +88 -0
- package/dist/senses/shepherd/attention-page.js +166 -0
- package/dist/senses/shepherd/attention-sidebar.js +76 -0
- package/dist/senses/shepherd/attention.js +295 -0
- package/dist/senses/shepherd/checkin-config.js +76 -0
- package/dist/senses/shepherd/checkin-store.js +383 -0
- package/dist/senses/shepherd/client.js +196 -0
- package/dist/senses/shepherd/cmux.js +483 -0
- package/dist/senses/shepherd/composer.js +336 -0
- package/dist/senses/shepherd/conversation-hold.js +78 -0
- package/dist/senses/shepherd/feedback-reply.js +108 -0
- package/dist/senses/shepherd/feedback-source.js +20 -0
- package/dist/senses/shepherd/feedback-store.js +328 -0
- package/dist/senses/shepherd/feedback-submit.js +182 -0
- package/dist/senses/shepherd/feedback-worker.js +208 -0
- package/dist/senses/shepherd/guidance.js +273 -0
- package/dist/senses/shepherd/herdr.js +427 -0
- package/dist/senses/shepherd/host.js +14 -0
- package/dist/senses/shepherd/human-decision-guard.js +29 -0
- package/dist/senses/shepherd/judge-evaluation-command.js +183 -0
- package/dist/senses/shepherd/judge-evaluation-entry.js +13 -0
- package/dist/senses/shepherd/judge-evaluation.js +155 -0
- package/dist/senses/shepherd/judge.js +210 -0
- package/dist/senses/shepherd/notice-outbox.js +254 -0
- package/dist/senses/shepherd/observation-publisher.js +320 -0
- package/dist/senses/shepherd/operations-defaults.js +86 -0
- package/dist/senses/shepherd/operations.js +159 -0
- package/dist/senses/shepherd/owner-notice.js +496 -0
- package/dist/senses/shepherd/prompt-state.js +60 -0
- package/dist/senses/shepherd/recovery.js +543 -0
- package/dist/senses/shepherd/redact.js +66 -0
- package/dist/senses/shepherd/returns.js +79 -0
- package/dist/senses/shepherd/sense.js +862 -0
- package/dist/senses/shepherd/shepherd-judge-corpus-v1.json +170 -0
- package/dist/senses/shepherd/surface.js +125 -0
- package/dist/senses/shepherd/target-binding.js +13 -0
- package/dist/senses/shepherd/terminal-process.js +147 -0
- package/dist/senses/shepherd-entry.js +98 -0
- package/dist/senses/surface-tool.js +121 -0
- package/dist/senses/teams-attachments.js +68 -0
- package/dist/senses/teams-entry.js +78 -8
- package/dist/senses/teams-image.js +128 -0
- package/dist/senses/teams-off-turn.js +198 -0
- package/dist/senses/teams-outbox.js +242 -0
- package/dist/senses/teams.js +1167 -369
- package/dist/senses/telegram-admission.js +700 -0
- package/dist/senses/telegram-approval-runtime.js +793 -0
- package/dist/senses/telegram-attachments.js +128 -0
- package/dist/senses/telegram-audit-ledger.js +220 -0
- package/dist/senses/telegram-authority-transport.js +233 -0
- package/dist/senses/telegram-chat-actions.js +54 -0
- package/dist/senses/telegram-client.js +1799 -0
- package/dist/senses/telegram-effect-adapter.js +907 -0
- package/dist/senses/telegram-entry.js +86 -0
- package/dist/senses/telegram-handoff.js +150 -0
- package/dist/senses/telegram-identity-key.js +143 -0
- package/dist/senses/telegram.js +2370 -0
- package/dist/senses/terminal-handoff.js +44 -0
- package/dist/senses/trust-gate.js +104 -9
- package/dist/senses/voice/audio-playback.js +237 -0
- package/dist/senses/voice/audio-routing.js +119 -0
- package/dist/senses/voice/call-auth.js +250 -0
- package/dist/senses/voice/elevenlabs.js +202 -0
- package/dist/senses/voice/floor-control.js +431 -0
- package/dist/senses/voice/floor-controller.js +115 -0
- package/dist/senses/voice/golden-path.js +116 -0
- package/dist/senses/voice/index.js +29 -0
- package/dist/senses/voice/local-audio-control.js +344 -0
- package/dist/senses/voice/local-audio-devices.js +516 -0
- package/dist/senses/voice/local-audio-disclosure.js +174 -0
- package/dist/senses/voice/local-audio-identity.js +103 -0
- package/dist/senses/voice/local-audio-join.js +325 -0
- package/dist/senses/voice/local-audio-mute.js +199 -0
- package/dist/senses/voice/local-audio-notify.js +124 -0
- package/dist/senses/voice/local-audio-prompts.js +116 -0
- package/dist/senses/voice/local-audio-transport.js +427 -0
- package/dist/senses/voice/local-audio.js +281 -0
- package/dist/senses/voice/local-media-stream.js +145 -0
- package/dist/senses/voice/meeting.js +113 -0
- package/dist/senses/voice/outbound.js +190 -0
- package/dist/senses/voice/phone.js +33 -0
- package/dist/senses/voice/playback.js +139 -0
- package/dist/senses/voice/process-guards.js +51 -0
- package/dist/senses/voice/realtime-eval.js +496 -0
- package/dist/senses/voice/realtime-tool-schema.js +195 -0
- package/dist/senses/voice/realtime-trace.js +531 -0
- package/dist/senses/voice/transcript.js +70 -0
- package/dist/senses/voice/turn.js +191 -0
- package/dist/senses/voice/twilio-phone-runtime.js +836 -0
- package/dist/senses/voice/twilio-phone.js +5454 -0
- package/dist/senses/voice/types.js +2 -0
- package/dist/senses/voice/whisper.js +153 -0
- package/dist/senses/voice-entry.js +83 -0
- package/dist/senses/voice-realtime-eval-command.js +99 -0
- package/dist/senses/voice-realtime-eval-entry.js +21 -0
- package/dist/senses/voice-twilio-entry.js +87 -0
- package/dist/trips/core.js +138 -0
- package/dist/trips/store.js +265 -0
- package/dist/util/frontmatter.js +69 -0
- package/node_modules/@ouro.bot/friends/LICENSE +201 -0
- package/node_modules/@ouro.bot/friends/README.md +674 -0
- package/node_modules/@ouro.bot/friends/changelog.json +125 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.d.ts +39 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.js +54 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.d.ts +117 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.js +202 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.d.ts +50 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.js +32 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.d.ts +38 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.js +120 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.d.ts +195 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.js +342 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.js +140 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.d.ts +62 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.js +79 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.js +82 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.js +17 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.d.ts +15 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.js +61 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.d.ts +47 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.js +95 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.d.ts +58 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.js +113 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.js +87 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.js +19 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.d.ts +52 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.js +108 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.js +138 -0
- package/node_modules/@ouro.bot/friends/dist/audit.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/audit.js +86 -0
- package/node_modules/@ouro.bot/friends/dist/channel.d.ts +11 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/channel.js +80 -3
- package/node_modules/@ouro.bot/friends/dist/connect-authority.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/connect-authority.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/connect.d.ts +56 -0
- package/node_modules/@ouro.bot/friends/dist/connect.js +163 -0
- package/node_modules/@ouro.bot/friends/dist/consent.d.ts +34 -0
- package/node_modules/@ouro.bot/friends/dist/consent.js +65 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.d.ts +116 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.js +329 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.d.ts +21 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.js +39 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.js +27 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.js +69 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +136 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.js +8 -0
- package/node_modules/@ouro.bot/friends/dist/grants.d.ts +39 -0
- package/node_modules/@ouro.bot/friends/dist/grants.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/group-context.d.ts +21 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/group-context.js +5 -4
- package/node_modules/@ouro.bot/friends/dist/identity.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/identity.js +68 -0
- package/node_modules/@ouro.bot/friends/dist/index.d.ts +73 -0
- package/node_modules/@ouro.bot/friends/dist/index.js +161 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.d.ts +14 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.js +157 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.d.ts +105 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.js +205 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.d.ts +2 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.js +16 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.d.ts +40 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +549 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.d.ts +6 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.js +14 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.js +48 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +445 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.d.ts +30 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.js +194 -0
- package/node_modules/@ouro.bot/friends/dist/message.d.ts +75 -0
- package/node_modules/@ouro.bot/friends/dist/message.js +99 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +82 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.js +200 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.d.ts +94 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.js +232 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.d.ts +18 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.js +161 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/missions.d.ts +31 -0
- package/node_modules/@ouro.bot/friends/dist/missions.js +98 -0
- package/node_modules/@ouro.bot/friends/dist/notes.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/notes.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/observability.d.ts +27 -0
- package/node_modules/@ouro.bot/friends/dist/observability.js +31 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.js +51 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.d.ts +59 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.js +276 -0
- package/node_modules/@ouro.bot/friends/dist/results.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/results.js +2 -0
- package/node_modules/@ouro.bot/friends/dist/room.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/room.js +40 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.js +125 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.js +20 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.d.ts +29 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.d.ts +23 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.js +47 -0
- package/node_modules/@ouro.bot/friends/dist/share.d.ts +108 -0
- package/node_modules/@ouro.bot/friends/dist/share.js +278 -0
- package/node_modules/@ouro.bot/friends/dist/standing.d.ts +83 -0
- package/node_modules/@ouro.bot/friends/dist/standing.js +111 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.d.ts +82 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.js +1074 -0
- package/node_modules/@ouro.bot/friends/dist/store.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +8 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/tokens.js +2 -2
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.js +67 -0
- package/node_modules/@ouro.bot/friends/dist/types.d.ts +321 -0
- package/node_modules/@ouro.bot/friends/dist/types.js +55 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.js +35 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.js +29 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.js +39 -0
- package/node_modules/@ouro.bot/friends/package.json +81 -0
- package/node_modules/libsodium/LICENSE +16 -0
- package/node_modules/libsodium/README.md +281 -0
- package/node_modules/libsodium/dist/modules/libsodium.js +1 -0
- package/node_modules/libsodium/dist/modules-esm/libsodium.mjs +1 -0
- package/node_modules/libsodium/package.json +54 -0
- package/node_modules/libsodium-wrappers/LICENSE +16 -0
- package/node_modules/libsodium-wrappers/README.md +281 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.d.ts +2155 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js +1 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.d.mts +2743 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.mjs +1 -0
- package/node_modules/libsodium-wrappers/package.json +74 -0
- package/npm-shrinkwrap.json +8789 -0
- package/package.json +92 -14
- package/skills/agent-commerce.md +113 -0
- package/skills/browser-navigation.md +117 -0
- package/skills/commerce-setup-guide.md +116 -0
- package/skills/commerce-setup.md +84 -0
- package/skills/configure-dev-tools.md +99 -0
- package/skills/sense-setup.md +56 -0
- package/skills/travel-planning.md +138 -0
- package/dist/heart/daemon/auth-flow.js +0 -432
- package/dist/heart/daemon/ouro-path-installer.js +0 -205
- package/dist/heart/daemon/ouro-version-manager.js +0 -171
- package/dist/heart/daemon/update-hooks.js +0 -138
- package/dist/heart/obligations.js +0 -197
- package/dist/heart/safe-workspace.js +0 -381
- package/dist/heart/session-recall.js +0 -216
- package/dist/mind/friends/resolver.js +0 -84
- package/dist/mind/friends/store-file.js +0 -190
- package/dist/mind/friends/trust-explanation.js +0 -74
- package/dist/mind/friends/types.js +0 -29
- package/dist/repertoire/tasks/board.js +0 -134
- package/dist/repertoire/tasks/index.js +0 -224
- package/dist/repertoire/tasks/lifecycle.js +0 -80
- package/dist/repertoire/tasks/middleware.js +0 -65
- package/dist/repertoire/tasks/parser.js +0 -173
- package/dist/repertoire/tasks/scanner.js +0 -132
- package/dist/repertoire/tasks/transitions.js +0 -144
- package/dist/repertoire/tools-bluebubbles.js +0 -93
- package/dist/senses/bluebubbles-entry.js +0 -13
- package/dist/senses/bluebubbles-media.js +0 -339
- package/dist/senses/bluebubbles.js +0 -1199
- package/dist/senses/debug-activity.js +0 -154
- package/dist/senses/inner-dialog-worker.js +0 -90
- package/dist/senses/inner-dialog.js +0 -536
- package/subagents/README.md +0 -7
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
- /package/dist/{repertoire/tasks/types.js → heart/attachments/sources/adapter.js} +0 -0
- /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
- /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
- /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
- /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
- /package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/store.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,e as Ys,c as Qs,j as e,B as as,u as Gs,D as Xs,M as Js,a as ht,b as yt,C as Zs,d as eo,f as kt,g as to,h as so,i as oo,k as is,l as no,m as ro,n as ao,o as io,p as lo,S as ls,q as co,s as uo,t as xo,v as mo,w as po,x as ho,y as fo,z as go,A as bo,E as cs,F as vo,G as jo,H as wo,I as No,J as yo,K as ko,L as Co,T as So,N as $o,O as Ao,P as Eo,Q as To}from"./vendor-D_wlGdJf.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function o(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=o(r);fetch(r.href,a)}})();const ds="/api";async function U(t,s){const o=await fetch(`${ds}${t}`,{headers:{accept:"application/json"},signal:s==null?void 0:s.signal});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}function Ro(t,s){const o=new EventSource(`${ds}/events`);let n=!1;s==null||s("connecting");const r=a=>{if(!(n||!(a instanceof MessageEvent)))try{const c=JSON.parse(a.data);t("state-changed",c)}catch{t("state-changed",{})}};return o.addEventListener("state-changed",r),o.onopen=()=>{n||(s==null||s("connected"),t("connected",{}))},o.onerror=()=>{n||s==null||s("reconnecting")},()=>{n=!0,o.removeEventListener("state-changed",r),o.onopen=null,o.onerror=null,o.close()}}function q(t){if(!t)return"unknown";const s=Date.now()-new Date(t).getTime();return s<0||s<6e4?"just now":s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:`${Math.floor(s/864e5)}d ago`}function G(t,s){if(!t)return"";if(t.length<=s)return t;const o=t.lastIndexOf(" ",s);return(o>s*.6?t.slice(0,o):t.slice(0,s))+"…"}const us=i.createContext(()=>{});function ge(){return i.useContext(us)}const Lo=new Set(["overview","mail","sessions","work","connections","inner","notes","runtime"]);function xs(t){const s=t.replace(/^#\/?/,"");if(!s.startsWith("agent/"))return null;const o=s.split("/"),n=o[1]?decodeURIComponent(o[1]):"";if(!n)return null;const r=o[2]??"overview",a=Lo.has(r)?r:"overview",c=o.slice(3),h=c.length>0?c.map(decodeURIComponent).join("/"):void 0;return{agent:n,tab:a,focus:h}}function He(t){let s=`#/agent/${encodeURIComponent(t.agent)}`;return(t.tab!=="overview"||t.focus)&&(s+=`/${t.tab}`),t.focus&&(s+=`/${t.focus.split("/").map(encodeURIComponent).join("/")}`),s}function Ct(t){const s=t.replace(/^#\/?/,"").split("/");if(s[0]!=="supervision"||s.length>3)return null;try{const o=s[1]?decodeURIComponent(s[1]):null;return o&&!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(o)?null:{agent:o,...s[2]?{focus:decodeURIComponent(s[2])}:{}}}catch{return null}}function St(t,s){return`#/supervision${t?`/${encodeURIComponent(t)}`:""}`}function ee(t,s,o){/* istanbul ignore else @preserve -- the else path exists only in production bundles; scripts/dev-strip.test.mjs covers it */throw new Error(`[ouro-ui] ${t}: ${s}`)}function ue(t,s,o,n){i.useRef(!1),i.useEffect(()=>{},[t,s,o,n])}const Mo=Ys({extend:{theme:{radius:["ouro-sm","ouro-md","ouro-lg","ouro-xl","ouro-2xl","ouro-3xl","ouro-4xl"]}}});function F(...t){return Mo(Qs(t))}function te(t,s){i.useRef({}),i.useEffect(()=>{})}const Io="sr-only text-base leading-5 focus-visible:top-2 focus-visible:start-2 focus-visible:z-20 focus-visible:m-0 focus-visible:size-auto focus-visible:overflow-visible focus-visible:[clip-path:none] focus-visible:px-4 focus-visible:py-2.5 focus-visible:whitespace-nowrap focus-visible:rounded-ouro-lg focus-visible:bg-background focus-visible:text-foreground focus-visible:font-medium focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:outline-solid",_o="z-10 col-start-1 row-start-1 box-border bg-background max-sm:sticky max-sm:top-0 max-sm:flex max-sm:min-h-14 max-sm:items-center max-sm:border-0 max-sm:border-b max-sm:border-solid max-sm:border-border max-sm:ps-[max(0.5rem,env(safe-area-inset-left,0px))] sm:sticky sm:top-0 sm:row-span-2 sm:h-dvh",Oo="sticky top-0 z-10 col-start-2 row-start-1 box-border flex min-w-0 items-center gap-2 border-0 border-b border-solid border-border bg-background ps-2 pe-[max(1rem,env(safe-area-inset-right,0px))] sm:ps-6";function Do(t){const{sidebar:s,header:o,children:n,as:r,bleed:a,skipLabel:c="Skip to content",className:h,ref:d,navbar:b}=t;ue("SidebarLayout",h,""),te();const x=i.useId(),w=r==="div"?"div":"main",$=o!==void 0?"header":"div",u=i.useRef(null);return e.jsxs("div",{ref:d,"data-ouro":"sidebar-layout",className:F("relative grid min-h-dvh grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)] bg-background text-foreground",h),children:[e.jsx("a",{href:`#${x}`,"data-ouro-control":"sidebar-layout","data-ouro-part":"skip-link",onClick:()=>u.current.focus(),className:Io,children:c}),e.jsx("div",{"data-ouro-sidebar-layout-sidebar":"",className:_o,children:s}),e.jsx($,{"data-ouro-sidebar-layout-header":"",className:F(Oo,o!==void 0?"min-h-14":"sm:hidden"),children:o}),e.jsx(w,{ref:u,id:x,tabIndex:-1,className:F("col-span-2 row-start-2 box-border min-w-0 outline-none sm:col-span-1 sm:col-start-2",!a&&"p-4 sm:p-6"),children:n})]})}function $t(t){const s=t.replace(/[?#].*$/,"").replace(/\/+$/,"");return s===""?"/":s}function Po(t,s){if(s===void 0)return;const o=$t(s);let n,r=-1;for(const a of t){const c=$t(a);if(c===o)return a;c!=="/"&&o.startsWith(`${c}/`)&&c.length>r&&(n=a,r=c.length)}return n}const Uo=t=>i.createElement("a",t),zo=i.createContext({linkComponent:Uo});function ms(){return i.useContext(zo)}const Bo=/^([a-z][a-z\d+.-]*:|\/\/)/i;function Ho(t){return Bo.test(t)}function Fo(t){const s=new Set((t??"").split(/\s+/).filter(Boolean));return s.add("noopener"),s.add("noreferrer"),[...s].join(" ")}function Ke({href:t,target:s,rel:o,reloadDocument:n,...r}){const{linkComponent:a}=ms(),c=Ho(t),h={...r,href:t,target:s,rel:c&&s==="_blank"?Fo(o):o},d=r.download!==void 0&&r.download!==null&&r.download!==!1;return c||n||d?i.createElement("a",h):i.createElement(a,h)}let ie=null,At=null;function Et(t){(ie===null||At!==matchMedia)&&(ie=new Map,At=matchMedia,queueMicrotask(()=>ie=null));const s=ie.get(t);if(s!==void 0)return s;const o=matchMedia(t);return typeof MediaQueryList=="function"&&o instanceof MediaQueryList&&ie.set(t,o),o}function ps(t,s){const o=i.useCallback(r=>{if(typeof matchMedia!="function")return()=>{};const a=Et(t),c=()=>{ie==null||ie.delete(t),r()};return a.addEventListener("change",c),()=>a.removeEventListener("change",c)},[t]),n=i.useCallback(()=>typeof matchMedia=="function"?Et(t).matches:s,[t,s]);return i.useSyncExternalStore(o,n,()=>s)}let Z,ve;const Tt=100;function qo(){return Z!=null&&Z.isConnected||(Z=document.createElement("div"),Z.setAttribute("role","status"),Z.setAttribute("aria-live","polite"),Z.setAttribute("aria-atomic","true"),Z.setAttribute("data-ouro-announcer",""),Object.assign(Z.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",border:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"}),document.body.append(Z)),Z}function Vo(t,{delayMs:s=Tt,onWrite:o}={}){/* istanbul ignore if @preserve -- server only */if(typeof document>"u")return;const n=qo();n.textContent="",clearTimeout(ve);const r=setTimeout(()=>{ve=void 0,n.textContent=t,o==null||o()},Math.max(Tt,s));return ve=r,()=>{ve===r&&(clearTimeout(r),ve=void 0)}}const Ko=new Set([" ","PageUp","PageDown","Home","End","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab"]),Wo=1e3,Yo=200,Qo=1e3,Qe=["Enter"," "],Rt=["ArrowDown","ArrowUp"],he=new Set;let dt=0,ut=0,ce=0,hs,Te,fs,Lt,me,Ue=null;function ft(t){Ue??(Ue=t.style.scrollBehavior),t.style.scrollBehavior="auto"}function gs(t){Ue!==null&&t.style.scrollBehavior==="auto"&&(t.style.scrollBehavior=Ue),Ue=null}const bs=()=>Te!==void 0||[...he].some(t=>t.querySelector("[data-open]")!==null);function vs(t){bs()||(dt=t.scrollX,ut=t.scrollY,he.size===0&&(hs=Xo(t)))}function gt(t){he.size>0||Te!==void 0||(hs(),gs(t.document.documentElement))}function Fe(){clearTimeout(Te),Te=void 0,me==null||me.trigger.removeEventListener("click",js),me=void 0}function js(){const{view:t}=me;Fe(),gt(t)}function Mt(t,s,o){if(s===Lt||(Lt=s,t.getAttribute("aria-expanded")==="true"))return;const n=t.ownerDocument.defaultView;n.scrollTo({left:n.scrollX,top:n.scrollY,behavior:"instant"}),vs(n),Fe(),Te=setTimeout(()=>{Fe(),gt(n)},Qo),ce=0,o?(me={trigger:t,view:n},t.addEventListener("click",js)):ft(n.document.documentElement)}function je(t,s=!1,o=n=>n.button===0){const n=new Set(t);return{onPointerDown:r=>{o(r)&&Mt(r.currentTarget,r.nativeEvent,s)},onKeyDown:r=>{n.has(r.key)&&(fs=r.nativeEvent,Mt(r.currentTarget,r.nativeEvent,s))}}}const de={button:je(Qe),listButton:je([...Qe,...Rt]),listInput:je(Rt),dialog:je(Qe,!0),contextMenu:je([],!1,t=>t.button===2)};function Go(t){const s=t.ownerDocument.defaultView;return vs(s),Fe(),ce=0,ft(s.document.documentElement),he.add(t),()=>{he.delete(t),gt(s)}}function Xo(t){const s=t.document,o=()=>{ce=performance.now()+Wo,gs(s.documentElement)},n=d=>{(d.target===s.documentElement||d.button===1)&&o()},r=d=>{[...he].some(b=>b.contains(d.target))&&o()},a=d=>{d!==fs&&(d.defaultPrevented?(ce=0,ft(s.documentElement)):Ko.has(d.key)&&o())},c=()=>{const d=performance.now(),b=d<ce;if(b&&(ce=Math.max(ce,d+Yo)),b||!bs()){dt=t.scrollX,ut=t.scrollY;return}t.scrollTo({left:dt,top:ut,behavior:"instant"})},h={capture:!0,passive:!0};return s.addEventListener("wheel",o,h),s.addEventListener("touchmove",o,h),s.addEventListener("pointerdown",n,h),s.addEventListener("click",r,h),t.addEventListener("keydown",a),s.addEventListener("scroll",c),()=>{s.removeEventListener("wheel",o,h),s.removeEventListener("touchmove",o,h),s.removeEventListener("pointerdown",n,h),s.removeEventListener("click",r,h),t.removeEventListener("keydown",a),s.removeEventListener("scroll",c)}}function qe(t,s){if(typeof t=="function"){const o=t(s);return typeof o=="function"?o:()=>t(null)}return t?(t.current=s,()=>{t.current=null}):()=>{}}function Re(t,s){return i.useCallback(o=>{const n=qe(s,o),r=qe(t,o);return()=>{n(),r()}},[t,s])}function Ve(){return e.jsx("span",{"aria-hidden":"true","data-ouro-touch-target":"",className:"absolute top-1/2 left-1/2 hidden size-[max(100%,44px)] -translate-1/2 pointer-coarse:block"})}const Jo="press relative box-border inline-flex shrink-0 items-center justify-center align-middle rounded-ouro-control border border-solid font-medium whitespace-nowrap no-underline select-none touch-manipulation [-webkit-tap-highlight-color:transparent] outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid before:pointer-events-none before:absolute before:-inset-px before:rounded-[inherit] before:[corner-shape:inherit] before:bg-current before:opacity-0 before:transition-opacity before:duration-(--ouro-duration-fast) before:ease-[ease] not-data-disabled:not-active:pointer-fine:hover:before:opacity-[var(--ouro-state-hover,8%)] not-data-disabled:active:before:opacity-[var(--ouro-state-pressed,14%)] bg-(--ouro-bg) border-(--ouro-bd) [--ouro-sq-w:1px] not-data-disabled:not-active:pointer-fine:hover:[--ouro-state:var(--ouro-state-hover,8%)] not-data-disabled:active:[--ouro-state:var(--ouro-state-pressed,14%)] motion-safe:not-data-disabled:active:scale-(--ouro-press-scale) disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-progress",Ge="h-(--ouro-button-h) px-(--ouro-button-px)",It={sm:`${Ge} gap-1.5 text-sm [--ouro-button-h:calc(var(--spacing)*9)] [--ouro-button-px:calc(var(--spacing)*3)] sm:[--ouro-button-h:calc(var(--spacing)*8)] sm:[--ouro-button-px:calc(var(--spacing)*2.5)]`,md:`${Ge} gap-2 text-base sm:text-sm [--ouro-button-h:calc(var(--spacing)*11)] [--ouro-button-px:calc(var(--spacing)*4)] sm:[--ouro-button-h:calc(var(--spacing)*9)] sm:[--ouro-button-px:calc(var(--spacing)*3.5)]`,lg:`${Ge} gap-2 text-base [--ouro-button-h:calc(var(--spacing)*12)] [--ouro-button-px:calc(var(--spacing)*5)] sm:[--ouro-button-h:calc(var(--spacing)*11)]`,inline:"h-auto min-w-6 px-1 py-[3px] -my-1 gap-1 rounded-ouro-md align-baseline text-[length:inherit] leading-[inherit]"},Xe={solid:{primary:"[--ouro-bd:transparent] [--ouro-bg:var(--ouro-action,var(--primary))] text-(--ouro-action-foreground,var(--primary-foreground)) not-data-disabled:not-active:pointer-fine:hover:[--ouro-bg:var(--ouro-action-hover,var(--ouro-action,var(--primary)))] not-data-disabled:active:[--ouro-bg:var(--ouro-action-active,var(--ouro-action,var(--primary)))] data-disabled:[--ouro-bg:var(--ouro-action-disabled,var(--ouro-action,var(--primary)))] data-disabled:text-(--ouro-action-disabled-foreground,var(--ouro-action-foreground,var(--primary-foreground))) disabled:opacity-(--ouro-action-disabled-opacity,0.5)",secondary:"[--ouro-bd:transparent] [--ouro-bg:var(--secondary)] text-secondary-foreground",destructive:"[--ouro-bd:transparent] [--ouro-bg:var(--destructive)] text-destructive-foreground",success:"[--ouro-bd:transparent] [--ouro-bg:var(--success)] text-success-foreground",warning:"[--ouro-bd:transparent] [--ouro-bg:var(--warning)] text-warning-foreground"},soft:{primary:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--primary)_10%,transparent)] text-[color-mix(in_oklab,var(--primary)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",secondary:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--secondary)_50%,transparent)] text-secondary-foreground contrast-more:[--ouro-bd:currentColor]",destructive:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--destructive)_10%,transparent)] text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",success:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--success)_10%,transparent)] text-[color-mix(in_oklab,var(--success)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",warning:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--warning)_10%,transparent)] text-[color-mix(in_oklab,var(--warning)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]"},outline:{primary:"[--ouro-bd:color-mix(in_oklab,var(--primary)_45%,transparent)] [--ouro-bg:transparent] text-foreground",secondary:"[--ouro-bd:var(--border)] [--ouro-bg:transparent] text-foreground",destructive:"[--ouro-bd:color-mix(in_oklab,var(--destructive)_45%,transparent)] [--ouro-bg:transparent] text-destructive",success:"[--ouro-bd:color-mix(in_oklab,var(--success)_45%,transparent)] [--ouro-bg:transparent] text-success",warning:"[--ouro-bd:color-mix(in_oklab,var(--warning)_45%,transparent)] [--ouro-bg:transparent] text-warning"},plain:{primary:"[--ouro-bd:transparent] [--ouro-bg:transparent] text-primary",secondary:"[--ouro-bd:transparent] [--ouro-bg:transparent] text-foreground",destructive:"[--ouro-bd:transparent] [--ouro-bg:transparent] text-destructive",success:"[--ouro-bd:transparent] [--ouro-bg:transparent] text-success",warning:"[--ouro-bd:transparent] [--ouro-bg:transparent] text-warning"}},_t="size-[1.25em] shrink-0",Zo="[&>[data-ouro-label]>svg:not([class*='size-'])]:size-[1.25em] [&>[data-ouro-label]>svg]:shrink-0",en="min-w-(--ouro-button-h) [--ouro-button-px:0px] sm:[--ouro-button-px:0px]",tn=["button","submit","reset"];function sn(){return e.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex items-center justify-center transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out) starting:opacity-0",children:e.jsxs("svg",{"data-ouro-spinner":"",viewBox:"0 0 24 24",fill:"none",className:"size-[1.25em] animate-[ouro-spin_0.8s_linear_infinite] motion-reduce:animate-[ouro-pulse_1.6s_ease-in-out_infinite]",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.25"}),e.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}const Ot=t=>t.preventDefault(),on="button,a[href],select,[contenteditable]:not([contenteditable=false]),input:is([type=button],[type=submit],[type=reset],[type=checkbox],[type=radio],[type=file]),[role=button],[role=link],[role=menuitem],[role=menuitemcheckbox],[role=menuitemradio],[role=option],[role=checkbox],[role=radio],[role=switch],[role=tab],[role=treeitem],[aria-expanded=true]";function nn(t,s){if(t.key!=="Enter"||t.defaultPrevented||t.isComposing||t.keyCode===229||t.shiftKey||t.altKey)return!1;const o=t.target;return s.contains(o)?o.matches("textarea")?t.metaKey||t.ctrlKey:!o.matches(on):!1}function rn(t){const{tone:s="primary",variant:o="solid",size:n="md",fullWidth:r,loading:a,loadingLabel:c="Loading",startIcon:h,endIcon:d,children:b,className:x,isLoading:w,color:$,asChild:u,leftIcon:g,rightIcon:m,reloadDocument:j,default:y,...v}=t,E=Object.hasOwn(Xe.solid,s)?s:"primary",l=Object.hasOwn(Xe,o)?o:"solid",k=Object.hasOwn(It,n)?n:"md";ue("Button",x,""),te();const T=i.useRef(a);i.useEffect(()=>{a&&!T.current&&Vo(c),T.current=a},[a,c]);const A=i.useRef(null),M=i.useRef(void 0),f=v.onClick;i.useEffect(()=>{M.current=f});const p=y&&v.href===void 0&&!v.disabled&&!a;i.useEffect(()=>{const S=p?A.current.closest("[role=dialog],[role=alertdialog]"):null;if(!S)return;const R=B=>{var D,P;if(!nn(B,S))return;B.preventDefault(),(D=M.current)==null||D.call(M,B);const N=A.current;N.type==="submit"&&((P=N.form)==null||P.requestSubmit(N))};return S.ownerDocument.addEventListener("keydown",R),()=>S.ownerDocument.removeEventListener("keydown",R)},[p]);const C=Re(v.ref,A),L=v,I=k!=="inline"&&!h&&!d&&i.isValidElement(b)&&b.type!==i.Fragment&&!(b.type==="img"&&b.props.width!==b.props.height)&&!!(L["aria-label"]||L["aria-labelledby"]),O=F(Jo,Zo,It[k],I&&en,Xe[l][E],r&&"w-full",x),V=F("relative transition-opacity duration-(--ouro-duration-fast) ease-(--ouro-ease-out)",a&&"opacity-0"),W=e.jsxs(e.Fragment,{children:[e.jsx(Ve,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true"}),e.jsxs("span",{"data-ouro-label":"",className:F("inline-flex grow items-center gap-[inherit] [justify-content:inherit]",V),children:[h&&e.jsx(h,{"aria-hidden":"true",className:F(_t,"-ms-0.5")}),b]}),d&&e.jsx(d,{"aria-hidden":"true",className:F(_t,V,"-me-0.5")}),a&&e.jsx(sn,{})]});if(v.href!==void 0){const{onClick:S,type:R,disabled:B,...N}=v;return e.jsx(Ke,{"data-ouro-control":"button","data-ouro-part":"root",...N,reloadDocument:j,onClick:a?Ot:S,onAuxClick:a?Ot:N.onAuxClick,className:O,"data-ouro":"button","data-ouro-squircle":"","data-variant":l,"data-tone":E,"data-loading":a?"":void 0,"data-disabled":a?"":void 0,"aria-busy":a||N["aria-busy"],"aria-disabled":a||N["aria-disabled"],children:W})}const{ref:z,disabled:H,type:Y="button",...K}=v,ne=K["aria-haspopup"]==="dialog"?{onPointerDown:S=>{var R;(R=K.onPointerDown)==null||R.call(K,S),de.dialog.onPointerDown(S)},onKeyDown:S=>{var R;(R=K.onKeyDown)==null||R.call(K,S),de.dialog.onKeyDown(S)}}:{},se=tn.includes(Y)?Y:"button";return e.jsx(as,{"data-ouro-control":"button","data-ouro-part":"root",...K,...ne,ref:C,type:se,disabled:!!(H||a),focusableWhenDisabled:!!(a&&!H),className:O,"data-ouro":"button","data-ouro-squircle":"","data-variant":l,"data-tone":E,"data-loading":a?"":void 0,"data-default":y?"":void 0,"aria-keyshortcuts":y?"Enter":K["aria-keyshortcuts"],"aria-busy":a||K["aria-busy"],children:W})}const Me=new Set;let we;function an(t){return Me.add(t),we===void 0&&(we=new MutationObserver(()=>Me.forEach(s=>s())),we.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]})),()=>{Me.delete(t),!(Me.size>0)&&(we.disconnect(),we=void 0)}}function Je({of:t,children:s}){const o=Gs(),[n,r]=i.useState(!1);return i.useLayoutEffect(()=>{const a=()=>{var c;return r(((c=((t instanceof Element?t:t==null?void 0:t.current)??document.documentElement).closest("[dir]"))==null?void 0:c.matches('[dir="rtl" i]'))===!0)};return a(),an(a)},[t]),e.jsx(Xs,{direction:n?"rtl":o,children:s})}const ln={cmd:["Meta"],command:["Meta"],meta:["Meta"],ctrl:["Control"],control:["Control"],alt:["Alt"],option:["Alt"],shift:["Shift"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"],arrowup:["ArrowUp"],arrowdown:["ArrowDown"],arrowleft:["ArrowLeft"],arrowright:["ArrowRight"],esc:["Escape"],escape:["Escape"],enter:["Enter"],return:["Enter"],del:["Delete"],delete:["Delete"],space:["Space"]};function cn(t){return t==="apple"?["Meta"]:t==="unknown"?["Control","Meta"]:["Control"]}function dn(t,s="unknown"){let o=[[]];for(const n of t){const r=n.toLowerCase(),a=r==="mod"?cn(s):ln[r]??[n.charAt(0).toUpperCase()+n.slice(1)];o=o.flatMap(c=>a.map(h=>[...c,h]))}return o.map(n=>n.join("+")).join(" ")}function un(){var o;const t=navigator,s=((o=t.userAgentData)==null?void 0:o.platform)??t.platform;return/mac|iphone|ipad|ipod|ios/i.test(s)?"apple":/^win/i.test(s)?"windows":"other"}const xn=()=>()=>{},mn=()=>"unknown";function We(){return i.useSyncExternalStore(xn,un,mn)}const pn=["top","bottom","left","right"],ws=["start","center","end"];function Ns(t,s){return pn.includes(t)?t:s}function hn(t){return ws.includes(t)?t:"center"}const ys="relative isolate z-(--ouro-layer) in-[[data-ouro$='-portal']]:z-1001",ks="fixed",fn="origin-(--transform-origin) [transition:transform_var(--ouro-floating-duration,var(--ouro-duration-base))_var(--ouro-ease-out),opacity_var(--ouro-floating-duration,var(--ouro-duration-base))_var(--ouro-ease-out)] data-starting-style:[transform:scale(0.96)] data-starting-style:opacity-0 data-ending-style:[transform:scale(0.96)] data-ending-style:opacity-0 data-ending-style:duration-(--ouro-duration-fast) motion-reduce:[transition:opacity_var(--ouro-duration-base)_var(--ouro-ease-out)] motion-reduce:data-starting-style:[transform:none] motion-reduce:data-ending-style:[transform:none]";function gn(t){const s=ps("(min-width: 640px)",!0);return t==="sheet"||t==="auto"&&!s}const Cs=i.createContext(!1),bn=i.createContext(!1),vn=i.createContext(!1);function bt({children:t}){return i.createElement(Cs.Provider,{value:!0},t)}const jn=()=>()=>{},wn=t=>t&&"current"in t?t.current??void 0:t;function Ss(t,s=!1){const{portalContainer:o}=ms(),n=i.useContext(Cs),r=i.useSyncExternalStore(jn,()=>wn(o),()=>{}),a=i.useRef(void 0),[c]=i.useState(()=>{const h=b=>{var x;(x=a.current)==null||x.call(a),a.current=b?Go(b):void 0};return{hold:h,check:b=>{s&&h(b)}}});return n?s?{ref:c.hold}:{}:{...r?{container:r}:{},ref:c.check}}const Dt={mod:["⌘","Command","Ctrl"],cmd:["⌘","Command","Win"],ctrl:["⌃","Control","Ctrl"],alt:["⌥","Option","Alt"],shift:["⇧","Shift","Shift"],enter:["↩","Return","Enter"],escape:["Esc","","Esc"],tab:["⇥","Tab","Tab"],backspace:["⌫","Delete","Backspace"],delete:["⌦","Forward delete","Del"],space:["Space","","Space"],up:["↑","Up arrow","↑","Up arrow"],down:["↓","Down arrow","↓","Down arrow"],left:["←","Left arrow","←","Left arrow"],right:["→","Right arrow","→","Right arrow"]},Pt={meta:"cmd",command:"cmd",control:"ctrl",option:"alt",return:"enter",esc:"escape",arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"},Nn={ctrl:0,alt:1,shift:2,mod:3,cmd:3},yn={cmd:0,mod:1,ctrl:1,alt:2,shift:3};function $s(t){const s=t.toLowerCase();return Object.hasOwn(Pt,s)?Pt[s]:s}function Ut(t){return new RegExp("^(?!\\p{ASCII})\\p{Emoji}$","u").test(t)?`${t}︎`:t}function kn(t,s){const o=$s(t);if(o==="cmd"&&s!=="apple")return{text:s==="windows"?"Win":"Ctrl",name:void 0};if(!Object.hasOwn(Dt,o))return{text:Ut(t.length===1?t.toUpperCase():t),name:void 0};const[n,r,a,c]=Dt[o];return s==="apple"?{text:Ut(n),name:r||void 0}:{text:a,name:c}}function Cn(t){const{keys:s,className:o,children:n,shortcut:r,...a}=t,c=We(),h=typeof s=="string"?s.split("+"):s??[];ue("Kbd",o,""),te();const d=c==="apple",b=d?Nn:yn,x=$=>b[$s($)]??4,w=[...h].sort(($,u)=>x($)-x(u));return e.jsx("kbd",{...a,"data-ouro":"kbd","data-platform":d?"apple":c==="unknown"?"unknown":"other",className:F("box-border inline-flex h-[1.6em] min-w-[1.6em] items-center justify-center gap-[0.15em] align-[0.1em] rounded-ouro-sm border border-solid border-border bg-muted px-[0.35em] [font-family:inherit] text-[0.85em]/none font-medium text-foreground whitespace-nowrap select-none",o),children:w.map(($,u)=>{const{text:g,name:m}=kn($,c);return e.jsxs(i.Fragment,{children:[!d&&u>0&&"+",e.jsx("kbd",{className:"m-0 [font:inherit]",children:m?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true","data-glyph":"",children:g}),e.jsx("span",{className:"sr-only",children:m})]}):g})]},u)})})}const Sn="outline-none",$n="outline-none fixed! inset-x-0! top-auto! bottom-0! w-auto! transform-none!",An="box-border min-w-48 max-w-(--available-width) max-h-(--available-height) overflow-y-auto overscroll-contain p-1 rounded-ouro-lg bg-popover text-popover-foreground outline-none ring-1 ring-border/60 shadow-(--shadow-lg) has-[[data-ouro-menu-indicator]]:[--ouro-menu-inset:1.5rem] origin-(--transform-origin) [transition:transform_var(--ouro-duration-fast)_var(--ouro-ease-out),opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] data-ending-style:[transform:scale(0.96)] data-ending-style:opacity-0 motion-reduce:[transition:opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] motion-reduce:data-ending-style:[transform:none] data-instant:[transition:none]",En="box-border w-full max-h-[min(80dvh,calc(100dvh-4rem))] overflow-y-auto overscroll-contain px-2 pt-2 pb-[calc(env(safe-area-inset-bottom,0px)+0.5rem)] rounded-t-ouro-xl bg-popover text-popover-foreground outline-none [box-shadow:var(--ouro-shadow-sheet-bottom)] has-[[data-ouro-menu-indicator]]:[--ouro-menu-inset:1.5rem] [transition:transform_var(--ouro-duration-sheet)_var(--ouro-ease-drawer),opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] data-starting-style:[transform:translateY(100%)] data-ending-style:[transform:translateY(100%)] data-ending-style:duration-(--ouro-duration-base) motion-reduce:[transition:opacity_var(--ouro-duration-base)_var(--ouro-ease-out)] motion-reduce:data-starting-style:[transform:none] motion-reduce:data-ending-style:[transform:none] motion-reduce:data-starting-style:opacity-0 motion-reduce:data-ending-style:opacity-0",Tn="fixed inset-0 bg-(--ouro-backdrop-color) opacity-(--ouro-backdrop-max) transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out) data-starting-style:opacity-0 data-ending-style:opacity-0",fe="relative m-0 box-border flex w-full min-h-11 pointer-fine:min-h-8 cursor-default items-center gap-3 rounded-ouro-md py-1.5 pe-2 ps-[calc(0.5rem+var(--ouro-menu-inset,0px))] text-start text-base leading-5 pointer-fine:text-sm text-popover-foreground no-underline select-none outline-ring focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid [-webkit-tap-highlight-color:transparent] data-highlighted:bg-[color-mix(in_oklab,var(--foreground)_var(--ouro-state-hover,6%),var(--popover))] data-highlighted:text-accent-foreground active:bg-[color-mix(in_oklab,var(--foreground)_var(--ouro-state-pressed,12%),var(--popover))] active:text-accent-foreground data-popup-open:bg-[color-mix(in_oklab,var(--foreground)_var(--ouro-state-hover,6%),var(--popover))] data-popup-open:text-accent-foreground forced-colors:data-highlighted:bg-[Highlight] forced-colors:data-highlighted:text-[HighlightText] forced-colors:data-popup-open:bg-[Highlight] forced-colors:data-popup-open:text-[HighlightText] aria-[current=page]:font-medium aria-[current=page]:before:absolute aria-[current=page]:before:inset-y-2 aria-[current=page]:before:start-0 aria-[current=page]:before:w-0.5 aria-[current=page]:before:rounded-full aria-[current=page]:before:bg-current aria-[current=page]:before:content-[''] forced-colors:aria-[current=page]:before:border-s-2 forced-colors:aria-[current=page]:before:border-solid forced-colors:aria-[current=page]:before:border-current data-[tone=destructive]:text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))] data-[tone=destructive]:data-highlighted:bg-destructive/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",As="absolute start-2 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center",Es="box-border py-1.5 pe-2 ps-[calc(0.5rem+var(--ouro-menu-inset,0px))] text-xs leading-4 font-medium text-muted-foreground select-none",Ts="-mx-1 my-1 h-px border-0 bg-border",Rn="absolute",Ln="relative m-0 box-border inline-flex h-11 pointer-fine:h-8 items-center rounded-ouro-md border-0 bg-transparent px-3 font-[inherit] text-base pointer-fine:text-sm leading-5 font-medium text-foreground cursor-default select-none [-webkit-tap-highlight-color:transparent] outline-ring focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid pointer-fine:hover:bg-[var(--ouro-row-hover,var(--accent))] pointer-fine:hover:text-accent-foreground active:bg-[var(--ouro-row-pressed,var(--accent))] active:text-accent-foreground data-popup-open:bg-[var(--ouro-row-hover,var(--accent))] data-popup-open:text-accent-foreground data-disabled:opacity-50",Mn="data-ouro-pressing:select-none data-ouro-pressing:[-webkit-touch-callout:none]",xt=i.createContext(null),Rs=i.createContext(!1),Ls=i.createContext(!1);function be(t,s){const o=i.useContext(xt);return o||ee(t,"must be rendered inside <Menu>"),o}function mt(t){return t.map((s,o)=>{switch(s.type){case"separator":return e.jsx(Bn,{},o);case"checkbox":return e.jsx(On,{checked:s.checked,defaultChecked:s.defaultChecked,onCheckedChange:s.onCheckedChange,shortcut:s.shortcut,disabled:s.disabled,axAction:s.axAction,children:s.label},o);case"radio":return e.jsx(Dn,{label:s.label,value:s.value,defaultValue:s.defaultValue,onValueChange:s.onValueChange,children:s.options.map(n=>e.jsx(Pn,{value:n.value,shortcut:n.shortcut,disabled:n.disabled,children:n.label},n.value))},o);case"group":return e.jsx(Un,{label:s.label,children:mt(s.items)},o);case"submenu":return e.jsx(zn,{label:s.label,disabled:s.disabled,backLabel:s.backLabel,children:mt(s.items)},o);default:return e.jsxs(Is,{onClick:s.onClick,href:s.href,shortcut:s.shortcut,tone:s.tone,disabled:s.disabled,axAction:s.axAction,children:[s.icon!==void 0&&e.jsx("span",{"aria-hidden":"true","data-ouro-menu-icon":"",className:"flex shrink-0",children:s.icon}),s.label]},o)}})}function Ze(t){return s=>s.currentTarget.toggleAttribute("data-ouro-pressing",t)}function ze({sheet:t,context:s,side:o,align:n,className:r,children:a,closeLabel:c,anchor:h,point:d,label:b,finalFocus:x}){const w=s?xo:mo,$=Ss("Menu",!0),u=i.useContext(xt)!==null,g=i.useContext(Rs),m=u||g,j=i.useRef(null);i.useLayoutEffect(()=>{const v=j.current;if(v===null)return;const E=()=>{for(const k of v.querySelectorAll("[data-base-ui-focus-guard][role]"))k.removeAttribute("role"),k.setAttribute("aria-hidden","true")},l=new MutationObserver(E);return l.observe(v,{subtree:!0,attributeFilter:["role"]}),()=>l.disconnect()},[]);const y=e.jsx(co,{...$,"data-ouro":"menu-portal",className:ys,children:e.jsxs(bt,{children:[t&&e.jsx(uo,{"data-ouro":"menu-backdrop",className:Tn}),e.jsx(w,{"data-ouro":"menu-positioner",className:t?$n:Sn,sideOffset:s||d?0:4,collisionPadding:8,...h!==void 0?{anchor:h}:{},positionMethod:ks,...o?{side:o}:{},...n?{align:n}:{},children:e.jsxs(po,{"data-ouro":"menu","data-ouro-presentation":t?"sheet":"menu","aria-label":b,...x!==void 0?{finalFocus:x}:{},className:F(t?En:An,t?void 0:r),children:[e.jsx(xt.Provider,{value:{sheet:t},children:a}),t&&c!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:Ts}),e.jsx(ht,{"data-ouro-menu-close":"","data-ouro-control":"menu","data-ouro-part":"close",className:fe,children:e.jsx("span",{"data-ouro-menu-label":"",children:c})})]})]})})]})});return m?e.jsx("span",{ref:j,"data-ouro-menu-guards":"",className:Rn,children:y}):y}function In(t){const{trigger:s,contextTrigger:o,label:n,anchor:r,"aria-label":a,returnFocus:c,items:h,children:d,side:b,align:x,className:w,closeLabel:$="Close",modal:u,open:g,onOpenChange:m,isOpen:j,onClose:y,placement:v,asChild:E,options:l}=t,k=i.useContext(Rs),T=[s,o,n,r].filter(R=>R!==void 0).length;T===0&&ee("Menu","needs trigger, contextTrigger, label or anchor"),T>1&&ee("Menu","takes one of trigger, contextTrigger, label and anchor"),r!==void 0&&g===void 0&&ee("Menu","anchor needs open: the app opens a menu it anchors"),r!==void 0&&!a&&ee("Menu","anchor needs aria-label: no button names the menu"),k&&n===void 0&&ee("Menu","a Menu inside <MenuBar> takes label, not trigger or contextTrigger"),!k&&n!==void 0&&ee("Menu","label is for a Menu inside <MenuBar>"),h===void 0&&d===void 0&&ee("Menu","needs items or children"),h!==void 0&&d!==void 0&&ee("Menu","takes items or children, not both"),g!==void 0&&typeof m!="function"&&ee("Menu","open needs onOpenChange");const A=o!==void 0,M=r!==void 0&&!("getBoundingClientRect"in r)?r:void 0,f=Ns(b,"bottom"),p=ws.includes(x)?x:"start";ue("Menu",w,""),te();const C=gn(A||M!==void 0?"menu":"auto"),L=h!==void 0?mt(h):d,[I,O]=i.useState(!1),V=g??I,W=i.useRef(null),z=i.useRef(null),H=i.useRef(null),Y=i.useRef(null);i.useEffect(()=>{var N;const R=r!==void 0?document:(N=H.current)==null?void 0:N.ownerDocument;if(!V||R===void 0)return;z.current=null;const B=D=>{var Q;const P=D.target;(Q=H.current)!=null&&Q.contains(P)||P.closest('[data-ouro="menu-positioner"], [data-base-ui-focus-guard]')||(z.current=P,W.current.close())};return R.addEventListener("focusin",B),()=>R.removeEventListener("focusin",B)},[V,r]);const K=i.useRef(c);i.useLayoutEffect(()=>{K.current=c});const ne=R=>{O(R),m==null||m(R),!(r===void 0||R)&&setTimeout(()=>{var N,D;const B=document.activeElement;B!==document.body&&B.closest('[data-ouro="menu-positioner"]')===null||(D=(N=z.current)!=null&&N.isConnected?z.current:K.current)==null||D.focus({preventScroll:!0})})},se=g!==void 0?{open:g,onOpenChange:ne}:{onOpenChange:ne};if(r!==void 0){const R=M===void 0?r:{getBoundingClientRect:()=>new DOMRect(M.x,M.y,0,0)},B=()=>!1,N=e.jsx(yt,{...se,actionsRef:W,modal:C,children:e.jsx(ze,{sheet:C,context:!1,side:f,align:M===void 0?p:"start",className:w,closeLabel:$,anchor:R,point:M!==void 0,label:a,finalFocus:B,children:L})});return e.jsx(Je,{of:r instanceof Element?r:null,children:N})}if(A){const R=e.jsxs(Zs,{...se,children:[e.jsx(eo,{ref:Y,render:o,className:Mn,...de.contextMenu,style:{WebkitTouchCallout:void 0},onTouchStart:Ze(!0),onTouchEnd:Ze(!1),onTouchCancel:Ze(!1)}),e.jsx(ze,{sheet:!1,context:!0,className:w,children:L})]});return e.jsx(Je,{of:Y,children:R})}const S=e.jsxs(yt,{...se,actionsRef:W,modal:n===void 0?C||u:void 0,children:[n!==void 0?e.jsx(kt,{"data-ouro-control":"menu","data-ouro-part":"bar-trigger",className:Ln,...de.listButton,children:n}):e.jsx(kt,{ref:H,render:s,...de.listButton}),e.jsx(ze,{sheet:C,context:!1,side:f,align:p,className:w,closeLabel:$,finalFocus:_n,children:L})]});return n!==void 0?S:e.jsx(Je,{of:H,children:S})}function _n(){if(document.querySelector('[data-ouro="menu"][data-open]')!==null)return!1;const t=document.activeElement;return t===document.body||t.closest('[data-ouro="menu"]')!==null}function Ms(t){return typeof t=="string"?t.split("+"):t}function vt(t,s){const o=Ms(t);return o?{"aria-keyshortcuts":dn(o,s)}:{}}function jt({children:t,shortcut:s}){const o=Ms(s);return e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-ouro-menu-label":"",className:"flex min-w-0 flex-1 items-center gap-2",children:t}),o&&e.jsx(Cn,{keys:o,"aria-hidden":"true",className:"ms-auto"})]})}function Is(t){const{children:s,onClick:o,href:n,current:r,shortcut:a,tone:c,disabled:h,axAction:d,onSelect:b,variant:x,asChild:w,checked:$}=t,u=We();be("MenuItem");const g=c==="destructive"?"destructive":void 0;te();const m={className:fe,"data-ouro-control":"menu","data-ouro-part":"item","data-tone":g,"data-ax-action":d,...vt(a,u),...o?{onClick:y=>o(y)}:{}},j=e.jsx(jt,{shortcut:a,children:s});return n!==void 0&&!h?e.jsx(Js,{...m,"aria-current":r?"page":void 0,closeOnClick:!0,render:e.jsx(Ke,{href:n}),children:j}):e.jsx(ht,{...m,disabled:h,children:j})}function _s(){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function On({children:t,shortcut:s,onCheckedChange:o,axAction:n,...r}){const a=We();return be("MenuCheckboxItem"),te(),e.jsxs(io,{"data-ouro-control":"menu","data-ouro-part":"checkbox-item","data-ax-action":n,...r,...vt(s,a),...o?{onCheckedChange:c=>o(c)}:{},className:fe,children:[e.jsx("span",{"data-ouro-menu-indicator":"",className:As,children:e.jsx(lo,{className:"flex",children:e.jsx(_s,{})})}),e.jsx(jt,{shortcut:s,children:t})]})}function Dn({children:t,label:s,onValueChange:o,...n}){return be("MenuRadioGroup"),e.jsxs(no,{...n,...o?{onValueChange:r=>o(r)}:{},children:[s!==void 0&&e.jsx(is,{className:Es,children:s}),e.jsx(Ls.Provider,{value:!0,children:t})]})}function Pn({children:t,shortcut:s,...o}){const n=We();return i.useContext(Ls)||ee("MenuRadioItem","must be rendered inside <MenuRadioGroup>"),te(),e.jsxs(ro,{"data-ouro-control":"menu","data-ouro-part":"radio-item",...o,...vt(s,n),className:fe,children:[e.jsx("span",{"data-ouro-menu-indicator":"",className:As,children:e.jsx(ao,{className:"flex",children:e.jsx(_s,{})})}),e.jsx(jt,{shortcut:s,children:t})]})}function Un({label:t,children:s}){return be("MenuGroup"),te(),e.jsxs(oo,{children:[e.jsx(is,{className:Es,children:t}),s]})}function zt({back:t}){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",className:t?"rotate-180 rtl:rotate-0":"ms-auto rtl:rotate-180",children:e.jsx("path",{d:"M6 3.5 10.5 8 6 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zn({label:t,children:s,disabled:o,backLabel:n="Back"}){const{sheet:r}=be("MenuSub"),[a,c]=i.useState(!1);return e.jsxs(to,{open:a,onOpenChange:c,disabled:o,children:[e.jsxs(so,{"data-ouro-control":"menu","data-ouro-part":"submenu-trigger",className:fe,disabled:o,openOnHover:!r,children:[e.jsx("span",{"data-ouro-menu-label":"",className:"flex min-w-0 flex-1 items-center gap-2",children:t}),e.jsx(zt,{})]}),e.jsxs(ze,{sheet:r,context:!1,children:[r&&e.jsxs(ht,{"data-ouro-menu-back":"","data-ouro-control":"menu","data-ouro-part":"back",className:fe,closeOnClick:!1,onClick:()=>c(!1),children:[e.jsx(zt,{back:!0}),e.jsx("span",{"data-ouro-menu-label":"",children:n})]}),s]})]})}function Bn(){return be("MenuSeparator"),e.jsx(ls,{className:Ts})}function Os(t){return i.useCallback(s=>{if(!CSS.supports("-webkit-touch-callout","none"))return qe(t,s);const o=()=>{const a=Number.parseFloat(s.style.getPropertyValue("--ouro-backdrop-top"))||0;s.style.setProperty("--ouro-backdrop-top",`${a-s.getBoundingClientRect().top}px`)};o();const n=requestAnimationFrame(o);addEventListener("scroll",o,{passive:!0}),addEventListener("resize",o);const r=qe(t,s);return()=>{cancelAnimationFrame(n),removeEventListener("scroll",o),removeEventListener("resize",o),r()}},[t])}function Hn(t){return i.useCallback(s=>{if(!s||!t)return;const o=()=>{const c=s.scrollWidth>s.clientWidth&&/auto|scroll/.test(getComputedStyle(s).overflowX);s.scrollHeight>s.clientHeight||c?s.setAttribute("tabindex","0"):s!==s.ownerDocument.activeElement&&s.removeAttribute("tabindex")},n=new ResizeObserver(o),r=()=>{n.disconnect(),n.observe(s);for(const c of s.children)n.observe(c)},a=new MutationObserver(r);return r(),a.observe(s,{childList:!0,subtree:!0,characterData:!0}),s.addEventListener("blur",o),()=>{n.disconnect(),a.disconnect(),s.removeEventListener("blur",o)}},[t])}const Fn=["bottom","top","left","right"],qn="supports-[-webkit-touch-callout:none]:absolute supports-[-webkit-touch-callout:none]:inset-x-0 supports-[-webkit-touch-callout:none]:top-[var(--ouro-backdrop-top,0px)] supports-[-webkit-touch-callout:none]:bottom-auto supports-[-webkit-touch-callout:none]:h-lvh",Vn="box-border flex shrink-0 justify-end gap-3 px-5 pt-3 pb-5 max-sm:flex-col max-sm:*:w-full";function Kn(){const t=[...["--ouro-sheet-x","--ouro-sheet-y","--ouro-sheet-grab"].map(s=>({name:s,syntax:"<length>",inherits:!1,initialValue:"0px"})),{name:"--ouro-sheet-transform",syntax:"*",inherits:!1},...["--drawer-swipe-movement-x","--drawer-swipe-movement-y","--drawer-snap-point-offset"].map(s=>({name:s,syntax:"<length>",inherits:!1,initialValue:"0px"})),{name:"--drawer-swipe-progress",syntax:"<number>",inherits:!1,initialValue:"0"},{name:"--drawer-swipe-strength",syntax:"<number>",inherits:!1,initialValue:"1"},{name:"--drawer-frontmost-height",syntax:"*",inherits:!1}];for(const s of t)try{CSS.registerProperty(s)}catch{}}const Ds=i.createContext(null),Wn={bottom:"down",top:"up",left:"left",right:"right"};Kn();const Yn="fixed inset-0 z-1000 min-h-dvh bg-(--ouro-backdrop-color) opacity-[calc(var(--ouro-backdrop-max)*(1-var(--drawer-swipe-progress,0)))] [transition:opacity_var(--ouro-duration-sheet)_var(--ouro-ease-drawer)] data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:duration-(--ouro-duration-slow) data-ending-style:ease-(--ouro-ease-out) data-swiping:duration-0 data-swipe-dismiss:data-ending-style:duration-(--ouro-duration-fast) "+qn,Qn="pointer-events-none fixed inset-0 z-1000 min-h-dvh bg-transparent",Gn={bottom:"items-end justify-center",top:"items-start justify-center",left:"[justify-content:left]",right:"[justify-content:right]"},Xn="[--ouro-sheet-stretch:3.5] [--ouro-sheet-slack:calc(var(--ouro-sheet-stretch)*0.25px)] [--ouro-sheet-gap:2rem] relative box-border flex min-h-0 flex-col outline-none touch-none bg-popover text-popover-foreground [-webkit-tap-highlight-color:transparent] [transition:transform_calc(var(--ouro-duration-sheet)*var(--drawer-swipe-strength,1))_var(--ouro-ease-drawer)] will-change-transform [transform:var(--ouro-sheet-transform)] data-swiping:select-none data-swiping:[transform:var(--ouro-sheet-transform)]! not-data-swiping:[--ouro-sheet-grab:0px]! after:pointer-events-none after:absolute after:bg-inherit motion-reduce:[transition:transform_0s,opacity_var(--ouro-duration-base)_var(--ouro-ease-out)] motion-reduce:data-starting-style:[transform:var(--ouro-sheet-transform)] motion-reduce:data-starting-style:opacity-0 motion-reduce:data-ending-style:[transform:var(--ouro-sheet-transform)] motion-reduce:data-ending-style:opacity-0",Jn={bottom:"w-full max-w-[40rem] max-h-[calc(100dvh-var(--ouro-sheet-gap))] ps-[env(safe-area-inset-left,0px)] pe-[env(safe-area-inset-right,0px)] [--ouro-sheet-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] [--ouro-sheet-transform:translateY(calc(max(var(--ouro-sheet-y),0px)+min(var(--ouro-sheet-y)+var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] rounded-t-ouro-xl [box-shadow:var(--ouro-shadow-sheet-bottom)] after:inset-x-0 after:top-[calc(100%-1px)] after:h-[50dvh] data-starting-style:[transform:translateY(calc(100%+2px))] data-ending-style:[transform:translateY(calc(100%+2px))]",top:"w-full max-w-[40rem] max-h-[calc(100dvh-var(--ouro-sheet-gap))] ps-[env(safe-area-inset-left,0px)] pe-[env(safe-area-inset-right,0px)] [--ouro-sheet-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] [--ouro-sheet-transform:translateY(calc(min(var(--ouro-sheet-y),0px)+max(var(--ouro-sheet-y)-var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] rounded-b-ouro-xl [box-shadow:var(--ouro-shadow-sheet-top)] pt-[env(safe-area-inset-top,0px)] after:inset-x-0 after:bottom-[calc(100%-1px)] after:h-[50dvh] data-starting-style:[transform:translateY(calc(-100%-2px))] data-ending-style:[transform:translateY(calc(-100%-2px))]",left:"h-full w-[min(22rem,calc(100vw-3rem))] pt-[env(safe-area-inset-top,0px)] pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))] [--ouro-sheet-x:var(--drawer-swipe-movement-x,0px)] [--ouro-sheet-transform:translateX(calc(min(var(--ouro-sheet-x),0px)+max(var(--ouro-sheet-x)-var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] rounded-r-ouro-xl [box-shadow:var(--ouro-shadow-sheet-left)] pl-[env(safe-area-inset-left,0px)] after:inset-y-0 after:right-[calc(100%-1px)] after:w-[50vw] data-starting-style:[transform:translateX(calc(-100%-2px))] data-ending-style:[transform:translateX(calc(-100%-2px))]",right:"h-full w-[min(22rem,calc(100vw-3rem))] pt-[env(safe-area-inset-top,0px)] pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))] [--ouro-sheet-x:var(--drawer-swipe-movement-x,0px)] [--ouro-sheet-transform:translateX(calc(max(var(--ouro-sheet-x),0px)+min(var(--ouro-sheet-x)+var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] rounded-l-ouro-xl [box-shadow:var(--ouro-shadow-sheet-right)] pr-[env(safe-area-inset-right,0px)] after:inset-y-0 after:left-[calc(100%-1px)] after:w-[50vw] data-starting-style:[transform:translateX(calc(100%+2px))] data-ending-style:[transform:translateX(calc(100%+2px))]"},Zn={fit:"pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))]",snap:"h-[calc(100dvh-var(--ouro-sheet-gap))] pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px)+max(0px,var(--drawer-snap-point-offset,0px)))]"};function oe(t,s){const o=i.useContext(Ds);return o||ee(t,"must be rendered inside <SheetRoot>"),o}function er({side:t="bottom",snapPoints:s,...o}){const n=o.modal!==!1,r=Fn.includes(t)?t:"bottom";te();const a=!!(s&&s.length>0);return e.jsx(Ds.Provider,{value:{side:r,snap:a,modal:n},children:e.jsx(ho,{...o,disablePointerDismissal:o.disablePointerDismissal??!n,...s?{snapPoints:s}:{},swipeDirection:Wn[r]})})}function tr({onPointerDown:t,onKeyDown:s,...o}){return oe("SheetTrigger"),e.jsx(fo,{...o.render===void 0?{className:"forced-colors:border forced-colors:border-solid","data-ouro-control":"sheet","data-ouro-part":"trigger"}:{},...o,onPointerDown:n=>{t==null||t(n),de.dialog.onPointerDown(n)},onKeyDown:n=>{s==null||s(n),de.dialog.onKeyDown(n)}})}function sr(t){return oe("SheetPortal"),e.jsx(go,{children:e.jsx(bo,{...t,"data-ouro":"sheet-portal",className:"relative isolate z-(--ouro-layer) in-[[data-ouro$='-portal']]:z-1001 [--drawer-keyboard-inset:0px]",children:e.jsx(bt,{children:t.children})})})}function or({ref:t,...s}){oe("SheetBackdrop");const o=Os(t);return e.jsx(cs,{...s,ref:o,"data-ouro":"sheet-backdrop",className:Yn})}function nr({ref:t,...s}){oe("SheetScrim");const o=Os(t);return e.jsx(cs,{...s,forceRender:!0,ref:o,"aria-hidden":"true","data-ouro":"sheet-scrim-backdrop",className:Qn})}function rr(t){return i.useCallback(s=>{const o=t==="left"||t==="right";let n=!1;const r=()=>{const d=s.querySelector('[data-ouro="sheet"]');if(!d||d.style.transitionProperty==="none")return!1;const b=getComputedStyle(d),x=new DOMMatrixReadOnly(b.transform),w=o?0:parseFloat(b.getPropertyValue("--drawer-snap-point-offset"));return d.style.setProperty("--ouro-sheet-grab",`${(o?x.m41:x.m42)-w}px`),d.getAnimations().length>0},a=d=>{n=s.contains(d.target)&&r()},c=()=>{n&&(n=r())},h=()=>{n=!1};return addEventListener("pointerdown",a,!0),addEventListener("pointermove",c,!0),addEventListener("pointerup",h,!0),addEventListener("pointercancel",h,!0),()=>{removeEventListener("pointerdown",a,!0),removeEventListener("pointermove",c,!0),removeEventListener("pointerup",h,!0),removeEventListener("pointercancel",h,!0)}},[t])}function ar({ref:t,...s}){const{side:o,modal:n}=oe("SheetViewport"),r=Re(t,rr(o));return e.jsx(vo,{...s,ref:r,"data-ouro":"sheet-viewport","data-side":o,className:F("fixed inset-0 z-1000 flex overflow-clip touch-none",!n&&"pointer-events-none",Gn[o])})}function ir({className:t,...s}){const{side:o,snap:n,modal:r}=oe("SheetPopup");return e.jsx(jo,{...s,className:F(Xn,Jn[o],o==="bottom"&&Zn[n?"snap":"fit"],o==="top"&&n&&"h-[calc(100dvh-var(--ouro-sheet-gap))]",!r&&"pointer-events-auto",t),"aria-modal":r?"true":void 0,"data-ouro":"sheet","data-side":o,"data-snap-points":n?"":void 0,"data-modal":r?void 0:"false"})}function Bt(){const{side:t}=oe("SheetHandle");return t==="left"||t==="right"?null:e.jsx("div",{"aria-hidden":"true","data-ouro-sheet-handle":"",className:"flex shrink-0 justify-center py-2 touch-none",children:e.jsx("div",{className:"h-1.25 w-9 rounded-full bg-border"})})}function lr({visuallyHidden:t,...s}){return oe("SheetTitle"),e.jsx(ko,{...s,"data-ouro-sheet-title":"",className:t?"sr-only":"m-0 font-[family-name:var(--font-heading,inherit)] text-lg leading-6 font-semibold text-balance text-popover-foreground"})}function cr(t){return oe("SheetDescription"),e.jsx(wo,{...t,"data-ouro-sheet-description":"",className:"m-0 text-sm leading-5 text-muted-foreground"})}function dr({className:t,ref:s,...o}){const n=Re(s,Hn(o.tabIndex===void 0));return oe("SheetContent"),ue("SheetContent",t,""),e.jsxs("div",{className:"relative box-border flex min-h-0 flex-1 flex-col",children:[e.jsx(No,{"data-ouro-control":"sheet","data-ouro-part":"content",...o,ref:n,"data-ouro-sheet-content":"",className:F("peer box-border min-h-0 flex-1 overflow-y-auto overscroll-contain touch-auto px-5 pt-2 pb-5 outline-none focus-visible:isolate","forced-colors:[&[tabindex='0']]:outline-1 forced-colors:[&[tabindex='0']]:outline-solid forced-colors:[&[tabindex='0']]:-outline-offset-1",t)}),e.jsx("span",{"aria-hidden":"true","data-sheet-focus-ring":"",className:"pointer-events-none absolute inset-0 hidden rounded-[inherit] outline-ring -outline-offset-2 peer-focus-visible:block peer-focus-visible:outline-2 peer-focus-visible:outline-solid"})]})}function ur(t){return oe("SheetClose"),e.jsx(yo,{...t.render===void 0?{className:"forced-colors:border forced-colors:border-solid","data-ouro-control":"sheet","data-ouro-part":"close"}:{},...t})}const xr="press absolute end-3 z-1 m-0 box-border inline-flex size-8 cursor-default items-center justify-center rounded-ouro-lg border-0 bg-transparent p-0 text-muted-foreground outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid pointer-fine:hover:bg-muted pointer-fine:hover:text-foreground motion-safe:active:scale-(--ouro-press-scale) forced-colors:border forced-colors:border-solid disabled:cursor-not-allowed disabled:opacity-50";function mr({title:t,hideTitle:s,closeLabel:o,description:n,side:r,snapPoints:a,snapPoint:c,modal:h=!0,closeOnOutsidePress:d=h,scrim:b=!1,children:x,className:w,trigger:$,open:u,onOpenChange:g,footer:m,presentation:j,finalFocus:y,initialFocus:v,closeDisabled:E,keepMounted:l,onOpenChangeComplete:k}){const T=!s||n!==void 0||!h,A=e.jsx(lr,{visuallyHidden:s,children:t});return e.jsxs(er,{side:r,snapPoints:a,snapPoint:c,modal:h,disablePointerDismissal:!d,...u!==void 0?{open:u,onOpenChange:M=>g(M)}:{},...k?{onOpenChangeComplete:k}:{},children:[$!==void 0&&e.jsx(tr,{render:$}),e.jsxs(sr,{keepMounted:l,children:[h?e.jsx(or,{}):b&&e.jsx(nr,{}),e.jsx(ar,{children:e.jsxs(ir,{className:w,"data-ouro-presentation":j,...y?{finalFocus:y}:{},initialFocus:v,children:[r==="bottom"&&e.jsx(Bt,{}),T?e.jsxs("div",{"data-ouro-sheet-header":"",className:"grid min-h-12 shrink-0 gap-1 ps-5 pe-14 pt-3 pb-2",children:[A,n!==void 0&&e.jsx(cr,{children:n})]}):A,e.jsx(dr,{children:x}),m!==void 0&&e.jsx("div",{"data-ouro-footer":"",className:Vn,children:m}),r==="top"&&e.jsx(Bt,{}),e.jsxs(ur,{"data-ouro-sheet-close":"",disabled:E,className:`${xr} ${r==="bottom"&&T?"top-8.25":"top-3"}`,children:[e.jsx(Ve,{}),e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",className:"size-4",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),e.jsx("span",{className:"sr-only",children:o})]})]})})]})]})}const pr=new Set(["Shift","Control","Alt","Meta","AltGraph","CapsLock"]);function Ht(t){const s=document.documentElement;s.getAttribute("data-ouro-modality")!==t&&s.setAttribute("data-ouro-modality",t)}let Be="";function hr(){return Be}/* istanbul ignore else @preserve -- the else path is server rendering, which has no document */typeof document<"u"&&(document.addEventListener("pointerdown",t=>{Be=t.pointerType,Ht("pointer")},!0),document.addEventListener("keydown",t=>{Be="keyboard",pr.has(t.key)||Ht("keyboard")},!0),document.addEventListener("pointermove",t=>{(t.pointerType==="mouse"||t.pointerType==="pen")&&(Be=t.pointerType)},!0));const fr=t=>(t==null?void 0:t.$$typeof)===Symbol.for("react.lazy");function gr(t){const s=[];return i.Children.forEach(t,o=>s.push(o)),s}function br(t){if(!fr(t))return t;const s=gr(t);return s.length===1&&i.isValidElement(s[0])?s[0]:t}const vr=fn+" box-border max-w-xs rounded-ouro-md bg-foreground px-2 py-1 text-xs leading-4 text-balance text-background [--ouro-floating-duration:var(--ouro-duration-fast)] data-instant:duration-0",jr=600,wr=400,Ft=100,Ne={count:0,closedAt:Number.NEGATIVE_INFINITY};function qt(t,s){return(t===!0||t==="true")&&s!==void 0&&s!==null&&s!==!1&&s!=="false"}function Vt(t){const{content:s,children:o,side:n,align:r,title:a,delayDuration:c,delay:h,asChild:d,placement:b,ref:x,...w}=t,$=Ns(n,"top"),u=hn(r);i.useRef({});const g=i.useRef(null),m=br(o),j=Re(m.props.ref,Re(x,g));te(),i.useEffect(()=>{});const y=i.useCallback(z=>{},[]),v=i.useContext(vn),[E,l]=i.useState(!1),[k,T]=i.useState(!1),A=i.useRef(void 0),M=z=>{const H=g.current;hr()!=="touch"&&!qt(H==null?void 0:H.getAttribute("aria-expanded"),H==null?void 0:H.getAttribute("aria-haspopup"))&&T(z)},f=(z,H)=>{clearTimeout(A.current),A.current=setTimeout(H,z)},p=()=>{clearTimeout(A.current),T(!1)};i.useEffect(()=>{if(k)return Ne.count+=1,()=>{Ne.count-=1,Ne.closedAt=performance.now()}},[k]),i.useEffect(()=>()=>clearTimeout(A.current),[]);const C=i.useContext(bn);i.useLayoutEffect(()=>{C&&p()},[C]);const L=m.props["aria-expanded"]??w["aria-expanded"],I=m.props["aria-haspopup"]??w["aria-haspopup"],O=qt(L,I);i.useLayoutEffect(()=>{p()},[O]);const V=Ss(),W=i.cloneElement(m,Co(w,m.props,{ref:j,...k?{"data-popup-open":""}:{},"data-base-ui-tooltip-trigger":"",onPointerEnter:z=>{z.pointerType!=="touch"&&(l(!0),v&&(Ne.count>0||z.timeStamp-Ne.closedAt<wr)?M("delay"):f(jr,()=>M("now")))},onPointerLeave:()=>f(Ft,()=>T(!1)),onFocus:z=>{z.currentTarget.matches(":focus-visible")&&(l(!0),clearTimeout(A.current),M("focus"))},onBlur:p,onKeyDown:z=>{z.key!=="Escape"||!k||(p(),z.preventDefault(),z.stopPropagation())},onPointerDown:p,onClick:p}));return E?e.jsxs(e.Fragment,{children:[W,e.jsx(So,{open:k!==!1,onOpenChange:p,children:e.jsx($o,{...V,"data-ouro":"tooltip-portal",className:ys,children:e.jsx(bt,{children:e.jsx(Ao,{anchor:g,positionMethod:ks,side:$,align:u,sideOffset:6,collisionPadding:8,"data-ouro":"tooltip-positioner",children:e.jsx(Eo,{ref:y,"data-ouro":"tooltip","data-instant":k==="focus"||k==="delay"?k:void 0,onPointerEnter:()=>clearTimeout(A.current),onPointerLeave:()=>f(Ft,()=>T(!1)),className:vr,children:s})})})})})]}):W}const Nr="box-border flex h-full w-[var(--ouro-sidebar-w,16rem)] flex-col overflow-hidden border-0 border-e border-solid border-border bg-background text-foreground data-collapsed:w-[calc(3.75rem+1px)] max-sm:hidden",yr="ms-auto shrink-0 rounded-ouro-sm bg-muted px-1.5 text-xs leading-5 font-medium text-[color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))] tabular-nums",Kt=t=>i.isValidElement(t)?void 0:yr,ye="relative m-0 box-border flex w-full min-h-11 pointer-fine:min-h-9 cursor-pointer items-center gap-3 rounded-ouro-md border-0 forced-colors:border forced-colors:border-solid bg-transparent px-3 py-2 text-start font-[inherit] text-base pointer-fine:text-sm leading-5 font-medium text-muted-foreground no-underline select-none touch-manipulation [-webkit-tap-highlight-color:transparent] transition-colors duration-(--ouro-duration-fast) ease-[ease] pointer-fine:hover:bg-accent pointer-fine:hover:text-accent-foreground active:bg-accent active:text-accent-foreground aria-[current=page]:font-semibold aria-[current=page]:text-foreground aria-[current=page]:before:absolute aria-[current=page]:before:inset-y-2 aria-[current=page]:before:start-0 aria-[current=page]:before:w-0.5 aria-[current=page]:before:rounded-full aria-[current=page]:before:bg-current aria-[current=page]:before:content-[''] forced-colors:aria-[current=page]:before:border-s-2 forced-colors:aria-[current=page]:before:border-solid forced-colors:aria-[current=page]:before:border-current outline-ring -outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid",Ie="justify-center px-0",Wt="flex size-5 shrink-0 items-center justify-center text-sm [&_svg]:size-5 [&_svg]:shrink-0",Yt="m-0 grid list-none gap-1 p-0";function kr(t){const{label:s,sections:o,currentPath:n,header:r,footer:a,collapsible:c=!0,collapsed:h,defaultCollapsed:d=!1,onCollapsedChange:b,collapseLabel:x="Collapse sidebar",menuLabel:w="Menu",closeLabel:$="Close",className:u,ref:g,items:m,isCollapsed:j,pathname:y,children:v}=t;ue("Sidebar",u,""),o.flatMap(S=>S.items).find(S=>S.items!==void 0),te();const E=ps("(min-width: 640px)",!0),[l,k]=i.useState(!1),T=i.useRef(null);E&&l&&k(!1);const[A,M]=i.useState(d),f=h??A,p=()=>{M(!f),b==null||b(!f)},L=o.flatMap(S=>S.items.flatMap(R=>R.items!==void 0?R.items:[R])).filter(S=>S.href!==void 0),I=L.some(S=>S.current)?void 0:Po(L.map(S=>S.href),n),O=S=>S.href!==void 0&&(!!S.current||S.href===I),[V,W]=i.useState({}),z=(S,R)=>V[S]??R.items.some(O),H=i.useId(),Y=(S,R)=>e.jsxs(e.Fragment,{children:[(S.icon!==void 0||R)&&e.jsx("span",{"aria-hidden":"true",className:Wt,children:S.icon!==void 0?S.icon:S.label.charAt(0).toUpperCase()}),e.jsx("span",{className:R?"sr-only":"min-w-0 flex-1 truncate",children:S.label}),S.badge!==void 0&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{"data-ouro-sidebar-badge":"",className:R?"sr-only":Kt(S.badge),children:S.badge})]})]}),K=(S,R,B)=>S?e.jsx(Vt,{content:R,side:"right",children:B}):B,ne=(S,R,B)=>K(R,S.label,S.href!==void 0?e.jsx(Ke,{href:S.href,"aria-current":O(S)?"page":void 0,"data-ouro-control":"sidebar","data-ouro-part":"link",onClick:N=>{var D;B==null||B(),(D=S.onClick)==null||D.call(S,N)},className:F(ye,R&&Ie),children:Y(S,R)}):e.jsx("button",{type:"button","data-ouro-control":"sidebar","data-ouro-part":"button",onClick:N=>{B==null||B(),S.onClick(N)},className:F(ye,R&&Ie),children:Y(S,R)})),se=(S,R,B)=>o.map((N,D)=>e.jsxs("div",{className:F("grid gap-1",D>0&&"border-0 border-t border-solid border-border pt-4"),children:[N.label!==void 0&&e.jsx("p",{id:`${H}${S}${D}`,className:R?"sr-only":"m-0 px-3 py-1 text-sm leading-5 font-semibold text-foreground",children:N.label}),e.jsx("ul",{"aria-labelledby":N.label!==void 0?`${H}${S}${D}`:void 0,className:Yt,children:N.items.map((P,Q)=>{if(P.items===void 0)return e.jsx("li",{children:ne(P,R,B)},Q);const X=P.items.some(O);if(R)return e.jsx("li",{children:e.jsx(In,{side:"right",closeLabel:$,trigger:e.jsx(Vt,{content:P.label,side:"right",children:e.jsx("button",{type:"button","data-current":X?"":void 0,"data-ouro-control":"sidebar","data-ouro-part":"group",className:F(ye,"data-current:text-foreground",Ie),children:Y(P,!0)})}),children:P.items.map((re,Ye)=>e.jsxs(Is,{href:re.href,current:O(re),onClick:re.onClick,children:[re.label,re.badge!==void 0&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:F(Kt(re.badge),"ms-2"),children:re.badge})]})]},Ye))})},Q);const J=`${D}-${Q}`,le=z(J,P);return e.jsxs("li",{children:[e.jsxs("button",{type:"button","aria-expanded":le,"aria-controls":`${H}${S}${J}`,"data-ouro-control":"sidebar","data-ouro-part":"group","data-current":X&&!le?"":void 0,onClick:()=>W({...V,[J]:!le}),className:F(ye,"data-current:text-foreground"),children:[Y(P,!1),e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:F("size-4 shrink-0 rtl:-scale-x-100",P.badge===void 0&&"ms-auto",le&&"rotate-90 rtl:-rotate-90"),children:e.jsx("path",{d:"m6 4 4 4-4 4"})})]}),le&&e.jsx("ul",{id:`${H}${S}${J}`,className:F(Yt,"ms-5 mt-1 border-0 border-s border-solid border-border ps-2"),children:P.items.map((re,Ye)=>e.jsx("li",{children:ne(re,!1,B)},Ye))})]},Q)})})]},D));return e.jsxs("div",{ref:g,"data-ouro":"sidebar","data-collapsed":f?"":void 0,className:F("max-sm:inline-flex sm:h-full",u),children:[e.jsx(rn,{ref:T,"data-ouro-sidebar-menu":"","data-ouro-control":"sidebar","data-ouro-part":"menu",variant:"plain",tone:"secondary","aria-label":w,"aria-haspopup":E?void 0:"dialog","aria-expanded":l,onClick:()=>k(!0),className:"w-11 px-0 sm:hidden",children:e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"size-5",children:e.jsx("path",{d:"M3 5.5h14M3 10h14M3 14.5h14"})})}),E&&e.jsxs("nav",{"aria-label":s,"data-collapsed":f?"":void 0,className:Nr,children:[r!==void 0&&e.jsx("div",{className:"flex min-h-14 shrink-0 items-center overflow-hidden px-3 py-2",children:r}),e.jsx("div",{"data-ouro-sidebar-scroll":"",className:"grid min-h-0 flex-1 content-start gap-6 overflow-y-auto overscroll-contain p-2",children:se("c",f)}),c&&e.jsx("div",{className:"shrink-0 p-2",children:e.jsxs("button",{type:"button","aria-pressed":f,"data-ouro-control":"sidebar","data-ouro-part":"collapse",onClick:p,className:F(ye,f&&Ie),children:[e.jsx("span",{"aria-hidden":"true",className:Wt,children:e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"rtl:-scale-x-100",children:[e.jsx("rect",{x:"3",y:"4",width:"14",height:"12",rx:"2"}),e.jsx("path",{d:"M8 4v12"})]})}),e.jsx("span",{className:f?"sr-only":"min-w-0 flex-1 truncate",children:x})]})}),a!==void 0&&e.jsx("div",{className:"flex min-h-14 shrink-0 items-center overflow-hidden border-0 border-t border-solid border-border px-3 py-2",children:a})]}),e.jsx(mr,{title:w,hideTitle:r!==void 0,closeLabel:$,side:"left",open:l,onOpenChange:k,finalFocus:T,children:e.jsxs("div",{className:"grid gap-4",children:[r!==void 0&&e.jsx("div",{className:"flex min-h-11 items-center px-3",children:r}),e.jsx("nav",{"aria-label":s,className:"grid gap-6",children:se("d",!1,()=>k(!1))}),a!==void 0&&e.jsx("div",{className:"flex min-h-11 items-center border-0 border-t border-solid border-border px-3 pt-4",children:a})]})})]})}const et="relative isolate box-border inline-flex shrink-0 items-center gap-1 align-middle h-6 rounded-ouro-md border border-solid px-2 text-xs/none font-medium whitespace-nowrap no-underline bg-(--ouro-bg) border-(--ouro-bd) [--ouro-sq-w:1px] [--ouro-sq-r:calc(var(--radius)*var(--ouro-radius-scale,1)*0.8)]",Qt="press cursor-pointer select-none touch-manipulation [-webkit-tap-highlight-color:transparent] outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid before:pointer-events-none before:absolute before:-inset-px before:rounded-[inherit] before:[corner-shape:inherit] before:bg-current before:opacity-0 before:transition-opacity before:duration-(--ouro-duration-fast) before:ease-[ease] not-data-disabled:not-active:pointer-fine:hover:before:opacity-[var(--ouro-state-hover,8%)] not-data-disabled:active:before:opacity-[var(--ouro-state-pressed,14%)] not-data-disabled:not-active:pointer-fine:hover:[--ouro-state:var(--ouro-state-hover,8%)] not-data-disabled:active:[--ouro-state:var(--ouro-state-pressed,14%)] motion-safe:not-data-disabled:active:scale-(--ouro-press-scale) disabled:cursor-not-allowed disabled:opacity-50",tt={solid:{primary:"[--ouro-bd:transparent] [--ouro-bg:var(--primary)] text-primary-foreground",secondary:"[--ouro-bd:transparent] [--ouro-bg:var(--secondary)] text-secondary-foreground",destructive:"[--ouro-bd:transparent] [--ouro-bg:var(--destructive)] text-destructive-foreground",success:"[--ouro-bd:transparent] [--ouro-bg:var(--success)] text-success-foreground",warning:"[--ouro-bd:transparent] [--ouro-bg:var(--warning)] text-warning-foreground"},soft:{primary:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--primary)_10%,transparent)] text-[color-mix(in_oklab,var(--primary)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",secondary:"[--ouro-bd:transparent] [--ouro-bg:var(--muted)] text-foreground contrast-more:[--ouro-bd:currentColor]",destructive:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--destructive)_10%,transparent)] text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",success:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--success)_10%,transparent)] text-[color-mix(in_oklab,var(--success)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]",warning:"[--ouro-bd:transparent] [--ouro-bg:color-mix(in_oklab,var(--warning)_10%,transparent)] text-[color-mix(in_oklab,var(--warning)_80%,var(--foreground))] contrast-more:[--ouro-bd:currentColor]"},outline:{primary:"[--ouro-bd:color-mix(in_oklab,var(--primary)_45%,transparent)] [--ouro-bg:transparent] text-primary",secondary:"[--ouro-bd:var(--border)] [--ouro-bg:transparent] text-foreground",destructive:"[--ouro-bd:color-mix(in_oklab,var(--destructive)_45%,transparent)] [--ouro-bg:transparent] text-destructive",success:"[--ouro-bd:color-mix(in_oklab,var(--success)_45%,transparent)] [--ouro-bg:transparent] text-success",warning:"[--ouro-bd:color-mix(in_oklab,var(--warning)_45%,transparent)] [--ouro-bg:transparent] text-warning"}};function Cr(t){const{tone:s="secondary",variant:o="solid",icon:n,dot:r=!1,onClick:a,children:c,className:h,color:d,asChild:b,...x}=t,w=Object.hasOwn(tt.solid,s)?s:"secondary",$=Object.hasOwn(tt,o)?o:"solid";ue("Badge",h,""),te();const u=tt[$][w],g=n&&e.jsx(n,{"aria-hidden":"true",className:"relative -ms-0.5 size-3.5 shrink-0"}),m=r&&e.jsx("span",{"data-ouro-dot":"","aria-hidden":"true",className:"relative size-1.5 shrink-0 rounded-full bg-current"});if(x.href!==void 0){const{type:M,disabled:f,...p}=x;return e.jsxs(Ke,{"data-ouro-control":"badge","data-ouro-part":"root",...p,onClick:a,"data-ouro":"badge","data-ouro-squircle":"",className:F(et,Qt,u,h),children:[e.jsx(Ve,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),m,g,c]})}const{ref:j,type:y="button",disabled:v,...E}=x;if(a!==void 0)return e.jsxs(as,{"data-ouro-control":"badge","data-ouro-part":"root",...E,onClick:a,disabled:v,ref:j,type:y,"data-ouro":"badge","data-ouro-squircle":"",className:F(et,Qt,u,h),children:[e.jsx(Ve,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),m,g,c]});const{name:l,value:k,form:T,...A}=E;return e.jsxs("span",{...A,ref:j,"data-ouro":"badge","data-ouro-squircle":"",className:F(et,u,h),children:[e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),m,g,c]})}const Sr={lime:"success",red:"destructive",yellow:"warning",zinc:"secondary"};function _({color:t,children:s}){return e.jsx(Cr,{tone:t&&Sr[t]||"secondary",children:s})}function $r(t){i.useEffect(()=>{if(!t)return;const s=t;function o(n){if(!(n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement))switch(n.key){case"1":s({tab:"overview"});break;case"2":s({tab:"mail"});break;case"3":s({tab:"sessions"});break;case"4":s({tab:"work"});break;case"5":s({tab:"connections"});break;case"6":s({tab:"inner"});break;case"7":s({tab:"notes"});break;case"8":s({tab:"runtime"});break;case"Escape":{document.activeElement instanceof HTMLElement&&document.activeElement.blur();break}}}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t])}const Ar={"owed-reply":"red","blocking-obligation":"red","broken-return":"red","stale-delegation":"yellow","return-ready":"lime","overdue-habit":"yellow"},Er={"owed-reply":"owed reply","blocking-obligation":"blocking","broken-return":"broken return","stale-delegation":"stale","return-ready":"ready to return","overdue-habit":"overdue"},Tr={"owed-reply":"Someone spoke last and is waiting for your response","blocking-obligation":"This obligation is open and blocking forward progress","broken-return":"Work was done but the result was never returned to the requester","stale-delegation":"This was delegated to you and hasn't been addressed","return-ready":"The result is ready — deliver it to close the loop","overdue-habit":"This routine is past its scheduled cadence"},Rr=new Set(["stale-delegation"]),Lr=new Set(["owed-reply","blocking-obligation","broken-return","return-ready","overdue-habit"]),Mr=new Set(["spawning","running","waiting_input","stalled"]);function Ir({view:t,deskPrefs:s,refreshGeneration:o}){const n=ge(),[r,a]=i.useState(null),[c,h]=i.useState(null),[d,b]=i.useState(null),[x,w]=i.useState(null),[$,u]=i.useState(null),g=t.agent,m=t.work,j=t.inner,y=t.activity,v=g.degraded,E=g.attention,l=m.tasks,k=m.obligations,T=m.sessions,A=m.coding,M=g.senses,f=m.bridges;return i.useEffect(()=>{U(`/agents/${encodeURIComponent(g.agentName)}/needs-me`).then(a),U(`/agents/${encodeURIComponent(g.agentName)}/coding`).then(h),U(`/agents/${encodeURIComponent(g.agentName)}/continuity`).then(b).catch(()=>{}),U(`/agents/${encodeURIComponent(g.agentName)}/orientation`).then(w).catch(()=>{}),U(`/agents/${encodeURIComponent(g.agentName)}/changes`).then(u).catch(()=>{})},[g.agentName,o]),e.jsxs("div",{className:"space-y-6",children:[r&&r.items.length>0&&(()=>{const p=r.items.filter(L=>Lr.has(L.urgency)),C=r.items.filter(L=>Rr.has(L.urgency));return e.jsxs("div",{className:"space-y-3",children:[p.length>0&&e.jsxs("div",{className:"rounded-xl bg-ouro-fang/5 p-4 ring-1 ring-ouro-fang/15",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-fang",children:["Action now (",p.length,")"]}),e.jsx("div",{className:"mt-2 space-y-1.5",children:p.map((L,I)=>e.jsx(Gt,{item:L,nav:n,agentName:g.agentName,onDismiss:()=>{a(O=>O&&{items:O.items.filter((V,W)=>r.items.indexOf(L)!==W)})}},`action-${I}`))})]}),C.length>0&&e.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["Stale (",C.length,")"]}),e.jsx("button",{onClick:async()=>{var L;for(const I of C)(L=I.ref)!=null&&L.focus&&await fetch(`/api/agents/${encodeURIComponent(g.agentName)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:I.ref.focus})});U(`/agents/${encodeURIComponent(g.agentName)}/needs-me`).then(a)},className:"text-xs text-ouro-gold underline underline-offset-2 hover:text-ouro-bone transition-colors",children:"Clear all stale"})]}),e.jsx("div",{className:"mt-2 space-y-1.5",children:C.map((L,I)=>e.jsx(Gt,{item:L,nav:n,agentName:g.agentName,onDismiss:()=>{U(`/agents/${encodeURIComponent(g.agentName)}/needs-me`).then(a)}},`stale-${I}`))})]})]})})(),(s==null?void 0:s.carrying)&&e.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"What I'm carrying"}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-bone",children:s.carrying})]}),(()=>{const p=(s==null?void 0:s.pinnedConstellations)??[];return p.length===0?null:e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Pinned threads"}),e.jsx("div",{className:"mt-2 space-y-2",children:p.map((C,L)=>e.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[e.jsx("p",{className:"font-medium text-ouro-bone",children:C.label}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[C.friendIds.map(I=>e.jsxs("button",{onClick:()=>n({tab:"sessions"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["friend:",I.slice(0,8),"…"]},I)),C.taskRefs.map(I=>e.jsxs("button",{onClick:()=>n({tab:"work"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["task:",I]},I)),C.bridgeIds.map(I=>e.jsxs("button",{onClick:()=>n({tab:"connections",focus:I}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["bridge:",I.slice(0,8),"…"]},I))]})]},L))})]})})(),e.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10 sm:p-5",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Center of gravity"}),e.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone sm:text-2xl",children:E.label}),e.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:[g.agentName," has"," ",e.jsxs(_e,{tab:"work",children:[l.liveCount," live tasks"]}),","," ",e.jsxs(_e,{tab:"work",children:[k.openCount," obligations"]}),","," ",e.jsxs(_e,{tab:"work",children:[A.activeCount," coding lanes"]}),", and"," ",e.jsxs(_e,{tab:"sessions",children:[T.liveCount," live sessions"]}),"."]}),v.status==="degraded"&&v.issues.length>0&&e.jsxs("div",{className:"mt-3 space-y-1",children:[v.issues.slice(0,5).map((p,C)=>e.jsxs("button",{onClick:()=>n({tab:"runtime"}),className:"flex w-full items-start gap-2 rounded-lg bg-ouro-fang/5 px-3 py-2 text-left text-sm ring-1 ring-ouro-fang/10 hover:ring-ouro-fang/25 transition-colors",children:[e.jsx("span",{className:"mt-0.5 h-2 w-2 shrink-0 rounded-full bg-ouro-fang"}),e.jsxs("span",{className:"text-ouro-mist",children:[e.jsx("span",{className:"font-semibold text-ouro-fang",children:p.code}),e.jsxs("span",{className:"text-ouro-shadow",children:[" — ",G(p.detail,80)]})]})]},C)),v.issues.length>5&&e.jsxs("button",{onClick:()=>n({tab:"runtime"}),className:"text-xs text-ouro-glow underline underline-offset-2",children:["+",v.issues.length-5," more issues"]})]})]}),x===null&&e.jsx("div",{"aria-hidden":"true",className:"min-h-40"}),x&&e.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Orientation"}),(()=>{const p=x.currentSession;return p?e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(_,{color:"lime",children:"active session"}),e.jsxs("button",{onClick:()=>n({tab:"sessions",focus:`${p.friendId}/${p.channel}/${p.key}`}),className:"text-sm text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:[p.channel,"/",p.key]}),p.lastActivityAt&&e.jsx("span",{className:"text-xs text-ouro-shadow",children:q(p.lastActivityAt)})]}):null})(),x.primaryObligation&&e.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:"yellow",children:x.primaryObligation.status}),e.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:G(x.primaryObligation.content,80)})]}),x.primaryObligation.nextAction&&e.jsxs("p",{className:"mt-1 text-xs text-ouro-mist",children:["Next: ",x.primaryObligation.nextAction]}),x.primaryObligation.waitingOn&&e.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Waiting on: ",x.primaryObligation.waitingOn]})]}),x.resumeHandle&&e.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Resume handle"}),e.jsxs("div",{className:"mt-1 space-y-0.5 text-sm",children:[x.resumeHandle.lane&&e.jsxs("p",{className:"text-ouro-bone",children:["Lane: ",x.resumeHandle.lane]}),x.resumeHandle.artifact&&e.jsxs("p",{className:"text-ouro-mist",children:["Artifact: ",x.resumeHandle.artifact]}),x.resumeHandle.nextAction&&e.jsxs("p",{className:"text-ouro-mist",children:["Next: ",x.resumeHandle.nextAction]}),x.resumeHandle.blockerOrWaitingOn&&e.jsxs("p",{className:"text-ouro-shadow",children:["Blocked: ",x.resumeHandle.blockerOrWaitingOn]}),e.jsxs(_,{color:x.resumeHandle.confidence==="high"?"lime":x.resumeHandle.confidence==="medium"?"yellow":"zinc",children:[x.resumeHandle.confidence," confidence"]})]})]}),x.otherActiveSessions.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:["Other sessions (",x.otherActiveSessions.length,")"]}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:x.otherActiveSessions.slice(0,5).map(p=>e.jsx("button",{onClick:()=>n({tab:"sessions",focus:`${p.friendId}/${p.channel}/${p.key}`}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:p.friendName},`${p.friendId}/${p.channel}/${p.key}`))})]})]}),$&&$.changeCount>0&&e.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["What changed (",$.changeCount,")"]}),$.snapshotAge&&e.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Since ",q($.snapshotAge)]}),e.jsxs("div",{className:"mt-2 space-y-1",children:[$.items.slice(0,8).map((p,C)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_,{color:p.kind.includes("status")?"yellow":"zinc",children:p.kind.replace(/_/g," ")}),e.jsx("span",{className:"truncate text-ouro-mist",children:p.summary})]},C)),$.items.length>8&&e.jsxs("p",{className:"text-xs text-ouro-shadow",children:["+",$.items.length-8," more changes"]})]})]}),d===null&&e.jsx("div",{"aria-busy":"true",className:"grid gap-4 sm:grid-cols-3","data-testid":"continuity-loading",children:["Presence","Cares","Episodes"].map(p=>e.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:p}),e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"Loading…"})]},p))}),d&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Presence"}),d.presence.self?e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-ouro-bone",children:d.presence.self.availability}),d.presence.self.lane&&e.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Lane: ",d.presence.self.lane]}),d.presence.self.tempo&&e.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Tempo: ",d.presence.self.tempo]})]}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No presence data"}),d.presence.peers.length>0&&e.jsxs("div",{className:"mt-2 border-t border-ouro-moss/20 pt-2",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:"Peers"}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:d.presence.peers.map(p=>e.jsx(_,{color:p.availability==="active"?"lime":"zinc",children:p.agentName},p.agentName))})]})]}),e.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Cares (",d.cares.activeCount,")"]}),d.cares.items.length>0?e.jsx("div",{className:"mt-2 space-y-1.5",children:d.cares.items.slice(0,5).map(p=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:p.salience==="high"?"red":p.salience==="medium"?"yellow":"zinc",children:p.salience}),e.jsx("p",{className:"truncate text-sm text-ouro-bone",children:p.label})]},p.id))}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No active cares"})]}),e.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Episodes (",d.episodes.recentCount,")"]}),d.episodes.items.length>0?e.jsx("div",{className:"mt-2 space-y-1.5",children:d.episodes.items.slice(0,5).map(p=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_,{color:"zinc",children:p.kind}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-ouro-bone",children:p.summary}),e.jsx("p",{className:"text-xs text-ouro-shadow",children:q(p.timestamp)})]})]},p.id))}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No recent episodes"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsx(Oe,{label:"Tasks",value:l.liveCount,sub:`${l.blockedCount} blocked`,onClick:()=>n({tab:"work"})}),e.jsx(Oe,{label:"Obligations",value:k.openCount,sub:`${T.liveCount} sessions`,onClick:()=>n({tab:"work"})}),e.jsx(Oe,{label:"Coding",value:A.activeCount,sub:`${A.blockedCount} blocked`,onClick:()=>n({tab:"work"})}),e.jsx(Oe,{label:"Private Runtime",value:j.status,sub:G(j.summary??"",30),onClick:()=>n({tab:"inner"})})]}),c&&c.items.length>0&&(()=>{const p=c.items.filter(C=>Mr.has(C.status));return p.length===0?null:e.jsx(ke,{title:`Active coding (${p.length})`,children:e.jsx("div",{className:"space-y-1.5",children:p.map(C=>e.jsxs("button",{onClick:()=>n({tab:"work"}),className:"flex w-full items-center gap-2 rounded-lg bg-ouro-void/40 px-3 py-2 text-left ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:[e.jsx(_,{color:C.status==="running"?"lime":C.status==="waiting_input"?"yellow":"zinc",children:C.status}),e.jsxs("span",{className:"truncate text-sm text-ouro-bone",children:[C.runner," — ",G(C.workdir,40)]}),e.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:q(C.lastActivityAt)})]},C.id))})})})(),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(ke,{title:"Senses",children:M.length>0?e.jsx(_r,{items:M}):e.jsx(st,{children:"No active senses"})}),e.jsx(ke,{title:"Bridges",children:f.length>0?e.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(p=>e.jsx("button",{onClick:()=>n({tab:"connections",focus:p}),children:e.jsx(_,{color:"lime",children:p})},p))}):e.jsx(st,{children:"No active bridges"})})]}),(()=>{const p=k.items.filter(C=>C.status==="fulfilled");return p.length===0?null:e.jsx(ke,{title:"Recently closed",children:e.jsx("div",{className:"space-y-1",children:p.slice(0,3).map((C,L)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-ouro-glow/5 ring-1 ring-ouro-glow/10",children:[e.jsx(_,{color:"lime",children:"closed"}),e.jsx("p",{className:"text-sm text-ouro-mist truncate",children:G(C.content,80)}),e.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:q(C.updatedAt)})]},L))})})})(),e.jsx(ke,{title:"Recent activity",children:y.recent.length>0?e.jsx("div",{className:"space-y-1",children:y.recent.map((p,C)=>{const L=p.kind==="coding"||p.kind==="obligation"?"work":p.kind==="session"?"sessions":"inner";return e.jsxs("button",{onClick:()=>n({tab:L}),className:"flex w-full flex-col gap-0.5 rounded-lg px-3 py-2.5 text-left hover:bg-ouro-moss/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{children:p.kind}),e.jsx("span",{className:"text-xs text-ouro-shadow",children:q(p.at)})]}),e.jsx("p",{className:"truncate text-sm font-medium text-ouro-bone",children:G(p.label,100)}),e.jsx("p",{className:"truncate text-xs text-ouro-shadow",children:G(p.detail,80)})]},C)})}):e.jsx(st,{children:"No recent activity yet."})})]})}function Gt({item:t,nav:s,agentName:o,onDismiss:n}){var c;const r=t.urgency==="return-ready",a=(c=t.ref)==null?void 0:c.focus;return e.jsxs("div",{className:`flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left ring-1 transition-colors ${r?"bg-ouro-glow/5 ring-ouro-glow/15":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[e.jsxs("button",{onClick:()=>t.ref&&s({tab:t.ref.tab,focus:t.ref.focus}),className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(_,{color:Ar[t.urgency]??"zinc",children:Er[t.urgency]??t.urgency}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:`text-sm font-medium ${r?"text-ouro-glow":"text-ouro-bone"}`,children:t.label}),e.jsx("p",{className:"text-xs text-ouro-shadow truncate",children:t.detail}),e.jsx("p",{className:"text-[10px] italic text-ouro-shadow/60 mt-0.5",children:Tr[t.urgency]??""})]}),t.ageMs!=null&&e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:t.ageMs<36e5?`${Math.floor(t.ageMs/6e4)}m`:t.ageMs<864e5?`${Math.floor(t.ageMs/36e5)}h`:`${Math.floor(t.ageMs/864e5)}d`})]}),a&&e.jsx("button",{onClick:async h=>{h.stopPropagation(),await fetch(`/api/agents/${encodeURIComponent(o)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:a})}),n()},className:"shrink-0 text-xs text-ouro-shadow hover:text-ouro-fang transition-colors",title:"Dismiss",children:"✕"})]})}function _e({tab:t,children:s}){const o=ge();return e.jsx("button",{onClick:()=>o({tab:t}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow transition-colors",children:s})}function Oe({label:t,value:s,sub:o,onClick:n}){return e.jsxs("button",{onClick:n,className:"rounded-xl bg-ouro-void/50 p-3 text-left ring-1 ring-ouro-moss/20 hover:ring-ouro-glow/20 transition-all",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:t}),e.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-ouro-bone",children:s}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-ouro-shadow",children:o})]})}function ke({title:t,children:s}){return e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:t}),e.jsx("div",{className:"mt-2",children:s})]})}function _r({items:t}){return e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>e.jsx(_,{color:"lime",children:s},s))})}function st({children:t}){return e.jsx("p",{className:"text-sm text-ouro-shadow",children:t})}function Ee(t){return t.length>0?t.join(", "):"(unknown)"}function Or(t,s){if(s==="all")return!0;if(["imbox","screener","discarded","quarantine"].includes(s))return t.placement===s;if(s==="native"||s==="delegated")return t.compartmentKind===s;if(s.startsWith("source:")){const o=s.slice(7),n=o.indexOf(":");if(n===-1)return t.source===o;const r=o.slice(0,n),a=o.slice(n+1);return t.source===r&&(t.ownerEmail??"unknown-owner")===a}return!1}function Ps(t){return t.subject||"(no subject)"}function Dr(t,s){return{status:"error",agentName:t,mailboxAddress:null,generatedAt:new Date().toISOString(),store:null,folders:[],messages:[],screener:[],outbound:[],recovery:{discardedCount:0,quarantineCount:0,undecryptableCount:0,missingKeyIds:[]},accessLog:[],error:s}}function Pr(t,s,o){return{status:"error",agentName:t,mailboxAddress:s,generatedAt:new Date().toISOString(),message:null,accessLog:[],error:o}}function Us(t){return t.provenance.compartmentKind==="delegated"?`delegated human mailbox · ${t.provenance.ownerEmail??"unknown owner"} / ${t.provenance.source??"unknown source"}`:"native agent mailbox"}function Ur(t){return t.mailboxRole==="delegated-human-mailbox"?`delegated human mailbox · ${t.ownerEmail??"unknown owner"} / ${t.source??"unknown source"}`:t.mailboxRole==="agent-native-mailbox"?"native agent mailbox":"mailbox"}function zr(t){return t.sendAuthority==="agent-native"?"native agent mailbox":t.mailboxRole}function Br(t){return t.transport??t.provider??"not sent"}function Hr(t){return t.deliveredAt??t.failedAt??t.acceptedAt??t.sentAt??t.submittedAt??t.updatedAt}function wt(t){return t==="screener"?"bg-[#fff7d6] text-[#6f5200] ring-[#e7c85c]":t==="discarded"||t==="quarantine"?"bg-[#ffe8e2] text-[#8a2f1f] ring-[#ef9a84]":t==="sent"?"bg-[#dff7ea] text-[#17613a] ring-[#82caa1]":t==="draft"?"bg-[#e7ecff] text-[#263f95] ring-[#a7b5f5]":"bg-[#e9f3ef] text-[#1e5840] ring-[#9fc7b5]"}function Fr(t){return(t==null?void 0:t.messages.length)??0}function qr({agentName:t,focus:s,onFocusConsumed:o,refreshGeneration:n}){var y;const[r,a]=i.useState(null),[c,h]=i.useState("all"),[d,b]=i.useState(s??null),[x,w]=i.useState(null),[$,u]=i.useState(!1);i.useEffect(()=>{h("all"),b(s??null),w(null)},[t]),i.useEffect(()=>{a(null),U(`/agents/${encodeURIComponent(t)}/mail`).then(a).catch(()=>a(Dr(t,"mail unavailable")))},[t,n]),i.useEffect(()=>{s&&(b(s),o==null||o())},[s,o]),i.useEffect(()=>{if(!d){w(null);return}u(!0),U(`/agents/${encodeURIComponent(t)}/mail/${encodeURIComponent(d)}`).then(w).catch(()=>w(Pr(t,(r==null?void 0:r.mailboxAddress)??null,"message unavailable"))).finally(()=>u(!1))},[t,d,n]);const g=i.useMemo(()=>{const v=(r==null?void 0:r.folders)??[];return[{id:"all",label:"All",count:Fr(r)},...v]},[r]),m=i.useMemo(()=>((r==null?void 0:r.messages)??[]).filter(v=>Or(v,c)),[c,r]),j=i.useMemo(()=>c!=="draft"&&c!=="sent"?[]:((r==null?void 0:r.outbound)??[]).filter(v=>c==="draft"?v.status==="draft":v.status!=="draft"),[c,r]);return r?r.status!=="ready"?e.jsx("div",{className:"mailbox-shell grid min-h-[58vh] place-items-center rounded-md bg-[#f2f6ef] p-8 text-[#1f2720] ring-1 ring-black/10",children:e.jsxs("div",{className:"max-w-lg text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-[#667067]",children:"Mailbox"}),e.jsx("h2",{className:"mt-2 text-2xl font-semibold",children:r.status==="auth-required"?"Locked":"Unavailable"}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[#59645c]",children:r.error})]})}):e.jsxs("div",{className:"mailbox-shell overflow-hidden rounded-md bg-[#f2f6ef] text-[#172018] ring-1 ring-black/10",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[#cbd8c8] bg-[#e4ecdf] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Agent mailbox"}),e.jsx("p",{className:"truncate text-sm text-[#2d3a30]",children:r.mailboxAddress})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:"zinc",children:"read-only"}),e.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[r.messages.length," messages"]}),e.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[r.outbound.length," outbound"]})]})]}),e.jsxs("div",{className:"grid min-h-[66vh] grid-cols-1 lg:grid-cols-[14.5rem_minmax(19rem,25rem)_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"border-b border-[#cbd8c8] bg-[#e4ecdf] p-3 lg:border-b-0 lg:border-r",children:[e.jsx(Vr,{folders:g,activeFolder:c,setActiveFolder:h}),e.jsx(Kr,{discarded:r.recovery.discardedCount,quarantine:r.recovery.quarantineCount,undecryptable:r.recovery.undecryptableCount,missingKeyIds:r.recovery.missingKeyIds}),e.jsx(Wr,{candidates:r.screener,onOpen:v=>{h("screener"),b(v)}}),e.jsx(Yr,{entries:r.accessLog})]}),e.jsxs("section",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[e.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:((y=g.find(v=>v.id===c))==null?void 0:y.label)??"All"}),e.jsx("p",{className:"text-xs text-[#687062]",children:j.length>0?`${j.length} outbound records`:`${m.length} messages`})]}),e.jsxs("div",{className:"max-h-[66vh] overflow-y-auto",children:[j.map(v=>e.jsx(Gr,{record:v},v.id)),j.length===0&&m.map(v=>e.jsx(Qr,{message:v,selected:d===v.id,onSelect:()=>b(v.id)},v.id)),j.length===0&&m.length===0&&e.jsx("div",{className:"px-4 py-10 text-center text-sm text-[#687062]",children:"No records here."})]})]}),e.jsxs("main",{className:"min-w-0 bg-[#fbfdf8]",children:[!d&&e.jsx(Jr,{}),d&&$&&e.jsx(Xt,{label:"Opening message"}),d&&!$&&(x==null?void 0:x.status)!=="ready"&&e.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"Message unavailable"}),e.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:x==null?void 0:x.error})]})}),(x==null?void 0:x.status)==="ready"&&x.message&&e.jsx(Xr,{detail:x})]})]})]}):e.jsx(Xt,{label:"Opening mailbox"})}function Vr({folders:t,activeFolder:s,setActiveFolder:o}){return e.jsx("div",{className:"space-y-1",children:t.map(n=>e.jsxs("button",{type:"button",onClick:()=>o(n.id),className:`flex h-9 w-full items-center justify-between rounded px-3 text-left text-sm transition-colors ${s===n.id?"bg-[#fbfdf8] text-[#172018] shadow-sm":"text-[#536157] hover:bg-[#fbfdf8]/65"}`,children:[e.jsx("span",{className:"truncate",children:n.label}),e.jsx("span",{className:"text-xs tabular-nums text-[#687062]",children:n.count})]},n.id))})}function Kr({discarded:t,quarantine:s,undecryptable:o,missingKeyIds:n}){return e.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Recovery drawers"}),e.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[e.jsx("p",{className:"text-xs text-[#687062]",children:"Discarded"}),e.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:t})]}),e.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[e.jsx("p",{className:"text-xs text-[#687062]",children:"Quarantine"}),e.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:s})]}),e.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[e.jsx("p",{className:"text-xs text-[#687062]",children:"Undecryptable"}),e.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:o})]})]}),o>0&&e.jsxs("p",{className:"mt-2 text-[11px] leading-4 text-[#687062]",children:["missing key ",n[0],n.length>1?` +${n.length-1} more`:""]})]})}function Wr({candidates:t,onOpen:s}){return e.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Screener"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[t.slice(0,5).map(o=>e.jsxs("button",{type:"button",onClick:()=>s(o.messageId),className:"block w-full rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-left hover:border-[#9fb8a7]",children:[e.jsx("p",{className:"truncate text-xs font-semibold text-[#172018]",children:o.senderEmail}),e.jsx("p",{className:"mt-1 truncate text-xs text-[#687062]",children:o.trustReason})]},o.id)),t.length===0&&e.jsx("p",{className:"text-xs text-[#687062]",children:"No pending senders."})]})]})}function Yr({entries:t}){return e.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Access audit"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[t.slice(0,4).map(s=>e.jsxs("div",{className:"text-xs leading-4 text-[#687062]",children:[e.jsx("p",{className:"truncate font-medium text-[#3f4b42]",children:s.tool}),e.jsx("p",{className:"truncate",children:Ur(s)}),e.jsx("p",{className:"truncate",children:s.reason})]},s.id)),t.length===0&&e.jsx("p",{className:"text-xs text-[#687062]",children:"No reads yet."})]})]})}function Qr({message:t,selected:s,onSelect:o}){return e.jsxs("button",{type:"button",onClick:o,className:`block w-full border-b border-[#d8e2d4] px-4 py-3 text-left transition-colors ${s?"bg-[#eaf4ee]":"hover:bg-[#eef4ec]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:Ee(t.from)}),e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-[#687062]",children:q(t.receivedAt)})]}),e.jsx("p",{className:"mt-1 truncate text-sm text-[#26352a]",children:Ps(t)}),e.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:G(t.snippet,150)}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:`rounded px-2 py-0.5 text-[11px] ring-1 ${wt(t.placement)}`,children:t.placement}),e.jsx("span",{className:"truncate text-[11px] text-[#687062]",children:Us(t)})]})]})}function Gr({record:t}){const s=t.deliveryEvents[t.deliveryEvents.length-1];return e.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:t.subject||"(no subject)"}),e.jsx("span",{className:`shrink-0 rounded px-2 py-0.5 text-[11px] ring-1 ${wt(t.status)}`,children:t.status})]}),e.jsxs("p",{className:"mt-1 truncate text-xs text-[#536157]",children:["to ",Ee(t.to)]}),e.jsxs("p",{className:"mt-1 text-xs text-[#687062]",children:[Br(t)," · ",q(Hr(t))]}),e.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:[zr(t)," · ",t.sendMode??"mode unknown",t.policyDecision?` · policy ${t.policyDecision.code} / ${t.policyDecision.fallback}`:""]}),(t.providerMessageId||t.providerRequestId)&&e.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:["provider ",t.providerMessageId??"unknown",t.providerRequestId?` · request ${t.providerRequestId}`:""]}),s&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:s.bodySafeSummary})]})}function Xr({detail:t}){const s=t.message;return e.jsxs("article",{className:"min-h-[66vh]",children:[e.jsxs("header",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] px-6 py-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsx("h2",{className:"min-w-0 text-xl font-semibold leading-tight text-[#172018]",children:Ps(s)}),e.jsx("span",{className:`rounded px-2 py-0.5 text-xs ring-1 ${wt(s.placement)}`,children:s.placement})]}),e.jsxs("div",{className:"mt-4 grid gap-1 text-sm text-[#536157]",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"From:"})," ",Ee(s.from)]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"To:"})," ",Ee(s.to)]}),s.cc.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"Cc:"})," ",Ee(s.cc)]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"Received:"})," ",new Date(s.receivedAt).toLocaleString()]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"Provenance:"})," ",Us(s)]})]})]}),e.jsx("div",{className:"border-b border-[#f0d0bd] bg-[#fff4e4] px-6 py-3 text-sm text-[#8a4a18]",children:s.untrustedContentWarning}),e.jsxs("div",{className:"px-6 py-6",children:[e.jsx("pre",{className:"whitespace-pre-wrap break-words font-body text-sm leading-7 text-[#26352a]",children:s.text||"(no text body)"}),s.bodyTruncated&&e.jsx("p",{className:"mt-4 text-xs text-[#687062]",children:"Body truncated in Mailbox."}),e.jsxs("div",{className:"mt-6 grid gap-3 border-t border-[#cbd8c8] pt-4 text-xs text-[#687062] md:grid-cols-2",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"Read reason:"})," ",s.access.reason]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-[#172018]",children:"Read at:"})," ",new Date(s.access.accessedAt).toLocaleString()]})]}),s.attachments.length>0&&e.jsxs("div",{className:"mt-6 border-t border-[#cbd8c8] pt-4",children:[e.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Attachments"}),e.jsx("div",{className:"mt-2 space-y-2",children:s.attachments.map(o=>e.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-sm text-[#3f4b42]",children:[o.filename," · ",o.contentType," · ",o.size.toLocaleString()," bytes"]},`${o.filename}-${o.size}`))})]})]})]})}function Jr(){return e.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"No message selected"}),e.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:"Reading pane idle."})]})})}function Xt({label:t}){return e.jsxs("div",{className:"flex items-center gap-2 p-6",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-[#2f8f4e]"}),e.jsxs("span",{className:"text-xs text-[#687062]",children:[t,"..."]})]})}function pt(t){const s=t.function.name,o=Zr(t.function.arguments);return s==="settle"?{kind:"response",name:s,id:t.id,deliveredText:o.answer??null,delegatedThought:null,metadata:o.intent??null,rawArgs:null}:s==="ponder"?{kind:"delegation",name:s,id:t.id,deliveredText:o.say??null,delegatedThought:o.thought??null,metadata:null,rawArgs:null}:s==="rest"?{kind:"rest",name:s,id:t.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:null}:s==="observe"?{kind:"observe",name:s,id:t.id,deliveredText:null,delegatedThought:null,metadata:o.reason??null,rawArgs:null}:s==="surface"?{kind:"surface",name:s,id:t.id,deliveredText:o.content??null,delegatedThought:null,metadata:o.delegationId??o.friendId??null,rawArgs:null}:{kind:"action",name:s,id:t.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:t.function.arguments}}function Zr(t){try{const s=JSON.parse(t);if(s&&typeof s=="object")return s}catch{}return{}}const ea=48;function ta(t){return t.scrollHeight-t.scrollTop-t.clientHeight<=ea}function zs(t){const s=i.useRef(null),o=i.useRef(!0),n=i.useCallback(()=>{const a=s.current;a&&(o.current=ta(a))},[]),r=i.useCallback(()=>{o.current=!1},[]);return i.useEffect(()=>{const a=s.current;!a||!o.current||(a.scrollTop=a.scrollHeight)},[t]),{ref:s,onScroll:n,preserveScroll:r}}function sa(t){return typeof t=="string"?t:Array.isArray(t)?t.map(s=>s.type==="text"&&typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):""}function Le(t){return sa(t.content)}function Bs(t){return t.time.authoredAt??t.time.observedAt??t.time.recordedAt}const Hs=t=>/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t),Fs=t=>/^[a-f0-9]{64}$/.test(t);function Jt(t,s){return!Hs(t)||s!==void 0&&!Fs(s)?null:s===void 0?`ouro shepherd status --agent '${t}' --json`:`ouro shepherd inspect --agent '${t}' --id '${s}' --json`}function oa(t,s,o){return!Hs(t)||!Fs(s)||o===null||!Number.isSafeInteger(o)||o<0?null:`ouro shepherd reconcile --agent '${t}' --id '${s}' --resolution retired --expected-revision ${o} --request-id 'supervision-retire-${s}-r${o}' --json`}const na="This alpha retains unqualified legacy automation. Legacy immediate/network automation may still type text without mandate enforcement. Automatic keys are refused. Absent or revoked mandates do not disable those text paths. Disable Shepherd to stop legacy automation.",Zt={"needs-reply":{color:"red",label:"needs reply"},"on-hold":{color:"yellow",label:"on hold"},monitoring:{color:"zinc",label:"monitoring"},idle:{color:"zinc",label:"idle"}};function qs(t){return t==="bluebubbles"?"iMessage":t==="teams"?"Teams":t==="cli"?"CLI":t==="mail"?"Mail":t==="voice"?"Voice":t}function ra(t){return t==="bluebubbles"?"imessage":t==="teams"?"teams":t==="cli"?"terminal":"default"}function aa(t){return t==="imessage"?"overflow-hidden rounded-xl bg-[#f5f5f7] text-[#1d1d1f] ring-1 ring-black/10":t==="teams"?"overflow-hidden rounded-xl bg-[#f7f5ff] text-[#242424] ring-1 ring-[#d8d1ff]":t==="terminal"?"overflow-hidden rounded-lg bg-[#050807] font-mono text-[#d1fae5] ring-1 ring-[#1f3a2c]":"overflow-hidden rounded-lg bg-ouro-void/60 text-ouro-bone ring-1 ring-ouro-moss/15"}function ia(t){return t==="imessage"?"border-b border-black/10 bg-[#fbfbfd] px-4 py-3 text-center":t==="teams"?"border-b border-[#d8d1ff] bg-[#4f3bb3] px-4 py-3 text-white":t==="terminal"?"border-b border-[#1f3a2c] bg-[#101815] px-4 py-2 text-[#86efac]":"border-b border-ouro-moss/15 px-4 py-3"}function la(t){return t==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-md bg-[#e9e9eb] px-3.5 py-2 text-[#1d1d1f]":t==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-white px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#e5e5e5]":t==="terminal"?"max-w-full rounded-none border-l-2 border-[#60a5fa] bg-transparent px-3 py-2 text-[#dbeafe]":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-sm bg-ouro-moss/25 px-3.5 py-2 ring-1 ring-ouro-moss/15"}function De(t,s="normal"){return t==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-md bg-[#0a84ff] px-3.5 py-2 text-white":t==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-[#ede9fe] px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#c4b5fd]":t==="terminal"?"max-w-full rounded-none border-l-2 border-[#22c55e] bg-transparent px-3 py-2 text-[#bbf7d0]":s==="surface"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-scale/12 px-3.5 py-2 ring-1 ring-ouro-scale/15":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-glow/8 px-3.5 py-2 ring-1 ring-ouro-glow/12"}function $e(t,s){return t==="imessage"?s==="agent"?"font-mono text-[9px] text-white/70":"font-mono text-[9px] text-[#6b7280]":t==="teams"?"font-mono text-[9px] uppercase tracking-wider text-[#5b5fc7]":t==="terminal"?s==="agent"?"font-mono text-[11px] text-[#22c55e]":"font-mono text-[11px] text-[#60a5fa]":s==="surface"||s==="agent"?"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/70":"font-mono text-[9px] uppercase tracking-wider text-ouro-gold/70"}function Ae(t,s="agent"){return t==="imessage"?"text-sm leading-relaxed whitespace-pre-wrap break-words":t==="teams"?"text-sm leading-relaxed text-[#242424] whitespace-pre-wrap break-words":t==="terminal"?`font-mono text-[12px] leading-6 whitespace-pre-wrap break-words ${s==="agent"?"text-[#bbf7d0]":"text-[#dbeafe]"}`:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words"}function ca(t){return Bs(t)}function pe(t){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(ca(t)))}function da({agentName:t,focus:s,onFocusConsumed:o,deskPrefs:n,refreshGeneration:r}){ge();const[a,c]=i.useState(null),[h,d]=i.useState(null),[b,x]=i.useState(null),[w,$]=i.useState(!1),u=i.useRef(null);i.useEffect(()=>{U(`/agents/${encodeURIComponent(t)}/sessions`).then(c)},[t,r]),i.useEffect(()=>{s&&(u.current=null,d(s),x(null),$(!0),o==null||o())},[t,s,o]),i.useEffect(()=>{if(!h)return;const l=`${h}:${r}`;if(u.current===l)return;u.current=l,$(!0);const[k,T,A]=h.split("/");U(`/agents/${encodeURIComponent(t)}/sessions/${encodeURIComponent(k)}/${encodeURIComponent(T)}/${encodeURIComponent(A)}`).then(x).catch(()=>x(null)).finally(()=>$(!1))},[t,h,r,s]);function g(l){if(h===l){d(null),x(null),u.current=null;return}d(l),x(null),$(!0)}const m=new Set((n==null?void 0:n.starredFriends)??[]);if(!a)return e.jsx(Vs,{label:"Loading sessions"});const j=new Map;for(const l of a.items)j.has(l.friendId)||j.set(l.friendId,[]),j.get(l.friendId).push(l);const y=[...j.entries()].sort((l,k)=>{const T=m.has(l[0])?0:1,A=m.has(k[0])?0:1;return T!==A?T-A:k[1].length-l[1].length}),v=[],E=new Map;for(const[l,k]of y)E.set(v.length,{name:k[0].friendName,channels:k.length,starred:m.has(l)}),v.push(...k);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:[a.totalCount," sessions · ",a.activeCount," active · ",a.staleCount," stale"]}),e.jsx("div",{className:"space-y-1.5",children:v.map((l,k)=>{var O;const T=E.get(k),A=m.has(l.friendId),M=`${l.friendId}/${l.channel}/${l.key}`,f=h===M,p=Zt[l.replyState]??Zt.idle,C=((O=l.lastUsage)==null?void 0:O.total_tokens)??l.estimatedTokens??0,I=C>0?Math.min(100,Math.round(C/8e4*100)):0;return e.jsxs("div",{children:[T&&T.channels>1&&e.jsxs("div",{className:"flex items-center gap-2 pt-3 pb-1",children:[T.starred&&e.jsx("span",{className:"text-ouro-gold text-sm",children:"★"}),e.jsx("span",{className:"font-medium text-ouro-bone text-sm",children:T.name}),e.jsxs("span",{className:"text-xs text-ouro-shadow",children:[T.channels," channels"]})]}),e.jsxs("button",{onClick:()=>g(M),className:`flex w-full flex-col gap-1.5 rounded-lg px-3 py-3 text-left transition-colors ring-1 ${f?"bg-ouro-moss/15 ring-ouro-glow/20":"ring-ouro-moss/15 hover:bg-ouro-moss/8"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A&&e.jsx("span",{className:"text-ouro-gold",title:"Starred",children:"★"}),e.jsx("span",{className:"truncate font-medium text-ouro-bone",children:l.friendName}),e.jsxs("span",{className:"shrink-0 text-xs text-ouro-shadow",children:["via ",qs(l.channel)]}),e.jsx(_,{color:p.color,children:p.label})]}),e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:q(l.lastActivityAt)})]}),l.latestUserExcerpt&&e.jsxs("p",{className:"truncate text-xs text-ouro-gold/70",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"in:"})," ",G(l.latestUserExcerpt,100)]}),l.latestAssistantExcerpt&&e.jsxs("p",{className:"truncate text-xs text-ouro-glow/60",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"out:"})," ",G(l.latestAssistantExcerpt,100)]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-ouro-shadow",children:[e.jsxs("span",{className:"tabular-nums",children:[l.messageCount," msgs"]}),l.lastUsage&&e.jsxs("span",{className:"tabular-nums",children:[l.lastUsage.total_tokens.toLocaleString()," tok"]}),I>0&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 max-w-32",title:"Context pressure — steady state oscillates between 80-100%",children:[e.jsx("div",{className:"h-1 flex-1 rounded-full bg-ouro-moss/20",children:e.jsx("div",{className:`h-1 rounded-full transition-all ${I>100?"bg-ouro-fang":I>80?"bg-ouro-gold":"bg-ouro-glow"}`,style:{width:`${Math.min(100,I)}%`}})}),e.jsxs("span",{className:"tabular-nums text-[10px]",children:[I,"%"]})]})]})]}),f&&e.jsx(ua,{loading:w,transcript:b})]},M)})})]})}function ua({loading:t,transcript:s}){var a;const o=((a=s==null?void 0:s.messages[s.messages.length-1])==null?void 0:a.id)??null,{ref:n,onScroll:r}=zs(o);return e.jsxs("div",{ref:n,"data-testid":"session-transcript-scroll",onScroll:r,className:"mt-1 max-h-[70vh] overflow-y-auto rounded-lg",children:[t&&!s&&e.jsx(Vs,{label:"Loading transcript"}),s&&e.jsx(xa,{transcript:s})]})}function xa({transcript:t}){const{messages:s,lastUsage:o}=t,n=ra(t.channel),r=s.filter(b=>b.role==="system"),a=s.filter(b=>b.role!=="system"),[c,h]=i.useState(!1),d=new Map;for(const b of a)b.role==="tool"&&b.toolCallId&&d.set(b.toolCallId,b);return e.jsxs("div",{className:aa(n),children:[e.jsxs("div",{className:ia(n),children:[e.jsx("p",{className:n==="terminal"?"font-mono text-xs":"text-sm font-semibold",children:qs(t.channel)}),e.jsxs("p",{className:n==="terminal"?"mt-0.5 font-mono text-[10px] text-[#6ee7b7]":"mt-0.5 text-xs opacity-70",children:[t.friendName," · ",t.messageCount," messages"]})]}),e.jsxs("div",{className:"space-y-0.5 p-3",children:[o&&e.jsxs("p",{className:n==="terminal"?"pb-2 font-mono text-[10px] text-[#6ee7b7]":"pb-2 font-mono text-[10px] opacity-60",children:[o.input_tokens.toLocaleString()," in · ",o.output_tokens.toLocaleString()," out · ",o.total_tokens.toLocaleString()," total"]}),t.truncatedHistory&&e.jsx("p",{className:n==="terminal"?"pb-2 font-mono text-[10px] text-[#facc15]":"pb-2 font-mono text-[10px] text-ouro-gold/80",children:"Model context is trimmed; retained history is shown below."}),r.length>0&&e.jsxs("div",{className:"pb-2 mb-2 border-b border-current/10",children:[e.jsxs("button",{onClick:()=>h(!c),className:"font-mono text-[10px] uppercase tracking-wider opacity-60 transition-opacity hover:opacity-90",children:[c?"▼":"▶"," system context (",r.length,")"]}),c&&r.map(b=>e.jsxs("div",{className:"mt-2 max-h-60 overflow-y-auto rounded bg-black/5 p-2 text-xs opacity-75 whitespace-pre-wrap break-words",children:[e.jsx("p",{className:"mb-1 font-mono text-[9px] opacity-70",children:pe(b)}),Le(b)]},b.id))]}),a.map(b=>b.role==="tool"?null:b.role==="user"?e.jsx(ma,{msg:b,surface:n},b.id):b.role==="assistant"?e.jsx(pa,{msg:b,toolResults:d,surface:n},b.id):null)]})]})}function ma({msg:t,surface:s}){const o=Le(t);return e.jsx("div",{className:"flex justify-start py-1",children:e.jsxs("div",{className:la(s),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:$e(s,"user"),children:s==="terminal"?"human $":"user"}),e.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",t.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:pe(t)})]}),e.jsx("p",{className:Ae(s,"user"),children:o})]})})}function pa({msg:t,toolResults:s,surface:o}){const n=Le(t),r=(t.toolCalls??[]).map(pt),a=r.filter(d=>d.kind!=="action"),c=r.filter(d=>d.kind==="action"),h=[];for(const d of a)d.kind==="response"?h.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:De(o),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:$e(o,"agent"),children:o==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:pe(t)})]}),e.jsx("p",{className:Ae(o),children:d.deliveredText}),d.metadata&&d.metadata!=="complete"&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["intent: ",d.metadata]})]})},d.id)):d.kind==="delegation"?h.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:De(o),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:$e(o,"agent"),children:o==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:pe(t)})]}),d.deliveredText&&e.jsx("p",{className:Ae(o),children:d.deliveredText}),d.delegatedThought&&e.jsxs("div",{className:"mt-2 rounded bg-black/10 px-2.5 py-1.5 ring-1 ring-current/10",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider opacity-70",children:"→ private runtime"}),e.jsx("p",{className:"mt-0.5 text-xs opacity-80",children:d.delegatedThought})]})]})},d.id)):d.kind==="surface"?h.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:De(o,"surface"),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:$e(o,"surface"),children:"surfaced"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:pe(t)})]}),e.jsx("p",{className:Ae(o),children:d.deliveredText}),d.metadata&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",d.metadata]})]})},d.id)):d.kind==="rest"?h.push(e.jsx("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:"— resting —"},d.id)):d.kind==="observe"&&h.push(e.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:["— observed",d.metadata?`: ${d.metadata}`:""," —"]},d.id));return n&&a.length===0&&h.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:De(o),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:$e(o,"agent"),children:o==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:pe(t)})]}),e.jsx("p",{className:Ae(o),children:n})]})},`${t.id}-content`)),c.length>0&&h.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsx("div",{className:"max-w-[85%] sm:max-w-[75%] space-y-1",children:c.map(d=>e.jsx(ha,{call:d,result:s.get(d.id),surface:o},d.id))})},`${t.id}-tools`)),e.jsx(e.Fragment,{children:h})}function ha({call:t,result:s,surface:o}){const[n,r]=i.useState(!1),a=s?Le(s):null;return e.jsxs("button",{onClick:()=>r(!n),className:`w-full text-left rounded px-2.5 py-1.5 text-sm transition-colors ${o==="terminal"?"bg-[#0f1a15] font-mono text-[#bbf7d0] ring-1 ring-[#1f3a2c] hover:ring-[#22c55e]/40":o==="teams"?"bg-white text-[#242424] ring-1 ring-[#d8d1ff] hover:ring-[#5b5fc7]/40":o==="imessage"?"bg-white text-[#1d1d1f] ring-1 ring-black/10 hover:ring-[#0a84ff]/30":"bg-ouro-moss/10 ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/15"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-ouro-glow",children:t.name}),!n&&e.jsx("span",{className:"text-[10px] text-ouro-shadow",children:"tap to inspect"})]}),n&&e.jsxs(e.Fragment,{children:[t.rawArgs&&e.jsx("pre",{className:"mt-1.5 max-h-24 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap break-words",children:t.rawArgs}),s&&e.jsxs("div",{className:"mt-1.5 border-t border-ouro-moss/15 pt-1.5",children:[e.jsx(_,{children:"result"}),e.jsx("pre",{className:"mt-1 max-h-32 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-mist whitespace-pre-wrap break-words",children:a})]})]})]})}function Vs({label:t}){return e.jsxs("div",{className:"flex items-center gap-2 py-6",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),e.jsxs("span",{className:"font-mono text-xs text-ouro-shadow",children:[t,"…"]})]})}function fa({agentName:t,view:s,focus:o,onFocusConsumed:n,refreshGeneration:r}){var A,M;const a=ge(),[c,h]=i.useState(null),[d,b]=i.useState(null),[x,w]=i.useState(null),[$,u]=i.useState(null),[g,m]=i.useState(null),j=s.work,y=j.obligations,v=j.tasks;i.useEffect(()=>{let f=!1;return h(null),b(null),w(null),u(null),m(null),U(`/agents/${encodeURIComponent(t)}/coding`).then(p=>{f||h(p)}).catch(()=>{}),U(`/agents/${encodeURIComponent(t)}/obligations`).then(p=>{f||b(p)}).catch(()=>{}),U(`/agents/${encodeURIComponent(t)}/self-fix`).then(p=>{f||w(p)}).catch(()=>{}),U(`/agents/${encodeURIComponent(t)}/sentinel`).then(p=>{f||(u(p),m(null))}).catch(p=>{f||(u(null),m(p instanceof Error?p.message:"sentinel unavailable"))}),()=>{f=!0}},[t,r]);const E=(d==null?void 0:d.items)??y.items,l=(d==null?void 0:d.openCount)??y.openCount,k=(c==null?void 0:c.items)??[],T=new Map;for(const f of k){const p=f.obligationId;if(p){const C=T.get(p);C?C.push(f):T.set(p,[f])}}return e.jsxs("div",{className:"space-y-8",children:[($||g)&&e.jsxs("section",{children:[e.jsx(Ce,{label:"Recovery Sentinel"}),e.jsx(ga,{view:$,error:g})]}),e.jsxs("section",{children:[e.jsx(Ce,{label:`Obligations (${l} open)`}),(d==null?void 0:d.primarySelectionReason)&&e.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Primary: ",d.primarySelectionReason]}),E.length>0?e.jsx("div",{className:"mt-3 space-y-3",children:E.map(f=>{const p=T.get(f.id)??[],C=wa(f)?f:null,L=(C==null?void 0:C.isPrimary)??!1,I=(C==null?void 0:C.meaning)??null,O=f.origin;return e.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${L?"bg-ouro-glow/5 ring-ouro-glow/20":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[L&&e.jsx(_,{color:"lime",children:"primary"}),e.jsx(_,{color:f.status==="pending"?"yellow":f.status==="fulfilled"?"lime":"zinc",children:f.status}),e.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:G(f.content,120)})]}),O&&e.jsxs("button",{onClick:()=>a({tab:"sessions",focus:`${O.friendId}/${O.channel}/${O.key}`}),className:"mt-2 flex w-full items-center gap-2 rounded-md bg-ouro-moss/8 px-2.5 py-1.5 text-left text-xs ring-1 ring-ouro-moss/10 hover:ring-ouro-glow/20 transition-colors",children:[e.jsx("span",{className:"text-ouro-shadow",children:"from"}),e.jsx("span",{className:"font-medium text-ouro-glow",children:O.channel}),e.jsx("span",{className:"text-ouro-shadow",children:"→"}),e.jsx("span",{className:"text-ouro-mist truncate",children:O.key}),e.jsx("span",{className:"ml-auto text-ouro-shadow",children:"open session →"})]}),f.currentSurface&&e.jsxs("div",{className:"mt-1 text-xs text-ouro-mist",children:["surface: ",e.jsx("span",{className:"text-ouro-bone",children:f.currentSurface.kind})," — ",f.currentSurface.label]}),(I==null?void 0:I.waitingOn)&&e.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Waiting on: ",I.waitingOn]}),p.length>0&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Linked coding"}),p.map(V=>e.jsxs("div",{className:"flex items-center gap-2 rounded bg-ouro-moss/10 px-2 py-1 text-xs",children:[e.jsx(_,{color:V.status==="failed"?"red":V.status==="running"?"lime":"zinc",children:V.status}),e.jsxs("span",{className:"text-ouro-mist truncate",children:[V.runner," — ",V.workdir]})]},V.id))]}),f.nextAction&&e.jsxs("p",{className:"mt-1.5 text-xs text-ouro-mist",children:["Next: ",f.nextAction]}),e.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:q(f.updatedAt)})]},f.id)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No open obligations."})]}),x&&x.steps.length>0&&e.jsxs("section",{children:[e.jsx(Ce,{label:`Self-fix ${x.active?"(active)":"(inactive)"}`}),x.currentStep&&e.jsxs("p",{className:"mt-1 text-xs text-ouro-glow",children:["Current: ",x.currentStep]}),e.jsx("div",{className:"mt-3 space-y-1.5",children:x.steps.map((f,p)=>e.jsxs("div",{className:`flex items-center gap-2.5 rounded-lg px-3 py-2 ring-1 ${f.status==="active"?"bg-ouro-glow/5 ring-ouro-glow/20":f.status==="done"?"bg-ouro-void/40 ring-ouro-glow/10":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[e.jsx(_,{color:f.status==="done"?"lime":f.status==="active"?"yellow":(f.status==="skipped","zinc"),children:f.status}),e.jsx("span",{className:`text-sm ${f.status==="active"?"font-medium text-ouro-bone":"text-ouro-mist"}`,children:f.label}),f.detail&&e.jsx("span",{className:"ml-auto text-xs text-ouro-shadow",children:f.detail})]},p))})]}),e.jsxs("section",{children:[e.jsx(Ce,{label:`Coding lanes (${k.length})`}),k.length>0?e.jsx("div",{className:"mt-3 space-y-2",children:k.map(f=>{const p=f.status,C=p==="failed",L=f.failure,I=f.obligationId,O=f.originSession;return e.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:C?"red":p==="running"?"lime":p==="completed"?"zinc":"yellow",children:p}),e.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:f.runner}),e.jsx("span",{className:"truncate text-xs text-ouro-shadow",children:f.workdir})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[I&&e.jsxs("button",{onClick:()=>a({tab:"work",focus:I}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",I.slice(0,20),"…"]}),f.taskRef&&e.jsxs("span",{className:"text-xs text-ouro-glow",children:["task: ",f.taskRef]}),O&&e.jsx("button",{onClick:()=>{a({tab:"sessions",focus:`${O.friendId}/${O.channel}/${O.key}`})},className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:"origin session"})]}),f.checkpoint&&e.jsx("p",{className:"mt-1.5 text-xs text-ouro-mist",children:G(f.checkpoint,100)}),e.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["pid ",f.pid??"–"," · restarts ",f.restartCount," · ",q(f.lastActivityAt)]}),C&&L&&e.jsxs("div",{className:"mt-2 rounded bg-ouro-fang/5 p-2 text-xs ring-1 ring-ouro-fang/15",children:[e.jsx("span",{className:"font-semibold text-ouro-fang",children:"FAILURE:"})," ",e.jsxs("span",{className:"text-ouro-mist",children:[L.command," exited ",String(L.code??L.signal)]}),L.stderrTail&&e.jsx("pre",{className:"mt-1 max-h-20 overflow-y-auto font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap",children:L.stderrTail})]})]},f.id)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No coding sessions."})]}),e.jsxs("section",{children:[e.jsx(Ce,{label:`Tasks (${v.liveCount} live, ${v.blockedCount} blocked)`}),((A=v.liveTaskNames)==null?void 0:A.length)>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:v.liveTaskNames.map(f=>e.jsx(_,{children:f},f))}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No live tasks."}),((M=v.actionRequired)==null?void 0:M.length)>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Action required"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:v.actionRequired.map(f=>e.jsx(_,{color:"red",children:f},f))})]})]})]})}function Ce({label:t}){return e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:t})}function ga({view:t,error:s}){const o=(t==null?void 0:t.latest)??null,n=(t==null?void 0:t.latestReady)??null,r=new Set([o,n].filter(c=>!!c).map(ot)),a=((t==null?void 0:t.history)??[]).filter(c=>!r.has(ot(c)));return e.jsx("div",{className:"mt-3 rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:s&&!t?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(_,{color:"red",children:"unavailable"}),e.jsx("span",{className:"min-w-0 flex-1 break-words text-sm text-ouro-mist",children:s})]}):t?e.jsxs(e.Fragment,{children:[s&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 border-b border-ouro-moss/10 pb-2",children:[e.jsx(_,{color:"red",children:"unavailable"}),e.jsx("span",{className:"min-w-0 flex-1 break-words text-xs text-ouro-mist",children:s})]}),o?e.jsx(es,{label:"Latest",receipt:o,prominent:!0}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(_,{children:"missing"}),e.jsx("span",{className:"text-sm text-ouro-shadow",children:"Latest"})]}),n&&e.jsx("div",{className:"mt-3 border-t border-ouro-moss/10 pt-3",children:e.jsx(es,{label:"Latest ready",receipt:n})}),a.length>0&&e.jsxs("div",{className:"mt-3 border-t border-ouro-moss/10 pt-3",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"History"}),e.jsx("div",{className:"mt-2 divide-y divide-ouro-moss/10",children:a.map(c=>e.jsx(va,{receipt:c},ot(c)))})]}),t.degraded.issues.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-ouro-moss/10 pt-3",children:[e.jsx(_,{color:"yellow",children:"degraded"}),t.degraded.issues.map(c=>e.jsx("span",{className:"break-words text-xs text-ouro-shadow",children:c},c))]})]}):null})}function es({label:t,receipt:s,prominent:o=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:t}),e.jsx(_,{color:Ks(s.verdict),children:s.verdict}),e.jsx("span",{className:"font-mono text-xs text-ouro-bone",children:Ws(s.trigger)}),e.jsxs("span",{className:"text-xs text-ouro-shadow",children:["updated ",q(s.generatedAt)]})]}),e.jsx("p",{className:`${o?"mt-2 text-sm font-medium text-ouro-bone":"mt-1.5 text-sm text-ouro-mist"} break-words`,children:s.summary}),e.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[e.jsx(ts,{label:"Current ask",value:s.recoveryAnchor.currentAsk}),e.jsx(ts,{label:"Next safe action",value:s.recoveryAnchor.nextSafeAction})]}),s.signals.length>0&&e.jsx("div",{className:"mt-3 divide-y divide-ouro-moss/10 border-t border-ouro-moss/10 pt-1",children:s.signals.map(n=>e.jsx(ba,{signal:n},n.id))}),ss(s.sourceLocators).length>0&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Sources"}),ss(s.sourceLocators).map(n=>e.jsx("span",{className:"max-w-full truncate font-mono text-[10px] text-ouro-moss",children:n},n))]})]})}function ts({label:t,value:s}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:t}),e.jsx("p",{className:"mt-1 break-words text-sm text-ouro-bone",children:s?G(s,140):"unknown"})]})}function ba({signal:t}){return e.jsxs("div",{className:"grid gap-2 py-2 md:grid-cols-[150px_1fr] md:items-start",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(_,{color:ja(t),children:t.status}),e.jsx("span",{className:"font-mono text-[10px] text-ouro-shadow",children:t.kind.replace(/_/g," ")})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"break-words text-xs text-ouro-mist",children:t.summary}),e.jsx("p",{className:"mt-1 truncate font-mono text-[10px] text-ouro-moss",children:t.source.locator}),t.repair&&e.jsxs("p",{className:"mt-1 break-words text-xs text-ouro-shadow",children:[t.repair.actor,": ",t.repair.command??t.repair.detail]})]})]})}function va({receipt:t}){var o;const s=((o=t.signals[0])==null?void 0:o.summary)??null;return e.jsxs("div",{className:"grid gap-2 py-2 md:grid-cols-[120px_110px_1fr] md:items-start",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(_,{color:Ks(t.verdict),children:t.verdict})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-mono text-xs text-ouro-bone",children:Ws(t.trigger)}),e.jsx("p",{className:"text-[10px] text-ouro-shadow",children:q(t.generatedAt)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"break-words text-xs text-ouro-mist",children:t.summary}),s&&e.jsx("p",{className:"mt-1 break-words text-xs text-ouro-shadow",children:s}),e.jsx("p",{className:"mt-1 truncate font-mono text-[10px] text-ouro-moss",children:t.receiptLocator})]})]})}function Ks(t){return t==="ready"?"lime":t==="watch"?"yellow":"red"}function ja(t){return t.status==="fail"||t.severity==="critical"?"red":t.status==="warn"||t.severity==="warn"?"yellow":"lime"}function ot(t){return t.receiptLocator||t.id}function ss(t){return Array.from(new Set(t.filter(Boolean)))}function Ws(t){return t.replace(/_/g," ")}function wa(t){return"isPrimary"in t}function Na({agentName:t,focus:s,onFocusConsumed:o,refreshGeneration:n}){const r=ge(),[a,c]=i.useState(null),[h,d]=i.useState(null),[b,x]=i.useState(null);i.useEffect(()=>{const g=`/agents/${encodeURIComponent(t)}`;Promise.all([U(`${g}/attention`).then(c),U(`${g}/bridges`).then(d),U(`${g}/friends`).then(x)])},[t,n]);const w=(a==null?void 0:a.queueItems)??[],$=(h==null?void 0:h.items)??[],u=(b==null?void 0:b.friends)??[];return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("section",{children:[e.jsx(nt,{label:`Who is waiting (${(a==null?void 0:a.queueLength)??0})`}),w.length>0?e.jsx("div",{className:"mt-3 space-y-2",children:w.map((g,m)=>{const j=g.bridgeId,y=g.obligationId;return e.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>r({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:g.friendName}),e.jsxs("span",{className:"text-xs text-ouro-shadow",children:["via ",g.channel]}),e.jsxs(_,{color:"yellow",children:["waiting ",q(new Date(g.timestamp).toISOString())]})]}),e.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:G(g.delegatedContent,140)}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-2 text-xs",children:[j&&e.jsxs("button",{onClick:()=>r({tab:"connections",focus:j}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["bridge: ",j.slice(0,12),"…"]}),y&&e.jsxs("button",{onClick:()=>r({tab:"work",focus:y}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",y.slice(0,16),"…"]})]})]},m)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"Nobody waiting."})]}),e.jsxs("section",{children:[e.jsx(nt,{label:`Bridges (${(h==null?void 0:h.totalCount)??0})`}),$.length>0?e.jsx("div",{className:"mt-3 space-y-3",children:$.map(g=>{const m=g.attachedSessions,j=g.task,y=g.lifecycle==="active";return e.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${y?"bg-ouro-moss/10 ring-ouro-glow/12":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_,{color:y?"lime":"zinc",children:g.lifecycle}),e.jsx("p",{className:"font-medium text-ouro-bone",children:g.objective})]}),g.summary&&e.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:G(g.summary,160)}),m.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:m.map((v,E)=>e.jsxs("button",{onClick:()=>r({tab:"sessions",focus:`${v.friendId}/${v.channel}/${v.key}`}),className:"rounded-md bg-ouro-moss/10 px-2 py-0.5 font-mono text-[11px] text-ouro-glow ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/25 transition-colors",children:[v.friendId,"/",v.channel,"/",v.key]},E))}),j&&e.jsxs("p",{className:"mt-1.5 text-xs",children:[e.jsxs("button",{onClick:()=>r({tab:"work"}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["task: ",j.taskName]}),e.jsxs("span",{className:"text-ouro-shadow",children:[" (",j.mode,")"]})]}),e.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:q(g.updatedAt)})]},g.id)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No bridges."})]}),e.jsxs("section",{children:[e.jsx(nt,{label:`Friends (${(b==null?void 0:b.totalFriends)??0})`}),u.length>0?e.jsx("div",{className:"mt-3 space-y-1.5",children:u.map(g=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("button",{onClick:()=>r({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:g.friendName}),e.jsxs("p",{className:"text-xs text-ouro-shadow",children:[g.channels.join(", ")," · ",g.sessionCount," sessions",g.lastActivityAt&&e.jsxs(e.Fragment,{children:[" · ",q(g.lastActivityAt)]})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("p",{className:"tabular-nums text-sm font-medium text-ouro-bone",children:g.totalTokens.toLocaleString()}),e.jsx("p",{className:"text-[10px] text-ouro-shadow",children:"tokens"})]})]},g.friendId))}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No friends."})]})]})}function nt({label:t}){return e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:t})}function ya(t){return Bs(t)}function Se(t){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(ya(t)))}function ka({agentName:t,view:s,refreshGeneration:o}){const n=ge(),[r,a]=i.useState(null),[c,h]=i.useState(null),[d,b]=i.useState(!1),[x,w]=i.useState(null),[$,u]=i.useState(!1),g=i.useRef(null),m=s.inner;i.useEffect(()=>{U(`/agents/${encodeURIComponent(t)}/habits`).then(a)},[t,o]),i.useEffect(()=>{let f=!1;return b(!1),h(null),U(`/agents/${encodeURIComponent(t)}/habit-runs`).then(p=>{f||h(p)}).catch(()=>{f||b(!0)}),()=>{f=!0}},[t,o]),i.useEffect(()=>{x&&g.current!==o&&(g.current=o,U(`/agents/${encodeURIComponent(t)}/inner-transcript`).then(w))},[t,o,x!==null]);function j(){if(x){u(!$);return}U(`/agents/${encodeURIComponent(t)}/inner-transcript`).then(f=>{g.current=o,w(f),u(!0)})}const y=(r==null?void 0:r.items)??[],v=(c==null?void 0:c.items)??[],E=y.filter(f=>f.isOverdue),l=y.filter(f=>f.status==="active"&&!f.isOverdue),k=y.filter(f=>f.status==="paused"),T=m.mode==="deep"?m.origin:null,A=m.mode==="deep"?m.obligationStatus:null,M=y.find(f=>f.name.toLowerCase()==="heartbeat");return e.jsxs("div",{className:"space-y-8",children:[M&&e.jsxs("section",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Heartbeat"}),e.jsx("div",{className:`mt-2 rounded-xl p-4 ring-1 ${M.isOverdue?"bg-ouro-fang/5 ring-ouro-fang/15":"bg-ouro-moss/10 ring-ouro-glow/10"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${M.isOverdue?"bg-ouro-fang animate-pulse":"bg-ouro-glow"}`}),e.jsx("span",{className:"font-medium text-ouro-bone",children:M.isOverdue?"Overdue":"Healthy"}),e.jsxs("span",{className:"text-xs text-ouro-shadow",children:["every ",M.cadence??"unknown"," · last ",M.lastRun?q(M.lastRun):"never"]})]})})]}),e.jsx("section",{children:e.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Private runtime work"}),e.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone",children:m.status}),m.summary&&e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:m.summary}),e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:m.hasPending?"Private runtime work queued.":"No private runtime work."}),(m.returnObligationQueue.queuedCount>0||m.returnObligationQueue.runningCount>0)&&e.jsxs("p",{className:"mt-1 text-sm text-ouro-mist",children:["Held work items:"," ",e.jsx("span",{className:"font-medium text-ouro-bone",children:m.returnObligationQueue.queuedCount+m.returnObligationQueue.runningCount})," ","(",m.returnObligationQueue.queuedCount," queued",m.returnObligationQueue.runningCount>0?`, ${m.returnObligationQueue.runningCount} running`:"",")",m.returnObligationQueue.oldestActiveAt!==null&&e.jsxs("span",{className:"text-ouro-shadow",children:[" · oldest ",q(new Date(m.returnObligationQueue.oldestActiveAt).toISOString())]})]}),T&&e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Triggered from"}),e.jsxs("button",{onClick:()=>{n({tab:"sessions",focus:`${T.friendId}/${T.channel}/${T.key}`})},className:"mt-1 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:[T.friendId.slice(0,8),"…/",T.channel,"/",T.key]}),A&&e.jsxs("button",{onClick:()=>n({tab:"work"}),className:"ml-2 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",A]})]})]})}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Habit sessions"}),e.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:c?`${c.totalCount} recorded`:d?"Run history unavailable":"Loading runs"})]}),c&&c.totalCount>v.length&&e.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-ouro-shadow",children:["showing ",v.length,"/",c.totalCount]})]}),c?v.length>0?e.jsx("div",{className:"mt-3 space-y-2",children:v.map(f=>e.jsx($a,{run:f},f.runId))}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No habit sessions recorded."}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:d?"Habit sessions unavailable.":"Loading habit sessions."})]}),e.jsxs("section",{children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Private runtime ",x?`(${x.messages.length} total)`:""]}),x?e.jsx(Aa,{messages:x.messages}):e.jsx("button",{onClick:j,className:"mt-2 w-full rounded-lg px-3 py-2.5 text-left font-mono text-xs text-ouro-glow ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:"Load private runtime"})]}),e.jsxs("section",{children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Habits (",(r==null?void 0:r.totalCount)??0,")"]}),E.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-fang mb-1.5",children:["Overdue (",E.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:E.map(f=>e.jsx(at,{h:f},f.name))})]}),l.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow mb-1.5",children:["Running fine (",l.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:l.map(f=>e.jsx(at,{h:f},f.name))})]}),k.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow mb-1.5",children:["Paused (",k.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:k.map(f=>e.jsx(at,{h:f},f.name))})]}),y.length===0&&e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No habits configured."})]})]})}function Ca(t){return t==="error"||t==="blocked"?"bad":t==="surfaced"||t==="wrote_arc"||t==="updated_desk"||t==="wrote_record"?"good":t==="no_change"?"quiet":"warn"}function Sa(t){const s=Ca(t);return s==="bad"?"bg-ouro-fang/10 text-ouro-fang ring-ouro-fang/20":s==="good"?"bg-ouro-scale/10 text-ouro-glow ring-ouro-scale/20":s==="warn"?"bg-ouro-gold/10 text-ouro-gold ring-ouro-gold/20":"bg-ouro-void/60 text-ouro-shadow ring-ouro-moss/15"}function $a({run:t}){const s=t.permissionEnvelope.returnRoutes,o=t.surfaceAttempts,n=t.errors??[],r=Array.from(new Set([...t.permissionEnvelope.deniedTools,...t.toolPolicy.deniedTools]));return e.jsxs("article",{className:"rounded-lg bg-ouro-void/45 px-3 py-3 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:`rounded-md px-2 py-0.5 font-mono text-[10px] font-medium uppercase tracking-wider ring-1 ${Sa(t.outcome)}`,children:t.outcome}),e.jsx("span",{className:"min-w-0 break-all font-medium text-ouro-bone",children:t.habitName}),e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:t.trigger})]}),e.jsx("p",{className:"mt-1 font-mono text-[11px] text-ouro-shadow break-all",children:t.runId})]}),e.jsxs("div",{className:"shrink-0 text-left sm:text-right",children:[e.jsx("p",{className:"font-mono text-[10px] text-ouro-shadow",children:q(t.endedAt)}),t.nextRunAt&&e.jsxs("p",{className:"font-mono text-[10px] text-ouro-glow",children:["next ",q(t.nextRunAt)]})]})]}),e.jsxs("div",{className:"mt-3 grid gap-2 lg:grid-cols-3",children:[e.jsxs(rt,{label:"routes",children:[s.length>0?e.jsx("div",{className:"space-y-1.5",children:s.map((a,c)=>e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("span",{className:"max-w-full break-all rounded bg-ouro-moss/20 px-1.5 py-0.5 font-mono text-[10px] text-ouro-mist ring-1 ring-ouro-moss/20",children:a.kind}),e.jsx("span",{className:"max-w-full break-all rounded bg-ouro-void/60 px-1.5 py-0.5 font-mono text-[10px] text-ouro-shadow ring-1 ring-ouro-moss/15",children:a.status})]}),e.jsx("p",{className:"mt-0.5 font-mono text-[10px] text-ouro-shadow break-all",children:a.recipient}),(a.friendId||a.channel||a.key)&&[a.friendId,a.channel,a.key].filter(Boolean).join("/")!==a.recipient&&e.jsx("p",{className:"mt-0.5 font-mono text-[10px] text-ouro-mist break-all",children:[a.friendId,a.channel,a.key].filter(Boolean).join("/")}),a.reason&&e.jsx("p",{className:"mt-0.5 text-[11px] text-ouro-shadow break-words",children:a.reason})]},`${a.kind}-${a.recipient}-${c}`))}):e.jsx("span",{className:"text-ouro-shadow",children:"none"}),e.jsxs("p",{className:"mt-1 text-[11px] text-ouro-shadow",children:["outward ",t.permissionEnvelope.canMessageOutward?"allowed":"closed"]}),t.permissionEnvelope.warnings.length>0&&e.jsx("div",{className:"mt-1.5 space-y-1",children:t.permissionEnvelope.warnings.map((a,c)=>e.jsx("p",{className:"text-[11px] text-ouro-gold break-words",children:a},`${a}-${c}`))})]}),e.jsx(rt,{label:"attempts",children:o.length>0?e.jsx("div",{className:"space-y-1",children:o.map((a,c)=>e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"rounded bg-ouro-moss/20 px-1.5 py-0.5 font-mono text-[10px] text-ouro-bone ring-1 ring-ouro-moss/20",children:a.result}),e.jsx("span",{className:"text-[11px] text-ouro-shadow",children:a.reason})]}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10px] text-ouro-shadow break-all",children:[a.recipient,"/",a.channel,a.error?` - ${a.error}`:""]})]},`${a.recipient}-${a.channel}-${c}`))}):e.jsx("span",{className:"text-ouro-shadow",children:"none"})}),e.jsxs(rt,{label:"tools",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.toolPolicy.grantedTools.map(a=>e.jsx("span",{className:"max-w-full break-all rounded bg-ouro-scale/10 px-1.5 py-0.5 font-mono text-[10px] text-ouro-glow ring-1 ring-ouro-scale/15",children:a},`granted-${a}`)),r.map(a=>e.jsx("span",{className:"max-w-full break-all rounded bg-ouro-fang/8 px-1.5 py-0.5 font-mono text-[10px] text-ouro-fang ring-1 ring-ouro-fang/15",children:a},`denied-${a}`)),t.toolPolicy.grantedTools.length===0&&r.length===0&&e.jsx("span",{className:"text-ouro-shadow",children:"none"})]}),t.errorCount>0&&e.jsxs("p",{className:"mt-1 font-mono text-[10px] text-ouro-fang",children:[t.errorCount," error",t.errorCount===1?"":"s"]}),n.length>0&&e.jsx("div",{className:"mt-1 space-y-1",children:n.map((a,c)=>e.jsx("p",{className:"max-w-full break-words font-mono text-[10px] text-ouro-fang",children:a},`${t.runId}-error-${c}`))})]})]}),(t.producedRefs.length>0||t.receiptLocator)&&e.jsxs("div",{className:"mt-3 border-t border-ouro-moss/15 pt-2",children:[t.producedRefs.length>0&&e.jsx("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:t.producedRefs.map((a,c)=>e.jsxs("span",{className:"max-w-full break-all rounded bg-ouro-void/60 px-1.5 py-0.5 font-mono text-[10px] text-ouro-shadow ring-1 ring-ouro-moss/10",children:[a.kind,": ",a.locator]},`${a.kind}-${a.locator}-${c}`))}),e.jsx("p",{className:"font-mono text-[10px] text-ouro-shadow break-all",children:t.receiptLocator})]})]})}function rt({label:t,children:s}){return e.jsxs("div",{className:"min-w-0 border-l border-ouro-moss/15 pl-2.5",children:[e.jsx("p",{className:"mb-1 font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:t}),e.jsx("div",{className:"min-w-0 text-xs text-ouro-mist",children:s})]})}function Aa({messages:t}){var $;const s=t.filter(u=>u.role!=="system"&&u.role!=="tool"),[o,n]=i.useState(!1),r=o?s:s.slice(-30),a=s.length-r.length,c=(($=r[r.length-1])==null?void 0:$.id)??null,{ref:h,onScroll:d,preserveScroll:b}=zs(c),x=[];for(const u of s){if(u.role!=="assistant")continue;const g=(u.toolCalls??[]).map(pt);for(const m of g)m.kind==="surface"&&x.push({index:u.sequence,kind:"surfaced",label:G(m.deliveredText??"",40)}),m.kind==="rest"&&x.push({index:u.sequence,kind:"resting",label:"resting"}),m.kind==="delegation"&&x.push({index:u.sequence,kind:"delegated",label:"continued thinking"})}function w(u){var m;const g=(m=h.current)==null?void 0:m.querySelector(`[data-msg-index="${u}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"})}return e.jsxs("div",{children:[x.length>0&&e.jsx("div",{className:"mt-2 mb-1 flex flex-wrap gap-1",children:x.map((u,g)=>e.jsxs("button",{onClick:()=>{b(),n(!0),setTimeout(()=>w(u.index),100)},className:`rounded-md px-2 py-0.5 text-[10px] font-mono ring-1 transition-colors ${u.kind==="surfaced"?"bg-ouro-scale/10 text-ouro-glow ring-ouro-scale/20 hover:ring-ouro-glow/30":u.kind==="resting"?"bg-ouro-void/40 text-ouro-shadow ring-ouro-moss/10":"bg-ouro-gold/5 text-ouro-gold ring-ouro-gold/10"}`,children:[u.kind==="surfaced"?"★":u.kind==="resting"?"—":"→"," #",u.index]},g))}),e.jsxs("div",{ref:h,"data-testid":"inner-transcript-scroll",onScroll:d,className:"max-h-[60vh] overflow-y-auto rounded-lg bg-ouro-void/60 p-3 ring-1 ring-ouro-moss/15 space-y-1",children:[a>0&&e.jsxs("button",{onClick:()=>{b(),n(!0)},className:"w-full rounded-lg px-3 py-2 text-center font-mono text-xs text-ouro-shadow hover:text-ouro-mist ring-1 ring-ouro-moss/10 hover:ring-ouro-moss/20 transition-colors mb-2",children:["Load ",a," earlier messages"]}),r.map(u=>{const g=Le(u);if(u.role==="user"){const m=g.includes("[pending from")||g.includes("[delegated"),j=g.includes("waking up")||g.includes("world-state checkpoint");return e.jsx("div",{"data-msg-index":u.sequence,className:"flex justify-start py-1",children:e.jsxs("div",{className:`max-w-[85%] rounded-2xl rounded-bl-sm px-3 py-2 ring-1 ${m?"bg-ouro-gold/8 ring-ouro-gold/15":j?"bg-ouro-moss/20 ring-ouro-moss/15":"bg-ouro-moss/25 ring-ouro-moss/15"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider",style:{color:m?"var(--color-ouro-gold)":"var(--color-ouro-shadow)"},children:m?"★ delegated":j?"heartbeat":"prompt"}),e.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",u.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Se(u)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:g})]})},u.id)}if(u.role==="assistant"){const m=(u.toolCalls??[]).map(pt),j=m.filter(E=>E.kind==="surface"),y=m.filter(E=>E.kind==="rest"),v=m.filter(E=>E.kind==="delegation");return e.jsxs("div",{"data-msg-index":u.sequence,children:[j.map(E=>e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-scale/15 px-3 py-2 ring-1 ring-ouro-scale/20",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow",children:"★ surfaced outward"}),e.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",u.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Se(u)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:E.deliveredText}),E.metadata&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",E.metadata]})]})},E.id)),v.length>0&&e.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-gold/50",children:["— still thinking — #",u.sequence," · ",Se(u)]}),y.length>0&&e.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/40",children:["— resting — #",u.sequence," · ",Se(u)]}),j.length===0&&y.length===0&&v.length===0&&g&&e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-glow/6 px-3 py-2 ring-1 ring-ouro-glow/8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/50",children:"thinking"}),e.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",u.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Se(u)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-mist whitespace-pre-wrap break-words",children:g})]})})]},u.id)}return null})]})]})}function at({h:t}){const s=t.isOverdue,o=t.isDegraded,n=t.status;return e.jsxs("div",{className:`rounded-lg px-3 py-2.5 ring-1 ${s?"bg-ouro-fang/5 ring-ouro-fang/15":o?"bg-ouro-gold/5 ring-ouro-gold/15":n==="paused"?"bg-ouro-void/30 ring-ouro-moss/10":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:s?"red":o?"yellow":n==="active"?"lime":"zinc",children:s?"overdue":o?"degraded":n}),e.jsx("span",{className:"font-medium text-ouro-bone",children:t.title})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-xs text-ouro-shadow",children:[t.cadence&&e.jsxs("span",{children:["every ",t.cadence]}),e.jsx("span",{children:t.lastRun?`last ${q(t.lastRun)}`:"never run"}),o&&t.degradedReason&&e.jsx("span",{className:"text-ouro-gold",children:t.degradedReason}),!s&&!o&&n==="active"&&t.lastRun&&e.jsx("span",{className:"text-ouro-glow",children:"on schedule"}),s&&t.overdueMs&&e.jsxs("span",{className:"text-ouro-fang",children:[Math.floor(t.overdueMs/6e4),"m overdue"]}),!t.lastRun&&n==="active"&&e.jsx("span",{className:"text-ouro-gold",children:"never fired — may be misconfigured"})]}),t.bodyExcerpt&&e.jsx("p",{className:"mt-1 text-xs text-ouro-mist",children:t.bodyExcerpt})]})}function Ea({agentName:t,refreshGeneration:s}){const[o,n]=i.useState(null),[r,a]=i.useState(null),[c,h]=i.useState("diary");if(i.useEffect(()=>{U(`/agents/${encodeURIComponent(t)}/notes`).then(n),U(`/agents/${encodeURIComponent(t)}/note-decisions`).then(a).catch(()=>{})},[t,s]),!o)return e.jsxs("div",{className:"flex items-center gap-2 py-6",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),e.jsx("span",{className:"font-mono text-xs text-ouro-shadow",children:"Loading…"})]});const d=o.recentDiaryEntries,b=o.recentCanonicalNotes;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>h("diary"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${c==="diary"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Diary (",o.diaryEntryCount,")"]}),e.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),e.jsxs("button",{onClick:()=>h("notes"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${c==="notes"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Notes (",o.canonicalNoteCount,")"]}),e.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),e.jsxs("button",{onClick:()=>h("decisions"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${c==="decisions"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Decisions (",(r==null?void 0:r.totalCount)??0,")"]})]}),c==="diary"&&e.jsx("div",{children:d.length>0?e.jsx("div",{className:"space-y-3",children:d.map(x=>e.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[e.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone",children:x.text}),e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-ouro-shadow",children:[e.jsx(_,{children:x.source}),e.jsx("span",{children:q(x.createdAt)})]})]},x.id))}):e.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No diary entries yet. The agent hasn't written anything down."})}),c==="notes"&&e.jsx("div",{children:b.length>0?e.jsx("div",{className:"space-y-3",children:b.map(x=>e.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"font-medium text-ouro-bone",children:x.title}),e.jsx("span",{className:"text-xs text-ouro-shadow",children:q(x.writtenAt)})]}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-mist",children:x.preview}),x.tags.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:x.tags.map(w=>e.jsx(_,{children:w},w))})]},x.filename))}):e.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No canonical notes yet."})}),c==="decisions"&&e.jsx("div",{children:r&&r.items.length>0?e.jsx("div",{className:"space-y-2",children:r.items.map((x,w)=>e.jsxs("div",{className:"rounded-xl bg-ouro-void/40 px-4 py-3 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{color:x.decision==="saved"?"lime":"zinc",children:x.decision}),e.jsx(_,{children:x.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-ouro-shadow",children:q(x.timestamp)})]}),x.reason&&e.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:x.reason}),x.excerpt&&e.jsx("p",{className:"mt-0.5 text-xs text-ouro-shadow italic truncate",children:x.excerpt})]},w))}):e.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No note decisions logged yet."})})]})}function Ta({agentName:t,view:s,refreshGeneration:o}){var g;const[n,r]=i.useState(null),[a,c]=i.useState(null),h=s.agent,d=h.degraded,b=h.freshness,x=((g=h.providers)==null?void 0:g.lanes)??[];i.useEffect(()=>{Promise.all([U("/machine/health").then(r).catch(()=>null),U("/machine/logs").then(c).catch(()=>null)])},[t,o]);const w=Pa(n)?n:null,$=(w==null?void 0:w.degradedComponents)??[],u=(a==null?void 0:a.entries)??[];return e.jsxs("div",{className:"space-y-8",children:[d.status==="degraded"&&d.issues.length>0&&e.jsxs("section",{children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-fang",children:["Agent issues (",d.issues.length,")"]}),e.jsx("div",{className:"mt-3 space-y-1.5",children:d.issues.map((m,j)=>e.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2.5 ring-1 ring-ouro-fang/15",children:[e.jsx("p",{className:"font-mono text-xs font-semibold text-ouro-fang",children:m.code}),e.jsx("p",{className:"mt-0.5 text-xs text-ouro-mist break-all",children:m.detail})]},j))})]}),e.jsxs("section",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Agent config"}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[e.jsx(xe,{label:"Provider lanes",value:Ra(x)}),e.jsx(xe,{label:"Enabled",value:h.enabled?"yes":"no"}),e.jsx(xe,{label:"Freshness",value:`${b.status}${b.ageMs!=null?` (${Math.floor(b.ageMs/6e4)}m)`:""}`})]})]}),e.jsxs("section",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Provider lanes"}),x.length>0?e.jsx("div",{className:"mt-3 grid gap-2 lg:grid-cols-2",children:x.map(m=>{const j=_a(m);return e.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"font-mono text-xs font-semibold uppercase tracking-wider text-ouro-bone",children:m.lane}),e.jsx(_,{color:Oa(m),children:m.status}),e.jsx(_,{color:Da(m.readiness.status),children:m.readiness.status})]}),e.jsx("p",{className:"mt-2 text-sm font-medium text-ouro-bone",children:La(m)}),e.jsxs("div",{className:"mt-2 space-y-1 text-xs text-ouro-mist",children:[e.jsxs("p",{children:["source: ",m.source]}),e.jsxs("p",{children:["readiness: ",Ma(m.readiness)]}),m.readiness.attempts!==void 0&&e.jsxs("p",{children:["attempts: ",m.readiness.attempts]}),m.readiness.checkedAt&&e.jsxs("p",{children:["checked: ",q(m.readiness.checkedAt)]}),e.jsxs("p",{children:["credentials: ",Ia(m.credential)]}),m.credential.revision&&e.jsxs("p",{children:["revision: ",m.credential.revision]}),os(m)&&e.jsxs("p",{children:["reason: ",os(m)]}),j&&e.jsxs("p",{className:"break-all text-ouro-fang",children:["repair: ",j]}),m.warnings.map((y,v)=>e.jsxs("p",{className:"break-words text-ouro-gold",children:["warning: ",y]},v))]})]},m.lane)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No provider lane data loaded."})]}),e.jsxs("section",{children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Daemon health"}),w?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[e.jsx(xe,{label:"Status",value:w.status}),e.jsx(xe,{label:"Mode",value:w.mode}),e.jsx(xe,{label:"Uptime",value:`${Math.floor(w.uptimeSeconds/60)}m`})]}),$.length>0&&e.jsxs("div",{className:"mt-3 space-y-1.5",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Degraded components"}),$.map((m,j)=>e.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2 ring-1 ring-ouro-fang/15",children:[e.jsx("p",{className:"text-xs font-semibold text-ouro-fang",children:m.component}),e.jsx("p",{className:"text-xs text-ouro-mist",children:m.reason})]},j))]})]}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No health file found. This is normal when not running under the daemon."})]}),e.jsxs("section",{children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Recent logs (",(a==null?void 0:a.totalLines)??0," total)"]}),u.length>0?e.jsx("div",{className:"mt-3 max-h-96 overflow-y-auto rounded-lg bg-ouro-void/40 ring-1 ring-ouro-moss/15",children:[...u].reverse().slice(0,50).map((m,j)=>{const y=m.level;return e.jsxs("div",{className:"border-b border-ouro-moss/10 px-3 py-1.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(_,{color:y==="error"?"red":y==="warn"?"yellow":"zinc",children:y}),e.jsx("span",{className:"text-ouro-shadow",children:q(m.ts)}),e.jsx("span",{className:"font-mono text-ouro-glow",children:m.event})]}),e.jsx("p",{className:"truncate text-xs text-ouro-mist",children:m.message})]},j)})}):e.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No log entries."})]})]})}function xe({label:t,value:s}){return e.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:t}),e.jsx("p",{className:"mt-1 text-sm font-medium text-ouro-bone",children:s})]})}function Ra(t){return t.length===0?"none":`${t.filter(o=>o.status==="configured").length}/${t.length} configured`}function La(t){return t.status==="unconfigured"?"unconfigured":`${t.provider} / ${t.model}`}function Ma(t){return t.status==="failed"?t.error?`failed: ${t.error}`:"failed":t.status==="stale"?t.reason?`stale: ${t.reason}`:"stale":t.status==="unknown"?t.reason?`unknown: ${t.reason}`:"unknown":t.status}function Ia(t){return t.status==="present"?t.source??"vault":t.status==="invalid-pool"?"vault unavailable":"missing"}function _a(t){return t.status==="unconfigured"?t.repairCommand:t.credential.repairCommand}function os(t){return t.status==="unconfigured"?t.reason:t.readiness.reason}function Oa(t){return t.status==="configured"?"green":"yellow"}function Da(t){return t==="ready"?"green":t==="failed"?"red":t==="stale"?"amber":"zinc"}function Pa(t){return!!(t&&"degradedComponents"in t)}const it=[{id:"overview",label:"Overview"},{id:"mail",label:"Mailbox"},{id:"sessions",label:"Sessions"},{id:"work",label:"Work"},{id:"connections",label:"Connections"},{id:"inner",label:"Private Runtime"},{id:"notes",label:"Desk Record"},{id:"runtime",label:"Runtime"}];function Ua(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function za({agentName:t,view:s,deskPrefs:o,refreshGeneration:n,initialRoute:r,onNavigate:a}){const[c,h]=i.useState((r==null?void 0:r.tab)??"overview"),[d,b]=i.useState(r==null?void 0:r.focus),x=i.useRef(t);i.useEffect(()=>{const j=x.current!==t;if(x.current=t,(r==null?void 0:r.agent)===t){h(r.tab),b(r.focus);return}j&&(h("overview"),b(void 0))},[t,r==null?void 0:r.agent,r==null?void 0:r.focus,r==null?void 0:r.tab]);const w=i.useCallback(j=>{const y={agent:t,tab:j.tab,focus:j.focus};h(j.tab),b(j.focus),window.history.pushState(null,"",He(y)),a==null||a(y)},[t,a]),$=i.useCallback(j=>{const y={agent:t,tab:j,focus:void 0};h(j),b(void 0),window.history.pushState(null,"",He(y)),a==null||a(y)},[t,a]),u=i.useCallback(()=>b(void 0),[]);if($r(w),!s||!t)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[e.jsx("p",{className:"font-display text-2xl italic text-ouro-bone",children:"Choose an agent"}),e.jsx("p",{className:"mt-2 text-sm text-ouro-mist",children:"Select an agent from the sidebar to inspect its state."})]});const m=s.agent.attention;return e.jsx(us.Provider,{value:w,children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex min-h-[4.5rem] flex-wrap items-start justify-between gap-3 pb-4 border-b border-ouro-moss/30",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("h1",{className:"font-display text-2xl italic font-semibold text-ouro-bone sm:text-3xl",children:t})}),e.jsx(_,{color:Ua(m.level),children:m.label})]}),e.jsx("nav",{className:"mt-4 flex gap-0.5 overflow-x-auto border-b border-ouro-moss/20 -mx-1",children:(()=>{const j=o==null?void 0:o.tabOrder;if(!j)return it;const y=j.map(E=>it.find(l=>l.id===E)).filter(E=>E!==void 0),v=it.filter(E=>!j.includes(E.id));return[...y,...v]})().map(j=>e.jsx("button",{type:"button",onClick:()=>$(j.id),className:`shrink-0 px-3 py-2 text-xs font-mono uppercase tracking-wider transition-colors rounded-t-md ${c===j.id?"bg-ouro-moss/20 text-ouro-glow border-b-2 border-ouro-glow":"text-ouro-shadow hover:text-ouro-mist hover:bg-ouro-moss/10"}`,children:j.label},j.id))}),e.jsxs("div",{className:"mt-6",children:[c==="overview"&&e.jsx(Ir,{view:s,deskPrefs:o,refreshGeneration:n}),c==="mail"&&e.jsx(qr,{agentName:t,focus:d,onFocusConsumed:u,refreshGeneration:n}),c==="sessions"&&e.jsx(da,{agentName:t,focus:d,onFocusConsumed:u,deskPrefs:o,refreshGeneration:n}),c==="work"&&e.jsx(fa,{agentName:t,view:s,focus:d,onFocusConsumed:u,refreshGeneration:n}),c==="connections"&&e.jsx(Na,{agentName:t,focus:d,onFocusConsumed:u,refreshGeneration:n}),c==="inner"&&e.jsx(ka,{agentName:t,view:s,refreshGeneration:n}),c==="notes"&&e.jsx(Ea,{agentName:t,refreshGeneration:n}),c==="runtime"&&e.jsx(Ta,{agentName:t,view:s,refreshGeneration:n})]})]})})}const ns={observation:"Observation",judgment:"Judgment",input_admitted:"Input admitted",input_unknown:"Input unknown",legacy_input_reported:"Legacy input report (unqualified)",notification_queued:"Notification queued",notification_delivered:"Notification transport acceptance",notification_unknown:"Notification unknown",recovery:"Acknowledged recovery"};function Nt(t,s){const o=t===null?NaN:s-Date.parse(t);return Number.isFinite(o)&&o>=0?o:null}function rs(t,s){const o=Nt(t,s);return o===null?"unknown":`${Math.floor(o/1e3)}s`}function Pe(t,s){const o=Nt(t,s);return o!==null&&o<=3e4}const ae="rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/25";function lt({command:t,label:s}){const[o,n]=i.useState(null);if(!t)return null;const r=async()=>{try{await navigator.clipboard.writeText(t),n("copied")}catch{n("failed")}};return e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("code",{className:"block select-text break-all rounded-md bg-ouro-void p-2 text-xs",children:t}),e.jsxs("button",{type:"button",onClick:()=>{r()},className:"text-xs text-ouro-glow underline",children:["Copy ",s," command"]}),o==="copied"&&e.jsx("span",{role:"status",className:"ml-2 text-xs text-ouro-mist",children:"Copied for local execution; nothing was run."}),o==="failed"&&e.jsx("p",{role:"alert",className:"text-xs text-ouro-gold",children:"Copy failed. Select the command text and copy it manually."})]})}function Ba({agents:t,agentName:s,focus:o,refreshGeneration:n,onSelectOwner:r}){const[a,c]=i.useState(null),[h,d]=i.useState(null),[b,x]=i.useState(Date.now),w=i.useRef(null),$=i.useRef(n);i.useEffect(()=>{if(!s){w.current=null;return}const l=s;let k=!0,T=!1,A=!1,M=null;const f=async()=>{if(k){if(T){A=!0;return}T=!0,M=new AbortController;try{const O=await U(`/agents/${encodeURIComponent(l)}/supervision`,{signal:M.signal});if(!k)return;if(O.agentName!==l)throw new Error("the observation belongs to another agent");if(O.schemaVersion!==1)throw new Error("unsupported observation schema");c(O),d(null),x(Date.now())}catch(O){k&&!M.signal.aborted&&d({agent:l,message:O instanceof Error?O.message:String(O)})}finally{T=!1,k&&A&&(A=!1,f())}}},p=()=>{f()};w.current=p,p();const C=window.setInterval(()=>{document.visibilityState!=="hidden"&&p()},5e3),L=window.setInterval(()=>x(Date.now()),1e3),I=()=>{x(Date.now()),document.visibilityState!=="hidden"&&p()};return document.addEventListener("visibilitychange",I),()=>{k=!1,M==null||M.abort(),window.clearInterval(C),window.clearInterval(L),document.removeEventListener("visibilitychange",I),w.current===p&&(w.current=null)}},[s]),i.useEffect(()=>{var l;$.current!==n&&($.current=n,(l=w.current)==null||l.call(w))},[n]);const u=(a==null?void 0:a.agentName)===s?a:null,g=(h==null?void 0:h.agent)===s?h.message:null,m=(u==null?void 0:u.freshness.status)==="fresh"&&Pe(u.freshness.observedAt,b),j=!u||u.freshness.status==="unknown"||Nt(u.freshness.observedAt,b)===null?"unknown":m?"fresh":"stale",y=(u==null?void 0:u.sessions.items.map(l=>({...l,activity:m&&l.freshness.status==="fresh"&&Pe(l.observedAt,b)?l.activity:"unknown",authority:m&&Pe(l.observedAt,b)?l.authority:"unknown",capability:m&&Pe(l.observedAt,b)?l.capability:"unknown"})))??[],v=u!=null&&u.counts?{working:0,idle:0,shell:0,unknown:0}:null;if(v)for(const l of y)v[l.activity]+=1;const E=(u==null?void 0:u.custody.claims.items.filter(l=>(l.state==="unknown"||l.state==="claimed")&&!l.retired))??[];return e.jsxs("div",{className:"space-y-6 text-ouro-bone",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl font-semibold",children:"Supervision"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-ouro-mist",children:"What Shepherd can observe, why it acted or withheld input, and what still needs the owner. Quiet terminals and judgments are not proof of merge, publication or deployment."})]}),e.jsxs("label",{className:"flex min-w-0 flex-col gap-1 text-sm text-ouro-mist",children:["Owning Ouro agent",e.jsxs("select",{"aria-label":"Owning Ouro agent",value:s??"",onChange:l=>r(l.target.value||null),className:"max-w-full rounded-lg border border-ouro-moss/40 bg-ouro-deep px-3 py-2 text-ouro-bone",children:[e.jsx("option",{value:"",children:"Choose an owner"}),s&&!t.includes(s)&&e.jsxs("option",{value:s,children:[s," (not in machine inventory)"]}),t.map(l=>e.jsx("option",{value:l,children:l},l))]})]})]}),e.jsxs("aside",{className:`${ae} text-sm text-ouro-gold`,"aria-label":"Alpha automation boundary",children:[e.jsx("p",{className:"font-semibold",children:"Alpha automation boundary"}),e.jsx("p",{className:"mt-1",children:na})]}),s?e.jsxs(e.Fragment,{children:[g&&e.jsxs("div",{role:"alert",className:`${ae} text-ouro-gold`,children:["Could not load supervision for ",s,": ",g,".",u&&e.jsxs(e.Fragment,{children:[" Showing the last successful observation for ",s,"; its age continues to increase."]}),e.jsx("button",{type:"button",className:"ml-2 underline",onClick:()=>{var l;return(l=w.current)==null?void 0:l.call(w)},children:"Retry observation"})]}),!u&&!g&&e.jsxs("p",{role:"status",children:["Loading supervision for ",s,"..."]}),u&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:ae,"aria-label":"Observation health",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(_,{color:j==="fresh"?"lime":"yellow",children:e.jsxs("span",{"data-testid":"supervision-freshness",children:[j," observation"]})}),e.jsx(_,{color:u.health==="ok"?"zinc":"yellow",children:u.health==="ok"?"Sources readable":"Sources degraded"}),e.jsxs("p",{className:"text-sm",children:["Observation age: ",rs(u.freshness.observedAt,b)]}),e.jsx("button",{type:"button",onClick:()=>{var l;return(l=w.current)==null?void 0:l.call(w)},className:"text-sm text-ouro-glow underline",children:"Refresh observation"})]}),u.freshness.observedAt&&e.jsxs("p",{className:"mt-2 break-words font-mono text-xs text-ouro-mist",children:["Observed at ",e.jsx("time",{dateTime:u.freshness.observedAt,children:u.freshness.observedAt}),". Reading this page does not refresh the observation."]}),e.jsx("dl",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ouro-mist",children:Object.entries(u.sourceHealth).map(([l,k])=>e.jsxs("div",{className:"flex gap-1",children:[e.jsxs("dt",{children:[l,":"]}),e.jsx("dd",{children:k})]},l))}),u.sourceErrors.length>0&&e.jsx("ul",{className:"mt-3 space-y-1 text-sm text-ouro-gold",children:u.sourceErrors.map((l,k)=>e.jsxs("li",{className:"break-words",children:[l.source,": ",l.detail]},`${l.source}:${l.code}:${k}`))})]}),e.jsx("section",{"aria-label":"Terminal counts",className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:["working","idle","shell","unknown"].map(l=>e.jsxs("div",{className:ae,children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-ouro-mist",children:l}),e.jsx("p",{"data-testid":`supervision-count-${l}`,className:"mt-1 text-2xl tabular-nums",children:(v==null?void 0:v[l])??"Unknown"})]},l))}),e.jsxs("p",{className:"text-sm text-ouro-mist",children:["Showing ",y.length," of ",u.sessions.totalCount??"unknown"," terminals.",u.sessions.truncated&&" Inventory is truncated."," Counts above describe only the displayed rows."]}),e.jsxs("section",{"aria-label":"Supervised terminals",className:"grid min-w-0 gap-4 xl:grid-cols-2",children:[y.map(l=>{const k=`${l.host}:${l.session}`,T=u.timeline.items.filter(A=>A.host===l.host&&A.session===l.session);return e.jsxs("article",{className:`${ae} min-w-0 space-y-3`,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsx("h2",{className:"min-w-0 break-words text-lg font-semibold",children:l.label}),e.jsx(_,{color:l.activity==="working"?"lime":l.activity==="unknown"?"yellow":"zinc",children:l.activity})]}),e.jsxs("dl",{className:"space-y-1 break-words text-sm text-ouro-mist",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"inline",children:"Terminal: "}),e.jsxs("dd",{className:"inline font-mono",children:[l.host," / ",l.session]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"inline",children:"Harness: "}),e.jsx("dd",{className:"inline",children:l.harness??"Unknown / no identified coding harness"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"inline",children:"Project: "}),e.jsx("dd",{className:"inline font-mono",children:l.project??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"inline",children:"Process instance: "}),e.jsx("dd",{className:"inline font-mono",children:l.instance??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"inline",children:"Last observed: "}),e.jsxs("dd",{className:"inline",children:[rs(l.observedAt,b)," ago"]})]})]}),e.jsxs("p",{className:"text-sm",children:["Stored mandate / pause state: ",l.authority,". Guarded input: ",l.capability,"."]}),e.jsxs("p",{className:"break-words text-sm text-ouro-gold",children:["Stored policy assessment, not an enforced dispatch decision: ",l.withheldReason??"Unknown."]}),e.jsxs("p",{className:"text-sm",children:["Last recorded judgment: ",e.jsx("span",{children:l.lastDecisionLabel??"None recorded"})]}),e.jsxs("p",{className:"break-words text-sm text-ouro-mist",children:["Last recorded action: ",l.lastAction==="respond"?"Reported terminal response":l.lastAction==="let_through"?"Let through without a response":"None recorded",".",l.lastReason&&e.jsxs(e.Fragment,{children:[" ",l.lastReason]}),l.lastActionAt&&e.jsxs(e.Fragment,{children:[" ",e.jsx("time",{dateTime:l.lastActionAt,children:l.lastActionAt})]})]}),e.jsx("a",{className:"inline-block text-xs text-ouro-glow underline",href:`#/supervision/${encodeURIComponent(s)}/${encodeURIComponent(k)}`,children:"Link to this terminal"}),e.jsxs("details",{open:o===k||void 0,className:"border-t border-ouro-moss/25 pt-3",children:[e.jsxs("summary",{className:"cursor-pointer text-sm text-ouro-glow",children:["Timeline for ",l.label]}),T.length===0&&e.jsx("p",{className:"mt-2 text-sm text-ouro-mist",children:"No retained events for this terminal."}),e.jsx("ol",{className:"mt-3 space-y-3",children:T.map(A=>e.jsxs("li",{className:"break-words text-sm",children:[e.jsxs("p",{children:[ns[A.kind],": ",A.summary]}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-ouro-mist",children:[e.jsx("time",{dateTime:A.at,children:A.at})," | ",A.instance?`instance ${A.instance}`:"instance not recorded"]})]},A.id))})]})]},k)}),y.length===0&&e.jsx("p",{className:ae,children:u.counts===null?"Terminal inventory is unavailable, not empty.":"No terminals were present in this observation."})]}),e.jsxs("section",{className:ae,"aria-label":"Custody and held inputs",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Replay barriers and unknown inputs"}),e.jsx("p",{className:"mt-2 text-sm text-ouro-gold",children:"Unknown effects remain held: do not retry blindly. Owner administration is local-only; this browser cannot resolve or retry claims."}),e.jsx("div",{className:"mt-3",children:e.jsx(lt,{command:Jt(s),label:"status"},s)}),e.jsxs("p",{className:"mt-2 text-xs text-ouro-mist",children:["Run commands locally as the existing owner. Local administration is same-UID authority, not proof of human presence."," ","Read current status and inspect the exact claim before changing anything. A stale revision will be rejected."]}),e.jsxs("p",{className:"mt-2 text-xs text-ouro-mist",children:["Custody revision: ",u.custody.revision??"unknown","."," ","Storage: ",u.custody.bytes===null?"unknown":`${u.custody.bytes.toLocaleString()} bytes`," (",u.custody.capacity,")."," ","Showing ",u.custody.claims.items.length," of ",u.custody.claims.totalCount??"unknown"," retained barriers.",u.custody.claims.truncated&&" Custody inventory is truncated."]}),E.map(l=>e.jsxs("div",{className:"mt-3 space-y-1 break-words border-t border-ouro-moss/25 pt-3 text-sm",children:[e.jsxs("p",{children:["Original state: ",l.state," | ",l.host," / ",l.session]}),e.jsx("p",{className:"break-all font-mono text-xs",children:l.id}),e.jsxs("p",{className:"text-ouro-mist",children:[l.reason??"No outcome evidence is recorded."," Acknowledgments in the timeline do not rewrite the original state."]}),e.jsx(lt,{command:Jt(s,l.id),label:"inspection"}),e.jsxs("details",{className:"pt-2",children:[e.jsx("summary",{className:"cursor-pointer text-xs text-ouro-glow",children:"Local recovery after terminal retirement"}),e.jsxs("p",{className:"my-2 text-xs text-ouro-mist",children:["The entire terminal must be absent from a strict host inventory."," ","A different foreground process is not proof of retirement. This command never confirms delivery or retries input."," ","Confirmed-delivery recovery remains unsupported until native receipt lookup is qualified."]}),e.jsx(lt,{command:oa(s,l.id,u.custody.revision),label:"retirement"},`${l.id}:${u.custody.revision}`),u.custody.revision===null&&e.jsx("p",{className:"text-xs text-ouro-gold",children:"No retirement command is available until a custody revision is known."})]})]},l.id)),u.custody.claims.totalCount===null&&e.jsx("p",{className:"mt-3 text-sm",children:"Custody availability is unknown; zero held inputs cannot be established."})]}),e.jsxs("details",{className:ae,children:[e.jsx("summary",{className:"cursor-pointer text-sm text-ouro-glow",children:"All retained events, including closed terminals"}),e.jsx("ol",{className:"mt-3 space-y-3",children:u.timeline.items.map(l=>e.jsxs("li",{className:"break-words text-sm",children:[e.jsxs("p",{children:[l.host," / ",l.session,": ",ns[l.kind],": ",l.summary]}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-ouro-mist",children:[e.jsx("time",{dateTime:l.at,children:l.at})," | ",l.instance??"instance not recorded"]})]},l.id))})]}),e.jsxs("p",{className:"text-xs text-ouro-mist",children:["Retained timeline: ",u.timeline.items.length," of ",u.timeline.totalCount??"unknown"," events.",u.timeline.truncated&&" History is truncated; absence from this view is not proof that an event never occurred."]})]})]}):e.jsx("p",{className:ae,children:"Choose an owning Ouro agent to inspect its terminal supervision. No fleet counts are available until an owner is selected."})]})}function ct(){return xs(window.location.hash)}function Ha(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function Fa(){var B;const[t,s]=i.useState(()=>Ct(window.location.hash)),o=i.useRef(t!==null),[n,r]=i.useState(null),[a,c]=i.useState(((B=ct())==null?void 0:B.agent)??""),[h,d]=i.useState(null),[b,x]=i.useState(null),[w,$]=i.useState(null),[u,g]=i.useState(null),[m,j]=i.useState(null),[y,v]=i.useState(null),[E,l]=i.useState("connecting"),[k,T]=i.useState(0),A=i.useRef(0),M=i.useRef(ct()),[f,p]=i.useState(ct),C=i.useRef(a),L=i.useRef(!0),I=i.useRef(0),O=i.useRef(0),V=i.useRef(null),W=i.useRef(null),z=i.useCallback(N=>{var D;C.current!==N&&(C.current=N,O.current+=1,A.current+=1,(D=W.current)==null||D.abort(),c(N),d(null),x(null),g(null),v(null))},[]),H=i.useCallback(async()=>{var P,Q;const N=++I.current;(P=V.current)==null||P.abort();const D=new AbortController;V.current=D;try{const X=await U("/machine",{signal:D.signal});if(!L.current||N!==I.current)return;if(r(X),$(null),j(new Date().toISOString()),!o.current&&!C.current&&X.agents.length>0){const J=((Q=M.current)==null?void 0:Q.agent)??X.agents[0].agentName;z(J)}}catch(X){if(!L.current||D.signal.aborted||N!==I.current)return;$(X instanceof Error?X.message:String(X))}},[z]),Y=i.useCallback(async N=>{var X;if(!N)return;const D=++O.current;(X=W.current)==null||X.abort();const P=new AbortController;W.current=P;const Q=()=>L.current&&D===O.current&&C.current===N;try{const[J,le]=await Promise.all([U(`/agents/${encodeURIComponent(N)}`,{signal:P.signal}),U(`/agents/${encodeURIComponent(N)}/desk-prefs`,{signal:P.signal})]);if(!Q())return;if(J.agent.agentName!==N)throw new Error("the response belongs to another agent");d(J),x(le),g(null),v(new Date().toISOString())}catch(J){if(!Q()||P.signal.aborted)return;g(J instanceof Error?J.message:String(J))}},[]);i.useEffect(()=>(L.current=!0,()=>{var N,D;L.current=!1,I.current+=1,O.current+=1,A.current+=1,(N=V.current)==null||N.abort(),(D=W.current)==null||D.abort()}),[]),i.useEffect(()=>{H()},[H]),i.useEffect(()=>{a&&Y(a)},[a,Y]);const K=i.useCallback(async()=>{const N=++A.current,D=o.current?"":C.current;await Promise.all([H(),D?Y(D):Promise.resolve()]),L.current&&A.current===N&&T(P=>P+1)},[H,Y]);i.useEffect(()=>Ro(()=>{K()},l),[K]),i.useEffect(()=>{const N=()=>{const D=Ct(window.location.hash);if(D){o.current=!0,s(D);return}const P=xs(window.location.hash);P&&(o.current=!1,p(P),s(null),z(P.agent))};return window.addEventListener("hashchange",N),()=>window.removeEventListener("hashchange",N)},[z]);const ne=i.useCallback(N=>{const D={agent:N,tab:"overview",focus:void 0};p(D),o.current=!1,s(null),z(N),window.history.pushState(null,"",He(D))},[z]),se=i.useCallback(N=>{o.current=!0,s({agent:N}),window.history.pushState(null,"",St(N))},[]);if(!n)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-ouro-void",children:e.jsx("div",{className:"text-center",children:w?e.jsxs("div",{role:"alert",children:[e.jsxs("p",{className:"text-ouro-bone",children:["Could not connect to Mailbox: ",w]}),e.jsx("button",{type:"button",onClick:()=>{K()},className:"mt-3 text-ouro-glow underline",children:"Retry connection"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mx-auto mb-4 h-4 w-4 animate-pulse rounded-full bg-ouro-glow shadow-[0_0_20px_theme(--color-ouro-glow)]"}),e.jsx("p",{role:"status",className:"font-mono text-sm text-ouro-mist",children:"Connecting to Mailbox…"})]})})});const S=n.overview.totals,R=(h==null?void 0:h.agent.agentName)===a?h:null;return e.jsxs(Do,{header:e.jsx(_,{color:n.overview.daemon.mode==="dev"?"yellow":"lime",children:n.overview.daemon.mode}),sidebar:e.jsx(kr,{label:"Mailbox",header:e.jsxs("div",{className:"space-y-3 border-b border-ouro-moss/30 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-3 w-3 shrink-0 rounded-full bg-ouro-glow shadow-[0_0_16px_theme(--color-ouro-glow)]"}),e.jsx("p",{className:"truncate font-display text-lg italic font-semibold text-ouro-bone",children:"Ouro Mailbox"})]}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:[{v:S.liveTasks??0,l:"Tasks",alert:(S.blockedTasks??0)>0},{v:S.openObligations??0,l:"Oblig."},{v:S.activeCodingAgents??0,l:"Coding"}].map(N=>e.jsxs("div",{className:"rounded-md bg-ouro-void/60 px-2 py-1.5 text-center ring-1 ring-ouro-moss/20",children:[e.jsx("div",{className:`text-base font-semibold tabular-nums ${N.alert?"text-ouro-fang":"text-ouro-bone"}`,children:N.v}),e.jsx("div",{className:"text-[9px] uppercase tracking-widest text-ouro-shadow",children:N.l})]},N.l))})]}),sections:[{label:"Machine",items:[{label:"Supervision",href:St(null),current:t!==null,onClick:N=>{N.preventDefault(),se(null)}}]},{label:"Agents",items:n.agents.map(N=>({label:N.agentName,href:He({agent:N.agentName,tab:"overview",focus:void 0}),current:t===null&&N.agentName===a,onClick:D=>{D.preventDefault(),ne(N.agentName)},badge:e.jsx(_,{color:Ha(N.attention.level),children:N.attention.label})}))}],footer:e.jsxs("div",{className:"space-y-2 border-t border-ouro-moss/20 pt-3 text-xs text-ouro-shadow",children:[e.jsxs("div",{className:"px-2",children:[e.jsx("p",{className:"font-mono",children:n.overview.runtime.version}),e.jsxs("p",{className:"mt-0.5",children:[n.overview.daemon.mode," · ",n.overview.freshness.status]})]}),t===null&&a&&R&&e.jsx("p",{className:"px-2 italic text-ouro-mist",children:(()=>{const N=b==null?void 0:b.statusLine;if(N)return N;const D=R.inner;if(D.status==="running"||D.hasPending)return"thinking through something privately";const Q=R.work.obligations.openCount;return Q>2?"a few loose ends":Q>0?"carrying something":"steady"})()})]})}),children:[e.jsxs("div",{role:"status",className:"mb-4 min-h-12 text-xs text-ouro-mist sm:min-h-8",children:[E==="connected"?"Live connection":E==="reconnecting"?"Disconnected - reconnecting. Displayed snapshots may be stale.":"Connecting to live updates. Displayed snapshots may be stale.",m&&e.jsxs(e.Fragment,{children:[" Last machine snapshot received ",e.jsx("time",{dateTime:m,children:new Date(m).toLocaleTimeString()}),"."]})]}),w&&e.jsxs("div",{role:"alert",className:"mb-4 text-sm text-ouro-gold",children:["Could not refresh the machine snapshot: ",w,". Showing the last successful machine snapshot.",e.jsx("button",{type:"button",onClick:()=>{K()},className:"ml-2 underline",children:"Retry"})]}),t===null&&u&&e.jsxs("div",{role:"alert",className:"mb-4 text-sm text-ouro-gold",children:["Could not load ",a,": ",u,".",R&&e.jsxs(e.Fragment,{children:[" Showing the last successful snapshot for ",a,y&&e.jsxs(e.Fragment,{children:[" received ",e.jsx("time",{dateTime:y,children:new Date(y).toLocaleTimeString()})]}),"."]}),e.jsx("button",{type:"button",onClick:()=>{Y(a)},className:"ml-2 underline",children:"Retry agent"})]}),t?e.jsx(Ba,{agents:n.agents.map(N=>N.agentName),agentName:t.agent,focus:t.focus,refreshGeneration:k,onSelectOwner:se}):R||!a?e.jsx(za,{agentName:a,view:R,deskPrefs:b,refreshGeneration:k,initialRoute:(f==null?void 0:f.agent)===a?f:void 0,onNavigate:p},a):e.jsxs("div",{className:"min-h-[60vh]",children:[e.jsx("div",{className:"flex min-h-[4.5rem] items-start border-b border-ouro-moss/30 pb-4",children:!u&&e.jsx("h1",{className:"font-display text-2xl italic font-semibold text-ouro-bone sm:text-3xl",children:a})}),e.jsx("div",{className:"mt-4 h-9 border-b border-ouro-moss/20","aria-hidden":"true"}),e.jsx("p",{role:"status",className:"mt-4 text-ouro-mist",children:u?`No snapshot available for ${a}.`:`Loading ${a}...`})]})]})}To.createRoot(document.getElementById("app")).render(e.jsx(i.StrictMode,{children:e.jsx(Fa,{})}));
|