@maudecode/talaria-web 1.22.0 → 1.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_release.json +4 -4
- package/dist/api/chat-router.d.ts +8 -0
- package/dist/api/raw-routes.d.ts +1 -1
- package/dist/api/raw-routes.js +12 -2
- package/dist/api/raw-routes.js.map +1 -1
- package/dist/api/router.d.ts +41 -0
- package/dist/api/router.js +2 -0
- package/dist/api/router.js.map +1 -1
- package/dist/api/sessions-router.d.ts +31 -0
- package/dist/api/sessions-router.js +5 -2
- package/dist/api/sessions-router.js.map +1 -1
- package/dist/api/settings-router.d.ts +37 -0
- package/dist/api/settings-router.js +2 -1
- package/dist/api/settings-router.js.map +1 -1
- package/dist/api/tools-router.js +5 -2
- package/dist/api/tools-router.js.map +1 -1
- package/dist/cli/ctl.d.ts +5 -2
- package/dist/cli/ctl.js +90 -42
- package/dist/cli/ctl.js.map +1 -1
- package/dist/feedback.d.ts +8 -5
- package/dist/feedback.js +204 -21
- package/dist/feedback.js.map +1 -1
- package/dist/http/context.d.ts +3 -1
- package/dist/http/context.js.map +1 -1
- package/dist/providers/catalog.d.ts +1 -1
- package/dist/providers/catalog.js +27 -9
- package/dist/providers/catalog.js.map +1 -1
- package/dist/release.d.ts +14 -1
- package/dist/release.js +40 -2
- package/dist/release.js.map +1 -1
- package/dist/runtime.js +2 -1
- package/dist/runtime.js.map +1 -1
- package/dist/sessions/list.d.ts +1 -1
- package/dist/sessions/list.js +4 -2
- package/dist/sessions/list.js.map +1 -1
- package/dist/sessions/relay.d.ts +31 -2
- package/dist/sessions/relay.js +43 -3
- package/dist/sessions/relay.js.map +1 -1
- package/dist/sessions/service.js +2 -0
- package/dist/sessions/service.js.map +1 -1
- package/dist/sessions/shares.d.ts +2 -0
- package/dist/sessions/shares.js +20 -7
- package/dist/sessions/shares.js.map +1 -1
- package/dist/sessions/source-kind.js +2 -0
- package/dist/sessions/source-kind.js.map +1 -1
- package/dist/sessions/state-db.js +5 -2
- package/dist/sessions/state-db.js.map +1 -1
- package/dist/sessions/streams.d.ts +5 -2
- package/dist/sessions/streams.js +4 -6
- package/dist/sessions/streams.js.map +1 -1
- package/dist/sessions/titles.d.ts +2 -0
- package/dist/sessions/titles.js +11 -0
- package/dist/sessions/titles.js.map +1 -1
- package/dist/sessions/turn.js +17 -12
- package/dist/sessions/turn.js.map +1 -1
- package/dist/settings.js +4 -0
- package/dist/settings.js.map +1 -1
- package/dist/sidecar/client.d.ts +3 -0
- package/dist/sidecar/client.js +2 -1
- package/dist/sidecar/client.js.map +1 -1
- package/dist/sidecar/discover.js +3 -2
- package/dist/sidecar/discover.js.map +1 -1
- package/dist/tools/insights.d.ts +3 -0
- package/dist/tools/insights.js +6 -7
- package/dist/tools/insights.js.map +1 -1
- package/dist/tools/update-notifications.d.ts +2 -0
- package/dist/tools/update-notifications.js +7 -3
- package/dist/tools/update-notifications.js.map +1 -1
- package/dist/tools/updates.d.ts +10 -0
- package/dist/tools/updates.js +81 -22
- package/dist/tools/updates.js.map +1 -1
- package/dist/workspace/media-refs.js +10 -3
- package/dist/workspace/media-refs.js.map +1 -1
- package/package.json +4 -3
- package/sidecar/scripts/suite_runner.py +55 -8
- package/static/dist/FILES.txt +133 -134
- package/static/dist/assets/AppShell-jwd95ofg.js +8 -0
- package/static/dist/assets/{Button-dlsibkzq.js → Button-nrcj7shj.js} +1 -1
- package/static/dist/assets/ChatPage-fmgk8xpk.js +2 -0
- package/static/dist/assets/Composer-oya4ggu7.js +5 -0
- package/static/dist/assets/{ConnectTargets-ejplzo4q.js → ConnectTargets-rg90uiui.js} +1 -1
- package/static/dist/assets/{Dialog-rksfyyq5.js → Dialog-gk0uatl8.js} +1 -1
- package/static/dist/assets/ExtensionRoute-ji4xce9l.js +1 -0
- package/static/dist/assets/HubRoute-2pgy4aa2.js +2 -0
- package/static/dist/assets/Markdown-d6br42ts.js +2 -0
- package/static/dist/assets/{MarkdownRenderer-74ysuomr.js → MarkdownRenderer-k8rmb83g.js} +6 -6
- package/static/dist/assets/{OAuthSignIn-i4flsuq2.js → OAuthSignIn-pbls9ljk.js} +1 -1
- package/static/dist/assets/{QueueCard-msz9wd1m.js → QueueCard-liib58ru.js} +1 -1
- package/static/dist/assets/{ResourceSwitch-b70zg4xd.js → ResourceSwitch-gtdv2jgs.js} +1 -1
- package/static/dist/assets/{RightPanel-f5v61m8j.js → RightPanel-b89e4kx3.js} +1 -1
- package/static/dist/assets/{Select-f3l897pt.js → Select-l6qybenp.js} +1 -1
- package/static/dist/assets/SessionListPanel-l4vy95j8.js +1 -0
- package/static/dist/assets/{SettingsLayout-f4akmrt2.js → SettingsLayout-chw7pl2m.js} +1 -1
- package/static/dist/assets/TerminalPanel-qrd0gkx7.js +16 -0
- package/static/dist/assets/Toaster-ihzgaq9z.js +1 -0
- package/static/dist/assets/{_app-lrjgufcy.js → _app-cn1au4zq.js} +1 -1
- package/static/dist/assets/{_app.ext._extensionId-k3xitxr1.js → _app.ext._extensionId-m4npkrr0.js} +1 -1
- package/static/dist/assets/_app.groups-c8ycbp5n.js +1 -0
- package/static/dist/assets/{_app.index-n3otiki0.js → _app.index-f1fckz3h.js} +1 -1
- package/static/dist/assets/{_app.insights-b0mzlh6m.js → _app.insights-ezivk7ad.js} +1 -1
- package/static/dist/assets/{_app.kanban-d923g7j5.js → _app.kanban-zbkeov0f.js} +1 -1
- package/static/dist/assets/{_app.logs-donegue1.js → _app.logs-dqam5zyz.js} +1 -1
- package/static/dist/assets/{_app.memory-hdnled08.js → _app.memory-gzxkm3a0.js} +1 -1
- package/static/dist/assets/{_app.profiles-fumot3jk.js → _app.profiles-j28l31hl.js} +1 -1
- package/static/dist/assets/{_app.session._sessionId-crmdl2ux.js → _app.session._sessionId-55egsufs.js} +1 -1
- package/static/dist/assets/{_app.settings-jui8iesz.js → _app.settings-f5ltpieb.js} +1 -1
- package/static/dist/assets/_app.settings._section-dda0vfot.js +3 -0
- package/static/dist/assets/{_app.skills-heqcn21m.js → _app.skills-kuc81hq0.js} +1 -1
- package/static/dist/assets/_app.tasks-gyy6vj5l.js +1 -0
- package/static/dist/assets/{_app.todos-bl6kk2zq.js → _app.todos-d0xoy68t.js} +1 -1
- package/static/dist/assets/{_app.workspaces-frvh3o7w.js → _app.workspaces-pawp2gxk.js} +1 -1
- package/static/dist/assets/{abnfDiagram-VCTEODGH-dppg3yfx.js → abnfDiagram-VCTEODGH-mhav7n5a.js} +1 -1
- package/static/dist/assets/{architecture-7GRP2DOG-gbajejh3.js → architecture-7GRP2DOG-ozbanukt.js} +1 -1
- package/static/dist/assets/{architectureDiagram-5GKGNRK7-bzrxyais.js → architectureDiagram-5GKGNRK7-febtor5m.js} +1 -1
- package/static/dist/assets/{archive-yhdyz231.js → archive-gyk9c34a.js} +1 -1
- package/static/dist/assets/{blockDiagram-I7D4REHJ-gmk9koab.js → blockDiagram-I7D4REHJ-ocais2jf.js} +1 -1
- package/static/dist/assets/{c4Diagram-7LVT6UL2-bfqiqqcz.js → c4Diagram-7LVT6UL2-cgpfjx5f.js} +1 -1
- package/static/dist/assets/channel-els5ri1f.js +1 -0
- package/static/dist/assets/{chunk-4HAMMTFA-i9s6h4wv.js → chunk-4HAMMTFA-hvqdiiow.js} +1 -1
- package/static/dist/assets/{chunk-75Z2AOVW-gnt6pnso.js → chunk-75Z2AOVW-hxbulvtb.js} +1 -1
- package/static/dist/assets/{chunk-DU6HZSFF-gq439wot.js → chunk-DU6HZSFF-kkp6a7gp.js} +1 -1
- package/static/dist/assets/{chunk-F27PBJKO-wvx90pbt.js → chunk-F27PBJKO-ljz0gssc.js} +1 -1
- package/static/dist/assets/{chunk-GMAD6QVW-mc2gu30k.js → chunk-GMAD6QVW-bo0enyxn.js} +1 -1
- package/static/dist/assets/{chunk-GVQU2GXP-f8fxa2ym.js → chunk-GVQU2GXP-cnq7l2v6.js} +1 -1
- package/static/dist/assets/{chunk-IMKFNOWR-lnsl31hj.js → chunk-IMKFNOWR-gjnkrfu6.js} +1 -1
- package/static/dist/assets/{chunk-L3NEJ4N5-kbfdidwu.js → chunk-L3NEJ4N5-gjfp71qi.js} +1 -1
- package/static/dist/assets/{chunk-OSK3NFVY-dvxsduj6.js → chunk-OSK3NFVY-ieq5r94b.js} +1 -1
- package/static/dist/assets/{chunk-P2QGCYS3-ivo3i1wf.js → chunk-P2QGCYS3-hdefjk56.js} +1 -1
- package/static/dist/assets/{chunk-POPQ4Y6H-i0gfu0hx.js → chunk-POPQ4Y6H-mcbt8wpr.js} +1 -1
- package/static/dist/assets/{chunk-PWAF6VOD-jb0fdyb0.js → chunk-PWAF6VOD-mx2drja9.js} +1 -1
- package/static/dist/assets/{chunk-SHT3W25Y-b7ou2xsp.js → chunk-SHT3W25Y-j7dd9i66.js} +1 -1
- package/static/dist/assets/{chunk-SVP7TREG-e2v7me5v.js → chunk-SVP7TREG-jcnt3lxt.js} +1 -1
- package/static/dist/assets/{chunk-TICWLB2K-e5zlai62.js → chunk-TICWLB2K-lrwv5hx9.js} +1 -1
- package/static/dist/assets/classDiagram-ZZMXUADV-krpt9pdd.js +1 -0
- package/static/dist/assets/classDiagram-v2-VYDZK3BY-krpt9pdd.js +1 -0
- package/static/dist/assets/{completionAudio-c5at041z.js → completionAudio-fhxf0h9j.js} +1 -1
- package/static/dist/assets/{copy-jj3oiw13.js → copy-gyzrqmyr.js} +1 -1
- package/static/dist/assets/{cynefin-OW5HDTMX-n5n1ck70.js → cynefin-OW5HDTMX-heq36srt.js} +1 -1
- package/static/dist/assets/{cynefinDiagram-5FMLGOSQ-b33npu4f.js → cynefinDiagram-5FMLGOSQ-crrmq338.js} +1 -1
- package/static/dist/assets/{dagre-GXQ25YYZ-miwvae07.js → dagre-GXQ25YYZ-m7fpnt6k.js} +1 -1
- package/static/dist/assets/{diagram-S7CK7UJ4-j8fphsp4.js → diagram-S7CK7UJ4-ebm1ebv6.js} +1 -1
- package/static/dist/assets/{diagram-UQ7AKVKN-5cixo166.js → diagram-UQ7AKVKN-hc0ypsp1.js} +1 -1
- package/static/dist/assets/{diagram-VSXAHHWV-ii3bf92m.js → diagram-VSXAHHWV-mu8q5n4b.js} +1 -1
- package/static/dist/assets/{diagram-VX7I27RA-b3cfgx81.js → diagram-VX7I27RA-i488wdlb.js} +1 -1
- package/static/dist/assets/{diagram-Z3DM3KII-bey9lqr8.js → diagram-Z3DM3KII-gz3nwvq9.js} +1 -1
- package/static/dist/assets/{dist-cb8um5dh.js → dist-ge7hom9n.js} +4 -4
- package/static/dist/assets/{ebnfDiagram-PWID7BFC-2m4wrnqc.js → ebnfDiagram-PWID7BFC-lwskecx4.js} +1 -1
- package/static/dist/assets/{erDiagram-RLTQ6QDP-kak5te0n.js → erDiagram-RLTQ6QDP-c0bysigr.js} +1 -1
- package/static/dist/assets/{eventmodeling-NTZA5JFV-ojcc486t.js → eventmodeling-NTZA5JFV-k19e509j.js} +1 -1
- package/static/dist/assets/feedbackVideo.worker-JBVT3sDD.js +480 -0
- package/static/dist/assets/flowDiagram-HODETNUW-n4m8e6kq.js +1 -0
- package/static/dist/assets/{folder-plus-fk6j7tlv.js → folder-plus-m1ywe0cv.js} +1 -1
- package/static/dist/assets/{ganttDiagram-EL5Y4UJY-k6nfmhrh.js → ganttDiagram-EL5Y4UJY-mz1p8yzt.js} +1 -1
- package/static/dist/assets/{getPseudoElementBounds-mwj3vqni.js → getPseudoElementBounds-ci0x9gki.js} +1 -1
- package/static/dist/assets/{gitGraph-4MIJSDKK-bxq1lbhy.js → gitGraph-4MIJSDKK-h0uskiog.js} +1 -1
- package/static/dist/assets/{gitGraphDiagram-WWUBYQGX-ehvoankt.js → gitGraphDiagram-WWUBYQGX-e4d9um1j.js} +1 -1
- package/static/dist/assets/{highlighted-body-KPVGNVTW-nr4nfdq7.js → highlighted-body-KPVGNVTW-d47n6oqu.js} +1 -1
- package/static/dist/assets/{host-dhgqiozp.js → host-f7eudvft.js} +1 -1
- package/static/dist/assets/index-lab8g9gs.css +2 -0
- package/static/dist/assets/index-n5rg2q2r.js +13 -0
- package/static/dist/assets/{info-A6RAGUB7-dtsj0ybw.js → info-A6RAGUB7-k04of9c6.js} +1 -1
- package/static/dist/assets/{infoDiagram-27XIBGKW-jena90ao.js → infoDiagram-27XIBGKW-l98n1tgz.js} +1 -1
- package/static/dist/assets/{ishikawaDiagram-5VMMS53U-kia6bn5u.js → ishikawaDiagram-5VMMS53U-gkznu2d6.js} +1 -1
- package/static/dist/assets/{journeyDiagram-3NMN7TZE-ipsa6icb.js → journeyDiagram-3NMN7TZE-mt23qvx1.js} +1 -1
- package/static/dist/assets/{kanban-definition-UXKFOSKX-moxx59kp.js → kanban-definition-UXKFOSKX-ab93l7y5.js} +1 -1
- package/static/dist/assets/{lazyRouteComponent-i74ujrfk.js → lazyRouteComponent-dt9efiqk.js} +1 -1
- package/static/dist/assets/{line-lgrkg9no.js → line-dkm9r3as.js} +1 -1
- package/static/dist/assets/{link-2-fp49mwl2.js → link-2-ozyjqwhh.js} +1 -1
- package/static/dist/assets/{link-es18mse1.js → link-dip3g6zs.js} +2 -2
- package/static/dist/assets/{login-o6gfl4gy.js → login-go5xfzkx.js} +1 -1
- package/static/dist/assets/mermaid-HWGCJPDP-o7wh7c74.js +1 -0
- package/static/dist/assets/{mermaid-parser.core-fflovwf2.js → mermaid-parser.core-c4ywstu7.js} +3 -3
- package/static/dist/assets/{mindmap-definition-YA3MSWOX-ic8l9whi.js → mindmap-definition-YA3MSWOX-mnvkgz5u.js} +1 -1
- package/static/dist/assets/{onboarding-bxm7gdrr.js → onboarding-hbbpvp6w.js} +1 -1
- package/static/dist/assets/{packet-AYTQ26CC-ntci3088.js → packet-AYTQ26CC-dfm2ygox.js} +1 -1
- package/static/dist/assets/{pegDiagram-XKGWAZYB-e3btz04w.js → pegDiagram-XKGWAZYB-kfbyls4v.js} +1 -1
- package/static/dist/assets/{pie-WAS4IAKB-o2dc7l36.js → pie-WAS4IAKB-jniw7r2b.js} +1 -1
- package/static/dist/assets/{pieDiagram-E7YTZNPT-gro55rrw.js → pieDiagram-E7YTZNPT-cir9nlg4.js} +1 -1
- package/static/dist/assets/{presence-lq6m12ga.js → presence-ivo54s19.js} +1 -1
- package/static/dist/assets/{quadrantDiagram-AXDQQJYC-fxulmd7d.js → quadrantDiagram-AXDQQJYC-2nnb2u4m.js} +1 -1
- package/static/dist/assets/queryKeys-mbi6o5vh.js +9 -0
- package/static/dist/assets/{radar-RG4KPBEZ-9pcospra.js → radar-RG4KPBEZ-jfvtqhq2.js} +1 -1
- package/static/dist/assets/{railroad-74A4TZTK-nzdga12j.js → railroad-74A4TZTK-hnm0ikx7.js} +1 -1
- package/static/dist/assets/{railroad-abnf-HS5TGJTU-ep3ytel0.js → railroad-abnf-HS5TGJTU-hcfz5gyc.js} +1 -1
- package/static/dist/assets/{railroad-ebnf-LZEXJU2U-iw7uc1wy.js → railroad-ebnf-LZEXJU2U-ocbvmcwo.js} +1 -1
- package/static/dist/assets/{railroad-peg-WCYAUIDC-fo3b3gme.js → railroad-peg-WCYAUIDC-kkbzgo8d.js} +1 -1
- package/static/dist/assets/{railroadDiagram-O6MQD6OU-lxpxf8f0.js → railroadDiagram-O6MQD6OU-ox5v7853.js} +1 -1
- package/static/dist/assets/{requirementDiagram-BXWQKSXE-lrozucd2.js → requirementDiagram-BXWQKSXE-e1iq54h4.js} +1 -1
- package/static/dist/assets/{sankeyDiagram-P5KCCOFB-iusxy9mq.js → sankeyDiagram-P5KCCOFB-mmza9r2u.js} +1 -1
- package/static/dist/assets/{sequenceDiagram-WJ2MYXX4-o987q8ti.js → sequenceDiagram-WJ2MYXX4-dioic69h.js} +1 -1
- package/static/dist/assets/{share._token-bfw7f9m5.js → share._token-i51g4ccy.js} +2 -2
- package/static/dist/assets/{sliders-horizontal-l65hoa3x.js → sliders-horizontal-nj1dipq4.js} +1 -1
- package/static/dist/assets/{stateDiagram-D77RDMKH-hh23v7y5.js → stateDiagram-D77RDMKH-do5wvqjw.js} +1 -1
- package/static/dist/assets/stateDiagram-v2-MP3YSRHH-f0sedx52.js +1 -0
- package/static/dist/assets/{swimlanes-42K2YHIH-gj2t3rm8.js → swimlanes-42K2YHIH-mhjzgtgl.js} +1 -1
- package/static/dist/assets/swimlanesDiagram-VR7AAH4N-n0x444kc.js +8 -0
- package/static/dist/assets/{timeline-definition-24CTP7MA-84s2w2sr.js → timeline-definition-24CTP7MA-i5820ppg.js} +1 -1
- package/static/dist/assets/{toast-gqqcvxiy.js → toast-esv4ma70.js} +1 -1
- package/static/dist/assets/{treeView-Q6P3EWNA-cmuj50l7.js → treeView-Q6P3EWNA-btp8feob.js} +1 -1
- package/static/dist/assets/{treemap-WGGIJYW6-dpjlg0xc.js → treemap-WGGIJYW6-lv71dt7p.js} +1 -1
- package/static/dist/assets/{tts-jw84jlqy.js → tts-bq7ax6xp.js} +1 -1
- package/static/dist/assets/{useForm-lxzhiqao.js → useForm-d5wxx0l0.js} +1 -1
- package/static/dist/assets/{useParams-dt6gkoq7.js → useParams-gk1u0y6m.js} +1 -1
- package/static/dist/assets/{useSearch-o8t49csk.js → useSearch-nsrme1pf.js} +1 -1
- package/static/dist/assets/{useTranscript-gx9umcc2.js → useTranscript-m9ve9mml.js} +1 -1
- package/static/dist/assets/{vennDiagram-4TSXK5OY-g9g5o8vy.js → vennDiagram-4TSXK5OY-bffv7e11.js} +1 -1
- package/static/dist/assets/{wardley-WFR3VGLG-ij35obrl.js → wardley-WFR3VGLG-f1m16ivx.js} +1 -1
- package/static/dist/assets/{wardleyDiagram-VM6X3IG4-f9my7q7w.js → wardleyDiagram-VM6X3IG4-ous4pq48.js} +1 -1
- package/static/dist/assets/{xychartDiagram-S5SC5T6Z-olqx1s1p.js → xychartDiagram-S5SC5T6Z-jxgbp4as.js} +1 -1
- package/static/dist/index.html +1 -1
- package/static/dist/sw.js +1 -1
- package/static/dist/assets/AppShell-hvysbd9x.js +0 -8
- package/static/dist/assets/ChatPage-jikwrwfd.js +0 -2
- package/static/dist/assets/Composer-mnke8ss2.js +0 -5
- package/static/dist/assets/ExtensionRoute-igk5h0rj.js +0 -1
- package/static/dist/assets/HubRoute-eooassx4.js +0 -2
- package/static/dist/assets/Markdown-m5pzgvtx.js +0 -2
- package/static/dist/assets/SessionListPanel-brnzacw9.js +0 -1
- package/static/dist/assets/States-msohx3c0.js +0 -1
- package/static/dist/assets/TerminalPanel-bnu5xawo.js +0 -16
- package/static/dist/assets/Toaster-d6col3ch.js +0 -1
- package/static/dist/assets/_app.groups-bt4wdwnd.js +0 -1
- package/static/dist/assets/_app.settings._section-do84hsqw.js +0 -3
- package/static/dist/assets/_app.tasks-jiudtutt.js +0 -1
- package/static/dist/assets/channel-grt3rob4.js +0 -1
- package/static/dist/assets/classDiagram-ZZMXUADV-nnsp49jr.js +0 -1
- package/static/dist/assets/classDiagram-v2-VYDZK3BY-nnsp49jr.js +0 -1
- package/static/dist/assets/flowDiagram-HODETNUW-kxr9sicu.js +0 -1
- package/static/dist/assets/index-hx7z4wdj.js +0 -13
- package/static/dist/assets/index-o8ebuc5x.css +0 -2
- package/static/dist/assets/mermaid-HWGCJPDP-n2kbzsao.js +0 -1
- package/static/dist/assets/queryKeys-cnvn6pea.js +0 -9
- package/static/dist/assets/refresh-cw-d14h79x5.js +0 -1
- package/static/dist/assets/stateDiagram-v2-MP3YSRHH-jukr0d8h.js +0 -1
- package/static/dist/assets/swimlanesDiagram-VR7AAH4N-ik9m9j2m.js +0 -8
|
@@ -53,4 +53,4 @@ import{r as e}from"./rolldown-runtime-bnnw9q4a.js";import{n as t}from"./jsx-runt
|
|
|
53
53
|
|
|
54
54
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ue,c=!at.jitless,l=c&&de.value,d=t.catchall,f;e._zod.parse=(i,u)=>{f??=r.value;let p=i.value;return s(p)?c&&l&&u?.async===!1&&u.jitless!==!0?(o||=a(t.shape),i=o(i,u),d?Lr([],p,i,u,f,e,u?.abortEarly===!0):i):n(i,u):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Br(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ae(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Fe(e,r,ot())))}),t)}var Vr=_(`$ZodUnion`,(e,t)=>{v.init(e,t),g(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),g(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),g(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),g(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>f(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Br(t,r,e,i)):Br(o,r,e,i)}});function Hr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Ur=_(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Vr.init(e,t);let n=e._zod.parse;g(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||m(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ee(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=u(()=>Hr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ue(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Wr=_(`$ZodIntersection`,(e,t)=>{v.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Kr(e,t,n)):Kr(e,i,a)}});function Gr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fe(e)&&fe(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Gr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Gr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Kr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Gr(t.value,n.value);if(!c.valid){if(Ae(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var qr=_(`$ZodTuple`,(e,t)=>{v.init(e,t);let n=t.items,r=at.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Jr(n,`optin`),l=Jr(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=Ae(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(Ae(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Yr(t,i,e))):Yr(r,i,e)}}return s.length?Promise.all(s).then(()=>Xr(u,i,n,o,l)):Xr(u,i,n,o,l)}});function Jr(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Yr(e,t,n){e.issues.length&&t.issues.push(...Me(n,e.issues)),t.value[n]=e.value}function Xr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Me(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Zr=_(`$ZodRecord`,(e,t)=>{v.init(e,t);let n=at.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!fe(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Fe(e,i,ot())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Me(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Me(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&pn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Fe(e,i,ot())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Me(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Me(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Qr=_(`$ZodEnum`,(e,t)=>{v.init(e,t);let n=o(t.entries),r=new Set(n);e._zod.values=r,g(e,`pattern`,e=>{let t=o(e.def.entries).filter(e=>me.has(typeof e));return RegExp(t.length?`^(${t.map(e=>he(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),$r=_(`$ZodLiteral`,(e,t)=>{v.init(e,t);let n=new Set(t.values);e._zod.values=n,g(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?he(e):e?he(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ei=_(`$ZodTransform`,(e,t)=>{v.init(e,t),e._zod.optin=`optional`,at.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new it(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new rt;return n.value=i,n}});function ti(e,t){return e.value=t.issues.length?void 0:t.value,e}var ni=_(`$ZodOptional`,(e,t)=>{v.init(e,t),g(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,g(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),g(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ti(e,t)):ti(e,r)}return t.innerType._zod.run(e,n)}}),ri=_(`$ZodExactOptional`,(e,t)=>{ni.init(e,t),g(e,`values`,e=>e.def.innerType._zod.values),g(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ii=_(`$ZodNullable`,(e,t)=>{v.init(e,t),g(e,`optin`,e=>e.def.innerType._zod.optin),g(e,`optout`,e=>e.def.innerType._zod.optout),g(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)}|null)$`):void 0}),g(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ai=_(`$ZodDefault`,(e,t)=>{v.init(e,t),e._zod.optin=`defaulted`,g(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>oi(e,t)):oi(r,t)}});function oi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var si=_(`$ZodPrefault`,(e,t)=>{v.init(e,t),e._zod.optin=`defaulted`,g(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ci=_(`$ZodNonOptional`,(e,t)=>{v.init(e,t),g(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>li(t,e)):li(i,e)}});function li(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ui(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Fe(e,r,ot()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var di=_(`$ZodCatch`,(e,t)=>{v.init(e,t),g(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),g(e,`optout`,e=>e.def.innerType._zod.optout),g(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ui(e,r,t,n)):ui(e,r,t,n)}}),fi=_(`$ZodPipe`,(e,t)=>{v.init(e,t),g(e,`values`,e=>e.def.in._zod.values),g(e,`optin`,e=>e.def.in._zod.optin),g(e,`optout`,e=>e.def.out._zod.optout),g(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t.in,n)):pi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t.out,n)):pi(r,t.out,n)}});function pi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var mi=_(`$ZodReadonly`,(e,t)=>{v.init(e,t),g(e,`propValues`,e=>e.def.innerType._zod.propValues),g(e,`values`,e=>e.def.innerType._zod.values),g(e,`optin`,e=>e.def.innerType?._zod?.optin),g(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(hi):hi(r)}});function hi(e){return e.memo||(e.value=Object.freeze(e.value)),e}var gi=_(`$ZodCustom`,(e,t)=>{vn.init(e,t),v.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>_i(t,n,r,e));_i(i,n,r,e)}});function _i(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Be(e))}}var vi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},yi=`~memo`,bi=[];function xi(e){return typeof e==`object`&&!!e}function Si(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ci=new WeakMap,wi=0,Ti=1,Ei=2;function Di(e,t,n){let r=Ci.get(e);if(r!==void 0)return r?Ei:wi;if(t.has(e))return Ei;t.add(e);let i=wi,a=e=>{if(i!==Ei&&e?._zod){let r=Di(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=wi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ti:o.value?._zod?Di(o.value,t,n):wi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ee(c);s(e?o(e,!0):Ti),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Di(r,t,!1):Ti);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Oi(e,i)}function Oi(e,t){return t!==Ti&&Ci.set(e,t===Ei),t}function ki(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ai,ji=[],Mi={alloc(e,t,n){let r=Ai;if(!r)return n;Ai=void 0;let i={value:n,issues:null};return r.set(t.value,i),ji.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Pi(n,e.value))throw new vi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Di(e,new Set,!1);if(i===wi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ei||r?n=!0:r=!0}let l=s.value;if(!xi(l))return t(s,c);let u=c[yi];u||(u={buckets:new WeakMap,backEdges:void 0},c[yi]=u);let d;i===c?d=a:(d=ki(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Si(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ai=d;let p=ji.length,m=t(s,c);Ai=void 0;let ee=ji.length>p?ji.pop():void 0;return m instanceof Promise?m.then(e=>(ee&&(ee.issues=e.issues.length?Si(e.issues):bi),e)):(ee&&(ee.issues=m.issues.length?Si(m.issues):bi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ni(){return Mi}function Pi(e,t){let n=e[yi]?.backEdges;return n!==void 0&&xi(t)&&n.has(t)}var Fi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(ze(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${_e(e.values[0])}`:`Invalid option: expected one of ${s(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${s(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ii(){return{localeError:Fi()}}var Li,Ri=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function zi(){return new Ri}(Li=globalThis).__zod_globalRegistry??(Li.__zod_globalRegistry=zi());var Bi=globalThis.__zod_globalRegistry;function Vi(e){return e.checks&&=[...e.checks],e}function Hi(e,t){return new e(Vi({type:`string`,...h(t)}))}function Ui(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...h(t)})}function Wi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...h(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...h(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...h(t)})}function qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...h(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...h(t)})}function Yi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...h(t)})}function Xi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...h(t)})}function Zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...h(t)})}function Qi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...h(t)})}function $i(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...h(t)})}function ea(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...h(t)})}function ta(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...h(t)})}function na(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...h(t)})}function ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...h(t)})}function ia(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...h(t)})}function aa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...h(t)})}function oa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...h(t)})}function sa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...h(t)})}function ca(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...h(t)})}function la(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...h(t)})}function ua(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...h(t)})}function da(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...h(t)})}function fa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...h(t)})}function pa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...h(t)})}function ma(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...h(t)})}function ha(e,t){return new e(Vi({type:`number`,checks:[],...h(t)}))}function ga(e,t){return new e(Vi({type:`number`,coerce:!0,checks:[],...h(t)}))}function _a(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...h(t)})}function va(e,t){return new e({type:`boolean`,...h(t)})}function ya(e,t){return new e({type:`null`,...h(t)})}function ba(e){return new e({type:`unknown`})}function xa(e,t){return new e({type:`never`,...h(t)})}function Sa(e,t){return new xn({check:`less_than`,...h(t),value:e,inclusive:!1})}function Ca(e,t){return new xn({check:`less_than`,...h(t),value:e,inclusive:!0})}function wa(e,t){return new Sn({check:`greater_than`,...h(t),value:e,inclusive:!1})}function Ta(e,t){return new Sn({check:`greater_than`,...h(t),value:e,inclusive:!0})}function Ea(e,t){return new Cn({check:`multiple_of`,...h(t),value:e})}function Da(e,t){return new Tn({check:`max_length`,...h(t),maximum:e})}function Oa(e,t){return new En({check:`min_length`,...h(t),minimum:e})}function ka(e,t){return new Dn({check:`length_equals`,...h(t),length:e})}function Aa(e,t){return new kn({check:`string_format`,format:`regex`,...h(t),pattern:e})}function ja(e){return new An({check:`string_format`,format:`lowercase`,...h(e)})}function Ma(e){return new jn({check:`string_format`,format:`uppercase`,...h(e)})}function Na(e,t){return new Mn({check:`string_format`,format:`includes`,...h(t),includes:e})}function Pa(e,t){return new Nn({check:`string_format`,format:`starts_with`,...h(t),prefix:e})}function Fa(e,t){return new Pn({check:`string_format`,format:`ends_with`,...h(t),suffix:e})}function Ia(e){return new Fn({check:`overwrite`,tx:e})}function La(e){return Ia(t=>t.normalize(e))}function Ra(){return Ia(e=>e.trim())}function za(){return Ia(e=>e.toLowerCase())}function Ba(){return Ia(e=>e.toUpperCase())}function Va(){return Ia(e=>ce(e))}function Ha(e,t,n){return new e({type:`array`,element:t,...h(n)})}function Ua(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...h(n)})}function Wa(e,t){let n=Ga(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Be(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Be(r))}},e(t.value,t)),t);return n}function Ga(e,t){let n=new vn({check:`custom`,...h(t)});return n._zod.check=e,n}function Ka(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&m(e,t,n[t]);return e}function qa(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Bi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function b(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function x(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,x(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ka(o.schema,c),t.io===`input`&&ro(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ja(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ya(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ja(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ja(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
55
55
|
|
|
56
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qa=[`oneOf`,`anyOf`];function $a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}m(n,r,e.length===1?e[0]:eo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$a(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function to(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Za)if(t in e)return;let n=t.filter(e=>Qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eo(t);else{let e=n[0],i=Qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ka(e,r))}function no(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ka(i,s),Ka(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])to(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ka(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,m(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ro(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ro(r.element,n);if(r.type===`set`)return ro(r.valueType,n);if(r.type===`lazy`)return ro(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return ro(r.innerType,n);if(r.type===`intersection`)return ro(r.left,n)||ro(r.right,n);if(r.type===`record`||r.type===`map`)return ro(r.keyType,n)||ro(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ro(r.in,n)||ro(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ro(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ro(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ro(e,n))return!0;return!!(r.rest&&ro(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=qa({...n,processors:t});return x(e,r),Ya(r,e),no(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=qa({...i??{},target:a,io:t,processors:n});return x(e,o),Ya(o,e),no(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(ye),bigint_format:go(be),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function vo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var yo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bo=new Map([[vr,en],[br,tn]]),xo=e=>bo.get(e)??e,So=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=vo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=yo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(xo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=vo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):b(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},wo=(e,t,n,r)=>{n.type=`boolean`},To=(e,t,n,r)=>{b(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{b(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Do=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Oo=(e,t,n,r)=>{b(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{b(e,t,n,r,`Void cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{n.not={}},jo=(e,t,n,r)=>{},Mo=(e,t,n,r)=>{},No=(e,t,n,r)=>{b(e,t,n,r,`Date cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Fo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(b(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(b(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Io=(e,t,n,r)=>{b(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ro=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=vo(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},zo=(e,t,n,r)=>{n.type=`boolean`},Bo=(e,t,n,r)=>{b(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Vo=(e,t,n,r)=>{b(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Ho=(e,t,n,r)=>{b(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{b(e,t,n,r,`Map cannot be represented in JSON Schema`)},Wo=(e,t,n,r)=>{b(e,t,n,r,`Set cannot be represented in JSON Schema`)},Go=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=vo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=x(a.element,t,{...r,path:[...r.path,`items`]})};function Ko(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ko(t.out):t.type===`catch`?Ko(t.innerType):e._zod.optin}var qo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&b(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)m(i.properties,e,x(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ko(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=x(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Jo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>x(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Yo=(e,t,n,r)=>{let i=e._zod.def,a=x(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=x(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Xo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>x(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?x(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Ko(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=vo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Zo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Zo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Zo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?pn:fn).source)),p}var Qo=new WeakMap;function $o(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Qo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Zo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var es=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=vo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=x(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)m(i.patternProperties,xo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=x(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Qo.get(t);n||(n=[],Qo.set(t,n),t.deferred.push(()=>$o(t))),n.push(e)}i.additionalProperties=x(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ko(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},ts=(e,t,n,r)=>{let i=e._zod.def,a=x(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ns=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rs=Symbol();function is(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(b(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),rs):JSON.parse(o)}var as=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=is(i.defaultValue,e,t,n,r);o!==rs&&(n.default=o)},os=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=is(i.defaultValue,e,t,n,r);o!==rs&&(n._prefault=o)},ss=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{b(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},cs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;x(o,t,r);let s=t.seen.get(e);s.ref=o},ls=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},us=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ds=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fs={string:So,number:Co,boolean:wo,bigint:To,symbol:Eo,null:Do,undefined:Oo,void:ko,never:Ao,any:jo,unknown:Mo,date:No,enum:Po,literal:Fo,nan:Io,template_literal:Lo,file:Ro,success:zo,custom:Bo,function:Vo,transform:Ho,map:Uo,set:Wo,array:Go,object:qo,union:Jo,intersection:Yo,tuple:Xo,record:es,nullable:ts,nonoptional:ns,default:as,prefault:os,catch:ss,pipe:cs,readonly:ls,promise:us,optional:ds,lazy:(e,t,n,r)=>{let i=e._zod.innerType;x(i,t,r);let a=t.seen.get(e);a.ref=i}};function ps(e,t){if(`_idmap`in e){let n=e,r=qa({...t,processors:fs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;x(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Ya(r,n),m(a,t,no(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=qa({...t,processors:fs});return x(e,n),Ya(n,e),no(n,e)}var ms=new WeakSet([Object.prototype,Error.prototype]);function hs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var gs=_(`ZodError`,(e,t)=>{ft.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ms.has(n)||(ms.add(n),hs(n,`format`,e=>t=>ht(e,t)),hs(n,`flatten`,e=>t=>mt(e,t)),hs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),hs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),_s=yt(gs),vs=bt(gs),ys=xt(gs),bs=Ct(gs),xs=kt(gs),Ss=At(gs),Cs=jt(gs),ws=Mt(gs),Ts=Nt(gs),Es=Pt(gs),Ds=Ft(gs),Os=It(gs);function ks(){at.localeError||ot(Ii())}function As(){at.memoizer||ot({memoizer:Ni()})}var S=_(`ZodType`,(e,t)=>(ks(),v.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(oe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(qc(e,t))},superRefine(e,t){return this.check(Jc(e,t))},overwrite(e){return this.check(Ia(e))},optional(){return kc(this)},exactOptional(){return jc(this)},nullable(){return Nc(this)},nullish(){return kc(Nc(this))},nonoptional(e){return zc(this,e)},array(){return O(this)},or(e){return j([this,e])},and(e){return yc(this,e)},transform(e){return Uc(this,Dc(e))},default(e){return Fc(this,e)},prefault(e){return Lc(this,e)},catch(e){return Vc(this,e)},pipe(e){return Uc(this,e)},readonly(){return Gc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ue(this,`~standard`,{...Bn(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){He(this,`~standard`,e)},parse:function e(t,n){return _s(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vs(this,t,n,{callee:e})},safeParse(e,t){return ys(this,e,t)},async safeParseAsync(e,t){return bs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){He(this,`spa`,e)},validate(e,t){return Et(this,e,t)},validateAsync(e,t){return Ot(this,e,t)},encode:function e(t,n){return xs(this,t,n,{callee:e})},decode:function e(t,n){return Ss(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Cs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ws(this,t,n,{callee:e})},safeEncode(e,t){return Ts(this,e,t)},safeDecode(e,t){return Es(this,e,t)},async safeEncodeAsync(e,t){return Ds(this,e,t)},async safeDecodeAsync(e,t){return Os(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),js=_(`_ZodString`,(e,t)=>{Vn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},We({format:e=>vo(e).format??null,minLength:e=>vo(e).minimum??null,maxLength:e=>vo(e).maximum??null},{regex(...e){return this.check(Aa(...e))},includes(...e){return this.check(Na(...e))},startsWith(...e){return this.check(Pa(...e))},endsWith(...e){return this.check(Fa(...e))},min(...e){return this.check(Oa(...e))},max(...e){return this.check(Da(...e))},length(...e){return this.check(ka(...e))},nonempty(...e){return this.check(Oa(1,...e))},lowercase(e){return this.check(ja(e))},uppercase(e){return this.check(Ma(e))},trim(){return this.check(Ra())},normalize(...e){return this.check(La(...e))},toLowerCase(){return this.check(za())},toUpperCase(){return this.check(Ba())},slugify(){return this.check(Va())}})),Ms=_(`ZodString`,(e,t)=>{Vn.init(e,t),js.init(e,t)},{email(e){return this.check(Ui(Ls,e))},url(e){return this.check(Yi(Vs,e))},jwt(e){return this.check(ua(rc,e))},emoji(e){return this.check(Xi(Us,e))},guid(e){return this.check(Wi(Rs,e))},uuid(e){return this.check(Gi(zs,e))},uuidv4(e){return this.check(Ki(zs,e))},uuidv6(e){return this.check(qi(zs,e))},uuidv7(e){return this.check(Ji(zs,e))},nanoid(e){return this.check(Zi(Ws,e))},cuid(e){return this.check(Qi(Gs,e))},cuid2(e){return this.check($i(Ks,e))},ulid(e){return this.check(ea(qs,e))},base64(e){return this.check(sa(ec,e))},base64url(e){return this.check(ca(tc,e))},xid(e){return this.check(ta(Js,e))},ksuid(e){return this.check(na(Ys,e))},ipv4(e){return this.check(ra(Xs,e))},ipv6(e){return this.check(ia(Zs,e))},cidrv4(e){return this.check(aa(Qs,e))},cidrv6(e){return this.check(oa($s,e))},e164(e){return this.check(la(nc,e))},datetime(e){return this.check(da(Ns,e))},date(e){return this.check(fa(Ps,e))},time(e){return this.check(pa(Fs,e))},duration(e){return this.check(ma(Is,e))}});function C(e){return Hi(Ms,e)}var w=_(`ZodStringFormat`,(e,t)=>{y.init(e,t),js.init(e,t)}),Ns=_(`ZodISODateTime`,(e,t)=>{or.init(e,t),w.init(e,t)}),Ps=_(`ZodISODate`,(e,t)=>{sr.init(e,t),w.init(e,t)}),Fs=_(`ZodISOTime`,(e,t)=>{cr.init(e,t),w.init(e,t)}),Is=_(`ZodISODuration`,(e,t)=>{lr.init(e,t),w.init(e,t)}),Ls=_(`ZodEmail`,(e,t)=>{Wn.init(e,t),w.init(e,t)}),Rs=_(`ZodGUID`,(e,t)=>{Hn.init(e,t),w.init(e,t)}),zs=_(`ZodUUID`,(e,t)=>{Un.init(e,t),w.init(e,t)});function Bs(e){return Gi(zs,e)}var Vs=_(`ZodURL`,(e,t)=>{Qn.init(e,t),w.init(e,t)});function Hs(e){return Yi(Vs,e)}var Us=_(`ZodEmoji`,(e,t)=>{$n.init(e,t),w.init(e,t)}),Ws=_(`ZodNanoID`,(e,t)=>{er.init(e,t),w.init(e,t)}),Gs=_(`ZodCUID`,(e,t)=>{tr.init(e,t),w.init(e,t)}),Ks=_(`ZodCUID2`,(e,t)=>{nr.init(e,t),w.init(e,t)}),qs=_(`ZodULID`,(e,t)=>{rr.init(e,t),w.init(e,t)}),Js=_(`ZodXID`,(e,t)=>{ir.init(e,t),w.init(e,t)}),Ys=_(`ZodKSUID`,(e,t)=>{ar.init(e,t),w.init(e,t)}),Xs=_(`ZodIPv4`,(e,t)=>{ur.init(e,t),w.init(e,t)}),Zs=_(`ZodIPv6`,(e,t)=>{pr.init(e,t),w.init(e,t)}),Qs=_(`ZodCIDRv4`,(e,t)=>{mr.init(e,t),w.init(e,t)}),$s=_(`ZodCIDRv6`,(e,t)=>{gr.init(e,t),w.init(e,t)}),ec=_(`ZodBase64`,(e,t)=>{yr.init(e,t),w.init(e,t)}),tc=_(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),w.init(e,t)}),nc=_(`ZodE164`,(e,t)=>{Cr.init(e,t),w.init(e,t)}),rc=_(`ZodJWT`,(e,t)=>{Tr.init(e,t),w.init(e,t)}),ic=_(`ZodNumber`,(e,t)=>{Er.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.isFinite=!0},We({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=vo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=vo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=vo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>vo(e).format??null},{gt(e,t){return this.check(wa(e,t))},gte(e,t){return this.check(Ta(e,t))},min(e,t){return this.check(Ta(e,t))},lt(e,t){return this.check(Sa(e,t))},lte(e,t){return this.check(Ca(e,t))},max(e,t){return this.check(Ca(e,t))},int(e){return this.check(oc(e))},safe(e){return this.check(oc(e))},positive(e){return this.check(wa(0,e))},nonnegative(e){return this.check(Ta(0,e))},negative(e){return this.check(Sa(0,e))},nonpositive(e){return this.check(Ca(0,e))},multipleOf(e,t){return this.check(Ea(e,t))},step(e,t){return this.check(Ea(e,t))},finite(){return this}}));function T(e){return ha(ic,e)}var ac=_(`ZodNumberFormat`,(e,t)=>{Dr.init(e,t),ic.init(e,t)});function oc(e){return _a(ac,e)}var sc=_(`ZodBoolean`,(e,t)=>{Or.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function E(e){return va(sc,e)}var cc=_(`ZodNull`,(e,t)=>{kr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function lc(e){return ya(cc,e)}var uc=_(`ZodUnknown`,(e,t)=>{Ar.init(e,t),S.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function D(){return ba(uc)}var dc=_(`ZodNever`,(e,t)=>{jr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function fc(e){return xa(dc,e)}var pc=_(`ZodArray`,(e,t)=>{As(),Nr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Oa(e,t))},nonempty(e){return this.check(Oa(1,e))},max(e,t){return this.check(Da(e,t))},length(e,t){return this.check(ka(e,t))},unwrap(){return this.element}});function O(e,t){return Ha(pc,e,t)}var mc=_(`ZodObject`,(e,t)=>{As(),zr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),Xe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return P(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(oe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(oe(this._zod.def,{catchall:D()}))},loose(){return this.clone(oe(this._zod.def,{catchall:D()}))},strict(){return this.clone(oe(this._zod.def,{catchall:fc()}))},strip(){return this.clone(oe(this._zod.def,{catchall:void 0}))},extend(e){return we(this,e)},safeExtend(e){return Ee(this,e)},merge(e){return De(this,e)},pick(e){return xe(this,e)},omit(e){return Ce(this,e)},partial(...e){return Oe(Oc,this,e[0])},exactPartial(...e){return Oe(Ac,this,e[0],`exactPartial`)},required(...e){return ke(Rc,this,e[0])}});function k(e,t){return new mc({type:`object`,shape:e??{},...h(t)})}function hc(e,t){return new mc({type:`object`,shape:e,catchall:fc(),...h(t)})}function A(e,t){return new mc({type:`object`,shape:e,catchall:D(),...h(t)})}var gc=_(`ZodUnion`,(e,t)=>{Vr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.options=t.options});function j(e,t){return new gc({type:`union`,options:e,...h(t)})}var _c=_(`ZodDiscriminatedUnion`,(e,t)=>{gc.init(e,t),Ur.init(e,t)});function M(e,t,n){return new _c({type:`union`,options:t,discriminator:e,...h(n)})}var vc=_(`ZodIntersection`,(e,t)=>{Wr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r)});function yc(e,t){return new vc({type:`intersection`,left:e,right:t})}var bc=_(`ZodTuple`,(e,t)=>{As(),qr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Oc({type:`optional`,innerType:e}))})}});function xc(e,t,n){let r=t instanceof v;return new bc({type:`tuple`,items:e,rest:r?t:null,...h(r?n:t)})}var Sc=_(`ZodRecord`,(e,t)=>{As(),Zr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function N(e,t,n){return!t||!t._zod?new Sc({type:`record`,keyType:C(),valueType:e,...h(t)}):new Sc({type:`record`,keyType:e,valueType:t,...h(n)})}function Cc(e,t,n){return new Sc({type:`record`,keyType:e,valueType:t,...h(n),partial:!0})}var wc=_(`ZodEnum`,(e,t)=>{Qr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wc({...t,checks:[],...h(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wc({...t,checks:[],...h(r),entries:i})}});function P(e,t){return new wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...h(t)})}var Tc=_(`ZodLiteral`,(e,t)=>{$r.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function F(e,t){return new Tc({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}var Ec=_(`ZodTransform`,(e,t)=>{As(),ei.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new it(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Be(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Be(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dc(e){return new Ec({type:`transform`,transform:e})}var Oc=_(`ZodOptional`,(e,t)=>{ni.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`optional`,innerType:e})}var Ac=_(`ZodExactOptional`,(e,t)=>{ri.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e){return new Ac({type:`optional`,innerType:e})}var Mc=_(`ZodNullable`,(e,t)=>{ii.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Mc({type:`nullable`,innerType:e})}var Pc=_(`ZodDefault`,(e,t)=>{ai.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fc(e,t){return new Pc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Ic=_(`ZodPrefault`,(e,t)=>{si.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lc(e,t){return new Ic({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Rc=_(`ZodNonOptional`,(e,t)=>{ci.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zc(e,t){return new Rc({type:`nonoptional`,innerType:e,...h(t)})}var Bc=_(`ZodCatch`,(e,t)=>{di.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vc(e,t){return new Bc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qe(t)})}var Hc=_(`ZodPipe`,(e,t)=>{fi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.in=t.in,e.out=t.out});function Uc(e,t){return new Hc({type:`pipe`,in:e,out:t})}var Wc=_(`ZodReadonly`,(e,t)=>{mi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new Wc({type:`readonly`,innerType:e})}var Kc=_(`ZodCustom`,(e,t)=>{gi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r)});function qc(e,t={}){return Ua(Kc,e,t)}function Jc(e,t){return Wa(e,t)}function Yc(e){return da(Ns,e)}function Xc(e){return ga(ic,e)}var Zc=T().int().nonnegative();k({jsonrpc:F(`2.0`),id:Zc,method:C().min(1),params:N(C(),D()),trace_id:Bs().optional()});var Qc=k({jsonrpc:F(`2.0`),method:C().min(1),params:N(C(),D())}),$c=k({code:T().int(),message:C(),data:k({condition:C().optional()}).catchall(D()).optional()}),el=j([k({jsonrpc:F(`2.0`),id:Zc.nullable(),result:D()}),k({jsonrpc:F(`2.0`),id:Zc.nullable(),error:$c})]),tl=k({id:Zc,seq:T().int().positive(),event:C().min(1),data:D()});j([el,k({jsonrpc:F(`2.0`),method:F(`stream`),params:tl}),Qc]),P([`sidecar_unavailable`,`sidecar_rpc_version_mismatch`,`agent_runtime_stale`,`agent_incompatible`,`cancelled`]);var nl=k({rpc_version:T().int().positive()}),rl=k({rpc_version:T().int().positive(),python:C(),python_version:C(),agent_dir:C().nullable(),agent_revision:C().nullable(),agent_version:C().nullable(),pinned_revision:C().regex(/^[a-f0-9]{40}$/),pinned_version:C(),pinned_image:C(),compatible:E(),stale:E(),agent_source_changed:E().optional(),update_state:P([`absent`,`active`,`stale`,`unknown`,`incomplete`,`unverified`]),import_error:C().nullable()}),il=k({current:F(!0),agent_revision:C().nullable()}),al=k({exit_code:T().int().optional()}),ol=k({set:N(C(),C()).optional(),unset:O(C()).optional()}),sl=k({ok:F(!0)}),cl=k({id:T().int()}),ll=k({cancelled:E(),reason:C().optional()}),ul=k({methods:O(C())}),dl=k({agent_dir:C().min(1)}),fl=k({ok:E(),skipped:E(),detail:C()}),pl=P([`install`,`gateway_restart`,`agent_ready`]),ml=k({operation_id:Bs(),baseline_revision:C().regex(/^[a-f0-9]{40}$/),target_revision:C().regex(/^[a-f0-9]{40}$/),stage:pl,recovered_revision:C().regex(/^[a-f0-9]{40}$/).optional(),source_moved:E().optional(),attempt_error:C().max(2e3).optional(),failed_stage:pl.optional()}),hl=k({probe:E().optional(),complete_revision:C().regex(/^[a-f0-9]{40}$/).optional()}),gl=k({ok:E(),owed:E(),fingerprint:C(),detail:C(),local_restore:E().optional(),revision:C().regex(/^[a-f0-9]{40}$/).optional(),runtime_pending:E().optional(),operation:ml.optional(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional(),draining:E().optional()}),_l=k({token:C().regex(/^[a-f0-9]{32}$/),services:O(C().min(1)).min(1)}),vl=M(`action`,[k({action:F(`begin`),agent_dir:C().min(1),revision:C().regex(/^[a-f0-9]{40}$/),homes:O(C().min(1)).min(1),operation_id:Bs().optional(),baseline_revision:C().regex(/^[a-f0-9]{40}$/).optional(),intent:C().min(1).max(1024).optional(),refresh_token:C().regex(/^[a-f0-9]{32}$/).optional()}),k({action:F(`git`),agent_dir:C().min(1),token:C().regex(/^[a-f0-9]{32}$/),args:O(C().max(65536)).min(1).max(1e3),timeout_ms:T().int().min(100).max(3e5)}),k({action:P([`sync`,`finish`]),agent_dir:C().min(1),token:C().regex(/^[a-f0-9]{32}$/)})]),yl=fl.extend({recovery_required:E().optional(),token:C().regex(/^[a-f0-9]{32}$/).optional(),refresh_confirmation:_l.optional()}),bl=M(`event`,[k({event:F(`progress`),data:k({phase:F(`gateway_drain`),deadline_seconds:T().min(0),services:O(C())})})]),xl=k({name:C(),description:C().optional(),original_name:C().optional(),provider:C().optional(),model:C().optional(),base_url:C().optional(),api_mode:C().optional(),api_key_set:E().optional(),api_key:C().optional(),api_key_clear:E().optional(),reasoning_effort:C().optional(),service_tier:C().optional(),fallback_providers:O(D()).optional(),request_overrides:D().optional(),profile:C().optional(),label:C().optional()}),Sl=k({options:O(xl).optional(),profiles:O(xl).optional(),default:C().nullable()}),Cl=M(`action`,[k({action:F(`backend`),backend:C()}),k({action:F(`routes`),backend:P([`model_map`,`profile_routes`]),block:Sl})]),wl=k({supported:E(),configured:C(),effective:C().nullable(),available:E(),blocked_reason:C().nullable(),fixed_model_active:E(),backends:O(k({name:C(),label:C(),description:C(),available:E(),reason:C()})),profiles:O(C())}),Tl=xl.omit({api_key:!0,api_key_clear:!0,original_name:!0,request_overrides:!0}),El=Sl.extend({options:O(Tl).optional(),profiles:O(Tl).optional()}),Dl=wl.extend({can_edit:E().describe(`Only server owners may edit delegation modes and named routes.`),model_map:El,profile_routes:El}),Ol=15e6,kl=Math.ceil(Ol/3)*4,Al=C().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),I=Al,jl=k({attachment_id:I,kind:P([`image`,`pdf`,`file`]),name:C().min(1).max(255).regex(/^[^/\\\x00\r\n]+$/),mime:C().max(127).regex(/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/),size:T().int().positive().max(Ol)}),Ml=k({member_id:I,profile:C().min(1).max(128),handle:I,display_name:C().max(128).optional()}),Nl=Ml.extend({target:k({kind:P([`local`,`peer`]),profile:C()}).optional()}),Pl=k({room_id:I,name:C().max(200),members:O(Nl).max(6),authority_gateway_id:C(),authority_epoch:T().int(),revision:T().int(),latest_seq:T().int().optional(),disbanded_at:T().optional()}),Fl=k({kind:P([`retry`,`discard`,`approval`]),member_id:I,task_id:I,execution_generation:T().int().positive(),request_id:C().optional(),approval:k({command:C().optional(),description:C().optional(),choices:O(P([`once`,`deny`])).optional()}).optional()}),Il=k({running:E(),working:E(),blocked:E(),pending_actions:O(Fl),member_activity:O(k({member_id:I,status:P([`queued`,`running`,`stopping`,`indeterminate`,`deferred`])})).optional()});k({driver:E(),authority_gateway_id:C(),methods:O(C()),seatable_profiles:O(C()),max_log_limit:T().int().positive()}),k({room:Pl,driver_status:Il.optional()}),k({rooms:O(Pl),next_offset:T().int().nullable()}),k({events:O(k({room_id:I,seq:T().int().positive(),event_id:I,kind:C(),authority_epoch:T().int().nullable(),actor:k({kind:C(),id:C(),profile:C().optional()}),payload:k({text:C().optional(),member_id:I.optional(),discussion_event_id:I.optional(),task_id:I.optional(),turn_id:I.optional(),error:C().optional(),reason_code:C().optional(),attachments:O(jl).optional()}),created_at:T()})),cursor:T().int().nonnegative(),latest_seq:T().int().nonnegative(),has_more:E(),authority:k({gateway_id:C(),epoch:T().int()})});var Ll=k({member_id:I,task_id:I,execution_generation:T().int().positive()}),Rl=M(`action`,[k({action:F(`capabilities`)}),k({action:F(`list`),offset:T().int().nonnegative().optional(),limit:T().int().positive().max(100).optional()}),k({action:F(`create`),room_id:I,name:C().trim().min(1).max(200),members:O(Ml).min(2).max(6)}),k({action:F(`state`),room_id:I,include_disbanded:E().optional()}),k({action:F(`log`),room_id:I,since_seq:T().int().nonnegative(),limit:T().int().positive().max(100).optional()}),k({action:F(`rename`),room_id:I,event_id:I,name:C().trim().min(1).max(200)}),k({action:F(`disband`),room_id:I,cancel_id:I}),k({action:F(`send`),room_id:I,event_id:I,payload:k({text:C().max(65536),attachments:O(jl).max(8).optional()})}),k({action:F(`stop`),room_id:I,cancel_id:I}),Ll.extend({action:F(`retry`),room_id:I}),Ll.extend({action:F(`discard`),room_id:I}),Ll.extend({action:F(`approve`),room_id:I,request_id:I,choice:P([`once`,`deny`])}),k({action:F(`attachment.upload`),room_id:I,upload_id:I,kind:P([`image`,`pdf`,`file`]),name:C().min(1).max(255),mime:C().max(127),data_base64:C().max(kl)}),k({action:F(`attachment.download`),room_id:I,event_id:I,attachment_id:I})]),zl=k({room_id:I,gateway_id:C(),authority_epoch:T().int()}),Bl=k({profile_home:C().min(1),subject:C().min(1).max(128),operation:Rl,expected_room:zl.optional()}),Vl=k({state:P([`available`,`unavailable`,`refused`,`unknown`]),reason:C().nullable(),value:N(C(),D()).nullable()}),Hl=k({id:C().max(128),label:C().max(256),used_bp:T().int().min(0).max(1e4),resets_at_ms:T().int().nonnegative().nullable()}),Ul=k({kind:F(`usage_window`),plan:C().nullable(),gauges:O(k({label:C(),left_fraction:T().min(0).max(1),style:P([`green`,`yellow`,`red`]),resets_at_ms:T().int().nonnegative().max(864e13).nullable(),scope:C(),title:C()})),top_tier_model_ids:O(C()),featured_model_ids:O(C()),paused_reason:C().nullable(),credits_pay:E().nullable()}),Wl=k({state:P([`included`,`free`,`blocked`,`credits`,`unknown`]),usage_level:P([`free`,`low`,`medium`,`top_tier`]).nullable(),resets_at_ms:T().int().nonnegative().max(864e13).nullable()}),Gl=O(k({kind:P([`recommended`,`other`]),model_ids:O(C())})),Kl=k({metadata_status:P([`current`,`pending`,`stale`,`error`,`unsupported`]).optional(),plan_usage:Ul.nullable().optional(),usage_levels:N(C(),P([`free`,`low`,`medium`,`top_tier`])).optional(),unavailable_model_ids:O(C()).optional(),allowance_pending:E().optional(),free_tier:E().nullable().optional()}),ql=k({draft_id:C().regex(/^d_[0-9a-f]{8}$/),card:T().int().positive()}),Jl=k({from:C().max(320),to:O(C().max(320)).max(50),cc:O(C().max(320)).max(50),bcc:O(C().max(320)).max(50),subject:C().max(300),body:C().max(2e4)}),Yl=k({draft:ql.extend({producer:F(`draft-cards`),producer_revision:C(),kind:P([`email`,`message`]),platform:C(),version:T().int().positive(),revision:C(),fields:Jl,state:P([`draft`,`approved`,`sent`,`saved`,`failed`,`discarded`,`superseded`,`unavailable`]),can_edit:E(),can_approve:E(),masked:E()}).nullable()}),Xl=ql.extend({session_id:C().min(1),tool_call_id:C().min(1)}),Zl=Xl.extend({action:P([`edit`,`approve`]),version:T().int().positive(),revision:C().min(1),fields:Jl.optional()}),Ql=T().nonnegative(),$l=j([Ql,xc([Ql,Ql]).refine(([e,t])=>e<=t,`Minimum must not exceed maximum`)]),eu=j([$l,hc({credits:$l,note:C().optional()})]),tu=hc({tool_costs:N(C().min(1),eu).nullable().optional(),spend_limit:Ql.nullable().optional(),cost_unit:C().max(32).refine(e=>e.trim().length>0,`Unit must not be blank`).nullable().optional()}).refine(e=>Object.keys(e).length>0,`Choose a policy field to edit`),nu=P([`native`,`package`,`default`]),ru=k({name:C(),source:P([`native`,`package`,`native_override`]),valid:E(),can_edit:E(),error:C().nullable(),package_revision:C(),overrides:k({tool_costs:N(C(),eu).nullable(),spend_limit:Ql.nullable(),cost_unit:C().nullable()}),tool_costs:O(k({name:C(),low:Ql,high:Ql,note:C()})),spend_limit:Ql,cost_unit:C(),budget_enabled:E(),field_sources:k({tool_costs:nu,spend_limit:nu,cost_unit:nu})}),iu=ru.omit({package_revision:!0}).extend({revision:C(),provenance:F(`declared_estimate`),reload_required:F(!0),runtime_state:F(`unknown`)}),au=T().int().nonnegative().max(2**53-1).nullable(),ou=P([`system_prompt`,`tool_definitions`,`rules`,`skills`,`mcp`,`subagent_definitions`,`memory`,`conversation`]),su=k({available:E(),reason:P([`not_built`,`unsupported`,`changed`,`unavailable`]).nullable(),used_tokens:au,window_tokens:au,estimated_total:au,source:P([`local_estimate`,`provider_usage`,`provider_usage_plus_estimate`]).nullable(),estimated:E().nullable(),categories:O(k({id:ou,tokens:au.unwrap(),percent:T().min(0).max(100).nullable(),estimated:F(!0)})).max(8),files:O(k({label:P([`AGENTS.md`,`SOUL.md`,`.hermes.md`,`CLAUDE.md`,`GEMINI.md`,`CONTEXT.md`,`Context file`]),characters:au,tokens:au,status:P([`loaded`,`truncated`,`flagged`,`shadowed`,`blocked`,`empty`,`unreadable`,`suppressed`,`unknown`]),loaded:E().nullable()})).max(64),truncated:E(),current_turn_output_tokens:au,last_turn_output_tokens:au}),cu=P([`claude-code`,`codex`,`cursor`]),lu=k({status:P([`available`,`unavailable`,`preview`,`applied`,`partial`,`changed`,`unknown`]),sources:O(k({agent:cu,label:C().max(64)})).max(3),items:O(k({kind:C().max(64),status:P([`imported`,`skipped`,`conflict`,`error`]),label:C().max(256)})).max(2048),stripped_secrets:O(C().max(200)).max(2048),catalog_required:E().optional(),receipt:C().max(128).nullable(),can_apply:E(),message:C().max(512).nullable()}),uu=k({provider:C().nullable(),provider_label:C().nullable(),until:T(),until_kind:P([`reset`,`retry`])}),du=k({phase:F(`prompt_reading`),progress_percent:T().min(0).max(100).nullable()}),fu=M(`phase`,[k({phase:F(`compressing`)}),k({phase:F(`rate_limit_wait`),wait:uu}),du,k({phase:F(`working`)})]),pu=k({id:P([`standard`,`priority`,`ultrafast`,`fast`]),service_tier:P([`default`,`priority`,`ultrafast`]).describe(`Value to save; Anthropic Fast is persisted as priority and sent as speed: fast.`)}),mu=4194304,hu=k({provenance:P([`native_owner`,`direct_workspace`]),baseline:P([`earliest_retained_project_checkpoint`,`selected_checkpoint`]),available:E(),reason:P([`checkpoints_disabled`,`no_baseline`,`checkpoint_unavailable`,`payload_too_large`,`invalid_payload`,`owner_unavailable`]).nullable(),truncated:E()}),gu=k({diff:C().max(mu),stat:C().max(mu),comparison:hu}),_u=k({checkpoint:C(),workspace:C(),diff:C(),files_changed:O(k({file:C(),status:C()})),total_changes:T().int(),comparison:hu.optional()}),vu=N(C(),D()),yu=C().min(1).max(8192).regex(/\S/,`Command must not be blank`),bu=k({stdout:C().max(8e3),stderr:C().max(4e3),code:T().int()}),xu=4194304,Su=P([`json`,`markdown`,`html`]),Cu=k({format:Su,filename:C().min(1).max(255),content:C().max(xu)}),wu=P([`👍`,`👎`,`❤️`,`😂`,`😮`,`🎉`]),Tu=k({items:O(k({emoji:wu,count:T().int().positive(),mine:E()})),selected:wu.nullable()}),Eu=k({row_id:T().int().positive(),state:Tu,actions:O(k({emoji:wu.nullable(),result:Tu}))}),Du=k({admission_id:C(),sequence:T().int(),status:P([`queued`,`started`,`unknown`,`terminal`]),outcome:C().nullable(),authority_epoch:T().int(),execution_generation:T().int().nullable(),controls:O(C()).optional(),steering:E().optional(),text:C().optional(),input_id:C().optional()}),Ou=k({plan_gauge:Hl.nullable().optional(),session_id:C(),stored_session_id:C(),messages:O(vu),message_count:T().int(),running:E(),authority_epoch:T().int(),replay_epoch:C(),last_sequence:T().int(),subscription_id:C(),revision:T().int(),execution_generation:T().int(),reactions_supported:E().optional(),todo_state:k({todos:O(vu),revision:T().int().nonnegative().optional()}).nullable().optional().describe(`Canonical owner plan. Null clears it; omission retains transcript fallback for older owners.`),pending:O(Du),prompts:O(vu),info:vu}),ku=A({operation:C(),status:C().optional()}),Au=k({state:P([`applied`,`deferred`,`confirmation_required`,`refused`]),message:C().optional(),confirm:C().optional(),model:C().optional(),provider:C().nullable().optional()}),ju=k({state:P([`attached`,`stopped`,`unavailable`,`incompatible`,`refused`]),reason:C().nullable(),replay_gap:E().optional(),snapshot:Ou.nullable(),receipt:j([Du.extend({voice_stopped:fc().optional()}),ku.extend({voice_stopped:fc().optional()}),hc({voice_stopped:F(!0)})]).nullable(),model_change:Au.optional(),context_detail:su.optional(),export:Cu.optional(),checkpoint_diff:gu.optional(),shell:bu.optional(),restarting:E().optional().describe(`The owner is in a restart's after-turn wait: parked prompts stay answerable, new work is refused.`),lock:k({status:P([`ok`,`expired`]),remaining:O(C()).optional()}).optional().describe("`clarify_lock`: the batch question ids the owner still waits on; `expired` when the batch already ended.")}),Mu=k({request_id:C().min(1),questions:O(k({qid:C().min(1),question:C(),choices:O(C()).optional(),multi_select:E().optional()})).min(1)}),Nu=k({profile_home:C().min(1),session_id:C().min(1),action:P([`snapshot`,`watch`,`context_detail`,`submit`,`receipt`,`cancel`,`steer_queued`,`replace_queued`,`interrupt`,`approval`,`clarify`,`clarify_lock`,`discard`,`mutate`,`export`,`checkpoint_diff`,`terminal_info`,`shell_exec`,`react`]),row_id:T().int().positive().optional(),emoji:wu.nullable().optional(),format:Su.optional(),redact:E().optional(),command:yu.optional(),authority_epoch:T().int().nonnegative().optional(),replay_epoch:C().min(1).optional(),request_id:C().min(1).max(128).optional(),text:C().optional(),submission_id:C().min(1).max(128).optional(),show_reasoning:E().optional().describe(`Whether the owner sends reasoning to the server observer; client visibility uses the current profile preference.`),admission_id:C().optional(),execution_generation:T().int().nonnegative().optional(),prompt_id:C().optional(),choice:P([`once`,`session`,`always`,`deny`]).optional(),question_id:C().min(1).optional(),answer:C().optional(),expected_revision:T().int().nonnegative().optional(),operation:P([`rename`,`archive`,`sidebar`,`branch`,`delete`,`rewind`,`reset`,`model`,`workspace`,`compress`]).optional(),payload:vu.optional()}),Pu=P([`normal`,`ignore_config`,`safe`]),Fu=k({profile_home:C().min(1),probe:E().optional(),request_id:C().min(1).max(128).optional(),execution_mode:Pu.exclude([`normal`]).optional(),cwd:C().min(1).optional(),model:C().min(1).optional(),provider:C().min(1).optional(),base_url:C().min(1).optional(),toolsets:O(C().min(1)).optional()}),Iu=P([`agent_unsupported`,`served_profile`,`gateway_stopped`,`gateway_unavailable`]),Lu=k({modes:O(k({mode:Pu,available:E(),reason:Iu.nullable(),can_reference:E().optional().describe(`A fresh chat in this mode accepts earlier-conversation references. Absent means unavailable.`),can_attach:E().describe(`A fresh chat in this mode accepts file attachments.`)}))}),Ru=k({session_id:C().min(1)}),zu=Ru.extend({admission_id:C().min(1),execution_generation:T().int().positive()}),Bu=M(`action`,[hc({session_id:C().min(1),action:F(`react`),row_id:T().int().positive(),emoji:wu.nullable()}),Ru.extend({action:F(`cancel`),admission_id:C().min(1)}),Ru.extend({action:F(`steer_queued`),admission_id:C().min(1)}),Ru.extend({action:F(`replace_queued`),admission_id:C().min(1),submission_id:C().min(1).max(128),text:C().trim().min(1)}),zu.extend({action:F(`discard`)}),zu.extend({action:F(`retry`)}),Ru.extend({action:F(`mutate`),request_id:Nu.shape.request_id.unwrap(),expected_revision:T().int().nonnegative(),execution_generation:T().int().nonnegative(),operation:P([`rename`,`rewind`,`reset`,`model`,`workspace`,`compress`]),payload:vu})]),Vu=k({state:ju.shape.state,reason:C().nullable(),can_submit:E(),can_interrupt:E(),can_attach:E(),restarting:E().describe(`The owning gateway is restarting once this turn ends; sending waits until it is back.`),revision:T().int().nullable(),execution_generation:T().int().nullable(),model_change:Au.optional(),active_admission:Du.nullable().optional(),admissions:O(Du.extend({actions:O(P([`cancel`,`steer`,`edit`,`retry`,`discard`]))}))}),Hu=k({kind:C(),title:C(),model:C(),provider:C(),message:C()}),L=k({profile_home:C().min(1)}),Uu=k({base_home:C().min(1)}),Wu=k({ok:E()}),R=D(),z=N(C(),D()),Gu=k({toolsets:O(k({name:C(),description:C(),available:E(),selected:E(),unavailable_reason:P([`disabled`,`unavailable`]).nullable()})),selected_toolsets:O(C()),using_defaults:E()}),Ku={"toolsets.catalog":{params:L.extend({enabled_toolsets:O(C()).nullable()}),result:Gu}},qu=k({goal:C(),status:C(),turns_used:T().int(),max_turns:T().int(),last_verdict:C().nullable(),last_reason:C().nullable(),paused_reason:C().nullable()}),Ju=L.extend({session_id:C().min(1),default_max_turns:T().int().positive().optional()}),Yu=k({reason:C().nullable(),until:T().nullable()}),Xu=k({goal:qu.nullable(),active:E(),parked:Yu.nullable(),message:C(),message_key:C().optional(),message_args:O(R).optional()}),Zu=k({ok:E(),action:C(),message:C(),goal:qu.nullable(),error:C().optional(),kickoff_prompt:C().optional(),message_key:C().optional(),message_args:O(R).optional()}),Qu=k({status:C().nullable(),should_continue:E(),continuation_prompt:C().nullable(),verdict:C(),reason:C(),message:C(),message_key:C().optional(),message_args:O(R).optional()}),$u={"goals.get":{params:Ju,result:Xu},"goals.command":{params:Ju.extend({args:C(),stream_running:E().optional(),workspace:C().optional()}),result:Zu},"goals.snapshot":{params:Ju,result:k({goal:qu.nullable(),snapshot:C().nullable()})},"goals.restore":{params:Ju.extend({snapshot:C().nullable()}),result:k({goal:qu.nullable()})},"goals.evaluate":{params:Ju.extend({last_response:C(),user_initiated:E().optional(),workspace:C().optional()}),result:Qu}},ed=k({name:C(),description:C(),category:C(),aliases:O(C()),args_hint:C(),subcommands:O(C()),cli_only:E(),gateway_only:E(),exec:E(),prompt:P([`expand`,`unsupported`]).nullable()}),td=k({key:C(),type:P([`string`,`number`,`boolean`,`enum`,`json`,`secret`]),label:C(),description:C(),required:E(),choices:O(C()).optional(),default:R.optional(),value:R.optional(),env:C().optional(),has_value:E().optional()}),nd=P([`applied`,`restart_required`,`unknown`]),rd=P([`signed_in`,`sign_in_needed`,`revoked`,`logged_out`]),id=k({id:C(),state:rd,authorize_host:C(),token_host:C()}),ad=M(`status`,[k({key:C(),status:F(`updated`)}),k({key:C(),status:F(`needs_consent`),verdict:F(`caution`),findings:C(),consent_token:C().min(1)}),k({key:C(),status:F(`blocked`),verdict:C(),findings:C()})]),od=k({query:C().trim().max(200).default(``),offset:Xc().int().min(0).max(1e4).default(0),limit:Xc().int().min(1).max(50).default(20)}),sd=k({name:C().regex(/^[a-z0-9_-]{1,64}$/),consent_token:C().min(1).max(128).optional()}),cd=k({supported:E(),read_only:E().optional(),entries:O(k({name:C(),title:C(),description:C(),repo:C(),sha:C(),tier:C(),category:C(),requirements:O(C()),installed_key:C().nullable(),installed_sha:C().nullable(),can_install:E(),refusal:C().nullable()})),total:T().int().nonnegative(),next_offset:T().int().nullable()}),ld=M(`status`,[k({name:C(),key:C(),status:F(`installed`),enabled:F(!1)}),k({name:C(),status:F(`needs_consent`),findings:C(),consent_token:C()}),k({name:C(),status:F(`blocked`),findings:C()})]),ud=k({name:C(),display_name:C(),auth_type:C(),setup:P([`ready`,`missing_cli`,`needs_setup`,`not_loaded`,`unavailable`])}),dd=k({name:C().regex(/^[a-z][a-z0-9_-]{0,63}$/),label:C().max(80),version:C().max(40),description:C().max(300),enabled:E(),panel:C().nullable(),has_api:E()}),fd=k({status:T().int().min(200).max(599),body:C(),content_type:C()}),pd=L.extend({name:C()}),md=k({name:C(),description:C(),skill_count:T().int(),source:F(`bundle`)}),hd=k({name:C(),source:F(`bundle`),message:C(),loaded_skills:O(C()),missing_skills:O(C())}),gd=262144,_d=C().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/),vd=T().int().min(0).max(gd),yd={"drafts.review":{params:ql.extend({profile_home:C().min(1),session_id:C().min(1),action:P([`read`,`edit`,`approve`]),version:T().int().positive().optional(),revision:C().optional(),fields:Jl.optional()}),result:Yl},"commands.registry":{params:L,result:k({commands:O(ed)})},"commands.exec":{params:L.extend({command:C().min(1),session_id:C().min(1).optional(),workspace:C().optional()}),result:k({output:C(),source:P([`agent`,`plugin`])})},"commands.expand_prompt":{params:L.extend({command:C().min(1),session_id:C().min(1).optional(),workspace:C(),enabled_toolsets:O(C()).nullable()}),result:k({name:C().nullable(),message:C().nullable()})},"commands.bundles":{params:L,result:k({bundles:O(md)})},"commands.bundle_resolve":{params:L.extend({command:C().min(1)}),result:hd},"commands.moa_preset":{params:L.extend({preset:C().nullable().optional()}),result:k({moa:z})},"plugins.buffers":{params:L.extend({action:P([`list`,`read`,`save`]),session_id:C().min(1).max(200),name:_d.optional(),content:C().max(gd).optional()}),result:k({supported:E(),buffers:O(k({name:_d,size:vd,read_only:E()})).max(200),content:C().max(gd).optional(),size:vd.optional(),read_only:E().optional(),write_semantics:F(`unconditional`)})},"plugins.dashboard_list":{params:L,result:k({supported:E(),plugins:O(dd)})},"plugins.dashboard_toggle":{params:pd.extend({enabled:E()}),result:k({ok:F(!0)})},"plugins.dashboard_asset":{params:pd.extend({path:C()}),result:fd},"plugins.dashboard_request":{params:pd.extend({path:C(),method:C(),query:C(),headers:N(C(),C()),body:C(),authenticated:E(),websocket:E()}),result:fd},"plugins.providers":{params:L,result:k({providers:O(ud)})},"plugins.list":{params:L.extend({selected_providers:N(C(),C()).optional()}),result:k({plugins:O(k({name:C(),key:C(),version:C(),description:C(),enabled:E(),kind:C(),activation:C(),hooks:O(C()),is_active_provider:E().optional(),update_available:E().optional(),latest_revision:C().optional()})),supported_hooks:O(C())})},"plugins.catalog":{params:L.extend(od.shape),result:cd},"plugins.install":{params:L.extend(sd.shape),result:ld},"plugins.update":{params:L.extend({key:C().min(1),accept_caution:E().optional(),consent_token:C().min(1).max(128).optional()}),result:ad},"plugins.isolation":{params:Uu,result:k({profiles:O(k({name:C(),isolation:P([`in_process`,`host`]),third_party_plugins:T().int()}))})},"plugins.settings":{params:L,result:k({supported:E(),plugins:O(k({key:C(),fields:O(td)}))})},"plugins.oauth_status":{params:L,result:k({supported:E(),plugins:O(k({key:C(),clients:O(id)}))})},"plugins.oauth_logout":{params:L.extend({key:C().min(1),id:C().min(1)}),result:k({key:C(),id:C(),removed:E()})},"plugins.settings_save":{params:L.extend({key:C().min(1),values:N(C(),R),secret_envs:N(C(),C()).optional()}),result:k({key:C(),written:O(C()),fields:O(td),runtime_application:nd.optional()})}},B=L.extend({board:C().nullable().optional()}),bd=k({id:C(),title:C(),status:C(),priority:T().int(),claim_live:E(),has_completion_evidence:E(),agent_move_targets:O(C()).nullable()}).catchall(R),xd=k({task:bd,read_only:E()}),Sd={links:k({parents:O(C()),children:O(C())}),link_tasks:O(k({id:C(),title:C(),status:C()}))},Cd={current_run_started_at:T().nullable()},wd=j([k({changed:F(!1),latest_event_id:T().int(),read_only:E()}),k({changed:F(!0),columns:O(k({name:C(),label:C(),tasks:O(bd)})),tenants:O(C()),assignees:O(C()),latest_event_id:T().int(),read_only:E(),filters:k({tenant:C().nullable(),assignee:C().nullable(),include_archived:E(),only_mine:E(),profile:C().nullable()})})]),Td=j([C(),k({name:C(),on_disk:E().optional(),counts:N(C(),T().int()).optional()}).catchall(R)]),Ed=k({id:T().int(),task_id:C().nullable(),run_id:j([T().int(),C()]).nullable(),kind:C(),payload:R,created_at:T().nullable()}),Dd=k({slug:C(),name:C().nullable().optional(),archived:E().optional()}).catchall(R),Od=k({source:C(),target:C()}),kd=k({key:C(),board:C(),board_name:C(),task:bd.extend(Cd)}),Ad=k({nodes:O(kd).max(500),edges:O(Od).max(2e3),generated_at:T(),truncated:E(),read_only:E()}),jd={"kanban.inspection":{params:B.extend({include_archived:E().optional()}),result:Ad},"kanban.board":{params:B.extend({tenant:C().nullable().optional(),assignee:C().nullable().optional(),include_archived:E().optional(),only_mine:E().optional(),since:T().int().nullable().optional(),profile:C().nullable().optional()}),result:wd},"kanban.boards":{params:L.extend({include_archived:E().optional()}),result:k({boards:O(Dd.extend({is_current:E(),counts:N(C(),T().int()),total:T().int()})),current:C(),read_only:E()})},"kanban.create_board":{params:L.extend({board_spec:z}),result:k({board:Dd,current:C(),read_only:E()})},"kanban.update_board":{params:L.extend({slug:C(),board_spec:z}),result:k({board:Dd,read_only:E()})},"kanban.delete_board":{params:L.extend({slug:C(),delete:E().optional()}),result:k({result:R,current:C(),read_only:E()})},"kanban.switch_board":{params:L.extend({slug:C()}),result:k({current:C(),read_only:E()})},"kanban.task":{params:B.extend({task_id:C()}),result:k({task:bd.extend(Cd),comments:O(z),events:O(z),...Sd,runs:O(z),read_only:E()})},"kanban.create_task":{params:B.extend({task:z}),result:xd},"kanban.patch_task":{params:B.extend({task_id:C(),patch:z}),result:xd},"kanban.task_action":{params:B.extend({task_id:C(),action:P([`block`,`unblock`]),reason:C().nullable().optional(),confirm_running_exit:E().optional()}),result:xd},"kanban.comment":{params:B.extend({task_id:C(),body:C(),author:C().optional()}),result:k({ok:F(!0),comment_id:j([T().int(),C()]),read_only:E()})},"kanban.link":{params:B.extend({parent_id:C(),child_id:C()}),result:k({ok:F(!0),parent_id:C(),child_id:C(),read_only:E()})},"kanban.unlink":{params:B.extend({parent_id:C(),child_id:C()}),result:k({ok:F(!0),changed:E(),parent_id:C(),child_id:C(),read_only:E()})},"kanban.normalize_board":{params:B,result:k({board:C()})},"kanban.events":{params:B.extend({since:T().int().optional(),limit:T().int().optional()}),result:k({events:O(Ed),cursor:T().int(),latest_event_id:T().int(),read_only:E()})},"kanban.config":{params:B,result:k({columns:O(C()),assignees:O(Td),default_tenant:C(),lane_by_profile:E(),include_archived_by_default:E(),render_markdown:E(),read_only:E()})},"kanban.stats":{params:B,result:k({column_order:O(C())}).catchall(R)},"kanban.assignees":{params:B,result:k({assignees:O(Td)})},"kanban.task_log":{params:B.extend({task_id:C(),tail:T().int().optional()}),result:k({task_id:C(),path:C(),exists:E(),size_bytes:T().int(),content:C(),truncated:E()})},"kanban.bulk":{params:B.extend({bulk:z}),result:k({results:O(k({id:C(),ok:E(),error:C().optional()})),read_only:E()})},"kanban.dispatch":{params:B.extend({dry_run:E().optional(),max:T().int().optional()}),result:z}},Md=P([`active_turn`,`runtime_history_unsupported`]),Nd=L.extend({session_id:C().min(1)}),Pd={"state_db.sync_start":{params:Nd.extend({model:C().nullable().optional()}),result:Wu},"state_db.sync_usage":{params:Nd.extend({input_tokens:T().int().optional(),output_tokens:T().int().optional(),estimated_cost:T().nullable().optional(),model:C().nullable().optional(),title:C().nullable().optional(),message_count:T().int().nullable().optional(),cache_read_tokens:T().int().optional(),cache_write_tokens:T().int().optional(),api_call_count:T().int().nullable().optional()}),result:Wu},"state_db.sync_title":{params:Nd.extend({title:C(),manual:E().optional()}),result:Wu},"state_db.delete_cli_session":{params:Nd.extend({include_compression_lineage:E().optional()}),result:Wu.extend({refused:Md.optional(),deleted_ids:O(C().min(1)).optional()})},"state_db.append_message":{params:Nd.extend({role:C().min(1),content:C(),tool_name:C().nullable().optional(),timestamp:T().nullable().optional()}),result:Wu},"state_db.prune_advice":{params:L,result:k({advice:k({lines:O(C()).min(1)}).nullable()})}},Fd=k({session_id:C(),tip_session_id:C()}),Id=P([`own`,`served`,`parked`,`standalone`,`stopped`]),Ld=k({name:C(),path:C(),is_default:E(),gateway_running:E(),model:C().nullable(),provider:C().nullable(),has_env:E(),visible:E(),skill_count:T().int(),enabled_skills:T().int(),total_skills:T().int(),gateway_mode:Id.default(`stopped`),display_name:C().default(``),description:C().default(``),has_avatar:E().default(!1),canonical_session:Fd.nullable().default(null)}),Rd={"profiles.import":{params:L.extend({action:P([`discover`,`preview`,`apply`,`result`]),agent:cu.optional(),receipt:C().min(1).max(128).optional()}),result:lu},"profiles.list":{params:Uu,result:k({profiles:O(Ld)})},"profiles.create":{params:Uu.extend({name:C().min(1),clone_from:C().nullable().optional(),clone_config:E().optional()}),result:k({profile:Ld})},"profiles.delete":{params:Uu.extend({name:C().min(1)}),result:k({ok:F(!0)})},"profiles.runtime_env":{params:L.extend({protected_keys:O(C()).optional()}),result:k({env:N(C(),C())})},"profiles.skills_stats":{params:L,result:k({enabled:T().int(),total:T().int()})}},zd=k({load_name:C().optional(),declared_name:C().optional(),status:P([`unique`,`ambiguous`,`shadowed`]).optional(),tier:T().int().optional()}),Bd=zd.extend({name:C(),description:C(),category:C().nullable(),disabled:E()}),Vd=C().regex(/^[a-f0-9]{64}$/),Hd=k({name:C().min(1).max(256),revision:Vd.optional(),compare_to:Vd.optional()}),Ud=k({state:P([`available`,`missing`,`unavailable`]),reason:P([`backend_unavailable`,`identity_unavailable`,`history_unavailable`,`invalid_history`]).nullable(),backend_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),revisions:O(k({id:Vd,sha256:Vd,label:C().max(12),saved_at:C().nullable(),actor:C().max(80).nullable(),current:E()})).max(64),selected:k({revision:Vd,content:C().max(32768)}).nullable(),comparison:k({from_revision:Vd,to_revision:Vd,diff:C().max(131072)}).nullable(),replay_available:F(!1)}),Wd=j([k({success:F(!0),name:C(),description:C(),tags:O(C()),related_skills:O(C()),content:C(),path:C(),skill_dir:C().nullable(),linked_files:N(C(),O(C())),editable:E().optional()}),k({success:F(!1),error:C(),available_skills:O(C()).optional(),available_skills_truncated:E().optional(),total_skills:T().int().optional(),hint:C().optional()})]),Gd={"skills.revisions":{params:Hd.extend({profile_home:C().min(1)}),result:Ud},"skills.list":{params:L.extend({category:C().nullable().optional()}),result:k({success:E().optional(),skills:O(Bd),categories:O(C()),count:T().int(),message:C().optional()})},"skills.view":{params:L.extend({name:C().min(1)}),result:Wd},"skills.find":{params:L.extend({name:C().min(1)}),result:k({found:E(),skill_dir:C().nullable(),skill_md:C().nullable(),load_name:C().optional(),declared_name:C().optional(),sibling_load_names:O(C()).optional()})}},Kd={"mcp.cost_policies":{params:L.extend({servers:z}),result:k({supported:E(),policies:O(ru)})},"mcp.status":{params:L,result:k({servers:O(k({name:C()}).catchall(R))})},"mcp.registry_tools":{params:L,result:k({tools:O(k({name:C(),server:C(),schema:z}))})},"mcp.reload":{params:L,result:k({output:C()})}},qd=k({account_id:C().min(1),email:C().nullable(),state:P([`idle`,`pending`,`retrying`,`claimed`,`gone`,`failed`,`paused`,`unknown`,`unavailable`]),lines:O(C()),moved:O(C()),dropped:O(C()),reconnect:O(C()),poll_after:T().int().min(1).nullable()}),Jd=C().regex(/^[a-z0-9][a-z0-9_-]*$/),Yd=k({mode:P([`unrestricted`,`deny-all`,`allow`,`deny`]),connectors:O(C()).optional(),disabled_connectors:O(C()).optional(),tools:N(C(),k({disable:O(C())})).optional(),tags:k({enable:O(C()).optional(),disable:O(C()).optional()}).optional()}),Xd=k({name:C(),kind:C(),state:P([`pending`,`initiated`,`connected`,`skipped`,`failed`,`expired`,`not_connected`]),detail:C(),connect_url:C().nullable().optional(),required_env:O(k({name:C(),prompt:C(),required:E(),secret:E()}))}),Zd=k({op_id:C(),settled:E(),owner:P([`account`,`session`]),tool_call_id:C().nullable(),targets:O(Xd)}),Qd=L.extend({op_id:C().min(1)}),$d=k({available:E(),guest_id:C().nullable(),eligible:E(),due_in:T().int().nonnegative().nullable(),claimed:E()}),ef={"connectors.offer.status":{params:L,result:$d},"connectors.offer.claim":{params:L.extend({guest_id:C().min(1)}),result:$d},"connectors.available":{params:L,result:k({available:E()})},"connectors.catalog":{params:L,result:k({connectors:O(k({slug:C(),name:C(),description:C(),category:C(),logo_url:C().nullable()}))})},"connectors.accounts":{params:L,result:k({accounts:O(k({connection_id:C(),connector:C(),status:C(),status_reason:C().nullable(),label:C(),alias:C().nullable(),active:E(),disabled:E(),created_at:C()}))})},"connectors.remove":{params:L.extend({connection_id:C().min(1)}),result:k({connection_id:C(),connector:C(),status:F(`removed`)})},"connectors.tools":{params:L.extend({connector:Jd,refresh:E().optional()}),result:k({connector:C(),tools:O(k({slug:C(),name:C(),description:C(),facet:C(),hints:O(C()),categories:O(C()),deprecated:E()}))})},"connectors.policy.get":{params:L,result:k({layers:O(k({kind:P([`org`,`role`,`member`]),revision:C(),body:Yd})),effective:Yd.extend({revision:C()})})},"connectors.policy.set":{params:L.extend({connector:Jd,expected_revision:C().min(1),enabled:E().optional(),tool:C().min(1).optional(),tool_enabled:E().optional()}),result:k({revision:C()})},"connectors.connect":{params:L.extend({connector:Jd,nous_account_id:C().min(1).optional()}),result:Zd},"connectors.operation":{params:Qd,result:Zd},"connectors.respond":{params:Qd.extend({action:P([`skip`,`retry`,`approve`,`continue`]),target:C().optional(),env:N(C(),C()).optional()}),result:Zd}},tf={"tts.synthesize":{params:L.extend({text:C().min(1).max(5e3),provider:C().min(1),speed:T().min(.5).max(2).optional()}),result:k({provider:C(),format:C(),audio_b64:C()})}},nf={"stt.capability":{params:L,result:k({available:E(),provider:C(),streaming:E(),warm_supported:E()})},"stt.warm":{params:L,result:k({provider:C(),warmed:E(),action:C(),error:C().optional()})},"stt.transcribe":{params:L.extend({audio_b64:C().min(1),suffix:C().optional()}),result:k({transcript:C(),filtered:E()})},"stt.stream":{params:L.extend({sample_rate:T().int().min(8e3).max(48e3)}),result:k({transcript:C(),filtered:E(),provider:C()}),stream:M(`event`,[k({event:F(`ready`),data:k({stream_id:C()})}),k({event:F(`partial`),data:k({text:C()})})])},"stt.stream_audio":{params:k({stream_id:C().min(1),audio_b64:C().optional(),end:E().optional()}),result:k({ok:F(!0)})}},rf=k({id:C(),name:C().nullable().optional(),profile:C().nullable(),toast_notifications:E(),monitor:C(),continuity:E(),running_elsewhere:E().optional(),recovery_only:E().optional()}).catchall(R),af=L.extend({job_id:C().min(1)}),of=k({job:rf}),sf=k({model:C().optional(),provider:C().optional(),estimated_cost_usd:T().optional(),duration_seconds:T().optional(),input_tokens:T().int().nullable().optional(),output_tokens:T().int().nullable().optional(),total_tokens:T().int().nullable().optional()}),cf=k({name:C(),type:C(),label:C(),default:C().nullable(),options:O(C()),optional:E(),strict:E(),help:C()}),lf=k({blueprints:O(k({key:C(),title:C(),description:C(),category:C(),source:P([`builtin`,`plugin`]),plugin:C().nullable(),schedule_label:C(),slots:O(cf)}))}),uf=k({key:C().min(1),values:N(C(),C())}),df=k({draft:k({name:C(),prompt:C(),schedule:C(),deliver:C(),skills:O(C())})}),ff={"cron.blueprints":{params:L,result:lf},"cron.blueprint_fill":{params:uf.extend({profile_home:C().optional()}),result:df},"cron.list":{params:L.extend({probe_store:E().optional()}),result:k({jobs:O(rf),store_health:k({store:C(),error:C(),since:C(),fix:C()}).nullable().optional()})},"cron.get":{params:af,result:k({job:rf.nullable()})},"cron.create":{params:L.extend({job:z,execution_home:C().nullable().optional()}),result:of},"cron.update":{params:af.extend({updates:z}),result:of},"cron.delete":{params:af,result:k({ok:F(!0),job_id:C()})},"cron.pause":{params:af.extend({reason:C().nullable().optional()}),result:k({job:k({id:C()}).catchall(R)})},"cron.resume":{params:af,result:k({job:k({id:C()}).catchall(R)})},"cron.run":{params:af.extend({execution_home:C().nullable().optional()}),result:j([k({job_id:C(),status:F(`already_running`),elapsed:T()}),k({job_id:C(),status:P([`completed`,`failed`]),success:E(),error:C().nullable().optional(),delivery_error:C().nullable().optional()})]),stream:M(`event`,[k({event:F(`started`),data:k({job_id:C()})})])},"cron.status":{params:k({job_id:C().optional()}),result:j([k({job_id:C(),running:E(),elapsed:T()}),k({running:N(C(),T())})])},"cron.history":{params:af.extend({offset:T().int().optional(),limit:T().int().optional()}),result:k({job_id:C(),runs:O(k({filename:C(),size:T().int(),modified:T(),usage:sf})),total:T().int(),offset:T().int()})},"cron.run_detail":{params:af.extend({filename:C().min(1)}),result:k({job_id:C(),filename:C(),content:C(),snippet:C(),usage:sf})},"cron.output":{params:af.extend({limit:T().int().optional()}),result:k({job_id:C(),outputs:O(k({filename:C(),content:C()}))})},"cron.delivery_options":{params:L,result:k({platforms:O(k({value:C(),label:C()}))})}},pf={"providers.registry":{params:L,result:k({providers:N(C(),k({id:C(),name:C(),auth_type:C()}).catchall(R))})},"providers.nous_account":{params:L,result:k({nous_account:qd.nullable()})},"providers.auth_status":{params:L.extend({provider:C().nullable().optional()}),result:k({status:k({logged_in:E()}).catchall(R)})},"providers.model_ids":{params:L.extend({provider:C().min(1),force_refresh:E().optional()}),result:Kl.extend({provider:C(),model_ids:O(C()),fallback:E().default(!1)})},"providers.local_models":{params:L,result:k({provider_id:C(),models:O(C()),current_endpoint:C().nullable()})},"providers.resolve_runtime":{params:L.extend({requested:C().nullable().optional(),api_key:C().nullable().optional(),base_url:C().nullable().optional(),target_model:C().nullable().optional()}),result:k({runtime:z})},"providers.credential_pool":{params:L.extend({provider:C().min(1)}),result:k({available:E(),strategy:C(),entries:O(z)})},"models.selection_warnings":{params:L.extend({session_id:C().min(1),model:C().min(1),provider:C().nullable(),current_model:C().nullable(),current_provider:C().nullable(),context_tokens:T().int().positive().nullable(),messages:O(z)}),result:k({warnings:O(Hu),context_tokens:T().int().positive().nullable(),provider:C(),base_url:C()})},"models.speed_tiers":{params:L.extend({routes:O(k({model:C().min(1),provider:C(),base_url:C().optional()}))}),result:k({tiers:O(O(pu))})},"models.context_length":{params:L.extend({model:C().min(1),base_url:C().optional(),api_key:C().optional(),provider:C().optional(),config_context_length:T().int().nullable().optional()}),result:k({model:C(),context_length:T().int().nullable()})},"models.estimate_tokens":{params:k({messages:O(z)}),result:k({tokens:T().int()})},"models.capabilities":{params:L.extend({provider:C(),model:C()}),result:k({capabilities:z.nullable()})}},mf=P([`pending`,`approved`,`denied`,`expired`,`cancelled`,`error`]),hf=k({flow_id:C(),provider:C(),status:mf,error:C().nullable(),nous_account:qd.nullable().optional()}),gf=L.extend({flow_id:C().min(1)}),_f={"oauth.start":{params:L.extend({provider:C().min(1)}),result:k({flow_id:C(),provider:C(),status:F(`pending`),user_code:C().optional(),verification_url:C(),expires_in:T().int(),interval:T().int(),redirect_uri:C().optional(),authorize_host:C().optional(),token_host:C().optional()})},"oauth.poll":{params:gf,result:hf},"oauth.cancel":{params:gf,result:hf},"oauth.submit_redirect":{params:gf.extend({url:C().min(1)}),result:hf}},vf=k({prompt_tokens:T().int().optional(),completion_tokens:T().int().optional(),total_tokens:T().int().optional()}),yf={"aux.complete":{params:L.extend({task:C().min(1),messages:O(z).min(1),main_runtime:z.nullable().optional(),main_fallback:E().optional(),max_tokens:T().int().nullable().optional(),temperature:T().nullable().optional(),model:C().nullable().optional(),provider:C().nullable().optional()}),result:k({model:C(),text:C(),usage:vf.nullable(),finish_reason:C().nullable().default(null)}),stream:M(`event`,[k({event:F(`token`),data:k({text:C()})})])},"aux.delegation":{params:L.extend({config:z}),result:wl},"aux.delegation_backend":{params:L.extend({backend:C(),config_path:C()}),result:Wu},"aux.delegation_routes":{params:L.extend({backend:P([`model_map`,`profile_routes`]),block:Sl,current:z}),result:k({block:z})},"aux.tasks":{params:L,result:k({tasks:O(k({key:C().min(1),label:C(),description:C(),inherit_from:C().nullable(),reasoning_effort:C(),effective:k({provider:C(),model:C(),base_url:C()}).nullable()})),reserved:O(C())})},"aux.resolve":{params:L.extend({task:C().min(1),main_runtime:z.nullable().optional()}),result:k({configured:E(),model:C().nullable(),error:C().optional()})}},bf={"text.image_mode":{params:L.extend({provider:C(),model:C(),cfg:z.nullable().optional(),requested_provider:C().optional()}),result:k({mode:P([`native`,`text`]),reason:C(),supports_vision:E().nullable()})},"text.portal_tags":{params:L,result:k({client_tag:C().nullable(),conversation_tag:C().nullable(),tags:j([O(C()),z])})},"text.spoken":{params:k({text:C()}),result:k({spoken_text:C()})}},xf={"memory.check":{params:L.extend({target:P([`memory`,`user`]),content:C()}),result:k({count:T().int(),limit:T().int()})},"memory.write":{params:L.extend({section:P([`memory`,`user`,`soul`]),base:C(),content:C()}),result:k({written:E()})}},Sf=k({id:C().regex(/^[A-Za-z0-9_-]{1,64}$/),kind:P([`skills`,`memory`]),target:C(),op:C(),summary:C(),origin:C(),created_at:T(),diff:C(),approvable:E(),revision:C()}),Cf=k({id:Sf.shape.id,revision:C()}),wf=L.extend({kind:P([`skills`,`memory`]),writes:O(Cf).min(1)}),Tf=k({results:O(k({id:C(),done:E(),message:C()}))}),Ef={"write_approval.pending":{params:L.extend({kind:P([`skills`,`memory`])}),result:k({supported:E(),enabled:E(),items:O(Sf)})},"write_approval.approve":{params:wf,result:Tf},"write_approval.reject":{params:wf,result:Tf}},Df=k({process_id:C(),consumed:E(),type:C().optional(),session_key:C().optional(),origin_ui_session_id:C().optional(),child_process:E().optional(),reconciliation_profile_home:C().optional()}).catchall(R),Of={"process.drain":{params:L.extend({max_events:T().int().positive().optional()}),result:k({events:O(Df)})},"process.recover":{params:Uu,result:k({homes:T().int()})},"process.requeue":{params:k({events:O(z)}),result:k({requeued:T().int()})},"process.mark_consumed":{params:k({process_id:C().min(1)}),result:Wu},"process.consumed":{params:k({process_ids:O(C().min(1))}),result:k({consumed:O(C())})},"process.claim_delivery":{params:L.extend({event:z,consumer:C().min(1)}),result:k({claim_id:C().nullable(),retryable:E().optional()})},"process.complete_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.release_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.defer_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.format_notification":{params:k({event:z}),result:k({text:C()})},"process.stop":{params:L.extend({session_id:C().min(1),process_id:C().min(1)}),result:k({outcome:P([`stopped`,`not_running`,`not_found`])})},"process.list":{params:L,result:k({sessions:O(z)})},"process.background_list":{params:L.extend({session_ids:O(C().min(1))}),result:k({delegations:O(k({delegation_id:C(),origin_ui_session_id:C(),state:C(),dispatched_at:T().nullable(),completed_at:T().nullable(),updated_at:T().nullable(),goals:O(C()),child_statuses:O(C()),has_result:E(),live_status:C().nullable(),children:O(k({goal:C(),session_id:C()})).optional()})),processes:O(k({process_id:C(),session_key:C(),command:C(),started_at:T().nullable(),exited:E(),exited_at:T().nullable(),exit_code:T().int().nullable(),completion_reason:C(),watched:E()}))})},"process.delegation_result":{params:L.extend({session_id:C().min(1),delegation_id:C().min(1)}),result:k({text:C()})}},kf=k({provider:C().nullable(),available:E(),unavailable_reason:C().nullable().optional(),windows:O(z),details:O(R)}).catchall(R),Af=k({credential_id:C(),label:C(),status:P([`available`,`exhausted`,`dead`]),unavailable_reason:C().nullable(),retry_after:C().nullable(),matches_api_key:E()}),jf=T().nullable(),Mf=k({status:P([`ok`,`no_key`,`http_error`,`unavailable`]),http_status:T().int().nullable(),quota:k({limit_remaining:jf,usage:jf,limit:jf}).nullable(),label:C().nullable(),is_available:E().nullable(),balances:O(k({currency:P([`CNY`,`USD`]),total:T(),granted:jf,topped_up:jf})),windows:O(k({key:P([`rolling`,`weekly`,`monthly`]),used_percent:T(),reset_at:C(),rate_limited:E()}))}),Nf=C().min(1).nullable().optional(),Pf=M(`scope`,[k({scope:F(`account`),resets_at:C()}),k({scope:F(`models`),models:N(C(),C())})]),Ff={"usage.account":{params:L.extend({provider:C().min(1),base_url:C().nullable().optional(),api_key:C().nullable().optional(),credential_id:Nf}),result:k({snapshot:kf.nullable()})},"usage.pool":{params:L.extend({provider:C().min(1),api_key:C().nullable().optional(),env_vars:O(C().min(1)).optional()}),result:k({entries:O(Af),has_api_key:E().optional()})},"usage.pool_providers":{params:L.extend({key_envs:N(C(),O(C().min(1))).optional()}),result:k({providers:O(C()),keys:N(C(),k({present:E(),revision:C().nullable()})).default({})})},"usage.limits":{params:L.extend({providers:O(k({slug:C().min(1),models:O(C())}))}),result:k({limits:N(C(),Pf)})},"usage.balance":{params:L.extend({provider:P([`openrouter`,`deepseek`,`opencode-go`]),credential_id:Nf,api_key:C().nullable().optional(),env_vars:O(C().min(1)).optional()}),result:Mf}},If={"config.get":{params:L.extend({config_path:C().min(1)}),result:k({path:C(),exists:E(),config:z})},"config.set":{params:L.extend({config_path:C().min(1),config:z}),result:k({ok:F(!0),path:C()})},"config.env_write":{params:L.extend({updates:N(C().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),C().nullable())}),result:k({ok:F(!0),path:C()})},"models.reasoning_efforts":{params:L.extend({model:C(),provider:C()}),result:k({efforts:O(C()),supports_reasoning:E().nullable()})},"personalities.list":{params:k({config:z}),result:k({personalities:O(k({name:C().min(1),description:C(),prompt:C()}))})}},Lf={"worktree.create":{params:L.extend({repo_root:C().min(1)}),result:k({path:C(),branch:C(),repo_root:C(),base:C().nullable()})},"worktree.retain":{params:k({paths:O(C().min(1))}),result:k({results:N(C(),P([`retained`,`missing`,`foreign_lock`]))})}},Rf=L.extend({workspace:C().min(1)}),zf={"checkpoints.list":{params:Rf,result:k({checkpoints:O(k({hash:C(),short_hash:C(),timestamp:C(),reason:C(),files_changed:T().int(),insertions:T().int(),deletions:T().int()})),store:C()})},"checkpoints.diff":{params:Rf.extend({checkpoint:C().min(1)}),result:k({stat:C(),diff:C()})},"checkpoints.restore":{params:Rf.extend({checkpoint:C().min(1),all:E().optional()}),result:k({restored_to:C(),reason:C(),restored_files:O(C()).nullable(),kept_user_edits:O(C()),skipped_oversize:O(C()),failed_deletes:O(C())})}},Bf=k({plan_gauge:Hl.nullable().optional(),prompt_tokens:T().int(),completion_tokens:T().int(),cache_read_tokens:T().int(),cache_write_tokens:T().int(),estimated_cost_usd:T().nullable()}),Vf=A({next_turn_threshold_tokens:T().int().positive().optional()}),Hf=k({status:P([`completed`,`cancelled`,`error`]),messages:O(z),context_messages:O(z).nullable().optional(),post_compression_context_tokens_estimate:T().int().nullable().optional(),final_response:C(),error:C().nullable(),failed:E(),partial:E(),compression_exhausted:E(),tool_limit_reached:E(),max_iterations_summary_request:C(),usage:Bf,context:Vf,model:C(),provider:C(),compressed:E(),agent_session_id:C(),token_sent:E(),pending_steer:C(),live_tool_calls:O(z)}),Uf=k({text:C()}).catchall(R),Wf=k({event_type:C(),name:C().nullable().optional(),preview:R.optional(),args:z.optional(),tid:C().optional(),is_error:E().optional()}).catchall(R),Gf=M(`event`,[k({event:F(`token`),data:Uf}),k({event:F(`reasoning`),data:Uf}),k({event:F(`steer_pending`),data:Uf}),k({event:F(`interim_assistant`),data:Uf}),k({event:F(`usage`),data:Bf}),k({event:F(`tool`),data:Wf}),k({event:F(`tool_progress`),data:k({tool_call_id:C(),message:C().nullable().optional(),progress:T().nullable().optional(),total:T().nullable().optional(),percent:T().nullable().optional()})}),k({event:F(`tool_complete`),data:Wf}),k({event:F(`approval`),data:z}),k({event:F(`clarify`),data:z}),k({event:F(`clarify_resolved`),data:z}),k({event:F(`connection`),data:Zd}),k({event:F(`approval_resolved`),data:A({approval_id:C(),session_id:C().optional(),reason:C().optional()})}),k({event:F(`compressing`),data:z}),k({event:F(`compression_finished`),data:z}),k({event:F(`warning`),data:z}),k({event:F(`status`),data:z}),k({event:F(`notice`),data:A({id:C().nullable().optional(),key:C().nullable().optional(),level:C(),kind:C(),ttl_ms:T().int().nullable().optional(),text:C(),lapses_with_agent:E().optional()})}),k({event:F(`notice_clear`),data:A({key:C()})}),k({event:F(`notices_reset`),data:z}),k({event:F(`provider_phase`),data:k({phase:du.nullable()})}),k({event:F(`rate_limit_wait`),data:A({provider:C().nullable(),until:T().nullable(),until_kind:P([`reset`,`retry`]).optional()})})]),Kf={"chat.start":{params:L.extend({session_id:C().min(1),stream_id:C().min(1),workspace:C(),model:C(),model_provider:C().nullable().optional(),user_message:j([C(),O(z)]),system_message:C().nullable().optional(),conversation_history:O(z),enabled_toolsets:O(C()).nullable().optional(),max_iterations:T().int().nullable().optional(),max_tokens:T().int().nullable().optional(),clarify_timeout_seconds:T().nullable().optional(),reasoning_config:k({enabled:E(),effort:C().optional()}).nullable().optional(),ephemeral_system_prompt:C().nullable().optional(),persist_user_message:C().optional(),ephemeral:E().optional(),voice_turn:E().optional(),connect_card:E().optional(),skill_secret:E().optional(),workspace_local:E().optional()}),result:Hf,stream:Gf},"chat.interrupt":{params:k({stream_id:C().optional(),session_id:C().optional()}),result:k({ok:E(),reason:C().optional(),pending_steer:C().optional(),checkpoint:O(z).optional()})},"chat.steer":{params:k({stream_id:C().optional(),session_id:C().optional(),text:C().min(1)}),result:k({accepted:E(),fallback:C().nullable().optional(),can_redirect:E().optional()})},"chat.steer_withdraw":{params:k({stream_id:C().optional(),session_id:C().optional(),pending:O(C().min(1)).min(1),index:T().int().nonnegative()}),result:k({withdrawn:E()})},"chat.steer_now":{params:k({stream_id:C().optional(),session_id:C().optional(),pending:O(C().min(1)).min(1),index:T().int().nonnegative()}),result:k({redirected:E(),withdrawn:E(),delivery:P([`redirect`,`steer`]).optional(),requeued:P([`kept`,`last`]).optional(),reason:P([`not_running`]).optional()})},"chat.compress":{params:L.extend({session_id:C().min(1),model:C(),model_provider:C().nullable().optional(),conversation_history:O(z),focus_topic:C().nullable().optional(),enabled_toolsets:O(C()).nullable().optional()}),result:k({status:P([`compressed`,`lock_skipped`,`nothing_to_do`]),messages:O(z),before_tokens:T().int(),after_tokens:T().int(),summary:A({headline:C().optional(),token_line:C().optional(),note:C().nullable().optional()}).nullable(),message:C().nullable(),agent_session_id:C(),commit_token:C().nullable()})},"chat.context_detail":{params:L.extend({session_id:C().min(1),model:C().nullable(),model_provider:C().nullable(),workspace:C().nullable()}),result:su},"chat.compress_finalize":{params:k({commit_token:C().min(1),committed:E()}),result:k({finalized:E()})},"chat.finalize_session":{params:L.extend({session_id:C().min(1),reason:P([`clear`,`delete`,`archive`]),lineage:O(C().min(1)).max(1e4).optional()}),result:k({messages:O(C())})},"chat.evict_agent":{params:k({session_id:C().min(1),clear_session:E().optional()}),result:k({evicted:E()})},"chat.commit_memory":{params:L.extend({session_id:C().min(1)}),result:k({committed:E()})},"chat.refine":{params:L.extend({session_id:C().min(1),messages:O(z),focus:C(),model:C(),model_provider:C().nullable().optional(),enabled_toolsets:O(C()).nullable().optional(),max_iterations:T().int().nullable().optional(),max_tokens:T().int().nullable().optional(),reasoning_config:k({enabled:E(),effort:C().optional()}).nullable().optional(),workspace:C().optional(),workspace_local:E().optional()}),result:k({output:C()})},"approval.respond":{params:L.extend({session_id:C().min(1),choice:P([`once`,`session`,`always`,`deny`]),request_id:C().nullable().optional()}),result:k({ok:E(),resolved:T().int(),choice:C()})},"approval.pending":{params:k({session_id:C().min(1)}),result:k({pending:O(z)})},"approval.set_yolo":{params:k({session_id:C().min(1),enabled:E()}),result:k({yolo_enabled:E(),released:T().int()})},"clarify.respond":{params:k({profile_home:C().optional(),stream_id:C().optional(),session_id:C().optional(),clarify_id:C().optional(),response:C()}),result:k({ok:E(),clarify_id:C().optional()})}},qf=L.extend({interrupt:E().optional(),cli_profile:C().nullable().optional(),quick_timeout_seconds:T().optional(),background_wait_seconds:T().optional()}),Jf=k({status:P([`completed`,`failed`,`busy`,`busy_live_work`]),message:C(),detail:C().optional(),returncode:T().int().optional(),reason:C().optional(),timed_out:E().optional()}),Yf=M(`event`,[k({event:F(`progress`),data:k({phase:P([`started`,`draining`])})})]),Xf={"gateway.session":{params:Nu,result:ju,stream:M(`event`,[k({event:F(`snapshot`),data:ju.extend({replaying:E().optional(),reaction_only:E().optional()})}),k({event:F(`event`),data:z}),k({event:F(`replay_complete`),data:k({})}),k({event:F(`clarify_batch`),data:Mu}),k({event:F(`restarting`),data:k({restarting:F(!0)})})])},"gateway.create":{params:Fu,result:ju},"gateway.control":{params:qf.extend({action:P([`start`,`stop`,`restart`])}),result:Jf,stream:Yf},"gateway.restart":{params:qf,result:Jf,stream:Yf},"gateway.mode":{params:L.extend({name:C().min(1),is_default:E()}),result:k({gateway_mode:Id})}},Zf={"gateway.groups":{params:Bl,result:Vl}},Qf=k({}),$f={"rpc.cancel":{params:cl,result:ll},"rpc.methods":{params:Qf,result:ul},"runtime.handshake":{params:nl,result:rl},"runtime.status":{params:Qf,result:rl},"runtime.ensure_current":{params:Qf,result:il},"runtime.shutdown":{params:al,result:sl},"runtime.env":{params:ol,result:sl},"runtime.sync_dependencies":{params:dl,result:fl},"runtime.agent_mutation":{params:vl,result:yl,stream:bl},"runtime.agent_recovery":{params:hl,result:gl},...$u,...yd,...jd,...Pd,...Rd,...Gd,...Ku,...Kd,...ef,...nf,...tf,...ff,...pf,..._f,...yf,...bf,...Of,...Ff,...Xf,...Zf,...Lf,...xf,...Ef,...zf,...If,...Kf};Object.keys($f);function ep(e){return e[0]??{}}function tp(e){return Array.isArray(e)?e:e==null?[]:[e]}var np=`orpc`,rp=`@orpc/shared`,ip=`1.15.2`,ap=class extends Error{constructor(...e){super(...e),this.name=`AbortError`}};function op(e){let t;return()=>{if(t)return t.result;let n=e();return t={result:n},n}}function sp(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}var cp=2,lp=`__${rp}@${ip}/otel/config__`;function up(){return globalThis[lp]}function dp(e,t={},n){return(up()?.tracer)?.startSpan(e,t,n)}function fp(e,t,n={}){if(!e)return;let r=pp(t);e.recordException(r),n.signal?.aborted&&n.signal.reason===t||e.setStatus({code:cp,message:r.message})}function pp(e){if(e instanceof Error){let t={message:e.message,name:e.name,stack:e.stack};return`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t}return{message:String(e)}}async function mp({name:e,context:t,...n},r){let i=up()?.tracer;if(!i)return r();let a=async e=>{try{return await r(e)}catch(t){throw fp(e,t,n),t}finally{e.end()}};return t?i.startActiveSpan(e,n,t,a):i.startActiveSpan(e,n,a)}async function hp(e,t){let n=up();if(!e||!n)return t();let r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function gp(e){return!e||typeof e!=`object`?!1:`next`in e&&typeof e.next==`function`&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]==`function`}var _p=Symbol.asyncDispose??Symbol.for(`asyncDispose`),vp=class{#e=!1;#t=!1;#n;#r;constructor(e,t){this.#n=t,this.#r=sp(async()=>{if(this.#e)return{done:!0,value:void 0};try{let t=await e();return t.done&&(this.#e=!0),t}catch(e){throw this.#e=!0,e}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n(`next`))}})}next(){return this.#r()}async return(e){return this.#e=!0,this.#t||(this.#t=!0,await this.#n(`return`)),{done:!0,value:e}}async throw(e){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n(`throw`)),e}async[_p](){this.#e=!0,this.#t||(this.#t=!0,await this.#n(`dispose`))}[Symbol.asyncIterator](){return this}};function yp({name:e,...t},n){let r;return new vp(async()=>{r??=dp(e);try{let e=await hp(r,()=>n.next());return r?.addEvent(e.done?`completed`:`yielded`),e}catch(e){throw fp(r,e,t),e}},async e=>{try{e!==`next`&&await hp(r,()=>n.return?.())}catch(e){throw fp(r,e,t),e}finally{r?.end()}})}function bp(e,t,n){let r=(t,i)=>{let a=e[i];return a?a({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function xp(e){if(e)return JSON.parse(e)}function Sp(e){return JSON.stringify(e)}function Cp(e){return Tp(e)?Object.getPrototypeOf(e)?.constructor:null}function wp(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function Tp(e){return!!e&&(typeof e==`object`||typeof e==`function`)}function Ep(e,t){let n=e;for(let e of t){if(!Tp(n))return;n=n[e]}return n}var Dp=(()=>{let e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function Op(e,...t){return typeof e==`function`?e(...t):e}function kp(e){return new Proxy(e,{get(e,t,n){let r=Reflect.get(e,t,n);return t!==`then`||typeof r!=`function`?r:new Proxy(r,{apply(t,n,r){if(r.length!==2||r.some(e=>!jp(e)))return Reflect.apply(t,n,r);let i=!0;r[0].call(n,kp(new Proxy(e,{get:(e,t,n)=>{if(i&&t===`then`)i=!1;else return Reflect.get(e,t,n)}})))}})}})}var Ap=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function jp(e){return typeof e==`function`&&Ap.test(e.toString())}function Mp(e){try{return decodeURIComponent(e)}catch{return e}}var Np=`@orpc/client`,Pp=`1.15.2`,Fp=new Set([`bind`,`valueOf`,`toString`,`toJSON`]),Ip={BAD_REQUEST:{status:400,message:`Bad Request`},UNAUTHORIZED:{status:401,message:`Unauthorized`},FORBIDDEN:{status:403,message:`Forbidden`},NOT_FOUND:{status:404,message:`Not Found`},METHOD_NOT_SUPPORTED:{status:405,message:`Method Not Supported`},NOT_ACCEPTABLE:{status:406,message:`Not Acceptable`},TIMEOUT:{status:408,message:`Request Timeout`},CONFLICT:{status:409,message:`Conflict`},PRECONDITION_FAILED:{status:412,message:`Precondition Failed`},PAYLOAD_TOO_LARGE:{status:413,message:`Payload Too Large`},UNSUPPORTED_MEDIA_TYPE:{status:415,message:`Unsupported Media Type`},UNPROCESSABLE_CONTENT:{status:422,message:`Unprocessable Content`},TOO_MANY_REQUESTS:{status:429,message:`Too Many Requests`},CLIENT_CLOSED_REQUEST:{status:499,message:`Client Closed Request`},INTERNAL_SERVER_ERROR:{status:500,message:`Internal Server Error`},NOT_IMPLEMENTED:{status:501,message:`Not Implemented`},BAD_GATEWAY:{status:502,message:`Bad Gateway`},SERVICE_UNAVAILABLE:{status:503,message:`Service Unavailable`},GATEWAY_TIMEOUT:{status:504,message:`Gateway Timeout`}};function Lp(e,t){return t??Ip[e]?.status??500}function Rp(e,t){return t||Ip[e]?.message||e}var zp,Bp=class e extends Error{defined;code;status;data;static{let t=Symbol.for(`__${Np}@${Pp}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[t]??=new WeakSet,zp=globalThis[t],zp.add(e)}constructor(e,...t){let n=ep(t);if(n.status!==void 0&&!Hp(n.status))throw Error(`[ORPCError] Invalid error status code.`);let r=Rp(e,n.message);super(r,n),this.code=e,this.status=Lp(e,n.status),this.defined=n.defined??!1,this.data=n.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(zp.has(this)){let t=Cp(e);if(t&&zp.has(t))return!0}return super[Symbol.hasInstance](e)}};function Vp(e){return e instanceof Bp?e:new Bp(`INTERNAL_SERVER_ERROR`,{message:`Internal server error`,cause:e})}function Hp(e){return e<200||e>=400}function Up(e){if(!wp(e))return!1;let t=[`defined`,`code`,`status`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`code`in e&&typeof e.code==`string`&&`status`in e&&typeof e.status==`number`&&Hp(e.status)&&`message`in e&&typeof e.message==`string`}function Wp(e,t={}){return new Bp(e.code,{...t,...e})}function Gp(e,t){return{...e,...t}}var Kp=class{"~orpc";constructor(e){if(e.route?.successStatus&&Hp(e.route.successStatus))throw Error(`[ContractProcedure] Invalid successStatus.`);if(Object.values(e.errorMap).some(e=>e&&e.status&&!Hp(e.status)))throw Error(`[ContractProcedure] Invalid error status code.`);this[`~orpc`]=e}};function qp(e){return e instanceof Kp||(typeof e==`object`||typeof e==`function`)&&e!==null&&`~orpc`in e&&typeof e[`~orpc`]==`object`&&e[`~orpc`]!==null&&`errorMap`in e[`~orpc`]&&`route`in e[`~orpc`]&&`meta`in e[`~orpc`]}function Jp(e,t){return{...e,...t}}function Yp(e,t){return{...e,...t}}function Xp(e,t){return e.path?{...e,path:`${t}${e.path}`}:e}function Zp(e,t){return{...e,tags:[...t,...e.tags??[]]}}function Qp(e,t){return e?`${e}${t}`:t}function $p(e,t){return e?[...e,...t]:t}function em(e,t){let n=e;return t.prefix&&(n=Xp(n,t.prefix)),t.tags?.length&&(n=Zp(n,t.tags)),n}function tm(e,t){if(qp(e))return new Kp({...e[`~orpc`],errorMap:Gp(t.errorMap,e[`~orpc`].errorMap),route:em(e[`~orpc`].route,t)});if(typeof e!=`object`||!e)return e;let n={};for(let r in e)n[r]=tm(e[r],t);return n}var V=new class e extends Kp{constructor(e){super(e),this[`~orpc`].prefix=e.prefix,this[`~orpc`].tags=e.tags}$meta(t){return new e({...this[`~orpc`],meta:t})}$route(t){return new e({...this[`~orpc`],route:t})}$input(t){return new e({...this[`~orpc`],inputSchema:t})}errors(t){return new e({...this[`~orpc`],errorMap:Gp(this[`~orpc`].errorMap,t)})}meta(t){return new e({...this[`~orpc`],meta:Jp(this[`~orpc`].meta,t)})}route(t){return new e({...this[`~orpc`],route:Yp(this[`~orpc`].route,t)})}input(t){return new e({...this[`~orpc`],inputSchema:t})}output(t){return new e({...this[`~orpc`],outputSchema:t})}prefix(t){return new e({...this[`~orpc`],prefix:Qp(this[`~orpc`].prefix,t)})}tag(...t){return new e({...this[`~orpc`],tags:$p(this[`~orpc`].tags,t)})}router(e){return tm(e,this[`~orpc`])}}({errorMap:{},route:{},meta:{}}),nm={defaultMethod:`POST`,defaultSuccessStatus:200,defaultSuccessDescription:`OK`,defaultInputStructure:`compact`,defaultOutputStructure:`compact`};function rm(e,t){return t===void 0?nm[e]:t}var H=D(),U=C().nullable(),W=T().nullable(),im=T(),am=C().regex(/^[A-Za-z0-9_.:-]{1,128}$/,`invalid session id`),om=A({download_url:C().startsWith(`/api/groups/file?`).optional(),filename:C().optional(),name:C().optional(),path:C().optional(),size:T().optional(),mime:C().optional(),is_image:E().optional(),rollback_token:C().optional()}),sm=P([`shell`,`read`,`list`,`search`,`web`,`write`,`skill`,`memory`,`delegate`,`unknown`]),cm=k({kind:P([`addition`,`deletion`,`context`]),old_line:T().int().nullable(),new_line:T().int().nullable(),text:C()}),lm=k({header:C(),old_start:T().int().nullable(),new_start:T().int().nullable(),new_end:T().int().nullable(),additions:T().int(),deletions:T().int(),lines:O(cm)}),um=k({added:T().int(),removed:T().int(),diff:C(),truncated:E(),hunks:O(lm)}),dm=k({percent:T().min(0).max(100).nullable(),message:C().nullable()}),fm={progress:dm.nullable().optional(),kind:sm.optional(),target:C().optional(),edit_diff:um.optional(),focus_path:U.optional().describe(`TAL-1458: a read or write call's file as a workspace-relative path, the file a companion page shows; absent for any other call or an absolute, home or out-of-workspace path.`)},pm=k({outbound_draft:ql.optional(),text:C().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),exit_code:T().int().optional()}),mm=A({...fm,name:C().optional(),args:H.optional(),function:A({name:C().optional(),arguments:H.optional()}).optional(),id:C().optional(),call_id:C().optional(),tool_call_id:C().optional(),done:E().optional(),is_error:E().optional(),preview:C().nullable().optional(),result:H.optional(),result_view:pm.nullable().optional(),output:H.optional(),duration:T().nullable().optional(),cost_usd:T().nullable().optional(),timestamp:T().nullable().optional(),event_type:C().optional()}),hm=A({type:C(),text:C().optional()}),gm=j([C(),O(hm),lc()]);P([`user`,`assistant`,`system`,`tool`]);var _m=j([C(),T()]),vm=k({task_ids:O(C()),status:P([`running`,`attention`,`completed`,`failed`,`cancelled`,`unknown`]),agents:k({total:T().int(),completed:T().int(),failed:T().int(),running:T().int()})}),ym=k({url:C(),name:C(),mime:C(),kind:P([`image`,`audio`,`video`,`pdf`,`file`])}),bm=A({row_id:C(),order_index:T().int(),role:P([`prose`,`reasoning`,`tool`,`steering`]),created_at:T().optional(),text:C().optional(),titles:O(C()).optional(),display_text:C().optional(),media:O(ym).optional(),tool:A({id:C(),name:C(),...fm,args:H.optional(),preview:C().nullable(),result:H.optional(),result_view:pm.nullable().optional(),done:E(),is_error:E(),duration:T().nullable(),cost_usd:T().nullable(),background:vm.optional(),result_truncated:F(!0).optional(),result_chars:T().int().nullable().optional()}).optional(),steering:A({steer_id:C(),consumed:E(),submitted_at:T().nullable(),consumed_at:T().nullable(),phase_duration:T().nullable().optional()}).optional()}),xm=A({path:C(),action:P([`added`,`edited`,`deleted`,`renamed`])}),Sm=P([`completed`,`no_response`,`cancelled`,`interrupted`,`tool_limit_reached`,`compression_exhausted`,`error`]),Cm=A({version:F(`activity_scene_v1`),activity_rows:O(bm),final_answer:C().optional(),final_answer_excerpt:C().optional().describe(`Collapsed preview of an older settled final answer. Absent on the session-global newest visible reply; its exemption transfers only when a newer visible reply settles.`),turn_duration:T().nullable().optional(),final_answer_display:C().optional(),final_answer_media:O(ym).optional(),terminal_state:C().optional().describe('The turn\'s outcome: a `TurnTerminalState` (`completed`, `no_response`, `error`, `cancelled`, `interrupted`, `tool_limit_reached`, ...), or `running` for the running turn of a run with no journal to replay (TAL-374). A running scene holds every persisted row (no final answer) and renders open, with no "Worked" fold or outcome; the live rows streamed after attach continue it, and the settled scene replaces both.'),expanded_by_default:E().optional(),final_phase_duration:T().optional(),has_consumed_steering:E().optional(),file_changes:O(xm).optional(),activity_rows_total:T().int().optional(),activity_rows_offset:T().int().optional(),activity_rows_complete:E().optional(),activity_rows_omitted:T().int().optional(),activity_scene_ref:C().optional()}),wm=P([`waiting`,`reviewing`,`reviewed`,`failed`,`unknown`]),Tm=k({kind:P([`agent`,`command`,`other`]),status:P([`completed`,`failed`,`notice`]),label:C(),exit_code:T().int().nullable().optional(),review_state:wm.optional()}),Em=A({role:C(),content:gm.optional(),id:_m.optional(),message_id:_m.optional(),timestamp:T().nullable().optional(),reaction_view:Eu.optional(),attachments:O(om).optional(),tool_calls:O(mm).optional(),reasoning:C().optional(),tool_call_id:C().optional(),tool_use_id:C().optional(),name:C().optional(),badge:C().optional(),label:C().optional(),provider_details:H.optional(),provider_details_label:C().optional(),recovery_control:H.optional(),_anchor_activity_scene:Cm.optional(),_turn_id:C().optional(),_turnDuration:T().optional(),_turnTps:T().optional(),_ts:T().optional(),reasoning_titles:O(C()).optional(),_active_turn_user:E().optional(),_steer:A({steer_id:C(),submitted_at:T().nullable().optional(),consumed_at:T().optional(),phase_duration:T().optional()}).optional(),_final_phase_duration:T().optional(),_display_truncated:E().optional().describe(`Whether this settled body has a collapsed preview. The newest settled visible assistant reply and active-turn output remain full.`),_display_excerpt:C().optional().describe(`Collapsed preview with full content retained. The newest settled visible assistant reply remains exempt throughout the next running turn, until a newer visible reply settles.`),_collapsible:E().optional(),_display_content:C().optional(),_media:O(ym).optional(),_background_update:k({kind:P([`delegation`,`process`,`mixed`,`other`]),attention:E(),count:T().int().positive(),summary:C(),lines:O(Tm),review_state:wm.optional()}).optional(),_marker_kind:P([`context_compaction`,`preserved_task_list`]).optional(),_marker_body:C().optional(),_notice_kind:P([`failed_turn`,`session_finalize`]).optional(),_delivery:k({kind:P([`webhook`,`cron`]),name:C(),body:C()}).optional(),_background_reply:E().optional(),_background_silent:E().optional(),_display:P([`row`,`hidden`,`in_scene`]).optional()}),Dm=A({text:C().optional(),files:O(H).optional()}),Om=k({steer_id:C(),text:C(),submitted_at:T(),state:P([`pending`,`sending_now`]),actions:k({edit:E(),cancel:E(),send_now:E()})}),km=k({key:C(),level:P([`info`,`warn`,`error`,`success`]),text:C(),expires_at:W.describe(`Unix seconds when the server drops it; null when only the Agent clears it.`)}),Am=k({text:C(),status:P([`active`,`paused`,`parked`]),turns_used:T().int().nonnegative(),max_turns:T().int().nonnegative(),reason:U,parked_until:W.describe(`Unix seconds a timed park ends; null otherwise.`)}),jm={context_used_tokens:T().int().positive().nullable().optional(),context_window_tokens:T().int().positive().nullable().optional(),context_usage_percent:T().int().min(0).max(100).nullable().optional(),context_threshold_percent:T().int().min(0).max(100).nullable().optional()},Mm=P([`user`,`background`]).nullable().optional().describe(`Who started the running turn; null while idle.`),Nm=E().describe(`True only while the session's run is a live stream on this server.`),Pm=U.optional().describe("The live stream id; non-null only while `is_streaming` is true."),Fm=U.optional().describe(`Server-owned reason this session is display-only or its ownership cannot be verified.`),Im=E().describe(`The session cannot be modified from Web: a read-only import, a view-only subagent child, or a foreign session whose owner refuses claiming.`),Lm=E().describe(`Web may branch this session: never a subagent child or an ownership-locked session; other read-only sessions only when they are cron runs.`),Rm=E().describe(`Web may pin or unpin this session: never a subagent child or a session locked by canonical ownership or unreadable ownership storage.`),zm=E().describe(`Web may archive or unarchive this session: never a subagent child or a session locked by canonical ownership or unreadable ownership storage.`),Bm=E().describe(`Web may delete this session: never a read-only session (a read-only import, a view-only subagent child, or a foreign session whose owner refuses claiming).`),Vm=E().describe(`Web may duplicate this session: it has a WebUI copy, is not a subagent child, and is not locked by canonical ownership or unreadable ownership storage.`),Hm=P([`webui`,`cli`,`messaging`,`cron`,`webhook`,`subagent`,`claude_code`,`kanban`,`api`,`other`]).describe("The session's source family. `is_cli_session` is true only for `cli` and `claude_code`."),Um=T().describe("Epoch seconds the session sorts and date-buckets by: `last_message_at`, else `updated_at`, else `created_at`."),Wm=E().describe("`source_kind` is `messaging`: a gateway chat (Telegram, Signal, WhatsApp, …) the server imports before Web continues it."),Gm=U.optional(),Km=k({session_id:am,title:C()}),qm=k({session_id:C().regex(/^[A-Za-z0-9_-]{1,128}$/).describe(`Retained logical conversation identity.`),tip_session_id:C().regex(/^[A-Za-z0-9_-]{1,128}$/),profile:C().min(1).max(128)}),Jm=qm.extend({title:C()}),Ym=P([`starting`,`running`,`waiting_for_approval`,`waiting_for_input`,`completed`,`failed`,`cancelled`,`stale`]),Xm=A({id:j([C(),T()]).optional(),text:C().optional(),content:C().optional(),title:C().optional(),status:C().optional(),done:E().optional(),completed:E().optional()}),Zm=A({display_items:O(k({id:j([C(),T()]).optional(),text:C(),state:P([`pending`,`in_progress`,`completed`,`cancelled`])})).optional(),total_count:T().int().nonnegative().optional(),completed_count:T().int().nonnegative().optional(),pending_count:T().int().nonnegative().optional(),in_progress_count:T().int().nonnegative().optional(),cancelled_count:T().int().nonnegative().optional(),session_id:C().optional(),todos:O(Xm).optional(),summary:N(C(),D()).optional(),version:T().optional(),ts:T().optional(),source:C().optional(),description:C().optional()}),Qm=A({plan_gauge:Hl.nullable().optional(),show_reasoning:E().optional().describe(`Server-resolved display preference. Hidden reasoning is omitted from live events, history and activity scenes; older servers omit this field.`),activity_phase:Ym.optional(),todo_state:Zm.optional(),source_references:O(Jm).optional(),context_detail_key:C().nullable().optional().describe(`Opaque identity for open-only context details; changes with owner epoch, model and context.`),composer_state_key:C().optional().describe(`Opaque profile-home and owner identity for device-local composer state; never an API session id.`),session_id:am,title:C(),workspace:C().optional(),created_workspace:C().nullable().optional(),model:U.optional(),model_provider:U.optional(),model_option_id:U.optional().describe(`TAL-301: the catalog entry id the stored model/provider selects; null when none.`),messages:O(Em).optional(),tool_calls:O(mm).optional(),created_at:im.optional(),updated_at:im.optional(),last_message_at:W.optional(),message_count:T().optional(),user_message_count:T().optional(),pinned:E().optional(),archived:E().optional(),project_id:U.optional(),profile:U.optional(),personality:U.optional(),input_tokens:T().optional(),output_tokens:T().optional(),cache_read_tokens:T().optional(),cache_write_tokens:T().optional(),cache_hit_percent:W.optional(),estimated_cost:W.optional(),active_stream_id:Pm,is_streaming:Nm,active_turn_origin:Mm,pending_steers:O(Om).optional().describe(`TAL-424: the active stream's pending steers, oldest first.`),run_status:fu.nullable().optional().describe(`Current server-selected run presentation; null when no turn runs. Older servers omit it.`),compression_started_at:W.optional().describe(`TAL-1006: when the compression clients show started (epoch seconds): the running manual job's, else the live run's open span; null when none runs.`),notices:O(km).optional().describe(`TAL-803: the Agent's active notices for the session, oldest first.`),goal:Am.nullable().optional().describe(`TAL-808: the standing /goal; null when none runs.`),automatic_turns_held:E().optional().describe(`TAL-899: the user pressed Stop, so no automatic turn (background wakeup or goal continuation) starts until their next message.`),has_pending_user_message:E().optional(),pending_user_message:U.optional(),pending_attachments:O(om).optional(),pending_started_at:W.optional(),pending_user_source:U.optional(),context_length:W.optional(),threshold_tokens:W.optional(),last_prompt_tokens:W.optional(),post_compression_context_tokens_estimate:W.optional(),...jm,execution_mode:Pu.optional().describe(`TAL-1040: the Agent execution policy frozen when the session was created; absent from older servers.`),enabled_toolsets:O(C()).nullable().optional(),composer_draft:Dm.optional(),is_cli_session:E().optional(),source_kind:Hm,is_messaging_session:Wm,sort_ts:Um,read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),can_branch:Lm,can_pin:Rm,can_archive:zm,can_delete:Bm,can_duplicate:Vm,source_tag:U.optional(),can_compress:E().optional().describe(`TAL-614: a manual compression would start now: writable, no running turn, and at least four model-history messages. Only the full session detail carries it; absent means no.`),confirms_deep_truncate:E().optional().describe("TAL-929: this server holds a `session.truncate` that discards more than one user turn until it is confirmed; absent on older servers, which cut at once."),source_label:U.optional(),session_source:U.optional(),raw_source:U.optional(),parent_session_id:U.optional(),worktree_path:U.optional(),worktree_branch:U.optional(),worktree_repo_root:U.optional(),worktree_retained:F(!0).optional().describe("TAL-1254: the last sidecar start found this worktree gone from git; the Agent's sweep keeps an archived one under `refs/hermes/archive/`. Absent while the worktree exists."),share_token:U.optional(),share_url:U.optional(),share_created_at:W.optional(),manual_title:E().optional(),compression_anchor_summary:U.optional(),compression_recovery:N(C(),H).optional(),recommended_recovery_action:U.optional(),compression_recovery_action:U.optional(),compression_recovery_source_session_id:U.optional(),gateway_routing:H.optional(),_messages_offset:T().optional(),_messages_truncated:E().optional(),_msg_limit_max:T().optional(),_load_revision:C().optional(),transcript_seq:k({stream_id:C(),seq:T().int().nonnegative()}).nullable().optional(),assistant_name:C().optional(),workspace_name:Gm,focus_path:U.optional().describe("TAL-1458: the last non-null `focus_path` of the session's persisted tool calls, so a reopened chat shows its file before any stream event; null when none."),branched_from:Km.nullable().optional().describe(`TAL-454: the chat this one was branched from while it still loads (archived included); null for a compression continuation, a deleted or missing parent, and every other chat.`)}),$m=A({session:Qm}),eh=P([`pinned`,`recent`]),th=k({kind:eh,title:C()}),nh=A({session_id:am,title:C(),workspace:C().optional(),model:U.optional(),created_at:im.optional(),updated_at:im.optional(),last_message_at:W.optional(),message_count:T().optional(),pinned:E().optional(),archived:E().optional(),project_id:U.optional(),profile:U.optional(),is_streaming:Nm,is_cli_session:E().optional(),source_kind:Hm,is_messaging_session:Wm,sort_ts:Um,cron_running:E().optional(),read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),can_branch:Lm,can_pin:Rm,can_archive:zm,can_delete:Bm,can_duplicate:Vm,attention:A({kind:C().optional(),count:T().optional()}).nullable().optional(),source_tag:U.optional(),source_label:U.optional(),session_source:U.optional(),raw_source:U.optional(),parent_session_id:U.optional(),active_stream_id:Pm,share_token:U.optional(),share_url:U.optional(),worktree_branch:U.optional(),match_type:P([`title`,`metadata`,`content`]).optional(),match_preview:U.optional(),workspace_name:Gm,sidebar_group:eh.nullable().optional().describe("TAL-1534: the sidebar group `GET /api/sessions` files the row under; null for an archived row. Other routes omit it."),...jm}),rh=k({state:P([`ok`,`corrupt`,`unavailable`,`outdated`]),reason:C().nullable()}),ih=A({sessions:O(nh).describe("Canonical display order (TAL-306): pinned first, then active (streaming or a pending prompt), then newest `sort_ts`, then `session_id`. Clients keep it."),sidebar_reference_sessions:O(nh),server_time:T(),server_tz:C(),active_profile:C(),all_profiles:E(),include_archived:E(),archived_count:T().int(),archived_webui_count:T().int(),archived_cli_count:T().int(),other_profile_count:T().int(),cli_count:T().int(),webui_session_count:T().int(),cli_session_count:T().int(),scheduled_session_count:T().int().nonnegative(),scheduled_sessions_truncated:E(),webhook_session_count:T().int().nonnegative(),webhook_sessions_truncated:E(),sidebar_groups:O(th).describe("TAL-1534: the groups the unarchived `sessions` rows fill, in display order; a client captions only these."),agent_storage:rh.describe(`Agent session storage health; a degraded state explains an empty or missing Agent session list.`),archived_limit:T().int().nullable().optional(),archived_offset:T().int().optional()}),ah=A({activity_phase:Ym.optional(),session_id:am,title:C().optional(),active_stream_id:Pm,active_turn_origin:Mm,agent_running:Nm,is_streaming:Nm,read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),message_count:T().optional(),model:U.optional(),profile:U.optional(),workspace:C().optional(),input_tokens:T().optional(),output_tokens:T().optional(),total_tokens:T().optional(),estimated_cost:W.optional(),updated_at:im.optional()}),oh=A({plan_gauge:Hl.nullable().optional(),input_tokens:T().optional(),output_tokens:T().optional(),total_tokens:T().optional(),estimated_cost:W.optional(),model:U.optional()}),sh=A({project_id:C(),name:C(),color:C().nullable().optional(),profile:U.optional(),created_at:T().optional()}),ch=A({projects:O(sh),active_profile:C(),all_profiles:E(),other_profile_count:T().int()}),lh=A({ok:F(!0),state_db_cleanup_failed:E().optional()}),uh=A({submission_id:C().min(1).max(128).optional().describe(`Stable native-owner admission identity. Reuse only for an exact retry of the same submission.`),session_id:am,message:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),workspace:C().nullable().optional(),profile:C().nullable().optional(),explicit_model_pick:E().optional(),attachments:O(j([om,C()])).optional(),moa_config:E().optional(),regenerate:E().optional(),regeneration_revision:C().optional(),voice_turn:E().optional(),connect_card:E().optional(),skill_secret:E().optional()}),dh=A({owner_attachment:Vu.optional(),admission_id:C().optional(),stream_id:C().optional(),session_id:am.optional(),turn_id:C().optional(),user_message_id:j([C(),T()]).nullable().optional(),pending_started_at:T().nullable().optional(),title:C().optional(),effective_model:C().optional(),effective_model_provider:C().optional(),queued:E().optional(),ok:E().optional(),status:C().optional(),reason:C().optional(),session:Qm.optional()}),fh=A({activity_phase:Ym.optional(),active:E(),stream_id:C(),replay_available:E().optional(),journal:H.optional(),blocking_stream_id:C().nullable()}),ph=k({steer_id:C().nullable(),reason:P([`edit`,`cancel`,`stopped`,`followup`]),text:C()}),mh=A({activity_phase:Ym.optional(),ok:E(),cancelled:E(),stream_id:C().optional(),withdrawn_steers:O(ph).optional(),error:C().optional()}),hh=k({session_id:am,steer_id:C().min(1),reason:P([`edit`,`cancel`])}),gh=k({withdrawn:E(),text:C().optional()}),_h=k({session_id:am,steer_id:C().min(1)}),vh=k({redirected:E(),outcome:P([`delivered`,`next_step`,`not_running`,`taken`,`failed`])});A({session_id:am,text:C().min(1),display_text:C().optional(),steer_id:C().optional()});var yh=A({accepted:E(),fallback:U.optional(),stream_id:U.optional(),steer_id:C().optional(),started_turn:dh.optional()}),bh=A({allowed_choices:O(P([`once`,`session`,`always`,`deny`])).optional(),can_enable_yolo:E().optional(),approval_id:C().optional(),session_id:C().optional(),command:C().optional(),description:C().optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),question:C().optional(),status:C().optional(),pending_count:T().optional(),run_id:C().optional(),mirror_token:C().optional()}),xh=A({pending:bh.nullable(),pending_count:T().int()});A({session_id:am,choice:P([`once`,`session`,`always`,`deny`]),approval_id:C().optional(),command:C().optional(),yolo:E().optional(),run_id:C().optional(),mirror_token:C().optional()});var Sh=A({ok:E(),choice:C().optional(),yolo_enabled:E().optional(),stale_cleared:E().optional(),error:C().optional(),pending_count:T().optional()}),Ch=j([C(),A({label:C().optional(),value:C().optional(),text:C().optional()})]),wh=A({qid:C(),question:C(),choices:O(C()),multi_select:E(),answered:E().optional().describe(`TAL-1271: a gateway-owned batch question the owner already holds an answer for; it stays editable until the last answer.`)}),Th=N(C(),j([C(),O(C())])),Eh=k({key:P([`master_password`,`identifier`,`password`,`code`,`secret`]),secure:E()}),Dh=k({kind:P([`vault_unlock`,`vault_save_login`,`vault_code`,`skill_secret`]),backend:C().nullable().describe("The password manager (`vault_unlock`)."),display_name:C().nullable().describe("Its display name (`vault_unlock`)."),origin:C().nullable().describe("The page origin the login is saved for (`vault_save_login`)."),site:C().nullable().describe("The site, by host (`vault_save_login`, `vault_code`)."),hint:C().nullable().describe("Where the code was sent, when the Agent says (`vault_code`)."),skill:k({env_var:C(),skill_name:C(),help:C().nullable(),required_for:C().nullable()}).optional().describe("Profile-local environment setup metadata (`skill_secret`)."),fields:O(Eh),timeout_at:T().describe(`Unix seconds when the Agent stops waiting.`)}),Oh=A({pending:A({steps:O(wh).optional(),vault:Dh.optional(),clarify_id:C().optional(),session_id:C().optional(),question:C().optional(),description:C().optional(),choices:O(Ch).optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),status:C().optional(),raw_preview:C().optional(),timeout_at:T().optional(),timeout_seconds:T().optional(),pending_count:T().optional(),index:T().optional(),total:T().optional()}).nullable(),pending_count:T().int()});A({session_id:am,answers:Th.optional(),response:C().optional(),answer:C().optional(),choice:C().optional(),clarify_id:C().optional(),decline:E().optional()});var kh=A({ok:E(),response:C().optional(),error:C().optional(),stale:E().optional()}),Ah=A({text:C(),files:O(H)}),jh=A({ok:F(!0),draft:Ah,draft_version:C().nullable(),unchanged:E().optional()}),Mh=A({filename:C(),path:C(),size:T(),mime:C(),is_image:E().optional(),rollback_token:C().optional(),named_in_prompt:E().optional(),max_attachments_per_message:T().int().positive().optional()}),Nh=A({text:C().optional(),state:C().optional(),status:C().optional(),turns:T().optional(),max_turns:T().optional(),reason:C().optional()}),Ph=A({ok:E().optional(),action:C().optional(),goal:Nh.nullable().optional(),message:C().optional(),message_key:C().optional(),stream_id:C().optional(),status:C().optional(),reason:C().optional()}),Fh=k({task_id:C(),kind:P([`delegation`,`process`,`background_command`]),status:vm.shape.status,title:C(),started_at:T().nullable(),updated_at:T(),completed_at:T().nullable(),result_available:E(),child_sessions:O(k({goal:C(),session_id:am})),exit_code:T().int().nullable(),agents:vm.shape.agents.nullable(),pinned:E(),dismissible:E(),can_stop:E().optional(),active:E()}),Ih=k({activity_phase:Ym.optional(),session_id:C(),tasks:O(Fh),agent_available:E(),agents_working:E().optional()}),Lh=k({task_id:C(),text:C()}),Rh=k({session_id:am,task_id:C().min(1)}),zh=k({outcome:P([`stopped`,`not_running`,`not_found`])}),Bh=k({ok:F(!0),task:Fh}),Vh=A({ok:F(!0),share:A({token:C(),url:C(),title:C(),message_count:T().int(),created_at:T(),updated_at:T()}),session:nh}),Hh=A({role:C(),content:j([C(),lc(),O(H)]).optional()}),Uh=A({share:A({title:C(),messages:O(Hh),message_count:T().int(),created_at:T().optional(),updated_at:T().optional(),model:U.optional()})}),Wh=k({sessions:O(nh.extend({source_reference:qm})),active_profile:C(),max_sources:T().int()}),Gh=A({title:C().optional(),workspace:C().optional(),workspace_inherited_from_prev_session:E().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),profile:C().nullable().optional(),prev_session_id:C().optional(),project_id:C().nullable().optional(),worktree:H.optional(),enabled_toolsets:O(C()).nullable().optional(),parent_session_id:C().optional(),execution_mode:Pu.optional().describe("TAL-1040: `ignore_config` and `safe` start the session through the Agent owner; omitted means normal."),request_id:C().regex(/^[A-Za-z0-9_-]{1,64}$/).optional().describe(`TAL-1040: stable creation identity for a diagnostic or referenced chat. Reuse it only to retry the same creation.`),source_references:O(qm).max(5).optional().describe(`Same-profile search pointers. Nonempty selections require request_id; unavailable or changed identities refuse creation.`)}),Kh=A({ok:F(!0),available:E(),provider:C(),streaming:E(),warm_supported:E()}),qh=k({spoken_text:C()}),Jh=A({ok:F(!0),transcript:C(),filtered:E()}),Yh=k({warning_remaining_percent:T().int().min(1).max(99),critical_remaining_percent:T().int().min(0).max(99),pace_tolerance_percent:T().int().min(0).max(25),pace_warning_burn_rate_percent:T().int().min(100).max(300),pace_critical_burn_rate_percent:T().int().min(100).max(400),pace_minimum_elapsed_hours:T().int().min(0).max(72)}),Xh=A({ok:F(!0),message:C().optional()}),Zh=P([`stable`,`nightly`,`experimental`]),Qh=A({bot_name:C().optional(),default_model:C().optional(),default_workspace:C().optional(),language:C().optional(),send_key:C().optional(),font_size:C().optional(),full_width_chat:E().optional(),chat_width:P([`comfortable`,`wide`,`full`]).optional(),auto_scroll_follow:E().optional(),render_user_markdown:E().optional(),chat_activity_display_mode:C().optional(),default_message_mode:C().optional(),fade_text_effect:E().optional(),hidden_tabs:O(C()).optional(),composer_control_order:O(C()).optional(),show_cli_sessions:E().optional(),show_claude_code_sessions:E().optional(),show_cron_sessions:E().optional(),show_webhook_sessions:E().optional(),show_kanban_sessions:E().optional(),check_for_updates:E().optional(),summarize_updates_automatically:E().optional(),ignore_agent_updates:E().optional(),auth_enabled:E().optional(),password_auth_enabled:E().optional(),password_env_var:E().optional(),passkeys_enabled:E().optional(),passwordless_enabled:E().optional(),auth_disabled_acknowledged:E().optional(),webui_version:C().optional(),agent_version:C().optional(),update_channel:C().optional(),update_channels:O(Zh).optional().describe(`TAL-1569: the Web update channels this server offers, in display order.`),agent_update_channel:P([`stable`,`experimental`]).optional(),update_channel_version:U.optional(),max_tokens:W.optional(),max_tokens_effective:W.optional(),max_tokens_fallback:W.optional(),tts_engine:C().optional(),tts_voice:C().optional(),dictation_append:E().optional(),persisted_speech_keys:O(C()).optional(),confirm_external_links:E().optional(),trusted_link_hosts:O(C()).optional(),provider_quota_thresholds:Yh.optional()}),$h=A({name:C(),path:C().optional(),is_active:E().optional(),is_default:E().optional(),model:U.optional(),provider:U.optional(),skill_count:T().optional(),total_skills:T().optional(),enabled_skills:T().optional(),gateway_running:E().optional(),has_env:E().optional(),visible:E().optional(),gateway_mode:Id.optional(),display_name:C().optional(),description:C().optional(),has_avatar:E().optional(),canonical_session:Fd.nullable().optional(),pending_writes:T().int().optional()}),eg=A({profiles:O($h),active:C(),single_profile_mode:E().optional()}),tg=A({name:C(),path:C().optional(),is_default:E().optional(),default_workspace:U.optional()}),ng=eg.extend({is_default:E(),default_model:H,default_model_provider:H,default_workspace:C().nullable()}),rg=A({show_reasoning:E().optional(),reasoning_effort:C().nullable().optional(),supported_efforts:O(C()).optional(),supports_reasoning_effort:E().optional(),supports_thinking_toggle:E().optional(),supports_session_scope:E().optional()}),ig=P([`healthy`,`warning`,`critical`,`stale`,`unavailable`]),ag=A({allowance:Wl.optional(),id:C(),label:C().optional(),provider:C().optional(),provider_id:C().optional(),bare_id:C().optional(),supports_fast_tier:E().optional(),supported_speed_tiers:O(pu).optional(),limit:k({scope:F(`model`),resets_at:C()}).optional()}),og=M(`scope`,[k({scope:F(`account`),resets_at:C()}),k({scope:F(`models`),models:N(C(),C())})]),sg=k({status:P([`available`,`stale`,`unavailable`]),authoritative:E(),unavailable_reason:U,generation:C().min(1).describe(`Opaque source generation; cached data from another generation must never be merged.`)}),cg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),sections:Gl.optional(),availability:sg.optional(),provider:C(),provider_id:C().optional(),models:O(ag),extra_models:O(ag).optional(),limit:og.optional(),quota_level:ig.optional()}),lg=A({availability:sg.optional(),active_provider:U.optional(),default_model:C().optional(),default_provider_id:U.optional(),default_bare_id:C().optional(),default_option_id:U.optional(),groups:O(cg),aliases:N(C(),H).optional(),configured_model_badges:N(C(),H).optional()}),ug=A({availability:sg.optional(),provider:C().optional(),source:C().optional(),models:O(ag),count:T().optional(),error:C().optional()}),dg=P([`env`,`oauth`,`config`,`pool`,`plugin`,`other`]),fg=A({id:C(),display_name:C().optional(),has_key:E().optional(),configured:E().optional(),configurable:E().optional(),is_oauth:E().optional(),is_plugin_provider:E().optional(),is_self_hosted:E().optional(),is_custom:E().optional(),key_source:C().optional(),base_url:U.optional(),auth_error:U.optional(),env_var:U.optional(),models:O(ag).optional(),models_total:T().optional(),nous_account:qd.nullable().optional(),nous_account_error:U.optional(),is_active:E().optional(),key_source_kind:dg.nullable().optional(),removable:E().optional()}),pg=A({availability:sg.optional(),providers:O(fg),active_provider:U.optional()}),mg=A({remaining:ig,pace:ig.describe(`Burn rate and pace tolerance; the remaining classification when the window has no pace.`)}),hg=A({expected_remaining_percent:T(),pace_delta_percent:T(),burn_rate:T(),minutes_to_reset:T(),projected_minutes_to_empty:W.describe(`Minutes until the window empties at the current burn; null when nothing has been used.`),elapsed_minutes:T(),valid_until:C(),status:P([`over`,`on`,`under`]).optional().describe("TAL-411, `/api/provider/quotas` only: over when behind pace by at least the tolerance, under when more than 1 point ahead.")}),gg=A({outcome:P([`safe`,`warning`]).describe("`warning` when the projection empties the window before it resets."),budget_unit:P([`hour`,`day`]),budget_percent:W.describe("Remaining percent per `budget_unit` until reset."),depletion_margin_minutes:W.describe(`Projected empty minus reset, in minutes; negative empties early, null when no depletion is projected.`)}),_g=A({label:C(),used_percent:W,remaining_percent:W,reset_at:U.describe(`ISO-8601 UTC.`),detail:U,window_seconds:W.describe(`The provider value, else 5h or weekly from the label; null when unknown.`),pace:hg.nullable().describe(`Null for a window without a future reset, a usage value, or a 5h/weekly length.`),forecast:gg.nullable(),projection_eligible:E().optional().describe("TAL-411, `/api/provider/quotas` only: the burn-rate breakpoints apply (enough elapsed time and use, and the projection empties the window before reset)."),urgency:mg.optional()}),vg=T().int().nullable().optional(),yg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),computed_at:C().optional().describe(`Original reference time of this source, retained with stale windows.`),source_id:C(),provider_id:C().optional(),provider_label:C().optional(),account_label:C().optional(),status:C().optional(),supported:E().optional(),message:C().nullable().optional(),is_active_provider:E().optional(),quota:H.optional(),windows:O(_g).optional(),balances:H.optional(),plan:H.optional(),details:H.optional(),unavailable_reason:H.optional(),retry_after:H.optional(),fetched_at:H.optional(),pace_window_index:vg.describe(`The window a pace-coloured widget shows: the weekly one, else the first 5h/session window.`),session_window_index:vg.describe(`The session (else 5h) window.`),weekly_window_index:vg.describe(`The weekly window.`),urgency:mg.optional().describe("TAL-411: `remaining` of the first window, `pace` of the pace window; alerts and the source colour follow it.")}),bg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),available:E().optional(),stale:E().optional(),title:C().optional(),plan:H.optional(),unavailable_reason:U.optional(),windows:O(_g),details:H.optional(),fetched_at:U.describe(`ISO-8601 UTC.`),pace_window_index:vg,session_window_index:vg,weekly_window_index:vg}),xg=A({computed_at:C().describe("ISO-8601 UTC reference time of every window `pace`."),ok:E(),provider:U,display_name:U,supported:E(),status:C(),label:C().optional(),message:C(),quota:H.describe("OpenRouter credits (`limit_remaining`, `usage`, `limit`), else null."),account_limits:bg.nullable().optional()}),Sg=A({availability:sg.optional(),version:T(),computed_at:C().describe(`ISO-8601 UTC request reference time; coalesced or stale sources retain their own computed_at.`),scope_id:C(),profile_id:C(),active_provider:U,requested_source_id:U,missing_source:E().describe("True when `?source=` names a source id this scope no longer has; `sources` is then empty."),sources:O(yg).describe("Each live source id exactly once, ordered by `provider_id`, then `account_label`, then `source_id`. Clients render this list as-is; a `?source=` read returns that one row.")}),Cg=A({date:C().describe("UTC day, `YYYY-MM-DD`."),used:W.describe(`Cumulative OpenRouter usage in USD that day.`),delta:W.describe("Spend since the previous day; the day's `used` after a credit reset; null for the first day or a missing `used`."),bar_percent:T().describe("Bar height: `delta` as a percent of the window's largest delta, at least 2 for any positive delta, 0 for a null delta.")}),wg=A({ok:E(),provider:U,display_name:C().optional(),supported:E().optional(),status:C().describe("`available`, `unavailable` (the snapshots are the last known data), `no_key`, `unsupported`, or `missing_provider`."),message:C(),window_days:T().int().optional(),snapshots:O(Cg).optional(),limit:W.optional(),label:U.optional(),monthly_budget:W.optional().describe("Settings `provider_cost_budget`."),monthly_pace:W.optional().describe(`Mean of the non-null deltas × 30, in USD rounded to cents; null without a delta.`),has_enough_data:E().optional().describe(`At least one non-null delta (two daily snapshots).`),budget_percent:W.optional().describe(`round(pace / budget × 100); null without a positive pace and a budget.`),budget_level:P([`ok`,`warn`,`over`]).nullable().optional().describe("`warn` from 80%, `over` from 100%; null without `budget_percent`.")}),Tg=A({personalities:O(A({name:C(),description:C().optional()}))}),Eg=A({task:C(),label:C(),description:C(),provider:C(),model:C(),base_url:C().optional(),api_key_set:E().optional(),is_auto:E(),value_label:C().nullable(),provider_label:C().nullable(),selected_option_id:C().nullable(),in_catalog:E(),inherit_from:C().nullable(),reasoning_effort:C().nullable()}),Dg=A({delegation:Dl.optional(),main:A({model:C().optional(),provider:C().optional(),base_url:C().optional(),api_key_set:E().optional(),service_tier:P([``,`default`,`priority`,`ultrafast`]).optional().describe(`Empty string is the Standard value returned by older servers.`),supported_speed_tiers:O(pu).optional()}),tasks:O(Eg)});A({max_tokens:W,max_tokens_effective:W,max_tokens_fallback:W});var Og=A({name:C().min(1),path:C()}),kg=A({workspaces:O(Og),last:U.optional(),terminal_remote_backend:E().optional()}),Ag=A({read_only:E().optional(),name:C(),path:C().optional(),is_dir:E().optional(),type:C().optional(),size:T().nullable().optional(),mtime:T().nullable().optional(),mtime_ns:j([T(),C()]).nullable().optional(),birthtime_ns:j([T(),C()]).nullable().optional(),hidden:E().optional(),workspace_sort_rank:T().int().optional(),target:C().optional(),target_outside_workspace:E().optional()}),jg=P([`workspace`,`managed`]),Mg={source:jg.optional(),read_only:E().optional(),write_semantics:F(`unconditional`).optional()},Ng=A({...Mg,unavailable:E().optional(),path:C().optional(),entries:O(Ag),signature:C().optional(),workspace:C().optional(),workspace_recovered:E().optional(),is_git:E().optional()}),Pg=P([`text`,`markdown`,`csv`,`html`,`image`,`pdf`,`audio`,`video`,`binary`]),Fg=A({...Mg,name:C().optional(),path:C().optional(),content:C().optional(),lines:T().optional(),size:T().optional(),truncated:E().optional(),binary:E().optional(),mime:C().optional(),preview:Pg.optional(),table:O(O(C())).optional(),table_truncated:E().optional(),preview_url:C().optional()}),Ig=A({is_git:E().optional(),branch:U.optional(),dirty:T().optional(),modified:T().optional(),untracked:T().optional(),ahead:T().optional(),behind:T().optional()}),Lg=A({git:Ig.nullable().optional()}),Rg=A({skills:O(A({...zd.shape,name:C(),description:U.optional(),category:U.optional(),disabled:E().optional()})),categories:O(H).optional()}),zg=A({editable:E().optional(),name:C().optional(),content:C().optional(),path:C().optional(),linked_files:N(C(),O(C())).optional(),binary:F(!0).optional(),size:T().optional(),success:E().optional(),message:C().optional(),ok:E().optional()}),Bg=A({usage:N(C(),A({use_count:T().optional(),view_count:T().optional(),patch_count:T().optional()})),skill_names:O(C()).optional(),total_invocations:T().optional(),unique_skills_used:T().optional()}),Vg=A({memory:C(),user:C(),soul:C(),project_context:C().optional(),memory_path:C().optional(),user_path:C().optional(),soul_path:C().optional(),project_context_path:C().optional(),project_context_name:C().optional(),project_context_workspace:C().optional(),memory_mtime:W.optional(),user_mtime:W.optional(),soul_mtime:W.optional(),project_context_mtime:W.optional(),project_context_shadowed:O(H).optional(),external_notes_enabled:E().optional(),memory_revision:C(),user_revision:C(),soul_revision:C()}),Hg=A({id:C().optional(),name:C().optional(),title:C().optional(),label:C().optional(),text:C().optional(),content:C().optional(),created_at:T().optional()}),Ug=A({prompts:O(Hg)}),Wg=P([`web`,`ios`]),Gg=A({commands:O(A({name:C(),description:C().optional(),aliases:O(C()),args_hint:C().optional(),category:C().optional(),handler:P([`client`,`agent`,`prompt`]),clients:O(Wg),unsupported_message:C().optional(),cli_only:E().optional(),gateway_only:E().optional(),subcommands:O(H).optional(),exec:E().optional()}))}),Kg=A({file:C(),tail:T().optional(),lines:O(C()),truncated:E().optional(),total_bytes:T().optional(),mtime:W.optional(),hint:C().optional()}),qg=A({period_days:T().optional(),total_sessions:T().optional(),total_messages:T().optional(),total_tokens:T().optional(),total_input_tokens:T().optional(),total_output_tokens:T().optional(),total_cache_read_tokens:T().optional(),total_cache_hit_percent:W.optional(),total_cost:T().optional(),activity_by_day:O(A({day:C(),sessions:T()})).optional(),activity_by_hour:O(A({hour:T(),sessions:T()})).optional(),daily_tokens:O(A({date:C(),input_tokens:T().optional(),output_tokens:T().optional(),cache_read_tokens:T().optional(),cost:T().optional(),sessions:T().optional()})).optional(),models:O(A({model:C().optional(),sessions:T().optional(),tokens:T().optional(),cost:T().optional()})).optional()}),Jg=A({running:E(),enabled:C().optional(),url:C().optional(),browser_url:C().optional(),host:C().optional(),port:T().int().optional(),version:C().optional(),error:C().optional()}),Yg=k({running:E(),configured:E(),gateway_mode:Id.nullable(),platforms:O(k({name:C(),label:C()})),last_active:C(),session_count:T().int(),health:k({state:U,reason:U,gateway_state:U})}),Xg=k({ok:F(!0),action:P([`start`,`stop`,`restart`]),message:C(),status:Yg}),Zg=k({enabled:P([`auto`,`always`,`never`]),url:C()}),Qg=k({workspace:U,repo_root:U,selected_board_slug:U.optional(),git:Ig.nullable(),docs:k({project:Fg.nullable(),plan:Fg.nullable(),status:Fg.nullable(),blocker_resolver:Fg.nullable()}).partial(),handoff:N(C(),H).nullable(),active:N(C(),H).nullable(),heartbeat:N(C(),H).nullable(),onboarding:A({active:E(),doc_source:P([`project-os`,`root`])}).optional(),goal_summary:C()}),$g=k({agent_runtime_reason:P([`update_active`,`recovery_incomplete`,`source_changed`,`unknown`]).optional(),agent_update_state:C().optional(),retryable:E().optional(),restart_scheduled:E().optional()}),e_=A({chat:M(`available`,[k({available:F(!0),condition:lc()}),k({available:F(!1),condition:P([`sidecar_unavailable`,`agent_incompatible`,`agent_runtime_stale`]),...$g.shape})]).optional().describe(`Always sent since TAL-951; absent from older servers.`),alive:E().nullable().optional(),checked_at:C().optional(),details:A({state:C().optional(),reason:C().optional()}).optional(),gateway_chat:A({enabled:E().optional(),backend:C().optional(),base_url_configured:E().optional(),api_key_configured:E().optional()}).optional(),error:C().optional()}),t_=A({available:E().optional(),status:C().optional(),checked_at:C().optional(),cpu:H.nullable().optional(),memory:H.nullable().optional(),disk:A({percent:T().optional(),total_bytes:T().optional(),used_bytes:T().optional()}).nullable().optional(),errors:O(A({code:C().optional(),metric:C().optional()})).optional(),webui_runtime:H.optional()}),n_=P([`up_to_date`,`release_ready`,`commits_behind`,`local_changes`,`finish`,`manual`,`check_failed`,`off`,`unknown`]),r_=P([`supported`,`unchecked`]),i_=k({version:C().describe(`The release as shown: the Agent tag or the Web release tag.`),ref:C().describe("What `updates.apply`/`updates.force` accept back as `version`: the Agent tag or the Web semver."),sha:C().optional().describe(`Agent only: the commit the tag peels to.`),release_url:C().nullable(),latest:E().describe("The channel's newest release, the one an update without `version` installs."),folded:E().describe(`Shown behind the folded "more versions" node: every entry except the newest.`),support:r_.optional().describe(`Agent only: this release's classification against the verified Agent window.`),support_label:C().optional().describe("Agent only: `support` worded to fit one phone line.")}).describe(`TAL-946: one installable Stable release newer than the installed one.`),a_=A({failed_update:k({version:C(),restored_version:C()}).optional().describe(`Web only: the update that failed before HTTP readiness and the restored package version. Manual retry remains available.`),name:C().optional(),channel:Zh.optional(),unsupported:E().optional().describe("Deprecated (TAL-350): `support === 'unchecked'`, kept for older clients."),support:r_.optional().describe("Agent target only (TAL-350): `supported` when the target revision is exactly a release in the verified Agent window, else `unchecked`; an `unchecked` apply requires `confirmed_agent_revision`."),support_label:C().optional().describe("Agent target only (TAL-946): `support` worded to fit one phone line."),current_support:r_.optional().describe(`Agent target only: the same classification for the installed Agent revision.`),supported_revision:C().optional(),supported_version:C().optional(),candidate_revision:C().optional(),behind:T().nullable().optional(),current_sha:C().nullable().optional(),latest_sha:C().nullable().optional(),compare_url:C().optional(),repo_url:C().optional(),error:C().optional(),ok:E().optional(),manual_update:E().optional(),no_git:E().optional(),install_kind:F(`npm`).optional(),npm:C().optional(),channel_switch:E().optional(),dirty:E().optional(),metadata_repair:E().optional(),release_url:C().optional(),ignored:E().optional(),stale_check:E().optional(),current_version:C().optional(),state:n_.describe("TAL-559: the status clients word; `off` when checks are disabled or Agent updates are ignored."),can_apply:E().describe(`The apply action is available for this target.`),installed_unverified:E().describe("`release_ready` only: the installed revision sits on no release tag."),manual_link:E().describe(`Show the manual-install (releases) link.`),target_version:C().nullable().describe(`The version the update path leads to, when one is shown.`),summary_available:E().describe('TAL-759: offer "Summarize with AI" for this target (`release_ready` or `commits_behind`).'),versions:O(i_).describe("TAL-946: every installable Stable release newer than the installed one, newest first; empty unless `release_ready` can apply."),folded_count:T().int().nonnegative().describe("How many `versions` are `folded`.")}),o_=A({agent_recovery:k({phase:P([`idle`,`running`,`waiting`,`complete`,`blocked`]),attempt:T().int().nonnegative(),detail:C(),retry_at:C().nullable(),operation_id:Bs().optional(),operation:ml.optional(),verified_revision:C().regex(/^[a-f0-9]{40}$/).optional(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional()}).optional(),disabled:E().optional(),cached:E().optional(),channel:C().optional(),agent_channel:P([`stable`,`experimental`]).optional(),checked_at:T().optional(),include_agent:E().optional(),webui:a_.nullable().optional(),agent:a_.nullable().optional()}),s_=k({ok:E(),target:P([`webui`,`agent`]),summary:C(),current_version:C().nullable().describe(`The installed version this summary starts from.`),target_version:C().nullable().describe(`The version this summary leads to, when the update names one.`),summary_sections:O(k({title:C(),items:O(C())})).describe(`Display-ready headed bullet lists; empty when nothing is pending.`),generated_by:P([`llm`,`fallback`,`none`]).describe("`fallback` when no model answered; `none` when the target has no pending update to summarize."),source:P([`release_notes`,`commits`,`none`]).describe(`Stable targets summarize the release notes they install; commit-tracking targets, or unreadable notes, use commit subjects.`),cached:E()}),c_=A({recovery_only:E().optional().describe(`Only a retained transaction was repaired; the selected update outcome remains unverified.`),recovery_pending:E().optional().describe(`The initiating operation remains active through automatic recovery; follow its notification_id without replaying the update.`),verified_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional(),recovery_compatibility:k({manual_execution:E(),bot_chat_delivery:E()}).optional().describe(`Whether the target Agent can reconcile retained manual execution and pending Bot Chat records. A false value blocks the update before any source or repair-intent change.`),ok:E().optional(),status:C().optional(),error:C().optional(),message:C().optional(),lock:H.optional(),confirmation_required:E().optional(),refresh_confirmation:_l.optional(),candidate_revision:C().optional(),supported_revision:C().optional(),supported_version:C().optional(),agent_channel:P([`stable`,`experimental`]).optional(),notification_id:Bs().optional(),channel_switch:E().optional(),backup_dir:C().nullable().optional(),backup_failed:E().optional(),stash_conflict:E().optional(),gateway_restart:C().optional().describe("TAL-953: `waiting_for_idle` when an Agent update left the gateway restart to wait for the gateway's running work; the update notification reports its outcome.")}),l_=P([`applying`,`awaiting_confirmation`,`waiting_for_idle`,`restarting`,`verifying`,`recovering`,`succeeded`,`blocked`,`failed`,`unknown`]),u_=k({id:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),label:C().min(1).max(80),style:P([`default`,`primary`,`destructive`]),acknowledges:E()}),d_=k({key:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_.-]*$/),label:C().min(1).max(80)}),f_=k({id:P([`install`,`web_restart`,`ready`,`gateway_wait`,`gateway_restart`,`agent_ready`,`recovery`]),label:C().min(1).max(80),state:P([`done`,`active`,`pending`,`failed`])}),p_=k({operation:ml,attempt_error:C().max(2e3).nullable(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),rollback:E().nullable().optional(),outcome:P([`recovering`,`target_installed`,`baseline_restored`,`other_revision`,`blocked`,`unknown`])}),m_=k({id:Bs(),kind:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),target:P([`webui`,`agent`]).nullable(),phase:j([l_,C().min(1).max(64)]),severity:P([`info`,`warning`,`critical`]),persistent:E(),requires_acknowledgement:E(),actions:O(u_).max(4),destination:d_.nullable(),title:C(),message:C(),created_at:Yc(),updated_at:Yc(),read_at:Yc().nullable(),acknowledged_at:Yc().nullable(),acknowledged_action_id:C().nullable(),verified_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),verified_version:C().min(1).max(80).nullable(),detail:C().max(2e3).nullable(),recovery:p_.optional(),unread:E(),active:E(),requires_interaction:E(),can_dismiss:E(),steps:O(f_).max(8),presents_dialog:E(),dialog_close:P([`none`,`close`,`restart_later`,`auto`])}),h_=C().regex(/^[a-f0-9]{64}$/),g_=C().regex(/^[A-Za-z0-9_-]{8,64}$/),__=k({current_build:h_.nullable(),loaded_build:h_.nullable(),refresh_required:E(),notification_id:Bs().nullable()}),v_=k({scope_id:C().min(1).max(64),frontend_build:__,notifications:O(m_),tab_update:m_.nullable(),tab_joined_at:Yc().nullable(),unread_count:T().int().nonnegative(),clearable_count:T().int().nonnegative(),can_clear:E()}),y_=td.extend({locked:E().optional()}),b_=id.extend({can_sign_out:E()}),x_=A({plugins:O(A({key:C(),name:C().optional(),kind:C().optional(),enabled:E().optional(),description:C().optional(),version:C().optional(),activation:C().optional(),is_active_provider:E().optional(),hooks:O(H).optional(),update:k({available:E(),latest_revision:C().optional()}).optional(),settings:O(y_).optional(),oauth_clients:O(b_).optional()})),empty:E().optional(),read_only:E().optional(),supported_hooks:O(C()).optional(),unavailable:E().optional(),plugin_isolation_advisory:E().optional()}),S_=A({cost_policy:iu.nullable().optional(),name:C(),id:C().optional(),transport:C().optional(),enabled:E().optional(),can_toggle:E().optional().describe(`Whether PATCH can enable or disable this server; false for invalid config.`),active:E().optional(),status:C().optional(),tools:T().optional(),tool_count:T().int().nullable().optional(),health:C().optional(),health_detail:C().optional(),health_checked_at:H.optional(),health_pending:E().optional()}),C_=A({servers:O(S_),health_pending:E().optional(),reload_required:E().optional(),toggle_supported:E().optional()}),w_=k({connection_id:C(),name:C(),problem:P([`pending`,`failed`,`expired`,`revoked`,`inactive`]).nullable(),status_reason:C().nullable(),active:E(),created_at:C()}),T_=k({slug:C(),name:C(),description:C(),category:C(),logo_url:C().nullable(),connected:E(),accounts:O(w_),enabled:E(),org_locked:E(),rules_editable:E(),tools_off:T().int()}),E_=k({available:E(),due:E().describe(`The native eligible due check at this read; an already delivered offer remains visible independently.`),visible:E(),offer_id:C().nullable(),actions:O(P([`sign_in`,`dismiss`])),refresh_after:T().int().positive().nullable()}),D_=k({available:E(),sign_in_required:E().default(!1),sign_in_offer:E_.optional(),connectors:O(T_),policy_revision:C().nullable(),rules_error:C().nullable()}),O_=k({connector:C(),policy_revision:C().nullable(),tools:O(k({slug:C(),name:C(),description:C(),facet:P([`read`,`write`,`destructive`,`unclassified`]),deprecated:E(),enabled:E(),locked:E(),editable:E()}))}),k_=k({op_id:C(),settled:E(),outcome:P([`connected`,`not_connected`]).nullable(),can_continue:E(),tool_call_id:C().nullable(),targets:O(k({name:C(),title:C(),kind:C(),state:P([`pending`,`initiated`,`connected`,`skipped`,`failed`,`expired`,`not_connected`]),detail:C(),connect_url:C().nullable(),actions:O(P([`skip`,`retry`,`approve`])),env_fields:O(k({name:C(),label:C(),required:E(),secret:E()}))}))}),A_=A({tools:O(A({name:C().optional(),server:C().optional(),description:C().optional()})),total:T().int().optional(),source:C().optional(),inventory_scope:C().optional(),unavailable_servers:O(C()).optional()}),j_=A({enabled:E().optional(),sources:O(H).optional(),source:C().optional(),inventory_scope:C().optional(),recent_ai_notes:O(H).optional(),attach_supported:E().optional(),automatic_recall_unchanged:E().optional()}),M_=k({id:C(),title:C(),snippet:C(),parent_id:C(),updated_time:H,source:F(`joplin`)}),N_=k({source:F(`joplin`),query:C(),results:O(M_)}),P_=k({source:F(`joplin`),note:k({id:C(),title:C(),body:C(),parent_id:C(),updated_time:H,created_time:H,source:F(`joplin`)})}),F_=k({available:E(),enabled:E(),status:P([`missing`,`not_directory`,`ready`,`empty`,`error`]),entry_count:T().int(),page_count:T().int(),raw_source_count:T().int(),last_updated:C().nullable(),last_writer:C(),path_configured:E(),path_source:C(),toggle_available:F(!1),toggle_reason:C(),docs_url:C(),error:C().optional()}),I_=k({pages:O(k({name:C(),path:C(),size:T().int(),mtime:T().int()}))}),L_=k({content:C(),path:C()}),R_=A({id:C(),name:C().optional(),label:C().optional(),kind:C().optional(),oauth:E().optional(),needs_key:E().optional(),base_url:U.optional(),models:O(H).optional(),category:C().optional(),default_model:C().optional(),oauth_flow:F(`device_code`).nullable().optional(),oauth_label:C().optional(),signed_in:E().optional()}),z_=A({completed:E(),settings:A({bot_name:C().optional(),default_model:C().optional(),default_workspace:U.optional(),password_enabled:E().optional()}).optional(),setup:A({providers:O(R_).optional(),categories:O(H).optional(),current:A({provider:C().optional(),model:C().optional(),base_url:C().optional()}).optional(),current_is_oauth:E().optional(),unsupported_note:C().optional()}).optional(),system:A({hermes_found:E().optional(),imports_ok:E().optional(),chat_ready:E().optional(),provider_ready:E().optional(),provider_configured:E().optional(),setup_state:C().optional(),provider_note:C().optional(),provider_note_key:C().optional(),missing_modules:O(C()).optional(),import_errors:N(C(),C()).optional(),config_path:C().optional(),env_path:C().optional()}).optional(),workspaces:A({items:O(Og).optional(),last:U.optional()}).optional(),models:lg.optional()}),B_=A({ok:E().optional(),success:E().optional(),error:C().optional(),message:C().optional(),models:O(H).optional()}),V_=A({nous_account:qd.nullable().optional(),ok:E().optional(),status:C().optional(),url:C().optional(),verification_url:C().optional(),user_code:C().optional(),message:C().optional(),error:C().nullable().optional(),flow_id:C().optional(),provider:C().optional(),expires_in:T().int().optional(),interval:T().int().optional(),authorize_host:C().optional(),token_host:C().optional(),redirect_uri:C().optional()}),H_=A({kind:C().optional(),expr:C().optional(),minutes:T().optional(),run_at:C().optional(),display:C().optional()}),U_=A({times:W.optional(),completed:T().optional()}),W_=P([`needs_attention`,`schedule_error`,`paused`,`off`,`error`,`active`]),G_=A({read_only:E().optional(),owner_profile:U.optional(),id:C().optional(),job_id:C().optional(),name:C().nullable().optional(),prompt:C().optional(),schedule:j([C(),H_]).optional(),schedule_display:C(),schedule_input:C(),enabled:E().optional(),paused:E().optional(),paused_reason:U.optional(),state:U.optional(),last_status:U.optional(),last_error:U.optional(),last_delivery_error:U.optional(),next_run_at:j([C(),T(),lc()]).optional(),last_run_at:j([C(),T(),lc()]).optional(),repeat:j([U_,T(),lc()]).optional(),status:C().optional(),last_run:H.optional(),next_run:H.optional(),profile:U.optional(),session_id:U.optional(),model:U.optional(),provider:U.optional(),model_option_id:U.optional(),workspace:U.optional(),workdir:U.optional(),deliver:U.optional(),skills:O(C()).optional(),no_agent:E().optional(),script:U.optional(),monitor:U.optional(),continuity:E().optional(),context_from:j([O(C()),C(),lc()]).optional(),reasoning_effort:U.optional(),toast_notifications:E().optional(),running:E().optional(),derived_state:W_.optional(),needs_attention:E().optional(),resumable:E().optional(),attention_hint:P([`croniter_missing`]).nullable(),last_failure:k({at:T().nullable(),detail:C()}).nullable()}),K_=k({profile:C(),store:C(),error:C(),fix:C(),since:T().nullable()}),q_=A({jobs:O(G_),ordered:E().optional(),active_profile:C().optional(),all_profiles:E().optional(),other_profile_count:T().optional(),cron_unavailable:E().optional(),unwritable_stores:O(K_)}),J_=k({profile:C(),sources:O(k({job_id:C(),label:C(),selectable:E()}))}),Y_=k({completions:O(k({job_id:C(),name:C().nullable(),status:C().nullable(),outcome:P([`succeeded`,`failed`,`unknown`]),completed_at:T(),toast_notifications:E(),session_id:C(),message_count:T().int().optional()})),since:T()}),X_=A({ok:E().optional(),job:G_.optional(),job_id:C().optional(),status:C().optional(),error:C().optional(),elapsed:T().optional()}),Z_=A({input_tokens:W.optional(),output_tokens:W.optional(),total_tokens:W.optional(),estimated_cost_usd:W.optional(),duration_seconds:W.optional(),model:C().optional(),provider:C().optional()}),Q_=A({filename:C(),size:T(),modified:T(),usage:Z_.optional()}),$_=A({job_id:C().optional(),runs:O(Q_),total:T().optional(),offset:T().optional()}),ev=A({content:C().optional(),snippet:C().optional(),response:C().optional(),usage:Z_.optional(),error:C().optional()}),tv=A({running:j([E(),N(C(),T())]).optional()}),nv={available_actions:k({block:E(),unblock:E(),complete:E(),archive:E(),move_to:O(C())}),requires_running_exit_confirmation:E()},rv=A({id:j([C(),T()]),title:C().optional(),status:C().optional(),assignee:U.optional(),priority:j([C(),T()]).nullable().optional(),description:C().optional(),tags:O(C()).optional(),session_id:U.optional(),archived:E().optional(),created_at:H.optional(),updated_at:H.optional(),...nv}),iv=A({name:C(),label:C(),tasks:O(rv)}),av=Ad.extend({nodes:O(kd.extend({task:rv,ancestors:O(C()),descendants:O(C()),cycle:E(),running_lineage:E(),timing:k({start:T().nullable(),end:T().nullable(),duration_seconds:T().nullable(),offset:T().nullable(),width:T().nullable()})})).max(500),window:k({start:T().nullable(),end:T().nullable()})}),ov=k({assignee:C().nullable(),count:T().int(),columns:O(iv)}),sv=A({columns:O(iv).optional(),assignees:O(H).optional(),filters:H.optional(),latest_event_id:T().optional(),read_only:E().optional(),tenants:O(H).optional(),changed:E().optional(),bulk_move_targets:O(C()),create_statuses:O(C()),lane_by_profile:E(),lanes:O(ov).optional()}),cv=A({boards:O(A({slug:C(),name:C().nullable().optional(),is_current:E().optional(),total:T().optional(),archived:E().optional(),color:C().optional(),icon:C().optional(),description:C().optional(),removable:E()})),current:C().optional(),read_only:E().optional()}),lv=A({by_status:N(C(),T()),total:T().int(),status_counts:O(k({status:C(),count:T().int()}))}),uv=A({enabled:E(),extension_dir_configured:E().optional(),extension_dir_valid:E().optional(),script_urls:O(C()).optional(),stylesheet_urls:O(C()).optional(),sidecars:O(H).optional(),extensions:O(A({id:C(),enabled:E().optional(),name:C().optional(),version:C().optional()})).optional(),warnings:O(H).optional(),manifest:A({configured:E().optional(),loaded:E().optional(),status:C().optional(),entry_count:T().optional()}).optional(),counts:N(C(),T()).optional(),gallery_installed:N(C(),H).optional()}),dv=C().nullable(),fv=k({error:C(),condition:C().optional(),type:C().optional(),...$g.shape}).catchall(D()),pv=k({auth_enabled:E(),logged_in:E(),oidc_enabled:E(),oidc_native_handoff_enabled:E(),oidc_unavailable:E(),password_auth_enabled:E(),passwordless_enabled:E(),passkeys_enabled:E(),passkeys_count:T().int(),passkey_feature_flag:E(),auth_disabled_acknowledged:E(),can_manage_server:E(),trusted_auth_enabled:E().optional(),auth_type:C().optional(),user:dv.optional(),bound_profile:dv.optional()}),mv=k({dashboard:E(),terminal_remote_backend:E(),extensions:E(),single_profile_mode:E()}),hv=k({webui_version:C(),max_upload_bytes:T().int().positive(),csrf_token:C(),language:C(),bot_name:C(),assistant_name:C(),auth:pv,profile:k({name:C(),is_default:E()}).nullable(),onboarding:k({completed:E()}).nullable(),features:mv}),gv=C().regex(/^[a-f0-9]{40}$/),_v=k({release:k({tag:C().nullable(),version:C(),sourceRevision:gv.nullable(),releaseSet:gv.nullable(),contracts:k({appWeb:O(T().int()),webRelay:O(T().int())}),compatibleAgent:k({sourceRevision:gv,version:C(),image:C()}).catchall(D())}),status:P([`ok`,`degraded`,`starting`]),phase:C().optional(),sessions:T().int(),active_streams:T().int(),active_runs:T().int(),runs:O(N(C(),D())),last_run_finished_at:T().nullable(),server_started_at:T(),uptime_seconds:T(),accept_loop:k({requests_total:T().int(),last_request_at:T()}),checks:N(C(),D()).optional(),agent:k({status:P([`ready`,`starting`,`restarting`,`incompatible`,`stopped`,`unavailable`])})}),vv=k({password:C().optional()}),yv=k({ok:F(!0),trusted_logout_url:C().optional()}),bv=k({callback_url:C(),state:C(),code_challenge:C(),code_challenge_method:C()}),xv=k({flow_id:C(),authorization_url:C(),server_id:C(),expires_in:T().int()}),Sv=k({flow_id:C(),code:C(),state:C(),code_verifier:C()}),Cv=k({flow_id:C(),state:C()}),wv=k({ok:F(!0)}),Tv=k({ok:E()}),Ev=k({ok:F(!0),publicKey:N(C(),D())}),Dv=k({id:C(),label:C(),created_at:T(),last_used_at:T().nullable(),sign_count:T().int()}),Ov=k({id:C().optional(),rawId:C().optional(),type:C().optional(),name:C().optional(),response:N(C(),D()).optional()}).catchall(D()),kv=k({ok:F(!0),credential:k({id:C(),label:C()}),credentials:O(Dv)}),Av=k({ok:F(!0)}),jv=k({id:C()}),Mv=k({ok:F(!0),credentials:O(Dv)}),Nv=k({credentials:O(Dv),disabled:E().optional()}),Pv={health:V.route({method:`GET`,path:`/health`,tags:[`core`],summary:"Liveness and release identity; `deep=1` adds startup and store probes."}).input(k({deep:C().optional()})).output(_v),bootstrap:V.route({method:`GET`,path:`/api/bootstrap`,tags:[`core`],summary:`Public runtime configuration and initial state for the shell.`}).output(hv),auth:{status:V.route({method:`GET`,path:`/api/auth/status`,tags:[`auth`]}).output(pv),login:V.route({method:`POST`,path:`/api/auth/login`,tags:[`auth`]}).input(vv).output(Xh),logout:V.route({method:`POST`,path:`/api/auth/logout`,tags:[`auth`]}).output(yv),oidcNativeStart:V.route({method:`POST`,path:`/api/auth/oidc/native/start`,tags:[`auth`],summary:`Begin a native-app OIDC handoff (S256 PKCE, rate limited per client IP).`}).input(bv).output(xv),oidcNativeExchange:V.route({method:`POST`,path:`/api/auth/oidc/native/exchange`,tags:[`auth`],summary:`Redeem the one-time native handoff code for a session cookie.`}).input(Sv).output(wv),oidcNativeCancel:V.route({method:`POST`,path:`/api/auth/oidc/native/cancel`,tags:[`auth`],summary:`Abandon a pending native handoff.`}).input(Cv).output(Tv),passkeyOptions:V.route({method:`POST`,path:`/api/auth/passkey/options`,tags:[`auth`],summary:`WebAuthn assertion options for login (public; CSRF exempt).`}).output(Ev),passkeyLogin:V.route({method:`POST`,path:`/api/auth/passkey/login`,tags:[`auth`],summary:`Verify a passkey assertion and start a session (public; CSRF exempt).`}).input(Ov).output(Av),passkeyRegisterOptions:V.route({method:`POST`,path:`/api/auth/passkey/register/options`,tags:[`auth`],summary:`WebAuthn creation options (owner session or local first-run bootstrap).`}).output(Ev),passkeyRegister:V.route({method:`POST`,path:`/api/auth/passkey/register`,tags:[`auth`],summary:`Store a new ES256 passkey credential.`}).input(Ov).output(kv),passkeyDelete:V.route({method:`POST`,path:`/api/auth/passkey/delete`,tags:[`auth`],summary:`Remove a passkey; the last one is kept while no password is set (409).`}).input(jv).output(Mv),passkeys:V.route({method:`GET`,path:`/api/auth/passkeys`,tags:[`auth`],summary:"Registered passkey metadata (`disabled: true` when the feature flag is off)."}).output(Nv),passkeysPost:V.route({method:`POST`,path:`/api/auth/passkeys`,tags:[`auth`],summary:`Legacy POST form of the passkey list (owner only).`}).output(Nv)}},G=D(),Fv=k({ok:F(!0)}).catchall(G),Iv=k({error:C(),type:F(`model_confirmation_required`),warnings:O(Hu).min(1),confirm_token:C().min(1)}),Lv=k({session_id:am}),Rv=k({session_id:C()}),zv=k({ok:F(!1),confirm_required:F(!0),discard_user_turns:T().int(),discard_messages:T().int(),confirm_token:C()}),Bv=k({include_archived:C().optional(),all_profiles:C().optional(),exclude_hidden:C().optional(),sidebar_source:C().optional(),archived_limit:C().optional(),archived_offset:C().optional(),show_cli_sessions:C().optional(),show_claude_code_sessions:C().optional(),show_cron_sessions:C().optional(),show_webhook_sessions:C().optional(),show_kanban_sessions:C().optional()}),Vv=Bv.omit({archived_limit:!0,archived_offset:!0}).extend({q:C().optional(),content:C().optional(),depth:C().optional(),project_id:C().optional()}),Hv=k({session_id:C(),messages:C().optional(),msg_limit:C().optional(),msg_before:C().optional(),resolve_model:C().optional(),expand_renderable:C().optional()}),Uv=k({action:P([`archive`,`unarchive`,`delete`]),session_ids:O(am).min(1).max(200).refine(e=>new Set(e).size===e.length,`session_ids must be unique`)}),Wv=k({results:O(k({session_id:C(),ok:E(),status:T().int().optional(),error:C().optional(),state_db_cleanup_failed:E().optional(),refused:Md.optional()}))}),Gv=k({session_id:C().optional(),since:G.optional()}),Kv=k({ok:F(!0),rounds:T().int(),threshold:T().int(),should_show:E()}),qv=k({ok:F(!0),summary:C(),message_count:T().int(),rounds:T().int(),fallback:E(),warning:C().optional()}),K=[`sessions`],Jv=A({headline:C().optional(),token_line:C().optional(),note:C().nullable().optional(),reference_message:C().nullable().optional()}),Yv=k({session_id:C().optional(),focus_topic:C().nullable().optional(),topic:C().nullable().optional()}),Xv=A({ok:F(!0),session:Qm,summary:Jv,focus_topic:C().nullable()}),Zv=A({ok:E().optional(),status:P([`running`,`done`,`error`,`idle`]),session_id:C().nullable().optional(),focus_topic:C().nullable().optional(),session:Qm.optional(),summary:Jv.optional(),error:C().optional(),error_status:T().int().optional(),type:C().optional(),...$g.shape,started_at:T().optional(),updated_at:T().optional()}),Qv=k({session_id:C(),role:P([`tip`,`hidden_segment`,`child_session`]),title:C().nullable(),source:C().nullable(),started_at:T().nullable(),updated_at:T().nullable(),end_reason:C().nullable(),active:E(),archived:E()}),$v=k({mutation:F(!1),found:F(!0),session_id:C(),lineage_key:C(),tip_session_id:C(),total_segments:T().int(),materialized_segments:T().int(),segments:O(Qv),children:O(Qv),manual_review:E()}),ey=k({ok:F(!0),session:Qm,source_session_id:C(),recommended_recovery_action:C(),message:C()}),ty=k({session_id:C(),kind:P([`shrunken_live`,`unstamped_legacy_backup`,`malformed_orphan_backup`,`orphan_backup`,`orphan_backup_without_state_row`,`state_db_deleted_webui_tombstone`,`index_unreadable`,`index_missing_file`,`index_missing_entry`,`state_db_orphan_webui_row`,`state_db_missing_sidecar`,`state_db_unreadable`,`turn_journal_pending_turn`]),category:P([`repairable`,`unsafe_to_repair`]),recommendation:P([`restore_from_bak`,`manual_review`,`deleted_session_skipped`,`rebuild_index`,`materialize_from_state_db`,`audit_only_pending_turn_journal`]),live_messages:T().int(),bak_messages:T().int(),turn_id:C().optional(),event:C().optional()}),ny=k({status:P([`ok`,`warn`,`needs_manual_review`]),summary:k({ok:T().int(),repairable:T().int(),unsafe_to_repair:T().int()}),items:O(ty)}),ry=k({clean:E(),ok:E(),repaired:T().int(),before:ny,backup_repair:k({scanned:T().int(),restored:T().int(),orphaned_backups:T().int(),details:O(k({session_id:C(),restored:E(),live_messages:T().int().optional(),bak_messages:T().int().optional(),skipped:C().optional(),error:C().optional()}))}),sidecar_repair:k({scanned:T().int(),materialized:T().int(),details:O(k({session_id:C(),materialized:E(),messages:T().int().optional(),skipped:C().optional(),error:C().optional()}))}),after:ny}),iy={sessions:{references:V.route({method:`GET`,path:`/api/sessions/references`,tags:K,summary:`Bounded same-profile title search for new-chat references; no transcript snippets.`}).input(k({q:C().max(200).optional()})).output(Wh),list:V.route({method:`GET`,path:`/api/sessions`,tags:K,summary:`Sidebar rows for the active profile.`}).input(Bv).output(ih),search:V.route({method:`GET`,path:`/api/sessions/search`,tags:K,summary:`Title, metadata and content matches; any sidebar filter answers from the /api/sessions rows, in their order.`}).input(Vv).output(A({sessions:O(nh),query:C().optional(),count:T().int().optional(),all_profiles:E(),active_profile:C(),sidebar_filtered:E().optional()})),bulk:V.route({method:`POST`,path:`/api/sessions/bulk`,tags:K,summary:`Archive, unarchive or delete up to 200 sessions, one ordered result per id.`}).input(Uv).output(Wv),cleanup:V.route({method:`POST`,path:`/api/sessions/cleanup`,tags:K,summary:`Delete empty Untitled sessions and index rows with no session file.`}).input(k({}).catchall(G)).output(k({ok:F(!0),cleaned:T().int()})),cleanupZeroMessage:V.route({method:`POST`,path:`/api/sessions/cleanup_zero_message`,tags:K}).input(k({}).catchall(G)).output(k({ok:F(!0),cleaned:T().int()}))},session:{get:V.route({method:`GET`,path:`/api/session`,tags:K,summary:`One session with a bounded message window.`}).input(Hv).output($m),status:V.route({method:`GET`,path:`/api/session/status`,tags:K}).input(Rv).output(ah),contextDetail:V.route({method:`GET`,path:`/api/session/context-detail`,tags:K,summary:`Read bounded, safe allocation estimates and context-file metadata from the existing Agent only.`}).input(Rv.extend({context_detail_key:C().min(1).max(128)})).output(su),usage:V.route({method:`GET`,path:`/api/session/usage`,tags:K}).input(Rv).output(oh),new:V.route({method:`POST`,path:`/api/session/new`,tags:K}).input(Gh).output($m.extend({worktree_skipped:C().optional()})),executionModes:V.route({method:`GET`,path:`/api/session/execution-modes`,tags:K,summary:`TAL-1040: which execution modes a fresh chat in the active profile can start in now.`}).input(k({})).output(Lu),rename:V.route({method:`POST`,path:`/api/session/rename`,tags:K}).input(Lv.extend({title:C()})).output($m),delete:V.route({method:`POST`,path:`/api/session/delete`,tags:K,summary:"Delete a session and its Agent state.db rows. 409 with `refused: active_turn` while another Agent process runs or compresses it, or `runtime_history_unsupported` when this Agent cannot retire retained history; the session is kept."}).input(k({session_id:C()})).output(lh),pin:V.route({method:`POST`,path:`/api/session/pin`,tags:K}).input(Lv.extend({pinned:E().optional()})).output(Fv.extend({session:nh})),archive:V.route({method:`POST`,path:`/api/session/archive`,tags:K}).input(Lv.extend({archived:E().optional()})).output(Fv.extend({session:nh})),move:V.route({method:`POST`,path:`/api/session/move`,tags:K}).input(Lv.extend({project_id:C().nullable().optional()})).output(Fv.extend({session:nh})),duplicate:V.route({method:`POST`,path:`/api/session/duplicate`,tags:K}).input(k({session_id:C()})).output($m),branch:V.route({method:`POST`,path:`/api/session/branch`,tags:K}).input(Lv.extend({keep_count:T().int().nullable().optional(),title:C().nullable().optional()})).output(k({session_id:C(),title:C(),parent_session_id:C()})),truncate:V.route({method:`POST`,path:`/api/session/truncate`,tags:K,description:"TAL-929: a cut that discards more than one user turn changes nothing and answers `confirm_required` with the counts to confirm, until resent with `confirm_deep_truncate` and the `confirm_token` of those same rows. A body without `confirm_deep_truncate` (a released App, which asks on the device) cuts at once; 503 when the profile's state.db cannot be read."}).input(Lv.extend({keep_count:G.optional(),confirm_deep_truncate:E().optional(),confirm_token:C().optional()})).output(Fv.extend({session:nh}).or(zv)),clear:V.route({method:`POST`,path:`/api/session/clear`,tags:K}).input(Lv).output(Fv.extend({session:nh})),retry:V.route({method:`POST`,path:`/api/session/retry`,tags:K,description:"`last_user_text` is the stored row's text; `last_user_prompt` and `last_user_attachments` are what to resend as the new turn."}).input(Lv).output(k({ok:F(!0),last_user_text:C(),last_user_prompt:C().optional(),last_user_attachments:O(om).optional(),removed_count:T().int()}).or(k({error:C()}))),undo:V.route({method:`POST`,path:`/api/session/undo`,tags:K}).input(Lv).output(k({ok:F(!0),removed_count:T().int(),removed_preview:C()}).or(k({error:C()}))),update:V.route({method:`POST`,path:`/api/session/update`,tags:K}).input(Lv.extend({workspace:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),confirm_token:C().optional()})).output($m),toolsets:V.route({method:`POST`,path:`/api/session/toolsets`,tags:K}).input(Lv.extend({toolsets:O(C()).nullable().optional()})).output(k({ok:F(!0),enabled_toolsets:O(C()).nullable()})),yoloGet:V.route({method:`GET`,path:`/api/session/yolo`,tags:K}).input(Rv).output(k({yolo_enabled:E()})),yoloSet:V.route({method:`POST`,path:`/api/session/yolo`,tags:K}).input(k({session_id:C(),enabled:G.optional()})).output(k({ok:F(!0),yolo_enabled:E(),stale_cleared:E().optional()})),import:V.route({method:`POST`,path:`/api/session/import`,tags:K}).input(k({messages:G.optional(),tool_calls:G.optional(),title:C().nullable().optional(),workspace:C().nullable().optional(),model:C().nullable().optional(),pinned:E().nullable().optional()}).catchall(G)).output(Fv.extend({session:nh})),regenerateTitle:V.route({method:`POST`,path:`/api/session/title/regenerate`,tags:K,summary:`Generate a title from the first (or latest) complete exchange through the auxiliary model and persist it.`}).input(Lv.extend({prefer_latest:E().optional()})).output(A({session:nh,title:C(),status:C(),raw_preview:C()})),recoveryAudit:V.route({method:`GET`,path:`/api/session/recovery/audit`,tags:K,summary:`Owner only. Read-only audit of session backups, the index, state.db rows without a sidecar, and pending turn journals.`}).input(k({})).output(ny),recoveryRepairSafe:V.route({method:`POST`,path:`/api/session/recovery/repair-safe`,tags:K,summary:`Owner only. Apply the repairable findings and audit again; 409 with the same body unless the result is clean.`}).input(k({}).catchall(G)).output(ry),lineageReport:V.route({method:`GET`,path:`/api/session/lineage/report`,tags:K,summary:`Read-only compression lineage of a state.db session; 404 when the active profile's state.db lacks it.`}).input(k({session_id:C().optional()})).output($v),compressionRecoveryStart:V.route({method:`POST`,path:`/api/session/compression-recovery/start`,tags:K,summary:`Open the focused continuation of a compression-exhausted session; a retry reuses the existing one.`}).input(k({session_id:C().optional()})).output(ey),compress:V.route({method:`POST`,path:`/api/session/compress`,tags:K,summary:"Compress the session's model context now (iOS `/compress`). `focus_topic` (alias `topic`) is capped at 500 characters."}).input(Yv).output(Xv),compressStart:V.route({method:`POST`,path:`/api/session/compress/start`,tags:K,summary:"Start (or join) the session's manual compression job; poll `compress/status`."}).input(Yv).output(Zv),compressStatus:V.route({method:`GET`,path:`/api/session/compress/status`,tags:K}).input(Rv).output(Zv),conversationRounds:V.route({method:`POST`,path:`/api/session/conversation-rounds`,tags:K,summary:`Count the session's conversation rounds in state.db and whether the handoff dock is due.`}).input(Gv).output(Kv),handoffSummary:V.route({method:`POST`,path:`/api/session/handoff-summary`,tags:K,summary:`Summarize the session's recent conversation for a handoff and append the summary card; needs the dock's round threshold.`}).input(Gv).output(qv),draftGet:V.route({method:`GET`,path:`/api/session/draft`,tags:K}).input(Rv).output(k({draft:Ah,draft_version:C().nullable()})),draftSave:V.route({method:`POST`,path:`/api/session/draft`,tags:K}).input(k({session_id:C(),text:G.optional(),files:G.optional(),draft_version:G.optional()})).output(jh),anchorSceneGet:V.route({method:`GET`,path:`/api/session/anchor-scene`,tags:K}).input(k({session_id:C(),message_ref:C().optional(),message_index:C().optional(),before:C().optional(),limit:C().optional()})).output(k({scene_ref:C(),rows:O(bm),start:T().int(),end:T().int(),total:T().int(),complete:E()})),outboundDraft:V.route({method:`GET`,path:`/api/session/outbound-draft`,tags:K,summary:`Resolve a registered producer draft through its session tool result. A directive alone grants nothing.`}).input(Xl.extend({card:Xc().int().positive()})).output(Yl),outboundDraftAct:V.route({method:`POST`,path:`/api/session/outbound-draft`,tags:K,summary:`Edit or approve the exact reviewed version once. Never sends or starts a turn.`}).input(Zl).output(Yl),toolResult:V.route({method:`GET`,path:`/api/session/tool-result`,tags:K,summary:"One tool call's whole, redacted result, for a scene row a limited response clipped (`result_truncated`); 404 for an unknown call id."}).input(k({session_id:C(),tool_call_id:C()})).output(k({tool_call_id:C(),result:C(),result_view:pm})),anchorSceneSave:V.route({method:`POST`,path:`/api/session/anchor-scene`,tags:K}).input(k({session_id:C(),scene:G.optional(),message_ref:C().optional(),message_index:G.optional(),message_offset:G.optional(),message_window_index:G.optional(),stream_id:C().optional()})).output(k({ok:F(!0),message_index:T().int(),message_ref:C()}))},projects:{list:V.route({method:`GET`,path:`/api/projects`,tags:[`projects`]}).input(k({all_profiles:C().optional()})).output(ch),create:V.route({method:`POST`,path:`/api/projects/create`,tags:[`projects`]}).input(k({name:C(),color:C().nullable().optional(),profile:C().nullable().optional()})).output(k({ok:F(!0),project:sh})),rename:V.route({method:`POST`,path:`/api/projects/rename`,tags:[`projects`]}).input(k({project_id:C(),name:C(),color:C().nullable().optional()})).output(k({ok:F(!0),project:sh})),delete:V.route({method:`POST`,path:`/api/projects/delete`,tags:[`projects`]}).input(k({project_id:C()})).output(k({ok:F(!0)}))},share:{create:V.route({method:`POST`,path:`/api/share/create`,tags:[`shares`]}).input(k({session_id:C()})).output(Vh),revoke:V.route({method:`POST`,path:`/api/share/revoke`,tags:[`shares`]}).input(k({session_id:C()})).output(Fv.extend({session:nh})),read:V.route({method:`GET`,path:`/api/share/{token}`,tags:[`shares`],summary:`Public read of a shared conversation snapshot.`}).input(k({token:C()})).output(Uh)},talaria:{pair:V.route({method:`POST`,path:`/api/talaria/relay/pair`,tags:[`talaria`],summary:`Register this server with Talaria Relay (owner) or enroll the active profile (any session).`}).input(k({relay_url:C(),publisher_id:C(),publisher_invitation:C(),label:C().optional()})).output(k({ok:F(!0),publisher_id:C()})),presence:V.route({method:`POST`,path:`/api/talaria/presence`,tags:[`talaria`],summary:`Renew or revoke one browser tab's activity lease; a fresh lease mutes relay alerts for the profile.`}).input(k({tab_id:C(),active:E(),seq:T().int()})).output(k({ok:F(!0),lease_seconds:T().int()})),viewed:V.route({method:`POST`,path:`/api/talaria/viewed`,tags:[`talaria`],summary:`Report a session as viewed through now so the relay clears its finished runs from Live Activities; a no-op without a relay.`}).input(k({session_id:C()})).output(k({ok:F(!0)}))}},ay=D(),oy=[`workspaces`],sy=k({ok:F(!0),workspaces:O(Og)}),cy=jg.optional(),ly=k({session_id:C(),path:C()}),uy=k({ok:F(!0),path:C()}),dy=k({session_id:C().optional(),token:C().optional(),path:C().optional()}),fy={escape_read_only:F(!0).describe(`Opened through an escape grant; clients offer no edits.`)},py={workspaces:{list:V.route({method:`GET`,path:`/api/workspaces`,tags:oy}).output(kg),suggest:V.route({method:`GET`,path:`/api/workspaces/suggest`,tags:oy}).input(k({prefix:C().optional()})).output(k({suggestions:O(C()),prefix:C()})),add:V.route({method:`POST`,path:`/api/workspaces/add`,tags:oy}).input(k({path:C(),name:C().optional(),create:ay.optional()})).output(sy),remove:V.route({method:`POST`,path:`/api/workspaces/remove`,tags:oy}).input(k({path:C()})).output(sy),rename:V.route({method:`POST`,path:`/api/workspaces/rename`,tags:oy}).input(k({path:C(),name:C()})).output(sy),reorder:V.route({method:`POST`,path:`/api/workspaces/reorder`,tags:oy}).input(k({paths:ay})).output(sy)},files:{list:V.route({method:`GET`,path:`/api/list`,tags:[`files`]}).input(k({session_id:C(),path:C().optional(),source:cy})).output(Ng),read:V.route({method:`GET`,path:`/api/file`,tags:[`files`]}).input(ly.extend({source:cy})).output(Fg),save:V.route({method:`POST`,path:`/api/file/save`,tags:[`files`]}).input(ly.extend({source:cy,content:C().optional()})).output(uy.extend({size:T().int(),source:cy})),create:V.route({method:`POST`,path:`/api/file/create`,tags:[`files`]}).input(ly.extend({content:C().optional()})).output(uy),createDir:V.route({method:`POST`,path:`/api/file/create-dir`,tags:[`files`]}).input(ly).output(uy),delete:V.route({method:`POST`,path:`/api/file/delete`,tags:[`files`]}).input(ly.extend({recursive:ay.optional()})).output(uy),rename:V.route({method:`POST`,path:`/api/file/rename`,tags:[`files`]}).input(ly.extend({new_name:C()})).output(k({ok:F(!0),old_path:C(),new_path:C()})),move:V.route({method:`POST`,path:`/api/file/move`,tags:[`files`]}).input(ly.extend({dest_dir:C().optional(),destination:C().optional()})).output(k({ok:F(!0),old_path:C(),new_path:C()})),reveal:V.route({method:`POST`,path:`/api/file/reveal`,tags:[`files`]}).input(ly).output(uy),path:V.route({method:`POST`,path:`/api/file/path`,tags:[`files`],summary:`Absolute on-disk path of a workspace-relative path; the file need not exist.`}).input(ly).output(uy),openVsCode:V.route({method:`POST`,path:`/api/file/open-vscode`,tags:[`files`]}).input(ly).output(uy),escapeAuthorize:V.route({method:`POST`,path:`/api/escape/authorize`,tags:[`files`]}).input(k({session_id:C().optional(),path:C().optional(),token:C().optional()})).output(k({token:C(),path:C(),is_dir:E(),expires_at:T(),expires_in:T().int(),read_only:F(!0)})),escapeList:V.route({method:`GET`,path:`/api/escape/list`,tags:[`files`]}).input(dy).output(Ng.extend({path:C(),entries:O(Ag.extend(fy)),virtual_root:C(),read_only:F(!0)})),escapeRead:V.route({method:`GET`,path:`/api/escape/file/read`,tags:[`files`]}).input(dy).output(Fg.extend(fy))}},my=D(),hy=N(C(),D()),gy=[`git`],_y=k({changed:T().int(),staged:T().int(),unstaged:T().int(),untracked:T().int(),conflicts:T().int()}),vy=k({path:C(),old_path:C().nullable(),workspace_path:C(),status:C(),staged:E(),unstaged:E(),untracked:E(),ignored:E(),conflict:E(),additions:T().int(),deletions:T().int(),binary:E()}),yy=k({is_git:E(),branch:C().optional(),upstream:C().optional(),ahead:T().int().optional(),behind:T().int().optional(),totals:_y.optional(),files:O(vy).optional(),truncated:E().optional(),noise_filtering:k({filemode_only:T().int(),crlf_only:T().int(),active:E()}).optional()}),by=k({name:C(),sha:C(),updated:T().int(),updated_relative:C(),author:C(),subject:C(),upstream:C(),ahead:T().int(),behind:T().int()}),xy=k({is_git:F(!0),current:C(),detached:E(),head:C(),local:O(by),remote:O(by),upstream:C(),ahead:T().int(),behind:T().int()}),Sy=k({path:C(),kind:C(),binary:E(),too_large:E(),additions:T().int(),deletions:T().int(),diff:C(),hunks:O(lm)});k({error:C(),code:C()});var Cy=k({id:C(),commit:C(),message:C(),date:C(),date_display:C(),files:T().int(),path:C()}),wy=k({path:C(),exists:E(),listed:E(),dirty:E(),untracked_count:T().int(),ahead_behind:k({ahead:T().int(),behind:T().int(),available:E(),upstream:C().nullable()}),locked_by_stream:E(),locked_by_terminal:E(),removable:E(),force_required:E()}),Ty=k({session_id:C()}),Ey=k({workspace:C().optional(),session_id:C().optional()}),Dy=k({session_id:C()}),Oy=Dy.extend({paths:j([O(my),C()]).optional(),path:C().optional()}),ky=k({ok:F(!0),git:yy}),Ay=k({ok:F(!0),message:C(),status:yy}),jy=Dy.extend({ref:C(),mode:C(),new_branch:C().nullable().optional(),track:my.optional(),dirty_mode:C().optional()}),My=k({ok:F(!0),git:yy,branches:xy,current_branch:C(),message:C()}),Ny={gitInfo:V.route({method:`GET`,path:`/api/git-info`,tags:gy,summary:`Lightweight branch badge for a session workspace.`}).input(Ty).output(Lg),git:{status:V.route({method:`GET`,path:`/api/git/status`,tags:gy}).input(Ty).output(k({git:yy})),branches:V.route({method:`GET`,path:`/api/git/branches`,tags:gy}).input(Ty).output(k({branches:xy})),diff:V.route({method:`GET`,path:`/api/git/diff`,tags:gy}).input(Ty.extend({path:C().optional(),kind:C().optional(),staged:C().optional()})).output(k({diff:Sy})),stage:V.route({method:`POST`,path:`/api/git/stage`,tags:gy}).input(Oy).output(ky),unstage:V.route({method:`POST`,path:`/api/git/unstage`,tags:gy}).input(Oy).output(ky),discard:V.route({method:`POST`,path:`/api/git/discard`,tags:gy}).input(Oy.extend({delete_untracked:my.optional()})).output(ky),commit:V.route({method:`POST`,path:`/api/git/commit`,tags:gy}).input(Dy.extend({message:C()})).output(k({ok:F(!0),commit:C(),status:yy})),commitSelected:V.route({method:`POST`,path:`/api/git/commit-selected`,tags:gy}).input(Oy.extend({message:C()})).output(k({ok:F(!0),commit:C(),paths:O(C()),status:yy})),commitMessage:V.route({method:`POST`,path:`/api/git/commit-message`,tags:gy,summary:`Generate a commit message for the staged diff through the auxiliary model.`}).input(Dy).output(k({ok:F(!0),message:C(),truncated:E()})),commitMessageSelected:V.route({method:`POST`,path:`/api/git/commit-message-selected`,tags:gy}).input(Oy).output(k({ok:F(!0),message:C(),truncated:E()})),fetch:V.route({method:`POST`,path:`/api/git/fetch`,tags:gy}).input(Dy).output(Ay),pull:V.route({method:`POST`,path:`/api/git/pull`,tags:gy}).input(Dy).output(Ay),push:V.route({method:`POST`,path:`/api/git/push`,tags:gy}).input(Dy).output(Ay),checkout:V.route({method:`POST`,path:`/api/git/checkout`,tags:gy}).input(jy).output(My),stashCheckout:V.route({method:`POST`,path:`/api/git/stash-checkout`,tags:gy}).input(jy.omit({dirty_mode:!0})).output(My.extend({stash_name:C(),stashed:E(),restored_stash:hy.nullable(),restore_failed:E(),restore_error:C(),restore_stash:hy.nullable()}))},rollback:{list:V.route({method:`GET`,path:`/api/rollback/list`,tags:[`rollback`]}).input(Ey).output(k({checkpoints:O(Cy),workspace:C(),checkpoint_dir:C(),session_diff:_u.optional()})),diff:V.route({method:`GET`,path:`/api/rollback/diff`,tags:[`rollback`]}).input(Ey.extend({checkpoint:C().optional(),id:C().optional()})).output(_u),restore:V.route({method:`POST`,path:`/api/rollback/restore`,tags:[`rollback`]}).input(Ey.extend({checkpoint:C().optional(),id:C().optional(),all:E().optional()}).catchall(my)).output(k({ok:F(!0),checkpoint:C(),workspace:C(),files_restored:O(C()),files_restored_count:T().int(),errors:O(k({file:C(),error:C()})),kept_user_edits:O(C()),skipped_oversize:O(C()),failed_deletes:O(C())}))},worktree:{status:V.route({method:`GET`,path:`/api/session/worktree/status`,tags:[`sessions`]}).input(Ty).output(k({status:wy})),remove:V.route({method:`POST`,path:`/api/session/worktree/remove`,tags:[`sessions`]}).input(k({session_id:my.optional(),force:my.optional()})).output(k({ok:F(!0),removed_path:C(),warnings:O(C()).nullable()}))},upload:{rollback:V.route({method:`POST`,path:`/api/upload/rollback`,tags:[`files`],summary:`Remove the successful prefix of one failed multi-file chat upload.`}).input(k({session_id:my.optional(),rollback_tokens:my.optional()})).output(k({ok:E(),rolled_back:T().int(),failed:T().int()}))}},Py=D(),Fy=[`chat`],Iy=k({session_id:C().optional(),choice:C().optional(),approval_id:C().optional(),yolo:E().optional(),run_id:C().optional(),mirror_token:C().optional()}).catchall(Py),Ly=k({session_id:C().optional(),answers:Th.optional(),response:C().optional(),answer:C().optional(),choice:C().optional(),clarify_id:C().optional(),decline:E().optional()}).catchall(Py),Ry=k({session_id:C().optional(),message:C().optional(),workspace:C().nullable().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional()}).catchall(Py),zy=k({answer:C(),status:P([`done`,`partial`]),session:Qm,result:k({final_response:C(),completed:E(),interrupted:E()})}),By=k({session_id:C().optional(),args:C().optional(),text:C().optional(),profile:C().optional(),workspace:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),explicit_model_pick:E().optional()}).catchall(Py),Vy={chat:{ownerAction:V.route({method:`POST`,path:`/api/chat/owner-action`,tags:Fy,summary:`A typed, generation-fenced action through the canonical session owner. Retry acknowledges unknown work and returns its text to the draft; it never executes it.`}).input(Bu).output(k({ok:F(!0),session:Qm,model_change:Au.optional(),draft:C().optional()})),sync:V.route({method:`POST`,path:`/api/chat`,tags:Fy,summary:`Legacy blocking turn: runs one turn to its end and answers with the reply.`}).input(Ry).output(zy),start:V.route({method:`POST`,path:`/api/chat/start`,tags:Fy,summary:"Admit one agent turn and return the stream id for `/api/chat/stream`."}).input(uh).output(dh),steer:V.route({method:`POST`,path:`/api/chat/steer`,tags:Fy}).input(k({session_id:C().optional(),text:C().optional(),display_text:C().optional(),steer_id:C().optional()}).catchall(Py)).output(yh),steerWithdraw:V.route({method:`POST`,path:`/api/chat/steer/withdraw`,tags:Fy,summary:`Take a pending steer back (Edit, Cancel) before the Agent takes it.`}).input(hh).output(gh),steerSendNow:V.route({method:`POST`,path:`/api/chat/steer/send-now`,tags:Fy,summary:`Deliver a pending steer now instead of after the running tools.`}).input(_h).output(vh),cancel:V.route({method:`GET`,path:`/api/chat/cancel`,tags:Fy}).input(k({stream_id:C().optional()})).output(mh),streamStatus:V.route({method:`GET`,path:`/api/chat/stream/status`,tags:Fy}).input(k({stream_id:C().optional()})).output(fh)},approval:{pending:V.route({method:`GET`,path:`/api/approval/pending`,tags:[`approval`]}).input(k({session_id:C().optional()})).output(xh),respond:V.route({method:`POST`,path:`/api/approval/respond`,tags:[`approval`]}).input(Iy).output(Sh)},clarify:{pending:V.route({method:`GET`,path:`/api/clarify/pending`,tags:[`approval`]}).input(k({session_id:C().optional()})).output(Oh),respond:V.route({method:`POST`,path:`/api/clarify/respond`,tags:[`approval`]}).input(Ly).output(kh)},goal:V.route({method:`POST`,path:`/api/goal`,tags:Fy}).input(By).output(Ph),background:{start:V.route({method:`POST`,path:`/api/background`,tags:Fy}).input(k({session_id:C().optional(),prompt:C().optional()}).catchall(Py)).output(k({ok:F(!0),task_id:C(),stream_id:C(),session_id:C()})),tasks:V.route({method:`GET`,path:`/api/background/tasks`,tags:Fy,summary:`The background work a session owns: delegations, notified processes and /background tasks (TAL-372).`}).input(k({session_id:C(),kind:Fh.shape.kind.optional()})).output(Ih),result:V.route({method:`GET`,path:`/api/background/result`,tags:Fy}).input(k({session_id:C(),task_id:C()})).output(Lh),stop:V.route({method:`POST`,path:`/api/background/stop`,tags:Fy}).input(Rh).output(zh),dismiss:V.route({method:`POST`,path:`/api/background/dismiss`,tags:Fy}).input(Rh).output(Bh),ack:V.route({method:`POST`,path:`/api/bg-task-complete-ack`,tags:Fy}).input(k({session_id:C().optional(),task_id:C().optional(),process_id:C().optional()}).catchall(Py)).output(k({ok:F(!0),session_id:C(),task_id:C(),noop:F(!0)}))},btw:V.route({method:`POST`,path:`/api/btw`,tags:Fy,summary:`Ephemeral side question answered in a hidden session that inherits the transcript.`}).input(k({session_id:C().optional(),question:C().optional()}).catchall(Py)).output(k({stream_id:C(),session_id:C(),parent_session_id:C()}))},Hy=D(),Uy=N(C(),D()),q=[`settings`],Wy=k({error:C()}),Gy=e=>C().max(e).regex(/\S/,`Must not be blank`),Ky=hc({requestId:Bs(),kind:P([`bug`,`feature`,`other`]),title:Gy(120),body:Gy(8e3),includeDiagnostics:E(),client:hc({platform:P([`web`,`ios`]),appVersion:Gy(64).optional(),osVersion:Gy(64).optional(),deviceModel:Gy(64).optional()})}),qy=k({text:C().max(16384),bytes:T().int().min(0).max(16384)}),Jy=k({status:F(`sent`),reportId:C().min(1)});M(`error`,[Wy.extend({error:F(`rate_limited`),retryAfterSeconds:T().int().nonnegative()}),Wy.extend({error:P([`feedback_unavailable`,`relay_unreachable`,`invalid`])})]),Wy.extend({code:F(`reasoning_unsupported`)});var Yy=k({advanced:Uy.nullable().optional()}),Xy={feedback:{diagnostics:V.route({method:`GET`,path:`/api/feedback/diagnostics`,tags:q,summary:`Preview the redacted diagnostics attached to feedback.`}).output(qy),submit:V.route({method:`POST`,path:`/api/feedback/submit`,tags:q,summary:`Forward feedback to Relay. Reuse requestId after an unknown outcome. Errors: rate_limited with retryAfterSeconds (429), feedback_unavailable (503), relay_unreachable (502), invalid (400).`}).input(Ky).output(Jy)},settings:{get:V.route({method:`GET`,path:`/api/settings`,tags:q,summary:`Server settings plus auth-state, max_tokens, and version badges.`}).output(Qh),save:V.route({method:`POST`,path:`/api/settings`,tags:q,summary:"Save settings; `_set_password`, `_clear_password`, `_passwordless`, `_current_password`, and `max_tokens` are handled specially."}).input(Uy).output(Qh),linkCheck:V.route({method:`POST`,path:`/api/settings/link-check`,tags:q,summary:"Whether a clicked chat link opens without the confirmation dialog (only absolute HTTP(S) URLs, when `confirm_external_links` is off or the exact hostname is in `trusted_link_hosts`), and the hostname that dialog names (null when the URL has none)."}).input(k({url:C().max(16384)})).output(k({opens_directly:E(),host:C().nullable()}))},profileImport:{discover:V.route({method:`GET`,path:`/api/profile/import`,tags:q,summary:`Owner only: permitted local coding-agent sources and reviewed importer availability.`}).output(lu),preview:V.route({method:`POST`,path:`/api/profile/import/preview`,tags:q,summary:`Owner only: preview with no source or profile writes. Consent binds the active profile, reviewed plugin and source/target snapshots.`}).input(hc({agent:cu})).output(lu),result:V.route({method:`GET`,path:`/api/profile/import/result`,tags:q,summary:`Owner only: read back a consumed import. Never runs the importer.`}).input(hc({receipt:C().min(1).max(128)})).output(lu),apply:V.route({method:`POST`,path:`/api/profile/import/apply`,tags:q,summary:`Owner only: consume preview consent once, or reconcile its recorded outcome. Never replays an unknown import.`}).input(hc({receipt:C().min(1).max(128)})).output(lu)},profiles:{list:V.route({method:`GET`,path:`/api/profiles`,tags:q}).output(eg),active:V.route({method:`GET`,path:`/api/profile/active`,tags:q}).output(tg),switch:V.route({method:`POST`,path:`/api/profile/switch`,tags:q,summary:`Per-client switch: sets the profile cookie; never mutates the process-wide profile.`}).input(k({name:C().optional(),profile:C().optional()})).output(ng),create:V.route({method:`POST`,path:`/api/profile/create`,tags:q}).input(k({name:C().optional(),clone_from:C().nullable().optional(),clone_config:Hy.optional(),base_url:C().nullable().optional(),api_key:C().nullable().optional(),default_model:C().nullable().optional(),model_provider:C().nullable().optional()})).output(k({ok:F(!0),profile:$h})),delete:V.route({method:`POST`,path:`/api/profile/delete`,tags:q}).input(k({name:C().optional(),profile:C().optional()})).output(k({ok:F(!0),name:C()}))},models:{delegation:V.route({method:`POST`,path:`/api/model/auxiliary/delegation`,tags:q,summary:`Persist a native delegation backend or replace one complete named route block.`}).input(Cl).output(Dg),list:V.route({method:`GET`,path:`/api/models`,tags:q}).input(k({freshness:C().optional()})).output(lg),live:V.route({method:`GET`,path:`/api/models/live`,tags:q}).input(k({provider:C().optional()})).output(ug),refresh:V.route({method:`POST`,path:`/api/models/refresh`,tags:q,summary:`Evict the live model cache for one provider (or all when omitted) and answer the rebuilt catalog; a named provider is re-read past the Agent's own catalog cache.`}).input(k({provider:C().optional()})).output(k({ok:F(!0),provider:C().nullable(),models:lg})),auxiliary:V.route({method:`GET`,path:`/api/model/auxiliary`,tags:q}).output(Dg),set:V.route({method:`POST`,path:`/api/model/set`,tags:q,summary:"scope=main sets config.yaml model.default; scope=auxiliary assigns one task slot (`__reset__` clears all) and answers the refreshed auxiliary state. An auxiliary `model` may be a `/api/models` entry id; provider `auto` with an empty model clears the override."}).input(Yy.extend({scope:C().optional(),task:C().optional(),provider:C().optional(),model:C().optional(),session_id:C().optional(),model_provider:C().nullable().optional(),explicit:E().optional()})).output(A({ok:E().optional(),session:Hy.optional(),error:C().optional(),auxiliary:Dg.optional()})),setDefault:V.route({method:`POST`,path:`/api/default-model`,tags:q}).input(Yy.extend({model:C().optional(),provider:C().nullable().optional()})).output(k({ok:F(!0),model:C(),provider:C().nullable()}))},providers:{list:V.route({method:`GET`,path:`/api/providers`,tags:q}).output(pg),setKey:V.route({method:`POST`,path:`/api/providers`,tags:q,summary:`Write (or clear when api_key is empty) a provider API key in the profile .env.`}).input(k({provider:C().optional(),api_key:C().nullable().optional()})).output(k({ok:F(!0),provider:C(),display_name:C(),action:C()})),delete:V.route({method:`POST`,path:`/api/providers/delete`,tags:q}).input(k({provider:C().optional()})).output(k({ok:F(!0),provider:C(),display_name:C(),action:C()})),selfHosted:V.route({method:`POST`,path:`/api/providers/self-hosted`,tags:q,summary:"Save an Ollama or LM Studio endpoint (optional key) and make `model` the default; an endpoint whose `/models` does not answer is refused with 400 and nothing is saved."}).input(Uy).output(Uy),quota:V.route({method:`GET`,path:`/api/provider/quota`,tags:q}).input(k({provider:C().optional(),refresh:C().optional()})).output(xg),quotas:V.route({method:`GET`,path:`/api/provider/quotas`,tags:q}).input(k({source:C().optional(),refresh:C().optional()})).output(Sg),costHistory:V.route({method:`GET`,path:`/api/provider/cost-history`,tags:q}).input(k({provider:C().optional(),days:C().optional()})).output(wg)},reasoning:{get:V.route({method:`GET`,path:`/api/reasoning`,tags:q}).input(k({model:C().optional(),provider:C().optional(),base_url:C().optional()})).output(rg),set:V.route({method:`POST`,path:`/api/reasoning`,tags:q,summary:"Body is `{display: show|hide}` or `{effort, session_id?, model?, provider?, base_url?}`. Chat effort changes carry session_id; read-only/native targets return 409 reasoning_unsupported without changing profile defaults. Omit session_id only for explicit profile settings."}).input(k({display:Hy.optional(),effort:Hy.optional(),session_id:C().trim().min(1).optional(),model:C().nullable().optional(),provider:C().nullable().optional(),base_url:C().nullable().optional()})).output(rg)},personalities:{list:V.route({method:`GET`,path:`/api/personalities`,tags:q}).output(Tg),set:V.route({method:`POST`,path:`/api/personality/set`,tags:q}).input(k({session_id:C().optional(),name:C().optional()})).output(k({ok:F(!0),personality:C().nullable(),prompt:C()}))},onboarding:{status:V.route({method:`GET`,path:`/api/onboarding/status`,tags:q}).output(z_),setup:V.route({method:`POST`,path:`/api/onboarding/setup`,tags:q}).input(Uy).output(A({ok:E().optional(),error:C().optional(),status:Hy.optional()})),complete:V.route({method:`POST`,path:`/api/onboarding/complete`,tags:q}).input(Uy.optional()).output(z_),probe:V.route({method:`POST`,path:`/api/onboarding/probe`,tags:q}).input(k({provider:C().optional(),base_url:C().optional(),api_key:C().nullable().optional()})).output(B_),oauthStart:V.route({method:`POST`,path:`/api/onboarding/oauth/start`,tags:q,summary:"Start a device-code sign-in for a provider whose onboarding entry has `oauth_flow: 'device_code'`, or (TAL-1276, operator only) the browser sign-in of a plugin OAuth client with provider `plugin:<key>:<id>`."}).input(A({provider:C().optional()})).output(V_),oauthCancel:V.route({method:`POST`,path:`/api/onboarding/oauth/cancel`,tags:q,summary:`Cancel a pending device-code sign-in; nothing is saved after it.`}).input(A({flow_id:C().optional()})).output(V_),oauthPoll:V.route({method:`GET`,path:`/api/onboarding/oauth/poll`,tags:q,summary:"Report a device-code sign-in; `approved` means the Agent saved the credential."}).input(k({flow_id:C().optional()})).output(V_)}},Zy=D(),Qy=N(C(),D()),J=[`tools`],$y=k({ok:F(!0)}),eb={agent_channel:P([`stable`,`experimental`]).optional(),agent_refresh_token:C().regex(/^[a-f0-9]{32}$/).optional(),confirmed_agent_revision:C().regex(/^[a-f0-9]{40}$/).optional()},tb=k({target:C().optional(),channel:C().nullable().optional(),...eb,version:C().min(1).max(128).optional().describe("TAL-946: a Stable `versions[].ref` of this target to install instead of the newest. Rejected when it is not listed or on Experimental."),tab_id:g_.optional()}),nb=k({error:C(),code:F(`memory_conflict`)}),rb=j([k({error:C(),code:F(`memory_char_limit`),char_limit:k({count:T().int(),limit:T().int()})}),k({error:C(),code:P([`memory_mask_ambiguous`,`memory_mask_edited`]),mask:C()})]),ib=j([...rb.options,nb]),ab=e=>{let t=ps(e);return delete t.$schema,t},ob=k({section:P([`memory`,`user`]),revision:C(),proposed_revision:C(),receipt:C().min(1).max(64e3),source:C(),proposed:C(),diff:C(),model:C(),expires_at:T()}),sb=k({ok:F(!0),section:P([`memory`,`user`]),revision:C()}),cb=j([ib,k({error:C(),code:P([`memory_compaction_conflict`,`memory_compaction_invalid`])}),k({error:C(),code:F(`memory_compaction_unavailable`),condition:C()})]),lb=e=>({...e,responses:{...e.responses,...Object.fromEntries([409,422,503].map(e=>[e,{description:`Compaction refused or unavailable. The review is retained; no unconfirmed write is replayed.`,content:{"application/json":{schema:ab(cb)}}}]))}}),ub=k({kind:P([`skills`,`memory`]),visible:E(),enabled:E(),items:O(Sf)}),db=k({kind:P([`skills`,`memory`]),writes:O(Cf).min(1)}),fb=k({results:O(k({id:C(),done:E(),message:C()}))}),pb={toolsetsCatalog:V.route({method:`POST`,path:`/api/toolsets`,tags:J,summary:`Read the current profile catalog with a draft selection. Null uses profile defaults.`}).input(k({session_id:C().optional(),toolsets:O(C()).nullable()})).output(Gu),skills:{revisions:V.route({method:`GET`,path:`/api/skills/revisions`,tags:J,summary:`Inspect actual saved skill history from the consented reviewed backend. Profile/skill-bound IDs refuse stale or foreign selections. No history is fabricated; inspection cannot execute checks, call providers, run a judge or change skills.`}).input(Hd).output(Ud),list:V.route({method:`GET`,path:`/api/skills`,tags:J}).input(k({category:C().optional()})).output(Rg),usage:V.route({method:`GET`,path:`/api/skills/usage`,tags:J}).output(Bg),content:V.route({method:`GET`,path:`/api/skills/content`,tags:J,summary:"Skill view, or one linked file when `file` is given."}).input(k({name:C().optional(),file:C().optional()})).output(zg),save:V.route({method:`POST`,path:`/api/skills/save`,tags:J}).input(k({name:C().optional(),content:C().optional(),category:C().optional()})).output(k({ok:F(!0),name:C(),path:C()})),delete:V.route({method:`POST`,path:`/api/skills/delete`,tags:J}).input(k({name:C().optional()})).output(k({ok:F(!0),name:C()})),toggle:V.route({method:`POST`,path:`/api/skills/toggle`,tags:J,summary:"Writes `skills.disabled` (and `skills.platform_disabled.webui` when present) in config.yaml."}).input(k({name:C().optional(),enabled:Zy.optional()})).output(k({ok:F(!0),name:C(),enabled:E()}))},memory:{compactionPreview:V.route({method:`POST`,path:`/api/memory/compaction/preview`,tags:J,spec:lb,summary:`Generate a bounded compaction through the configured compression auxiliary route, without writing. Secrets and protected entries are retained locally. Preview binds the active profile, source revision, proposal and expiry; an unavailable privacy-safe route returns 503.`}).input(k({section:P([`memory`,`user`]),revision:C()})).output(ob),compactionApply:V.route({method:`POST`,path:`/api/memory/compaction/apply`,tags:J,spec:lb,summary:`Explicitly apply the exact preview receipt through the Agent-format and locked revision gate. Stale, foreign or expired receipts are refused. Repeated acknowledgments reconcile with the exact proposed bytes without rewriting.`}).input(k({receipt:C().min(1).max(64e3)})).output(sb),get:V.route({method:`GET`,path:`/api/memory`,tags:J}).input(k({session_id:C().optional(),workspace:C().optional()})).output(Vg),write:V.route({method:`POST`,path:`/api/memory/write`,tags:J,summary:"`section` names the file (memory, user, soul); the legacy `target` alias is accepted. `revision` is the section's `*_revision` the edit started from; 409 refuses the save when the file changed since. Masks the page showed are restored to the values they hide; 422 refuses an ambiguous or edited mask, or a MEMORY.md / USER.md body over the Agent store limit.",spec:e=>({...e,responses:{...e.responses,409:{description:"The file changed since `revision`; the file is untouched.",content:{"application/json":{schema:ab(nb)}}},422:{description:`Refused; the file is untouched.`,content:{"application/json":{schema:ab(rb)}}}}})}).input(k({section:C().optional(),target:C().optional(),content:C().optional(),revision:C()})).output(k({ok:F(!0),section:C(),path:C()}))},pendingWrites:{list:V.route({method:`GET`,path:`/api/pending-writes`,tags:J,summary:"TAL-819: the active profile's skill or memory writes the Agent staged for approval, oldest first, each with the diff approving it applies. `visible` is whether the page shows its review panel (any write pending); `enabled` is the profile's `<kind>.write_approval` gate. `summary` and `diff` are redacted like the memory page (`api_redact_enabled`); `revision` is the hash of the raw diff. An Agent without the review handlers, or no running Agent, lists none."}).input(k({kind:P([`skills`,`memory`])})).output(ub),approve:V.route({method:`POST`,path:`/api/pending-writes/approve`,tags:J,summary:"TAL-819: apply each staged write through the Agent's `/skills` or `/memory approve`. Each write carries the `revision` the user reviewed; a write whose diff changed since is refused unapplied. `done` is false when the write was not applied (its record stays pending); `message` is the Agent's text either way, redacted."}).input(db).output(fb),reject:V.route({method:`POST`,path:`/api/pending-writes/reject`,tags:J,summary:"TAL-819: discard each staged write through the Agent's `/skills` or `/memory reject`."}).input(db).output(fb)},prompts:{list:V.route({method:`GET`,path:`/api/prompts`,tags:J}).output(Ug),create:V.route({method:`POST`,path:`/api/prompts`,tags:J}).input(k({text:C().optional(),label:C().optional()})).output(k({ok:F(!0),prompt:Hg})),delete:V.route({method:`DELETE`,path:`/api/prompts`,tags:J}).input(k({id:C().optional()})).output($y)},commands:{list:V.route({method:`GET`,path:`/api/commands`,tags:J}).output(Gg),exec:V.route({method:`POST`,path:`/api/commands/exec`,tags:J}).input(k({command:C().optional(),session_id:C().optional()})).output(k({output:C()})),bundles:V.route({method:`GET`,path:`/api/commands/bundles`,tags:J,summary:`The active profile's skill bundles; empty when the Agent is unavailable.`}).output(k({bundles:O(md)})),resolveBundle:V.route({method:`POST`,path:`/api/commands/bundles/resolve`,tags:J,summary:"Expands `/<bundle> [instruction]` into the user message that loads its skills. 404 for an unknown bundle."}).input(k({command:C().optional()})).output(hd),resolveMoa:V.route({method:`GET`,path:`/api/commands/moa/resolve`,tags:J,summary:"The active profile's normalized MoA config merged with `preset`, or its default preset when that is absent or unknown. 503 when the Agent has no MoA."}).input(k({preset:C().optional()})).output(A({preset:C(),usage:C()}))},notes:{sources:V.route({method:`GET`,path:`/api/notes/sources`,tags:J}).output(j_),search:V.route({method:`GET`,path:`/api/notes/search`,tags:J,summary:"Joplin notes matching `q` (`limit` 1-50, default 20). 404 while external notes sources are disabled; 502 when Joplin fails."}).input(k({source:C().optional(),q:C().optional(),limit:C().optional()})).output(N_),item:V.route({method:`GET`,path:`/api/notes/item`,tags:J,summary:`One Joplin note for preview. 404 while external notes sources are disabled; 502 for an invalid id or a Joplin failure.`}).input(k({source:C().optional(),id:C().optional()})).output(P_)},wiki:{status:V.route({method:`GET`,path:`/api/wiki/status`,tags:J,summary:"LLM wiki summary from `WIKI_PATH` (env, then the profile `.env`), `skills.config.wiki.path` or `wiki.path` in config.yaml, else `~/wiki`. Always 200."}).output(F_),browse:V.route({method:`GET`,path:`/api/wiki/browse`,tags:J,summary:"Allowlisted `*.md` pages under `entities`, `concepts`, `comparisons`, and `queries`; 404 when the wiki directory is missing."}).output(I_),page:V.route({method:`GET`,path:`/api/wiki/page`,tags:J,summary:`One allowlisted page, cut at 2 MiB. 400 for a missing or non-canonical path; 404 for anything not listed.`}).input(k({path:C().optional()})).output(L_)},insights:V.route({method:`GET`,path:`/api/insights`,tags:J}).input(k({days:C().optional()})).output(qg),logs:V.route({method:`GET`,path:`/api/logs`,tags:J}).input(k({file:C().optional(),tail:C().optional()})).output(Kg),ops:{agent:V.route({method:`GET`,path:`/api/health/agent`,tags:J}).output(e_),system:V.route({method:`GET`,path:`/api/system/health`,tags:J}).output(t_),restart:V.route({method:`POST`,path:`/api/health/restart`,tags:J,summary:`Restart the Hermes gateway for the active profile (operator only).`}).input(Qy.optional()).output(k({ok:F(!0),message:C()})),dashboard:V.route({method:`GET`,path:`/api/dashboard/status`,tags:J}).output(Jg),dashboardConfig:V.route({method:`GET`,path:`/api/dashboard/config`,tags:J,summary:"The active profile's `webui.dashboard` link settings. 400 when the stored URL is invalid."}).output(Zg),saveDashboardConfig:V.route({method:`POST`,path:`/api/dashboard/config`,tags:J,summary:"Writes `webui.dashboard.{enabled,url}` to the active profile's config.yaml; an empty `url` removes it. 400 for an invalid mode or URL."}).input(k({enabled:Zy.optional(),url:Zy.optional()})).output(Zg),projectOs:V.route({method:`GET`,path:`/api/project-os/dashboard`,tags:J,summary:`Project OS handoff, status, and docs for the current repo. Always 200.`}).input(k({board:C().optional()})).output(Qg),shutdown:V.route({method:`POST`,path:`/api/shutdown`,tags:J,summary:`Stop the server process (operator only).`}).input(Qy.optional()).output(k({status:F(`shutting_down`)}))},gateway:{status:V.route({method:`GET`,path:`/api/gateway/status`,tags:J}).output(Yg),start:V.route({method:`POST`,path:`/api/gateway/start`,tags:J,summary:"Run `hermes gateway start` for the active profile (operator only). A named profile the Agent refuses its own gateway starts the host gateway from the root profile, then retries. 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 after 60 seconds."}).input(Qy.optional()).output(Xg),stop:V.route({method:`POST`,path:`/api/gateway/stop`,tags:J,summary:"Run `hermes gateway stop` for the active profile (operator only). 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 after 60 seconds."}).input(Qy.optional()).output(Xg),restart:V.route({method:`POST`,path:`/api/gateway/restart`,tags:J,summary:"Run `hermes gateway restart` for the active profile (operator only). A named profile the Agent refuses its own gateway starts the host gateway from the root profile, then retries. 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 after 60 seconds."}).input(Qy.optional()).output(Xg)},mcp:{servers:V.route({method:`GET`,path:`/api/mcp/servers`,tags:J}).output(C_),tools:V.route({method:`GET`,path:`/api/mcp/tools`,tags:J,summary:"`q` keeps tools whose name, server, or description contains it (case-insensitive); `total` counts every known tool."}).input(k({q:C().optional()})).output(A_),action:V.route({method:`POST`,path:`/api/mcp/servers/{name}`,tags:J,summary:"`{enabled}` toggles, `{delete: true}` removes, `{url|command, ...}` adds or updates the server in config.yaml."}).input(k({name:C()}).catchall(Zy)).output(Qy),toggle:V.route({method:`PATCH`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C(),enabled:Zy.optional()})).output(k({ok:F(!0),name:C(),enabled:E()})),update:V.route({method:`PUT`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C(),config_revision:C().optional(),cost_policy:tu.optional()}).catchall(Zy)).output(k({ok:F(!0),server:S_})),delete:V.route({method:`DELETE`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C()})).output(k({ok:F(!0),deleted:C()}))},connectors:{available:V.route({method:`GET`,path:`/api/connectors/available`,tags:J,summary:`Whether the active profile has connectors; false hides the Connectors page. Never creates an identity.`}).output(k({available:E()})),page:V.route({method:`GET`,path:`/api/connectors`,tags:J,summary:"Every catalog app with its accounts and member rules. `available: false` with no apps when the profile has no connectors."}).output(D_),dismissOffer:V.route({method:`POST`,path:`/api/connectors/sign-in-offer/dismiss`,tags:J,summary:`Acknowledge the current profile guest offer. Idempotent for the same offer; preserves native backoff.`}).input(k({offer_id:C().min(1)})).output(E_),tools:V.route({method:`GET`,path:`/api/connectors/{connector}/tools`,tags:J,summary:`One app's tools with their member and organization rules.`}).input(k({connector:C()})).output(O_),setPolicy:V.route({method:`POST`,path:`/api/connectors/{connector}/policy`,tags:J,summary:"One member-rule change from `revision` (the page's `policy_revision`): `enabled` turns the app on or off, or `tool` with `tool_enabled` one of its tools. 409 `policy_conflict` when the rules changed since."}).input(k({connector:C(),revision:C().min(1),enabled:E().optional(),tool:C().min(1).optional(),tool_enabled:E().optional()})).output(k({ok:F(!0),revision:C()})),connect:V.route({method:`POST`,path:`/api/connectors/{connector}/connect`,tags:J,summary:`Starts the app's authorization (or rejoins an open one) and answers with its link; poll the operation until it settles.`}).input(k({connector:C(),nous_account_id:C().min(1).optional()})).output(k_),removeAccount:V.route({method:`DELETE`,path:`/api/connectors/accounts/{connection_id}`,tags:J,summary:`Disconnects one account at the portal.`}).input(k({connection_id:C().min(1)})).output($y),operation:V.route({method:`GET`,path:`/api/connectors/operations/{op_id}`,tags:J}).input(k({op_id:C().min(1)})).output(k_),respond:V.route({method:`POST`,path:`/api/connectors/operations/{op_id}`,tags:J,summary:"`skip`, `retry` or `approve` (with `env`) one `target`, as its `actions` allow, or `continue` the card without the rest."}).input(k({op_id:C().min(1),action:P([`skip`,`retry`,`approve`,`continue`]),target:C().optional(),env:N(C(),C()).optional()})).output(k_)},plugins:V.route({method:`GET`,path:`/api/plugins`,tags:J}).output(x_),pluginCatalog:V.route({method:`GET`,path:`/api/plugins/catalog`,tags:J}).input(od).output(cd),pluginInstall:V.route({method:`POST`,path:`/api/plugins/install`,tags:J,summary:`Operator only: preview or confirm a reviewed catalog pin. Confirmation is single use and binds the profile, catalog entry and staged tree. Native scan and admission apply; no replacement, dependency approval, enabling or Desktop UI grant.`}).input(sd).output(ld),pluginUpdate:V.route({method:`POST`,path:`/api/plugins/update`,tags:J,summary:`Operator only: update a profile-installed Git plugin through the Agent scan transaction. Caution requires accept_caution plus the single-use consent_token bound to the profile, installation and scanned revision; changed or expired consent returns 409. Dangerous always blocks.`}).input(k({key:C().trim().min(1),accept_caution:E().default(!1),consent_token:C().min(1).max(128).optional()})).output(ad),pluginSettings:V.route({method:`POST`,path:`/api/plugins/settings`,tags:J,summary:"TAL-806 (operator only): save a plugin's manifest-declared settings. `values` holds non-secret fields as the form entered them (numbers and JSON as text); the server checks each against the field list, writes the changed ones to `plugins.entries.<key>.settings`, and writes `secrets` to the profile `.env` under each field's `env` name (an empty one removes it). Secrets are written first; when a later write is refused, the ones already written are restored. 400 for an undeclared key, a bad value or a `locked` secret; 409 when the manifest changed; 503 when the Agent sidecar stopped before confirming (secrets stay written); 403 on a managed install, 404 for an unknown plugin. After persistence, runtime_application separately reports applied, restart_required, or unknown; runtime reconnect failures never roll saved secrets back."}).input(k({key:C().min(1),values:N(C(),Zy).optional(),secrets:N(C(),C()).optional()})).output(k({ok:F(!0),key:C(),written:O(C()),settings:O(y_),runtime_application:nd})),pluginOAuthRedirect:V.route({method:`POST`,path:`/api/plugins/oauth/redirect`,tags:J,summary:"TAL-1276 (operator only): finish a plugin client's browser sign-in with `url`, the address the browser showed after the approval, when that address does not open on the Agent's machine. 400 `oauth_redirect_invalid` unless it is the flow's `redirect_uri` on 127.0.0.1 with the flow's `state`; 404 for an unknown flow, 409 `oauth_flow_ended` once it ended. Poll the flow afterwards."}).input(k({flow_id:C().min(1),url:C().min(1)})).output(V_),pluginOAuthLogout:V.route({method:`POST`,path:`/api/plugins/oauth/logout`,tags:J,summary:"TAL-1276 (operator only): sign out of a plugin-declared OAuth client (`hermes auth logout <key>:<id>`). `removed` is false when no grant was stored."}).input(k({key:C().min(1),id:C().min(1)})).output(k({ok:F(!0),removed:E()})),updates:{check:V.route({method:`GET`,path:`/api/updates/check`,tags:J,summary:"Cached status; `POST` runs the check. Git source installs can update from completed releases (stable) or origin/main (experimental); direct global npm installs can update to completed stable npm releases."}).output(o_),checkNow:V.route({method:`POST`,path:`/api/updates/check`,tags:J}).input(k({force:Zy.optional(),channel:C().nullable().optional(),agent_channel:eb.agent_channel})).output(o_),apply:V.route({method:`POST`,path:`/api/updates/apply`,tags:J}).input(tb).output(c_),force:V.route({method:`POST`,path:`/api/updates/force`,tags:J}).input(tb).output(c_),clearLock:V.route({method:`POST`,path:`/api/updates/clear_lock`,tags:J}).input(tb).output(c_),summary:V.route({method:`POST`,path:`/api/updates/summary`,tags:J}).input(hc({target:P([`webui`,`agent`])})).output(s_)},updateNotifications:{list:V.route({method:`GET`,path:`/api/update-notifications`,tags:J,summary:`Server-owned update operation history for the authenticated owner and active profile. A Web tab passes its tab_id and loaded_build so the server compares that build and keeps its tab-scoped refresh notice.`}).input(k({tab_id:g_.optional(),loaded_build:h_.optional()})).output(v_),read:V.route({method:`POST`,path:`/api/update-notifications/{id}/read`,tags:J}).input(k({id:Bs(),read:F(!0),tab_id:g_.optional()})).output(m_),dismiss:V.route({method:`POST`,path:`/api/update-notifications/{id}/dismiss`,tags:J}).input(k({id:Bs(),dismiss:F(!0),tab_id:g_.optional()})).output(k({ok:F(!0)})),clear:V.route({method:`POST`,path:`/api/update-notifications/clear`,tags:J}).input(k({clear:F(!0),tab_id:g_.optional(),loaded_build:h_.optional()})).output(v_),cancel:V.route({method:`POST`,path:`/api/update-notifications/{id}/cancel`,tags:J}).input(k({id:Bs(),cancel:F(!0)})).output(m_),action:V.route({method:`POST`,path:`/api/update-notifications/{id}/actions/{action_id}`,tags:J}).input(k({id:Bs(),action_id:C().min(1).max(64),perform:F(!0),tab_id:g_.optional()})).output(m_)},transcribeCapability:V.route({method:`GET`,path:`/api/transcribe/capability`,tags:J}).output(Kh),speech:{prepare:V.route({method:`POST`,path:`/api/speech/prepare`,tags:J,summary:"TAL-906: the read-aloud script for `text` (the Agent's `prepare_spoken_text`): Markdown, reasoning blocks, filenames, paths, UUIDs, hashes, and URLs are dropped, at most 4000 characters. `/api/tts` speaks the same script. The text as written, trimmed, when the Agent cannot prepare it."}).input(k({text:C().max(1e5)})).output(qh)},transcribeWarm:V.route({method:`POST`,path:`/api/transcribe/warm`,tags:J,summary:`Start loading the profile's speech-to-text engine in the background and answer at once (TAL-916). Send when a recording starts and the capability has warm_supported.`}).output(k({ok:F(!0)})),clientEvents:V.route({method:`POST`,path:`/api/client-events/log`,tags:J,summary:`Bounded browser diagnostics; only whitelisted scalar fields are logged.`}).input(Qy).output(k({ok:F(!0),event:C().nullable()}))},mb=P([`start`,`pause`,`resume`,`cancel`,`reconcile`]),hb=k({session_id:C().min(1).max(256),project_id:C().nullable(),text:C().trim().min(1).max(32e3)}),gb=O(hb).min(1).max(100),_b=hb.extend({request_id:C(),title:C(),backend:P([`direct`,`owner`]),authority_epoch:T().int().nullable(),status:P([`waiting`,`dispatching`,`running`,`completed`,`failed`,`refused`,`unknown`]),stream_id:C().nullable(),admission_id:C().nullable(),outcome:C().nullable()}),vb=k({id:C(),title:C(),revision:T().int().nonnegative(),profile:C(),phase:P([`draft`,`running`,`paused`,`cancelled`,`completed`,`failed`,`refused`,`unknown`]),current_step:T().int().nonnegative(),cards:O(_b),actions:O(mb),editable:E(),error:C().nullable()}),Y=D(),X=N(C(),D()),Z=[`automation`],yb=k({ok:F(!0)}),bb=k({job_id:C().optional()}),xb=bd.omit({agent_move_targets:!0}).extend(nv),Sb=k({action:P([`block`,`unblock`]),event_id:T().int()}).nullable(),Cb=k({task:xb,read_only:E()}),wb=k({task_id:C(),confirm_running_exit:E().optional()}).catchall(Y),Tb=k({session_id:C().optional()}),Eb=M(`mode`,[k({ok:F(!0),mode:F(`web_pty`),session_id:C(),workspace:C(),running:E()}),k({ok:F(!0),mode:F(`owner_command`),session_id:C(),workspace:C(),running:F(!1),target_key:C().min(1)})]),Db={promptQueues:{list:V.route({method:`GET`,path:`/api/prompt-queues`,tags:Z}).output(k({runs:O(vb)})),create:V.route({method:`POST`,path:`/api/prompt-queues`,tags:Z}).input(k({request_id:C().min(1).max(128),cards:gb})).output(vb),edit:V.route({method:`PATCH`,path:`/api/prompt-queues/{id}`,tags:Z}).input(k({id:C(),revision:T().int().nonnegative(),cards:gb})).output(vb),action:V.route({method:`POST`,path:`/api/prompt-queues/{id}/action`,tags:Z}).input(k({id:C(),revision:T().int().nonnegative(),action:mb})).output(vb)},crons:{blueprints:V.route({method:`GET`,path:`/api/cron/blueprints`,tags:Z}).output(lf),blueprintFill:V.route({method:`POST`,path:`/api/cron/blueprints/fill`,tags:Z}).input(uf).output(df),contextSources:V.route({method:`POST`,path:`/api/crons/context-sources`,tags:Z,summary:`Read eligible context sources for the editor execution store.`}).input(k({profile:C().optional(),editing_job_id:C().optional(),exclude_job_id:C().optional(),selected_refs:O(C()).optional()})).output(J_),list:V.route({method:`GET`,path:`/api/crons`,tags:Z}).input(k({all_profiles:C().optional()})).output(q_),history:V.route({method:`GET`,path:`/api/crons/history`,tags:Z}).input(bb.extend({offset:C().optional(),limit:C().optional()})).output($_),output:V.route({method:`GET`,path:`/api/crons/output`,tags:Z}).input(bb.extend({limit:C().optional()})).output(X),run:V.route({method:`GET`,path:`/api/crons/run`,tags:Z}).input(bb.extend({filename:C().optional()})).output(ev),status:V.route({method:`GET`,path:`/api/crons/status`,tags:Z}).input(bb).output(tv),recent:V.route({method:`GET`,path:`/api/crons/recent`,tags:Z,summary:"Each active-profile job's latest completion after `since` (Unix seconds), newest first. Not a run archive."}).input(k({since:C().optional()})).output(Y_),deliveryOptions:V.route({method:`GET`,path:`/api/crons/delivery-options`,tags:Z}).output(k({platforms:O(k({value:C(),label:C()}))})),create:V.route({method:`POST`,path:`/api/crons/create`,tags:Z}).input(X).output(X_),update:V.route({method:`POST`,path:`/api/crons/update`,tags:Z}).input(X).output(X_),delete:V.route({method:`POST`,path:`/api/crons/delete`,tags:Z}).input(bb).output(X_),runNow:V.route({method:`POST`,path:`/api/crons/run`,tags:Z,summary:"Start a manual run in the sidecar; answers immediately with `status: running` (or `already_running`)."}).input(bb).output(X_),pause:V.route({method:`POST`,path:`/api/crons/pause`,tags:Z}).input(bb.extend({reason:C().nullable().optional()})).output(X_),resume:V.route({method:`POST`,path:`/api/crons/resume`,tags:Z}).input(bb).output(X_)},kanban:{inspection:V.route({method:`GET`,path:`/api/kanban/inspection`,tags:Z}).input(k({board:C().optional(),search:C().optional(),assignee:C().optional(),tenant:C().optional(),only_mine:C().optional(),include_archived:C().optional(),running_only:C().optional()})).output(av),boards:V.route({method:`GET`,path:`/api/kanban/boards`,tags:Z}).input(k({include_archived:C().optional()})).output(cv),board:V.route({method:`GET`,path:`/api/kanban/board`,tags:Z}).input(k({board:C().optional(),tenant:C().optional(),assignee:C().optional(),include_archived:C().optional(),only_mine:C().optional(),since:C().optional(),search:C().optional()})).output(sv),config:V.route({method:`GET`,path:`/api/kanban/config`,tags:Z}).input(k({board:C().optional()})).output(X),updateConfig:V.route({method:`PATCH`,path:`/api/kanban/config`,tags:Z}).input(k({lane_by_profile:Y.optional()})).output(X),stats:V.route({method:`GET`,path:`/api/kanban/stats`,tags:Z}).input(k({board:C().optional()})).output(lv),assignees:V.route({method:`GET`,path:`/api/kanban/assignees`,tags:Z}).input(k({board:C().optional()})).output(k({assignees:O(Td)})),events:V.route({method:`GET`,path:`/api/kanban/events`,tags:Z}).input(k({board:C().optional(),since:C().optional(),limit:C().optional()})).output(k({events:O(Ed),cursor:T().int(),latest_event_id:T().int(),read_only:E()})),createBoard:V.route({method:`POST`,path:`/api/kanban/boards`,tags:Z}).input(X).output(k({board:Dd,current:C(),read_only:E()})),switchBoard:V.route({method:`POST`,path:`/api/kanban/boards/{slug}/switch`,tags:Z}).input(k({slug:C()})).output(k({current:C(),read_only:E()})),updateBoard:V.route({method:`PATCH`,path:`/api/kanban/boards/{slug}`,tags:Z}).input(k({slug:C()}).catchall(Y)).output(k({board:Dd,read_only:E()})),deleteBoard:V.route({method:`DELETE`,path:`/api/kanban/boards/{slug}`,tags:Z}).input(k({slug:C(),delete:C().optional()})).output(k({result:Y,current:C(),read_only:E()})),dispatch:V.route({method:`POST`,path:`/api/kanban/dispatch`,tags:Z}).input(k({board:C().optional(),dry_run:C().optional(),max:C().optional()})).output(X),bulk:V.route({method:`POST`,path:`/api/kanban/tasks/bulk`,tags:Z}).input(X).output(k({results:O(X),read_only:E()})),createTask:V.route({method:`POST`,path:`/api/kanban/tasks`,tags:Z}).input(X).output(Cb),link:V.route({method:`POST`,path:`/api/kanban/links`,tags:Z}).input(X).output(X),unlink:V.route({method:`POST`,path:`/api/kanban/links/delete`,tags:Z}).input(X).output(X),unlinkDelete:V.route({method:`DELETE`,path:`/api/kanban/links`,tags:Z}).input(X).output(X),task:V.route({method:`GET`,path:`/api/kanban/tasks/{task_id}`,tags:Z}).input(k({task_id:C(),board:C().optional()})).output(A({task:xb.extend(Cd),last_card_action:Sb,...Sd})),taskLog:V.route({method:`GET`,path:`/api/kanban/tasks/{task_id}/log`,tags:Z}).input(k({task_id:C(),board:C().optional(),tail:C().optional()})).output(A({log:O(Y).optional(),entries:O(Y).optional()})),comment:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/comments`,tags:Z}).input(k({task_id:C()}).catchall(Y)).output(X),block:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/block`,tags:Z}).input(wb).output(Cb),unblock:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/unblock`,tags:Z}).input(k({task_id:C()}).catchall(Y)).output(Cb),patch:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/patch`,tags:Z}).input(wb).output(Cb),patchTask:V.route({method:`PATCH`,path:`/api/kanban/tasks/{task_id}`,tags:Z}).input(wb).output(Cb)},extensions:{status:V.route({method:`GET`,path:`/api/extensions/status`,tags:Z}).output(uv),registry:V.route({method:`GET`,path:`/api/extensions/registry`,tags:Z}).output(A({entries:O(Y),error:C().optional(),unavailable:E().optional()})),manifests:V.route({method:`GET`,path:`/api/extensions/manifests`,tags:Z}).output(k({protocol_version:F(1),manifests:O(A({can_toggle:E(),agent_host:E().optional(),display_id:C().optional()}))})),toggle:V.route({method:`POST`,path:`/api/extensions/toggle`,tags:Z}).input(k({id:Y.optional(),enabled:Y.optional()})).output(uv),consent:V.route({method:`POST`,path:`/api/extensions/sidecar-proxy-consent`,tags:Z}).input(k({id:Y.optional(),approved:Y.optional()})).output(uv),install:V.route({method:`POST`,path:`/api/extensions/install`,tags:Z}).input(k({id:Y.optional(),download_url:Y.optional(),sha256:Y.optional()})).output(k({installed:F(!0),id:C(),version:C()})),uninstall:V.route({method:`POST`,path:`/api/extensions/uninstall`,tags:Z}).input(k({id:Y.optional()})).output(k({uninstalled:F(!0),id:C()}))},terminal:{exec:V.route({method:`POST`,path:`/api/terminal/exec`,tags:Z,summary:`Execute one explicit captured command on the selected native owner. Unknown outcomes must never be replayed.`}).input(k({session_id:C().min(1),mode:F(`owner_command`),target_key:C().min(1),command:yu})).output(bu),start:V.route({method:`POST`,path:`/api/terminal/start`,tags:Z,summary:`Open the Web host PTY or select captured commands for a native owner (local origin when auth is off).`}).input(Tb.extend({rows:Y.optional(),cols:Y.optional(),restart:Y.optional()})).output(Eb),input:V.route({method:`POST`,path:`/api/terminal/input`,tags:Z}).input(Tb.extend({data:C().optional()})).output(yb),resize:V.route({method:`POST`,path:`/api/terminal/resize`,tags:Z}).input(Tb.extend({rows:Y.optional(),cols:Y.optional()})).output(yb),close:V.route({method:`POST`,path:`/api/terminal/close`,tags:Z}).input(Tb).output(k({ok:F(!0),closed:E()}))}},Ob=A({text:C().optional(),already_streamed:E().optional(),reasoning_echo:E().optional(),session_id:C().optional()}),kb=A({text:C().optional(),titles:O(C()).optional(),name:C().optional(),session_id:C().optional()}),Ab=A({name:C().optional(),...fm,preview:C().nullable().optional(),args:D().optional(),event_type:C().optional(),session_id:C().optional(),id:C(),timestamp:T().optional()}),jb=Ab.extend({duration:T().nullable().optional(),is_error:E().optional(),cost_usd:T().nullable().optional(),result:D().optional(),result_view:pm.optional(),output:D().optional()}),Mb=A({allowed_choices:bh.shape.allowed_choices,can_enable_yolo:bh.shape.can_enable_yolo,approval_id:C().optional(),session_id:C().optional(),command:C().optional(),description:C().optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),question:C().optional(),status:C().optional(),pending_count:T().optional(),run_id:C().optional(),mirror_token:C().optional()}),Nb=A({steps:O(wh).optional(),vault:Dh.optional(),clarify_id:C().optional(),session_id:C().optional(),question:C().optional(),choices:O(D()).optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),status:C().optional(),raw_preview:C().optional(),timeout_seconds:T().optional(),timeout_at:T().optional(),index:T().optional(),total:T().optional()}),Pb=A({session_id:C().optional(),old_session_id:C().optional(),new_session_id:C().optional(),continuation_session_id:C().optional(),usage:A({...jm,plan_gauge:Hl.nullable().optional()}).optional()}),Fb=Pb.extend({started_at:T().optional()}),Ib=A({session_id:C().optional(),title:C().optional(),status:C().optional(),reason:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional(),raw_preview:C().optional(),prefill:D().optional()}),Lb=A({type:C().optional(),message:C().optional()}),Rb=A({...$g.shape,condition:C().optional(),terminal_state:Sm.optional(),type:C().optional(),message:C().optional(),details:D().optional(),hint:C().optional(),session_id:C().optional(),old_session_id:C().optional(),new_session_id:C().optional(),continuation_session_id:C().optional(),status:j([C(),T()]).optional(),session:D().optional(),code:C().optional()}),zb=A({terminal_state:Sm.optional(),session:D().optional(),usage:A({...jm,plan_gauge:Hl.nullable().optional()}).optional(),status:C().optional(),ephemeral:E().optional(),answer:C().optional()}),Bb=A({terminal_state:Sm.optional(),type:C().optional(),message:C().optional(),hint:C().optional(),status:C().optional(),session_id:C().optional(),session:D().optional()}),Vb=A({session_id:C().optional()}),Hb=A({plan_gauge:Hl.nullable().optional(),input_tokens:T(),output_tokens:T(),estimated_cost:T().nullable(),cache_read_tokens:T(),cache_write_tokens:T()}),Ub=A({session_id:C().optional(),usage:Hb.optional(),tps:T().nullable().optional(),tps_available:E().optional(),estimated:E().optional()}),Wb=A({session_id:C().optional(),state:C().optional(),decision:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional(),prefill:D().optional()}),Gb=A({session_id:C().optional(),state:D().optional(),text:C().optional(),decision:C().optional(),continuation_prompt:C().optional(),stream_id:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional()}),Kb=A({session_id:C().optional(),steer_id:C().optional(),text:C().optional(),consumed_at:T().optional(),after_tool_call_id:C().nullable().optional()}),qb=A({session_id:C().optional(),status:C().optional(),kind:C().optional(),name:C().optional(),reason:C().optional(),action:C().optional()}),Jb=Zm.extend({stream_id:C().optional()}),Yb=A({session_id:C().optional(),task_id:C().optional(),id:C().optional(),title:C().optional(),status:C().optional(),summary:C().optional(),error:C().optional()}),Xb=A({session_id:C().optional(),stream_id:C().optional(),turn_id:C().optional(),user_message_id:j([C(),T()]).optional()}),Zb=A({}),Qb=`session_snapshot.token.reasoning.tool.tool_progress.tool_complete.interim_assistant.approval.approval_cleared.clarify.compressing.compressed.title.title_status.warning.apperror.cancel.error.done.stream_end.metering.context_status.goal.goal_continue.steer_consumed.steer_pending.steer_withdrawn.state_saved.todo_state.bg_task_complete.server_turn_started.notices.session_goal.rate_limit_wait.run_status.connect_card.hello.initial.events.gateway_status.sessions_changed`.split(`.`),$b=M(`event`,[k({event:F(`session_snapshot`),data:k({session:Qm,replay_gap:E().optional()})}),k({event:F(`token`),data:Ob}),k({event:F(`interim_assistant`),data:Ob}),k({event:F(`reasoning`),data:kb}),k({event:F(`tool`),data:Ab}),k({event:F(`tool_progress`),data:k({id:C(),progress:dm.nullable()})}),k({event:F(`tool_complete`),data:jb}),k({event:F(`approval`),data:Mb}),k({event:F(`approval_cleared`),data:A({session_id:C().optional(),pending_count:T()})}),k({event:F(`clarify`),data:Nb}),k({event:F(`compressing`),data:Fb}),k({event:F(`compressed`),data:Pb}),k({event:F(`title`),data:Ib}),k({event:F(`title_status`),data:Ib}),k({event:F(`warning`),data:Lb}),k({event:F(`apperror`),data:Rb}),k({event:F(`error`),data:Rb}),k({event:F(`cancel`),data:Bb}),k({event:F(`done`),data:zb}),k({event:F(`stream_end`),data:Vb}),k({event:F(`metering`),data:Ub}),k({event:F(`context_status`),data:Wb}),k({event:F(`goal`),data:Gb}),k({event:F(`goal_continue`),data:Gb}),k({event:F(`steer_consumed`),data:Kb}),k({event:F(`steer_pending`),data:Om}),k({event:F(`steer_withdrawn`),data:ph}),k({event:F(`state_saved`),data:qb}),k({event:F(`todo_state`),data:Jb}),k({event:F(`bg_task_complete`),data:Yb}),k({event:F(`server_turn_started`),data:Xb}),k({event:F(`notices`),data:A({session_id:C().optional(),notices:O(km)})}),k({event:F(`session_goal`),data:A({session_id:C().optional(),goal:Am.nullable()})}),k({event:F(`run_status`),data:k({session_id:C(),status:fu.nullable()})}),k({event:F(`rate_limit_wait`),data:A({session_id:C().optional(),wait:uu.nullable()})}),k({event:F(`connect_card`),data:k_}),k({event:F(`hello`),data:Zb}),k({event:F(`initial`),data:Zb}),k({event:F(`events`),data:Zb}),k({event:F(`gateway_status`),data:Zb}),k({event:F(`sessions_changed`),data:Zb})]),ex=new Set([`stream_end`,`cancel`,`apperror`,`error`]),tx=k({identity:C().min(1).max(128),scope:C().min(1).max(128),profile:C().min(1),eligible:E(),expires_at:T()}),nx=A({type:F(`sessions_changed`).optional(),version:T().optional(),reason:C().optional(),profile:C().nullable().optional(),session_id:C().nullable().optional(),web_audio:O(tx).max(32).optional()}),rx=M(`event`,[k({event:F(`initial`),data:Zb}),k({event:F(`sessions_changed`),data:nx}),k({event:F(`gateway_status`),data:Zb}),k({event:F(`hello`),data:Zb})]),ix=[`initial`,`session-updated`,`server_turn_started`,`bg_task_complete`,`process_complete`],ax=k({event:P(ix),data:A({session_id:C()})});function ox(e,t){let n;try{n=t===``?{}:JSON.parse(t)}catch{return null}let r=$b.safeParse({event:e,data:n});return r.success?r.data:null}var sx=`/api/transcribe/stream`;k({sample_rate:T().int().min(8e3).max(48e3)}),k({eos:F(!0)});var cx=M(`type`,[k({type:F(`partial`),text:C()}),k({type:F(`final`),transcript:C(),filtered:E(),provider:C()}),k({type:F(`error`),message:C()})]),lx=`--bg.--sidebar.--border.--border2.--text.--muted.--accent.--blue.--gold.--code-bg.--surface.--topbar-bg.--main-bg.--focus-ring.--focus-glow.--input-bg.--hover-bg.--strong.--em.--code-text.--code-inline-bg.--pre-text.--accent-hover.--accent-bg.--accent-bg-strong.--accent-text.--error.--success.--warning.--info.--radius-sm.--radius-md.--radius-card.--radius-lg.--radius-pill.--space-1.--space-2.--space-3.--space-4.--font-size-xs.--font-size-sm.--font-size-md.--message-body-font-size.--message-body-line-height.--message-code-font-size.--message-pre-code-font-size.--message-table-font-size.--file-tree-toggle-width.--font-ui.--font-conversation.--font-mono.--surface-subtle.--surface-subtle-hover.--border-subtle.--border-muted.--app-titlebar-safe-top.--skeleton-base.--skeleton-sheen.--msg-rail.--msg-max.--chat-col-inset.--user-bubble-bg.--user-bubble-border.--user-bubble-text.--user-bubble-placeholder.--user-selection-bg.--user-selection-text.--ease.--dur.--shadow-sm.--shadow-md.--r-sm.--r-md.--r-lg.--canvas.--island-ring.--island-radius.--island-gap.--island-shadow.--accent-fg.--link-color.--link-hover-glow.--purple.--amber.--amber-strong.--danger.--panel-head-primary-fg.--overlay-faint.--overlay.--overlay-strong.--overlay-max.--overlay-neutral.--ink-overlay.--scrim.--dialog-bg.--source-telegram.--source-discord.--source-slack.--source-claude-code.--scrollbar-thumb.--scrollbar-thumb-hover.--selection-bg.--selection-fg.--root-font-size.--root-line-height.--body-weight.--body-tracking.--text-rendering.--msg-tracking.--msg-code-size.--heading-tracking.--titlebar-title-tracking.--composer-font-size.--composer-line-height.--composer-tracking.--composer-scrollbar-width.--composer-scrollbar-display.--body-bg.--rail-bg.--titlebar-bg.--titlebar-border.--sidebar-bg.--sidebar-border.--sidebar-border-style.--sidebar-shadow.--main-surface.--pane-bg.--island-ring-width.--chrome-backdrop.--control-radius.--composer-wrap-bg.--composer-wrap-border-top.--composer-bg.--composer-border-color.--composer-border-width.--composer-radius.--composer-shadow.--composer-focus-border.--composer-focus-shadow.--composer-radius-phone.--composer-glass-mix.--composer-backdrop.--composer-hero-title-size.--composer-fade-height.--composer-rest-height.--chip-bg.--chip-border.--chip-fg.--chip-hover-bg.--chip-hover-border.--chip-hover-fg.--ws-chip-hover-bg.--ws-chip-hover-border.--ws-chip-hover-fg.--send-bg.--send-fg.--send-shadow.--send-weight.--send-hover-bg.--send-hover-shadow.--send-disabled-bg.--send-disabled-fg.--send-disabled-opacity.--primary-bg.--primary-fg.--primary-border.--primary-hover-bg.--primary-hover-border.--primary-hover-transform.--primary-hover-shadow.--float-btn-bg.--float-shadow.--scroll-btn-bg.--scroll-btn-shadow.--btn-radius.--rail-btn-radius.--nav-tab-radius.--nav-tab-radius-mobile.--input-radius.--chip-radius.--session-radius.--icon-btn-hover-bg.--project-chip-hover-bg.--file-item-hover-bg.--project-chip-bg.--project-chip-border.--project-chip-active-bg.--project-chip-active-fg.--project-chip-active-border.--project-chip-active-shadow.--project-chip-active-weight.--select-border.--input-focus-border.--input-focus-shadow.--search-bg.--search-border.--search-focus-bg.--search-focus-shadow.--table-border.--table-head-border.--pre-bg.--pre-border.--msg-role-user-fg.--assistant-msg-bg.--user-msg-bg.--user-msg-border.--user-msg-rail-width.--user-msg-rail.--user-msg-radius.--user-msg-fg.--user-msg-padding.--user-msg-weight.--user-msg-size.--user-msg-code-bg.--tool-running-bg.--tool-running-border.--session-font-size.--session-line-height.--session-hover-bg.--session-active-bg.--session-active-fg.--session-active-border.--session-active-rail-width.--session-active-rail-color.--session-active-shadow.--session-active-weight.--session-active-title-fg.--session-active-meta-fg.--session-bar-color.--session-bar-radius.--session-bar-inset-y.--session-bar-left.--session-bar-opacity.--session-pinned-fg.--session-trigger-active-fg.--pick-active-bg.--pick-active-border.--pick-active-shadow.--pick-active-fg.--pick-active-weight.--settings-section-bg.--menu-active-bg.--menu-active-fg.--menu-active-shadow.--menu-active-weight.--nav-active-bg.--nav-active-fg.--nav-active-shadow.--nav-active-weight.--nav-active-icon-fg.--nav-hover-bg.--nav-tooltip-fg.--rail-active-bg.--rail-active-fg.--rail-active-shadow.--rail-active-weight.--rail-active-icon-fg.--panel-btn-hover-bg.--panel-btn-hover-fg`.split(`.`),ux={"--surface2":`--surface-subtle`,"--text2":`--muted`,"--accent2":`--accent-hover`,"--accent3":`--accent-text`,"--accent-contrast":`--accent-fg`,"--sidebar-text":`--text`,"--user-bubble":`--user-bubble-bg`,"--assistant-bubble":`--assistant-msg-bg`,"--link":`--link-color`},dx=[...lx,...Object.keys(ux),`--accent-rgb`],fx=/^(#(?:[0-9a-fA-F]{3,8})|rg(?:b|ba)\(\s*[0-9.,%\s/]+\)|hsl(?:a)?\(\s*[0-9.,%\s/deg]+\)|[0-9]{1,3}\s*,\s*[0-9]{1,3}\s*,\s*[0-9]{1,3}|[a-zA-Z]{3,20}|[0-9.]+(?:px|em|rem|%)?)$/,px=Al,mx=k({id:px,name:C(),identity:C(),revision:T().int(),disbanded:E(),max_upload_bytes:T().int().positive(),attachment_limit:T().int().positive(),members:O(Ml.extend({phase:P([`idle`,`queued`,`running`,`stopping`,`unknown`,`failed`,`approval`]),actions:O(Fl)})),actions:O(P([`send`,`rename`,`disband`,`stop`]))}),hx=k({key:C(),index:T().int(),author:C(),message:Em,attachments:O(jl.extend({event_id:px,download_url:C()}))}),gx=k({available:E(),reason:P([`unsupported`,`stopped`,`refused`,`unavailable`,`unknown`,`driver_inactive`]).nullable(),room:mx.nullable(),rows:O(hx),cursor:T().int().nonnegative(),has_more:E(),next_before_seq:T().int().positive().nullable()}),_x=k({identity:C().nullable(),available:E(),reason:gx.shape.reason,profiles:O(k({profile:C(),label:C()})),rooms:O(mx),actions:O(F(`create`)),next_offset:T().int().nullable()}),vx=k({outcome:P([`confirmed`,`refused`,`unknown`]),reason:gx.shape.reason,room_id:px,event_id:px.nullable(),attachment:jl.nullable()}),yx=k({event:F(`snapshot`),data:gx}),bx=k({identity:C().nullable(),operation:Rl}),xx={groups:{sendIdentity:V.route({method:`GET`,path:`/api/groups/send-identity`,tags:[`groups`]}).input(k({request_id:Al})).output(k({event_id:Al})),list:V.route({method:`GET`,path:`/api/groups`,tags:[`groups`]}).input(k({offset:Xc().int().nonnegative().optional()})).output(_x),view:V.route({method:`GET`,path:`/api/groups/view`,tags:[`groups`]}).input(k({room_id:Al,before_seq:Xc().int().positive().optional()})).output(gx),receipt:V.route({method:`GET`,path:`/api/groups/receipt`,tags:[`groups`]}).input(k({room_id:Al,request_id:Al})).output(vx),write:V.route({method:`POST`,path:`/api/groups/action`,tags:[`groups`]}).input(bx).output(vx),upload:V.route({method:`POST`,path:`/api/groups/upload`,tags:[`groups`]}).input(k({room_id:Al,identity:C(),upload_id:Al,name:C().min(1).max(255),mime:C().max(127),data_base64:C().max(kl)})).output(vx)}},Sx=V.router({...Pv,...iy,...py,...Ny,...Vy,...Xy,...pb,...Db,...xx});E().optional();var Cx=fv.extend({code:C().optional()}),wx=A({ok:E().optional()}),Tx=class e extends Error{kind;status;code;body;path;retryable;constructor(e){super(e.message,e.cause===void 0?void 0:{cause:e.cause}),this.name=`ApiError`,this.kind=e.kind,this.status=e.status??0,this.code=e.code,this.body=e.body,this.path=e.path,this.retryable=e.retryable??(e.kind===`network`||e.kind===`timeout`)}static from(t,n=``){return t instanceof e?t:t instanceof DOMException&&t.name===`AbortError`?new e({kind:`aborted`,path:n,message:`Request aborted`,retryable:!1}):new e({kind:`network`,path:n,message:t instanceof Error?t.message:`Network error`,cause:t})}};function Ex(e){return e instanceof Tx}function Dx(e){return!Ex(e)||(e.kind===`http`||e.kind===`unauthorized`)&&e.status>=400&&e.status<500&&e.status!==408}function Ox(e,t,n){let r=e.safeParse(t);if(r.success)return r.data;throw new Tx({kind:`invalid_payload`,path:n,message:`Malformed payload from ${n}: ${_t(r.error)}`,body:t,retryable:!1})}var kx=()=>`Hermes Agent version not supported`,Ax=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_incompatible;return r?r(e):kx(e)}),jx=()=>`Agent update recovery is incomplete`,Mx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_recovery_incomplete;return r?r(e):jx(e)}),Nx=()=>`Agent runtime is unavailable; check the Agent update outcome`,Px=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_runtime_stale;return r?r(e):Nx(e)}),Fx=()=>`Hermes Agent isn't running`,Ix=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_sidecar_unavailable;return r?r(e):Fx(e)}),Lx=()=>`Agent source changed; check the update outcome before restarting Talaria Web`,Rx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_source_changed;return r?r(e):Lx(e)}),zx=()=>`Agent update is in progress`,Bx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_update_active;return r?r(e):zx(e)}),Vx={sidecar_unavailable:Ix,agent_incompatible:Ax,agent_runtime_stale:Px},Hx={update_active:Bx,recovery_incomplete:Mx,source_changed:Rx,unknown:Px};function Ux(e,t){return e===`agent_runtime_stale`?(t?Hx[t]:void 0)?.()??Px():e&&Object.hasOwn(Vx,e)?Vx[e]():void 0}var Wx=/\/api\/(auth\/login|csp-report)$/,Gx=/\/api\/auth\/(login|passkey\/options|passkey\/login|logout)$/,Kx=new Set([`POST`,`PUT`,`PATCH`,`DELETE`]),Q={transport:e=>{let t={method:e.method,headers:e.headers,body:e.body??null,credentials:e.credentials,keepalive:e.keepalive??!1};return e.signal&&(t.signal=e.signal),fetch(e.url,t)},csrfToken:``,authEnabled:!1,mutationSeq:0,inflight:new Map,onUnauthorized:e=>{window.location.assign(r(`login?next=${encodeURIComponent(e)}`).href)}};function qx(e){Object.assign(Q,e)}function Jx(e,t){return new Promise((n,r)=>{let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`aborted`,`AbortError`))},{once:!0})})}function Yx(e){return r(e)}function Xx(){let e=n().pathname.replace(/\/$/,``),t=window.location.pathname+window.location.search;return t.startsWith(e)?t.slice(e.length)||`/`:t}async function Zx(e,t){let n=(t.method??`GET`).toUpperCase(),r=Yx(e),i=n===`GET`||n===`HEAD`,a=i&&t.dedupe!==!1&&!t.signal?`${n} ${r.href} @${Q.mutationSeq} ${JSON.stringify({t:t.timeoutMs,r:t.retries,s:t.retryStatuses})}`:null;if(a){let n=Q.inflight.get(a);if(n)return n;let r=Zx(e,{...t,dedupe:!1});Q.inflight.set(a,r);let i=()=>{Q.inflight.get(a)===r&&Q.inflight.delete(a)};return r.then(i,i),r}i||(Q.mutationSeq+=1);let o=t.timeoutMs??3e4,s=(t.retries??2)+1,c=new Set(t.retryStatuses??[]),l=t.retryDelayMs??350,u=null;for(let a=1;a<=s;a++){let d=new AbortController,f=()=>d.abort();t.signal?.addEventListener(`abort`,f,{once:!0});let p=o>0?setTimeout(()=>d.abort(new DOMException(`timeout`,`TimeoutError`)),o):null;try{let i=new Headers(t.headers),o=null;t.json===void 0?t.body!==void 0&&(o=t.body):(i.set(`Content-Type`,`application/json`),o=JSON.stringify(t.json)),Kx.has(n)&&r.origin===window.location.origin&&!Wx.test(r.pathname)&&Q.csrfToken&&!i.has(`X-Hermes-CSRF-Token`)&&i.set(`X-Hermes-CSRF-Token`,Q.csrfToken);let f=await Q.transport({url:r,method:n,headers:i,body:o,signal:d.signal,credentials:`include`,keepalive:t.keepalive??!1});if(f.status===401&&Q.authEnabled&&t.redirect401!==!1&&!Gx.test(r.pathname))throw Q.onUnauthorized(Xx()),new Tx({kind:`unauthorized`,status:401,path:e,message:`Authentication required`,retryable:!1});let p=await f.text(),m=null;if(p!==``)try{m=JSON.parse(p)}catch{if(f.ok)throw new Tx({kind:`invalid_payload`,status:f.status,path:e,message:`Non-JSON response from ${e}`,body:p,retryable:!1});m={error:p.slice(0,500)}}if(!f.ok){let n=Cx.safeParse(m),r=new Tx({kind:`http`,status:f.status,code:n.success?n.data.code:void 0,body:m,path:e,message:n.success?Ux(n.data.condition??n.data.type,n.data.agent_runtime_reason)??n.data.error:`HTTP ${f.status} from ${e}`,retryable:c.has(f.status)});if(r.retryable&&a<s){u=r,await Jx(l,t.signal);continue}throw r}return Ox(t.schema,m,e)}catch(n){let r=Tx.from(n,e);if(r.kind===`aborted`&&t.signal?.aborted)throw r;if(u=r.kind===`aborted`&&d.signal.reason instanceof DOMException&&d.signal.reason.name===`TimeoutError`?new Tx({kind:`timeout`,path:e,message:`Request to ${e} timed out`,retryable:!0}):r,!u.retryable||a>=s||!i&&u.kind===`timeout`)throw u;await Jx(l,t.signal)}finally{p&&clearTimeout(p),t.signal?.removeEventListener(`abort`,f)}}throw u??new Tx({kind:`network`,path:e,message:`Request failed`})}function Qx(e,t,n={}){return Zx(e,{...n,method:`GET`,schema:t})}function $x(e,t,n,r={}){return Zx(e,{...r,method:`POST`,json:t,schema:n})}function eS(e,t,n,r={}){return Zx(e,{...r,method:`POST`,body:t,schema:n,retries:r.retries??0})}async function tS(e,t){let n=new URL(e.url),r=n.pathname.replace(/^.*?\/api\//,`api/`),i=new Headers(e.headers);Kx.has(e.method)&&n.origin===window.location.origin&&!Wx.test(n.pathname)&&Q.csrfToken&&!i.has(`X-Hermes-CSRF-Token`)&&i.set(`X-Hermes-CSRF-Token`,Q.csrfToken);let a=e.method===`GET`||e.method===`HEAD`,o=a||e.body===null?null:await e.text(),s=a&&t?`${e.method} ${n.href} @${Q.mutationSeq} contract`:null;if(s){let e=Q.inflight.get(s);if(e)return(await e).clone()}a||(Q.mutationSeq+=1);let c=async()=>{let t;try{t=await Q.transport({url:n,method:e.method,headers:i,body:o,signal:e.signal,credentials:`include`})}catch(e){throw Tx.from(e,r)}if(t.status===401&&Q.authEnabled&&!Gx.test(n.pathname))throw Q.onUnauthorized(Xx()),new Tx({kind:`unauthorized`,status:401,path:r,message:`Authentication required`,retryable:!1});if(!t.ok){let e=await t.text(),n=null;try{n=e?JSON.parse(e):null}catch{n={error:e.slice(0,500)}}let i=Cx.safeParse(n);throw new Tx({kind:`http`,status:t.status,code:i.success?i.data.code:void 0,body:n,path:r,message:i.success?Ux(i.data.condition??i.data.type,i.data.agent_runtime_reason)??i.data.error:`HTTP ${t.status} from ${r}`,retryable:!1})}return t};if(!s)return c();let l=c();Q.inflight.set(s,l);let u=()=>{Q.inflight.get(s)===l&&Q.inflight.delete(s)};return l.then(u,u),(await l).clone()}var nS=e(t(),1),$=[],rS=0,iS=new Set,aS=new Map,oS=new Map,sS=()=>{for(let e of iS)e()},cS=(e,t)=>{let n=e.get(t);n!==void 0&&clearTimeout(n),e.delete(t)},lS=e=>{cS(aS,e),cS(oS,e),$=$.filter(t=>t.id!==e),sS()},uS=e=>{lS(e)};function dS(e,t=`programmatic`){let n=$.find(t=>t.id===e);if(!n||!n.visible&&t===`manual`)return;if(!n.visible){lS(e);return}t===`manual`&&n?.onDismiss?.(),$=$.map(t=>t.id===e?{...t,visible:!1}:t),sS(),cS(aS,e);let r=n?.revision;aS.set(e,setTimeout(()=>{let t=$.find(t=>t.id===e);t&&!t.visible&&t.revision===r&&lS(e)},220))}function fS(e,t=2500,n=`info`){pS({id:`local-${String(++rS)}`,text:e,ttl:t,kind:n,dismissible:!1,actions:[]})}function pS(e){let t=$.find(t=>t.id===e.id);if(t){if(t.revision===e.revision){$=$.map(t=>t.id===e.id?{...e,visible:t.visible}:t),sS();return}cS(aS,e.id),cS(oS,e.id),$=$.map(t=>t.id===e.id?{...e,visible:!1}:t)}else $=[...$,{...e,visible:!1}];sS();let n=e.revision;requestAnimationFrame(()=>{$=$.map(t=>t.id===e.id&&t.revision===n?{...t,visible:!0}:t),sS()}),e.ttl>0&&oS.set(e.id,setTimeout(()=>{$.some(t=>t.id===e.id&&t.revision===n)&&dS(e.id,`timeout`)},e.ttl))}function mS(){return(0,nS.useSyncExternalStore)(_S,gS,hS)}function hS(){return $}function gS(){return $}function _S(e){return iS.add(e),()=>iS.delete(e)}export{Fp as $,ox as A,O as At,Qm as B,j as Bt,sx as C,tp as Ct,ix as D,Al as Dt,ex as E,bu as Et,eg as F,T as Ft,pm as G,Qh as H,Hs as Ht,ch as I,k as It,kg as J,Jh as K,rg as L,Cc as Lt,Iv as M,M as Mt,vm as N,F as Nt,rx as O,P as Ot,ym as P,A as Pt,Bp as Q,$m as R,N as Rt,fx as S,Sp as St,Qb as T,Op as Tt,sm as U,Bs as Ut,ih as V,D as Vt,dm as W,qp as X,rm as Y,Ip as Z,Dx as _,kp as _t,mS as a,vp as at,ux as b,fp as bt,Qx as c,yp as ct,Zx as d,bp as dt,Wp as et,Yx as f,gp as ft,Ex as g,xp as gt,wx as h,op as ht,fS as i,ap as it,Eb as j,E as jt,ax as k,lc as kt,$x as l,Ep as lt,Tx as m,Tp as mt,uS as n,Hp as nt,qx as o,Dp as ot,Ux as p,wp as pt,Mh as q,pS as r,Vp as rt,tS as s,np as st,dS as t,Up as tt,eS as u,up as ut,Sx as v,hp as vt,cx as w,Mp as wt,dx as x,dp as xt,yx as y,mp as yt,am as z,C as zt};
|
|
56
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qa=[`oneOf`,`anyOf`];function $a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}m(n,r,e.length===1?e[0]:eo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$a(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function to(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Za)if(t in e)return;let n=t.filter(e=>Qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eo(t);else{let e=n[0],i=Qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ka(e,r))}function no(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ka(i,s),Ka(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])to(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ka(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,m(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ro(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ro(r.element,n);if(r.type===`set`)return ro(r.valueType,n);if(r.type===`lazy`)return ro(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return ro(r.innerType,n);if(r.type===`intersection`)return ro(r.left,n)||ro(r.right,n);if(r.type===`record`||r.type===`map`)return ro(r.keyType,n)||ro(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ro(r.in,n)||ro(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ro(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ro(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ro(e,n))return!0;return!!(r.rest&&ro(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=qa({...n,processors:t});return x(e,r),Ya(r,e),no(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=qa({...i??{},target:a,io:t,processors:n});return x(e,o),Ya(o,e),no(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(ye),bigint_format:go(be),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function vo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var yo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bo=new Map([[vr,en],[br,tn]]),xo=e=>bo.get(e)??e,So=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=vo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=yo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(xo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=vo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):b(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},wo=(e,t,n,r)=>{n.type=`boolean`},To=(e,t,n,r)=>{b(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{b(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Do=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Oo=(e,t,n,r)=>{b(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{b(e,t,n,r,`Void cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{n.not={}},jo=(e,t,n,r)=>{},Mo=(e,t,n,r)=>{},No=(e,t,n,r)=>{b(e,t,n,r,`Date cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Fo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(b(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(b(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Io=(e,t,n,r)=>{b(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ro=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=vo(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},zo=(e,t,n,r)=>{n.type=`boolean`},Bo=(e,t,n,r)=>{b(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Vo=(e,t,n,r)=>{b(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Ho=(e,t,n,r)=>{b(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{b(e,t,n,r,`Map cannot be represented in JSON Schema`)},Wo=(e,t,n,r)=>{b(e,t,n,r,`Set cannot be represented in JSON Schema`)},Go=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=vo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=x(a.element,t,{...r,path:[...r.path,`items`]})};function Ko(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ko(t.out):t.type===`catch`?Ko(t.innerType):e._zod.optin}var qo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&b(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)m(i.properties,e,x(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ko(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=x(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Jo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>x(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Yo=(e,t,n,r)=>{let i=e._zod.def,a=x(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=x(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Xo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>x(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?x(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Ko(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=vo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Zo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Zo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Zo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?pn:fn).source)),p}var Qo=new WeakMap;function $o(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Qo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Zo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var es=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=vo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=x(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)m(i.patternProperties,xo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=x(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Qo.get(t);n||(n=[],Qo.set(t,n),t.deferred.push(()=>$o(t))),n.push(e)}i.additionalProperties=x(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ko(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},ts=(e,t,n,r)=>{let i=e._zod.def,a=x(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ns=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rs=Symbol();function is(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(b(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),rs):JSON.parse(o)}var as=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=is(i.defaultValue,e,t,n,r);o!==rs&&(n.default=o)},os=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=is(i.defaultValue,e,t,n,r);o!==rs&&(n._prefault=o)},ss=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{b(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},cs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;x(o,t,r);let s=t.seen.get(e);s.ref=o},ls=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},us=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ds=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fs={string:So,number:Co,boolean:wo,bigint:To,symbol:Eo,null:Do,undefined:Oo,void:ko,never:Ao,any:jo,unknown:Mo,date:No,enum:Po,literal:Fo,nan:Io,template_literal:Lo,file:Ro,success:zo,custom:Bo,function:Vo,transform:Ho,map:Uo,set:Wo,array:Go,object:qo,union:Jo,intersection:Yo,tuple:Xo,record:es,nullable:ts,nonoptional:ns,default:as,prefault:os,catch:ss,pipe:cs,readonly:ls,promise:us,optional:ds,lazy:(e,t,n,r)=>{let i=e._zod.innerType;x(i,t,r);let a=t.seen.get(e);a.ref=i}};function ps(e,t){if(`_idmap`in e){let n=e,r=qa({...t,processors:fs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;x(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Ya(r,n),m(a,t,no(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=qa({...t,processors:fs});return x(e,n),Ya(n,e),no(n,e)}var ms=new WeakSet([Object.prototype,Error.prototype]);function hs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var gs=_(`ZodError`,(e,t)=>{ft.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ms.has(n)||(ms.add(n),hs(n,`format`,e=>t=>ht(e,t)),hs(n,`flatten`,e=>t=>mt(e,t)),hs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),hs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),_s=yt(gs),vs=bt(gs),ys=xt(gs),bs=Ct(gs),xs=kt(gs),Ss=At(gs),Cs=jt(gs),ws=Mt(gs),Ts=Nt(gs),Es=Pt(gs),Ds=Ft(gs),Os=It(gs);function ks(){at.localeError||ot(Ii())}function As(){at.memoizer||ot({memoizer:Ni()})}var S=_(`ZodType`,(e,t)=>(ks(),v.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(oe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(qc(e,t))},superRefine(e,t){return this.check(Jc(e,t))},overwrite(e){return this.check(Ia(e))},optional(){return kc(this)},exactOptional(){return jc(this)},nullable(){return Nc(this)},nullish(){return kc(Nc(this))},nonoptional(e){return zc(this,e)},array(){return O(this)},or(e){return j([this,e])},and(e){return yc(this,e)},transform(e){return Uc(this,Dc(e))},default(e){return Fc(this,e)},prefault(e){return Lc(this,e)},catch(e){return Vc(this,e)},pipe(e){return Uc(this,e)},readonly(){return Gc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ue(this,`~standard`,{...Bn(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){He(this,`~standard`,e)},parse:function e(t,n){return _s(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vs(this,t,n,{callee:e})},safeParse(e,t){return ys(this,e,t)},async safeParseAsync(e,t){return bs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){He(this,`spa`,e)},validate(e,t){return Et(this,e,t)},validateAsync(e,t){return Ot(this,e,t)},encode:function e(t,n){return xs(this,t,n,{callee:e})},decode:function e(t,n){return Ss(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Cs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ws(this,t,n,{callee:e})},safeEncode(e,t){return Ts(this,e,t)},safeDecode(e,t){return Es(this,e,t)},async safeEncodeAsync(e,t){return Ds(this,e,t)},async safeDecodeAsync(e,t){return Os(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),js=_(`_ZodString`,(e,t)=>{Vn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},We({format:e=>vo(e).format??null,minLength:e=>vo(e).minimum??null,maxLength:e=>vo(e).maximum??null},{regex(...e){return this.check(Aa(...e))},includes(...e){return this.check(Na(...e))},startsWith(...e){return this.check(Pa(...e))},endsWith(...e){return this.check(Fa(...e))},min(...e){return this.check(Oa(...e))},max(...e){return this.check(Da(...e))},length(...e){return this.check(ka(...e))},nonempty(...e){return this.check(Oa(1,...e))},lowercase(e){return this.check(ja(e))},uppercase(e){return this.check(Ma(e))},trim(){return this.check(Ra())},normalize(...e){return this.check(La(...e))},toLowerCase(){return this.check(za())},toUpperCase(){return this.check(Ba())},slugify(){return this.check(Va())}})),Ms=_(`ZodString`,(e,t)=>{Vn.init(e,t),js.init(e,t)},{email(e){return this.check(Ui(Ls,e))},url(e){return this.check(Yi(Vs,e))},jwt(e){return this.check(ua(rc,e))},emoji(e){return this.check(Xi(Us,e))},guid(e){return this.check(Wi(Rs,e))},uuid(e){return this.check(Gi(zs,e))},uuidv4(e){return this.check(Ki(zs,e))},uuidv6(e){return this.check(qi(zs,e))},uuidv7(e){return this.check(Ji(zs,e))},nanoid(e){return this.check(Zi(Ws,e))},cuid(e){return this.check(Qi(Gs,e))},cuid2(e){return this.check($i(Ks,e))},ulid(e){return this.check(ea(qs,e))},base64(e){return this.check(sa(ec,e))},base64url(e){return this.check(ca(tc,e))},xid(e){return this.check(ta(Js,e))},ksuid(e){return this.check(na(Ys,e))},ipv4(e){return this.check(ra(Xs,e))},ipv6(e){return this.check(ia(Zs,e))},cidrv4(e){return this.check(aa(Qs,e))},cidrv6(e){return this.check(oa($s,e))},e164(e){return this.check(la(nc,e))},datetime(e){return this.check(da(Ns,e))},date(e){return this.check(fa(Ps,e))},time(e){return this.check(pa(Fs,e))},duration(e){return this.check(ma(Is,e))}});function C(e){return Hi(Ms,e)}var w=_(`ZodStringFormat`,(e,t)=>{y.init(e,t),js.init(e,t)}),Ns=_(`ZodISODateTime`,(e,t)=>{or.init(e,t),w.init(e,t)}),Ps=_(`ZodISODate`,(e,t)=>{sr.init(e,t),w.init(e,t)}),Fs=_(`ZodISOTime`,(e,t)=>{cr.init(e,t),w.init(e,t)}),Is=_(`ZodISODuration`,(e,t)=>{lr.init(e,t),w.init(e,t)}),Ls=_(`ZodEmail`,(e,t)=>{Wn.init(e,t),w.init(e,t)}),Rs=_(`ZodGUID`,(e,t)=>{Hn.init(e,t),w.init(e,t)}),zs=_(`ZodUUID`,(e,t)=>{Un.init(e,t),w.init(e,t)});function Bs(e){return Gi(zs,e)}var Vs=_(`ZodURL`,(e,t)=>{Qn.init(e,t),w.init(e,t)});function Hs(e){return Yi(Vs,e)}var Us=_(`ZodEmoji`,(e,t)=>{$n.init(e,t),w.init(e,t)}),Ws=_(`ZodNanoID`,(e,t)=>{er.init(e,t),w.init(e,t)}),Gs=_(`ZodCUID`,(e,t)=>{tr.init(e,t),w.init(e,t)}),Ks=_(`ZodCUID2`,(e,t)=>{nr.init(e,t),w.init(e,t)}),qs=_(`ZodULID`,(e,t)=>{rr.init(e,t),w.init(e,t)}),Js=_(`ZodXID`,(e,t)=>{ir.init(e,t),w.init(e,t)}),Ys=_(`ZodKSUID`,(e,t)=>{ar.init(e,t),w.init(e,t)}),Xs=_(`ZodIPv4`,(e,t)=>{ur.init(e,t),w.init(e,t)}),Zs=_(`ZodIPv6`,(e,t)=>{pr.init(e,t),w.init(e,t)}),Qs=_(`ZodCIDRv4`,(e,t)=>{mr.init(e,t),w.init(e,t)}),$s=_(`ZodCIDRv6`,(e,t)=>{gr.init(e,t),w.init(e,t)}),ec=_(`ZodBase64`,(e,t)=>{yr.init(e,t),w.init(e,t)}),tc=_(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),w.init(e,t)}),nc=_(`ZodE164`,(e,t)=>{Cr.init(e,t),w.init(e,t)}),rc=_(`ZodJWT`,(e,t)=>{Tr.init(e,t),w.init(e,t)}),ic=_(`ZodNumber`,(e,t)=>{Er.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.isFinite=!0},We({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=vo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=vo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=vo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>vo(e).format??null},{gt(e,t){return this.check(wa(e,t))},gte(e,t){return this.check(Ta(e,t))},min(e,t){return this.check(Ta(e,t))},lt(e,t){return this.check(Sa(e,t))},lte(e,t){return this.check(Ca(e,t))},max(e,t){return this.check(Ca(e,t))},int(e){return this.check(oc(e))},safe(e){return this.check(oc(e))},positive(e){return this.check(wa(0,e))},nonnegative(e){return this.check(Ta(0,e))},negative(e){return this.check(Sa(0,e))},nonpositive(e){return this.check(Ca(0,e))},multipleOf(e,t){return this.check(Ea(e,t))},step(e,t){return this.check(Ea(e,t))},finite(){return this}}));function T(e){return ha(ic,e)}var ac=_(`ZodNumberFormat`,(e,t)=>{Dr.init(e,t),ic.init(e,t)});function oc(e){return _a(ac,e)}var sc=_(`ZodBoolean`,(e,t)=>{Or.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function E(e){return va(sc,e)}var cc=_(`ZodNull`,(e,t)=>{kr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function lc(e){return ya(cc,e)}var uc=_(`ZodUnknown`,(e,t)=>{Ar.init(e,t),S.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function D(){return ba(uc)}var dc=_(`ZodNever`,(e,t)=>{jr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function fc(e){return xa(dc,e)}var pc=_(`ZodArray`,(e,t)=>{As(),Nr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Oa(e,t))},nonempty(e){return this.check(Oa(1,e))},max(e,t){return this.check(Da(e,t))},length(e,t){return this.check(ka(e,t))},unwrap(){return this.element}});function O(e,t){return Ha(pc,e,t)}var mc=_(`ZodObject`,(e,t)=>{As(),zr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),Xe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return P(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(oe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(oe(this._zod.def,{catchall:D()}))},loose(){return this.clone(oe(this._zod.def,{catchall:D()}))},strict(){return this.clone(oe(this._zod.def,{catchall:fc()}))},strip(){return this.clone(oe(this._zod.def,{catchall:void 0}))},extend(e){return we(this,e)},safeExtend(e){return Ee(this,e)},merge(e){return De(this,e)},pick(e){return xe(this,e)},omit(e){return Ce(this,e)},partial(...e){return Oe(Oc,this,e[0])},exactPartial(...e){return Oe(Ac,this,e[0],`exactPartial`)},required(...e){return ke(Rc,this,e[0])}});function k(e,t){return new mc({type:`object`,shape:e??{},...h(t)})}function hc(e,t){return new mc({type:`object`,shape:e,catchall:fc(),...h(t)})}function A(e,t){return new mc({type:`object`,shape:e,catchall:D(),...h(t)})}var gc=_(`ZodUnion`,(e,t)=>{Vr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.options=t.options});function j(e,t){return new gc({type:`union`,options:e,...h(t)})}var _c=_(`ZodDiscriminatedUnion`,(e,t)=>{gc.init(e,t),Ur.init(e,t)});function M(e,t,n){return new _c({type:`union`,options:t,discriminator:e,...h(n)})}var vc=_(`ZodIntersection`,(e,t)=>{Wr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r)});function yc(e,t){return new vc({type:`intersection`,left:e,right:t})}var bc=_(`ZodTuple`,(e,t)=>{As(),qr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Oc({type:`optional`,innerType:e}))})}});function xc(e,t,n){let r=t instanceof v;return new bc({type:`tuple`,items:e,rest:r?t:null,...h(r?n:t)})}var Sc=_(`ZodRecord`,(e,t)=>{As(),Zr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function N(e,t,n){return!t||!t._zod?new Sc({type:`record`,keyType:C(),valueType:e,...h(t)}):new Sc({type:`record`,keyType:e,valueType:t,...h(n)})}function Cc(e,t,n){return new Sc({type:`record`,keyType:e,valueType:t,...h(n),partial:!0})}var wc=_(`ZodEnum`,(e,t)=>{Qr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wc({...t,checks:[],...h(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wc({...t,checks:[],...h(r),entries:i})}});function P(e,t){return new wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...h(t)})}var Tc=_(`ZodLiteral`,(e,t)=>{$r.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function F(e,t){return new Tc({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}var Ec=_(`ZodTransform`,(e,t)=>{As(),ei.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new it(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Be(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Be(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dc(e){return new Ec({type:`transform`,transform:e})}var Oc=_(`ZodOptional`,(e,t)=>{ni.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`optional`,innerType:e})}var Ac=_(`ZodExactOptional`,(e,t)=>{ri.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e){return new Ac({type:`optional`,innerType:e})}var Mc=_(`ZodNullable`,(e,t)=>{ii.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Mc({type:`nullable`,innerType:e})}var Pc=_(`ZodDefault`,(e,t)=>{ai.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fc(e,t){return new Pc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Ic=_(`ZodPrefault`,(e,t)=>{si.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lc(e,t){return new Ic({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Rc=_(`ZodNonOptional`,(e,t)=>{ci.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zc(e,t){return new Rc({type:`nonoptional`,innerType:e,...h(t)})}var Bc=_(`ZodCatch`,(e,t)=>{di.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vc(e,t){return new Bc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qe(t)})}var Hc=_(`ZodPipe`,(e,t)=>{fi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.in=t.in,e.out=t.out});function Uc(e,t){return new Hc({type:`pipe`,in:e,out:t})}var Wc=_(`ZodReadonly`,(e,t)=>{mi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new Wc({type:`readonly`,innerType:e})}var Kc=_(`ZodCustom`,(e,t)=>{gi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r)});function qc(e,t={}){return Ua(Kc,e,t)}function Jc(e,t){return Wa(e,t)}function Yc(e){return da(Ns,e)}function Xc(e){return ga(ic,e)}var Zc=T().int().nonnegative();k({jsonrpc:F(`2.0`),id:Zc,method:C().min(1),params:N(C(),D()),trace_id:Bs().optional()});var Qc=k({jsonrpc:F(`2.0`),method:C().min(1),params:N(C(),D())}),$c=k({code:T().int(),message:C(),data:k({condition:C().optional()}).catchall(D()).optional()}),el=j([k({jsonrpc:F(`2.0`),id:Zc.nullable(),result:D()}),k({jsonrpc:F(`2.0`),id:Zc.nullable(),error:$c})]),tl=k({id:Zc,seq:T().int().positive(),event:C().min(1),data:D()});j([el,k({jsonrpc:F(`2.0`),method:F(`stream`),params:tl}),Qc]),P([`sidecar_unavailable`,`sidecar_rpc_version_mismatch`,`agent_runtime_stale`,`agent_incompatible`,`cancelled`]);var nl=k({rpc_version:T().int().positive()}),rl=k({rpc_version:T().int().positive(),python:C(),python_version:C(),agent_dir:C().nullable(),agent_revision:C().nullable(),agent_version:C().nullable(),pinned_revision:C().regex(/^[a-f0-9]{40}$/),pinned_version:C(),pinned_image:C(),compatible:E(),stale:E(),agent_source_changed:E().optional(),update_state:P([`absent`,`active`,`stale`,`unknown`,`incomplete`,`unverified`]),import_error:C().nullable()}),il=k({current:F(!0),agent_revision:C().nullable()}),al=k({exit_code:T().int().optional()}),ol=k({set:N(C(),C()).optional(),unset:O(C()).optional()}),sl=k({ok:F(!0)}),cl=k({id:T().int()}),ll=k({cancelled:E(),reason:C().optional()}),ul=k({methods:O(C())}),dl=k({agent_dir:C().min(1)}),fl=k({ok:E(),skipped:E(),detail:C()}),pl=P([`install`,`gateway_restart`,`agent_ready`]),ml=k({operation_id:Bs(),baseline_revision:C().regex(/^[a-f0-9]{40}$/),target_revision:C().regex(/^[a-f0-9]{40}$/),stage:pl,recovered_revision:C().regex(/^[a-f0-9]{40}$/).optional(),source_moved:E().optional(),attempt_error:C().max(2e3).optional(),failed_stage:pl.optional()}),hl=k({probe:E().optional(),complete_revision:C().regex(/^[a-f0-9]{40}$/).optional()}),gl=k({ok:E(),owed:E(),fingerprint:C(),detail:C(),local_restore:E().optional(),revision:C().regex(/^[a-f0-9]{40}$/).optional(),runtime_pending:E().optional(),operation:ml.optional(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional(),draining:E().optional()}),_l=k({token:C().regex(/^[a-f0-9]{32}$/),services:O(C().min(1)).min(1)}),vl=M(`action`,[k({action:F(`begin`),agent_dir:C().min(1),revision:C().regex(/^[a-f0-9]{40}$/),homes:O(C().min(1)).min(1),operation_id:Bs().optional(),baseline_revision:C().regex(/^[a-f0-9]{40}$/).optional(),intent:C().min(1).max(1024).optional(),refresh_token:C().regex(/^[a-f0-9]{32}$/).optional()}),k({action:F(`git`),agent_dir:C().min(1),token:C().regex(/^[a-f0-9]{32}$/),args:O(C().max(65536)).min(1).max(1e3),timeout_ms:T().int().min(100).max(3e5)}),k({action:P([`sync`,`finish`]),agent_dir:C().min(1),token:C().regex(/^[a-f0-9]{32}$/)})]),yl=fl.extend({recovery_required:E().optional(),token:C().regex(/^[a-f0-9]{32}$/).optional(),refresh_confirmation:_l.optional()}),bl=M(`event`,[k({event:F(`progress`),data:k({phase:F(`gateway_drain`),deadline_seconds:T().min(0),services:O(C())})})]),xl=k({name:C(),description:C().optional(),original_name:C().optional(),provider:C().optional(),model:C().optional(),base_url:C().optional(),api_mode:C().optional(),api_key_set:E().optional(),api_key:C().optional(),api_key_clear:E().optional(),reasoning_effort:C().optional(),service_tier:C().optional(),fallback_providers:O(D()).optional(),request_overrides:D().optional(),profile:C().optional(),label:C().optional()}),Sl=k({options:O(xl).optional(),profiles:O(xl).optional(),default:C().nullable()}),Cl=M(`action`,[k({action:F(`backend`),backend:C()}),k({action:F(`routes`),backend:P([`model_map`,`profile_routes`]),block:Sl})]),wl=k({supported:E(),configured:C(),effective:C().nullable(),available:E(),blocked_reason:C().nullable(),fixed_model_active:E(),backends:O(k({name:C(),label:C(),description:C(),available:E(),reason:C()})),profiles:O(C())}),Tl=xl.omit({api_key:!0,api_key_clear:!0,original_name:!0,request_overrides:!0}),El=Sl.extend({options:O(Tl).optional(),profiles:O(Tl).optional()}),Dl=wl.extend({can_edit:E().describe(`Only server owners may edit delegation modes and named routes.`),model_map:El,profile_routes:El}),Ol=15e6,kl=Math.ceil(Ol/3)*4,Al=C().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),I=Al,jl=k({attachment_id:I,kind:P([`image`,`pdf`,`file`]),name:C().min(1).max(255).regex(/^[^/\\\x00\r\n]+$/),mime:C().max(127).regex(/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/),size:T().int().positive().max(Ol)}),Ml=k({member_id:I,profile:C().min(1).max(128),handle:I,display_name:C().max(128).optional()}),Nl=Ml.extend({target:k({kind:P([`local`,`peer`]),profile:C()}).optional()}),Pl=k({room_id:I,name:C().max(200),members:O(Nl).max(6),authority_gateway_id:C(),authority_epoch:T().int(),revision:T().int(),latest_seq:T().int().optional(),disbanded_at:T().optional()}),Fl=k({kind:P([`retry`,`discard`,`approval`]),member_id:I,task_id:I,execution_generation:T().int().positive(),request_id:C().optional(),approval:k({command:C().optional(),description:C().optional(),choices:O(P([`once`,`deny`])).optional()}).optional()}),Il=k({running:E(),working:E(),blocked:E(),pending_actions:O(Fl),member_activity:O(k({member_id:I,status:P([`queued`,`running`,`stopping`,`indeterminate`,`deferred`])})).optional()});k({driver:E(),authority_gateway_id:C(),methods:O(C()),seatable_profiles:O(C()),max_log_limit:T().int().positive()}),k({room:Pl,driver_status:Il.optional()}),k({rooms:O(Pl),next_offset:T().int().nullable()}),k({events:O(k({room_id:I,seq:T().int().positive(),event_id:I,kind:C(),authority_epoch:T().int().nullable(),actor:k({kind:C(),id:C(),profile:C().optional()}),payload:k({text:C().optional(),member_id:I.optional(),discussion_event_id:I.optional(),task_id:I.optional(),turn_id:I.optional(),error:C().optional(),reason_code:C().optional(),attachments:O(jl).optional()}),created_at:T()})),cursor:T().int().nonnegative(),latest_seq:T().int().nonnegative(),has_more:E(),authority:k({gateway_id:C(),epoch:T().int()})});var Ll=k({member_id:I,task_id:I,execution_generation:T().int().positive()}),Rl=M(`action`,[k({action:F(`capabilities`)}),k({action:F(`list`),offset:T().int().nonnegative().optional(),limit:T().int().positive().max(100).optional()}),k({action:F(`create`),room_id:I,name:C().trim().min(1).max(200),members:O(Ml).min(2).max(6)}),k({action:F(`state`),room_id:I,include_disbanded:E().optional()}),k({action:F(`log`),room_id:I,since_seq:T().int().nonnegative(),limit:T().int().positive().max(100).optional()}),k({action:F(`rename`),room_id:I,event_id:I,name:C().trim().min(1).max(200)}),k({action:F(`disband`),room_id:I,cancel_id:I}),k({action:F(`send`),room_id:I,event_id:I,payload:k({text:C().max(65536),attachments:O(jl).max(8).optional()})}),k({action:F(`stop`),room_id:I,cancel_id:I}),Ll.extend({action:F(`retry`),room_id:I}),Ll.extend({action:F(`discard`),room_id:I}),Ll.extend({action:F(`approve`),room_id:I,request_id:I,choice:P([`once`,`deny`])}),k({action:F(`attachment.upload`),room_id:I,upload_id:I,kind:P([`image`,`pdf`,`file`]),name:C().min(1).max(255),mime:C().max(127),data_base64:C().max(kl)}),k({action:F(`attachment.download`),room_id:I,event_id:I,attachment_id:I})]),zl=k({room_id:I,gateway_id:C(),authority_epoch:T().int()}),Bl=k({profile_home:C().min(1),subject:C().min(1).max(128),operation:Rl,expected_room:zl.optional()}),Vl=k({state:P([`available`,`unavailable`,`refused`,`unknown`]),reason:C().nullable(),value:N(C(),D()).nullable()}),Hl=k({id:C().max(128),label:C().max(256),used_bp:T().int().min(0).max(1e4),resets_at_ms:T().int().nonnegative().nullable()}),Ul=k({kind:F(`usage_window`),plan:C().nullable(),gauges:O(k({label:C(),left_fraction:T().min(0).max(1),style:P([`green`,`yellow`,`red`]),resets_at_ms:T().int().nonnegative().max(864e13).nullable(),scope:C(),title:C()})),top_tier_model_ids:O(C()),featured_model_ids:O(C()),paused_reason:C().nullable(),credits_pay:E().nullable()}),Wl=k({state:P([`included`,`free`,`blocked`,`credits`,`unknown`]),usage_level:P([`free`,`low`,`medium`,`top_tier`]).nullable(),resets_at_ms:T().int().nonnegative().max(864e13).nullable()}),Gl=O(k({kind:P([`recommended`,`other`]),model_ids:O(C())})),Kl=k({metadata_status:P([`current`,`pending`,`stale`,`error`,`unsupported`]).optional(),plan_usage:Ul.nullable().optional(),usage_levels:N(C(),P([`free`,`low`,`medium`,`top_tier`])).optional(),unavailable_model_ids:O(C()).optional(),allowance_pending:E().optional(),free_tier:E().nullable().optional()}),ql=k({draft_id:C().regex(/^d_[0-9a-f]{8}$/),card:T().int().positive()}),Jl=k({from:C().max(320),to:O(C().max(320)).max(50),cc:O(C().max(320)).max(50),bcc:O(C().max(320)).max(50),subject:C().max(300),body:C().max(2e4)}),Yl=k({draft:ql.extend({producer:F(`draft-cards`),producer_revision:C(),kind:P([`email`,`message`]),platform:C(),version:T().int().positive(),revision:C(),fields:Jl,state:P([`draft`,`approved`,`sent`,`saved`,`failed`,`discarded`,`superseded`,`unavailable`]),can_edit:E(),can_approve:E(),masked:E()}).nullable()}),Xl=ql.extend({session_id:C().min(1),tool_call_id:C().min(1)}),Zl=Xl.extend({action:P([`edit`,`approve`]),version:T().int().positive(),revision:C().min(1),fields:Jl.optional()}),Ql=T().nonnegative(),$l=j([Ql,xc([Ql,Ql]).refine(([e,t])=>e<=t,`Minimum must not exceed maximum`)]),eu=j([$l,hc({credits:$l,note:C().optional()})]),tu=hc({tool_costs:N(C().min(1),eu).nullable().optional(),spend_limit:Ql.nullable().optional(),cost_unit:C().max(32).refine(e=>e.trim().length>0,`Unit must not be blank`).nullable().optional()}).refine(e=>Object.keys(e).length>0,`Choose a policy field to edit`),nu=P([`native`,`package`,`default`]),ru=k({name:C(),source:P([`native`,`package`,`native_override`]),valid:E(),can_edit:E(),error:C().nullable(),package_revision:C(),overrides:k({tool_costs:N(C(),eu).nullable(),spend_limit:Ql.nullable(),cost_unit:C().nullable()}),tool_costs:O(k({name:C(),low:Ql,high:Ql,note:C()})),spend_limit:Ql,cost_unit:C(),budget_enabled:E(),field_sources:k({tool_costs:nu,spend_limit:nu,cost_unit:nu})}),iu=ru.omit({package_revision:!0}).extend({revision:C(),provenance:F(`declared_estimate`),reload_required:F(!0),runtime_state:F(`unknown`)}),au=T().int().nonnegative().max(2**53-1).nullable(),ou=P([`system_prompt`,`tool_definitions`,`rules`,`skills`,`mcp`,`subagent_definitions`,`memory`,`conversation`]),su=k({available:E(),reason:P([`not_built`,`unsupported`,`changed`,`unavailable`]).nullable(),used_tokens:au,window_tokens:au,estimated_total:au,source:P([`local_estimate`,`provider_usage`,`provider_usage_plus_estimate`]).nullable(),estimated:E().nullable(),categories:O(k({id:ou,tokens:au.unwrap(),percent:T().min(0).max(100).nullable(),estimated:F(!0)})).max(8),files:O(k({label:P([`AGENTS.md`,`SOUL.md`,`.hermes.md`,`CLAUDE.md`,`GEMINI.md`,`CONTEXT.md`,`Context file`]),characters:au,tokens:au,status:P([`loaded`,`truncated`,`flagged`,`shadowed`,`blocked`,`empty`,`unreadable`,`suppressed`,`unknown`]),loaded:E().nullable()})).max(64),truncated:E(),current_turn_output_tokens:au,last_turn_output_tokens:au}),cu=P([`claude-code`,`codex`,`cursor`]),lu=k({status:P([`available`,`unavailable`,`preview`,`applied`,`partial`,`changed`,`unknown`]),sources:O(k({agent:cu,label:C().max(64)})).max(3),items:O(k({kind:C().max(64),status:P([`imported`,`skipped`,`conflict`,`error`]),label:C().max(256)})).max(2048),stripped_secrets:O(C().max(200)).max(2048),catalog_required:E().optional(),receipt:C().max(128).nullable(),can_apply:E(),message:C().max(512).nullable()}),uu=k({provider:C().nullable(),provider_label:C().nullable(),until:T(),until_kind:P([`reset`,`retry`])}),du=k({phase:F(`prompt_reading`),progress_percent:T().min(0).max(100).nullable()}),fu=M(`phase`,[k({phase:F(`compressing`)}),k({phase:F(`rate_limit_wait`),wait:uu}),du,k({phase:F(`working`)})]),pu=k({id:P([`standard`,`priority`,`ultrafast`,`fast`]),service_tier:P([`default`,`priority`,`ultrafast`]).describe(`Value to save; Anthropic Fast is persisted as priority and sent as speed: fast.`)}),mu=4194304,hu=k({provenance:P([`native_owner`,`direct_workspace`]),baseline:P([`earliest_retained_project_checkpoint`,`selected_checkpoint`]),available:E(),reason:P([`checkpoints_disabled`,`no_baseline`,`checkpoint_unavailable`,`payload_too_large`,`invalid_payload`,`owner_unavailable`]).nullable(),truncated:E()}),gu=k({diff:C().max(mu),stat:C().max(mu),comparison:hu}),_u=k({checkpoint:C(),workspace:C(),diff:C(),files_changed:O(k({file:C(),status:C()})),total_changes:T().int(),comparison:hu.optional()}),vu=N(C(),D()),yu=C().min(1).max(8192).regex(/\S/,`Command must not be blank`),bu=k({stdout:C().max(8e3),stderr:C().max(4e3),code:T().int()}),xu=4194304,Su=P([`json`,`markdown`,`html`]),Cu=k({format:Su,filename:C().min(1).max(255),content:C().max(xu)}),wu=P([`👍`,`👎`,`❤️`,`😂`,`😮`,`🎉`]),Tu=k({items:O(k({emoji:wu,count:T().int().positive(),mine:E()})),selected:wu.nullable()}),Eu=k({row_id:T().int().positive(),state:Tu,actions:O(k({emoji:wu.nullable(),result:Tu}))}),Du=k({admission_id:C(),sequence:T().int(),status:P([`queued`,`started`,`unknown`,`terminal`]),outcome:C().nullable(),authority_epoch:T().int(),execution_generation:T().int().nullable(),controls:O(C()).optional(),steering:E().optional(),text:C().optional(),input_id:C().optional()}),Ou=k({plan_gauge:Hl.nullable().optional(),session_id:C(),stored_session_id:C(),messages:O(vu),message_count:T().int(),running:E(),authority_epoch:T().int(),replay_epoch:C(),last_sequence:T().int(),subscription_id:C(),revision:T().int(),execution_generation:T().int(),reactions_supported:E().optional(),todo_state:k({todos:O(vu),revision:T().int().nonnegative().optional()}).nullable().optional().describe(`Canonical owner plan. Null clears it; omission retains transcript fallback for older owners.`),pending:O(Du),prompts:O(vu),info:vu}),ku=A({operation:C(),status:C().optional()}),Au=k({state:P([`applied`,`deferred`,`confirmation_required`,`refused`]),message:C().optional(),confirm:C().optional(),model:C().optional(),provider:C().nullable().optional()}),ju=k({state:P([`attached`,`stopped`,`unavailable`,`incompatible`,`refused`]),reason:C().nullable(),replay_gap:E().optional(),snapshot:Ou.nullable(),receipt:j([Du.extend({voice_stopped:fc().optional()}),ku.extend({voice_stopped:fc().optional()}),hc({voice_stopped:F(!0)})]).nullable(),model_change:Au.optional(),context_detail:su.optional(),export:Cu.optional(),checkpoint_diff:gu.optional(),shell:bu.optional(),restarting:E().optional().describe(`The owner is in a restart's after-turn wait: parked prompts stay answerable, new work is refused.`),lock:k({status:P([`ok`,`expired`]),remaining:O(C()).optional()}).optional().describe("`clarify_lock`: the batch question ids the owner still waits on; `expired` when the batch already ended.")}),Mu=k({request_id:C().min(1),questions:O(k({qid:C().min(1),question:C(),choices:O(C()).optional(),multi_select:E().optional()})).min(1)}),Nu=k({profile_home:C().min(1),session_id:C().min(1),action:P([`snapshot`,`watch`,`context_detail`,`submit`,`receipt`,`cancel`,`steer_queued`,`replace_queued`,`interrupt`,`approval`,`clarify`,`clarify_lock`,`discard`,`mutate`,`export`,`checkpoint_diff`,`terminal_info`,`shell_exec`,`react`]),row_id:T().int().positive().optional(),emoji:wu.nullable().optional(),format:Su.optional(),redact:E().optional(),command:yu.optional(),authority_epoch:T().int().nonnegative().optional(),replay_epoch:C().min(1).optional(),request_id:C().min(1).max(128).optional(),text:C().optional(),submission_id:C().min(1).max(128).optional(),show_reasoning:E().optional().describe(`Whether the owner sends reasoning to the server observer; client visibility uses the current profile preference.`),admission_id:C().optional(),execution_generation:T().int().nonnegative().optional(),prompt_id:C().optional(),choice:P([`once`,`session`,`always`,`deny`]).optional(),question_id:C().min(1).optional(),answer:C().optional(),expected_revision:T().int().nonnegative().optional(),operation:P([`rename`,`archive`,`sidebar`,`branch`,`delete`,`rewind`,`reset`,`model`,`workspace`,`compress`]).optional(),payload:vu.optional()}),Pu=P([`normal`,`ignore_config`,`safe`]),Fu=k({profile_home:C().min(1),probe:E().optional(),request_id:C().min(1).max(128).optional(),execution_mode:Pu.exclude([`normal`]).optional(),cwd:C().min(1).optional(),model:C().min(1).optional(),provider:C().min(1).optional(),base_url:C().min(1).optional(),toolsets:O(C().min(1)).optional()}),Iu=P([`agent_unsupported`,`served_profile`,`gateway_stopped`,`gateway_unavailable`]),Lu=k({modes:O(k({mode:Pu,available:E(),reason:Iu.nullable(),can_reference:E().optional().describe(`A fresh chat in this mode accepts earlier-conversation references. Absent means unavailable.`),can_attach:E().describe(`A fresh chat in this mode accepts file attachments.`)}))}),Ru=k({session_id:C().min(1)}),zu=Ru.extend({admission_id:C().min(1),execution_generation:T().int().positive()}),Bu=M(`action`,[hc({session_id:C().min(1),action:F(`react`),row_id:T().int().positive(),emoji:wu.nullable()}),Ru.extend({action:F(`cancel`),admission_id:C().min(1)}),Ru.extend({action:F(`steer_queued`),admission_id:C().min(1)}),Ru.extend({action:F(`replace_queued`),admission_id:C().min(1),submission_id:C().min(1).max(128),text:C().trim().min(1)}),zu.extend({action:F(`discard`)}),zu.extend({action:F(`retry`)}),Ru.extend({action:F(`mutate`),request_id:Nu.shape.request_id.unwrap(),expected_revision:T().int().nonnegative(),execution_generation:T().int().nonnegative(),operation:P([`rename`,`rewind`,`reset`,`model`,`workspace`,`compress`]),payload:vu})]),Vu=k({state:ju.shape.state,reason:C().nullable(),can_submit:E(),can_interrupt:E(),can_attach:E(),restarting:E().describe(`The owning gateway is restarting once this turn ends; sending waits until it is back.`),revision:T().int().nullable(),execution_generation:T().int().nullable(),model_change:Au.optional(),active_admission:Du.nullable().optional(),admissions:O(Du.extend({actions:O(P([`cancel`,`steer`,`edit`,`retry`,`discard`]))}))}),Hu=k({kind:C(),title:C(),model:C(),provider:C(),message:C()}),L=k({profile_home:C().min(1)}),Uu=k({base_home:C().min(1)}),Wu=k({ok:E()}),R=D(),z=N(C(),D()),Gu=k({toolsets:O(k({name:C(),description:C(),available:E(),selected:E(),unavailable_reason:P([`disabled`,`unavailable`]).nullable()})),selected_toolsets:O(C()),using_defaults:E()}),Ku={"toolsets.catalog":{params:L.extend({enabled_toolsets:O(C()).nullable()}),result:Gu}},qu=k({goal:C(),status:C(),turns_used:T().int(),max_turns:T().int(),last_verdict:C().nullable(),last_reason:C().nullable(),paused_reason:C().nullable()}),Ju=L.extend({session_id:C().min(1),default_max_turns:T().int().positive().optional()}),Yu=k({reason:C().nullable(),until:T().nullable()}),Xu=k({goal:qu.nullable(),active:E(),parked:Yu.nullable(),message:C(),message_key:C().optional(),message_args:O(R).optional()}),Zu=k({ok:E(),action:C(),message:C(),goal:qu.nullable(),error:C().optional(),kickoff_prompt:C().optional(),message_key:C().optional(),message_args:O(R).optional()}),Qu=k({status:C().nullable(),should_continue:E(),continuation_prompt:C().nullable(),verdict:C(),reason:C(),message:C(),message_key:C().optional(),message_args:O(R).optional()}),$u={"goals.get":{params:Ju,result:Xu},"goals.command":{params:Ju.extend({args:C(),stream_running:E().optional(),workspace:C().optional()}),result:Zu},"goals.snapshot":{params:Ju,result:k({goal:qu.nullable(),snapshot:C().nullable()})},"goals.restore":{params:Ju.extend({snapshot:C().nullable()}),result:k({goal:qu.nullable()})},"goals.evaluate":{params:Ju.extend({last_response:C(),user_initiated:E().optional(),workspace:C().optional()}),result:Qu}},ed=k({name:C(),description:C(),category:C(),aliases:O(C()),args_hint:C(),subcommands:O(C()),cli_only:E(),gateway_only:E(),exec:E(),prompt:P([`expand`,`unsupported`]).nullable()}),td=k({key:C(),type:P([`string`,`number`,`boolean`,`enum`,`json`,`secret`]),label:C(),description:C(),required:E(),choices:O(C()).optional(),default:R.optional(),value:R.optional(),env:C().optional(),has_value:E().optional()}),nd=P([`applied`,`restart_required`,`unknown`]),rd=P([`signed_in`,`sign_in_needed`,`revoked`,`logged_out`]),id=k({id:C(),state:rd,authorize_host:C(),token_host:C()}),ad=M(`status`,[k({key:C(),status:F(`updated`)}),k({key:C(),status:F(`needs_consent`),verdict:F(`caution`),findings:C(),consent_token:C().min(1)}),k({key:C(),status:F(`blocked`),verdict:C(),findings:C()})]),od=k({query:C().trim().max(200).default(``),offset:Xc().int().min(0).max(1e4).default(0),limit:Xc().int().min(1).max(50).default(20)}),sd=k({name:C().regex(/^[a-z0-9_-]{1,64}$/),consent_token:C().min(1).max(128).optional()}),cd=k({supported:E(),read_only:E().optional(),entries:O(k({name:C(),title:C(),description:C(),repo:C(),sha:C(),tier:C(),category:C(),requirements:O(C()),installed_key:C().nullable(),installed_sha:C().nullable(),can_install:E(),refusal:C().nullable()})),total:T().int().nonnegative(),next_offset:T().int().nullable()}),ld=M(`status`,[k({name:C(),key:C(),status:F(`installed`),enabled:F(!1)}),k({name:C(),status:F(`needs_consent`),findings:C(),consent_token:C()}),k({name:C(),status:F(`blocked`),findings:C()})]),ud=k({name:C(),display_name:C(),auth_type:C(),setup:P([`ready`,`missing_cli`,`needs_setup`,`not_loaded`,`unavailable`])}),dd=k({name:C().regex(/^[a-z][a-z0-9_-]{0,63}$/),label:C().max(80),version:C().max(40),description:C().max(300),enabled:E(),panel:C().nullable(),has_api:E()}),fd=k({status:T().int().min(200).max(599),body:C(),content_type:C()}),pd=L.extend({name:C()}),md=k({name:C(),description:C(),skill_count:T().int(),source:F(`bundle`)}),hd=k({name:C(),source:F(`bundle`),message:C(),loaded_skills:O(C()),missing_skills:O(C())}),gd=262144,_d=C().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/),vd=T().int().min(0).max(gd),yd={"drafts.review":{params:ql.extend({profile_home:C().min(1),session_id:C().min(1),action:P([`read`,`edit`,`approve`]),version:T().int().positive().optional(),revision:C().optional(),fields:Jl.optional()}),result:Yl},"commands.registry":{params:L,result:k({commands:O(ed)})},"commands.exec":{params:L.extend({command:C().min(1),session_id:C().min(1).optional(),workspace:C().optional()}),result:k({output:C(),source:P([`agent`,`plugin`])})},"commands.expand_prompt":{params:L.extend({command:C().min(1),session_id:C().min(1).optional(),workspace:C(),enabled_toolsets:O(C()).nullable()}),result:k({name:C().nullable(),message:C().nullable()})},"commands.bundles":{params:L,result:k({bundles:O(md)})},"commands.bundle_resolve":{params:L.extend({command:C().min(1)}),result:hd},"commands.moa_preset":{params:L.extend({preset:C().nullable().optional()}),result:k({moa:z})},"plugins.buffers":{params:L.extend({action:P([`list`,`read`,`save`]),session_id:C().min(1).max(200),name:_d.optional(),content:C().max(gd).optional()}),result:k({supported:E(),buffers:O(k({name:_d,size:vd,read_only:E()})).max(200),content:C().max(gd).optional(),size:vd.optional(),read_only:E().optional(),write_semantics:F(`unconditional`)})},"plugins.dashboard_list":{params:L,result:k({supported:E(),plugins:O(dd)})},"plugins.dashboard_toggle":{params:pd.extend({enabled:E()}),result:k({ok:F(!0)})},"plugins.dashboard_asset":{params:pd.extend({path:C()}),result:fd},"plugins.dashboard_request":{params:pd.extend({path:C(),method:C(),query:C(),headers:N(C(),C()),body:C(),authenticated:E(),websocket:E()}),result:fd},"plugins.providers":{params:L,result:k({providers:O(ud)})},"plugins.list":{params:L.extend({selected_providers:N(C(),C()).optional()}),result:k({plugins:O(k({name:C(),key:C(),version:C(),description:C(),enabled:E(),kind:C(),activation:C(),hooks:O(C()),is_active_provider:E().optional(),update_available:E().optional(),latest_revision:C().optional()})),supported_hooks:O(C())})},"plugins.catalog":{params:L.extend(od.shape),result:cd},"plugins.install":{params:L.extend(sd.shape),result:ld},"plugins.update":{params:L.extend({key:C().min(1),accept_caution:E().optional(),consent_token:C().min(1).max(128).optional()}),result:ad},"plugins.isolation":{params:Uu,result:k({profiles:O(k({name:C(),isolation:P([`in_process`,`host`]),third_party_plugins:T().int()}))})},"plugins.settings":{params:L,result:k({supported:E(),plugins:O(k({key:C(),fields:O(td)}))})},"plugins.oauth_status":{params:L,result:k({supported:E(),plugins:O(k({key:C(),clients:O(id)}))})},"plugins.oauth_logout":{params:L.extend({key:C().min(1),id:C().min(1)}),result:k({key:C(),id:C(),removed:E()})},"plugins.settings_save":{params:L.extend({key:C().min(1),values:N(C(),R),secret_envs:N(C(),C()).optional()}),result:k({key:C(),written:O(C()),fields:O(td),runtime_application:nd.optional()})}},B=L.extend({board:C().nullable().optional()}),bd=k({id:C(),title:C(),status:C(),priority:T().int(),claim_live:E(),has_completion_evidence:E(),agent_move_targets:O(C()).nullable()}).catchall(R),xd=k({task:bd,read_only:E()}),Sd={links:k({parents:O(C()),children:O(C())}),link_tasks:O(k({id:C(),title:C(),status:C()}))},Cd={current_run_started_at:T().nullable()},wd=j([k({changed:F(!1),latest_event_id:T().int(),read_only:E()}),k({changed:F(!0),columns:O(k({name:C(),label:C(),tasks:O(bd)})),tenants:O(C()),assignees:O(C()),latest_event_id:T().int(),read_only:E(),filters:k({tenant:C().nullable(),assignee:C().nullable(),include_archived:E(),only_mine:E(),profile:C().nullable()})})]),Td=j([C(),k({name:C(),on_disk:E().optional(),counts:N(C(),T().int()).optional()}).catchall(R)]),Ed=k({id:T().int(),task_id:C().nullable(),run_id:j([T().int(),C()]).nullable(),kind:C(),payload:R,created_at:T().nullable()}),Dd=k({slug:C(),name:C().nullable().optional(),archived:E().optional()}).catchall(R),Od=k({source:C(),target:C()}),kd=k({key:C(),board:C(),board_name:C(),task:bd.extend(Cd)}),Ad=k({nodes:O(kd).max(500),edges:O(Od).max(2e3),generated_at:T(),truncated:E(),read_only:E()}),jd={"kanban.inspection":{params:B.extend({include_archived:E().optional()}),result:Ad},"kanban.board":{params:B.extend({tenant:C().nullable().optional(),assignee:C().nullable().optional(),include_archived:E().optional(),only_mine:E().optional(),since:T().int().nullable().optional(),profile:C().nullable().optional()}),result:wd},"kanban.boards":{params:L.extend({include_archived:E().optional()}),result:k({boards:O(Dd.extend({is_current:E(),counts:N(C(),T().int()),total:T().int()})),current:C(),read_only:E()})},"kanban.create_board":{params:L.extend({board_spec:z}),result:k({board:Dd,current:C(),read_only:E()})},"kanban.update_board":{params:L.extend({slug:C(),board_spec:z}),result:k({board:Dd,read_only:E()})},"kanban.delete_board":{params:L.extend({slug:C(),delete:E().optional()}),result:k({result:R,current:C(),read_only:E()})},"kanban.switch_board":{params:L.extend({slug:C()}),result:k({current:C(),read_only:E()})},"kanban.task":{params:B.extend({task_id:C()}),result:k({task:bd.extend(Cd),comments:O(z),events:O(z),...Sd,runs:O(z),read_only:E()})},"kanban.create_task":{params:B.extend({task:z}),result:xd},"kanban.patch_task":{params:B.extend({task_id:C(),patch:z}),result:xd},"kanban.task_action":{params:B.extend({task_id:C(),action:P([`block`,`unblock`]),reason:C().nullable().optional(),confirm_running_exit:E().optional()}),result:xd},"kanban.comment":{params:B.extend({task_id:C(),body:C(),author:C().optional()}),result:k({ok:F(!0),comment_id:j([T().int(),C()]),read_only:E()})},"kanban.link":{params:B.extend({parent_id:C(),child_id:C()}),result:k({ok:F(!0),parent_id:C(),child_id:C(),read_only:E()})},"kanban.unlink":{params:B.extend({parent_id:C(),child_id:C()}),result:k({ok:F(!0),changed:E(),parent_id:C(),child_id:C(),read_only:E()})},"kanban.normalize_board":{params:B,result:k({board:C()})},"kanban.events":{params:B.extend({since:T().int().optional(),limit:T().int().optional()}),result:k({events:O(Ed),cursor:T().int(),latest_event_id:T().int(),read_only:E()})},"kanban.config":{params:B,result:k({columns:O(C()),assignees:O(Td),default_tenant:C(),lane_by_profile:E(),include_archived_by_default:E(),render_markdown:E(),read_only:E()})},"kanban.stats":{params:B,result:k({column_order:O(C())}).catchall(R)},"kanban.assignees":{params:B,result:k({assignees:O(Td)})},"kanban.task_log":{params:B.extend({task_id:C(),tail:T().int().optional()}),result:k({task_id:C(),path:C(),exists:E(),size_bytes:T().int(),content:C(),truncated:E()})},"kanban.bulk":{params:B.extend({bulk:z}),result:k({results:O(k({id:C(),ok:E(),error:C().optional()})),read_only:E()})},"kanban.dispatch":{params:B.extend({dry_run:E().optional(),max:T().int().optional()}),result:z}},Md=P([`active_turn`,`runtime_history_unsupported`]),Nd=L.extend({session_id:C().min(1)}),Pd={"state_db.sync_start":{params:Nd.extend({model:C().nullable().optional()}),result:Wu},"state_db.sync_usage":{params:Nd.extend({input_tokens:T().int().optional(),output_tokens:T().int().optional(),estimated_cost:T().nullable().optional(),model:C().nullable().optional(),title:C().nullable().optional(),message_count:T().int().nullable().optional(),cache_read_tokens:T().int().optional(),cache_write_tokens:T().int().optional(),api_call_count:T().int().nullable().optional()}),result:Wu},"state_db.sync_title":{params:Nd.extend({title:C(),manual:E().optional()}),result:Wu},"state_db.delete_cli_session":{params:Nd.extend({include_compression_lineage:E().optional()}),result:Wu.extend({refused:Md.optional(),deleted_ids:O(C().min(1)).optional()})},"state_db.append_message":{params:Nd.extend({role:C().min(1),content:C(),tool_name:C().nullable().optional(),timestamp:T().nullable().optional()}),result:Wu},"state_db.prune_advice":{params:L,result:k({advice:k({lines:O(C()).min(1)}).nullable()})}},Fd=k({session_id:C(),tip_session_id:C()}),Id=P([`own`,`served`,`parked`,`standalone`,`stopped`]),Ld=k({name:C(),path:C(),is_default:E(),gateway_running:E(),model:C().nullable(),provider:C().nullable(),has_env:E(),visible:E(),skill_count:T().int(),enabled_skills:T().int(),total_skills:T().int(),gateway_mode:Id.default(`stopped`),display_name:C().default(``),description:C().default(``),has_avatar:E().default(!1),canonical_session:Fd.nullable().default(null)}),Rd={"profiles.import":{params:L.extend({action:P([`discover`,`preview`,`apply`,`result`]),agent:cu.optional(),receipt:C().min(1).max(128).optional()}),result:lu},"profiles.list":{params:Uu,result:k({profiles:O(Ld)})},"profiles.create":{params:Uu.extend({name:C().min(1),clone_from:C().nullable().optional(),clone_config:E().optional()}),result:k({profile:Ld})},"profiles.delete":{params:Uu.extend({name:C().min(1)}),result:k({ok:F(!0)})},"profiles.runtime_env":{params:L.extend({protected_keys:O(C()).optional()}),result:k({env:N(C(),C())})},"profiles.skills_stats":{params:L,result:k({enabled:T().int(),total:T().int()})}},zd=k({load_name:C().optional(),declared_name:C().optional(),status:P([`unique`,`ambiguous`,`shadowed`]).optional(),tier:T().int().optional()}),Bd=zd.extend({name:C(),description:C(),category:C().nullable(),disabled:E()}),Vd=C().regex(/^[a-f0-9]{64}$/),Hd=k({name:C().min(1).max(256),revision:Vd.optional(),compare_to:Vd.optional()}),Ud=k({state:P([`available`,`missing`,`unavailable`]),reason:P([`backend_unavailable`,`identity_unavailable`,`history_unavailable`,`invalid_history`]).nullable(),backend_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),revisions:O(k({id:Vd,sha256:Vd,label:C().max(12),saved_at:C().nullable(),actor:C().max(80).nullable(),current:E()})).max(64),selected:k({revision:Vd,content:C().max(32768)}).nullable(),comparison:k({from_revision:Vd,to_revision:Vd,diff:C().max(131072)}).nullable(),replay_available:F(!1)}),Wd=j([k({success:F(!0),name:C(),description:C(),tags:O(C()),related_skills:O(C()),content:C(),path:C(),skill_dir:C().nullable(),linked_files:N(C(),O(C())),editable:E().optional()}),k({success:F(!1),error:C(),available_skills:O(C()).optional(),available_skills_truncated:E().optional(),total_skills:T().int().optional(),hint:C().optional()})]),Gd={"skills.revisions":{params:Hd.extend({profile_home:C().min(1)}),result:Ud},"skills.list":{params:L.extend({category:C().nullable().optional()}),result:k({success:E().optional(),skills:O(Bd),categories:O(C()),count:T().int(),message:C().optional()})},"skills.view":{params:L.extend({name:C().min(1)}),result:Wd},"skills.find":{params:L.extend({name:C().min(1)}),result:k({found:E(),skill_dir:C().nullable(),skill_md:C().nullable(),load_name:C().optional(),declared_name:C().optional(),sibling_load_names:O(C()).optional()})}},Kd={"mcp.cost_policies":{params:L.extend({servers:z}),result:k({supported:E(),policies:O(ru)})},"mcp.status":{params:L,result:k({servers:O(k({name:C()}).catchall(R))})},"mcp.registry_tools":{params:L,result:k({tools:O(k({name:C(),server:C(),schema:z}))})},"mcp.reload":{params:L,result:k({output:C()})}},qd=k({account_id:C().min(1),email:C().nullable(),state:P([`idle`,`pending`,`retrying`,`claimed`,`gone`,`failed`,`paused`,`unknown`,`unavailable`]),lines:O(C()),moved:O(C()),dropped:O(C()),reconnect:O(C()),poll_after:T().int().min(1).nullable()}),Jd=C().regex(/^[a-z0-9][a-z0-9_-]*$/),Yd=k({mode:P([`unrestricted`,`deny-all`,`allow`,`deny`]),connectors:O(C()).optional(),disabled_connectors:O(C()).optional(),tools:N(C(),k({disable:O(C())})).optional(),tags:k({enable:O(C()).optional(),disable:O(C()).optional()}).optional()}),Xd=k({name:C(),kind:C(),state:P([`pending`,`initiated`,`connected`,`skipped`,`failed`,`expired`,`not_connected`]),detail:C(),connect_url:C().nullable().optional(),required_env:O(k({name:C(),prompt:C(),required:E(),secret:E()}))}),Zd=k({op_id:C(),settled:E(),owner:P([`account`,`session`]),tool_call_id:C().nullable(),targets:O(Xd)}),Qd=L.extend({op_id:C().min(1)}),$d=k({available:E(),guest_id:C().nullable(),eligible:E(),due_in:T().int().nonnegative().nullable(),claimed:E()}),ef={"connectors.offer.status":{params:L,result:$d},"connectors.offer.claim":{params:L.extend({guest_id:C().min(1)}),result:$d},"connectors.available":{params:L,result:k({available:E()})},"connectors.catalog":{params:L,result:k({connectors:O(k({slug:C(),name:C(),description:C(),category:C(),logo_url:C().nullable()}))})},"connectors.accounts":{params:L,result:k({accounts:O(k({connection_id:C(),connector:C(),status:C(),status_reason:C().nullable(),label:C(),alias:C().nullable(),active:E(),disabled:E(),created_at:C()}))})},"connectors.remove":{params:L.extend({connection_id:C().min(1)}),result:k({connection_id:C(),connector:C(),status:F(`removed`)})},"connectors.tools":{params:L.extend({connector:Jd,refresh:E().optional()}),result:k({connector:C(),tools:O(k({slug:C(),name:C(),description:C(),facet:C(),hints:O(C()),categories:O(C()),deprecated:E()}))})},"connectors.policy.get":{params:L,result:k({layers:O(k({kind:P([`org`,`role`,`member`]),revision:C(),body:Yd})),effective:Yd.extend({revision:C()})})},"connectors.policy.set":{params:L.extend({connector:Jd,expected_revision:C().min(1),enabled:E().optional(),tool:C().min(1).optional(),tool_enabled:E().optional()}),result:k({revision:C()})},"connectors.connect":{params:L.extend({connector:Jd,nous_account_id:C().min(1).optional()}),result:Zd},"connectors.operation":{params:Qd,result:Zd},"connectors.respond":{params:Qd.extend({action:P([`skip`,`retry`,`approve`,`continue`]),target:C().optional(),env:N(C(),C()).optional()}),result:Zd}},tf={"tts.synthesize":{params:L.extend({text:C().min(1).max(5e3),provider:C().min(1),speed:T().min(.5).max(2).optional()}),result:k({provider:C(),format:C(),audio_b64:C()})}},nf={"stt.capability":{params:L,result:k({available:E(),provider:C(),streaming:E(),warm_supported:E()})},"stt.warm":{params:L,result:k({provider:C(),warmed:E(),action:C(),error:C().optional()})},"stt.transcribe":{params:L.extend({audio_b64:C().min(1),suffix:C().optional()}),result:k({transcript:C(),filtered:E()})},"stt.stream":{params:L.extend({sample_rate:T().int().min(8e3).max(48e3)}),result:k({transcript:C(),filtered:E(),provider:C()}),stream:M(`event`,[k({event:F(`ready`),data:k({stream_id:C()})}),k({event:F(`partial`),data:k({text:C()})})])},"stt.stream_audio":{params:k({stream_id:C().min(1),audio_b64:C().optional(),end:E().optional()}),result:k({ok:F(!0)})}},rf=k({id:C(),name:C().nullable().optional(),profile:C().nullable(),toast_notifications:E(),monitor:C(),continuity:E(),running_elsewhere:E().optional(),recovery_only:E().optional()}).catchall(R),af=L.extend({job_id:C().min(1)}),of=k({job:rf}),sf=k({model:C().optional(),provider:C().optional(),estimated_cost_usd:T().optional(),duration_seconds:T().optional(),input_tokens:T().int().nullable().optional(),output_tokens:T().int().nullable().optional(),total_tokens:T().int().nullable().optional()}),cf=k({name:C(),type:C(),label:C(),default:C().nullable(),options:O(C()),optional:E(),strict:E(),help:C()}),lf=k({blueprints:O(k({key:C(),title:C(),description:C(),category:C(),source:P([`builtin`,`plugin`]),plugin:C().nullable(),schedule_label:C(),slots:O(cf)}))}),uf=k({key:C().min(1),values:N(C(),C())}),df=k({draft:k({name:C(),prompt:C(),schedule:C(),deliver:C(),skills:O(C())})}),ff={"cron.blueprints":{params:L,result:lf},"cron.blueprint_fill":{params:uf.extend({profile_home:C().optional()}),result:df},"cron.list":{params:L.extend({probe_store:E().optional()}),result:k({jobs:O(rf),store_health:k({store:C(),error:C(),since:C(),fix:C()}).nullable().optional()})},"cron.get":{params:af,result:k({job:rf.nullable()})},"cron.create":{params:L.extend({job:z,execution_home:C().nullable().optional()}),result:of},"cron.update":{params:af.extend({updates:z}),result:of},"cron.delete":{params:af,result:k({ok:F(!0),job_id:C()})},"cron.pause":{params:af.extend({reason:C().nullable().optional()}),result:k({job:k({id:C()}).catchall(R)})},"cron.resume":{params:af,result:k({job:k({id:C()}).catchall(R)})},"cron.run":{params:af.extend({execution_home:C().nullable().optional()}),result:j([k({job_id:C(),status:F(`already_running`),elapsed:T()}),k({job_id:C(),status:P([`completed`,`failed`]),success:E(),error:C().nullable().optional(),delivery_error:C().nullable().optional()})]),stream:M(`event`,[k({event:F(`started`),data:k({job_id:C()})})])},"cron.status":{params:k({job_id:C().optional()}),result:j([k({job_id:C(),running:E(),elapsed:T()}),k({running:N(C(),T())})])},"cron.history":{params:af.extend({offset:T().int().optional(),limit:T().int().optional()}),result:k({job_id:C(),runs:O(k({filename:C(),size:T().int(),modified:T(),usage:sf})),total:T().int(),offset:T().int()})},"cron.run_detail":{params:af.extend({filename:C().min(1)}),result:k({job_id:C(),filename:C(),content:C(),snippet:C(),usage:sf})},"cron.output":{params:af.extend({limit:T().int().optional()}),result:k({job_id:C(),outputs:O(k({filename:C(),content:C()}))})},"cron.delivery_options":{params:L,result:k({platforms:O(k({value:C(),label:C()}))})}},pf={"providers.registry":{params:L,result:k({providers:N(C(),k({id:C(),name:C(),auth_type:C()}).catchall(R))})},"providers.nous_account":{params:L,result:k({nous_account:qd.nullable()})},"providers.auth_status":{params:L.extend({provider:C().nullable().optional()}),result:k({status:k({logged_in:E()}).catchall(R)})},"providers.model_ids":{params:L.extend({provider:C().min(1),force_refresh:E().optional()}),result:Kl.extend({provider:C(),model_ids:O(C()),fallback:E().default(!1)})},"providers.local_models":{params:L,result:k({provider_id:C(),models:O(C()),current_endpoint:C().nullable()})},"providers.resolve_runtime":{params:L.extend({requested:C().nullable().optional(),api_key:C().nullable().optional(),base_url:C().nullable().optional(),target_model:C().nullable().optional()}),result:k({runtime:z})},"providers.credential_pool":{params:L.extend({provider:C().min(1)}),result:k({available:E(),strategy:C(),entries:O(z)})},"models.selection_warnings":{params:L.extend({session_id:C().min(1),model:C().min(1),provider:C().nullable(),current_model:C().nullable(),current_provider:C().nullable(),context_tokens:T().int().positive().nullable(),messages:O(z)}),result:k({warnings:O(Hu),context_tokens:T().int().positive().nullable(),provider:C(),base_url:C()})},"models.speed_tiers":{params:L.extend({routes:O(k({model:C().min(1),provider:C(),base_url:C().optional()}))}),result:k({tiers:O(O(pu))})},"models.context_length":{params:L.extend({model:C().min(1),base_url:C().optional(),api_key:C().optional(),provider:C().optional(),config_context_length:T().int().nullable().optional()}),result:k({model:C(),context_length:T().int().nullable()})},"models.estimate_tokens":{params:k({messages:O(z)}),result:k({tokens:T().int()})},"models.capabilities":{params:L.extend({provider:C(),model:C()}),result:k({capabilities:z.nullable()})}},mf=P([`pending`,`approved`,`denied`,`expired`,`cancelled`,`error`]),hf=k({flow_id:C(),provider:C(),status:mf,error:C().nullable(),nous_account:qd.nullable().optional()}),gf=L.extend({flow_id:C().min(1)}),_f={"oauth.start":{params:L.extend({provider:C().min(1)}),result:k({flow_id:C(),provider:C(),status:F(`pending`),user_code:C().optional(),verification_url:C(),expires_in:T().int(),interval:T().int(),redirect_uri:C().optional(),authorize_host:C().optional(),token_host:C().optional()})},"oauth.poll":{params:gf,result:hf},"oauth.cancel":{params:gf,result:hf},"oauth.submit_redirect":{params:gf.extend({url:C().min(1)}),result:hf}},vf=k({prompt_tokens:T().int().optional(),completion_tokens:T().int().optional(),total_tokens:T().int().optional()}),yf={"aux.complete":{params:L.extend({task:C().min(1),messages:O(z).min(1),main_runtime:z.nullable().optional(),main_fallback:E().optional(),max_tokens:T().int().nullable().optional(),temperature:T().nullable().optional(),model:C().nullable().optional(),provider:C().nullable().optional()}),result:k({model:C(),text:C(),usage:vf.nullable(),finish_reason:C().nullable().default(null)}),stream:M(`event`,[k({event:F(`token`),data:k({text:C()})})])},"aux.delegation":{params:L.extend({config:z}),result:wl},"aux.delegation_backend":{params:L.extend({backend:C(),config_path:C()}),result:Wu},"aux.delegation_routes":{params:L.extend({backend:P([`model_map`,`profile_routes`]),block:Sl,current:z}),result:k({block:z})},"aux.tasks":{params:L,result:k({tasks:O(k({key:C().min(1),label:C(),description:C(),inherit_from:C().nullable(),reasoning_effort:C(),effective:k({provider:C(),model:C(),base_url:C()}).nullable()})),reserved:O(C())})},"aux.resolve":{params:L.extend({task:C().min(1),main_runtime:z.nullable().optional()}),result:k({configured:E(),model:C().nullable(),error:C().optional()})}},bf={"text.image_mode":{params:L.extend({provider:C(),model:C(),cfg:z.nullable().optional(),requested_provider:C().optional()}),result:k({mode:P([`native`,`text`]),reason:C(),supports_vision:E().nullable()})},"text.portal_tags":{params:L,result:k({client_tag:C().nullable(),conversation_tag:C().nullable(),tags:j([O(C()),z])})},"text.spoken":{params:k({text:C()}),result:k({spoken_text:C()})}},xf={"memory.check":{params:L.extend({target:P([`memory`,`user`]),content:C()}),result:k({count:T().int(),limit:T().int()})},"memory.write":{params:L.extend({section:P([`memory`,`user`,`soul`]),base:C(),content:C()}),result:k({written:E()})}},Sf=k({id:C().regex(/^[A-Za-z0-9_-]{1,64}$/),kind:P([`skills`,`memory`]),target:C(),op:C(),summary:C(),origin:C(),created_at:T(),diff:C(),approvable:E(),revision:C()}),Cf=k({id:Sf.shape.id,revision:C()}),wf=L.extend({kind:P([`skills`,`memory`]),writes:O(Cf).min(1)}),Tf=k({results:O(k({id:C(),done:E(),message:C()}))}),Ef={"write_approval.pending":{params:L.extend({kind:P([`skills`,`memory`])}),result:k({supported:E(),enabled:E(),items:O(Sf)})},"write_approval.approve":{params:wf,result:Tf},"write_approval.reject":{params:wf,result:Tf}},Df=k({process_id:C(),consumed:E(),type:C().optional(),session_key:C().optional(),origin_ui_session_id:C().optional(),child_process:E().optional(),reconciliation_profile_home:C().optional()}).catchall(R),Of={"process.drain":{params:L.extend({max_events:T().int().positive().optional()}),result:k({events:O(Df)})},"process.recover":{params:Uu,result:k({homes:T().int()})},"process.requeue":{params:k({events:O(z)}),result:k({requeued:T().int()})},"process.mark_consumed":{params:k({process_id:C().min(1)}),result:Wu},"process.consumed":{params:k({process_ids:O(C().min(1))}),result:k({consumed:O(C())})},"process.claim_delivery":{params:L.extend({event:z,consumer:C().min(1)}),result:k({claim_id:C().nullable(),retryable:E().optional()})},"process.complete_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.release_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.defer_delivery":{params:L.extend({event:z,claim_id:C()}),result:Wu},"process.format_notification":{params:k({event:z}),result:k({text:C()})},"process.stop":{params:L.extend({session_id:C().min(1),process_id:C().min(1)}),result:k({outcome:P([`stopped`,`not_running`,`not_found`])})},"process.list":{params:L,result:k({sessions:O(z)})},"process.background_list":{params:L.extend({session_ids:O(C().min(1))}),result:k({delegations:O(k({delegation_id:C(),origin_ui_session_id:C(),state:C(),dispatched_at:T().nullable(),completed_at:T().nullable(),updated_at:T().nullable(),goals:O(C()),child_statuses:O(C()),has_result:E(),live_status:C().nullable(),children:O(k({goal:C(),session_id:C()})).optional()})),processes:O(k({process_id:C(),session_key:C(),command:C(),started_at:T().nullable(),exited:E(),exited_at:T().nullable(),exit_code:T().int().nullable(),completion_reason:C(),watched:E()}))})},"process.delegation_result":{params:L.extend({session_id:C().min(1),delegation_id:C().min(1)}),result:k({text:C()})}},kf=k({provider:C().nullable(),available:E(),unavailable_reason:C().nullable().optional(),windows:O(z),details:O(R)}).catchall(R),Af=k({credential_id:C(),label:C(),status:P([`available`,`exhausted`,`dead`]),unavailable_reason:C().nullable(),retry_after:C().nullable(),matches_api_key:E()}),jf=T().nullable(),Mf=k({status:P([`ok`,`no_key`,`http_error`,`unavailable`]),http_status:T().int().nullable(),quota:k({limit_remaining:jf,usage:jf,limit:jf}).nullable(),label:C().nullable(),is_available:E().nullable(),balances:O(k({currency:P([`CNY`,`USD`]),total:T(),granted:jf,topped_up:jf})),windows:O(k({key:P([`rolling`,`weekly`,`monthly`]),used_percent:T(),reset_at:C(),rate_limited:E()}))}),Nf=C().min(1).nullable().optional(),Pf=M(`scope`,[k({scope:F(`account`),resets_at:C()}),k({scope:F(`models`),models:N(C(),C())})]),Ff={"usage.account":{params:L.extend({provider:C().min(1),base_url:C().nullable().optional(),api_key:C().nullable().optional(),credential_id:Nf}),result:k({snapshot:kf.nullable()})},"usage.pool":{params:L.extend({provider:C().min(1),api_key:C().nullable().optional(),env_vars:O(C().min(1)).optional()}),result:k({entries:O(Af),has_api_key:E().optional()})},"usage.pool_providers":{params:L.extend({key_envs:N(C(),O(C().min(1))).optional()}),result:k({providers:O(C()),keys:N(C(),k({present:E(),revision:C().nullable()})).default({})})},"usage.limits":{params:L.extend({providers:O(k({slug:C().min(1),models:O(C())}))}),result:k({limits:N(C(),Pf)})},"usage.balance":{params:L.extend({provider:P([`openrouter`,`deepseek`,`opencode-go`]),credential_id:Nf,api_key:C().nullable().optional(),env_vars:O(C().min(1)).optional()}),result:Mf}},If={"config.get":{params:L.extend({config_path:C().min(1)}),result:k({path:C(),exists:E(),config:z})},"config.set":{params:L.extend({config_path:C().min(1),config:z}),result:k({ok:F(!0),path:C()})},"config.env_write":{params:L.extend({updates:N(C().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),C().nullable())}),result:k({ok:F(!0),path:C()})},"models.reasoning_efforts":{params:L.extend({model:C(),provider:C()}),result:k({efforts:O(C()),supports_reasoning:E().nullable()})},"personalities.list":{params:k({config:z}),result:k({personalities:O(k({name:C().min(1),description:C(),prompt:C()}))})}},Lf={"worktree.create":{params:L.extend({repo_root:C().min(1)}),result:k({path:C(),branch:C(),repo_root:C(),base:C().nullable()})},"worktree.retain":{params:k({paths:O(C().min(1))}),result:k({results:N(C(),P([`retained`,`missing`,`foreign_lock`]))})}},Rf=L.extend({workspace:C().min(1)}),zf={"checkpoints.list":{params:Rf,result:k({checkpoints:O(k({hash:C(),short_hash:C(),timestamp:C(),reason:C(),files_changed:T().int(),insertions:T().int(),deletions:T().int()})),store:C()})},"checkpoints.diff":{params:Rf.extend({checkpoint:C().min(1)}),result:k({stat:C(),diff:C()})},"checkpoints.restore":{params:Rf.extend({checkpoint:C().min(1),all:E().optional()}),result:k({restored_to:C(),reason:C(),restored_files:O(C()).nullable(),kept_user_edits:O(C()),skipped_oversize:O(C()),failed_deletes:O(C())})}},Bf=k({plan_gauge:Hl.nullable().optional(),prompt_tokens:T().int(),completion_tokens:T().int(),cache_read_tokens:T().int(),cache_write_tokens:T().int(),estimated_cost_usd:T().nullable()}),Vf=A({next_turn_threshold_tokens:T().int().positive().optional()}),Hf=k({status:P([`completed`,`cancelled`,`error`]),messages:O(z),context_messages:O(z).nullable().optional(),post_compression_context_tokens_estimate:T().int().nullable().optional(),final_response:C(),error:C().nullable(),failed:E(),partial:E(),compression_exhausted:E(),tool_limit_reached:E(),max_iterations_summary_request:C(),usage:Bf,context:Vf,model:C(),provider:C(),compressed:E(),agent_session_id:C(),token_sent:E(),pending_steer:C(),live_tool_calls:O(z)}),Uf=k({text:C()}).catchall(R),Wf=k({event_type:C(),name:C().nullable().optional(),preview:R.optional(),args:z.optional(),tid:C().optional(),is_error:E().optional()}).catchall(R),Gf=M(`event`,[k({event:F(`token`),data:Uf}),k({event:F(`reasoning`),data:Uf}),k({event:F(`steer_pending`),data:Uf}),k({event:F(`interim_assistant`),data:Uf}),k({event:F(`usage`),data:Bf}),k({event:F(`tool`),data:Wf}),k({event:F(`tool_progress`),data:k({tool_call_id:C(),message:C().nullable().optional(),progress:T().nullable().optional(),total:T().nullable().optional(),percent:T().nullable().optional()})}),k({event:F(`tool_complete`),data:Wf}),k({event:F(`approval`),data:z}),k({event:F(`clarify`),data:z}),k({event:F(`clarify_resolved`),data:z}),k({event:F(`connection`),data:Zd}),k({event:F(`approval_resolved`),data:A({approval_id:C(),session_id:C().optional(),reason:C().optional()})}),k({event:F(`compressing`),data:z}),k({event:F(`compression_finished`),data:z}),k({event:F(`warning`),data:z}),k({event:F(`status`),data:z}),k({event:F(`notice`),data:A({id:C().nullable().optional(),key:C().nullable().optional(),level:C(),kind:C(),ttl_ms:T().int().nullable().optional(),text:C(),lapses_with_agent:E().optional()})}),k({event:F(`notice_clear`),data:A({key:C()})}),k({event:F(`notices_reset`),data:z}),k({event:F(`provider_phase`),data:k({phase:du.nullable()})}),k({event:F(`rate_limit_wait`),data:A({provider:C().nullable(),until:T().nullable(),until_kind:P([`reset`,`retry`]).optional()})})]),Kf={"chat.start":{params:L.extend({session_id:C().min(1),stream_id:C().min(1),workspace:C(),model:C(),model_provider:C().nullable().optional(),user_message:j([C(),O(z)]),system_message:C().nullable().optional(),conversation_history:O(z),enabled_toolsets:O(C()).nullable().optional(),max_iterations:T().int().nullable().optional(),max_tokens:T().int().nullable().optional(),clarify_timeout_seconds:T().nullable().optional(),reasoning_config:k({enabled:E(),effort:C().optional()}).nullable().optional(),ephemeral_system_prompt:C().nullable().optional(),persist_user_message:C().optional(),ephemeral:E().optional(),voice_turn:E().optional(),connect_card:E().optional(),skill_secret:E().optional(),workspace_local:E().optional()}),result:Hf,stream:Gf},"chat.interrupt":{params:k({stream_id:C().optional(),session_id:C().optional()}),result:k({ok:E(),reason:C().optional(),pending_steer:C().optional(),checkpoint:O(z).optional()})},"chat.steer":{params:k({stream_id:C().optional(),session_id:C().optional(),text:C().min(1)}),result:k({accepted:E(),fallback:C().nullable().optional(),can_redirect:E().optional()})},"chat.steer_withdraw":{params:k({stream_id:C().optional(),session_id:C().optional(),pending:O(C().min(1)).min(1),index:T().int().nonnegative()}),result:k({withdrawn:E()})},"chat.steer_now":{params:k({stream_id:C().optional(),session_id:C().optional(),pending:O(C().min(1)).min(1),index:T().int().nonnegative()}),result:k({redirected:E(),withdrawn:E(),delivery:P([`redirect`,`steer`]).optional(),requeued:P([`kept`,`last`]).optional(),reason:P([`not_running`]).optional()})},"chat.compress":{params:L.extend({session_id:C().min(1),model:C(),model_provider:C().nullable().optional(),conversation_history:O(z),focus_topic:C().nullable().optional(),enabled_toolsets:O(C()).nullable().optional()}),result:k({status:P([`compressed`,`lock_skipped`,`nothing_to_do`]),messages:O(z),before_tokens:T().int(),after_tokens:T().int(),summary:A({headline:C().optional(),token_line:C().optional(),note:C().nullable().optional()}).nullable(),message:C().nullable(),agent_session_id:C(),commit_token:C().nullable()})},"chat.context_detail":{params:L.extend({session_id:C().min(1),model:C().nullable(),model_provider:C().nullable(),workspace:C().nullable()}),result:su},"chat.compress_finalize":{params:k({commit_token:C().min(1),committed:E()}),result:k({finalized:E()})},"chat.finalize_session":{params:L.extend({session_id:C().min(1),reason:P([`clear`,`delete`,`archive`]),lineage:O(C().min(1)).max(1e4).optional()}),result:k({messages:O(C())})},"chat.evict_agent":{params:k({session_id:C().min(1),clear_session:E().optional()}),result:k({evicted:E()})},"chat.commit_memory":{params:L.extend({session_id:C().min(1)}),result:k({committed:E()})},"chat.refine":{params:L.extend({session_id:C().min(1),messages:O(z),focus:C(),model:C(),model_provider:C().nullable().optional(),enabled_toolsets:O(C()).nullable().optional(),max_iterations:T().int().nullable().optional(),max_tokens:T().int().nullable().optional(),reasoning_config:k({enabled:E(),effort:C().optional()}).nullable().optional(),workspace:C().optional(),workspace_local:E().optional()}),result:k({output:C()})},"approval.respond":{params:L.extend({session_id:C().min(1),choice:P([`once`,`session`,`always`,`deny`]),request_id:C().nullable().optional()}),result:k({ok:E(),resolved:T().int(),choice:C()})},"approval.pending":{params:k({session_id:C().min(1)}),result:k({pending:O(z)})},"approval.set_yolo":{params:k({session_id:C().min(1),enabled:E()}),result:k({yolo_enabled:E(),released:T().int()})},"clarify.respond":{params:k({profile_home:C().optional(),stream_id:C().optional(),session_id:C().optional(),clarify_id:C().optional(),response:C()}),result:k({ok:E(),clarify_id:C().optional()})}},qf=L.extend({interrupt:E().optional(),cli_profile:C().nullable().optional(),quick_timeout_seconds:T().optional(),background_wait_seconds:T().optional()}),Jf=k({status:P([`completed`,`failed`,`busy`,`busy_live_work`]),message:C(),detail:C().optional(),returncode:T().int().optional(),reason:C().optional(),timed_out:E().optional()}),Yf=M(`event`,[k({event:F(`progress`),data:k({phase:P([`started`,`draining`])})})]),Xf={"gateway.session":{params:Nu,result:ju,stream:M(`event`,[k({event:F(`snapshot`),data:ju.extend({replaying:E().optional(),reaction_only:E().optional()})}),k({event:F(`event`),data:z}),k({event:F(`replay_complete`),data:k({})}),k({event:F(`clarify_batch`),data:Mu}),k({event:F(`restarting`),data:k({restarting:F(!0)})})])},"gateway.create":{params:Fu,result:ju},"gateway.control":{params:qf.extend({action:P([`start`,`stop`,`restart`])}),result:Jf,stream:Yf},"gateway.restart":{params:qf,result:Jf,stream:Yf},"gateway.mode":{params:L.extend({name:C().min(1),is_default:E()}),result:k({gateway_mode:Id})}},Zf={"gateway.groups":{params:Bl,result:Vl}},Qf=k({}),$f={"rpc.cancel":{params:cl,result:ll},"rpc.methods":{params:Qf,result:ul},"runtime.handshake":{params:nl,result:rl},"runtime.status":{params:Qf,result:rl},"runtime.ensure_current":{params:Qf,result:il},"runtime.shutdown":{params:al,result:sl},"runtime.env":{params:ol,result:sl},"runtime.sync_dependencies":{params:dl,result:fl},"runtime.agent_mutation":{params:vl,result:yl,stream:bl},"runtime.agent_recovery":{params:hl,result:gl},...$u,...yd,...jd,...Pd,...Rd,...Gd,...Ku,...Kd,...ef,...nf,...tf,...ff,...pf,..._f,...yf,...bf,...Of,...Ff,...Xf,...Zf,...Lf,...xf,...Ef,...zf,...If,...Kf};Object.keys($f);function ep(e){return e[0]??{}}function tp(e){return Array.isArray(e)?e:e==null?[]:[e]}var np=`orpc`,rp=`@orpc/shared`,ip=`1.15.2`,ap=class extends Error{constructor(...e){super(...e),this.name=`AbortError`}};function op(e){let t;return()=>{if(t)return t.result;let n=e();return t={result:n},n}}function sp(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}var cp=2,lp=`__${rp}@${ip}/otel/config__`;function up(){return globalThis[lp]}function dp(e,t={},n){return(up()?.tracer)?.startSpan(e,t,n)}function fp(e,t,n={}){if(!e)return;let r=pp(t);e.recordException(r),n.signal?.aborted&&n.signal.reason===t||e.setStatus({code:cp,message:r.message})}function pp(e){if(e instanceof Error){let t={message:e.message,name:e.name,stack:e.stack};return`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t}return{message:String(e)}}async function mp({name:e,context:t,...n},r){let i=up()?.tracer;if(!i)return r();let a=async e=>{try{return await r(e)}catch(t){throw fp(e,t,n),t}finally{e.end()}};return t?i.startActiveSpan(e,n,t,a):i.startActiveSpan(e,n,a)}async function hp(e,t){let n=up();if(!e||!n)return t();let r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function gp(e){return!e||typeof e!=`object`?!1:`next`in e&&typeof e.next==`function`&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]==`function`}var _p=Symbol.asyncDispose??Symbol.for(`asyncDispose`),vp=class{#e=!1;#t=!1;#n;#r;constructor(e,t){this.#n=t,this.#r=sp(async()=>{if(this.#e)return{done:!0,value:void 0};try{let t=await e();return t.done&&(this.#e=!0),t}catch(e){throw this.#e=!0,e}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n(`next`))}})}next(){return this.#r()}async return(e){return this.#e=!0,this.#t||(this.#t=!0,await this.#n(`return`)),{done:!0,value:e}}async throw(e){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n(`throw`)),e}async[_p](){this.#e=!0,this.#t||(this.#t=!0,await this.#n(`dispose`))}[Symbol.asyncIterator](){return this}};function yp({name:e,...t},n){let r;return new vp(async()=>{r??=dp(e);try{let e=await hp(r,()=>n.next());return r?.addEvent(e.done?`completed`:`yielded`),e}catch(e){throw fp(r,e,t),e}},async e=>{try{e!==`next`&&await hp(r,()=>n.return?.())}catch(e){throw fp(r,e,t),e}finally{r?.end()}})}function bp(e,t,n){let r=(t,i)=>{let a=e[i];return a?a({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function xp(e){if(e)return JSON.parse(e)}function Sp(e){return JSON.stringify(e)}function Cp(e){return Tp(e)?Object.getPrototypeOf(e)?.constructor:null}function wp(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function Tp(e){return!!e&&(typeof e==`object`||typeof e==`function`)}function Ep(e,t){let n=e;for(let e of t){if(!Tp(n))return;n=n[e]}return n}var Dp=(()=>{let e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function Op(e,...t){return typeof e==`function`?e(...t):e}function kp(e){return new Proxy(e,{get(e,t,n){let r=Reflect.get(e,t,n);return t!==`then`||typeof r!=`function`?r:new Proxy(r,{apply(t,n,r){if(r.length!==2||r.some(e=>!jp(e)))return Reflect.apply(t,n,r);let i=!0;r[0].call(n,kp(new Proxy(e,{get:(e,t,n)=>{if(i&&t===`then`)i=!1;else return Reflect.get(e,t,n)}})))}})}})}var Ap=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function jp(e){return typeof e==`function`&&Ap.test(e.toString())}function Mp(e){try{return decodeURIComponent(e)}catch{return e}}var Np=`@orpc/client`,Pp=`1.15.2`,Fp=new Set([`bind`,`valueOf`,`toString`,`toJSON`]),Ip={BAD_REQUEST:{status:400,message:`Bad Request`},UNAUTHORIZED:{status:401,message:`Unauthorized`},FORBIDDEN:{status:403,message:`Forbidden`},NOT_FOUND:{status:404,message:`Not Found`},METHOD_NOT_SUPPORTED:{status:405,message:`Method Not Supported`},NOT_ACCEPTABLE:{status:406,message:`Not Acceptable`},TIMEOUT:{status:408,message:`Request Timeout`},CONFLICT:{status:409,message:`Conflict`},PRECONDITION_FAILED:{status:412,message:`Precondition Failed`},PAYLOAD_TOO_LARGE:{status:413,message:`Payload Too Large`},UNSUPPORTED_MEDIA_TYPE:{status:415,message:`Unsupported Media Type`},UNPROCESSABLE_CONTENT:{status:422,message:`Unprocessable Content`},TOO_MANY_REQUESTS:{status:429,message:`Too Many Requests`},CLIENT_CLOSED_REQUEST:{status:499,message:`Client Closed Request`},INTERNAL_SERVER_ERROR:{status:500,message:`Internal Server Error`},NOT_IMPLEMENTED:{status:501,message:`Not Implemented`},BAD_GATEWAY:{status:502,message:`Bad Gateway`},SERVICE_UNAVAILABLE:{status:503,message:`Service Unavailable`},GATEWAY_TIMEOUT:{status:504,message:`Gateway Timeout`}};function Lp(e,t){return t??Ip[e]?.status??500}function Rp(e,t){return t||Ip[e]?.message||e}var zp,Bp=class e extends Error{defined;code;status;data;static{let t=Symbol.for(`__${Np}@${Pp}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[t]??=new WeakSet,zp=globalThis[t],zp.add(e)}constructor(e,...t){let n=ep(t);if(n.status!==void 0&&!Hp(n.status))throw Error(`[ORPCError] Invalid error status code.`);let r=Rp(e,n.message);super(r,n),this.code=e,this.status=Lp(e,n.status),this.defined=n.defined??!1,this.data=n.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(zp.has(this)){let t=Cp(e);if(t&&zp.has(t))return!0}return super[Symbol.hasInstance](e)}};function Vp(e){return e instanceof Bp?e:new Bp(`INTERNAL_SERVER_ERROR`,{message:`Internal server error`,cause:e})}function Hp(e){return e<200||e>=400}function Up(e){if(!wp(e))return!1;let t=[`defined`,`code`,`status`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`code`in e&&typeof e.code==`string`&&`status`in e&&typeof e.status==`number`&&Hp(e.status)&&`message`in e&&typeof e.message==`string`}function Wp(e,t={}){return new Bp(e.code,{...t,...e})}function Gp(e,t){return{...e,...t}}var Kp=class{"~orpc";constructor(e){if(e.route?.successStatus&&Hp(e.route.successStatus))throw Error(`[ContractProcedure] Invalid successStatus.`);if(Object.values(e.errorMap).some(e=>e&&e.status&&!Hp(e.status)))throw Error(`[ContractProcedure] Invalid error status code.`);this[`~orpc`]=e}};function qp(e){return e instanceof Kp||(typeof e==`object`||typeof e==`function`)&&e!==null&&`~orpc`in e&&typeof e[`~orpc`]==`object`&&e[`~orpc`]!==null&&`errorMap`in e[`~orpc`]&&`route`in e[`~orpc`]&&`meta`in e[`~orpc`]}function Jp(e,t){return{...e,...t}}function Yp(e,t){return{...e,...t}}function Xp(e,t){return e.path?{...e,path:`${t}${e.path}`}:e}function Zp(e,t){return{...e,tags:[...t,...e.tags??[]]}}function Qp(e,t){return e?`${e}${t}`:t}function $p(e,t){return e?[...e,...t]:t}function em(e,t){let n=e;return t.prefix&&(n=Xp(n,t.prefix)),t.tags?.length&&(n=Zp(n,t.tags)),n}function tm(e,t){if(qp(e))return new Kp({...e[`~orpc`],errorMap:Gp(t.errorMap,e[`~orpc`].errorMap),route:em(e[`~orpc`].route,t)});if(typeof e!=`object`||!e)return e;let n={};for(let r in e)n[r]=tm(e[r],t);return n}var V=new class e extends Kp{constructor(e){super(e),this[`~orpc`].prefix=e.prefix,this[`~orpc`].tags=e.tags}$meta(t){return new e({...this[`~orpc`],meta:t})}$route(t){return new e({...this[`~orpc`],route:t})}$input(t){return new e({...this[`~orpc`],inputSchema:t})}errors(t){return new e({...this[`~orpc`],errorMap:Gp(this[`~orpc`].errorMap,t)})}meta(t){return new e({...this[`~orpc`],meta:Jp(this[`~orpc`].meta,t)})}route(t){return new e({...this[`~orpc`],route:Yp(this[`~orpc`].route,t)})}input(t){return new e({...this[`~orpc`],inputSchema:t})}output(t){return new e({...this[`~orpc`],outputSchema:t})}prefix(t){return new e({...this[`~orpc`],prefix:Qp(this[`~orpc`].prefix,t)})}tag(...t){return new e({...this[`~orpc`],tags:$p(this[`~orpc`].tags,t)})}router(e){return tm(e,this[`~orpc`])}}({errorMap:{},route:{},meta:{}}),nm={defaultMethod:`POST`,defaultSuccessStatus:200,defaultSuccessDescription:`OK`,defaultInputStructure:`compact`,defaultOutputStructure:`compact`};function rm(e,t){return t===void 0?nm[e]:t}var H=D(),U=C().nullable(),W=T().nullable(),im=T(),am=C().regex(/^[A-Za-z0-9_.:-]{1,128}$/,`invalid session id`),om=A({download_url:C().startsWith(`/api/groups/file?`).optional(),filename:C().optional(),name:C().optional(),path:C().optional(),size:T().optional(),mime:C().optional(),is_image:E().optional(),rollback_token:C().optional()}),sm=P([`shell`,`read`,`list`,`search`,`web`,`write`,`skill`,`memory`,`delegate`,`unknown`]),cm=k({kind:P([`addition`,`deletion`,`context`]),old_line:T().int().nullable(),new_line:T().int().nullable(),text:C()}),lm=k({header:C(),old_start:T().int().nullable(),new_start:T().int().nullable(),new_end:T().int().nullable(),additions:T().int(),deletions:T().int(),lines:O(cm)}),um=k({added:T().int(),removed:T().int(),diff:C(),truncated:E(),hunks:O(lm)}),dm=k({percent:T().min(0).max(100).nullable(),message:C().nullable()}),fm={progress:dm.nullable().optional(),kind:sm.optional(),target:C().optional(),edit_diff:um.optional(),focus_path:U.optional().describe(`TAL-1458: a read or write call's file as a workspace-relative path, the file a companion page shows; absent for any other call or an absolute, home or out-of-workspace path.`)},pm=k({outbound_draft:ql.optional(),text:C().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),exit_code:T().int().optional()}),mm=A({...fm,name:C().optional(),args:H.optional(),function:A({name:C().optional(),arguments:H.optional()}).optional(),id:C().optional(),call_id:C().optional(),tool_call_id:C().optional(),done:E().optional(),is_error:E().optional(),preview:C().nullable().optional(),result:H.optional(),result_view:pm.nullable().optional(),output:H.optional(),duration:T().nullable().optional(),cost_usd:T().nullable().optional(),timestamp:T().nullable().optional(),event_type:C().optional()}),hm=A({type:C(),text:C().optional()}),gm=j([C(),O(hm),lc()]);P([`user`,`assistant`,`system`,`tool`]);var _m=j([C(),T()]),vm=k({task_ids:O(C()),status:P([`running`,`attention`,`completed`,`failed`,`cancelled`,`unknown`]),agents:k({total:T().int(),completed:T().int(),failed:T().int(),running:T().int()})}),ym=k({url:C(),name:C(),mime:C(),kind:P([`image`,`audio`,`video`,`pdf`,`file`])}),bm=A({row_id:C(),order_index:T().int(),role:P([`prose`,`reasoning`,`tool`,`steering`]),created_at:T().optional(),text:C().optional(),titles:O(C()).optional(),display_text:C().optional(),media:O(ym).optional(),tool:A({id:C(),name:C(),...fm,args:H.optional(),preview:C().nullable(),result:H.optional(),result_view:pm.nullable().optional(),done:E(),is_error:E(),duration:T().nullable(),cost_usd:T().nullable(),background:vm.optional(),result_truncated:F(!0).optional(),result_chars:T().int().nullable().optional()}).optional(),steering:A({steer_id:C(),consumed:E(),submitted_at:T().nullable(),consumed_at:T().nullable(),phase_duration:T().nullable().optional()}).optional()}),xm=A({path:C(),action:P([`added`,`edited`,`deleted`,`renamed`])}),Sm=P([`completed`,`no_response`,`cancelled`,`interrupted`,`tool_limit_reached`,`compression_exhausted`,`error`]),Cm=A({version:F(`activity_scene_v1`),activity_rows:O(bm),final_answer:C().optional(),final_answer_excerpt:C().optional().describe(`Collapsed preview of an older settled final answer. Absent on the session-global newest visible reply; its exemption transfers only when a newer visible reply settles.`),turn_duration:T().nullable().optional(),final_answer_display:C().optional(),final_answer_media:O(ym).optional(),terminal_state:C().optional().describe('The turn\'s outcome: a `TurnTerminalState` (`completed`, `no_response`, `error`, `cancelled`, `interrupted`, `tool_limit_reached`, ...), or `running` for the running turn of a run with no journal to replay (TAL-374). A running scene holds every persisted row (no final answer) and renders open, with no "Worked" fold or outcome; the live rows streamed after attach continue it, and the settled scene replaces both.'),expanded_by_default:E().optional(),final_phase_duration:T().optional(),has_consumed_steering:E().optional(),file_changes:O(xm).optional(),activity_rows_total:T().int().optional(),activity_rows_offset:T().int().optional(),activity_rows_complete:E().optional(),activity_rows_omitted:T().int().optional(),activity_scene_ref:C().optional()}),wm=P([`waiting`,`reviewing`,`reviewed`,`failed`,`unknown`]),Tm=k({kind:P([`agent`,`command`,`other`]),status:P([`completed`,`failed`,`notice`]),label:C(),exit_code:T().int().nullable().optional(),review_state:wm.optional()}),Em=A({role:C(),content:gm.optional(),id:_m.optional(),message_id:_m.optional(),timestamp:T().nullable().optional(),reaction_view:Eu.optional(),attachments:O(om).optional(),tool_calls:O(mm).optional(),reasoning:C().optional(),tool_call_id:C().optional(),tool_use_id:C().optional(),name:C().optional(),badge:C().optional(),label:C().optional(),provider_details:H.optional(),provider_details_label:C().optional(),recovery_control:H.optional(),_anchor_activity_scene:Cm.optional(),_turn_id:C().optional(),_turnDuration:T().optional(),_turnTps:T().optional(),_ts:T().optional(),reasoning_titles:O(C()).optional(),_active_turn_user:E().optional(),_steer:A({steer_id:C(),submitted_at:T().nullable().optional(),consumed_at:T().optional(),phase_duration:T().optional()}).optional(),_final_phase_duration:T().optional(),_display_truncated:E().optional().describe(`Whether this settled body has a collapsed preview. The newest settled visible assistant reply and active-turn output remain full.`),_display_excerpt:C().optional().describe(`Collapsed preview with full content retained. The newest settled visible assistant reply remains exempt throughout the next running turn, until a newer visible reply settles.`),_collapsible:E().optional(),_display_content:C().optional(),_media:O(ym).optional(),_background_update:k({kind:P([`delegation`,`process`,`mixed`,`other`]),attention:E(),count:T().int().positive(),summary:C(),lines:O(Tm),review_state:wm.optional()}).optional(),_marker_kind:P([`context_compaction`,`preserved_task_list`]).optional(),_marker_body:C().optional(),_notice_kind:P([`failed_turn`,`session_finalize`]).optional(),_delivery:k({kind:P([`webhook`,`cron`]),name:C(),body:C()}).optional(),_background_reply:E().optional(),_background_silent:E().optional(),_display:P([`row`,`hidden`,`in_scene`]).optional()}),Dm=A({text:C().optional(),files:O(H).optional()}),Om=k({steer_id:C(),text:C(),submitted_at:T(),state:P([`pending`,`sending_now`]),actions:k({edit:E(),cancel:E(),send_now:E()})}),km=k({key:C(),level:P([`info`,`warn`,`error`,`success`]),text:C(),expires_at:W.describe(`Unix seconds when the server drops it; null when only the Agent clears it.`)}),Am=k({text:C(),status:P([`active`,`paused`,`parked`]),turns_used:T().int().nonnegative(),max_turns:T().int().nonnegative(),reason:U,parked_until:W.describe(`Unix seconds a timed park ends; null otherwise.`)}),jm={context_used_tokens:T().int().positive().nullable().optional(),context_window_tokens:T().int().positive().nullable().optional(),context_usage_percent:T().int().min(0).max(100).nullable().optional(),context_threshold_percent:T().int().min(0).max(100).nullable().optional()},Mm=P([`user`,`background`]).nullable().optional().describe(`Who started the running turn; null while idle.`),Nm=E().describe(`True only while the session's run is a live stream on this server.`),Pm=U.optional().describe("The live stream id; non-null only while `is_streaming` is true."),Fm=U.optional().describe(`Server-owned reason this session is display-only or its ownership cannot be verified.`),Im=E().describe(`The session cannot be modified from Web: a read-only import, a view-only subagent child, or a foreign session whose owner refuses claiming.`),Lm=E().describe(`Web may branch this session: never a subagent child or an ownership-locked session; other read-only sessions only when they are cron runs.`),Rm=E().describe(`Web may pin or unpin this session: never a subagent child or a session locked by canonical ownership or unreadable ownership storage.`),zm=E().describe(`Web may archive or unarchive this session: never a subagent child or a session locked by canonical ownership or unreadable ownership storage.`),Bm=E().describe(`Web may delete this session: never a read-only session (a read-only import, a view-only subagent child, or a foreign session whose owner refuses claiming).`),Vm=E().describe(`Web may duplicate this session: it has a WebUI copy, is not a subagent child, and is not locked by canonical ownership or unreadable ownership storage.`),Hm=E().describe(`Web may create or refresh a public share of this session: never a Claude Code import (TAL-551).`),Um=P([`webui`,`cli`,`messaging`,`cron`,`webhook`,`subagent`,`claude_code`,`kanban`,`api`,`other`]).describe("The session's source family. `is_cli_session` is true only for `cli` and `claude_code`."),Wm=T().describe("Epoch seconds the session sorts and date-buckets by: `last_message_at`, else `updated_at`, else `created_at`."),Gm=E().describe("`source_kind` is `messaging`: a gateway chat (Telegram, Signal, WhatsApp, …) the server imports before Web continues it."),Km=U.optional(),qm=k({session_id:am,title:C()}),Jm=k({session_id:C().regex(/^[A-Za-z0-9_-]{1,128}$/).describe(`Retained logical conversation identity.`),tip_session_id:C().regex(/^[A-Za-z0-9_-]{1,128}$/),profile:C().min(1).max(128)}),Ym=Jm.extend({title:C()}),Xm=P([`starting`,`running`,`waiting_for_approval`,`waiting_for_input`,`completed`,`failed`,`cancelled`,`stale`]),Zm=A({id:j([C(),T()]).optional(),text:C().optional(),content:C().optional(),title:C().optional(),status:C().optional(),done:E().optional(),completed:E().optional()}),Qm=A({display_items:O(k({id:j([C(),T()]).optional(),text:C(),state:P([`pending`,`in_progress`,`completed`,`cancelled`])})).optional(),total_count:T().int().nonnegative().optional(),completed_count:T().int().nonnegative().optional(),pending_count:T().int().nonnegative().optional(),in_progress_count:T().int().nonnegative().optional(),cancelled_count:T().int().nonnegative().optional(),session_id:C().optional(),todos:O(Zm).optional(),summary:N(C(),D()).optional(),version:T().optional(),ts:T().optional(),source:C().optional(),description:C().optional()}),$m=A({plan_gauge:Hl.nullable().optional(),show_reasoning:E().optional().describe(`Server-resolved display preference. Hidden reasoning is omitted from live events, history and activity scenes; older servers omit this field.`),activity_phase:Xm.optional(),todo_state:Qm.optional(),source_references:O(Ym).optional(),context_detail_key:C().nullable().optional().describe(`Opaque identity for open-only context details; changes with owner epoch, model and context.`),composer_state_key:C().optional().describe(`Opaque profile-home and owner identity for device-local composer state; never an API session id.`),clear_generation:U.optional().describe(`TAL-848: opaque marker that changes each time /clear empties the session; a client whose clear outcome is unknown compares it with its last read. Null before any clear; older servers omit it.`),session_id:am,title:C(),workspace:C().optional(),created_workspace:C().nullable().optional(),model:U.optional(),model_provider:U.optional(),model_option_id:U.optional().describe(`TAL-301: the catalog entry id the stored model/provider selects; null when none.`),messages:O(Em).optional(),tool_calls:O(mm).optional(),created_at:im.optional(),updated_at:im.optional(),last_message_at:W.optional(),message_count:T().optional(),user_message_count:T().optional(),pinned:E().optional(),archived:E().optional(),project_id:U.optional(),profile:U.optional(),personality:U.optional(),input_tokens:T().optional(),output_tokens:T().optional(),cache_read_tokens:T().optional(),cache_write_tokens:T().optional(),cache_hit_percent:W.optional(),estimated_cost:W.optional(),active_stream_id:Pm,is_streaming:Nm,active_turn_origin:Mm,pending_steers:O(Om).optional().describe(`TAL-424: the active stream's pending steers, oldest first.`),run_status:fu.nullable().optional().describe(`Current server-selected run presentation; null when no turn runs. Older servers omit it.`),compression_started_at:W.optional().describe(`TAL-1006: when the compression clients show started (epoch seconds): the running manual job's, else the live run's open span; null when none runs.`),notices:O(km).optional().describe(`TAL-803: the Agent's active notices for the session, oldest first.`),goal:Am.nullable().optional().describe(`TAL-808: the standing /goal; null when none runs.`),automatic_turns_held:E().optional().describe(`TAL-899: the user pressed Stop, so no automatic turn (background wakeup or goal continuation) starts until their next message.`),has_pending_user_message:E().optional(),pending_user_message:U.optional(),pending_attachments:O(om).optional(),pending_started_at:W.optional(),pending_user_source:U.optional(),context_length:W.optional(),threshold_tokens:W.optional(),last_prompt_tokens:W.optional(),post_compression_context_tokens_estimate:W.optional(),...jm,execution_mode:Pu.optional().describe(`TAL-1040: the Agent execution policy frozen when the session was created; absent from older servers.`),enabled_toolsets:O(C()).nullable().optional(),composer_draft:Dm.optional(),is_cli_session:E().optional(),source_kind:Um,is_messaging_session:Gm,sort_ts:Wm,read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),can_branch:Lm,can_pin:Rm,can_archive:zm,can_delete:Bm,can_duplicate:Vm,can_share:Hm,source_tag:U.optional(),can_compress:E().optional().describe(`TAL-614: a manual compression would start now: writable, no running turn, and at least four model-history messages. Only the full session detail carries it; absent means no.`),confirms_deep_truncate:E().optional().describe("TAL-929: this server holds a `session.truncate` that discards more than one user turn until it is confirmed; absent on older servers, which cut at once."),source_label:U.optional(),session_source:U.optional(),raw_source:U.optional(),parent_session_id:U.optional(),worktree_path:U.optional(),worktree_branch:U.optional(),worktree_repo_root:U.optional(),worktree_retained:F(!0).optional().describe("TAL-1254: the last sidecar start found this worktree gone from git; the Agent's sweep keeps an archived one under `refs/hermes/archive/`. Absent while the worktree exists."),share_token:U.optional(),share_url:U.optional(),share_created_at:W.optional(),manual_title:E().optional(),compression_anchor_summary:U.optional(),compression_recovery:N(C(),H).optional(),recommended_recovery_action:U.optional(),compression_recovery_action:U.optional(),compression_recovery_source_session_id:U.optional(),gateway_routing:H.optional(),_messages_offset:T().optional(),_messages_truncated:E().optional(),_msg_limit_max:T().optional(),_load_revision:C().optional(),transcript_seq:k({stream_id:C(),seq:T().int().nonnegative()}).nullable().optional(),assistant_name:C().optional(),workspace_name:Km,focus_path:U.optional().describe("TAL-1458: the last non-null `focus_path` of the session's persisted tool calls, so a reopened chat shows its file before any stream event; null when none."),branched_from:qm.nullable().optional().describe(`TAL-454: the chat this one was branched from while it still loads (archived included); null for a compression continuation, a deleted or missing parent, and every other chat.`)}),eh=A({session:$m}),th=P([`pinned`,`recent`]),nh=k({kind:th,title:C()}),rh=A({session_id:am,title:C(),workspace:C().optional(),model:U.optional(),created_at:im.optional(),updated_at:im.optional(),last_message_at:W.optional(),message_count:T().optional(),pinned:E().optional(),archived:E().optional(),project_id:U.optional(),profile:U.optional(),is_streaming:Nm,is_cli_session:E().optional(),source_kind:Um,is_messaging_session:Gm,sort_ts:Wm,cron_running:E().optional(),read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),can_branch:Lm,can_pin:Rm,can_archive:zm,can_delete:Bm,can_duplicate:Vm,can_share:Hm,attention:A({kind:C().optional(),count:T().optional()}).nullable().optional(),source_tag:U.optional(),source_label:U.optional(),session_source:U.optional(),raw_source:U.optional(),parent_session_id:U.optional(),active_stream_id:Pm,share_token:U.optional(),share_url:U.optional(),worktree_branch:U.optional(),match_type:P([`title`,`metadata`,`content`]).optional(),match_preview:U.optional(),workspace_name:Km,sidebar_group:th.nullable().optional().describe("TAL-1534: the sidebar group `GET /api/sessions` files the row under; null for an archived row. Other routes omit it."),...jm}),ih=k({state:P([`ok`,`corrupt`,`unavailable`,`outdated`]),reason:C().nullable()}),ah=A({sessions:O(rh).describe("Canonical display order (TAL-306): pinned first, then active (streaming or a pending prompt), then newest `sort_ts`, then `session_id`. Clients keep it."),sidebar_reference_sessions:O(rh),server_time:T(),server_tz:C(),active_profile:C(),all_profiles:E(),include_archived:E(),archived_count:T().int(),archived_webui_count:T().int(),archived_cli_count:T().int(),other_profile_count:T().int(),cli_count:T().int(),webui_session_count:T().int(),cli_session_count:T().int(),scheduled_session_count:T().int().nonnegative(),scheduled_sessions_truncated:E(),webhook_session_count:T().int().nonnegative(),webhook_sessions_truncated:E(),sidebar_groups:O(nh).describe("TAL-1534: the groups the unarchived `sessions` rows fill, in display order; a client captions only these."),agent_storage:ih.describe(`Agent session storage health; a degraded state explains an empty or missing Agent session list.`),archived_limit:T().int().nullable().optional(),archived_offset:T().int().optional()}),oh=A({activity_phase:Xm.optional(),session_id:am,title:C().optional(),active_stream_id:Pm,active_turn_origin:Mm,agent_running:Nm,is_streaming:Nm,read_only:Im,read_only_reason:Fm,owner_attachment:Vu.optional(),message_count:T().optional(),model:U.optional(),profile:U.optional(),workspace:C().optional(),input_tokens:T().optional(),output_tokens:T().optional(),total_tokens:T().optional(),estimated_cost:W.optional(),updated_at:im.optional()}),sh=A({plan_gauge:Hl.nullable().optional(),input_tokens:T().optional(),output_tokens:T().optional(),total_tokens:T().optional(),estimated_cost:W.optional(),model:U.optional()}),ch=A({project_id:C(),name:C(),color:C().nullable().optional(),profile:U.optional(),created_at:T().optional()}),lh=A({projects:O(ch),active_profile:C(),all_profiles:E(),other_profile_count:T().int()}),uh=A({ok:F(!0),state_db_cleanup_failed:E().optional()}),dh=A({submission_id:C().min(1).max(128).optional().describe(`Stable native-owner admission identity. Reuse only for an exact retry of the same submission.`),session_id:am,message:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),workspace:C().nullable().optional(),profile:C().nullable().optional(),explicit_model_pick:E().optional(),attachments:O(j([om,C()])).optional(),moa_config:E().optional(),regenerate:E().optional(),regeneration_revision:C().optional(),voice_turn:E().optional(),connect_card:E().optional(),skill_secret:E().optional()}),fh=A({owner_attachment:Vu.optional(),admission_id:C().optional(),stream_id:C().optional(),session_id:am.optional(),turn_id:C().optional(),user_message_id:j([C(),T()]).nullable().optional(),pending_started_at:T().nullable().optional(),title:C().optional(),effective_model:C().optional(),effective_model_provider:C().optional(),queued:E().optional(),ok:E().optional(),status:C().optional(),reason:C().optional(),session:$m.optional()}),ph=A({activity_phase:Xm.optional(),active:E(),stream_id:C(),replay_available:E().optional(),journal:H.optional(),blocking_stream_id:C().nullable()}),mh=k({steer_id:C().nullable(),reason:P([`edit`,`cancel`,`stopped`,`followup`]),text:C()}),hh=A({activity_phase:Xm.optional(),ok:E(),cancelled:E(),stream_id:C().optional(),withdrawn_steers:O(mh).optional(),error:C().optional()}),gh=k({session_id:am,steer_id:C().min(1),reason:P([`edit`,`cancel`])}),_h=k({withdrawn:E(),text:C().optional()}),vh=k({session_id:am,steer_id:C().min(1)}),yh=k({redirected:E(),outcome:P([`delivered`,`next_step`,`not_running`,`taken`,`failed`])});A({session_id:am,text:C().min(1),display_text:C().optional(),steer_id:C().optional()});var bh=A({accepted:E(),fallback:U.optional(),stream_id:U.optional(),steer_id:C().optional(),started_turn:fh.optional()}),xh=A({allowed_choices:O(P([`once`,`session`,`always`,`deny`])).optional(),can_enable_yolo:E().optional(),approval_id:C().optional(),session_id:C().optional(),command:C().optional(),description:C().optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),question:C().optional(),status:C().optional(),pending_count:T().optional(),run_id:C().optional(),mirror_token:C().optional()}),Sh=A({pending:xh.nullable(),pending_count:T().int()});A({session_id:am,choice:P([`once`,`session`,`always`,`deny`]),approval_id:C().optional(),command:C().optional(),yolo:E().optional(),run_id:C().optional(),mirror_token:C().optional()});var Ch=A({ok:E(),choice:C().optional(),yolo_enabled:E().optional(),stale_cleared:E().optional(),error:C().optional(),pending_count:T().optional()}),wh=j([C(),A({label:C().optional(),value:C().optional(),text:C().optional()})]),Th=A({qid:C(),question:C(),choices:O(C()),multi_select:E(),answered:E().optional().describe(`TAL-1271: a gateway-owned batch question the owner already holds an answer for; it stays editable until the last answer.`)}),Eh=N(C(),j([C(),O(C())])),Dh=k({key:P([`master_password`,`identifier`,`password`,`code`,`secret`]),secure:E()}),Oh=k({kind:P([`vault_unlock`,`vault_save_login`,`vault_code`,`skill_secret`]),backend:C().nullable().describe("The password manager (`vault_unlock`)."),display_name:C().nullable().describe("Its display name (`vault_unlock`)."),origin:C().nullable().describe("The page origin the login is saved for (`vault_save_login`)."),site:C().nullable().describe("The site, by host (`vault_save_login`, `vault_code`)."),hint:C().nullable().describe("Where the code was sent, when the Agent says (`vault_code`)."),skill:k({env_var:C(),skill_name:C(),help:C().nullable(),required_for:C().nullable()}).optional().describe("Profile-local environment setup metadata (`skill_secret`)."),fields:O(Dh),timeout_at:T().describe(`Unix seconds when the Agent stops waiting.`)}),kh=A({pending:A({steps:O(Th).optional(),vault:Oh.optional(),clarify_id:C().optional(),session_id:C().optional(),question:C().optional(),description:C().optional(),choices:O(wh).optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),status:C().optional(),raw_preview:C().optional(),timeout_at:T().optional(),timeout_seconds:T().optional(),pending_count:T().optional(),index:T().optional(),total:T().optional()}).nullable(),pending_count:T().int()});A({session_id:am,answers:Eh.optional(),response:C().optional(),answer:C().optional(),choice:C().optional(),clarify_id:C().optional(),decline:E().optional()});var Ah=A({ok:E(),response:C().optional(),error:C().optional(),stale:E().optional()}),jh=A({text:C(),files:O(H)}),Mh=A({ok:F(!0),draft:jh,draft_version:C().nullable(),unchanged:E().optional()}),Nh=A({filename:C(),path:C(),size:T(),mime:C(),is_image:E().optional(),rollback_token:C().optional(),named_in_prompt:E().optional(),max_attachments_per_message:T().int().positive().optional()}),Ph=A({text:C().optional(),state:C().optional(),status:C().optional(),turns:T().optional(),max_turns:T().optional(),reason:C().optional()}),Fh=A({ok:E().optional(),action:C().optional(),goal:Ph.nullable().optional(),message:C().optional(),message_key:C().optional(),stream_id:C().optional(),status:C().optional(),reason:C().optional()}),Ih=k({task_id:C(),kind:P([`delegation`,`process`,`background_command`]),status:vm.shape.status,title:C(),started_at:T().nullable(),updated_at:T(),completed_at:T().nullable(),result_available:E(),child_sessions:O(k({goal:C(),session_id:am})),exit_code:T().int().nullable(),agents:vm.shape.agents.nullable(),pinned:E(),dismissible:E(),can_stop:E().optional(),active:E()}),Lh=k({activity_phase:Xm.optional(),session_id:C(),tasks:O(Ih),agent_available:E(),agents_working:E().optional()}),Rh=k({task_id:C(),text:C()}),zh=k({session_id:am,task_id:C().min(1)}),Bh=k({outcome:P([`stopped`,`not_running`,`not_found`])}),Vh=k({ok:F(!0),task:Ih}),Hh=A({ok:F(!0),share:A({token:C(),url:C(),title:C(),message_count:T().int(),created_at:T(),updated_at:T()}),session:rh}),Uh=A({role:C(),content:j([C(),lc(),O(H)]).optional()}),Wh=A({share:A({title:C(),messages:O(Uh),message_count:T().int(),created_at:T().optional(),updated_at:T().optional(),model:U.optional()})}),Gh=k({sessions:O(rh.extend({source_reference:Jm})),active_profile:C(),max_sources:T().int()}),Kh=A({title:C().optional(),workspace:C().optional(),workspace_inherited_from_prev_session:E().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),profile:C().nullable().optional(),prev_session_id:C().optional(),project_id:C().nullable().optional(),worktree:H.optional(),enabled_toolsets:O(C()).nullable().optional(),parent_session_id:C().optional(),execution_mode:Pu.optional().describe("TAL-1040: `ignore_config` and `safe` start the session through the Agent owner; omitted means normal."),request_id:C().regex(/^[A-Za-z0-9_-]{1,64}$/).optional().describe(`TAL-1040: stable creation identity for a diagnostic or referenced chat. Reuse it only to retry the same creation.`),source_references:O(Jm).max(5).optional().describe(`Same-profile search pointers. Nonempty selections require request_id; unavailable or changed identities refuse creation.`)}),qh=A({ok:F(!0),available:E(),provider:C(),streaming:E(),warm_supported:E()}),Jh=k({spoken_text:C()}),Yh=A({ok:F(!0),transcript:C(),filtered:E()}),Xh=k({warning_remaining_percent:T().int().min(1).max(99),critical_remaining_percent:T().int().min(0).max(99),pace_tolerance_percent:T().int().min(0).max(25),pace_warning_burn_rate_percent:T().int().min(100).max(300),pace_critical_burn_rate_percent:T().int().min(100).max(400),pace_minimum_elapsed_hours:T().int().min(0).max(72)}),Zh=A({ok:F(!0),message:C().optional()}),Qh=P([`stable`,`nightly`,`experimental`]),$h=A({bot_name:C().optional(),default_model:C().optional(),default_workspace:C().optional(),language:C().optional(),send_key:C().optional(),font_size:C().optional(),full_width_chat:E().optional(),chat_width:P([`comfortable`,`wide`,`full`]).optional(),auto_scroll_follow:E().optional(),render_user_markdown:E().optional(),chat_activity_display_mode:C().optional(),default_message_mode:C().optional(),fade_text_effect:E().optional(),hidden_tabs:O(C()).optional(),composer_control_order:O(C()).optional(),show_cli_sessions:E().optional(),show_claude_code_sessions:E().optional(),show_cron_sessions:E().optional(),show_sidebar_feedback:E().optional().describe(`TAL-1588: show Send feedback in the Web rail above Notifications.`),show_webhook_sessions:E().optional(),show_kanban_sessions:E().optional(),check_for_updates:E().optional(),summarize_updates_automatically:E().optional(),ignore_agent_updates:E().optional(),auth_enabled:E().optional(),password_auth_enabled:E().optional(),password_env_var:E().optional(),passkeys_enabled:E().optional(),passwordless_enabled:E().optional(),auth_disabled_acknowledged:E().optional(),webui_version:C().optional(),agent_version:C().optional(),update_channel:C().optional(),update_channels:O(Qh).optional().describe(`TAL-1569: the Web update channels this server offers, in display order.`),agent_update_channel:P([`stable`,`experimental`]).optional(),update_channel_version:U.optional(),max_tokens:W.optional(),max_tokens_effective:W.optional(),max_tokens_fallback:W.optional(),tts_engine:C().optional(),tts_voice:C().optional(),dictation_append:E().optional(),persisted_speech_keys:O(C()).optional(),confirm_external_links:E().optional(),trusted_link_hosts:O(C()).optional(),provider_quota_thresholds:Xh.optional()}),eg=A({name:C(),path:C().optional(),is_active:E().optional(),is_default:E().optional(),model:U.optional(),provider:U.optional(),skill_count:T().optional(),total_skills:T().optional(),enabled_skills:T().optional(),gateway_running:E().optional(),has_env:E().optional(),visible:E().optional(),gateway_mode:Id.optional(),display_name:C().optional(),description:C().optional(),has_avatar:E().optional(),canonical_session:Fd.nullable().optional(),pending_writes:T().int().optional()}),tg=A({profiles:O(eg),active:C(),single_profile_mode:E().optional()}),ng=A({name:C(),path:C().optional(),is_default:E().optional(),default_workspace:U.optional()}),rg=tg.extend({is_default:E(),default_model:H,default_model_provider:H,default_workspace:C().nullable()}),ig=A({show_reasoning:E().optional(),reasoning_effort:C().nullable().optional(),supported_efforts:O(C()).optional(),supports_reasoning_effort:E().optional(),supports_thinking_toggle:E().optional(),supports_session_scope:E().optional()}),ag=P([`healthy`,`warning`,`critical`,`stale`,`unavailable`]),og=A({allowance:Wl.optional(),id:C(),label:C().optional(),provider:C().optional(),provider_id:C().optional(),bare_id:C().optional(),supports_fast_tier:E().optional(),supported_speed_tiers:O(pu).optional(),limit:k({scope:F(`model`),resets_at:C()}).optional()}),sg=M(`scope`,[k({scope:F(`account`),resets_at:C()}),k({scope:F(`models`),models:N(C(),C())})]),cg=k({status:P([`available`,`stale`,`unavailable`]),authoritative:E(),unavailable_reason:U,generation:C().min(1).describe(`Opaque source generation; cached data from another generation must never be merged.`)}),lg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),sections:Gl.optional(),availability:cg.optional(),provider:C(),provider_id:C().optional(),models:O(og),extra_models:O(og).optional(),limit:sg.optional(),quota_level:ag.optional()}),ug=A({availability:cg.optional(),active_provider:U.optional(),default_model:C().optional(),default_provider_id:U.optional(),default_bare_id:C().optional(),default_option_id:U.optional(),groups:O(lg),aliases:N(C(),H).optional(),configured_model_badges:N(C(),H).optional()}),dg=A({availability:cg.optional(),provider:C().optional(),source:C().optional(),models:O(og),count:T().optional(),error:C().optional()}),fg=P([`env`,`oauth`,`config`,`pool`,`plugin`,`other`]),pg=A({id:C(),display_name:C().optional(),has_key:E().optional(),configured:E().optional(),configurable:E().optional(),is_oauth:E().optional(),is_plugin_provider:E().optional(),is_self_hosted:E().optional(),is_custom:E().optional(),key_source:C().optional(),base_url:U.optional(),auth_error:U.optional(),env_var:U.optional(),models:O(og).optional(),models_total:T().optional(),nous_account:qd.nullable().optional(),nous_account_error:U.optional(),is_active:E().optional(),key_source_kind:fg.nullable().optional(),removable:E().optional()}),mg=A({availability:cg.optional(),providers:O(pg),active_provider:U.optional()}),hg=A({remaining:ag,pace:ag.describe(`Burn rate and pace tolerance; the remaining classification when the window has no pace.`)}),gg=A({expected_remaining_percent:T(),pace_delta_percent:T(),burn_rate:T(),minutes_to_reset:T(),projected_minutes_to_empty:W.describe(`Minutes until the window empties at the current burn; null when nothing has been used.`),elapsed_minutes:T(),valid_until:C(),status:P([`over`,`on`,`under`]).optional().describe("TAL-411, `/api/provider/quotas` only: over when behind pace by at least the tolerance, under when more than 1 point ahead.")}),_g=A({outcome:P([`safe`,`warning`]).describe("`warning` when the projection empties the window before it resets."),budget_unit:P([`hour`,`day`]),budget_percent:W.describe("Remaining percent per `budget_unit` until reset."),depletion_margin_minutes:W.describe(`Projected empty minus reset, in minutes; negative empties early, null when no depletion is projected.`)}),vg=A({label:C(),used_percent:W,remaining_percent:W,reset_at:U.describe(`ISO-8601 UTC.`),detail:U,window_seconds:W.describe(`The provider value, else 5h or weekly from the label; null when unknown.`),pace:gg.nullable().describe(`Null for a window without a future reset, a usage value, or a 5h/weekly length.`),forecast:_g.nullable(),projection_eligible:E().optional().describe("TAL-411, `/api/provider/quotas` only: the burn-rate breakpoints apply (enough elapsed time and use, and the projection empties the window before reset)."),urgency:hg.optional()}),yg=T().int().nullable().optional(),bg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),computed_at:C().optional().describe(`Original reference time of this source, retained with stale windows.`),source_id:C(),provider_id:C().optional(),provider_label:C().optional(),account_label:C().optional(),status:C().optional(),supported:E().optional(),message:C().nullable().optional(),is_active_provider:E().optional(),quota:H.optional(),windows:O(vg).optional(),balances:H.optional(),plan:H.optional(),details:H.optional(),unavailable_reason:H.optional(),retry_after:H.optional(),fetched_at:H.optional(),pace_window_index:yg.describe(`The window a pace-coloured widget shows: the weekly one, else the first 5h/session window.`),session_window_index:yg.describe(`The session (else 5h) window.`),weekly_window_index:yg.describe(`The weekly window.`),urgency:hg.optional().describe("TAL-411: `remaining` of the first window, `pace` of the pace window; alerts and the source colour follow it.")}),xg=A({plan_usage:Ul.nullable().optional(),plan_stale:E().optional(),available:E().optional(),stale:E().optional(),title:C().optional(),plan:H.optional(),unavailable_reason:U.optional(),windows:O(vg),details:H.optional(),fetched_at:U.describe(`ISO-8601 UTC.`),pace_window_index:yg,session_window_index:yg,weekly_window_index:yg}),Sg=A({computed_at:C().describe("ISO-8601 UTC reference time of every window `pace`."),ok:E(),provider:U,display_name:U,supported:E(),status:C(),label:C().optional(),message:C(),quota:H.describe("OpenRouter credits (`limit_remaining`, `usage`, `limit`), else null."),account_limits:xg.nullable().optional()}),Cg=A({availability:cg.optional(),version:T(),computed_at:C().describe(`ISO-8601 UTC request reference time; coalesced or stale sources retain their own computed_at.`),scope_id:C(),profile_id:C(),active_provider:U,requested_source_id:U,missing_source:E().describe("True when `?source=` names a source id this scope no longer has; `sources` is then empty."),sources:O(bg).describe("Each live source id exactly once, ordered by `provider_id`, then `account_label`, then `source_id`. Clients render this list as-is; a `?source=` read returns that one row.")}),wg=A({date:C().describe("UTC day, `YYYY-MM-DD`."),used:W.describe(`Cumulative OpenRouter usage in USD that day.`),delta:W.describe("Spend since the previous day; the day's `used` after a credit reset; null for the first day or a missing `used`."),bar_percent:T().describe("Bar height: `delta` as a percent of the window's largest delta, at least 2 for any positive delta, 0 for a null delta.")}),Tg=A({ok:E(),provider:U,display_name:C().optional(),supported:E().optional(),status:C().describe("`available`, `unavailable` (the snapshots are the last known data), `no_key`, `unsupported`, or `missing_provider`."),message:C(),window_days:T().int().optional(),snapshots:O(wg).optional(),limit:W.optional(),label:U.optional(),monthly_budget:W.optional().describe("Settings `provider_cost_budget`."),monthly_pace:W.optional().describe(`Mean of the non-null deltas × 30, in USD rounded to cents; null without a delta.`),has_enough_data:E().optional().describe(`At least one non-null delta (two daily snapshots).`),budget_percent:W.optional().describe(`round(pace / budget × 100); null without a positive pace and a budget.`),budget_level:P([`ok`,`warn`,`over`]).nullable().optional().describe("`warn` from 80%, `over` from 100%; null without `budget_percent`.")}),Eg=A({personalities:O(A({name:C(),description:C().optional()}))}),Dg=A({task:C(),label:C(),description:C(),provider:C(),model:C(),base_url:C().optional(),api_key_set:E().optional(),is_auto:E(),value_label:C().nullable(),provider_label:C().nullable(),selected_option_id:C().nullable(),in_catalog:E(),inherit_from:C().nullable(),reasoning_effort:C().nullable()}),Og=A({delegation:Dl.optional(),main:A({model:C().optional(),provider:C().optional(),base_url:C().optional(),api_key_set:E().optional(),service_tier:P([``,`default`,`priority`,`ultrafast`]).optional().describe(`Empty string is the Standard value returned by older servers.`),supported_speed_tiers:O(pu).optional()}),tasks:O(Dg)});A({max_tokens:W,max_tokens_effective:W,max_tokens_fallback:W});var kg=A({name:C().min(1),path:C()}),Ag=A({workspaces:O(kg),last:U.optional(),terminal_remote_backend:E().optional()}),jg=A({read_only:E().optional(),name:C(),path:C().optional(),is_dir:E().optional(),type:C().optional(),size:T().nullable().optional(),mtime:T().nullable().optional(),mtime_ns:j([T(),C()]).nullable().optional(),birthtime_ns:j([T(),C()]).nullable().optional(),hidden:E().optional(),workspace_sort_rank:T().int().optional(),target:C().optional(),target_outside_workspace:E().optional()}),Mg=P([`workspace`,`managed`]),Ng={source:Mg.optional(),read_only:E().optional(),write_semantics:F(`unconditional`).optional()},Pg=A({...Ng,unavailable:E().optional(),path:C().optional(),entries:O(jg),signature:C().optional(),workspace:C().optional(),workspace_recovered:E().optional(),is_git:E().optional()}),Fg=P([`text`,`markdown`,`csv`,`html`,`image`,`pdf`,`audio`,`video`,`binary`]),Ig=A({...Ng,name:C().optional(),path:C().optional(),content:C().optional(),lines:T().optional(),size:T().optional(),truncated:E().optional(),binary:E().optional(),mime:C().optional(),preview:Fg.optional(),table:O(O(C())).optional(),table_truncated:E().optional(),preview_url:C().optional()}),Lg=A({is_git:E().optional(),branch:U.optional(),dirty:T().optional(),modified:T().optional(),untracked:T().optional(),ahead:T().optional(),behind:T().optional()}),Rg=A({git:Lg.nullable().optional()}),zg=A({skills:O(A({...zd.shape,name:C(),description:U.optional(),category:U.optional(),disabled:E().optional()})),categories:O(H).optional()}),Bg=A({editable:E().optional(),name:C().optional(),content:C().optional(),path:C().optional(),linked_files:N(C(),O(C())).optional(),binary:F(!0).optional(),size:T().optional(),success:E().optional(),message:C().optional(),ok:E().optional()}),Vg=A({usage:N(C(),A({use_count:T().optional(),view_count:T().optional(),patch_count:T().optional()})),skill_names:O(C()).optional(),total_invocations:T().optional(),unique_skills_used:T().optional()}),Hg=A({memory:C(),user:C(),soul:C(),project_context:C().optional(),memory_path:C().optional(),user_path:C().optional(),soul_path:C().optional(),project_context_path:C().optional(),project_context_name:C().optional(),project_context_workspace:C().optional(),memory_mtime:W.optional(),user_mtime:W.optional(),soul_mtime:W.optional(),project_context_mtime:W.optional(),project_context_shadowed:O(H).optional(),external_notes_enabled:E().optional(),memory_revision:C(),user_revision:C(),soul_revision:C()}),Ug=A({id:C().optional(),name:C().optional(),title:C().optional(),label:C().optional(),text:C().optional(),content:C().optional(),created_at:T().optional()}),Wg=A({prompts:O(Ug)}),Gg=P([`web`,`ios`]),Kg=A({commands:O(A({name:C(),description:C().optional(),aliases:O(C()),args_hint:C().optional(),category:C().optional(),handler:P([`client`,`agent`,`prompt`]),clients:O(Gg),unsupported_message:C().optional(),cli_only:E().optional(),gateway_only:E().optional(),subcommands:O(H).optional(),exec:E().optional()}))}),qg=A({file:C(),tail:T().optional(),lines:O(C()),truncated:E().optional(),total_bytes:T().optional(),mtime:W.optional(),hint:C().optional()}),Jg=A({period_days:T().optional(),total_sessions:T().optional(),total_messages:T().optional(),total_tokens:T().optional(),total_input_tokens:T().optional(),total_output_tokens:T().optional(),total_cache_read_tokens:T().optional(),total_cache_hit_percent:W.optional(),total_cost:T().optional(),activity_by_day:O(A({day:C(),sessions:T()})).optional(),activity_by_hour:O(A({hour:T(),sessions:T()})).optional(),daily_tokens:O(A({date:C(),input_tokens:T().optional(),output_tokens:T().optional(),cache_read_tokens:T().optional(),cost:T().optional(),sessions:T().optional()})).optional(),models:O(A({model:C().optional(),sessions:T().optional(),tokens:T().optional(),cost:T().optional()})).optional()}),Yg=A({running:E(),enabled:C().optional(),url:C().optional(),browser_url:C().optional(),host:C().optional(),port:T().int().optional(),version:C().optional(),error:C().optional()}),Xg=k({running:E(),configured:E(),gateway_mode:Id.nullable(),platforms:O(k({name:C(),label:C()})),last_active:C(),session_count:T().int(),health:k({state:U,reason:U,gateway_state:U})}),Zg=k({ok:F(!0),action:P([`start`,`stop`,`restart`]),message:C(),status:Xg}),Qg=k({enabled:P([`auto`,`always`,`never`]),url:C()}),$g=k({workspace:U,repo_root:U,selected_board_slug:U.optional(),git:Lg.nullable(),docs:k({project:Ig.nullable(),plan:Ig.nullable(),status:Ig.nullable(),blocker_resolver:Ig.nullable()}).partial(),handoff:N(C(),H).nullable(),active:N(C(),H).nullable(),heartbeat:N(C(),H).nullable(),onboarding:A({active:E(),doc_source:P([`project-os`,`root`])}).optional(),goal_summary:C()}),e_=k({agent_runtime_reason:P([`update_active`,`recovery_incomplete`,`source_changed`,`unknown`]).optional(),agent_update_state:C().optional(),retryable:E().optional(),restart_scheduled:E().optional()}),t_=A({chat:M(`available`,[k({available:F(!0),condition:lc()}),k({available:F(!1),condition:P([`sidecar_unavailable`,`agent_incompatible`,`agent_runtime_stale`]),...e_.shape})]).optional().describe(`Always sent since TAL-951; absent from older servers.`),alive:E().nullable().optional(),checked_at:C().optional(),details:A({state:C().optional(),reason:C().optional()}).optional(),gateway_chat:A({enabled:E().optional(),backend:C().optional(),base_url_configured:E().optional(),api_key_configured:E().optional()}).optional(),error:C().optional()}),n_=A({available:E().optional(),status:C().optional(),checked_at:C().optional(),cpu:H.nullable().optional(),memory:H.nullable().optional(),disk:A({percent:T().optional(),total_bytes:T().optional(),used_bytes:T().optional()}).nullable().optional(),errors:O(A({code:C().optional(),metric:C().optional()})).optional(),webui_runtime:H.optional()}),r_=P([`up_to_date`,`release_ready`,`commits_behind`,`local_changes`,`finish`,`manual`,`check_failed`,`off`,`unknown`]),i_=P([`supported`,`unchecked`]),a_=k({version:C().describe(`The release as shown: the Agent tag or the Web release tag.`),ref:C().describe("What `updates.apply`/`updates.force` accept back as `version`: the Agent tag or the Web semver."),sha:C().optional().describe(`Agent only: the commit the tag peels to.`),release_url:C().nullable(),latest:E().describe("The channel's newest release, the one an update without `version` installs."),folded:E().describe(`Shown behind the folded "more versions" node: every entry except the newest.`),support:i_.optional().describe(`Agent only: this release's classification against the verified Agent window.`),support_label:C().optional().describe("Agent only: `support` worded to fit one phone line.")}).describe(`TAL-946: one installable Stable release newer than the installed one.`),o_=A({failed_update:k({version:C(),restored_version:C()}).optional().describe(`Web only: the update that failed before HTTP readiness and the restored package version. Manual retry remains available.`),name:C().optional(),channel:Qh.optional(),unsupported:E().optional().describe("Deprecated (TAL-350): `support === 'unchecked'`, kept for older clients."),support:i_.optional().describe("Agent target only (TAL-350): `supported` when the target revision is exactly a release in the verified Agent window, else `unchecked`; an `unchecked` apply requires `confirmed_agent_revision`."),support_label:C().optional().describe("Agent target only (TAL-946): `support` worded to fit one phone line."),current_support:i_.optional().describe(`Agent target only: the same classification for the installed Agent revision.`),supported_revision:C().optional(),supported_version:C().optional(),candidate_revision:C().optional(),behind:T().nullable().optional(),current_sha:C().nullable().optional(),latest_sha:C().nullable().optional(),compare_url:C().optional(),repo_url:C().optional(),error:C().optional(),ok:E().optional(),manual_update:E().optional(),no_git:E().optional(),install_kind:F(`npm`).optional(),npm:C().optional(),channel_switch:E().optional(),dirty:E().optional(),metadata_repair:E().optional(),release_url:C().optional(),ignored:E().optional(),stale_check:E().optional(),current_version:C().optional(),state:r_.describe("TAL-559: the status clients word; `off` when checks are disabled or Agent updates are ignored."),can_apply:E().describe(`The apply action is available for this target.`),installed_unverified:E().describe("`release_ready` only: the installed revision sits on no release tag."),manual_link:E().describe(`Show the manual-install (releases) link.`),target_version:C().nullable().describe(`The version the update path leads to, when one is shown.`),summary_available:E().describe('TAL-759: offer "Summarize with AI" for this target (`release_ready` or `commits_behind`).'),versions:O(a_).describe("TAL-946: every installable Stable release newer than the installed one, newest first; empty unless `release_ready` can apply."),folded_count:T().int().nonnegative().describe("How many `versions` are `folded`.")}),s_=A({agent_recovery:k({phase:P([`idle`,`running`,`waiting`,`complete`,`blocked`]),attempt:T().int().nonnegative(),detail:C(),retry_at:C().nullable(),operation_id:Bs().optional(),operation:ml.optional(),verified_revision:C().regex(/^[a-f0-9]{40}$/).optional(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional()}).optional(),disabled:E().optional(),cached:E().optional(),channel:C().optional(),agent_channel:P([`stable`,`experimental`]).optional(),checked_at:T().optional(),include_agent:E().optional(),webui:o_.nullable().optional(),agent:o_.nullable().optional()}),c_=k({ok:E(),target:P([`webui`,`agent`]),summary:C(),current_version:C().nullable().describe(`The installed version this summary starts from.`),target_version:C().nullable().describe(`The version this summary leads to, when the update names one.`),summary_sections:O(k({title:C(),items:O(C())})).describe(`Display-ready headed bullet lists; empty when nothing is pending.`),generated_by:P([`llm`,`fallback`,`none`]).describe("`fallback` when no model answered; `none` when the target has no pending update to summarize."),source:P([`release_notes`,`commits`,`none`]).describe(`Stable targets summarize the release notes they install; commit-tracking targets, or unreadable notes, use commit subjects.`),cached:E()}),l_=A({recovery_only:E().optional().describe(`Only a retained transaction was repaired; the selected update outcome remains unverified.`),recovery_pending:E().optional().describe(`The initiating operation remains active through automatic recovery; follow its notification_id without replaying the update.`),verified_revision:C().regex(/^[a-f0-9]{40}$/).optional(),verified_version:C().nullable().optional(),recovery_compatibility:k({manual_execution:E(),bot_chat_delivery:E()}).optional().describe(`Whether the target Agent can reconcile retained manual execution and pending Bot Chat records. A false value blocks the update before any source or repair-intent change.`),ok:E().optional(),status:C().optional(),error:C().optional(),message:C().optional(),lock:H.optional(),confirmation_required:E().optional(),refresh_confirmation:_l.optional(),candidate_revision:C().optional(),supported_revision:C().optional(),supported_version:C().optional(),agent_channel:P([`stable`,`experimental`]).optional(),notification_id:Bs().optional(),channel_switch:E().optional(),backup_dir:C().nullable().optional(),backup_failed:E().optional(),stash_conflict:E().optional(),gateway_restart:C().optional().describe("TAL-953: `waiting_for_idle` when an Agent update left the gateway restart to wait for the gateway's running work; the update notification reports its outcome.")}),u_=P([`applying`,`awaiting_confirmation`,`waiting_for_idle`,`restarting`,`verifying`,`recovering`,`succeeded`,`blocked`,`failed`,`unknown`]),d_=k({id:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),label:C().min(1).max(80),style:P([`default`,`primary`,`destructive`]),acknowledges:E()}),f_=k({key:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_.-]*$/),label:C().min(1).max(80)}),p_=k({id:P([`install`,`web_restart`,`ready`,`gateway_wait`,`gateway_restart`,`agent_ready`,`recovery`]),label:C().min(1).max(80),state:P([`done`,`active`,`pending`,`failed`])}),m_=k({operation:ml,attempt_error:C().max(2e3).nullable(),runtime_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),rollback:E().nullable().optional(),outcome:P([`recovering`,`target_installed`,`baseline_restored`,`other_revision`,`blocked`,`unknown`])}),h_=k({id:Bs(),kind:C().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),target:P([`webui`,`agent`]).nullable(),phase:j([u_,C().min(1).max(64)]),severity:P([`info`,`warning`,`critical`]),persistent:E(),requires_acknowledgement:E(),actions:O(d_).max(4),destination:f_.nullable(),title:C(),message:C(),created_at:Yc(),updated_at:Yc(),read_at:Yc().nullable(),acknowledged_at:Yc().nullable(),acknowledged_action_id:C().nullable(),verified_revision:C().regex(/^[a-f0-9]{40}$/).nullable(),verified_version:C().min(1).max(80).nullable(),detail:C().max(2e3).nullable(),recovery:m_.optional(),unread:E(),active:E(),requires_interaction:E(),can_dismiss:E(),steps:O(p_).max(8),presents_dialog:E(),dialog_close:P([`none`,`close`,`restart_later`,`auto`])}),g_=C().regex(/^[a-f0-9]{64}$/),__=C().regex(/^[A-Za-z0-9_-]{8,64}$/),v_=k({current_build:g_.nullable(),loaded_build:g_.nullable(),refresh_required:E(),notification_id:Bs().nullable()}),y_=k({scope_id:C().min(1).max(64),frontend_build:v_,notifications:O(h_),tab_update:h_.nullable(),tab_joined_at:Yc().nullable(),unread_count:T().int().nonnegative(),clearable_count:T().int().nonnegative(),can_clear:E()}),b_=td.extend({locked:E().optional()}),x_=id.extend({can_sign_out:E()}),S_=A({plugins:O(A({key:C(),name:C().optional(),kind:C().optional(),enabled:E().optional(),description:C().optional(),version:C().optional(),activation:C().optional(),is_active_provider:E().optional(),hooks:O(H).optional(),update:k({available:E(),latest_revision:C().optional()}).optional(),settings:O(b_).optional(),oauth_clients:O(x_).optional()})),empty:E().optional(),read_only:E().optional(),supported_hooks:O(C()).optional(),unavailable:E().optional(),plugin_isolation_advisory:E().optional()}),C_=A({cost_policy:iu.nullable().optional(),name:C(),id:C().optional(),transport:C().optional(),enabled:E().optional(),can_toggle:E().optional().describe(`Whether PATCH can enable or disable this server; false for invalid config.`),active:E().optional(),status:C().optional(),tools:T().optional(),tool_count:T().int().nullable().optional(),health:C().optional(),health_detail:C().optional(),health_checked_at:H.optional(),health_pending:E().optional()}),w_=A({servers:O(C_),health_pending:E().optional(),reload_required:E().optional(),toggle_supported:E().optional()}),T_=k({connection_id:C(),name:C(),problem:P([`pending`,`failed`,`expired`,`revoked`,`inactive`]).nullable(),status_reason:C().nullable(),active:E(),created_at:C()}),E_=k({slug:C(),name:C(),description:C(),category:C(),logo_url:C().nullable(),connected:E(),accounts:O(T_),enabled:E(),org_locked:E(),rules_editable:E(),tools_off:T().int()}),D_=k({available:E(),due:E().describe(`The native eligible due check at this read; an already delivered offer remains visible independently.`),visible:E(),offer_id:C().nullable(),actions:O(P([`sign_in`,`dismiss`])),refresh_after:T().int().positive().nullable()}),O_=k({available:E(),sign_in_required:E().default(!1),sign_in_offer:D_.optional(),connectors:O(E_),policy_revision:C().nullable(),rules_error:C().nullable()}),k_=k({connector:C(),policy_revision:C().nullable(),tools:O(k({slug:C(),name:C(),description:C(),facet:P([`read`,`write`,`destructive`,`unclassified`]),deprecated:E(),enabled:E(),locked:E(),editable:E()}))}),A_=k({op_id:C(),settled:E(),outcome:P([`connected`,`not_connected`]).nullable(),can_continue:E(),tool_call_id:C().nullable(),targets:O(k({name:C(),title:C(),kind:C(),state:P([`pending`,`initiated`,`connected`,`skipped`,`failed`,`expired`,`not_connected`]),detail:C(),connect_url:C().nullable(),actions:O(P([`skip`,`retry`,`approve`])),env_fields:O(k({name:C(),label:C(),required:E(),secret:E()}))}))}),j_=A({tools:O(A({name:C().optional(),server:C().optional(),description:C().optional()})),total:T().int().optional(),source:C().optional(),inventory_scope:C().optional(),unavailable_servers:O(C()).optional()}),M_=A({enabled:E().optional(),sources:O(H).optional(),source:C().optional(),inventory_scope:C().optional(),recent_ai_notes:O(H).optional(),attach_supported:E().optional(),automatic_recall_unchanged:E().optional()}),N_=k({id:C(),title:C(),snippet:C(),parent_id:C(),updated_time:H,source:F(`joplin`)}),P_=k({source:F(`joplin`),query:C(),results:O(N_)}),F_=k({source:F(`joplin`),note:k({id:C(),title:C(),body:C(),parent_id:C(),updated_time:H,created_time:H,source:F(`joplin`)})}),I_=k({available:E(),enabled:E(),status:P([`missing`,`not_directory`,`ready`,`empty`,`error`]),entry_count:T().int(),page_count:T().int(),raw_source_count:T().int(),last_updated:C().nullable(),last_writer:C(),path_configured:E(),path_source:C(),toggle_available:F(!1),toggle_reason:C(),docs_url:C(),error:C().optional()}),L_=k({pages:O(k({name:C(),path:C(),size:T().int(),mtime:T().int()}))}),R_=k({content:C(),path:C()}),z_=A({id:C(),name:C().optional(),label:C().optional(),kind:C().optional(),oauth:E().optional(),needs_key:E().optional(),base_url:U.optional(),models:O(H).optional(),category:C().optional(),default_model:C().optional(),oauth_flow:F(`device_code`).nullable().optional(),oauth_label:C().optional(),signed_in:E().optional()}),B_=A({completed:E(),settings:A({bot_name:C().optional(),default_model:C().optional(),default_workspace:U.optional(),password_enabled:E().optional()}).optional(),setup:A({providers:O(z_).optional(),categories:O(H).optional(),current:A({provider:C().optional(),model:C().optional(),base_url:C().optional()}).optional(),current_is_oauth:E().optional(),unsupported_note:C().optional()}).optional(),system:A({hermes_found:E().optional(),imports_ok:E().optional(),chat_ready:E().optional(),provider_ready:E().optional(),provider_configured:E().optional(),setup_state:C().optional(),provider_note:C().optional(),provider_note_key:C().optional(),missing_modules:O(C()).optional(),import_errors:N(C(),C()).optional(),config_path:C().optional(),env_path:C().optional()}).optional(),workspaces:A({items:O(kg).optional(),last:U.optional()}).optional(),models:ug.optional()}),V_=A({ok:E().optional(),success:E().optional(),error:C().optional(),message:C().optional(),models:O(H).optional()}),H_=A({nous_account:qd.nullable().optional(),ok:E().optional(),status:C().optional(),url:C().optional(),verification_url:C().optional(),user_code:C().optional(),message:C().optional(),error:C().nullable().optional(),flow_id:C().optional(),provider:C().optional(),expires_in:T().int().optional(),interval:T().int().optional(),authorize_host:C().optional(),token_host:C().optional(),redirect_uri:C().optional()}),U_=A({kind:C().optional(),expr:C().optional(),minutes:T().optional(),run_at:C().optional(),display:C().optional()}),W_=A({times:W.optional(),completed:T().optional()}),G_=P([`needs_attention`,`schedule_error`,`paused`,`off`,`error`,`active`]),K_=A({read_only:E().optional(),owner_profile:U.optional(),id:C().optional(),job_id:C().optional(),name:C().nullable().optional(),prompt:C().optional(),schedule:j([C(),U_]).optional(),schedule_display:C(),schedule_input:C(),enabled:E().optional(),paused:E().optional(),paused_reason:U.optional(),state:U.optional(),last_status:U.optional(),last_error:U.optional(),last_delivery_error:U.optional(),next_run_at:j([C(),T(),lc()]).optional(),last_run_at:j([C(),T(),lc()]).optional(),repeat:j([W_,T(),lc()]).optional(),status:C().optional(),last_run:H.optional(),next_run:H.optional(),profile:U.optional(),session_id:U.optional(),model:U.optional(),provider:U.optional(),model_option_id:U.optional(),workspace:U.optional(),workdir:U.optional(),deliver:U.optional(),skills:O(C()).optional(),no_agent:E().optional(),script:U.optional(),monitor:U.optional(),continuity:E().optional(),context_from:j([O(C()),C(),lc()]).optional(),reasoning_effort:U.optional(),toast_notifications:E().optional(),running:E().optional(),derived_state:G_.optional(),needs_attention:E().optional(),resumable:E().optional(),attention_hint:P([`croniter_missing`]).nullable(),last_failure:k({at:T().nullable(),detail:C()}).nullable()}),q_=k({profile:C(),store:C(),error:C(),fix:C(),since:T().nullable()}),J_=A({jobs:O(K_),ordered:E().optional(),active_profile:C().optional(),all_profiles:E().optional(),other_profile_count:T().optional(),cron_unavailable:E().optional(),unwritable_stores:O(q_)}),Y_=k({profile:C(),sources:O(k({job_id:C(),label:C(),selectable:E()}))}),X_=k({completions:O(k({job_id:C(),name:C().nullable(),status:C().nullable(),outcome:P([`succeeded`,`failed`,`unknown`]),completed_at:T(),toast_notifications:E(),session_id:C(),message_count:T().int().optional()})),since:T()}),Z_=A({ok:E().optional(),job:K_.optional(),job_id:C().optional(),status:C().optional(),error:C().optional(),elapsed:T().optional()}),Q_=A({input_tokens:W.optional(),output_tokens:W.optional(),total_tokens:W.optional(),estimated_cost_usd:W.optional(),duration_seconds:W.optional(),model:C().optional(),provider:C().optional()}),$_=A({filename:C(),size:T(),modified:T(),usage:Q_.optional()}),ev=A({job_id:C().optional(),runs:O($_),total:T().optional(),offset:T().optional()}),tv=A({content:C().optional(),snippet:C().optional(),response:C().optional(),usage:Q_.optional(),error:C().optional()}),nv=A({running:j([E(),N(C(),T())]).optional()}),rv={available_actions:k({block:E(),unblock:E(),complete:E(),archive:E(),move_to:O(C())}),requires_running_exit_confirmation:E()},iv=A({id:j([C(),T()]),title:C().optional(),status:C().optional(),assignee:U.optional(),priority:j([C(),T()]).nullable().optional(),description:C().optional(),tags:O(C()).optional(),session_id:U.optional(),archived:E().optional(),created_at:H.optional(),updated_at:H.optional(),...rv}),av=A({name:C(),label:C(),tasks:O(iv)}),ov=Ad.extend({nodes:O(kd.extend({task:iv,ancestors:O(C()),descendants:O(C()),cycle:E(),running_lineage:E(),timing:k({start:T().nullable(),end:T().nullable(),duration_seconds:T().nullable(),offset:T().nullable(),width:T().nullable()})})).max(500),window:k({start:T().nullable(),end:T().nullable()})}),sv=k({assignee:C().nullable(),count:T().int(),columns:O(av)}),cv=A({columns:O(av).optional(),assignees:O(H).optional(),filters:H.optional(),latest_event_id:T().optional(),read_only:E().optional(),tenants:O(H).optional(),changed:E().optional(),bulk_move_targets:O(C()),create_statuses:O(C()),lane_by_profile:E(),lanes:O(sv).optional()}),lv=A({boards:O(A({slug:C(),name:C().nullable().optional(),is_current:E().optional(),total:T().optional(),archived:E().optional(),color:C().optional(),icon:C().optional(),description:C().optional(),removable:E()})),current:C().optional(),read_only:E().optional()}),uv=A({by_status:N(C(),T()),total:T().int(),status_counts:O(k({status:C(),count:T().int()}))}),dv=A({enabled:E(),extension_dir_configured:E().optional(),extension_dir_valid:E().optional(),script_urls:O(C()).optional(),stylesheet_urls:O(C()).optional(),sidecars:O(H).optional(),extensions:O(A({id:C(),enabled:E().optional(),name:C().optional(),version:C().optional()})).optional(),warnings:O(H).optional(),manifest:A({configured:E().optional(),loaded:E().optional(),status:C().optional(),entry_count:T().optional()}).optional(),counts:N(C(),T()).optional(),gallery_installed:N(C(),H).optional()}),fv=C().nullable(),pv=k({error:C(),condition:C().optional(),type:C().optional(),...e_.shape}).catchall(D()),mv=k({auth_enabled:E(),logged_in:E(),oidc_enabled:E(),oidc_native_handoff_enabled:E(),oidc_unavailable:E(),password_auth_enabled:E(),passwordless_enabled:E(),passkeys_enabled:E(),passkeys_count:T().int(),passkey_feature_flag:E(),auth_disabled_acknowledged:E(),can_manage_server:E(),trusted_auth_enabled:E().optional(),auth_type:C().optional(),user:fv.optional(),bound_profile:fv.optional()}),hv=k({dashboard:E(),terminal_remote_backend:E(),extensions:E(),single_profile_mode:E()}),gv=k({webui_version:C(),max_upload_bytes:T().int().positive(),csrf_token:C(),language:C(),bot_name:C(),assistant_name:C(),auth:mv,profile:k({name:C(),is_default:E()}).nullable(),onboarding:k({completed:E()}).nullable(),features:hv}),_v=C().regex(/^[a-f0-9]{40}$/),vv=k({tag:C().nullable(),version:C(),sourceRevision:_v.nullable(),releaseSet:_v.nullable(),contracts:k({appWeb:O(T().int()),webRelay:O(T().int())}),compatibleAgent:k({sourceRevision:_v,version:C(),image:C()}).catchall(D())}),yv=P([`sparkles`,`chat`,`voice`,`attachment`,`search`,`notifications`,`automation`,`model`,`appearance`,`speed`,`reliability`,`security`,`sync`,`share`,`settings`,`accessibility`]),bv=e=>C().min(1).max(e).regex(/^\S(?:[^\u0000-\u001f]*\S)?$/),xv=k({id:C().regex(/^TAL-[1-9][0-9]*-[1-9][0-9]*$/),icon:yv,title:bv(40),description:bv(120)}),Sv=k({schemaVersion:F(1),id:C().regex(/^(app|web)-[0-9A-Za-z.-]+$/),component:P([`app`,`web`]),version:C().min(1),sourceCommit:_v,rows:O(xv).min(1).max(4)}),Cv=C().max(256),wv=k({announcement:Sv.nullable(),eligible:E(),observation:C().nullable(),acknowledgement:C().nullable()}),Tv=k({release:vv,status:P([`ok`,`degraded`,`starting`]),phase:C().optional(),sessions:T().int(),active_streams:T().int(),active_runs:T().int(),runs:O(N(C(),D())),last_run_finished_at:T().nullable(),server_started_at:T(),uptime_seconds:T(),accept_loop:k({requests_total:T().int(),last_request_at:T()}),checks:N(C(),D()).optional(),agent:k({status:P([`ready`,`starting`,`restarting`,`incompatible`,`stopped`,`unavailable`])})}),Ev=k({password:C().optional()}),Dv=k({ok:F(!0),trusted_logout_url:C().optional()}),Ov=k({callback_url:C(),state:C(),code_challenge:C(),code_challenge_method:C()}),kv=k({flow_id:C(),authorization_url:C(),server_id:C(),expires_in:T().int()}),Av=k({flow_id:C(),code:C(),state:C(),code_verifier:C()}),jv=k({flow_id:C(),state:C()}),Mv=k({ok:F(!0)}),Nv=k({ok:E()}),Pv=k({ok:F(!0),publicKey:N(C(),D())}),Fv=k({id:C(),label:C(),created_at:T(),last_used_at:T().nullable(),sign_count:T().int()}),Iv=k({id:C().optional(),rawId:C().optional(),type:C().optional(),name:C().optional(),response:N(C(),D()).optional()}).catchall(D()),Lv=k({ok:F(!0),credential:k({id:C(),label:C()}),credentials:O(Fv)}),Rv=k({ok:F(!0)}),zv=k({id:C()}),Bv=k({ok:F(!0),credentials:O(Fv)}),Vv=k({credentials:O(Fv),disabled:E().optional()}),Hv={health:V.route({method:`GET`,path:`/health`,tags:[`core`],summary:"Liveness and release identity; `deep=1` adds startup and store probes."}).input(k({deep:C().optional()})).output(Tv),bootstrap:V.route({method:`GET`,path:`/api/bootstrap`,tags:[`core`],summary:`Public runtime configuration and initial state for the shell.`}).output(gv),whatsNew:V.route({method:`GET`,path:`/api/whats-new`,tags:[`core`],summary:`The installed Web release's What's New announcement and whether this tab presents it now. A tab passes its loaded_build and stored observation token; a stale tab neither presents nor records a newer release.`}).input(k({loaded_build:g_.optional(),observed:Cv.optional()})).output(wv),auth:{status:V.route({method:`GET`,path:`/api/auth/status`,tags:[`auth`]}).output(mv),login:V.route({method:`POST`,path:`/api/auth/login`,tags:[`auth`]}).input(Ev).output(Zh),logout:V.route({method:`POST`,path:`/api/auth/logout`,tags:[`auth`]}).output(Dv),oidcNativeStart:V.route({method:`POST`,path:`/api/auth/oidc/native/start`,tags:[`auth`],summary:`Begin a native-app OIDC handoff (S256 PKCE, rate limited per client IP).`}).input(Ov).output(kv),oidcNativeExchange:V.route({method:`POST`,path:`/api/auth/oidc/native/exchange`,tags:[`auth`],summary:`Redeem the one-time native handoff code for a session cookie.`}).input(Av).output(Mv),oidcNativeCancel:V.route({method:`POST`,path:`/api/auth/oidc/native/cancel`,tags:[`auth`],summary:`Abandon a pending native handoff.`}).input(jv).output(Nv),passkeyOptions:V.route({method:`POST`,path:`/api/auth/passkey/options`,tags:[`auth`],summary:`WebAuthn assertion options for login (public; CSRF exempt).`}).output(Pv),passkeyLogin:V.route({method:`POST`,path:`/api/auth/passkey/login`,tags:[`auth`],summary:`Verify a passkey assertion and start a session (public; CSRF exempt).`}).input(Iv).output(Rv),passkeyRegisterOptions:V.route({method:`POST`,path:`/api/auth/passkey/register/options`,tags:[`auth`],summary:`WebAuthn creation options (owner session or local first-run bootstrap).`}).output(Pv),passkeyRegister:V.route({method:`POST`,path:`/api/auth/passkey/register`,tags:[`auth`],summary:`Store a new ES256 passkey credential.`}).input(Iv).output(Lv),passkeyDelete:V.route({method:`POST`,path:`/api/auth/passkey/delete`,tags:[`auth`],summary:`Remove a passkey; the last one is kept while no password is set (409).`}).input(zv).output(Bv),passkeys:V.route({method:`GET`,path:`/api/auth/passkeys`,tags:[`auth`],summary:"Registered passkey metadata (`disabled: true` when the feature flag is off)."}).output(Vv),passkeysPost:V.route({method:`POST`,path:`/api/auth/passkeys`,tags:[`auth`],summary:`Legacy POST form of the passkey list (owner only).`}).output(Vv)}},G=D(),Uv=k({ok:F(!0)}).catchall(G),Wv=k({error:C(),type:F(`model_confirmation_required`),warnings:O(Hu).min(1),confirm_token:C().min(1)}),Gv=k({session_id:am}),Kv=k({session_id:C()}),qv=k({ok:F(!1),confirm_required:F(!0),discard_user_turns:T().int(),discard_messages:T().int(),confirm_token:C()}),Jv=k({include_archived:C().optional(),all_profiles:C().optional(),exclude_hidden:C().optional(),sidebar_source:C().optional(),archived_limit:C().optional(),archived_offset:C().optional(),show_cli_sessions:C().optional(),show_claude_code_sessions:C().optional(),show_cron_sessions:C().optional(),show_webhook_sessions:C().optional(),show_kanban_sessions:C().optional()}),Yv=Jv.omit({archived_limit:!0,archived_offset:!0}).extend({q:C().optional(),content:C().optional(),depth:C().optional(),project_id:C().optional()}),Xv=k({session_id:C(),messages:C().optional(),msg_limit:C().optional(),msg_before:C().optional(),resolve_model:C().optional(),expand_renderable:C().optional()}),Zv=k({action:P([`archive`,`unarchive`,`delete`]),session_ids:O(am).min(1).max(200).refine(e=>new Set(e).size===e.length,`session_ids must be unique`)}),Qv=k({results:O(k({session_id:C(),ok:E(),status:T().int().optional(),error:C().optional(),state_db_cleanup_failed:E().optional(),refused:Md.optional()}))}),$v=k({session_id:C().optional(),since:G.optional()}),ey=k({ok:F(!0),rounds:T().int(),threshold:T().int(),should_show:E()}),ty=k({ok:F(!0),summary:C(),message_count:T().int(),rounds:T().int(),fallback:E(),warning:C().optional()}),K=[`sessions`],ny=A({headline:C().optional(),token_line:C().optional(),note:C().nullable().optional(),reference_message:C().nullable().optional()}),ry=k({session_id:C().optional(),focus_topic:C().nullable().optional(),topic:C().nullable().optional()}),iy=A({ok:F(!0),session:$m,summary:ny,focus_topic:C().nullable()}),ay=A({ok:E().optional(),status:P([`running`,`done`,`error`,`idle`]),session_id:C().nullable().optional(),focus_topic:C().nullable().optional(),session:$m.optional(),summary:ny.optional(),error:C().optional(),error_status:T().int().optional(),type:C().optional(),...e_.shape,started_at:T().optional(),updated_at:T().optional()}),oy=k({session_id:C(),role:P([`tip`,`hidden_segment`,`child_session`]),title:C().nullable(),source:C().nullable(),started_at:T().nullable(),updated_at:T().nullable(),end_reason:C().nullable(),active:E(),archived:E()}),sy=k({mutation:F(!1),found:F(!0),session_id:C(),lineage_key:C(),tip_session_id:C(),total_segments:T().int(),materialized_segments:T().int(),segments:O(oy),children:O(oy),manual_review:E()}),cy=k({ok:F(!0),session:$m,source_session_id:C(),recommended_recovery_action:C(),message:C()}),ly=k({session_id:C(),kind:P([`shrunken_live`,`unstamped_legacy_backup`,`malformed_orphan_backup`,`orphan_backup`,`orphan_backup_without_state_row`,`state_db_deleted_webui_tombstone`,`index_unreadable`,`index_missing_file`,`index_missing_entry`,`state_db_orphan_webui_row`,`state_db_missing_sidecar`,`state_db_unreadable`,`turn_journal_pending_turn`]),category:P([`repairable`,`unsafe_to_repair`]),recommendation:P([`restore_from_bak`,`manual_review`,`deleted_session_skipped`,`rebuild_index`,`materialize_from_state_db`,`audit_only_pending_turn_journal`]),live_messages:T().int(),bak_messages:T().int(),turn_id:C().optional(),event:C().optional()}),uy=k({status:P([`ok`,`warn`,`needs_manual_review`]),summary:k({ok:T().int(),repairable:T().int(),unsafe_to_repair:T().int()}),items:O(ly)}),dy=k({clean:E(),ok:E(),repaired:T().int(),before:uy,backup_repair:k({scanned:T().int(),restored:T().int(),orphaned_backups:T().int(),details:O(k({session_id:C(),restored:E(),live_messages:T().int().optional(),bak_messages:T().int().optional(),skipped:C().optional(),error:C().optional()}))}),sidecar_repair:k({scanned:T().int(),materialized:T().int(),details:O(k({session_id:C(),materialized:E(),messages:T().int().optional(),skipped:C().optional(),error:C().optional()}))}),after:uy}),fy={sessions:{references:V.route({method:`GET`,path:`/api/sessions/references`,tags:K,summary:`Bounded same-profile title search for new-chat references; no transcript snippets.`}).input(k({q:C().max(200).optional()})).output(Gh),list:V.route({method:`GET`,path:`/api/sessions`,tags:K,summary:`Sidebar rows for the active profile.`}).input(Jv).output(ah),search:V.route({method:`GET`,path:`/api/sessions/search`,tags:K,summary:`Title, metadata and content matches; any sidebar filter answers from the /api/sessions rows, in their order.`}).input(Yv).output(A({sessions:O(rh),query:C().optional(),count:T().int().optional(),all_profiles:E(),active_profile:C(),sidebar_filtered:E().optional()})),bulk:V.route({method:`POST`,path:`/api/sessions/bulk`,tags:K,summary:`Archive, unarchive or delete up to 200 sessions, one ordered result per id.`}).input(Zv).output(Qv),cleanup:V.route({method:`POST`,path:`/api/sessions/cleanup`,tags:K,summary:`Delete empty Untitled sessions and index rows with no session file.`}).input(k({}).catchall(G)).output(k({ok:F(!0),cleaned:T().int()})),cleanupZeroMessage:V.route({method:`POST`,path:`/api/sessions/cleanup_zero_message`,tags:K}).input(k({}).catchall(G)).output(k({ok:F(!0),cleaned:T().int()}))},session:{get:V.route({method:`GET`,path:`/api/session`,tags:K,summary:`One session with a bounded message window.`}).input(Xv).output(eh),status:V.route({method:`GET`,path:`/api/session/status`,tags:K}).input(Kv).output(oh),contextDetail:V.route({method:`GET`,path:`/api/session/context-detail`,tags:K,summary:`Read bounded, safe allocation estimates and context-file metadata from the existing Agent only.`}).input(Kv.extend({context_detail_key:C().min(1).max(128)})).output(su),usage:V.route({method:`GET`,path:`/api/session/usage`,tags:K}).input(Kv).output(sh),new:V.route({method:`POST`,path:`/api/session/new`,tags:K}).input(Kh).output(eh.extend({worktree_skipped:C().optional()})),executionModes:V.route({method:`GET`,path:`/api/session/execution-modes`,tags:K,summary:`TAL-1040: which execution modes a fresh chat in the active profile can start in now.`}).input(k({})).output(Lu),rename:V.route({method:`POST`,path:`/api/session/rename`,tags:K}).input(Gv.extend({title:C()})).output(eh),delete:V.route({method:`POST`,path:`/api/session/delete`,tags:K,summary:"Delete a session and its Agent state.db rows. 409 with `refused: active_turn` while another Agent process runs or compresses it, or `runtime_history_unsupported` when this Agent cannot retire retained history; the session is kept."}).input(k({session_id:C()})).output(uh),pin:V.route({method:`POST`,path:`/api/session/pin`,tags:K}).input(Gv.extend({pinned:E().optional()})).output(Uv.extend({session:rh})),archive:V.route({method:`POST`,path:`/api/session/archive`,tags:K}).input(Gv.extend({archived:E().optional()})).output(Uv.extend({session:rh})),move:V.route({method:`POST`,path:`/api/session/move`,tags:K}).input(Gv.extend({project_id:C().nullable().optional()})).output(Uv.extend({session:rh})),duplicate:V.route({method:`POST`,path:`/api/session/duplicate`,tags:K}).input(k({session_id:C()})).output(eh),branch:V.route({method:`POST`,path:`/api/session/branch`,tags:K}).input(Gv.extend({keep_count:T().int().nullable().optional(),title:C().nullable().optional()})).output(k({session_id:C(),title:C(),parent_session_id:C()})),truncate:V.route({method:`POST`,path:`/api/session/truncate`,tags:K,description:"TAL-929: a cut that discards more than one user turn changes nothing and answers `confirm_required` with the counts to confirm, until resent with `confirm_deep_truncate` and the `confirm_token` of those same rows. A body without `confirm_deep_truncate` (a released App, which asks on the device) cuts at once; 503 when the profile's state.db cannot be read."}).input(Gv.extend({keep_count:G.optional(),confirm_deep_truncate:E().optional(),confirm_token:C().optional()})).output(Uv.extend({session:rh}).or(qv)),clear:V.route({method:`POST`,path:`/api/session/clear`,tags:K}).input(Gv).output(Uv.extend({session:rh})),retry:V.route({method:`POST`,path:`/api/session/retry`,tags:K,description:"`last_user_text` is the stored row's text; `last_user_prompt` and `last_user_attachments` are what to resend as the new turn."}).input(Gv).output(k({ok:F(!0),last_user_text:C(),last_user_prompt:C().optional(),last_user_attachments:O(om).optional(),removed_count:T().int()}).or(k({error:C()}))),undo:V.route({method:`POST`,path:`/api/session/undo`,tags:K}).input(Gv).output(k({ok:F(!0),removed_count:T().int(),removed_preview:C()}).or(k({error:C()}))),update:V.route({method:`POST`,path:`/api/session/update`,tags:K}).input(Gv.extend({workspace:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),confirm_token:C().optional()})).output(eh),toolsets:V.route({method:`POST`,path:`/api/session/toolsets`,tags:K}).input(Gv.extend({toolsets:O(C()).nullable().optional()})).output(k({ok:F(!0),enabled_toolsets:O(C()).nullable()})),yoloGet:V.route({method:`GET`,path:`/api/session/yolo`,tags:K}).input(Kv).output(k({yolo_enabled:E()})),yoloSet:V.route({method:`POST`,path:`/api/session/yolo`,tags:K}).input(k({session_id:C(),enabled:G.optional()})).output(k({ok:F(!0),yolo_enabled:E(),stale_cleared:E().optional()})),import:V.route({method:`POST`,path:`/api/session/import`,tags:K}).input(k({messages:G.optional(),tool_calls:G.optional(),title:C().nullable().optional(),workspace:C().nullable().optional(),model:C().nullable().optional(),pinned:E().nullable().optional()}).catchall(G)).output(Uv.extend({session:rh})),regenerateTitle:V.route({method:`POST`,path:`/api/session/title/regenerate`,tags:K,summary:`Generate a title from the first (or latest) complete exchange through the auxiliary model and persist it.`}).input(Gv.extend({prefer_latest:E().optional()})).output(A({session:rh,title:C(),status:C(),raw_preview:C()})),recoveryAudit:V.route({method:`GET`,path:`/api/session/recovery/audit`,tags:K,summary:`Owner only. Read-only audit of session backups, the index, state.db rows without a sidecar, and pending turn journals.`}).input(k({})).output(uy),recoveryRepairSafe:V.route({method:`POST`,path:`/api/session/recovery/repair-safe`,tags:K,summary:`Owner only. Apply the repairable findings and audit again; 409 with the same body unless the result is clean.`}).input(k({}).catchall(G)).output(dy),lineageReport:V.route({method:`GET`,path:`/api/session/lineage/report`,tags:K,summary:`Read-only compression lineage of a state.db session; 404 when the active profile's state.db lacks it.`}).input(k({session_id:C().optional()})).output(sy),compressionRecoveryStart:V.route({method:`POST`,path:`/api/session/compression-recovery/start`,tags:K,summary:`Open the focused continuation of a compression-exhausted session; a retry reuses the existing one.`}).input(k({session_id:C().optional()})).output(cy),compress:V.route({method:`POST`,path:`/api/session/compress`,tags:K,summary:"Compress the session's model context now (iOS `/compress`). `focus_topic` (alias `topic`) is capped at 500 characters."}).input(ry).output(iy),compressStart:V.route({method:`POST`,path:`/api/session/compress/start`,tags:K,summary:"Start (or join) the session's manual compression job; poll `compress/status`."}).input(ry).output(ay),compressStatus:V.route({method:`GET`,path:`/api/session/compress/status`,tags:K}).input(Kv).output(ay),conversationRounds:V.route({method:`POST`,path:`/api/session/conversation-rounds`,tags:K,summary:`Count the session's conversation rounds in state.db and whether the handoff dock is due.`}).input($v).output(ey),handoffSummary:V.route({method:`POST`,path:`/api/session/handoff-summary`,tags:K,summary:`Summarize the session's recent conversation for a handoff and append the summary card; needs the dock's round threshold.`}).input($v).output(ty),draftGet:V.route({method:`GET`,path:`/api/session/draft`,tags:K}).input(Kv).output(k({draft:jh,draft_version:C().nullable()})),draftSave:V.route({method:`POST`,path:`/api/session/draft`,tags:K}).input(k({session_id:C(),text:G.optional(),files:G.optional(),draft_version:G.optional()})).output(Mh),anchorSceneGet:V.route({method:`GET`,path:`/api/session/anchor-scene`,tags:K}).input(k({session_id:C(),message_ref:C().optional(),message_index:C().optional(),before:C().optional(),limit:C().optional()})).output(k({scene_ref:C(),rows:O(bm),start:T().int(),end:T().int(),total:T().int(),complete:E()})),outboundDraft:V.route({method:`GET`,path:`/api/session/outbound-draft`,tags:K,summary:`Resolve a registered producer draft through its session tool result. A directive alone grants nothing.`}).input(Xl.extend({card:Xc().int().positive()})).output(Yl),outboundDraftAct:V.route({method:`POST`,path:`/api/session/outbound-draft`,tags:K,summary:`Edit or approve the exact reviewed version once. Never sends or starts a turn.`}).input(Zl).output(Yl),toolResult:V.route({method:`GET`,path:`/api/session/tool-result`,tags:K,summary:"One tool call's whole, redacted result, for a scene row a limited response clipped (`result_truncated`); 404 for an unknown call id."}).input(k({session_id:C(),tool_call_id:C()})).output(k({tool_call_id:C(),result:C(),result_view:pm})),anchorSceneSave:V.route({method:`POST`,path:`/api/session/anchor-scene`,tags:K}).input(k({session_id:C(),scene:G.optional(),message_ref:C().optional(),message_index:G.optional(),message_offset:G.optional(),message_window_index:G.optional(),stream_id:C().optional()})).output(k({ok:F(!0),message_index:T().int(),message_ref:C()}))},projects:{list:V.route({method:`GET`,path:`/api/projects`,tags:[`projects`]}).input(k({all_profiles:C().optional()})).output(lh),create:V.route({method:`POST`,path:`/api/projects/create`,tags:[`projects`]}).input(k({name:C(),color:C().nullable().optional(),profile:C().nullable().optional()})).output(k({ok:F(!0),project:ch})),rename:V.route({method:`POST`,path:`/api/projects/rename`,tags:[`projects`]}).input(k({project_id:C(),name:C(),color:C().nullable().optional()})).output(k({ok:F(!0),project:ch})),delete:V.route({method:`POST`,path:`/api/projects/delete`,tags:[`projects`]}).input(k({project_id:C()})).output(k({ok:F(!0)}))},share:{create:V.route({method:`POST`,path:`/api/share/create`,tags:[`shares`]}).input(k({session_id:C()})).output(Hh),revoke:V.route({method:`POST`,path:`/api/share/revoke`,tags:[`shares`]}).input(k({session_id:C()})).output(Uv.extend({session:rh})),read:V.route({method:`GET`,path:`/api/share/{token}`,tags:[`shares`],summary:`Public read of a shared conversation snapshot.`}).input(k({token:C()})).output(Wh)},talaria:{pair:V.route({method:`POST`,path:`/api/talaria/relay/pair`,tags:[`talaria`],summary:`Register this server with Talaria Relay (owner) or enroll the active profile (any session).`}).input(k({relay_url:C(),publisher_id:C(),publisher_invitation:C(),label:C().optional()})).output(k({ok:F(!0),publisher_id:C()})),presence:V.route({method:`POST`,path:`/api/talaria/presence`,tags:[`talaria`],summary:`Renew or revoke one browser tab's activity lease; a fresh lease mutes relay alerts for the profile.`}).input(k({tab_id:C(),active:E(),seq:T().int()})).output(k({ok:F(!0),lease_seconds:T().int()})),viewed:V.route({method:`POST`,path:`/api/talaria/viewed`,tags:[`talaria`],summary:`Report a session as viewed through now so the relay clears its finished runs from Live Activities; a no-op without a relay.`}).input(k({session_id:C()})).output(k({ok:F(!0)}))}},py=D(),my=[`workspaces`],hy=k({ok:F(!0),workspaces:O(kg)}),gy=Mg.optional(),_y=k({session_id:C(),path:C()}),vy=k({ok:F(!0),path:C()}),yy=k({session_id:C().optional(),token:C().optional(),path:C().optional()}),by={escape_read_only:F(!0).describe(`Opened through an escape grant; clients offer no edits.`)},xy={workspaces:{list:V.route({method:`GET`,path:`/api/workspaces`,tags:my}).output(Ag),suggest:V.route({method:`GET`,path:`/api/workspaces/suggest`,tags:my}).input(k({prefix:C().optional()})).output(k({suggestions:O(C()),prefix:C()})),add:V.route({method:`POST`,path:`/api/workspaces/add`,tags:my}).input(k({path:C(),name:C().optional(),create:py.optional()})).output(hy),remove:V.route({method:`POST`,path:`/api/workspaces/remove`,tags:my}).input(k({path:C()})).output(hy),rename:V.route({method:`POST`,path:`/api/workspaces/rename`,tags:my}).input(k({path:C(),name:C()})).output(hy),reorder:V.route({method:`POST`,path:`/api/workspaces/reorder`,tags:my}).input(k({paths:py})).output(hy)},files:{list:V.route({method:`GET`,path:`/api/list`,tags:[`files`]}).input(k({session_id:C(),path:C().optional(),source:gy})).output(Pg),read:V.route({method:`GET`,path:`/api/file`,tags:[`files`]}).input(_y.extend({source:gy})).output(Ig),save:V.route({method:`POST`,path:`/api/file/save`,tags:[`files`]}).input(_y.extend({source:gy,content:C().optional()})).output(vy.extend({size:T().int(),source:gy})),create:V.route({method:`POST`,path:`/api/file/create`,tags:[`files`]}).input(_y.extend({content:C().optional()})).output(vy),createDir:V.route({method:`POST`,path:`/api/file/create-dir`,tags:[`files`]}).input(_y).output(vy),delete:V.route({method:`POST`,path:`/api/file/delete`,tags:[`files`]}).input(_y.extend({recursive:py.optional()})).output(vy),rename:V.route({method:`POST`,path:`/api/file/rename`,tags:[`files`]}).input(_y.extend({new_name:C()})).output(k({ok:F(!0),old_path:C(),new_path:C()})),move:V.route({method:`POST`,path:`/api/file/move`,tags:[`files`]}).input(_y.extend({dest_dir:C().optional(),destination:C().optional()})).output(k({ok:F(!0),old_path:C(),new_path:C()})),reveal:V.route({method:`POST`,path:`/api/file/reveal`,tags:[`files`]}).input(_y).output(vy),path:V.route({method:`POST`,path:`/api/file/path`,tags:[`files`],summary:`Absolute on-disk path of a workspace-relative path; the file need not exist.`}).input(_y).output(vy),openVsCode:V.route({method:`POST`,path:`/api/file/open-vscode`,tags:[`files`]}).input(_y).output(vy),escapeAuthorize:V.route({method:`POST`,path:`/api/escape/authorize`,tags:[`files`]}).input(k({session_id:C().optional(),path:C().optional(),token:C().optional()})).output(k({token:C(),path:C(),is_dir:E(),expires_at:T(),expires_in:T().int(),read_only:F(!0)})),escapeList:V.route({method:`GET`,path:`/api/escape/list`,tags:[`files`]}).input(yy).output(Pg.extend({path:C(),entries:O(jg.extend(by)),virtual_root:C(),read_only:F(!0)})),escapeRead:V.route({method:`GET`,path:`/api/escape/file/read`,tags:[`files`]}).input(yy).output(Ig.extend(by))}},Sy=D(),Cy=N(C(),D()),wy=[`git`],Ty=k({changed:T().int(),staged:T().int(),unstaged:T().int(),untracked:T().int(),conflicts:T().int()}),Ey=k({path:C(),old_path:C().nullable(),workspace_path:C(),status:C(),staged:E(),unstaged:E(),untracked:E(),ignored:E(),conflict:E(),additions:T().int(),deletions:T().int(),binary:E()}),Dy=k({is_git:E(),branch:C().optional(),upstream:C().optional(),ahead:T().int().optional(),behind:T().int().optional(),totals:Ty.optional(),files:O(Ey).optional(),truncated:E().optional(),noise_filtering:k({filemode_only:T().int(),crlf_only:T().int(),active:E()}).optional()}),Oy=k({name:C(),sha:C(),updated:T().int(),updated_relative:C(),author:C(),subject:C(),upstream:C(),ahead:T().int(),behind:T().int()}),ky=k({is_git:F(!0),current:C(),detached:E(),head:C(),local:O(Oy),remote:O(Oy),upstream:C(),ahead:T().int(),behind:T().int()}),Ay=k({path:C(),kind:C(),binary:E(),too_large:E(),additions:T().int(),deletions:T().int(),diff:C(),hunks:O(lm)});k({error:C(),code:C()});var jy=k({id:C(),commit:C(),message:C(),date:C(),date_display:C(),files:T().int(),path:C()}),My=k({path:C(),exists:E(),listed:E(),dirty:E(),untracked_count:T().int(),ahead_behind:k({ahead:T().int(),behind:T().int(),available:E(),upstream:C().nullable()}),locked_by_stream:E(),locked_by_terminal:E(),removable:E(),force_required:E()}),Ny=k({session_id:C()}),Py=k({workspace:C().optional(),session_id:C().optional()}),Fy=k({session_id:C()}),Iy=Fy.extend({paths:j([O(Sy),C()]).optional(),path:C().optional()}),Ly=k({ok:F(!0),git:Dy}),Ry=k({ok:F(!0),message:C(),status:Dy}),zy=Fy.extend({ref:C(),mode:C(),new_branch:C().nullable().optional(),track:Sy.optional(),dirty_mode:C().optional()}),By=k({ok:F(!0),git:Dy,branches:ky,current_branch:C(),message:C()}),Vy={gitInfo:V.route({method:`GET`,path:`/api/git-info`,tags:wy,summary:`Lightweight branch badge for a session workspace.`}).input(Ny).output(Rg),git:{status:V.route({method:`GET`,path:`/api/git/status`,tags:wy}).input(Ny).output(k({git:Dy})),branches:V.route({method:`GET`,path:`/api/git/branches`,tags:wy}).input(Ny).output(k({branches:ky})),diff:V.route({method:`GET`,path:`/api/git/diff`,tags:wy}).input(Ny.extend({path:C().optional(),kind:C().optional(),staged:C().optional()})).output(k({diff:Ay})),stage:V.route({method:`POST`,path:`/api/git/stage`,tags:wy}).input(Iy).output(Ly),unstage:V.route({method:`POST`,path:`/api/git/unstage`,tags:wy}).input(Iy).output(Ly),discard:V.route({method:`POST`,path:`/api/git/discard`,tags:wy}).input(Iy.extend({delete_untracked:Sy.optional()})).output(Ly),commit:V.route({method:`POST`,path:`/api/git/commit`,tags:wy}).input(Fy.extend({message:C()})).output(k({ok:F(!0),commit:C(),status:Dy})),commitSelected:V.route({method:`POST`,path:`/api/git/commit-selected`,tags:wy}).input(Iy.extend({message:C()})).output(k({ok:F(!0),commit:C(),paths:O(C()),status:Dy})),commitMessage:V.route({method:`POST`,path:`/api/git/commit-message`,tags:wy,summary:`Generate a commit message for the staged diff through the auxiliary model.`}).input(Fy).output(k({ok:F(!0),message:C(),truncated:E()})),commitMessageSelected:V.route({method:`POST`,path:`/api/git/commit-message-selected`,tags:wy}).input(Iy).output(k({ok:F(!0),message:C(),truncated:E()})),fetch:V.route({method:`POST`,path:`/api/git/fetch`,tags:wy}).input(Fy).output(Ry),pull:V.route({method:`POST`,path:`/api/git/pull`,tags:wy}).input(Fy).output(Ry),push:V.route({method:`POST`,path:`/api/git/push`,tags:wy}).input(Fy).output(Ry),checkout:V.route({method:`POST`,path:`/api/git/checkout`,tags:wy}).input(zy).output(By),stashCheckout:V.route({method:`POST`,path:`/api/git/stash-checkout`,tags:wy}).input(zy.omit({dirty_mode:!0})).output(By.extend({stash_name:C(),stashed:E(),restored_stash:Cy.nullable(),restore_failed:E(),restore_error:C(),restore_stash:Cy.nullable()}))},rollback:{list:V.route({method:`GET`,path:`/api/rollback/list`,tags:[`rollback`]}).input(Py).output(k({checkpoints:O(jy),workspace:C(),checkpoint_dir:C(),session_diff:_u.optional()})),diff:V.route({method:`GET`,path:`/api/rollback/diff`,tags:[`rollback`]}).input(Py.extend({checkpoint:C().optional(),id:C().optional()})).output(_u),restore:V.route({method:`POST`,path:`/api/rollback/restore`,tags:[`rollback`]}).input(Py.extend({checkpoint:C().optional(),id:C().optional(),all:E().optional()}).catchall(Sy)).output(k({ok:F(!0),checkpoint:C(),workspace:C(),files_restored:O(C()),files_restored_count:T().int(),errors:O(k({file:C(),error:C()})),kept_user_edits:O(C()),skipped_oversize:O(C()),failed_deletes:O(C())}))},worktree:{status:V.route({method:`GET`,path:`/api/session/worktree/status`,tags:[`sessions`]}).input(Ny).output(k({status:My})),remove:V.route({method:`POST`,path:`/api/session/worktree/remove`,tags:[`sessions`]}).input(k({session_id:Sy.optional(),force:Sy.optional()})).output(k({ok:F(!0),removed_path:C(),warnings:O(C()).nullable()}))},upload:{rollback:V.route({method:`POST`,path:`/api/upload/rollback`,tags:[`files`],summary:`Remove the successful prefix of one failed multi-file chat upload.`}).input(k({session_id:Sy.optional(),rollback_tokens:Sy.optional()})).output(k({ok:E(),rolled_back:T().int(),failed:T().int()}))}},Hy=D(),Uy=[`chat`],Wy=k({session_id:C().optional(),choice:C().optional(),approval_id:C().optional(),yolo:E().optional(),run_id:C().optional(),mirror_token:C().optional()}).catchall(Hy),Gy=k({session_id:C().optional(),answers:Eh.optional(),response:C().optional(),answer:C().optional(),choice:C().optional(),clarify_id:C().optional(),decline:E().optional()}).catchall(Hy),Ky=k({session_id:C().optional(),message:C().optional(),workspace:C().nullable().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional()}).catchall(Hy),qy=k({answer:C(),status:P([`done`,`partial`]),session:$m,result:k({final_response:C(),completed:E(),interrupted:E()})}),Jy=k({session_id:C().optional(),args:C().optional(),text:C().optional(),profile:C().optional(),workspace:C().optional(),model:C().nullable().optional(),model_provider:C().nullable().optional(),explicit_model_pick:E().optional()}).catchall(Hy),Yy={chat:{ownerAction:V.route({method:`POST`,path:`/api/chat/owner-action`,tags:Uy,summary:`A typed, generation-fenced action through the canonical session owner. Retry acknowledges unknown work and returns its text to the draft; it never executes it.`}).input(Bu).output(k({ok:F(!0),session:$m,model_change:Au.optional(),draft:C().optional()})),sync:V.route({method:`POST`,path:`/api/chat`,tags:Uy,summary:`Legacy blocking turn: runs one turn to its end and answers with the reply.`}).input(Ky).output(qy),start:V.route({method:`POST`,path:`/api/chat/start`,tags:Uy,summary:"Admit one agent turn and return the stream id for `/api/chat/stream`."}).input(dh).output(fh),steer:V.route({method:`POST`,path:`/api/chat/steer`,tags:Uy}).input(k({session_id:C().optional(),text:C().optional(),display_text:C().optional(),steer_id:C().optional()}).catchall(Hy)).output(bh),steerWithdraw:V.route({method:`POST`,path:`/api/chat/steer/withdraw`,tags:Uy,summary:`Take a pending steer back (Edit, Cancel) before the Agent takes it.`}).input(gh).output(_h),steerSendNow:V.route({method:`POST`,path:`/api/chat/steer/send-now`,tags:Uy,summary:`Deliver a pending steer now instead of after the running tools.`}).input(vh).output(yh),cancel:V.route({method:`GET`,path:`/api/chat/cancel`,tags:Uy}).input(k({stream_id:C().optional()})).output(hh),streamStatus:V.route({method:`GET`,path:`/api/chat/stream/status`,tags:Uy}).input(k({stream_id:C().optional()})).output(ph)},approval:{pending:V.route({method:`GET`,path:`/api/approval/pending`,tags:[`approval`]}).input(k({session_id:C().optional()})).output(Sh),respond:V.route({method:`POST`,path:`/api/approval/respond`,tags:[`approval`]}).input(Wy).output(Ch)},clarify:{pending:V.route({method:`GET`,path:`/api/clarify/pending`,tags:[`approval`]}).input(k({session_id:C().optional()})).output(kh),respond:V.route({method:`POST`,path:`/api/clarify/respond`,tags:[`approval`]}).input(Gy).output(Ah)},goal:V.route({method:`POST`,path:`/api/goal`,tags:Uy}).input(Jy).output(Fh),background:{start:V.route({method:`POST`,path:`/api/background`,tags:Uy}).input(k({session_id:C().optional(),prompt:C().optional()}).catchall(Hy)).output(k({ok:F(!0),task_id:C(),stream_id:C(),session_id:C()})),tasks:V.route({method:`GET`,path:`/api/background/tasks`,tags:Uy,summary:`The background work a session owns: delegations, notified processes and /background tasks (TAL-372).`}).input(k({session_id:C(),kind:Ih.shape.kind.optional()})).output(Lh),result:V.route({method:`GET`,path:`/api/background/result`,tags:Uy}).input(k({session_id:C(),task_id:C()})).output(Rh),stop:V.route({method:`POST`,path:`/api/background/stop`,tags:Uy}).input(zh).output(Bh),dismiss:V.route({method:`POST`,path:`/api/background/dismiss`,tags:Uy}).input(zh).output(Vh),ack:V.route({method:`POST`,path:`/api/bg-task-complete-ack`,tags:Uy}).input(k({session_id:C().optional(),task_id:C().optional(),process_id:C().optional()}).catchall(Hy)).output(k({ok:F(!0),session_id:C(),task_id:C(),noop:F(!0)}))},btw:V.route({method:`POST`,path:`/api/btw`,tags:Uy,summary:`Ephemeral side question answered in a hidden session that inherits the transcript.`}).input(k({session_id:C().optional(),question:C().optional()}).catchall(Hy)).output(k({stream_id:C(),session_id:C(),parent_session_id:C()}))},Xy=D(),Zy=N(C(),D()),q=[`settings`],Qy=k({error:C()}),$y={maxAttachments:5,maxVideosPerReport:1,maxVideoSeconds:120,types:{"image/png":{kind:`image`,maxBytes:1e7},"image/jpeg":{kind:`image`,maxBytes:1e7},"image/heic":{kind:`image`,maxBytes:1e7},"image/webp":{kind:`image`,maxBytes:1e7},"video/mp4":{kind:`video`,maxBytes:2e7},"video/quicktime":{kind:`video`,maxBytes:2e7},"video/webm":{kind:`video`,maxBytes:2e7}},tierKinds:{verified:[`image`,`video`],unverified:[]}},eb=P(Object.keys($y.types)),tb=e=>C().max(e).regex(/\S/,`Must not be blank`),nb=hc({requestId:Bs(),kind:P([`bug`,`feature`,`other`]),title:tb(120),body:tb(8e3),includeDiagnostics:E(),client:hc({platform:P([`web`,`ios`]),appVersion:tb(64).optional(),osVersion:tb(64).optional(),deviceModel:tb(64).optional()}),attachmentIds:O(Bs()).min(1).max($y.maxAttachments).refine(e=>new Set(e).size===e.length,`Must not repeat`).optional()}),rb=k({text:C().max(16384),bytes:T().int().min(0).max(16384)}),ib=k({attachments:k({enabled:E(),videoAllowed:E(),maxCount:T().int().nonnegative(),maxVideoCount:T().int().nonnegative(),maxImageBytes:T().int().nonnegative(),maxVideoBytes:T().int().nonnegative(),maxVideoSeconds:T().int().nonnegative(),acceptedTypes:O(eb)})}),ab=k({attachmentId:Bs(),contentType:eb,bytes:T().int().positive()}),ob=k({attachmentId:Bs(),status:P([`sent`,`refused`]),reason:P([`tier`,`quota`,`disabled`,`invalid`,`expired`]).optional()}),sb=k({status:F(`sent`),reportId:C().min(1),attachments:O(ob).max($y.maxAttachments)});M(`error`,[Qy.extend({error:F(`rate_limited`),retryAfterSeconds:T().int().nonnegative()}),Qy.extend({error:P([`feedback_unavailable`,`relay_unreachable`,`invalid`])})]),Qy.extend({code:F(`reasoning_unsupported`)});var cb=k({advanced:Zy.nullable().optional()}),lb={feedback:{diagnostics:V.route({method:`GET`,path:`/api/feedback/diagnostics`,tags:q,summary:`Preview the redacted diagnostics attached to feedback.`}).output(rb),options:V.route({method:`GET`,path:`/api/feedback/options`,tags:q,summary:`Attachment limits for this server: attachments are enabled only for a registered Relay publisher.`}).output(ib),submit:V.route({method:`POST`,path:`/api/feedback/submit`,tags:q,summary:"Forward feedback and its staged attachments to Relay; `attachments` reports each one as sent or refused with a reason. Reuse requestId after an unknown outcome. Errors: rate_limited with retryAfterSeconds (429), feedback_unavailable (503), relay_unreachable (502), invalid (400, including unknown, expired or another member's attachmentIds)."}).input(nb).output(sb)},settings:{get:V.route({method:`GET`,path:`/api/settings`,tags:q,summary:`Server settings plus auth-state, max_tokens, and version badges.`}).output($h),save:V.route({method:`POST`,path:`/api/settings`,tags:q,summary:"Save settings; `_set_password`, `_clear_password`, `_passwordless`, `_current_password`, and `max_tokens` are handled specially."}).input(Zy).output($h),linkCheck:V.route({method:`POST`,path:`/api/settings/link-check`,tags:q,summary:"Whether a clicked chat link opens without the confirmation dialog (only absolute HTTP(S) URLs, when `confirm_external_links` is off or the exact hostname is in `trusted_link_hosts`), and the hostname that dialog names (null when the URL has none)."}).input(k({url:C().max(16384)})).output(k({opens_directly:E(),host:C().nullable()}))},profileImport:{discover:V.route({method:`GET`,path:`/api/profile/import`,tags:q,summary:`Owner only: permitted local coding-agent sources and reviewed importer availability.`}).output(lu),preview:V.route({method:`POST`,path:`/api/profile/import/preview`,tags:q,summary:`Owner only: preview with no source or profile writes. Consent binds the active profile, reviewed plugin and source/target snapshots.`}).input(hc({agent:cu})).output(lu),result:V.route({method:`GET`,path:`/api/profile/import/result`,tags:q,summary:`Owner only: read back a consumed import. Never runs the importer.`}).input(hc({receipt:C().min(1).max(128)})).output(lu),apply:V.route({method:`POST`,path:`/api/profile/import/apply`,tags:q,summary:`Owner only: consume preview consent once, or reconcile its recorded outcome. Never replays an unknown import.`}).input(hc({receipt:C().min(1).max(128)})).output(lu)},profiles:{list:V.route({method:`GET`,path:`/api/profiles`,tags:q}).output(tg),active:V.route({method:`GET`,path:`/api/profile/active`,tags:q}).output(ng),switch:V.route({method:`POST`,path:`/api/profile/switch`,tags:q,summary:`Per-client switch: sets the profile cookie; never mutates the process-wide profile.`}).input(k({name:C().optional(),profile:C().optional()})).output(rg),create:V.route({method:`POST`,path:`/api/profile/create`,tags:q}).input(k({name:C().optional(),clone_from:C().nullable().optional(),clone_config:Xy.optional(),base_url:C().nullable().optional(),api_key:C().nullable().optional(),default_model:C().nullable().optional(),model_provider:C().nullable().optional()})).output(k({ok:F(!0),profile:eg})),delete:V.route({method:`POST`,path:`/api/profile/delete`,tags:q}).input(k({name:C().optional(),profile:C().optional()})).output(k({ok:F(!0),name:C()}))},models:{delegation:V.route({method:`POST`,path:`/api/model/auxiliary/delegation`,tags:q,summary:`Persist a native delegation backend or replace one complete named route block.`}).input(Cl).output(Og),list:V.route({method:`GET`,path:`/api/models`,tags:q}).input(k({freshness:C().optional()})).output(ug),live:V.route({method:`GET`,path:`/api/models/live`,tags:q}).input(k({provider:C().optional()})).output(dg),refresh:V.route({method:`POST`,path:`/api/models/refresh`,tags:q,summary:`Evict the live model cache for one provider (or all when omitted) and answer the rebuilt catalog; a named provider is re-read past the Agent's own catalog cache.`}).input(k({provider:C().optional()})).output(k({ok:F(!0),provider:C().nullable(),models:ug})),auxiliary:V.route({method:`GET`,path:`/api/model/auxiliary`,tags:q}).output(Og),set:V.route({method:`POST`,path:`/api/model/set`,tags:q,summary:"scope=main sets config.yaml model.default; scope=auxiliary assigns one task slot (`__reset__` clears all) and answers the refreshed auxiliary state. An auxiliary `model` may be a `/api/models` entry id; provider `auto` with an empty model clears the override."}).input(cb.extend({scope:C().optional(),task:C().optional(),provider:C().optional(),model:C().optional(),session_id:C().optional(),model_provider:C().nullable().optional(),explicit:E().optional()})).output(A({ok:E().optional(),session:Xy.optional(),error:C().optional(),auxiliary:Og.optional()})),setDefault:V.route({method:`POST`,path:`/api/default-model`,tags:q}).input(cb.extend({model:C().optional(),provider:C().nullable().optional()})).output(k({ok:F(!0),model:C(),provider:C().nullable()}))},providers:{list:V.route({method:`GET`,path:`/api/providers`,tags:q}).output(mg),setKey:V.route({method:`POST`,path:`/api/providers`,tags:q,summary:`Write (or clear when api_key is empty) a provider API key in the profile .env.`}).input(k({provider:C().optional(),api_key:C().nullable().optional()})).output(k({ok:F(!0),provider:C(),display_name:C(),action:C()})),delete:V.route({method:`POST`,path:`/api/providers/delete`,tags:q}).input(k({provider:C().optional()})).output(k({ok:F(!0),provider:C(),display_name:C(),action:C()})),selfHosted:V.route({method:`POST`,path:`/api/providers/self-hosted`,tags:q,summary:"Save an Ollama or LM Studio endpoint (optional key) and make `model` the default; an endpoint whose `/models` does not answer is refused with 400 and nothing is saved."}).input(Zy).output(Zy),quota:V.route({method:`GET`,path:`/api/provider/quota`,tags:q}).input(k({provider:C().optional(),refresh:C().optional()})).output(Sg),quotas:V.route({method:`GET`,path:`/api/provider/quotas`,tags:q}).input(k({source:C().optional(),refresh:C().optional()})).output(Cg),costHistory:V.route({method:`GET`,path:`/api/provider/cost-history`,tags:q}).input(k({provider:C().optional(),days:C().optional()})).output(Tg)},reasoning:{get:V.route({method:`GET`,path:`/api/reasoning`,tags:q}).input(k({model:C().optional(),provider:C().optional(),base_url:C().optional()})).output(ig),set:V.route({method:`POST`,path:`/api/reasoning`,tags:q,summary:"Body is `{display: show|hide}` or `{effort, session_id?, model?, provider?, base_url?}`. Chat effort changes carry session_id; read-only/native targets return 409 reasoning_unsupported without changing profile defaults. Omit session_id only for explicit profile settings."}).input(k({display:Xy.optional(),effort:Xy.optional(),session_id:C().trim().min(1).optional(),model:C().nullable().optional(),provider:C().nullable().optional(),base_url:C().nullable().optional()})).output(ig)},personalities:{list:V.route({method:`GET`,path:`/api/personalities`,tags:q}).output(Eg),set:V.route({method:`POST`,path:`/api/personality/set`,tags:q}).input(k({session_id:C().optional(),name:C().optional()})).output(k({ok:F(!0),personality:C().nullable(),prompt:C()}))},onboarding:{status:V.route({method:`GET`,path:`/api/onboarding/status`,tags:q}).output(B_),setup:V.route({method:`POST`,path:`/api/onboarding/setup`,tags:q}).input(Zy).output(A({ok:E().optional(),error:C().optional(),status:Xy.optional()})),complete:V.route({method:`POST`,path:`/api/onboarding/complete`,tags:q}).input(Zy.optional()).output(B_),probe:V.route({method:`POST`,path:`/api/onboarding/probe`,tags:q}).input(k({provider:C().optional(),base_url:C().optional(),api_key:C().nullable().optional()})).output(V_),oauthStart:V.route({method:`POST`,path:`/api/onboarding/oauth/start`,tags:q,summary:"Start a device-code sign-in for a provider whose onboarding entry has `oauth_flow: 'device_code'`, or (TAL-1276, operator only) the browser sign-in of a plugin OAuth client with provider `plugin:<key>:<id>`."}).input(A({provider:C().optional()})).output(H_),oauthCancel:V.route({method:`POST`,path:`/api/onboarding/oauth/cancel`,tags:q,summary:`Cancel a pending device-code sign-in; nothing is saved after it.`}).input(A({flow_id:C().optional()})).output(H_),oauthPoll:V.route({method:`GET`,path:`/api/onboarding/oauth/poll`,tags:q,summary:"Report a device-code sign-in; `approved` means the Agent saved the credential."}).input(k({flow_id:C().optional()})).output(H_)}},ub=D(),db=N(C(),D()),J=[`tools`],fb=k({ok:F(!0)}),pb={agent_channel:P([`stable`,`experimental`]).optional(),agent_refresh_token:C().regex(/^[a-f0-9]{32}$/).optional(),confirmed_agent_revision:C().regex(/^[a-f0-9]{40}$/).optional()},mb=k({target:C().optional(),channel:C().nullable().optional(),...pb,version:C().min(1).max(128).optional().describe("TAL-946: a Stable `versions[].ref` of this target to install instead of the newest. Rejected when it is not listed or on Experimental."),tab_id:__.optional()}),hb=k({error:C(),code:F(`memory_conflict`)}),gb=j([k({error:C(),code:F(`memory_char_limit`),char_limit:k({count:T().int(),limit:T().int()})}),k({error:C(),code:P([`memory_mask_ambiguous`,`memory_mask_edited`]),mask:C()})]),_b=j([...gb.options,hb]),vb=e=>{let t=ps(e);return delete t.$schema,t},yb=k({section:P([`memory`,`user`]),revision:C(),proposed_revision:C(),receipt:C().min(1).max(64e3),source:C(),proposed:C(),diff:C(),model:C(),expires_at:T()}),bb=k({ok:F(!0),section:P([`memory`,`user`]),revision:C()}),xb=j([_b,k({error:C(),code:P([`memory_compaction_conflict`,`memory_compaction_invalid`])}),k({error:C(),code:F(`memory_compaction_unavailable`),condition:C()})]),Sb=e=>({...e,responses:{...e.responses,...Object.fromEntries([409,422,503].map(e=>[e,{description:`Compaction refused or unavailable. The review is retained; no unconfirmed write is replayed.`,content:{"application/json":{schema:vb(xb)}}}]))}}),Cb=k({kind:P([`skills`,`memory`]),visible:E(),enabled:E(),items:O(Sf)}),wb=k({kind:P([`skills`,`memory`]),writes:O(Cf).min(1)}),Tb=k({results:O(k({id:C(),done:E(),message:C()}))}),Eb={toolsetsCatalog:V.route({method:`POST`,path:`/api/toolsets`,tags:J,summary:`Read the current profile catalog with a draft selection. Null uses profile defaults.`}).input(k({session_id:C().optional(),toolsets:O(C()).nullable()})).output(Gu),skills:{revisions:V.route({method:`GET`,path:`/api/skills/revisions`,tags:J,summary:`Inspect actual saved skill history from the consented reviewed backend. Profile/skill-bound IDs refuse stale or foreign selections. No history is fabricated; inspection cannot execute checks, call providers, run a judge or change skills.`}).input(Hd).output(Ud),list:V.route({method:`GET`,path:`/api/skills`,tags:J}).input(k({category:C().optional()})).output(zg),usage:V.route({method:`GET`,path:`/api/skills/usage`,tags:J}).output(Vg),content:V.route({method:`GET`,path:`/api/skills/content`,tags:J,summary:"Skill view, or one linked file when `file` is given."}).input(k({name:C().optional(),file:C().optional()})).output(Bg),save:V.route({method:`POST`,path:`/api/skills/save`,tags:J}).input(k({name:C().optional(),content:C().optional(),category:C().optional()})).output(k({ok:F(!0),name:C(),path:C()})),delete:V.route({method:`POST`,path:`/api/skills/delete`,tags:J}).input(k({name:C().optional()})).output(k({ok:F(!0),name:C()})),toggle:V.route({method:`POST`,path:`/api/skills/toggle`,tags:J,summary:"Writes `skills.disabled` (and `skills.platform_disabled.webui` when present) in config.yaml."}).input(k({name:C().optional(),enabled:ub.optional()})).output(k({ok:F(!0),name:C(),enabled:E()}))},memory:{compactionPreview:V.route({method:`POST`,path:`/api/memory/compaction/preview`,tags:J,spec:Sb,summary:`Generate a bounded compaction through the configured compression auxiliary route, without writing. Secrets and protected entries are retained locally. Preview binds the active profile, source revision, proposal and expiry; an unavailable privacy-safe route returns 503.`}).input(k({section:P([`memory`,`user`]),revision:C()})).output(yb),compactionApply:V.route({method:`POST`,path:`/api/memory/compaction/apply`,tags:J,spec:Sb,summary:`Explicitly apply the exact preview receipt through the Agent-format and locked revision gate. Stale, foreign or expired receipts are refused. Repeated acknowledgments reconcile with the exact proposed bytes without rewriting.`}).input(k({receipt:C().min(1).max(64e3)})).output(bb),get:V.route({method:`GET`,path:`/api/memory`,tags:J}).input(k({session_id:C().optional(),workspace:C().optional()})).output(Hg),write:V.route({method:`POST`,path:`/api/memory/write`,tags:J,summary:"`section` names the file (memory, user, soul); the legacy `target` alias is accepted. `revision` is the section's `*_revision` the edit started from; 409 refuses the save when the file changed since. Masks the page showed are restored to the values they hide; 422 refuses an ambiguous or edited mask, or a MEMORY.md / USER.md body over the Agent store limit.",spec:e=>({...e,responses:{...e.responses,409:{description:"The file changed since `revision`; the file is untouched.",content:{"application/json":{schema:vb(hb)}}},422:{description:`Refused; the file is untouched.`,content:{"application/json":{schema:vb(gb)}}}}})}).input(k({section:C().optional(),target:C().optional(),content:C().optional(),revision:C()})).output(k({ok:F(!0),section:C(),path:C()}))},pendingWrites:{list:V.route({method:`GET`,path:`/api/pending-writes`,tags:J,summary:"TAL-819: the active profile's skill or memory writes the Agent staged for approval, oldest first, each with the diff approving it applies. `visible` is whether the page shows its review panel (any write pending); `enabled` is the profile's `<kind>.write_approval` gate. `summary` and `diff` are redacted like the memory page (`api_redact_enabled`); `revision` is the hash of the raw diff. An Agent without the review handlers, or no running Agent, lists none."}).input(k({kind:P([`skills`,`memory`])})).output(Cb),approve:V.route({method:`POST`,path:`/api/pending-writes/approve`,tags:J,summary:"TAL-819: apply each staged write through the Agent's `/skills` or `/memory approve`. Each write carries the `revision` the user reviewed; a write whose diff changed since is refused unapplied. `done` is false when the write was not applied (its record stays pending); `message` is the Agent's text either way, redacted."}).input(wb).output(Tb),reject:V.route({method:`POST`,path:`/api/pending-writes/reject`,tags:J,summary:"TAL-819: discard each staged write through the Agent's `/skills` or `/memory reject`."}).input(wb).output(Tb)},prompts:{list:V.route({method:`GET`,path:`/api/prompts`,tags:J}).output(Wg),create:V.route({method:`POST`,path:`/api/prompts`,tags:J}).input(k({text:C().optional(),label:C().optional()})).output(k({ok:F(!0),prompt:Ug})),delete:V.route({method:`DELETE`,path:`/api/prompts`,tags:J}).input(k({id:C().optional()})).output(fb)},commands:{list:V.route({method:`GET`,path:`/api/commands`,tags:J}).output(Kg),exec:V.route({method:`POST`,path:`/api/commands/exec`,tags:J}).input(k({command:C().optional(),session_id:C().optional()})).output(k({output:C()})),bundles:V.route({method:`GET`,path:`/api/commands/bundles`,tags:J,summary:`The active profile's skill bundles; empty when the Agent is unavailable.`}).output(k({bundles:O(md)})),resolveBundle:V.route({method:`POST`,path:`/api/commands/bundles/resolve`,tags:J,summary:"Expands `/<bundle> [instruction]` into the user message that loads its skills. 404 for an unknown bundle."}).input(k({command:C().optional()})).output(hd),resolveMoa:V.route({method:`GET`,path:`/api/commands/moa/resolve`,tags:J,summary:"The active profile's normalized MoA config merged with `preset`, or its default preset when that is absent or unknown. 503 when the Agent has no MoA."}).input(k({preset:C().optional()})).output(A({preset:C(),usage:C()}))},notes:{sources:V.route({method:`GET`,path:`/api/notes/sources`,tags:J}).output(M_),search:V.route({method:`GET`,path:`/api/notes/search`,tags:J,summary:"Joplin notes matching `q` (`limit` 1-50, default 20). 404 while external notes sources are disabled; 502 when Joplin fails."}).input(k({source:C().optional(),q:C().optional(),limit:C().optional()})).output(P_),item:V.route({method:`GET`,path:`/api/notes/item`,tags:J,summary:`One Joplin note for preview. 404 while external notes sources are disabled; 502 for an invalid id or a Joplin failure.`}).input(k({source:C().optional(),id:C().optional()})).output(F_)},wiki:{status:V.route({method:`GET`,path:`/api/wiki/status`,tags:J,summary:"LLM wiki summary from `WIKI_PATH` (env, then the profile `.env`), `skills.config.wiki.path` or `wiki.path` in config.yaml, else `~/wiki`. Always 200."}).output(I_),browse:V.route({method:`GET`,path:`/api/wiki/browse`,tags:J,summary:"Allowlisted `*.md` pages under `entities`, `concepts`, `comparisons`, and `queries`; 404 when the wiki directory is missing."}).output(L_),page:V.route({method:`GET`,path:`/api/wiki/page`,tags:J,summary:`One allowlisted page, cut at 2 MiB. 400 for a missing or non-canonical path; 404 for anything not listed.`}).input(k({path:C().optional()})).output(R_)},insights:V.route({method:`GET`,path:`/api/insights`,tags:J}).input(k({days:C().optional()})).output(Jg),logs:V.route({method:`GET`,path:`/api/logs`,tags:J}).input(k({file:C().optional(),tail:C().optional()})).output(qg),ops:{agent:V.route({method:`GET`,path:`/api/health/agent`,tags:J}).output(t_),system:V.route({method:`GET`,path:`/api/system/health`,tags:J}).output(n_),restart:V.route({method:`POST`,path:`/api/health/restart`,tags:J,summary:`Restart the Hermes gateway for the active profile (operator only).`}).input(db.optional()).output(k({ok:F(!0),message:C()})),dashboard:V.route({method:`GET`,path:`/api/dashboard/status`,tags:J}).output(Yg),dashboardConfig:V.route({method:`GET`,path:`/api/dashboard/config`,tags:J,summary:"The active profile's `webui.dashboard` link settings. 400 when the stored URL is invalid."}).output(Qg),saveDashboardConfig:V.route({method:`POST`,path:`/api/dashboard/config`,tags:J,summary:"Writes `webui.dashboard.{enabled,url}` to the active profile's config.yaml; an empty `url` removes it. 400 for an invalid mode or URL."}).input(k({enabled:ub.optional(),url:ub.optional()})).output(Qg),projectOs:V.route({method:`GET`,path:`/api/project-os/dashboard`,tags:J,summary:`Project OS handoff, status, and docs for the current repo. Always 200.`}).input(k({board:C().optional()})).output($g),shutdown:V.route({method:`POST`,path:`/api/shutdown`,tags:J,summary:`Stop the server process (operator only).`}).input(db.optional()).output(k({status:F(`shutting_down`)}))},gateway:{status:V.route({method:`GET`,path:`/api/gateway/status`,tags:J}).output(Xg),start:V.route({method:`POST`,path:`/api/gateway/start`,tags:J,summary:"Run `hermes gateway start` for the active profile (operator only). A named profile the Agent refuses its own gateway starts the host gateway from the root profile, then retries. 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 after 60 seconds."}).input(db.optional()).output(Zg),stop:V.route({method:`POST`,path:`/api/gateway/stop`,tags:J,summary:"Run `hermes gateway stop` for the active profile (operator only). 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 after 60 seconds."}).input(db.optional()).output(Zg),restart:V.route({method:`POST`,path:`/api/gateway/restart`,tags:J,summary:"Run `hermes gateway restart` for the active profile (operator only). A named profile the Agent refuses its own gateway starts the host gateway from the root profile, then retries. The old gateway drains for the Agent's own restart budget before it is replaced. 409 while another gateway action runs, 500 with the Agent's first error line on failure, 504 with the sidecar's timeout message once that budget runs out."}).input(db.optional()).output(Zg)},mcp:{servers:V.route({method:`GET`,path:`/api/mcp/servers`,tags:J}).output(w_),tools:V.route({method:`GET`,path:`/api/mcp/tools`,tags:J,summary:"`q` keeps tools whose name, server, or description contains it (case-insensitive); `total` counts every known tool."}).input(k({q:C().optional()})).output(j_),action:V.route({method:`POST`,path:`/api/mcp/servers/{name}`,tags:J,summary:"`{enabled}` toggles, `{delete: true}` removes, `{url|command, ...}` adds or updates the server in config.yaml."}).input(k({name:C()}).catchall(ub)).output(db),toggle:V.route({method:`PATCH`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C(),enabled:ub.optional()})).output(k({ok:F(!0),name:C(),enabled:E()})),update:V.route({method:`PUT`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C(),config_revision:C().optional(),cost_policy:tu.optional()}).catchall(ub)).output(k({ok:F(!0),server:C_})),delete:V.route({method:`DELETE`,path:`/api/mcp/servers/{name}`,tags:J}).input(k({name:C()})).output(k({ok:F(!0),deleted:C()}))},connectors:{available:V.route({method:`GET`,path:`/api/connectors/available`,tags:J,summary:`Whether the active profile has connectors; false hides the Connectors page. Never creates an identity.`}).output(k({available:E()})),page:V.route({method:`GET`,path:`/api/connectors`,tags:J,summary:"Every catalog app with its accounts and member rules. `available: false` with no apps when the profile has no connectors."}).output(O_),dismissOffer:V.route({method:`POST`,path:`/api/connectors/sign-in-offer/dismiss`,tags:J,summary:`Acknowledge the current profile guest offer. Idempotent for the same offer; preserves native backoff.`}).input(k({offer_id:C().min(1)})).output(D_),tools:V.route({method:`GET`,path:`/api/connectors/{connector}/tools`,tags:J,summary:`One app's tools with their member and organization rules.`}).input(k({connector:C()})).output(k_),setPolicy:V.route({method:`POST`,path:`/api/connectors/{connector}/policy`,tags:J,summary:"One member-rule change from `revision` (the page's `policy_revision`): `enabled` turns the app on or off, or `tool` with `tool_enabled` one of its tools. 409 `policy_conflict` when the rules changed since."}).input(k({connector:C(),revision:C().min(1),enabled:E().optional(),tool:C().min(1).optional(),tool_enabled:E().optional()})).output(k({ok:F(!0),revision:C()})),connect:V.route({method:`POST`,path:`/api/connectors/{connector}/connect`,tags:J,summary:`Starts the app's authorization (or rejoins an open one) and answers with its link; poll the operation until it settles.`}).input(k({connector:C(),nous_account_id:C().min(1).optional()})).output(A_),removeAccount:V.route({method:`DELETE`,path:`/api/connectors/accounts/{connection_id}`,tags:J,summary:`Disconnects one account at the portal.`}).input(k({connection_id:C().min(1)})).output(fb),operation:V.route({method:`GET`,path:`/api/connectors/operations/{op_id}`,tags:J}).input(k({op_id:C().min(1)})).output(A_),respond:V.route({method:`POST`,path:`/api/connectors/operations/{op_id}`,tags:J,summary:"`skip`, `retry` or `approve` (with `env`) one `target`, as its `actions` allow, or `continue` the card without the rest."}).input(k({op_id:C().min(1),action:P([`skip`,`retry`,`approve`,`continue`]),target:C().optional(),env:N(C(),C()).optional()})).output(A_)},plugins:V.route({method:`GET`,path:`/api/plugins`,tags:J}).output(S_),pluginCatalog:V.route({method:`GET`,path:`/api/plugins/catalog`,tags:J}).input(od).output(cd),pluginInstall:V.route({method:`POST`,path:`/api/plugins/install`,tags:J,summary:`Operator only: preview or confirm a reviewed catalog pin. Confirmation is single use and binds the profile, catalog entry and staged tree. Native scan and admission apply; no replacement, dependency approval, enabling or Desktop UI grant.`}).input(sd).output(ld),pluginUpdate:V.route({method:`POST`,path:`/api/plugins/update`,tags:J,summary:`Operator only: update a profile-installed Git plugin through the Agent scan transaction. Caution requires accept_caution plus the single-use consent_token bound to the profile, installation and scanned revision; changed or expired consent returns 409. Dangerous always blocks.`}).input(k({key:C().trim().min(1),accept_caution:E().default(!1),consent_token:C().min(1).max(128).optional()})).output(ad),pluginSettings:V.route({method:`POST`,path:`/api/plugins/settings`,tags:J,summary:"TAL-806 (operator only): save a plugin's manifest-declared settings. `values` holds non-secret fields as the form entered them (numbers and JSON as text); the server checks each against the field list, writes the changed ones to `plugins.entries.<key>.settings`, and writes `secrets` to the profile `.env` under each field's `env` name (an empty one removes it). Secrets are written first; when a later write is refused, the ones already written are restored. 400 for an undeclared key, a bad value or a `locked` secret; 409 when the manifest changed; 503 when the Agent sidecar stopped before confirming (secrets stay written); 403 on a managed install, 404 for an unknown plugin. After persistence, runtime_application separately reports applied, restart_required, or unknown; runtime reconnect failures never roll saved secrets back."}).input(k({key:C().min(1),values:N(C(),ub).optional(),secrets:N(C(),C()).optional()})).output(k({ok:F(!0),key:C(),written:O(C()),settings:O(b_),runtime_application:nd})),pluginOAuthRedirect:V.route({method:`POST`,path:`/api/plugins/oauth/redirect`,tags:J,summary:"TAL-1276 (operator only): finish a plugin client's browser sign-in with `url`, the address the browser showed after the approval, when that address does not open on the Agent's machine. 400 `oauth_redirect_invalid` unless it is the flow's `redirect_uri` on 127.0.0.1 with the flow's `state`; 404 for an unknown flow, 409 `oauth_flow_ended` once it ended. Poll the flow afterwards."}).input(k({flow_id:C().min(1),url:C().min(1)})).output(H_),pluginOAuthLogout:V.route({method:`POST`,path:`/api/plugins/oauth/logout`,tags:J,summary:"TAL-1276 (operator only): sign out of a plugin-declared OAuth client (`hermes auth logout <key>:<id>`). `removed` is false when no grant was stored."}).input(k({key:C().min(1),id:C().min(1)})).output(k({ok:F(!0),removed:E()})),updates:{check:V.route({method:`GET`,path:`/api/updates/check`,tags:J,summary:"Cached status; `POST` runs the check. Git source installs can update from completed releases (stable) or origin/main (experimental); direct global npm installs can update to completed stable npm releases."}).output(s_),checkNow:V.route({method:`POST`,path:`/api/updates/check`,tags:J}).input(k({force:ub.optional(),channel:C().nullable().optional(),agent_channel:pb.agent_channel})).output(s_),apply:V.route({method:`POST`,path:`/api/updates/apply`,tags:J}).input(mb).output(l_),force:V.route({method:`POST`,path:`/api/updates/force`,tags:J}).input(mb).output(l_),clearLock:V.route({method:`POST`,path:`/api/updates/clear_lock`,tags:J}).input(mb).output(l_),summary:V.route({method:`POST`,path:`/api/updates/summary`,tags:J}).input(hc({target:P([`webui`,`agent`])})).output(c_)},updateNotifications:{list:V.route({method:`GET`,path:`/api/update-notifications`,tags:J,summary:`Server-owned update operation history for the authenticated owner and active profile. A Web tab passes its tab_id and loaded_build so the server compares that build and keeps its tab-scoped refresh notice.`}).input(k({tab_id:__.optional(),loaded_build:g_.optional()})).output(y_),read:V.route({method:`POST`,path:`/api/update-notifications/{id}/read`,tags:J}).input(k({id:Bs(),read:F(!0),tab_id:__.optional()})).output(h_),dismiss:V.route({method:`POST`,path:`/api/update-notifications/{id}/dismiss`,tags:J}).input(k({id:Bs(),dismiss:F(!0),tab_id:__.optional()})).output(k({ok:F(!0)})),clear:V.route({method:`POST`,path:`/api/update-notifications/clear`,tags:J}).input(k({clear:F(!0),tab_id:__.optional(),loaded_build:g_.optional()})).output(y_),cancel:V.route({method:`POST`,path:`/api/update-notifications/{id}/cancel`,tags:J}).input(k({id:Bs(),cancel:F(!0)})).output(h_),action:V.route({method:`POST`,path:`/api/update-notifications/{id}/actions/{action_id}`,tags:J}).input(k({id:Bs(),action_id:C().min(1).max(64),perform:F(!0),tab_id:__.optional()})).output(h_)},transcribeCapability:V.route({method:`GET`,path:`/api/transcribe/capability`,tags:J}).output(qh),speech:{prepare:V.route({method:`POST`,path:`/api/speech/prepare`,tags:J,summary:"TAL-906: the read-aloud script for `text` (the Agent's `prepare_spoken_text`): Markdown, reasoning blocks, filenames, paths, UUIDs, hashes, and URLs are dropped, at most 4000 characters. `/api/tts` speaks the same script. The text as written, trimmed, when the Agent cannot prepare it."}).input(k({text:C().max(1e5)})).output(Jh)},transcribeWarm:V.route({method:`POST`,path:`/api/transcribe/warm`,tags:J,summary:`Start loading the profile's speech-to-text engine in the background and answer at once (TAL-916). Send when a recording starts and the capability has warm_supported.`}).output(k({ok:F(!0)})),clientEvents:V.route({method:`POST`,path:`/api/client-events/log`,tags:J,summary:`Bounded browser diagnostics; only whitelisted scalar fields are logged.`}).input(db).output(k({ok:F(!0),event:C().nullable()}))},Db=P([`start`,`pause`,`resume`,`cancel`,`reconcile`]),Ob=k({session_id:C().min(1).max(256),project_id:C().nullable(),text:C().trim().min(1).max(32e3)}),kb=O(Ob).min(1).max(100),Ab=Ob.extend({request_id:C(),title:C(),backend:P([`direct`,`owner`]),authority_epoch:T().int().nullable(),status:P([`waiting`,`dispatching`,`running`,`completed`,`failed`,`refused`,`unknown`]),stream_id:C().nullable(),admission_id:C().nullable(),outcome:C().nullable()}),jb=k({id:C(),title:C(),revision:T().int().nonnegative(),profile:C(),phase:P([`draft`,`running`,`paused`,`cancelled`,`completed`,`failed`,`refused`,`unknown`]),current_step:T().int().nonnegative(),cards:O(Ab),actions:O(Db),editable:E(),error:C().nullable()}),Y=D(),X=N(C(),D()),Z=[`automation`],Mb=k({ok:F(!0)}),Nb=k({job_id:C().optional()}),Pb=bd.omit({agent_move_targets:!0}).extend(rv),Fb=k({action:P([`block`,`unblock`]),event_id:T().int()}).nullable(),Ib=k({task:Pb,read_only:E()}),Lb=k({task_id:C(),confirm_running_exit:E().optional()}).catchall(Y),Rb=k({session_id:C().optional()}),zb=M(`mode`,[k({ok:F(!0),mode:F(`web_pty`),session_id:C(),workspace:C(),running:E()}),k({ok:F(!0),mode:F(`owner_command`),session_id:C(),workspace:C(),running:F(!1),target_key:C().min(1)})]),Bb={promptQueues:{list:V.route({method:`GET`,path:`/api/prompt-queues`,tags:Z}).output(k({runs:O(jb)})),create:V.route({method:`POST`,path:`/api/prompt-queues`,tags:Z}).input(k({request_id:C().min(1).max(128),cards:kb})).output(jb),edit:V.route({method:`PATCH`,path:`/api/prompt-queues/{id}`,tags:Z}).input(k({id:C(),revision:T().int().nonnegative(),cards:kb})).output(jb),action:V.route({method:`POST`,path:`/api/prompt-queues/{id}/action`,tags:Z}).input(k({id:C(),revision:T().int().nonnegative(),action:Db})).output(jb)},crons:{blueprints:V.route({method:`GET`,path:`/api/cron/blueprints`,tags:Z}).output(lf),blueprintFill:V.route({method:`POST`,path:`/api/cron/blueprints/fill`,tags:Z}).input(uf).output(df),contextSources:V.route({method:`POST`,path:`/api/crons/context-sources`,tags:Z,summary:`Read eligible context sources for the editor execution store.`}).input(k({profile:C().optional(),editing_job_id:C().optional(),exclude_job_id:C().optional(),selected_refs:O(C()).optional()})).output(Y_),list:V.route({method:`GET`,path:`/api/crons`,tags:Z}).input(k({all_profiles:C().optional()})).output(J_),history:V.route({method:`GET`,path:`/api/crons/history`,tags:Z}).input(Nb.extend({offset:C().optional(),limit:C().optional()})).output(ev),output:V.route({method:`GET`,path:`/api/crons/output`,tags:Z}).input(Nb.extend({limit:C().optional()})).output(X),run:V.route({method:`GET`,path:`/api/crons/run`,tags:Z}).input(Nb.extend({filename:C().optional()})).output(tv),status:V.route({method:`GET`,path:`/api/crons/status`,tags:Z}).input(Nb).output(nv),recent:V.route({method:`GET`,path:`/api/crons/recent`,tags:Z,summary:"Each active-profile job's latest completion after `since` (Unix seconds), newest first. Not a run archive."}).input(k({since:C().optional()})).output(X_),deliveryOptions:V.route({method:`GET`,path:`/api/crons/delivery-options`,tags:Z}).output(k({platforms:O(k({value:C(),label:C()}))})),create:V.route({method:`POST`,path:`/api/crons/create`,tags:Z}).input(X).output(Z_),update:V.route({method:`POST`,path:`/api/crons/update`,tags:Z}).input(X).output(Z_),delete:V.route({method:`POST`,path:`/api/crons/delete`,tags:Z}).input(Nb).output(Z_),runNow:V.route({method:`POST`,path:`/api/crons/run`,tags:Z,summary:"Start a manual run in the sidecar; answers immediately with `status: running` (or `already_running`)."}).input(Nb).output(Z_),pause:V.route({method:`POST`,path:`/api/crons/pause`,tags:Z}).input(Nb.extend({reason:C().nullable().optional()})).output(Z_),resume:V.route({method:`POST`,path:`/api/crons/resume`,tags:Z}).input(Nb).output(Z_)},kanban:{inspection:V.route({method:`GET`,path:`/api/kanban/inspection`,tags:Z}).input(k({board:C().optional(),search:C().optional(),assignee:C().optional(),tenant:C().optional(),only_mine:C().optional(),include_archived:C().optional(),running_only:C().optional()})).output(ov),boards:V.route({method:`GET`,path:`/api/kanban/boards`,tags:Z}).input(k({include_archived:C().optional()})).output(lv),board:V.route({method:`GET`,path:`/api/kanban/board`,tags:Z}).input(k({board:C().optional(),tenant:C().optional(),assignee:C().optional(),include_archived:C().optional(),only_mine:C().optional(),since:C().optional(),search:C().optional()})).output(cv),config:V.route({method:`GET`,path:`/api/kanban/config`,tags:Z}).input(k({board:C().optional()})).output(X),updateConfig:V.route({method:`PATCH`,path:`/api/kanban/config`,tags:Z}).input(k({lane_by_profile:Y.optional()})).output(X),stats:V.route({method:`GET`,path:`/api/kanban/stats`,tags:Z}).input(k({board:C().optional()})).output(uv),assignees:V.route({method:`GET`,path:`/api/kanban/assignees`,tags:Z}).input(k({board:C().optional()})).output(k({assignees:O(Td)})),events:V.route({method:`GET`,path:`/api/kanban/events`,tags:Z}).input(k({board:C().optional(),since:C().optional(),limit:C().optional()})).output(k({events:O(Ed),cursor:T().int(),latest_event_id:T().int(),read_only:E()})),createBoard:V.route({method:`POST`,path:`/api/kanban/boards`,tags:Z}).input(X).output(k({board:Dd,current:C(),read_only:E()})),switchBoard:V.route({method:`POST`,path:`/api/kanban/boards/{slug}/switch`,tags:Z}).input(k({slug:C()})).output(k({current:C(),read_only:E()})),updateBoard:V.route({method:`PATCH`,path:`/api/kanban/boards/{slug}`,tags:Z}).input(k({slug:C()}).catchall(Y)).output(k({board:Dd,read_only:E()})),deleteBoard:V.route({method:`DELETE`,path:`/api/kanban/boards/{slug}`,tags:Z}).input(k({slug:C(),delete:C().optional()})).output(k({result:Y,current:C(),read_only:E()})),dispatch:V.route({method:`POST`,path:`/api/kanban/dispatch`,tags:Z}).input(k({board:C().optional(),dry_run:C().optional(),max:C().optional()})).output(X),bulk:V.route({method:`POST`,path:`/api/kanban/tasks/bulk`,tags:Z}).input(X).output(k({results:O(X),read_only:E()})),createTask:V.route({method:`POST`,path:`/api/kanban/tasks`,tags:Z}).input(X).output(Ib),link:V.route({method:`POST`,path:`/api/kanban/links`,tags:Z}).input(X).output(X),unlink:V.route({method:`POST`,path:`/api/kanban/links/delete`,tags:Z}).input(X).output(X),unlinkDelete:V.route({method:`DELETE`,path:`/api/kanban/links`,tags:Z}).input(X).output(X),task:V.route({method:`GET`,path:`/api/kanban/tasks/{task_id}`,tags:Z}).input(k({task_id:C(),board:C().optional()})).output(A({task:Pb.extend(Cd),last_card_action:Fb,...Sd})),taskLog:V.route({method:`GET`,path:`/api/kanban/tasks/{task_id}/log`,tags:Z}).input(k({task_id:C(),board:C().optional(),tail:C().optional()})).output(A({log:O(Y).optional(),entries:O(Y).optional()})),comment:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/comments`,tags:Z}).input(k({task_id:C()}).catchall(Y)).output(X),block:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/block`,tags:Z}).input(Lb).output(Ib),unblock:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/unblock`,tags:Z}).input(k({task_id:C()}).catchall(Y)).output(Ib),patch:V.route({method:`POST`,path:`/api/kanban/tasks/{task_id}/patch`,tags:Z}).input(Lb).output(Ib),patchTask:V.route({method:`PATCH`,path:`/api/kanban/tasks/{task_id}`,tags:Z}).input(Lb).output(Ib)},extensions:{status:V.route({method:`GET`,path:`/api/extensions/status`,tags:Z}).output(dv),registry:V.route({method:`GET`,path:`/api/extensions/registry`,tags:Z}).output(A({entries:O(Y),error:C().optional(),unavailable:E().optional()})),manifests:V.route({method:`GET`,path:`/api/extensions/manifests`,tags:Z}).output(k({protocol_version:F(1),manifests:O(A({can_toggle:E(),agent_host:E().optional(),display_id:C().optional()}))})),toggle:V.route({method:`POST`,path:`/api/extensions/toggle`,tags:Z}).input(k({id:Y.optional(),enabled:Y.optional()})).output(dv),consent:V.route({method:`POST`,path:`/api/extensions/sidecar-proxy-consent`,tags:Z}).input(k({id:Y.optional(),approved:Y.optional()})).output(dv),install:V.route({method:`POST`,path:`/api/extensions/install`,tags:Z}).input(k({id:Y.optional(),download_url:Y.optional(),sha256:Y.optional()})).output(k({installed:F(!0),id:C(),version:C()})),uninstall:V.route({method:`POST`,path:`/api/extensions/uninstall`,tags:Z}).input(k({id:Y.optional()})).output(k({uninstalled:F(!0),id:C()}))},terminal:{exec:V.route({method:`POST`,path:`/api/terminal/exec`,tags:Z,summary:`Execute one explicit captured command on the selected native owner. Unknown outcomes must never be replayed.`}).input(k({session_id:C().min(1),mode:F(`owner_command`),target_key:C().min(1),command:yu})).output(bu),start:V.route({method:`POST`,path:`/api/terminal/start`,tags:Z,summary:`Open the Web host PTY or select captured commands for a native owner (local origin when auth is off).`}).input(Rb.extend({rows:Y.optional(),cols:Y.optional(),restart:Y.optional()})).output(zb),input:V.route({method:`POST`,path:`/api/terminal/input`,tags:Z}).input(Rb.extend({data:C().optional()})).output(Mb),resize:V.route({method:`POST`,path:`/api/terminal/resize`,tags:Z}).input(Rb.extend({rows:Y.optional(),cols:Y.optional()})).output(Mb),close:V.route({method:`POST`,path:`/api/terminal/close`,tags:Z}).input(Rb).output(k({ok:F(!0),closed:E()}))}},Vb=A({text:C().optional(),already_streamed:E().optional(),reasoning_echo:E().optional(),session_id:C().optional()}),Hb=A({text:C().optional(),titles:O(C()).optional(),name:C().optional(),session_id:C().optional()}),Ub=A({name:C().optional(),...fm,preview:C().nullable().optional(),args:D().optional(),event_type:C().optional(),session_id:C().optional(),id:C(),timestamp:T().optional()}),Wb=Ub.extend({duration:T().nullable().optional(),is_error:E().optional(),cost_usd:T().nullable().optional(),result:D().optional(),result_view:pm.optional(),output:D().optional()}),Gb=A({allowed_choices:xh.shape.allowed_choices,can_enable_yolo:xh.shape.can_enable_yolo,approval_id:C().optional(),session_id:C().optional(),command:C().optional(),description:C().optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),question:C().optional(),status:C().optional(),pending_count:T().optional(),run_id:C().optional(),mirror_token:C().optional()}),Kb=A({steps:O(Th).optional(),vault:Oh.optional(),clarify_id:C().optional(),session_id:C().optional(),question:C().optional(),choices:O(D()).optional(),title:C().optional(),name:C().optional(),kind:C().optional(),reason:C().optional(),action:C().optional(),status:C().optional(),raw_preview:C().optional(),timeout_seconds:T().optional(),timeout_at:T().optional(),index:T().optional(),total:T().optional()}),qb=A({session_id:C().optional(),old_session_id:C().optional(),new_session_id:C().optional(),continuation_session_id:C().optional(),usage:A({...jm,plan_gauge:Hl.nullable().optional()}).optional()}),Jb=qb.extend({started_at:T().optional()}),Yb=A({session_id:C().optional(),title:C().optional(),status:C().optional(),reason:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional(),raw_preview:C().optional(),prefill:D().optional()}),Xb=A({type:C().optional(),message:C().optional()}),Zb=A({...e_.shape,condition:C().optional(),terminal_state:Sm.optional(),type:C().optional(),message:C().optional(),details:D().optional(),hint:C().optional(),session_id:C().optional(),old_session_id:C().optional(),new_session_id:C().optional(),continuation_session_id:C().optional(),status:j([C(),T()]).optional(),session:D().optional(),code:C().optional()}),Qb=A({terminal_state:Sm.optional(),session:D().optional(),usage:A({...jm,plan_gauge:Hl.nullable().optional()}).optional(),status:C().optional(),ephemeral:E().optional(),answer:C().optional()}),$b=A({terminal_state:Sm.optional(),type:C().optional(),message:C().optional(),hint:C().optional(),status:C().optional(),session_id:C().optional(),session:D().optional()}),ex=A({session_id:C().optional()}),tx=A({plan_gauge:Hl.nullable().optional(),input_tokens:T(),output_tokens:T(),estimated_cost:T().nullable(),cache_read_tokens:T(),cache_write_tokens:T()}),nx=A({session_id:C().optional(),usage:tx.optional(),tps:T().nullable().optional(),tps_available:E().optional(),estimated:E().optional()}),rx=A({session_id:C().optional(),state:C().optional(),decision:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional(),prefill:D().optional()}),ix=A({session_id:C().optional(),state:D().optional(),text:C().optional(),decision:C().optional(),continuation_prompt:C().optional(),stream_id:C().optional(),message:C().optional(),message_key:C().optional(),message_args:O(D()).optional()}),ax=A({session_id:C().optional(),steer_id:C().optional(),text:C().optional(),consumed_at:T().optional(),after_tool_call_id:C().nullable().optional()}),ox=A({session_id:C().optional(),status:C().optional(),kind:C().optional(),name:C().optional(),reason:C().optional(),action:C().optional()}),sx=Qm.extend({stream_id:C().optional()}),cx=A({session_id:C().optional(),task_id:C().optional(),id:C().optional(),title:C().optional(),status:C().optional(),summary:C().optional(),error:C().optional()}),lx=A({session_id:C().optional(),stream_id:C().optional(),turn_id:C().optional(),user_message_id:j([C(),T()]).optional()}),ux=A({}),dx=`session_snapshot.token.reasoning.tool.tool_progress.tool_complete.interim_assistant.approval.approval_cleared.clarify.compressing.compressed.title.title_status.warning.apperror.cancel.error.done.stream_end.metering.context_status.goal.goal_continue.steer_consumed.steer_pending.steer_withdrawn.state_saved.todo_state.bg_task_complete.server_turn_started.notices.session_goal.rate_limit_wait.run_status.connect_card.hello.initial.events.gateway_status.sessions_changed`.split(`.`),fx=M(`event`,[k({event:F(`session_snapshot`),data:k({session:$m,replay_gap:E().optional()})}),k({event:F(`token`),data:Vb}),k({event:F(`interim_assistant`),data:Vb}),k({event:F(`reasoning`),data:Hb}),k({event:F(`tool`),data:Ub}),k({event:F(`tool_progress`),data:k({id:C(),progress:dm.nullable()})}),k({event:F(`tool_complete`),data:Wb}),k({event:F(`approval`),data:Gb}),k({event:F(`approval_cleared`),data:A({session_id:C().optional(),pending_count:T()})}),k({event:F(`clarify`),data:Kb}),k({event:F(`compressing`),data:Jb}),k({event:F(`compressed`),data:qb}),k({event:F(`title`),data:Yb}),k({event:F(`title_status`),data:Yb}),k({event:F(`warning`),data:Xb}),k({event:F(`apperror`),data:Zb}),k({event:F(`error`),data:Zb}),k({event:F(`cancel`),data:$b}),k({event:F(`done`),data:Qb}),k({event:F(`stream_end`),data:ex}),k({event:F(`metering`),data:nx}),k({event:F(`context_status`),data:rx}),k({event:F(`goal`),data:ix}),k({event:F(`goal_continue`),data:ix}),k({event:F(`steer_consumed`),data:ax}),k({event:F(`steer_pending`),data:Om}),k({event:F(`steer_withdrawn`),data:mh}),k({event:F(`state_saved`),data:ox}),k({event:F(`todo_state`),data:sx}),k({event:F(`bg_task_complete`),data:cx}),k({event:F(`server_turn_started`),data:lx}),k({event:F(`notices`),data:A({session_id:C().optional(),notices:O(km)})}),k({event:F(`session_goal`),data:A({session_id:C().optional(),goal:Am.nullable()})}),k({event:F(`run_status`),data:k({session_id:C(),status:fu.nullable()})}),k({event:F(`rate_limit_wait`),data:A({session_id:C().optional(),wait:uu.nullable()})}),k({event:F(`connect_card`),data:A_}),k({event:F(`hello`),data:ux}),k({event:F(`initial`),data:ux}),k({event:F(`events`),data:ux}),k({event:F(`gateway_status`),data:ux}),k({event:F(`sessions_changed`),data:ux})]),px=new Set([`stream_end`,`cancel`,`apperror`,`error`]),mx=k({identity:C().min(1).max(128),scope:C().min(1).max(128),profile:C().min(1),eligible:E(),expires_at:T()}),hx=A({type:F(`sessions_changed`).optional(),version:T().optional(),reason:C().optional(),profile:C().nullable().optional(),session_id:C().nullable().optional(),web_audio:O(mx).max(32).optional()}),gx=M(`event`,[k({event:F(`initial`),data:ux}),k({event:F(`sessions_changed`),data:hx}),k({event:F(`gateway_status`),data:ux}),k({event:F(`hello`),data:ux})]),_x=[`initial`,`session-updated`,`server_turn_started`,`bg_task_complete`,`process_complete`],vx=k({event:P(_x),data:A({session_id:C()})});function yx(e,t){let n;try{n=t===``?{}:JSON.parse(t)}catch{return null}let r=fx.safeParse({event:e,data:n});return r.success?r.data:null}var bx=`/api/transcribe/stream`;k({sample_rate:T().int().min(8e3).max(48e3)}),k({eos:F(!0)});var xx=M(`type`,[k({type:F(`partial`),text:C()}),k({type:F(`final`),transcript:C(),filtered:E(),provider:C()}),k({type:F(`error`),message:C()})]),Sx=`--bg.--sidebar.--border.--border2.--text.--muted.--accent.--blue.--gold.--code-bg.--surface.--topbar-bg.--main-bg.--focus-ring.--focus-glow.--input-bg.--hover-bg.--strong.--em.--code-text.--code-inline-bg.--pre-text.--accent-hover.--accent-bg.--accent-bg-strong.--accent-text.--error.--success.--warning.--info.--radius-sm.--radius-md.--radius-card.--radius-lg.--radius-pill.--space-1.--space-2.--space-3.--space-4.--font-size-xs.--font-size-sm.--font-size-md.--message-body-font-size.--message-body-line-height.--message-code-font-size.--message-pre-code-font-size.--message-table-font-size.--file-tree-toggle-width.--font-ui.--font-conversation.--font-mono.--surface-subtle.--surface-subtle-hover.--border-subtle.--border-muted.--app-titlebar-safe-top.--skeleton-base.--skeleton-sheen.--msg-rail.--msg-max.--chat-col-inset.--user-bubble-bg.--user-bubble-border.--user-bubble-text.--user-bubble-placeholder.--user-selection-bg.--user-selection-text.--ease.--dur.--shadow-sm.--shadow-md.--r-sm.--r-md.--r-lg.--canvas.--island-ring.--island-radius.--island-gap.--island-shadow.--accent-fg.--link-color.--link-hover-glow.--purple.--amber.--amber-strong.--danger.--panel-head-primary-fg.--overlay-faint.--overlay.--overlay-strong.--overlay-max.--overlay-neutral.--ink-overlay.--scrim.--dialog-bg.--source-telegram.--source-discord.--source-slack.--source-claude-code.--scrollbar-thumb.--scrollbar-thumb-hover.--selection-bg.--selection-fg.--root-font-size.--root-line-height.--body-weight.--body-tracking.--text-rendering.--msg-tracking.--msg-code-size.--heading-tracking.--titlebar-title-tracking.--composer-font-size.--composer-line-height.--composer-tracking.--composer-scrollbar-width.--composer-scrollbar-display.--body-bg.--rail-bg.--titlebar-bg.--titlebar-border.--sidebar-bg.--sidebar-border.--sidebar-border-style.--sidebar-shadow.--main-surface.--pane-bg.--island-ring-width.--chrome-backdrop.--control-radius.--composer-wrap-bg.--composer-wrap-border-top.--composer-bg.--composer-border-color.--composer-border-width.--composer-radius.--composer-shadow.--composer-focus-border.--composer-focus-shadow.--composer-radius-phone.--composer-glass-mix.--composer-backdrop.--composer-hero-title-size.--composer-fade-height.--composer-rest-height.--chip-bg.--chip-border.--chip-fg.--chip-hover-bg.--chip-hover-border.--chip-hover-fg.--ws-chip-hover-bg.--ws-chip-hover-border.--ws-chip-hover-fg.--send-bg.--send-fg.--send-shadow.--send-weight.--send-hover-bg.--send-hover-shadow.--send-disabled-bg.--send-disabled-fg.--send-disabled-opacity.--primary-bg.--primary-fg.--primary-border.--primary-hover-bg.--primary-hover-border.--primary-hover-transform.--primary-hover-shadow.--float-btn-bg.--float-shadow.--scroll-btn-bg.--scroll-btn-shadow.--btn-radius.--rail-btn-radius.--nav-tab-radius.--nav-tab-radius-mobile.--input-radius.--chip-radius.--session-radius.--icon-btn-hover-bg.--project-chip-hover-bg.--file-item-hover-bg.--project-chip-bg.--project-chip-border.--project-chip-active-bg.--project-chip-active-fg.--project-chip-active-border.--project-chip-active-shadow.--project-chip-active-weight.--select-border.--input-focus-border.--input-focus-shadow.--search-bg.--search-border.--search-focus-bg.--search-focus-shadow.--table-border.--table-head-border.--pre-bg.--pre-border.--msg-role-user-fg.--assistant-msg-bg.--user-msg-bg.--user-msg-border.--user-msg-rail-width.--user-msg-rail.--user-msg-radius.--user-msg-fg.--user-msg-padding.--user-msg-weight.--user-msg-size.--user-msg-code-bg.--tool-running-bg.--tool-running-border.--session-font-size.--session-line-height.--session-hover-bg.--session-active-bg.--session-active-fg.--session-active-border.--session-active-rail-width.--session-active-rail-color.--session-active-shadow.--session-active-weight.--session-active-title-fg.--session-active-meta-fg.--session-bar-color.--session-bar-radius.--session-bar-inset-y.--session-bar-left.--session-bar-opacity.--session-pinned-fg.--session-trigger-active-fg.--pick-active-bg.--pick-active-border.--pick-active-shadow.--pick-active-fg.--pick-active-weight.--settings-section-bg.--menu-active-bg.--menu-active-fg.--menu-active-shadow.--menu-active-weight.--nav-active-bg.--nav-active-fg.--nav-active-shadow.--nav-active-weight.--nav-active-icon-fg.--nav-hover-bg.--nav-tooltip-fg.--rail-active-bg.--rail-active-fg.--rail-active-shadow.--rail-active-weight.--rail-active-icon-fg.--panel-btn-hover-bg.--panel-btn-hover-fg`.split(`.`),Cx={"--surface2":`--surface-subtle`,"--text2":`--muted`,"--accent2":`--accent-hover`,"--accent3":`--accent-text`,"--accent-contrast":`--accent-fg`,"--sidebar-text":`--text`,"--user-bubble":`--user-bubble-bg`,"--assistant-bubble":`--assistant-msg-bg`,"--link":`--link-color`},wx=[...Sx,...Object.keys(Cx),`--accent-rgb`],Tx=/^(#(?:[0-9a-fA-F]{3,8})|rg(?:b|ba)\(\s*[0-9.,%\s/]+\)|hsl(?:a)?\(\s*[0-9.,%\s/deg]+\)|[0-9]{1,3}\s*,\s*[0-9]{1,3}\s*,\s*[0-9]{1,3}|[a-zA-Z]{3,20}|[0-9.]+(?:px|em|rem|%)?)$/,Ex=Al,Dx=k({id:Ex,name:C(),identity:C(),revision:T().int(),disbanded:E(),max_upload_bytes:T().int().positive(),attachment_limit:T().int().positive(),members:O(Ml.extend({phase:P([`idle`,`queued`,`running`,`stopping`,`unknown`,`failed`,`approval`]),actions:O(Fl)})),actions:O(P([`send`,`rename`,`disband`,`stop`]))}),Ox=k({key:C(),index:T().int(),author:C(),message:Em,attachments:O(jl.extend({event_id:Ex,download_url:C()}))}),kx=k({available:E(),reason:P([`unsupported`,`stopped`,`refused`,`unavailable`,`unknown`,`driver_inactive`]).nullable(),room:Dx.nullable(),rows:O(Ox),cursor:T().int().nonnegative(),has_more:E(),next_before_seq:T().int().positive().nullable()}),Ax=k({identity:C().nullable(),available:E(),reason:kx.shape.reason,profiles:O(k({profile:C(),label:C()})),rooms:O(Dx),actions:O(F(`create`)),next_offset:T().int().nullable()}),jx=k({outcome:P([`confirmed`,`refused`,`unknown`]),reason:kx.shape.reason,room_id:Ex,event_id:Ex.nullable(),attachment:jl.nullable()}),Mx=k({event:F(`snapshot`),data:kx}),Nx=k({identity:C().nullable(),operation:Rl}),Px={groups:{sendIdentity:V.route({method:`GET`,path:`/api/groups/send-identity`,tags:[`groups`]}).input(k({request_id:Al})).output(k({event_id:Al})),list:V.route({method:`GET`,path:`/api/groups`,tags:[`groups`]}).input(k({offset:Xc().int().nonnegative().optional()})).output(Ax),view:V.route({method:`GET`,path:`/api/groups/view`,tags:[`groups`]}).input(k({room_id:Al,before_seq:Xc().int().positive().optional()})).output(kx),receipt:V.route({method:`GET`,path:`/api/groups/receipt`,tags:[`groups`]}).input(k({room_id:Al,request_id:Al})).output(jx),write:V.route({method:`POST`,path:`/api/groups/action`,tags:[`groups`]}).input(Nx).output(jx),upload:V.route({method:`POST`,path:`/api/groups/upload`,tags:[`groups`]}).input(k({room_id:Al,identity:C(),upload_id:Al,name:C().min(1).max(255),mime:C().max(127),data_base64:C().max(kl)})).output(jx)}},Fx=V.router({...Hv,...fy,...xy,...Vy,...Yy,...lb,...Eb,...Bb,...Px});E().optional();var Ix=pv.extend({code:C().optional()}),Lx=A({ok:E().optional()}),Rx=class e extends Error{kind;status;code;body;path;retryable;constructor(e){super(e.message,e.cause===void 0?void 0:{cause:e.cause}),this.name=`ApiError`,this.kind=e.kind,this.status=e.status??0,this.code=e.code,this.body=e.body,this.path=e.path,this.retryable=e.retryable??(e.kind===`network`||e.kind===`timeout`)}static from(t,n=``){return t instanceof e?t:t instanceof DOMException&&t.name===`AbortError`?new e({kind:`aborted`,path:n,message:`Request aborted`,retryable:!1}):new e({kind:`network`,path:n,message:t instanceof Error?t.message:`Network error`,cause:t})}};function zx(e){return e instanceof Rx}function Bx(e){return!zx(e)||(e.kind===`http`||e.kind===`unauthorized`)&&e.status>=400&&e.status<500&&e.status!==408}function Vx(e,t,n){let r=e.safeParse(t);if(r.success)return r.data;throw new Rx({kind:`invalid_payload`,path:n,message:`Malformed payload from ${n}: ${_t(r.error)}`,body:t,retryable:!1})}var Hx=()=>`Hermes Agent version not supported`,Ux=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_incompatible;return r?r(e):Hx(e)}),Wx=()=>`Agent update recovery is incomplete`,Gx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_recovery_incomplete;return r?r(e):Wx(e)}),Kx=()=>`Agent runtime is unavailable; check the Agent update outcome`,qx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_runtime_stale;return r?r(e):Kx(e)}),Jx=()=>`Hermes Agent isn't running`,Yx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_sidecar_unavailable;return r?r(e):Jx(e)}),Xx=()=>`Agent source changed; check the update outcome before restarting Talaria Web`,Zx=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_source_changed;return r?r(e):Xx(e)}),Qx=()=>`Agent update is in progress`,$x=((e={},t={})=>{let n=t.locale??a(),r=i[n]?.notice_agent_update_active;return r?r(e):Qx(e)}),eS={sidecar_unavailable:Yx,agent_incompatible:Ux,agent_runtime_stale:qx},tS={update_active:$x,recovery_incomplete:Gx,source_changed:Zx,unknown:qx};function nS(e,t){return e===`agent_runtime_stale`?(t?tS[t]:void 0)?.()??qx():e&&Object.hasOwn(eS,e)?eS[e]():void 0}var rS=/\/api\/(auth\/login|csp-report)$/,iS=/\/api\/auth\/(login|passkey\/options|passkey\/login|logout)$/,aS=new Set([`POST`,`PUT`,`PATCH`,`DELETE`]),Q={transport:e=>{let t={method:e.method,headers:e.headers,body:e.body??null,credentials:e.credentials,keepalive:e.keepalive??!1};return e.signal&&(t.signal=e.signal),fetch(e.url,t)},csrfToken:``,authEnabled:!1,mutationSeq:0,inflight:new Map,onUnauthorized:e=>{window.location.assign(r(`login?next=${encodeURIComponent(e)}`).href)}};function oS(e){Object.assign(Q,e)}function sS(e,t){return new Promise((n,r)=>{let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`aborted`,`AbortError`))},{once:!0})})}function cS(e){return r(e)}function lS(){let e=n().pathname.replace(/\/$/,``),t=window.location.pathname+window.location.search;return t.startsWith(e)?t.slice(e.length)||`/`:t}async function uS(e,t){let n=(t.method??`GET`).toUpperCase(),r=cS(e),i=n===`GET`||n===`HEAD`,a=i&&t.dedupe!==!1&&!t.signal?`${n} ${r.href} @${Q.mutationSeq} ${JSON.stringify({t:t.timeoutMs,r:t.retries,s:t.retryStatuses})}`:null;if(a){let n=Q.inflight.get(a);if(n)return n;let r=uS(e,{...t,dedupe:!1});Q.inflight.set(a,r);let i=()=>{Q.inflight.get(a)===r&&Q.inflight.delete(a)};return r.then(i,i),r}i||(Q.mutationSeq+=1);let o=t.timeoutMs??3e4,s=(t.retries??2)+1,c=new Set(t.retryStatuses??[]),l=t.retryDelayMs??350,u=null;for(let a=1;a<=s;a++){let d=new AbortController,f=()=>d.abort();t.signal?.addEventListener(`abort`,f,{once:!0});let p=o>0?setTimeout(()=>d.abort(new DOMException(`timeout`,`TimeoutError`)),o):null;try{let i=new Headers(t.headers),o=null;t.json===void 0?t.body!==void 0&&(o=t.body):(i.set(`Content-Type`,`application/json`),o=JSON.stringify(t.json)),aS.has(n)&&r.origin===window.location.origin&&!rS.test(r.pathname)&&Q.csrfToken&&!i.has(`X-Hermes-CSRF-Token`)&&i.set(`X-Hermes-CSRF-Token`,Q.csrfToken);let f=await Q.transport({url:r,method:n,headers:i,body:o,signal:d.signal,credentials:`include`,keepalive:t.keepalive??!1});if(f.status===401&&Q.authEnabled&&t.redirect401!==!1&&!iS.test(r.pathname))throw Q.onUnauthorized(lS()),new Rx({kind:`unauthorized`,status:401,path:e,message:`Authentication required`,retryable:!1});let p=await f.text(),m=null;if(p!==``)try{m=JSON.parse(p)}catch{if(f.ok)throw new Rx({kind:`invalid_payload`,status:f.status,path:e,message:`Non-JSON response from ${e}`,body:p,retryable:!1});m={error:p.slice(0,500)}}if(!f.ok){let n=Ix.safeParse(m),r=new Rx({kind:`http`,status:f.status,code:n.success?n.data.code:void 0,body:m,path:e,message:n.success?nS(n.data.condition??n.data.type,n.data.agent_runtime_reason)??n.data.error:`HTTP ${f.status} from ${e}`,retryable:c.has(f.status)});if(r.retryable&&a<s){u=r,await sS(l,t.signal);continue}throw r}return Vx(t.schema,m,e)}catch(n){let r=Rx.from(n,e);if(r.kind===`aborted`&&t.signal?.aborted)throw r;if(u=r.kind===`aborted`&&d.signal.reason instanceof DOMException&&d.signal.reason.name===`TimeoutError`?new Rx({kind:`timeout`,path:e,message:`Request to ${e} timed out`,retryable:!0}):r,!u.retryable||a>=s||!i&&u.kind===`timeout`)throw u;await sS(l,t.signal)}finally{p&&clearTimeout(p),t.signal?.removeEventListener(`abort`,f)}}throw u??new Rx({kind:`network`,path:e,message:`Request failed`})}function dS(e,t,n={}){return uS(e,{...n,method:`GET`,schema:t})}function fS(e,t,n,r={}){return uS(e,{...r,method:`POST`,json:t,schema:n})}function pS(e,t,n,r={}){return uS(e,{...r,method:`POST`,body:t,schema:n,retries:r.retries??0})}async function mS(e,t){let n=new URL(e.url),r=n.pathname.replace(/^.*?\/api\//,`api/`);if(e.signal.aborted)throw new Rx({kind:`aborted`,path:r,message:`Request aborted`,retryable:!1});let i=new Headers(e.headers);aS.has(e.method)&&n.origin===window.location.origin&&!rS.test(n.pathname)&&Q.csrfToken&&!i.has(`X-Hermes-CSRF-Token`)&&i.set(`X-Hermes-CSRF-Token`,Q.csrfToken);let a=e.method===`GET`||e.method===`HEAD`,o=a||e.body===null?null:await e.text(),s=a&&t?`${e.method} ${n.href} @${Q.mutationSeq} contract`:null;if(s){let e=Q.inflight.get(s);if(e)return(await e).clone()}a||(Q.mutationSeq+=1);let c=async()=>{let t;try{t=await Q.transport({url:n,method:e.method,headers:i,body:o,signal:e.signal,credentials:`include`})}catch(e){throw Rx.from(e,r)}if(t.status===401&&Q.authEnabled&&!iS.test(n.pathname))throw Q.onUnauthorized(lS()),new Rx({kind:`unauthorized`,status:401,path:r,message:`Authentication required`,retryable:!1});if(!t.ok){let e=await t.text(),n=null;try{n=e?JSON.parse(e):null}catch{n={error:e.slice(0,500)}}let i=Ix.safeParse(n);throw new Rx({kind:`http`,status:t.status,code:i.success?i.data.code:void 0,body:n,path:r,message:i.success?nS(i.data.condition??i.data.type,i.data.agent_runtime_reason)??i.data.error:`HTTP ${t.status} from ${r}`,retryable:!1})}return t};if(!s)return c();let l=c();Q.inflight.set(s,l);let u=()=>{Q.inflight.get(s)===l&&Q.inflight.delete(s)};return l.then(u,u),(await l).clone()}var hS=e(t(),1),$=[],gS=0,_S=new Set,vS=new Map,yS=new Map,bS=()=>{for(let e of _S)e()},xS=(e,t)=>{let n=e.get(t);n!==void 0&&clearTimeout(n),e.delete(t)},SS=e=>{xS(vS,e),xS(yS,e),$=$.filter(t=>t.id!==e),bS()},CS=e=>{SS(e)};function wS(e,t=`programmatic`){let n=$.find(t=>t.id===e);if(!n||!n.visible&&t===`manual`)return;if(!n.visible){SS(e);return}t===`manual`&&n?.onDismiss?.(),$=$.map(t=>t.id===e?{...t,visible:!1}:t),bS(),xS(vS,e);let r=n?.revision;vS.set(e,setTimeout(()=>{let t=$.find(t=>t.id===e);t&&!t.visible&&t.revision===r&&SS(e)},220))}function TS(e,t=2500,n=`info`){ES({id:`local-${String(++gS)}`,text:e,ttl:t,kind:n,dismissible:!1,actions:[]})}function ES(e){let t=$.find(t=>t.id===e.id);if(t){if(t.revision===e.revision){$=$.map(t=>t.id===e.id?{...e,visible:t.visible}:t),bS();return}xS(vS,e.id),xS(yS,e.id),$=$.map(t=>t.id===e.id?{...e,visible:!1}:t)}else $=[...$,{...e,visible:!1}];bS();let n=e.revision;requestAnimationFrame(()=>{$=$.map(t=>t.id===e.id&&t.revision===n?{...t,visible:!0}:t),bS()}),e.ttl>0&&yS.set(e.id,setTimeout(()=>{$.some(t=>t.id===e.id&&t.revision===n)&&wS(e.id,`timeout`)},e.ttl))}function DS(){return(0,hS.useSyncExternalStore)(AS,kS,OS)}function OS(){return $}function kS(){return $}function AS(e){return _S.add(e),()=>_S.delete(e)}export{Ip as $,yx as A,P as At,eh as B,N as Bt,bx as C,dp as Ct,_x as D,Op as Dt,px as E,Mp as Et,vm as F,F as Ft,sm as G,Bs as Gt,$m as H,j as Ht,ym as I,A as It,Yh as J,dm as K,tg as L,T as Lt,ab as M,O as Mt,eb as N,E as Nt,gx as O,bu as Ot,Wv as P,M as Pt,qp as Q,lh as R,k as Rt,Tx as S,fp as St,dx as T,tp as Tt,ah as U,D as Ut,am as V,C as Vt,$h as W,Hs as Wt,Ag as X,Nh as Y,rm as Z,Bx as _,op as _t,DS as a,Vp as at,Cx as b,hp as bt,dS as c,Dp as ct,uS as d,Ep as dt,Bp as et,cS as f,up as ft,zx as g,Tp as gt,Lx as h,wp as ht,TS as i,Hp as it,zb as j,lc as jt,vx as k,Al as kt,fS as l,np as lt,Rx as m,gp as mt,CS as n,Wp as nt,oS as o,ap as ot,nS as p,bp as pt,pm as q,ES as r,Up as rt,mS as s,vp as st,wS as t,Fp as tt,pS as u,yp as ut,Fx as v,xp as vt,xx as w,Sp as wt,wx as x,mp as xt,Mx as y,kp as yt,ig as z,Cc as zt};
|