@ouro.bot/cli 0.1.0-alpha.140 → 0.1.0-alpha.1401

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.
Files changed (1049) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +194 -30
  3. package/RepairGuide.ouro/agent.json +5 -0
  4. package/RepairGuide.ouro/psyche/IDENTITY.md +19 -0
  5. package/RepairGuide.ouro/psyche/SOUL.md +55 -0
  6. package/RepairGuide.ouro/skills/diagnose-broken-remote.md +63 -0
  7. package/RepairGuide.ouro/skills/diagnose-stacked-typed-issues.md +35 -0
  8. package/RepairGuide.ouro/skills/diagnose-sync-blocked.md +54 -0
  9. package/RepairGuide.ouro/skills/diagnose-vault-expired.md +60 -0
  10. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +4 -2
  11. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +2 -2
  12. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
  13. package/assets/bluebubbles-host +264 -0
  14. package/assets/sanctuary-host-launcher.sh +16 -0
  15. package/changelog.json +8189 -35
  16. package/deploy/unraid/Dockerfile +85 -0
  17. package/deploy/unraid/INSTALL.md +64 -0
  18. package/deploy/unraid/README.txt +3032 -0
  19. package/deploy/unraid/audit-container-spec.sh +4 -0
  20. package/deploy/unraid/container-runtime.json +1 -0
  21. package/deploy/unraid/credit-gateway.md +95 -0
  22. package/deploy/unraid/docker-man-template-transaction.mjs +733 -0
  23. package/deploy/unraid/docker-man-template-xml.cjs +105 -0
  24. package/deploy/unraid/github_known_hosts +3 -0
  25. package/deploy/unraid/install.sh +274 -0
  26. package/deploy/unraid/migrate-sanctuary-bundle.mjs +63 -0
  27. package/deploy/unraid/ouro-events/bootstrap-spool.sh +92 -0
  28. package/deploy/unraid/ouro-events/emit-event.mjs +310 -0
  29. package/deploy/unraid/ouro-events/emit-usenet-event.sh +54 -0
  30. package/deploy/unraid/ouro-events/install-usenet-guard.sh +435 -0
  31. package/deploy/unraid/ouro-events/usenet-health.sh +176 -0
  32. package/deploy/unraid/ouro-sync-ssh +98 -0
  33. package/deploy/unraid/ouro-sync.sudoers +3 -0
  34. package/deploy/unraid/sanctuary-acceptance-adapter.sh +43 -0
  35. package/deploy/unraid/sanctuary-acceptance-contract.json +198 -0
  36. package/deploy/unraid/sanctuary-acceptance-harness.sh +23 -0
  37. package/deploy/unraid/sanctuary-authority-installation.json +36 -0
  38. package/deploy/unraid/sanctuary-authority-service.sh +30 -0
  39. package/deploy/unraid/sanctuary-butler-upgrade.mjs +1523 -0
  40. package/deploy/unraid/sanctuary-deployment-target.mjs +710 -0
  41. package/deploy/unraid/sanctuary-replay-gate.mjs +2680 -0
  42. package/deploy/unraid/sanctuary-safe-rename.py +24 -0
  43. package/deploy/unraid/sanctuary-sync-cutover.sh +1039 -0
  44. package/deploy/unraid/sanctuary-unit16-host-broker.mjs +2088 -0
  45. package/deploy/unraid/sanctuary-unit16-run.sh +570 -0
  46. package/deploy/unraid/sanctuary-unit18-target-audit.sh +27 -0
  47. package/deploy/unraid/sanctuary.ouro/agent.json +73 -0
  48. package/deploy/unraid/sanctuary.ouro/arc/README.md +3 -0
  49. package/deploy/unraid/sanctuary.ouro/awaiting/house-care-sweep.md +17 -0
  50. package/deploy/unraid/sanctuary.ouro/bundle-meta.json +5 -0
  51. package/deploy/unraid/sanctuary.ouro/habits/sanctuary-health.md +8 -0
  52. package/deploy/unraid/sanctuary.ouro/mcp/media-mcp.mjs +2533 -0
  53. package/deploy/unraid/sanctuary.ouro/product/PRODUCT.md +13 -0
  54. package/deploy/unraid/sanctuary.ouro/provider-readiness.json +11 -0
  55. package/deploy/unraid/sanctuary.ouro/psyche/ASPIRATIONS.md +5 -0
  56. package/deploy/unraid/sanctuary.ouro/psyche/IDENTITY.md +7 -0
  57. package/deploy/unraid/sanctuary.ouro/psyche/LORE.md +7 -0
  58. package/deploy/unraid/sanctuary.ouro/psyche/SOUL.md +15 -0
  59. package/deploy/unraid/sanctuary.ouro/psyche/TACIT.md +3 -0
  60. package/deploy/unraid/sanctuary.ouro/state/policy/steward.json +7 -0
  61. package/deploy/unraid/sanctuary.ouro/tool-profiles.json +252 -0
  62. package/deploy/unraid/sanctuary.xml +30 -0
  63. package/dist/a2a/approval-relay.js +95 -0
  64. package/dist/a2a/card.js +57 -0
  65. package/dist/a2a/client.js +290 -0
  66. package/dist/a2a/config.js +50 -0
  67. package/dist/a2a/delegated-command-grants.js +93 -0
  68. package/dist/a2a/delegated-command.js +200 -0
  69. package/dist/a2a/delegation-stores.js +56 -0
  70. package/dist/a2a/did-resolution.js +205 -0
  71. package/dist/a2a/escalation-grants.js +84 -0
  72. package/dist/a2a/escalation-wiring.js +60 -0
  73. package/dist/a2a/identity.js +258 -0
  74. package/dist/a2a/inbound-share.js +131 -0
  75. package/dist/a2a/mission-result-wire.js +265 -0
  76. package/dist/a2a/onboarding.js +133 -0
  77. package/dist/a2a/operator-trust.js +399 -0
  78. package/dist/a2a/outbox-client.js +59 -0
  79. package/dist/a2a/outbox-store.js +245 -0
  80. package/dist/a2a/outbox-wire.js +106 -0
  81. package/dist/a2a/pin-store.js +167 -0
  82. package/dist/a2a/refusals.js +55 -0
  83. package/dist/a2a/relay-client.js +106 -0
  84. package/dist/a2a/relay-config-vault.js +64 -0
  85. package/dist/a2a/relay-contacts.js +120 -0
  86. package/dist/a2a/relay-inbox.js +360 -0
  87. package/dist/a2a/relay-retirements.js +89 -0
  88. package/dist/a2a/replay-grant-holders.js +33 -0
  89. package/dist/a2a/replay-harness.js +188 -0
  90. package/dist/a2a/resolution-proof.js +53 -0
  91. package/dist/a2a/sealed-chat.js +114 -0
  92. package/dist/a2a/seen-ledger.js +214 -0
  93. package/dist/a2a/server.js +1034 -0
  94. package/dist/a2a/task-store.js +69 -0
  95. package/dist/a2a/transport.js +100 -0
  96. package/dist/a2a/trust-commands.js +203 -0
  97. package/dist/a2a/trusted-files.js +185 -0
  98. package/dist/a2a/types.js +3 -0
  99. package/dist/arc/attention-types.js +8 -0
  100. package/dist/arc/cares.js +360 -0
  101. package/dist/arc/episodes.js +118 -0
  102. package/dist/arc/evolution.js +490 -0
  103. package/dist/arc/flight-recorder.js +1030 -0
  104. package/dist/arc/intentions.js +134 -0
  105. package/dist/arc/json-store.js +117 -0
  106. package/dist/arc/obligations.js +386 -0
  107. package/dist/arc/packets.js +336 -0
  108. package/dist/arc/presence.js +185 -0
  109. package/dist/arc/task-lifecycle.js +57 -0
  110. package/dist/commerce/store.js +755 -0
  111. package/dist/commerce/types.js +3 -0
  112. package/dist/eval/assertions/index.js +219 -0
  113. package/dist/eval/domain/case.js +115 -0
  114. package/dist/eval/domain/stats.js +19 -0
  115. package/dist/eval/guest-entry.js +16 -0
  116. package/dist/eval/readback/hedges.js +35 -0
  117. package/dist/eval/sandbox/docker.js +303 -0
  118. package/dist/eval/sandbox/guest.js +41 -0
  119. package/dist/eval/sandbox/projection.js +105 -0
  120. package/dist/eval/sandbox/readback.js +137 -0
  121. package/dist/eval/self-test.js +84 -0
  122. package/dist/eval/transport/provider-proxy.js +261 -0
  123. package/dist/eval/transport/synthetic-sanctuary.js +101 -0
  124. package/dist/eval/transport/telegram-turn.js +209 -0
  125. package/dist/gateway/keys.js +117 -0
  126. package/dist/gateway/server.js +429 -0
  127. package/dist/heart/active-work.js +421 -45
  128. package/dist/heart/agent-entry.js +255 -4
  129. package/dist/heart/approval-files.js +94 -0
  130. package/dist/heart/approval-store.js +1000 -0
  131. package/dist/heart/atomic-file.js +115 -0
  132. package/dist/heart/attachments/downloaded-store.js +89 -0
  133. package/dist/heart/attachments/image-normalize.js +201 -0
  134. package/dist/heart/attachments/materialize.js +97 -0
  135. package/dist/heart/attachments/originals.js +102 -0
  136. package/dist/heart/attachments/render.js +29 -0
  137. package/dist/heart/attachments/sources/bluebubbles.js +155 -0
  138. package/dist/heart/attachments/sources/cli-local-file.js +78 -0
  139. package/dist/heart/attachments/sources/downloaded.js +76 -0
  140. package/dist/heart/attachments/sources/index.js +19 -0
  141. package/dist/heart/attachments/store.js +132 -0
  142. package/dist/heart/attachments/transcribe-audio.js +172 -0
  143. package/dist/heart/attachments/types.js +93 -0
  144. package/dist/heart/attachments/understand.js +195 -0
  145. package/dist/heart/auth/auth-flow.js +590 -0
  146. package/dist/heart/auth/github-device-login.js +104 -0
  147. package/dist/heart/autonomy-budget.js +478 -0
  148. package/dist/heart/awaiting/a2a-await-delivery.js +109 -0
  149. package/dist/heart/awaiting/await-alert.js +152 -0
  150. package/dist/heart/awaiting/await-expiry.js +143 -0
  151. package/dist/heart/awaiting/await-loader.js +91 -0
  152. package/dist/heart/awaiting/await-parser.js +152 -0
  153. package/dist/heart/awaiting/await-runtime-state.js +130 -0
  154. package/dist/heart/awaiting/await-scheduler.js +403 -0
  155. package/dist/heart/background-operations.js +281 -0
  156. package/dist/heart/bluebubbles-host-account.js +78 -0
  157. package/dist/heart/bridges/manager.js +137 -17
  158. package/dist/heart/bridges/store.js +14 -2
  159. package/dist/heart/bundle-state.js +168 -0
  160. package/dist/heart/chat-interaction.js +38 -0
  161. package/dist/heart/commitments.js +44 -14
  162. package/dist/heart/config-registry.js +340 -0
  163. package/dist/heart/config.js +195 -140
  164. package/dist/heart/context-loss-gauntlet.js +387 -0
  165. package/dist/heart/context-loss-sentinel.js +1200 -0
  166. package/dist/heart/core.js +2658 -639
  167. package/dist/heart/cross-chat-delivery.js +29 -22
  168. package/dist/heart/daemon/agent-config-check.js +494 -0
  169. package/dist/heart/daemon/agent-discovery.js +304 -3
  170. package/dist/heart/daemon/agent-home.js +409 -0
  171. package/dist/heart/daemon/agent-service.js +392 -317
  172. package/dist/heart/daemon/agentic-repair.js +548 -0
  173. package/dist/heart/daemon/await-private-wake.js +59 -0
  174. package/dist/heart/daemon/bluebubbles-cli-integration.js +71 -0
  175. package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
  176. package/dist/heart/daemon/bluebubbles-host-protocol.js +433 -0
  177. package/dist/heart/daemon/bluebubbles-host.js +273 -0
  178. package/dist/heart/daemon/boot-sync-probe.js +223 -0
  179. package/dist/heart/daemon/cadence.js +180 -0
  180. package/dist/heart/daemon/cli-arg-redaction.js +26 -0
  181. package/dist/heart/daemon/cli-commands/a2a.js +26 -0
  182. package/dist/heart/daemon/cli-commands/cards.js +68 -0
  183. package/dist/heart/daemon/cli-commands/coding-tools.js +13 -0
  184. package/dist/heart/daemon/cli-commands/desk.js +34 -0
  185. package/dist/heart/daemon/cli-commands/dns.js +13 -0
  186. package/dist/heart/daemon/cli-commands/entry-points.js +164 -0
  187. package/dist/heart/daemon/cli-commands/failure-code.js +11 -0
  188. package/dist/heart/daemon/cli-commands/friends.js +18 -0
  189. package/dist/heart/daemon/cli-commands/habits.js +15 -0
  190. package/dist/heart/daemon/cli-commands/lifecycle.js +42 -0
  191. package/dist/heart/daemon/cli-commands/mail.js +12 -0
  192. package/dist/heart/daemon/cli-commands/mind.js +25 -0
  193. package/dist/heart/daemon/cli-commands/presence.js +28 -0
  194. package/dist/heart/daemon/cli-commands/providers.js +20 -0
  195. package/dist/heart/daemon/cli-commands/rsvp.js +20 -0
  196. package/dist/heart/daemon/cli-commands/shepherd.js +17 -0
  197. package/dist/heart/daemon/cli-commands/vault.js +23 -0
  198. package/dist/heart/daemon/cli-defaults.js +997 -0
  199. package/dist/heart/daemon/cli-desk.js +329 -0
  200. package/dist/heart/daemon/cli-exec.js +9684 -0
  201. package/dist/heart/daemon/cli-gate.js +198 -0
  202. package/dist/heart/daemon/cli-help.js +809 -0
  203. package/dist/heart/daemon/cli-manifest.js +112 -0
  204. package/dist/heart/daemon/cli-parse.js +3600 -0
  205. package/dist/heart/daemon/cli-render-doctor.js +57 -0
  206. package/dist/heart/daemon/cli-render.js +823 -0
  207. package/dist/heart/daemon/cli-types.js +8 -0
  208. package/dist/heart/daemon/compile-cache.js +69 -0
  209. package/dist/heart/daemon/connect-bay.js +323 -0
  210. package/dist/heart/daemon/container-credential-bootstrap.js +273 -0
  211. package/dist/heart/daemon/container-healthcheck.js +123 -0
  212. package/dist/heart/daemon/container-runtime.js +97 -0
  213. package/dist/heart/daemon/container-spec-auditor-main.js +187 -0
  214. package/dist/heart/daemon/container-spec-auditor.js +261 -0
  215. package/dist/heart/daemon/daemon-bootstrap-startup.js +115 -0
  216. package/dist/heart/daemon/daemon-cli.js +29 -2693
  217. package/dist/heart/daemon/daemon-entry.js +1109 -32
  218. package/dist/heart/daemon/daemon-health.js +186 -0
  219. package/dist/heart/daemon/daemon-rollup.js +57 -0
  220. package/dist/heart/daemon/daemon-runtime-sync.js +147 -13
  221. package/dist/heart/daemon/daemon-tombstone.js +236 -0
  222. package/dist/heart/daemon/daemon.js +2050 -128
  223. package/dist/heart/daemon/desk-admin.js +420 -0
  224. package/dist/heart/daemon/dns-workflow.js +394 -0
  225. package/dist/heart/daemon/doctor-types.js +8 -0
  226. package/dist/heart/daemon/doctor.js +1890 -0
  227. package/dist/heart/daemon/freshness.js +345 -0
  228. package/dist/heart/daemon/habit-private-wake.js +61 -0
  229. package/dist/heart/daemon/health-monitor.js +209 -12
  230. package/dist/heart/daemon/home-filesystem.js +93 -0
  231. package/dist/heart/daemon/hook-post-tool-use.js +149 -0
  232. package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
  233. package/dist/heart/daemon/hooks/bundle-meta.js +135 -1
  234. package/dist/heart/daemon/http-health-probe.js +80 -0
  235. package/dist/heart/daemon/human-command-screens.js +234 -0
  236. package/dist/heart/daemon/human-readiness.js +114 -0
  237. package/dist/heart/daemon/inner-status.js +78 -0
  238. package/dist/heart/daemon/interactive-repair.js +394 -0
  239. package/dist/heart/daemon/launchd.js +40 -8
  240. package/dist/heart/daemon/linux-service.js +382 -0
  241. package/dist/heart/daemon/log-tailer.js +79 -10
  242. package/dist/heart/daemon/logs-prune.js +132 -0
  243. package/dist/heart/daemon/mcp-canary.js +525 -0
  244. package/dist/heart/daemon/message-router.js +65 -5
  245. package/dist/heart/daemon/migrate-to-desk.js +848 -0
  246. package/dist/heart/daemon/os-cron-deps.js +139 -0
  247. package/dist/heart/daemon/os-cron.js +45 -15
  248. package/dist/heart/daemon/ouro-bot-entry.js +8 -3
  249. package/dist/heart/daemon/ouro-cli-main.js +50 -0
  250. package/dist/heart/daemon/ouro-entry.js +43 -20
  251. package/dist/heart/daemon/plugin-cli.js +432 -0
  252. package/dist/heart/daemon/portable-git-install.js +265 -0
  253. package/dist/heart/daemon/portable-git.js +179 -0
  254. package/dist/heart/daemon/presence-daemon.js +265 -0
  255. package/dist/heart/daemon/presence-roster.js +259 -0
  256. package/dist/heart/daemon/presence.js +462 -0
  257. package/dist/heart/daemon/process-manager.js +799 -61
  258. package/dist/heart/daemon/provider-discovery.js +171 -0
  259. package/dist/heart/daemon/provider-ping-progress.js +83 -0
  260. package/dist/heart/daemon/prunable-bundle.js +144 -0
  261. package/dist/heart/daemon/pulse.js +511 -0
  262. package/dist/heart/daemon/readiness-repair.js +365 -0
  263. package/dist/heart/daemon/run-hooks.js +2 -0
  264. package/dist/heart/daemon/runtime-logging.js +54 -14
  265. package/dist/heart/daemon/runtime-metadata.js +2 -30
  266. package/dist/heart/daemon/runtime-mode.js +13 -2
  267. package/dist/heart/daemon/runtime-replacement-handoff.js +207 -0
  268. package/dist/heart/daemon/safe-mode.js +161 -0
  269. package/dist/heart/daemon/sanctuary-acceptance-adapter.js +2659 -0
  270. package/dist/heart/daemon/sanctuary-acceptance-harness.js +1832 -0
  271. package/dist/heart/daemon/sanctuary-acceptance-marker.js +267 -0
  272. package/dist/heart/daemon/sanctuary-acceptance-scenarios.js +956 -0
  273. package/dist/heart/daemon/sanctuary-authority-codec.js +86 -0
  274. package/dist/heart/daemon/sanctuary-authority-epoch.js +291 -0
  275. package/dist/heart/daemon/sanctuary-authority-installation.js +161 -0
  276. package/dist/heart/daemon/sanctuary-authority-ledger.js +241 -0
  277. package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +1356 -0
  278. package/dist/heart/daemon/sanctuary-authority-vault-migration.js +79 -0
  279. package/dist/heart/daemon/sanctuary-bundle-migration.js +974 -0
  280. package/dist/heart/daemon/sanctuary-host-authority.js +1008 -0
  281. package/dist/heart/daemon/sanctuary-host-detached-supervisor.js +493 -0
  282. package/dist/heart/daemon/sanctuary-host-executor.js +670 -0
  283. package/dist/heart/daemon/sanctuary-host-linux-kernel.js +334 -0
  284. package/dist/heart/daemon/sanctuary-host-supervisor-entry.js +210 -0
  285. package/dist/heart/daemon/sanctuary-host-supervisor.js +95 -0
  286. package/dist/heart/daemon/sanctuary-package-management.js +113 -0
  287. package/dist/heart/daemon/sanctuary-scheduler-liveness.js +227 -0
  288. package/dist/heart/daemon/sanctuary-scheduler-origin.js +132 -0
  289. package/dist/heart/daemon/sanctuary-telegram-authority-entry.js +481 -0
  290. package/dist/heart/daemon/sanctuary-telegram-authority-gateway.js +614 -0
  291. package/dist/heart/daemon/sanctuary-telegram-authority-service.js +763 -0
  292. package/dist/heart/daemon/sanctuary-telegram-test-driver-entry.js +97 -0
  293. package/dist/heart/daemon/sanctuary-telegram-test-driver.js +294 -0
  294. package/dist/heart/daemon/sense-manager.js +1011 -60
  295. package/dist/heart/daemon/session-id-resolver.js +131 -0
  296. package/dist/heart/daemon/skill-management-installer.js +1 -1
  297. package/dist/heart/daemon/socket-client.js +180 -12
  298. package/dist/heart/daemon/stale-bundle-prune.js +113 -0
  299. package/dist/heart/daemon/startup-tui.js +339 -0
  300. package/dist/heart/daemon/supercronic-supervisor.js +282 -0
  301. package/dist/heart/daemon/task-scheduler.js +117 -39
  302. package/dist/heart/daemon/terminal-ui.js +503 -0
  303. package/dist/heart/daemon/thoughts.js +133 -49
  304. package/dist/heart/daemon/up-progress.js +366 -0
  305. package/dist/heart/daemon/vault-items.js +56 -0
  306. package/dist/heart/daemon/vault-outage.js +74 -0
  307. package/dist/heart/delegation.js +0 -3
  308. package/dist/heart/external-events/router.js +1556 -0
  309. package/dist/heart/failure-reports.js +398 -0
  310. package/dist/heart/file-lock.js +109 -0
  311. package/dist/heart/frontend-approval-runtime.js +506 -0
  312. package/dist/heart/frontend-journal.js +215 -0
  313. package/dist/heart/frontend-session-service.js +330 -0
  314. package/dist/heart/frontend-socket-client.js +173 -0
  315. package/dist/heart/frontend-socket.js +434 -0
  316. package/dist/heart/frontend-turn-errors.js +20 -0
  317. package/dist/heart/habits/habit-cancel.js +810 -0
  318. package/dist/heart/habits/habit-lifecycle.js +1324 -0
  319. package/dist/heart/habits/habit-migration.js +194 -0
  320. package/dist/heart/habits/habit-parser.js +278 -0
  321. package/dist/heart/habits/habit-runtime-state.js +93 -0
  322. package/dist/heart/habits/habit-scheduler.js +667 -0
  323. package/dist/heart/habits/habit-session-summary.js +318 -0
  324. package/dist/heart/habits/habit-session.js +643 -0
  325. package/dist/heart/{daemon → hatch}/hatch-flow.js +68 -62
  326. package/dist/heart/{daemon → hatch}/hatch-specialist.js +6 -8
  327. package/dist/heart/{daemon → hatch}/specialist-prompt.js +10 -6
  328. package/dist/heart/hatch/specialist-tools.js +395 -0
  329. package/dist/heart/identity.js +363 -60
  330. package/dist/heart/kept-notes.js +289 -0
  331. package/dist/heart/machine-identity.js +175 -0
  332. package/dist/heart/mail-import-discovery.js +356 -0
  333. package/dist/heart/mailbox/mailbox-http-hooks.js +99 -0
  334. package/dist/heart/mailbox/mailbox-http-response.js +7 -0
  335. package/dist/heart/mailbox/mailbox-http-routes.js +406 -0
  336. package/dist/heart/mailbox/mailbox-http-static.js +103 -0
  337. package/dist/heart/mailbox/mailbox-http-transport.js +272 -0
  338. package/dist/heart/mailbox/mailbox-http.js +99 -0
  339. package/dist/heart/mailbox/mailbox-read.js +41 -0
  340. package/dist/heart/mailbox/mailbox-supervision.js +131 -0
  341. package/dist/heart/mailbox/mailbox-types.js +27 -0
  342. package/dist/heart/mailbox/mailbox-view.js +197 -0
  343. package/dist/heart/mailbox/readers/agent-machine.js +428 -0
  344. package/dist/heart/mailbox/readers/continuity-readers.js +329 -0
  345. package/dist/heart/mailbox/readers/mail.js +375 -0
  346. package/dist/heart/mailbox/readers/runtime-readers.js +823 -0
  347. package/dist/heart/mailbox/readers/sessions.js +231 -0
  348. package/dist/heart/mailbox/readers/shared.js +111 -0
  349. package/dist/heart/mcp/mcp-server.js +872 -0
  350. package/dist/heart/migrate-config.js +100 -0
  351. package/dist/heart/model-capabilities.js +98 -16
  352. package/dist/heart/model-limits.js +49 -0
  353. package/dist/heart/optional-packages.js +77 -0
  354. package/dist/heart/orientation-frame.js +393 -0
  355. package/dist/heart/platform.js +81 -0
  356. package/dist/heart/primitives.js +1 -1
  357. package/dist/heart/private-runtime/decision-renderer.js +158 -0
  358. package/dist/heart/private-runtime/index.js +18 -0
  359. package/dist/heart/private-runtime/ledger.js +212 -0
  360. package/dist/heart/private-runtime/policy.js +295 -0
  361. package/dist/heart/private-runtime/types.js +2 -0
  362. package/dist/heart/progress-story.js +1 -1
  363. package/dist/heart/provider-attempt.js +137 -0
  364. package/dist/heart/provider-binding-resolver.js +273 -0
  365. package/dist/heart/provider-credentials.js +449 -0
  366. package/dist/heart/provider-failover.js +260 -37
  367. package/dist/heart/provider-fallback.js +228 -0
  368. package/dist/heart/provider-models.js +96 -0
  369. package/dist/heart/provider-ping-child.js +125 -0
  370. package/dist/heart/provider-ping-entry.js +8 -0
  371. package/dist/heart/provider-ping.js +217 -78
  372. package/dist/heart/provider-readiness-cache.js +119 -0
  373. package/dist/heart/provider-visibility.js +188 -0
  374. package/dist/heart/providers/account-pool.js +717 -0
  375. package/dist/heart/providers/anthropic-token.js +15 -47
  376. package/dist/heart/providers/anthropic.js +259 -80
  377. package/dist/heart/providers/azure.js +19 -31
  378. package/dist/heart/providers/error-classification.js +129 -0
  379. package/dist/heart/providers/github-copilot.js +131 -36
  380. package/dist/heart/providers/minimax-vlm.js +189 -0
  381. package/dist/heart/providers/minimax.js +19 -27
  382. package/dist/heart/providers/openai-codex-token.js +349 -0
  383. package/dist/heart/providers/openai-codex.js +46 -57
  384. package/dist/heart/providers/openai-compatible.js +177 -0
  385. package/dist/heart/quota/fleet-readings.js +222 -0
  386. package/dist/heart/quota/tranche.js +59 -0
  387. package/dist/heart/reach-channel.js +85 -0
  388. package/dist/heart/reply-style.js +52 -0
  389. package/dist/heart/run-ledger.js +247 -0
  390. package/dist/heart/runtime-capability-check.js +170 -0
  391. package/dist/heart/runtime-credentials.js +647 -0
  392. package/dist/heart/runtime-cwd.js +87 -0
  393. package/dist/heart/sense-truth.js +26 -4
  394. package/dist/heart/session-activity.js +89 -23
  395. package/dist/heart/session-events.js +1602 -0
  396. package/dist/heart/session-playback-cli-main.js +10 -0
  397. package/dist/heart/session-playback-cli.js +36 -0
  398. package/dist/heart/session-playback.js +231 -0
  399. package/dist/heart/session-redaction-repair-cli-main.js +34 -0
  400. package/dist/heart/session-redaction-repair.js +552 -0
  401. package/dist/heart/session-stats-cli-main.js +10 -0
  402. package/dist/heart/session-stats.js +183 -0
  403. package/dist/heart/session-transcript.js +133 -0
  404. package/dist/heart/shelf-claims.js +124 -0
  405. package/dist/heart/shepherd/custody-types.js +2 -0
  406. package/dist/heart/shepherd/mandates.js +352 -0
  407. package/dist/heart/shepherd/operation-commands.js +19 -0
  408. package/dist/heart/shepherd/operations.js +139 -0
  409. package/dist/heart/shepherd/supervision.js +114 -0
  410. package/dist/heart/shepherd/types.js +2 -0
  411. package/dist/heart/shepherd-config.js +113 -0
  412. package/dist/heart/source-grounding.js +313 -0
  413. package/dist/heart/sqlite.js +18 -0
  414. package/dist/heart/start-of-turn-packet.js +372 -0
  415. package/dist/heart/steward-policy.js +656 -0
  416. package/dist/heart/streaming.js +620 -192
  417. package/dist/heart/structured-output.js +196 -0
  418. package/dist/heart/sync-classification.js +176 -0
  419. package/dist/heart/sync-health.js +152 -0
  420. package/dist/heart/sync-lock.js +431 -0
  421. package/dist/heart/sync.js +1579 -0
  422. package/dist/heart/target-resolution.js +11 -7
  423. package/dist/heart/tempo.js +93 -0
  424. package/dist/heart/temporal-view.js +41 -0
  425. package/dist/heart/timeouts.js +101 -0
  426. package/dist/heart/tool-activity-callbacks.js +59 -0
  427. package/dist/heart/tool-approval.js +382 -0
  428. package/dist/heart/tool-description.js +155 -0
  429. package/dist/heart/tool-friction.js +55 -0
  430. package/dist/heart/tool-images.js +42 -0
  431. package/dist/heart/tool-loop.js +10 -2
  432. package/dist/heart/tool-output-budget.js +41 -0
  433. package/dist/heart/turn-context.js +503 -0
  434. package/dist/heart/turn-execution-lease.js +78 -0
  435. package/dist/heart/versioning/host-self-update.js +118 -0
  436. package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +6 -5
  437. package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +3 -2
  438. package/dist/heart/versioning/ouro-path-installer.js +432 -0
  439. package/dist/heart/versioning/ouro-recovery-launcher.js +98 -0
  440. package/dist/heart/versioning/ouro-version-manager.js +432 -0
  441. package/dist/heart/versioning/release-sources.js +185 -0
  442. package/dist/heart/versioning/self-update-defaults.js +424 -0
  443. package/dist/heart/versioning/self-update.js +257 -0
  444. package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
  445. package/dist/heart/{daemon → versioning}/update-checker.js +12 -35
  446. package/dist/heart/versioning/update-hooks.js +160 -0
  447. package/dist/heart/versioning/update-state.js +134 -0
  448. package/dist/heart/versioning/updater-launchd.js +150 -0
  449. package/dist/heart/versioning/version-intent.js +114 -0
  450. package/dist/heart/work-card.js +380 -0
  451. package/dist/mailbox-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  452. package/dist/mailbox-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  453. package/dist/mailbox-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  454. package/dist/mailbox-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  455. package/dist/mailbox-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  456. package/dist/mailbox-ui/assets/index-B5PHJ96n.js +1 -0
  457. package/dist/mailbox-ui/assets/index-C1x3aMJb.css +1 -0
  458. package/dist/mailbox-ui/assets/vendor-BfcLUM_P.js +65 -0
  459. package/dist/mailbox-ui/index.html +18 -0
  460. package/dist/mailroom/attention.js +167 -0
  461. package/dist/mailroom/autonomy.js +209 -0
  462. package/dist/mailroom/azure-sdk.js +27 -0
  463. package/dist/mailroom/blob-store.js +974 -0
  464. package/dist/mailroom/body-cache.js +61 -0
  465. package/dist/mailroom/cache-sync-cli.js +58 -0
  466. package/dist/mailroom/core.js +805 -0
  467. package/dist/mailroom/entry.js +169 -0
  468. package/dist/mailroom/file-store.js +568 -0
  469. package/dist/mailroom/hosted-cache-sync.js +384 -0
  470. package/dist/mailroom/mbox-import.js +393 -0
  471. package/dist/mailroom/migration.js +164 -0
  472. package/dist/mailroom/outbound.js +380 -0
  473. package/dist/mailroom/policy.js +263 -0
  474. package/dist/mailroom/reader.js +291 -0
  475. package/dist/mailroom/search-cache.js +513 -0
  476. package/dist/mailroom/search-relevance.js +319 -0
  477. package/dist/mailroom/smtp-ingress.js +176 -0
  478. package/dist/mailroom/source-state.js +176 -0
  479. package/dist/mailroom/sweep-orphans-cli.js +34 -0
  480. package/dist/mailroom/thread.js +109 -0
  481. package/dist/mailroom/travel-extract.js +89 -0
  482. package/dist/mind/bundle-manifest.js +25 -4
  483. package/dist/mind/context.js +322 -197
  484. package/dist/mind/desk-section.js +342 -0
  485. package/dist/mind/diary-integrity.js +60 -0
  486. package/dist/mind/diary.js +31 -53
  487. package/dist/mind/embedding-provider.js +60 -0
  488. package/dist/mind/file-state.js +179 -0
  489. package/dist/mind/friend-link-codes.js +209 -0
  490. package/dist/mind/friend-merge.js +336 -0
  491. package/dist/mind/house-names.js +43 -0
  492. package/dist/mind/note-search.js +198 -0
  493. package/dist/mind/obligation-steering.js +15 -9
  494. package/dist/mind/outbound-record.js +176 -0
  495. package/dist/mind/pending.js +65 -10
  496. package/dist/mind/prompt-budget.js +511 -0
  497. package/dist/mind/prompt-refresh.js +3 -2
  498. package/dist/mind/prompt.js +977 -344
  499. package/dist/mind/provenance-trust.js +26 -0
  500. package/dist/mind/record-paths.js +312 -0
  501. package/dist/mind/scrutiny.js +121 -0
  502. package/dist/mind/session-transaction.js +642 -0
  503. package/dist/mind/token-estimate.js +17 -0
  504. package/dist/mind/where-am-i.js +147 -0
  505. package/dist/nerves/cli-logging.js +7 -1
  506. package/dist/nerves/coverage/audit-rules.js +15 -6
  507. package/dist/nerves/coverage/audit.js +28 -2
  508. package/dist/nerves/coverage/cli-main.js +6 -1
  509. package/dist/nerves/coverage/cli.js +1 -1
  510. package/dist/nerves/coverage/contract.js +5 -5
  511. package/dist/nerves/coverage/file-completeness.js +161 -5
  512. package/dist/nerves/coverage/run-artifacts.js +55 -35
  513. package/dist/nerves/coverage/source-scanner.js +4 -4
  514. package/dist/nerves/event-buffer.js +111 -0
  515. package/dist/nerves/index.js +293 -9
  516. package/dist/nerves/observation.js +20 -0
  517. package/dist/nerves/redact.js +79 -0
  518. package/dist/nerves/review/cli-main.js +10 -0
  519. package/dist/nerves/review/cli.js +156 -0
  520. package/dist/nerves/review/core.js +159 -0
  521. package/dist/nerves/runtime.js +12 -0
  522. package/dist/repertoire/ado-client.js +15 -56
  523. package/dist/repertoire/ado-semantic.js +108 -40
  524. package/dist/repertoire/api-client.js +97 -0
  525. package/dist/repertoire/auth-required.js +22 -0
  526. package/dist/repertoire/bitwarden-native.js +458 -0
  527. package/dist/repertoire/bitwarden-store.js +1296 -0
  528. package/dist/repertoire/bundle-templates.js +71 -0
  529. package/dist/repertoire/bw-installer.js +268 -0
  530. package/dist/repertoire/coding/context-pack.js +80 -3
  531. package/dist/repertoire/coding/feedback.js +26 -5
  532. package/dist/repertoire/coding/index.js +15 -3
  533. package/dist/repertoire/coding/manager.js +19 -11
  534. package/dist/repertoire/coding/spawner.js +11 -11
  535. package/dist/repertoire/coding/tools.js +151 -27
  536. package/dist/repertoire/coding/workbench-client.js +272 -0
  537. package/dist/repertoire/coding/workbench-manager.js +346 -0
  538. package/dist/repertoire/commerce-errors.js +109 -0
  539. package/dist/repertoire/commerce-self-test.js +156 -0
  540. package/dist/repertoire/credential-access.js +183 -0
  541. package/dist/repertoire/desk/classifier.js +362 -0
  542. package/dist/repertoire/duffel-client.js +185 -0
  543. package/dist/repertoire/github-client.js +14 -55
  544. package/dist/repertoire/graph-client.js +11 -52
  545. package/dist/repertoire/guardrails.js +1074 -70
  546. package/dist/repertoire/house-sweep.js +471 -0
  547. package/dist/repertoire/in-turn-tools-door.js +54 -0
  548. package/dist/repertoire/mcp-client.js +58 -5
  549. package/dist/repertoire/mcp-declared-tools.js +156 -0
  550. package/dist/repertoire/mcp-manager.js +433 -141
  551. package/dist/repertoire/mcp-tools.js +195 -0
  552. package/dist/repertoire/mcp-write-guard.js +85 -0
  553. package/dist/repertoire/plugin-mcp.js +175 -0
  554. package/dist/repertoire/plugins.js +253 -0
  555. package/dist/repertoire/relationship-authorization.js +322 -0
  556. package/dist/repertoire/sanctuary-container-policy.js +50 -0
  557. package/dist/repertoire/shell-sessions.js +136 -0
  558. package/dist/repertoire/skill-summaries.js +127 -0
  559. package/dist/repertoire/skills.js +34 -4
  560. package/dist/repertoire/stripe-client.js +163 -0
  561. package/dist/repertoire/tool-arguments.js +180 -0
  562. package/dist/repertoire/tool-candidates.js +50 -0
  563. package/dist/repertoire/tool-catalog.js +206 -0
  564. package/dist/repertoire/tool-error-code.js +30 -0
  565. package/dist/repertoire/tool-limits.js +20 -0
  566. package/dist/repertoire/tool-results.js +29 -0
  567. package/dist/repertoire/tools-a2a.js +792 -0
  568. package/dist/repertoire/tools-app-sessions.js +219 -0
  569. package/dist/repertoire/tools-attachments.js +302 -0
  570. package/dist/repertoire/tools-awaiting.js +934 -0
  571. package/dist/repertoire/tools-base.js +85 -1407
  572. package/dist/repertoire/tools-bridge.js +153 -0
  573. package/dist/repertoire/tools-bundle.js +998 -0
  574. package/dist/repertoire/tools-chat.js +185 -0
  575. package/dist/repertoire/tools-commerce.js +272 -0
  576. package/dist/repertoire/tools-config.js +199 -0
  577. package/dist/repertoire/tools-continuity.js +648 -0
  578. package/dist/repertoire/tools-credential.js +410 -0
  579. package/dist/repertoire/tools-escalation.js +98 -0
  580. package/dist/repertoire/tools-evolution.js +560 -0
  581. package/dist/repertoire/tools-files.js +521 -0
  582. package/dist/repertoire/tools-flight.js +313 -0
  583. package/dist/repertoire/tools-flow.js +161 -0
  584. package/dist/repertoire/tools-friend-link.js +65 -0
  585. package/dist/repertoire/tools-github.js +11 -4
  586. package/dist/repertoire/tools-habits.js +111 -0
  587. package/dist/repertoire/tools-house-care.js +190 -0
  588. package/dist/repertoire/tools-mail.js +1928 -0
  589. package/dist/repertoire/tools-notes.js +551 -0
  590. package/dist/repertoire/tools-obligations.js +187 -0
  591. package/dist/repertoire/tools-orientation.js +36 -0
  592. package/dist/repertoire/tools-record.js +497 -0
  593. package/dist/repertoire/tools-rsvp.js +148 -0
  594. package/dist/repertoire/tools-runtime.js +260 -0
  595. package/dist/repertoire/tools-sanctuary-host.js +213 -0
  596. package/dist/repertoire/tools-session.js +1190 -0
  597. package/dist/repertoire/tools-shell.js +275 -0
  598. package/dist/repertoire/tools-shepherd-guidance.js +183 -0
  599. package/dist/repertoire/tools-shepherd.js +369 -0
  600. package/dist/repertoire/tools-steward-policy.js +157 -0
  601. package/dist/repertoire/tools-stripe.js +244 -0
  602. package/dist/repertoire/tools-surface.js +553 -0
  603. package/dist/repertoire/tools-teams.js +67 -17
  604. package/dist/repertoire/tools-telegram-contacts.js +41 -0
  605. package/dist/repertoire/tools-travel.js +142 -0
  606. package/dist/repertoire/tools-trip.js +1041 -0
  607. package/dist/repertoire/tools-unraid.js +627 -0
  608. package/dist/repertoire/tools-user-profile.js +166 -0
  609. package/dist/repertoire/tools-vault.js +46 -0
  610. package/dist/repertoire/tools-voice-local.js +210 -0
  611. package/dist/repertoire/tools-voice.js +153 -0
  612. package/dist/repertoire/tools-web.js +238 -0
  613. package/dist/repertoire/tools.js +583 -274
  614. package/dist/repertoire/travel-api-client.js +463 -0
  615. package/dist/repertoire/unraid-client.js +155 -0
  616. package/dist/repertoire/unraid-restart.js +342 -0
  617. package/dist/repertoire/user-profile.js +131 -0
  618. package/dist/repertoire/vault-setup.js +298 -0
  619. package/dist/repertoire/vault-unlock.js +816 -0
  620. package/dist/rsvp/aisleplanner-client.js +354 -0
  621. package/dist/rsvp/cli.js +936 -0
  622. package/dist/rsvp/config.js +327 -0
  623. package/dist/rsvp/cutover.js +453 -0
  624. package/dist/rsvp/diagnostics.js +232 -0
  625. package/dist/rsvp/diff-renderer.js +176 -0
  626. package/dist/rsvp/habit-policy.js +110 -0
  627. package/dist/rsvp/habit-stage.js +123 -0
  628. package/dist/rsvp/incident-bundle.js +97 -0
  629. package/dist/rsvp/migration.js +204 -0
  630. package/dist/rsvp/native-habit-runner.js +630 -0
  631. package/dist/rsvp/outbound-state.js +628 -0
  632. package/dist/rsvp/query.js +118 -0
  633. package/dist/rsvp/replay.js +233 -0
  634. package/dist/rsvp/snapshot.js +232 -0
  635. package/dist/rsvp/spend-ledger.js +175 -0
  636. package/dist/scripts/claude-code-hook.js +41 -0
  637. package/dist/scripts/claude-code-stop-hook.js +48 -0
  638. package/dist/senses/a2a-entry.js +145 -0
  639. package/dist/senses/acp-server.js +386 -0
  640. package/dist/senses/app-sessions/client.js +128 -0
  641. package/dist/senses/app-sessions/digest-cards.js +187 -0
  642. package/dist/senses/app-sessions/digest-push.js +108 -0
  643. package/dist/senses/app-sessions/digest-sources.js +204 -0
  644. package/dist/senses/app-sessions/digest.js +284 -0
  645. package/dist/senses/app-sessions/run-command.js +51 -0
  646. package/dist/senses/app-sessions/sense.js +252 -0
  647. package/dist/senses/app-sessions/shepherd-cli.js +166 -0
  648. package/dist/senses/app-sessions/shepherd-rows.js +67 -0
  649. package/dist/senses/app-sessions/store.js +149 -0
  650. package/dist/senses/app-sessions/waiting-prompts.js +137 -0
  651. package/dist/senses/app-sessions/waiting-status.js +23 -0
  652. package/dist/senses/app-sessions-entry.js +87 -0
  653. package/dist/senses/attention-queue.js +95 -6
  654. package/dist/senses/await-turn-message.js +65 -0
  655. package/dist/senses/bluebubbles/active-turns.js +241 -0
  656. package/dist/senses/bluebubbles/attachment-cache.js +53 -0
  657. package/dist/senses/bluebubbles/attachment-download.js +143 -0
  658. package/dist/senses/bluebubbles/client.js +874 -0
  659. package/dist/senses/bluebubbles/context-packet.js +207 -0
  660. package/dist/senses/bluebubbles/context-smoke.js +144 -0
  661. package/dist/senses/bluebubbles/entry.js +80 -0
  662. package/dist/senses/bluebubbles/host-account-verifier.js +113 -0
  663. package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +21 -3
  664. package/dist/senses/bluebubbles/index.js +4486 -0
  665. package/dist/senses/bluebubbles/latest-turn.js +342 -0
  666. package/dist/senses/bluebubbles/media.js +256 -0
  667. package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +147 -30
  668. package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +24 -13
  669. package/dist/senses/bluebubbles/outbound-state.js +335 -0
  670. package/dist/senses/bluebubbles/processed-log.js +133 -0
  671. package/dist/senses/bluebubbles/reactions.js +18 -0
  672. package/dist/senses/bluebubbles/replay.js +284 -0
  673. package/dist/senses/{bluebubbles-runtime-state.js → bluebubbles/runtime-state.js} +47 -4
  674. package/dist/senses/bluebubbles/semantic-receipts.js +2014 -0
  675. package/dist/senses/bluebubbles/send-file.js +20 -0
  676. package/dist/senses/bluebubbles/send-health.js +126 -0
  677. package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
  678. package/dist/senses/bluebubbles/webhook-registration.js +257 -0
  679. package/dist/senses/bluebubbles-meta-guard.js +39 -0
  680. package/dist/senses/chat-file.js +75 -0
  681. package/dist/senses/cli/bracketed-paste.js +82 -0
  682. package/dist/senses/cli/image-paste.js +287 -0
  683. package/dist/senses/cli/image-ref-navigation.js +75 -0
  684. package/dist/senses/cli/ink-app.js +156 -0
  685. package/dist/senses/cli/inline-diff.js +64 -0
  686. package/dist/senses/cli/input-keys.js +209 -0
  687. package/dist/senses/cli/kill-ring.js +86 -0
  688. package/dist/senses/cli/message-list.js +51 -0
  689. package/dist/senses/cli/ouro-tui.js +633 -0
  690. package/dist/senses/cli/spinner-imperative.js +135 -0
  691. package/dist/senses/cli/spinner.js +101 -0
  692. package/dist/senses/cli/status-line.js +60 -0
  693. package/dist/senses/cli/streaming-markdown.js +526 -0
  694. package/dist/senses/cli/tool-display.js +85 -0
  695. package/dist/senses/cli/tool-render.js +85 -0
  696. package/dist/senses/cli/tui-store.js +252 -0
  697. package/dist/senses/cli/virtual-list.js +35 -0
  698. package/dist/senses/cli-entry.js +62 -9
  699. package/dist/senses/cli.js +627 -350
  700. package/dist/senses/commands.js +66 -3
  701. package/dist/senses/context-packet-ledger.js +367 -0
  702. package/dist/senses/context-packets.js +154 -0
  703. package/dist/senses/habit-lifecycle-guard.js +24 -0
  704. package/dist/senses/habit-turn-message.js +160 -0
  705. package/dist/senses/inbound-journal.js +182 -0
  706. package/dist/senses/ingress-evidence.js +2 -0
  707. package/dist/senses/mail-entry.js +69 -0
  708. package/dist/senses/mail.js +524 -0
  709. package/dist/senses/ordinary-owner-decision.js +98 -0
  710. package/dist/senses/pipeline.js +1146 -282
  711. package/dist/senses/private-runtime-worker.js +857 -0
  712. package/dist/senses/private-runtime.js +1689 -0
  713. package/dist/senses/proactive-content-guard.js +51 -0
  714. package/dist/senses/program-status.js +155 -0
  715. package/dist/senses/repeat-while.js +36 -0
  716. package/dist/senses/root-host-approval-port.js +345 -0
  717. package/dist/senses/root-host-approval-runtime.js +393 -0
  718. package/dist/senses/sanctuary-authority-resident.js +102 -0
  719. package/dist/senses/sanctuary-download-credit-presentation.js +31 -0
  720. package/dist/senses/sanctuary-full-visibility-contract.js +302 -0
  721. package/dist/senses/sanctuary-grounding.js +118 -0
  722. package/dist/senses/sanctuary-health-acceptance-probe-entry.js +21 -0
  723. package/dist/senses/sanctuary-health-acceptance-probe.js +802 -0
  724. package/dist/senses/sanctuary-health-runner.js +106 -0
  725. package/dist/senses/sanctuary-health.js +442 -0
  726. package/dist/senses/sanctuary-house.js +97 -0
  727. package/dist/senses/sanctuary-install-state-contract.js +169 -0
  728. package/dist/senses/sanctuary-interactive-control.js +410 -0
  729. package/dist/senses/sanctuary-media-catalog-contract.js +268 -0
  730. package/dist/senses/sanctuary-media-optimization.js +517 -0
  731. package/dist/senses/sanctuary-runtime.js +392 -0
  732. package/dist/senses/sanctuary-sab.js +85 -0
  733. package/dist/senses/sanctuary-storage-optimization-contract.js +32 -0
  734. package/dist/senses/sense-shutdown.js +72 -0
  735. package/dist/senses/shared-turn.js +834 -0
  736. package/dist/senses/shepherd/agent-presentation.js +88 -0
  737. package/dist/senses/shepherd/attention-page.js +166 -0
  738. package/dist/senses/shepherd/attention-sidebar.js +76 -0
  739. package/dist/senses/shepherd/attention.js +295 -0
  740. package/dist/senses/shepherd/checkin-config.js +76 -0
  741. package/dist/senses/shepherd/checkin-store.js +383 -0
  742. package/dist/senses/shepherd/client.js +196 -0
  743. package/dist/senses/shepherd/cmux.js +483 -0
  744. package/dist/senses/shepherd/composer.js +336 -0
  745. package/dist/senses/shepherd/conversation-hold.js +78 -0
  746. package/dist/senses/shepherd/feedback-reply.js +108 -0
  747. package/dist/senses/shepherd/feedback-source.js +20 -0
  748. package/dist/senses/shepherd/feedback-store.js +328 -0
  749. package/dist/senses/shepherd/feedback-submit.js +182 -0
  750. package/dist/senses/shepherd/feedback-worker.js +208 -0
  751. package/dist/senses/shepherd/guidance.js +273 -0
  752. package/dist/senses/shepherd/herdr.js +427 -0
  753. package/dist/senses/shepherd/host.js +14 -0
  754. package/dist/senses/shepherd/human-decision-guard.js +29 -0
  755. package/dist/senses/shepherd/judge-evaluation-command.js +185 -0
  756. package/dist/senses/shepherd/judge-evaluation-entry.js +20 -0
  757. package/dist/senses/shepherd/judge-evaluation.js +144 -0
  758. package/dist/senses/shepherd/judge.js +210 -0
  759. package/dist/senses/shepherd/notice-outbox.js +254 -0
  760. package/dist/senses/shepherd/observation-publisher.js +320 -0
  761. package/dist/senses/shepherd/operations-defaults.js +86 -0
  762. package/dist/senses/shepherd/operations.js +159 -0
  763. package/dist/senses/shepherd/owner-notice.js +496 -0
  764. package/dist/senses/shepherd/prompt-state.js +60 -0
  765. package/dist/senses/shepherd/recovery.js +543 -0
  766. package/dist/senses/shepherd/redact.js +66 -0
  767. package/dist/senses/shepherd/returns.js +79 -0
  768. package/dist/senses/shepherd/sense.js +862 -0
  769. package/dist/senses/shepherd/shepherd-judge-corpus-v1.json +170 -0
  770. package/dist/senses/shepherd/surface.js +125 -0
  771. package/dist/senses/shepherd/target-binding.js +13 -0
  772. package/dist/senses/shepherd/terminal-process.js +147 -0
  773. package/dist/senses/shepherd-entry.js +98 -0
  774. package/dist/senses/surface-tool.js +73 -34
  775. package/dist/senses/teams-attachments.js +68 -0
  776. package/dist/senses/teams-entry.js +80 -9
  777. package/dist/senses/teams-image.js +128 -0
  778. package/dist/senses/teams-off-turn.js +199 -0
  779. package/dist/senses/teams-outbox.js +242 -0
  780. package/dist/senses/teams.js +1167 -369
  781. package/dist/senses/telegram-admission.js +700 -0
  782. package/dist/senses/telegram-approval-runtime.js +796 -0
  783. package/dist/senses/telegram-attachments.js +128 -0
  784. package/dist/senses/telegram-audit-ledger.js +220 -0
  785. package/dist/senses/telegram-authority-transport.js +233 -0
  786. package/dist/senses/telegram-chat-actions.js +54 -0
  787. package/dist/senses/telegram-client.js +1763 -0
  788. package/dist/senses/telegram-effect-adapter.js +877 -0
  789. package/dist/senses/telegram-entry.js +87 -0
  790. package/dist/senses/telegram-handoff.js +150 -0
  791. package/dist/senses/telegram-identity-key.js +143 -0
  792. package/dist/senses/telegram-markdown.js +331 -0
  793. package/dist/senses/telegram-owner-route.js +113 -0
  794. package/dist/senses/telegram.js +2531 -0
  795. package/dist/senses/terminal-handoff.js +44 -0
  796. package/dist/senses/trust-gate.js +104 -9
  797. package/dist/senses/voice/audio-playback.js +237 -0
  798. package/dist/senses/voice/audio-routing.js +119 -0
  799. package/dist/senses/voice/call-auth.js +250 -0
  800. package/dist/senses/voice/elevenlabs.js +202 -0
  801. package/dist/senses/voice/floor-control.js +431 -0
  802. package/dist/senses/voice/floor-controller.js +115 -0
  803. package/dist/senses/voice/golden-path.js +116 -0
  804. package/dist/senses/voice/index.js +29 -0
  805. package/dist/senses/voice/local-audio-control.js +344 -0
  806. package/dist/senses/voice/local-audio-devices.js +516 -0
  807. package/dist/senses/voice/local-audio-disclosure.js +174 -0
  808. package/dist/senses/voice/local-audio-identity.js +103 -0
  809. package/dist/senses/voice/local-audio-join.js +325 -0
  810. package/dist/senses/voice/local-audio-mute.js +199 -0
  811. package/dist/senses/voice/local-audio-notify.js +124 -0
  812. package/dist/senses/voice/local-audio-prompts.js +116 -0
  813. package/dist/senses/voice/local-audio-transport.js +427 -0
  814. package/dist/senses/voice/local-audio.js +281 -0
  815. package/dist/senses/voice/local-media-stream.js +145 -0
  816. package/dist/senses/voice/meeting.js +113 -0
  817. package/dist/senses/voice/outbound.js +190 -0
  818. package/dist/senses/voice/phone.js +33 -0
  819. package/dist/senses/voice/playback.js +139 -0
  820. package/dist/senses/voice/process-guards.js +51 -0
  821. package/dist/senses/voice/realtime-eval.js +496 -0
  822. package/dist/senses/voice/realtime-tool-schema.js +195 -0
  823. package/dist/senses/voice/realtime-trace.js +531 -0
  824. package/dist/senses/voice/transcript.js +70 -0
  825. package/dist/senses/voice/turn.js +191 -0
  826. package/dist/senses/voice/twilio-phone-runtime.js +836 -0
  827. package/dist/senses/voice/twilio-phone.js +5456 -0
  828. package/dist/senses/voice/types.js +2 -0
  829. package/dist/senses/voice/whisper.js +153 -0
  830. package/dist/senses/voice-entry.js +84 -0
  831. package/dist/senses/voice-realtime-eval-command.js +99 -0
  832. package/dist/senses/voice-realtime-eval-entry.js +25 -0
  833. package/dist/senses/voice-twilio-entry.js +88 -0
  834. package/dist/trips/core.js +138 -0
  835. package/dist/trips/store.js +265 -0
  836. package/dist/util/frontmatter.js +69 -0
  837. package/node_modules/@ouro.bot/friends/LICENSE +201 -0
  838. package/node_modules/@ouro.bot/friends/README.md +687 -0
  839. package/node_modules/@ouro.bot/friends/actions/generated/mcp.json +1105 -0
  840. package/node_modules/@ouro.bot/friends/changelog.json +197 -0
  841. package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.d.ts +39 -0
  842. package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.js +54 -0
  843. package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.d.ts +117 -0
  844. package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.js +202 -0
  845. package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.d.ts +50 -0
  846. package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.js +32 -0
  847. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.d.ts +38 -0
  848. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.js +120 -0
  849. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.d.ts +195 -0
  850. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.js +342 -0
  851. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.d.ts +26 -0
  852. package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.js +140 -0
  853. package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.d.ts +62 -0
  854. package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.js +83 -0
  855. package/node_modules/@ouro.bot/friends/dist/a2a-client/index.d.ts +26 -0
  856. package/node_modules/@ouro.bot/friends/dist/a2a-client/index.js +82 -0
  857. package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.d.ts +5 -0
  858. package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.js +84 -0
  859. package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.d.ts +22 -0
  860. package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.js +17 -0
  861. package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.d.ts +15 -0
  862. package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.js +61 -0
  863. package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.d.ts +47 -0
  864. package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.js +95 -0
  865. package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.d.ts +58 -0
  866. package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.js +113 -0
  867. package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.d.ts +42 -0
  868. package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.js +87 -0
  869. package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.d.ts +5 -0
  870. package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.js +19 -0
  871. package/node_modules/@ouro.bot/friends/dist/account-roster.d.ts +52 -0
  872. package/node_modules/@ouro.bot/friends/dist/account-roster.js +108 -0
  873. package/node_modules/@ouro.bot/friends/dist/agent-peer.d.ts +26 -0
  874. package/node_modules/@ouro.bot/friends/dist/agent-peer.js +138 -0
  875. package/node_modules/@ouro.bot/friends/dist/audit.d.ts +42 -0
  876. package/node_modules/@ouro.bot/friends/dist/audit.js +86 -0
  877. package/node_modules/@ouro.bot/friends/dist/channel.d.ts +16 -0
  878. package/node_modules/@ouro.bot/friends/dist/channel.js +172 -0
  879. package/node_modules/@ouro.bot/friends/dist/connect-authority.d.ts +43 -0
  880. package/node_modules/@ouro.bot/friends/dist/connect-authority.js +84 -0
  881. package/node_modules/@ouro.bot/friends/dist/connect.d.ts +56 -0
  882. package/node_modules/@ouro.bot/friends/dist/connect.js +163 -0
  883. package/node_modules/@ouro.bot/friends/dist/consent.d.ts +34 -0
  884. package/node_modules/@ouro.bot/friends/dist/consent.js +65 -0
  885. package/node_modules/@ouro.bot/friends/dist/coordination.d.ts +116 -0
  886. package/node_modules/@ouro.bot/friends/dist/coordination.js +329 -0
  887. package/node_modules/@ouro.bot/friends/dist/delegation-grant.d.ts +21 -0
  888. package/node_modules/@ouro.bot/friends/dist/delegation-grant.js +39 -0
  889. package/node_modules/@ouro.bot/friends/dist/file-bundle.d.ts +17 -0
  890. package/node_modules/@ouro.bot/friends/dist/file-bundle.js +27 -0
  891. package/node_modules/@ouro.bot/friends/dist/friend-lookup.d.ts +9 -0
  892. package/node_modules/@ouro.bot/friends/dist/friend-lookup.js +69 -0
  893. package/node_modules/@ouro.bot/friends/dist/grant-store-file.d.ts +19 -0
  894. package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +157 -0
  895. package/node_modules/@ouro.bot/friends/dist/grant-store.d.ts +7 -0
  896. package/node_modules/@ouro.bot/friends/dist/grant-store.js +8 -0
  897. package/node_modules/@ouro.bot/friends/dist/grants.d.ts +43 -0
  898. package/node_modules/@ouro.bot/friends/dist/grants.js +100 -0
  899. package/node_modules/@ouro.bot/friends/dist/group-context.d.ts +21 -0
  900. package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/group-context.js +5 -4
  901. package/node_modules/@ouro.bot/friends/dist/identity.d.ts +17 -0
  902. package/node_modules/@ouro.bot/friends/dist/identity.js +68 -0
  903. package/node_modules/@ouro.bot/friends/dist/index.d.ts +73 -0
  904. package/node_modules/@ouro.bot/friends/dist/index.js +164 -0
  905. package/node_modules/@ouro.bot/friends/dist/link-identity.d.ts +14 -0
  906. package/node_modules/@ouro.bot/friends/dist/link-identity.js +157 -0
  907. package/node_modules/@ouro.bot/friends/dist/mailbox/index.d.ts +105 -0
  908. package/node_modules/@ouro.bot/friends/dist/mailbox/index.js +205 -0
  909. package/node_modules/@ouro.bot/friends/dist/mcp/bin.d.ts +2 -0
  910. package/node_modules/@ouro.bot/friends/dist/mcp/bin.js +17 -0
  911. package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.d.ts +40 -0
  912. package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +744 -0
  913. package/node_modules/@ouro.bot/friends/dist/mcp/index.d.ts +6 -0
  914. package/node_modules/@ouro.bot/friends/dist/mcp/index.js +14 -0
  915. package/node_modules/@ouro.bot/friends/dist/mcp/run-main.d.ts +7 -0
  916. package/node_modules/@ouro.bot/friends/dist/mcp/run-main.js +59 -0
  917. package/node_modules/@ouro.bot/friends/dist/mcp/schemas.d.ts +10 -0
  918. package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +23 -0
  919. package/node_modules/@ouro.bot/friends/dist/mcp/server.d.ts +30 -0
  920. package/node_modules/@ouro.bot/friends/dist/mcp/server.js +195 -0
  921. package/node_modules/@ouro.bot/friends/dist/message.d.ts +93 -0
  922. package/node_modules/@ouro.bot/friends/dist/message.js +129 -0
  923. package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +89 -0
  924. package/node_modules/@ouro.bot/friends/dist/mission-result.js +207 -0
  925. package/node_modules/@ouro.bot/friends/dist/mission-share.d.ts +94 -0
  926. package/node_modules/@ouro.bot/friends/dist/mission-share.js +232 -0
  927. package/node_modules/@ouro.bot/friends/dist/mission-store-file.d.ts +18 -0
  928. package/node_modules/@ouro.bot/friends/dist/mission-store-file.js +169 -0
  929. package/node_modules/@ouro.bot/friends/dist/mission-store.d.ts +10 -0
  930. package/node_modules/@ouro.bot/friends/dist/mission-store.js +9 -0
  931. package/node_modules/@ouro.bot/friends/dist/missions.d.ts +31 -0
  932. package/node_modules/@ouro.bot/friends/dist/missions.js +99 -0
  933. package/node_modules/@ouro.bot/friends/dist/notes.d.ts +11 -0
  934. package/node_modules/@ouro.bot/friends/dist/notes.js +90 -0
  935. package/node_modules/@ouro.bot/friends/dist/observability.d.ts +27 -0
  936. package/node_modules/@ouro.bot/friends/dist/observability.js +31 -0
  937. package/node_modules/@ouro.bot/friends/dist/outcomes.d.ts +9 -0
  938. package/node_modules/@ouro.bot/friends/dist/outcomes.js +51 -0
  939. package/node_modules/@ouro.bot/friends/dist/resolver.d.ts +59 -0
  940. package/node_modules/@ouro.bot/friends/dist/resolver.js +276 -0
  941. package/node_modules/@ouro.bot/friends/dist/results.d.ts +10 -0
  942. package/node_modules/@ouro.bot/friends/dist/results.js +2 -0
  943. package/node_modules/@ouro.bot/friends/dist/room.d.ts +22 -0
  944. package/node_modules/@ouro.bot/friends/dist/room.js +40 -0
  945. package/node_modules/@ouro.bot/friends/dist/roster-store-file.d.ts +16 -0
  946. package/node_modules/@ouro.bot/friends/dist/roster-store-file.js +125 -0
  947. package/node_modules/@ouro.bot/friends/dist/roster-store-memory.d.ts +9 -0
  948. package/node_modules/@ouro.bot/friends/dist/roster-store-memory.js +20 -0
  949. package/node_modules/@ouro.bot/friends/dist/roster-store.d.ts +29 -0
  950. package/node_modules/@ouro.bot/friends/dist/roster-store.js +9 -0
  951. package/node_modules/@ouro.bot/friends/dist/roster-verifier.d.ts +23 -0
  952. package/node_modules/@ouro.bot/friends/dist/roster-verifier.js +47 -0
  953. package/node_modules/@ouro.bot/friends/dist/share.d.ts +113 -0
  954. package/node_modules/@ouro.bot/friends/dist/share.js +314 -0
  955. package/node_modules/@ouro.bot/friends/dist/standing.d.ts +83 -0
  956. package/node_modules/@ouro.bot/friends/dist/standing.js +111 -0
  957. package/node_modules/@ouro.bot/friends/dist/store-file.d.ts +82 -0
  958. package/node_modules/@ouro.bot/friends/dist/store-file.js +1089 -0
  959. package/node_modules/@ouro.bot/friends/dist/store.d.ts +43 -0
  960. package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +10 -0
  961. package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/tokens.js +7 -4
  962. package/node_modules/@ouro.bot/friends/dist/trust-explanation.d.ts +22 -0
  963. package/node_modules/@ouro.bot/friends/dist/trust-explanation.js +90 -0
  964. package/node_modules/@ouro.bot/friends/dist/trust-mutation.d.ts +16 -0
  965. package/node_modules/@ouro.bot/friends/dist/trust-mutation.js +67 -0
  966. package/node_modules/@ouro.bot/friends/dist/types.d.ts +333 -0
  967. package/node_modules/@ouro.bot/friends/dist/types.js +55 -0
  968. package/node_modules/@ouro.bot/friends/dist/util/cap-string.d.ts +7 -0
  969. package/node_modules/@ouro.bot/friends/dist/util/cap-string.js +35 -0
  970. package/node_modules/@ouro.bot/friends/dist/util/safe-id.d.ts +1 -0
  971. package/node_modules/@ouro.bot/friends/dist/util/safe-id.js +10 -0
  972. package/node_modules/@ouro.bot/friends/dist/verifier.d.ts +11 -0
  973. package/node_modules/@ouro.bot/friends/dist/verifier.js +29 -0
  974. package/node_modules/@ouro.bot/friends/dist/whoami.d.ts +7 -0
  975. package/node_modules/@ouro.bot/friends/dist/whoami.js +39 -0
  976. package/node_modules/@ouro.bot/friends/package.json +82 -0
  977. package/node_modules/libsodium/LICENSE +16 -0
  978. package/node_modules/libsodium/README.md +281 -0
  979. package/node_modules/libsodium/dist/modules/libsodium.js +1 -0
  980. package/node_modules/libsodium/dist/modules-esm/libsodium.mjs +1 -0
  981. package/node_modules/libsodium/package.json +54 -0
  982. package/node_modules/libsodium-wrappers/LICENSE +16 -0
  983. package/node_modules/libsodium-wrappers/README.md +281 -0
  984. package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.d.ts +2155 -0
  985. package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js +1 -0
  986. package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.d.mts +2743 -0
  987. package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.mjs +1 -0
  988. package/node_modules/libsodium-wrappers/package.json +74 -0
  989. package/npm-shrinkwrap.json +8789 -0
  990. package/package.json +93 -13
  991. package/skills/agent-commerce.md +116 -0
  992. package/skills/browser-navigation.md +120 -0
  993. package/skills/commerce-setup-guide.md +116 -0
  994. package/skills/commerce-setup.md +87 -0
  995. package/skills/configure-dev-tools.md +64 -74
  996. package/skills/sense-setup.md +56 -0
  997. package/skills/travel-planning.md +141 -0
  998. package/dist/heart/daemon/auth-flow.js +0 -457
  999. package/dist/heart/daemon/heartbeat-timer.js +0 -131
  1000. package/dist/heart/daemon/mcp-server.js +0 -464
  1001. package/dist/heart/daemon/ouro-path-installer.js +0 -210
  1002. package/dist/heart/daemon/ouro-version-manager.js +0 -171
  1003. package/dist/heart/daemon/specialist-tools.js +0 -283
  1004. package/dist/heart/daemon/update-hooks.js +0 -138
  1005. package/dist/heart/obligations.js +0 -197
  1006. package/dist/heart/session-recall.js +0 -216
  1007. package/dist/mind/associative-recall.js +0 -287
  1008. package/dist/mind/friends/channel.js +0 -84
  1009. package/dist/mind/friends/resolver.js +0 -84
  1010. package/dist/mind/friends/store-file.js +0 -190
  1011. package/dist/mind/friends/trust-explanation.js +0 -74
  1012. package/dist/mind/friends/types.js +0 -29
  1013. package/dist/mind/journal-index.js +0 -161
  1014. package/dist/mind/obligations.js +0 -134
  1015. package/dist/repertoire/tasks/board.js +0 -134
  1016. package/dist/repertoire/tasks/index.js +0 -224
  1017. package/dist/repertoire/tasks/lifecycle.js +0 -80
  1018. package/dist/repertoire/tasks/middleware.js +0 -65
  1019. package/dist/repertoire/tasks/parser.js +0 -173
  1020. package/dist/repertoire/tasks/scanner.js +0 -132
  1021. package/dist/repertoire/tasks/transitions.js +0 -144
  1022. package/dist/repertoire/tools-bluebubbles.js +0 -94
  1023. package/dist/senses/bluebubbles-client.js +0 -484
  1024. package/dist/senses/bluebubbles-entry.js +0 -13
  1025. package/dist/senses/bluebubbles-media.js +0 -339
  1026. package/dist/senses/bluebubbles.js +0 -1231
  1027. package/dist/senses/contextual-heartbeat.js +0 -102
  1028. package/dist/senses/debug-activity.js +0 -154
  1029. package/dist/senses/inner-dialog-worker.js +0 -90
  1030. package/dist/senses/inner-dialog.js +0 -647
  1031. package/subagents/README.md +0 -7
  1032. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
  1033. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
  1034. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
  1035. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
  1036. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
  1037. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
  1038. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
  1039. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
  1040. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
  1041. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
  1042. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
  1043. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
  1044. /package/dist/{repertoire/tasks/types.js → heart/attachments/sources/adapter.js} +0 -0
  1045. /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
  1046. /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
  1047. /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
  1048. /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
  1049. /package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/store.js +0 -0
