decocms 4.286.4 → 4.286.5
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/dist/client/assets/{AlertCircle-CjPPe_Es.js → AlertCircle-hbOF65b0.js} +1 -1
- package/dist/client/assets/{AreaChart-z-wKOY4Q.js → AreaChart-n1mYvGZT.js} +1 -1
- package/dist/client/assets/{ArrowLeft-xVEL6Xri.js → ArrowLeft-ddOW7Utj.js} +1 -1
- package/dist/client/assets/{ArrowUp-B504DwzE.js → ArrowUp-TAiBz5-S.js} +1 -1
- package/dist/client/assets/{Check-D-tWl3Ph.js → Check-B3_C5L4H.js} +1 -1
- package/dist/client/assets/{CheckCircle-1al5Y-iY.js → CheckCircle-qhfPedx4.js} +1 -1
- package/dist/client/assets/{ChevronDown-B_ixPCTO.js → ChevronDown-DjNDef0B.js} +1 -1
- package/dist/client/assets/{ChevronRight-C3-hRZ4f.js → ChevronRight-BdZD1wOd.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-BhgvMMhD.js → ChevronSelectorVertical-C3XzNMjp.js} +1 -1
- package/dist/client/assets/{ChevronUp-CcbaTGNZ.js → ChevronUp-CF-6uo2q.js} +1 -1
- package/dist/client/assets/{Circle-BAeolOWX.js → Circle-DikClmxK.js} +1 -1
- package/dist/client/assets/{Copy01-neaxsIAM.js → Copy01-BtYh0qaz.js} +1 -1
- package/dist/client/assets/{CreditCard01-ww7LUBF4.js → CreditCard01-BZ5WaFrN.js} +1 -1
- package/dist/client/assets/{DotsVertical-CWvHeX6p.js → DotsVertical-UpG1HW_H.js} +1 -1
- package/dist/client/assets/{Download01-Cpj3pMZO.js → Download01-NYWbPf44.js} +1 -1
- package/dist/client/assets/{Eye-DZppzI4K.js → Eye-BrmZqAOB.js} +1 -1
- package/dist/client/assets/{FilterLines-BoU3nKXE.js → FilterLines-ZenG24Rn.js} +1 -1
- package/dist/client/assets/{Flag01-Cks7Hcsj.js → Flag01-BNhp0q0F.js} +1 -1
- package/dist/client/assets/{Globe01-Blrb9QCE.js → Globe01-BtOjASGw.js} +1 -1
- package/dist/client/assets/{Globe04-nqeXJchO.js → Globe04-DyTmAVi_.js} +1 -1
- package/dist/client/assets/{HardDrive-AUMHLymc.js → HardDrive-B8qO5lo2.js} +1 -1
- package/dist/client/assets/{Key01-CBfmNloZ.js → Key01-C0grv-OX.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CSXhEw69.js → LinkExternal01-DvSmALGy.js} +1 -1
- package/dist/client/assets/{LockUnlocked01-Dp6LUDzs.js → LockUnlocked01-DXloCpRg.js} +1 -1
- package/dist/client/assets/{LogOut01-BwKRFWiv.js → LogOut01-CZnhJ5mF.js} +1 -1
- package/dist/client/assets/{Monitor01-BmwzRY8Z.js → Monitor01-B8Rrv2da.js} +1 -1
- package/dist/client/assets/{Palette-B_zZgvh3.js → Palette-C4C22tfY.js} +1 -1
- package/dist/client/assets/{Play-d1wMPqu_.js → Play-BwenLu8s.js} +1 -1
- package/dist/client/assets/{Plus-CS3JRZHD.js → Plus-BwN-nQoB.js} +1 -1
- package/dist/client/assets/{SearchLg-Bgx75S-8.js → SearchLg-BwG4c-bt.js} +1 -1
- package/dist/client/assets/{SearchMd-Bhs-AY-t.js → SearchMd-b9R2CUD_.js} +1 -1
- package/dist/client/assets/{Settings02-1WpCazPC.js → Settings02-Iwrx7s0-.js} +1 -1
- package/dist/client/assets/{Share07-C_MGXbKu.js → Share07-BLY4Z7Mr.js} +1 -1
- package/dist/client/assets/{Shield01-hY2vXu_p.js → Shield01-lwHISrB4.js} +1 -1
- package/dist/client/assets/{Stars01-DrSh3zMF.js → Stars01-CNkIpuKV.js} +1 -1
- package/dist/client/assets/{Stars02-BnPoIjHT.js → Stars02-eD4Vo-Jb.js} +1 -1
- package/dist/client/assets/{Sun-BW56eukD.js → Sun-JyqPyntC.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-l1VxUcA6.js → SwitchHorizontal01-Bs0x5qtZ.js} +1 -1
- package/dist/client/assets/{Tag01-B7UGGBpr.js → Tag01-afTNtw6U.js} +1 -1
- package/dist/client/assets/{ThumbsUp-CzeOya0s.js → ThumbsUp-Ct1yB7LJ.js} +1 -1
- package/dist/client/assets/{Tool01-dqpaqZjV.js → Tool01-BiYgD_E2.js} +1 -1
- package/dist/client/assets/{Tool02-y2Kt_Mle.js → Tool02-ChGS4l39.js} +1 -1
- package/dist/client/assets/{Trash01-DXi7qmjb.js → Trash01-DS3XDjpz.js} +1 -1
- package/dist/client/assets/{TrendUp01-DlR3MMdY.js → TrendUp01-fKn7vXoA.js} +1 -1
- package/dist/client/assets/{Upload01-zXZzID1Z.js → Upload01-DFdWifRB.js} +1 -1
- package/dist/client/assets/{User01-D5qvxe7_.js → User01-Bwt0zv61.js} +1 -1
- package/dist/client/assets/{UserSquare-BCsy6lPT.js → UserSquare-BA6rx4nr.js} +1 -1
- package/dist/client/assets/{Users01-BNl3O1xq.js → Users01-OidC4eEm.js} +1 -1
- package/dist/client/assets/{Users03-D4uJ1x7m.js → Users03-BpaLRfDJ.js} +1 -1
- package/dist/client/assets/{XCircle-DP3o1KVc.js → XCircle-DX3E2lEf.js} +1 -1
- package/dist/client/assets/{XClose-DcJ8LsPY.js → XClose-CrruX2m3.js} +1 -1
- package/dist/client/assets/{YAxis-Bh0QJVqk.js → YAxis-bjGV4r2L.js} +1 -1
- package/dist/client/assets/{Zap-QaC6OykZ.js → Zap-Du_Dvx7d.js} +1 -1
- package/dist/client/assets/{ZapSquare-rS3NzNGE.js → ZapSquare-CoPjJUgD.js} +1 -1
- package/dist/client/assets/{access-gate-Cxk9l6b9.js → access-gate-CdnbAZ0X.js} +1 -1
- package/dist/client/assets/{agent-icon-CQ4qTxJT.js → agent-icon-DoYdbige.js} +1 -1
- package/dist/client/assets/{agents-list-BF8Sxquk.js → agents-list-DHTIYOCP.js} +1 -1
- package/dist/client/assets/{ai-providers-0lVVwipt.js → ai-providers-Dotze7dx.js} +1 -1
- package/dist/client/assets/{alert-Di8wV19j.js → alert-D-KNEv4g.js} +1 -1
- package/dist/client/assets/{alert-dialog-C2gjYbmU.js → alert-dialog-DB2afDGg.js} +1 -1
- package/dist/client/assets/{api-keys-D-qkBRR0.js → api-keys-DoLC7tor.js} +1 -1
- package/dist/client/assets/{app-editor-Dq0blITG.js → app-editor-CWJGmPzk.js} +1 -1
- package/dist/client/assets/{auth-CR0_WHnM.js → auth-BGFdSoD_.js} +1 -1
- package/dist/client/assets/{auth-catchall-QvGPbVjd.js → auth-catchall-DRGXr_FU.js} +1 -1
- package/dist/client/assets/{auth-entry-CWY4gCWi.js → auth-entry-CmsP7QKh.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DzhkGA45.js → auth-split-layout-Cy6f-KXY.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DePShlsb.js → authenticate-and-persist-oauth-xKTcf66v.js} +1 -1
- package/dist/client/assets/{automation-list-row-Cj-qk1co.js → automation-list-row-BBtsYaL9.js} +1 -1
- package/dist/client/assets/{automation-runs-DGZfbF0y.js → automation-runs-uSj0aK2u.js} +1 -1
- package/dist/client/assets/{automations-CUtamPLl.js → automations-FhU1HrJF.js} +1 -1
- package/dist/client/assets/{avatar-gygO8t0k.js → avatar-DDiluiv-.js} +1 -1
- package/dist/client/assets/{badge-CagNBc4U.js → badge-Cj6RbOmk.js} +1 -1
- package/dist/client/assets/{block-document-CpLnMzDW.js → block-document-Bfw-8Thb.js} +1 -1
- package/dist/client/assets/{breadcrumb-BLJkl04u.js → breadcrumb-DzFCL7g7.js} +1 -1
- package/dist/client/assets/{buckets-CQX7ELNp.js → buckets-B_nzbyYk.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-pYKTv68z.js → bulk-category-panel-DR55f3an.js} +1 -1
- package/dist/client/assets/{capability-load-error-BbaDF84A.js → capability-load-error-BYYIDzKa.js} +1 -1
- package/dist/client/assets/{cards-2NqNY4R9.js → cards-2MLy9EY8.js} +1 -1
- package/dist/client/assets/{category-editor-Cw-qgPeh.js → category-editor-EeDyLPGK.js} +1 -1
- package/dist/client/assets/{chart-DNRpbEQG.js → chart-KLFfuqlm.js} +1 -1
- package/dist/client/assets/{chat-context-DdGr3_g8.js → chat-context-D0617LcP.js} +1 -1
- package/dist/client/assets/{checkbox-CvS4qhxI.js → checkbox-DB0y0oWV.js} +1 -1
- package/dist/client/assets/{choose-editor-CRVToY1R.js → choose-editor-BFCW3xqM.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BxxY4YVS.js → cli-auth-success-DcobNI9X.js} +1 -1
- package/dist/client/assets/{collection-detail-DBFBDjmC.js → collection-detail-Bi0WcZtT.js} +1 -1
- package/dist/client/assets/{collection-display-button-BeDXWwQw.js → collection-display-button-Cnsdsje_.js} +1 -1
- package/dist/client/assets/{collection-search-D3XcAdbv.js → collection-search-BIvmug_y.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DXgYFbn3.js → collection-table-wrapper-aKbGOHhC.js} +1 -1
- package/dist/client/assets/{collection-tabs-DqgsWWuc.js → collection-tabs-BW8Mvw-0.js} +1 -1
- package/dist/client/assets/{command-98mCceOP.js → command-J6ZodfLg.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-COoKJya8.js → commerce-onboarding-_jyCeWYb.js} +1 -1
- package/dist/client/assets/{config-DY6hf3s8.js → config-BTCmGJMz.js} +1 -1
- package/dist/client/assets/{connect-DP6XodOs.js → connect-DdzA-cbm.js} +1 -1
- package/dist/client/assets/{connection-BFaWbm0C.js → connection-CVP3qvMd.js} +1 -1
- package/dist/client/assets/{connection-card-Cv0RsJJ_.js → connection-card-CvsB1PdG.js} +1 -1
- package/dist/client/assets/{connection-detail-Dqb7DdBc.js → connection-detail-BiidMgQf.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Df8e763X.js → connection-form-helpers-Bii3uHIY.js} +1 -1
- package/dist/client/assets/{connections-D5Ay3kJB.js → connections-DOX5SYFS.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DVw1gZjG.js → decopilot-sse-pool-UV7IjtMY.js} +1 -1
- package/dist/client/assets/{dialog-BuvuvAYC.js → dialog-BRhjQqao.js} +1 -1
- package/dist/client/assets/{domain-settings-DSbKp6qA.js → domain-settings-CrgOE7OY.js} +1 -1
- package/dist/client/assets/{drawer-DmEn61SS.js → drawer-BhpJ8RDm.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Czbd_AJy.js → dropdown-menu-BTBx5zt9.js} +1 -1
- package/dist/client/assets/{empty-state-_lAZnBi4.js → empty-state-f0neyD24.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CW9bBZne.js → extract-connection-data-D3i_Unk2.js} +1 -1
- package/dist/client/assets/{file-explorer-BbAtNM55.js → file-explorer-BYHommOM.js} +1 -1
- package/dist/client/assets/{file-type-icon-BSfc7Wfg.js → file-type-icon-C9V6Abd3.js} +1 -1
- package/dist/client/assets/{form-CHh_Bz9U.js → form-C7yAAqUx.js} +1 -1
- package/dist/client/assets/{general-Bwm-UhNq.js → general-DwwtnF4r.js} +1 -1
- package/dist/client/assets/{github-icon-C4IsZh8Y.js → github-icon-kiOQlv3C.js} +1 -1
- package/dist/client/assets/{github-repo-picker-C9RaVBvS.js → github-repo-picker-KUt87jru.js} +1 -1
- package/dist/client/assets/{hooks-BBdeXd44.js → hooks-XOSpGyel.js} +2 -2
- package/dist/client/assets/{index-D297vbs1.js → index-BDxkf_Ni.js} +1 -1
- package/dist/client/assets/{index-DmDieVAU.js → index-BSXpDVSf.js} +1 -1
- package/dist/client/assets/{index-2iYjeWO7.js → index-Bf68eREm.js} +4 -4
- package/dist/client/assets/index-CK3ATYrI.js +1 -0
- package/dist/client/assets/{index-Bn1REJqN.js → index-CS3kGVyH.js} +1 -1
- package/dist/client/assets/{index-BqGmkqxx.js → index-CVELa3cg.js} +1 -1
- package/dist/client/assets/{index-DINrMtim.js → index-CWg_Ggyg.js} +1 -1
- package/dist/client/assets/{index-C9hnclQJ.js → index-DOxIL-eA.js} +1 -1
- package/dist/client/assets/{index-4kWhKkvd.js → index-DacIZHC7.js} +1 -1
- package/dist/client/assets/{index-C5_rudyt.js → index-Dq2HZao2.js} +5 -5
- package/dist/client/assets/{index-redirect-DulA9_vk.js → index-redirect-CLTfA10u.js} +1 -1
- package/dist/client/assets/{infra-billing-BhAeXe1T.js → infra-billing-vkmbhQii.js} +1 -1
- package/dist/client/assets/{input-D8Zm47Jt.js → input-D-lHjB_B.js} +1 -1
- package/dist/client/assets/{integration-icon-DF5D8dzf.js → integration-icon-BxRfy4jW.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DIFWrpMK.js → invite-member-dialog-Bhhb5_Zs.js} +1 -1
- package/dist/client/assets/{label-BXmVgc4R.js → label-Tqjnctct.js} +1 -1
- package/dist/client/assets/{layout-C2umEqat.js → layout-DYGOON_v.js} +1 -1
- package/dist/client/assets/{login-BA5Gn4nV.js → login-DTI68PzO.js} +1 -1
- package/dist/client/assets/{mcp-oauth-EIjqmOGW.js → mcp-oauth-T2ZJGkDv.js} +1 -1
- package/dist/client/assets/{members-WEbYgK-E.js → members-DvqwbrYa.js} +1 -1
- package/dist/client/assets/{monaco-editor-CLceT9Kc.js → monaco-editor-BbiQeHvV.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C1J4-yvD.js → monitoring-stats-row-BRxPjIzV.js} +1 -1
- package/dist/client/assets/{multi-select-8nHOrqP6.js → multi-select-eP4Q63XC.js} +1 -1
- package/dist/client/assets/{oauth-callback-B1gi_QXh.js → oauth-callback-BgZu9IMs.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BR3jc69B.js → oauth-callback-ai-provider-DexUSLe3.js} +1 -1
- package/dist/client/assets/{onboarding-CJb7w2u2.js → onboarding-9H5VivEO.js} +1 -1
- package/dist/client/assets/{org-layout-9As--daQ.js → org-layout-Bc_Fif3l.js} +1 -1
- package/dist/client/assets/{organization-choice-Dk9tfw5m.js → organization-choice-C3vw3LAv.js} +1 -1
- package/dist/client/assets/{orgs-D04LOh9A.js → orgs-BeakZaHe.js} +1 -1
- package/dist/client/assets/{page-seo-form-CPmgmD8Q.js → page-seo-form-WVj6WzxD.js} +1 -1
- package/dist/client/assets/{popover-pV1E5Yae.js → popover-DsZ61P_r.js} +1 -1
- package/dist/client/assets/{post-calendar-BskyHDPL.js → post-calendar-aGlF1j0e.js} +1 -1
- package/dist/client/assets/{post-editor--Zt9kpwk.js → post-editor-ORhNsadd.js} +1 -1
- package/dist/client/assets/{primitives-RaFkl2kw.js → primitives-QKnj3ey6.js} +1 -1
- package/dist/client/assets/{profile-DZM1TgC_.js → profile-zwRF5ZCc.js} +1 -1
- package/dist/client/assets/{project-app-view-D9hKZwXZ.js → project-app-view-BWY4x8V_.js} +1 -1
- package/dist/client/assets/{prompts-BC28h6-t.js → prompts-aBvdb6tH.js} +1 -1
- package/dist/client/assets/record-editor-BWE_FuhO.js +1 -0
- package/dist/client/assets/redirect-editor-BYA5niNO.js +1 -0
- package/dist/client/assets/registry-CxqQQ3Bw.js +2 -0
- package/dist/client/assets/{registry-layout-CDi54rAy.js → registry-layout-0Jl-E27Z.js} +1 -1
- package/dist/client/assets/{reports-BM4wctLR.js → reports-B4N07Zq6.js} +1 -1
- package/dist/client/assets/{require-capability-B6_CSUE8.js → require-capability-D1mRdUy0.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CPH_QLZq.js → required-auth-layout-CKzLIyTN.js} +1 -1
- package/dist/client/assets/{reset-password-CKTbNXE2.js → reset-password-Dd_TS03U.js} +1 -1
- package/dist/client/assets/{review-settings-CvDMhhLj.js → review-settings-JxLTprxy.js} +1 -1
- package/dist/client/assets/{roles-BBbgP0OS.js → roles-ota62KeI.js} +1 -1
- package/dist/client/assets/{scroll-area-CrW7xE2P.js → scroll-area-DjuuX4La.js} +1 -1
- package/dist/client/assets/{search-input-CUhyYijt.js → search-input-EFkfagu2.js} +1 -1
- package/dist/client/assets/{secrets-BS5YBU3b.js → secrets-DaYiFFED.js} +1 -1
- package/dist/client/assets/{sections-editor-B1dtTQTT.js → sections-editor-CaVl5pmG.js} +1 -1
- package/dist/client/assets/{select-BvLYuOCD.js → select-CfyYscNu.js} +1 -1
- package/dist/client/assets/{select-model-DSpI71RT.js → select-model-NvBF-Dw9.js} +1 -1
- package/dist/client/assets/{self-tool-result-C15mzmUL.js → self-tool-result-Ch9d7Tw-.js} +1 -1
- package/dist/client/assets/{seo-editor-Drt9uDgy.js → seo-editor-BmkWAYmP.js} +1 -1
- package/dist/client/assets/{settings-layout-Dw0kRTPi.js → settings-layout-BBgaoe7Z.js} +1 -1
- package/dist/client/assets/{shell-controls-DUuG6V04.js → shell-controls-iSEeqhd3.js} +1 -1
- package/dist/client/assets/{shell-layout-DEm7qxZk.js → shell-layout-CAskdAjm.js} +1 -1
- package/dist/client/assets/{spinner-Wicci2m_.js → spinner-CVgH_6Da.js} +1 -1
- package/dist/client/assets/{sso-Dc5dEHUK.js → sso-Cs6pDScE.js} +1 -1
- package/dist/client/assets/{store-DbIF8Srw.js → store-BtvCEcNx.js} +1 -1
- package/dist/client/assets/store-registry-RGdaoMx_.js +2 -0
- package/dist/client/assets/{super-agent-icon-DqHrlyQ5.js → super-agent-icon-Bbbe0gd3.js} +1 -1
- package/dist/client/assets/{switch-Bgl3Wxgz.js → switch-CFBbZ2fI.js} +1 -1
- package/dist/client/assets/{synced-repos-CxD3U_ap.js → synced-repos-DGgcJgf5.js} +1 -1
- package/dist/client/assets/{tab-id-B343rgJA.js → tab-id-hM5CdMyY.js} +1 -1
- package/dist/client/assets/{table-DQye_KJa.js → table-DgN42FUE.js} +1 -1
- package/dist/client/assets/{tabs-BD0mG09G.js → tabs-SIVnjiMC.js} +1 -1
- package/dist/client/assets/{task-board-BrhfV0Xn.js → task-board-DTdVH0ko.js} +1 -1
- package/dist/client/assets/{task-filters-D8uPSMj4.js → task-filters-XUBghaBW.js} +1 -1
- package/dist/client/assets/{tasks-BccmO9V1.js → tasks-Lz1-oBPs.js} +1 -1
- package/dist/client/assets/{textarea-f884xv9A.js → textarea-DEWZbEfM.js} +1 -1
- package/dist/client/assets/{toggle-group-Bha-KoNy.js → toggle-group-Ckc1SsPe.js} +1 -1
- package/dist/client/assets/{toolbar-BK5xyxK4.js → toolbar-B6_I9zMz.js} +1 -1
- package/dist/client/assets/{track-BdMpnoYO.js → track-C1AB8I0m.js} +1 -1
- package/dist/client/assets/{types-Dlbctr00.js → types-jwWkwsVZ.js} +1 -1
- package/dist/client/assets/{use-ai-providers-ApFi-RQM.js → use-ai-providers-B73xdIeu.js} +1 -1
- package/dist/client/assets/{use-api-keys-JXVd1lCZ.js → use-api-keys-CNqrf8KU.js} +1 -1
- package/dist/client/assets/{use-automations-Cleu9yjO.js → use-automations-C-9nW5p3.js} +1 -1
- package/dist/client/assets/{use-autosave-BNILGimX.js → use-autosave-BGyei4XT.js} +1 -1
- package/dist/client/assets/{use-commerce-diagnostic-whzF46SQ.js → use-commerce-diagnostic-D043ZDL_.js} +1 -1
- package/dist/client/assets/{use-connection-C6hvABLD.js → use-connection-BSgWBlyU.js} +1 -1
- package/dist/client/assets/{use-copy-C-tpPcSH.js → use-copy-CQrjYMt6.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BYzHv7h6.js → use-create-virtual-mcp-Ci_Pf5Nk.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-upXMLcwd.js → use-debounced-autosave-B9iBKi2C.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BZvqBs8z.js → use-debounced-value-B_0XkcPc.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-uN4mE2mp.js → use-decopilot-events-Doi21ulo.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DdhDmPIr.js → use-delete-connection-0X6HgWG5.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-b1b5Xb8Z.js → use-deployment-admin-DlvM9ExP.js} +1 -1
- package/dist/client/assets/{use-file-configs-BTbQBv0E.js → use-file-configs-C6HBxpgS.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-ngbg-f4B.js → use-infinite-scroll-C5JPrDpx.js} +1 -1
- package/dist/client/assets/{use-join-requests-BCF9SiKI.js → use-join-requests-Bs9KDX82.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-WmUL9ybR.js → use-mcp-auth-status-CsctuXkZ.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DjvuKLjH.js → use-mcp-client-BjkntfPY.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CxRnxARj.js → use-mcp-tools-DfEInpyw.js} +1 -1
- package/dist/client/assets/{use-members-DYGPMjBz.js → use-members-6EWIgJ4X.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-zMgG6J1K.js → use-navigate-to-agent-C85XYG9r.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CDziQeOJ.js → use-org-auth-client-D9GfKDtc.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BJjI7-Fw.js → use-org-repo-syncs-DIb6EKNJ.js} +1 -1
- package/dist/client/assets/{use-org-sso-DucjgbBl.js → use-org-sso-C1_ZZRoO.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DwfEId2H.js → use-organization-roles-DXsO7UfX.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DjpZoScC.js → use-organization-settings-D7_OVC2c.js} +1 -1
- package/dist/client/assets/{use-registry-connections-25RcS4jV.js → use-registry-connections-BQbAxplt.js} +1 -1
- package/dist/client/assets/{use-secrets-enFOK9gr.js → use-secrets-CntK3pfw.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-MCctBdnO.js → use-section-preview-base-C5f0AtPX.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Dks597jZ.js → use-status-sounds-BOtL83Kh.js} +1 -1
- package/dist/client/assets/{use-tags-CPkOatUi.js → use-tags-BoR99ZmT.js} +1 -1
- package/dist/client/assets/{use-view-mode-DmoKnHoh.js → use-view-mode-CKlMnqJi.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CcIco7Kt.js → use-virtual-mcp-DqfTaJVc.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BUMwuIFl.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-Cl8JyqCl.js +1 -0
- package/dist/client/assets/{users-D_1RV0_X.js → users-ocO-LzHy.js} +1 -1
- package/dist/client/assets/{variant-calendar-CK-1Nkq7.js → variant-calendar-BjnMsv24.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-B-svGARb.js → view-mode-toggle-CkDOm3HG.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/index-B5o3n9Kb.js +0 -1
- package/dist/client/assets/record-editor-BK6RtSPc.js +0 -1
- package/dist/client/assets/redirect-editor-BMHZJK5a.js +0 -1
- package/dist/client/assets/registry-C-Y3lVMm.js +0 -2
- package/dist/client/assets/store-registry-B6ZdpEm_.js +0 -2
- package/dist/client/assets/useInfiniteQuery-C4QcHYKZ.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CwmI6XzH.js +0 -1
package/dist/server/cli.js
CHANGED
|
@@ -1444,7 +1444,7 @@ Usage: deco services <up|down|status>`),process.exit(1)}}var Ip1=L(()=>{uf()});f
|
|
|
1444
1444
|
`.execute($);if(Number(W.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${J}/${K}, keeping in old table`);continue}}await Uy`
|
|
1445
1445
|
DELETE FROM kysely_migration WHERE name = ${Q}
|
|
1446
1446
|
`.execute($)}}async function Ba1($){await ca8($),await la8($);let Z=new Na1({db:$,provider:{getMigrations:()=>Promise.resolve(_p0)}}),{error:Q,results:X}=await Z.migrateToLatest(),Y=0;if(X?.forEach((G)=>{if(G.status==="Success")Y++;else if(G.status==="Error")console.error(`Failed to execute migration "${G.migrationName}"`)}),Q)throw console.error("Failed to migrate"),console.error(Q),Q;return Y}async function ma8($){let{keepOpen:Z=!1,database:Q,skipBetterAuth:X=!1}=$??{},Y="skipped";if(!X&&!Q)Y=await xl0();let G=Q??H8(),J=async()=>{if(!Z&&!Q)await oB(G).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await Ba1(G.db);return await J(),{betterAuth:Y,kysely:K}}catch(K){throw await J(),K}}async function da8(){let $=H8(),Z=new Na1({db:$.db,provider:{getMigrations:()=>Promise.resolve(_p0)}}),{error:Q,results:X}=await Z.migrateDown();if(X?.forEach((Y)=>{if(Y.status==="Success")console.log(`\u2705 Migration "${Y.migrationName}" rolled back successfully`);else if(Y.status==="Error")console.error(`\u274C Failed to rollback migration "${Y.migrationName}"`)}),Q)throw console.error("Failed to rollback migration"),console.error(Q),Q}var La1=L(()=>{Fa1();fl0();QQ()});async function N70($){let Z={...process.env},Q=J80($,Z);console.log(Mw1(Q.settings.encryptionKey));let X=Q.settings.betterAuthSecret||(Q.settings.localMode?Qt1(Q.settings.dataDir):""),{ensureServices:Y}=await Promise.resolve().then(() => (EZ0(),wZ0)),{outputs:G,services:J}=await Y({home:Q.settings.dataDir,externalDatabaseUrl:Q.externalDatabaseUrl,externalNatsUrl:Q.externalNatsUrl});if(!Q.skipMigrations){let{migrateBetterAuth:W}=await Promise.resolve().then(() => (fl0(),Yt1));await W(G.databaseUrl);let{createDatabase:H}=await Promise.resolve().then(() => (QQ(),zn1)),{migrateToLatest:F}=await Promise.resolve().then(() => (La1(),Oa1)),N=H(G.databaseUrl);await F({keepOpen:!0,database:N,skipBetterAuth:!0})}let K={...Q.settings,betterAuthSecret:X,databaseUrl:G.databaseUrl,natsUrls:G.natsUrls,...G.s3?{s3Endpoint:G.s3.endpoint,s3Bucket:G.s3.bucket,s3AccessKeyId:G.s3.accessKeyId,s3SecretAccessKey:G.s3.secretAccessKey,s3ForcePathStyle:G.s3.forcePathStyle}:{}};return qp1(K),{settings:K,services:J.map((W)=>({name:W.name==="PostgreSQL"?"Postgres":W.name,port:W.port})),managedServiceNames:J.filter((W)=>W.owner==="managed").map((W)=>W.name)}}var vp0=L(()=>{uf();Xt1();R$()});var ja1={};Q0(ja1,{updateService:()=>yE,subscribeCliState:()=>bp0,setTuiConsoleIntercepted:()=>U70,setServerUrl:()=>Op,setMigrationsDone:()=>Bp,setDevMode:()=>pa8,resetCliStateForTests:()=>ia8,isTuiConsoleIntercepted:()=>B70,getCliState:()=>fp0,addLogEntry:()=>QO});function Da1(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function wa1(){return{services:Da1(),migrationsStatus:"pending",serverUrl:null,logs:[]}}function ia8(){lX=wa1()}function Up(){for(let $ of xp0)$()}function fp0(){return lX}function bp0($){return xp0.add($),()=>xp0.delete($)}function yE($){lX={...lX,services:lX.services.map((Z)=>Z.name===$.name?$:Z)},Up()}function Bp(){lX={...lX,migrationsStatus:"done"},Up()}function Op($){lX={...lX,serverUrl:$},Up()}function QO($){let Z=[...lX.logs,$];lX={...lX,logs:Z.length>500?Z.slice(-500):Z},Up()}function pa8(){lX={...lX,services:[...Da1(),{name:"API",status:"pending",port:0},{name:"Vite",status:"pending",port:0}]},Up()}function U70($){Ea1=$}function B70(){return Ea1}var lX,xp0,Ea1=!1;var gE=L(()=>{lX=wa1();xp0=new Set});import{createServer as za1}from"net";function na8($){return new Promise((Z)=>{let Q=za1();Q.once("error",()=>Z(!1)),Q.listen($,"0.0.0.0",()=>{Q.close(()=>Z(!0))})})}async function Lp($){if(await na8($))return $;let Z=await new Promise((Q,X)=>{let Y=za1();Y.once("error",X),Y.listen(0,"0.0.0.0",()=>{let G=Y.address(),J=typeof G==="object"&&G?G.port:0;Y.close(()=>Q(J))})});return console.warn(`Port ${$} is in use, using port ${Z} instead.`),Z}var yp0=()=>{};var hp0={};Q0(hp0,{startDevServer:()=>oa8,pipeToLogStore:()=>gp0});import{join as ta8}from"path";function gp0($){let Z=$.getReader(),Q=new TextDecoder,X="";function Y(){let G=X.split(`
|
|
1447
|
-
`);X=G.pop()??"";for(let J of G){let K=Bun.stripANSI(J).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;QO({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{try{for(;;){let{done:G,value:J}=await Z.read();if(G)break;X+=Q.decode(J,{stream:!0}),Y()}}catch{}if(X.trim()){let G=Bun.stripANSI(X).replace(/^\[\d+\]\s*/,"").trim();if(G)QO({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function oa8($){let{baseUrl:Z,noTui:Q}=$,X=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=X?process.env.PORT:$.vitePort,G=Z||`http://localhost:${Y}`,J=X?await Lp(Number(Y)+1):await Lp(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await N70({port:String(J),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let D of W)yE({name:D.name,status:"ready",port:D.port});Bp();let F=ta8(import.meta.dir,"..","..","..","..",".."),N=Q===!0,U=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:G,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}},stdio:["inherit",N?"inherit":"pipe",N?"inherit":"pipe"]});if(!N)gp0(U.stdout),gp0(U.stderr);Op(G),yE({name:"Vite",status:"ready",port:Number(Y)}),yE({name:"API",status:"ready",port:Number(K.port)});let O=async(D)=>{if(U.kill(D),await U.exited,H.length>0){let{stopServices:w}=await Promise.resolve().then(() => (EZ0(),wZ0));await w(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:U}}var up0=L(()=>{vp0();gE();yp0()});var O70;var cp0=L(()=>{O70={name:"decocms",version:"4.286.4",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^3.0.85","@ai-sdk/google":"^3.0.83","@ai-sdk/openai":"^3.0.73","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^2.9.1","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^3.0.10","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^6.0.208","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});import{Box as aa8,Text as Pa1}from"ink";import{jsx as sa8,jsxs as Aa1}from"react/jsx-runtime";function Ta1({version:$}){return Aa1(aa8,{flexDirection:"column",marginTop:1,children:[cZ0.map((Z,Q)=>sa8(Pa1,{color:lZ0[Q],children:Z},Q)),Aa1(Pa1,{dimColor:!0,children:[" v",$]})]})}var Ra1=L(()=>{Zp()});import{Box as hE,Text as XO}from"ink";import{Spinner as ea8}from"@inkjs/ui";import{jsx as eY,jsxs as By}from"react/jsx-runtime";function Ia1({status:$}){if($==="pending")return eY(ea8,{label:""});return eY(XO,{color:"green",children:"\u2713"})}function $s8($){return`${$.name}: ${$.port||"...."}`}function qa1({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return By(hE,{flexDirection:"column",paddingBottom:1,children:[eY(Ta1,{version:O70.version}),eY(hE,{marginBottom:1,children:eY(XO,{dimColor:!0,children:"\u2500".repeat(80)})}),eY(hE,{children:By(XO,{dimColor:!0,children:["Home: ",Q]})}),By(hE,{gap:2,children:[$.map((Y)=>By(hE,{gap:1,children:[eY(XO,{children:$s8(Y)}),eY(Ia1,{status:Y.status})]},Y.name)),By(hE,{gap:1,children:[eY(XO,{children:"Migrations"}),eY(Ia1,{status:Z})]})]}),eY(hE,{children:X?By(XO,{children:["Open in browser: ",eY(XO,{color:"cyan",children:X})]}):eY(XO,{dimColor:!0,children:"Starting..."})})]})}var Ma1=L(()=>{cp0();Ra1()});import{Box as Zs8,Text as Dp}from"ink";import{jsx as lp0,jsxs as mp0}from"react/jsx-runtime";function Qs8($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function Va1({logs:$}){return lp0(Zs8,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return lp0(Dp,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return mp0(Dp,{children:[mp0(Dp,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),lp0(Dp,{color:Qs8(Z.status),children:Z.status}),mp0(Dp,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var ka1=()=>{};var dp0={};Q0(dp0,{App:()=>Gs8});import{Box as Xs8}from"ink";import{useSyncExternalStore as Ys8}from"react";import{jsx as Sa1,jsxs as Js8}from"react/jsx-runtime";function Gs8({home:$}){let Z=Ys8(bp0,fp0);return Js8(Xs8,{flexDirection:"column",children:[Sa1(qa1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),Sa1(Va1,{logs:Z.logs})]})}var ip0=L(()=>{Ma1();ka1();gE()});var u3="thread-gate",KN="decopilot-hosted-harness",WN="decopilot-hosted-harness-sandboxed",LJ="automations",YO="background-tools",uE="task-board-github-reads",cE="jira-push";var Ca1="9";function _a1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:Ca1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var va1=()=>{};import Ks8 from"pg";async function fa1($,Z){let{databaseUrl:Q,lockTimeoutMs:X=Ws8}=$,Y=$.log??((W)=>console.log(W)),G=new Ks8.Client({connectionString:Q});await G.connect();let J=Date.now(),K=!1;try{while(!K){if(K=(await G.query("SELECT pg_try_advisory_lock($1) AS locked",[xa1.toString()])).rows[0]?.locked===!0,K)break;if(Date.now()-J>=X)throw Error(`Timed out after ${X}ms waiting for the DBOS migration lock. Another process is still migrating the dbos schema; this pod will restart and retry.`);await W$(Hs8)}let W=Date.now()-J;if(W>1000)Y(`[dbos] waited ${W}ms for the migration lock; another process migrated first`);return await Z()}finally{if(K)try{await G.query("SELECT pg_advisory_unlock($1)",[xa1.toString()])}catch{}await G.end().catch(()=>{})}}var xa1=8314027461559302n,Ws8=600000,Hs8=500;var ba1=L(()=>{J4()});function Fs8(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function pp0($,Z){for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X===Z)return $[Q+1];if(X.startsWith(`${Z}=`))return X.slice(Z.length+1)}return}function ya1(){let $=Fs8();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:pp0($,"--cpu-prof-dir")??process.cwd(),name:pp0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(pp0($,"--cpu-prof-interval")??1000),note:"profile is written on process exit"}));return}if(process.env.CPU_PROFILE)console.warn(JSON.stringify({msg:"cpu-profiling-requested-but-inactive",hint:'CPU profiling is a Bun launch flag. Set BUN_OPTIONS="--cpu-prof --cpu-prof-md --cpu-prof-dir=/tmp" before starting the process.'}))}function ga1(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=vE();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),G=Y(),J=Object.entries(G.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);X={objectCount:G.objectCount,heapSize:G.heapSize,top:Object.fromEntries(J)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:Q.rss,heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,external:Q.external,arrayBuffers:Q.arrayBuffers,...X}))};return Z().catch(()=>{}),L70=setInterval(()=>void Z().catch(()=>{}),$),L70.unref?.(),process.on("SIGUSR2",()=>{try{let Q=Bun.generateHeapSnapshot("v8"),X=typeof Q==="string"?Q:JSON.stringify(Q),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,X),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(Q){console.error("[heap-watch] snapshot failed:",Q)}}),()=>{if(L70)clearInterval(L70)}}var L70;var ha1=()=>{};import*as Ns8 from"bun:jsc";function ua1(){if(process.env.STALL_WATCHDOG!=="1")return()=>{};let $=Number(process.env.STALL_WATCHDOG_MS??100),Z=Number(process.env.STALL_WATCHDOG_TICK_MS??50);try{Us8()}catch(G){return console.error("[stall-watchdog] failed to start sampling profiler:",G),()=>{}}let Q,X=performance.now()+Z,Y=()=>{let G=performance.now(),J=G-X;X=G+Z;let K=[];try{K=Bs8()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let F of K){let N=F.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??F.frames[0];if(!N)continue;let U=(N.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${N.name??"?"} @ ${U}:${N.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((F,N)=>N[1]-F[1]).slice(0,8).map(([F,N])=>({frame:F,count:N}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(J),samplesInWindow:K.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var Us8,Bs8;var ca1=L(()=>{({startSamplingProfiler:Us8,samplingProfilerStackTraces:Bs8}=Ns8)});function la1(){ya1();let $=[ga1(),Un1(),ua1()];return()=>{for(let Z of $)Z()}}var ma1=L(()=>{Il0();ha1();ca1()});var lE=v((da1)=>{Object.defineProperty(da1,"__esModule",{value:!0});da1.RepublishHeaders=da1.DirectMsgHeaders=da1.JsHeaders=da1.AdvisoryKind=void 0;da1.isOrderedPushConsumerOptions=Os8;da1.isPullConsumer=Ls8;da1.isPushConsumer=Ds8;da1.isBoundPushConsumerOptions=ws8;function Os8($){if($&&typeof $==="object")return"name_prefix"in $||"deliver_subject_prefix"in $||"filter_subjects"in $||"filter_subject"in $||"deliver_policy"in $||"opt_start_seq"in $||"opt_start_time"in $||"replay_policy"in $||"inactive_threshold"in $||"headers_only"in $||"deliver_prefix"in $;return!1}function Ls8($){return $.isPullConsumer()}function Ds8($){return $.isPushConsumer()}function ws8($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}da1.AdvisoryKind={API:"api_audit",StreamAction:"stream_action",ConsumerAction:"consumer_action",SnapshotCreate:"snapshot_create",SnapshotComplete:"snapshot_complete",RestoreCreate:"restore_create",RestoreComplete:"restore_complete",MaxDeliver:"max_deliver",Terminated:"terminated",Ack:"consumer_ack",StreamLeaderElected:"stream_leader_elected",StreamQuorumLost:"stream_quorum_lost",ConsumerLeaderElected:"consumer_leader_elected",ConsumerQuorumLost:"consumer_quorum_lost"};da1.JsHeaders={StreamSourceHdr:"Nats-Stream-Source",LastConsumerSeqHdr:"Nats-Last-Consumer",LastStreamSeqHdr:"Nats-Last-Stream",ConsumerStalledHdr:"Nats-Consumer-Stalled",MessageSizeHdr:"Nats-Msg-Size",RollupHdr:"Nats-Rollup",RollupValueSubject:"sub",RollupValueAll:"all",PendingMessagesHdr:"Nats-Pending-Messages",PendingBytesHdr:"Nats-Pending-Bytes",RequiredApiLevel:"Nats-Required-Api-Level"};da1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};da1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var $G=v((pa1)=>{Object.defineProperty(pa1,"__esModule",{value:!0});pa1.TD=pa1.TE=pa1.Empty=void 0;pa1.encode=qs8;pa1.decode=Ms8;pa1.Empty=new Uint8Array(0);pa1.TE=new TextEncoder;pa1.TD=new TextDecoder;function Is8(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}function qs8(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(pa1.TE.encode($[Q]));if(Z.length===0)return pa1.Empty;if(Z.length===1)return Z[0];return Is8(...Z)}function Ms8($){if(!$||$.length===0)return"";return pa1.TD.decode($)}});var ZG=v((oa1)=>{Object.defineProperty(oa1,"__esModule",{value:!0});oa1.errors=oa1.PermissionViolationError=oa1.NoRespondersError=oa1.TimeoutError=oa1.RequestError=oa1.ProtocolError=oa1.ConnectionError=oa1.DrainingConnectionError=oa1.ClosedConnectionError=oa1.AuthorizationError=oa1.UserAuthenticationExpiredError=oa1.InvalidOperationError=oa1.InvalidArgumentError=oa1.InvalidSubjectError=void 0;class tp0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}oa1.InvalidSubjectError=tp0;class D70 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,Q){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((X)=>`'${X}'`),$=$.join(",");else $=`'${$}'`;return new D70(`${$} ${Z}`,Q)}}oa1.InvalidArgumentError=D70;class op0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}oa1.InvalidOperationError=op0;class w70 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new w70($);return null}}oa1.UserAuthenticationExpiredError=w70;class E70 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],Q=$.toLowerCase();for(let X=0;X<Z.length;X++)if(Q.indexOf(Z[X])!==-1)return new E70($);return null}}oa1.AuthorizationError=E70;class rp0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}oa1.ClosedConnectionError=rp0;class ap0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}oa1.DrainingConnectionError=ap0;class sp0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}oa1.ConnectionError=sp0;class ep0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}oa1.ProtocolError=ep0;class $n0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof j70}}oa1.RequestError=$n0;class Zn0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}oa1.TimeoutError=Zn0;class j70 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}oa1.NoRespondersError=j70;class z70 extends Error{operation;subject;queue;constructor($,Z,Q,X,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=Q,this.queue=X}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let Q="publish",X="",Y=void 0,G=$.match(/(Publish|Subscription) to "(\S+)"/);if(G){if(Q=G[1].toLowerCase(),X=G[2],Q==="subscription"){let J=$.match(/using queue "(\S+)"/);if(J)Y=J[1]}}return new z70($,Q,X,Y)}}oa1.PermissionViolationError=z70;oa1.errors={AuthorizationError:E70,ClosedConnectionError:rp0,ConnectionError:sp0,DrainingConnectionError:ap0,InvalidArgumentError:D70,InvalidOperationError:op0,InvalidSubjectError:tp0,NoRespondersError:j70,PermissionViolationError:z70,ProtocolError:ep0,RequestError:$n0,TimeoutError:Zn0,UserAuthenticationExpiredError:w70}});var c3=v(($s1)=>{Object.defineProperty($s1,"__esModule",{value:!0});$s1.SimpleMutex=$s1.Perf=void 0;$s1.extend=ds8;$s1.render=is8;$s1.timeout=ps8;$s1.delay=ns8;$s1.deadline=ts8;$s1.deferred=Xn0;$s1.debugDeferred=os8;$s1.shuffle=rs8;$s1.collect=as8;$s1.jitter=ea1;$s1.backoff=ss8;$s1.nanos=es8;$s1.millis=$e8;$s1.randomToken=Xe8;var ms8=$G(),Qn0=ZG();function ds8($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function is8($){return ms8.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function ps8($,Z=!0){let Q=Z?new Qn0.TimeoutError:null,X,Y,G=new Promise((J,K)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)K(new Qn0.TimeoutError);else K(Q)},$)});return Object.assign(G,X)}function ns8($=0){let Z,Q=new Promise((X)=>{let Y=setTimeout(()=>{X()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),X()}}});return Object.assign(Q,Z)}async function ts8($,Z=1000){let Q=Xn0(),X=setTimeout(()=>{Q.reject(new Qn0.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function Xn0(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function os8(){let $={},Z=new Promise((Q,X)=>{$={resolve:(Y)=>{console.trace("resolve",Y),Q(Y)},reject:(Y)=>{console.trace("reject"),X(Y)}}});return Object.assign(Z,$)}function rs8($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function as8($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class aa1{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,Q){let X=this.timers.get(Z);if(X===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(Q);if(Y===void 0)throw Error(`${Q} is not defined`);this.measures.set($,Y-X)}getEntries(){let $=[];return this.measures.forEach((Z,Q)=>{$.push({name:Q,duration:Z})}),$}}$s1.Perf=aa1;class sa1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=Xn0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}$s1.SimpleMutex=sa1;function ea1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function ss8($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(Q){return ea1(Q>Z?$[Z]:$[Q])}}}function es8($){return $*1e6}function $e8($){return Math.floor($/1e6)}var Ze8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",HN=new Uint8Array(62);for(let $=0;$<62;$++)HN[$]=Ze8.charCodeAt($);var Qe8=218340105584896;function Xe8(){let $=Math.floor(Math.random()*Qe8),Z=$%62,Q=HN[Z];$=($-Z)/62,Z=$%62;let X=HN[Z];$=($-Z)/62,Z=$%62;let Y=HN[Z];$=($-Z)/62,Z=$%62;let G=HN[Z];$=($-Z)/62,Z=$%62;let J=HN[Z];$=($-Z)/62,Z=$%62;let K=HN[Z];$=($-Z)/62,Z=$%62;let W=HN[Z];$=($-Z)/62;let H=HN[$];return String.fromCharCode(Q,X,Y,G,J,K,W,H)}});var Ws1=v((Js1)=>{Object.defineProperty(Js1,"__esModule",{value:!0});Js1.nuid=Js1.NuidImpl=void 0;var je8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",GO=62,A70=12,Ys1=10,Qs1=33,ze8=333,Xs1=A70+Ys1,Gn0=new Uint8Array(GO);for(let $=0;$<GO;$++)Gn0[$]=je8.charCodeAt($);var P70=4294967296,Gs1=BigInt(GO)**BigInt(Ys1),wp=Number(Gs1/(1n<<32n)),Yn0=Number(Gs1%(1n<<32n));function Pe8($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function Ae8($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else Pe8($)}class Jn0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Xs1),this.cbuf=new Uint8Array(A70),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(wp+1)),this.seqLo=Math.floor(Math.random()*P70);while($++<8&&this.seqHi===wp&&this.seqLo>=Yn0);if(this.seqHi===wp&&this.seqLo>=Yn0)this.seqLo=0;this.inc=Math.random()*(ze8-Qs1)+Qs1|0}setPre(){Ae8(this.cbuf);for(let $=0;$<A70;$++)this.buf[$]=Gn0[this.cbuf[$]%GO]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=Xs1-1;Q>=A70;Q--){let X=Math.floor($/GO),G=($-X*GO)*P70+Z,J=Math.floor(G/GO),K=G-J*GO;this.buf[Q]=Gn0[K],$=X,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=P70)this.seqLo-=P70,this.seqHi+=1;if(this.seqHi>wp||this.seqHi===wp&&this.seqLo>=Yn0)this.setPre(),this.initSeqAndInc();this.fillSeq();let $=this.buf;return String.fromCharCode($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],$[8],$[9],$[10],$[11],$[12],$[13],$[14],$[15],$[16],$[17],$[18],$[19],$[20],$[21])}reset(){this.init()}}Js1.NuidImpl=Jn0;Js1.nuid=new Jn0});var Us1=v((Fs1)=>{Object.defineProperty(Fs1,"__esModule",{value:!0});Fs1.nuid=Fs1.Nuid=void 0;var Hs1=Ws1();Fs1.Nuid=Hs1.NuidImpl;Fs1.nuid=Hs1.nuid});var R70=v((T70)=>{Object.defineProperty(T70,"__esModule",{value:!0});T70.nuid=T70.Nuid=void 0;var Bs1=Us1();Object.defineProperty(T70,"Nuid",{enumerable:!0,get:function(){return Bs1.Nuid}});Object.defineProperty(T70,"nuid",{enumerable:!0,get:function(){return Bs1.nuid}})});var JO=v((Os1)=>{Object.defineProperty(Os1,"__esModule",{value:!0});Os1.DEFAULT_HOST=Os1.DEFAULT_PORT=Os1.Match=void 0;Os1.syncIterator=Ve8;Os1.createInbox=ke8;var qe8=R70(),Me8=ZG();Os1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Ve8($){let Z=$[Symbol.asyncIterator]();return{async next(){let Q=await Z.next();if(Q.done)return Promise.resolve(null);return Promise.resolve(Q.value)}}}function ke8($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw Me8.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${qe8.nuid.next()}`}Os1.DEFAULT_PORT=4222;Os1.DEFAULT_HOST="127.0.0.1"});var Ep=v((Es1)=>{Object.defineProperty(Es1,"__esModule",{value:!0});Es1.DataBuffer=void 0;var Ds1=$G();class ws1{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}static fromAscii($){if(!$)$="";return Ds1.TE.encode($)}static toAscii($){return Ds1.TD.decode($)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let $=new Uint8Array(this.byteLength),Z=0;for(let Q=0;Q<this.buffers.length;Q++)$.set(this.buffers[Q],Z),Z+=this.buffers[Q].length;this.buffers.length=0,this.buffers.push($)}}shift(){if(this.buffers.length){let $=this.buffers.shift();if($)return this.byteLength-=$.length,$}return new Uint8Array(0)}drain($){if(this.buffers.length){this.pack();let Z=this.buffers.pop();if(Z){let Q=this.byteLength;if($===void 0||$>Q)$=Q;let X=Z.subarray(0,$);if(Q>$)this.buffers.push(Z.subarray($));return this.byteLength=Q-$,X}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let Q=0;Q<Z.length;Q++)if(Z[Q]&&Z[Q].length)this.buffers.push(Z[Q]),this.byteLength+=Z[Q].length}peek(){if(this.buffers.length)return this.pack(),this.buffers[0];return new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}Es1.DataBuffer=ws1});var mE=v((Ps1)=>{Object.defineProperty(Ps1,"__esModule",{value:!0});Ps1.LF=Ps1.CR=Ps1.CRLF=Ps1.CR_LF_LEN=Ps1.CR_LF=void 0;Ps1.setTransportFactory=ye8;Ps1.defaultPort=ge8;Ps1.getUrlParseFn=he8;Ps1.newTransport=ue8;Ps1.getResolveFn=ce8;Ps1.protoLen=zs1;Ps1.extractProtocolMessage=le8;var xe8=$G(),fe8=JO(),be8=Ep(),QG;function ye8($){QG=$}function ge8(){return QG!==void 0&&QG.defaultPort!==void 0?QG.defaultPort:fe8.DEFAULT_PORT}function he8(){return QG!==void 0&&QG.urlParseFn?QG.urlParseFn:void 0}function ue8(){if(!QG||typeof QG.factory!=="function")throw Error("transport fn is not set");return QG.factory()}function ce8(){return QG!==void 0&&QG.dnsResolveFn?QG.dnsResolveFn:void 0}Ps1.CR_LF=`\r
|
|
1447
|
+
`);X=G.pop()??"";for(let J of G){let K=Bun.stripANSI(J).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;QO({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{try{for(;;){let{done:G,value:J}=await Z.read();if(G)break;X+=Q.decode(J,{stream:!0}),Y()}}catch{}if(X.trim()){let G=Bun.stripANSI(X).replace(/^\[\d+\]\s*/,"").trim();if(G)QO({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function oa8($){let{baseUrl:Z,noTui:Q}=$,X=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=X?process.env.PORT:$.vitePort,G=Z||`http://localhost:${Y}`,J=X?await Lp(Number(Y)+1):await Lp(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await N70({port:String(J),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let D of W)yE({name:D.name,status:"ready",port:D.port});Bp();let F=ta8(import.meta.dir,"..","..","..","..",".."),N=Q===!0,U=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:G,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}},stdio:["inherit",N?"inherit":"pipe",N?"inherit":"pipe"]});if(!N)gp0(U.stdout),gp0(U.stderr);Op(G),yE({name:"Vite",status:"ready",port:Number(Y)}),yE({name:"API",status:"ready",port:Number(K.port)});let O=async(D)=>{if(U.kill(D),await U.exited,H.length>0){let{stopServices:w}=await Promise.resolve().then(() => (EZ0(),wZ0));await w(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:U}}var up0=L(()=>{vp0();gE();yp0()});var O70;var cp0=L(()=>{O70={name:"decocms",version:"4.286.5",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^3.0.85","@ai-sdk/google":"^3.0.83","@ai-sdk/openai":"^3.0.73","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^2.9.1","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^3.0.10","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^6.0.208","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});import{Box as aa8,Text as Pa1}from"ink";import{jsx as sa8,jsxs as Aa1}from"react/jsx-runtime";function Ta1({version:$}){return Aa1(aa8,{flexDirection:"column",marginTop:1,children:[cZ0.map((Z,Q)=>sa8(Pa1,{color:lZ0[Q],children:Z},Q)),Aa1(Pa1,{dimColor:!0,children:[" v",$]})]})}var Ra1=L(()=>{Zp()});import{Box as hE,Text as XO}from"ink";import{Spinner as ea8}from"@inkjs/ui";import{jsx as eY,jsxs as By}from"react/jsx-runtime";function Ia1({status:$}){if($==="pending")return eY(ea8,{label:""});return eY(XO,{color:"green",children:"\u2713"})}function $s8($){return`${$.name}: ${$.port||"...."}`}function qa1({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return By(hE,{flexDirection:"column",paddingBottom:1,children:[eY(Ta1,{version:O70.version}),eY(hE,{marginBottom:1,children:eY(XO,{dimColor:!0,children:"\u2500".repeat(80)})}),eY(hE,{children:By(XO,{dimColor:!0,children:["Home: ",Q]})}),By(hE,{gap:2,children:[$.map((Y)=>By(hE,{gap:1,children:[eY(XO,{children:$s8(Y)}),eY(Ia1,{status:Y.status})]},Y.name)),By(hE,{gap:1,children:[eY(XO,{children:"Migrations"}),eY(Ia1,{status:Z})]})]}),eY(hE,{children:X?By(XO,{children:["Open in browser: ",eY(XO,{color:"cyan",children:X})]}):eY(XO,{dimColor:!0,children:"Starting..."})})]})}var Ma1=L(()=>{cp0();Ra1()});import{Box as Zs8,Text as Dp}from"ink";import{jsx as lp0,jsxs as mp0}from"react/jsx-runtime";function Qs8($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function Va1({logs:$}){return lp0(Zs8,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return lp0(Dp,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return mp0(Dp,{children:[mp0(Dp,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),lp0(Dp,{color:Qs8(Z.status),children:Z.status}),mp0(Dp,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var ka1=()=>{};var dp0={};Q0(dp0,{App:()=>Gs8});import{Box as Xs8}from"ink";import{useSyncExternalStore as Ys8}from"react";import{jsx as Sa1,jsxs as Js8}from"react/jsx-runtime";function Gs8({home:$}){let Z=Ys8(bp0,fp0);return Js8(Xs8,{flexDirection:"column",children:[Sa1(qa1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),Sa1(Va1,{logs:Z.logs})]})}var ip0=L(()=>{Ma1();ka1();gE()});var u3="thread-gate",KN="decopilot-hosted-harness",WN="decopilot-hosted-harness-sandboxed",LJ="automations",YO="background-tools",uE="task-board-github-reads",cE="jira-push";var Ca1="9";function _a1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:Ca1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var va1=()=>{};import Ks8 from"pg";async function fa1($,Z){let{databaseUrl:Q,lockTimeoutMs:X=Ws8}=$,Y=$.log??((W)=>console.log(W)),G=new Ks8.Client({connectionString:Q});await G.connect();let J=Date.now(),K=!1;try{while(!K){if(K=(await G.query("SELECT pg_try_advisory_lock($1) AS locked",[xa1.toString()])).rows[0]?.locked===!0,K)break;if(Date.now()-J>=X)throw Error(`Timed out after ${X}ms waiting for the DBOS migration lock. Another process is still migrating the dbos schema; this pod will restart and retry.`);await W$(Hs8)}let W=Date.now()-J;if(W>1000)Y(`[dbos] waited ${W}ms for the migration lock; another process migrated first`);return await Z()}finally{if(K)try{await G.query("SELECT pg_advisory_unlock($1)",[xa1.toString()])}catch{}await G.end().catch(()=>{})}}var xa1=8314027461559302n,Ws8=600000,Hs8=500;var ba1=L(()=>{J4()});function Fs8(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function pp0($,Z){for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X===Z)return $[Q+1];if(X.startsWith(`${Z}=`))return X.slice(Z.length+1)}return}function ya1(){let $=Fs8();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:pp0($,"--cpu-prof-dir")??process.cwd(),name:pp0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(pp0($,"--cpu-prof-interval")??1000),note:"profile is written on process exit"}));return}if(process.env.CPU_PROFILE)console.warn(JSON.stringify({msg:"cpu-profiling-requested-but-inactive",hint:'CPU profiling is a Bun launch flag. Set BUN_OPTIONS="--cpu-prof --cpu-prof-md --cpu-prof-dir=/tmp" before starting the process.'}))}function ga1(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=vE();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),G=Y(),J=Object.entries(G.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);X={objectCount:G.objectCount,heapSize:G.heapSize,top:Object.fromEntries(J)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:Q.rss,heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,external:Q.external,arrayBuffers:Q.arrayBuffers,...X}))};return Z().catch(()=>{}),L70=setInterval(()=>void Z().catch(()=>{}),$),L70.unref?.(),process.on("SIGUSR2",()=>{try{let Q=Bun.generateHeapSnapshot("v8"),X=typeof Q==="string"?Q:JSON.stringify(Q),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,X),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(Q){console.error("[heap-watch] snapshot failed:",Q)}}),()=>{if(L70)clearInterval(L70)}}var L70;var ha1=()=>{};import*as Ns8 from"bun:jsc";function ua1(){if(process.env.STALL_WATCHDOG!=="1")return()=>{};let $=Number(process.env.STALL_WATCHDOG_MS??100),Z=Number(process.env.STALL_WATCHDOG_TICK_MS??50);try{Us8()}catch(G){return console.error("[stall-watchdog] failed to start sampling profiler:",G),()=>{}}let Q,X=performance.now()+Z,Y=()=>{let G=performance.now(),J=G-X;X=G+Z;let K=[];try{K=Bs8()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let F of K){let N=F.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??F.frames[0];if(!N)continue;let U=(N.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${N.name??"?"} @ ${U}:${N.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((F,N)=>N[1]-F[1]).slice(0,8).map(([F,N])=>({frame:F,count:N}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(J),samplesInWindow:K.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var Us8,Bs8;var ca1=L(()=>{({startSamplingProfiler:Us8,samplingProfilerStackTraces:Bs8}=Ns8)});function la1(){ya1();let $=[ga1(),Un1(),ua1()];return()=>{for(let Z of $)Z()}}var ma1=L(()=>{Il0();ha1();ca1()});var lE=v((da1)=>{Object.defineProperty(da1,"__esModule",{value:!0});da1.RepublishHeaders=da1.DirectMsgHeaders=da1.JsHeaders=da1.AdvisoryKind=void 0;da1.isOrderedPushConsumerOptions=Os8;da1.isPullConsumer=Ls8;da1.isPushConsumer=Ds8;da1.isBoundPushConsumerOptions=ws8;function Os8($){if($&&typeof $==="object")return"name_prefix"in $||"deliver_subject_prefix"in $||"filter_subjects"in $||"filter_subject"in $||"deliver_policy"in $||"opt_start_seq"in $||"opt_start_time"in $||"replay_policy"in $||"inactive_threshold"in $||"headers_only"in $||"deliver_prefix"in $;return!1}function Ls8($){return $.isPullConsumer()}function Ds8($){return $.isPushConsumer()}function ws8($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}da1.AdvisoryKind={API:"api_audit",StreamAction:"stream_action",ConsumerAction:"consumer_action",SnapshotCreate:"snapshot_create",SnapshotComplete:"snapshot_complete",RestoreCreate:"restore_create",RestoreComplete:"restore_complete",MaxDeliver:"max_deliver",Terminated:"terminated",Ack:"consumer_ack",StreamLeaderElected:"stream_leader_elected",StreamQuorumLost:"stream_quorum_lost",ConsumerLeaderElected:"consumer_leader_elected",ConsumerQuorumLost:"consumer_quorum_lost"};da1.JsHeaders={StreamSourceHdr:"Nats-Stream-Source",LastConsumerSeqHdr:"Nats-Last-Consumer",LastStreamSeqHdr:"Nats-Last-Stream",ConsumerStalledHdr:"Nats-Consumer-Stalled",MessageSizeHdr:"Nats-Msg-Size",RollupHdr:"Nats-Rollup",RollupValueSubject:"sub",RollupValueAll:"all",PendingMessagesHdr:"Nats-Pending-Messages",PendingBytesHdr:"Nats-Pending-Bytes",RequiredApiLevel:"Nats-Required-Api-Level"};da1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};da1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var $G=v((pa1)=>{Object.defineProperty(pa1,"__esModule",{value:!0});pa1.TD=pa1.TE=pa1.Empty=void 0;pa1.encode=qs8;pa1.decode=Ms8;pa1.Empty=new Uint8Array(0);pa1.TE=new TextEncoder;pa1.TD=new TextDecoder;function Is8(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}function qs8(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(pa1.TE.encode($[Q]));if(Z.length===0)return pa1.Empty;if(Z.length===1)return Z[0];return Is8(...Z)}function Ms8($){if(!$||$.length===0)return"";return pa1.TD.decode($)}});var ZG=v((oa1)=>{Object.defineProperty(oa1,"__esModule",{value:!0});oa1.errors=oa1.PermissionViolationError=oa1.NoRespondersError=oa1.TimeoutError=oa1.RequestError=oa1.ProtocolError=oa1.ConnectionError=oa1.DrainingConnectionError=oa1.ClosedConnectionError=oa1.AuthorizationError=oa1.UserAuthenticationExpiredError=oa1.InvalidOperationError=oa1.InvalidArgumentError=oa1.InvalidSubjectError=void 0;class tp0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}oa1.InvalidSubjectError=tp0;class D70 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,Q){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((X)=>`'${X}'`),$=$.join(",");else $=`'${$}'`;return new D70(`${$} ${Z}`,Q)}}oa1.InvalidArgumentError=D70;class op0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}oa1.InvalidOperationError=op0;class w70 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new w70($);return null}}oa1.UserAuthenticationExpiredError=w70;class E70 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],Q=$.toLowerCase();for(let X=0;X<Z.length;X++)if(Q.indexOf(Z[X])!==-1)return new E70($);return null}}oa1.AuthorizationError=E70;class rp0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}oa1.ClosedConnectionError=rp0;class ap0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}oa1.DrainingConnectionError=ap0;class sp0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}oa1.ConnectionError=sp0;class ep0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}oa1.ProtocolError=ep0;class $n0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof j70}}oa1.RequestError=$n0;class Zn0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}oa1.TimeoutError=Zn0;class j70 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}oa1.NoRespondersError=j70;class z70 extends Error{operation;subject;queue;constructor($,Z,Q,X,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=Q,this.queue=X}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let Q="publish",X="",Y=void 0,G=$.match(/(Publish|Subscription) to "(\S+)"/);if(G){if(Q=G[1].toLowerCase(),X=G[2],Q==="subscription"){let J=$.match(/using queue "(\S+)"/);if(J)Y=J[1]}}return new z70($,Q,X,Y)}}oa1.PermissionViolationError=z70;oa1.errors={AuthorizationError:E70,ClosedConnectionError:rp0,ConnectionError:sp0,DrainingConnectionError:ap0,InvalidArgumentError:D70,InvalidOperationError:op0,InvalidSubjectError:tp0,NoRespondersError:j70,PermissionViolationError:z70,ProtocolError:ep0,RequestError:$n0,TimeoutError:Zn0,UserAuthenticationExpiredError:w70}});var c3=v(($s1)=>{Object.defineProperty($s1,"__esModule",{value:!0});$s1.SimpleMutex=$s1.Perf=void 0;$s1.extend=ds8;$s1.render=is8;$s1.timeout=ps8;$s1.delay=ns8;$s1.deadline=ts8;$s1.deferred=Xn0;$s1.debugDeferred=os8;$s1.shuffle=rs8;$s1.collect=as8;$s1.jitter=ea1;$s1.backoff=ss8;$s1.nanos=es8;$s1.millis=$e8;$s1.randomToken=Xe8;var ms8=$G(),Qn0=ZG();function ds8($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function is8($){return ms8.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function ps8($,Z=!0){let Q=Z?new Qn0.TimeoutError:null,X,Y,G=new Promise((J,K)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)K(new Qn0.TimeoutError);else K(Q)},$)});return Object.assign(G,X)}function ns8($=0){let Z,Q=new Promise((X)=>{let Y=setTimeout(()=>{X()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),X()}}});return Object.assign(Q,Z)}async function ts8($,Z=1000){let Q=Xn0(),X=setTimeout(()=>{Q.reject(new Qn0.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function Xn0(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function os8(){let $={},Z=new Promise((Q,X)=>{$={resolve:(Y)=>{console.trace("resolve",Y),Q(Y)},reject:(Y)=>{console.trace("reject"),X(Y)}}});return Object.assign(Z,$)}function rs8($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function as8($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class aa1{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,Q){let X=this.timers.get(Z);if(X===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(Q);if(Y===void 0)throw Error(`${Q} is not defined`);this.measures.set($,Y-X)}getEntries(){let $=[];return this.measures.forEach((Z,Q)=>{$.push({name:Q,duration:Z})}),$}}$s1.Perf=aa1;class sa1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=Xn0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}$s1.SimpleMutex=sa1;function ea1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function ss8($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(Q){return ea1(Q>Z?$[Z]:$[Q])}}}function es8($){return $*1e6}function $e8($){return Math.floor($/1e6)}var Ze8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",HN=new Uint8Array(62);for(let $=0;$<62;$++)HN[$]=Ze8.charCodeAt($);var Qe8=218340105584896;function Xe8(){let $=Math.floor(Math.random()*Qe8),Z=$%62,Q=HN[Z];$=($-Z)/62,Z=$%62;let X=HN[Z];$=($-Z)/62,Z=$%62;let Y=HN[Z];$=($-Z)/62,Z=$%62;let G=HN[Z];$=($-Z)/62,Z=$%62;let J=HN[Z];$=($-Z)/62,Z=$%62;let K=HN[Z];$=($-Z)/62,Z=$%62;let W=HN[Z];$=($-Z)/62;let H=HN[$];return String.fromCharCode(Q,X,Y,G,J,K,W,H)}});var Ws1=v((Js1)=>{Object.defineProperty(Js1,"__esModule",{value:!0});Js1.nuid=Js1.NuidImpl=void 0;var je8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",GO=62,A70=12,Ys1=10,Qs1=33,ze8=333,Xs1=A70+Ys1,Gn0=new Uint8Array(GO);for(let $=0;$<GO;$++)Gn0[$]=je8.charCodeAt($);var P70=4294967296,Gs1=BigInt(GO)**BigInt(Ys1),wp=Number(Gs1/(1n<<32n)),Yn0=Number(Gs1%(1n<<32n));function Pe8($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function Ae8($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else Pe8($)}class Jn0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Xs1),this.cbuf=new Uint8Array(A70),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(wp+1)),this.seqLo=Math.floor(Math.random()*P70);while($++<8&&this.seqHi===wp&&this.seqLo>=Yn0);if(this.seqHi===wp&&this.seqLo>=Yn0)this.seqLo=0;this.inc=Math.random()*(ze8-Qs1)+Qs1|0}setPre(){Ae8(this.cbuf);for(let $=0;$<A70;$++)this.buf[$]=Gn0[this.cbuf[$]%GO]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=Xs1-1;Q>=A70;Q--){let X=Math.floor($/GO),G=($-X*GO)*P70+Z,J=Math.floor(G/GO),K=G-J*GO;this.buf[Q]=Gn0[K],$=X,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=P70)this.seqLo-=P70,this.seqHi+=1;if(this.seqHi>wp||this.seqHi===wp&&this.seqLo>=Yn0)this.setPre(),this.initSeqAndInc();this.fillSeq();let $=this.buf;return String.fromCharCode($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],$[8],$[9],$[10],$[11],$[12],$[13],$[14],$[15],$[16],$[17],$[18],$[19],$[20],$[21])}reset(){this.init()}}Js1.NuidImpl=Jn0;Js1.nuid=new Jn0});var Us1=v((Fs1)=>{Object.defineProperty(Fs1,"__esModule",{value:!0});Fs1.nuid=Fs1.Nuid=void 0;var Hs1=Ws1();Fs1.Nuid=Hs1.NuidImpl;Fs1.nuid=Hs1.nuid});var R70=v((T70)=>{Object.defineProperty(T70,"__esModule",{value:!0});T70.nuid=T70.Nuid=void 0;var Bs1=Us1();Object.defineProperty(T70,"Nuid",{enumerable:!0,get:function(){return Bs1.Nuid}});Object.defineProperty(T70,"nuid",{enumerable:!0,get:function(){return Bs1.nuid}})});var JO=v((Os1)=>{Object.defineProperty(Os1,"__esModule",{value:!0});Os1.DEFAULT_HOST=Os1.DEFAULT_PORT=Os1.Match=void 0;Os1.syncIterator=Ve8;Os1.createInbox=ke8;var qe8=R70(),Me8=ZG();Os1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Ve8($){let Z=$[Symbol.asyncIterator]();return{async next(){let Q=await Z.next();if(Q.done)return Promise.resolve(null);return Promise.resolve(Q.value)}}}function ke8($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw Me8.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${qe8.nuid.next()}`}Os1.DEFAULT_PORT=4222;Os1.DEFAULT_HOST="127.0.0.1"});var Ep=v((Es1)=>{Object.defineProperty(Es1,"__esModule",{value:!0});Es1.DataBuffer=void 0;var Ds1=$G();class ws1{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}static fromAscii($){if(!$)$="";return Ds1.TE.encode($)}static toAscii($){return Ds1.TD.decode($)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let $=new Uint8Array(this.byteLength),Z=0;for(let Q=0;Q<this.buffers.length;Q++)$.set(this.buffers[Q],Z),Z+=this.buffers[Q].length;this.buffers.length=0,this.buffers.push($)}}shift(){if(this.buffers.length){let $=this.buffers.shift();if($)return this.byteLength-=$.length,$}return new Uint8Array(0)}drain($){if(this.buffers.length){this.pack();let Z=this.buffers.pop();if(Z){let Q=this.byteLength;if($===void 0||$>Q)$=Q;let X=Z.subarray(0,$);if(Q>$)this.buffers.push(Z.subarray($));return this.byteLength=Q-$,X}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let Q=0;Q<Z.length;Q++)if(Z[Q]&&Z[Q].length)this.buffers.push(Z[Q]),this.byteLength+=Z[Q].length}peek(){if(this.buffers.length)return this.pack(),this.buffers[0];return new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}Es1.DataBuffer=ws1});var mE=v((Ps1)=>{Object.defineProperty(Ps1,"__esModule",{value:!0});Ps1.LF=Ps1.CR=Ps1.CRLF=Ps1.CR_LF_LEN=Ps1.CR_LF=void 0;Ps1.setTransportFactory=ye8;Ps1.defaultPort=ge8;Ps1.getUrlParseFn=he8;Ps1.newTransport=ue8;Ps1.getResolveFn=ce8;Ps1.protoLen=zs1;Ps1.extractProtocolMessage=le8;var xe8=$G(),fe8=JO(),be8=Ep(),QG;function ye8($){QG=$}function ge8(){return QG!==void 0&&QG.defaultPort!==void 0?QG.defaultPort:fe8.DEFAULT_PORT}function he8(){return QG!==void 0&&QG.urlParseFn?QG.urlParseFn:void 0}function ue8(){if(!QG||typeof QG.factory!=="function")throw Error("transport fn is not set");return QG.factory()}function ce8(){return QG!==void 0&&QG.dnsResolveFn?QG.dnsResolveFn:void 0}Ps1.CR_LF=`\r
|
|
1448
1448
|
`;Ps1.CR_LF_LEN=Ps1.CR_LF.length;Ps1.CRLF=be8.DataBuffer.fromAscii(Ps1.CR_LF);Ps1.CR=new Uint8Array(Ps1.CRLF)[0];Ps1.LF=new Uint8Array(Ps1.CRLF)[1];function zs1($){for(let Z=0;Z<$.length;Z++){let Q=Z+1;if($.byteLength>Q&&$[Z]===Ps1.CR&&$[Q]===Ps1.LF)return Q+1}return 0}function le8($){let Z=zs1($);if(Z>0){let X=new Uint8Array($).slice(0,Z);return xe8.TD.decode(X)}return""}});var Nn0=v((ks1)=>{Object.defineProperty(ks1,"__esModule",{value:!0});ks1.ipV4=qs1;ks1.isIP=ee8;ks1.parseIP=Ms1;var jp=4,dE=16,I70=48,Is1=57,Ts1=65,ae8=70,Rs1=97,se8=102,Fn0=16777215;function qs1($,Z,Q,X){let Y=new Uint8Array(dE);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((J,K)=>{Y[K]=J}),Y[12]=$,Y[13]=Z,Y[14]=Q,Y[15]=X,Y}function ee8($){return Ms1($)!==void 0}function Ms1($){for(let Z=0;Z<$.length;Z++)switch($[Z]){case".":return Vs1($);case":":return $04($)}return}function Vs1($){let Z=new Uint8Array(jp);for(let Q=0;Q<jp;Q++){if($.length===0)return;if(Q>0){if($[0]!==".")return;$=$.substring(1)}let{n:X,c:Y,ok:G}=Z04($);if(!G||X>255)return;$=$.substring(Y),Z[Q]=X}return qs1(Z[0],Z[1],Z[2],Z[3])}function $04($){let Z=new Uint8Array(dE),Q=-1;if($.length>=2&&$[0]===":"&&$[1]===":"){if(Q=0,$=$.substring(2),$.length===0)return Z}let X=0;while(X<dE){let{n:Y,c:G,ok:J}=Q04($);if(!J||Y>65535)return;if(G<$.length&&$[G]==="."){if(Q<0&&X!=dE-jp)return;if(X+jp>dE)return;let K=Vs1($);if(K===void 0)return;Z[X]=K[12],Z[X+1]=K[13],Z[X+2]=K[14],Z[X+3]=K[15],$="",X+=jp;break}if(Z[X]=Y>>8,Z[X+1]=Y,X+=2,$=$.substring(G),$.length===0)break;if($[0]!==":"||$.length==1)return;if($=$.substring(1),$[0]===":"){if(Q>=0)return;if(Q=X,$=$.substring(1),$.length===0)break}}if($.length!==0)return;if(X<dE){if(Q<0)return;let Y=dE-X;for(let G=X-1;G>=Q;G--)Z[G+Y]=Z[G];for(let G=Q+Y-1;G>=Q;G--)Z[G]=0}else if(Q>=0)return;return Z}function Z04($){let Z=0,Q=0;for(Z=0;Z<$.length&&I70<=$.charCodeAt(Z)&&$.charCodeAt(Z)<=Is1;Z++)if(Q=Q*10+($.charCodeAt(Z)-I70),Q>=Fn0)return{n:Fn0,c:Z,ok:!1};if(Z===0)return{n:0,c:0,ok:!1};return{n:Q,c:Z,ok:!0}}function Q04($){let Z=0,Q=0;for(Q=0;Q<$.length;Q++){if(I70<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=Is1)Z*=16,Z+=$.charCodeAt(Q)-I70;else if(Rs1<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=se8)Z*=16,Z+=$.charCodeAt(Q)-Rs1+10;else if(Ts1<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=ae8)Z*=16,Z+=$.charCodeAt(Q)-Ts1+10;else break;if(Z>=Fn0)return{n:0,c:Q,ok:!1}}if(Q===0)return{n:0,c:Q,ok:!1};return{n:Z,c:Q,ok:!0}}});var wn0=v((Cs1)=>{Object.defineProperty(Cs1,"__esModule",{value:!0});Cs1.Servers=Cs1.ServerImpl=void 0;Cs1.isIPV4OrHostname=Ss1;Cs1.hostPort=Dn0;var Un0=mE(),Bn0=c3(),On0=Nn0(),J04=JO(),K04=ZG();function Ss1($){if($.indexOf("[")!==-1||$.indexOf("::")!==-1)return!1;if($.indexOf(".")!==-1)return!0;if($.split(":").length<=2)return!0;return!1}function Ln0($){return!Ss1($)}function W04($){let Q=$.toUpperCase().indexOf("::FFFF:");if(Q!==-1&&$.indexOf(".")!==-1){let X=$.substring(Q+7);return X=X.replace("[",""),X.replace("]","")}return $}function Dn0($){if($=$.trim(),$.match(/^(.*:\/\/)(.*)/m))$=$.replace(/^(.*:\/\/)(.*)/gm,"$2");if($=W04($),Ln0($)&&$.indexOf("[")===-1)$=`[${$}]`;let Z=Ln0($)?$.match(/(]:)(\d+)/):$.match(/(:)(\d+)/),Q=Z&&Z.length===3&&Z[1]&&Z[2]?parseInt(Z[2]):J04.DEFAULT_PORT,Y=new URL(`${Q===80?"https":"http"}://${$}`);Y.port=`${Q}`;let G=Y.hostname;if(G.charAt(0)==="[")G=G.substring(1,G.length-1);return{listen:Y.host,hostname:G,port:Q}}class Oy{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor($,Z=!1){this.src=$,this.tlsName="";let Q=Dn0($);this.listen=Q.listen,this.hostname=Q.hostname,this.port=Q.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=Z}toString(){return this.listen}async resolve($){if(!$.fn||$.resolve===!1)return[this];let Z=[];if((0,On0.isIP)(this.hostname))return[this];else{let Q=await $.fn(this.hostname);if($.debug)console.log(`resolve ${this.hostname} = ${Q.join(",")}`);for(let X of Q){let Y=this.port===80?"https":"http",G=new URL(`${Y}://${Ln0(X)?"["+X+"]":X}`);G.port=`${this.port}`;let J=new Oy(G.host,!1);J.tlsName=this.hostname,Z.push(J)}}if($.randomize)(0,Bn0.shuffle)(Z);return this.resolves=Z,Z}}Cs1.ServerImpl=Oy;class q70{firstSelect;servers;currentServer;tlsName;randomize;constructor($={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=$.randomize||!1}setServers($){if(!Array.isArray($)||$.length===0)throw K04.InvalidArgumentError.format("servers","cannot be empty");let Z=(0,Un0.getUrlParseFn)(),Q=new Map;for(let Y of this.servers)Q.set(Y.listen,Y);let X=[];for(let Y of $){Y=Z?Z(Y):Y;let{listen:G}=Dn0(Y),J=Q.get(G);if(J)J.gossiped=!1,X.push(J);else X.push(new Oy(Y))}if(this.randomize)(0,Bn0.shuffle)(X);if(this.servers=X,this.currentServer===void 0||!X.includes(this.currentServer))this.currentServer=X[0],this.firstSelect=!0}clear(){this.servers.length=0}updateTLSName(){let $=this.getCurrentServer();if(!(0,On0.isIP)($.hostname))this.tlsName=$.hostname,this.servers.forEach((Z)=>{if(Z.gossiped)Z.tlsName=this.tlsName})}getCurrentServer(){return this.currentServer}addServer($,Z=!1){let Q=(0,Un0.getUrlParseFn)();$=Q?Q($):$;let X=new Oy($,Z);if((0,On0.isIP)(X.hostname))X.tlsName=this.tlsName;this.servers.push(X)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;let $=this.servers.shift();if($)this.servers.push($),this.currentServer=$;return $}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer($){if($){let Z=this.servers.indexOf($);this.servers.splice(Z,1)}}snapshot(){return q70.freezeAll(this.servers)}snapshotForHandler(){let $=this.currentServer;if(!$)return this.snapshot();let Z=this.servers.indexOf($);if(Z<=0)return this.snapshot();return q70.freezeAll([$,...this.servers.slice(0,Z),...this.servers.slice(Z+1)])}static freezeAll($){return $.map((Z)=>Object.freeze({hostname:Z.hostname,port:Z.port,listen:Z.listen,src:Z.src,tlsName:Z.tlsName,reconnects:Z.reconnects,lastConnect:Z.lastConnect,gossiped:Z.gossiped,didConnect:Z.didConnect}))}find($){return this.servers.find((Z)=>Z.listen===$.listen)}setCurrent($){this.currentServer=$}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update($,Z){let Q=[],X=[],Y=(0,Un0.getUrlParseFn)(),G=new Map;if($.connect_urls&&$.connect_urls.length>0)$.connect_urls.forEach((K)=>{K=Y?Y(K,Z):K;let W=new Oy(K,!0);G.set(K,W)});let J=[];if(this.servers.forEach((K,W)=>{let H=K.listen;if(K.gossiped&&this.currentServer.listen!==H&&G.get(H)===void 0)J.push(W);G.delete(H)}),J.reverse(),J.forEach((K)=>{let W=this.servers.splice(K,1);X=X.concat(W[0].listen)}),G.forEach((K,W)=>{this.servers.push(K),Q.push(W)}),this.randomize&&Q.length>0){let K=this.currentServer,W=this.servers.filter((H)=>H!==K);(0,Bn0.shuffle)(W),this.servers=K?[K,...W]:W}return{added:Q,deleted:X}}}Cs1.Servers=q70});var M70=v((fs1)=>{Object.defineProperty(fs1,"__esModule",{value:!0});fs1.QueuedIteratorImpl=void 0;var En0=c3(),vs1=ZG();class xs1{inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ctx;_data;err;time;profile;yielding;didBreak;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=(0,En0.deferred)(),this.yields=[],this.iterClosed=(0,En0.deferred)(),this.time=0,this.yielding=!1,this.didBreak=!1,this.profile=!1}[Symbol.asyncIterator](){return this.iterate()}push($){if(this.done)return;if(this.didBreak){if(typeof $==="function"){let Z=$;try{Z()}catch(Q){}}return}if(typeof $==="function")this.pendingFiltered++;this.yields.push($),this.signal.resolve()}async*iterate(){if(this.noIterator)throw new vs1.InvalidOperationError("iterator cannot be used when a callback is registered");if(this.yielding)throw new vs1.InvalidOperationError("iterator is already yielding");this.yielding=!0;try{while(!0){if(this.yields.length===0)await this.signal;if(this.err)throw this.err;let $=this.yields;this.inflight=$.length,this.yields=[];for(let Z=0;Z<$.length;Z++){if(typeof $[Z]==="function"){this.pendingFiltered--;let X=$[Z];try{X()}catch(Y){throw Y}if(this.err)throw this.err;continue}this.processed++,this.inflight--;let Q=this.profile?Date.now():0;yield $[Z],this.time=this.profile?Date.now()-Q:0}if(this.done)break;else if(this.yields.length===0)$.length=0,this.yields=$,this.signal=(0,En0.deferred)()}}finally{this.didBreak=!0,this.stop()}}stop($){if(this.done)return;this.err=$,this.done=!0,this.signal.resolve(),this.iterClosed.resolve($)}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}fs1.QueuedIteratorImpl=xs1});var jn0=v((hs1)=>{Object.defineProperty(hs1,"__esModule",{value:!0});hs1.MuxSubscription=void 0;var U04=JO(),ys1=ZG();class gs1{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init($){return this.baseInbox=`${(0,U04.createInbox)($)}.`,this.baseInbox}add($){if(!isNaN($.received))$.received=0;this.reqs.set($.token,$)}get($){return this.reqs.get($)}cancel($){this.reqs.delete($.token)}getToken($){let Z=$.subject||"";if(Z.indexOf(this.baseInbox)===0)return Z.substring(this.baseInbox.length);return null}all(){return Array.from(this.reqs.values())}handleError($,Z){if($)return this.all().forEach((Q)=>{Q.resolver(Z,{})}),!0;if(Z.operation==="publish"){let Q=this.all().find((X)=>{return X.requestSubject===Z.subject});if(Q)return Q.resolver(Z,{}),!0}return!1}dispatcher(){return($,Z)=>{let Q=this.getToken(Z);if(Q){let X=this.get(Q);if(X){if($===null)$=Z?.data?.length===0&&Z.headers?.code===503?new ys1.NoRespondersError(X.requestSubject):null;X.resolver($,Z)}}}}close(){let $=new ys1.RequestError("connection closed");this.reqs.forEach((Z)=>{Z.resolver($,{})})}}hs1.MuxSubscription=gs1});var zn0=v((ls1)=>{Object.defineProperty(ls1,"__esModule",{value:!0});ls1.Heartbeat=void 0;var B04=c3();class cs1{ph;interval;maxOut;timer;pendings;constructor($,Z,Q){this.ph=$,this.interval=Z,this.maxOut=Q,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel($){if(this.timer)clearTimeout(this.timer),this.timer=void 0;if(this._reset(),$)this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:"ping",pendingPings:this.pendings.length+1}),this.pendings.length===this.maxOut){this.cancel(!0);return}let $=(0,B04.deferred)();this.ph.flush($).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push($),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(($)=>{return $.resolve(),!1})}}ls1.Heartbeat=cs1});var Tn0=v((ns1)=>{Object.defineProperty(ns1,"__esModule",{value:!0});ns1.DenoBuffer=ns1.MAX_SIZE=ns1.AssertionError=void 0;ns1.assert=is1;ns1.concat=ps1;ns1.append=L04;ns1.readAll=D04;ns1.writeAll=w04;var O04=$G();class Pn0 extends Error{constructor($){super($);this.name="AssertionError"}}ns1.AssertionError=Pn0;function is1($,Z="Assertion failed."){if(!$)throw new Pn0(Z)}var ds1=32768;ns1.MAX_SIZE=4294967294;function V70($,Z,Q=0){let X=Z.byteLength-Q;if($.byteLength>X)$=$.subarray(0,X);return Z.set($,Q),$.byteLength}function ps1($,Z){if($===void 0&&Z===void 0)return new Uint8Array(0);if($===void 0)return Z;if(Z===void 0)return $;let Q=new Uint8Array($.length+Z.length);return Q.set($,0),Q.set(Z,$.length),Q}function L04($,Z){return ps1($,Uint8Array.of(Z))}class An0{_buf;_off;constructor($){if(this._off=0,$==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array($)}bytes($={copy:!0}){if($.copy===!1)return this._buf.subarray(this._off);return this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate($){if($===0){this.reset();return}if($<0||$>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+$)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice($){let Z=this._buf.byteLength;if($<=this.capacity-Z)return this._reslice(Z+$),Z;return-1}_reslice($){is1($<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,$)}readByte(){let $=new Uint8Array(1);if(this.read($))return $[0];return null}read($){if(this.empty()){if(this.reset(),$.byteLength===0)return 0;return null}let Z=V70(this._buf.subarray(this._off),$);return this._off+=Z,Z}writeByte($){return this.write(Uint8Array.of($))}writeString($){return this.write(O04.TE.encode($))}write($){let Z=this._grow($.byteLength);return V70($,this._buf,Z)}_grow($){let Z=this.length;if(Z===0&&this._off!==0)this.reset();let Q=this._tryGrowByReslice($);if(Q>=0)return Q;let X=this.capacity;if($<=Math.floor(X/2)-Z)V70(this._buf.subarray(this._off),this._buf);else if(X+$>ns1.MAX_SIZE)throw Error("The buffer cannot be grown beyond the maximum size.");else{let Y=new Uint8Array(Math.min(2*X+$,ns1.MAX_SIZE));V70(this._buf.subarray(this._off),Y),this._buf=Y}return this._off=0,this._reslice(Math.min(Z+$,ns1.MAX_SIZE)),Z}grow($){if($<0)throw Error("Buffer._grow: negative count");let Z=this._grow($);this._reslice(Z)}readFrom($){let Z=0,Q=new Uint8Array(ds1);while(!0){let X=this.capacity-this.length<ds1,Y=X?Q:new Uint8Array(this._buf.buffer,this.length),G=$.read(Y);if(G===null)return Z;if(X)this.write(Y.subarray(0,G));else this._reslice(this.length+G);Z+=G}}}ns1.DenoBuffer=An0;function D04($){let Z=new An0;return Z.readFrom($),Z.bytes()}function w04($,Z){let Q=0;while(Q<Z.length)Q+=$.write(Z.subarray(Q))}});var qn0=v((ss1)=>{Object.defineProperty(ss1,"__esModule",{value:!0});ss1.cc=ss1.State=ss1.Parser=ss1.Kind=void 0;ss1.describe=R04;var Rn0=Tn0(),In0=$G();ss1.Kind={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5};function R04($){let Z,Q="";switch($.kind){case ss1.Kind.MSG:Z="MSG";break;case ss1.Kind.OK:Z="OK";break;case ss1.Kind.ERR:Z="ERR",Q=In0.TD.decode($.data);break;case ss1.Kind.PING:Z="PING";break;case ss1.Kind.PONG:Z="PONG";break;case ss1.Kind.INFO:Z="INFO",Q=In0.TD.decode($.data)}return`${Z}: ${Q}`}function os1(){let $={};return $.sid=-1,$.hdr=-1,$.size=-1,$}var rs1=48,I04=57,Ly=67108864;class as1{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor($){this.dispatcher=$,this.state=ss1.State.OP_START,this.as=0,this.drop=0,this.hdr=0}parse($){let Z;for(Z=0;Z<$.length;Z++){let Q=$[Z];switch(this.state){case ss1.State.OP_START:switch(Q){case ss1.cc.M:case ss1.cc.m:this.state=ss1.State.OP_M,this.hdr=-1,this.ma=os1();break;case ss1.cc.H:case ss1.cc.h:this.state=ss1.State.OP_H,this.hdr=0,this.ma=os1();break;case ss1.cc.P:case ss1.cc.p:this.state=ss1.State.OP_P;break;case ss1.cc.PLUS:this.state=ss1.State.OP_PLUS;break;case ss1.cc.MINUS:this.state=ss1.State.OP_MINUS;break;case ss1.cc.I:case ss1.cc.i:this.state=ss1.State.OP_I;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_H:switch(Q){case ss1.cc.M:case ss1.cc.m:this.state=ss1.State.OP_M;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_M:switch(Q){case ss1.cc.S:case ss1.cc.s:this.state=ss1.State.OP_MS;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MS:switch(Q){case ss1.cc.G:case ss1.cc.g:this.state=ss1.State.OP_MSG;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MSG:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:this.state=ss1.State.OP_MSG_SPC;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MSG_SPC:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:continue;default:this.state=ss1.State.MSG_ARG,this.as=Z}break;case ss1.State.MSG_ARG:switch(Q){case ss1.cc.CR:this.drop=1;break;case ss1.cc.NL:{let X=this.argBuf?this.argBuf.bytes():$.subarray(this.as,Z-this.drop);this.processMsgArgs(X),this.drop=0,this.as=Z+1,this.state=ss1.State.MSG_PAYLOAD,Z=this.as+this.ma.size-1;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;case ss1.State.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let X=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:ss1.Kind.MSG,msg:this.ma,data:X}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ss1.State.MSG_END}else{let X=this.ma.size-this.msgBuf.length,Y=$.length-Z;if(Y<X)X=Y;if(X>0)this.msgBuf.write($.subarray(Z,Z+X)),Z=Z+X-1;else this.msgBuf.writeByte(Q)}else if(Z-this.as>=this.ma.size)this.dispatcher.push({kind:ss1.Kind.MSG,msg:this.ma,data:$.subarray(this.as,Z)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ss1.State.MSG_END;break;case ss1.State.MSG_END:switch(Q){case ss1.cc.NL:this.drop=0,this.as=Z+1,this.state=ss1.State.OP_START;break;default:continue}break;case ss1.State.OP_PLUS:switch(Q){case ss1.cc.O:case ss1.cc.o:this.state=ss1.State.OP_PLUS_O;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PLUS_O:switch(Q){case ss1.cc.K:case ss1.cc.k:this.state=ss1.State.OP_PLUS_OK;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PLUS_OK:switch(Q){case ss1.cc.NL:this.dispatcher.push({kind:ss1.Kind.OK}),this.drop=0,this.state=ss1.State.OP_START;break}break;case ss1.State.OP_MINUS:switch(Q){case ss1.cc.E:case ss1.cc.e:this.state=ss1.State.OP_MINUS_E;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MINUS_E:switch(Q){case ss1.cc.R:case ss1.cc.r:this.state=ss1.State.OP_MINUS_ER;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MINUS_ER:switch(Q){case ss1.cc.R:case ss1.cc.r:this.state=ss1.State.OP_MINUS_ERR;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MINUS_ERR:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:this.state=ss1.State.OP_MINUS_ERR_SPC;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_MINUS_ERR_SPC:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:continue;default:this.state=ss1.State.MINUS_ERR_ARG,this.as=Z}break;case ss1.State.MINUS_ERR_ARG:switch(Q){case ss1.cc.CR:this.drop=1;break;case ss1.cc.NL:{let X;if(this.argBuf)X=this.argBuf.bytes(),this.argBuf=void 0;else X=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:ss1.Kind.ERR,data:X}),this.drop=0,this.as=Z+1,this.state=ss1.State.OP_START;break}default:if(this.argBuf)this.argBuf.write(Uint8Array.of(Q))}break;case ss1.State.OP_P:switch(Q){case ss1.cc.I:case ss1.cc.i:this.state=ss1.State.OP_PI;break;case ss1.cc.O:case ss1.cc.o:this.state=ss1.State.OP_PO;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PO:switch(Q){case ss1.cc.N:case ss1.cc.n:this.state=ss1.State.OP_PON;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PON:switch(Q){case ss1.cc.G:case ss1.cc.g:this.state=ss1.State.OP_PONG;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PONG:switch(Q){case ss1.cc.NL:this.dispatcher.push({kind:ss1.Kind.PONG}),this.drop=0,this.state=ss1.State.OP_START;break}break;case ss1.State.OP_PI:switch(Q){case ss1.cc.N:case ss1.cc.n:this.state=ss1.State.OP_PIN;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PIN:switch(Q){case ss1.cc.G:case ss1.cc.g:this.state=ss1.State.OP_PING;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_PING:switch(Q){case ss1.cc.NL:this.dispatcher.push({kind:ss1.Kind.PING}),this.drop=0,this.state=ss1.State.OP_START;break}break;case ss1.State.OP_I:switch(Q){case ss1.cc.N:case ss1.cc.n:this.state=ss1.State.OP_IN;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_IN:switch(Q){case ss1.cc.F:case ss1.cc.f:this.state=ss1.State.OP_INF;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_INF:switch(Q){case ss1.cc.O:case ss1.cc.o:this.state=ss1.State.OP_INFO;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_INFO:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:this.state=ss1.State.OP_INFO_SPC;break;default:throw this.fail($.subarray(Z))}break;case ss1.State.OP_INFO_SPC:switch(Q){case ss1.cc.SPACE:case ss1.cc.TAB:continue;default:this.state=ss1.State.INFO_ARG,this.as=Z}break;case ss1.State.INFO_ARG:switch(Q){case ss1.cc.CR:this.drop=1;break;case ss1.cc.NL:{let X;if(this.argBuf)X=this.argBuf.bytes(),this.argBuf=void 0;else X=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:ss1.Kind.INFO,data:X}),this.drop=0,this.as=Z+1,this.state=ss1.State.OP_START;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;default:throw this.fail($.subarray(Z))}}if((this.state===ss1.State.MSG_ARG||this.state===ss1.State.MINUS_ERR_ARG||this.state===ss1.State.INFO_ARG)&&!this.argBuf)this.argBuf=new Rn0.DenoBuffer($.subarray(this.as,Z-this.drop));if(this.state===ss1.State.MSG_PAYLOAD&&!this.msgBuf){if(!this.argBuf)this.cloneMsgArg();this.msgBuf=new Rn0.DenoBuffer($.subarray(this.as))}}cloneMsgArg(){let $=this.ma.subject.length,Z=this.ma.reply?this.ma.reply.length:0,Q=new Uint8Array($+Z);if(Q.set(this.ma.subject),this.ma.reply)Q.set(this.ma.reply,$);if(this.argBuf=new Rn0.DenoBuffer(Q),this.ma.subject=Q.subarray(0,$),this.ma.reply)this.ma.reply=Q.subarray($)}processMsgArgs($){if(this.hdr>=0)return this.processHeaderMsgArgs($);let Z=[],Q=-1;for(let X=0;X<$.length;X++)switch($[X]){case ss1.cc.SPACE:case ss1.cc.TAB:case ss1.cc.CR:case ss1.cc.NL:if(Q>=0)Z.push($.subarray(Q,X)),Q=-1;break;default:if(Q<0)Q=X}if(Q>=0)Z.push($.subarray(Q));switch(Z.length){case 3:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(Z[2],Ly);break;case 4:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=Z[2],this.ma.size=this.protoParseInt(Z[3],Ly);break;default:throw this.fail($,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail($,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail($,"processMsgArgs Bad or Missing Size Error")}fail($,Z=""){if(!Z)Z=`parse error [${this.state}]`;else Z=`${Z} [${this.state}]`;return Error(`${Z}: ${In0.TD.decode($)}`)}processHeaderMsgArgs($){let Z=[],Q=-1;for(let X=0;X<$.length;X++)switch($[X]){case ss1.cc.SPACE:case ss1.cc.TAB:case ss1.cc.CR:case ss1.cc.NL:if(Q>=0)Z.push($.subarray(Q,X)),Q=-1;break;default:if(Q<0)Q=X}if(Q>=0)Z.push($.subarray(Q));switch(Z.length){case 4:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(Z[2],Ly),this.ma.size=this.protoParseInt(Z[3],Ly);break;case 5:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=Z[2],this.ma.hdr=this.protoParseInt(Z[3],Ly),this.ma.size=this.protoParseInt(Z[4],Ly);break;default:throw this.fail($,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail($,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail($,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail($,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt($,Z){if($.length===0||$.length>15)return-1;let Q=0;for(let X=0;X<$.length;X++){if($[X]<rs1||$[X]>I04)return-1;Q=Q*10+($[X]-rs1)}return Z!==void 0&&Q>Z?-1:Q}}ss1.Parser=as1;ss1.State={OP_START:0,OP_PLUS:1,OP_PLUS_O:2,OP_PLUS_OK:3,OP_MINUS:4,OP_MINUS_E:5,OP_MINUS_ER:6,OP_MINUS_ERR:7,OP_MINUS_ERR_SPC:8,MINUS_ERR_ARG:9,OP_M:10,OP_MS:11,OP_MSG:12,OP_MSG_SPC:13,MSG_ARG:14,MSG_PAYLOAD:15,MSG_END:16,OP_H:17,OP_P:18,OP_PI:19,OP_PIN:20,OP_PING:21,OP_PO:22,OP_PON:23,OP_PONG:24,OP_I:25,OP_IN:26,OP_INF:27,OP_INFO:28,OP_INFO_SPC:29,INFO_ARG:30};ss1.cc={CR:13,E:69,e:101,F:70,f:102,G:71,g:103,H:72,h:104,I:73,i:105,K:75,k:107,M:77,m:109,MINUS:45,N:78,n:110,NL:10,O:79,o:111,P:80,p:112,PLUS:43,R:82,r:114,S:83,s:115,SPACE:32,TAB:9}});var C70=v(($e1)=>{Object.defineProperty($e1,"__esModule",{value:!0});$e1.MsgHdrsImpl=void 0;$e1.canonicalMIMEHeaderKey=Vn0;$e1.headers=V04;var es1=$G(),l3=JO(),S70=ZG();function Vn0($){let F=!0,N=Array($.length);for(let U=0;U<$.length;U++){let B=$.charCodeAt(U);if(B===58||B<33||B>126)throw S70.InvalidArgumentError.format("header",`'${$[U]}' is not a valid character in a header name`);if(F&&97<=B&&B<=122)B-=32;else if(!F&&65<=B&&B<=90)B+=32;N[U]=B,F=B==45}return String.fromCharCode(...N)}function V04($=0,Z=""){if($===0&&Z!=="")throw S70.InvalidArgumentError.format("code","is required");else if($>0&&Z==="")throw S70.InvalidArgumentError.format("description","is required");return new Dy($,Z)}var Mn0="NATS/1.0";class Dy{_code;headers;_description;constructor($=0,Z=""){this._code=$,this._description=Z,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals($){if($&&this.headers.size===$.headers.size&&this._code===$._code){for(let[Z,Q]of this.headers){let X=$.values(Z);if(Q.length!==X.length)return!1;let Y=[...Q].sort(),G=[...X].sort();for(let J=0;J<Y.length;J++)if(Y[J]!==G[J])return!1}return!0}return!1}static decode($){let Z=new Dy,X=es1.TD.decode($).split(`\r
|
|
1449
1449
|
`),Y=X[0];if(Y!==Mn0){let G=Y.replace(Mn0,"").trim();if(G.length>0){if(Z._code=parseInt(G,10),isNaN(Z._code))Z._code=0;let J=Z._code.toString();G=G.replace(J,""),Z._description=G.trim()}}if(X.length>=1)X.slice(1).map((G)=>{if(G){let J=G.indexOf(":");if(J>-1){let K=G.slice(0,J),W=G.slice(J+1).trim();Z.append(K,W)}}});return Z}toString(){if(this.headers.size===0&&this._code===0)return"";let $=Mn0;if(this._code>0&&this._description!=="")$+=` ${this._code} ${this._description}`;for(let[Z,Q]of this.headers)for(let X=0;X<Q.length;X++)$=`${$}\r
|
|
1450
1450
|
${Z}: ${Q[X]}`;return`${$}\r
|
|
@@ -2856,7 +2856,7 @@ Usage notes:
|
|
|
2856
2856
|
`+`- Every subtask call starts FRESH \u2014 no conversation history, no prior runs. Always include full context in the prompt and state exactly what to return (the specific answer/list/paths you need, not a raw dump); never use continuation phrases like 'continue' or 'as before'.
|
|
2857
2857
|
`+`- Clearly tell the subagent whether you expect it to take action or just research.
|
|
2858
2858
|
- To parallelize independent searches, launch multiple subtask calls in the same message.
|
|
2859
|
-
- The subagent's output should generally be trusted.`;Uo4={readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}});function Ev$($){let Z={},Q=$.split(/\r?\n/);for(let X=0;X<Q.length;X++){let Y=(Q[X]??"").trim();if(!Y||Y.startsWith("#"))continue;if(Y.startsWith("export "))Y=Y.slice(7).trim();let G=Y.indexOf("=");if(G<0)throw Error(`Line ${X+1}: missing '='`);let J=Y.slice(0,G).trim();if(!Bo4.test(J))throw Error(`Line ${X+1}: invalid key "${J}"`);let K=Y.slice(G+1).trim();if(K.length>=2&&(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'")))K=K.slice(1,-1);Z[J]=K}return Z}var Bo4;var jv$=L(()=>{Bo4=/^[A-Za-z_][A-Za-z0-9_]*$/});async function Pv$($){let Z=$.organization?.id;if(!Z)return{};try{let{value:Q}=await $.storage.secrets.resolveByName({organizationId:Z,scope:{kind:"organization"},name:zv$});return Ev$(Q)}catch(Q){if(Q?.name!=="SecretNotFoundError")console.warn(`[org-run-env] ignoring the ${zv$} secret: ${Q instanceof Error?Q.message:String(Q)}`);return{}}}function Av$($,Z){return{...$,...Z}}var zv$="TASK_RUN_ENV";var Tv$=L(()=>{jv$()});async function*Rv$($,Z,Q){let X=!1;for await(let Y of $){if(yield Y,X||!Z)continue;if(Y.type!=="start")continue;X=!0,yield{type:"message-metadata",messageMetadata:{models:{thinking:{id:Z,title:Z,provider:Q}}}}}}function Iv$($){let{role:Z,roleStatements:Q,connectionIds:X}=$;if(NQ(Z??void 0))return Object.fromEntries(X.map((G)=>[G,["*"]]));let Y={};for(let G of X){let J=new Set;for(let K of Q)for(let W of K[G]??[])J.add(W);if(J.size===0)continue;Y[G]=J.has("*")?["*"]:[...J]}return Y}function qv$($){return($??"").split(",").map((Z)=>Z.trim()).filter(Boolean)}var Mv$=L(()=>{QY()});function xv($){return $==="decopilot"||$==="claude-code"}function Lo4($){return{type:"data-run-status",id:"run-status",data:{stage:$}}}function Vv$($){if(!$||typeof $!=="object")return!1;return $.type==="data-run-status"}async function _G($){let{streamBuffer:Z,harnessId:Q,taskId:X,stage:Y}=$;if(!Z||!xv(Q))return;try{await Z.publishRawChunk(X,Lo4(Y))}catch{}}var Oo4,Xs,BWZ;var fv=L(()=>{Oo4=["waiting-runner","starting-run","starting-sandbox","waiting-capacity","gathering-context","preparing-tools","starting-assistant","analyzing-scope"],Xs=["gathering-context","preparing-tools","starting-assistant","analyzing-scope"],BWZ=new Set(Oo4)});function Ys($){return $ instanceof Error&&$.superseded===!0}function vv$($){return $===404||$===410||$>=500}function Jc($){return $===bv}class t71{ctx;virtualMcpId;branch;credential;resume;interactive;streamBuffer;constructor($){this.ctx=$.ctx,this.virtualMcpId=$.virtualMcpId,this.branch=$.branch,this.credential=$.credential,this.resume=$.resume??null,this.interactive=$.interactive??!1,this.streamBuffer=$.streamBuffer}dispatch($){return this.stream($)}async resolveWorkspace($){let Z=await eL(this.ctx,$);if(!Z)return this.branch===rN($)?{cwd:kv$,branch:aN(this.branch)}:{cwd:null};return{cwd:kv$,repo:{owner:Z.owner,name:Z.name,connectedGithub:Boolean(Z.connectionId)},branch:this.branch.startsWith("thread:")?aN(this.branch):this.branch}}async mcpForRun($,Z,Q){let X=await this.orgMcpConnections($),Y=await this.dispatcherConnectionGrants($.id,Q,X.map((W)=>W.id)),G=X.filter((W)=>(W.id in Y)),J=await tP0(this.ctx,this.virtualMcpId,$,`${bv}-run`,"task-run",Z,WV$({toolNames:S91,grants:Y}));if(G.length===0||!$.slug)return{mcp:J};let K=KV$({publicUrl:m9(),organizationSlug:$.slug,headers:J.headers,connections:G});return console.log(`[${bv}] org mcps: ${K.map((W)=>W.name).join(" ")||"none"}${X.length===G.length?"":` (${X.length-G.length} withheld \u2014 the `+"dispatching user has no grant for them)"}`),{mcp:J,orgMcps:K}}async dispatcherConnectionGrants($,Z,Q){if(Q.length===0)return{};let Y=(await this.ctx.db.selectFrom("member").select(["role"]).where("organizationId","=",$).where("userId","=",Z).executeTakeFirst())?.role,G=NQ(Y??void 0)?[]:(await Promise.all(qv$(Y).map((J)=>Gs(this.ctx.db,$,J)))).filter((J)=>Boolean(J));return Iv$({role:Y,roleStatements:G,connectionIds:Q})}async orgMcpConnections($){if(!$.slug)return[];let[Z,Q]=await Promise.all([this.ctx.storage.organizationSettings.get($.id),this.ctx.storage.virtualMcps.findById(this.virtualMcpId).catch(()=>null)]),X=DG(Z?.flags,"coding_agent_org_mcps"),Y=new Set((Q?.connections??[]).map((J)=>J.connection_id));if(!X&&Y.size===0)return[];let{items:G}=await this.ctx.storage.connections.list($.id);return So4({organizationId:$.id,orgWide:X,ownIds:Y,connections:G})}async*stream($){if(!this.credential)throw Error(`the ${bv} harness needs a resolved model credential; this run has none (check the agent's thinking model)`);let Z=hV$(this.credential,yV$(this.ctx.metadata?.runMetadata?.[GA0])),Q=this.ctx.organization;if(!Q)throw Error(`the ${bv} harness needs an organization on the context to mint its MCP endpoint; this run has none`);let X=Av$(await Pv$(this.ctx),Z),Y=await AX(this.ctx),G={...$,...await this.mcpForRun(Q,$.threadId,$.user.id),workspace:await this.resolveWorkspace($.threadId)},J=$.threadId,{ctx:K,virtualMcpId:W,branch:H,interactive:F,streamBuffer:N}=this,U=this.credential.providerId,B=null,O=(D)=>async function*(){await _G({streamBuffer:N,harnessId:bv,taskId:J,stage:"starting-sandbox"});let w=await Su({virtualMcpId:W,branch:H,purpose:F?"interactive":"harness-run"},K);B=w.sandboxHandle,await To4(Y,w.sandboxHandle,X),yield*Rv$(Mo4({provider:Y,handle:w.sandboxHandle,input:D?{...G,resume:D}:G,runId:J,signal:$.signal}),D?null:Z.CLAUDE_CODE_MODEL,U)}();try{yield*jo4({runId:J,resume:this.resume,aborted:()=>$.signal?.aborted===!0,dispatchOnce:O,lastHandle:()=>B,describeTermination:async(D)=>D===null?null:Po4(await Y.lastTermination(D))})}finally{if(B&&!this.interactive&&y0().sandboxReleaseOnRunEndEnabled)await Y.releaseAfter(B,y0().sandboxReleaseGraceMs).catch(()=>{})}}}async function*jo4($){let Z=$.maxAttempts??Do4,Q=$.maxTotalAttempts??wo4,X=$.resume,Y=X!==null,G=0;for(let J=1;;J++){let K=!1;try{for await(let W of $.dispatchOnce(X)){if(K=!0,W.type==="start"){if(Y)continue;Y=!0}yield W}return}catch(W){if($.aborted())throw W;G=K?0:G+1;let H=W instanceof TY?await $.describeTermination?.($.lastHandle?.()??null).catch(()=>null)??null:null;if(Ys(W)||!(W instanceof TY)||G>=Z||J>=Q){if(H&&W instanceof TY)throw new TY(W.reason,H);throw W}console.warn("[sandbox-dispatch] sandbox lost mid-run; continuing",{runId:$.runId,attempt:J,progressed:K,reason:W.message,termination:H}),X={reason:zo4(W.message,H)}}}}function zo4($,Z){let Q=`the sandbox running the previous attempt stopped answering (${$})`;if(!Z)return Q;return`${Q}. ${Z}. A replacement sandbox has been started from the last state pushed to the branch. Tell the user this happened, re-read the files you had been editing rather than trusting your memory of them, and if a step needs more memory than the sandbox has, split it instead of repeating what was killed`}function Po4($){if(!$)return null;if($.oomKilled)return`it was killed by the kernel for exceeding its memory limit${$.memoryLimit?` (memory limit ${$.memoryLimit})`:""} \u2014 OOMKilled`;if($.reason==="Completed")return null;let Z=$.exitCode===void 0?"":` (exit code ${$.exitCode})`;return`the sandbox container terminated with reason ${$.reason}${Z}`}async function To4($,Z,Q){let X;try{X=await $.proxyDaemonRequest(Z,"/_sandbox/config",{method:"PUT",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify({env:Q}),signal:AbortSignal.timeout(Ao4)})}catch(Y){throw new TY(`could not push the model env to the sandbox: ${Y instanceof Error?Y.message:String(Y)}`)}if(!X.ok){let Y=`failed to push model env to the sandbox (${X.status} ${X.statusText})`;if(vv$(X.status))throw new TY(Y);throw Error(Y)}}function Ro4($){let{signal:Z,...Q}=$;return Q}function qo4($,Z){let Q=()=>void $.renewTtl(Z).catch((Y)=>console.warn(`[sandbox-dispatch] TTL renew failed for ${Z}: ${Y instanceof Error?Y.message:String(Y)}`));Q();let X=setInterval(Q,Io4);return X.unref?.(),()=>clearInterval(X)}async function*Mo4($){let Z=Date.now(),Q=Ro4($.input),X=(H=!1)=>$.provider.proxyDaemonRequest($.handle,"/_sandbox/dispatch",{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify({...H?{harnessId:bv}:{},runId:$.runId,input:Q}),...$.signal?{signal:$.signal}:{}}),Y;try{if(Y=await X(),Y.status===400){let H=await Y.clone().json().catch(()=>null);if(typeof H==="object"&&H!==null&&"error"in H&&H.error==="missing_harness_id")Y=await X(!0)}}catch(H){if($.signal?.aborted)throw H;throw new TY(`could not reach the sandbox daemon: ${H instanceof Error?H.message:String(H)}`)}if(!Y.ok){let H=await Y.text().catch(()=>Y.statusText),F=`sandbox dispatch failed (${Y.status}): ${H.slice(0,512)}`;if(vv$(Y.status))throw new TY(F);throw Error(F)}if(!Y.body)throw new TY("dispatch returned no body");let G=qo4($.provider,$.handle),J=0,K=null,W=!1;try{for await(let H of ko4(Y.body,$.signal)){let F=uV$.safeParse(H);if(!F.success)throw Error(`sandbox dispatch returned a malformed frame: ${F.error.message}`);if(J+=F.data.chunks.length,yield*F.data.chunks,K??=F.data.error,F.data.done)W=!0}}finally{G()}if(console.log("[sandbox-dispatch] run ended",{runId:$.runId,handle:$.handle,chunks:J,elapsedMs:Date.now()-Z,done:W,error:K?.code??null}),!W&&!K)throw new TY(`the sandbox stopped streaming after ${J} chunks without finishing the run`);if(K)throw Vo4(K.code,K.message)}function Vo4($,Z){if($===Eo4)return new _v$(Z);if($===lV$)return new TY(Z);return Error(`${$}: ${Z}`)}async function*ko4($,Z){let Q=new TextDecoder,X="",Y=function*(J){let K=X.split(`
|
|
2859
|
+
- The subagent's output should generally be trusted.`;Uo4={readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}});function Ev$($){let Z={},Q=$.split(/\r?\n/);for(let X=0;X<Q.length;X++){let Y=(Q[X]??"").trim();if(!Y||Y.startsWith("#"))continue;if(Y.startsWith("export "))Y=Y.slice(7).trim();let G=Y.indexOf("=");if(G<0)throw Error(`Line ${X+1}: missing '='`);let J=Y.slice(0,G).trim();if(!Bo4.test(J))throw Error(`Line ${X+1}: invalid key "${J}"`);let K=Y.slice(G+1).trim();if(K.length>=2&&(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'")))K=K.slice(1,-1);Z[J]=K}return Z}var Bo4;var jv$=L(()=>{Bo4=/^[A-Za-z_][A-Za-z0-9_]*$/});async function Pv$($){let Z=$.organization?.id;if(!Z)return{};try{let{value:Q}=await $.storage.secrets.resolveByName({organizationId:Z,scope:{kind:"organization"},name:zv$});return Ev$(Q)}catch(Q){if(Q?.name!=="SecretNotFoundError")console.warn(`[org-run-env] ignoring the ${zv$} secret: ${Q instanceof Error?Q.message:String(Q)}`);return{}}}function Av$($,Z){return{...$,...Z}}var zv$="TASK_RUN_ENV";var Tv$=L(()=>{jv$()});async function*Rv$($,Z,Q){let X=!1;for await(let Y of $){if(yield Y,X||!Z)continue;if(Y.type!=="start")continue;X=!0,yield{type:"message-metadata",messageMetadata:{models:{thinking:{id:Z,title:Z,provider:Q}}}}}}function Iv$($){let{role:Z,roleStatements:Q,connectionIds:X}=$;if(NQ(Z??void 0))return Object.fromEntries(X.map((G)=>[G,["*"]]));let Y={};for(let G of X){let J=new Set;for(let K of Q)for(let W of K[G]??[])J.add(W);if(J.size===0)continue;Y[G]=J.has("*")?["*"]:[...J]}return Y}function qv$($){return($??"").split(",").map((Z)=>Z.trim()).filter(Boolean)}var Mv$=L(()=>{QY()});function xv($){return $==="decopilot"||$==="claude-code"}function Lo4($){return{type:"data-run-status",id:"run-status",data:{stage:$}}}function Vv$($){if(!$||typeof $!=="object")return!1;return $.type==="data-run-status"}async function _G($){let{streamBuffer:Z,harnessId:Q,taskId:X,stage:Y}=$;if(!Z||!xv(Q))return;try{await Z.publishRawChunk(X,Lo4(Y))}catch{}}var Oo4,Xs,BWZ;var fv=L(()=>{Oo4=["waiting-runner","starting-run","starting-sandbox","waiting-capacity","gathering-context","preparing-tools","starting-assistant","analyzing-scope","retrying-provider"],Xs=["gathering-context","preparing-tools","starting-assistant","analyzing-scope"],BWZ=new Set(Oo4)});function Ys($){return $ instanceof Error&&$.superseded===!0}function vv$($){return $===404||$===410||$>=500}function Jc($){return $===bv}class t71{ctx;virtualMcpId;branch;credential;resume;interactive;streamBuffer;constructor($){this.ctx=$.ctx,this.virtualMcpId=$.virtualMcpId,this.branch=$.branch,this.credential=$.credential,this.resume=$.resume??null,this.interactive=$.interactive??!1,this.streamBuffer=$.streamBuffer}dispatch($){return this.stream($)}async resolveWorkspace($){let Z=await eL(this.ctx,$);if(!Z)return this.branch===rN($)?{cwd:kv$,branch:aN(this.branch)}:{cwd:null};return{cwd:kv$,repo:{owner:Z.owner,name:Z.name,connectedGithub:Boolean(Z.connectionId)},branch:this.branch.startsWith("thread:")?aN(this.branch):this.branch}}async mcpForRun($,Z,Q){let X=await this.orgMcpConnections($),Y=await this.dispatcherConnectionGrants($.id,Q,X.map((W)=>W.id)),G=X.filter((W)=>(W.id in Y)),J=await tP0(this.ctx,this.virtualMcpId,$,`${bv}-run`,"task-run",Z,WV$({toolNames:S91,grants:Y}));if(G.length===0||!$.slug)return{mcp:J};let K=KV$({publicUrl:m9(),organizationSlug:$.slug,headers:J.headers,connections:G});return console.log(`[${bv}] org mcps: ${K.map((W)=>W.name).join(" ")||"none"}${X.length===G.length?"":` (${X.length-G.length} withheld \u2014 the `+"dispatching user has no grant for them)"}`),{mcp:J,orgMcps:K}}async dispatcherConnectionGrants($,Z,Q){if(Q.length===0)return{};let Y=(await this.ctx.db.selectFrom("member").select(["role"]).where("organizationId","=",$).where("userId","=",Z).executeTakeFirst())?.role,G=NQ(Y??void 0)?[]:(await Promise.all(qv$(Y).map((J)=>Gs(this.ctx.db,$,J)))).filter((J)=>Boolean(J));return Iv$({role:Y,roleStatements:G,connectionIds:Q})}async orgMcpConnections($){if(!$.slug)return[];let[Z,Q]=await Promise.all([this.ctx.storage.organizationSettings.get($.id),this.ctx.storage.virtualMcps.findById(this.virtualMcpId).catch(()=>null)]),X=DG(Z?.flags,"coding_agent_org_mcps"),Y=new Set((Q?.connections??[]).map((J)=>J.connection_id));if(!X&&Y.size===0)return[];let{items:G}=await this.ctx.storage.connections.list($.id);return So4({organizationId:$.id,orgWide:X,ownIds:Y,connections:G})}async*stream($){if(!this.credential)throw Error(`the ${bv} harness needs a resolved model credential; this run has none (check the agent's thinking model)`);let Z=hV$(this.credential,yV$(this.ctx.metadata?.runMetadata?.[GA0])),Q=this.ctx.organization;if(!Q)throw Error(`the ${bv} harness needs an organization on the context to mint its MCP endpoint; this run has none`);let X=Av$(await Pv$(this.ctx),Z),Y=await AX(this.ctx),G={...$,...await this.mcpForRun(Q,$.threadId,$.user.id),workspace:await this.resolveWorkspace($.threadId)},J=$.threadId,{ctx:K,virtualMcpId:W,branch:H,interactive:F,streamBuffer:N}=this,U=this.credential.providerId,B=null,O=(D)=>async function*(){await _G({streamBuffer:N,harnessId:bv,taskId:J,stage:"starting-sandbox"});let w=await Su({virtualMcpId:W,branch:H,purpose:F?"interactive":"harness-run"},K);B=w.sandboxHandle,await To4(Y,w.sandboxHandle,X),yield*Rv$(Mo4({provider:Y,handle:w.sandboxHandle,input:D?{...G,resume:D}:G,runId:J,signal:$.signal}),D?null:Z.CLAUDE_CODE_MODEL,U)}();try{yield*jo4({runId:J,resume:this.resume,aborted:()=>$.signal?.aborted===!0,dispatchOnce:O,lastHandle:()=>B,describeTermination:async(D)=>D===null?null:Po4(await Y.lastTermination(D))})}finally{if(B&&!this.interactive&&y0().sandboxReleaseOnRunEndEnabled)await Y.releaseAfter(B,y0().sandboxReleaseGraceMs).catch(()=>{})}}}async function*jo4($){let Z=$.maxAttempts??Do4,Q=$.maxTotalAttempts??wo4,X=$.resume,Y=X!==null,G=0;for(let J=1;;J++){let K=!1;try{for await(let W of $.dispatchOnce(X)){if(K=!0,W.type==="start"){if(Y)continue;Y=!0}yield W}return}catch(W){if($.aborted())throw W;G=K?0:G+1;let H=W instanceof TY?await $.describeTermination?.($.lastHandle?.()??null).catch(()=>null)??null:null;if(Ys(W)||!(W instanceof TY)||G>=Z||J>=Q){if(H&&W instanceof TY)throw new TY(W.reason,H);throw W}console.warn("[sandbox-dispatch] sandbox lost mid-run; continuing",{runId:$.runId,attempt:J,progressed:K,reason:W.message,termination:H}),X={reason:zo4(W.message,H)}}}}function zo4($,Z){let Q=`the sandbox running the previous attempt stopped answering (${$})`;if(!Z)return Q;return`${Q}. ${Z}. A replacement sandbox has been started from the last state pushed to the branch. Tell the user this happened, re-read the files you had been editing rather than trusting your memory of them, and if a step needs more memory than the sandbox has, split it instead of repeating what was killed`}function Po4($){if(!$)return null;if($.oomKilled)return`it was killed by the kernel for exceeding its memory limit${$.memoryLimit?` (memory limit ${$.memoryLimit})`:""} \u2014 OOMKilled`;if($.reason==="Completed")return null;let Z=$.exitCode===void 0?"":` (exit code ${$.exitCode})`;return`the sandbox container terminated with reason ${$.reason}${Z}`}async function To4($,Z,Q){let X;try{X=await $.proxyDaemonRequest(Z,"/_sandbox/config",{method:"PUT",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify({env:Q}),signal:AbortSignal.timeout(Ao4)})}catch(Y){throw new TY(`could not push the model env to the sandbox: ${Y instanceof Error?Y.message:String(Y)}`)}if(!X.ok){let Y=`failed to push model env to the sandbox (${X.status} ${X.statusText})`;if(vv$(X.status))throw new TY(Y);throw Error(Y)}}function Ro4($){let{signal:Z,...Q}=$;return Q}function qo4($,Z){let Q=()=>void $.renewTtl(Z).catch((Y)=>console.warn(`[sandbox-dispatch] TTL renew failed for ${Z}: ${Y instanceof Error?Y.message:String(Y)}`));Q();let X=setInterval(Q,Io4);return X.unref?.(),()=>clearInterval(X)}async function*Mo4($){let Z=Date.now(),Q=Ro4($.input),X=(H=!1)=>$.provider.proxyDaemonRequest($.handle,"/_sandbox/dispatch",{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify({...H?{harnessId:bv}:{},runId:$.runId,input:Q}),...$.signal?{signal:$.signal}:{}}),Y;try{if(Y=await X(),Y.status===400){let H=await Y.clone().json().catch(()=>null);if(typeof H==="object"&&H!==null&&"error"in H&&H.error==="missing_harness_id")Y=await X(!0)}}catch(H){if($.signal?.aborted)throw H;throw new TY(`could not reach the sandbox daemon: ${H instanceof Error?H.message:String(H)}`)}if(!Y.ok){let H=await Y.text().catch(()=>Y.statusText),F=`sandbox dispatch failed (${Y.status}): ${H.slice(0,512)}`;if(vv$(Y.status))throw new TY(F);throw Error(F)}if(!Y.body)throw new TY("dispatch returned no body");let G=qo4($.provider,$.handle),J=0,K=null,W=!1;try{for await(let H of ko4(Y.body,$.signal)){let F=uV$.safeParse(H);if(!F.success)throw Error(`sandbox dispatch returned a malformed frame: ${F.error.message}`);if(J+=F.data.chunks.length,yield*F.data.chunks,K??=F.data.error,F.data.done)W=!0}}finally{G()}if(console.log("[sandbox-dispatch] run ended",{runId:$.runId,handle:$.handle,chunks:J,elapsedMs:Date.now()-Z,done:W,error:K?.code??null}),!W&&!K)throw new TY(`the sandbox stopped streaming after ${J} chunks without finishing the run`);if(K)throw Vo4(K.code,K.message)}function Vo4($,Z){if($===Eo4)return new _v$(Z);if($===lV$)return new TY(Z);return Error(`${$}: ${Z}`)}async function*ko4($,Z){let Q=new TextDecoder,X="",Y=function*(J){let K=X.split(`
|
|
2860
2860
|
`);X=J?K.pop()??"":"";for(let W of K){if(W.trim().length===0)continue;try{yield JSON.parse(W)}catch(H){throw Error(`sandbox dispatch produced a non-JSON line: ${H instanceof Error?H.message:String(H)} (line: ${W.slice(0,256)})`)}}},G=$[Symbol.asyncIterator]();try{for(;;){let J=new AbortController,K=G.next().then((F)=>{return J.abort(),F}),W=W$(Sv$,{signal:J.signal}).then(()=>"silent").catch(()=>"read-won"),H=await Promise.race([K,W]).catch((F)=>{if(Z?.aborted)throw F;let N=F instanceof Error?F.message:String(F);if(!n71(N))throw F;throw new TY(`the sandbox stream broke mid-run: ${N}`)});if(H==="silent"){if(Z?.aborted)return;throw new TY(`no output from the sandbox for ${Sv$/1000}s (its keepalive is every 15s, so the pod is gone)`)}if(H==="read-won")continue;if(H.done)break;if(X+=Q.decode(H.value,{stream:!0}),yield*Y(!0),X.length>Cv$)throw Error(`sandbox dispatch produced a line over ${Cv$} chars without a newline \u2014 refusing to buffer it further`)}X+=Q.decode(),yield*Y(!1)}finally{await G.return?.().catch(()=>{})}}function So4($){return $.connections.filter((Z)=>($.orgWide||$.ownIds.has(Z.id))&&Z.status==="active"&&!Co4($.organizationId,Z.id))}function Co4($,Z){return[y8.SELF,y8.REGISTRY,y8.COMMUNITY_REGISTRY,y8.DEV_ASSETS,y8.COMMERCE_DISCOVERY].some((Q)=>Q($)===Z)}var kv$="/repo",bv="claude-code",Do4=2,wo4=5,Sv$=90000,Cv$=67108864,TY,_v$,Eo4="superseded",Ao4=30000,Io4=300000;var TT0=L(()=>{J4();cV$();y71();JA0();Tv$();k91();rZ();g8();QY();ID();Mv$();LD();p5();xK();R$();qa();fv();kK();TY=class TY extends Error{reason;constructor($,Z){super(`${KA0} ${$}${Z?` \u2014 ${Z}`:""}`);this.name="SandboxUnreachableError",this.reason=$}};_v$=class _v$ extends Error{superseded=!0;constructor($){super($);this.name="RunSupersededError"}}});function o71($){if($.providerId==="openai-compatible")try{let Z=JSON.parse($.apiKey);return{kind:"secret",providerId:$.providerId,apiKey:Z.apiKey??"",modelId:$.modelId,...Z.baseUrl?{baseUrl:Z.baseUrl}:{}}}catch{return{kind:"secret",providerId:$.providerId,apiKey:$.apiKey,modelId:$.modelId}}return{kind:"secret",providerId:$.providerId,apiKey:$.apiKey,modelId:$.modelId}}var xv$=L(()=>{tW();Yg()});var fv$=L(()=>{xv$()});import{z as Js}from"zod/v4";import{z as V}from"zod/v4";import{z as F1}from"zod/v4";import{z as AZ}from"zod/v4";import{z as $3}from"zod/v4";import{z as y9}from"zod/v4";import{z as g9}from"zod/v4";import{z as V6}from"zod/v4";import{z as k6}from"zod/v4";import{z as cK}from"zod/v4";import{z as Q$}from"zod/v4";import{z as y1}from"zod/v4";import{z as yv}from"zod/v4";import{z as e71}from"zod/v4";import{z as $Q1}from"zod/v4";import{z as Ks}from"zod/v4";import{z as eJ}from"zod/v4";import{z as S7}from"zod/v4";import{z as c6}from"zod/v4";import{z as uH}from"zod/v4";import{z as cH}from"zod/v4";import{z as lH}from"zod/v4";import{z as gv}from"zod/v4";function yo4($){var Z;let Q=$==null?void 0:$.anthropic;return(Z=Q==null?void 0:Q.cacheControl)!=null?Z:Q==null?void 0:Q.cache_control}async function Fr4({tools:$,toolChoice:Z,disableParallelToolUse:Q,cacheControlValidator:X,supportsStructuredOutput:Y,supportsStrictTools:G,defaultEagerInputStreaming:J=!1}){var K,W;$=($==null?void 0:$.length)?$:void 0;let H=[],F=new Set,N=X||new ZQ1;if($==null)return{tools:void 0,toolChoice:void 0,toolWarnings:H,betas:F};let U=[];for(let O of $)switch(O.type){case"function":{let D=N.getCacheControl(O.providerOptions,{type:"tool definition",canCache:!0}),w=(K=O.providerOptions)==null?void 0:K.anthropic,E=(W=w==null?void 0:w.eagerInputStreaming)!=null?W:J,j=w==null?void 0:w.deferLoading,z=w==null?void 0:w.allowedCallers;if(!G&&O.strict!=null)H.push({type:"unsupported",feature:"strict",details:`Tool '${O.name}' has strict: ${O.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`});if(U.push({name:O.name,description:O.description,input_schema:O.inputSchema,cache_control:D,...E?{eager_input_streaming:!0}:{},...G===!0&&O.strict!=null?{strict:O.strict}:{},...j!=null?{defer_loading:j}:{},...z!=null?{allowed_callers:z}:{},...O.inputExamples!=null?{input_examples:O.inputExamples.map((A)=>A.input)}:{}}),Y===!0)F.add("structured-outputs-2025-11-13");if(O.inputExamples!=null||z!=null)F.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(O.id){case"anthropic.code_execution_20250522":{F.add("code-execution-2025-05-22"),U.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{F.add("code-execution-2025-08-25"),U.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{U.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{F.add("computer-use-2025-01-24"),U.push({name:"computer",type:"computer_20250124",display_width_px:O.args.displayWidthPx,display_height_px:O.args.displayHeightPx,display_number:O.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{F.add("computer-use-2025-11-24"),U.push({name:"computer",type:"computer_20251124",display_width_px:O.args.displayWidthPx,display_height_px:O.args.displayHeightPx,display_number:O.args.displayNumber,enable_zoom:O.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{F.add("computer-use-2024-10-22"),U.push({name:"computer",type:"computer_20241022",display_width_px:O.args.displayWidthPx,display_height_px:O.args.displayHeightPx,display_number:O.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{F.add("computer-use-2025-01-24"),U.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{F.add("computer-use-2024-10-22"),U.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{F.add("computer-use-2025-01-24"),U.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let D=await l$({value:O.args,schema:lo4});U.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:D.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{F.add("computer-use-2025-01-24"),U.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{F.add("computer-use-2024-10-22"),U.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{F.add("context-management-2025-06-27"),U.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{F.add("web-fetch-2025-09-10");let D=await l$({value:O.args,schema:Jr4});U.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:D.maxUses,allowed_domains:D.allowedDomains,blocked_domains:D.blockedDomains,citations:D.citations,max_content_tokens:D.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{F.add("code-execution-web-tools-2026-02-09");let D=await l$({value:O.args,schema:Zr4});U.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:D.maxUses,allowed_domains:D.allowedDomains,blocked_domains:D.blockedDomains,citations:D.citations,max_content_tokens:D.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let D=await l$({value:O.args,schema:ao4});U.push({type:"web_search_20250305",name:"web_search",max_uses:D.maxUses,allowed_domains:D.allowedDomains,blocked_domains:D.blockedDomains,user_location:D.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{F.add("code-execution-web-tools-2026-02-09");let D=await l$({value:O.args,schema:po4});U.push({type:"web_search_20260209",name:"web_search",max_uses:D.maxUses,allowed_domains:D.allowedDomains,blocked_domains:D.blockedDomains,user_location:D.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{U.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{U.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}case"anthropic.advisor_20260301":{F.add("advisor-tool-2026-03-01");let D=await l$({value:O.args,schema:go4});U.push({type:"advisor_20260301",name:"advisor",model:D.model,...D.maxUses!==void 0&&{max_uses:D.maxUses},...D.caching!==void 0&&{caching:D.caching}});break}default:{H.push({type:"unsupported",feature:`provider-defined tool ${O.id}`});break}}break}default:{H.push({type:"unsupported",feature:`tool ${O}`});break}}if(Z==null)return{tools:U,toolChoice:Q?{type:"auto",disable_parallel_tool_use:Q}:void 0,toolWarnings:H,betas:F};let B=Z.type;switch(B){case"auto":return{tools:U,toolChoice:{type:"auto",disable_parallel_tool_use:Q},toolWarnings:H,betas:F};case"required":return{tools:U,toolChoice:{type:"any",disable_parallel_tool_use:Q},toolWarnings:H,betas:F};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:H,betas:F};case"tool":return{tools:U,toolChoice:{type:"tool",name:Z.toolName,disable_parallel_tool_use:Q},toolWarnings:H,betas:F};default:throw new y4({functionality:`tool choice type: ${B}`})}}function uv$({usage:$,rawUsage:Z}){var Q,X,Y;let G=(Q=$.cache_creation_input_tokens)!=null?Q:0,J=(X=$.cache_read_input_tokens)!=null?X:0,K,W,H=(Y=$.iterations)==null?void 0:Y.some((F)=>F.type==="fallback_message");if($.iterations&&$.iterations.length>0&&!H){let F=$.iterations.filter((N)=>N.type==="compaction"||N.type==="message");if(F.length>0){let N=F.reduce((U,B)=>({input:U.input+B.input_tokens,output:U.output+B.output_tokens}),{input:0,output:0});K=N.input,W=N.output}else K=$.input_tokens,W=$.output_tokens}else K=$.input_tokens,W=$.output_tokens;return{inputTokens:{total:K+G+J,noCache:K,cacheRead:J,cacheWrite:G},outputTokens:{total:W,text:void 0,reasoning:void 0},raw:Z!=null?Z:$}}function Tr4($){if(typeof $==="string")return new TextDecoder().decode(_9($));if($ instanceof Uint8Array)return new TextDecoder().decode($);if($ instanceof URL)throw new y4({functionality:"URL-based text documents are not supported for citations"});throw new y4({functionality:`unsupported data type for text documents: ${typeof $}`})}function r71($){return $ instanceof URL||Rr4($)}function Rr4($){return typeof $==="string"&&/^https?:\/\//i.test($)}function a71($){return $ instanceof URL?$.toString():$}async function cv$($){if(typeof $==="string"){let Z=await sZ({text:$});if(Z.success&&typeof Z.value==="object"&&Z.value!==null)return Z.value;return{errorCode:"unavailable"}}if(typeof $==="object"&&$!==null)return $;return{}}async function Ir4({prompt:$,sendReasoning:Z,warnings:Q,cacheControlValidator:X,toolNameMapping:Y}){var G,J,K,W,H,F,N,U,B,O,D,w,E,j,z,A,P,I,q,M,S;let m=new Set,f=qr4($),b=X||new ZQ1,l=void 0,y=[];async function p(L0){var r,t;let D0=await Q4({provider:"anthropic",providerOptions:L0,schema:yv$});return(t=(r=D0==null?void 0:D0.citations)==null?void 0:r.enabled)!=null?t:!1}async function Y0(L0){let r=await Q4({provider:"anthropic",providerOptions:L0,schema:yv$});return{title:r==null?void 0:r.title,context:r==null?void 0:r.context}}for(let L0=0;L0<f.length;L0++){let r=f[L0],t=L0===f.length-1,D0=r.type;switch(D0){case"system":{let e=r.messages.map(({content:E0,providerOptions:u0})=>({type:"text",text:E0,cache_control:b.getCacheControl(u0,{type:"system message",canCache:!0})}));if(l==null)l=e;else y.push({role:"system",content:e}),m.add("mid-conversation-system-2026-04-07");break}case"user":{let e=[];for(let E0 of r.messages){let{role:u0,content:q0}=E0;switch(u0){case"user":{for(let m0=0;m0<q0.length;m0++){let J0=q0[m0],j0=m0===q0.length-1,P0=(G=b.getCacheControl(J0.providerOptions,{type:"user message part",canCache:!0}))!=null?G:j0?b.getCacheControl(E0.providerOptions,{type:"user message",canCache:!0}):void 0;switch(J0.type){case"text":{e.push({type:"text",text:J0.text,cache_control:P0});break}case"file":{if(J0.mediaType.startsWith("image/"))e.push({type:"image",source:r71(J0.data)?{type:"url",url:a71(J0.data)}:{type:"base64",media_type:J0.mediaType==="image/*"?"image/jpeg":J0.mediaType,data:EZ(J0.data)},cache_control:P0});else if(J0.mediaType==="application/pdf"){m.add("pdfs-2024-09-25");let M0=await p(J0.providerOptions),X0=await Y0(J0.providerOptions);e.push({type:"document",source:r71(J0.data)?{type:"url",url:a71(J0.data)}:{type:"base64",media_type:"application/pdf",data:EZ(J0.data)},title:(J=X0.title)!=null?J:J0.filename,...X0.context&&{context:X0.context},...M0&&{citations:{enabled:!0}},cache_control:P0})}else if(J0.mediaType==="text/plain"){let M0=await p(J0.providerOptions),X0=await Y0(J0.providerOptions);e.push({type:"document",source:r71(J0.data)?{type:"url",url:a71(J0.data)}:{type:"text",media_type:"text/plain",data:Tr4(J0.data)},title:(K=X0.title)!=null?K:J0.filename,...X0.context&&{context:X0.context},...M0&&{citations:{enabled:!0}},cache_control:P0})}else throw new y4({functionality:`media type: ${J0.mediaType}`});break}}}break}case"tool":{for(let m0=0;m0<q0.length;m0++){let J0=q0[m0];if(J0.type==="tool-approval-response")continue;let j0=J0.output,P0="providerOptions"in j0?j0.providerOptions:j0.type==="content"?(W=j0.value.find((V0)=>V0.providerOptions!=null))==null?void 0:W.providerOptions:void 0,M0=m0===q0.length-1,X0=(F=(H=b.getCacheControl(J0.providerOptions,{type:"tool result part",canCache:!0}))!=null?H:b.getCacheControl(P0,{type:"tool result output",canCache:!0}))!=null?F:M0?b.getCacheControl(E0.providerOptions,{type:"tool result message",canCache:!0}):void 0,G0;switch(j0.type){case"content":G0=j0.value.map((V0)=>{var N0;switch(V0.type){case"text":return{type:"text",text:V0.text};case"image-data":return{type:"image",source:{type:"base64",media_type:V0.mediaType,data:V0.data}};case"image-url":return{type:"image",source:{type:"url",url:V0.url}};case"file-url":return{type:"document",source:{type:"url",url:V0.url}};case"file-data":{if(V0.mediaType==="application/pdf")return m.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:V0.mediaType,data:V0.data}};Q.push({type:"other",message:`unsupported tool content part type: ${V0.type} with media type: ${V0.mediaType}`});return}case"custom":{let O0=(N0=V0.providerOptions)==null?void 0:N0.anthropic;if((O0==null?void 0:O0.type)==="tool-reference")return{type:"tool_reference",tool_name:O0.toolName};Q.push({type:"other",message:"unsupported custom tool content part"});return}default:{Q.push({type:"other",message:`unsupported tool content part type: ${V0.type}`});return}}}).filter(zz);break;case"text":case"error-text":G0=j0.value;break;case"execution-denied":G0=(N=j0.reason)!=null?N:"Tool execution denied.";break;case"json":case"error-json":default:G0=JSON.stringify(j0.value);break}e.push({type:"tool_result",tool_use_id:J0.toolCallId,content:G0,is_error:j0.type==="error-text"||j0.type==="error-json"?!0:void 0,cache_control:X0})}break}default:throw Error(`Unsupported role: ${u0}`)}}y.push({role:"user",content:e});break}case"assistant":{let e=[],E0=new Set;for(let u0=0;u0<r.messages.length;u0++){let q0=r.messages[u0],m0=u0===r.messages.length-1,{content:J0}=q0;for(let j0=0;j0<J0.length;j0++){let P0=J0[j0],M0=j0===J0.length-1,X0=(U=b.getCacheControl(P0.providerOptions,{type:"assistant message part",canCache:!0}))!=null?U:M0?b.getCacheControl(q0.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(P0.type){case"text":{let G0=(B=P0.providerOptions)==null?void 0:B.anthropic;if((G0==null?void 0:G0.type)==="compaction")e.push({type:"compaction",content:P0.text,cache_control:X0});else e.push({type:"text",text:t&&m0&&M0?P0.text.trim():P0.text,cache_control:X0});break}case"reasoning":{if(Z){let G0=await Q4({provider:"anthropic",providerOptions:P0.providerOptions,schema:bo4});if(G0!=null)if(G0.signature!=null)b.getCacheControl(P0.providerOptions,{type:"thinking block",canCache:!1}),e.push({type:"thinking",thinking:P0.text,signature:G0.signature});else if(G0.redactedData!=null)b.getCacheControl(P0.providerOptions,{type:"redacted thinking block",canCache:!1}),e.push({type:"redacted_thinking",data:G0.redactedData});else Q.push({type:"other",message:"unsupported reasoning metadata"});else Q.push({type:"other",message:"unsupported reasoning metadata"})}else Q.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(P0.providerExecuted){let N0=Y.toProviderToolName(P0.toolName);if(((D=(O=P0.providerOptions)==null?void 0:O.anthropic)==null?void 0:D.type)==="mcp-tool-use"){E0.add(P0.toolCallId);let P1=(E=(w=P0.providerOptions)==null?void 0:w.anthropic)==null?void 0:E.serverName;if(P1==null||typeof P1!=="string"){Q.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}e.push({type:"mcp_tool_use",id:P0.toolCallId,name:P0.toolName,input:P0.input,server_name:P1,cache_control:X0})}else if(N0==="code_execution"&&P0.input!=null&&typeof P0.input==="object"&&"type"in P0.input&&typeof P0.input.type==="string"&&(P0.input.type==="bash_code_execution"||P0.input.type==="text_editor_code_execution"))e.push({type:"server_tool_use",id:P0.toolCallId,name:P0.input.type,input:P0.input,cache_control:X0});else if(N0==="code_execution"&&P0.input!=null&&typeof P0.input==="object"&&"type"in P0.input&&P0.input.type==="programmatic-tool-call"){let{type:P1,...v0}=P0.input;e.push({type:"server_tool_use",id:P0.toolCallId,name:"code_execution",input:v0,cache_control:X0})}else if(N0==="code_execution"||N0==="web_fetch"||N0==="web_search")e.push({type:"server_tool_use",id:P0.toolCallId,name:N0,input:P0.input,cache_control:X0});else if(N0==="tool_search_tool_regex"||N0==="tool_search_tool_bm25")e.push({type:"server_tool_use",id:P0.toolCallId,name:N0,input:P0.input,cache_control:X0});else if(N0==="advisor")e.push({type:"server_tool_use",id:P0.toolCallId,name:"advisor",input:{},cache_control:X0});else Q.push({type:"other",message:`provider executed tool call for tool ${P0.toolName} is not supported`});break}let G0=(j=P0.providerOptions)==null?void 0:j.anthropic,V0=(G0==null?void 0:G0.caller)?(G0.caller.type==="code_execution_20250825"||G0.caller.type==="code_execution_20260120")&&G0.caller.toolId?{type:G0.caller.type,tool_id:G0.caller.toolId}:G0.caller.type==="direct"?{type:"direct"}:void 0:void 0;e.push({type:"tool_use",id:P0.toolCallId,name:P0.toolName,input:P0.input,...V0&&{caller:V0},cache_control:X0});break}case"tool-result":{let G0=Y.toProviderToolName(P0.toolName);if(E0.has(P0.toolCallId)){let V0=P0.output;if(V0.type!=="json"&&V0.type!=="error-json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}e.push({type:"mcp_tool_result",tool_use_id:P0.toolCallId,is_error:V0.type==="error-json",content:V0.value,cache_control:X0})}else if(G0==="code_execution"){let V0=P0.output;if(V0.type==="error-text"||V0.type==="error-json"){let N0={};try{if(typeof V0.value==="string")N0=JSON.parse(V0.value);else if(typeof V0.value==="object"&&V0.value!==null)N0=V0.value}catch(O0){}if(N0.type==="code_execution_tool_result_error")e.push({type:"code_execution_tool_result",tool_use_id:P0.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(z=N0.errorCode)!=null?z:"unknown"},cache_control:X0});else e.push({type:"bash_code_execution_tool_result",tool_use_id:P0.toolCallId,cache_control:X0,content:{type:"bash_code_execution_tool_result_error",error_code:(A=N0.errorCode)!=null?A:"unknown"}});break}if(V0.type!=="json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}if(V0.value==null||typeof V0.value!=="object"||!("type"in V0.value)||typeof V0.value.type!=="string"){Q.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${P0.toolName}`});break}if(V0.value.type==="code_execution_result"){let N0=await l$({value:V0.value,schema:rv$});e.push({type:"code_execution_tool_result",tool_use_id:P0.toolCallId,content:{type:N0.type,stdout:N0.stdout,stderr:N0.stderr,return_code:N0.return_code,content:(P=N0.content)!=null?P:[]},cache_control:X0})}else if(V0.value.type==="encrypted_code_execution_result"){let N0=await l$({value:V0.value,schema:sv$});if(N0.type==="encrypted_code_execution_result")e.push({type:"code_execution_tool_result",tool_use_id:P0.toolCallId,content:{type:N0.type,encrypted_stdout:N0.encrypted_stdout,stderr:N0.stderr,return_code:N0.return_code,content:(I=N0.content)!=null?I:[]},cache_control:X0})}else{let N0=await l$({value:V0.value,schema:av$});if(N0.type==="code_execution_result")e.push({type:"code_execution_tool_result",tool_use_id:P0.toolCallId,content:{type:N0.type,stdout:N0.stdout,stderr:N0.stderr,return_code:N0.return_code,content:(q=N0.content)!=null?q:[]},cache_control:X0});else if(N0.type==="bash_code_execution_result"||N0.type==="bash_code_execution_tool_result_error")e.push({type:"bash_code_execution_tool_result",tool_use_id:P0.toolCallId,cache_control:X0,content:N0});else e.push({type:"text_editor_code_execution_tool_result",tool_use_id:P0.toolCallId,cache_control:X0,content:N0})}break}if(G0==="web_fetch"){let V0=P0.output;if(V0.type==="error-json"){e.push({type:"web_fetch_tool_result",tool_use_id:P0.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(M=(await cv$(V0.value)).errorCode)!=null?M:"unavailable"},cache_control:X0});break}if(V0.type!=="json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}let N0=await l$({value:V0.value,schema:ov$});e.push({type:"web_fetch_tool_result",tool_use_id:P0.toolCallId,content:{type:"web_fetch_result",url:N0.url,retrieved_at:N0.retrievedAt,content:{type:"document",title:N0.content.title,citations:N0.content.citations,source:{type:N0.content.source.type,media_type:N0.content.source.mediaType,data:N0.content.source.data}}},cache_control:X0});break}if(G0==="web_search"){let V0=P0.output;if(V0.type==="error-json"){e.push({type:"web_search_tool_result",tool_use_id:P0.toolCallId,content:{type:"web_search_tool_result_error",error_code:(S=(await cv$(V0.value)).errorCode)!=null?S:"unavailable"},cache_control:X0});break}if(V0.type!=="json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}let N0=await l$({value:V0.value,schema:tv$});e.push({type:"web_search_tool_result",tool_use_id:P0.toolCallId,content:N0.map((O0)=>({url:O0.url,title:O0.title,page_age:O0.pageAge,encrypted_content:O0.encryptedContent,type:O0.type})),cache_control:X0});break}if(G0==="tool_search_tool_regex"||G0==="tool_search_tool_bm25"){let V0=P0.output;if(V0.type!=="json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}let O0=(await l$({value:V0.value,schema:ev$})).map((P1)=>({type:"tool_reference",tool_name:P1.toolName}));e.push({type:"tool_search_tool_result",tool_use_id:P0.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:O0},cache_control:X0});break}if(G0==="advisor"){let V0=P0.output;if(V0.type!=="json"&&V0.type!=="error-json"){Q.push({type:"other",message:`provider executed tool result output type ${V0.type} for tool ${P0.toolName} is not supported`});break}let N0=await l$({value:V0.value,schema:nv$});if(N0.type==="advisor_result")e.push({type:"advisor_tool_result",tool_use_id:P0.toolCallId,content:{type:"advisor_result",text:N0.text},cache_control:X0});else if(N0.type==="advisor_redacted_result")e.push({type:"advisor_tool_result",tool_use_id:P0.toolCallId,content:{type:"advisor_redacted_result",encrypted_content:N0.encryptedContent},cache_control:X0});else e.push({type:"advisor_tool_result",tool_use_id:P0.toolCallId,content:{type:"advisor_tool_result_error",error_code:N0.errorCode},cache_control:X0});break}Q.push({type:"other",message:`provider executed tool result for tool ${P0.toolName} is not supported`});break}}}}y.push({role:"assistant",content:e});break}default:throw Error(`content type: ${D0}`)}}return{prompt:{system:l,messages:y},betas:m}}function qr4($){let Z=[],Q=void 0;for(let X of $){let{role:Y}=X;switch(Y){case"system":{if((Q==null?void 0:Q.type)!=="system")Q={type:"system",messages:[]},Z.push(Q);Q.messages.push(X);break}case"assistant":{if((Q==null?void 0:Q.type)!=="assistant")Q={type:"assistant",messages:[]},Z.push(Q);Q.messages.push(X);break}case"user":{if((Q==null?void 0:Q.type)!=="user")Q={type:"user",messages:[]},Z.push(Q);Q.messages.push(X);break}case"tool":{if((Q==null?void 0:Q.type)!=="user")Q={type:"user",messages:[]},Z.push(Q);Q.messages.push(X);break}default:throw Error(`Unsupported role: ${Y}`)}}return Z}function s71({finishReason:$,isJsonResponseFromTool:Z}){switch($){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return Z?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function Vr4($){return Zx$($)}function kD($){if(typeof $==="boolean"||!_r4($))return $;return Zx$($)}function Zx$($){let Z={},Q=$;if($.$ref!=null)return{$ref:$.$ref};if($.$schema!=null)Z.$schema=$.$schema;if($.$id!=null)Z.$id=$.$id;if($.title!=null)Z.title=$.title;if($.description!=null)Z.description=$.description;if($.default!==void 0)Z.default=$.default;if($.const!==void 0)Z.const=$.const;if($.enum!=null)Z.enum=$.enum;if($.type!=null)Z.type=$.type;if($.anyOf!=null)Z.anyOf=$.anyOf.map(kD);else if($.oneOf!=null)Z.anyOf=$.oneOf.map(kD);if($.allOf!=null)Z.allOf=$.allOf.map(kD);if($.definitions!=null)Z.definitions=Object.fromEntries(Object.entries($.definitions).map(([Y,G])=>[Y,kD(G)]));if(Q.$defs!=null){let Y=Z;Y.$defs=Object.fromEntries(Object.entries(Q.$defs).map(([G,J])=>[G,kD(J)]))}if($.type==="object"||$.properties!=null){if($.properties!=null)Z.properties=Object.fromEntries(Object.entries($.properties).map(([Y,G])=>[Y,kD(G)]));if(Z.additionalProperties=!1,$.required!=null)Z.required=$.required}if($.items!=null)Z.items=Array.isArray($.items)?$.items.map(kD):kD($.items);if(typeof $.format==="string"&&$x$.has($.format))Z.format=$.format;let X=kr4($);if(X!=null)Z.description=Z.description==null?X:`${Z.description}
|
|
2861
2861
|
${X}`;return Z}function kr4($){let Z=Mr4.flatMap((Q)=>{let X=$[Q];if(X==null||X===!1)return[];return`${Sr4(Q)}: ${Cr4(X)}`});if(typeof $.format==="string"&&!$x$.has($.format))Z.push(`format: ${$.format}`);return Z.length===0?void 0:`${Z.join("; ")}.`}function Sr4($){return $.replace(/[A-Z]/g,(Z)=>` ${Z.toLowerCase()}`)}function Cr4($){if(typeof $==="string")return $;return JSON.stringify($)}function _r4($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function lv$($,Z,Q){var X;if($.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Q(),url:$.url,title:$.title,providerMetadata:{anthropic:{citedText:$.cited_text,encryptedIndex:$.encrypted_index}}};if($.type!=="page_location"&&$.type!=="char_location")return;let Y=Z[$.document_index];if(!Y)return;return{type:"source",sourceType:"document",id:Q(),mediaType:Y.mediaType,title:(X=$.document_title)!=null?X:Y.title,filename:Y.filename,providerMetadata:{anthropic:$.type==="page_location"?{citedText:$.cited_text,startPageNumber:$.start_page_number,endPageNumber:$.end_page_number}:{citedText:$.cited_text,startCharIndex:$.start_char_index,endCharIndex:$.end_char_index}}}}function xr4($){if($.includes("claude-opus-4-8")||$.includes("claude-opus-4-7")||$.includes("claude-fable-5"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!0,isKnownModel:!0};else if($.includes("claude-sonnet-4-6")||$.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if($.includes("claude-sonnet-4-5")||$.includes("claude-opus-4-5")||$.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if($.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,rejectsSamplingParameters:!1,isKnownModel:!0};else if($.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if($.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else if($.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,rejectsSamplingParameters:!1,isKnownModel:!1}}function mv$($){if(!$)return!1;let Z=!1,Q=!1;for(let X of $){if("type"in X&&(X.type==="web_fetch_20260209"||X.type==="web_search_20260209")){Z=!0;continue}if(X.name==="code_execution"){Q=!0;break}}return Z&&!Q}function dv$($){return $?{appliedEdits:$.applied_edits.map((Z)=>{switch(Z.type){case"clear_tool_uses_20250919":return{type:Z.type,clearedToolUses:Z.cleared_tool_uses,clearedInputTokens:Z.cleared_input_tokens};case"clear_thinking_20251015":return{type:Z.type,clearedThinkingTurns:Z.cleared_thinking_turns,clearedInputTokens:Z.cleared_input_tokens};case"compact_20260112":return{type:Z.type}}}).filter((Z)=>Z!==void 0)}:null}function iv$($){if($==null)return;return{type:$.type,...$.category!=null?{category:$.category}:{},...$.explanation!=null?{explanation:$.explanation}:{},...$.recommended_model!=null?{recommendedModel:$.recommended_model}:{}}}function Ws($={}){var Z,Q;let X=(Z=mL(zH({settingValue:$.baseURL,environmentVariableName:"ANTHROPIC_BASE_URL"})))!=null?Z:"https://api.anthropic.com/v1",Y=(Q=$.name)!=null?Q:"anthropic.messages";if($.apiKey&&$.authToken)throw new uL({argument:"apiKey/authToken",message:"Both apiKey and authToken were provided. Please use only one authentication method."});let G=()=>{let W=$.authToken?{Authorization:`Bearer ${$.authToken}`}:{"x-api-key":eh({apiKey:$.apiKey,environmentVariableName:"ANTHROPIC_API_KEY",description:"Anthropic"})};return e4({"anthropic-version":"2023-06-01",...W,...$.headers},`ai-sdk/anthropic/${_o4}`)},J=(W)=>{var H;return new vr4(W,{provider:Y,baseURL:X,headers:G,fetch:$.fetch,generateId:(H=$.generateId)!=null?H:d8,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})})},K=function(W){if(new.target)throw Error("The Anthropic model function cannot be called with the new keyword.");return J(W)};return K.specificationVersion="v3",K.languageModel=J,K.chat=J,K.messages=J,K.embeddingModel=(W)=>{throw new s5({modelId:W,modelType:"embeddingModel"})},K.textEmbeddingModel=K.embeddingModel,K.imageModel=(W)=>{throw new s5({modelId:W,modelType:"imageModel"})},K.tools=Xa4,K}var _o4="3.0.85",vo4,bv$,pv$,xo4,fo4,bo4,yv$,gv$,hv$=4,ZQ1=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl($,Z){let Q=yo4($);if(!Q)return;if(!Z.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${Z.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>hv$){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${hv$} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Q}getWarnings(){return this.warnings}},go4,nv$,ho4,uo4,co4=($)=>{return uo4($)},lo4,mo4,do4,io4=($={})=>{return do4($)},po4,no4,to4,oo4,ro4=($={})=>{return oo4($)},ao4,tv$,so4,eo4,$r4=($={})=>{return eo4($)},Zr4,Qr4,Xr4,Yr4,Gr4=($={})=>{return Yr4($)},Jr4,ov$,Kr4,Wr4,Hr4=($={})=>{return Wr4($)},rv$,Nr4,Ur4,Br4=($={})=>{return Ur4($)},av$,Or4,Lr4,Dr4=($={})=>{return Lr4($)},sv$,wr4,Er4,jr4=($={})=>{return Er4($)},ev$,zr4,Pr4,Ar4=($={})=>{return Pr4($)},$x$,Mr4,vr4=class{constructor($,Z){this.specificationVersion="v3";var Q;this.modelId=$,this.config=Z,this.generateId=(Q=Z.generateId)!=null?Q:d8}supportsUrl($){return $.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let $=this.config.provider,Z=$.indexOf(".");return Z===-1?$:$.substring(0,Z)}get supportedUrls(){var $,Z,Q;return(Q=(Z=($=this.config).supportedUrls)==null?void 0:Z.call($))!=null?Q:{}}async getArgs({userSuppliedBetas:$,prompt:Z,maxOutputTokens:Q,temperature:X,topP:Y,topK:G,frequencyPenalty:J,presencePenalty:K,stopSequences:W,responseFormat:H,seed:F,tools:N,toolChoice:U,providerOptions:B,stream:O}){var D,w,E,j,z,A,P,I,q,M;let S=[];if(J!=null)S.push({type:"unsupported",feature:"frequencyPenalty"});if(K!=null)S.push({type:"unsupported",feature:"presencePenalty"});if(F!=null)S.push({type:"unsupported",feature:"seed"});if(X!=null&&X>1)S.push({type:"unsupported",feature:"temperature",details:`${X} exceeds anthropic maximum of 1.0. clamped to 1.0`}),X=1;else if(X!=null&&X<0)S.push({type:"unsupported",feature:"temperature",details:`${X} is below anthropic minimum of 0. clamped to 0`}),X=0;if((H==null?void 0:H.type)==="json"){if(H.schema==null)S.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let m=this.providerOptionsName,f=await Q4({provider:"anthropic",providerOptions:B,schema:gv$}),b=m!=="anthropic"?await Q4({provider:m,providerOptions:B,schema:gv$}):null,l=b!=null,y=Object.assign({},f!=null?f:{},b!=null?b:{}),{maxOutputTokens:p,supportsStructuredOutput:Y0,rejectsSamplingParameters:L0,isKnownModel:r}=xr4(this.modelId);if(L0){if(X!=null)S.push({type:"unsupported",feature:"temperature",details:`temperature is not supported by ${this.modelId} and will be ignored`}),X=void 0;if(G!=null)S.push({type:"unsupported",feature:"topK",details:`topK is not supported by ${this.modelId} and will be ignored`}),G=void 0;if(Y!=null)S.push({type:"unsupported",feature:"topP",details:`topP is not supported by ${this.modelId} and will be ignored`}),Y=void 0}let t=r||this.modelId.startsWith("claude-"),D0=((D=this.config.supportsNativeStructuredOutput)!=null?D:!0)&&Y0,e=((w=this.config.supportsStrictTools)!=null?w:!0)&&Y0,E0=(E=y==null?void 0:y.structuredOutputMode)!=null?E:"auto",u0=E0==="outputFormat"||E0==="auto"&&D0,q0=(H==null?void 0:H.type)==="json"&&H.schema!=null&&!u0?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:H.schema}:void 0,m0=y==null?void 0:y.contextManagement,J0=new ZQ1,j0=q30({tools:N,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25","anthropic.advisor_20260301":"advisor"}}),{prompt:P0,betas:M0}=await Ir4({prompt:Z,sendReasoning:(j=y==null?void 0:y.sendReasoning)!=null?j:!0,warnings:S,cacheControlValidator:J0,toolNameMapping:j0}),X0=(z=y==null?void 0:y.thinking)==null?void 0:z.type,G0=X0==="enabled"||X0==="adaptive",V0=X0==="enabled"?(A=y==null?void 0:y.thinking)==null?void 0:A.budgetTokens:void 0,N0=X0==="adaptive"?(P=y==null?void 0:y.thinking)==null?void 0:P.display:void 0,O0=Q!=null?Q:p,P1={model:this.modelId,max_tokens:O0,temperature:X,top_k:G,top_p:Y,stop_sequences:W,...G0&&{thinking:{type:X0,...V0!=null&&{budget_tokens:V0},...N0!=null&&{display:N0}}},...((y==null?void 0:y.effort)||(y==null?void 0:y.taskBudget)||u0&&(H==null?void 0:H.type)==="json"&&H.schema!=null)&&{output_config:{...(y==null?void 0:y.effort)&&{effort:y.effort},...(y==null?void 0:y.taskBudget)&&{task_budget:{type:y.taskBudget.type,total:y.taskBudget.total,...y.taskBudget.remaining!=null&&{remaining:y.taskBudget.remaining}}},...u0&&(H==null?void 0:H.type)==="json"&&H.schema!=null&&{format:{type:"json_schema",schema:Vr4(H.schema)}}}},...(y==null?void 0:y.speed)&&{speed:y.speed},...(y==null?void 0:y.inferenceGeo)&&{inference_geo:y.inferenceGeo},...(y==null?void 0:y.fallbacks)&&y.fallbacks.length>0&&{fallbacks:y.fallbacks},...(y==null?void 0:y.cacheControl)&&{cache_control:y.cacheControl},...((I=y==null?void 0:y.metadata)==null?void 0:I.userId)!=null&&{metadata:{user_id:y.metadata.userId}},...(y==null?void 0:y.mcpServers)&&y.mcpServers.length>0&&{mcp_servers:y.mcpServers.map((_0)=>({type:_0.type,name:_0.name,url:_0.url,authorization_token:_0.authorizationToken,tool_configuration:_0.toolConfiguration?{allowed_tools:_0.toolConfiguration.allowedTools,enabled:_0.toolConfiguration.enabled}:void 0}))},...(y==null?void 0:y.container)&&{container:y.container.skills&&y.container.skills.length>0?{id:y.container.id,skills:y.container.skills.map((_0)=>({type:_0.type,skill_id:_0.skillId,version:_0.version}))}:y.container.id},system:P0.system,messages:P0.messages,...m0&&{context_management:{edits:m0.edits.map((_0)=>{let c1=_0.type;switch(c1){case"clear_tool_uses_20250919":return{type:_0.type,..._0.trigger!==void 0&&{trigger:_0.trigger},..._0.keep!==void 0&&{keep:_0.keep},..._0.clearAtLeast!==void 0&&{clear_at_least:_0.clearAtLeast},..._0.clearToolInputs!==void 0&&{clear_tool_inputs:_0.clearToolInputs},..._0.excludeTools!==void 0&&{exclude_tools:_0.excludeTools}};case"clear_thinking_20251015":return{type:_0.type,..._0.keep!==void 0&&{keep:_0.keep}};case"compact_20260112":return{type:_0.type,..._0.trigger!==void 0&&{trigger:_0.trigger},..._0.pauseAfterCompaction!==void 0&&{pause_after_compaction:_0.pauseAfterCompaction},..._0.instructions!==void 0&&{instructions:_0.instructions}};default:S.push({type:"other",message:`Unknown context management strategy: ${c1}`});return}}).filter((_0)=>_0!==void 0)}}};if(G0){if(X0==="enabled"&&V0==null)S.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),P1.thinking={type:"enabled",budget_tokens:1024},V0=1024;if(P1.temperature!=null)P1.temperature=void 0,S.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(G!=null)P1.top_k=void 0,S.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(Y!=null)P1.top_p=void 0,S.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});P1.max_tokens=O0+(V0!=null?V0:0)}else if(t&&Y!=null&&X!=null)S.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),P1.top_p=void 0;if(r&&P1.max_tokens>p){if(Q!=null)S.push({type:"unsupported",feature:"maxOutputTokens",details:`${P1.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${p} max output tokens. The max output tokens have been limited to ${p}.`});P1.max_tokens=p}if((y==null?void 0:y.mcpServers)&&y.mcpServers.length>0)M0.add("mcp-client-2025-04-04");if(m0){if(M0.add("context-management-2025-06-27"),m0.edits.some((_0)=>_0.type==="compact_20260112"))M0.add("compact-2026-01-12")}if((y==null?void 0:y.container)&&y.container.skills&&y.container.skills.length>0){if(M0.add("code-execution-2025-08-25"),M0.add("skills-2025-10-02"),M0.add("files-api-2025-04-14"),!(N==null?void 0:N.some((_0)=>_0.type==="provider"&&(_0.id==="anthropic.code_execution_20250825"||_0.id==="anthropic.code_execution_20260120"))))S.push({type:"other",message:"code execution tool is required when using skills"})}if(y==null?void 0:y.taskBudget)M0.add("task-budgets-2026-03-13");if((y==null?void 0:y.speed)==="fast")M0.add("fast-mode-2026-02-01");if((y==null?void 0:y.fallbacks)&&y.fallbacks.length>0)M0.add("server-side-fallback-2026-06-01");let v0=O&&((q=y==null?void 0:y.toolStreaming)!=null?q:!0),{tools:n0,toolChoice:o,toolWarnings:f0,betas:Q1}=await Fr4(q0!=null?{tools:[...N!=null?N:[],q0],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:J0,supportsStructuredOutput:!1,supportsStrictTools:e,defaultEagerInputStreaming:v0}:{tools:N!=null?N:[],toolChoice:U,disableParallelToolUse:y==null?void 0:y.disableParallelToolUse,cacheControlValidator:J0,supportsStructuredOutput:D0,supportsStrictTools:e,defaultEagerInputStreaming:v0}),k1=J0.getWarnings();return{args:{...P1,tools:n0,tool_choice:o,stream:O===!0?!0:void 0},warnings:[...S,...f0,...k1],betas:new Set([...M0,...Q1,...$,...(M=y==null?void 0:y.anthropicBeta)!=null?M:[]]),usesJsonResponseTool:q0!=null,toolNameMapping:j0,providerOptionsName:m,usedCustomProviderKey:l}}async getHeaders({betas:$,headers:Z}){return $8(await g$(this.config.headers),Z,$.size>0?{"anthropic-beta":Array.from($).join(",")}:{})}async getBetasFromHeaders($){var Z,Q;let Y=(Z=(await g$(this.config.headers))["anthropic-beta"])!=null?Z:"",G=(Q=$==null?void 0:$["anthropic-beta"])!=null?Q:"";return new Set([...Y.toLowerCase().split(","),...G.toLowerCase().split(",")].map((J)=>J.trim()).filter((J)=>J!==""))}buildRequestUrl($){var Z,Q,X;return(X=(Q=(Z=this.config).buildRequestUrl)==null?void 0:Q.call(Z,this.config.baseURL,$))!=null?X:`${this.config.baseURL}/messages`}transformRequestBody($,Z){var Q,X,Y;return(Y=(X=(Q=this.config).transformRequestBody)==null?void 0:X.call(Q,$,Z))!=null?Y:$}extractCitationDocuments($){let Z=(Q)=>{var X,Y;if(Q.type!=="file")return!1;if(Q.mediaType!=="application/pdf"&&Q.mediaType!=="text/plain")return!1;let G=(X=Q.providerOptions)==null?void 0:X.anthropic,J=G==null?void 0:G.citations;return(Y=J==null?void 0:J.enabled)!=null?Y:!1};return $.filter((Q)=>Q.role==="user").flatMap((Q)=>Q.content).filter(Z).map((Q)=>{var X;let Y=Q;return{title:(X=Y.filename)!=null?X:"Untitled Document",filename:Y.filename,mediaType:Y.mediaType}})}async doGenerate($){var Z,Q,X,Y,G,J,K;let{args:W,warnings:H,betas:F,usesJsonResponseTool:N,toolNameMapping:U,providerOptionsName:B,usedCustomProviderKey:O}=await this.getArgs({...$,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders($.headers)}),D=[...this.extractCitationDocuments($.prompt)],w=mv$(W.tools),{responseHeaders:E,value:j,rawValue:z}=await z8({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:F,headers:$.headers}),body:this.transformRequestBody(W,F),failedResponseHandler:bv$,successfulResponseHandler:G8(xo4),abortSignal:$.abortSignal,fetch:this.config.fetch}),A=[],P={},I={},q=!1;for(let M of j.content)switch(M.type){case"text":{if(!N){if(A.push({type:"text",text:M.text}),M.citations)for(let S of M.citations){let m=lv$(S,D,this.generateId);if(m)A.push(m)}}break}case"thinking":{A.push({type:"reasoning",text:M.thinking,providerMetadata:{anthropic:{signature:M.signature}}});break}case"redacted_thinking":{A.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:M.data}}});break}case"compaction":{A.push({type:"text",text:M.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(N&&M.name==="json")q=!0,A.push({type:"text",text:JSON.stringify(M.input)});else{let m=M.caller,f=m?{type:m.type,toolId:"tool_id"in m?m.tool_id:void 0}:void 0;A.push({type:"tool-call",toolCallId:M.id,toolName:M.name,input:JSON.stringify(M.input),...f&&{providerMetadata:{anthropic:{caller:f}}}})}break}case"server_tool_use":{if(M.name==="text_editor_code_execution"||M.name==="bash_code_execution")A.push({type:"tool-call",toolCallId:M.id,toolName:U.toCustomToolName("code_execution"),input:JSON.stringify({type:M.name,...M.input}),providerExecuted:!0,...w?{dynamic:!0}:{}});else if(M.name==="web_search"||M.name==="code_execution"||M.name==="web_fetch"){let S=M.name==="code_execution"&&M.input!=null&&typeof M.input==="object"&&"code"in M.input&&!("type"in M.input)?{type:"programmatic-tool-call",...M.input}:M.input;A.push({type:"tool-call",toolCallId:M.id,toolName:U.toCustomToolName(M.name),input:JSON.stringify(S),providerExecuted:!0,...w&&M.name==="code_execution"?{dynamic:!0}:{}})}else if(M.name==="tool_search_tool_regex"||M.name==="tool_search_tool_bm25")I[M.id]=M.name,A.push({type:"tool-call",toolCallId:M.id,toolName:U.toCustomToolName(M.name),input:JSON.stringify(M.input),providerExecuted:!0});else if(M.name==="advisor")A.push({type:"tool-call",toolCallId:M.id,toolName:U.toCustomToolName("advisor"),input:JSON.stringify(M.input),providerExecuted:!0});break}case"mcp_tool_use":{P[M.id]={type:"tool-call",toolCallId:M.id,toolName:M.name,input:JSON.stringify(M.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:M.server_name}}},A.push(P[M.id]);break}case"mcp_tool_result":{A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:P[M.tool_use_id].toolName,isError:M.is_error,result:M.content,dynamic:!0,providerMetadata:P[M.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(M.content.type==="web_fetch_result")D.push({title:(Z=M.content.content.title)!=null?Z:M.content.url,mediaType:M.content.content.source.media_type}),A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:M.content.url,retrievedAt:M.content.retrieved_at,content:{type:M.content.content.type,title:M.content.content.title,citations:M.content.content.citations,source:{type:M.content.content.source.type,mediaType:M.content.content.source.media_type,data:M.content.content.source.data}}}});else if(M.content.type==="web_fetch_tool_result_error")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:M.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(M.content)){A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("web_search"),result:M.content.map((S)=>{var m;return{url:S.url,title:S.title,pageAge:(m=S.page_age)!=null?m:null,encryptedContent:S.encrypted_content,type:S.type}})});for(let S of M.content)A.push({type:"source",sourceType:"url",id:this.generateId(),url:S.url,title:S.title,providerMetadata:{anthropic:{pageAge:(Q=S.page_age)!=null?Q:null}}})}else A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:M.content.error_code}});break}case"code_execution_tool_result":{if(M.content.type==="code_execution_result")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("code_execution"),result:{type:M.content.type,stdout:M.content.stdout,stderr:M.content.stderr,return_code:M.content.return_code,content:(X=M.content.content)!=null?X:[]}});else if(M.content.type==="encrypted_code_execution_result")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("code_execution"),result:{type:M.content.type,encrypted_stdout:M.content.encrypted_stdout,stderr:M.content.stderr,return_code:M.content.return_code,content:(Y=M.content.content)!=null?Y:[]}});else if(M.content.type==="code_execution_tool_result_error")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:M.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName("code_execution"),result:M.content});break}case"tool_search_tool_result":{let S=I[M.tool_use_id];if(S==null){let m=U.toCustomToolName("tool_search_tool_bm25"),f=U.toCustomToolName("tool_search_tool_regex");if(m!=="tool_search_tool_bm25")S="tool_search_tool_bm25";else if(f!=="tool_search_tool_regex")S="tool_search_tool_regex";else S="tool_search_tool_regex"}if(M.content.type==="tool_search_tool_search_result")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName(S),result:M.content.tool_references.map((m)=>({type:m.type,toolName:m.tool_name}))});else A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:U.toCustomToolName(S),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:M.content.error_code}});break}case"advisor_tool_result":{let S=U.toCustomToolName("advisor");if(M.content.type==="advisor_result")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:S,result:{type:"advisor_result",text:M.content.text}});else if(M.content.type==="advisor_redacted_result")A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:S,result:{type:"advisor_redacted_result",encryptedContent:M.content.encrypted_content}});else A.push({type:"tool-result",toolCallId:M.tool_use_id,toolName:S,isError:!0,result:{type:"advisor_tool_result_error",errorCode:M.content.error_code}});break}case"fallback":break}return{content:A,finishReason:{unified:s71({finishReason:j.stop_reason,isJsonResponseFromTool:q}),raw:(G=j.stop_reason)!=null?G:void 0},usage:uv$({usage:j.usage}),request:{body:W},response:{id:(J=j.id)!=null?J:void 0,modelId:(K=j.model)!=null?K:void 0,headers:E,body:z},warnings:H,providerMetadata:(()=>{var M,S,m,f,b;let l=iv$(j.stop_details),y={usage:j.usage,cacheCreationInputTokens:(M=j.usage.cache_creation_input_tokens)!=null?M:null,stopSequence:(S=j.stop_sequence)!=null?S:null,...l!=null?{stopDetails:l}:{},iterations:j.usage.iterations?j.usage.iterations.map((Y0)=>({type:Y0.type,...Y0.model!=null?{model:Y0.model}:{},inputTokens:Y0.input_tokens,outputTokens:Y0.output_tokens,...Y0.cache_creation_input_tokens?{cacheCreationInputTokens:Y0.cache_creation_input_tokens}:{},...Y0.cache_read_input_tokens?{cacheReadInputTokens:Y0.cache_read_input_tokens}:{}})):null,container:j.container?{expiresAt:j.container.expires_at,id:j.container.id,skills:(f=(m=j.container.skills)==null?void 0:m.map((Y0)=>({type:Y0.type,skillId:Y0.skill_id,version:Y0.version})))!=null?f:null}:null,contextManagement:(b=dv$(j.context_management))!=null?b:null},p={anthropic:y};if(O&&B!=="anthropic")p[B]=y;return p})()}}async doStream($){var Z,Q;let{args:X,warnings:Y,betas:G,usesJsonResponseTool:J,toolNameMapping:K,providerOptionsName:W,usedCustomProviderKey:H}=await this.getArgs({...$,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders($.headers)}),F=[...this.extractCitationDocuments($.prompt)],N=mv$(X.tools),U=this.buildRequestUrl(!0),{responseHeaders:B,value:O}=await z8({url:U,headers:await this.getHeaders({betas:G,headers:$.headers}),body:this.transformRequestBody(X,G),failedResponseHandler:bv$,successfulResponseHandler:wQ(fo4),abortSignal:$.abortSignal,fetch:this.config.fetch}),D={unified:"other",raw:void 0},w={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},E={},j={},z={},A=null,P=void 0,I=null,q=null,M=void 0,S=null,m=!1,f=void 0,b=this.generateId,l=O.pipeThrough(new TransformStream({start(L0){L0.enqueue({type:"stream-start",warnings:Y})},transform(L0,r){var t,D0,e,E0,u0,q0,m0,J0,j0,P0,M0,X0,G0,V0;if($.includeRawChunks)r.enqueue({type:"raw",rawValue:L0.rawValue});if(!L0.success){r.enqueue({type:"error",error:L0.error});return}let N0=L0.value;switch(N0.type){case"ping":return;case"content_block_start":{let O0=N0.content_block,P1=O0.type;if(P1==="fallback")return;switch(f=P1,P1){case"text":{if(J)return;E[N0.index]={type:"text"},r.enqueue({type:"text-start",id:String(N0.index)});return}case"thinking":{E[N0.index]={type:"reasoning"},r.enqueue({type:"reasoning-start",id:String(N0.index)});return}case"redacted_thinking":{E[N0.index]={type:"reasoning"},r.enqueue({type:"reasoning-start",id:String(N0.index),providerMetadata:{anthropic:{redactedData:O0.data}}});return}case"compaction":{E[N0.index]={type:"text"},r.enqueue({type:"text-start",id:String(N0.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(J&&O0.name==="json")m=!0,E[N0.index]={type:"text"},r.enqueue({type:"text-start",id:String(N0.index)});else{let n0=O0.caller,o=n0?{type:n0.type,toolId:"tool_id"in n0?n0.tool_id:void 0}:void 0,Q1=O0.input&&Object.keys(O0.input).length>0?JSON.stringify(O0.input):"";E[N0.index]={type:"tool-call",toolCallId:O0.id,toolName:O0.name,input:Q1,firstDelta:Q1.length===0,...o&&{caller:o}},r.enqueue({type:"tool-input-start",id:O0.id,toolName:O0.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(O0.name)){let v0=O0.name==="text_editor_code_execution"||O0.name==="bash_code_execution"?"code_execution":O0.name,n0=K.toCustomToolName(v0),o=O0.input!=null&&typeof O0.input==="object"&&Object.keys(O0.input).length>0?JSON.stringify(O0.input):"";E[N0.index]={type:"tool-call",toolCallId:O0.id,toolName:n0,input:o,providerExecuted:!0,...N&&v0==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:v0},r.enqueue({type:"tool-input-start",id:O0.id,toolName:n0,providerExecuted:!0,...N&&v0==="code_execution"?{dynamic:!0}:{}})}else if(O0.name==="tool_search_tool_regex"||O0.name==="tool_search_tool_bm25"){z[O0.id]=O0.name;let v0=K.toCustomToolName(O0.name);E[N0.index]={type:"tool-call",toolCallId:O0.id,toolName:v0,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:O0.name},r.enqueue({type:"tool-input-start",id:O0.id,toolName:v0,providerExecuted:!0})}else if(O0.name==="advisor"){let v0=K.toCustomToolName("advisor");E[N0.index]={type:"tool-call",toolCallId:O0.id,toolName:v0,input:"{}",providerExecuted:!0,firstDelta:!0,providerToolName:O0.name},r.enqueue({type:"tool-input-start",id:O0.id,toolName:v0,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(O0.content.type==="web_fetch_result")F.push({title:(t=O0.content.content.title)!=null?t:O0.content.url,mediaType:O0.content.content.source.media_type}),r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:O0.content.url,retrievedAt:O0.content.retrieved_at,content:{type:O0.content.content.type,title:O0.content.content.title,citations:O0.content.content.citations,source:{type:O0.content.content.source.type,mediaType:O0.content.content.source.media_type,data:O0.content.content.source.data}}}});else if(O0.content.type==="web_fetch_tool_result_error")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:O0.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(O0.content)){r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("web_search"),result:O0.content.map((v0)=>{var n0;return{url:v0.url,title:v0.title,pageAge:(n0=v0.page_age)!=null?n0:null,encryptedContent:v0.encrypted_content,type:v0.type}})});for(let v0 of O0.content)r.enqueue({type:"source",sourceType:"url",id:b(),url:v0.url,title:v0.title,providerMetadata:{anthropic:{pageAge:(D0=v0.page_age)!=null?D0:null}}})}else r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:O0.content.error_code}});return}case"code_execution_tool_result":{if(O0.content.type==="code_execution_result")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("code_execution"),result:{type:O0.content.type,stdout:O0.content.stdout,stderr:O0.content.stderr,return_code:O0.content.return_code,content:(e=O0.content.content)!=null?e:[]}});else if(O0.content.type==="encrypted_code_execution_result")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("code_execution"),result:{type:O0.content.type,encrypted_stdout:O0.content.encrypted_stdout,stderr:O0.content.stderr,return_code:O0.content.return_code,content:(E0=O0.content.content)!=null?E0:[]}});else if(O0.content.type==="code_execution_tool_result_error")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:O0.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName("code_execution"),result:O0.content});return}case"tool_search_tool_result":{let v0=z[O0.tool_use_id];if(v0==null){let n0=K.toCustomToolName("tool_search_tool_bm25"),o=K.toCustomToolName("tool_search_tool_regex");if(n0!=="tool_search_tool_bm25")v0="tool_search_tool_bm25";else if(o!=="tool_search_tool_regex")v0="tool_search_tool_regex";else v0="tool_search_tool_regex"}if(O0.content.type==="tool_search_tool_search_result")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName(v0),result:O0.content.tool_references.map((n0)=>({type:n0.type,toolName:n0.tool_name}))});else r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:K.toCustomToolName(v0),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:O0.content.error_code}});return}case"advisor_tool_result":{let v0=K.toCustomToolName("advisor");if(O0.content.type==="advisor_result")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:v0,result:{type:"advisor_result",text:O0.content.text}});else if(O0.content.type==="advisor_redacted_result")r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:v0,result:{type:"advisor_redacted_result",encryptedContent:O0.content.encrypted_content}});else r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:v0,isError:!0,result:{type:"advisor_tool_result_error",errorCode:O0.content.error_code}});return}case"mcp_tool_use":{j[O0.id]={type:"tool-call",toolCallId:O0.id,toolName:O0.name,input:JSON.stringify(O0.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:O0.server_name}}},r.enqueue(j[O0.id]);return}case"mcp_tool_result":{r.enqueue({type:"tool-result",toolCallId:O0.tool_use_id,toolName:j[O0.tool_use_id].toolName,isError:O0.is_error,result:O0.content,dynamic:!0,providerMetadata:j[O0.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${P1}`)}}case"content_block_stop":{if(E[N0.index]!=null){let O0=E[N0.index];switch(O0.type){case"text":{r.enqueue({type:"text-end",id:String(N0.index)});break}case"reasoning":{r.enqueue({type:"reasoning-end",id:String(N0.index)});break}case"tool-call":if(!(J&&O0.toolName==="json")){r.enqueue({type:"tool-input-end",id:O0.toolCallId});let v0=O0.input===""?"{}":O0.input;if(O0.providerToolName==="code_execution")try{let n0=JSON.parse(v0);if(n0!=null&&typeof n0==="object"&&"code"in n0&&!("type"in n0))v0=JSON.stringify({type:"programmatic-tool-call",...n0})}catch(n0){}r.enqueue({type:"tool-call",toolCallId:O0.toolCallId,toolName:O0.toolName,input:v0,providerExecuted:O0.providerExecuted,...N&&O0.providerToolName==="code_execution"?{dynamic:!0}:{},...O0.caller&&{providerMetadata:{anthropic:{caller:O0.caller}}}})}break}delete E[N0.index]}f=void 0;return}case"content_block_delta":{let O0=N0.delta.type;switch(O0){case"text_delta":{if(J)return;r.enqueue({type:"text-delta",id:String(N0.index),delta:N0.delta.text});return}case"thinking_delta":{r.enqueue({type:"reasoning-delta",id:String(N0.index),delta:N0.delta.thinking});return}case"signature_delta":{if(f==="thinking")r.enqueue({type:"reasoning-delta",id:String(N0.index),delta:"",providerMetadata:{anthropic:{signature:N0.delta.signature}}});return}case"compaction_delta":{if(N0.delta.content!=null)r.enqueue({type:"text-delta",id:String(N0.index),delta:N0.delta.content});return}case"input_json_delta":{let P1=E[N0.index],v0=N0.delta.partial_json;if(v0.length===0)return;if(m){if((P1==null?void 0:P1.type)!=="text")return;r.enqueue({type:"text-delta",id:String(N0.index),delta:v0})}else{if((P1==null?void 0:P1.type)!=="tool-call")return;if(P1.firstDelta&&P1.providerToolName==="code_execution")v0=`{"type": "programmatic-tool-call",${v0.substring(1)}`;r.enqueue({type:"tool-input-delta",id:P1.toolCallId,delta:v0}),P1.input+=v0,P1.firstDelta=!1}return}case"citations_delta":{let P1=N0.delta.citation,v0=lv$(P1,F,b);if(v0)r.enqueue(v0);return}default:throw Error(`Unsupported delta type: ${O0}`)}}case"message_start":{if(w.input_tokens=N0.message.usage.input_tokens,w.cache_read_input_tokens=(u0=N0.message.usage.cache_read_input_tokens)!=null?u0:0,w.cache_creation_input_tokens=(q0=N0.message.usage.cache_creation_input_tokens)!=null?q0:0,P={...N0.message.usage},I=(m0=N0.message.usage.cache_creation_input_tokens)!=null?m0:null,N0.message.container!=null)S={expiresAt:N0.message.container.expires_at,id:N0.message.container.id,skills:null};if(N0.message.stop_reason!=null)D={unified:s71({finishReason:N0.message.stop_reason,isJsonResponseFromTool:m}),raw:N0.message.stop_reason};if(r.enqueue({type:"response-metadata",id:(J0=N0.message.id)!=null?J0:void 0,modelId:(j0=N0.message.model)!=null?j0:void 0}),N0.message.content!=null)for(let O0=0;O0<N0.message.content.length;O0++){let P1=N0.message.content[O0];if(P1.type==="tool_use"){let v0=P1.caller,n0=v0?{type:v0.type,toolId:"tool_id"in v0?v0.tool_id:void 0}:void 0;r.enqueue({type:"tool-input-start",id:P1.id,toolName:P1.name});let o=JSON.stringify((P0=P1.input)!=null?P0:{});r.enqueue({type:"tool-input-delta",id:P1.id,delta:o}),r.enqueue({type:"tool-input-end",id:P1.id}),r.enqueue({type:"tool-call",toolCallId:P1.id,toolName:P1.name,input:o,...n0&&{providerMetadata:{anthropic:{caller:n0}}}})}}return}case"message_delta":{if(N0.usage.input_tokens!=null&&w.input_tokens!==N0.usage.input_tokens)w.input_tokens=N0.usage.input_tokens;if(w.output_tokens=N0.usage.output_tokens,N0.usage.cache_read_input_tokens!=null)w.cache_read_input_tokens=N0.usage.cache_read_input_tokens;if(N0.usage.cache_creation_input_tokens!=null)w.cache_creation_input_tokens=N0.usage.cache_creation_input_tokens,I=N0.usage.cache_creation_input_tokens;if(N0.usage.iterations!=null)w.iterations=N0.usage.iterations;if(D={unified:s71({finishReason:N0.delta.stop_reason,isJsonResponseFromTool:m}),raw:(M0=N0.delta.stop_reason)!=null?M0:void 0},q=(X0=N0.delta.stop_sequence)!=null?X0:null,M=iv$(N0.delta.stop_details),S=N0.delta.container!=null?{expiresAt:N0.delta.container.expires_at,id:N0.delta.container.id,skills:(V0=(G0=N0.delta.container.skills)==null?void 0:G0.map((O0)=>({type:O0.type,skillId:O0.skill_id,version:O0.version})))!=null?V0:null}:null,N0.context_management)A=dv$(N0.context_management);P={...P,...N0.usage};return}case"message_stop":{let O0={usage:P!=null?P:null,cacheCreationInputTokens:I,stopSequence:q,...M!=null?{stopDetails:M}:{},iterations:w.iterations?w.iterations.map((v0)=>({type:v0.type,...v0.model!=null?{model:v0.model}:{},inputTokens:v0.input_tokens,outputTokens:v0.output_tokens,...v0.cache_creation_input_tokens?{cacheCreationInputTokens:v0.cache_creation_input_tokens}:{},...v0.cache_read_input_tokens?{cacheReadInputTokens:v0.cache_read_input_tokens}:{}})):null,container:S,contextManagement:A},P1={anthropic:O0};if(H&&W!=="anthropic")P1[W]=O0;r.enqueue({type:"finish",finishReason:D,usage:uv$({usage:w,rawUsage:P}),providerMetadata:P1});return}case"error":{r.enqueue({type:"error",error:N0.error});return}default:throw Error(`Unsupported chunk type: ${N0}`)}}})),[y,p]=l.tee(),Y0=y.getReader();try{await Y0.read();let L0=await Y0.read();if(((Z=L0.value)==null?void 0:Z.type)==="raw")L0=await Y0.read();if(((Q=L0.value)==null?void 0:Q.type)==="error"){let r=L0.value.error;throw new H4({message:r.message,url:U,requestBodyValues:X,statusCode:r.type==="overloaded_error"?529:500,responseHeaders:B,responseBody:JSON.stringify(r),isRetryable:r.type==="overloaded_error"})}}finally{Y0.cancel().catch(()=>{}),Y0.releaseLock()}return{stream:p,request:{body:X},response:{headers:B}}}},fr4,br4,yr4,gr4,hr4,ur4,cr4,lr4,mr4,dr4,ir4,pr4,nr4,tr4,or4,rr4,ar4,sr4,er4,$a4,Za4,Qa4=($={})=>{return Za4($)},Xa4,cHZ;var QQ1=L(()=>{$$();h0();$$();h0();h0();h0();$$();h0();h0();h0();h0();h0();h0();h0();$$();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();h0();vo4=w0(()=>Z0(Js.object({type:Js.literal("error"),error:Js.object({type:Js.string(),message:Js.string()})}))),bv$=h5({errorSchema:vo4,errorToMessage:($)=>$.error.message}),pv$=V.object({type:V.string(),category:V.string().nullish(),explanation:V.string().nullish(),recommended_model:V.string().nullish()}),xo4=w0(()=>Z0(V.object({type:V.literal("message"),id:V.string().nullish(),model:V.string().nullish(),content:V.array(V.discriminatedUnion("type",[V.object({type:V.literal("text"),text:V.string(),citations:V.array(V.discriminatedUnion("type",[V.object({type:V.literal("web_search_result_location"),cited_text:V.string(),url:V.string(),title:V.string(),encrypted_index:V.string()}),V.object({type:V.literal("page_location"),cited_text:V.string(),document_index:V.number(),document_title:V.string().nullable(),start_page_number:V.number(),end_page_number:V.number()}),V.object({type:V.literal("char_location"),cited_text:V.string(),document_index:V.number(),document_title:V.string().nullable(),start_char_index:V.number(),end_char_index:V.number()})])).optional()}),V.object({type:V.literal("thinking"),thinking:V.string(),signature:V.string()}),V.object({type:V.literal("redacted_thinking"),data:V.string()}),V.object({type:V.literal("compaction"),content:V.string()}),V.object({type:V.literal("tool_use"),id:V.string(),name:V.string(),input:V.unknown(),caller:V.union([V.object({type:V.literal("code_execution_20250825"),tool_id:V.string()}),V.object({type:V.literal("code_execution_20260120"),tool_id:V.string()}),V.object({type:V.literal("direct")})]).optional()}),V.object({type:V.literal("server_tool_use"),id:V.string(),name:V.string(),input:V.record(V.string(),V.unknown()).nullish(),caller:V.union([V.object({type:V.literal("code_execution_20260120"),tool_id:V.string()}),V.object({type:V.literal("direct")})]).optional()}),V.object({type:V.literal("mcp_tool_use"),id:V.string(),name:V.string(),input:V.unknown(),server_name:V.string()}),V.object({type:V.literal("mcp_tool_result"),tool_use_id:V.string(),is_error:V.boolean(),content:V.array(V.union([V.string(),V.object({type:V.literal("text"),text:V.string()})]))}),V.object({type:V.literal("web_fetch_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("web_fetch_result"),url:V.string(),retrieved_at:V.string(),content:V.object({type:V.literal("document"),title:V.string().nullable(),citations:V.object({enabled:V.boolean()}).optional(),source:V.union([V.object({type:V.literal("base64"),media_type:V.literal("application/pdf"),data:V.string()}),V.object({type:V.literal("text"),media_type:V.literal("text/plain"),data:V.string()})])})}),V.object({type:V.literal("web_fetch_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("web_search_tool_result"),tool_use_id:V.string(),content:V.union([V.array(V.object({type:V.literal("web_search_result"),url:V.string(),title:V.string(),encrypted_content:V.string(),page_age:V.string().nullish()})),V.object({type:V.literal("web_search_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("code_execution_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("code_execution_result"),stdout:V.string(),stderr:V.string(),return_code:V.number(),content:V.array(V.object({type:V.literal("code_execution_output"),file_id:V.string()})).optional().default([])}),V.object({type:V.literal("encrypted_code_execution_result"),encrypted_stdout:V.string(),stderr:V.string(),return_code:V.number(),content:V.array(V.object({type:V.literal("code_execution_output"),file_id:V.string()})).optional().default([])}),V.object({type:V.literal("code_execution_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("bash_code_execution_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("bash_code_execution_result"),content:V.array(V.object({type:V.literal("bash_code_execution_output"),file_id:V.string()})),stdout:V.string(),stderr:V.string(),return_code:V.number()}),V.object({type:V.literal("bash_code_execution_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("text_editor_code_execution_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("text_editor_code_execution_tool_result_error"),error_code:V.string()}),V.object({type:V.literal("text_editor_code_execution_view_result"),content:V.string(),file_type:V.string(),num_lines:V.number().nullable(),start_line:V.number().nullable(),total_lines:V.number().nullable()}),V.object({type:V.literal("text_editor_code_execution_create_result"),is_file_update:V.boolean()}),V.object({type:V.literal("text_editor_code_execution_str_replace_result"),lines:V.array(V.string()).nullable(),new_lines:V.number().nullable(),new_start:V.number().nullable(),old_lines:V.number().nullable(),old_start:V.number().nullable()})])}),V.object({type:V.literal("tool_search_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("tool_search_tool_search_result"),tool_references:V.array(V.object({type:V.literal("tool_reference"),tool_name:V.string()}))}),V.object({type:V.literal("tool_search_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("advisor_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("advisor_result"),text:V.string()}),V.object({type:V.literal("advisor_redacted_result"),encrypted_content:V.string()}),V.object({type:V.literal("advisor_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("fallback")})])),stop_reason:V.string().nullish(),stop_sequence:V.string().nullish(),stop_details:pv$.nullish(),usage:V.looseObject({input_tokens:V.number(),output_tokens:V.number(),cache_creation_input_tokens:V.number().nullish(),cache_read_input_tokens:V.number().nullish(),iterations:V.array(V.object({type:V.union([V.literal("compaction"),V.literal("message"),V.literal("advisor_message"),V.literal("fallback_message")]),model:V.string().nullish(),input_tokens:V.number(),output_tokens:V.number(),cache_creation_input_tokens:V.number().nullish(),cache_read_input_tokens:V.number().nullish()})).nullish()}),container:V.object({expires_at:V.string(),id:V.string(),skills:V.array(V.object({type:V.union([V.literal("anthropic"),V.literal("custom")]),skill_id:V.string(),version:V.string()})).nullish()}).nullish(),context_management:V.object({applied_edits:V.array(V.union([V.object({type:V.literal("clear_tool_uses_20250919"),cleared_tool_uses:V.number(),cleared_input_tokens:V.number()}),V.object({type:V.literal("clear_thinking_20251015"),cleared_thinking_turns:V.number(),cleared_input_tokens:V.number()}),V.object({type:V.literal("compact_20260112")})]))}).nullish()}))),fo4=w0(()=>Z0(V.discriminatedUnion("type",[V.object({type:V.literal("message_start"),message:V.object({id:V.string().nullish(),model:V.string().nullish(),role:V.string().nullish(),usage:V.looseObject({input_tokens:V.number(),cache_creation_input_tokens:V.number().nullish(),cache_read_input_tokens:V.number().nullish()}),content:V.array(V.discriminatedUnion("type",[V.object({type:V.literal("tool_use"),id:V.string(),name:V.string(),input:V.unknown(),caller:V.union([V.object({type:V.literal("code_execution_20250825"),tool_id:V.string()}),V.object({type:V.literal("code_execution_20260120"),tool_id:V.string()}),V.object({type:V.literal("direct")})]).optional()})])).nullish(),stop_reason:V.string().nullish(),container:V.object({expires_at:V.string(),id:V.string()}).nullish()})}),V.object({type:V.literal("content_block_start"),index:V.number(),content_block:V.discriminatedUnion("type",[V.object({type:V.literal("text"),text:V.string()}),V.object({type:V.literal("thinking"),thinking:V.string()}),V.object({type:V.literal("tool_use"),id:V.string(),name:V.string(),input:V.record(V.string(),V.unknown()).optional(),caller:V.union([V.object({type:V.literal("code_execution_20250825"),tool_id:V.string()}),V.object({type:V.literal("code_execution_20260120"),tool_id:V.string()}),V.object({type:V.literal("direct")})]).optional()}),V.object({type:V.literal("redacted_thinking"),data:V.string()}),V.object({type:V.literal("compaction"),content:V.string().nullish()}),V.object({type:V.literal("server_tool_use"),id:V.string(),name:V.string(),input:V.record(V.string(),V.unknown()).nullish(),caller:V.union([V.object({type:V.literal("code_execution_20260120"),tool_id:V.string()}),V.object({type:V.literal("direct")})]).optional()}),V.object({type:V.literal("mcp_tool_use"),id:V.string(),name:V.string(),input:V.unknown(),server_name:V.string()}),V.object({type:V.literal("mcp_tool_result"),tool_use_id:V.string(),is_error:V.boolean(),content:V.array(V.union([V.string(),V.object({type:V.literal("text"),text:V.string()})]))}),V.object({type:V.literal("web_fetch_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("web_fetch_result"),url:V.string(),retrieved_at:V.string(),content:V.object({type:V.literal("document"),title:V.string().nullable(),citations:V.object({enabled:V.boolean()}).optional(),source:V.union([V.object({type:V.literal("base64"),media_type:V.literal("application/pdf"),data:V.string()}),V.object({type:V.literal("text"),media_type:V.literal("text/plain"),data:V.string()})])})}),V.object({type:V.literal("web_fetch_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("web_search_tool_result"),tool_use_id:V.string(),content:V.union([V.array(V.object({type:V.literal("web_search_result"),url:V.string(),title:V.string(),encrypted_content:V.string(),page_age:V.string().nullish()})),V.object({type:V.literal("web_search_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("code_execution_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("code_execution_result"),stdout:V.string(),stderr:V.string(),return_code:V.number(),content:V.array(V.object({type:V.literal("code_execution_output"),file_id:V.string()})).optional().default([])}),V.object({type:V.literal("encrypted_code_execution_result"),encrypted_stdout:V.string(),stderr:V.string(),return_code:V.number(),content:V.array(V.object({type:V.literal("code_execution_output"),file_id:V.string()})).optional().default([])}),V.object({type:V.literal("code_execution_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("bash_code_execution_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("bash_code_execution_result"),content:V.array(V.object({type:V.literal("bash_code_execution_output"),file_id:V.string()})),stdout:V.string(),stderr:V.string(),return_code:V.number()}),V.object({type:V.literal("bash_code_execution_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("text_editor_code_execution_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("text_editor_code_execution_tool_result_error"),error_code:V.string()}),V.object({type:V.literal("text_editor_code_execution_view_result"),content:V.string(),file_type:V.string(),num_lines:V.number().nullable(),start_line:V.number().nullable(),total_lines:V.number().nullable()}),V.object({type:V.literal("text_editor_code_execution_create_result"),is_file_update:V.boolean()}),V.object({type:V.literal("text_editor_code_execution_str_replace_result"),lines:V.array(V.string()).nullable(),new_lines:V.number().nullable(),new_start:V.number().nullable(),old_lines:V.number().nullable(),old_start:V.number().nullable()})])}),V.object({type:V.literal("tool_search_tool_result"),tool_use_id:V.string(),content:V.union([V.object({type:V.literal("tool_search_tool_search_result"),tool_references:V.array(V.object({type:V.literal("tool_reference"),tool_name:V.string()}))}),V.object({type:V.literal("tool_search_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("advisor_tool_result"),tool_use_id:V.string(),content:V.discriminatedUnion("type",[V.object({type:V.literal("advisor_result"),text:V.string()}),V.object({type:V.literal("advisor_redacted_result"),encrypted_content:V.string()}),V.object({type:V.literal("advisor_tool_result_error"),error_code:V.string()})])}),V.object({type:V.literal("fallback")})])}),V.object({type:V.literal("content_block_delta"),index:V.number(),delta:V.discriminatedUnion("type",[V.object({type:V.literal("input_json_delta"),partial_json:V.string()}),V.object({type:V.literal("text_delta"),text:V.string()}),V.object({type:V.literal("thinking_delta"),thinking:V.string()}),V.object({type:V.literal("signature_delta"),signature:V.string()}),V.object({type:V.literal("compaction_delta"),content:V.string().nullish()}),V.object({type:V.literal("citations_delta"),citation:V.discriminatedUnion("type",[V.object({type:V.literal("web_search_result_location"),cited_text:V.string(),url:V.string(),title:V.string(),encrypted_index:V.string()}),V.object({type:V.literal("page_location"),cited_text:V.string(),document_index:V.number(),document_title:V.string().nullable(),start_page_number:V.number(),end_page_number:V.number()}),V.object({type:V.literal("char_location"),cited_text:V.string(),document_index:V.number(),document_title:V.string().nullable(),start_char_index:V.number(),end_char_index:V.number()})])})])}),V.object({type:V.literal("content_block_stop"),index:V.number()}),V.object({type:V.literal("error"),error:V.object({type:V.string(),message:V.string()})}),V.object({type:V.literal("message_delta"),delta:V.object({stop_reason:V.string().nullish(),stop_sequence:V.string().nullish(),stop_details:pv$.nullish(),container:V.object({expires_at:V.string(),id:V.string(),skills:V.array(V.object({type:V.union([V.literal("anthropic"),V.literal("custom")]),skill_id:V.string(),version:V.string()})).nullish()}).nullish()}),usage:V.looseObject({input_tokens:V.number().nullish(),output_tokens:V.number(),cache_creation_input_tokens:V.number().nullish(),cache_read_input_tokens:V.number().nullish(),iterations:V.array(V.object({type:V.union([V.literal("compaction"),V.literal("message"),V.literal("advisor_message"),V.literal("fallback_message")]),model:V.string().nullish(),input_tokens:V.number(),output_tokens:V.number(),cache_creation_input_tokens:V.number().nullish(),cache_read_input_tokens:V.number().nullish()})).nullish()}),context_management:V.object({applied_edits:V.array(V.union([V.object({type:V.literal("clear_tool_uses_20250919"),cleared_tool_uses:V.number(),cleared_input_tokens:V.number()}),V.object({type:V.literal("clear_thinking_20251015"),cleared_thinking_turns:V.number(),cleared_input_tokens:V.number()}),V.object({type:V.literal("compact_20260112")})]))}).nullish()}),V.object({type:V.literal("message_stop")}),V.object({type:V.literal("ping")})]))),bo4=w0(()=>Z0(V.object({signature:V.string().optional(),redactedData:V.string().optional()}))),yv$=F1.object({citations:F1.object({enabled:F1.boolean()}).optional(),title:F1.string().optional(),context:F1.string().optional()}),gv$=F1.object({sendReasoning:F1.boolean().optional(),structuredOutputMode:F1.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:F1.discriminatedUnion("type",[F1.object({type:F1.literal("adaptive"),display:F1.enum(["omitted","summarized"]).optional()}),F1.object({type:F1.literal("enabled"),budgetTokens:F1.number().optional()}),F1.object({type:F1.literal("disabled")})]).optional(),disableParallelToolUse:F1.boolean().optional(),cacheControl:F1.object({type:F1.literal("ephemeral"),ttl:F1.union([F1.literal("5m"),F1.literal("1h")]).optional()}).optional(),metadata:F1.object({userId:F1.string().optional()}).optional(),mcpServers:F1.array(F1.object({type:F1.literal("url"),name:F1.string(),url:F1.string(),authorizationToken:F1.string().nullish(),toolConfiguration:F1.object({enabled:F1.boolean().nullish(),allowedTools:F1.array(F1.string()).nullish()}).nullish()})).optional(),container:F1.object({id:F1.string().optional(),skills:F1.array(F1.object({type:F1.union([F1.literal("anthropic"),F1.literal("custom")]),skillId:F1.string(),version:F1.string().optional()})).optional()}).optional(),toolStreaming:F1.boolean().optional(),effort:F1.enum(["low","medium","high","xhigh","max"]).optional(),taskBudget:F1.object({type:F1.literal("tokens"),total:F1.number().int().min(20000),remaining:F1.number().int().min(0).optional()}).optional(),speed:F1.enum(["fast","standard"]).optional(),inferenceGeo:F1.enum(["us","global"]).optional(),fallbacks:F1.array(F1.object({model:F1.string(),max_tokens:F1.number().int().optional(),thinking:F1.record(F1.string(),F1.unknown()).optional(),output_config:F1.record(F1.string(),F1.unknown()).optional(),speed:F1.enum(["fast","standard"]).optional()})).optional(),anthropicBeta:F1.array(F1.string()).optional(),contextManagement:F1.object({edits:F1.array(F1.discriminatedUnion("type",[F1.object({type:F1.literal("clear_tool_uses_20250919"),trigger:F1.discriminatedUnion("type",[F1.object({type:F1.literal("input_tokens"),value:F1.number()}),F1.object({type:F1.literal("tool_uses"),value:F1.number()})]).optional(),keep:F1.object({type:F1.literal("tool_uses"),value:F1.number()}).optional(),clearAtLeast:F1.object({type:F1.literal("input_tokens"),value:F1.number()}).optional(),clearToolInputs:F1.boolean().optional(),excludeTools:F1.array(F1.string()).optional()}),F1.object({type:F1.literal("clear_thinking_20251015"),keep:F1.union([F1.literal("all"),F1.object({type:F1.literal("thinking_turns"),value:F1.number()})]).optional()}),F1.object({type:F1.literal("compact_20260112"),trigger:F1.object({type:F1.literal("input_tokens"),value:F1.number()}).optional(),pauseAfterCompaction:F1.boolean().optional(),instructions:F1.string().optional()})]))}).optional()});go4=w0(()=>Z0(AZ.object({model:AZ.string(),maxUses:AZ.number().optional(),caching:AZ.object({type:AZ.literal("ephemeral"),ttl:AZ.union([AZ.literal("5m"),AZ.literal("1h")])}).optional()}))),nv$=w0(()=>Z0(AZ.discriminatedUnion("type",[AZ.object({type:AZ.literal("advisor_result"),text:AZ.string()}),AZ.object({type:AZ.literal("advisor_redacted_result"),encryptedContent:AZ.string()}),AZ.object({type:AZ.literal("advisor_tool_result_error"),errorCode:AZ.string()})]))),ho4=w0(()=>Z0(AZ.object({}).strict())),uo4=Z8({id:"anthropic.advisor_20260301",inputSchema:ho4,outputSchema:nv$,supportsDeferredResults:!0}),lo4=w0(()=>Z0($3.object({maxCharacters:$3.number().optional()}))),mo4=w0(()=>Z0($3.object({command:$3.enum(["view","create","str_replace","insert"]),path:$3.string(),file_text:$3.string().optional(),insert_line:$3.number().int().optional(),new_str:$3.string().optional(),insert_text:$3.string().optional(),old_str:$3.string().optional(),view_range:$3.array($3.number().int()).optional()}))),do4=g4({id:"anthropic.text_editor_20250728",inputSchema:mo4}),po4=w0(()=>Z0(y9.object({maxUses:y9.number().optional(),allowedDomains:y9.array(y9.string()).optional(),blockedDomains:y9.array(y9.string()).optional(),userLocation:y9.object({type:y9.literal("approximate"),city:y9.string().optional(),region:y9.string().optional(),country:y9.string().optional(),timezone:y9.string().optional()}).optional()}))),no4=w0(()=>Z0(y9.array(y9.object({url:y9.string(),title:y9.string().nullable(),pageAge:y9.string().nullable(),encryptedContent:y9.string(),type:y9.literal("web_search_result")})))),to4=w0(()=>Z0(y9.object({query:y9.string()}))),oo4=Z8({id:"anthropic.web_search_20260209",inputSchema:to4,outputSchema:no4,supportsDeferredResults:!0}),ao4=w0(()=>Z0(g9.object({maxUses:g9.number().optional(),allowedDomains:g9.array(g9.string()).optional(),blockedDomains:g9.array(g9.string()).optional(),userLocation:g9.object({type:g9.literal("approximate"),city:g9.string().optional(),region:g9.string().optional(),country:g9.string().optional(),timezone:g9.string().optional()}).optional()}))),tv$=w0(()=>Z0(g9.array(g9.object({url:g9.string(),title:g9.string().nullable(),pageAge:g9.string().nullable(),encryptedContent:g9.string(),type:g9.literal("web_search_result")})))),so4=w0(()=>Z0(g9.object({query:g9.string()}))),eo4=Z8({id:"anthropic.web_search_20250305",inputSchema:so4,outputSchema:tv$,supportsDeferredResults:!0}),Zr4=w0(()=>Z0(V6.object({maxUses:V6.number().optional(),allowedDomains:V6.array(V6.string()).optional(),blockedDomains:V6.array(V6.string()).optional(),citations:V6.object({enabled:V6.boolean()}).optional(),maxContentTokens:V6.number().optional()}))),Qr4=w0(()=>Z0(V6.object({type:V6.literal("web_fetch_result"),url:V6.string(),content:V6.object({type:V6.literal("document"),title:V6.string().nullable(),citations:V6.object({enabled:V6.boolean()}).optional(),source:V6.union([V6.object({type:V6.literal("base64"),mediaType:V6.literal("application/pdf"),data:V6.string()}),V6.object({type:V6.literal("text"),mediaType:V6.literal("text/plain"),data:V6.string()})])}),retrievedAt:V6.string().nullable()}))),Xr4=w0(()=>Z0(V6.object({url:V6.string()}))),Yr4=Z8({id:"anthropic.web_fetch_20260209",inputSchema:Xr4,outputSchema:Qr4,supportsDeferredResults:!0}),Jr4=w0(()=>Z0(k6.object({maxUses:k6.number().optional(),allowedDomains:k6.array(k6.string()).optional(),blockedDomains:k6.array(k6.string()).optional(),citations:k6.object({enabled:k6.boolean()}).optional(),maxContentTokens:k6.number().optional()}))),ov$=w0(()=>Z0(k6.object({type:k6.literal("web_fetch_result"),url:k6.string(),content:k6.object({type:k6.literal("document"),title:k6.string().nullable(),citations:k6.object({enabled:k6.boolean()}).optional(),source:k6.union([k6.object({type:k6.literal("base64"),mediaType:k6.literal("application/pdf"),data:k6.string()}),k6.object({type:k6.literal("text"),mediaType:k6.literal("text/plain"),data:k6.string()})])}),retrievedAt:k6.string().nullable()}))),Kr4=w0(()=>Z0(k6.object({url:k6.string()}))),Wr4=Z8({id:"anthropic.web_fetch_20250910",inputSchema:Kr4,outputSchema:ov$,supportsDeferredResults:!0});rv$=w0(()=>Z0(cK.object({type:cK.literal("code_execution_result"),stdout:cK.string(),stderr:cK.string(),return_code:cK.number(),content:cK.array(cK.object({type:cK.literal("code_execution_output"),file_id:cK.string()})).optional().default([])}))),Nr4=w0(()=>Z0(cK.object({code:cK.string()}))),Ur4=Z8({id:"anthropic.code_execution_20250522",inputSchema:Nr4,outputSchema:rv$}),av$=w0(()=>Z0(Q$.discriminatedUnion("type",[Q$.object({type:Q$.literal("code_execution_result"),stdout:Q$.string(),stderr:Q$.string(),return_code:Q$.number(),content:Q$.array(Q$.object({type:Q$.literal("code_execution_output"),file_id:Q$.string()})).optional().default([])}),Q$.object({type:Q$.literal("bash_code_execution_result"),content:Q$.array(Q$.object({type:Q$.literal("bash_code_execution_output"),file_id:Q$.string()})),stdout:Q$.string(),stderr:Q$.string(),return_code:Q$.number()}),Q$.object({type:Q$.literal("bash_code_execution_tool_result_error"),error_code:Q$.string()}),Q$.object({type:Q$.literal("text_editor_code_execution_tool_result_error"),error_code:Q$.string()}),Q$.object({type:Q$.literal("text_editor_code_execution_view_result"),content:Q$.string(),file_type:Q$.string(),num_lines:Q$.number().nullable(),start_line:Q$.number().nullable(),total_lines:Q$.number().nullable()}),Q$.object({type:Q$.literal("text_editor_code_execution_create_result"),is_file_update:Q$.boolean()}),Q$.object({type:Q$.literal("text_editor_code_execution_str_replace_result"),lines:Q$.array(Q$.string()).nullable(),new_lines:Q$.number().nullable(),new_start:Q$.number().nullable(),old_lines:Q$.number().nullable(),old_start:Q$.number().nullable()})]))),Or4=w0(()=>Z0(Q$.discriminatedUnion("type",[Q$.object({type:Q$.literal("programmatic-tool-call"),code:Q$.string()}),Q$.object({type:Q$.literal("bash_code_execution"),command:Q$.string()}),Q$.discriminatedUnion("command",[Q$.object({type:Q$.literal("text_editor_code_execution"),command:Q$.literal("view"),path:Q$.string()}),Q$.object({type:Q$.literal("text_editor_code_execution"),command:Q$.literal("create"),path:Q$.string(),file_text:Q$.string().nullish()}),Q$.object({type:Q$.literal("text_editor_code_execution"),command:Q$.literal("str_replace"),path:Q$.string(),old_str:Q$.string(),new_str:Q$.string()})])]))),Lr4=Z8({id:"anthropic.code_execution_20250825",inputSchema:Or4,outputSchema:av$,supportsDeferredResults:!0}),sv$=w0(()=>Z0(y1.discriminatedUnion("type",[y1.object({type:y1.literal("code_execution_result"),stdout:y1.string(),stderr:y1.string(),return_code:y1.number(),content:y1.array(y1.object({type:y1.literal("code_execution_output"),file_id:y1.string()})).optional().default([])}),y1.object({type:y1.literal("encrypted_code_execution_result"),encrypted_stdout:y1.string(),stderr:y1.string(),return_code:y1.number(),content:y1.array(y1.object({type:y1.literal("code_execution_output"),file_id:y1.string()})).optional().default([])}),y1.object({type:y1.literal("bash_code_execution_result"),content:y1.array(y1.object({type:y1.literal("bash_code_execution_output"),file_id:y1.string()})),stdout:y1.string(),stderr:y1.string(),return_code:y1.number()}),y1.object({type:y1.literal("bash_code_execution_tool_result_error"),error_code:y1.string()}),y1.object({type:y1.literal("text_editor_code_execution_tool_result_error"),error_code:y1.string()}),y1.object({type:y1.literal("text_editor_code_execution_view_result"),content:y1.string(),file_type:y1.string(),num_lines:y1.number().nullable(),start_line:y1.number().nullable(),total_lines:y1.number().nullable()}),y1.object({type:y1.literal("text_editor_code_execution_create_result"),is_file_update:y1.boolean()}),y1.object({type:y1.literal("text_editor_code_execution_str_replace_result"),lines:y1.array(y1.string()).nullable(),new_lines:y1.number().nullable(),new_start:y1.number().nullable(),old_lines:y1.number().nullable(),old_start:y1.number().nullable()})]))),wr4=w0(()=>Z0(y1.discriminatedUnion("type",[y1.object({type:y1.literal("programmatic-tool-call"),code:y1.string()}),y1.object({type:y1.literal("bash_code_execution"),command:y1.string()}),y1.discriminatedUnion("command",[y1.object({type:y1.literal("text_editor_code_execution"),command:y1.literal("view"),path:y1.string()}),y1.object({type:y1.literal("text_editor_code_execution"),command:y1.literal("create"),path:y1.string(),file_text:y1.string().nullish()}),y1.object({type:y1.literal("text_editor_code_execution"),command:y1.literal("str_replace"),path:y1.string(),old_str:y1.string(),new_str:y1.string()})])]))),Er4=Z8({id:"anthropic.code_execution_20260120",inputSchema:wr4,outputSchema:sv$,supportsDeferredResults:!0}),ev$=w0(()=>Z0(yv.array(yv.object({type:yv.literal("tool_reference"),toolName:yv.string()})))),zr4=w0(()=>Z0(yv.object({pattern:yv.string(),limit:yv.number().optional()}))),Pr4=Z8({id:"anthropic.tool_search_regex_20251119",inputSchema:zr4,outputSchema:ev$,supportsDeferredResults:!0});$x$=new Set(["date-time","time","date","duration","email","hostname","uri","ipv4","ipv6","uuid"]),Mr4=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","minItems","maxItems","uniqueItems","minProperties","maxProperties","not"];fr4=w0(()=>Z0(e71.object({command:e71.string(),restart:e71.boolean().optional()}))),br4=g4({id:"anthropic.bash_20241022",inputSchema:fr4}),yr4=w0(()=>Z0($Q1.object({command:$Q1.string(),restart:$Q1.boolean().optional()}))),gr4=g4({id:"anthropic.bash_20250124",inputSchema:yr4}),hr4=w0(()=>Z0(Ks.object({action:Ks.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:Ks.array(Ks.number().int()).optional(),text:Ks.string().optional()}))),ur4=g4({id:"anthropic.computer_20241022",inputSchema:hr4}),cr4=w0(()=>Z0(eJ.object({action:eJ.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:eJ.tuple([eJ.number().int(),eJ.number().int()]).optional(),duration:eJ.number().optional(),scroll_amount:eJ.number().optional(),scroll_direction:eJ.enum(["up","down","left","right"]).optional(),start_coordinate:eJ.tuple([eJ.number().int(),eJ.number().int()]).optional(),text:eJ.string().optional()}))),lr4=g4({id:"anthropic.computer_20250124",inputSchema:cr4}),mr4=w0(()=>Z0(S7.object({action:S7.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:S7.tuple([S7.number().int(),S7.number().int()]).optional(),duration:S7.number().optional(),region:S7.tuple([S7.number().int(),S7.number().int(),S7.number().int(),S7.number().int()]).optional(),scroll_amount:S7.number().optional(),scroll_direction:S7.enum(["up","down","left","right"]).optional(),start_coordinate:S7.tuple([S7.number().int(),S7.number().int()]).optional(),text:S7.string().optional()}))),dr4=g4({id:"anthropic.computer_20251124",inputSchema:mr4}),ir4=w0(()=>Z0(c6.discriminatedUnion("command",[c6.object({command:c6.literal("view"),path:c6.string(),view_range:c6.tuple([c6.number(),c6.number()]).optional()}),c6.object({command:c6.literal("create"),path:c6.string(),file_text:c6.string()}),c6.object({command:c6.literal("str_replace"),path:c6.string(),old_str:c6.string(),new_str:c6.string()}),c6.object({command:c6.literal("insert"),path:c6.string(),insert_line:c6.number(),insert_text:c6.string()}),c6.object({command:c6.literal("delete"),path:c6.string()}),c6.object({command:c6.literal("rename"),old_path:c6.string(),new_path:c6.string()})]))),pr4=g4({id:"anthropic.memory_20250818",inputSchema:ir4}),nr4=w0(()=>Z0(uH.object({command:uH.enum(["view","create","str_replace","insert","undo_edit"]),path:uH.string(),file_text:uH.string().optional(),insert_line:uH.number().int().optional(),new_str:uH.string().optional(),insert_text:uH.string().optional(),old_str:uH.string().optional(),view_range:uH.array(uH.number().int()).optional()}))),tr4=g4({id:"anthropic.text_editor_20241022",inputSchema:nr4}),or4=w0(()=>Z0(cH.object({command:cH.enum(["view","create","str_replace","insert","undo_edit"]),path:cH.string(),file_text:cH.string().optional(),insert_line:cH.number().int().optional(),new_str:cH.string().optional(),insert_text:cH.string().optional(),old_str:cH.string().optional(),view_range:cH.array(cH.number().int()).optional()}))),rr4=g4({id:"anthropic.text_editor_20250124",inputSchema:or4}),ar4=w0(()=>Z0(lH.object({command:lH.enum(["view","create","str_replace","insert"]),path:lH.string(),file_text:lH.string().optional(),insert_line:lH.number().int().optional(),new_str:lH.string().optional(),insert_text:lH.string().optional(),old_str:lH.string().optional(),view_range:lH.array(lH.number().int()).optional()}))),sr4=g4({id:"anthropic.text_editor_20250429",inputSchema:ar4}),er4=w0(()=>Z0(gv.array(gv.object({type:gv.literal("tool_reference"),toolName:gv.string()})))),$a4=w0(()=>Z0(gv.object({query:gv.string(),limit:gv.number().optional()}))),Za4=Z8({id:"anthropic.tool_search_bm25_20251119",inputSchema:$a4,outputSchema:er4,supportsDeferredResults:!0}),Xa4={advisor_20260301:co4,bash_20241022:br4,bash_20250124:gr4,codeExecution_20250522:Br4,codeExecution_20250825:Dr4,codeExecution_20260120:jr4,computer_20241022:ur4,computer_20250124:lr4,computer_20251124:dr4,memory_20250818:pr4,textEditor_20241022:tr4,textEditor_20250124:rr4,textEditor_20250429:sr4,textEditor_20250728:io4,webFetch_20250910:Hr4,webFetch_20260209:Gr4,webSearch_20250305:$r4,webSearch_20260209:ro4,toolSearchRegex_20251119:Ar4,toolSearchBm25_20251119:Qa4};cHZ=Ws()});import{z as zU}from"zod/v4";import{z as Hs}from"zod/v4";import{z as qQ}from"zod/v4";import{z as c0}from"zod/v4";import{z as O6}from"zod/v4";import{z as Kc}from"zod/v4";import{z as ka4}from"zod/v4";import{z as Fs}from"zod/v4";import{z as xa4}from"zod/v4";import{z as hv}from"zod/v4";import{z as ga4}from"zod/v4";import{z as XQ1}from"zod/v4";import{z as uv}from"zod/v4";import{z as j9}from"zod/v4";import{z as B0}from"zod/v4";import{z as t1}from"zod/v4";function Qx$($){var Z,Q,X,Y;if($==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let G=(Z=$.promptTokenCount)!=null?Z:0,J=(Q=$.candidatesTokenCount)!=null?Q:0,K=(X=$.cachedContentTokenCount)!=null?X:0,W=(Y=$.thoughtsTokenCount)!=null?Y:0;return{inputTokens:{total:G,noCache:G-K,cacheRead:K,cacheWrite:void 0},outputTokens:{total:J+W,text:J,reasoning:W},raw:$}}function lK($,Z=!0){if($==null)return;if(Na4($)){if(Z)return;if(typeof $==="object"&&$.description)return{type:"object",description:$.description};return{type:"object"}}if(typeof $==="boolean")return{type:"boolean",properties:{}};let{type:Q,description:X,required:Y,properties:G,items:J,allOf:K,anyOf:W,oneOf:H,format:F,const:N,minLength:U,enum:B}=$,O={};if(X)O.description=X;if(Y)O.required=Y;if(F)O.format=F;if(N!==void 0)O.enum=[N];if(Q)if(Array.isArray(Q)){let D=Q.includes("null"),w=Q.filter((E)=>E!=="null");if(w.length===0)O.type="null";else if(O.anyOf=w.map((E)=>({type:E})),D)O.nullable=!0}else O.type=Q;if(B!==void 0)O.enum=B;if(G!=null)O.properties=Object.entries(G).reduce((D,[w,E])=>{return D[w]=lK(E,!1),D},{});if(J)O.items=Array.isArray(J)?J.map((D)=>lK(D,!1)):lK(J,!1);if(K)O.allOf=K.map((D)=>lK(D,!1));if(W)if(W.some((D)=>typeof D==="object"&&(D==null?void 0:D.type)==="null")){let D=W.filter((w)=>!(typeof w==="object"&&(w==null?void 0:w.type)==="null"));if(D.length===1){let w=lK(D[0],!1);if(typeof w==="object")O.nullable=!0,Object.assign(O,w)}else O.anyOf=D.map((w)=>lK(w,!1)),O.nullable=!0}else O.anyOf=W.map((D)=>lK(D,!1));if(H)O.oneOf=H.map((D)=>lK(D,!1));if(U!==void 0)O.minLength=U;return O}function Na4($){return $!=null&&typeof $==="object"&&$.type==="object"&&($.properties==null||Object.keys($.properties).length===0)&&!$.additionalProperties}function Xx$($,Z){let Q=[Z,"google","googleVertex","vertex"].filter((X,Y,G)=>{return G.indexOf(X)===Y});for(let X of Q){let Y=$==null?void 0:$[X];if(Y!=null)return Y}}function Oa4($){let Z=Ba4.exec($);if(Z==null)return;return{mediaType:Z[1],data:Z[2]}}function La4($){let Z=Oa4($);if(Z==null)return;return{inlineData:{mimeType:Z.mediaType,data:Z.data}}}function Da4($,Z,Q,X){let Y=[],G=[];for(let J of Q)switch(J.type){case"text":{G.push(J.text);break}case"image-data":case"file-data":{Y.push({inlineData:{mimeType:J.mediaType,data:J.data}});break}case"image-url":case"file-url":{let K=La4(J.url);if(K!=null)Y.push(K);else G.push(JSON.stringify(J));break}default:{G.push(JSON.stringify(J));break}}$.push({functionResponse:{...X!=null?{id:X}:{},name:Z,response:{name:Z,content:G.length>0?G.join(`
|
|
2862
2862
|
`):"Tool executed successfully."},...Y.length>0?{parts:Y}:{}}})}function wa4($,Z,Q,X){for(let Y of Q)switch(Y.type){case"text":$.push({functionResponse:{...X!=null?{id:X}:{},name:Z,response:{name:Z,content:Y.text}}});break;case"image-data":$.push({inlineData:{mimeType:String(Y.mediaType),data:String(Y.data)}},{text:"Tool executed successfully and returned this image as a response"});break;default:$.push({text:JSON.stringify(Y)});break}}function Ea4($,Z){var Q,X,Y,G,J;let K=[],W=[],H=!0,F=(Q=Z==null?void 0:Z.isGemmaModel)!=null?Q:!1,N=(X=Z==null?void 0:Z.isGemini3Model)!=null?X:!1,U=(Y=Z==null?void 0:Z.providerOptionsName)!=null?Y:"google",B=(G=Z==null?void 0:Z.supportsFunctionResponseParts)!=null?G:!0,O=Z==null?void 0:Z.onWarning,D=!1,w=[],E=(j)=>{return w.push(j),D=!0,Ua4};for(let{role:j,content:z}of $)switch(j){case"system":{if(!H)throw new y4({functionality:"system messages are only supported at the beginning of the conversation"});K.push({text:z});break}case"user":{H=!1;let A=[];for(let P of z)switch(P.type){case"text":{A.push({text:P.text});break}case"file":{let I=P.mediaType==="image/*"?"image/jpeg":P.mediaType;A.push(P.data instanceof URL?{fileData:{mimeType:I,fileUri:P.data.toString()}}:{inlineData:{mimeType:I,data:EZ(P.data)}});break}}W.push({role:"user",parts:A});break}case"assistant":{H=!1,W.push({role:"model",parts:z.map((A)=>{let P=Xx$(A.providerOptions,U),I=(P==null?void 0:P.thoughtSignature)!=null?String(P.thoughtSignature):void 0;switch(A.type){case"text":return A.text.length===0?void 0:{text:A.text,thoughtSignature:I};case"reasoning":return A.text.length===0?void 0:{text:A.text,thought:!0,thoughtSignature:I};case"file":{if(A.data instanceof URL)throw new y4({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:A.mediaType,data:EZ(A.data)},...(P==null?void 0:P.thought)===!0?{thought:!0}:{},thoughtSignature:I}}case"tool-call":{let q=(P==null?void 0:P.serverToolCallId)!=null?String(P.serverToolCallId):void 0,M=(P==null?void 0:P.serverToolType)!=null?String(P.serverToolType):void 0,S=I!=null?I:N?E(A.toolName):void 0;if(q&&M)return{toolCall:{toolType:M,args:typeof A.input==="string"?JSON.parse(A.input):A.input,id:q},thoughtSignature:S};return{functionCall:{...A.toolCallId!=null?{id:A.toolCallId}:{},name:A.toolName,args:A.input},thoughtSignature:S}}case"tool-result":{let q=(P==null?void 0:P.serverToolCallId)!=null?String(P.serverToolCallId):void 0,M=(P==null?void 0:P.serverToolType)!=null?String(P.serverToolType):void 0;if(q&&M)return{toolResponse:{toolType:M,response:A.output.type==="json"?A.output.value:{},id:q},thoughtSignature:I};return}}}).filter((A)=>A!==void 0)});break}case"tool":{H=!1;let A=[];for(let P of z){if(P.type==="tool-approval-response")continue;let I=Xx$(P.providerOptions,U),q=(I==null?void 0:I.serverToolCallId)!=null?String(I.serverToolCallId):void 0,M=(I==null?void 0:I.serverToolType)!=null?String(I.serverToolType):void 0;if(q&&M){let m=(I==null?void 0:I.thoughtSignature)!=null?String(I.thoughtSignature):void 0;if(W.length>0){let f=W[W.length-1];if(f.role==="model"){f.parts.push({toolResponse:{toolType:M,response:P.output.type==="json"?P.output.value:{},id:q},thoughtSignature:m});continue}}}let S=P.output;if(S.type==="content")if(B)Da4(A,P.toolName,S.value,P.toolCallId);else wa4(A,P.toolName,S.value,P.toolCallId);else A.push({functionResponse:{...P.toolCallId!=null?{id:P.toolCallId}:{},name:P.toolName,response:{name:P.toolName,content:S.type==="execution-denied"?(J=S.reason)!=null?J:"Tool execution denied.":S.value}}})}W.push({role:"user",parts:A});break}}if(F&&K.length>0&&W.length>0&&W[0].role==="user"){let j=K.map((z)=>z.text).join(`
|