@ouro.bot/cli 0.1.0-alpha.146 → 0.1.0-alpha.1461
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 +194 -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 +8566 -41
- package/deploy/unraid/Dockerfile +85 -0
- package/deploy/unraid/INSTALL.md +64 -0
- package/deploy/unraid/README.txt +3034 -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 +733 -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-host-lock.mjs +207 -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 +1604 -0
- package/deploy/unraid/sanctuary-deployment-target.mjs +710 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +2781 -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 +2533 -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 +274 -0
- package/deploy/unraid/sanctuary.xml +30 -0
- package/dist/a2a/approval-relay-forward.js +117 -0
- package/dist/a2a/approval-relay.js +95 -0
- package/dist/a2a/approval-request-wire.js +123 -0
- package/dist/a2a/card.js +57 -0
- package/dist/a2a/client.js +331 -0
- package/dist/a2a/config.js +50 -0
- package/dist/a2a/delegated-command-grants.js +93 -0
- package/dist/a2a/delegated-command.js +200 -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 +55 -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 +142 -0
- package/dist/a2a/seen-ledger.js +216 -0
- package/dist/a2a/server.js +1088 -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/eval/assertions/index.js +378 -0
- package/dist/eval/budget.js +135 -0
- package/dist/eval/domain/case.js +115 -0
- package/dist/eval/domain/stats.js +19 -0
- package/dist/eval/guest-entry.js +16 -0
- package/dist/eval/interview-entry.js +170 -0
- package/dist/eval/interview-grade-entry.js +36 -0
- package/dist/eval/interview-guest-entry.js +17 -0
- package/dist/eval/interviews/allocation.js +90 -0
- package/dist/eval/interviews/final.js +133 -0
- package/dist/eval/interviews/grader.js +196 -0
- package/dist/eval/interviews/guest/arms.js +173 -0
- package/dist/eval/interviews/guest/ax/ax-command.js +792 -0
- package/dist/eval/interviews/guest/ax/effects.js +51 -0
- package/dist/eval/interviews/guest/ax/exit-codes.js +51 -0
- package/dist/eval/interviews/guest/ax/help.js +181 -0
- package/dist/eval/interviews/guest/ax/mcp.js +246 -0
- package/dist/eval/interviews/guest/ax/outcome.js +211 -0
- package/dist/eval/interviews/guest/ax/output.js +53 -0
- package/dist/eval/interviews/guest/ax/precise-copy.js +200 -0
- package/dist/eval/interviews/guest/ax/problem.js +95 -0
- package/dist/eval/interviews/guest/ax/voice.js +83 -0
- package/dist/eval/interviews/guest/ax/wait.js +158 -0
- package/dist/eval/interviews/guest/books-core.js +54 -0
- package/dist/eval/interviews/guest/cli-shell.js +267 -0
- package/dist/eval/interviews/guest/loop.js +78 -0
- package/dist/eval/interviews/guest/operations.js +108 -0
- package/dist/eval/interviews/guest/run.js +62 -0
- package/dist/eval/interviews/latch.js +122 -0
- package/dist/eval/interviews/protocol.js +77 -0
- package/dist/eval/interviews/runner.js +308 -0
- package/dist/eval/readback/hedges.js +39 -0
- package/dist/eval/remote-entry.js +32 -0
- package/dist/eval/report.js +85 -0
- package/dist/eval/run-command.js +161 -0
- package/dist/eval/run-entry.js +89 -0
- package/dist/eval/sandbox/declared-gaps.js +17 -0
- package/dist/eval/sandbox/docker.js +338 -0
- package/dist/eval/sandbox/guest.js +41 -0
- package/dist/eval/sandbox/host-lock.js +62 -0
- package/dist/eval/sandbox/oracle.js +32 -0
- package/dist/eval/sandbox/projection.js +127 -0
- package/dist/eval/sandbox/readback.js +137 -0
- package/dist/eval/sandbox/remote.js +102 -0
- package/dist/eval/self-test.js +84 -0
- package/dist/eval/targets/index.js +127 -0
- package/dist/eval/transport/provider-proxy.js +262 -0
- package/dist/eval/transport/synthetic-sanctuary.js +111 -0
- package/dist/eval/transport/telegram-turn.js +204 -0
- package/dist/gateway/keys.js +117 -0
- package/dist/gateway/server.js +429 -0
- package/dist/heart/active-work.js +421 -45
- package/dist/heart/agent-entry.js +255 -4
- package/dist/heart/approval-files.js +94 -0
- package/dist/heart/approval-store.js +1000 -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 +231 -0
- package/dist/heart/attachments/types.js +93 -0
- package/dist/heart/attachments/understand.js +195 -0
- package/dist/heart/auth/auth-flow.js +590 -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 +462 -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 +69 -0
- package/dist/heart/commitments.js +44 -14
- package/dist/heart/config-registry.js +340 -0
- package/dist/heart/config.js +191 -140
- package/dist/heart/context-loss-gauntlet.js +387 -0
- package/dist/heart/context-loss-sentinel.js +1200 -0
- package/dist/heart/core.js +2751 -693
- 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 +210 -28
- 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-commands/a2a.js +26 -0
- package/dist/heart/daemon/cli-commands/cards.js +68 -0
- package/dist/heart/daemon/cli-commands/coding-tools.js +13 -0
- package/dist/heart/daemon/cli-commands/desk.js +34 -0
- package/dist/heart/daemon/cli-commands/dns.js +13 -0
- package/dist/heart/daemon/cli-commands/entry-points.js +172 -0
- package/dist/heart/daemon/cli-commands/failure-code.js +11 -0
- package/dist/heart/daemon/cli-commands/friends.js +18 -0
- package/dist/heart/daemon/cli-commands/habits.js +15 -0
- package/dist/heart/daemon/cli-commands/lifecycle.js +42 -0
- package/dist/heart/daemon/cli-commands/mail.js +12 -0
- package/dist/heart/daemon/cli-commands/mind.js +25 -0
- package/dist/heart/daemon/cli-commands/presence.js +28 -0
- package/dist/heart/daemon/cli-commands/providers.js +20 -0
- package/dist/heart/daemon/cli-commands/rsvp.js +20 -0
- package/dist/heart/daemon/cli-commands/shepherd.js +17 -0
- package/dist/heart/daemon/cli-commands/vault.js +23 -0
- package/dist/heart/daemon/cli-defaults.js +997 -0
- package/dist/heart/daemon/cli-desk.js +329 -0
- package/dist/heart/daemon/cli-exec.js +9697 -0
- package/dist/heart/daemon/cli-gate.js +198 -0
- package/dist/heart/daemon/cli-help.js +809 -0
- package/dist/heart/daemon/cli-manifest.js +112 -0
- package/dist/heart/daemon/cli-parse.js +3600 -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 +123 -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 +261 -0
- package/dist/heart/daemon/daemon-bootstrap-startup.js +115 -0
- package/dist/heart/daemon/daemon-cli.js +29 -3021
- package/dist/heart/daemon/daemon-entry.js +1109 -32
- 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 +147 -13
- package/dist/heart/daemon/daemon-tombstone.js +236 -0
- package/dist/heart/daemon/daemon.js +2050 -128
- 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/hook-post-tool-use.js +149 -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 +7 -18
- 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-cli-main.js +50 -0
- package/dist/heart/daemon/ouro-entry.js +43 -20
- 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 +841 -71
- package/dist/heart/daemon/process-tree.js +109 -0
- 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 +54 -14
- package/dist/heart/daemon/runtime-metadata.js +2 -30
- package/dist/heart/daemon/runtime-mode.js +13 -2
- package/dist/heart/daemon/runtime-replacement-handoff.js +207 -0
- 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 +1370 -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 +210 -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 +481 -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 +97 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver.js +294 -0
- package/dist/heart/daemon/sense-manager.js +1071 -60
- 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 +133 -49
- 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/delegated-work-report.js +115 -0
- package/dist/heart/delegation.js +0 -3
- 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 +643 -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 +10 -6
- package/dist/heart/hatch/specialist-tools.js +395 -0
- package/dist/heart/identity.js +363 -60
- package/dist/heart/kept-notes.js +289 -0
- 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 +872 -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 +393 -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 +303 -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 +217 -78
- 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 +275 -80
- package/dist/heart/providers/azure.js +19 -31
- 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 +19 -27
- package/dist/heart/providers/openai-codex-token.js +349 -0
- package/dist/heart/providers/openai-codex.js +46 -57
- 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/sent-message-ledger.js +98 -0
- package/dist/heart/session-activity.js +89 -23
- package/dist/heart/session-events.js +1602 -0
- package/dist/heart/session-playback-cli-main.js +10 -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 +34 -0
- package/dist/heart/session-redaction-repair.js +552 -0
- package/dist/heart/session-stats-cli-main.js +10 -0
- package/dist/heart/session-stats.js +183 -0
- package/dist/heart/session-transcript.js +133 -0
- package/dist/heart/shelf-claims.js +136 -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 +139 -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 +620 -192
- 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 +1580 -0
- package/dist/heart/target-resolution.js +7 -7
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -0
- package/dist/heart/termination-guard.js +27 -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 +9 -3
- package/dist/heart/tool-output-budget.js +41 -0
- package/dist/heart/turn-context.js +503 -0
- package/dist/heart/turn-execution-lease.js +78 -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 +98 -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 +424 -0
- package/dist/heart/versioning/self-update.js +270 -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-BQYBPyiH.js +5 -0
- package/dist/mailbox-ui/assets/index-UZ85Lvxp.css +1 -0
- package/dist/mailbox-ui/assets/vendor-BfcLUM_P.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 +169 -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 -4
- package/dist/mind/context.js +335 -198
- package/dist/mind/desk-section.js +342 -0
- package/dist/mind/diary-integrity.js +60 -0
- package/dist/mind/diary.js +31 -53
- 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/note-search.js +198 -0
- package/dist/mind/obligation-steering.js +15 -9
- package/dist/mind/outbound-record.js +176 -0
- package/dist/mind/pending.js +294 -11
- package/dist/mind/prompt-budget.js +511 -0
- package/dist/mind/prompt-refresh.js +3 -2
- package/dist/mind/prompt.js +981 -358
- 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-main.js +6 -1
- package/dist/nerves/coverage/cli.js +1 -1
- package/dist/nerves/coverage/contract.js +5 -5
- package/dist/nerves/coverage/file-completeness.js +164 -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 +10 -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 +108 -40
- 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/context-pack.js +80 -3
- package/dist/repertoire/coding/feedback.js +27 -26
- package/dist/repertoire/coding/index.js +63 -6
- package/dist/repertoire/coding/manager.js +31 -14
- package/dist/repertoire/coding/orca-client.js +194 -0
- package/dist/repertoire/coding/orca-manager.js +460 -0
- package/dist/repertoire/coding/router.js +124 -0
- package/dist/repertoire/coding/spawner.js +3 -2
- package/dist/repertoire/coding/tools.js +178 -34
- package/dist/repertoire/coding/workbench-client.js +272 -0
- package/dist/repertoire/coding/workbench-manager.js +404 -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/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 +1174 -70
- package/dist/repertoire/house-sweep.js +471 -0
- package/dist/repertoire/in-turn-tools-door.js +54 -0
- package/dist/repertoire/mcp-client.js +58 -5
- package/dist/repertoire/mcp-declared-tools.js +156 -0
- package/dist/repertoire/mcp-manager.js +435 -141
- package/dist/repertoire/mcp-tools.js +195 -0
- package/dist/repertoire/mcp-write-guard.js +85 -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 +136 -0
- package/dist/repertoire/skill-search.js +177 -0
- package/dist/repertoire/skill-summaries.js +129 -0
- package/dist/repertoire/skills.js +34 -4
- package/dist/repertoire/stripe-client.js +163 -0
- package/dist/repertoire/tool-arguments.js +180 -0
- package/dist/repertoire/tool-candidates.js +50 -0
- package/dist/repertoire/tool-catalog.js +228 -0
- package/dist/repertoire/tool-error-code.js +30 -0
- package/dist/repertoire/tool-limits.js +20 -0
- package/dist/repertoire/tool-results.js +29 -0
- package/dist/repertoire/tools-a2a.js +792 -0
- package/dist/repertoire/tools-app-sessions.js +219 -0
- package/dist/repertoire/tools-attachments.js +302 -0
- package/dist/repertoire/tools-awaiting.js +934 -0
- package/dist/repertoire/tools-base.js +85 -1420
- package/dist/repertoire/tools-bridge.js +153 -0
- package/dist/repertoire/tools-bundle.js +998 -0
- package/dist/repertoire/tools-chat.js +185 -0
- package/dist/repertoire/tools-commerce.js +272 -0
- package/dist/repertoire/tools-config.js +199 -0
- package/dist/repertoire/tools-continuity.js +648 -0
- package/dist/repertoire/tools-credential.js +410 -0
- package/dist/repertoire/tools-escalation.js +98 -0
- package/dist/repertoire/tools-evolution.js +560 -0
- package/dist/repertoire/tools-files.js +521 -0
- package/dist/repertoire/tools-flight.js +313 -0
- package/dist/repertoire/tools-flow.js +169 -0
- package/dist/repertoire/tools-friend-link.js +65 -0
- package/dist/repertoire/tools-github.js +11 -4
- package/dist/repertoire/tools-habits.js +111 -0
- package/dist/repertoire/tools-house-care.js +190 -0
- package/dist/repertoire/tools-mail.js +1928 -0
- package/dist/repertoire/tools-notes.js +567 -0
- package/dist/repertoire/tools-obligations.js +187 -0
- package/dist/repertoire/tools-orientation.js +36 -0
- package/dist/repertoire/tools-record.js +497 -0
- package/dist/repertoire/tools-rsvp.js +148 -0
- package/dist/repertoire/tools-runtime.js +260 -0
- package/dist/repertoire/tools-sanctuary-host.js +213 -0
- package/dist/repertoire/tools-session.js +1190 -0
- package/dist/repertoire/tools-shell.js +275 -0
- package/dist/repertoire/tools-shepherd-guidance.js +183 -0
- package/dist/repertoire/tools-shepherd.js +369 -0
- package/dist/repertoire/tools-steward-policy.js +157 -0
- package/dist/repertoire/tools-stripe.js +244 -0
- package/dist/repertoire/tools-surface.js +553 -0
- package/dist/repertoire/tools-teams.js +67 -17
- package/dist/repertoire/tools-telegram-contacts.js +41 -0
- package/dist/repertoire/tools-travel.js +142 -0
- package/dist/repertoire/tools-trip.js +1041 -0
- package/dist/repertoire/tools-unraid.js +627 -0
- package/dist/repertoire/tools-user-profile.js +166 -0
- package/dist/repertoire/tools-vault.js +46 -0
- package/dist/repertoire/tools-voice-local.js +210 -0
- package/dist/repertoire/tools-voice.js +153 -0
- package/dist/repertoire/tools-web.js +238 -0
- package/dist/repertoire/tools.js +604 -288
- package/dist/repertoire/travel-api-client.js +463 -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-stop-hook.js +4 -3
- package/dist/senses/a2a-entry.js +145 -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 +242 -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 +87 -0
- package/dist/senses/attention-queue.js +95 -6
- package/dist/senses/await-turn-message.js +65 -0
- package/dist/senses/bluebubbles/active-turns.js +241 -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} +391 -49
- package/dist/senses/bluebubbles/context-packet.js +207 -0
- package/dist/senses/bluebubbles/context-smoke.js +144 -0
- package/dist/senses/bluebubbles/entry.js +80 -0
- package/dist/senses/bluebubbles/host-account-verifier.js +113 -0
- package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +21 -3
- package/dist/senses/bluebubbles/index.js +4663 -0
- package/dist/senses/bluebubbles/latest-turn.js +342 -0
- package/dist/senses/bluebubbles/media.js +255 -0
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +152 -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} +47 -4
- package/dist/senses/bluebubbles/semantic-receipts.js +2014 -0
- package/dist/senses/bluebubbles/send-file.js +20 -0
- package/dist/senses/bluebubbles/send-health.js +126 -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 +209 -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 +633 -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 +62 -9
- package/dist/senses/cli.js +627 -350
- 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/inbound-journal.js +186 -0
- package/dist/senses/ingress-evidence.js +2 -0
- package/dist/senses/mail-entry.js +69 -0
- package/dist/senses/mail.js +524 -0
- package/dist/senses/ordinary-owner-decision.js +98 -0
- package/dist/senses/pipeline.js +1216 -289
- package/dist/senses/private-runtime-worker.js +857 -0
- package/dist/senses/private-runtime.js +1692 -0
- package/dist/senses/proactive-content-guard.js +51 -0
- package/dist/senses/program-status.js +155 -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 +21 -0
- package/dist/senses/sanctuary-health-acceptance-probe.js +802 -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 +392 -0
- package/dist/senses/sanctuary-sab.js +85 -0
- package/dist/senses/sanctuary-storage-optimization-contract.js +32 -0
- package/dist/senses/sense-shutdown.js +72 -0
- package/dist/senses/shared-turn.js +741 -97
- 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 +185 -0
- package/dist/senses/shepherd/judge-evaluation-entry.js +20 -0
- package/dist/senses/shepherd/judge-evaluation.js +144 -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 +60 -34
- package/dist/senses/teams-attachments.js +68 -0
- package/dist/senses/teams-entry.js +80 -9
- package/dist/senses/teams-image.js +128 -0
- package/dist/senses/teams-inbound.js +76 -0
- package/dist/senses/teams-off-turn.js +199 -0
- package/dist/senses/teams-outbox.js +242 -0
- package/dist/senses/teams.js +1379 -331
- package/dist/senses/telegram-admission.js +700 -0
- package/dist/senses/telegram-approval-relay.js +293 -0
- package/dist/senses/telegram-approval-runtime.js +831 -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 +57 -0
- package/dist/senses/telegram-client.js +1896 -0
- package/dist/senses/telegram-effect-adapter.js +892 -0
- package/dist/senses/telegram-entry.js +87 -0
- package/dist/senses/telegram-handoff.js +150 -0
- package/dist/senses/telegram-identity-key.js +143 -0
- package/dist/senses/telegram-markdown.js +331 -0
- package/dist/senses/telegram-owner-route.js +129 -0
- package/dist/senses/telegram.js +2789 -0
- package/dist/senses/terminal-handoff.js +44 -0
- package/dist/senses/trust-gate.js +104 -9
- package/dist/senses/turn-attempts.js +171 -0
- package/dist/senses/turn-watch.js +268 -0
- 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/realtime-utterances.js +158 -0
- package/dist/senses/voice/transcript.js +70 -0
- package/dist/senses/voice/turn.js +219 -0
- package/dist/senses/voice/twilio-phone-runtime.js +836 -0
- package/dist/senses/voice/twilio-phone.js +5660 -0
- package/dist/senses/voice/types.js +2 -0
- package/dist/senses/voice/utterances.js +207 -0
- package/dist/senses/voice/whisper.js +153 -0
- package/dist/senses/voice-entry.js +84 -0
- package/dist/senses/voice-realtime-eval-command.js +99 -0
- package/dist/senses/voice-realtime-eval-entry.js +25 -0
- package/dist/senses/voice-twilio-entry.js +88 -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 +687 -0
- package/node_modules/@ouro.bot/friends/actions/generated/mcp.json +1105 -0
- package/node_modules/@ouro.bot/friends/changelog.json +197 -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 +83 -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 +16 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/channel.js +83 -4
- 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 +19 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +157 -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 +43 -0
- package/node_modules/@ouro.bot/friends/dist/grants.js +100 -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 +164 -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 +17 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.d.ts +40 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +744 -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 +59 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +23 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.d.ts +30 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.js +195 -0
- package/node_modules/@ouro.bot/friends/dist/message.d.ts +93 -0
- package/node_modules/@ouro.bot/friends/dist/message.js +129 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +89 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.js +207 -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 +169 -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 +99 -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 +113 -0
- package/node_modules/@ouro.bot/friends/dist/share.js +314 -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 +1089 -0
- package/node_modules/@ouro.bot/friends/dist/store.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +10 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/tokens.js +7 -4
- 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 +333 -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/util/safe-id.d.ts +1 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.js +10 -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 +82 -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 +95 -13
- package/skills/agent-commerce.md +116 -0
- package/skills/browser-navigation.md +120 -0
- package/skills/commerce-setup-guide.md +116 -0
- package/skills/commerce-setup.md +87 -0
- package/skills/configure-dev-tools.md +32 -14
- package/skills/sense-setup.md +56 -0
- package/skills/travel-planning.md +141 -0
- package/dist/heart/daemon/auth-flow.js +0 -457
- package/dist/heart/daemon/heartbeat-timer.js +0 -132
- package/dist/heart/daemon/mcp-server.js +0 -591
- package/dist/heart/daemon/ouro-path-installer.js +0 -221
- package/dist/heart/daemon/ouro-version-manager.js +0 -171
- package/dist/heart/daemon/specialist-tools.js +0 -283
- package/dist/heart/daemon/update-hooks.js +0 -138
- package/dist/heart/obligations.js +0 -197
- package/dist/heart/session-recall.js +0 -216
- package/dist/mind/associative-recall.js +0 -287
- 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/mind/journal-index.js +0 -161
- package/dist/mind/obligations.js +0 -134
- 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 -94
- package/dist/senses/bluebubbles-entry.js +0 -13
- package/dist/senses/bluebubbles-media.js +0 -339
- package/dist/senses/bluebubbles.js +0 -1247
- package/dist/senses/contextual-heartbeat.js +0 -102
- package/dist/senses/debug-activity.js +0 -154
- package/dist/senses/inner-dialog-worker.js +0 -90
- package/dist/senses/inner-dialog.js +0 -662
- 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,5 @@
|
|
|
1
|
+
import{r as d,e as Ko,c as Yo,j as e,m as Go,T as Xo,a as Jo,b as Qo,d as Zo,B as zs,u as er,D as tr,M as nr,f as Vt,g as cn,C as sr,h as or,i as dn,k as rr,l as ar,n as ir,o as As,p as lr,q as cr,s as dr,t as ur,v as mr,S as We,w as pr,x as fr,y as hr,z as xr,A as br,E as gr,F as vr,G as jr,H as yr,I as Ls,J as wr,K as kr,L as Nr,N as Cr,O as Sr,P as Er,Q as _r}from"./vendor-BfcLUM_P.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function s(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 o(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}})();const Ts="/api";async function Q(t,n){const s=await fetch(`${Ts}${t}`,{headers:{accept:"application/json"},signal:n==null?void 0:n.signal});if(!s.ok)throw new Error(`${s.status} ${s.statusText}`);return s.json()}function zr(t,n){const s=new EventSource(`${Ts}/events`);let o=!1;n==null||n("connecting");const r=a=>{if(!(o||!(a instanceof MessageEvent)))try{const l=JSON.parse(a.data);t("state-changed",l)}catch{t("state-changed",{})}};return s.addEventListener("state-changed",r),s.onopen=()=>{o||(n==null||n("connected"),t("connected",{}))},s.onerror=()=>{o||n==null||n("reconnecting")},()=>{o=!0,s.removeEventListener("state-changed",r),s.onopen=null,s.onerror=null,s.close()}}function oe(t){if(!t)return"unknown";const n=Date.now()-new Date(t).getTime();return n<0||n<6e4?"just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function de(t,n){if(!t)return"";if(t.length<=n)return t;const s=t.lastIndexOf(" ",n);return(s>n*.6?t.slice(0,s):t.slice(0,n))+"…"}const $s=d.createContext(()=>{});function mt(){return d.useContext($s)}const Ar=new Set(["overview","mail","sessions","work","connections","inner","notes","runtime"]);function Rs(t){const n=t.replace(/^#\/?/,"");if(!n.startsWith("agent/"))return null;const s=n.split("/"),o=s[1]?decodeURIComponent(s[1]):"";if(!o)return null;const r=s[2]??"overview",a=Ar.has(r)?r:"overview",l=s.slice(3),i=l.length>0?l.map(decodeURIComponent).join("/"):void 0;return{agent:o,tab:a,focus:i}}function rt(t){let n=`#/agent/${encodeURIComponent(t.agent)}`;return(t.tab!=="overview"||t.focus)&&(n+=`/${t.tab}`),t.focus&&(n+=`/${t.focus.split("/").map(encodeURIComponent).join("/")}`),n}function un(t){const n=t.replace(/^#\/?/,"").split("/");if(n[0]!=="supervision"||n.length>3)return null;try{const s=n[1]?decodeURIComponent(n[1]):null;return s&&!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(s)?null:{agent:s,...n[2]?{focus:decodeURIComponent(n[2])}:{}}}catch{return null}}function mn(t,n){return`#/supervision${t?`/${encodeURIComponent(t)}`:""}`}function ue(t,n,s){/* 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}: ${n}`)}function X(t,n,s,o){d.useRef(!1),d.useEffect(()=>{},[t,n,s,o])}const Lr=Ko({extend:{theme:{radius:["ouro-sm","ouro-md","ouro-lg","ouro-xl","ouro-2xl","ouro-3xl","ouro-4xl"],spacing:["ouro-0_5","ouro-1","ouro-1_5","ouro-2","ouro-2_5","ouro-3","ouro-3_5","ouro-4","ouro-5","ouro-5_5","ouro-6","ouro-7","ouro-8","ouro-9","ouro-10","ouro-11","ouro-12","ouro-13","ouro-14","ouro-16","ouro-17","ouro-18","ouro-20","ouro-24","ouro-28","ouro-32","ouro-40","ouro-48","ouro-56","ouro-64","ouro-72","ouro-80","ouro-96","ouro-144"]}}});function C(...t){return Lr(Yo(t))}function V(t,n){d.useRef({}),d.useEffect(()=>{})}const Tr="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",$r="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",Rr="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 Ir(t){const{sidebar:n,header:s,children:o,as:r,bleed:a,skipLabel:l="Skip to content",className:i,ref:c,navbar:u}=t;X("SidebarLayout",i,""),V();const p=d.useId(),f=r==="div"?"div":"main",b=s!==void 0?"header":"div",m=d.useRef(null);return e.jsxs("div",{ref:c,"data-ouro":"sidebar-layout",className:C("relative grid min-h-dvh grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)] bg-background text-foreground",i),children:[e.jsx("a",{href:`#${p}`,"data-ouro-control":"sidebar-layout","data-ouro-part":"skip-link",onClick:()=>m.current.focus(),className:Tr,children:l}),e.jsx("div",{"data-ouro-sidebar-layout-sidebar":"",className:$r,children:n}),e.jsx(b,{"data-ouro-sidebar-layout-header":"",className:C(Rr,s!==void 0?"min-h-14":"sm:hidden"),children:s}),e.jsx(f,{ref:m,id:p,tabIndex:-1,className:C("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:o})]})}function pn(t){const n=t.replace(/[?#].*$/,"").replace(/\/+$/,"");return n===""?"/":n}function Mr(t,n){if(n===void 0)return;const s=pn(n);let o,r=-1;for(const a of t){const l=pn(a);if(l===s)return a;l!=="/"&&s.startsWith(`${l}/`)&&l.length>r&&(o=a,r=l.length)}return o}const Or=t=>d.createElement("a",t),Pr=d.createContext({linkComponent:Or});function Kt(){return d.useContext(Pr)}const Dr=/^([a-z][a-z\d+.-]*:|\/\/)/i;function Br(t){return Dr.test(t)}function pt(t){const n=new Set((t??"").split(/\s+/).filter(Boolean));return n.add("noopener"),n.add("noreferrer"),[...n].join(" ")}function Se({href:t,target:n,rel:s,reloadDocument:o,...r}){const{linkComponent:a}=Kt(),l=Br(t),i={...r,href:t,target:n,rel:l&&n==="_blank"?pt(s):s},c=r.download!==void 0&&r.download!==null&&r.download!==!1;return l||o||c?d.createElement("a",i):d.createElement(a,i)}let je=null,fn=null;function hn(t){(je===null||fn!==matchMedia)&&(je=new Map,fn=matchMedia,queueMicrotask(()=>je=null));const n=je.get(t);if(n!==void 0)return n;const s=matchMedia(t);return typeof MediaQueryList=="function"&&s instanceof MediaQueryList&&je.set(t,s),s}function Yt(t,n){const s=d.useCallback(r=>{if(typeof matchMedia!="function")return()=>{};const a=hn(t),l=()=>{je==null||je.delete(t),r()};return a.addEventListener("change",l),()=>a.removeEventListener("change",l)},[t]),o=d.useCallback(()=>typeof matchMedia=="function"?hn(t).matches:n,[t,n]);return d.useSyncExternalStore(s,o,()=>n)}const Fr=["top","bottom","left","right"],Is=["start","center","end"];function Ms(t,n){return Fr.includes(t)?t:n}function Hr(t){return Is.includes(t)?t:"center"}const Os="relative isolate z-(--ouro-layer) in-[[data-ouro$='-portal']]:z-1001",Ps="fixed",Ur="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]",qr=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Wr="data-ouro-pressed-focus",Vr="data-ouro-pressed-within";let Ds;function Ot(t,n=Ds==="pointer"){if(!(!(t instanceof Element)||t===document.body)){t.toggleAttribute(Wr,n);for(let s=t.parentElement;s&&s!==document.body;s=s.parentElement)s.toggleAttribute(Vr,n)}}function xn(t){Ds=t;const n=document.documentElement;n.getAttribute("data-ouro-modality")!==t&&n.setAttribute("data-ouro-modality",t),Ot(document.activeElement)}let nt="";function Kr(){return nt}/* istanbul ignore else @preserve -- the else path is server rendering, which has no document */typeof document<"u"&&(document.addEventListener("pointerdown",t=>{nt=t.pointerType,xn("pointer")},!0),document.addEventListener("keydown",t=>{nt="keyboard",qr.has(t.key)&&xn("keyboard")},!0),document.addEventListener("focusin",t=>Ot(t.target),!0),document.addEventListener("focusout",t=>{Ot(t.target,!1)},!0),document.addEventListener("pointermove",t=>{(t.pointerType==="mouse"||t.pointerType==="pen")&&(nt=t.pointerType)},!0));function at(t,n){if(typeof t=="function"){const s=t(n);return typeof s=="function"?s:()=>t(null)}return t?(t.current=n,()=>{t.current=null}):()=>{}}function ge(t,n){return d.useCallback(s=>{const o=at(n,s),r=at(t,s);return()=>{o(),r()}},[t,n])}const Yr=new Set([" ","PageUp","PageDown","Home","End","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab"]),Gr=1e3,Xr=200,Jr=1e3,vt=["Enter"," "],bn=["ArrowDown","ArrowUp"],Le=new Set;let Pt=0,Dt=0,Ne=0,Bs,Ke,Fs,gn,ze,st=null;function Gt(t){st??(st=t.style.scrollBehavior),t.style.scrollBehavior="auto"}function Hs(t){st!==null&&t.style.scrollBehavior==="auto"&&(t.style.scrollBehavior=st),st=null}const Us=()=>Ke!==void 0||[...Le].some(t=>t.querySelector("[data-open]")!==null);function qs(t){Us()||(Pt=t.scrollX,Dt=t.scrollY,Le.size===0&&(Bs=Zr(t)))}function Xt(t){Le.size>0||Ke!==void 0||(Bs(),Hs(t.document.documentElement))}function it(){clearTimeout(Ke),Ke=void 0,ze==null||ze.trigger.removeEventListener("click",Ws),ze=void 0}function Ws(){const{view:t}=ze;it(),Xt(t)}function vn(t,n,s){if(n===gn||(gn=n,t.getAttribute("aria-expanded")==="true"))return;const o=t.ownerDocument.defaultView;o.scrollTo({left:o.scrollX,top:o.scrollY,behavior:"instant"}),qs(o),it(),Ke=setTimeout(()=>{it(),Xt(o)},Jr),Ne=0,s?(ze={trigger:t,view:o},t.addEventListener("click",Ws)):Gt(o.document.documentElement)}function Me(t,n=!1,s=o=>o.button===0){const o=new Set(t);return{onPointerDown:r=>{s(r)&&vn(r.currentTarget,r.nativeEvent,n)},onKeyDown:r=>{o.has(r.key)&&(Fs=r.nativeEvent,vn(r.currentTarget,r.nativeEvent,n))}}}const Ce={button:Me(vt),listButton:Me([...vt,...bn]),listInput:Me(bn),dialog:Me(vt,!0),contextMenu:Me([],!1,t=>t.button===2)};function Qr(t){const n=t.ownerDocument.defaultView;return qs(n),it(),Ne=0,Gt(n.document.documentElement),Le.add(t),()=>{Le.delete(t),Xt(n)}}function Zr(t){const n=t.document,s=()=>{Ne=performance.now()+Gr,Hs(n.documentElement)},o=c=>{(c.target===n.documentElement||c.button===1)&&s()},r=c=>{[...Le].some(u=>u.contains(c.target))&&s()},a=c=>{c!==Fs&&(c.defaultPrevented?(Ne=0,Gt(n.documentElement)):Yr.has(c.key)&&s())},l=()=>{const c=performance.now(),u=c<Ne;if(u&&(Ne=Math.max(Ne,c+Xr)),u||!Us()){Pt=t.scrollX,Dt=t.scrollY;return}t.scrollTo({left:Pt,top:Dt,behavior:"instant"})},i={capture:!0,passive:!0};return n.addEventListener("wheel",s,i),n.addEventListener("touchmove",s,i),n.addEventListener("pointerdown",o,i),n.addEventListener("click",r,i),t.addEventListener("keydown",a),n.addEventListener("scroll",l),()=>{n.removeEventListener("wheel",s,i),n.removeEventListener("touchmove",s,i),n.removeEventListener("pointerdown",o,i),n.removeEventListener("click",r,i),t.removeEventListener("keydown",a),n.removeEventListener("scroll",l)}}const Vs=d.createContext(!1),ea=d.createContext(!1),ta=d.createContext(!1);function Jt({children:t}){return d.createElement(Vs.Provider,{value:!0},t)}const na=()=>()=>{},sa=t=>t&&"current"in t?t.current??void 0:t;function Ks(t,n=!1){const{portalContainer:s}=Kt(),o=d.useContext(Vs),r=d.useSyncExternalStore(na,()=>sa(s),()=>{}),a=d.useRef(void 0),[l]=d.useState(()=>{const i=u=>{var p;(p=a.current)==null||p.call(a),a.current=u?Qr(u):void 0};return{hold:i,check:u=>{n&&i(u)}}});return o?n?{ref:l.hold}:{}:{...r?{container:r}:{},ref:l.check}}const oa=t=>(t==null?void 0:t.$$typeof)===Symbol.for("react.lazy");function ra(t){const n=[];return d.Children.forEach(t,s=>n.push(s)),n}function aa(t){if(!oa(t))return t;const n=ra(t);return n.length===1&&d.isValidElement(n[0])?n[0]:t}const ia=Ur+" 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",la=600,ca=400,jn=100,Oe={count:0,closedAt:Number.NEGATIVE_INFINITY};function yn(t,n){return(t===!0||t==="true")&&n!==void 0&&n!==null&&n!==!1&&n!=="false"}function lt(t){const{content:n,children:s,side:o,align:r,title:a,delayDuration:l,delay:i,asChild:c,placement:u,ref:p,...f}=t,b=Ms(o,"top"),m=Hr(r);d.useRef({});const h=d.useRef(null),x=aa(s),v=ge(x.props.ref,ge(p,h));V(),d.useEffect(()=>{});const y=d.useCallback(F=>{},[]),j=d.useContext(ta),[w,g]=d.useState(!1),[E,$]=d.useState(!1),R=d.useRef(void 0),L=F=>{const q=h.current;n==null||n===""||Kr()!=="touch"&&!yn(q==null?void 0:q.getAttribute("aria-expanded"),q==null?void 0:q.getAttribute("aria-haspopup"))&&$(F)},I=(F,q)=>{clearTimeout(R.current),R.current=setTimeout(q,F)},_=()=>{clearTimeout(R.current),$(!1)};d.useEffect(()=>{if(E)return Oe.count+=1,()=>{Oe.count-=1,Oe.closedAt=performance.now()}},[E]),d.useEffect(()=>()=>clearTimeout(R.current),[]);const S=d.useContext(ea);d.useLayoutEffect(()=>{S&&_()},[S]);const B=x.props["aria-expanded"]??f["aria-expanded"],M=x.props["aria-haspopup"]??f["aria-haspopup"],W=yn(B,M);d.useLayoutEffect(()=>{_()},[W]);const J=Ks(),ee=d.cloneElement(x,Go(f,x.props,{ref:v,...E?{"data-popup-open":""}:{},...n==null||n===""?{}:{"data-base-ui-tooltip-trigger":""},onPointerEnter:F=>{F.pointerType!=="touch"&&(g(!0),j&&(Oe.count>0||F.timeStamp-Oe.closedAt<ca)?L("delay"):I(la,()=>L("now")))},onPointerLeave:()=>I(jn,()=>$(!1)),onFocus:F=>{F.currentTarget.matches(":focus-visible")&&(g(!0),clearTimeout(R.current),L("focus"))},onBlur:_,onKeyDown:F=>{F.key!=="Escape"||!E||(_(),F.preventDefault(),F.stopPropagation())},onPointerDown:_,onClick:_}));return w?e.jsxs(e.Fragment,{children:[ee,e.jsx(Xo,{open:E!==!1,onOpenChange:_,children:e.jsx(Jo,{"data-slot":"tooltip-portal",...J,"data-ouro":"tooltip-portal",className:Os,children:e.jsx(Jt,{children:e.jsx(Qo,{anchor:h,positionMethod:Ps,side:b,align:m,sideOffset:6,collisionPadding:8,"data-ouro":"tooltip-positioner",children:e.jsx(Zo,{"data-slot":"tooltip-content",ref:y,"data-ouro":"tooltip","data-instant":E==="focus"||E==="delay"?E:void 0,onPointerEnter:()=>clearTimeout(R.current),onPointerLeave:()=>I(jn,()=>$(!1)),className:ia,children:n})})})})})]}):ee}let pe,Pe;const wn=100;function da(){return pe!=null&&pe.isConnected||(pe=document.createElement("div"),pe.setAttribute("role","status"),pe.setAttribute("aria-live","polite"),pe.setAttribute("aria-atomic","true"),pe.setAttribute("data-ouro-announcer",""),Object.assign(pe.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(pe)),pe}function Qt(t,{delayMs:n=wn,onWrite:s}={}){/* istanbul ignore if @preserve -- server only */if(typeof document>"u")return;const o=da();o.textContent="",clearTimeout(Pe);const r=setTimeout(()=>{Pe=void 0,o.textContent=t,s==null||s()},Math.max(wn,n));return Pe=r,()=>{Pe===r&&(clearTimeout(r),Pe=void 0)}}function Ys(t,n){const s=d.useId(),o="disabledReason"in t,r=t.disabledReason||void 0,a=r!==void 0;return{off:a,wrapped:o,reason:r,describedBy:a?[n,s].filter(Boolean).join(" "):n,note:a?e.jsx("span",{hidden:!0,id:s,children:r}):null}}function ct(){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 ua="press relative box-border inline-flex shrink-0 items-center justify-center align-middle rounded-ouro-control border border-solid font-medium whitespace-nowrap forced-colors:data-[variant=plain]:border-0 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 data-ouro-off:cursor-not-allowed data-ouro-off:opacity-50 aria-busy:cursor-progress",jt="h-[max(var(--ouro-button-h),var(--ouro-size-6))] px-(--ouro-button-px)",kn={sm:`${jt} 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:`${jt} 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:`${jt} 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]"},yt={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) data-ouro-off: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"}},Nn="size-[1.25em] shrink-0",ma="[&>[data-ouro-label]>svg:not([class*='size-'])]:size-[1.25em] [&>[data-ouro-label]>svg]:shrink-0",pa="min-w-(--ouro-button-h) pointer-fine:min-w-[max(var(--ouro-button-h),var(--ouro-size-6))] [--ouro-button-px:0px] sm:[--ouro-button-px:0px]",fa=["button","submit","reset"];function ha({fadeIn:t}){return e.jsx("span",{"data-slot":"button-spinner","aria-hidden":"true",className:C("absolute inset-0 flex items-center justify-center transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out)",t&&"starting:opacity-0"),children:e.jsxs("svg",{"data-slot":"button-spinner-icon","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 Cn=t=>t.preventDefault(),xa="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 ba(t,n){if(t.key!=="Enter"||t.defaultPrevented||t.isComposing||t.keyCode===229||t.shiftKey||t.altKey)return!1;const s=t.target;return n.contains(s)?s.matches("textarea")?t.metaKey||t.ctrlKey:!s.matches(xa):!1}function re(t){const{tone:n="primary",variant:s="solid",size:o="md",fullWidth:r,loading:a,loadingLabel:l="Loading",startIcon:i,endIcon:c,children:u,className:p,isLoading:f,color:b,asChild:m,leftIcon:h,rightIcon:x,reloadDocument:v,default:y,...j}=t,w=Object.hasOwn(yt.solid,n)?n:"primary",g=Object.hasOwn(yt,s)?s:"solid",E=Object.hasOwn(kn,o)?o:"md";X("Button",p,""),V();const $=d.useRef(a),[R,L]=d.useState(!1);d.useEffect(()=>{L(!0)},[]),d.useEffect(()=>{a&&!$.current&&Qt(l),$.current=a},[a,l]);const I=d.useRef(null),_=d.useRef(void 0),S=j.onClick;d.useEffect(()=>{_.current=S});const B=y&&j.href===void 0&&!j.disabled&&!j.disabledReason&&!a;d.useEffect(()=>{const O=B?I.current.closest("[role=dialog],[role=alertdialog]"):null;if(!O)return;const T=P=>{var be,me;if(!ba(P,O))return;P.preventDefault(),(be=_.current)==null||be.call(_,P);const Y=I.current;Y.type==="submit"&&((me=Y.form)==null||me.requestSubmit(Y))};return O.ownerDocument.addEventListener("keydown",T),()=>O.ownerDocument.removeEventListener("keydown",T)},[B]);const M=Ys(j,j["aria-describedby"]),W=ge(j.ref,I),J=j,ee=E!=="inline"&&!i&&!c&&d.isValidElement(u)&&u.type!==d.Fragment&&!(u.type==="img"&&u.props.width!==u.props.height)&&!!(J["aria-label"]||J["aria-labelledby"]),F=C(ua,ma,kn[E],ee&&pa,yt[g][w],r&&"w-full",p),q=C("relative transition-opacity duration-(--ouro-duration-fast) ease-(--ouro-ease-out)",a&&"opacity-0"),K=e.jsxs(e.Fragment,{children:[e.jsx(ct,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true"}),e.jsxs("span",{"data-slot":"button-label","data-ouro-label":"",className:C("inline-flex grow items-center gap-[inherit] [justify-content:inherit]",q),children:[i&&e.jsx(i,{"aria-hidden":"true",className:C(Nn,"-ms-0.5")}),u]}),c&&e.jsx(c,{"aria-hidden":"true",className:C(Nn,q,"-me-0.5")}),a&&e.jsx(ha,{fadeIn:R})]});if(j.href!==void 0){const{onClick:O,type:T,disabled:P,...Y}=j;return e.jsx(Se,{"data-ouro-control":"button","data-ouro-part":"root",...Y,reloadDocument:v,onClick:a?Cn:O,onAuxClick:a?Cn:Y.onAuxClick,className:F,"data-ouro":"button","data-ouro-squircle":"","data-variant":g,"data-tone":w,"data-loading":a?"":void 0,"data-disabled":a?"":void 0,"aria-busy":a||Y["aria-busy"],"aria-disabled":a||Y["aria-disabled"],children:K})}const{ref:ie,disabled:le,disabledReason:se,type:A="button",...k}=j,H=k["aria-haspopup"]==="dialog"?{onPointerDown:O=>{var T;(T=k.onPointerDown)==null||T.call(k,O),Ce.dialog.onPointerDown(O)},onKeyDown:O=>{var T;(T=k.onKeyDown)==null||T.call(k,O),Ce.dialog.onKeyDown(O)}}:{},z=fa.includes(A)?A:"button",D=e.jsx(zs,{"data-ouro-control":"button","data-ouro-part":"root","data-slot":"button",...k,...H,ref:W,type:z,disabled:!!(le||a||M.off),focusableWhenDisabled:!!(M.off||a&&!le),className:F,"data-ouro":"button","data-ouro-squircle":"","data-variant":g,"data-tone":w,"data-loading":a?"":void 0,"data-ouro-off":M.off?"":void 0,"data-default":y?"":void 0,"aria-keyshortcuts":y?"Enter":k["aria-keyshortcuts"],"aria-busy":a||k["aria-busy"],"aria-describedby":M.describedBy,children:M.note?e.jsxs(e.Fragment,{children:[K,M.note]}):K});return M.wrapped?e.jsx(lt,{content:M.reason,children:D}):D}const Xe=new Set;let De;function ga(t){return Xe.add(t),De===void 0&&(De=new MutationObserver(()=>Xe.forEach(n=>n())),De.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]})),()=>{Xe.delete(t),!(Xe.size>0)&&(De.disconnect(),De=void 0)}}function wt({of:t,children:n}){const s=er(),[o,r]=d.useState(!1);return d.useLayoutEffect(()=>{const a=()=>{var l;return r(((l=((t instanceof Element?t:t==null?void 0:t.current)??document.documentElement).closest("[dir]"))==null?void 0:l.matches('[dir="rtl" i]'))===!0)};return a(),ga(a)},[t]),e.jsx(tr,{direction:o?"rtl":s,children:n})}const va={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 ja(t){return t==="apple"?["Meta"]:t==="unknown"?["Control","Meta"]:["Control"]}function ya(t,n="unknown"){let s=[[]];for(const o of t){const r=o.toLowerCase(),a=r==="mod"?ja(n):va[r]??[o.charAt(0).toUpperCase()+o.slice(1)];s=s.flatMap(l=>a.map(i=>[...l,i]))}return s.map(o=>o.join("+")).join(" ")}function wa(){var s;const t=navigator,n=((s=t.userAgentData)==null?void 0:s.platform)??t.platform;return/mac|iphone|ipad|ipod|ios/i.test(n)?"apple":/^win/i.test(n)?"windows":"other"}const ka=()=>()=>{},Na=()=>"unknown";function ft(){return d.useSyncExternalStore(ka,wa,Na)}function Ca(t){const n=Yt("(min-width: 640px)",!0);return t==="sheet"||t==="auto"&&!n}const Sn={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"]},En={meta:"cmd",command:"cmd",control:"ctrl",option:"alt",return:"enter",esc:"escape",arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"},Sa={ctrl:0,alt:1,shift:2,mod:3,cmd:3},Ea={cmd:0,mod:1,ctrl:1,alt:2,shift:3};function Gs(t){const n=t.toLowerCase();return Object.hasOwn(En,n)?En[n]:n}function _n(t){return new RegExp("^(?!\\p{ASCII})\\p{Emoji}$","u").test(t)?`${t}︎`:t}function _a(t,n){const s=Gs(t);if(s==="cmd"&&n!=="apple")return{text:n==="windows"?"Win":"Ctrl",name:void 0};if(!Object.hasOwn(Sn,s))return{text:_n(t.length===1?t.toUpperCase():t),name:void 0};const[o,r,a,l]=Sn[s];return n==="apple"?{text:_n(o),name:r||void 0}:{text:a,name:l}}function za(t){const{keys:n,className:s,children:o,shortcut:r,...a}=t,l=ft(),i=typeof n=="string"?n.split("+"):n??[];X("Kbd",s,""),V();const c=l==="apple",u=c?Sa:Ea,p=b=>u[Gs(b)]??4,f=[...i].sort((b,m)=>p(b)-p(m));return e.jsx("kbd",{...a,"data-ouro":"kbd","data-platform":c?"apple":l==="unknown"?"unknown":"other",className:C("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",s),children:f.map((b,m)=>{const{text:h,name:x}=_a(b,l);return e.jsxs(d.Fragment,{children:[!c&&m>0&&"+",e.jsx("kbd",{className:"m-0 [font:inherit]",children:x?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true","data-glyph":"",children:h}),e.jsx("span",{className:"sr-only",children:x})]}):h})]},m)})})}const Aa="outline-none",La="outline-none fixed! inset-x-0! top-auto! bottom-0! w-auto! transform-none!",Ta="box-border min-w-ouro-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:var(--ouro-size-6)] 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]",$a="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:var(--ouro-size-6)] [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",Ra="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",Te="relative m-0 box-border flex w-full min-h-ouro-11 pointer-fine:min-h-ouro-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-ouro-4 [&_svg]:shrink-0",Xs="absolute start-ouro-2 top-1/2 flex size-ouro-4 -translate-y-1/2 items-center justify-center",Js="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",Qs="-mx-1 my-1 h-px border-0 bg-border",Ia="absolute",Ma="relative m-0 box-border inline-flex h-ouro-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",Oa="data-ouro-pressing:select-none data-ouro-pressing:[-webkit-touch-callout:none]",Bt=d.createContext(null),Zs=d.createContext(!1),eo=d.createContext(!1);function Re(t,n){const s=d.useContext(Bt);return s||ue(t,"must be rendered inside <Menu>"),s}function Ft(t){return t.map((n,s)=>{switch(n.type){case"separator":return e.jsx(Wa,{},s);case"checkbox":return e.jsx(Ba,{checked:n.checked,defaultChecked:n.defaultChecked,onCheckedChange:n.onCheckedChange,shortcut:n.shortcut,disabled:n.disabled,axAction:n.axAction,children:n.label},s);case"radio":return e.jsx(Fa,{label:n.label,value:n.value,defaultValue:n.defaultValue,onValueChange:n.onValueChange,children:n.options.map(o=>e.jsx(Ha,{value:o.value,shortcut:o.shortcut,disabled:o.disabled,children:o.label},o.value))},s);case"group":return e.jsx(Ua,{label:n.label,children:Ft(n.items)},s);case"submenu":return e.jsx(qa,{label:n.label,disabled:n.disabled,backLabel:n.backLabel,children:Ft(n.items)},s);default:return e.jsxs(no,{onClick:n.onClick,href:n.href,shortcut:n.shortcut,tone:n.tone,disabled:n.disabled,..."disabledReason"in n?{disabledReason:n.disabledReason}:{},axAction:n.axAction,children:[n.icon!==void 0&&e.jsx("span",{"aria-hidden":"true","data-ouro-menu-icon":"",className:"flex shrink-0",children:n.icon}),n.label]},s)}})}function kt(t){return n=>n.currentTarget.toggleAttribute("data-ouro-pressing",t)}function ot({sheet:t,context:n,side:s,align:o,className:r,children:a,closeLabel:l,anchor:i,point:c,label:u,finalFocus:p}){const f=n?hr:xr,b=Ks("Menu",!0),m=d.useContext(Bt)!==null,h=d.useContext(Zs),x=m||h,v=d.useRef(null);d.useLayoutEffect(()=>{const j=v.current;if(j===null)return;const w=()=>{for(const E of j.querySelectorAll("[data-base-ui-focus-guard][role]"))E.removeAttribute("role"),E.setAttribute("aria-hidden","true")},g=new MutationObserver(w);return g.observe(j,{subtree:!0,attributeFilter:["role"]}),()=>g.disconnect()},[]);const y=e.jsx(pr,{...b,"data-ouro":"menu-portal",className:Os,children:e.jsxs(Jt,{children:[t&&e.jsx(fr,{"data-ouro":"menu-backdrop",className:Ra}),e.jsx(f,{"data-ouro":"menu-positioner",className:t?La:Aa,sideOffset:n||c?0:4,collisionPadding:8,...i!==void 0?{anchor:i}:{},positionMethod:Ps,...s?{side:s}:{},...o?{align:o}:{},children:e.jsxs(br,{"data-ouro":"menu","data-ouro-presentation":t?"sheet":"menu","aria-label":u,...p!==void 0?{finalFocus:p}:{},className:C(t?$a:Ta,t?void 0:r),children:[e.jsx(Bt.Provider,{value:{sheet:t},children:a}),t&&l!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx(We,{className:Qs}),e.jsx(Vt,{"data-ouro-menu-close":"","data-ouro-control":"menu","data-ouro-part":"close",className:Te,children:e.jsx("span",{"data-ouro-menu-label":"",children:l})})]})]})})]})});return x?e.jsx("span",{ref:v,"data-ouro-menu-guards":"",className:Ia,children:y}):y}function Pa(t){const{trigger:n,contextTrigger:s,label:o,anchor:r,"aria-label":a,returnFocus:l,items:i,children:c,side:u,align:p,className:f,closeLabel:b="Close",modal:m,open:h,onOpenChange:x,isOpen:v,onClose:y,placement:j,asChild:w,options:g}=t,E=d.useContext(Zs),$=[n,s,o,r].filter(k=>k!==void 0).length;$===0&&ue("Menu","needs trigger, contextTrigger, label or anchor"),$>1&&ue("Menu","takes one of trigger, contextTrigger, label and anchor"),r!==void 0&&h===void 0&&ue("Menu","anchor needs open: the app opens a menu it anchors"),r!==void 0&&!a&&ue("Menu","anchor needs aria-label: no button names the menu"),E&&o===void 0&&ue("Menu","a Menu inside <MenuBar> takes label, not trigger or contextTrigger"),!E&&o!==void 0&&ue("Menu","label is for a Menu inside <MenuBar>"),i===void 0&&c===void 0&&ue("Menu","needs items or children"),i!==void 0&&c!==void 0&&ue("Menu","takes items or children, not both"),h!==void 0&&typeof x!="function"&&ue("Menu","open needs onOpenChange");const R=s!==void 0,L=r!==void 0&&!("getBoundingClientRect"in r)?r:void 0,I=Ms(u,"bottom"),_=Is.includes(p)?p:"start";X("Menu",f,""),V();const S=Ca(R||L!==void 0?"menu":"auto"),B=i!==void 0?Ft(i):c,[M,W]=d.useState(!1),J=h??M,ee=d.useRef(null),F=d.useRef(null),q=d.useRef(null),K=d.useRef(null);d.useEffect(()=>{var z;const k=r!==void 0?document:(z=q.current)==null?void 0:z.ownerDocument;if(!J||k===void 0)return;F.current=null;const H=D=>{var T;const O=D.target;(T=q.current)!=null&&T.contains(O)||O.closest('[data-ouro="menu-positioner"], [data-base-ui-focus-guard]')||(F.current=O,ee.current.close())};return k.addEventListener("focusin",H),()=>k.removeEventListener("focusin",H)},[J,r]);const ie=d.useRef(l);d.useLayoutEffect(()=>{ie.current=l});const le=k=>{W(k),x==null||x(k),!(r===void 0||k)&&setTimeout(()=>{var z,D;const H=document.activeElement;H!==document.body&&H.closest('[data-ouro="menu-positioner"]')===null||(D=(z=F.current)!=null&&z.isConnected?F.current:ie.current)==null||D.focus({preventScroll:!0})})},se=h!==void 0?{open:h,onOpenChange:le}:{onOpenChange:le};if(r!==void 0){const k=L===void 0?r:{getBoundingClientRect:()=>new DOMRect(L.x,L.y,0,0)},H=()=>!1,z=e.jsx(cn,{...se,actionsRef:ee,modal:S,children:e.jsx(ot,{sheet:S,context:!1,side:I,align:L===void 0?_:"start",className:f,closeLabel:b,anchor:k,point:L!==void 0,label:a,finalFocus:H,children:B})});return e.jsx(wt,{of:r instanceof Element?r:null,children:z})}if(R){const k=e.jsxs(sr,{...se,children:[e.jsx(or,{ref:K,render:s,className:Oa,...Ce.contextMenu,style:{WebkitTouchCallout:void 0},onTouchStart:kt(!0),onTouchEnd:kt(!1),onTouchCancel:kt(!1)}),e.jsx(ot,{sheet:!1,context:!0,className:f,children:B})]});return e.jsx(wt,{of:K,children:k})}const A=e.jsxs(cn,{...se,actionsRef:ee,modal:o===void 0?S||m:void 0,children:[o!==void 0?e.jsx(dn,{"data-ouro-control":"menu","data-ouro-part":"bar-trigger",className:Ma,...Ce.listButton,children:o}):e.jsx(dn,{ref:q,render:n,...Ce.listButton}),e.jsx(ot,{sheet:S,context:!1,side:I,align:_,className:f,closeLabel:b,finalFocus:Da,children:B})]});return o!==void 0?A:e.jsx(wt,{of:q,children:A})}function Da(){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 to(t){return typeof t=="string"?t.split("+"):t}function Zt(t,n){const s=to(t);return s?{"aria-keyshortcuts":ya(s,n)}:{}}function en({children:t,shortcut:n}){const s=to(n);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}),s&&e.jsx(za,{keys:s,"aria-hidden":"true",className:"ms-auto"})]})}function no(t){const{children:n,onClick:s,href:o,current:r,shortcut:a,tone:l,disabled:i,axAction:c,onSelect:u,variant:p,asChild:f,checked:b}=t,m=ft(),h=Ys(t,void 0);Re("MenuItem");const x=l==="destructive"?"destructive":void 0;V();const v={className:Te,...h.off?{style:{pointerEvents:"auto"}}:{},"data-ouro-control":"menu","data-ouro-part":"item","data-tone":x,"data-ax-action":c,...Zt(a,m),...s&&!h.off?{onClick:w=>s(w)}:{}},y=e.jsxs(e.Fragment,{children:[e.jsx(en,{shortcut:a,children:n}),h.note]}),j=o!==void 0&&!i&&!h.off?e.jsx(nr,{...v,"aria-current":r?"page":void 0,closeOnClick:!0,render:e.jsx(Se,{href:o}),children:y}):e.jsx(Vt,{...v,...h.wrapped?{"aria-describedby":h.describedBy,closeOnClick:!h.off}:{},disabled:!!(i||h.off),children:y});return h.wrapped?e.jsx(lt,{content:h.reason,children:j}):j}function so(){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 Ba({children:t,shortcut:n,onCheckedChange:s,axAction:o,...r}){const a=ft();return Re("MenuCheckboxItem"),V(),e.jsxs(ur,{"data-ouro-control":"menu","data-ouro-part":"checkbox-item","data-ax-action":o,...r,...Zt(n,a),...s?{onCheckedChange:l=>s(l)}:{},className:Te,children:[e.jsx("span",{"data-ouro-menu-indicator":"",className:Xs,children:e.jsx(mr,{className:"flex",children:e.jsx(so,{})})}),e.jsx(en,{shortcut:n,children:t})]})}function Fa({children:t,label:n,onValueChange:s,...o}){return Re("MenuRadioGroup"),e.jsxs(lr,{...o,...s?{onValueChange:r=>s(r)}:{},children:[n!==void 0&&e.jsx(As,{className:Js,children:n}),e.jsx(eo.Provider,{value:!0,children:t})]})}function Ha({children:t,shortcut:n,...s}){const o=ft();return d.useContext(eo)||ue("MenuRadioItem","must be rendered inside <MenuRadioGroup>"),V(),e.jsxs(cr,{"data-ouro-control":"menu","data-ouro-part":"radio-item",...s,...Zt(n,o),className:Te,children:[e.jsx("span",{"data-ouro-menu-indicator":"",className:Xs,children:e.jsx(dr,{className:"flex",children:e.jsx(so,{})})}),e.jsx(en,{shortcut:n,children:t})]})}function Ua({label:t,children:n}){return Re("MenuGroup"),V(),e.jsxs(ir,{children:[e.jsx(As,{className:Js,children:t}),n]})}function zn({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 qa({label:t,children:n,disabled:s,backLabel:o="Back"}){const{sheet:r}=Re("MenuSub"),[a,l]=d.useState(!1),i=d.useRef(void 0),c=(u,p)=>{if(!u){i.current=p.reason==="trigger-hover"?void 0:null,l(!1);return}if(p.reason==="trigger-hover"&&i.current!==void 0){const{clientX:f,clientY:b}=p.event;if(!(i.current!==null&&(i.current.x!==f||i.current.y!==b))){i.current={x:f,y:b},p.cancel();return}}i.current=void 0,l(!0)};return e.jsxs(rr,{open:a,onOpenChange:c,disabled:s,children:[e.jsxs(ar,{"data-ouro-control":"menu","data-ouro-part":"submenu-trigger",className:Te,disabled:s,openOnHover:!r,onClick:()=>{i.current=void 0,l(!0)},children:[e.jsx("span",{"data-ouro-menu-label":"",className:"flex min-w-0 flex-1 items-center gap-2",children:t}),e.jsx(zn,{})]}),e.jsxs(ot,{sheet:r,context:!1,children:[r&&e.jsxs(Vt,{"data-ouro-menu-back":"","data-ouro-control":"menu","data-ouro-part":"back",className:Te,closeOnClick:!1,onClick:()=>l(!1),children:[e.jsx(zn,{back:!0}),e.jsx("span",{"data-ouro-menu-label":"",children:o})]}),n]})]})}function Wa(){return Re("MenuSeparator"),e.jsx(We,{className:Qs})}function Va(t){return[...document.querySelectorAll('[role="dialog"][data-open], [role="alertdialog"][data-open]')].some(s=>!s.contains(t))?void 0:t}function oo(t){return d.useCallback(n=>{if(!CSS.supports("-webkit-touch-callout","none"))return at(t,n);const s=()=>{const a=Number.parseFloat(n.style.getPropertyValue("--ouro-backdrop-top"))||0;n.style.setProperty("--ouro-backdrop-top",`${a-n.getBoundingClientRect().top}px`)};s();const o=requestAnimationFrame(s);addEventListener("scroll",s,{passive:!0}),addEventListener("resize",s);const r=at(t,n);return()=>{cancelAnimationFrame(o),removeEventListener("scroll",s),removeEventListener("resize",s),r()}},[t])}function Ka(t){return d.useCallback(n=>{if(!n||!t)return;const s=()=>{const l=n.scrollWidth>n.clientWidth&&/auto|scroll/.test(getComputedStyle(n).overflowX);n.scrollHeight>n.clientHeight||l?n.setAttribute("tabindex","0"):n!==n.ownerDocument.activeElement&&n.removeAttribute("tabindex")},o=new ResizeObserver(s),r=()=>{o.disconnect(),o.observe(n);for(const l of n.children)o.observe(l)},a=new MutationObserver(r);return r(),a.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("blur",s),()=>{o.disconnect(),a.disconnect(),n.removeEventListener("blur",s)}},[t])}const Ya=["bottom","top","left","right"],Ga="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",Xa="box-border flex shrink-0 justify-end gap-3 px-5 pt-3 pb-5 max-sm:flex-col max-sm:*:w-full";function Ja(){const t=[...["--ouro-sheet-x","--ouro-sheet-y","--ouro-sheet-grab"].map(n=>({name:n,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(n=>({name:n,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 n of t)try{CSS.registerProperty(n)}catch{}}const ro=d.createContext(null),Qa={bottom:"down",top:"up",left:"left",right:"right"};Ja();const Za="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) "+Ga,ei="pointer-events-none fixed inset-0 z-1000 min-h-dvh bg-transparent",ti={bottom:"items-end justify-center",top:"items-start justify-center",left:"[justify-content:left]",right:"[justify-content:right]"},ni="[--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",si={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))]"},oi={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 xe(t,n){const s=d.useContext(ro);return s||ue(t,"must be rendered inside <SheetRoot>"),s}function ri({side:t="bottom",snapPoints:n,...s}){const o=s.modal!==!1,r=Ya.includes(t)?t:"bottom";V();const a=!!(n&&n.length>0);return e.jsx(ro.Provider,{value:{side:r,snap:a,modal:o},children:e.jsx(gr,{...s,disablePointerDismissal:s.disablePointerDismissal??!o,...n?{snapPoints:n}:{},swipeDirection:Qa[r]})})}function ai({onPointerDown:t,onKeyDown:n,...s}){return xe("SheetTrigger"),e.jsx(vr,{"data-slot":"sheet-trigger",...s.render===void 0?{className:"forced-colors:border forced-colors:border-solid","data-ouro-control":"sheet","data-ouro-part":"trigger"}:{},...s,onPointerDown:o=>{t==null||t(o),Ce.dialog.onPointerDown(o)},onKeyDown:o=>{n==null||n(o),Ce.dialog.onKeyDown(o)}})}function ii(t){return xe("SheetPortal"),e.jsx(jr,{children:e.jsx(yr,{"data-slot":"sheet-portal",...t,"data-ouro":"sheet-portal",className:"relative isolate z-(--ouro-layer) in-[[data-ouro$='-portal']]:z-1001 [--drawer-keyboard-inset:0px]",children:e.jsx(Jt,{children:t.children})})})}function li({ref:t,...n}){xe("SheetBackdrop");const s=oo(t);return e.jsx(Ls,{"data-slot":"sheet-overlay",...n,ref:s,"data-ouro":"sheet-backdrop",className:Za})}function ci({ref:t,...n}){xe("SheetScrim");const s=oo(t);return e.jsx(Ls,{"data-slot":"sheet-scrim",...n,forceRender:!0,ref:s,"aria-hidden":"true","data-ouro":"sheet-scrim-backdrop",className:ei})}function di(t){return d.useCallback(n=>{const s=t==="left"||t==="right";let o=!1;const r=()=>{const c=n.querySelector('[data-ouro="sheet"]');if(!c||c.style.transitionProperty==="none")return!1;const u=getComputedStyle(c),p=new DOMMatrixReadOnly(u.transform),f=s?0:parseFloat(u.getPropertyValue("--drawer-snap-point-offset"));return c.style.setProperty("--ouro-sheet-grab",`${(s?p.m41:p.m42)-f}px`),c.getAnimations().length>0},a=c=>{o=n.contains(c.target)&&r()},l=()=>{o&&(o=r())},i=()=>{o=!1};return addEventListener("pointerdown",a,!0),addEventListener("pointermove",l,!0),addEventListener("pointerup",i,!0),addEventListener("pointercancel",i,!0),()=>{removeEventListener("pointerdown",a,!0),removeEventListener("pointermove",l,!0),removeEventListener("pointerup",i,!0),removeEventListener("pointercancel",i,!0)}},[t])}function ui({ref:t,...n}){const{side:s,modal:o}=xe("SheetViewport"),r=ge(t,di(s));return e.jsx(wr,{"data-slot":"sheet-viewport",...n,ref:r,"data-ouro":"sheet-viewport","data-side":s,className:C("fixed inset-0 z-1000 flex overflow-clip touch-none",!o&&"pointer-events-none",ti[s])})}function mi({className:t,...n}){const{side:s,snap:o,modal:r}=xe("SheetPopup");return e.jsx(kr,{"data-slot":"sheet-content",...n,className:C(ni,si[s],s==="bottom"&&oi[o?"snap":"fit"],s==="top"&&o&&"h-[calc(100dvh-var(--ouro-sheet-gap))]",!r&&"pointer-events-auto",t),"aria-modal":r?"true":void 0,"data-ouro":"sheet","data-side":s,"data-snap-points":o?"":void 0,"data-modal":r?void 0:"false"})}function An(){const{side:t}=xe("SheetHandle");return t==="left"||t==="right"?null:e.jsx("div",{"data-slot":"sheet-handle","aria-hidden":"true","data-ouro-sheet-handle":"",className:"flex shrink-0 justify-center py-2 touch-none",children:e.jsx("div",{"data-slot":"sheet-handle-bar",className:"h-1.25 w-ouro-9 rounded-full bg-border"})})}function pi({visuallyHidden:t,...n}){return xe("SheetTitle"),e.jsx(Er,{"data-slot":"sheet-title",...n,"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 fi(t){return xe("SheetDescription"),e.jsx(Nr,{"data-slot":"sheet-description",...t,"data-ouro-sheet-description":"",className:"m-0 text-sm leading-5 text-muted-foreground"})}function hi({className:t,ref:n,...s}){const o=ge(n,Ka(s.tabIndex===void 0));return xe("SheetContent"),X("SheetContent",t,""),e.jsxs("div",{"data-slot":"sheet-body",className:"relative box-border flex min-h-0 flex-1 flex-col",children:[e.jsx(Cr,{"data-slot":"sheet-scroller","data-ouro-control":"sheet","data-ouro-part":"content",...s,ref:o,"data-ouro-sheet-content":"",className:C("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-slot":"sheet-focus-ring","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 xi(t){return xe("SheetClose"),e.jsx(Sr,{"data-slot":"sheet-close",...t.render===void 0?{className:"forced-colors:border forced-colors:border-solid","data-ouro-control":"sheet","data-ouro-part":"close"}:{},...t})}const bi="press absolute end-3 z-1 m-0 box-border inline-flex size-ouro-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 gi({title:t,hideTitle:n,closeLabel:s,description:o,side:r,snapPoints:a,snapPoint:l,modal:i=!0,closeOnOutsidePress:c=i,scrim:u=!1,children:p,className:f,trigger:b,open:m,onOpenChange:h,footer:x,presentation:v,finalFocus:y,initialFocus:j,closeDisabled:w,keepMounted:g,onOpenChangeComplete:E}){const $=!n||o!==void 0||!i,R=e.jsx(pi,{visuallyHidden:n,children:t});return e.jsxs(ri,{side:r,snapPoints:a,snapPoint:l,modal:i,disablePointerDismissal:!c,...m!==void 0?{open:m,onOpenChange:L=>h(L)}:{},...E?{onOpenChangeComplete:E}:{},children:[b!==void 0&&e.jsx(ai,{render:b}),e.jsxs(ii,{keepMounted:g,children:[i?e.jsx(li,{}):u&&e.jsx(ci,{}),e.jsx(ui,{children:e.jsxs(mi,{className:f,"data-ouro-presentation":v,...y?{finalFocus:typeof y=="object"?()=>Va(y.current):y}:{},initialFocus:j,children:[r==="bottom"&&e.jsx(An,{}),$?e.jsxs("div",{"data-slot":"sheet-header","data-ouro-sheet-header":"",className:"grid min-h-12 shrink-0 gap-1 ps-5 pe-14 pt-3 pb-2",children:[R,o!==void 0&&e.jsx(fi,{children:o})]}):R,e.jsx(hi,{children:p}),x!==void 0&&e.jsx("div",{"data-slot":"sheet-footer","data-ouro-footer":"",className:Xa,children:x}),r==="top"&&e.jsx(An,{}),e.jsxs(xi,{"data-ouro-sheet-close":"",disabled:w,className:`${bi} ${r==="bottom"&&$?"top-8.25":"top-3"}`,children:[e.jsx(ct,{}),e.jsx("svg",{"data-slot":"sheet-close-icon","aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",className:"size-ouro-4",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),e.jsx("span",{"data-slot":"sheet-close-label",className:"sr-only",children:s})]})]})})]})]})}const vi="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",ji="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",Ln=t=>d.isValidElement(t)?void 0:ji,Be="relative m-0 box-border flex w-full min-h-ouro-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-ouro-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",Je="justify-center px-0",Tn="flex size-ouro-5 shrink-0 items-center justify-center text-sm [&_svg]:size-ouro-5 [&_svg]:shrink-0",$n="m-0 grid grid-cols-1 list-none gap-1 p-0";function yi(t){const{label:n,sections:s,currentPath:o,header:r,footer:a,collapsible:l=!0,collapsed:i,defaultCollapsed:c=!1,onCollapsedChange:u,collapseLabel:p="Collapse sidebar",menuLabel:f="Menu",closeLabel:b="Close",className:m,ref:h,items:x,isCollapsed:v,pathname:y,children:j}=t;X("Sidebar",m,""),s.flatMap(A=>A.items).find(A=>A.items!==void 0),V();const w=Yt("(min-width: 640px)",!0),[g,E]=d.useState(!1),$=d.useRef(null);w&&g&&E(!1);const[R,L]=d.useState(c),I=i??R,_=()=>{L(!I),u==null||u(!I)},B=s.flatMap(A=>A.items.flatMap(k=>k.items!==void 0?k.items:[k])).filter(A=>A.href!==void 0),M=B.some(A=>A.current)?void 0:Mr(B.map(A=>A.href),o),W=A=>A.href!==void 0&&(!!A.current||A.href===M),[J,ee]=d.useState({}),F=(A,k)=>J[A]??k.items.some(W),q=d.useId(),K=(A,k)=>e.jsxs(e.Fragment,{children:[(A.icon!==void 0||k)&&e.jsx("span",{"aria-hidden":"true",className:Tn,children:A.icon!==void 0?A.icon:A.label.charAt(0).toUpperCase()}),e.jsx("span",{className:k?"sr-only":"min-w-0 flex-1 [overflow-wrap:anywhere]",children:A.label}),A.badge!==void 0&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{"data-ouro-sidebar-badge":"",className:k?"sr-only":Ln(A.badge),children:A.badge})]})]}),ie=(A,k,H)=>A?e.jsx(lt,{content:k,side:"right",children:H}):H,le=(A,k,H)=>ie(k,A.label,A.href!==void 0?e.jsx(Se,{href:A.href,"aria-current":W(A)?"page":void 0,"data-ouro-control":"sidebar","data-ouro-part":"link",onClick:z=>{var D;H==null||H(),(D=A.onClick)==null||D.call(A,z)},className:C(Be,k&&Je),children:K(A,k)}):e.jsx("button",{type:"button","data-ouro-control":"sidebar","data-ouro-part":"button",onClick:z=>{H==null||H(),A.onClick(z)},className:C(Be,k&&Je),children:K(A,k)})),se=(A,k,H)=>s.map((z,D)=>e.jsxs("div",{className:C("grid grid-cols-1 gap-1",D>0&&"border-0 border-t border-solid border-border pt-4"),children:[z.label!==void 0&&e.jsx("p",{id:`${q}${A}${D}`,className:k?"sr-only":"m-0 px-3 py-1 text-sm leading-5 font-semibold text-foreground",children:z.label}),e.jsx("ul",{"aria-labelledby":z.label!==void 0?`${q}${A}${D}`:void 0,className:$n,children:z.items.map((O,T)=>{if(O.items===void 0)return e.jsx("li",{children:le(O,k,H)},T);const P=O.items.some(W);if(k)return e.jsx("li",{children:e.jsx(Pa,{side:"right",closeLabel:b,trigger:e.jsx(lt,{content:O.label,side:"right",children:e.jsx("button",{type:"button","data-current":P?"":void 0,"data-ouro-control":"sidebar","data-ouro-part":"group",className:C(Be,"data-current:text-foreground",Je),children:K(O,!0)})}),children:O.items.map((me,gt)=>e.jsxs(no,{href:me.href,current:W(me),onClick:me.onClick,children:[me.label,me.badge!==void 0&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:C(Ln(me.badge),"ms-2"),children:me.badge})]})]},gt))})},T);const Y=`${D}-${T}`,be=F(Y,O);return e.jsxs("li",{children:[e.jsxs("button",{type:"button","aria-expanded":be,"aria-controls":`${q}${A}${Y}`,"data-ouro-control":"sidebar","data-ouro-part":"group","data-current":P&&!be?"":void 0,onClick:()=>ee({...J,[Y]:!be}),className:C(Be,"data-current:text-foreground"),children:[K(O,!1),e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:C("size-ouro-4 shrink-0 rtl:-scale-x-100",be&&"rotate-90 rtl:-rotate-90"),children:e.jsx("path",{d:"m6 4 4 4-4 4"})})]}),be&&e.jsx("ul",{id:`${q}${A}${Y}`,className:C($n,"ms-5 mt-1 border-0 border-s border-solid border-border ps-2"),children:O.items.map((me,gt)=>e.jsx("li",{children:le(me,!1,H)},gt))})]},T)})})]},D));return e.jsxs("div",{ref:h,"data-ouro":"sidebar","data-collapsed":I?"":void 0,className:C("max-sm:inline-flex sm:h-full",m),children:[e.jsx(re,{ref:$,"data-ouro-sidebar-menu":"","data-ouro-control":"sidebar","data-ouro-part":"menu",variant:"plain",tone:"secondary","aria-label":f,"aria-haspopup":w?void 0:"dialog","aria-expanded":g,onClick:()=>E(!0),className:"w-ouro-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-ouro-5",children:e.jsx("path",{d:"M3 5.5h14M3 10h14M3 14.5h14"})})}),w&&e.jsxs("nav",{"aria-label":n,"data-collapsed":I?"":void 0,className:vi,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 grid-cols-1 min-h-0 flex-1 content-start gap-6 overflow-y-auto overscroll-contain p-2",children:se("c",I)}),l&&e.jsx("div",{className:"shrink-0 p-2",children:e.jsxs("button",{type:"button","aria-pressed":I,"data-ouro-control":"sidebar","data-ouro-part":"collapse",onClick:_,className:C(Be,I&&Je),children:[e.jsx("span",{"aria-hidden":"true",className:Tn,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:I?"sr-only":"min-w-0 flex-1 [overflow-wrap:anywhere]",children:p})]})}),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(gi,{title:f,hideTitle:r!==void 0,closeLabel:b,side:"left",open:g,onOpenChange:E,finalFocus:$,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":n,className:"grid gap-6",children:se("d",!1,()=>E(!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 Nt="relative isolate box-border inline-flex shrink-0 items-center gap-1 align-middle h-ouro-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)]",Rn="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 data-disabled:cursor-not-allowed data-disabled:opacity-50",Ct={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 ce(t){const{tone:n="secondary",variant:s="solid",icon:o,dot:r=!1,onClick:a,children:l,className:i,color:c,asChild:u,...p}=t,f=Object.hasOwn(Ct.solid,n)?n:"secondary",b=Object.hasOwn(Ct,s)?s:"solid";X("Badge",i,""),V();const m=Ct[b][f],h=o&&e.jsx(o,{"aria-hidden":"true",className:"relative -ms-0.5 size-ouro-3_5 shrink-0"}),x=r&&e.jsx("span",{"data-slot":"badge-dot","data-ouro-dot":"","aria-hidden":"true",className:"relative size-ouro-1_5 shrink-0 rounded-full bg-current"});if(p.href!==void 0){const{type:L,disabled:I,..._}=p;return e.jsxs(Se,{"data-ouro-control":"badge","data-ouro-part":"root","data-slot":"badge",..._,onClick:a,"data-ouro":"badge","data-ouro-squircle":"",className:C(Nt,Rn,m,i),children:[e.jsx(ct,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),x,h,l]})}const{ref:v,type:y="button",disabled:j,...w}=p;if(a!==void 0)return e.jsxs(zs,{"data-ouro-control":"badge","data-ouro-part":"root","data-slot":"badge",...w,onClick:a,disabled:j,ref:v,type:y,"data-ouro":"badge","data-ouro-squircle":"",className:C(Nt,Rn,m,i),children:[e.jsx(ct,{}),e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),x,h,l]});const{name:g,value:E,form:$,...R}=w;return e.jsxs("span",{"data-slot":"badge",...R,ref:v,"data-ouro":"badge","data-ouro-squircle":"",className:C(Nt,m,i),children:[e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),x,h,l]})}const wi={lime:"success",red:"destructive",yellow:"warning",zinc:"secondary"};function U({color:t,children:n}){return e.jsx(ce,{tone:t&&wi[t]||"secondary",children:n})}const tn={start:"text-start",center:"text-center",end:"text-end"};function ao(t,n){return n===void 0||Object.hasOwn(tn,n)?[n,!1]:[void 0,!1]}const In={sm:"text-base",md:"text-lg tracking-[calc(-0.01em*var(--ouro-heading-tracking,1))]",lg:"text-xl tracking-[calc(-0.015em*var(--ouro-heading-tracking,1))]",xl:"text-2xl tracking-[calc(-0.02em*var(--ouro-heading-tracking,1))]","2xl":"text-3xl tracking-[calc(-0.025em*var(--ouro-heading-tracking,1))]",display:"text-[2.5rem] leading-[1.05] tracking-[calc(-0.035em*var(--ouro-heading-tracking,1))] sm:text-6xl sm:leading-[1.02]"},Mn={1:"2xl",2:"xl",3:"lg",4:"md",5:"sm",6:"sm"};function ht(t){const{level:n,size:s,align:o,truncate:r,className:a,ref:l,color:i,as:c,...u}=t,p=n,[f,b]=ao("Heading",o);(!(p in Mn)||typeof p!="number")&&ue("Heading",`level must be 1, 2, 3, 4, 5 or 6, got ${JSON.stringify(p)}`);const m=s!==void 0&&Object.hasOwn(In,s)?s:Mn[p];X("Heading",a,"",void 0),V();const h=`h${p}`,x=C("[@layer_ouro-reset]:m-0 font-[family-name:var(--font-heading,inherit)] font-semibold text-foreground",r?"truncate [text-wrap-style:auto]":"text-balance",In[m],f&&tn[f],a);return e.jsx(h,{...u,ref:l,"data-ouro":"heading",className:x})}const On={sm:"text-sm",md:"text-base",lg:"text-lg"},Pn={default:"text-foreground",muted:"text-muted-foreground",primary:"text-primary",secondary:"text-muted-foreground",destructive:"text-destructive",success:"text-success",warning:"text-warning"},ki=["p","span","div"];function N(t){const{as:n="p",size:s="md",tone:o="default",align:r,truncate:a,lines:l,className:i,style:c,ref:u,color:p,variant:f,...b}=t,m=Object.hasOwn(Pn,o)?o:"default",h=ki.includes(n)?n:"p",x=Object.hasOwn(On,s)?s:"md",[v,y]=ao("Text",r);X("Text",i,"",void 0),V();const j=C("[@layer_ouro-reset]:m-0",On[x],Pn[m],v&&tn[v],a?"truncate":"text-pretty",l!==void 0&&"line-clamp-(--ouro-lines)",i),w=l!==void 0?{...c,"--ouro-lines":l}:c;return e.jsx(h,{...b,ref:u,"data-ouro":"text",className:j,style:w})}const Dn={outline:"border border-dashed border-border rounded-ouro-xl",plain:""},St={center:"items-center text-center",start:"items-start text-start"},Ni=[2,3,4,5,6];function ne(t){const{title:n,description:s,icon:o,action:r,children:a,headingLevel:l=3,variant:i="outline",align:c="center",className:u,heading:p,message:f,actions:b,image:m,...h}=t,x=Ni.includes(l)?l:3,v=Object.hasOwn(Dn,i)?i:"outline",y=Object.hasOwn(St,c)?c:"center";return X("Empty",u,"",void 0),V(),e.jsxs("div",{...h,"data-ouro":"empty",className:C("flex min-w-0 flex-col gap-4 py-10 text-balance",!(v==="plain"&&y==="start")&&"px-6",Dn[v],St[y],u),children:[o&&e.jsx("div",{"aria-hidden":"true",className:"flex size-ouro-12 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground *:[svg]:size-ouro-6",children:o}),e.jsxs("div",{className:C("flex flex-col gap-1.5",St[y]),children:[e.jsx(ht,{level:x,size:"md",children:n}),s&&e.jsx(N,{as:"div",size:"sm",tone:"muted",children:s})]}),r&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r}),a&&e.jsx("div",{className:"w-full",children:a})]})}function nn(t){const{title:n,eyebrow:s,description:o,actions:r,breadcrumb:a,media:l,children:i,level:c=1,size:u="md",divider:p,className:f,subtitle:b,overline:m,action:h,image:x,heading:v,...y}=t,j=c===2?2:1,w=u==="lg"?"lg":"md";return X("PageHeader",f,""),V(),e.jsxs("div",{...y,"data-ouro":"page-header","data-size":w,className:C("grid min-w-0 gap-4",p&&"border-0 border-b border-solid border-border pb-6",f),children:[a!=null?e.jsx("div",{"data-slot":"breadcrumb",className:"min-w-0",children:a}):null,l!=null?e.jsx("div",{"data-slot":"media",className:"min-w-0 overflow-hidden rounded-ouro-lg bg-muted [&>img]:block [&>img]:h-full [&>img]:w-full [&>img]:object-cover",children:l}):null,e.jsxs("div",{className:"grid min-w-0 gap-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end",children:[e.jsxs("div",{className:"grid min-w-0 gap-2",children:[s!=null?e.jsx("p",{"data-slot":"eyebrow",className:"m-0 text-sm leading-5 font-medium text-muted-foreground",children:s}):null,e.jsx(ht,{level:j,size:w==="lg"?"display":j===1?"2xl":"xl",className:"min-w-0 break-words",children:n}),o!=null?e.jsx("div",{"data-slot":"description",className:"max-w-prose text-base leading-7 text-muted-foreground",children:o}):null,i!=null?e.jsx("div",{className:"min-w-0 pt-1",children:i}):null]}),r!=null?e.jsx("div",{"data-slot":"actions",className:"flex min-w-0 flex-wrap items-center gap-2 sm:justify-end",children:r}):null]})]})}function Ci(t){d.useEffect(()=>{if(!t)return;const n=t;function s(o){if(!(o.target instanceof HTMLInputElement||o.target instanceof HTMLTextAreaElement))switch(o.key){case"1":n({tab:"overview"});break;case"2":n({tab:"mail"});break;case"3":n({tab:"sessions"});break;case"4":n({tab:"work"});break;case"5":n({tab:"connections"});break;case"6":n({tab:"inner"});break;case"7":n({tab:"notes"});break;case"8":n({tab:"runtime"});break;case"Escape":{document.activeElement instanceof HTMLElement&&document.activeElement.blur();break}}}return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t])}const io="text-inherit no-underline outline-none after:absolute after:inset-0 after:z-1 after:content-['']",dt=io+" after:transition-colors after:duration-(--ouro-duration-fast) pointer-fine:hover:after:bg-foreground/[0.03] active:after:bg-foreground/[0.06]",sn="[:where(&_:is(a,button,input,select,textarea,label,summary,[tabindex]:not([tabindex='-1']),[role=button],[data-linked]):not([data-stretched-link]))]:relative [:where(&_:is(a,button,input,select,textarea,label,summary,[tabindex]:not([tabindex='-1']),[role=button],[data-linked]):not([data-stretched-link]))]:z-10",Si="a,button,input,select,textarea,label,summary,[tabindex]:not([tabindex='-1']),[role=button],[role=link],[contenteditable=true],[data-linked]";function $e(t){if(t.defaultPrevented||t.button!==(t.type==="auxclick"?1:0))return;const n=t.currentTarget;if(!n.contains(t.target))return;const s=n.querySelector(":scope [data-stretched-link]:not(:scope [data-linked] [data-stretched-link])"),o=t.target.closest(Si);if(!s||o&&o!==n&&n.contains(o))return;const r=n.ownerDocument.getSelection();if(r&&!r.isCollapsed&&r.containsNode(n,!0))return;const a=n.ownerDocument.defaultView;if(s instanceof HTMLAnchorElement&&(t.button===1||t.ctrlKey||t.metaKey||t.shiftKey)){a==null||a.open(s.href,"_blank","noopener");return}s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0,view:a,altKey:t.altKey}))}const Ei=["div","article","section","li"],_i=[2,3,4,5,6],Bn={outline:"rounded-ouro-xl border border-border bg-(--ouro-bg) border-(--ouro-bd) [--ouro-bg:var(--card)] [--ouro-bd:var(--border)] [--ouro-sq-w:1px] [--ouro-sq-r:calc(var(--radius)*var(--ouro-radius-scale,1)*1.4)] text-card-foreground shadow-(--shadow-xs)",plain:"bg-transparent text-foreground"},zi={outline:{md:"gap-6 py-6",sm:"gap-4 py-4"},plain:{md:"gap-4 py-0",sm:"gap-3 py-0"}},Fn={outline:{md:"px-6",sm:"px-4"},plain:{md:"px-0",sm:"px-0"}},Hn={outline:{md:"-mt-6",sm:"-mt-4"},plain:{md:"rounded-ouro-xl",sm:"rounded-ouro-lg"}},Ai={outline:{md:"rounded-[inherit]",sm:"rounded-[inherit]"},plain:{md:"rounded-ouro-xl",sm:"rounded-ouro-lg"}},Li="pointer-events-none absolute -z-1 overflow-clip",Ht={inset:"var(--ouro-card-backdrop-inset, calc(var(--ouro-sq-w, 0px) * -1))"},Ti={md:{...Ht,"--ouro-sq-w":"0px","--ouro-sq-r":"calc(var(--radius) * var(--ouro-radius-scale, 1) * 1.4)"},sm:{...Ht,"--ouro-sq-w":"0px","--ouro-sq-r":"calc(var(--radius) * var(--ouro-radius-scale, 1))"}},$i={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"},Ri={none:"transparent",hovered:"color-mix(in oklab, var(--foreground) 3%, transparent)",pressed:"color-mix(in oklab, var(--foreground) 6%, transparent)"},Ii="press cursor-pointer outline-ring -outline-offset-2 has-[[data-card-link]:focus-visible]:outline-2 has-[[data-card-link]:focus-visible]:outline-solid motion-safe:has-[[data-card-link]:active]:scale-(--ouro-press-scale)",Un="motion-safe:[&_:is(img,video)]:transition-transform motion-safe:[&_:is(img,video)]:duration-(--ouro-duration-base) motion-safe:[&_:is(img,video)]:ease-(--ouro-ease-out) motion-safe:pointer-fine:group-hover/card:[&_:is(img,video)]:scale-[1.03] motion-safe:group-has-[:focus-visible]/card:[&_:is(img,video)]:scale-[1.03]",Mi="grid grid-rows-[1fr] transition-[grid-template-rows,opacity] duration-(--ouro-duration-base) ease-(--ouro-ease-out) motion-reduce:transition-opacity motion-reduce:duration-(--ouro-duration-fast) pointer-fine:[@media(hover:hover)]:not-group-hover/card:not-group-has-[:focus-visible]/card:grid-rows-[0fr] pointer-fine:[@media(hover:hover)]:not-group-hover/card:not-group-has-[:focus-visible]/card:opacity-0",Oi="grid self-end [grid-area:1/1] text-(--card-foreground,var(--foreground)) [&_[data-card-reveal]>[data-ouro=text]]:text-[color-mix(in_oklab,var(--muted-foreground)_50%,var(--foreground))]",Pi="z-1 [grid-area:1/1] bg-[color-mix(in_oklab,var(--card,var(--background))_78%,transparent)] backdrop-blur-md backdrop-saturate-150 supports-[not(backdrop-filter:blur(1px))]:bg-(--card,var(--background)) [@media(prefers-reduced-transparency:reduce)]:bg-(--card,var(--background)) [@media(prefers-reduced-transparency:reduce)]:backdrop-filter-none contrast-more:bg-(--card,var(--background)) contrast-more:backdrop-filter-none contrast-more:border-t contrast-more:border-solid contrast-more:border-foreground forced-colors:bg-[Canvas] forced-colors:backdrop-filter-none forced-colors:border-t forced-colors:border-solid",Di="transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out) motion-reduce:duration-(--ouro-duration-fast) pointer-fine:[@media(hover:hover)]:not-group-hover/card:not-group-has-[:focus-visible]/card:opacity-0",Bi={sm:"max-sm:flex-col max-sm:gap-3",md:"max-md:flex-col max-md:gap-3"};function ae(t){const{href:n,title:s,external:o,linkRef:r,description:a,zoomMedia:l,revealDescription:i,action:c,media:u,backdrop:p,children:f,footer:b,stackBelow:m,headingLevel:h=3,variant:x="outline",size:v="md",as:y="div",className:j,subtitle:w,image:g,header:E,actions:$,to:R,asChild:L,interactive:I,..._}=t,S=d.useId(),B=Object.hasOwn(Bn,x)?x:"outline",M=v==="sm"?"sm":"md",W=Ei.includes(y)?y:"div",J=_i.includes(h)?h:3,ee=m==="sm"?"sm":m==="md"?"md":void 0,F=n!==void 0&&!!s,[q,K]=d.useState("none"),ie=!!p&&F,le=T=>T.target instanceof Element&&T.target.closest("[data-card-link]")!==null,se=F&&l===!0&&!!u,A=F&&(i===!0||i==="rise")&&!!a,k=A&&i==="rise"&&!!u;X("Card",j,""),V();const H=Fn[B][M],z=k?Fn.outline[M]:H,D=s?e.jsx(ht,{"data-slot":"card-title",level:J,size:M==="sm"?"sm":"md",children:F?e.jsxs(Se,{href:n,ref:r,target:o?"_blank":void 0,rel:o?pt(void 0):void 0,"data-card-link":"","data-stretched-link":"","data-ouro-control":"card","data-ouro-part":"link","aria-describedby":A?S:void 0,className:p?io:dt,children:[s,o&&e.jsx("span",{"data-slot":"card-link-note",className:"sr-only",children:" (opens in a new tab)"})]}):s}):null,O=T=>(D||a||c)&&e.jsxs("div",{"data-slot":"card-header",className:C("flex items-start gap-4",ee&&Bi[ee],z,T),children:[e.jsxs("div",{"data-slot":"card-text",className:"flex min-w-0 flex-1 flex-col gap-1",children:[D,a&&(A?e.jsx("div",{"data-slot":"card-reveal",id:S,"data-card-reveal":k?"rise":"",className:k?Mi:Di,children:e.jsx(N,{"data-slot":"card-description",as:"div",size:"sm",tone:"muted",className:k?"min-h-0 overflow-hidden":void 0,children:a})}):e.jsx(N,{"data-slot":"card-description",as:"div",size:"sm",tone:"muted",children:a}))]}),c&&e.jsx("div",{"data-slot":"card-action",className:"flex shrink-0 items-center gap-2",children:c})]});return d.createElement(W,{"data-slot":"card",..._,onClick:T=>{var P;return(P=_.onClick)==null||P.call(_,T),$e(T)},onAuxClick:T=>{var P;return(P=_.onAuxClick)==null||P.call(_,T),$e(T)},...ie&&{onPointerOver:T=>{var P;return(P=_.onPointerOver)==null||P.call(_,T),K(Y=>Y==="pressed"?Y:T.pointerType!=="touch"&&le(T)?"hovered":"none")},onPointerDown:T=>{var P;return(P=_.onPointerDown)==null||P.call(_,T),le(T)&&K("pressed")},onPointerUp:T=>{var P;return(P=_.onPointerUp)==null||P.call(_,T),K(T.pointerType!=="touch"&&le(T)?"hovered":"none")},onPointerCancel:T=>{var P;return(P=_.onPointerCancel)==null||P.call(_,T),K("none")},onPointerLeave:T=>{var P;return(P=_.onPointerLeave)==null||P.call(_,T),K("none")}},"data-ouro":"card","data-ouro-squircle":B==="outline"?"":void 0,"data-linked":F?"":void 0,"data-follows-link":F?"":void 0,className:C("relative isolate flex min-w-0 list-none flex-col",p?"overflow-visible":"overflow-hidden",Bn[B],zi[B][M],F&&Ii,(se||A)&&"group/card",F&&sn,j)},B==="outline"&&e.jsx("span",{"data-ouro-surface":"","aria-hidden":"true",style:{zIndex:-1}}),p&&e.jsxs("div",{"data-slot":"card-backdrop","data-card-backdrop":"","data-ouro-avatar-surface":"",className:C(Li,Ai[B][M]),style:B==="plain"?Ti[M]:Ht,children:[d.isValidElement(p)?d.cloneElement(p,{style:{...$i,...p.props.style}}):p,F&&e.jsx("span",{"data-card-tint":"","aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:Ri[q],transition:"background-color var(--ouro-duration-fast) ease"}})]}),u&&!k&&e.jsx("div",{"data-slot":"card-media",className:C("relative overflow-hidden",Hn[B][M],se&&Un),children:u}),k&&e.jsxs("div",{"data-slot":"card-rise",className:C("grid overflow-hidden",Hn[B][M]),children:[e.jsx("div",{"data-slot":"card-rise-media",className:C("relative overflow-hidden [grid-area:1/1]",se&&Un),children:u}),e.jsxs("div",{"data-slot":"card-rise-band",className:Oi,children:[e.jsx("div",{"aria-hidden":"true","data-slot":"card-rise-glass","data-card-glass":"",className:Pi}),O("z-2 py-3 [grid-area:1/1]")]})]}),!k&&O(),f&&e.jsx("div",{"data-slot":"card-content",className:C("min-w-0",H),children:f}),b&&e.jsx("div",{"data-slot":"card-footer",className:C("flex flex-wrap items-center gap-2",H),children:b}))}const Fi=["div","li","article"],qn={plain:"",outline:"rounded-ouro-xl border border-border px-4"},Wn={md:"py-3",sm:"py-2"},Vn={icon:"size-ouro-10 rounded-ouro-lg bg-muted text-muted-foreground flex items-center justify-center *:[svg]:size-ouro-5",sm:"size-ouro-10 rounded-ouro-md overflow-hidden *:size-full *:object-cover",md:"size-ouro-16 rounded-ouro-lg overflow-hidden *:size-full *:object-cover",lg:"size-ouro-28 rounded-ouro-lg overflow-hidden *:size-full *:object-cover"},Hi={icon:"self-start mt-0.75",sm:"self-start mt-0.75",md:"self-start",lg:"self-start"},Ui="transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out) motion-reduce:duration-(--ouro-duration-fast) pointer-fine:[@media(hover:hover)]:not-group-hover/item:not-group-focus-within/item:not-group-has-[[aria-expanded=true]]/item:opacity-0",qi={media:{actions:"grid-cols-[auto_minmax(0,1fr)_auto]",none:"grid-cols-[auto_minmax(0,1fr)]"},none:{actions:"grid-cols-[minmax(0,1fr)_auto]",none:"grid-cols-[minmax(0,1fr)]"}},Qe={media:{sm:{root:"max-sm:grid-cols-[auto_minmax(0,1fr)]",actions:"max-sm:col-start-2 max-sm:justify-start"},md:{root:"max-md:grid-cols-[auto_minmax(0,1fr)]",actions:"max-md:col-start-2 max-md:justify-start"}},none:{sm:{root:"max-sm:grid-cols-[minmax(0,1fr)]",actions:"max-sm:col-start-1 max-sm:justify-start"},md:{root:"max-md:grid-cols-[minmax(0,1fr)]",actions:"max-md:col-start-1 max-md:justify-start"}}},Wi="press cursor-pointer outline-ring -outline-offset-2 has-[[data-item-link]:focus-visible]:outline-2 has-[[data-item-link]:focus-visible]:outline-solid pointer-coarse:min-h-ouro-11",Vi="rounded-ouro-lg px-3",Ki="bg-accent text-accent-foreground [&_[data-ouro-text]]:text-[color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))]",Kn="forced-colors:after:border forced-colors:after:border-solid forced-colors:aria-[current]:after:border-2 forced-colors:aria-[current]:after:border-[Highlight]",Yi="m-0 cursor-pointer appearance-none border-0 bg-transparent p-0 text-start font-[inherit] [font-size:inherit] [line-height:inherit]",Yn={always:{root:{actions:"grid-cols-[minmax(0,1fr)_auto]",none:"grid-cols-[minmax(0,1fr)]"},media:"col-span-full w-full h-auto aspect-[4/3] rounded-ouro-lg"},sm:{root:{actions:"max-sm:grid-cols-[minmax(0,1fr)_auto]",none:"max-sm:grid-cols-[minmax(0,1fr)]"},media:"max-sm:col-span-full max-sm:w-full max-sm:h-auto max-sm:aspect-[4/3] max-sm:rounded-ouro-lg"},md:{root:{actions:"max-md:grid-cols-[minmax(0,1fr)_auto]",none:"max-md:grid-cols-[minmax(0,1fr)]"},media:"max-md:col-span-full max-md:w-full max-md:h-auto max-md:aspect-[4/3] max-md:rounded-ouro-lg"}};function G(t){const{href:n,title:s,external:o,linkRef:r,description:a,media:l,mediaSize:i="sm",mediaAbove:c,actions:u,revealActions:p,stackBelow:f,variant:b="plain",size:m="md",as:h="div",className:x,subtitle:v,icon:y,avatar:j,image:w,thumbnail:g,action:E,label:$,to:R,asChild:L,onSelect:I,selected:_,buttonRef:S,active:B,isSelected:M,current:W,...J}=t,ee=Object.hasOwn(qn,b)?b:"plain",F=Object.hasOwn(Wn,m)?m:"md",q=Object.hasOwn(Vn,i)?i:"sm",K=f==="sm"?"sm":f==="md"?"md":void 0,ie=c!==void 0&&Object.hasOwn(Yn,c)?c:void 0,le=Fi.includes(h)?h:"div",se=n!==void 0,A=!se&&I!==void 0,k=A||se&&_!==void 0,H=`${d.useId()}description`;X("Item",x,""),V();const z=p===!0&&!!u,D=l?"media":"none",O=l&&ie&&q!=="icon"?Yn[ie]:void 0,T=[];return K&&u&&(O?ie==="always"?T.push(Qe.none[K]):(T.push(Qe.media[K]),T.push(Qe.none[ie==="sm"||K==="sm"?"sm":"md"])):T.push(Qe[D][K])),d.createElement(le,{...J,onClick:P=>{var Y;return(Y=J.onClick)==null||Y.call(J,P),$e(P)},onAuxClick:P=>{var Y;return(Y=J.onAuxClick)==null||Y.call(J,P),$e(P)},"data-ouro":"item","data-linked":se||A?"":void 0,"data-follows-link":se||A?"":void 0,"data-choosable":k?"":void 0,className:C("relative isolate grid min-w-0 list-none items-center gap-x-4 gap-y-2",qi[D][u?"actions":"none"],O==null?void 0:O.root[u?"actions":"none"],T.map(P=>P.root),qn[ee],Wn[F],(se||A)&&Wi,(se||A)&&sn,k&&ee==="plain"&&Vi,k&&_&&Ki,z&&"group/item",x)},l&&e.jsx("div",{"aria-hidden":q==="icon"?!0:void 0,className:C("shrink-0",Vn[q],a&&!O&&Hi[q],O==null?void 0:O.media),children:l}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx("div",{className:C("text-base font-medium",k&&_?"text-accent-foreground":"text-foreground"),children:A?e.jsx("button",{type:"button",ref:S,onClick:I,"aria-current":_?"true":void 0,"aria-describedby":a?H:void 0,"data-item-link":"","data-stretched-link":"","data-ouro-control":"item","data-ouro-part":"select",className:C(Yi,dt,ee==="outline"?"after:rounded-ouro-xl":"after:rounded-ouro-lg",Kn),children:s}):se?e.jsxs(Se,{href:n,ref:r,target:o?"_blank":void 0,rel:o?pt(void 0):void 0,"aria-current":_?"page":void 0,"aria-describedby":a?H:void 0,"data-item-link":"","data-stretched-link":"","data-ouro-control":"item","data-ouro-part":"link",className:C(dt,ee==="outline"?"after:rounded-ouro-xl":k&&"after:rounded-ouro-lg",k&&Kn),children:[s,o&&e.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):s}),a&&e.jsx("div",{id:se||A?H:void 0,"data-ouro-text":"",className:"text-sm text-muted-foreground",children:a})]}),u&&e.jsx("div",{"data-item-actions":"",className:C("flex flex-wrap items-center justify-end gap-2",T.map(P=>P.actions),z&&Ui),children:u}))}const Gn="[&_[data-ouro=item][data-choosable]]:rounded-ouro-lg [&_[data-ouro=item][data-choosable]]:px-3",Gi="[&>li:first-child]:overflow-clip [&>li:first-child]:rounded-t-[calc(var(--radius-ouro-xl)-1px)] [&>li:last-child]:overflow-clip [&>li:last-child]:rounded-b-[calc(var(--radius-ouro-xl)-1px)]",Xn={divided:"[&>li:not(:last-child)]:border-b [&>li]:border-border [&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-0 "+Gn,outline:"rounded-ouro-xl border border-border bg-card text-card-foreground [&>li:not(:last-child)]:border-b [&>li]:border-border "+Gi+" [&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-4",plain:`[&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-0 ${Gn}`};function Z(t){const{label:n,children:s,empty:o,variant:r="divided",ordered:a,className:l,title:i,items:c,divided:u,...p}=t,f=d.useId(),b=Object.hasOwn(Xn,r)?r:"divided",m=d.Children.toArray(s);X("ItemGroup",l,""),V();const{"aria-label":h,"aria-labelledby":x,...v}=p,y=a?"ol":"ul";return e.jsxs("div",{...v,"data-ouro":"item-group",className:C("group/item-group flex min-w-0 flex-col gap-2",l),children:[n&&e.jsx("div",{id:f,className:C("text-sm font-medium text-muted-foreground",b!=="outline"&&"group-has-[[data-choosable]]/item-group:px-3"),children:n}),m.length>0?e.jsx(y,{"aria-label":h,"aria-labelledby":n?f:x,className:C("m-0 flex list-none flex-col p-0",Xn[b]),children:m.map((j,w)=>e.jsx("li",{className:"m-0 min-w-0 p-0",children:j},d.isValidElement(j)?j.key:w))}):o&&e.jsx("div",{className:"text-sm text-muted-foreground",children:o})]})}function te(t){const{title:n,meta:s,actions:o,level:r=2,divider:a=!0,className:l,count:i,description:c,action:u,heading:p,...f}=t,b=r===3?3:2;return X("SectionHeader",l,""),V(),e.jsxs("div",{...f,"data-ouro":"section-header",className:C("flex min-w-0 items-baseline gap-x-3",a&&"border-0 border-b border-solid border-border pb-2",l),children:[e.jsxs("div",{className:"flex min-w-0 grow flex-wrap items-baseline gap-x-3 gap-y-0.5",children:[e.jsx(ht,{level:b,size:b===2?"lg":"md",className:"min-w-0 grow break-words",children:n}),s!=null?e.jsx("p",{"data-slot":"meta",className:"m-0 text-xs leading-4 font-medium tracking-[0.08em] text-muted-foreground uppercase tabular-nums",children:s}):null]}),o!=null?e.jsx("div",{"data-slot":"actions",className:"flex shrink-0 items-baseline gap-3 text-sm",children:o}):null]})}const Xi='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Jn(t){return t.getClientRects().length>0&&t.closest('[inert], [aria-hidden="true"]')===null}function Ji(t,n){return(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&!t.contains(n)}function Qi(t,{within:n,fallback:s}={}){const o=t.ownerDocument;if(!t.contains(o.activeElement))return;const r=t.parentElement;if(r===null)return;const a=[{parent:r,previous:t.previousElementSibling}];r.matches('li, [role="listitem"]')&&r.childElementCount===1&&a.push({parent:r.parentElement,previous:r.previousElementSibling});const l=(n==null?void 0:n.parentElement)??null;queueMicrotask(()=>{const i=o.activeElement;if(i!==null&&i!==o.body&&i.isConnected)return;const c=a.find(b=>b.parent.isConnected);if(c===void 0)return;const{parent:u,previous:p}=c;let f=null;for(let b=u;b!==null&&b!==l;f=b,b=b.parentElement){const m=[...b.querySelectorAll(Xi)].filter(Jn);if(m.length===0)continue;const h=f??(p!=null&&p.isConnected?p:null);(m.find(v=>h===null||Ji(h,v))??m.at(-1)).focus();return}s!=null&&s.isConnected&&Jn(s)&&s.focus()})}function Zi(t){return d.useCallback(n=>n===null?void 0:()=>Qi(n,t==null?void 0:t(n)),[t])}const Et={primary:{root:"border-primary/30 bg-primary/5",accent:"text-[color-mix(in_oklab,var(--primary)_80%,var(--foreground))]"},secondary:{root:"border-border bg-card",accent:"text-foreground"},destructive:{root:"border-destructive/30 bg-destructive/5",accent:"text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))]"},success:{root:"border-success/30 bg-success/5",accent:"text-[color-mix(in_oklab,var(--success)_80%,var(--foreground))]"},warning:{root:"border-warning/30 bg-warning/5",accent:"text-[color-mix(in_oklab,var(--warning)_80%,var(--foreground))]"}},el=new Set(["destructive","warning"]);function Ye({children:t,...n}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",...n,children:t})}function Qn(t){return e.jsxs(Ye,{...t,children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5"}),e.jsx("path",{d:"M10 9v4.5M10 6.5v.01"})]})}function tl(t){return e.jsxs(Ye,{...t,children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5"}),e.jsx("path",{d:"m6.75 10.25 2.25 2.25 4.25-4.75"})]})}function nl(t){return e.jsxs(Ye,{...t,children:[e.jsx("path",{d:"M8.7 3.3a1.5 1.5 0 0 1 2.6 0l6 10.5a1.5 1.5 0 0 1-1.3 2.2H4a1.5 1.5 0 0 1-1.3-2.2z"}),e.jsx("path",{d:"M10 8v3.5M10 13.75v.01"})]})}function sl(t){return e.jsxs(Ye,{...t,children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5"}),e.jsx("path",{d:"m7.5 7.5 5 5m0-5-5 5"})]})}const ol={primary:Qn,secondary:Qn,destructive:sl,success:tl,warning:nl};function rl(t){return e.jsx(Ye,{...t,children:e.jsx("path",{d:"m5.5 5.5 9 9m0-9-9 9"})})}function fe(t){const{title:n,description:s,tone:o="secondary",action:r,onDismiss:a,dismissLabel:l="Dismiss",icon:i,className:c,variant:u,severity:p,status:f,onClose:b,children:m,ref:h,...x}=t,v=ge(h,Zi()),y=Object.hasOwn(Et,o)?o:"secondary";X("Alert",c,""),V();const j=i===void 0?ol[y]:i,w=Et[y].accent;return e.jsxs("div",{"data-slot":"alert",...x,ref:v,role:el.has(y)?"alert":"status","data-ouro":"alert","data-tone":y,className:C("box-border flex w-full items-start gap-3 rounded-ouro-lg border border-solid p-4 text-foreground",Et[y].root,c),children:[j&&e.jsx(j,{"aria-hidden":"true","data-slot":"alert-icon","data-ouro-alert-icon":"",className:C("mt-0.5 size-ouro-5 shrink-0",w)}),e.jsxs("div",{"data-slot":"alert-body",className:"flex min-w-0 flex-1 flex-col gap-1 [overflow-wrap:anywhere]",children:[e.jsx("div",{"data-slot":"alert-title","data-ouro-alert-title":"","data-ouro-text":"",className:C("text-base/6 font-medium sm:pointer-fine:text-sm/5",w),children:n}),s!==void 0&&e.jsx("div",{"data-slot":"alert-description","data-ouro-alert-description":"","data-ouro-text":"",className:"text-base/6 sm:pointer-fine:text-sm/5",children:s}),r!==void 0&&e.jsx("div",{"data-slot":"alert-action","data-ouro-alert-action":"",className:"mt-2 flex flex-wrap gap-2",children:r})]}),a&&e.jsx(re,{variant:"plain",tone:"secondary",size:"sm","aria-label":l,"data-ouro-control":"alert","data-ouro-part":"dismiss",onClick:()=>a(),className:"-my-1.5 -me-2 w-(--ouro-button-h) px-0",children:e.jsx(rl,{"aria-hidden":"true",className:"size-ouro-4"})})]})}function al({view:t,nav:n}){const{agent:s,work:o}=t,r=s.degraded,a=(l,i)=>e.jsx(re,{variant:"plain",tone:"primary",size:"inline",onClick:()=>n({tab:l}),children:i});return e.jsx(ae,{headingLevel:2,title:"Center of gravity",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(N,{as:"p",size:"lg",className:"font-semibold",children:s.attention.label}),e.jsxs(N,{size:"sm",tone:"muted",children:[s.agentName," has"," ",a("work",`${o.tasks.liveCount} live tasks`),","," ",a("work",`${o.obligations.openCount} obligations`),","," ",a("work",`${o.coding.activeCount} coding lanes`),", and"," ",a("sessions",`${o.sessions.liveCount} live sessions`),"."]}),r.status==="degraded"&&r.issues.length>0&&e.jsx(fe,{tone:"destructive",title:"Runtime issues",description:e.jsx(Z,{"aria-label":"Runtime issues",children:r.issues.slice(0,5).map((l,i)=>e.jsx(G,{size:"sm",title:l.code,description:de(l.detail,80),onSelect:()=>n({tab:"runtime"})},i))}),action:r.issues.length>5?e.jsxs(re,{variant:"plain",tone:"primary",size:"sm",onClick:()=>n({tab:"runtime"}),children:["+",r.issues.length-5," more issues"]}):void 0})]})})}const il={sm:{root:"@container grid-cols-(--ouro-dl-cols) [--ouro-dl-cols:min(40%,14rem)_minmax(0,1fr)]",term:"col-span-full @md:col-span-1 pt-3 pb-1 @md:py-3 first:pt-0 @md:first:pt-0",details:"col-span-full @md:col-span-1 pb-3 @md:border-t @md:border-border @md:py-3 @md:nth-2:border-t-0 @md:nth-2:pt-0"},md:{root:"@container grid-cols-(--ouro-dl-cols) [--ouro-dl-cols:min(40%,14rem)_minmax(0,1fr)]",term:"col-span-full @lg:col-span-1 pt-3 pb-1 @lg:py-3 first:pt-0 @lg:first:pt-0",details:"col-span-full @lg:col-span-1 pb-3 @lg:border-t @lg:border-border @lg:py-3 @lg:nth-2:border-t-0 @lg:nth-2:pt-0"}};function he(t){const{items:n,stackBelow:s="sm",className:o,data:r,children:a,...l}=t,i=n??[],c=s==="md"?"md":"sm";X("DescriptionList",o,""),V();const u=il[c];return e.jsx("dl",{...l,"data-ouro":"description-list",className:C("[@layer_ouro-reset]:m-0 grid w-full min-w-0 text-base pointer-fine:text-sm",u.root,o),children:i.map((p,f)=>{const b=p;return e.jsxs(d.Fragment,{children:[e.jsx("dt",{className:C("m-0 border-t border-border font-normal text-muted-foreground wrap-break-word first:border-t-0",u.term),children:p.term??b.label}),e.jsx("dd",{className:C("m-0 text-foreground wrap-break-word",u.details),children:p.details??b.value??b.description})]},f)})})}const Zn={horizontal:"h-px w-full",vertical:"w-px self-stretch"},es="h-px min-w-0 flex-1 shrink border-0",_t={primary:{line:"bg-primary forced-colors:bg-[CanvasText]",label:"text-primary"},destructive:{line:"bg-destructive forced-colors:bg-[CanvasText]",label:"text-destructive"},success:{line:"bg-success forced-colors:bg-[CanvasText]",label:"text-success"},warning:{line:"bg-warning forced-colors:bg-[CanvasText]",label:"text-warning"}};function ye(t){const{orientation:n="horizontal",decorative:s,tone:o,label:r,className:a,vertical:l,children:i,text:c,...u}=t,p=Object.hasOwn(Zn,n)?n:"horizontal",f=r!=null&&r!==!1,b=Object.hasOwn(_t,String(o))?o:void 0,m=b?_t[b].line:"bg-border",h=b?_t[b].label:"text-muted-foreground";return X("Separator",a,""),V(),f?e.jsxs("div",{"data-slot":"separator",...u,"data-ouro":"separator","data-orientation":"horizontal",className:C("flex w-full min-w-0 items-center gap-3",a),children:[e.jsx(We,{role:"none","aria-orientation":void 0,"data-slot":"separator-line",className:C(es,m)}),e.jsx("span",{"data-slot":"separator-label",className:C("max-w-full shrink-0 text-center text-sm leading-5",h),children:r}),e.jsx(We,{role:"none","aria-orientation":void 0,"data-slot":"separator-line",className:C(es,m)})]}):e.jsx(We,{"data-slot":"separator",...u,orientation:p,...s?{role:"none","aria-orientation":void 0}:{},"data-ouro":"separator",className:C("shrink-0 border-0",m,Zn[p],a)})}const ts=1e3,ll=2400;function ns(t,n,s,o){const r=n===0&&t-s>ts?t:o,a=t-r;return{start:r,delay:`${-((a-ts)%ll)}ms`}}const lo="relative block overflow-hidden bg-muted animate-[ouro-skeleton-breathe_2.4s_ease-in-out_var(--ouro-skeleton-delay,1s)_infinite] motion-reduce:animate-none forced-colors:outline forced-colors:outline-1 forced-colors:-outline-offset-1 forced-colors:outline-[CanvasText]",cl="ouro-skeleton-breathe",co="animate-none",dl=24;let Fe=0,ss=0,os=Number.NEGATIVE_INFINITY;function ul(t){const[n,s]=d.useState({breathes:!0,delay:void 0}),o=d.useRef(void 0),r=d.useRef(new Map),a=d.useRef(new Map),l=d.useCallback(i=>{let c=a.current.get(i);return c||(c=u=>{u?r.current.set(i,u):r.current.delete(i)},a.current.set(i,c)),c},[]);return d.useLayoutEffect(()=>{if(!t)return;const i=Fe<dl;let c;if(i){const u=ns(performance.now(),Fe,os,ss);ss=u.start,c=u.delay,o.current=u.start}return s({breathes:i,delay:c}),Fe+=i?1:0,()=>{Fe-=i?1:0,Fe===0&&(os=performance.now())}},[t]),d.useLayoutEffect(()=>{if(!t||n.delay===void 0||o.current===void 0)return;const i=o.current,c=Number.parseFloat(n.delay);let u=!1;const p=requestAnimationFrame(()=>{/* istanbul ignore next @preserve -- cancelAnimationFrame below always runs before a cancelled frame could
|
|
2
|
+
fire, so this callback never actually observes cancelled true; the guard only protects a browser race
|
|
3
|
+
no test can force. */var m;if(u)return;const f=Number.parseFloat(ns(performance.now(),1,0,i).delay),b=c-f;for(const h of r.current.values())for(const x of((m=h.getAnimations)==null?void 0:m.call(h,{subtree:!0}))??[]){/* istanbul ignore next @preserve -- registerNode only ever sees this component's own Bar elements,
|
|
4
|
+
which carry no animation but the breathe one this component applies itself, so the non-matching
|
|
5
|
+
branch never runs. */x instanceof CSSAnimation&&x.animationName===cl&&(x.currentTime=b)}});return()=>{u=!0,cancelAnimationFrame(p)}},[t,n.delay]),{breathes:t&&n.breathes,style:n.delay===void 0?void 0:{"--ouro-skeleton-delay":n.delay},registerNode:l}}const rs={rect:"h-ouro-4 w-full rounded-ouro-md",circle:"aspect-square rounded-full"},uo={xs:"w-ouro-6",sm:"w-ouro-8",md:"w-ouro-10",lg:"w-ouro-12",xl:"w-ouro-16","2xl":"w-ouro-18","3xl":"w-ouro-28"},mo={sm:"text-sm",md:"text-base",lg:"text-lg"},we="flex h-[1lh] items-center",ml="h-[0.75em] rounded-ouro-sm",po={md:"py-3",sm:"py-2"},fo={md:{root:"gap-6 py-6",pad:"px-6",title:"text-lg"},sm:{root:"gap-4 py-4",pad:"px-4",title:"text-base"}},as=["w-2/3","w-1/2","w-3/4","w-1/3","w-1/2"],is=["w-full","w-3/4","w-full","w-2/3","w-3/4"],ho={rect:{},text:mo,circle:uo,row:po,card:fo},pl=Object.keys(ho);function ls(t){return Math.max(1,Number.isInteger(t)?t:1)}function ve({className:t,shimmer:n}){return e.jsx("span",{className:C(lo,!n&&co,ml,t)})}function Ie(t){const{shape:n="rect",size:s,lines:o,count:r,className:a,shimmer:l=!0,variant:i,animation:c,width:u,height:p,ref:f,...b}=t,{breathes:m,style:h,registerNode:x}=ul(l),v=ge(f,x(0)),y=pl.includes(n)?n:"rect",j=ho[y],g=s===void 0||Object.hasOwn(j,s)?s:void 0;X("Skeleton",a,""),V();const E={"aria-hidden":!0,"data-ouro":"skeleton","data-shape":y};if(y==="rect"||y==="circle"){const L=y==="circle"?C(rs.circle,uo[g??"md"]):rs.rect;return e.jsx("span",{...b,...E,ref:v,style:h?{...b.style,...h}:b.style,className:C(lo,!m&&co,L,a)})}if(y==="text"){const L=ls(o);return e.jsx("span",{...b,...E,ref:v,style:h?{...b.style,...h}:b.style,className:C("block w-full",g&&mo[g],a),children:Array.from({length:L},(I,_)=>e.jsx("span",{className:we,children:e.jsx(ve,{shimmer:m,className:L>1&&_===L-1?"w-2/3":"w-full"})},_))})}const $=g??"md",R=ls(r);return e.jsx(e.Fragment,{children:Array.from({length:R},(L,I)=>{const _=I===0?{...b,ref:v}:{...b,id:void 0,ref:x(I)},S=as[I%as.length],B=is[I%is.length];if(y==="row")return e.jsxs("span",{..._,...E,style:h?{..._.style,...h}:_.style,className:C("grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4",po[$],a),children:[e.jsx(ve,{shimmer:m,className:"mt-0.75 size-ouro-10 self-start rounded-ouro-md"}),e.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx("span",{className:C(we,"text-base"),children:e.jsx(ve,{shimmer:m,className:S})}),e.jsx("span",{className:C(we,"text-sm"),children:e.jsx(ve,{shimmer:m,className:B})})]})]},I);const M=fo[$];return e.jsxs("span",{..._,...E,style:h?{..._.style,...h}:_.style,className:C("flex min-w-0 flex-col overflow-hidden rounded-ouro-xl border border-border bg-card",M.root,a),children:[e.jsxs("span",{className:C("flex min-w-0 flex-col gap-1",M.pad),children:[e.jsx("span",{className:C(we,M.title),children:e.jsx(ve,{shimmer:m,className:S})}),e.jsx("span",{className:C(we,"text-sm"),children:e.jsx(ve,{shimmer:m,className:B})})]}),e.jsxs("span",{className:C("block min-w-0 text-sm",M.pad),children:[e.jsx("span",{className:we,children:e.jsx(ve,{shimmer:m,className:"w-full"})}),e.jsx("span",{className:we,children:e.jsx(ve,{shimmer:m,className:"w-2/3"})})]})]},I)})})}const cs="grid gap-4 sm:grid-cols-3";function fl({continuity:t}){if(t===null)return e.jsx("div",{"aria-busy":"true",className:cs,"data-testid":"continuity-loading",children:["Presence","Cares","Episodes"].map(o=>e.jsx(ae,{headingLevel:2,title:o,children:e.jsx(Ie,{shape:"text",size:"sm",lines:2})},o))});const n=t.presence.self,s=t.presence.peers;return e.jsxs("div",{className:cs,children:[e.jsxs(ae,{headingLevel:2,title:"Presence",children:[n?e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{size:"sm",children:n.availability}),(n.lane||n.tempo)&&e.jsx(he,{items:[...n.lane?[{term:"Lane",details:n.lane}]:[],...n.tempo?[{term:"Tempo",details:n.tempo}]:[]]})]}):e.jsx(ne,{variant:"plain",align:"start",headingLevel:3,title:"No presence data"}),s.length>0&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(ye,{label:"Peers"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(o=>e.jsx(U,{color:o.availability==="active"?"lime":"zinc",children:o.agentName},o.agentName))})]})]}),e.jsx(ae,{headingLevel:2,title:`Cares (${t.cares.activeCount})`,children:e.jsx(Z,{"aria-label":"Cares",empty:e.jsx(ne,{variant:"plain",align:"start",headingLevel:3,title:"No active cares"}),children:t.cares.items.slice(0,5).map(o=>e.jsx(G,{size:"sm",title:o.label,actions:e.jsx(U,{color:o.salience==="high"?"red":o.salience==="medium"?"yellow":"zinc",children:o.salience})},o.id))})}),e.jsx(ae,{headingLevel:2,title:`Episodes (${t.episodes.recentCount})`,children:e.jsx(Z,{"aria-label":"Episodes",empty:e.jsx(ne,{variant:"plain",align:"start",headingLevel:3,title:"No recent episodes"}),children:t.episodes.items.slice(0,5).map(o=>e.jsx(G,{size:"sm",title:o.summary,description:oe(o.timestamp),actions:e.jsx(U,{color:"zinc",children:o.kind})},o.id))})})]})}const hl={"owed-reply":"red","blocking-obligation":"red","broken-return":"red","stale-delegation":"yellow","return-ready":"lime","overdue-habit":"yellow"},xl={"owed-reply":"owed reply","blocking-obligation":"blocking","broken-return":"broken return","stale-delegation":"stale","return-ready":"ready to return","overdue-habit":"overdue"},bl={"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"},gl=new Set(["stale-delegation"]),vl=new Set(["owed-reply","blocking-obligation","broken-return","return-ready","overdue-habit"]);function xo(t,n){return fetch(`/api/agents/${encodeURIComponent(t)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:n})})}function jl({needsMe:t,setNeedsMe:n,agentName:s,nav:o}){const r=t.items.filter(i=>vl.has(i.urgency)),a=t.items.filter(i=>gl.has(i.urgency)),l=()=>Q(`/agents/${encodeURIComponent(s)}/needs-me`).then(n);return e.jsxs("div",{className:"space-y-4",children:[r.length>0&&e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{title:"Action now",meta:r.length}),e.jsx(Z,{variant:"outline","aria-label":"Action now",children:r.map((i,c)=>e.jsx(ds,{item:i,nav:o,agentName:s,onDismiss:()=>{n(u=>u&&{items:u.items.filter((p,f)=>t.items.indexOf(i)!==f)})}},`action-${c}`))})]}),a.length>0&&e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{title:"Stale",meta:a.length,actions:e.jsx(re,{variant:"plain",tone:"warning",size:"sm",onClick:async()=>{var i;for(const c of a)(i=c.ref)!=null&&i.focus&&await xo(s,c.ref.focus);l()},children:"Clear all stale"})}),e.jsx(Z,{variant:"outline","aria-label":"Stale",children:a.map((i,c)=>e.jsx(ds,{item:i,nav:o,agentName:s,onDismiss:()=>{l()}},`stale-${c}`))})]})]})}function yl(t){return t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function ds({item:t,nav:n,agentName:s,onDismiss:o}){var a;const r=(a=t.ref)==null?void 0:a.focus;return e.jsx(G,{title:t.label,onSelect:()=>t.ref&&n({tab:t.ref.tab,focus:t.ref.focus}),description:e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"sm",tone:"muted",truncate:!0,children:t.detail}),e.jsx(N,{size:"sm",tone:"muted",children:bl[t.urgency]??""})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{color:hl[t.urgency]??"zinc",children:xl[t.urgency]??t.urgency}),t.ageMs!=null&&e.jsx(N,{as:"span",size:"sm",tone:"muted",className:"tabular-nums",children:yl(t.ageMs)}),r&&e.jsx(re,{variant:"plain",tone:"secondary",size:"sm","aria-label":"Dismiss",title:"Dismiss",onClick:async l=>{l.stopPropagation(),await xo(s,r),o()},children:"✕"})]})})}function wl({orientation:t,nav:n}){if(t===null)return e.jsx(Ie,{className:"min-h-40","data-testid":"orientation-loading"});const s=t.currentSession,o=t.primaryObligation,r=t.resumeHandle,a=r?[["Lane",r.lane],["Artifact",r.artifact],["Next",r.nextAction],["Blocked",r.blockerOrWaitingOn]].flatMap(([l,i])=>i?[{term:l,details:i}]:[]):[];return e.jsx(ae,{headingLevel:2,title:"Orientation",className:"min-h-40","data-testid":"orientation-loaded",children:e.jsxs("div",{className:"space-y-3",children:[s&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{color:"lime",children:"active session"}),e.jsxs(re,{variant:"plain",tone:"primary",size:"inline",onClick:()=>n({tab:"sessions",focus:`${s.friendId}/${s.channel}/${s.key}`}),children:[s.channel,"/",s.key]}),s.lastActivityAt&&e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(s.lastActivityAt)})]}),o&&e.jsx(G,{variant:"outline",size:"sm",title:de(o.content,80),description:(o.nextAction||o.waitingOn)&&e.jsxs(e.Fragment,{children:[o.nextAction&&e.jsxs(N,{size:"sm",tone:"muted",children:["Next: ",o.nextAction]}),o.waitingOn&&e.jsxs(N,{size:"sm",tone:"muted",children:["Waiting on: ",o.waitingOn]})]}),actions:e.jsx(U,{color:"yellow",children:o.status})}),r&&e.jsx(ae,{size:"sm",headingLevel:3,title:"Resume handle",action:e.jsxs(U,{color:r.confidence==="high"?"lime":r.confidence==="medium"?"yellow":"zinc",children:[r.confidence," confidence"]}),children:a.length>0&&e.jsx(he,{items:a})}),t.otherActiveSessions.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{level:3,divider:!1,title:"Other sessions",meta:t.otherActiveSessions.length}),e.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5",children:t.otherActiveSessions.slice(0,5).map(l=>e.jsx(re,{variant:"plain",tone:"primary",size:"inline",onClick:()=>n({tab:"sessions",focus:`${l.friendId}/${l.channel}/${l.key}`}),children:l.friendName},`${l.friendId}/${l.channel}/${l.key}`))})]})]})})}const kl=new Set(["spawning","running","waiting_input","stalled"]);function Nl({view:t,deskPrefs:n,refreshGeneration:s}){const o=mt(),[r,a]=d.useState(null),[l,i]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState(null),[b,m]=d.useState(null),h=t.agent,x=t.work,v=t.inner,y=t.activity,j=x.tasks,w=x.obligations,g=x.sessions,E=x.coding,$=h.senses,R=x.bridges;d.useEffect(()=>{Q(`/agents/${encodeURIComponent(h.agentName)}/needs-me`).then(a),Q(`/agents/${encodeURIComponent(h.agentName)}/coding`).then(i),Q(`/agents/${encodeURIComponent(h.agentName)}/continuity`).then(u).catch(()=>{}),Q(`/agents/${encodeURIComponent(h.agentName)}/orientation`).then(f).catch(()=>{}),Q(`/agents/${encodeURIComponent(h.agentName)}/changes`).then(m).catch(()=>{})},[h.agentName,s]);const L=(n==null?void 0:n.pinnedConstellations)??[],I=(l==null?void 0:l.items.filter(S=>kl.has(S.status)))??[],_=w.items.filter(S=>S.status==="fulfilled");return e.jsxs("div",{className:"space-y-6",children:[r&&r.items.length>0&&e.jsx(jl,{needsMe:r,setNeedsMe:a,agentName:h.agentName,nav:o}),(n==null?void 0:n.carrying)&&e.jsx(ae,{headingLevel:2,title:"What I'm carrying",children:e.jsx(N,{size:"sm",children:n.carrying})}),L.length>0&&e.jsx(ke,{title:"Pinned threads",children:e.jsx(Z,{variant:"outline","aria-label":"Pinned threads",children:L.map((S,B)=>e.jsx(G,{title:S.label,description:e.jsxs("span",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[S.friendIds.map(M=>e.jsxs(zt,{onClick:()=>o({tab:"sessions"}),children:["friend:",M.slice(0,8),"…"]},M)),S.taskRefs.map(M=>e.jsxs(zt,{onClick:()=>o({tab:"work"}),children:["task:",M]},M)),S.bridgeIds.map(M=>e.jsxs(zt,{onClick:()=>o({tab:"connections",focus:M}),children:["bridge:",M.slice(0,8),"…"]},M))]})},B))})}),e.jsx(al,{view:t,nav:o}),e.jsx(wl,{orientation:p,nav:o}),b&&b.changeCount>0&&e.jsxs(ke,{title:"What changed",meta:b.changeCount,children:[b.snapshotAge&&e.jsxs(N,{size:"sm",tone:"muted",children:["Since ",oe(b.snapshotAge)]}),e.jsx(Z,{"aria-label":"What changed",children:b.items.slice(0,8).map((S,B)=>e.jsx(G,{size:"sm",title:e.jsx("span",{className:"block truncate",children:S.summary}),actions:e.jsx(U,{color:S.kind.includes("status")?"yellow":"zinc",children:S.kind.replace(/_/g," ")})},B))}),b.items.length>8&&e.jsxs(N,{size:"sm",tone:"muted",children:["+",b.items.length-8," more changes"]})]}),e.jsx(fl,{continuity:c}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsx(Ze,{label:"Tasks",value:j.liveCount,sub:`${j.blockedCount} blocked`,onClick:()=>o({tab:"work"})}),e.jsx(Ze,{label:"Obligations",value:w.openCount,sub:`${g.liveCount} sessions`,onClick:()=>o({tab:"work"})}),e.jsx(Ze,{label:"Coding",value:E.activeCount,sub:`${E.blockedCount} blocked`,onClick:()=>o({tab:"work"})}),e.jsx(Ze,{label:"Private Runtime",value:v.status,sub:de(v.summary??"",30),onClick:()=>o({tab:"inner"})})]}),I.length>0&&e.jsx(ke,{title:"Active coding",meta:I.length,children:e.jsx(Z,{variant:"outline","aria-label":"Active coding",children:I.map(S=>e.jsx(G,{size:"sm",title:`${S.runner} — ${de(S.workdir,40)}`,onSelect:()=>o({tab:"work"}),actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{color:S.status==="running"?"lime":S.status==="waiting_input"?"yellow":"zinc",children:S.status}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(S.lastActivityAt)})]})},S.id))})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(ke,{title:"Senses",children:$.length>0?e.jsx("div",{className:"flex flex-wrap gap-1.5",children:$.map(S=>e.jsx(U,{color:"lime",children:S},S))}):e.jsx(ne,{variant:"plain",align:"start",title:"No active senses"})}),e.jsx(ke,{title:"Bridges",children:R.length>0?e.jsx("div",{className:"flex flex-wrap gap-1.5",children:R.map(S=>e.jsx(ce,{tone:"success",onClick:()=>o({tab:"connections",focus:S}),children:S},S))}):e.jsx(ne,{variant:"plain",align:"start",title:"No active bridges"})})]}),_.length>0&&e.jsx(ke,{title:"Recently closed",children:e.jsx(Z,{"aria-label":"Recently closed",children:_.slice(0,3).map((S,B)=>e.jsx(G,{size:"sm",title:e.jsx("span",{className:"block truncate",children:de(S.content,80)}),actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{color:"lime",children:"closed"}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(S.updatedAt)})]})},B))})}),e.jsx(ke,{title:"Recent activity",children:e.jsx(Z,{"aria-label":"Recent activity",empty:e.jsx(ne,{variant:"plain",align:"start",title:"No recent activity yet."}),children:y.recent.map((S,B)=>{const M=S.kind==="coding"||S.kind==="obligation"?"work":S.kind==="session"?"sessions":"inner";return e.jsx(G,{title:de(S.label,100),description:e.jsx("span",{className:"block truncate",children:de(S.detail,80)}),onSelect:()=>o({tab:M}),actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{children:S.kind}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(S.at)})]})},B)})})})]})}function zt({onClick:t,children:n}){return e.jsx(re,{variant:"plain",tone:"primary",size:"inline",onClick:t,children:n})}function Ze({label:t,value:n,sub:s,onClick:o}){return e.jsx(G,{variant:"outline",size:"sm",title:t,description:e.jsxs(e.Fragment,{children:[e.jsx(N,{as:"span",size:"lg",className:"block tabular-nums text-foreground",children:n}),e.jsx("span",{className:"block truncate",children:s})]}),onSelect:o})}function ke({title:t,meta:n,children:s}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{title:t,meta:n}),s]})}function Ve(t){return t.length>0?t.join(", "):"(unknown)"}function bo(t){return t.subject||"(no subject)"}function go(t){return t.provenance.compartmentKind==="delegated"?`delegated human mailbox · ${t.provenance.ownerEmail??"unknown owner"} / ${t.provenance.source??"unknown source"}`:"native agent mailbox"}function Cl(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 Sl(t){return t.sendAuthority==="agent-native"?"native agent mailbox":t.mailboxRole}function El(t){return t.transport??t.provider??"not sent"}function _l(t){return t.deliveredAt??t.failedAt??t.acceptedAt??t.sentAt??t.submittedAt??t.updatedAt}const zl={screener:"warning",discarded:"destructive",quarantine:"destructive",sent:"success",draft:"primary"};function on({placement:t}){return e.jsx(ce,{tone:zl[t]??"secondary",variant:"soft",children:t})}function Al({folderLabel:t,messages:n,outbound:s,selectedId:o,onSelect:r}){const a=s.length>0;return e.jsxs("div",{className:"space-y-2",children:[e.jsx(te,{level:3,title:t,meta:a?`${s.length} outbound records`:`${n.length} messages`}),e.jsx("div",{className:"max-h-[66vh] overflow-y-auto",children:e.jsx(Z,{"aria-label":`${t} messages`,empty:e.jsx(ne,{variant:"plain",title:"No records here."}),children:a?s.map(l=>e.jsx(Tl,{record:l},l.id)):n.map(l=>e.jsx(Ll,{message:l,selected:o===l.id,onSelect:()=>r(l.id)},l.id))})})]})}function Ll({message:t,selected:n,onSelect:s}){return e.jsx(G,{selected:n,onSelect:s,title:e.jsx("span",{className:"block truncate",children:Ve(t.from)}),actions:e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:oe(t.receivedAt)}),description:e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{as:"span",size:"sm",truncate:!0,className:"block",children:bo(t)}),e.jsx(N,{as:"span",size:"sm",tone:"muted",lines:2,className:"block",children:de(t.snippet,150)}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e.jsx(on,{placement:t.placement}),e.jsx("span",{className:"truncate text-xs",children:go(t)})]})]})})}function Tl({record:t}){const n=t.deliveryEvents[t.deliveryEvents.length-1];return e.jsx(G,{title:e.jsx("span",{className:"block truncate",children:t.subject||"(no subject)"}),actions:e.jsx(on,{placement:t.status}),description:e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsxs("p",{className:"truncate",children:["to ",Ve(t.to)]}),e.jsxs("p",{children:[El(t)," · ",oe(_l(t))]}),e.jsxs("p",{className:"truncate",children:[Sl(t)," · ",t.sendMode??"mode unknown",t.policyDecision?` · policy ${t.policyDecision.code} / ${t.policyDecision.fallback}`:""]}),(t.providerMessageId||t.providerRequestId)&&e.jsxs("p",{className:"truncate",children:["provider ",t.providerMessageId??"unknown",t.providerRequestId?` · request ${t.providerRequestId}`:""]}),n&&e.jsx("p",{className:"line-clamp-2",children:n.bodySafeSummary})]})})}function $l({folders:t,activeFolder:n,setActiveFolder:s}){return e.jsx(Z,{"aria-label":"Folders",variant:"plain",children:t.map(o=>e.jsx(G,{size:"sm",title:o.label,selected:n===o.id,onSelect:()=>s(o.id),actions:e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:o.count})},o.id))})}function Rl({discarded:t,quarantine:n,undecryptable:s,missingKeyIds:o}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{level:3,title:"Recovery drawers"}),e.jsx(he,{items:[{term:"Discarded",details:e.jsx("span",{className:"tabular-nums",children:t})},{term:"Quarantine",details:e.jsx("span",{className:"tabular-nums",children:n})},{term:"Undecryptable",details:e.jsx("span",{className:"tabular-nums",children:s})}]}),s>0&&e.jsxs(N,{size:"sm",tone:"muted",children:["missing key ",o[0],o.length>1?` +${o.length-1} more`:""]})]})}function Il({candidates:t,onOpen:n}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{level:3,title:"Screener"}),e.jsx(Z,{"aria-label":"Pending senders",empty:"No pending senders.",children:t.slice(0,5).map(s=>e.jsx(G,{size:"sm",title:e.jsx("span",{className:"block truncate",children:s.senderEmail}),description:e.jsx("span",{className:"block truncate",children:s.trustReason}),onSelect:()=>n(s.messageId)},s.id))})]})}function Ml({entries:t}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx(te,{level:3,title:"Access audit"}),e.jsx(Z,{"aria-label":"Recent mailbox reads",empty:"No reads yet.",children:t.slice(0,4).map(n=>e.jsx(G,{size:"sm",title:e.jsx("span",{className:"block truncate",children:n.tool}),description:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"block truncate",children:Cl(n)}),e.jsx("span",{className:"block truncate",children:n.reason})]})},n.id))})]})}function Ol({detail:t}){const n=t.message,s=[{term:"From",details:Ve(n.from)},{term:"To",details:Ve(n.to)},...n.cc.length>0?[{term:"Cc",details:Ve(n.cc)}]:[],{term:"Received",details:new Date(n.receivedAt).toLocaleString()},{term:"Provenance",details:go(n)}];return e.jsxs("article",{className:"min-h-[66vh] space-y-5 px-6 py-5",children:[e.jsx(nn,{level:2,title:bo(n),actions:e.jsx(on,{placement:n.placement})}),e.jsx(he,{items:s}),e.jsx(fe,{tone:"primary",title:n.untrustedContentWarning}),e.jsxs("div",{children:[e.jsx(N,{as:"div",className:"whitespace-pre-wrap break-words",children:n.text||"(no text body)"}),n.bodyTruncated&&e.jsx(N,{size:"sm",tone:"muted",className:"mt-4",children:"Body truncated in Mailbox."})]}),e.jsx(ye,{}),e.jsx(he,{items:[{term:"Read reason",details:n.access.reason},{term:"Read at",details:new Date(n.access.accessedAt).toLocaleString()}]}),n.attachments.length>0&&e.jsx(Z,{label:"Attachments",variant:"outline",children:n.attachments.map(o=>e.jsx(G,{size:"sm",title:o.filename,description:`${o.contentType} · ${o.size.toLocaleString()} bytes`},`${o.filename}-${o.size}`))})]})}function Pl(){return e.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8",children:e.jsx(ne,{variant:"plain",title:"No message selected",description:"Reading pane idle."})})}function Dl({error:t}){return e.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8",children:e.jsx(ne,{variant:"plain",title:"Message unavailable",description:t})})}function Bl(t,n){if(n==="all")return!0;if(["imbox","screener","discarded","quarantine"].includes(n))return t.placement===n;if(n==="native"||n==="delegated")return t.compartmentKind===n;if(n.startsWith("source:")){const s=n.slice(7),o=s.indexOf(":");if(o===-1)return t.source===s;const r=s.slice(0,o),a=s.slice(o+1);return t.source===r&&(t.ownerEmail??"unknown-owner")===a}return!1}function Fl(t,n){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:n}}function Hl(t,n,s){return{status:"error",agentName:t,mailboxAddress:n,generatedAt:new Date().toISOString(),message:null,accessLog:[],error:s}}function Ul(t){return(t==null?void 0:t.messages.length)??0}function ql({agentName:t,focus:n,onFocusConsumed:s,refreshGeneration:o}){var y;const[r,a]=d.useState(null),[l,i]=d.useState("all"),[c,u]=d.useState(n??null),[p,f]=d.useState(null),[b,m]=d.useState(!1);d.useEffect(()=>{i("all"),u(n??null),f(null)},[t]),d.useEffect(()=>{a(null),Q(`/agents/${encodeURIComponent(t)}/mail`).then(a).catch(()=>a(Fl(t,"mail unavailable")))},[t,o]),d.useEffect(()=>{n&&(u(n),s==null||s())},[n,s]),d.useEffect(()=>{if(!c){f(null);return}m(!0),Q(`/agents/${encodeURIComponent(t)}/mail/${encodeURIComponent(c)}`).then(f).catch(()=>f(Hl(t,(r==null?void 0:r.mailboxAddress)??null,"message unavailable"))).finally(()=>m(!1))},[t,c,o]);const h=d.useMemo(()=>{const j=(r==null?void 0:r.folders)??[];return[{id:"all",label:"All",count:Ul(r)},...j]},[r]),x=d.useMemo(()=>((r==null?void 0:r.messages)??[]).filter(j=>Bl(j,l)),[l,r]),v=d.useMemo(()=>l!=="draft"&&l!=="sent"?[]:((r==null?void 0:r.outbound)??[]).filter(j=>l==="draft"?j.status==="draft":j.status!=="draft"),[l,r]);return r?r.status!=="ready"?e.jsx(ae,{title:"Mailbox",children:e.jsx("div",{className:"grid min-h-[50vh] place-items-center",children:e.jsx(ne,{variant:"plain",headingLevel:2,className:"max-w-lg",title:r.status==="auth-required"?"Locked":"Unavailable",description:r.error})})}):e.jsx(ae,{size:"sm",title:"Agent mailbox",description:e.jsx("span",{className:"block truncate",children:r.mailboxAddress}),action:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{color:"zinc",children:"read-only"}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",className:"tabular-nums",children:[r.messages.length," messages"]}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",className:"tabular-nums",children:[r.outbound.length," outbound"]})]}),children:e.jsxs("div",{className:"grid min-h-[66vh] grid-cols-1 gap-6 border-t border-border pt-4 lg:grid-cols-[14.5rem_minmax(19rem,25rem)_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"space-y-6 lg:border-r lg:border-border lg:pr-4",children:[e.jsx($l,{folders:h,activeFolder:l,setActiveFolder:i}),e.jsx(Rl,{discarded:r.recovery.discardedCount,quarantine:r.recovery.quarantineCount,undecryptable:r.recovery.undecryptableCount,missingKeyIds:r.recovery.missingKeyIds}),e.jsx(Il,{candidates:r.screener,onOpen:j=>{i("screener"),u(j)}}),e.jsx(Ml,{entries:r.accessLog})]}),e.jsx("section",{className:"min-w-0 lg:border-r lg:border-border lg:pr-4",children:e.jsx(Al,{folderLabel:((y=h.find(j=>j.id===l))==null?void 0:y.label)??"All",messages:x,outbound:v,selectedId:c,onSelect:u})}),e.jsxs("main",{className:"min-w-0",children:[!c&&e.jsx(Pl,{}),c&&b&&e.jsx(us,{label:"Opening message"}),c&&!b&&(p==null?void 0:p.status)!=="ready"&&e.jsx(Dl,{error:p==null?void 0:p.error}),(p==null?void 0:p.status)==="ready"&&p.message&&e.jsx(Ol,{detail:p})]})]})}):e.jsx(us,{label:"Opening mailbox"})}function us({label:t}){return e.jsxs("div",{role:"group","aria-busy":"true","aria-label":t,className:"space-y-2 p-6",children:[e.jsx(Ie,{shape:"row",count:3}),e.jsxs(N,{size:"sm",tone:"muted",children:[t,"..."]})]})}function vo({label:t,rows:n=3}){return e.jsxs("div",{role:"group","aria-busy":"true","aria-label":t,className:"space-y-2 py-4",children:[e.jsx(Ie,{shape:"row",count:n}),e.jsxs(N,{size:"sm",tone:"muted",children:[t,"…"]})]})}const jo="data-ouro-scroll-fade:[mask-image:linear-gradient(to_right,transparent,#000_min(var(--ouro-scroll-fade-left),2rem),#000_calc(100%-min(var(--ouro-scroll-fade-right),2rem)),transparent)]";function yo(t){d.useEffect(()=>{const n=t.current;n.setAttribute("data-ouro-scroll-fade-js","");const s=()=>{const r=getComputedStyle(n),a=n.scrollWidth-n.clientWidth;if(a>1&&/auto|scroll/.test(r.overflowX)){const l=Math.abs(n.scrollLeft),[i,c]=r.direction==="rtl"?[a-l,l]:[l,a-l];n.setAttribute("data-ouro-scroll-fade",""),n.style.setProperty("--ouro-scroll-fade-left",`${i}px`),n.style.setProperty("--ouro-scroll-fade-right",`${c}px`)}else n.removeAttribute("data-ouro-scroll-fade"),n.style.removeProperty("--ouro-scroll-fade-left"),n.style.removeProperty("--ouro-scroll-fade-right")},o=new ResizeObserver(s);return o.observe(n),o.observe(n.firstElementChild),n.addEventListener("scroll",s),()=>{o.disconnect(),n.removeEventListener("scroll",s)}},[t])}const Wl=["solid","soft","outline","plain"],Vl=["sm","md","lg"],Kl=2e3;function Yl(t){return e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:[e.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function Gl(t){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function Xl(t){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function Jl(t){const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),Object.assign(n.style,{position:"fixed",top:"0",left:"0",opacity:"0",pointerEvents:"none"});const s=document.activeElement;document.body.append(n),n.select();let o;try{o=document.execCommand("copy")}catch{o=!1}return n.remove(),s.focus({preventScroll:!0}),o}async function Ql(t){var n;if((n=navigator.clipboard)!=null&&n.writeText)try{return await navigator.clipboard.writeText(t),!0}catch{}return Jl(t)}function wo(t){const{value:n,label:s="Copy",copiedLabel:o="Copied",failedLabel:r="Browser blocked copying",failedMessage:a=t.failedLabel??"The browser blocked copying. Select the text and copy it by hand.",hideLabel:l,variant:i="outline",size:c="sm",onCopy:u,className:p,ref:f,disabled:b,text:m,content:h,children:x,timeout:v,onClick:y,...j}=t,w=Wl.includes(i)?i:"outline",g=Vl.includes(c)?c:"sm";X("CopyButton",p,""),V();const[E,$]=d.useState("idle"),R=d.useRef(void 0),L=d.useRef(!1);d.useEffect(()=>(L.current=!0,()=>{L.current=!1,clearTimeout(R.current)}),[]);const I=async B=>{B.preventDefault();const M=await Ql(n);M&&(u==null||u(n)),L.current&&(clearTimeout(R.current),$(M?"copied":"failed"),Qt(M?o:a),R.current=setTimeout(()=>$("idle"),Kl))},_=E==="copied"?o:E==="failed"?r:s,S=E==="copied"?Gl:E==="failed"?Xl:Yl;return e.jsx("span",{"data-ouro":"copy-button","data-status":E,className:C("inline-flex",p),children:e.jsx(re,{"data-ouro-control":"copy-button","data-ouro-part":"trigger",...j,ref:f,disabled:b,variant:w,size:g,tone:"secondary",onClick:I,...E==="failed"?{title:a}:{},...l?{"aria-label":_,className:"w-(--ouro-button-h) px-0"}:{startIcon:S},children:l?e.jsx(S,{className:"size-[1.25em] shrink-0"}):_})})}function Zl(t){const{motion:n}=Kt(),s=Yt("(prefers-reduced-motion: reduce)",t===!0);return n==="reduced"||n!=="full"&&s}const ko=["default","light","medium-light","medium","medium-dark","dark"],ms="inline-block size-[1.25em] shrink-0 overflow-hidden align-[-0.3em] object-contain select-none",ec="absolute inset-0 size-full object-contain opacity-0 group-data-loaded/emoji:opacity-100",tc="group-data-loaded/emoji:transition-opacity group-data-loaded/emoji:duration-(--ouro-duration-fast) group-data-loaded/emoji:ease-(--ouro-ease-out)",nc="pointer-events-none absolute inset-0 grid size-full place-items-center overflow-hidden group-data-loaded/emoji:invisible group-data-loaded/emoji:opacity-0",sc="group-data-loaded/emoji:transition-[opacity,visibility] group-data-loaded/emoji:duration-(--ouro-duration-fast) group-data-loaded/emoji:ease-(--ouro-ease-out)";function oc(t,n){var s;return((s=t.skinTones)==null?void 0:s[ko.indexOf(n)-1])??t}const ps=new WeakMap,No=/\uFE0F/g,fs=new WeakMap,rc=8,ac={steps:[]};function ic(t){const[n]=t;if(n===void 0)return ac;let s=fs.get(n);s||fs.set(n,s=[]);const o=s.find(a=>a.steps.length===t.length&&a.steps.every((l,i)=>l===t[i]));if(o)return o;const r={steps:[...t]};return s.push(r),s.length>rc&&s.shift(),r}const Ee=new Map,lc=16;function cc(t){var r;const n=ps.get(t);if(n)return n;const{id:s}=t,o=Ee.get(s)??(r=ic(t.categories.flatMap(a=>a.items))).index??(r.index=pc(t));return s!==void 0&&(Ee.delete(s),Ee.set(s,o),Ee.size>lc&&Ee.delete(Ee.keys().next().value)),ps.set(t,o),o}const _e=new Map,dc=8;function uc(t){var s;let n="";for(const o of t){n+=`${o.id}${o.text??""}${((s=o.shortcodes)==null?void 0:s.join(""))??""}`;for(const r of o.skinTones??[])n+=`${r.id}${r.text??""}`}return n}function mc(t){const n=new Map,s=new Map,o=new Map;t.forEach((a,l)=>{const i=[[a,0],...(a.skinTones??[]).map((c,u)=>[c,u+1])];for(const[c,u]of i)n.set(c.id,l*8+u),s.set(c.id.toLowerCase(),l*8+u),c.text&&o.set(c.text.replace(No,""),l*8+u)}),t.forEach((a,l)=>{var i;return(i=a.shortcodes)==null?void 0:i.forEach(c=>s.set(c.toLowerCase(),l*8))});const r=new Map;for(const a of[...o.keys()].sort((l,i)=>i.length-l.length)){const l=Array.from(a),i=r.get(l[0]);i?i.push(l):r.set(l[0],[l])}return{byId:n,byToken:s,byText:o,textStarts:r}}function At(t,n){return{get:s=>{const o=t.get(s);return o===void 0?void 0:{item:n[o>>3],tone:ko[o&7]}},has:s=>t.has(s)}}function pc(t){const n=[],s=new Set;for(const a of t.categories.flatMap(l=>l.items))s.has(a.id)||(s.add(a.id),n.push(a));const o=uc(n),r=_e.get(o)??mc(n);return _e.delete(o),_e.set(o,r),_e.size>dc&&_e.delete(_e.keys().next().value),{items:n,byId:At(r.byId,n),byToken:At(r.byToken,n),byText:At(r.byText,n),textStarts:r.textStarts}}function fc(t,n,s=!0){const{byToken:o,byText:r,textStarts:a}=cc(n);if(!Array.from(t).some(c=>s&&c===":"||a.has(c)))return t?[t]:[];const l=[];let i=0;for(let c=hs(t,0,a,s);c;c=hs(t,c.end,a,s)){if(c.index<i)continue;const u=c.token?o.get(t.slice(c.index+1,c.end).toLowerCase()):r.get(t.slice(c.index,c.end).replace(No,""));if(!u)continue;c.index>i&&l.push(t.slice(i,c.index));const p=c.end+(c.token?1:0);l.push({...u,source:t.slice(c.index,p)}),i=p}return i<t.length&&l.push(t.slice(i)),l}const hc=/\s/u;function hs(t,n,s,o){for(let r=n;r<t.length;){const a=String.fromCodePoint(t.codePointAt(r));if(o&&a===":"){let i=r+1;for(;i<t.length;){const c=String.fromCodePoint(t.codePointAt(i));if(c===":"||hc.test(c))break;i+=c.length}if(i>r+1&&t[i]===":")return{index:r,end:i,token:!0}}const l=s.get(a);if(l)for(const i of l){let c=r;for(const u of i){if(!t.startsWith(u,c)){c=-1;break}c+=u.length,t[c]==="️"&&(c+=1)}if(c!==-1)return{index:r,end:c,token:!1}}r+=a.length}return null}const xc='button, a[href], [role="button"], [role="option"], [role="menuitem"]';function bc(t,n){const[s,o]=d.useState(!1),[r,a]=d.useState(!1);return d.useEffect(()=>{if(!n)return;const l=t.current,i=l.parentElement.closest(xc)??l,c=new AbortController,u=(p,f)=>i.addEventListener(p,f,{signal:c.signal});return u("pointerenter",p=>o(p.pointerType==="mouse")),u("pointerleave",()=>o(!1)),u("focusin",()=>a(!0)),u("focusout",p=>a(i.contains(p.relatedTarget))),()=>{c.abort(),o(!1),a(!1)}},[t,n]),s||r}function gc(t){for(const n of t.getAnimations())n.cancel()}function vc(t,n){const s=n==null?void 0:n.src,o=n==null?void 0:n.fps;d.useLayoutEffect(()=>{if(s===void 0)return;const r=t.current;let a=!1;return r.decode().then(()=>{/* istanbul ignore if @preserve -- WebKit only, and only when its decode resolves late: Chromium fails a stale decode itself */if(a)return;const l=Math.round(r.naturalHeight/r.naturalWidth);l>1&&r.animate([{objectPosition:"50% 0%"},{objectPosition:"50% 100%"}],{duration:l/o*1e3,iterations:1/0,easing:`steps(${l}, jump-none)`})},()=>{}),()=>{a=!0,gc(r)}},[t,s,o])}function jc(t,n){d.useEffect(()=>{var s;n===void 0||(s=navigator.connection)!=null&&s.saveData||t.current.decode().then(()=>{const o=new Image;o.fetchPriority="low",o.src=n},()=>{})},[t,n])}function yc(t,n,s,o,r){const a=d.useRef(void 0);d.useLayoutEffect(()=>{if(!r)return;const l=t.current;l.toggleAttribute("data-loaded",a.current===o);let i=!1;const c=u=>{i||(a.current=u?o:void 0,l.toggleAttribute("data-loaded",u))};return n.current.decode().then(()=>c(!0),()=>c(!1)),()=>{i=!0}},[t,n,s,o,r])}function wc(t){const{item:n,skinTone:s="default",play:o,alt:r,placeholder:a,className:l,ref:i,src:c,emoji:u,animate:p,...f}=t;X("Emoji",l,""),V();const b=oc(n,s),m=d.useRef(null),h=ge(i,m),x=Zl(!0),v=!!(b.animatedSrc??b.filmstrip)&&!x,y=bc(m,v&&o===void 0),j=v&&(o??y),w=j&&!b.animatedSrc?b.filmstrip:void 0;vc(m,w),jc(m,v&&f.fetchPriority!=="low"?b.animatedSrc??b.filmstrip.src:void 0);const g=w?w.src:j?b.animatedSrc:b.src,E=a!==void 0,$=d.useRef(null);yc($,m,g,b.src,E);const R=e.jsx("img",{...f,ref:h,"data-ouro":E?void 0:"emoji",src:g,srcSet:j?void 0:b.srcSet,width:n.width,height:n.height,alt:r??n.name,draggable:!1,decoding:"async",className:C(E?[ec,!x&&tc]:ms,w&&"object-cover object-top",!E&&l)});return E?e.jsxs("span",{ref:$,"data-ouro":"emoji",className:C(ms,"group/emoji relative",l),children:[e.jsx("span",{"aria-hidden":"true",className:C(nc,!x&&sc),children:typeof a=="string"?e.jsx("img",{src:a,alt:"",draggable:!1,decoding:"async",className:"size-full object-contain"}):a}),R]}):R}const Co=/\x1b(?:\[([0-?]*)([ -/]*)([@-~])|[\]PX^_][\s\S]*?(?:\x07|\x1b\\|$)|[ -/]*[0-~]|$)/g;function kc(t){return t.replace(Co,"")}const So={bold:!1,dim:!1,italic:!1,underline:!1,strike:!1,color:null};function Nc(t){return!t.bold&&!t.dim&&!t.italic&&!t.underline&&!t.strike&&t.color===null}function xs(t,n){return t===5&&n<16?n:null}function Cc(t,n){const s=n.split(";");let o={...t};for(let r=0;r<s.length;r+=1){const[a,...l]=s[r].split(":").map(Number),i=a;if(l.length>0){i===4?o.underline=l[0]!==0:i===38&&(o.color=xs(l[0],Number(l[1])));continue}if(i===0)o={...So};else if(i===1)o.bold=!0;else if(i===2)o.dim=!0;else if(i===3)o.italic=!0;else if(i===4)o.underline=!0;else if(i===9)o.strike=!0;else if(i===22)o={...o,bold:!1,dim:!1};else if(i===23)o.italic=!1;else if(i===24)o.underline=!1;else if(i===29)o.strike=!1;else if(i>=30&&i<=37)o.color=i-30;else if(i>=90&&i<=97)o.color=i-90+8;else if(i===39)o.color=null;else if(i===38||i===48||i===58){const c=Number(s[r+1]);i===38&&(o.color=xs(c,Number(s[r+2]))),r+=c===5?2:c===2?4:1}}return o}function Sc(t){const n=[];let s=So,o=0;const r=a=>{if(a==="")return;const l=Nc(s)?null:s,i=n[n.length-1];i&&JSON.stringify(i.style)===JSON.stringify(l)?i.text+=a:n.push({text:a,style:l})};for(const a of t.matchAll(Co))r(t.slice(o,a.index)),o=a.index+a[0].length,a[3]==="m"&&a[2]===""&&(s=Cc(s,a[1]));return r(t.slice(o)),n}const Ec=["[--ouro-ansi:color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_25)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_145)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_90)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_260)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_330)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.18_200)_55%,var(--foreground))]","[--ouro-ansi:var(--foreground)]","[--ouro-ansi:color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_25)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_145)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_90)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_260)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_330)_55%,var(--foreground))]","[--ouro-ansi:color-mix(in_oklab,oklch(0.58_0.27_200)_55%,var(--foreground))]","[--ouro-ansi:var(--foreground)]"];function _c(t){const n=t.color===null?void 0:Ec[t.color];return C(n,n?t.dim?"text-[color-mix(in_oklab,var(--ouro-ansi)_50%,color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground)))]":"text-(--ouro-ansi)":t.dim&&"text-[color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))]",t.bold&&"font-bold",t.italic&&"italic",t.underline&&t.strike?"[text-decoration-line:underline_line-through]":t.underline?"underline":t.strike&&"line-through")}function zc(){return d.useCallback(t=>{/* istanbul ignore if @preserve -- never called with null */if(!t)return;const n=()=>{t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight?t.setAttribute("tabindex","0"):t!==document.activeElement&&t.removeAttribute("tabindex")},s=new ResizeObserver(n);return s.observe(t),s.observe(t.firstElementChild),t.addEventListener("blur",n),()=>{s.disconnect(),t.removeEventListener("blur",n)}},[])}function Eo({code:t,catalogue:n}){return fc(t,n,!1).map((s,o)=>typeof s=="string"?s:e.jsxs("span",{"data-ouro-code-emoji":"",className:"relative",children:[e.jsx("span",{className:"text-transparent [forced-color-adjust:none]",children:s.source}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx(wc,{item:s.item,skinTone:s.tone,play:!1,alt:"",className:"size-[1em] align-baseline"})})]},o))}function Ac({code:t,catalogue:n}){return Sc(t).map((s,o)=>{const r=n?e.jsx(Eo,{code:s.text,catalogue:n}):s.text;return s.style?e.jsx("span",{"data-ouro-ansi":"",className:_c(s.style),children:r},o):e.jsx(d.Fragment,{children:r},o)})}function Ut(t){const{code:n,language:s,title:o,copy:r=!0,copyLabel:a="Copy code",wrap:l,catalogue:i,className:c,ref:u,children:p,lang:f,filename:b,showCopyButton:m,...h}=t;X("CodeBlock",c,""),V();const x=d.useRef(null);yo(x);const v=ge(zc(),x),y=s==="ansi",j=o??s,w=j!=null||r;return e.jsxs("figure",{...h,ref:u,"data-ouro":"code-block","data-language":s,className:C("[@layer_ouro-reset]:m-0 grid min-w-0 grid-cols-[minmax(0,1fr)_auto] rounded-ouro-lg border border-solid border-border bg-muted text-foreground outline-ring outline-offset-2 has-[[data-ouro-part=code]:focus-visible]:outline-2 has-[[data-ouro-part=code]:focus-visible]:outline-solid",w?"grid-rows-[minmax(calc(var(--spacing)*11),auto)_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",c),children:[j!=null?e.jsx("figcaption",{"data-slot":"caption",className:"col-start-1 row-start-1 flex min-w-0 items-center ps-4 pe-2 text-xs leading-5 font-medium text-[color-mix(in_oklab,var(--muted-foreground)_80%,var(--foreground))]",children:e.jsx("span",{className:"min-w-0 truncate",children:j})}):null,r?e.jsx(wo,{"data-ouro-control":"code-block","data-ouro-part":"copy",value:y?kc(n):n,label:a,hideLabel:!0,variant:"plain",size:"sm",className:"col-start-2 row-start-1 self-center me-1.5"}):null,w?e.jsx("span",{"aria-hidden":"true","data-slot":"rule",className:"pointer-events-none col-span-2 col-start-1 row-start-2 h-px self-start border-0 border-t border-solid border-border"}):null,e.jsx("div",{"data-slot":"code-clip",className:C("col-span-2 col-start-1 grid min-h-0 min-w-0 overflow-hidden",w?"row-start-2":"row-start-1"),children:e.jsx("pre",{ref:v,"data-ouro-control":"code-block","data-ouro-part":"code",className:C("m-0 min-h-0 min-w-0 overflow-auto p-4 font-mono text-sm leading-6 outline-none",jo,w?"rounded-b-[calc(var(--radius-ouro-lg)-1px)] border-0 border-t border-solid border-transparent":"rounded-[calc(var(--radius-ouro-lg)-1px)]",l?"whitespace-pre-wrap break-words":"whitespace-pre"),children:e.jsx("code",{className:C("[font-family:inherit]",l?"block":"block w-max min-w-full"),children:y?e.jsx(Ac,{code:n,catalogue:i}):i?e.jsx(Eo,{code:n,catalogue:i}):n})})})]})}const Lc=()=>()=>{};function Tc(){return d.useSyncExternalStore(Lc,()=>"onbeforematch"in document.body,()=>!1)}function $c({open:t,onFound:n,children:s,contentClassName:o,...r}){const a=Tc(),l=d.useRef(null),i=d.useRef(n);d.useLayoutEffect(()=>{i.current=n});const[c,u]=d.useState(t),[p,f]=d.useState(!1),[b,m]=d.useState(!1);c!==t&&(u(t),m(!0),f(!t));const h=()=>{const v=l.current;/* istanbul ignore next @preserve -- the panel always exists once effects run */if(!v)return;const y=()=>i.current();return v.addEventListener("beforematch",y),()=>v.removeEventListener("beforematch",y)};d.useEffect(h,[]),d.useEffect(()=>{const v=l.current;if(!p||!v)return;if(v.getAnimations().length===0){f(!1);return}const y=j=>{/* istanbul ignore else @preserve -- descendants of the panel send no transition events */j.target===v&&f(!1)};return v.addEventListener("transitionend",y),v.addEventListener("transitioncancel",y),()=>{v.removeEventListener("transitionend",y),v.removeEventListener("transitioncancel",y)}},[p]);const x=t||p;return d.useLayoutEffect(()=>{var v;!x&&a&&((v=l.current)==null||v.setAttribute("hidden","until-found"))},[x,a]),e.jsx("div",{...r,ref:l,hidden:x?void 0:!0,"data-open":t?"":void 0,"data-moved":b?"":void 0,className:"grid w-full grid-rows-[0fr] data-open:grid-rows-[1fr] transition-[grid-template-rows] duration-(--ouro-duration-base) ease-(--ouro-ease-out) motion-reduce:transition-none data-moved:starting:grid-rows-[0fr] [&[hidden]:not([hidden=until-found])]:hidden",children:e.jsx("div",{className:"min-h-0 overflow-hidden",children:e.jsx("div",{className:o,children:s})})})}const Rc="box-border grid min-w-0 justify-items-start text-foreground",Ic="group/trigger press relative m-0 box-border inline-flex min-w-0 max-w-full cursor-pointer items-center gap-2 min-h-ouro-11 sm:pointer-fine:min-h-9 px-0 py-2 rounded-ouro-md border-0 bg-transparent text-start forced-colors:border forced-colors:border-solid font-[inherit] text-base font-medium text-foreground sm:pointer-fine:text-sm select-none touch-manipulation [-webkit-tap-highlight-color:transparent] underline-offset-4 not-data-disabled:pointer-fine:hover:underline not-data-disabled:active:opacity-70 outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid data-disabled:cursor-not-allowed data-disabled:opacity-50",Mc="size-ouro-4 shrink-0 text-muted-foreground transition-[rotate] duration-(--ouro-duration-base) ease-(--ouro-ease-out) group-data-panel-open/trigger:rotate-180 motion-reduce:transition-none";function ut(t){const{title:n,children:s,open:o,defaultOpen:r,onOpenChange:a,disabled:l,className:i,ref:c,trigger:u,label:p,onChange:f,isOpen:b}=t;X("Collapsible",i,""),V();const m=d.useId(),[h,x]=d.useState(r===!0),v=o??h,y=j=>{o===void 0&&x(j),a==null||a(j)};return e.jsxs("div",{ref:c,"data-ouro":"collapsible",className:C(Rc,i),children:[e.jsxs("button",{type:"button",disabled:l,"aria-expanded":v,"aria-controls":v?m:void 0,"data-disabled":l?"":void 0,"data-panel-open":v?"":void 0,"data-ouro-control":"collapsible","data-ouro-part":"trigger",className:Ic,onClick:()=>y(!v),children:[n,e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:Mc,children:e.jsx("path",{d:"m4 6 4 4 4-4"})})]}),e.jsx($c,{id:m,open:v,onFound:()=>y(!0),contentClassName:"pt-1 pb-2","data-ouro-collapsible-panel":"",children:s})]})}function qt(t){const n=t.function.name,s=Oc(t.function.arguments);return n==="settle"?{kind:"response",name:n,id:t.id,deliveredText:s.answer??null,delegatedThought:null,metadata:s.intent??null,rawArgs:null}:n==="ponder"?{kind:"delegation",name:n,id:t.id,deliveredText:s.say??null,delegatedThought:s.thought??null,metadata:null,rawArgs:null}:n==="rest"?{kind:"rest",name:n,id:t.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:null}:n==="observe"?{kind:"observe",name:n,id:t.id,deliveredText:null,delegatedThought:null,metadata:s.reason??null,rawArgs:null}:n==="surface"?{kind:"surface",name:n,id:t.id,deliveredText:s.content??null,delegatedThought:null,metadata:s.delegationId??s.friendId??null,rawArgs:null}:{kind:"action",name:n,id:t.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:t.function.arguments}}function Oc(t){try{const n=JSON.parse(t);if(n&&typeof n=="object")return n}catch{}return{}}const Pc=48;function Dc(t){return t.scrollHeight-t.scrollTop-t.clientHeight<=Pc}function _o(t){const n=d.useRef(null),s=d.useRef(!0),o=d.useCallback(()=>{const a=n.current;a&&(s.current=Dc(a))},[]),r=d.useCallback(()=>{s.current=!1},[]);return d.useEffect(()=>{const a=n.current;!a||!s.current||(a.scrollTop=a.scrollHeight)},[t]),{ref:n,onScroll:o,preserveScroll:r}}function Bc(t){return typeof t=="string"?t:Array.isArray(t)?t.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").filter(n=>n.length>0).join(""):""}function Ge(t){return Bc(t.content)}function zo(t){return t.time.authoredAt??t.time.observedAt??t.time.recordedAt}const Ao=t=>/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t),Lo=t=>/^[a-f0-9]{64}$/.test(t);function bs(t,n){return!Ao(t)||n!==void 0&&!Lo(n)?null:n===void 0?`ouro shepherd status --agent '${t}' --json`:`ouro shepherd inspect --agent '${t}' --id '${n}' --json`}function Fc(t,n,s){return!Ao(t)||!Lo(n)||s===null||!Number.isSafeInteger(s)||s<0?null:`ouro shepherd reconcile --agent '${t}' --id '${n}' --resolution retired --expected-revision ${s} --request-id 'supervision-retire-${n}-r${s}' --json`}const Hc="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.";function To(t){return t==="bluebubbles"?"iMessage":t==="teams"?"Teams":t==="cli"?"CLI":t==="mail"?"Mail":t==="voice"?"Voice":t}function Uc(t){return t==="bluebubbles"?"imessage":t==="teams"?"teams":t==="cli"?"terminal":"default"}function qc(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 Wc(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 Vc(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 et(t,n="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]":n==="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 Ue(t,n){return t==="imessage"?n==="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"?n==="agent"?"font-mono text-[11px] text-[#22c55e]":"font-mono text-[11px] text-[#60a5fa]":n==="surface"||n==="agent"?"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/70":"font-mono text-[9px] uppercase tracking-wider text-ouro-gold/70"}function qe(t,n="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 ${n==="agent"?"text-[#bbf7d0]":"text-[#dbeafe]"}`:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words"}function Kc(t){return zo(t)}function Ae(t){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(Kc(t)))}function Yc({loading:t,transcript:n}){var a;const s=((a=n==null?void 0:n.messages[n.messages.length-1])==null?void 0:a.id)??null,{ref:o,onScroll:r}=_o(s);return e.jsxs("div",{ref:o,"data-testid":"session-transcript-scroll",onScroll:r,className:"mt-1 max-h-[70vh] overflow-y-auto rounded-lg",children:[t&&!n&&e.jsx(vo,{label:"Loading transcript"}),n&&e.jsx(Gc,{transcript:n})]})}function Gc({transcript:t}){const{messages:n,lastUsage:s}=t,o=Uc(t.channel),r=n.filter(i=>i.role==="system"),a=n.filter(i=>i.role!=="system"),l=new Map;for(const i of a)i.role==="tool"&&i.toolCallId&&l.set(i.toolCallId,i);return e.jsxs("div",{className:qc(o),children:[e.jsxs("div",{className:Wc(o),children:[e.jsx("p",{className:o==="terminal"?"font-mono text-xs":"text-sm font-semibold",children:To(t.channel)}),e.jsxs("p",{className:o==="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:[s&&e.jsxs("p",{className:o==="terminal"?"pb-2 font-mono text-[10px] text-[#6ee7b7]":"pb-2 font-mono text-[10px] opacity-60",children:[s.input_tokens.toLocaleString()," in · ",s.output_tokens.toLocaleString()," out · ",s.total_tokens.toLocaleString()," total"]}),t.truncatedHistory&&e.jsx(fe,{tone:"primary",className:"mb-2",title:"Model context is trimmed; retained history is shown below."}),r.length>0&&e.jsx(ut,{title:`system context (${r.length})`,className:"mb-2",children:e.jsx("div",{className:"space-y-2",children:r.map(i=>e.jsxs("div",{className:"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:Ae(i)}),Ge(i)]},i.id))})}),a.map(i=>i.role==="tool"?null:i.role==="user"?e.jsx(Xc,{msg:i,surface:o},i.id):i.role==="assistant"?e.jsx(Jc,{msg:i,toolResults:l,surface:o},i.id):null)]})]})}function Xc({msg:t,surface:n}){const s=Ge(t);return e.jsx("div",{className:"flex justify-start py-1",children:e.jsxs("div",{className:Vc(n),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:Ue(n,"user"),children:n==="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:Ae(t)})]}),e.jsx("p",{className:qe(n,"user"),children:s})]})})}function Jc({msg:t,toolResults:n,surface:s}){const o=Ge(t),r=(t.toolCalls??[]).map(qt),a=r.filter(c=>c.kind!=="action"),l=r.filter(c=>c.kind==="action"),i=[];for(const c of a)c.kind==="response"?i.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:et(s),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:Ue(s,"agent"),children:s==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Ae(t)})]}),e.jsx("p",{className:qe(s),children:c.deliveredText}),c.metadata&&c.metadata!=="complete"&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["intent: ",c.metadata]})]})},c.id)):c.kind==="delegation"?i.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:et(s),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:Ue(s,"agent"),children:s==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Ae(t)})]}),c.deliveredText&&e.jsx("p",{className:qe(s),children:c.deliveredText}),c.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:c.delegatedThought})]})]})},c.id)):c.kind==="surface"?i.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:et(s,"surface"),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:Ue(s,"surface"),children:"surfaced"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Ae(t)})]}),e.jsx("p",{className:qe(s),children:c.deliveredText}),c.metadata&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",c.metadata]})]})},c.id)):c.kind==="rest"?i.push(e.jsx(ye,{className:"my-2",label:"resting"},c.id)):c.kind==="observe"&&i.push(e.jsx(ye,{className:"my-2",label:`observed${c.metadata?`: ${c.metadata}`:""}`},c.id));return o&&a.length===0&&i.push(e.jsx("div",{className:"flex justify-end py-1",children:e.jsxs("div",{className:et(s),children:[e.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[e.jsx("p",{className:Ue(s,"agent"),children:s==="terminal"?"agent >":"agent"}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Ae(t)})]}),e.jsx("p",{className:qe(s),children:o})]})},`${t.id}-content`)),l.length>0&&i.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:l.map(c=>e.jsx(Zc,{call:c,result:n.get(c.id),surface:s},c.id))})},`${t.id}-tools`)),e.jsx(e.Fragment,{children:i})}function Qc(t){return t==="terminal"?"bg-[#0f1a15] text-[#bbf7d0] ring-1 ring-[#1f3a2c]":t==="teams"?"bg-white text-[#242424] ring-1 ring-[#d8d1ff]":t==="imessage"?"bg-white text-[#1d1d1f] ring-1 ring-black/10":"bg-ouro-moss/10 ring-1 ring-ouro-moss/12"}function Zc({call:t,result:n,surface:s}){const o=n?Ge(n):null;return e.jsx("div",{className:`rounded px-2.5 ${Qc(s)}`,children:e.jsx(ut,{title:e.jsx("span",{className:"font-mono text-xs",children:t.name}),children:e.jsxs("div",{className:"space-y-1.5",children:[t.rawArgs&&e.jsx(Ut,{code:t.rawArgs,title:"arguments",wrap:!0,className:"max-h-40"}),n&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(U,{children:"result"}),e.jsx(Ut,{code:o??"",title:"result",wrap:!0,className:"max-h-48"})]})]})})})}const gs={"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 ed({agentName:t,focus:n,onFocusConsumed:s,deskPrefs:o,refreshGeneration:r}){const[a,l]=d.useState(null),[i,c]=d.useState(null),[u,p]=d.useState(null),[f,b]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{Q(`/agents/${encodeURIComponent(t)}/sessions`).then(l)},[t,r]),d.useEffect(()=>{n&&(m.current=null,c(n),p(null),b(!0),s==null||s())},[t,n,s]),d.useEffect(()=>{if(!i)return;const w=`${i}:${r}`;if(m.current===w)return;m.current=w,b(!0);const[g,E,$]=i.split("/");Q(`/agents/${encodeURIComponent(t)}/sessions/${encodeURIComponent(g)}/${encodeURIComponent(E)}/${encodeURIComponent($)}`).then(p).catch(()=>p(null)).finally(()=>b(!1))},[t,i,r,n]);function h(w){if(i===w){c(null),p(null),m.current=null;return}c(w),p(null),b(!0)}const x=new Set((o==null?void 0:o.starredFriends)??[]);if(!a)return e.jsx(vo,{label:"Loading sessions"});const v=new Map;for(const w of a.items)v.has(w.friendId)||v.set(w.friendId,[]),v.get(w.friendId).push(w);const y=[...v.entries()].sort((w,g)=>{const E=x.has(w[0])?0:1,$=x.has(g[0])?0:1;return E!==$?E-$:g[1].length-w[1].length}),j=[];for(const[w,g]of y){if(g.length>1){j.push({key:w,person:{name:g[0].friendName,channels:g.length,starred:x.has(w)},sessions:g});continue}const E=j[j.length-1];E&&!E.person?E.sessions.push(...g):j.push({key:w,person:null,sessions:[...g]})}return e.jsxs("div",{className:"space-y-3",children:[e.jsx(te,{title:"Sessions",meta:`${a.totalCount} sessions · ${a.activeCount} active · ${a.staleCount} stale`}),e.jsx("div",{className:"space-y-3",children:j.map(w=>e.jsxs("div",{className:"space-y-1",children:[w.person&&e.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[w.person.starred&&e.jsx("span",{className:"text-sm text-ouro-gold",children:"★"}),e.jsx("span",{className:"text-sm font-medium",children:w.person.name}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:[w.person.channels," channels"]})]}),e.jsx(Z,{"aria-label":w.person?`${w.person.name}'s sessions`:"Sessions",children:w.sessions.map(g=>{const E=`${g.friendId}/${g.channel}/${g.key}`,$=i===E;return e.jsxs("div",{children:[e.jsx(td,{session:g,starred:x.has(g.friendId),selected:$,onSelect:()=>h(E)}),$&&e.jsx(Yc,{loading:f,transcript:u})]},E)})})]},w.key))})]})}function td({session:t,starred:n,selected:s,onSelect:o}){var c;const r=gs[t.replyState]??gs.idle,a=((c=t.lastUsage)==null?void 0:c.total_tokens)??t.estimatedTokens??0,i=a>0?Math.min(100,Math.round(a/8e4*100)):0;return e.jsx(G,{selected:s,onSelect:o,title:e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[n&&e.jsx("span",{className:"text-ouro-gold",title:"Starred",children:"★"}),e.jsx("span",{className:"truncate",children:t.friendName}),e.jsxs("span",{className:"shrink-0 text-xs font-normal text-muted-foreground",children:["via ",To(t.channel)]}),e.jsx(U,{color:r.color,children:r.label})]}),actions:e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:oe(t.lastActivityAt)}),description:e.jsxs("div",{className:"mt-1 space-y-1",children:[t.latestUserExcerpt&&e.jsxs("p",{className:"truncate text-xs",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"in:"})," ",de(t.latestUserExcerpt,100)]}),t.latestAssistantExcerpt&&e.jsxs("p",{className:"truncate text-xs",children:[e.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"out:"})," ",de(t.latestAssistantExcerpt,100)]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"tabular-nums",children:[t.messageCount," msgs"]}),t.lastUsage&&e.jsxs("span",{className:"tabular-nums",children:[t.lastUsage.total_tokens.toLocaleString()," tok"]}),i>0&&e.jsxs("div",{className:"flex max-w-32 flex-1 items-center gap-1.5",title:"Context pressure — steady state oscillates between 80-100%",children:[e.jsx("div",{className:"h-1 flex-1 rounded-full bg-muted",children:e.jsx("div",{className:`h-1 rounded-full transition-all ${i>100?"bg-destructive":i>80?"bg-warning":"bg-success"}`,style:{width:`${Math.min(100,i)}%`}})}),e.jsxs("span",{className:"text-[10px] tabular-nums",children:[i,"%"]})]})]})]})})}function nd({items:t,nav:n}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Coding lanes",meta:t.length}),e.jsx(Z,{"aria-label":"Coding lanes",empty:e.jsx(ne,{variant:"plain",align:"start",title:"No coding sessions."}),children:t.map(s=>e.jsx(sd,{lane:s,nav:n},s.id))})]})}function sd({lane:t,nav:n}){const s=t.status,o=s==="failed",r=t.failure,a=t.obligationId,l=t.originSession;return e.jsx(G,{title:t.runner,actions:e.jsx(U,{color:o?"red":s==="running"?"lime":s==="completed"?"zinc":"yellow",children:s}),description:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"truncate",children:t.workdir}),(a||t.taskRef||l)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>n({tab:"work",focus:a}),children:["obligation: ",a.slice(0,20),"…"]}),t.taskRef&&e.jsxs("span",{children:["task: ",t.taskRef]}),l&&e.jsx(re,{variant:"plain",size:"sm",onClick:()=>{n({tab:"sessions",focus:`${l.friendId}/${l.channel}/${l.key}`})},children:"origin session"})]}),t.checkpoint&&e.jsx("p",{children:de(t.checkpoint,100)}),e.jsxs("p",{children:["pid ",t.pid??"–"," · restarts ",t.restartCount," · ",oe(t.lastActivityAt)]}),o&&r&&e.jsx(fe,{tone:"destructive",title:"FAILURE:",description:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{children:[r.command," exited ",String(r.code??r.signal)]}),r.stderrTail&&e.jsx(Ut,{code:r.stderrTail,title:"stderr",wrap:!0,className:"max-h-40"})]})})]})})}function od({obligations:t,openCount:n,primarySelectionReason:s,codingByObligation:o,nav:r}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Obligations",meta:`${n} open`}),s&&e.jsxs(N,{size:"sm",tone:"muted",children:["Primary: ",s]}),e.jsx(Z,{"aria-label":"Obligations",empty:e.jsx(ne,{variant:"plain",align:"start",title:"No open obligations."}),children:t.map(a=>e.jsx(rd,{obligation:a,linkedCoding:o.get(a.id)??[],nav:r},a.id))})]})}function rd({obligation:t,linkedCoding:n,nav:s}){const o=ad(t)?t:null,r=(o==null?void 0:o.isPrimary)??!1,a=(o==null?void 0:o.meaning)??null,l=t.origin;return e.jsx(G,{title:de(t.content,120),actions:e.jsxs(e.Fragment,{children:[r&&e.jsx(U,{color:"lime",children:"primary"}),e.jsx(U,{color:t.status==="pending"?"yellow":t.status==="fulfilled"?"lime":"zinc",children:t.status})]}),description:e.jsxs("div",{className:"mt-1 space-y-1.5",children:[l&&e.jsxs(re,{variant:"soft",tone:"secondary",size:"sm",onClick:()=>s({tab:"sessions",focus:`${l.friendId}/${l.channel}/${l.key}`}),children:["from ",l.channel," → ",l.key," · open session →"]}),t.currentSurface&&e.jsxs("p",{children:["surface: ",t.currentSurface.kind," — ",t.currentSurface.label]}),(a==null?void 0:a.waitingOn)&&e.jsxs("p",{children:["Waiting on: ",a.waitingOn]}),n.length>0&&e.jsx(Z,{label:"Linked coding",variant:"plain",children:n.map(i=>e.jsx(G,{size:"sm",title:`${i.runner} — ${i.workdir}`,actions:e.jsx(U,{color:i.status==="failed"?"red":i.status==="running"?"lime":"zinc",children:i.status})},i.id))}),t.nextAction&&e.jsxs("p",{children:["Next: ",t.nextAction]}),e.jsx("p",{children:oe(t.updatedAt)})]})})}function ad(t){return"isPrimary"in t}function id({selfFix:t}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Self-fix",meta:t.active?"active":"inactive"}),t.currentStep&&e.jsxs(N,{size:"sm",tone:"primary",children:["Current: ",t.currentStep]}),e.jsx(Z,{"aria-label":"Self-fix steps",ordered:!0,children:t.steps.map((n,s)=>e.jsx(G,{size:"sm",title:n.label,description:n.detail||void 0,actions:e.jsx(U,{color:n.status==="done"?"lime":n.status==="active"?"yellow":"zinc",children:n.status})},s))})]})}function ld({tasks:t}){var n,s;return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Tasks",meta:`${t.liveCount} live, ${t.blockedCount} blocked`}),((n=t.liveTaskNames)==null?void 0:n.length)>0?e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.liveTaskNames.map(o=>e.jsx(U,{children:o},o))}):e.jsx(ne,{variant:"plain",align:"start",title:"No live tasks."}),((s=t.actionRequired)==null?void 0:s.length)>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(N,{size:"sm",tone:"destructive",children:"Action required"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actionRequired.map(o=>e.jsx(U,{color:"red",children:o},o))})]})]})}function cd({view:t,error:n}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Recovery Sentinel"}),e.jsx(dd,{view:t,error:n})]})}function dd({view:t,error:n}){if(n&&!t)return e.jsx(fe,{tone:"destructive",title:"Sentinel unavailable",description:n});if(!t)return null;const s=t.latest??null,o=t.latestReady??null,r=new Set([s,o].filter(l=>!!l).map(Lt)),a=(t.history??[]).filter(l=>!r.has(Lt(l)));return e.jsx(ae,{size:"sm",children:e.jsxs("div",{className:"space-y-4",children:[n&&e.jsx(fe,{tone:"destructive",title:"Sentinel unavailable",description:n}),s?e.jsx(vs,{label:"Latest",receipt:s,prominent:!0}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{children:"missing"}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:"Latest"})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{}),e.jsx(vs,{label:"Latest ready",receipt:o})]}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{}),e.jsx(Z,{label:"History",children:a.map(l=>e.jsx(md,{receipt:l},Lt(l)))})]}),t.degraded.issues.length>0&&e.jsx(fe,{tone:"warning",title:"Sentinel degraded",description:e.jsx("ul",{className:"space-y-0.5",children:t.degraded.issues.map(l=>e.jsx("li",{className:"break-words",children:l},l))})})]})})}function vs({label:t,receipt:n,prominent:s=!1}){const o=fd(n.sourceLocators);return e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(N,{as:"span",size:"sm",tone:"muted",children:t}),e.jsx(U,{color:$o(n.verdict),children:n.verdict}),e.jsx("span",{className:"font-mono text-xs",children:Ro(n.trigger)}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:["updated ",oe(n.generatedAt)]})]}),e.jsx(N,{size:s?"md":"sm",tone:s?"default":"muted",className:"break-words",children:n.summary}),e.jsx(he,{items:[{term:"Current ask",details:js(n.recoveryAnchor.currentAsk)},{term:"Next safe action",details:js(n.recoveryAnchor.nextSafeAction)}]}),n.signals.length>0&&e.jsx(Z,{"aria-label":`${t} signals`,children:n.signals.map(r=>e.jsx(ud,{signal:r},r.id))}),o.length>0&&e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[e.jsx(N,{as:"span",size:"sm",tone:"muted",children:"Sources"}),o.map(r=>e.jsx("span",{className:"max-w-full truncate font-mono text-xs text-muted-foreground",children:r},r))]})]})}function js(t){return t?de(t,140):"unknown"}function ud({signal:t}){return e.jsx(G,{size:"sm",title:t.summary,actions:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.kind.replace(/_/g," ")}),e.jsx(U,{color:pd(t),children:t.status})]}),description:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"truncate font-mono text-xs",children:t.source.locator}),t.repair&&e.jsxs("p",{className:"break-words",children:[t.repair.actor,": ",t.repair.command??t.repair.detail]})]})})}function md({receipt:t}){var s;const n=((s=t.signals[0])==null?void 0:s.summary)??null;return e.jsx(G,{size:"sm",title:t.summary,actions:e.jsx(U,{color:$o(t.verdict),children:t.verdict}),description:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-mono",children:Ro(t.trigger)})," · ",oe(t.generatedAt)]}),n&&e.jsx("p",{className:"break-words",children:n}),e.jsx("p",{className:"truncate font-mono text-xs",children:t.receiptLocator})]})})}function $o(t){return t==="ready"?"lime":t==="watch"?"yellow":"red"}function pd(t){return t.status==="fail"||t.severity==="critical"?"red":t.status==="warn"||t.severity==="warn"?"yellow":"lime"}function Lt(t){return t.receiptLocator||t.id}function fd(t){return Array.from(new Set(t.filter(Boolean)))}function Ro(t){return t.replace(/_/g," ")}function hd({agentName:t,view:n,focus:s,onFocusConsumed:o,refreshGeneration:r}){const a=mt(),[l,i]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState(null),[b,m]=d.useState(null),[h,x]=d.useState(null),v=n.work,y=v.obligations,j=v.tasks;d.useEffect(()=>{let R=!1;return i(null),u(null),f(null),m(null),x(null),Q(`/agents/${encodeURIComponent(t)}/coding`).then(L=>{R||i(L)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/obligations`).then(L=>{R||u(L)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/self-fix`).then(L=>{R||f(L)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/sentinel`).then(L=>{R||(m(L),x(null))}).catch(L=>{R||(m(null),x(L instanceof Error?L.message:"sentinel unavailable"))}),()=>{R=!0}},[t,r]);const w=(c==null?void 0:c.items)??y.items,g=(c==null?void 0:c.openCount)??y.openCount,E=(l==null?void 0:l.items)??[],$=new Map;for(const R of E){const L=R.obligationId;if(L){const I=$.get(L);I?I.push(R):$.set(L,[R])}}return e.jsxs("div",{className:"space-y-8",children:[(b||h)&&e.jsx(cd,{view:b,error:h}),e.jsx(od,{obligations:w,openCount:g,primarySelectionReason:c==null?void 0:c.primarySelectionReason,codingByObligation:$,nav:a}),p&&p.steps.length>0&&e.jsx(id,{selfFix:p}),e.jsx(nd,{items:E,nav:a}),e.jsx(ld,{tasks:j})]})}function xd({agentName:t,focus:n,onFocusConsumed:s,refreshGeneration:o}){const r=mt(),[a,l]=d.useState(null),[i,c]=d.useState(null),[u,p]=d.useState(null);d.useEffect(()=>{const h=`/agents/${encodeURIComponent(t)}`;Promise.all([Q(`${h}/attention`).then(l),Q(`${h}/bridges`).then(c),Q(`${h}/friends`).then(p)])},[t,o]);const f=(a==null?void 0:a.queueItems)??[],b=(i==null?void 0:i.items)??[],m=(u==null?void 0:u.friends)??[];return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Who is waiting",meta:(a==null?void 0:a.queueLength)??0}),e.jsx(Z,{"aria-label":"Who is waiting",empty:e.jsx(ne,{title:"Nobody waiting.",variant:"plain",align:"start"}),children:f.map((h,x)=>{const v=h.bridgeId,y=h.obligationId;return e.jsx(G,{title:h.friendName,onSelect:()=>r({tab:"sessions"}),actions:e.jsxs(U,{color:"yellow",children:["waiting ",oe(new Date(h.timestamp).toISOString())]}),description:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{children:["via ",h.channel]}),e.jsx(N,{size:"sm",tone:"default",children:de(h.delegatedContent,140)}),(v||y)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[v&&e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>r({tab:"connections",focus:v}),children:["bridge: ",v.slice(0,12),"…"]}),y&&e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>r({tab:"work",focus:y}),children:["obligation: ",y.slice(0,16),"…"]})]})]})},x)})})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Bridges",meta:(i==null?void 0:i.totalCount)??0}),e.jsx(Z,{"aria-label":"Bridges",empty:e.jsx(ne,{title:"No bridges.",variant:"plain",align:"start"}),children:b.map(h=>{const x=h.attachedSessions,v=h.task,y=h.lifecycle==="active";return e.jsx(G,{title:h.objective,actions:e.jsx(U,{color:y?"lime":"zinc",children:h.lifecycle}),description:e.jsxs("div",{className:"space-y-2",children:[h.summary&&e.jsx(N,{size:"sm",tone:"default",children:de(h.summary,160)}),x.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((j,w)=>e.jsxs(ce,{tone:"primary",variant:"soft",onClick:()=>r({tab:"sessions",focus:`${j.friendId}/${j.channel}/${j.key}`}),children:[j.friendId,"/",j.channel,"/",j.key]},w))}),v&&e.jsxs("p",{children:[e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>r({tab:"work"}),children:["task: ",v.taskName]}),e.jsxs("span",{children:[" (",v.mode,")"]})]}),e.jsx("p",{children:oe(h.updatedAt)})]})},h.id)})})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Friends",meta:(u==null?void 0:u.totalFriends)??0}),e.jsx(Z,{"aria-label":"Friends",empty:e.jsx(ne,{title:"No friends.",variant:"plain",align:"start"}),children:m.map(h=>e.jsx(G,{title:h.friendName,onSelect:()=>r({tab:"sessions"}),description:e.jsxs(e.Fragment,{children:[h.channels.join(", ")," · ",h.sessionCount," sessions",h.lastActivityAt&&e.jsxs(e.Fragment,{children:[" · ",oe(h.lastActivityAt)]})]}),actions:e.jsxs("div",{className:"text-right",children:[e.jsx(N,{as:"p",size:"sm",tone:"default",className:"tabular-nums",children:h.totalTokens.toLocaleString()}),e.jsx(N,{as:"p",size:"sm",tone:"muted",children:"tokens"})]})},h.friendId))})]})]})}function bd({h:t}){const n=t.isOverdue,s=t.isDegraded,o=t.status;return e.jsx(G,{size:"sm",title:t.title,actions:e.jsx(U,{color:n?"red":s?"yellow":o==="active"?"lime":"zinc",children:n?"overdue":s?"degraded":o}),description:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[t.cadence&&e.jsxs("span",{children:["every ",t.cadence]}),e.jsx("span",{children:t.lastRun?`last ${oe(t.lastRun)}`:"never run"}),s&&t.degradedReason&&e.jsx(N,{as:"span",size:"sm",tone:"warning",children:t.degradedReason}),!n&&!s&&o==="active"&&t.lastRun&&e.jsx(N,{as:"span",size:"sm",tone:"success",children:"on schedule"}),n&&t.overdueMs&&e.jsxs(N,{as:"span",size:"sm",tone:"destructive",children:[Math.floor(t.overdueMs/6e4),"m overdue"]}),!t.lastRun&&o==="active"&&e.jsx(N,{as:"span",size:"sm",tone:"warning",children:"never fired — may be misconfigured"})]}),t.bodyExcerpt&&e.jsx(N,{size:"sm",tone:"default",className:"mt-1",children:t.bodyExcerpt})]})})}function gd(t){return t==="error"||t==="blocked"?"destructive":t==="surfaced"||t==="wrote_arc"||t==="updated_desk"||t==="wrote_record"?"success":t==="no_change"?"secondary":"warning"}function vd({run:t}){const n=t.permissionEnvelope.returnRoutes,s=t.surfaceAttempts,o=t.errors??[],r=Array.from(new Set([...t.permissionEnvelope.deniedTools,...t.toolPolicy.deniedTools])),a=e.jsxs("div",{className:"space-y-1.5",children:[n.length>0?n.map((c,u)=>{const p=[c.friendId,c.channel,c.key].filter(Boolean).join("/");return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(ce,{variant:"outline",children:c.kind}),e.jsx(ce,{variant:"soft",children:c.status})]}),e.jsx("p",{className:"mt-0.5 break-all font-mono text-xs",children:c.recipient}),(c.friendId||c.channel||c.key)&&p!==c.recipient&&e.jsx("p",{className:"mt-0.5 break-all font-mono text-xs",children:p}),c.reason&&e.jsx(N,{size:"sm",tone:"muted",className:"mt-0.5 break-words",children:c.reason})]},`${c.kind}-${c.recipient}-${u}`)}):e.jsx(N,{size:"sm",tone:"muted",children:"none"}),e.jsxs(N,{size:"sm",tone:"muted",children:["outward ",t.permissionEnvelope.canMessageOutward?"allowed":"closed"]}),t.permissionEnvelope.warnings.map((c,u)=>e.jsx(N,{size:"sm",tone:"warning",className:"break-words",children:c},`${c}-${u}`))]}),l=s.length>0?e.jsx("div",{className:"space-y-1",children:s.map((c,u)=>e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(ce,{variant:"outline",children:c.result}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:c.reason})]}),e.jsxs("p",{className:"mt-0.5 break-all font-mono text-xs",children:[c.recipient,"/",c.channel,c.error?` - ${c.error}`:""]})]},`${c.recipient}-${c.channel}-${u}`))}):e.jsx(N,{size:"sm",tone:"muted",children:"none"}),i=e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.toolPolicy.grantedTools.map(c=>e.jsx(ce,{tone:"success",variant:"soft",children:c},`granted-${c}`)),r.map(c=>e.jsx(ce,{tone:"destructive",variant:"soft",children:c},`denied-${c}`)),t.toolPolicy.grantedTools.length===0&&r.length===0&&e.jsx(N,{as:"span",size:"sm",tone:"muted",children:"none"})]}),t.errorCount>0&&e.jsxs(N,{size:"sm",tone:"destructive",children:[t.errorCount," error",t.errorCount===1?"":"s"]}),o.map((c,u)=>e.jsx(N,{size:"sm",tone:"destructive",className:"break-words",children:c},`${t.runId}-error-${u}`))]});return e.jsxs(ae,{as:"article",size:"sm",headingLevel:3,stackBelow:"sm",title:t.habitName,description:e.jsx("span",{className:"break-all font-mono",children:t.runId}),action:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ce,{tone:gd(t.outcome),variant:"soft",children:t.outcome}),e.jsx(ce,{variant:"outline",children:t.trigger})]}),footer:e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:[oe(t.endedAt),t.nextRunAt&&e.jsxs(e.Fragment,{children:[" · next ",oe(t.nextRunAt)]})]}),children:[e.jsx(he,{items:[{term:"routes",details:a},{term:"attempts",details:l},{term:"tools",details:i}]}),(t.producedRefs.length>0||t.receiptLocator)&&e.jsxs("div",{className:"mt-3 space-y-1.5",children:[e.jsx(ye,{}),t.producedRefs.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.producedRefs.map((c,u)=>e.jsxs(ce,{variant:"outline",children:[c.kind,": ",c.locator]},`${c.kind}-${c.locator}-${u}`))}),e.jsx("p",{className:"break-all font-mono text-xs",children:t.receiptLocator})]})]})}function He(t){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(zo(t)))}function jd({messages:t}){var b;const n=t.filter(m=>m.role!=="system"&&m.role!=="tool"),[s,o]=d.useState(!1),r=s?n:n.slice(-30),a=n.length-r.length,l=((b=r[r.length-1])==null?void 0:b.id)??null,{ref:i,onScroll:c,preserveScroll:u}=_o(l),p=[];for(const m of n){if(m.role!=="assistant")continue;const h=(m.toolCalls??[]).map(qt);for(const x of h)x.kind==="surface"&&p.push({index:m.sequence,kind:"surfaced",label:de(x.deliveredText??"",40)}),x.kind==="rest"&&p.push({index:m.sequence,kind:"resting",label:"resting"}),x.kind==="delegation"&&p.push({index:m.sequence,kind:"delegated",label:"continued thinking"})}function f(m){var x;const h=(x=i.current)==null?void 0:x.querySelector(`[data-msg-index="${m}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"})}return e.jsxs("div",{children:[p.length>0&&e.jsx("div",{className:"mt-2 mb-1 flex flex-wrap gap-1",children:p.map((m,h)=>e.jsxs(ce,{variant:"soft",tone:m.kind==="surfaced"?"success":m.kind==="resting"?"secondary":"warning",onClick:()=>{u(),o(!0),setTimeout(()=>f(m.index),100)},children:[m.kind==="surfaced"?"★":m.kind==="resting"?"—":"→"," #",m.index]},h))}),e.jsxs("div",{ref:i,"data-testid":"inner-transcript-scroll",onScroll:c,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(re,{variant:"plain",size:"sm",fullWidth:!0,className:"mb-2",onClick:()=>{u(),o(!0)},children:["Load ",a," earlier messages"]}),r.map(m=>{const h=Ge(m);if(m.role==="user"){const x=h.includes("[pending from")||h.includes("[delegated"),v=h.includes("waking up")||h.includes("world-state checkpoint");return e.jsx("div",{"data-msg-index":m.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 ${x?"bg-ouro-gold/8 ring-ouro-gold/15":v?"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:x?"var(--color-ouro-gold)":"var(--color-ouro-shadow)"},children:x?"★ delegated":v?"heartbeat":"prompt"}),e.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",m.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:He(m)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:h})]})},m.id)}if(m.role==="assistant"){const x=(m.toolCalls??[]).map(qt),v=x.filter(w=>w.kind==="surface"),y=x.filter(w=>w.kind==="rest"),j=x.filter(w=>w.kind==="delegation");return e.jsxs("div",{"data-msg-index":m.sequence,children:[v.map(w=>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:["#",m.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:He(m)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:w.deliveredText}),w.metadata&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",w.metadata]})]})},w.id)),j.length>0&&e.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-gold/50",children:["— still thinking — #",m.sequence," · ",He(m)]}),y.length>0&&e.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/40",children:["— resting — #",m.sequence," · ",He(m)]}),v.length===0&&y.length===0&&j.length===0&&h&&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:["#",m.sequence]}),e.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:He(m)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ouro-mist whitespace-pre-wrap break-words",children:h})]})})]},m.id)}return null})]})]})}function yd({agentName:t,view:n,refreshGeneration:s}){const o=mt(),[r,a]=d.useState(null),[l,i]=d.useState(null),[c,u]=d.useState(!1),[p,f]=d.useState(null),[b,m]=d.useState(!1),h=d.useRef(null),x=n.inner;d.useEffect(()=>{Q(`/agents/${encodeURIComponent(t)}/habits`).then(a)},[t,s]),d.useEffect(()=>{let S=!1;return u(!1),i(null),Q(`/agents/${encodeURIComponent(t)}/habit-runs`).then(B=>{S||i(B)}).catch(()=>{S||u(!0)}),()=>{S=!0}},[t,s]),d.useEffect(()=>{p&&h.current!==s&&(h.current=s,Q(`/agents/${encodeURIComponent(t)}/inner-transcript`).then(f))},[t,s,p!==null]);function v(){if(p){m(!b);return}Q(`/agents/${encodeURIComponent(t)}/inner-transcript`).then(S=>{h.current=s,f(S),m(!0)})}const y=(r==null?void 0:r.items)??[],j=(l==null?void 0:l.items)??[],w=y.filter(S=>S.isOverdue),g=y.filter(S=>S.status==="active"&&!S.isOverdue),E=y.filter(S=>S.status==="paused"),$=x.mode==="deep"?x.origin:null,R=x.mode==="deep"?x.obligationStatus:null,L=x.returnObligationQueue,I=y.find(S=>S.name.toLowerCase()==="heartbeat"),_=l?`${l.totalCount} recorded${l.totalCount>j.length?` · showing ${j.length}/${l.totalCount}`:""}`:c?"Run history unavailable":"Loading runs";return e.jsxs("div",{className:"space-y-8",children:[I&&e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Heartbeat"}),e.jsx(ae,{size:"sm",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ce,{tone:I.isOverdue?"destructive":"success",variant:"soft",dot:!0,children:I.isOverdue?"Overdue":"Healthy"}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:["every ",I.cadence??"unknown"," · last ",I.lastRun?oe(I.lastRun):"never"]})]})})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Private runtime work"}),e.jsxs(ae,{size:"sm",title:x.status,description:x.summary??void 0,children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{size:"sm",tone:"muted",children:x.hasPending?"Private runtime work queued.":"No private runtime work."}),(L.queuedCount>0||L.runningCount>0)&&e.jsxs(N,{size:"sm",children:["Held work items:"," ",e.jsx("span",{className:"font-medium",children:L.queuedCount+L.runningCount})," ","(",L.queuedCount," queued",L.runningCount>0?`, ${L.runningCount} running`:"",")",L.oldestActiveAt!==null&&e.jsxs("span",{children:[" · oldest ",oe(new Date(L.oldestActiveAt).toISOString())]})]})]}),$&&e.jsxs("div",{className:"mt-3",children:[e.jsx(N,{size:"sm",tone:"muted",children:"Triggered from"}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>{o({tab:"sessions",focus:`${$.friendId}/${$.channel}/${$.key}`})},children:[$.friendId.slice(0,8),"…/",$.channel,"/",$.key]}),R&&e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>o({tab:"work"}),children:["obligation: ",R]})]})]})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Habit sessions",meta:_}),l?j.length>0?e.jsx("div",{className:"space-y-2",children:j.map(S=>e.jsx(vd,{run:S},S.runId))}):e.jsx(ne,{title:"No habit sessions recorded.",variant:"plain",align:"start"}):c?e.jsx(fe,{tone:"warning",title:"Habit sessions unavailable."}):e.jsx(Ie,{shape:"card",size:"sm",count:2})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Private runtime",meta:p?`${p.messages.length} total`:void 0}),p?e.jsx(jd,{messages:p.messages}):e.jsx(re,{variant:"outline",fullWidth:!0,onClick:v,children:"Load private runtime"})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Habits",meta:(r==null?void 0:r.totalCount)??0}),e.jsx(Tt,{label:`Overdue (${w.length})`,habits:w}),e.jsx(Tt,{label:`Running fine (${g.length})`,habits:g}),e.jsx(Tt,{label:`Paused (${E.length})`,habits:E}),y.length===0&&e.jsx(ne,{title:"No habits configured.",variant:"plain",align:"start"})]})]})}function Tt({label:t,habits:n}){return n.length===0?null:e.jsx(Z,{label:t,children:n.map(s=>e.jsx(bd,{h:s},s.name))})}const ys={sm:"size-ouro-4",md:"size-ouro-5",lg:"size-ouro-8"},ws={primary:"text-primary",secondary:"text-muted-foreground",destructive:"text-destructive",success:"text-success",warning:"text-warning"};function wd(t){const{label:n="Loading",size:s="md",tone:o,className:r,color:a,...l}=t,i=Object.hasOwn(ys,s)?s:"md",c=o!==void 0&&Object.hasOwn(ws,o)?o:void 0;return X("Spinner",r,""),V(),e.jsxs("span",{...l,role:"status","data-ouro":"spinner",className:C("relative inline-flex shrink-0 align-middle",ys[i],c&&ws[c],r),children:[e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",className:"size-full 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"})]}),e.jsx("span",{className:"sr-only",children:n})]})}function kd({agentName:t,refreshGeneration:n}){const[s,o]=d.useState(null),[r,a]=d.useState(null),[l,i]=d.useState("diary");if(d.useEffect(()=>{Q(`/agents/${encodeURIComponent(t)}/notes`).then(o),Q(`/agents/${encodeURIComponent(t)}/note-decisions`).then(a).catch(()=>{})},[t,n]),!s)return e.jsxs("div",{"aria-busy":"true",className:"space-y-3 py-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wd,{label:"Loading…"}),e.jsx(N,{as:"span",size:"sm",tone:"muted","aria-hidden":"true",children:"Loading…"})]}),e.jsx(Ie,{shape:"card",count:3})]});const c=s.recentDiaryEntries,u=s.recentCanonicalNotes,p=(f,b)=>e.jsx(re,{variant:l===f?"soft":"plain",tone:l===f?"primary":"secondary",size:"sm","aria-pressed":l===f,onClick:()=>i(f),children:b});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p("diary",`Diary (${s.diaryEntryCount})`),p("notes",`Notes (${s.canonicalNoteCount})`),p("decisions",`Decisions (${(r==null?void 0:r.totalCount)??0})`)]}),l==="diary"&&(c.length>0?e.jsx("div",{className:"space-y-3",children:c.map(f=>e.jsx(ae,{as:"article",size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(U,{children:f.source}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(f.createdAt)})]}),children:e.jsx(N,{size:"sm",children:f.text})},f.id))}):e.jsx(ne,{title:"No diary entries yet.",description:"The agent hasn't written anything down."})),l==="notes"&&(u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(f=>e.jsx(ae,{as:"article",size:"sm",title:f.title,description:oe(f.writtenAt),footer:f.tags.length>0?f.tags.map(b=>e.jsx(U,{children:b},b)):void 0,children:e.jsx(N,{size:"sm",tone:"muted",children:f.preview})},f.filename))}):e.jsx(ne,{title:"No canonical notes yet."})),l==="decisions"&&e.jsx(Z,{variant:"outline","aria-label":"Note decisions",empty:e.jsx(ne,{title:"No note decisions logged yet."}),children:((r==null?void 0:r.items)??[]).map((f,b)=>e.jsx(G,{title:f.reason||f.kind.replace(/_/g," "),description:f.excerpt?e.jsx("span",{className:"block truncate",children:f.excerpt}):void 0,actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{color:f.decision==="saved"?"lime":"zinc",children:f.decision}),e.jsx(U,{children:f.kind.replace(/_/g," ")}),e.jsx(N,{as:"span",size:"sm",tone:"muted",children:oe(f.timestamp)})]})},b))})]})}const Nd=["vertical","horizontal","both"],Cd="[scrollbar-width:thin] [scrollbar-color:color-mix(in_oklab,var(--muted-foreground)_40%,transparent)_transparent] pointer-fine:hover:[scrollbar-color:color-mix(in_oklab,var(--muted-foreground)_60%,transparent)_transparent]",Sd={vertical:"overflow-x-hidden overflow-y-auto",horizontal:"overflow-x-auto overflow-y-hidden",both:"overflow-auto"},Ed="data-ouro-scroll-fade-y:[mask-image:linear-gradient(to_bottom,transparent,#000_min(var(--scroll-area-overflow-y-start),2rem),#000_calc(100%-min(var(--scroll-area-overflow-y-end),2rem)),transparent)]",_d="a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),summary,[tabindex]:not([tabindex='-1']),[contenteditable='true']";function zd(t){d.useEffect(()=>{const n=t.current,s=()=>{const l=(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&!n.querySelector(_d)?0:-1;n.tabIndex!==l&&(n.tabIndex=l);const i=n.scrollHeight-n.clientHeight,c=Math.max(0,n.scrollTop),u=Math.max(0,i-c),p=i>1&&getComputedStyle(n).overflowY!=="hidden";n.toggleAttribute("data-ouro-scroll-fade-y",p),n.toggleAttribute("data-overflow-y-start",p&&c>1),n.toggleAttribute("data-overflow-y-end",p&&u>1),n.style.setProperty("--scroll-area-overflow-y-start",`${p?c:0}px`),n.style.setProperty("--scroll-area-overflow-y-end",`${p?u:0}px`)},o=new ResizeObserver(s);o.observe(n),o.observe(n.firstElementChild),n.addEventListener("scroll",s);const r=new MutationObserver(s);return r.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["tabindex","disabled","href"]}),()=>{o.disconnect(),r.disconnect(),n.removeEventListener("scroll",s)}},[t])}function Ad(t,n){d.useRef({}),d.useEffect(()=>{},[t,n])}function Ld(t){const{children:n,orientation:s="vertical",label:o,contain:r,className:a,type:l,maxHeight:i,height:c,...u}=t,p=d.useRef(null);Ad(p,o),yo(p),zd(p);const f=Nd.includes(s)?s:"vertical";X("ScrollArea",a,""),V();const b=f==="vertical"&&Ed;return e.jsxs("div",{...u,"data-ouro":"scroll-area",className:C("group/scroll-area relative flex min-h-0 min-w-0 flex-col overflow-hidden",a),children:[e.jsx("div",{ref:p,"data-scroll-viewport":"",tabIndex:-1,"data-ouro-control":"scroll-area","data-ouro-part":"viewport",role:o?"region":void 0,"aria-label":o,className:C("peer min-h-0 focus-visible:isolate flex-1 rounded-[inherit] outline-none",Sd[f],Cd,jo,b,r&&"overscroll-contain"),children:e.jsx("div",{className:f==="vertical"?"min-w-0":"min-w-fit",children:n})}),e.jsx("span",{"aria-hidden":"true","data-scroll-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"})]})}const Io={start:"text-start",center:"text-center",end:"text-end"},Mo="m-0 align-middle whitespace-nowrap border-b border-border font-normal",Oo="whitespace-normal wrap-anywhere min-w-48",Po={md:"px-4 py-3",dense:"px-3 py-1.5"},Td="font-medium text-muted-foreground",$d="sticky top-0 z-20 bg-background",Do={head:"",body:"[tbody>tr:last-child>&]:border-b-0",foot:"border-t border-b-0 font-medium"},Rd="after:outline-ring after:-outline-offset-2 focus-visible:after:outline-2 focus-visible:after:outline-solid",Id=(t,n)=>`Sorted by ${t}, ${n}`,Md="m-0 inline-flex max-w-full cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-start [font:inherit] text-inherit outline-none pointer-fine:hover:text-foreground after:absolute after:inset-0 after:z-1 after:content-[''] after:transition-colors after:duration-(--ouro-duration-fast) pointer-fine:hover:after:bg-foreground/[0.03] active:after:bg-foreground/[0.06] after:outline-ring after:-outline-offset-2 focus-visible:after:outline-2 focus-visible:after:outline-solid forced-colors:after:border forced-colors:after:border-solid",Od={ascending:"M8 13V3M4 7l4-4 4 4",descending:"M8 3v10M4 9l4 4 4-4",none:"M5 6l3-3 3 3M5 10l3 3 3-3"};function Bo(t){return t===void 0?void 0:t==="descending"?"descending":"ascending"}const Fo=d.createContext(null),Ho=d.createContext(null),rn=d.createContext(null);function xt(t,n){return ue(t,`must be rendered inside <${n}>`)}function bt(t){return d.useContext(Fo)??xt(t,"Table")}const Uo=t=>{},an=()=>"";function Pd(t){const{caption:n,hideCaption:s,striped:o,dense:r,stickyHeader:a,sortedLabel:l=Id,children:i,className:c,tableRef:u,...p}=t;return e.jsx(Fo.Provider,{value:{dense:!!r,striped:!!o,stickyHeader:!!a,sortedLabel:l},children:e.jsxs("div",{...p,"data-ouro":"table",className:C("flex min-w-0 flex-col gap-3",c),children:[!s&&e.jsx("div",{"aria-hidden":!0,"data-table-caption":"",className:"text-sm font-medium text-muted-foreground",children:n}),e.jsx(Ld,{orientation:"both",label:n,className:"min-h-0 flex-1",children:e.jsxs("table",{ref:u,className:"w-full border-separate border-spacing-0 text-base text-foreground pointer-fine:text-sm",children:[e.jsx("caption",{className:"sr-only",children:n}),i]})})]})})}function qo(t){const{part:n,kind:s,className:o,...r}=t;bt(n),X(n,o,an());const a=s==="head"?"thead":s==="body"?"tbody":"tfoot";return e.jsx(Ho.Provider,{value:s,children:e.jsx(a,{...r,className:C(o)})})}function Dd(t){return e.jsx(qo,{...t,part:"TableHeader",kind:"head"})}function Bd(t){return e.jsx(qo,{...t,part:"TableBody",kind:"body"})}function $t(t){const{href:n,external:s,externalLabel:o="(opens in a new tab)",className:r,ref:a,children:l,...i}=t,c=bt("TableRow"),u=d.useContext(Ho)??xt("TableRow","TableBody"),p=d.useRef(null),f=ge(a,p);X("TableRow",r,"");const b=n!==void 0&&u==="body";return d.useEffect(()=>{}),e.jsx(rn.Provider,{value:{section:u,href:b?n:void 0,external:!!s,externalLabel:o,claim:{}},children:e.jsx("tr",{...i,ref:f,onClick:m=>{var h;return(h=i.onClick)==null||h.call(i,m),$e(m)},onAuxClick:m=>{var h;return(h=i.onAuxClick)==null||h.call(i,m),$e(m)},"data-linked":b?"":void 0,"data-follows-link":b?"":void 0,className:C(c.striped&&u==="body"&&"even:bg-muted/50",b&&"relative isolate cursor-pointer pointer-coarse:h-ouro-11",b&&sn,r),children:l})})}function Wt(t){return t==="center"||t==="end"?t:"start"}function Wo(t,n){V()}function Fd(t){const{align:n,hideHeader:s,wrap:o,sorted:r,onSort:a,className:l,children:i,...c}=t,u=bt("TableHead"),p=d.useContext(rn)??xt("TableHead","TableRow");X("TableHead",l,an(),Uo()),Wo(),V();const f=Bo(r),b=s?e.jsx("span",{className:"sr-only",children:i}):i,m=(a||f)&&e.jsx("svg",{"aria-hidden":"true","data-sort-icon":f??"none",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"size-ouro-3_5 shrink-0",children:e.jsx("path",{d:Od[f??"none"]})});return e.jsx("th",{scope:"col","aria-sort":f,...c,className:C(Mo,Td,Po[u.dense?"dense":"md"],Io[Wt(n)],Do[p.section],o&&Oo,f&&"text-foreground",a&&"relative pointer-coarse:h-ouro-11",u.stickyHeader&&p.section==="head"&&$d,l),children:a?e.jsxs("button",{type:"button","data-ouro-control":"table","data-ouro-part":"sort",className:C(Md,Wt(n)==="end"&&"flex-row-reverse"),onClick:h=>{const x=f==="ascending"?"descending":"ascending";Qt(u.sortedLabel(h.currentTarget.textContent,x)),a(x)},children:[e.jsx("span",{className:"min-w-0",children:b}),m]}):e.jsxs(e.Fragment,{children:[b,m&&e.jsx("span",{className:"ms-1.5 inline-flex align-middle",children:m})]})})}function Vo(t){return d.Children.toArray(t).some(n=>d.isValidElement(n)&&(n.type==="a"||Vo(n.props.children)))}function ks(t){var b;const{rowHeader:n,align:s,wrap:o,className:r,children:a,...l}=t,i=bt("TableCell"),c=d.useContext(rn)??xt("TableCell","TableRow"),u=d.useId();X("TableCell",r,an(),Uo()),Wo(),n&&c.href!==void 0&&((b=c.claim).owner??(b.owner=u));const p=n&&c.href!==void 0&&c.claim.owner===u&&!Vo(a),f=n?"th":"td";return e.jsx(f,{scope:n?"row":void 0,...l,className:C(Mo,Po[i.dense?"dense":"md"],Io[Wt(s)],Do[c.section],n&&"font-medium",o&&Oo,r),children:p?e.jsxs(Se,{href:c.href,target:c.external?"_blank":void 0,rel:c.external?pt(void 0):void 0,"data-table-row-link":"","data-stretched-link":"","data-ouro-control":"table","data-ouro-part":"row-link",className:C(dt,Rd),children:[a,c.external&&e.jsxs("span",{"data-external-label":"",className:"sr-only",children:[" ",c.externalLabel]})]}):a})}const Hd=["start","center","end"];function Ud(t){const n=t instanceof Date?t.getTime():typeof t=="boolean"?Number(t):t;return typeof n=="number"?Number.isNaN(n)?null:n:typeof n=="string"&&n!==""?n:null}const Ns=t=>t.sortable??t.sortValue!==void 0,qd=(t,n)=>t.sortValue?t.sortValue(n):n[t.key];function Wd(t,n,s,o){const r=new Intl.Collator(o,{numeric:!0}),a=s==="descending"?-1:1,l=(u,p)=>typeof u!=typeof p?typeof u=="number"?-1:1:typeof u=="number"?u-p:r.compare(u,p),i=t.map(u=>({row:u,key:Ud(qd(n,u))}));return[...i.filter(u=>u.key!==null).sort((u,p)=>a*l(u.key,p.key)),...i.filter(u=>u.key===null)].map(u=>u.row)}const Vd=()=>()=>{},Kd=()=>{},Yd=()=>"en",Cs=[];function Gd(t){const{caption:n,hideCaption:s,striped:o,dense:r,stickyHeader:a,className:l,style:i,ref:c,columns:u,rows:p,rowKey:f,rowHref:b,rowExternal:m,externalLabel:h,empty:x="Nothing here yet.",sort:v,defaultSort:y,onSortChange:j,sortedLabel:w,children:g,data:E,onRowClick:$,title:R,sortable:L,...I}=t;X("Table",l,""),V();const _=p??Cs,[S,B]=d.useState(y??null),M=v!==void 0,W=M?v:S,J=(u??Cs).find(k=>k.key===(W==null?void 0:W.key)&&Ns(k)),ee=Bo(W==null?void 0:W.direction),F=d.useSyncExternalStore(Vd,Kd,Yd),q=k=>{B(k),j==null||j(k)},K=d.useMemo(()=>M||!J?_:Wd(_,J,ee,F),[M,_,J,ee,F]),ie=(u==null?void 0:u.findIndex(k=>k.rowHeader))??-1,le=ie>=0?ie:Math.max(0,(u==null?void 0:u.findIndex(k=>!k.cell))??0),se=k=>k!==void 0&&Hd.includes(k)?k:void 0,A=u===void 0?g:e.jsxs(e.Fragment,{children:[e.jsx(Dd,{children:e.jsx($t,{children:u.map(k=>e.jsx(Fd,{align:se(k.align),hideHeader:k.hideHeader,wrap:k.wrap,className:k.className,sorted:k===J?ee:void 0,onSort:Ns(k)?H=>q({key:k.key,direction:H}):void 0,children:k.header},k.key))})}),e.jsx(Bd,{children:K.length===0?e.jsx($t,{children:e.jsx(ks,{colSpan:u.length,children:e.jsx("span",{className:"text-muted-foreground",children:x})})}):K.map((k,H)=>{const z=k,D=typeof f=="function"?f(k,H):f!==void 0?z[f]:typeof z.id=="string"||typeof z.id=="number"?z.id:H,O=typeof b=="function"?b(k):b!==void 0?z[b]:void 0;return e.jsx($t,{href:O,external:m,externalLabel:h,children:u.map((T,P)=>e.jsx(ks,{rowHeader:P===le,align:se(T.align),wrap:T.wrap,children:T.cell?T.cell(k,H):z[T.key]},T.key))},D)})})]});return e.jsx(Pd,{...I,caption:n,hideCaption:s,striped:o,dense:r,stickyHeader:a,sortedLabel:w,className:l,style:i,tableRef:c,children:A})}const Xd=[{key:"level",header:"Level",cell:t=>e.jsx(ce,{tone:t.level==="error"?"destructive":t.level==="warn"?"warning":"secondary",children:t.level})},{key:"ts",header:"When",cell:t=>oe(t.ts)},{key:"event",header:"Event",cell:t=>e.jsx("span",{className:"font-mono",children:t.event})},{key:"message",header:"Message",wrap:!0,cell:t=>t.message}];function Jd({agentName:t,view:n,refreshGeneration:s}){var h;const[o,r]=d.useState(null),[a,l]=d.useState(null),i=n.agent,c=i.degraded,u=i.freshness,p=((h=i.providers)==null?void 0:h.lanes)??[];d.useEffect(()=>{Promise.all([Q("/machine/health").then(r).catch(()=>null),Q("/machine/logs").then(l).catch(()=>null)])},[t,s]);const f=ru(o)?o:null,b=(f==null?void 0:f.degradedComponents)??[],m=(a==null?void 0:a.entries)??[];return e.jsxs("div",{className:"space-y-8",children:[c.status==="degraded"&&c.issues.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Agent issues",meta:c.issues.length}),e.jsx(Z,{"aria-label":"Agent issues",variant:"outline",children:c.issues.map((x,v)=>e.jsx(G,{size:"sm",title:e.jsx(N,{as:"span",tone:"destructive",children:e.jsx("span",{className:"font-mono",children:x.code})}),description:e.jsx("span",{className:"break-all",children:x.detail})},v))})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Agent config"}),e.jsx(he,{items:[{term:"Provider lanes",details:Qd(p)},{term:"Enabled",details:i.enabled?"yes":"no"},{term:"Freshness",details:`${u.status}${u.ageMs!=null?` (${Math.floor(u.ageMs/6e4)}m)`:""}`}]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Provider lanes",meta:p.length>0?p.length:void 0}),p.length>0?e.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:p.map(x=>{const v=nu(x);return e.jsx(ae,{size:"sm",headingLevel:3,title:x.lane,description:Zd(x),action:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ce,{tone:su(x),children:x.status}),e.jsx(ce,{tone:ou(x.readiness.status),children:x.readiness.status})]}),children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs(N,{size:"sm",children:["source: ",x.source]}),e.jsxs(N,{size:"sm",children:["readiness: ",eu(x.readiness)]}),x.readiness.attempts!==void 0&&e.jsxs(N,{size:"sm",children:["attempts: ",x.readiness.attempts]}),x.readiness.checkedAt&&e.jsxs(N,{size:"sm",children:["checked: ",oe(x.readiness.checkedAt)]}),e.jsxs(N,{size:"sm",children:["credentials: ",tu(x.credential)]}),x.credential.revision&&e.jsxs(N,{size:"sm",children:["revision: ",x.credential.revision]}),Ss(x)&&e.jsxs(N,{size:"sm",children:["reason: ",Ss(x)]}),v&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(N,{size:"sm",tone:"destructive",className:"min-w-0 break-all",children:["repair: ",v]}),e.jsx(wo,{value:v,label:"Copy repair command",hideLabel:!0,variant:"plain"})]}),x.warnings.map((y,j)=>e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:["warning: ",y]},j))]})},x.lane)})}):e.jsx(ne,{title:"No provider lane data loaded.",variant:"plain",align:"start"})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Daemon health"}),f?e.jsxs(e.Fragment,{children:[e.jsx(he,{items:[{term:"Status",details:f.status},{term:"Mode",details:f.mode},{term:"Uptime",details:`${Math.floor(f.uptimeSeconds/60)}m`}]}),b.length>0&&e.jsx(Z,{label:"Degraded components",variant:"outline",children:b.map((x,v)=>e.jsx(G,{size:"sm",title:e.jsx(N,{as:"span",tone:"destructive",children:x.component}),description:x.reason},v))})]}):e.jsx(ne,{title:"No health file found.",description:"This is normal when not running under the daemon.",variant:"plain",align:"start"})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Recent logs",meta:`${(a==null?void 0:a.totalLines)??0} total`}),m.length>0?e.jsx(Gd,{caption:"Recent logs",hideCaption:!0,dense:!0,stickyHeader:!0,className:"max-h-96",columns:Xd,rows:[...m].reverse().slice(0,50),rowKey:(x,v)=>v}):e.jsx(ne,{title:"No log entries.",variant:"plain",align:"start"})]})]})}function Qd(t){return t.length===0?"none":`${t.filter(s=>s.status==="configured").length}/${t.length} configured`}function Zd(t){return t.status==="unconfigured"?"unconfigured":`${t.provider} / ${t.model}`}function eu(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 tu(t){return t.status==="present"?t.source??"vault":t.status==="invalid-pool"?"vault unavailable":"missing"}function nu(t){return t.status==="unconfigured"?t.repairCommand:t.credential.repairCommand}function Ss(t){return t.status==="unconfigured"?t.reason:t.readiness.reason}function su(t){return t.status==="configured"?"success":"warning"}function ou(t){return t==="ready"?"success":t==="failed"?"destructive":t==="stale"?"warning":"secondary"}function ru(t){return!!(t&&"degradedComponents"in t)}const Rt=[{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 au(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function iu({agentName:t,view:n,deskPrefs:s,refreshGeneration:o,initialRoute:r,onNavigate:a}){const[l,i]=d.useState((r==null?void 0:r.tab)??"overview"),[c,u]=d.useState(r==null?void 0:r.focus),p=d.useRef(t);d.useEffect(()=>{const v=p.current!==t;if(p.current=t,(r==null?void 0:r.agent)===t){i(r.tab),u(r.focus);return}v&&(i("overview"),u(void 0))},[t,r==null?void 0:r.agent,r==null?void 0:r.focus,r==null?void 0:r.tab]);const f=d.useCallback(v=>{const y={agent:t,tab:v.tab,focus:v.focus};i(v.tab),u(v.focus),window.history.pushState(null,"",rt(y)),a==null||a(y)},[t,a]),b=d.useCallback(v=>{const y={agent:t,tab:v,focus:void 0};i(v),u(void 0),window.history.pushState(null,"",rt(y)),a==null||a(y)},[t,a]),m=d.useCallback(()=>u(void 0),[]);if(Ci(f),!n||!t)return e.jsx(ne,{variant:"plain",className:"py-24",headingLevel:2,title:"Choose an agent",description:"Select an agent from the sidebar to inspect its state."});const x=n.agent.attention;return e.jsx($s.Provider,{value:f,children:e.jsxs("div",{children:[e.jsx(nn,{title:t,divider:!0,className:"min-h-[4.5rem]",actions:e.jsx(U,{color:au(x.level),children:x.label})}),e.jsx("nav",{className:"mt-4 flex gap-0.5 overflow-x-auto border-b border-ouro-moss/20 -mx-1",children:(()=>{const v=s==null?void 0:s.tabOrder;if(!v)return Rt;const y=v.map(w=>Rt.find(g=>g.id===w)).filter(w=>w!==void 0),j=Rt.filter(w=>!v.includes(w.id));return[...y,...j]})().map(v=>e.jsx("button",{type:"button",onClick:()=>b(v.id),className:`shrink-0 px-3 py-2 text-xs font-mono uppercase tracking-wider transition-colors rounded-t-md ${l===v.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:v.label},v.id))}),e.jsxs("div",{className:"mt-6",children:[l==="overview"&&e.jsx(Nl,{view:n,deskPrefs:s,refreshGeneration:o}),l==="mail"&&e.jsx(ql,{agentName:t,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="sessions"&&e.jsx(ed,{agentName:t,focus:c,onFocusConsumed:m,deskPrefs:s,refreshGeneration:o}),l==="work"&&e.jsx(hd,{agentName:t,view:n,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="connections"&&e.jsx(xd,{agentName:t,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="inner"&&e.jsx(yd,{agentName:t,view:n,refreshGeneration:o}),l==="notes"&&e.jsx(kd,{agentName:t,refreshGeneration:o}),l==="runtime"&&e.jsx(Jd,{agentName:t,view:n,refreshGeneration:o})]})]})})}const lu={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 ln(t,n){const s=t===null?NaN:n-Date.parse(t);return Number.isFinite(s)&&s>=0?s:null}function Es(t,n){const s=ln(t,n);return s===null?"unknown":`${Math.floor(s/1e3)}s`}function tt(t,n){const s=ln(t,n);return s!==null&&s<=3e4}function It({command:t,label:n}){const[s,o]=d.useState(null);if(!t)return null;const r=async()=>{try{await navigator.clipboard.writeText(t),o("copied")}catch{o("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 font-mono text-xs",children:t}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>{r()},children:["Copy ",n," command"]}),s==="copied"&&e.jsx(N,{as:"span",size:"sm",tone:"muted",role:"status",children:"Copied for local execution; nothing was run."})]}),s==="failed"&&e.jsx(fe,{tone:"warning",title:"Copy failed.",description:"Select the command text and copy it manually."})]})}function _s({events:t,withTerminal:n}){return e.jsx("ol",{className:"mt-3 space-y-3",children:t.map(s=>e.jsxs("li",{className:"break-words text-sm",children:[e.jsxs("p",{children:[n&&e.jsxs(e.Fragment,{children:[s.host," / ",s.session,": "]}),lu[s.kind],": ",s.summary]}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-ouro-mist",children:[e.jsx("time",{dateTime:s.at,children:s.at})," | ",n?s.instance??"instance not recorded":s.instance?`instance ${s.instance}`:"instance not recorded"]})]},s.id))})}function cu({agents:t,agentName:n,focus:s,refreshGeneration:o,onSelectOwner:r}){const[a,l]=d.useState(null),[i,c]=d.useState(null),[u,p]=d.useState(Date.now),f=d.useRef(null),b=d.useRef(o);d.useEffect(()=>{if(!n){f.current=null;return}const g=n;let E=!0,$=!1,R=!1,L=null;const I=async()=>{if(E){if($){R=!0;return}$=!0,L=new AbortController;try{const W=await Q(`/agents/${encodeURIComponent(g)}/supervision`,{signal:L.signal});if(!E)return;if(W.agentName!==g)throw new Error("the observation belongs to another agent");if(W.schemaVersion!==1)throw new Error("unsupported observation schema");l(W),c(null),p(Date.now())}catch(W){E&&!L.signal.aborted&&c({agent:g,message:W instanceof Error?W.message:String(W)})}finally{$=!1,E&&R&&(R=!1,I())}}},_=()=>{I()};f.current=_,_();const S=window.setInterval(()=>{document.visibilityState!=="hidden"&&_()},5e3),B=window.setInterval(()=>p(Date.now()),1e3),M=()=>{p(Date.now()),document.visibilityState!=="hidden"&&_()};return document.addEventListener("visibilitychange",M),()=>{E=!1,L==null||L.abort(),window.clearInterval(S),window.clearInterval(B),document.removeEventListener("visibilitychange",M),f.current===_&&(f.current=null)}},[n]),d.useEffect(()=>{var g;b.current!==o&&(b.current=o,(g=f.current)==null||g.call(f))},[o]);const m=(a==null?void 0:a.agentName)===n?a:null,h=(i==null?void 0:i.agent)===n?i.message:null,x=(m==null?void 0:m.freshness.status)==="fresh"&&tt(m.freshness.observedAt,u),v=!m||m.freshness.status==="unknown"||ln(m.freshness.observedAt,u)===null?"unknown":x?"fresh":"stale",y=(m==null?void 0:m.sessions.items.map(g=>({...g,activity:x&&g.freshness.status==="fresh"&&tt(g.observedAt,u)?g.activity:"unknown",authority:x&&tt(g.observedAt,u)?g.authority:"unknown",capability:x&&tt(g.observedAt,u)?g.capability:"unknown"})))??[],j=m!=null&&m.counts?{working:0,idle:0,shell:0,unknown:0}:null;if(j)for(const g of y)j[g.activity]+=1;const w=(m==null?void 0:m.custody.claims.items.filter(g=>(g.state==="unknown"||g.state==="claimed")&&!g.retired))??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsx(nn,{title:"Supervision",description:e.jsx(e.Fragment,{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."}),actions: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:n??"",onChange:g=>r(g.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"}),n&&!t.includes(n)&&e.jsxs("option",{value:n,children:[n," (not in machine inventory)"]}),t.map(g=>e.jsx("option",{value:g,children:g},g))]})]})}),e.jsx(fe,{tone:"primary","aria-label":"Alpha automation boundary",title:"Alpha automation boundary",description:Hc}),n?e.jsxs(e.Fragment,{children:[h&&e.jsx(fe,{tone:"warning",title:`Could not load supervision for ${n}: ${h}.`,description:m?`Showing the last successful observation for ${n}; its age continues to increase.`:void 0,action:e.jsx(re,{size:"sm",variant:"outline",onClick:()=>{var g;return(g=f.current)==null?void 0:g.call(f)},children:"Retry observation"})}),!m&&!h&&e.jsxs(N,{role:"status",tone:"muted",children:["Loading supervision for ",n,"..."]}),m&&e.jsxs(e.Fragment,{children:[e.jsxs(ae,{as:"section","aria-label":"Observation health",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(U,{color:v==="fresh"?"lime":"yellow",children:e.jsxs("span",{"data-testid":"supervision-freshness",children:[v," observation"]})}),e.jsx(U,{color:m.health==="ok"?"zinc":"yellow",children:m.health==="ok"?"Sources readable":"Sources degraded"}),e.jsxs(N,{as:"span",size:"sm",children:["Observation age: ",Es(m.freshness.observedAt,u)]}),e.jsx(re,{variant:"plain",size:"sm",onClick:()=>{var g;return(g=f.current)==null?void 0:g.call(f)},children:"Refresh observation"})]}),m.freshness.observedAt&&e.jsxs(N,{size:"sm",tone:"muted",className:"mt-2 break-words",children:["Observed at ",e.jsx("time",{className:"font-mono",dateTime:m.freshness.observedAt,children:m.freshness.observedAt}),". Reading this page does not refresh the observation."]}),e.jsx(he,{className:"mt-3",items:Object.entries(m.sourceHealth).map(([g,E])=>({term:g,details:E}))}),m.sourceErrors.length>0&&e.jsx("ul",{className:"mt-3 space-y-1",children:m.sourceErrors.map((g,E)=>e.jsx("li",{children:e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:[g.source,": ",g.detail]})},`${g.source}:${g.code}:${E}`))})]}),e.jsx("section",{"aria-label":"Terminal counts",className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:["working","idle","shell","unknown"].map(g=>e.jsxs(ae,{size:"sm",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-ouro-mist",children:g}),e.jsx("p",{"data-testid":`supervision-count-${g}`,className:"mt-1 text-2xl tabular-nums",children:(j==null?void 0:j[g])??"Unknown"})]},g))}),e.jsxs(N,{size:"sm",tone:"muted",children:["Showing ",y.length," of ",m.sessions.totalCount??"unknown"," terminals.",m.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(g=>{const E=`${g.host}:${g.session}`,$=m.timeline.items.filter(R=>R.host===g.host&&R.session===g.session);return e.jsx(ae,{as:"article",headingLevel:2,title:g.label,action:e.jsx(U,{color:g.activity==="working"?"lime":g.activity==="unknown"?"yellow":"zinc",children:g.activity}),className:"min-w-0",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(he,{items:[{term:"Terminal",details:e.jsxs("span",{className:"font-mono",children:[g.host," / ",g.session]})},{term:"Harness",details:g.harness??"Unknown / no identified coding harness"},{term:"Project",details:e.jsx("span",{className:"font-mono",children:g.project??"Unknown"})},{term:"Process instance",details:e.jsx("span",{className:"font-mono",children:g.instance??"Unknown"})},{term:"Last observed",details:`${Es(g.observedAt,u)} ago`}]}),e.jsxs(N,{size:"sm",children:["Stored mandate / pause state: ",g.authority,". Guarded input: ",g.capability,"."]}),e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:["Stored policy assessment, not an enforced dispatch decision: ",g.withheldReason??"Unknown."]}),e.jsxs(N,{size:"sm",children:["Last recorded judgment: ",e.jsx("span",{children:g.lastDecisionLabel??"None recorded"})]}),e.jsxs(N,{size:"sm",tone:"muted",className:"break-words",children:["Last recorded action: ",g.lastAction==="respond"?"Reported terminal response":g.lastAction==="let_through"?"Let through without a response":"None recorded",".",g.lastReason&&e.jsxs(e.Fragment,{children:[" ",g.lastReason]}),g.lastActionAt&&e.jsxs(e.Fragment,{children:[" ",e.jsx("time",{dateTime:g.lastActionAt,children:g.lastActionAt})]})]}),e.jsx("a",{className:"inline-block text-xs text-ouro-glow underline",href:`#/supervision/${encodeURIComponent(n)}/${encodeURIComponent(E)}`,children:"Link to this terminal"}),e.jsxs("details",{open:s===E||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 ",g.label]}),$.length===0&&e.jsx(N,{size:"sm",tone:"muted",className:"mt-2",children:"No retained events for this terminal."}),e.jsx(_s,{events:$})]})]})},E)}),y.length===0&&e.jsx(ne,{title:m.counts===null?"Terminal inventory is unavailable, not empty.":"No terminals were present in this observation."})]}),e.jsxs(ae,{as:"section","aria-label":"Custody and held inputs",headingLevel:2,title:"Replay barriers and unknown inputs",children:[e.jsx(N,{size:"sm",tone:"warning",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(It,{command:bs(n),label:"status"},n)}),e.jsxs(N,{size:"sm",tone:"muted",className:"mt-2",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(N,{size:"sm",tone:"muted",className:"mt-2",children:["Custody revision: ",m.custody.revision??"unknown","."," ","Storage: ",m.custody.bytes===null?"unknown":`${m.custody.bytes.toLocaleString()} bytes`," (",m.custody.capacity,")."," ","Showing ",m.custody.claims.items.length," of ",m.custody.claims.totalCount??"unknown"," retained barriers.",m.custody.claims.truncated&&" Custody inventory is truncated."]}),w.map(g=>e.jsxs("div",{className:"mt-3 space-y-1 break-words text-sm",children:[e.jsx(ye,{className:"mb-3"}),e.jsxs("p",{children:["Original state: ",g.state," | ",g.host," / ",g.session]}),e.jsx("p",{className:"break-all font-mono text-xs",children:g.id}),e.jsxs(N,{size:"sm",tone:"muted",children:[g.reason??"No outcome evidence is recorded."," Acknowledgments in the timeline do not rewrite the original state."]}),e.jsx(It,{command:bs(n,g.id),label:"inspection"}),e.jsxs(ut,{title:"Local recovery after terminal retirement",className:"pt-2",children:[e.jsxs(N,{size:"sm",tone:"muted",className:"my-2",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(It,{command:Fc(n,g.id,m.custody.revision),label:"retirement"},`${g.id}:${m.custody.revision}`),m.custody.revision===null&&e.jsx(N,{size:"sm",tone:"warning",children:"No retirement command is available until a custody revision is known."})]})]},g.id)),m.custody.claims.totalCount===null&&e.jsx(N,{size:"sm",className:"mt-3",children:"Custody availability is unknown; zero held inputs cannot be established."})]}),e.jsx(ae,{size:"sm",children:e.jsx(ut,{title:"All retained events, including closed terminals",children:e.jsx(_s,{events:m.timeline.items,withTerminal:!0})})}),e.jsxs(N,{size:"sm",tone:"muted",children:["Retained timeline: ",m.timeline.items.length," of ",m.timeline.totalCount??"unknown"," events.",m.timeline.truncated&&" History is truncated; absence from this view is not proof that an event never occurred."]})]})]}):e.jsx(ne,{title:"No owner selected",description:"Choose an owning Ouro agent to inspect its terminal supervision. No fleet counts are available until an owner is selected."})]})}function Mt(){return Rs(window.location.hash)}function du(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function uu(){var H;const[t,n]=d.useState(()=>un(window.location.hash)),s=d.useRef(t!==null),[o,r]=d.useState(null),[a,l]=d.useState(((H=Mt())==null?void 0:H.agent)??""),[i,c]=d.useState(null),[u,p]=d.useState(null),[f,b]=d.useState(null),[m,h]=d.useState(null),[x,v]=d.useState(null),[y,j]=d.useState(null),[w,g]=d.useState("connecting"),[E,$]=d.useState(0),R=d.useRef(0),L=d.useRef(Mt()),[I,_]=d.useState(Mt),S=d.useRef(a),B=d.useRef(!0),M=d.useRef(0),W=d.useRef(0),J=d.useRef(null),ee=d.useRef(null),F=d.useCallback(z=>{var D;S.current!==z&&(S.current=z,W.current+=1,R.current+=1,(D=ee.current)==null||D.abort(),l(z),c(null),p(null),h(null),j(null))},[]),q=d.useCallback(async()=>{var O,T;const z=++M.current;(O=J.current)==null||O.abort();const D=new AbortController;J.current=D;try{const P=await Q("/machine",{signal:D.signal});if(!B.current||z!==M.current)return;if(r(P),b(null),v(new Date().toISOString()),!s.current&&!S.current&&P.agents.length>0){const Y=((T=L.current)==null?void 0:T.agent)??P.agents[0].agentName;F(Y)}}catch(P){if(!B.current||D.signal.aborted||z!==M.current)return;b(P instanceof Error?P.message:String(P))}},[F]),K=d.useCallback(async z=>{var P;if(!z)return;const D=++W.current;(P=ee.current)==null||P.abort();const O=new AbortController;ee.current=O;const T=()=>B.current&&D===W.current&&S.current===z;try{const[Y,be]=await Promise.all([Q(`/agents/${encodeURIComponent(z)}`,{signal:O.signal}),Q(`/agents/${encodeURIComponent(z)}/desk-prefs`,{signal:O.signal})]);if(!T())return;if(Y.agent.agentName!==z)throw new Error("the response belongs to another agent");c(Y),p(be),h(null),j(new Date().toISOString())}catch(Y){if(!T()||O.signal.aborted)return;h(Y instanceof Error?Y.message:String(Y))}},[]);d.useEffect(()=>(B.current=!0,()=>{var z,D;B.current=!1,M.current+=1,W.current+=1,R.current+=1,(z=J.current)==null||z.abort(),(D=ee.current)==null||D.abort()}),[]),d.useEffect(()=>{q()},[q]),d.useEffect(()=>{a&&K(a)},[a,K]);const ie=d.useCallback(async()=>{const z=++R.current,D=s.current?"":S.current;await Promise.all([q(),D?K(D):Promise.resolve()]),B.current&&R.current===z&&$(O=>O+1)},[q,K]);d.useEffect(()=>zr(()=>{ie()},g),[ie]),d.useEffect(()=>{const z=()=>{const D=un(window.location.hash);if(D){s.current=!0,n(D);return}const O=Rs(window.location.hash);O&&(s.current=!1,_(O),n(null),F(O.agent))};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[F]);const le=d.useCallback(z=>{const D={agent:z,tab:"overview",focus:void 0};_(D),s.current=!1,n(null),F(z),window.history.pushState(null,"",rt(D))},[F]),se=d.useCallback(z=>{s.current=!0,n({agent:z}),window.history.pushState(null,"",mn(z))},[]);if(!o)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-ouro-void",children:e.jsx("div",{className:"text-center",children:f?e.jsxs("div",{role:"alert",children:[e.jsxs("p",{className:"text-ouro-bone",children:["Could not connect to Mailbox: ",f]}),e.jsx("button",{type:"button",onClick:()=>{ie()},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 A=o.overview.totals,k=(i==null?void 0:i.agent.agentName)===a?i:null;return e.jsxs(Ir,{header:e.jsx(U,{color:o.overview.daemon.mode==="dev"?"yellow":"lime",children:o.overview.daemon.mode}),sidebar:e.jsx(yi,{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:A.liveTasks??0,l:"Tasks",alert:(A.blockedTasks??0)>0},{v:A.openObligations??0,l:"Oblig."},{v:A.activeCodingAgents??0,l:"Coding"}].map(z=>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 ${z.alert?"text-ouro-fang":"text-ouro-bone"}`,children:z.v}),e.jsx("div",{className:"text-[9px] uppercase tracking-widest text-ouro-shadow",children:z.l})]},z.l))})]}),sections:[{label:"Machine",items:[{label:"Supervision",href:mn(null),current:t!==null,onClick:z=>{z.preventDefault(),se(null)}}]},{label:"Agents",items:o.agents.map(z=>({label:z.agentName,href:rt({agent:z.agentName,tab:"overview",focus:void 0}),current:t===null&&z.agentName===a,onClick:D=>{D.preventDefault(),le(z.agentName)},badge:e.jsx(U,{color:du(z.attention.level),children:z.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:o.overview.runtime.version}),e.jsxs("p",{className:"mt-0.5",children:[o.overview.daemon.mode," · ",o.overview.freshness.status]})]}),t===null&&a&&k&&e.jsx("p",{className:"px-2 italic text-ouro-mist",children:(()=>{const z=u==null?void 0:u.statusLine;if(z)return z;const D=k.inner;if(D.status==="running"||D.hasPending)return"thinking through something privately";const T=k.work.obligations.openCount;return T>2?"a few loose ends":T>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:[w==="connected"?"Live connection":w==="reconnecting"?"Disconnected - reconnecting. Displayed snapshots may be stale.":"Connecting to live updates. Displayed snapshots may be stale.",x&&e.jsxs(e.Fragment,{children:[" Last machine snapshot received ",e.jsx("time",{dateTime:x,children:new Date(x).toLocaleTimeString()}),"."]})]}),f&&e.jsxs("div",{role:"alert",className:"mb-4 text-sm text-ouro-gold",children:["Could not refresh the machine snapshot: ",f,". Showing the last successful machine snapshot.",e.jsx("button",{type:"button",onClick:()=>{ie()},className:"ml-2 underline",children:"Retry"})]}),t===null&&m&&e.jsxs("div",{role:"alert",className:"mb-4 text-sm text-ouro-gold",children:["Could not load ",a,": ",m,".",k&&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:()=>{K(a)},className:"ml-2 underline",children:"Retry agent"})]}),t?e.jsx(cu,{agents:o.agents.map(z=>z.agentName),agentName:t.agent,focus:t.focus,refreshGeneration:E,onSelectOwner:se}):k||!a?e.jsx(iu,{agentName:a,view:k,deskPrefs:u,refreshGeneration:E,initialRoute:(I==null?void 0:I.agent)===a?I:void 0,onNavigate:_},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:!m&&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:m?`No snapshot available for ${a}.`:`Loading ${a}...`})]})]})}_r.createRoot(document.getElementById("app")).render(e.jsx(d.StrictMode,{children:e.jsx(uu,{})}));
|