@@ -0,0 +1 @@
1
+ import{r as d,e as Vo,c as Ko,j as e,m as Yo,T as Go,a as Xo,b as Jo,d as Qo,B as _s,u as Zo,D as er,M as tr,f as Vt,g as cn,C as nr,h as sr,i as dn,k as or,l as rr,n as ar,o as zs,p as ir,q as lr,s as cr,t as dr,v as ur,S as We,w as mr,x as pr,y as fr,z as hr,A as xr,E as gr,F as br,G as vr,H as jr,I as As,J as yr,K as wr,L as kr,N as Nr,O as Cr,P as Sr,Q as Er}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 Ls="/api";async function Q(t,n){const s=await fetch(`${Ls}${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 _r(t,n){const s=new EventSource(`${Ls}/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 Ts=d.createContext(()=>{});function mt(){return d.useContext(Ts)}const zr=new Set(["overview","mail","sessions","work","connections","inner","notes","runtime"]);function $s(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=zr.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 Ar=Vo({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 Ar(Ko(t))}function V(t,n){d.useRef({}),d.useEffect(()=>{})}const Lr="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",Tr="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",$r="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 Rr(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",g=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:Lr,children:l}),e.jsx("div",{"data-ouro-sidebar-layout-sidebar":"",className:Tr,children:n}),e.jsx(g,{"data-ouro-sidebar-layout-header":"",className:C($r,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 Ir(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 Mr=t=>d.createElement("a",t),Or=d.createContext({linkComponent:Mr});function Kt(){return d.useContext(Or)}const Pr=/^([a-z][a-z\d+.-]*:|\/\/)/i;function Dr(t){return Pr.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=Dr(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 Br=["top","bottom","left","right"],Rs=["start","center","end"];function Is(t,n){return Br.includes(t)?t:n}function Fr(t){return Rs.includes(t)?t:"center"}const Ms="relative isolate z-(--ouro-layer) in-[[data-ouro$='-portal']]:z-1001",Os="fixed",Hr="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]",Ur=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),qr="data-ouro-pressed-focus",Wr="data-ouro-pressed-within";let Ps;function Ot(t,n=Ps==="pointer"){if(!(!(t instanceof Element)||t===document.body)){t.toggleAttribute(qr,n);for(let s=t.parentElement;s&&s!==document.body;s=s.parentElement)s.toggleAttribute(Wr,n)}}function xn(t){Ps=t;const n=document.documentElement;n.getAttribute("data-ouro-modality")!==t&&n.setAttribute("data-ouro-modality",t),Ot(document.activeElement)}let nt="";function Vr(){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",Ur.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 be(t,n){return d.useCallback(s=>{const o=at(n,s),r=at(t,s);return()=>{o(),r()}},[t,n])}const Kr=new Set([" ","PageUp","PageDown","Home","End","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab"]),Yr=1e3,Gr=200,Xr=1e3,vt=["Enter"," "],gn=["ArrowDown","ArrowUp"],Le=new Set;let Pt=0,Dt=0,Ne=0,Ds,Ke,Bs,bn,ze,st=null;function Gt(t){st??(st=t.style.scrollBehavior),t.style.scrollBehavior="auto"}function Fs(t){st!==null&&t.style.scrollBehavior==="auto"&&(t.style.scrollBehavior=st),st=null}const Hs=()=>Ke!==void 0||[...Le].some(t=>t.querySelector("[data-open]")!==null);function Us(t){Hs()||(Pt=t.scrollX,Dt=t.scrollY,Le.size===0&&(Ds=Qr(t)))}function Xt(t){Le.size>0||Ke!==void 0||(Ds(),Fs(t.document.documentElement))}function it(){clearTimeout(Ke),Ke=void 0,ze==null||ze.trigger.removeEventListener("click",qs),ze=void 0}function qs(){const{view:t}=ze;it(),Xt(t)}function vn(t,n,s){if(n===bn||(bn=n,t.getAttribute("aria-expanded")==="true"))return;const o=t.ownerDocument.defaultView;o.scrollTo({left:o.scrollX,top:o.scrollY,behavior:"instant"}),Us(o),it(),Ke=setTimeout(()=>{it(),Xt(o)},Xr),Ne=0,s?(ze={trigger:t,view:o},t.addEventListener("click",qs)):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)&&(Bs=r.nativeEvent,vn(r.currentTarget,r.nativeEvent,n))}}}const Ce={button:Me(vt),listButton:Me([...vt,...gn]),listInput:Me(gn),dialog:Me(vt,!0),contextMenu:Me([],!1,t=>t.button===2)};function Jr(t){const n=t.ownerDocument.defaultView;return Us(n),it(),Ne=0,Gt(n.document.documentElement),Le.add(t),()=>{Le.delete(t),Xt(n)}}function Qr(t){const n=t.document,s=()=>{Ne=performance.now()+Yr,Fs(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!==Bs&&(c.defaultPrevented?(Ne=0,Gt(n.documentElement)):Kr.has(c.key)&&s())},l=()=>{const c=performance.now(),u=c<Ne;if(u&&(Ne=Math.max(Ne,c+Gr)),u||!Hs()){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 Ws=d.createContext(!1),Zr=d.createContext(!1),ea=d.createContext(!1);function Jt({children:t}){return d.createElement(Ws.Provider,{value:!0},t)}const ta=()=>()=>{},na=t=>t&&"current"in t?t.current??void 0:t;function Vs(t,n=!1){const{portalContainer:s}=Kt(),o=d.useContext(Ws),r=d.useSyncExternalStore(ta,()=>na(s),()=>{}),a=d.useRef(void 0),[l]=d.useState(()=>{const i=u=>{var p;(p=a.current)==null||p.call(a),a.current=u?Jr(u):void 0};return{hold:i,check:u=>{n&&i(u)}}});return o?n?{ref:l.hold}:{}:{...r?{container:r}:{},ref:l.check}}const sa=t=>(t==null?void 0:t.$$typeof)===Symbol.for("react.lazy");function oa(t){const n=[];return d.Children.forEach(t,s=>n.push(s)),n}function ra(t){if(!sa(t))return t;const n=oa(t);return n.length===1&&d.isValidElement(n[0])?n[0]:t}const aa=Hr+" 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",ia=600,la=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,g=Is(o,"top"),m=Fr(r);d.useRef({});const h=d.useRef(null),x=ra(s),v=be(x.props.ref,be(p,h));V(),d.useEffect(()=>{});const w=d.useCallback(F=>{},[]),j=d.useContext(ea),[y,b]=d.useState(!1),[E,$]=d.useState(!1),R=d.useRef(void 0),A=F=>{const q=h.current;n==null||n===""||Vr()!=="touch"&&!yn(q==null?void 0:q.getAttribute("aria-expanded"),q==null?void 0:q.getAttribute("aria-haspopup"))&&$(F)},M=(F,q)=>{clearTimeout(R.current),R.current=setTimeout(q,F)},z=()=>{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(Zr);d.useLayoutEffect(()=>{S&&z()},[S]);const B=x.props["aria-expanded"]??f["aria-expanded"],O=x.props["aria-haspopup"]??f["aria-haspopup"],W=yn(B,O);d.useLayoutEffect(()=>{z()},[W]);const J=Vs(),ee=d.cloneElement(x,Yo(f,x.props,{ref:v,...E?{"data-popup-open":""}:{},...n==null||n===""?{}:{"data-base-ui-tooltip-trigger":""},onPointerEnter:F=>{F.pointerType!=="touch"&&(b(!0),j&&(Oe.count>0||F.timeStamp-Oe.closedAt<la)?A("delay"):M(ia,()=>A("now")))},onPointerLeave:()=>M(jn,()=>$(!1)),onFocus:F=>{F.currentTarget.matches(":focus-visible")&&(b(!0),clearTimeout(R.current),A("focus"))},onBlur:z,onKeyDown:F=>{F.key!=="Escape"||!E||(z(),F.preventDefault(),F.stopPropagation())},onPointerDown:z,onClick:z}));return y?e.jsxs(e.Fragment,{children:[ee,e.jsx(Go,{open:E!==!1,onOpenChange:z,children:e.jsx(Xo,{"data-slot":"tooltip-portal",...J,"data-ouro":"tooltip-portal",className:Ms,children:e.jsx(Jt,{children:e.jsx(Jo,{anchor:h,positionMethod:Os,side:g,align:m,sideOffset:6,collisionPadding:8,"data-ouro":"tooltip-positioner",children:e.jsx(Qo,{"data-slot":"tooltip-content",ref:w,"data-ouro":"tooltip","data-instant":E==="focus"||E==="delay"?E:void 0,onPointerEnter:()=>clearTimeout(R.current),onPointerLeave:()=>M(jn,()=>$(!1)),className:aa,children:n})})})})})]}):ee}let pe,Pe;const wn=100;function ca(){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=ca();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 Ks(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 da="press relative box-border inline-flex shrink-0 items-center justify-center align-middle rounded-ouro-control border border-solid font-medium whitespace-nowrap no-underline select-none touch-manipulation [-webkit-tap-highlight-color:transparent] outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid before:pointer-events-none before:absolute before:-inset-px before:rounded-[inherit] before:[corner-shape:inherit] before:bg-current before:opacity-0 before:transition-opacity before:duration-(--ouro-duration-fast) before:ease-[ease] not-data-disabled:not-active:pointer-fine:hover:before:opacity-[var(--ouro-state-hover,8%)] not-data-disabled:active:before:opacity-[var(--ouro-state-pressed,14%)] bg-(--ouro-bg) border-(--ouro-bd) [--ouro-sq-w:1px] not-data-disabled:not-active:pointer-fine:hover:[--ouro-state:var(--ouro-state-hover,8%)] not-data-disabled:active:[--ouro-state:var(--ouro-state-pressed,14%)] motion-safe:not-data-disabled:active:scale-(--ouro-press-scale) disabled:cursor-not-allowed disabled:opacity-50 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",ua="[&>[data-ouro-label]>svg:not([class*='size-'])]:size-[1.25em] [&>[data-ouro-label]>svg]:shrink-0",ma="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]",pa=["button","submit","reset"];function fa({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(),ha="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 xa(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(ha):!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:g,asChild:m,leftIcon:h,rightIcon:x,reloadDocument:v,default:w,...j}=t,y=Object.hasOwn(yt.solid,n)?n:"primary",b=Object.hasOwn(yt,s)?s:"solid",E=Object.hasOwn(kn,o)?o:"md";X("Button",p,""),V();const $=d.useRef(a),[R,A]=d.useState(!1);d.useEffect(()=>{A(!0)},[]),d.useEffect(()=>{a&&!$.current&&Qt(l),$.current=a},[a,l]);const M=d.useRef(null),z=d.useRef(void 0),S=j.onClick;d.useEffect(()=>{z.current=S});const B=w&&j.href===void 0&&!j.disabled&&!j.disabledReason&&!a;d.useEffect(()=>{const I=B?M.current.closest("[role=dialog],[role=alertdialog]"):null;if(!I)return;const T=P=>{var ge,me;if(!xa(P,I))return;P.preventDefault(),(ge=z.current)==null||ge.call(z,P);const Y=M.current;Y.type==="submit"&&((me=Y.form)==null||me.requestSubmit(Y))};return I.ownerDocument.addEventListener("keydown",T),()=>I.ownerDocument.removeEventListener("keydown",T)},[B]);const O=Ks(j,j["aria-describedby"]),W=be(j.ref,M),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(da,ua,kn[E],ee&&ma,yt[b][y],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(fa,{fadeIn:R})]});if(j.href!==void 0){const{onClick:I,type:T,disabled:P,...Y}=j;return e.jsx(Se,{"data-ouro-control":"button","data-ouro-part":"root",...Y,reloadDocument:v,onClick:a?Cn:I,onAuxClick:a?Cn:Y.onAuxClick,className:F,"data-ouro":"button","data-ouro-squircle":"","data-variant":b,"data-tone":y,"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:L="button",...k}=j,H=k["aria-haspopup"]==="dialog"?{onPointerDown:I=>{var T;(T=k.onPointerDown)==null||T.call(k,I),Ce.dialog.onPointerDown(I)},onKeyDown:I=>{var T;(T=k.onKeyDown)==null||T.call(k,I),Ce.dialog.onKeyDown(I)}}:{},_=pa.includes(L)?L:"button",D=e.jsx(_s,{"data-ouro-control":"button","data-ouro-part":"root","data-slot":"button",...k,...H,ref:W,type:_,disabled:!!(le||a||O.off),focusableWhenDisabled:!!(O.off||a&&!le),className:F,"data-ouro":"button","data-ouro-squircle":"","data-variant":b,"data-tone":y,"data-loading":a?"":void 0,"data-ouro-off":O.off?"":void 0,"data-default":w?"":void 0,"aria-keyshortcuts":w?"Enter":k["aria-keyshortcuts"],"aria-busy":a||k["aria-busy"],"aria-describedby":O.describedBy,children:O.note?e.jsxs(e.Fragment,{children:[K,O.note]}):K});return O.wrapped?e.jsx(lt,{content:O.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=Zo(),[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(er,{direction:o?"rtl":s,children:n})}const ba={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 va(t){return t==="apple"?["Meta"]:t==="unknown"?["Control","Meta"]:["Control"]}function ja(t,n="unknown"){let s=[[]];for(const o of t){const r=o.toLowerCase(),a=r==="mod"?va(n):ba[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 ya(){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 wa=()=>()=>{},ka=()=>"unknown";function ft(){return d.useSyncExternalStore(wa,ya,ka)}function Na(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"},Ca={ctrl:0,alt:1,shift:2,mod:3,cmd:3},Sa={cmd:0,mod:1,ctrl:1,alt:2,shift:3};function Ys(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 Ea(t,n){const s=Ys(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 _a(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?Ca:Sa,p=g=>u[Ys(g)]??4,f=[...i].sort((g,m)=>p(g)-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((g,m)=>{const{text:h,name:x}=Ea(g,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 za="outline-none",Aa="outline-none fixed! inset-x-0! top-auto! bottom-0! w-auto! transform-none!",La="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]",Ta="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",$a="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",Gs="absolute start-ouro-2 top-1/2 flex size-ouro-4 -translate-y-1/2 items-center justify-center",Xs="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",Js="-mx-1 my-1 h-px border-0 bg-border",Ra="absolute",Ia="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",Ma="data-ouro-pressing:select-none data-ouro-pressing:[-webkit-touch-callout:none]",Bt=d.createContext(null),Qs=d.createContext(!1),Zs=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(qa,{},s);case"checkbox":return e.jsx(Da,{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(Ba,{label:n.label,value:n.value,defaultValue:n.defaultValue,onValueChange:n.onValueChange,children:n.options.map(o=>e.jsx(Fa,{value:o.value,shortcut:o.shortcut,disabled:o.disabled,children:o.label},o.value))},s);case"group":return e.jsx(Ha,{label:n.label,children:Ft(n.items)},s);case"submenu":return e.jsx(Ua,{label:n.label,disabled:n.disabled,backLabel:n.backLabel,children:Ft(n.items)},s);default:return e.jsxs(to,{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?fr:hr,g=Vs("Menu",!0),m=d.useContext(Bt)!==null,h=d.useContext(Qs),x=m||h,v=d.useRef(null);d.useLayoutEffect(()=>{const j=v.current;if(j===null)return;const y=()=>{for(const E of j.querySelectorAll("[data-base-ui-focus-guard][role]"))E.removeAttribute("role"),E.setAttribute("aria-hidden","true")},b=new MutationObserver(y);return b.observe(j,{subtree:!0,attributeFilter:["role"]}),()=>b.disconnect()},[]);const w=e.jsx(mr,{...g,"data-ouro":"menu-portal",className:Ms,children:e.jsxs(Jt,{children:[t&&e.jsx(pr,{"data-ouro":"menu-backdrop",className:$a}),e.jsx(f,{"data-ouro":"menu-positioner",className:t?Aa:za,sideOffset:n||c?0:4,collisionPadding:8,...i!==void 0?{anchor:i}:{},positionMethod:Os,...s?{side:s}:{},...o?{align:o}:{},children:e.jsxs(xr,{"data-ouro":"menu","data-ouro-presentation":t?"sheet":"menu","aria-label":u,...p!==void 0?{finalFocus:p}:{},className:C(t?Ta:La,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:Js}),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:Ra,children:w}):w}function Oa(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:g="Close",modal:m,open:h,onOpenChange:x,isOpen:v,onClose:w,placement:j,asChild:y,options:b}=t,E=d.useContext(Qs),$=[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,A=r!==void 0&&!("getBoundingClientRect"in r)?r:void 0,M=Is(u,"bottom"),z=Rs.includes(p)?p:"start";X("Menu",f,""),V();const S=Na(R||A!==void 0?"menu":"auto"),B=i!==void 0?Ft(i):c,[O,W]=d.useState(!1),J=h??O,ee=d.useRef(null),F=d.useRef(null),q=d.useRef(null),K=d.useRef(null);d.useEffect(()=>{var _;const k=r!==void 0?document:(_=q.current)==null?void 0:_.ownerDocument;if(!J||k===void 0)return;F.current=null;const H=D=>{var T;const I=D.target;(T=q.current)!=null&&T.contains(I)||I.closest('[data-ouro="menu-positioner"], [data-base-ui-focus-guard]')||(F.current=I,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 _,D;const H=document.activeElement;H!==document.body&&H.closest('[data-ouro="menu-positioner"]')===null||(D=(_=F.current)!=null&&_.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=A===void 0?r:{getBoundingClientRect:()=>new DOMRect(A.x,A.y,0,0)},H=()=>!1,_=e.jsx(cn,{...se,actionsRef:ee,modal:S,children:e.jsx(ot,{sheet:S,context:!1,side:M,align:A===void 0?z:"start",className:f,closeLabel:g,anchor:k,point:A!==void 0,label:a,finalFocus:H,children:B})});return e.jsx(wt,{of:r instanceof Element?r:null,children:_})}if(R){const k=e.jsxs(nr,{...se,children:[e.jsx(sr,{ref:K,render:s,className:Ma,...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 L=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:Ia,...Ce.listButton,children:o}):e.jsx(dn,{ref:q,render:n,...Ce.listButton}),e.jsx(ot,{sheet:S,context:!1,side:M,align:z,className:f,closeLabel:g,finalFocus:Pa,children:B})]});return o!==void 0?L:e.jsx(wt,{of:q,children:L})}function Pa(){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 eo(t){return typeof t=="string"?t.split("+"):t}function Zt(t,n){const s=eo(t);return s?{"aria-keyshortcuts":ja(s,n)}:{}}function en({children:t,shortcut:n}){const s=eo(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(_a,{keys:s,"aria-hidden":"true",className:"ms-auto"})]})}function to(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:g}=t,m=ft(),h=Ks(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:y=>s(y)}:{}},w=e.jsxs(e.Fragment,{children:[e.jsx(en,{shortcut:a,children:n}),h.note]}),j=o!==void 0&&!i&&!h.off?e.jsx(tr,{...v,"aria-current":r?"page":void 0,closeOnClick:!0,render:e.jsx(Se,{href:o}),children:w}):e.jsx(Vt,{...v,...h.wrapped?{"aria-describedby":h.describedBy,closeOnClick:!h.off}:{},disabled:!!(i||h.off),children:w});return h.wrapped?e.jsx(lt,{content:h.reason,children:j}):j}function no(){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 Da({children:t,shortcut:n,onCheckedChange:s,axAction:o,...r}){const a=ft();return Re("MenuCheckboxItem"),V(),e.jsxs(dr,{"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:Gs,children:e.jsx(ur,{className:"flex",children:e.jsx(no,{})})}),e.jsx(en,{shortcut:n,children:t})]})}function Ba({children:t,label:n,onValueChange:s,...o}){return Re("MenuRadioGroup"),e.jsxs(ir,{...o,...s?{onValueChange:r=>s(r)}:{},children:[n!==void 0&&e.jsx(zs,{className:Xs,children:n}),e.jsx(Zs.Provider,{value:!0,children:t})]})}function Fa({children:t,shortcut:n,...s}){const o=ft();return d.useContext(Zs)||ue("MenuRadioItem","must be rendered inside <MenuRadioGroup>"),V(),e.jsxs(lr,{"data-ouro-control":"menu","data-ouro-part":"radio-item",...s,...Zt(n,o),className:Te,children:[e.jsx("span",{"data-ouro-menu-indicator":"",className:Gs,children:e.jsx(cr,{className:"flex",children:e.jsx(no,{})})}),e.jsx(en,{shortcut:n,children:t})]})}function Ha({label:t,children:n}){return Re("MenuGroup"),V(),e.jsxs(ar,{children:[e.jsx(zs,{className:Xs,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 Ua({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:g}=p.event;if(!(i.current!==null&&(i.current.x!==f||i.current.y!==g))){i.current={x:f,y:g},p.cancel();return}}i.current=void 0,l(!0)};return e.jsxs(or,{open:a,onOpenChange:c,disabled:s,children:[e.jsxs(rr,{"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 qa(){return Re("MenuSeparator"),e.jsx(We,{className:Js})}function Wa(t){return[...document.querySelectorAll('[role="dialog"][data-open], [role="alertdialog"][data-open]')].some(s=>!s.contains(t))?void 0:t}function so(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 Va(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 Ka=["bottom","top","left","right"],Ya="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",Ga="box-border flex shrink-0 justify-end gap-3 px-5 pt-3 pb-5 max-sm:flex-col max-sm:*:w-full";function Xa(){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 oo=d.createContext(null),Ja={bottom:"down",top:"up",left:"left",right:"right"};Xa();const Qa="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) "+Ya,Za="pointer-events-none fixed inset-0 z-1000 min-h-dvh bg-transparent",ei={bottom:"items-end justify-center",top:"items-start justify-center",left:"[justify-content:left]",right:"[justify-content:right]"},ti="[--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",ni={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))]"},si={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(oo);return s||ue(t,"must be rendered inside <SheetRoot>"),s}function oi({side:t="bottom",snapPoints:n,...s}){const o=s.modal!==!1,r=Ka.includes(t)?t:"bottom";V();const a=!!(n&&n.length>0);return e.jsx(oo.Provider,{value:{side:r,snap:a,modal:o},children:e.jsx(gr,{...s,disablePointerDismissal:s.disablePointerDismissal??!o,...n?{snapPoints:n}:{},swipeDirection:Ja[r]})})}function ri({onPointerDown:t,onKeyDown:n,...s}){return xe("SheetTrigger"),e.jsx(br,{"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 ai(t){return xe("SheetPortal"),e.jsx(vr,{children:e.jsx(jr,{"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 ii({ref:t,...n}){xe("SheetBackdrop");const s=so(t);return e.jsx(As,{"data-slot":"sheet-overlay",...n,ref:s,"data-ouro":"sheet-backdrop",className:Qa})}function li({ref:t,...n}){xe("SheetScrim");const s=so(t);return e.jsx(As,{"data-slot":"sheet-scrim",...n,forceRender:!0,ref:s,"aria-hidden":"true","data-ouro":"sheet-scrim-backdrop",className:Za})}function ci(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 di({ref:t,...n}){const{side:s,modal:o}=xe("SheetViewport"),r=be(t,ci(s));return e.jsx(yr,{"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",ei[s])})}function ui({className:t,...n}){const{side:s,snap:o,modal:r}=xe("SheetPopup");return e.jsx(wr,{"data-slot":"sheet-content",...n,className:C(ti,ni[s],s==="bottom"&&si[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 mi({visuallyHidden:t,...n}){return xe("SheetTitle"),e.jsx(Sr,{"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 pi(t){return xe("SheetDescription"),e.jsx(kr,{"data-slot":"sheet-description",...t,"data-ouro-sheet-description":"",className:"m-0 text-sm leading-5 text-muted-foreground"})}function fi({className:t,ref:n,...s}){const o=be(n,Va(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(Nr,{"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 hi(t){return xe("SheetClose"),e.jsx(Cr,{"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 xi="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:g,open:m,onOpenChange:h,footer:x,presentation:v,finalFocus:w,initialFocus:j,closeDisabled:y,keepMounted:b,onOpenChangeComplete:E}){const $=!n||o!==void 0||!i,R=e.jsx(mi,{visuallyHidden:n,children:t});return e.jsxs(oi,{side:r,snapPoints:a,snapPoint:l,modal:i,disablePointerDismissal:!c,...m!==void 0?{open:m,onOpenChange:A=>h(A)}:{},...E?{onOpenChangeComplete:E}:{},children:[g!==void 0&&e.jsx(ri,{render:g}),e.jsxs(ai,{keepMounted:b,children:[i?e.jsx(ii,{}):u&&e.jsx(li,{}),e.jsx(di,{children:e.jsxs(ui,{className:f,"data-ouro-presentation":v,...w?{finalFocus:typeof w=="object"?()=>Wa(w.current):w}:{},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(pi,{children:o})]}):R,e.jsx(fi,{children:p}),x!==void 0&&e.jsx("div",{"data-slot":"sheet-footer","data-ouro-footer":"",className:Ga,children:x}),r==="top"&&e.jsx(An,{}),e.jsxs(hi,{"data-ouro-sheet-close":"",disabled:y,className:`${xi} ${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 bi="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",vi="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:vi,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 ji(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:g="Close",className:m,ref:h,items:x,isCollapsed:v,pathname:w,children:j}=t;X("Sidebar",m,""),s.flatMap(L=>L.items).find(L=>L.items!==void 0),V();const y=Yt("(min-width: 640px)",!0),[b,E]=d.useState(!1),$=d.useRef(null);y&&b&&E(!1);const[R,A]=d.useState(c),M=i??R,z=()=>{A(!M),u==null||u(!M)},B=s.flatMap(L=>L.items.flatMap(k=>k.items!==void 0?k.items:[k])).filter(L=>L.href!==void 0),O=B.some(L=>L.current)?void 0:Ir(B.map(L=>L.href),o),W=L=>L.href!==void 0&&(!!L.current||L.href===O),[J,ee]=d.useState({}),F=(L,k)=>J[L]??k.items.some(W),q=d.useId(),K=(L,k)=>e.jsxs(e.Fragment,{children:[(L.icon!==void 0||k)&&e.jsx("span",{"aria-hidden":"true",className:Tn,children:L.icon!==void 0?L.icon:L.label.charAt(0).toUpperCase()}),e.jsx("span",{className:k?"sr-only":"min-w-0 flex-1 [overflow-wrap:anywhere]",children:L.label}),L.badge!==void 0&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{"data-ouro-sidebar-badge":"",className:k?"sr-only":Ln(L.badge),children:L.badge})]})]}),ie=(L,k,H)=>L?e.jsx(lt,{content:k,side:"right",children:H}):H,le=(L,k,H)=>ie(k,L.label,L.href!==void 0?e.jsx(Se,{href:L.href,"aria-current":W(L)?"page":void 0,"data-ouro-control":"sidebar","data-ouro-part":"link",onClick:_=>{var D;H==null||H(),(D=L.onClick)==null||D.call(L,_)},className:C(Be,k&&Je),children:K(L,k)}):e.jsx("button",{type:"button","data-ouro-control":"sidebar","data-ouro-part":"button",onClick:_=>{H==null||H(),L.onClick(_)},className:C(Be,k&&Je),children:K(L,k)})),se=(L,k,H)=>s.map((_,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:[_.label!==void 0&&e.jsx("p",{id:`${q}${L}${D}`,className:k?"sr-only":"m-0 px-3 py-1 text-sm leading-5 font-semibold text-foreground",children:_.label}),e.jsx("ul",{"aria-labelledby":_.label!==void 0?`${q}${L}${D}`:void 0,className:$n,children:_.items.map((I,T)=>{if(I.items===void 0)return e.jsx("li",{children:le(I,k,H)},T);const P=I.items.some(W);if(k)return e.jsx("li",{children:e.jsx(Oa,{side:"right",closeLabel:g,trigger:e.jsx(lt,{content:I.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(I,!0)})}),children:I.items.map((me,bt)=>e.jsxs(to,{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})]})]},bt))})},T);const Y=`${D}-${T}`,ge=F(Y,I);return e.jsxs("li",{children:[e.jsxs("button",{type:"button","aria-expanded":ge,"aria-controls":`${q}${L}${Y}`,"data-ouro-control":"sidebar","data-ouro-part":"group","data-current":P&&!ge?"":void 0,onClick:()=>ee({...J,[Y]:!ge}),className:C(Be,"data-current:text-foreground"),children:[K(I,!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",ge&&"rotate-90 rtl:-rotate-90"),children:e.jsx("path",{d:"m6 4 4 4-4 4"})})]}),ge&&e.jsx("ul",{id:`${q}${L}${Y}`,className:C($n,"ms-5 mt-1 border-0 border-s border-solid border-border ps-2"),children:I.items.map((me,bt)=>e.jsx("li",{children:le(me,!1,H)},bt))})]},T)})})]},D));return e.jsxs("div",{ref:h,"data-ouro":"sidebar","data-collapsed":M?"":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":y?void 0:"dialog","aria-expanded":b,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"})})}),y&&e.jsxs("nav",{"aria-label":n,"data-collapsed":M?"":void 0,className:bi,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",M)}),l&&e.jsx("div",{className:"shrink-0 p-2",children:e.jsxs("button",{type:"button","aria-pressed":M,"data-ouro-control":"sidebar","data-ouro-part":"collapse",onClick:z,className:C(Be,M&&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:M?"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:g,side:"left",open:b,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",g=Object.hasOwn(Ct,s)?s:"solid";X("Badge",i,""),V();const m=Ct[g][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:A,disabled:M,...z}=p;return e.jsxs(Se,{"data-ouro-control":"badge","data-ouro-part":"root","data-slot":"badge",...z,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:w="button",disabled:j,...y}=p;if(a!==void 0)return e.jsxs(_s,{"data-ouro-control":"badge","data-ouro-part":"root","data-slot":"badge",...y,onClick:a,disabled:j,ref:v,type:w,"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:b,value:E,form:$,...R}=y;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 yi={lime:"success",red:"destructive",yellow:"warning",zinc:"secondary"};function U({color:t,children:n}){return e.jsx(ce,{tone:t&&yi[t]||"secondary",children:n})}const tn={start:"text-start",center:"text-center",end:"text-end"};function ro(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,g]=ro("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"},wi=["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,...g}=t,m=Object.hasOwn(Pn,o)?o:"default",h=wi.includes(n)?n:"p",x=Object.hasOwn(On,s)?s:"md",[v,w]=ro("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),y=l!==void 0?{...c,"--ouro-lines":l}:c;return e.jsx(h,{...g,ref:u,"data-ouro":"text",className:j,style:y})}const Dn={outline:"border border-dashed border-border rounded-ouro-xl",plain:""},St={center:"items-center text-center",start:"items-start text-start"},ki=[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:g,image:m,...h}=t,x=ki.includes(l)?l:3,v=Object.hasOwn(Dn,i)?i:"outline",w=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"&&w==="start")&&"px-6",Dn[v],St[w],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[w]),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:g,overline:m,action:h,image:x,heading:v,...w}=t,j=c===2?2:1,y=u==="lg"?"lg":"md";return X("PageHeader",f,""),V(),e.jsxs("div",{...w,"data-ouro":"page-header","data-size":y,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:y==="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 Ni(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 ao="text-inherit no-underline outline-none after:absolute after:inset-0 after:z-1 after:content-['']",dt=ao+" 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",Ci="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(Ci);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 Si=["div","article","section","li"],Ei=[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"},_i={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"}},zi={outline:{md:"rounded-[inherit]",sm:"rounded-[inherit]"},plain:{md:"rounded-ouro-xl",sm:"rounded-ouro-lg"}},Ai="pointer-events-none absolute -z-1 overflow-clip",Ht={inset:"var(--ouro-card-backdrop-inset, calc(var(--ouro-sq-w, 0px) * -1))"},Li={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))"}},Ti={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"},$i={none:"transparent",hovered:"color-mix(in oklab, var(--foreground) 3%, transparent)",pressed:"color-mix(in oklab, var(--foreground) 6%, transparent)"},Ri="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]",Ii="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",Mi="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))]",Oi="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",Pi="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",Di={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:g,stackBelow:m,headingLevel:h=3,variant:x="outline",size:v="md",as:w="div",className:j,subtitle:y,image:b,header:E,actions:$,to:R,asChild:A,interactive:M,...z}=t,S=d.useId(),B=Object.hasOwn(Bn,x)?x:"outline",O=v==="sm"?"sm":"md",W=Si.includes(w)?w:"div",J=Ei.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,L=F&&(i===!0||i==="rise")&&!!a,k=L&&i==="rise"&&!!u;X("Card",j,""),V();const H=Fn[B][O],_=k?Fn.outline[O]:H,D=s?e.jsx(ht,{"data-slot":"card-title",level:J,size:O==="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":L?S:void 0,className:p?ao:dt,children:[s,o&&e.jsx("span",{"data-slot":"card-link-note",className:"sr-only",children:" (opens in a new tab)"})]}):s}):null,I=T=>(D||a||c)&&e.jsxs("div",{"data-slot":"card-header",className:C("flex items-start gap-4",ee&&Di[ee],_,T),children:[e.jsxs("div",{"data-slot":"card-text",className:"flex min-w-0 flex-1 flex-col gap-1",children:[D,a&&(L?e.jsx("div",{"data-slot":"card-reveal",id:S,"data-card-reveal":k?"rise":"",className:k?Ii:Pi,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",...z,onClick:T=>{var P;return(P=z.onClick)==null||P.call(z,T),$e(T)},onAuxClick:T=>{var P;return(P=z.onAuxClick)==null||P.call(z,T),$e(T)},...ie&&{onPointerOver:T=>{var P;return(P=z.onPointerOver)==null||P.call(z,T),K(Y=>Y==="pressed"?Y:T.pointerType!=="touch"&&le(T)?"hovered":"none")},onPointerDown:T=>{var P;return(P=z.onPointerDown)==null||P.call(z,T),le(T)&&K("pressed")},onPointerUp:T=>{var P;return(P=z.onPointerUp)==null||P.call(z,T),K(T.pointerType!=="touch"&&le(T)?"hovered":"none")},onPointerCancel:T=>{var P;return(P=z.onPointerCancel)==null||P.call(z,T),K("none")},onPointerLeave:T=>{var P;return(P=z.onPointerLeave)==null||P.call(z,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],_i[B][O],F&&Ri,(se||L)&&"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(Ai,zi[B][O]),style:B==="plain"?Li[O]:Ht,children:[d.isValidElement(p)?d.cloneElement(p,{style:{...Ti,...p.props.style}}):p,F&&e.jsx("span",{"data-card-tint":"","aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:$i[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][O],se&&Un),children:u}),k&&e.jsxs("div",{"data-slot":"card-rise",className:C("grid overflow-hidden",Hn[B][O]),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:Mi,children:[e.jsx("div",{"aria-hidden":"true","data-slot":"card-rise-glass","data-card-glass":"",className:Oi}),I("z-2 py-3 [grid-area:1/1]")]})]}),!k&&I(),f&&e.jsx("div",{"data-slot":"card-content",className:C("min-w-0",H),children:f}),g&&e.jsx("div",{"data-slot":"card-footer",className:C("flex flex-wrap items-center gap-2",H),children:g}))}const Bi=["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"},Fi={icon:"self-start mt-0.75",sm:"self-start mt-0.75",md:"self-start",lg:"self-start"},Hi="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",Ui={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"}}},qi="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",Wi="rounded-ouro-lg px-3",Vi="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]",Ki="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:g="plain",size:m="md",as:h="div",className:x,subtitle:v,icon:w,avatar:j,image:y,thumbnail:b,action:E,label:$,to:R,asChild:A,onSelect:M,selected:z,buttonRef:S,active:B,isSelected:O,current:W,...J}=t,ee=Object.hasOwn(qn,g)?g:"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=Bi.includes(h)?h:"div",se=n!==void 0,L=!se&&M!==void 0,k=L||se&&z!==void 0,H=`${d.useId()}description`;X("Item",x,""),V();const _=p===!0&&!!u,D=l?"media":"none",I=l&&ie&&q!=="icon"?Yn[ie]:void 0,T=[];return K&&u&&(I?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||L?"":void 0,"data-follows-link":se||L?"":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",Ui[D][u?"actions":"none"],I==null?void 0:I.root[u?"actions":"none"],T.map(P=>P.root),qn[ee],Wn[F],(se||L)&&qi,(se||L)&&sn,k&&ee==="plain"&&Wi,k&&z&&Vi,_&&"group/item",x)},l&&e.jsx("div",{"aria-hidden":q==="icon"?!0:void 0,className:C("shrink-0",Vn[q],a&&!I&&Fi[q],I==null?void 0:I.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&&z?"text-accent-foreground":"text-foreground"),children:L?e.jsx("button",{type:"button",ref:S,onClick:M,"aria-current":z?"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(Ki,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":z?"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||L?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),_&&Hi),children:u}))}const Gn="[&_[data-ouro=item][data-choosable]]:rounded-ouro-lg [&_[data-ouro=item][data-choosable]]:px-3",Yi="[&>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 "+Yi+" [&_[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(),g=Object.hasOwn(Xn,r)?r:"divided",m=d.Children.toArray(s);X("ItemGroup",l,""),V();const{"aria-label":h,"aria-labelledby":x,...v}=p,w=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",g!=="outline"&&"group-has-[[data-choosable]]/item-group:px-3"),children:n}),m.length>0?e.jsx(w,{"aria-label":h,"aria-labelledby":n?f:x,className:C("m-0 flex list-none flex-col p-0",Xn[g]),children:m.map((j,y)=>e.jsx("li",{className:"m-0 min-w-0 p-0",children:j},d.isValidElement(j)?j.key:y))}):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,g=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:g,size:g===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 Gi='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 Xi(t,n){return(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&!t.contains(n)}function Ji(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(g=>g.parent.isConnected);if(c===void 0)return;const{parent:u,previous:p}=c;let f=null;for(let g=u;g!==null&&g!==l;f=g,g=g.parentElement){const m=[...g.querySelectorAll(Gi)].filter(Jn);if(m.length===0)continue;const h=f??(p!=null&&p.isConnected?p:null);(m.find(v=>h===null||Xi(h,v))??m.at(-1)).focus();return}s!=null&&s.isConnected&&Jn(s)&&s.focus()})}function Qi(t){return d.useCallback(n=>n===null?void 0:()=>Ji(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))]"}},Zi=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 el(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 tl(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 nl(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 sl={primary:Qn,secondary:Qn,destructive:nl,success:el,warning:tl};function ol(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:g,children:m,ref:h,...x}=t,v=be(h,Qi()),w=Object.hasOwn(Et,o)?o:"secondary";X("Alert",c,""),V();const j=i===void 0?sl[w]:i,y=Et[w].accent;return e.jsxs("div",{"data-slot":"alert",...x,ref:v,role:Zi.has(w)?"alert":"status","data-ouro":"alert","data-tone":w,className:C("box-border flex w-full items-start gap-3 rounded-ouro-lg border border-solid p-4 text-foreground",Et[w].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",y)}),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",y),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(ol,{"aria-hidden":"true",className:"size-ouro-4"})})]})}function rl({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 al={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=al[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 g=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??g.label}),e.jsx("dd",{className:C("m-0 text-foreground wrap-break-word",u.details),children:p.details??g.value??g.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,g=Object.hasOwn(_t,String(o))?o:void 0,m=g?_t[g].line:"bg-border",h=g?_t[g].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,il=2400;function ll(t,n,s,o){const r=n===0&&t-s>ts?t:o,a=t-r;return{start:r,delay:`${-((a-ts)%il)}ms`}}const io="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]",lo="animate-none",cl=24;let Fe=0,ns=0,ss=Number.NEGATIVE_INFINITY;function dl(t){const[n,s]=d.useState({breathes:!0,delay:void 0});return d.useLayoutEffect(()=>{if(!t)return;const o=Fe<cl;let r;if(o){const a=ll(performance.now(),Fe,ss,ns);ns=a.start,r=a.delay}return s({breathes:o,delay:r}),Fe+=o?1:0,()=>{Fe-=o?1:0,Fe===0&&(ss=performance.now())}},[t]),{breathes:t&&n.breathes,style:n.delay===void 0?void 0:{"--ouro-skeleton-delay":n.delay}}}const os={rect:"h-ouro-4 w-full rounded-ouro-md",circle:"aspect-square rounded-full"},co={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"},uo={sm:"text-sm",md:"text-base",lg:"text-lg"},we="flex h-[1lh] items-center",ul="h-[0.75em] rounded-ouro-sm",mo={md:"py-3",sm:"py-2"},po={md:{root:"gap-6 py-6",pad:"px-6",title:"text-lg"},sm:{root:"gap-4 py-4",pad:"px-4",title:"text-base"}},rs=["w-2/3","w-1/2","w-3/4","w-1/3","w-1/2"],as=["w-full","w-3/4","w-full","w-2/3","w-3/4"],fo={rect:{},text:uo,circle:co,row:mo,card:po},ml=Object.keys(fo);function is(t){return Math.max(1,Number.isInteger(t)?t:1)}function ve({className:t,shimmer:n}){return e.jsx("span",{className:C(io,!n&&lo,ul,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,...g}=t,{breathes:m,style:h}=dl(l),x=ml.includes(n)?n:"rect",v=fo[x],j=s===void 0||Object.hasOwn(v,s)?s:void 0;X("Skeleton",a,""),V();const y={"aria-hidden":!0,"data-ouro":"skeleton","data-shape":x};if(x==="rect"||x==="circle"){const $=x==="circle"?C(os.circle,co[j??"md"]):os.rect;return e.jsx("span",{...g,...y,ref:f,style:h?{...g.style,...h}:g.style,className:C(io,!m&&lo,$,a)})}if(x==="text"){const $=is(o);return e.jsx("span",{...g,...y,ref:f,style:h?{...g.style,...h}:g.style,className:C("block w-full",j&&uo[j],a),children:Array.from({length:$},(R,A)=>e.jsx("span",{className:we,children:e.jsx(ve,{shimmer:m,className:$>1&&A===$-1?"w-2/3":"w-full"})},A))})}const b=j??"md",E=is(r);return e.jsx(e.Fragment,{children:Array.from({length:E},($,R)=>{const A=R===0?{...g,ref:f}:{...g,id:void 0},M=rs[R%rs.length],z=as[R%as.length];if(x==="row")return e.jsxs("span",{...A,...y,style:h?{...A.style,...h}:A.style,className:C("grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4",mo[b],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:M})}),e.jsx("span",{className:C(we,"text-sm"),children:e.jsx(ve,{shimmer:m,className:z})})]})]},R);const S=po[b];return e.jsxs("span",{...A,...y,style:h?{...A.style,...h}:A.style,className:C("flex min-w-0 flex-col overflow-hidden rounded-ouro-xl border border-border bg-card",S.root,a),children:[e.jsxs("span",{className:C("flex min-w-0 flex-col gap-1",S.pad),children:[e.jsx("span",{className:C(we,S.title),children:e.jsx(ve,{shimmer:m,className:M})}),e.jsx("span",{className:C(we,"text-sm"),children:e.jsx(ve,{shimmer:m,className:z})})]}),e.jsxs("span",{className:C("block min-w-0 text-sm",S.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"})})]})]},R)})})}const ls="grid gap-4 sm:grid-cols-3";function pl({continuity:t}){if(t===null)return e.jsx("div",{"aria-busy":"true",className:ls,"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:ls,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 fl={"owed-reply":"red","blocking-obligation":"red","broken-return":"red","stale-delegation":"yellow","return-ready":"lime","overdue-habit":"yellow"},hl={"owed-reply":"owed reply","blocking-obligation":"blocking","broken-return":"broken return","stale-delegation":"stale","return-ready":"ready to return","overdue-habit":"overdue"},xl={"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"]),bl=new Set(["owed-reply","blocking-obligation","broken-return","return-ready","overdue-habit"]);function ho(t,n){return fetch(`/api/agents/${encodeURIComponent(t)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:n})})}function vl({needsMe:t,setNeedsMe:n,agentName:s,nav:o}){const r=t.items.filter(i=>bl.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(cs,{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 ho(s,c.ref.focus);l()},children:"Clear all stale"})}),e.jsx(Z,{variant:"outline","aria-label":"Stale",children:a.map((i,c)=>e.jsx(cs,{item:i,nav:o,agentName:s,onDismiss:()=>{l()}},`stale-${c}`))})]})]})}function jl(t){return t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function cs({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:xl[t.urgency]??""})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(U,{color:fl[t.urgency]??"zinc",children:hl[t.urgency]??t.urgency}),t.ageMs!=null&&e.jsx(N,{as:"span",size:"sm",tone:"muted",className:"tabular-nums",children:jl(t.ageMs)}),r&&e.jsx(re,{variant:"plain",tone:"secondary",size:"sm","aria-label":"Dismiss",title:"Dismiss",onClick:async l=>{l.stopPropagation(),await ho(s,r),o()},children:"✕"})]})})}function yl({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 wl=new Set(["spawning","running","waiting_input","stalled"]);function kl({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),[g,m]=d.useState(null),h=t.agent,x=t.work,v=t.inner,w=t.activity,j=x.tasks,y=x.obligations,b=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 A=(n==null?void 0:n.pinnedConstellations)??[],M=(l==null?void 0:l.items.filter(S=>wl.has(S.status)))??[],z=y.items.filter(S=>S.status==="fulfilled");return e.jsxs("div",{className:"space-y-6",children:[r&&r.items.length>0&&e.jsx(vl,{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})}),A.length>0&&e.jsx(ke,{title:"Pinned threads",children:e.jsx(Z,{variant:"outline","aria-label":"Pinned threads",children:A.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(O=>e.jsxs(zt,{onClick:()=>o({tab:"sessions"}),children:["friend:",O.slice(0,8),"…"]},O)),S.taskRefs.map(O=>e.jsxs(zt,{onClick:()=>o({tab:"work"}),children:["task:",O]},O)),S.bridgeIds.map(O=>e.jsxs(zt,{onClick:()=>o({tab:"connections",focus:O}),children:["bridge:",O.slice(0,8),"…"]},O))]})},B))})}),e.jsx(rl,{view:t,nav:o}),e.jsx(yl,{orientation:p,nav:o}),g&&g.changeCount>0&&e.jsxs(ke,{title:"What changed",meta:g.changeCount,children:[g.snapshotAge&&e.jsxs(N,{size:"sm",tone:"muted",children:["Since ",oe(g.snapshotAge)]}),e.jsx(Z,{"aria-label":"What changed",children:g.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))}),g.items.length>8&&e.jsxs(N,{size:"sm",tone:"muted",children:["+",g.items.length-8," more changes"]})]}),e.jsx(pl,{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:y.openCount,sub:`${b.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"})})]}),M.length>0&&e.jsx(ke,{title:"Active coding",meta:M.length,children:e.jsx(Z,{variant:"outline","aria-label":"Active coding",children:M.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"})})]}),z.length>0&&e.jsx(ke,{title:"Recently closed",children:e.jsx(Z,{"aria-label":"Recently closed",children:z.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:w.recent.map((S,B)=>{const O=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:O}),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 xo(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 Nl(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 Cl(t){return t.sendAuthority==="agent-native"?"native agent mailbox":t.mailboxRole}function Sl(t){return t.transport??t.provider??"not sent"}function El(t){return t.deliveredAt??t.failedAt??t.acceptedAt??t.sentAt??t.submittedAt??t.updatedAt}const _l={screener:"warning",discarded:"destructive",quarantine:"destructive",sent:"success",draft:"primary"};function on({placement:t}){return e.jsx(ce,{tone:_l[t]??"secondary",variant:"soft",children:t})}function zl({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(Ll,{record:l},l.id)):n.map(l=>e.jsx(Al,{message:l,selected:o===l.id,onSelect:()=>r(l.id)},l.id))})})]})}function Al({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:xo(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 Ll({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:[Sl(t)," · ",oe(El(t))]}),e.jsxs("p",{className:"truncate",children:[Cl(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 Tl({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 $l({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 Rl({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 Il({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:Nl(n)}),e.jsx("span",{className:"block truncate",children:n.reason})]})},n.id))})]})}function Ml({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:xo(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 Ol(){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 Pl({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 Dl(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 Bl(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 Fl(t,n,s){return{status:"error",agentName:t,mailboxAddress:n,generatedAt:new Date().toISOString(),message:null,accessLog:[],error:s}}function Hl(t){return(t==null?void 0:t.messages.length)??0}function Ul({agentName:t,focus:n,onFocusConsumed:s,refreshGeneration:o}){var w;const[r,a]=d.useState(null),[l,i]=d.useState("all"),[c,u]=d.useState(n??null),[p,f]=d.useState(null),[g,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(Bl(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(Fl(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:Hl(r)},...j]},[r]),x=d.useMemo(()=>((r==null?void 0:r.messages)??[]).filter(j=>Dl(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(Tl,{folders:h,activeFolder:l,setActiveFolder:i}),e.jsx($l,{discarded:r.recovery.discardedCount,quarantine:r.recovery.quarantineCount,undecryptable:r.recovery.undecryptableCount,missingKeyIds:r.recovery.missingKeyIds}),e.jsx(Rl,{candidates:r.screener,onOpen:j=>{i("screener"),u(j)}}),e.jsx(Il,{entries:r.accessLog})]}),e.jsx("section",{className:"min-w-0 lg:border-r lg:border-border lg:pr-4",children:e.jsx(zl,{folderLabel:((w=h.find(j=>j.id===l))==null?void 0:w.label)??"All",messages:x,outbound:v,selectedId:c,onSelect:u})}),e.jsxs("main",{className:"min-w-0",children:[!c&&e.jsx(Ol,{}),c&&g&&e.jsx(ds,{label:"Opening message"}),c&&!g&&(p==null?void 0:p.status)!=="ready"&&e.jsx(Pl,{error:p==null?void 0:p.error}),(p==null?void 0:p.status)==="ready"&&p.message&&e.jsx(Ml,{detail:p})]})]})}):e.jsx(ds,{label:"Opening mailbox"})}function ds({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 bo({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 vo="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 jo(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 ql=["solid","soft","outline","plain"],Wl=["sm","md","lg"],Vl=2e3;function Kl(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 Yl(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 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:"M18 6 6 18M6 6l12 12"})})}function Xl(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 Jl(t){var n;if((n=navigator.clipboard)!=null&&n.writeText)try{return await navigator.clipboard.writeText(t),!0}catch{}return Xl(t)}function yo(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:g,text:m,content:h,children:x,timeout:v,onClick:w,...j}=t,y=ql.includes(i)?i:"outline",b=Wl.includes(c)?c:"sm";X("CopyButton",p,""),V();const[E,$]=d.useState("idle"),R=d.useRef(void 0),A=d.useRef(!1);d.useEffect(()=>(A.current=!0,()=>{A.current=!1,clearTimeout(R.current)}),[]);const M=async B=>{B.preventDefault();const O=await Jl(n);O&&(u==null||u(n)),A.current&&(clearTimeout(R.current),$(O?"copied":"failed"),Qt(O?o:a),R.current=setTimeout(()=>$("idle"),Vl))},z=E==="copied"?o:E==="failed"?r:s,S=E==="copied"?Yl:E==="failed"?Gl:Kl;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:g,variant:y,size:b,tone:"secondary",onClick:M,...E==="failed"?{title:a}:{},...l?{"aria-label":z,className:"w-(--ouro-button-h) px-0"}:{startIcon:S},children:l?e.jsx(S,{className:"size-[1.25em] shrink-0"}):z})})}function Ql(t){const{motion:n}=Kt(),s=Yt("(prefers-reduced-motion: reduce)",t===!0);return n==="reduced"||n!=="full"&&s}const wo=["default","light","medium-light","medium","medium-dark","dark"],us="inline-block size-[1.25em] shrink-0 overflow-hidden align-[-0.3em] object-contain select-none",Zl="absolute inset-0 size-full object-contain opacity-0 group-data-loaded/emoji:opacity-100",ec="group-data-loaded/emoji:transition-opacity group-data-loaded/emoji:duration-(--ouro-duration-fast) group-data-loaded/emoji:ease-(--ouro-ease-out)",tc="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",nc="group-data-loaded/emoji:transition-[opacity,visibility] group-data-loaded/emoji:duration-(--ouro-duration-fast) group-data-loaded/emoji:ease-(--ouro-ease-out)";function sc(t,n){var s;return((s=t.skinTones)==null?void 0:s[wo.indexOf(n)-1])??t}const ms=new WeakMap,ko=/\uFE0F/g,ps=new WeakMap,oc=8,rc={steps:[]};function ac(t){const[n]=t;if(n===void 0)return rc;let s=ps.get(n);s||ps.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>oc&&s.shift(),r}const Ee=new Map,ic=16;function lc(t){var r;const n=ms.get(t);if(n)return n;const{id:s}=t,o=Ee.get(s)??(r=ac(t.categories.flatMap(a=>a.items))).index??(r.index=mc(t));return s!==void 0&&(Ee.delete(s),Ee.set(s,o),Ee.size>ic&&Ee.delete(Ee.keys().next().value)),ms.set(t,o),o}const _e=new Map,cc=8;function dc(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 uc(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(ko,""),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:wo[o&7]}},has:s=>t.has(s)}}function mc(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=dc(n),r=_e.get(o)??uc(n);return _e.delete(o),_e.set(o,r),_e.size>cc&&_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 pc(t,n,s=!0){const{byToken:o,byText:r,textStarts:a}=lc(n);if(!Array.from(t).some(c=>s&&c===":"||a.has(c)))return t?[t]:[];const l=[];let i=0;for(let c=fs(t,0,a,s);c;c=fs(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(ko,""));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 fc=/\s/u;function fs(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===":"||fc.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 hc='button, a[href], [role="button"], [role="option"], [role="menuitem"]';function xc(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(hc)??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 bc(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 vc(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 jc(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 yc(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 g=sc(n,s),m=d.useRef(null),h=be(i,m),x=Ql(!0),v=!!(g.animatedSrc??g.filmstrip)&&!x,w=xc(m,v&&o===void 0),j=v&&(o??w),y=j&&!g.animatedSrc?g.filmstrip:void 0;bc(m,y),vc(m,v&&f.fetchPriority!=="low"?g.animatedSrc??g.filmstrip.src:void 0);const b=y?y.src:j?g.animatedSrc:g.src,E=a!==void 0,$=d.useRef(null);jc($,m,b,g.src,E);const R=e.jsx("img",{...f,ref:h,"data-ouro":E?void 0:"emoji",src:b,srcSet:j?void 0:g.srcSet,width:n.width,height:n.height,alt:r??n.name,draggable:!1,decoding:"async",className:C(E?[Zl,!x&&ec]:us,y&&"object-cover object-top",!E&&l)});return E?e.jsxs("span",{ref:$,"data-ouro":"emoji",className:C(us,"group/emoji relative",l),children:[e.jsx("span",{"aria-hidden":"true",className:C(tc,!x&&nc),children:typeof a=="string"?e.jsx("img",{src:a,alt:"",draggable:!1,decoding:"async",className:"size-full object-contain"}):a}),R]}):R}const No=/\x1b(?:\[([0-?]*)([ -/]*)([@-~])|[\]PX^_][\s\S]*?(?:\x07|\x1b\\|$)|[ -/]*[0-~]|$)/g;function wc(t){return t.replace(No,"")}const Co={bold:!1,dim:!1,italic:!1,underline:!1,strike:!1,color:null};function kc(t){return!t.bold&&!t.dim&&!t.italic&&!t.underline&&!t.strike&&t.color===null}function hs(t,n){return t===5&&n<16?n:null}function Nc(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=hs(l[0],Number(l[1])));continue}if(i===0)o={...Co};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=hs(c,Number(s[r+2]))),r+=c===5?2:c===2?4:1}}return o}function Cc(t){const n=[];let s=Co,o=0;const r=a=>{if(a==="")return;const l=kc(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(No))r(t.slice(o,a.index)),o=a.index+a[0].length,a[3]==="m"&&a[2]===""&&(s=Nc(s,a[1]));return r(t.slice(o)),n}const Sc=["[--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 Ec(t){const n=t.color===null?void 0:Sc[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 _c(){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 So({code:t,catalogue:n}){return pc(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(yc,{item:s.item,skinTone:s.tone,play:!1,alt:"",className:"size-[1em] align-baseline"})})]},o))}function zc({code:t,catalogue:n}){return Cc(t).map((s,o)=>{const r=n?e.jsx(So,{code:s.text,catalogue:n}):s.text;return s.style?e.jsx("span",{"data-ouro-ansi":"",className:Ec(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:g,showCopyButton:m,...h}=t;X("CodeBlock",c,""),V();const x=d.useRef(null);jo(x);const v=be(_c(),x),w=s==="ansi",j=o??s,y=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",y?"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(yo,{"data-ouro-control":"code-block","data-ouro-part":"copy",value:w?wc(n):n,label:a,hideLabel:!0,variant:"plain",size:"sm",className:"col-start-2 row-start-1 self-center me-1.5"}):null,y?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",y?"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",vo,y?"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:w?e.jsx(zc,{code:n,catalogue:i}):i?e.jsx(So,{code:n,catalogue:i}):n})})})]})}const Ac=()=>()=>{};function Lc(){return d.useSyncExternalStore(Ac,()=>"onbeforematch"in document.body,()=>!1)}function Tc({open:t,onFound:n,children:s,contentClassName:o,...r}){const a=Lc(),l=d.useRef(null),i=d.useRef(n);d.useLayoutEffect(()=>{i.current=n});const[c,u]=d.useState(t),[p,f]=d.useState(!1),[g,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 w=()=>i.current();return v.addEventListener("beforematch",w),()=>v.removeEventListener("beforematch",w)};d.useEffect(h,[]),d.useEffect(()=>{const v=l.current;if(!p||!v)return;if(v.getAnimations().length===0){f(!1);return}const w=j=>{/* istanbul ignore else @preserve -- descendants of the panel send no transition events */j.target===v&&f(!1)};return v.addEventListener("transitionend",w),v.addEventListener("transitioncancel",w),()=>{v.removeEventListener("transitionend",w),v.removeEventListener("transitioncancel",w)}},[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":g?"":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 $c="box-border grid min-w-0 justify-items-start text-foreground",Rc="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",Ic="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:g}=t;X("Collapsible",i,""),V();const m=d.useId(),[h,x]=d.useState(r===!0),v=o??h,w=j=>{o===void 0&&x(j),a==null||a(j)};return e.jsxs("div",{ref:c,"data-ouro":"collapsible",className:C($c,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:Rc,onClick:()=>w(!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:Ic,children:e.jsx("path",{d:"m4 6 4 4 4-4"})})]}),e.jsx(Tc,{id:m,open:v,onFound:()=>w(!0),contentClassName:"pt-1 pb-2","data-ouro-collapsible-panel":"",children:s})]})}function qt(t){const n=t.function.name,s=Mc(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 Mc(t){try{const n=JSON.parse(t);if(n&&typeof n=="object")return n}catch{}return{}}const Oc=48;function Pc(t){return t.scrollHeight-t.scrollTop-t.clientHeight<=Oc}function Eo(t){const n=d.useRef(null),s=d.useRef(!0),o=d.useCallback(()=>{const a=n.current;a&&(s.current=Pc(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 Dc(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 Dc(t.content)}function _o(t){return t.time.authoredAt??t.time.observedAt??t.time.recordedAt}const zo=t=>/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t),Ao=t=>/^[a-f0-9]{64}$/.test(t);function xs(t,n){return!zo(t)||n!==void 0&&!Ao(n)?null:n===void 0?`ouro shepherd status --agent '${t}' --json`:`ouro shepherd inspect --agent '${t}' --id '${n}' --json`}function Bc(t,n,s){return!zo(t)||!Ao(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 Fc="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 Lo(t){return t==="bluebubbles"?"iMessage":t==="teams"?"Teams":t==="cli"?"CLI":t==="mail"?"Mail":t==="voice"?"Voice":t}function Hc(t){return t==="bluebubbles"?"imessage":t==="teams"?"teams":t==="cli"?"terminal":"default"}function Uc(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 qc(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 Wc(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 Vc(t){return _o(t)}function Ae(t){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(Vc(t)))}function Kc({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}=Eo(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(bo,{label:"Loading transcript"}),n&&e.jsx(Yc,{transcript:n})]})}function Yc({transcript:t}){const{messages:n,lastUsage:s}=t,o=Hc(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:Uc(o),children:[e.jsxs("div",{className:qc(o),children:[e.jsx("p",{className:o==="terminal"?"font-mono text-xs":"text-sm font-semibold",children:Lo(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(Gc,{msg:i,surface:o},i.id):i.role==="assistant"?e.jsx(Xc,{msg:i,toolResults:l,surface:o},i.id):null)]})]})}function Gc({msg:t,surface:n}){const s=Ge(t);return e.jsx("div",{className:"flex justify-start py-1",children:e.jsxs("div",{className:Wc(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 Xc({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(Qc,{call:c,result:n.get(c.id),surface:s},c.id))})},`${t.id}-tools`)),e.jsx(e.Fragment,{children:i})}function Jc(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 Qc({call:t,result:n,surface:s}){const o=n?Ge(n):null;return e.jsx("div",{className:`rounded px-2.5 ${Jc(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 Zc({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,g]=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),g(!0),s==null||s())},[t,n,s]),d.useEffect(()=>{if(!i)return;const y=`${i}:${r}`;if(m.current===y)return;m.current=y,g(!0);const[b,E,$]=i.split("/");Q(`/agents/${encodeURIComponent(t)}/sessions/${encodeURIComponent(b)}/${encodeURIComponent(E)}/${encodeURIComponent($)}`).then(p).catch(()=>p(null)).finally(()=>g(!1))},[t,i,r,n]);function h(y){if(i===y){c(null),p(null),m.current=null;return}c(y),p(null),g(!0)}const x=new Set((o==null?void 0:o.starredFriends)??[]);if(!a)return e.jsx(bo,{label:"Loading sessions"});const v=new Map;for(const y of a.items)v.has(y.friendId)||v.set(y.friendId,[]),v.get(y.friendId).push(y);const w=[...v.entries()].sort((y,b)=>{const E=x.has(y[0])?0:1,$=x.has(b[0])?0:1;return E!==$?E-$:b[1].length-y[1].length}),j=[];for(const[y,b]of w){if(b.length>1){j.push({key:y,person:{name:b[0].friendName,channels:b.length,starred:x.has(y)},sessions:b});continue}const E=j[j.length-1];E&&!E.person?E.sessions.push(...b):j.push({key:y,person:null,sessions:[...b]})}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(y=>e.jsxs("div",{className:"space-y-1",children:[y.person&&e.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[y.person.starred&&e.jsx("span",{className:"text-sm text-ouro-gold",children:"★"}),e.jsx("span",{className:"text-sm font-medium",children:y.person.name}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:[y.person.channels," channels"]})]}),e.jsx(Z,{"aria-label":y.person?`${y.person.name}'s sessions`:"Sessions",children:y.sessions.map(b=>{const E=`${b.friendId}/${b.channel}/${b.key}`,$=i===E;return e.jsxs("div",{children:[e.jsx(ed,{session:b,starred:x.has(b.friendId),selected:$,onSelect:()=>h(E)}),$&&e.jsx(Kc,{loading:f,transcript:u})]},E)})})]},y.key))})]})}function ed({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 ",Lo(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 td({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(nd,{lane:s,nav:n},s.id))})]})}function nd({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 sd({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(od,{obligation:a,linkedCoding:o.get(a.id)??[],nav:r},a.id))})]})}function od({obligation:t,linkedCoding:n,nav:s}){const o=rd(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 rd(t){return"isPrimary"in t}function ad({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 id({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 ld({view:t,error:n}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx(te,{title:"Recovery Sentinel"}),e.jsx(cd,{view:t,error:n})]})}function cd({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(bs,{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(bs,{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(ud,{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 bs({label:t,receipt:n,prominent:s=!1}){const o=pd(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:To(n.verdict),children:n.verdict}),e.jsx("span",{className:"font-mono text-xs",children:$o(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:vs(n.recoveryAnchor.currentAsk)},{term:"Next safe action",details:vs(n.recoveryAnchor.nextSafeAction)}]}),n.signals.length>0&&e.jsx(Z,{"aria-label":`${t} signals`,children:n.signals.map(r=>e.jsx(dd,{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 vs(t){return t?de(t,140):"unknown"}function dd({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:md(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 ud({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:To(t.verdict),children:t.verdict}),description:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-mono",children:$o(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 To(t){return t==="ready"?"lime":t==="watch"?"yellow":"red"}function md(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 pd(t){return Array.from(new Set(t.filter(Boolean)))}function $o(t){return t.replace(/_/g," ")}function fd({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),[g,m]=d.useState(null),[h,x]=d.useState(null),v=n.work,w=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(A=>{R||i(A)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/obligations`).then(A=>{R||u(A)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/self-fix`).then(A=>{R||f(A)}).catch(()=>{}),Q(`/agents/${encodeURIComponent(t)}/sentinel`).then(A=>{R||(m(A),x(null))}).catch(A=>{R||(m(null),x(A instanceof Error?A.message:"sentinel unavailable"))}),()=>{R=!0}},[t,r]);const y=(c==null?void 0:c.items)??w.items,b=(c==null?void 0:c.openCount)??w.openCount,E=(l==null?void 0:l.items)??[],$=new Map;for(const R of E){const A=R.obligationId;if(A){const M=$.get(A);M?M.push(R):$.set(A,[R])}}return e.jsxs("div",{className:"space-y-8",children:[(g||h)&&e.jsx(ld,{view:g,error:h}),e.jsx(sd,{obligations:y,openCount:b,primarySelectionReason:c==null?void 0:c.primarySelectionReason,codingByObligation:$,nav:a}),p&&p.steps.length>0&&e.jsx(ad,{selfFix:p}),e.jsx(td,{items:E,nav:a}),e.jsx(id,{tasks:j})]})}function hd({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)??[],g=(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,w=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||w)&&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),"…"]}),w&&e.jsxs(re,{variant:"plain",size:"sm",onClick:()=>r({tab:"work",focus:w}),children:["obligation: ",w.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:g.map(h=>{const x=h.attachedSessions,v=h.task,w=h.lifecycle==="active";return e.jsx(G,{title:h.objective,actions:e.jsx(U,{color:w?"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,y)=>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]},y))}),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 xd({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 bd({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(_o(t)))}function vd({messages:t}){var g;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=((g=r[r.length-1])==null?void 0:g.id)??null,{ref:i,onScroll:c,preserveScroll:u}=Eo(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(y=>y.kind==="surface"),w=x.filter(y=>y.kind==="rest"),j=x.filter(y=>y.kind==="delegation");return e.jsxs("div",{"data-msg-index":m.sequence,children:[v.map(y=>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:y.deliveredText}),y.metadata&&e.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",y.metadata]})]})},y.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)]}),w.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&&w.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 jd({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),[g,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(!g);return}Q(`/agents/${encodeURIComponent(t)}/inner-transcript`).then(S=>{h.current=s,f(S),m(!0)})}const w=(r==null?void 0:r.items)??[],j=(l==null?void 0:l.items)??[],y=w.filter(S=>S.isOverdue),b=w.filter(S=>S.status==="active"&&!S.isOverdue),E=w.filter(S=>S.status==="paused"),$=x.mode==="deep"?x.origin:null,R=x.mode==="deep"?x.obligationStatus:null,A=x.returnObligationQueue,M=w.find(S=>S.name.toLowerCase()==="heartbeat"),z=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:[M&&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:M.isOverdue?"destructive":"success",variant:"soft",dot:!0,children:M.isOverdue?"Overdue":"Healthy"}),e.jsxs(N,{as:"span",size:"sm",tone:"muted",children:["every ",M.cadence??"unknown"," · last ",M.lastRun?oe(M.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."}),(A.queuedCount>0||A.runningCount>0)&&e.jsxs(N,{size:"sm",children:["Held work items:"," ",e.jsx("span",{className:"font-medium",children:A.queuedCount+A.runningCount})," ","(",A.queuedCount," queued",A.runningCount>0?`, ${A.runningCount} running`:"",")",A.oldestActiveAt!==null&&e.jsxs("span",{children:[" · oldest ",oe(new Date(A.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:z}),l?j.length>0?e.jsx("div",{className:"space-y-2",children:j.map(S=>e.jsx(bd,{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(vd,{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 (${y.length})`,habits:y}),e.jsx(Tt,{label:`Running fine (${b.length})`,habits:b}),e.jsx(Tt,{label:`Paused (${E.length})`,habits:E}),w.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(xd,{h:s},s.name))})}const js={sm:"size-ouro-4",md:"size-ouro-5",lg:"size-ouro-8"},ys={primary:"text-primary",secondary:"text-muted-foreground",destructive:"text-destructive",success:"text-success",warning:"text-warning"};function yd(t){const{label:n="Loading",size:s="md",tone:o,className:r,color:a,...l}=t,i=Object.hasOwn(js,s)?s:"md",c=o!==void 0&&Object.hasOwn(ys,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",js[i],c&&ys[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 wd({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(yd,{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,g)=>e.jsx(re,{variant:l===f?"soft":"plain",tone:l===f?"primary":"secondary",size:"sm","aria-pressed":l===f,onClick:()=>i(f),children:g});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(g=>e.jsx(U,{children:g},g)):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,g)=>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)})]})},g))})]})}const kd=["vertical","horizontal","both"],Nd="[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]",Cd={vertical:"overflow-x-hidden overflow-y-auto",horizontal:"overflow-x-auto overflow-y-hidden",both:"overflow-auto"},Sd="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)]";function Ed(t){d.useEffect(()=>{const n=t.current,s=()=>{n.tabIndex=n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth?0:-1;const r=n.scrollHeight-n.clientHeight,a=Math.max(0,n.scrollTop),l=Math.max(0,r-a),i=r>1&&getComputedStyle(n).overflowY!=="hidden";n.toggleAttribute("data-ouro-scroll-fade-y",i),n.toggleAttribute("data-overflow-y-start",i&&a>1),n.toggleAttribute("data-overflow-y-end",i&&l>1),n.style.setProperty("--scroll-area-overflow-y-start",`${i?a:0}px`),n.style.setProperty("--scroll-area-overflow-y-end",`${i?l:0}px`)},o=new ResizeObserver(s);return o.observe(n),o.observe(n.firstElementChild),n.addEventListener("scroll",s),()=>{o.disconnect(),n.removeEventListener("scroll",s)}},[t])}function _d(t,n){d.useRef({}),d.useEffect(()=>{},[t,n])}function zd(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);_d(p,o),jo(p),Ed(p);const f=kd.includes(s)?s:"vertical";X("ScrollArea",a,""),V();const g=f==="vertical"&&Sd;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",Cd[f],Nd,vo,g,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 Ro={start:"text-start",center:"text-center",end:"text-end"},Io="m-0 align-middle whitespace-nowrap border-b border-border font-normal",Mo="whitespace-normal wrap-anywhere min-w-48",Oo={md:"px-4 py-3",dense:"px-3 py-1.5"},Ad="font-medium text-muted-foreground",Ld="sticky top-0 z-20 bg-background",Po={head:"",body:"[tbody>tr:last-child>&]:border-b-0",foot:"border-t border-b-0 font-medium"},Td="after:outline-ring after:-outline-offset-2 focus-visible:after:outline-2 focus-visible:after:outline-solid",$d=(t,n)=>`Sorted by ${t}, ${n}`,Rd="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",Id={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 Do(t){return t===void 0?void 0:t==="descending"?"descending":"ascending"}const Bo=d.createContext(null),Fo=d.createContext(null),rn=d.createContext(null);function xt(t,n){return ue(t,`must be rendered inside <${n}>`)}function gt(t){return d.useContext(Bo)??xt(t,"Table")}const Ho=t=>{},an=()=>"";function Md(t){const{caption:n,hideCaption:s,striped:o,dense:r,stickyHeader:a,sortedLabel:l=$d,children:i,className:c,tableRef:u,...p}=t;return e.jsx(Bo.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(zd,{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 Uo(t){const{part:n,kind:s,className:o,...r}=t;gt(n),X(n,o,an());const a=s==="head"?"thead":s==="body"?"tbody":"tfoot";return e.jsx(Fo.Provider,{value:s,children:e.jsx(a,{...r,className:C(o)})})}function Od(t){return e.jsx(Uo,{...t,part:"TableHeader",kind:"head"})}function Pd(t){return e.jsx(Uo,{...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=gt("TableRow"),u=d.useContext(Fo)??xt("TableRow","TableBody"),p=d.useRef(null),f=be(a,p);X("TableRow",r,"");const g=n!==void 0&&u==="body";return d.useEffect(()=>{}),e.jsx(rn.Provider,{value:{section:u,href:g?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":g?"":void 0,"data-follows-link":g?"":void 0,className:C(c.striped&&u==="body"&&"even:bg-muted/50",g&&"relative isolate cursor-pointer pointer-coarse:h-ouro-11",g&&sn,r),children:l})})}function Wt(t){return t==="center"||t==="end"?t:"start"}function qo(t,n){V()}function Dd(t){const{align:n,hideHeader:s,wrap:o,sorted:r,onSort:a,className:l,children:i,...c}=t,u=gt("TableHead"),p=d.useContext(rn)??xt("TableHead","TableRow");X("TableHead",l,an(),Ho()),qo(),V();const f=Do(r),g=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:Id[f??"none"]})});return e.jsx("th",{scope:"col","aria-sort":f,...c,className:C(Io,Ad,Oo[u.dense?"dense":"md"],Ro[Wt(n)],Po[p.section],o&&Mo,f&&"text-foreground",a&&"relative pointer-coarse:h-ouro-11",u.stickyHeader&&p.section==="head"&&Ld,l),children:a?e.jsxs("button",{type:"button","data-ouro-control":"table","data-ouro-part":"sort",className:C(Rd,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:g}),m]}):e.jsxs(e.Fragment,{children:[g,m&&e.jsx("span",{className:"ms-1.5 inline-flex align-middle",children:m})]})})}function Wo(t){return d.Children.toArray(t).some(n=>d.isValidElement(n)&&(n.type==="a"||Wo(n.props.children)))}function ws(t){var g;const{rowHeader:n,align:s,wrap:o,className:r,children:a,...l}=t,i=gt("TableCell"),c=d.useContext(rn)??xt("TableCell","TableRow"),u=d.useId();X("TableCell",r,an(),Ho()),qo(),n&&c.href!==void 0&&((g=c.claim).owner??(g.owner=u));const p=n&&c.href!==void 0&&c.claim.owner===u&&!Wo(a),f=n?"th":"td";return e.jsx(f,{scope:n?"row":void 0,...l,className:C(Io,Oo[i.dense?"dense":"md"],Ro[Wt(s)],Po[c.section],n&&"font-medium",o&&Mo,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,Td),children:[a,c.external&&e.jsxs("span",{"data-external-label":"",className:"sr-only",children:[" ",c.externalLabel]})]}):a})}const Bd=["start","center","end"];function Fd(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 ks=t=>t.sortable??t.sortValue!==void 0,Hd=(t,n)=>t.sortValue?t.sortValue(n):n[t.key];function Ud(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:Fd(Hd(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 qd=()=>()=>{},Wd=()=>{},Vd=()=>"en",Ns=[];function Kd(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:g,rowExternal:m,externalLabel:h,empty:x="Nothing here yet.",sort:v,defaultSort:w,onSortChange:j,sortedLabel:y,children:b,data:E,onRowClick:$,title:R,sortable:A,...M}=t;X("Table",l,""),V();const z=p??Ns,[S,B]=d.useState(w??null),O=v!==void 0,W=O?v:S,J=(u??Ns).find(k=>k.key===(W==null?void 0:W.key)&&ks(k)),ee=Do(W==null?void 0:W.direction),F=d.useSyncExternalStore(qd,Wd,Vd),q=k=>{B(k),j==null||j(k)},K=d.useMemo(()=>O||!J?z:Ud(z,J,ee,F),[O,z,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&&Bd.includes(k)?k:void 0,L=u===void 0?b:e.jsxs(e.Fragment,{children:[e.jsx(Od,{children:e.jsx($t,{children:u.map(k=>e.jsx(Dd,{align:se(k.align),hideHeader:k.hideHeader,wrap:k.wrap,className:k.className,sorted:k===J?ee:void 0,onSort:ks(k)?H=>q({key:k.key,direction:H}):void 0,children:k.header},k.key))})}),e.jsx(Pd,{children:K.length===0?e.jsx($t,{children:e.jsx(ws,{colSpan:u.length,children:e.jsx("span",{className:"text-muted-foreground",children:x})})}):K.map((k,H)=>{const _=k,D=typeof f=="function"?f(k,H):f!==void 0?_[f]:typeof _.id=="string"||typeof _.id=="number"?_.id:H,I=typeof g=="function"?g(k):g!==void 0?_[g]:void 0;return e.jsx($t,{href:I,external:m,externalLabel:h,children:u.map((T,P)=>e.jsx(ws,{rowHeader:P===le,align:se(T.align),wrap:T.wrap,children:T.cell?T.cell(k,H):_[T.key]},T.key))},D)})})]});return e.jsx(Md,{...M,caption:n,hideCaption:s,striped:o,dense:r,stickyHeader:a,sortedLabel:y,className:l,style:i,tableRef:c,children:L})}const Yd=[{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 Gd({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=su(o)?o:null,g=(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:Xd(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=eu(x);return e.jsx(ae,{size:"sm",headingLevel:3,title:x.lane,description:Jd(x),action:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ce,{tone:tu(x),children:x.status}),e.jsx(ce,{tone:nu(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: ",Qd(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: ",Zd(x.credential)]}),x.credential.revision&&e.jsxs(N,{size:"sm",children:["revision: ",x.credential.revision]}),Cs(x)&&e.jsxs(N,{size:"sm",children:["reason: ",Cs(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(yo,{value:v,label:"Copy repair command",hideLabel:!0,variant:"plain"})]}),x.warnings.map((w,j)=>e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:["warning: ",w]},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`}]}),g.length>0&&e.jsx(Z,{label:"Degraded components",variant:"outline",children:g.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(Kd,{caption:"Recent logs",hideCaption:!0,dense:!0,stickyHeader:!0,className:"max-h-96",columns:Yd,rows:[...m].reverse().slice(0,50),rowKey:(x,v)=>v}):e.jsx(ne,{title:"No log entries.",variant:"plain",align:"start"})]})]})}function Xd(t){return t.length===0?"none":`${t.filter(s=>s.status==="configured").length}/${t.length} configured`}function Jd(t){return t.status==="unconfigured"?"unconfigured":`${t.provider} / ${t.model}`}function Qd(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 Zd(t){return t.status==="present"?t.source??"vault":t.status==="invalid-pool"?"vault unavailable":"missing"}function eu(t){return t.status==="unconfigured"?t.repairCommand:t.credential.repairCommand}function Cs(t){return t.status==="unconfigured"?t.reason:t.readiness.reason}function tu(t){return t.status==="configured"?"success":"warning"}function nu(t){return t==="ready"?"success":t==="failed"?"destructive":t==="stale"?"warning":"secondary"}function su(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 ou(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function ru({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 w={agent:t,tab:v.tab,focus:v.focus};i(v.tab),u(v.focus),window.history.pushState(null,"",rt(w)),a==null||a(w)},[t,a]),g=d.useCallback(v=>{const w={agent:t,tab:v,focus:void 0};i(v),u(void 0),window.history.pushState(null,"",rt(w)),a==null||a(w)},[t,a]),m=d.useCallback(()=>u(void 0),[]);if(Ni(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(Ts.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:ou(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 w=v.map(y=>Rt.find(b=>b.id===y)).filter(y=>y!==void 0),j=Rt.filter(y=>!v.includes(y.id));return[...w,...j]})().map(v=>e.jsx("button",{type:"button",onClick:()=>g(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(kl,{view:n,deskPrefs:s,refreshGeneration:o}),l==="mail"&&e.jsx(Ul,{agentName:t,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="sessions"&&e.jsx(Zc,{agentName:t,focus:c,onFocusConsumed:m,deskPrefs:s,refreshGeneration:o}),l==="work"&&e.jsx(fd,{agentName:t,view:n,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="connections"&&e.jsx(hd,{agentName:t,focus:c,onFocusConsumed:m,refreshGeneration:o}),l==="inner"&&e.jsx(jd,{agentName:t,view:n,refreshGeneration:o}),l==="notes"&&e.jsx(wd,{agentName:t,refreshGeneration:o}),l==="runtime"&&e.jsx(Gd,{agentName:t,view:n,refreshGeneration:o})]})]})})}const au={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 Ss(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 Es({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,": "]}),au[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 iu({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),g=d.useRef(o);d.useEffect(()=>{if(!n){f.current=null;return}const b=n;let E=!0,$=!1,R=!1,A=null;const M=async()=>{if(E){if($){R=!0;return}$=!0,A=new AbortController;try{const W=await Q(`/agents/${encodeURIComponent(b)}/supervision`,{signal:A.signal});if(!E)return;if(W.agentName!==b)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&&!A.signal.aborted&&c({agent:b,message:W instanceof Error?W.message:String(W)})}finally{$=!1,E&&R&&(R=!1,M())}}},z=()=>{M()};f.current=z,z();const S=window.setInterval(()=>{document.visibilityState!=="hidden"&&z()},5e3),B=window.setInterval(()=>p(Date.now()),1e3),O=()=>{p(Date.now()),document.visibilityState!=="hidden"&&z()};return document.addEventListener("visibilitychange",O),()=>{E=!1,A==null||A.abort(),window.clearInterval(S),window.clearInterval(B),document.removeEventListener("visibilitychange",O),f.current===z&&(f.current=null)}},[n]),d.useEffect(()=>{var b;g.current!==o&&(g.current=o,(b=f.current)==null||b.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",w=(m==null?void 0:m.sessions.items.map(b=>({...b,activity:x&&b.freshness.status==="fresh"&&tt(b.observedAt,u)?b.activity:"unknown",authority:x&&tt(b.observedAt,u)?b.authority:"unknown",capability:x&&tt(b.observedAt,u)?b.capability:"unknown"})))??[],j=m!=null&&m.counts?{working:0,idle:0,shell:0,unknown:0}:null;if(j)for(const b of w)j[b.activity]+=1;const y=(m==null?void 0:m.custody.claims.items.filter(b=>(b.state==="unknown"||b.state==="claimed")&&!b.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:b=>r(b.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(b=>e.jsx("option",{value:b,children:b},b))]})]})}),e.jsx(fe,{tone:"primary","aria-label":"Alpha automation boundary",title:"Alpha automation boundary",description:Fc}),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 b;return(b=f.current)==null?void 0:b.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: ",Ss(m.freshness.observedAt,u)]}),e.jsx(re,{variant:"plain",size:"sm",onClick:()=>{var b;return(b=f.current)==null?void 0:b.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(([b,E])=>({term:b,details:E}))}),m.sourceErrors.length>0&&e.jsx("ul",{className:"mt-3 space-y-1",children:m.sourceErrors.map((b,E)=>e.jsx("li",{children:e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:[b.source,": ",b.detail]})},`${b.source}:${b.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(b=>e.jsxs(ae,{size:"sm",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-ouro-mist",children:b}),e.jsx("p",{"data-testid":`supervision-count-${b}`,className:"mt-1 text-2xl tabular-nums",children:(j==null?void 0:j[b])??"Unknown"})]},b))}),e.jsxs(N,{size:"sm",tone:"muted",children:["Showing ",w.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:[w.map(b=>{const E=`${b.host}:${b.session}`,$=m.timeline.items.filter(R=>R.host===b.host&&R.session===b.session);return e.jsx(ae,{as:"article",headingLevel:2,title:b.label,action:e.jsx(U,{color:b.activity==="working"?"lime":b.activity==="unknown"?"yellow":"zinc",children:b.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:[b.host," / ",b.session]})},{term:"Harness",details:b.harness??"Unknown / no identified coding harness"},{term:"Project",details:e.jsx("span",{className:"font-mono",children:b.project??"Unknown"})},{term:"Process instance",details:e.jsx("span",{className:"font-mono",children:b.instance??"Unknown"})},{term:"Last observed",details:`${Ss(b.observedAt,u)} ago`}]}),e.jsxs(N,{size:"sm",children:["Stored mandate / pause state: ",b.authority,". Guarded input: ",b.capability,"."]}),e.jsxs(N,{size:"sm",tone:"warning",className:"break-words",children:["Stored policy assessment, not an enforced dispatch decision: ",b.withheldReason??"Unknown."]}),e.jsxs(N,{size:"sm",children:["Last recorded judgment: ",e.jsx("span",{children:b.lastDecisionLabel??"None recorded"})]}),e.jsxs(N,{size:"sm",tone:"muted",className:"break-words",children:["Last recorded action: ",b.lastAction==="respond"?"Reported terminal response":b.lastAction==="let_through"?"Let through without a response":"None recorded",".",b.lastReason&&e.jsxs(e.Fragment,{children:[" ",b.lastReason]}),b.lastActionAt&&e.jsxs(e.Fragment,{children:[" ",e.jsx("time",{dateTime:b.lastActionAt,children:b.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 ",b.label]}),$.length===0&&e.jsx(N,{size:"sm",tone:"muted",className:"mt-2",children:"No retained events for this terminal."}),e.jsx(Es,{events:$})]})]})},E)}),w.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:xs(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."]}),y.map(b=>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: ",b.state," | ",b.host," / ",b.session]}),e.jsx("p",{className:"break-all font-mono text-xs",children:b.id}),e.jsxs(N,{size:"sm",tone:"muted",children:[b.reason??"No outcome evidence is recorded."," Acknowledgments in the timeline do not rewrite the original state."]}),e.jsx(It,{command:xs(n,b.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:Bc(n,b.id,m.custody.revision),label:"retirement"},`${b.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."})]})]},b.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(Es,{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 $s(window.location.hash)}function lu(t){return t==="degraded"||t==="blocked"?"red":t==="stale"?"yellow":t==="active"?"lime":"zinc"}function cu(){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,g]=d.useState(null),[m,h]=d.useState(null),[x,v]=d.useState(null),[w,j]=d.useState(null),[y,b]=d.useState("connecting"),[E,$]=d.useState(0),R=d.useRef(0),A=d.useRef(Mt()),[M,z]=d.useState(Mt),S=d.useRef(a),B=d.useRef(!0),O=d.useRef(0),W=d.useRef(0),J=d.useRef(null),ee=d.useRef(null),F=d.useCallback(_=>{var D;S.current!==_&&(S.current=_,W.current+=1,R.current+=1,(D=ee.current)==null||D.abort(),l(_),c(null),p(null),h(null),j(null))},[]),q=d.useCallback(async()=>{var I,T;const _=++O.current;(I=J.current)==null||I.abort();const D=new AbortController;J.current=D;try{const P=await Q("/machine",{signal:D.signal});if(!B.current||_!==O.current)return;if(r(P),g(null),v(new Date().toISOString()),!s.current&&!S.current&&P.agents.length>0){const Y=((T=A.current)==null?void 0:T.agent)??P.agents[0].agentName;F(Y)}}catch(P){if(!B.current||D.signal.aborted||_!==O.current)return;g(P instanceof Error?P.message:String(P))}},[F]),K=d.useCallback(async _=>{var P;if(!_)return;const D=++W.current;(P=ee.current)==null||P.abort();const I=new AbortController;ee.current=I;const T=()=>B.current&&D===W.current&&S.current===_;try{const[Y,ge]=await Promise.all([Q(`/agents/${encodeURIComponent(_)}`,{signal:I.signal}),Q(`/agents/${encodeURIComponent(_)}/desk-prefs`,{signal:I.signal})]);if(!T())return;if(Y.agent.agentName!==_)throw new Error("the response belongs to another agent");c(Y),p(ge),h(null),j(new Date().toISOString())}catch(Y){if(!T()||I.signal.aborted)return;h(Y instanceof Error?Y.message:String(Y))}},[]);d.useEffect(()=>(B.current=!0,()=>{var _,D;B.current=!1,O.current+=1,W.current+=1,R.current+=1,(_=J.current)==null||_.abort(),(D=ee.current)==null||D.abort()}),[]),d.useEffect(()=>{q()},[q]),d.useEffect(()=>{a&&K(a)},[a,K]);const ie=d.useCallback(async()=>{const _=++R.current,D=s.current?"":S.current;await Promise.all([q(),D?K(D):Promise.resolve()]),B.current&&R.current===_&&$(I=>I+1)},[q,K]);d.useEffect(()=>_r(()=>{ie()},b),[ie]),d.useEffect(()=>{const _=()=>{const D=un(window.location.hash);if(D){s.current=!0,n(D);return}const I=$s(window.location.hash);I&&(s.current=!1,z(I),n(null),F(I.agent))};return window.addEventListener("hashchange",_),()=>window.removeEventListener("hashchange",_)},[F]);const le=d.useCallback(_=>{const D={agent:_,tab:"overview",focus:void 0};z(D),s.current=!1,n(null),F(_),window.history.pushState(null,"",rt(D))},[F]),se=d.useCallback(_=>{s.current=!0,n({agent:_}),window.history.pushState(null,"",mn(_))},[]);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 L=o.overview.totals,k=(i==null?void 0:i.agent.agentName)===a?i:null;return e.jsxs(Rr,{header:e.jsx(U,{color:o.overview.daemon.mode==="dev"?"yellow":"lime",children:o.overview.daemon.mode}),sidebar:e.jsx(ji,{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:L.liveTasks??0,l:"Tasks",alert:(L.blockedTasks??0)>0},{v:L.openObligations??0,l:"Oblig."},{v:L.activeCodingAgents??0,l:"Coding"}].map(_=>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 ${_.alert?"text-ouro-fang":"text-ouro-bone"}`,children:_.v}),e.jsx("div",{className:"text-[9px] uppercase tracking-widest text-ouro-shadow",children:_.l})]},_.l))})]}),sections:[{label:"Machine",items:[{label:"Supervision",href:mn(null),current:t!==null,onClick:_=>{_.preventDefault(),se(null)}}]},{label:"Agents",items:o.agents.map(_=>({label:_.agentName,href:rt({agent:_.agentName,tab:"overview",focus:void 0}),current:t===null&&_.agentName===a,onClick:D=>{D.preventDefault(),le(_.agentName)},badge:e.jsx(U,{color:lu(_.attention.level),children:_.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 _=u==null?void 0:u.statusLine;if(_)return _;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:[y==="connected"?"Live connection":y==="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,w&&e.jsxs(e.Fragment,{children:[" received ",e.jsx("time",{dateTime:w,children:new Date(w).toLocaleTimeString()})]}),"."]}),e.jsx("button",{type:"button",onClick:()=>{K(a)},className:"ml-2 underline",children:"Retry agent"})]}),t?e.jsx(iu,{agents:o.agents.map(_=>_.agentName),agentName:t.agent,focus:t.focus,refreshGeneration:E,onSelectOwner:se}):k||!a?e.jsx(ru,{agentName:a,view:k,deskPrefs:u,refreshGeneration:E,initialRoute:(M==null?void 0:M.agent)===a?M:void 0,onNavigate:z},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}...`})]})]})}Er.createRoot(document.getElementById("app")).render(e.jsx(d.StrictMode,{children:e.jsx(cu,{})}));