@readmagic/workmate 0.0.21 → 0.0.23
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/chunks/AddWorkspaceDirectory-OgcBcK5A.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +1 -0
- package/dist/chunks/App-B-3tPQ3k.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +1 -0
- package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
- package/dist/chunks/DiffDialog-B3X9FMpO.js +6 -0
- package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
- package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
- package/dist/chunks/ExitFlow-DgAZp_8U.js +2 -0
- package/dist/chunks/Grove-CHatOzcE.js +11 -0
- package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-Dtmpzeps.js +1 -0
- package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +1 -0
- package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
- package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
- package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-JvChf3xr.js} +1 -1
- package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
- package/dist/chunks/Messages-K4DDsDP9.js +10 -0
- package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +1 -0
- package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
- package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
- package/dist/chunks/REPL-CQBJRrT0.js +124 -0
- package/dist/chunks/REPL-CrVuMQY2.js +1 -0
- package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
- package/dist/chunks/SelectMulti-Bc6l11_K.js +1 -0
- package/dist/chunks/Settings-TGp3fPrS.js +3 -0
- package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
- package/dist/chunks/SpinnerGlyph-CmkRUvHe.js +1 -0
- package/dist/chunks/TextInput-CD9iau2k.js +22 -0
- package/dist/chunks/ThemePicker-0F0hZYPX.js +1 -0
- package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
- package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
- package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
- package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
- package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-BReJUBWg.js} +1 -1
- package/dist/chunks/agents-9qQ8I6zW.js +101 -0
- package/dist/chunks/{agents-CvW8XjoJ.js → agents-B3x8yJ_r.js} +1 -1
- package/dist/chunks/allErrors-DfWylHSw.js +1 -0
- package/dist/chunks/appleTerminalBackup-BArZWB21.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
- package/dist/chunks/banner-Cu2-XUek.js +2 -0
- package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
- package/dist/chunks/branch-C4TsMEkx.js +2 -0
- package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BMXqFTeS.js} +2 -2
- package/dist/chunks/btw-Dn1eYFAz.js +1 -0
- package/dist/chunks/caches-BGzKwpnc.js +1 -0
- package/dist/chunks/caches-DArHxBgL.js +1 -0
- package/dist/chunks/claudeDesktop-D8ml2767.js +1 -0
- package/dist/chunks/{clear-D2KRoibg.js → clear-Bdhb6b39.js} +1 -1
- package/dist/chunks/{client-C_jBL1yC.js → client-4iqhC8xq.js} +1 -1
- package/dist/chunks/client-BiqbIkwr.js +1 -0
- package/dist/chunks/client-CZ8nyVh5.js +1 -0
- package/dist/chunks/client-CpTCeWba.js +1 -0
- package/dist/chunks/commands-QepeBbFn.js +1 -0
- package/dist/chunks/compact-Bu9BUpxV.js +2 -0
- package/dist/chunks/config-C-Y2qtB2.js +3 -0
- package/dist/chunks/config-D58C3_Lu.js +1 -0
- package/dist/chunks/config-DD8fCYXn.js +1 -0
- package/dist/chunks/{context-Db9tH1VF.js → context-CY_yfdYa.js} +1 -1
- package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
- package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-Dd4xIoP1.js} +10 -10
- package/dist/chunks/conversation-B0wxBwzv.js +1 -0
- package/dist/chunks/conversation-DUu9qBnq.js +1 -0
- package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
- package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
- package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
- package/dist/chunks/cwd-Pa83R95t.js +1 -0
- package/dist/chunks/{datadog-BuElf2EQ.js → datadog-BPuGcxxC.js} +1 -1
- package/dist/chunks/{debug-D58GQBDG.js → debug-Bglx1aTu.js} +5 -5
- package/dist/chunks/detectRepository-CfX8Lc0A.js +1 -0
- package/dist/chunks/{diff-yA6v_dpP.js → diff-BOAElpfQ.js} +1 -1
- package/dist/chunks/directoryCompletion-D_Rtg-4j.js +1 -0
- package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
- package/dist/chunks/dist-es-B7j_mv242.js +1 -0
- package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
- package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
- package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
- package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
- package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
- package/dist/chunks/dist-es-DSkyibcN.js +1 -0
- package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
- package/dist/chunks/dist-es-hwK6468D.js +1 -0
- package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
- package/dist/chunks/doctor-CkLzqAMd.js +1 -0
- package/dist/chunks/entry-TNOoyy7_.js +13 -0
- package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
- package/dist/chunks/esm-eTAUP-La.js +1 -0
- package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BTachNBI.js} +1 -1
- package/dist/chunks/exit-DXApFJIP.js +1 -0
- package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
- package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
- package/dist/chunks/fast-C5nQH8rm.js +1 -0
- package/dist/chunks/fast-eGx2IxD7.js +1 -0
- package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
- package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
- package/dist/chunks/fileSuggestions-DHxdwq28.js +3 -0
- package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
- package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
- package/dist/chunks/gemini-D_ORb_L6.js +2 -0
- package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
- package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-DwQFuna9.js} +1 -1
- package/dist/chunks/goal-D7c2mSds.js +3 -0
- package/dist/chunks/grok-B2-ZbUiR.js +1 -0
- package/dist/chunks/grove-O6qp7ITR.js +1 -0
- package/dist/chunks/help-CZJdRviD.js +1 -0
- package/dist/chunks/history-CQiUERTL.js +1 -0
- package/dist/chunks/hooks-BNuUlMzL.js +1 -0
- package/dist/chunks/{hooks-BDgToO1Z.js → hooks-DIvN6gdv.js} +3 -3
- package/dist/chunks/install-T_CV1Slu.js +1 -0
- package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
- package/dist/chunks/{job-DYMfSglZ.js → job-R6c4-3c8.js} +1 -1
- package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
- package/dist/chunks/launchLocalMemory-DrbKrwXc.js +3 -0
- package/dist/chunks/{launchOnboarding-BeNf51Ig.js → launchOnboarding-tqsMD8ni.js} +1 -1
- package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
- package/dist/chunks/loadAgentsDir-DlPbtIsS.js +3349 -0
- package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
- package/dist/chunks/{loader-C33o_5kS.js → loader-CICGtLp2.js} +1 -1
- package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-CK-sFzPm.js} +1 -1
- package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
- package/dist/chunks/log-D2TIwHBV.js +1 -0
- package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
- package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-BEF8D3if.js} +3 -3
- package/dist/chunks/main-kOVUGxOS.js +345 -0
- package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
- package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
- package/dist/chunks/mcp-BNd29r6p.js +6 -0
- package/dist/chunks/mcp-D0wAJrRT.js +1 -0
- package/dist/chunks/mcp-mgOlm1cY.js +2 -0
- package/dist/chunks/memory-DDLk9_LJ.js +1 -0
- package/dist/chunks/mode-CcNsWgK3.js +2 -0
- package/dist/chunks/model-BwBG0V1u.js +1 -0
- package/dist/chunks/model-DzCP4K-9.js +1 -0
- package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
- package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
- package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
- package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
- package/dist/chunks/openai-CDN71NdX.js +2 -0
- package/dist/chunks/overlayContext-BT2Lq8ei.js +1 -0
- package/dist/chunks/{panel-Cm23FDVt.js → panel-CVS4SK_E.js} +1 -1
- package/dist/chunks/parser-CG5RuOCK.js +1 -0
- package/dist/chunks/{parser-eVu-cTRs.js → parser-Cg6hSCmn.js} +1 -1
- package/dist/chunks/partition-CIl_ORUT.js +1 -0
- package/dist/chunks/pasteStore-P0zP-ch0.js +1 -0
- package/dist/chunks/permissions-zSNOZSwr.js +3 -0
- package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
- package/dist/chunks/{plan-s228H7IU.js → plan-Bs6em6lk.js} +1 -1
- package/dist/chunks/{platform-DMQxcm4K.js → platform-BacQ6ACS.js} +1 -1
- package/dist/chunks/plugin-DDDxjBa0.js +17 -0
- package/dist/chunks/pluginAutoupdate-8qugAFhb.js +1 -0
- package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
- package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
- package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-BG2MHCQJ.js} +1 -1
- package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
- package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
- package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
- package/dist/chunks/plugins-COoGBYk6.js +4 -0
- package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-B0QGV6Ci.js} +1 -1
- package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
- package/dist/chunks/print-BASybEtO.js +13 -0
- package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
- package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
- package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
- package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
- package/dist/chunks/projectOnboardingState-B5YATuc6.js +1 -0
- package/dist/chunks/prompt-CHobfCB1.js +1 -0
- package/dist/chunks/prompt-CMm6RHHc.js +1 -0
- package/dist/chunks/{prompt-BNNE5tsG.js → prompt-mM79EGnT.js} +3 -3
- package/dist/chunks/promptEditor-DLGN_eLu.js +4 -0
- package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-DjQALaU2.js} +2 -2
- package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CDBfZjO7.js} +2 -2
- package/dist/chunks/reconciler-CeXqh95g.js +1 -0
- package/dist/chunks/refresh-Ce2yk28a.js +1 -0
- package/dist/chunks/registerProtocol-CAsDme_E.js +1 -0
- package/dist/chunks/reject-Bld5E-bn.js +1 -0
- package/dist/chunks/reload-plugins-C42xSB5l.js +1 -0
- package/dist/chunks/rename-CtBghpxZ.js +1 -0
- package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-DV0dn0IW.js} +1 -1
- package/dist/chunks/resume-BWkaTDqd.js +2 -0
- package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
- package/dist/chunks/ripgrep-Dl3y5r4m.js +5 -0
- package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-1wQO8HSZ.js} +1 -1
- package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-XQrOux41.js} +4 -4
- package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
- package/dist/chunks/sandbox-toggle-Dir9Polo.js +1 -0
- package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
- package/dist/chunks/select-Bxf5-5sI.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
- package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
- package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-DS4G6mb9.js} +2 -2
- package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
- package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
- package/dist/chunks/settings-B2jvL8Dp.js +24 -0
- package/dist/chunks/settings-CisDe8DB.js +1 -0
- package/dist/chunks/setup-BRypY6iT.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
- package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-DLJxyrlp.js} +3 -3
- package/dist/chunks/sinks-CGdKmq_8.js +1 -0
- package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
- package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
- package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CKN_d3pO.js} +2 -2
- package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BMY2JGGG.js} +2 -2
- package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-D9trHULQ.js} +4 -4
- package/dist/chunks/skills-CX_AvwLG.js +1 -0
- package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
- package/dist/chunks/startupProfiler-CJdr3SxP.js +3 -0
- package/dist/chunks/state-B4jiUise.js +1 -0
- package/dist/chunks/state-BhOKSFi5.js +1 -0
- package/dist/chunks/status-Daaak6Bo.js +1 -0
- package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
- package/dist/chunks/stringUtils-C718f5ey.js +4 -0
- package/dist/chunks/sts-ei3CGBNu.js +1 -0
- package/dist/chunks/switcher-BpgmH4AI.js +1 -0
- package/dist/chunks/{switcher-DWfKi17X.js → switcher-CAajZeNL.js} +1 -1
- package/dist/chunks/{tasks-BwSsj2vI.js → tasks-BWNQr2d3.js} +1 -1
- package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
- package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-gUET39Ho.js} +1 -1
- package/dist/chunks/terminalSetup-B_10N_gE.js +32 -0
- package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-qc2PlvOm.js} +1 -1
- package/dist/chunks/{theme-CAoGjf2D.js → theme-B7fKI6E5.js} +1 -1
- package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
- package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-BL06sDI4.js} +1 -1
- package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
- package/dist/chunks/types-Dx7P7JLQ.js +81 -0
- package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
- package/dist/chunks/use-select-navigation-BiUJdWai.js +1 -0
- package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +1 -0
- package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
- package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
- package/dist/chunks/useMergedTools-Bw8FchX8.js +1 -0
- package/dist/chunks/useSearchInput-B25K1RnK.js +1 -0
- package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
- package/dist/chunks/util-CtlC2dsN.js +1 -0
- package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
- package/dist/chunks/vim-CoRp9lY1.js +1 -0
- package/dist/chunks/worktree-B8apCnVe.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -5
- package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
- package/dist/chunks/App-VWyPd524.js +0 -1
- package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
- package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
- package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
- package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
- package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
- package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
- package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
- package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
- package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
- package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
- package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
- package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
- package/dist/chunks/Messages-Cykztq1O.js +0 -10
- package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
- package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
- package/dist/chunks/REPL-B8e5UU3H.js +0 -128
- package/dist/chunks/REPL-C4mbOhyL.js +0 -1
- package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
- package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
- package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
- package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
- package/dist/chunks/Settings-B7n_dfP-.js +0 -2
- package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
- package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
- package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
- package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
- package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
- package/dist/chunks/agents-D96ng5I9.js +0 -101
- package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
- package/dist/chunks/api-DTyrmy1O.js +0 -1
- package/dist/chunks/api-DumFOErN.js +0 -1
- package/dist/chunks/auth-CZ4EsFWF.js +0 -10
- package/dist/chunks/auth-QvonHoG9.js +0 -1
- package/dist/chunks/auth-jV5THRH8.js +0 -1
- package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
- package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
- package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
- package/dist/chunks/bg-qG2osBbP.js +0 -9
- package/dist/chunks/branch-K8X6jx0i.js +0 -2
- package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
- package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
- package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
- package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
- package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
- package/dist/chunks/btw-BNs5OX7x.js +0 -1
- package/dist/chunks/bundledMode--fG1S62b.js +0 -1
- package/dist/chunks/caches-CC5NHwAz.js +0 -1
- package/dist/chunks/caches-nHxJWXgO.js +0 -1
- package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
- package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
- package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
- package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
- package/dist/chunks/client-9uHzAmFH.js +0 -1
- package/dist/chunks/client-BVal_QII.js +0 -1
- package/dist/chunks/client-BtTkq0YS.js +0 -1
- package/dist/chunks/client-Dd7CKMRX.js +0 -1
- package/dist/chunks/commands-C_rYjyQZ.js +0 -1
- package/dist/chunks/compact-Cqd6vKpn.js +0 -2
- package/dist/chunks/config-Be0BkAAr.js +0 -1
- package/dist/chunks/config-DUTgj3js.js +0 -3
- package/dist/chunks/config-DoEDgAfv.js +0 -1
- package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
- package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
- package/dist/chunks/conversation-DWfE4KGH.js +0 -1
- package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
- package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
- package/dist/chunks/createSession-CqHnHhCR.js +0 -1
- package/dist/chunks/createSession-DqTtBycR.js +0 -1
- package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
- package/dist/chunks/cwd-DLK3znO7.js +0 -1
- package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
- package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
- package/dist/chunks/detached-Biz-xhu0.js +0 -4
- package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
- package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
- package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
- package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
- package/dist/chunks/dist-es-BIjDeceU.js +0 -1
- package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
- package/dist/chunks/dist-es-CEk66gUu.js +0 -1
- package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
- package/dist/chunks/dist-es-CMtO44xC.js +0 -1
- package/dist/chunks/dist-es-CYPVg66r.js +0 -9
- package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
- package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
- package/dist/chunks/dist-es-kj-F5A132.js +0 -1
- package/dist/chunks/doctor-eNAm6OiS.js +0 -1
- package/dist/chunks/entry-DidpiR-D.js +0 -13
- package/dist/chunks/esm-BCUC71kt.js +0 -1
- package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
- package/dist/chunks/exit-DywUeiYd.js +0 -1
- package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
- package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
- package/dist/chunks/fast-DCXZACT9.js +0 -1
- package/dist/chunks/fast-Qo4WVqiW.js +0 -1
- package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
- package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
- package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
- package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
- package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
- package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
- package/dist/chunks/gemini-BXAyy1JN.js +0 -1
- package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
- package/dist/chunks/git-Wid-XppW.js +0 -5
- package/dist/chunks/git-hO-TMvXc.js +0 -1
- package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
- package/dist/chunks/goal-C9clrwEH.js +0 -3
- package/dist/chunks/grok-CjeCecsZ.js +0 -1
- package/dist/chunks/grove-DqTnK9nn.js +0 -7
- package/dist/chunks/hash-Tu-My5Vp.js +0 -1
- package/dist/chunks/help-Bb6LdzXK.js +0 -1
- package/dist/chunks/hooks-BX2s7aoL.js +0 -1
- package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
- package/dist/chunks/install-eCA8UACi.js +0 -1
- package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
- package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
- package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
- package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
- package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
- package/dist/chunks/lib-BlVGipXx.js +0 -14
- package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
- package/dist/chunks/loadAgentsDir-C96o6gCj.js +0 -3422
- package/dist/chunks/loadPluginHooks-0nGlugZ4.js +0 -1
- package/dist/chunks/localSearch-dodgnjGn.js +0 -1
- package/dist/chunks/log-CZ7ploQm.js +0 -1
- package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
- package/dist/chunks/main-7ssnA9Yb.js +0 -31
- package/dist/chunks/main-BEv6MqMX.js +0 -356
- package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
- package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
- package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
- package/dist/chunks/mcp-BUn3yqsT.js +0 -1
- package/dist/chunks/mcp-BskLq9iP.js +0 -2
- package/dist/chunks/mcp-C-0DMaXx.js +0 -6
- package/dist/chunks/memoize-CumjjK2Q.js +0 -1
- package/dist/chunks/memory-vDkJM58W.js +0 -1
- package/dist/chunks/mode-Dbh21H2Y.js +0 -2
- package/dist/chunks/model-BaMclMXn.js +0 -1
- package/dist/chunks/model-atn3_JBi.js +0 -1
- package/dist/chunks/model-vS1Iewyq.js +0 -1
- package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
- package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
- package/dist/chunks/oauth-D38aRTUb.js +0 -1
- package/dist/chunks/oauth-U649LV5H.js +0 -1
- package/dist/chunks/omit-B7eQ9q0x.js +0 -1
- package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
- package/dist/chunks/openai-wh8AX5iz.js +0 -10
- package/dist/chunks/parser-Cq9X7HMP.js +0 -1
- package/dist/chunks/partition-CENvOfiS.js +0 -1
- package/dist/chunks/permissions-ChuIx-d4.js +0 -3
- package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
- package/dist/chunks/plugin-DVBEWwMP.js +0 -17
- package/dist/chunks/pluginAutoupdate-aLXhSUVD.js +0 -1
- package/dist/chunks/pluginBlocklist-BprCv0En.js +0 -1
- package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
- package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
- package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
- package/dist/chunks/plugins-DdIaXpNb.js +0 -4
- package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
- package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
- package/dist/chunks/print-vxrRE1O2.js +0 -14
- package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
- package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
- package/dist/chunks/prompt-2AA5W7EH.js +0 -1
- package/dist/chunks/prompt-AXiS2LoO.js +0 -1
- package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
- package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
- package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
- package/dist/chunks/refresh-BSG0t4cf.js +0 -1
- package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
- package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
- package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
- package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
- package/dist/chunks/rename-BrEwj3Xw.js +0 -1
- package/dist/chunks/resume-DR5JbICs.js +0 -2
- package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
- package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
- package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
- package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
- package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
- package/dist/chunks/session-wkRTfdo8.js +0 -2
- package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
- package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
- package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
- package/dist/chunks/sessionState-8jutEorw.js +0 -11
- package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
- package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
- package/dist/chunks/sessionTracing-fIp8g04N.js +0 -11
- package/dist/chunks/settings-BowI3jp-.js +0 -19
- package/dist/chunks/settings-CHn0gJCG.js +0 -1
- package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
- package/dist/chunks/setup-UiEO9i7F.js +0 -3
- package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
- package/dist/chunks/sinks-DnLqRPEC.js +0 -1
- package/dist/chunks/sinks-mGBiINp8.js +0 -1
- package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
- package/dist/chunks/skills-DKtN17ch.js +0 -1
- package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
- package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
- package/dist/chunks/state-BStOuCh4.js +0 -1
- package/dist/chunks/state-D5D6QpTX.js +0 -1
- package/dist/chunks/stats-D4LEtkrw.js +0 -1
- package/dist/chunks/status-0ZBx6Ls0.js +0 -2
- package/dist/chunks/status-BUJ4-omB.js +0 -1
- package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
- package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
- package/dist/chunks/sts-C2Gf2WYN.js +0 -1
- package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
- package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
- package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
- package/dist/chunks/syncCache-DUhciJLz.js +0 -1
- package/dist/chunks/teleport-DwZMevmQ.js +0 -1
- package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
- package/dist/chunks/tmux-DA06aewY.js +0 -1
- package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
- package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
- package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
- package/dist/chunks/types-APu4OCXJ.js +0 -17
- package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
- package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
- package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
- package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
- package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
- package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
- package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
- package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
- package/dist/chunks/util-DU63xTwZ.js +0 -1
- package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
- package/dist/chunks/vim-xruiCyUd.js +0 -1
- package/dist/chunks/which-B8rchd8P.js +0 -1
- package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
- package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
- package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
- package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
- package/dist/chunks/worktree-C28I8mFB.js +0 -1
- /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
- /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
- /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-Dd4xIoP1.js}
RENAMED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dh as t,Lh as n,Qx as r,Rh as i,Th as a,Yi as o}from"./loadAgentsDir-DlPbtIsS.js";import{cn as s,ln as c}from"./settings-B2jvL8Dp.js";import{_ as l,g as u}from"./startupProfiler-CJdr3SxP.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=r(t),{messages:f}=await i(d),p=n();return a(f,o,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:c,agents:l,skills:d}=e,f=`## Context Usage
|
|
2
2
|
|
|
3
|
-
`;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${
|
|
3
|
+
`;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${u(n)} / ${u(r)} (${i}%)\n`,f+=`
|
|
4
4
|
`;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
|
|
5
5
|
|
|
6
6
|
`,f+=`| Category | Tokens | Percentage |
|
|
7
7
|
`,f+=`|----------|--------|------------|
|
|
8
|
-
`;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${
|
|
9
|
-
`}if(
|
|
8
|
+
`;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${u(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/r*100).toFixed(1);f+=`| Free space | ${u(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/r*100).toFixed(1);f+=`| Autocompact buffer | ${u(n.tokens)} | ${e}% |\n`}f+=`
|
|
9
|
+
`}if(c.length>0){f+=`### MCP Tools
|
|
10
10
|
|
|
11
11
|
`,f+=`| Tool | Server | Tokens |
|
|
12
12
|
`,f+=`|------|--------|--------|
|
|
13
|
-
`;for(let e of
|
|
14
|
-
`}if(
|
|
13
|
+
`;for(let e of c)f+=`| ${e.name} | ${e.serverName} | ${u(e.tokens)} |\n`;f+=`
|
|
14
|
+
`}if(l.length>0){f+=`### Custom Agents
|
|
15
15
|
|
|
16
16
|
`,f+=`| Agent Type | Source | Tokens |
|
|
17
17
|
`,f+=`|------------|--------|--------|
|
|
18
|
-
`;for(let e of
|
|
18
|
+
`;for(let e of l){let t;switch(e.source){case`projectSettings`:t=`Project`;break;case`userSettings`:t=`User`;break;case`localSettings`:t=`Local`;break;case`flagSettings`:t=`Flag`;break;case`policySettings`:t=`Policy`;break;case`plugin`:t=`Plugin`;break;case`built-in`:t=`Built-in`;break;default:t=String(e.source)}f+=`| ${e.agentType} | ${t} | ${u(e.tokens)} |\n`}f+=`
|
|
19
19
|
`}if(o.length>0){f+=`### Memory Files
|
|
20
20
|
|
|
21
21
|
`,f+=`| Type | Path | Tokens |
|
|
22
22
|
`,f+=`|------|------|--------|
|
|
23
|
-
`;for(let e of o)f+=`| ${e.type} | ${e.path} | ${
|
|
23
|
+
`;for(let e of o)f+=`| ${e.type} | ${e.path} | ${u(e.tokens)} |\n`;f+=`
|
|
24
24
|
`}if(d&&d.tokens>0&&d.skillFrontmatter.length>0){f+=`### Skills
|
|
25
25
|
|
|
26
26
|
`,f+=`| Skill | Source | Tokens |
|
|
27
27
|
`,f+=`|-------|--------|--------|
|
|
28
|
-
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${
|
|
29
|
-
`}return f}var m=e((()=>{
|
|
28
|
+
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${s(e.source)} | ${u(e.tokens)} |\n`;f+=`
|
|
29
|
+
`}return f}var m=e((()=>{n(),t(),l(),o(),c()}));export{d as n,m as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./conversation-DUu9qBnq.js";e();export{t as clearConversation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$m as n,$n as r,Aw as i,Cw as a,Dn as o,En as s,Gn as c,Kt as l,Nb as u,Pb as d,QC as f,Qm as p,Xr as m,_r as h,cp as g,fs as _,gm as v,hm as y,li as b,mn as x,oi as S,on as C,ps as w,qC as T,up as E,vt as D,wn as O,xm as k,xt as A,ym as j}from"./loadAgentsDir-DlPbtIsS.js";import{Gt as M,It as N,J as P,Ut as F,V as I,fn as L,hn as R,pn as z}from"./state-B4jiUise.js";import{o as B,s as V}from"./log-D2TIwHBV.js";import{n as H,r as U}from"./analytics-DJobLaWP.js";import{n as W,t as G}from"./caches-DArHxBgL.js";import{randomUUID as K}from"crypto";async function q({setMessages:t,readFileState:i,discoveredSkillNames:o,loadedNestedMemoryPaths:u,getAppState:p,setAppState:_,setConversationId:y}){let x=C();await l(`clear`,{getAppState:p,setAppState:_,signal:AbortSignal.timeout(x),timeoutMs:x});let E=I();E&&U(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:E});let k=new Set,A=[],N=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(p)for(let e of Object.values(p().tasks))N(e)||w(e)&&(k.add(e.agentId),A.push(e));t(()=>[]);let{setContextBlocked:B}=(T(),e(f));B(!1),y&&y(K()),G(k),L(null),z(null),R(null),M(),d(P()),i.clear(),o?.clear(),u?.clear(),_&&_(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!N(r)){t[n]=r;continue}try{r.status===`running`&&(v(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){V(e)}O(n)}return{...e,tasks:t,attribution:g(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),a(),c(),F({setCurrentAsParent:!0}),await m();for(let e of A)e.status===`running`&&s(e.id,r(j(e.agentId)));let{saveMode:H}=(h(),e(b));H(`normal`);let W=D();W&&S(W);let q=await n(`clear`);q.length>0&&t(()=>q)}var J=t((()=>{N(),H(),_(),y(),k(),E(),x(),B(),i(),u(),p(),h(),o(),A(),W()}));export{J as n,q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$m as e,Ar as t,Aw as n,Bn as r,Kr as i,Pr as a,Qm as o,Rn as s,SS as c,Ta as l,Tw as u,Xp as d,Yi as f,_r as p,aS as m,bm as h,es as g,im as _,kr as v,ns as y,pS as b,rr as x,rs as S,sa as C,ua as w,ur as T,va as E,xm as D,xr as O,ya as k}from"./loadAgentsDir-DlPbtIsS.js";import{It as A,t as j}from"./state-B4jiUise.js";import{n as M,t as N}from"./cwd-Pa83R95t.js";import{Bt as P,zt as F}from"./settings-B2jvL8Dp.js";import{o as I,s as L}from"./log-D2TIwHBV.js";import{relative as R}from"path";M(),A(),D(),P(),g(),_(),I(),f(),n(),o(),p();function z(e){if(e.type!==`attachment`)return e;let t=e.attachment;if(t.type===`new_file`)return{...e,attachment:{...t,type:`file`,displayPath:R(N(),t.filename)}};if(t.type===`new_directory`)return{...e,attachment:{...t,type:`directory`,displayPath:R(N(),t.path)}};if(!(`displayPath`in t)){let n=`filename`in t?t.filename:`path`in t?t.path:`skillDir`in t?t.skillDir:void 0;if(n)return{...e,attachment:{...t,displayPath:R(N(),n)}}}return e}function B(e){return V(e).messages}function V(e){try{let t=e.map(z),n=new Set(F);for(let e of t)e.type===`user`&&e.permissionMode!==void 0&&!n.has(e.permissionMode)&&(e.permissionMode=void 0);let r=C(E(k(t))),i=H(r),a;if(i.kind===`interrupted_turn`){let[e]=w([b({content:`Continue from where you left off.`,isMeta:!0})]);r.push(e),a={kind:`interrupted_prompt`,message:e}}else a=i;let o=r.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`);return o!==-1&&r[o].type===`user`&&r.splice(o+1,0,m({content:c})),{messages:r,turnInterruptionState:a}}catch(e){throw L(e),e}}function H(e){if(e.length===0)return{kind:`none`};let t=e.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`&&!(e.type===`assistant`&&e.isApiErrorMessage)),n=t===-1?void 0:e[t];return!n||n.type===`assistant`?{kind:`none`}:n.type===`user`?n.isMeta||n.isCompactSummary?{kind:`none`}:l(n)?{kind:`interrupted_turn`}:{kind:`interrupted_prompt`,message:n}:n.type===`attachment`?{kind:`interrupted_turn`}:{kind:`none`}}function U(e){for(let t of e)if(t.type===`attachment`){if(t.attachment.type===`invoked_skills`){let e=t.attachment.skills;for(let t of e)t.name&&t.path&&t.content&&j(t.name,t.path,t.content,null)}t.attachment.type===`skill_listing`&&S()}S(),y()}async function W(e){let{messages:t,leafUuids:n}=await a(e),r=null,o=0;for(let e of t.values()){if(e.isSidechain||!n.has(e.uuid))continue;let t=new Date(e.timestamp).getTime();t>o&&(o=t,r=e)}return r?{messages:i(s(t,r)),sessionId:r.sessionId}:{messages:[],sessionId:void 0}}async function G(n,i){try{let a=null,o=null,s;if(n===void 0){let e=t(),n=new Set;try{let{listAllLiveSessions:e}=await import(`./udsClient-cQz6nJ_T.js`),t=await e();n=new Set(t.flatMap(e=>e.kind&&e.kind!==`interactive`&&e.sessionId?[e.sessionId]:[]))}catch{}a=(await e).find(e=>{let t=T(e);return!t||!n.has(t)})??null}else if(i){let e=await W(i);o=e.messages,s=e.sessionId}else typeof n==`string`?(a=await x(n),s=n):a=n;if(!a&&!o)return null;a&&(O(a)&&(a=await v(a)),s||(s=T(a)),s&&await u(a,h(s)),d(a),o=a.messages,r(o)),U(o);let c=V(o);o=c.messages;let l=await e(`resume`,{sessionId:s});return o.push(...l),{messages:o,turnInterruptionState:c.turnInterruptionState,fileHistorySnapshots:a?.fileHistorySnapshots,attributionSnapshots:a?.attributionSnapshots,contentReplacements:a?.contentReplacements,contextCollapseCommits:a?.contextCollapseCommits,contextCollapseSnapshot:a?.contextCollapseSnapshot,sessionId:s,agentName:a?.agentName,agentColor:a?.agentColor,agentSetting:a?.agentSetting,customTitle:a?.customTitle,tag:a?.tag,mode:a?.mode,worktreeSession:a?.worktreeSession,prNumber:a?.prNumber,prUrl:a?.prUrl,prRepository:a?.prRepository,fullPath:a?.fullPath,goal:a?.goal}}catch(e){throw L(e),e}}export{G as n,B as t};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ec as n,Lb as r,MS as i,NS as a,Rb as o,_r as s,bb as c,bi as l,kr as u,mb as d,md as f,nr as ee,pd as p,ti as te,ur as m,wc as h,xi as ne,xr as g,yr as _}from"./loadAgentsDir-DlPbtIsS.js";import{C as re,D as v,Gr as y,H as ie,I as b,P as x,T as S,Wt as C,Xn as ae,ai as w,di as oe,fi as se,hn as ce,k as le,oi as ue,ot as de,p as T,t as fe}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{It as pe,J as me,st as he}from"./state-B4jiUise.js";import{S as D,c as O,i as k,x as ge}from"./debug-Bglx1aTu.js";import{Hn as _e,Lr as ve,Vn as A,kr as ye}from"./settings-B2jvL8Dp.js";import{a as j,o as be,s as xe}from"./log-D2TIwHBV.js";import{n as Se,r as M}from"./analytics-DJobLaWP.js";import{S as Ce,_ as we,d as Te,p as Ee}from"./startupProfiler-CJdr3SxP.js";import{d as De,l as Oe}from"./model-BwBG0V1u.js";import{n as N,t as ke}from"./TextInput-CD9iau2k.js";import{n as Ae,t as P}from"./useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js";import{n as je,t as Me}from"./select-Bxf5-5sI.js";import{r as Ne,t as Pe}from"./Spinner-zYPFVFHN.js";import{l as Fe,u as Ie}from"./SpinnerGlyph-CmkRUvHe.js";import{t as Le}from"./SearchBox-C9xxQzh1.js";import{n as Re,t as ze}from"./useSearchInput-B25K1RnK.js";import{n as F,t as I}from"./Messages-K4DDsDP9.js";function Be({log:e,onExit:t,onSelect:n}){let[r,i]=L.useState(null);L.useEffect(()=>{i(null),g(e)&&u(e).then(i)},[e]);let a=g(e)&&r===null,o=r??e,s=m(o)||``,c=h();return C(`confirm:no`,t,{context:`Confirmation`}),C(`confirm:yes`,(0,L.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),a?(0,R.jsxs)(b,{flexDirection:`column`,padding:1,children:[(0,R.jsx)(T,{message:`Loading session…`}),(0,R.jsx)(x,{dimColor:!0,children:(0,R.jsx)(S,{children:(0,R.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,R.jsxs)(b,{flexDirection:`column`,children:[(0,R.jsx)(I,{messages:o.messages,tools:c,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:s,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,R.jsxs)(b,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,R.jsxs)(x,{children:[Ee(o.modified),` · `,o.messageCount,` messages`,o.gitBranch?` · ${o.gitBranch}`:``]}),(0,R.jsx)(x,{dimColor:!0,children:(0,R.jsxs)(S,{children:[(0,R.jsx)(v,{shortcut:`Enter`,action:`resume`}),(0,R.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var L,R,Ve=e((()=>{L=t(w(),1),fe(),d(),n(),we(),s(),f(),F(),R=E()}));function z(e,t){if(e===V)return 5;let n=y(e),r=t?Math.min(n,t-H-U):n;return Math.max(0,r)+H+U}function He(e,t){let n=t-H-U;return y(e)<=n?e:n<=1?e.charAt(0):Ce(e,n)}function Ue({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(Je,G),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>z(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-qe,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let ee=d,p=e.length-f,te=e.slice(d,f),m=te.map((e,t)=>d+t);return(0,B.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,B.jsx)(x,{color:`suggestion`,children:i}),ee>0&&(0,B.jsxs)(x,{dimColor:!0,children:[W,ee]}),te.map((e,t)=>{let n=m[t]===c,r=e===V?e:`#${He(e,l-H)}`;return(0,B.jsxs)(x,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),p>0?(0,B.jsxs)(x,{dimColor:!0,children:[We,p,Ge]}):(0,B.jsx)(x,{dimColor:!0,children:Ke})]})}var B,V,H,U,W,We,Ge,Ke,qe,Je,G,Ye=e((()=>{fe(),we(),B=E(),V=`All`,H=2,U=1,W=`← `,We=`→`,Ge=` (tab to cycle)`,Ke=`(tab to cycle)`,qe=5,Je=18,G=14}));function Xe({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:ee,onUpFromFirstItem:p}){let[te,m]=K.useState(new Set),h=K.useRef(!1),ne=K.useRef(null),g=K.useCallback(e=>l?l(e):te.has(e),[l,te]),_=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=g(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,g]),re=K.useCallback(e=>e?`▼ `:`▶ `,[]),v=K.useCallback(e=>` ▸ `,[]),y=f??re,ie=ee??v,x=K.useCallback(e=>{let t=``;return e.hasChildren?t=y(e.isExpanded):e.depth>0&&(t=ie(e.depth)),t+e.node.label},[y,ie]),S=K.useMemo(()=>_.map(e=>({label:x(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[_,x]),C=K.useMemo(()=>{let e=new Map;return _.forEach(t=>e.set(t.node.id,t.node)),e},[_]),ae=K.useCallback(e=>_.find(t=>t.node.id===e),[_]),w=K.useCallback((e,t)=>{ae(e)?.hasChildren&&(t?u?u(e):m(t=>new Set(t).add(e)):d?d(e):m(t=>{let n=new Set(t);return n.delete(e),n}))},[ae,u,d]);return(0,Ze.jsx)(b,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=ae(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),w(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),w(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,w(t.parentId,!1),r)){let e=C.get(t.parentId);e&&r(e)}}}},children:(0,Ze.jsx)(Me,{options:S,onChange:K.useCallback(e=>{let n=C.get(e);n&&t(n)},[C,t]),onFocus:K.useCallback(e=>{if(h.current){h.current=!1;return}if(ne.current!==e&&(ne.current=e,r)){let t=C.get(e);t&&r(t)}},[r,C]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:p})})}var K,Ze,Qe=e((()=>{K=t(w(),1),fe(),je(),Ze=E()}));function $e(e,t){return Ce(e.replace(/\s+/g,` `).trim(),t)}function et({before:e,match:t,after:n},r){return oe.dim(e)+r(t)+oe.dim(n)}function tt(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function nt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?lt:i?ut:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${$e(j(e),l)}${c}${s}`}function rt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Te(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function it({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:i,onLogsChanged:a,onLoadMore:o,initialSearchQuery:s,showAllProjects:c=!1,onToggleAllProjects:u,onAgenticSearch:d}){let f=de(),h=n===void 0?f.columns:n,ne=Ae(r),g=ae(),y=_(),[w]=ie(),oe=Fe(w),se=q.useMemo(()=>e=>ue(e,oe.warning),[oe.warning]),[T,fe]=q.useState(null),[E,pe]=q.useState(!1),[D,O]=q.useState(!1),[k,ge]=q.useState(!1),_e=q.useMemo(()=>me(),[]),[ve,A]=q.useState(``),[be,xe]=q.useState(0),[Se,Ce]=q.useState(new Set),[we,Ee]=q.useState(null),[De,Oe]=q.useState(1),[N,P]=q.useState(`list`),[je,Ne]=q.useState(null),Ie=q.useRef(null),[Le,ze]=q.useState(0),[F,I]=q.useState({status:`idle`}),[L,R]=q.useState(!1),Ve=q.useRef(null),{query:z,setQuery:He,cursorOffset:B}=Re({isActive:N===`search`&&F.status!==`searching`,onExit:()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:s||``}),V=q.useDeferredValue(z),[H,U]=q.useState(``);q.useEffect(()=>{if(!V){U(``);return}let e=setTimeout(U,300,V);return()=>clearTimeout(e)},[V]);let[W,We]=q.useState(null),[Ge,Ke]=q.useState(!1);q.useEffect(()=>{ye().then(e=>fe(e)),l(_e).then(e=>{ge(e.length>1)})},[_e]);let qe=q.useMemo(()=>new Map(e.map(e=>[e,ot(e)])),[e]),Je=q.useMemo(()=>null,[e,qe,!1]),G=q.useMemo(()=>ct(e),[e]),Ye=G.length>0,K=q.useMemo(()=>Ye?[`All`,...G]:[],[Ye,G]),Ze=K.length>0&&Le<K.length?Le:0,Qe=K[Ze],it=Qe===`All`?void 0:Qe,at=+!!Ye,lt=q.useMemo(()=>{let t=e;return y&&(t=e.filter(e=>{let t=he(),n=m(e);return!!(t&&n===t||e.customTitle||ee(e.messages)||e.firstPrompt||e.customTitle)})),it!==void 0&&(t=t.filter(e=>e.tag===it)),E&&T&&(t=t.filter(e=>e.gitBranch===T)),k&&!D&&(t=t.filter(e=>e.projectPath===_e)),t},[e,y,it,E,T,k,D,_e]),ut=q.useMemo(()=>{if(!z)return lt;let e=z.toLowerCase();return lt.filter(t=>{let n=j(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[lt,z]);q.useEffect(()=>{},[V,H,!1]),q.useEffect(()=>{We(null),Ke(!1)},[H,Je,!1]);let{filteredLogs:dt,snippets:Y}=q.useMemo(()=>{let e=new Map,t=ut;if(W&&H&&W.query===H){for(let t of W.results)if(t.searchableText){let n=tt(t.searchableText,H,ft);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=W.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ut,W,H]),X=q.useMemo(()=>F.status===`results`&&F.results.length>0?F.results:dt,[F,dt]),Z=Math.max(30,h-4),pt=q.useMemo(()=>{if(!y)return[];let e=st(X);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=X.indexOf(n),i=Y.get(n),a=i?et(i,se):null;if(t.length===1){let t=rt(n,{showProjectPath:c});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:nt(n,Z),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=X.indexOf(t),i=Y.get(t),a=i?et(i,se):null,o=rt(t,{isChild:!0,showProjectPath:c});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:nt(t,Z,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),l=rt(n,{showProjectPath:c});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:nt(n,Z,{isGroupHeader:!0,forkCount:o}),description:a?`${l}\n ${a}`:l,dimDescription:!0,children:s}})},[y,X,Z,c,Y,se]),mt=q.useMemo(()=>y?[]:X.map((e,t)=>{let n=$e(j(e)+(e.isSidechain?` (sidechain)`:``),Z),r=Te(e),i=c&&e.projectPath?` · ${e.projectPath}`:``,a=Y.get(e),o=a?et(a,se):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[y,X,se,Z,c,Y]),Q=we?.value.log??null,ht=()=>{if(!y||!Q)return``;let e=m(Q);if(!e)return``;let t=X.filter(t=>m(t)===e);if(!(t.length>1))return``;let n=Se.has(e);return t.indexOf(Q)>0||n?`← to collapse`:`→ to expand`},gt=q.useCallback(async()=>{let e=Q?m(Q):void 0;if(!Q||!e){P(`list`),A(``);return}ve.trim()&&(await te(e,ve.trim(),Q.fullPath),y&&a&&a()),P(`list`),A(``)},[Q,ve,a,y]),_t=q.useCallback(()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},[]),vt=q.useCallback(()=>{P(`search`),M(`tengu_session_search_toggled`,{enabled:!0})},[]),yt=q.useCallback(async()=>{if(!z.trim()||!d||!0)return;Ve.current?.abort();let t=new AbortController;Ve.current=t,I({status:`searching`}),M(`tengu_agentic_search_started`,{query_length:z.length});try{let n=await d(z,e,t.signal);if(t.signal.aborted)return;I({status:`results`,results:n,query:z}),M(`tengu_agentic_search_completed`,{query_length:z.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;I({status:`error`,message:e instanceof Error?e.message:`Search failed`}),M(`tengu_agentic_search_error`,{query_length:z.length})}},[z,d,!1,e]);q.useEffect(()=>{F.status!==`idle`&&F.status!==`searching`&&(F.status===`results`&&F.query!==z||F.status===`error`)&&I({status:`idle`})},[z,F]),q.useEffect(()=>()=>{Ve.current?.abort()},[]);let bt=q.useRef(F.status);q.useEffect(()=>{let e=bt.current;if(bt.current=F.status,e===`searching`&&F.status===`results`){if(y&&pt.length>0)Ee(pt[0]);else if(!y&&X.length>0){let e=X[0];Ee({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[F.status,y,pt,X]);let xt=q.useCallback(e=>{let t=parseInt(e,10),n=X[t];!n||Ie.current===t.toString()||(Ie.current=t.toString(),Ee({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Oe(t+1))},[X]),St=q.useCallback(e=>{Ee(e);let t=X.findIndex(t=>m(t)===m(e.value.log));t>=0&&Oe(t+1)},[X]);C(`confirm:no`,()=>{Ve.current?.abort(),I({status:`idle`}),M(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:N!==`preview`&&F.status===`searching`}),C(`confirm:no`,()=>{P(`list`),A(``)},{context:`Settings`,isActive:N===`rename`&&F.status!==`searching`}),C(`confirm:no`,()=>{He(``),R(!1),r?.()},{context:`Confirmation`,isActive:N!==`preview`&&N!==`rename`&&N!==`search`&&L&&F.status!==`searching`}),ce((e,t)=>{if(N!==`preview`&&F.status!==`searching`&&N!==`rename`)if(N===`search`)e.toLowerCase()===`n`&&t.ctrl?_t():(t.return||t.downArrow)&&z.trim();else{if(L){if(t.return){yt(),R(!1);return}else if(t.downArrow){R(!1);return}else if(t.upArrow){P(`search`),R(!1);return}}if(Ye&&t.tab){let e=t.shift?-1:1;ze(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length,r=K[n];return M(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:G.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&u)u(),M(`tengu_session_all_projects_toggled`,{enabled:!c});else if(r===`b`&&t.ctrl){let e=!E;pe(e),M(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&k){let e=!D;O(e),M(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(P(`search`),M(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&Q?(P(`rename`),A(``),M(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&Q?(Ne(Q),P(`preview`),M(`tengu_session_preview_opened`,{messageCount:Q.messageCount})):Q&&n&&e.length>0&&!/^\s+$/.test(e)&&(P(`search`),He(e),M(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let Ct=[];E&&T&&Ct.push(T),k&&!D&&Ct.push(`current worktree`);let wt=8+ +(Ct.length>0&&N!==`search`)+at,$=Math.max(1,Math.floor((t-wt-2)/3));return q.useEffect(()=>{if(!o)return;let e=$*2;De+e>=X.length&&o($*3)},[De,$,X.length,o]),e.length===0?null:N===`preview`&&je&&y?(0,J.jsx)(Be,{log:je,onExit:()=>{P(`list`),Ne(null)},onSelect:i}):(0,J.jsxs)(b,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(b,{flexShrink:0,children:(0,J.jsx)(re,{color:`suggestion`})}),(0,J.jsx)(b,{flexShrink:0,children:(0,J.jsx)(x,{children:` `})}),Ye?(0,J.jsx)(Ue,{tabs:K,selectedIndex:Ze,availableWidth:h,showAllProjects:c}):(0,J.jsx)(b,{flexShrink:0,children:(0,J.jsxs)(x,{bold:!0,color:`suggestion`,children:[`Resume Session`,N===`list`&&X.length>$&&(0,J.jsxs)(x,{dimColor:!0,children:[` `,`(`,De,` of `,X.length,`)`]})]})}),(0,J.jsx)(le,{query:z,isFocused:N===`search`,isTerminalFocused:g,cursorOffset:B}),Ct.length>0&&N!==`search`&&(0,J.jsx)(b,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsx)(S,{children:Ct})})}),(0,J.jsx)(b,{flexShrink:0,children:(0,J.jsx)(x,{children:` `})}),F.status===`searching`&&(0,J.jsxs)(b,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(Pe,{}),(0,J.jsx)(x,{children:` Searching…`})]}),F.status===`results`&&F.results.length>0&&(0,J.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(x,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),F.status===`results`&&F.results.length===0&&dt.length===0&&(0,J.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(x,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),F.status===`error`&&dt.length===0&&(0,J.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(x,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!z.trim()&&d&&!1,F.status===`searching`?null:N===`rename`&&Q?(0,J.jsxs)(b,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(x,{bold:!0,children:`Rename session:`}),(0,J.jsx)(b,{paddingTop:1,children:(0,J.jsx)(ke,{value:ve,onChange:A,onSubmit:gt,placeholder:j(Q,`Enter new session name`),columns:h,cursorOffset:be,onChangeCursorOffset:xe,showCursor:!0})})]}):y?(0,J.jsx)(Xe,{nodes:pt,onSelect:e=>{i(e.value.log)},onFocus:St,onCancel:r,focusNodeId:we?.id,visibleOptionCount:$,layout:`expanded`,isDisabled:N===`search`||L,hideIndexes:!1,isNodeExpanded:e=>{if(N===`search`||E)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Se.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Ce(e=>new Set(e).add(t)),M(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Ce(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:vt}):(0,J.jsx)(Me,{options:mt,onChange:e=>{let t=X[parseInt(e,10)];t&&i(t)},visibleOptionCount:$,onCancel:r,onFocus:xt,defaultFocusValue:we?.id.toString(),layout:`expanded`,isDisabled:N===`search`||L,onUpFromFirstItem:vt}),(0,J.jsx)(b,{paddingLeft:2,children:ne.pending?(0,J.jsxs)(x,{dimColor:!0,children:[`Press `,ne.keyName,` again to exit`]}):N===`rename`?(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsxs)(S,{children:[(0,J.jsx)(v,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):F.status===`searching`?(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsxs)(S,{children:[(0,J.jsx)(x,{children:`Searching with Work Mate…`}),(0,J.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):L?(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsxs)(S,{children:[(0,J.jsx)(v,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(v,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):N===`search`?(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsxs)(S,{children:[(0,J.jsx)(x,{children:`Type to Search`}),(0,J.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(x,{dimColor:!0,children:(0,J.jsxs)(S,{children:[u&&(0,J.jsx)(v,{shortcut:`Ctrl+A`,action:`show ${c?`current dir`:`all projects`}`}),T&&(0,J.jsx)(v,{shortcut:`Ctrl+B`,action:`toggle branch`}),k&&(0,J.jsx)(v,{shortcut:`Ctrl+W`,action:`show ${D?`current worktree`:`all worktrees`}`}),(0,J.jsx)(v,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(v,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(x,{children:`Type to search`}),(0,J.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),ht()&&(0,J.jsx)(x,{children:ht()})]})})})]})}function at(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ot(e){let t=(e.messages.length<=dt?e.messages:[...e.messages.slice(0,Y),...e.messages.slice(-1e3)]).map(at).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>X?n.slice(0,X):n}function st(e){let t=new Map;for(let n of e){let e=m(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ct(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,lt,ut,dt,Y,X,ft,Z=e((()=>{se(),q=t(w(),1),pe(),P(),ze(),c(),fe(),d(),Se(),we(),ne(),ve(),be(),s(),Ie(),f(),je(),Le(),Ve(),Ne(),Ye(),N(),Qe(),J=E(),lt=2,ut=4,dt=2e3,Y=1e3,X=5e4,ft=50}));function pt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function mt(e){if(e.length===0)return``;let t=(e.length<=_t?e:[...e.slice(0,_t/2),...e.slice(-100/2)]).map(pt).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>gt?`${t.slice(0,gt)}…`:t}function Q(e,t){return!!(j(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&mt(e.messages).toLowerCase().includes(t))}async function ht(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>Q(e,r)),o;if(i.length>=vt)o=i.slice(0,vt);else{let e=t.filter(e=>!Q(e,r)),n=vt-i.length;o=[...i,...e.slice(0,n)]}O(`Agentic search: ${o.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${A(o,e=>e.messages?.length>0)}`);let s=o.map(async e=>{if(g(e))try{return await u(e)}catch(t){return xe(t),e}return e}),c=await Promise.all(s);O(`Agentic search: loaded ${A(c,e=>e.messages?.length>0)}/${o.length} logs with transcripts`);let l=`Sessions:
|
|
2
|
+
${c.map((e,t)=>{let n=[`${t}:`],r=j(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=mt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
Search query: "${e}"
|
|
6
|
+
|
|
7
|
+
Find the sessions that are most relevant to this query.`;O(`Agentic search prompt (first 500 chars): ${l.slice(0,500)}...`);try{let e=Oe();O(`Agentic search using model: ${e}`);let t=(await a({model:e,system:yt,messages:[{role:`user`,content:l}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return O(`No text content in agentic search response`),[];O(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return O(`Could not find JSON in agentic search response`),[];let i=(D(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<c.length).map(e=>c[e]);return O(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return xe(e),O(`Agentic search error: ${e}`),[]}}var gt,_t,vt,yt,bt=e((()=>{_e(),k(),be(),De(),s(),i(),ge(),gt=2e3,_t=100,vt=100,yt=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
+
|
|
9
|
+
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
+
|
|
11
|
+
Each session may include:
|
|
12
|
+
- Title (display name or custom title)
|
|
13
|
+
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
+
- Branch (git branch name, shown as [branch: name])
|
|
15
|
+
- Summary (AI-generated summary)
|
|
16
|
+
- First message (beginning of the conversation)
|
|
17
|
+
- Transcript (excerpt of conversation content)
|
|
18
|
+
|
|
19
|
+
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
+
|
|
21
|
+
For each session, consider (in order of priority):
|
|
22
|
+
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
+
2. Partial tag matches or tag-related terms
|
|
24
|
+
3. Title matches (custom titles or first message content)
|
|
25
|
+
4. Branch name matches
|
|
26
|
+
5. Summary and transcript content matches
|
|
27
|
+
6. Semantic similarity and related concepts
|
|
28
|
+
|
|
29
|
+
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
+
- Contain the query term anywhere in any field
|
|
31
|
+
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
+
- Discuss topics that could be related to the query
|
|
33
|
+
- Have transcripts that mention the concept even in passing
|
|
34
|
+
|
|
35
|
+
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
+
|
|
37
|
+
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
+
|
|
39
|
+
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
+
{"relevant_indices": [2, 5, 0]}`}));function xt(e,t){let n=me();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=m(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${o([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var St=e((()=>{pe(),r(),s()}));export{it as a,bt as i,St as n,Z as o,ht as r,xt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./cwd-Pa83R95t.js";e();export{t as getCwd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{E as t,It as n,J as r}from"./state-B4jiUise.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??t()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{n(),c=new i}));export{a as i,l as n,o as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{Z as r,et as i}from"./esm-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{Z as r,et as i}from"./esm-eTAUP-La.js";import{n as a,t as o}from"./axios-DaWTGg7G.js";import{p as s,u as c}from"./config-C-Y2qtB2.js";import{o as l,s as u}from"./log-D2TIwHBV.js";import{D as d,M as f,Yt as p,Zt as m,d as h,t as g}from"./model-BwBG0V1u.js";import{d as _,f as v}from"./firstPartyEventLogger-M6UMli2c.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await a.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){u(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(p()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...i}=await r({model:t.model,betas:t.betas}),a={...i,...n,...t,userBucket:R()};if(typeof a.toolName==`string`&&a.toolName.startsWith(`mcp__`)&&(a.toolName=`mcp`),typeof a.model==`string`){let e=g(a.model.replace(/\[1m]$/i,``));a.model=e in d?e:`other`}if(typeof a.version==`string`&&(a.version=a.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),a.status!==void 0&&a.status!==null){let e=String(a.status);a.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(a.http_status_range=`${t}xx`),delete a.status}let o=a,s={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>o[e]!==void 0&&o[e]!==null).map(e=>`${b(e)}:${o[e]}`)].join(`,`),message:e,service:`workmate`,hostname:`workmate`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(a))t!=null&&(s[b(e)]=t);N.push(s),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){u(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{o(),n(),s(),l(),h(),m(),f(),_(),i(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`tengu_api_error.tengu_api_success.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(v()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return u(e),F=!1,!1}}),L=30,R=t(()=>{let e=c(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{C as n,w as r,z as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Ut as l,ft as u}from"./state-D5D6QpTX.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function it(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),ut=()=>lt??(lt=ot())}));function ft(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function pt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gt(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var xt=e((()=>{S()}));function St(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function kt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DfkgIdYf.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{It as l,st as u}from"./state-B4jiUise.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function it(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),ut=()=>lt??(lt=ot())}));function ft(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function pt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gt(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var xt=e((()=>{S()}));function St(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function kt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
|
|
2
2
|
`):[]}},w=new WeakMap,T=new WeakMap,At.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),At.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));function Mt(){}function Nt(e,t,n){return!t||Pt[e]>Pt[n]?Mt:t[e].bind(t)}function E(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return It;let r=Lt.get(t);if(r&&r[0]===n)return r[1];let i={error:Nt(`error`,t,n),warn:Nt(`warn`,t,n),info:Nt(`info`,t,n),debug:Nt(`debug`,t,n)};return Lt.set(t,[n,i]),i}var Pt,Ft,It,Lt,D,Rt=e((()=>{$e(),Pt={off:0,error:200,warn:300,info:400,debug:500},Ft=(e,t,n)=>{if(e){if(Ke(Pt,e))return e;E(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Pt))}`)}},It={error:Mt,warn:Mt,info:Mt,debug:Mt},Lt=new WeakMap,D=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t]))),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e)}));async function*zt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new v(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new v(`Attempted to iterate over a response with no body`);let n=new Wt,r=new At,i=ht(e.body);for await(let e of Bt(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Bt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?Ct(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=kt(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Vt(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ht,Ut,Wt,Gt=e((()=>{_(),S(),_t(),jt(),Pe(),$e(),Dt(),Rt(),Ut=class e{constructor(e,t,n){this.iterator=e,Ht.set(this,void 0),this.controller=t,h(this,Ht,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?E(r):console;async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of zt(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=Qe(e.data)??e.data,r=n?.error?.type;throw new y(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new At,n=ht(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ht=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,g(this,Ht,`f`)),new e(()=>i(n),this.controller,g(this,Ht,`f`))]}toReadableStream(){let e=this,t;return pt({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=Ct(JSON.stringify(n)+`
|
|
4
4
|
`);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Wt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -32,8 +32,8 @@ If you understand the risks and have appropriate mitigations in place,
|
|
|
32
32
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
33
33
|
|
|
34
34
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
35
|
-
`);this.baseURL=i.baseURL,this.timeout=i.timeout??zi.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a=`warn`;this.logLevel=a,this.logLevel=Ft(i.logLevel,`ClientOptions.logLevel`,this)??Ft(Ii(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??ft(),h(this,Bi,vt,`f`),this._options=i,this.apiKey=typeof t==`string`?t:null,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))&&!(this.apiKey&&e.get(`x-api-key`))&&!t.has(`x-api-key`)&&!(this.authToken&&e.get(`authorization`))&&!t.has(`authorization`))throw Error(`Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}async authHeaders(e){return M([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return M([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return bt(e)}getUserAgent(){return`${this.constructor.name}/JS ${C}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ae()}`}makeStatusError(e,t,n,r){return y.generate(e,t,n,r)}buildURL(e,t,n){let r=!g(this,Ri,`m`,Vi).call(this)&&n||this.baseURL,i=Je(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!Ge(a)||!Ge(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details`);return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Xt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??(t=i),await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(E(this).debug(`[${c}] sending request`,D({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new b;let ee=new AbortController,d=await this.fetchWithTimeout(o,a,s,ee).catch(Ne),f=Date.now();if(d instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new b;let i=Me(d)||/timed? ?out/i.test(String(d)+(`cause`in d?String(d.cause):``));if(t)return E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),this.retryRequest(r,t,n??c);throw E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),i?new Fe:new x({cause:d})}let p=`[${c}${l}${[...d.headers.entries()].filter(([e])=>e===`request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${d.ok?`succeeded`:`failed`} with status ${d.status} in ${f-u}ms`;if(!d.ok){let e=await this.shouldRetry(d);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await gt(d.body),E(this).info(`${p} - ${e}`),E(this).debug(`[${c}] response error (${e})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),this.retryRequest(r,t,n??c,d.headers)}let i=e?`error; no more retries left`:`error; not retryable`;E(this).info(`${p} - ${i}`);let a=await d.text().catch(e=>Ne(e).message),o=Qe(a),s=o?void 0:a;throw E(this).debug(`[${c}] response error (${i})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(d.status,o,s,d.headers)}return E(this).info(p),E(this).debug(`[${c}] response start`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),{response:d,options:r,controller:ee,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new en(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener(`abort`,s,{once:!0});let c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:`half`}:{},method:`GET`,...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await et(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}calculateNonstreamingTimeout(e,t){let n=600*1e3;if(36e5*e/128e3>n||t!=null&&e>t)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details`);return n}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&Ze(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=M([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ut(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":`true`}:void 0,"anthropic-version":`2023-06-01`},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=M([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:mt(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:g(this,Bi,`f`).call(this,{body:e,headers:n})}},zi=Z,Bi=new WeakMap,Ri=new WeakSet,Vi=function(){return this.baseURL!==`https://api.anthropic.com`},Z.Anthropic=zi,Z.HUMAN_PROMPT=Hi,Z.AI_PROMPT=Ui,Z.DEFAULT_TIMEOUT=6e5,Z.AnthropicError=v,Z.APIError=y,Z.APIConnectionError=x,Z.APIConnectionTimeoutError=Fe,Z.APIUserAbortError=b,Z.NotFoundError=ze,Z.ConflictError=Be,Z.RateLimitError=He,Z.BadRequestError=Ie,Z.AuthenticationError=Le,Z.InternalServerError=Ue,Z.PermissionDeniedError=Re,Z.UnprocessableEntityError=Ve,Z.toFile=mn,Wi=class extends Z{constructor(){super(...arguments),this.completions=new Xr(this),this.messages=new ki(this),this.models=new Ni(this),this.beta=new K(this)}},Wi.Completions=Xr,Wi.Messages=ki,Wi.Models=Ni,Wi.Beta=K})),Ki=e((()=>{Gi(),xn(),Zt(),O(),S()}));function qi(e){return e instanceof aa||e instanceof b||e instanceof Error&&e.name===`AbortError`}function Ji(e,t){return e instanceof Error&&e.message===t}function Yi(e){return e instanceof Error?e:Error(String(e))}function Xi(e){return e instanceof Error?e.message:String(e)}function Zi(e){if(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`)return e.code}function Qi(e){return Zi(e)===`ENOENT`}function $i(e){if(e&&typeof e==`object`&&`path`in e&&typeof e.path==`string`)return e.path}function ea(e,t=5){if(!(e instanceof Error))return String(e);if(!e.stack)return e.message;let n=e.stack.split(`
|
|
35
|
+
`);this.baseURL=i.baseURL,this.timeout=i.timeout??zi.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a=`warn`;this.logLevel=a,this.logLevel=Ft(i.logLevel,`ClientOptions.logLevel`,this)??Ft(Ii(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??ft(),h(this,Bi,vt,`f`),this._options=i,this.apiKey=typeof t==`string`?t:null,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))&&!(this.apiKey&&e.get(`x-api-key`))&&!t.has(`x-api-key`)&&!(this.authToken&&e.get(`authorization`))&&!t.has(`authorization`))throw Error(`Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}async authHeaders(e){return M([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return M([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return bt(e)}getUserAgent(){return`${this.constructor.name}/JS ${C}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ae()}`}makeStatusError(e,t,n,r){return y.generate(e,t,n,r)}buildURL(e,t,n){let r=!g(this,Ri,`m`,Vi).call(this)&&n||this.baseURL,i=Je(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!Ge(a)||!Ge(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details`);return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Xt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??(t=i),await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(E(this).debug(`[${c}] sending request`,D({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new b;let ee=new AbortController,d=await this.fetchWithTimeout(o,a,s,ee).catch(Ne),f=Date.now();if(d instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new b;let i=Me(d)||/timed? ?out/i.test(String(d)+(`cause`in d?String(d.cause):``));if(t)return E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),this.retryRequest(r,t,n??c);throw E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),i?new Fe:new x({cause:d})}let p=`[${c}${l}${[...d.headers.entries()].filter(([e])=>e===`request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${d.ok?`succeeded`:`failed`} with status ${d.status} in ${f-u}ms`;if(!d.ok){let e=await this.shouldRetry(d);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await gt(d.body),E(this).info(`${p} - ${e}`),E(this).debug(`[${c}] response error (${e})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),this.retryRequest(r,t,n??c,d.headers)}let i=e?`error; no more retries left`:`error; not retryable`;E(this).info(`${p} - ${i}`);let a=await d.text().catch(e=>Ne(e).message),o=Qe(a),s=o?void 0:a;throw E(this).debug(`[${c}] response error (${i})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(d.status,o,s,d.headers)}return E(this).info(p),E(this).debug(`[${c}] response start`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),{response:d,options:r,controller:ee,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new en(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener(`abort`,s,{once:!0});let c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:`half`}:{},method:`GET`,...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await et(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}calculateNonstreamingTimeout(e,t){let n=600*1e3;if(36e5*e/128e3>n||t!=null&&e>t)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details`);return n}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&Ze(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=M([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ut(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":`true`}:void 0,"anthropic-version":`2023-06-01`},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=M([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:mt(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:g(this,Bi,`f`).call(this,{body:e,headers:n})}},zi=Z,Bi=new WeakMap,Ri=new WeakSet,Vi=function(){return this.baseURL!==`https://api.anthropic.com`},Z.Anthropic=zi,Z.HUMAN_PROMPT=Hi,Z.AI_PROMPT=Ui,Z.DEFAULT_TIMEOUT=6e5,Z.AnthropicError=v,Z.APIError=y,Z.APIConnectionError=x,Z.APIConnectionTimeoutError=Fe,Z.APIUserAbortError=b,Z.NotFoundError=ze,Z.ConflictError=Be,Z.RateLimitError=He,Z.BadRequestError=Ie,Z.AuthenticationError=Le,Z.InternalServerError=Ue,Z.PermissionDeniedError=Re,Z.UnprocessableEntityError=Ve,Z.toFile=mn,Wi=class extends Z{constructor(){super(...arguments),this.completions=new Xr(this),this.messages=new ki(this),this.models=new Ni(this),this.beta=new K(this)}},Wi.Completions=Xr,Wi.Messages=ki,Wi.Models=Ni,Wi.Beta=K})),Ki=e((()=>{Gi(),xn(),Zt(),O(),S()}));function qi(e){return e instanceof ia||e instanceof b||e instanceof Error&&e.name===`AbortError`}function Ji(e,t){return e instanceof Error&&e.message===t}function Yi(e){return e instanceof Error?e:Error(String(e))}function Xi(e){return e instanceof Error?e.message:String(e)}function Zi(e){if(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`)return e.code}function Qi(e){return Zi(e)===`ENOENT`}function $i(e){if(e&&typeof e==`object`&&`path`in e&&typeof e.path==`string`)return e.path}function ea(e,t=5){if(!(e instanceof Error))return String(e);if(!e.stack)return e.message;let n=e.stack.split(`
|
|
36
36
|
`),r=n[0]??e.message,i=n.slice(1).filter(e=>e.trim().startsWith(`at `));return i.length<=t?e.stack:[r,...i.slice(0,t)].join(`
|
|
37
|
-
`)}function ta(e){let t=Zi(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}
|
|
38
|
-
`);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var
|
|
39
|
-
`)&&(e=
|
|
37
|
+
`)}function ta(e){let t=Zi(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}var na,ra,ia,aa,oa,sa,ca=e((()=>{Ki(),s(),na=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},ra=class extends Error{},ia=class extends Error{constructor(e){super(e),this.name=`AbortError`}},aa=class extends Error{constructor(e,t,n){super(e),c(this,`filePath`,void 0),c(this,`defaultConfig`,void 0),this.name=`ConfigParseError`,this.filePath=t,this.defaultConfig=n}},oa=class extends Error{constructor(e,t,n,r){super(`Shell command failed`),c(this,`stdout`,void 0),c(this,`stderr`,void 0),c(this,`code`,void 0),c(this,`interrupted`,void 0),this.stdout=e,this.stderr=t,this.code=n,this.interrupted=r,this.name=`ShellError`}},sa=class extends Error{constructor(e,t){super(e),c(this,`telemetryMessage`,void 0),this.name=`TelemetrySafeError`,this.telemetryMessage=t??e}}}));function la(){return pa}function ua(e,t,n){return Q`JSON.stringify(${e})`,JSON.stringify(e,t,n)}function da(e,t){return Q`structuredClone(${e})`,structuredClone(e,t)}function fa(e,t,n){if(Q`fs.writeFileSync(${e}, ${t})`,typeof n==`object`&&n&&`flush`in n&&n.flush===!0){let r=typeof n==`object`&&`encoding`in n?n.encoding:void 0,i=typeof n==`object`&&`mode`in n?n.mode:void 0,a;try{a=oe(e,`w`,i),se(a,t,{encoding:r??void 0}),ae(a)}finally{a!==void 0&&ie(a)}}else se(e,t,n)}var pa,Q,ma,ha=e((()=>{l(),Ya(),(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),pa={[Symbol.dispose](){}},Q=la,ma=(e,t)=>(Q`JSON.parse(${e})`,t===void 0?JSON.parse(e):JSON.parse(e,t))}));function ga(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var _a=e((()=>{}));function va(e,t){if(t.startsWith(`//`)||t.startsWith(`\\\\`))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};try{let n=e.lstatSync(t);if(n.isFIFO()||n.isSocket()||n.isCharacterDevice()||n.isBlockDevice())return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function ya(e,t,n){let{resolvedPath:r}=va(e,t);return n.has(r)?!0:(n.add(r),!1)}function ba(e,t){let n=t,r=[];for(;n!==p.dirname(n);){let t;try{t=e.lstatSync(n)}catch{r.unshift(p.basename(n)),n=p.dirname(n);continue}if(t.isSymbolicLink())try{let t=e.realpathSync(n);return r.length===0?t:p.join(t,...r)}catch{let t=e.readlinkSync(n),i=p.isAbsolute(t)?t:p.resolve(p.dirname(n),t);return r.length===0?i:p.join(i,...r)}try{let t=e.realpathSync(n);if(t!==n)return r.length===0?t:p.join(t,...r)}catch{}return}}function xa(e){let t=e;t===`~`?t=f().normalize(`NFC`):t.startsWith(`~/`)&&(t=p.join(f().normalize(`NFC`),t.slice(2)));let n=new Set,r=Sa();if(n.add(t),t.startsWith(`//`)||t.startsWith(`\\\\`))return Array.from(n);try{let e=t,i=new Set;for(let a=0;a<40&&!i.has(e);a++){if(i.add(e),!r.existsSync(e)){if(e===t){let e=ba(r,t);e!==void 0&&n.add(e)}break}let a=r.lstatSync(e);if(a.isFIFO()||a.isSocket()||a.isCharacterDevice()||a.isBlockDevice()||!a.isSymbolicLink())break;let o=r.readlinkSync(e),s=p.isAbsolute(o)?o:p.resolve(p.dirname(e),o);n.add(s),e=s}}catch{}let{resolvedPath:i,isSymlink:a}=va(r,t);return a&&i!==t&&n.add(i),Array.from(n)}function Sa(){return Da}async function Ca(e,t,n){try{var r=ga();let i=r.a(await ue(e,`r`)),a=(await i.stat()).size;if(a<=t)return null;let o=Math.min(a-t,n),s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await i.read(s,c,o-c,t+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:a}}catch(e){r.e=e}finally{await r.d()}}async function wa(e,t){try{var n=ga();let r=n.a(await ue(e,`r`)),i=(await r.stat()).size;if(i===0)return{content:``,bytesRead:0,bytesTotal:0};let a=Math.max(0,i-t),o=i-a,s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await r.read(s,c,o-c,a+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:i}}catch(e){n.e=e}finally{await n.d()}}async function*Ta(e){let t=1024*4,n=await ue(e,`r`);try{let e=(await n.stat()).size,r=Buffer.alloc(0),i=Buffer.alloc(t);for(;e>0;){let a=Math.min(t,e);e-=a,await n.read(i,0,a,e);let o=Buffer.concat([i.subarray(0,a),r]),s=o.indexOf(10);if(s===-1){r=o;continue}r=Buffer.from(o.subarray(0,s));let c=o.toString(`utf8`,s+1).split(`
|
|
38
|
+
`);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var Ea,Da,Oa=e((()=>{ca(),ha(),_a(),Ea={cwd(){return process.cwd()},existsSync(e){return Q`fs.existsSync(${e})`,m.existsSync(e)},async stat(e){return ge(e)},async readdir(e){return fe(e,{withFileTypes:!0})},async unlink(e){return ve(e)},async rmdir(e){return he(e)},async rm(e,t){return me(e,t)},async mkdir(e,t){try{await le(e,{recursive:!0,...t})}catch(e){if(Zi(e)!==`EEXIST`)throw e}},async readFile(e,t){return de(e,{encoding:t.encoding})},async rename(e,t){return pe(e,t)},statSync(e){return Q`fs.statSync(${e})`,m.statSync(e)},lstatSync(e){return Q`fs.lstatSync(${e})`,m.lstatSync(e)},readFileSync(e,t){return Q`fs.readFileSync(${e})`,m.readFileSync(e,{encoding:t.encoding})},readFileBytesSync(e){return Q`fs.readFileBytesSync(${e})`,m.readFileSync(e)},readSync(e,t){Q`fs.readSync(${e}, ${t.length} bytes)`;let n;try{n=m.openSync(e,`r`);let r=Buffer.alloc(t.length);return{buffer:r,bytesRead:m.readSync(n,r,0,t.length,0)}}finally{n&&m.closeSync(n)}},appendFileSync(e,t,n){if(Q`fs.appendFileSync(${e}, ${t.length} chars)`,n?.mode!==void 0)try{let r=m.openSync(e,`ax`,n.mode);try{m.appendFileSync(r,t)}finally{m.closeSync(r)}return}catch(e){if(Zi(e)!==`EEXIST`)throw e}m.appendFileSync(e,t)},copyFileSync(e,t){Q`fs.copyFileSync(${e} → ${t})`,m.copyFileSync(e,t)},unlinkSync(e){Q`fs.unlinkSync(${e})`,m.unlinkSync(e)},renameSync(e,t){Q`fs.renameSync(${e} → ${t})`,m.renameSync(e,t)},linkSync(e,t){Q`fs.linkSync(${e} → ${t})`,m.linkSync(e,t)},symlinkSync(e,t,n){Q`fs.symlinkSync(${e} → ${t})`,m.symlinkSync(e,t,n)},readlinkSync(e){return Q`fs.readlinkSync(${e})`,m.readlinkSync(e)},realpathSync(e){return Q`fs.realpathSync(${e})`,m.realpathSync(e).normalize(`NFC`)},mkdirSync(e,t){Q`fs.mkdirSync(${e})`;let n={recursive:!0};t?.mode!==void 0&&(n.mode=t.mode);try{m.mkdirSync(e,n)}catch(e){if(Zi(e)!==`EEXIST`)throw e}},readdirSync(e){return Q`fs.readdirSync(${e})`,m.readdirSync(e,{withFileTypes:!0})},readdirStringSync(e){return Q`fs.readdirStringSync(${e})`,m.readdirSync(e)},isDirEmptySync(e){return Q`fs.isDirEmptySync(${e})`,this.readdirSync(e).length===0},rmdirSync(e){Q`fs.rmdirSync(${e})`,m.rmdirSync(e)},rmSync(e,t){Q`fs.rmSync(${e})`,m.rmSync(e,t)},createWriteStream(e){return m.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return de(e);let n=await ue(e,`r`);try{let{size:e}=await n.stat(),r=Math.min(e,t),i=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:e}=await n.read(i,a,r-a,a);if(e===0)break;a+=e}return a<r?i.subarray(0,a):i}finally{await n.close()}}},Da=Ea})),ka=t({flushDebugLogs:()=>Ia,getDebugFilePath:()=>Ga,getDebugFilter:()=>Ua,getDebugLogPath:()=>Ra,getHasFormattedOutput:()=>Ma,getMinDebugLogLevel:()=>Va,isDebugMode:()=>Ha,isDebugToStdErr:()=>Wa,logAntError:()=>za,logForDebugging:()=>La,setHasFormattedOutput:()=>ja});function Aa(e){return!Ha()||typeof process>`u`||process.versions===void 0||process.versions.node===void 0?!1:De(e,Ua())}function ja(e){Ka=e}function Ma(){return Ka}async function Na(e,t,n,r){e&&await le(t,{recursive:!0}).catch(()=>{}),await ce(n,r),Ja()}function Pa(){}function Fa(){if(!$){let e=null;$=ye({writeFn:t=>{let n=Ra(),r=te(n),i=e!==r;if(e=r,Ha()){if(i)try{Sa().mkdirSync(r)}catch{}try{Sa().appendFileSync(n,t)}catch{try{Sa().mkdirSync(r),Sa().appendFileSync(n,t)}catch{}}Ja();return}qa=qa.then(Na.bind(null,i,r,n,t)).catch(Pa)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:Ha()}),xe(async()=>{$?.dispose(),await qa})}return $}async function Ia(){$?.flush(),await qa}function La(e,{level:t}={level:`debug`}){if(Ba[t]<Ba[Va()]||!Aa(e))return;Ka&&e.includes(`
|
|
39
|
+
`)&&(e=ua(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}\n`;if(Wa()){ee(n);return}Fa().write(n)}function Ra(){return Ga()??(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR?re(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR):null)??ne(i(),`debug`,`${u()}.txt`)}function za(e,t){t instanceof Error&&t.stack&&La(`[ANT-ONLY] ${e} stack trace:\n${t.stack}`,{level:`error`})}var Ba,Va,Ha,Ua,Wa,Ga,Ka,$,qa,Ja,Ya=e((()=>{r(),l(),be(),we(),ke(),o(),Oa(),d(),ha(),Ba={verbose:0,debug:1,info:2,warn:3,error:4},Va=n(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(Ba,e)?e:`debug`}),Ha=n(()=>a(process.env.DEBUG)||a(process.env.DEBUG_SDK)||process.argv.includes(`--debug`)||process.argv.includes(`-d`)||Wa()||process.argv.some(e=>e.startsWith(`--debug=`))||Ga()!==null),Ua=n(()=>{let e=process.argv.find(e=>e.startsWith(`--debug=`));return e?Oe(e.substring(8)):null}),Wa=n(()=>process.argv.includes(`--debug-to-stderr`)),Ga=n(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith(`--debug-file=`))return re(t.substring(13));if(t===`--debug-file`&&e+1<process.argv.length)return re(process.argv[e+1])}return null}),Ka=!1,$=null,qa=Promise.resolve(),Ja=n(async()=>{try{let e=Ra(),t=ne(te(e),`latest`);await ve(t).catch(()=>{}),await _e(e,t)}catch{}})}));export{we as $,oa as A,ea as B,ua as C,na as D,ia as E,Ji as F,Rn as G,Ki as H,ca as I,y as J,x as K,qi as L,Xi as M,Zi as N,aa as O,$i as P,S as Q,Qi as R,ma as S,fa as T,Wi as U,Yi as V,Gi as W,Le as X,b as Y,ze as Z,wa as _,Ha as a,da as b,La as c,xa as d,xe as et,Oa as f,va as g,Ta as h,Ya as i,sa as j,ra as k,ja as l,Ca as m,Ra as n,ye as nt,Wa as o,ya as p,Fe as q,Ma as r,be as rt,za as s,ka as t,Se as tt,Sa as u,ga as v,Q as w,ha as x,_a as y,ta as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Pa83R95t.js";import{c as r,i}from"./debug-Bglx1aTu.js";import{Lr as a,Nr as o}from"./settings-B2jvL8Dp.js";function s(){f.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(f.has(e))return f.get(e)??null;try{let t=await o();if(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),f.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),f.set(e,n),n}catch(t){return r(`Error detecting repository: ${t}`),f.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return d(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return d(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var f,p=e((()=>{t(),i(),a(),f=new Map}));export{c as n,p as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-B3X9FMpO.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{b as t,y as n}from"./types-Dx7P7JLQ.js";import{n as r,t as i}from"./cwd-Pa83R95t.js";import{f as a,u as o}from"./debug-Bglx1aTu.js";import{er as s,nr as c}from"./settings-B2jvL8Dp.js";import{o as l,s as u}from"./log-D2TIwHBV.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||i(),prefix:``};let n=s(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:n,prefix:``}:{directory:f(n),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await o().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return u(e),[]}}async function _(e,t={}){let{basePath:n=i(),maxResults:r=10}=t,{directory:a,prefix:o}=h(e,n),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,r).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await o().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return u(e),[]}}async function b(e,t={}){let{basePath:n=i(),maxResults:r=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,r),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{t(),r(),a(),l(),c(),x=500,S=300*1e3,C=new n({max:x,ttl:S}),w=new n({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{_t as t,t as n}from"./client-DvAL7lY8.js";import{L as r,N as i,k as a,t as o,v as s}from"./config-BSXLgwpD.js";var c,l,u=e((()=>{n(),o(),c=(e,t,n)=>{let a={EcsContainer:async e=>{let{fromHttp:t}=await import(`./dist-es-Byxccz_-.js`),{fromContainerMetadata:r}=await import(`./dist-es-Cwru7c2B.js`);return n?.debug(`@aws-sdk/credential-provider-ini - credential_source is EcsContainer`),async()=>i(t(e??{}),r(e))().then(l)},Ec2InstanceMetadata:async e=>{n?.debug(`@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata`);let{fromInstanceMetadata:t}=await import(`./dist-es-Cwru7c2B.js`);return async()=>t(e)().then(l)},Environment:async e=>{n?.debug(`@aws-sdk/credential-provider-ini - credential_source is Environment`);let{fromEnv:t}=await import(`./dist-es-D1wHe_zh.js`);return async()=>t(e)().then(l)}};if(e in a)return a[e];throw new r(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:n})},l=e=>t(e,`CREDENTIALS_PROFILE_NAMED_PROVIDER`,`p`)})),d,f,p,m,h,g=e((()=>{n(),o(),u(),d=(e,{profile:t=`default`,logger:n}={})=>!!e&&typeof e==`object`&&typeof e.role_arn==`string`&&[`undefined`,`string`].indexOf(typeof e.role_session_name)>-1&&[`undefined`,`string`].indexOf(typeof e.external_id)>-1&&[`undefined`,`string`].indexOf(typeof e.mfa_serial)>-1&&(f(e,{profile:t,logger:n})||p(e,{profile:t,logger:n})),f=(e,{profile:t,logger:n})=>{let r=typeof e.source_profile==`string`&&e.credential_source===void 0;return r&&n?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),r},p=(e,{profile:t,logger:n})=>{let r=typeof e.credential_source==`string`&&e.source_profile===void 0;return r&&n?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),r},m=async(e,n,i,o,s={},l)=>{i.logger?.debug(`@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)`);let u=n[e],{source_profile:d,region:f}=u;if(!i.roleAssumer){let{getDefaultRoleAssumer:e}=await import(`./sts-ei3CGBNu.js`);i.roleAssumer=e({...i.clientConfig,credentialProviderLogger:i.logger,parentClientConfig:{...o,...i?.parentClientConfig,region:f??i?.parentClientConfig?.region??o?.region}},i.clientPlugins)}if(d&&d in s)throw new r(`Detected a cycle attempting to resolve credentials for profile ${a(i)}. Profiles visited: `+Object.keys(s).join(`, `),{logger:i.logger});i.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${d?`source_profile=[${d}]`:`profile=[${e}]`}`);let p=d?l(d,n,i,o,{...s,[d]:!0},h(n[d]??{})):(await c(u.credential_source,e,i.logger)(i))();if(h(u))return p.then(e=>t(e,`CREDENTIALS_PROFILE_SOURCE_PROFILE`,`o`));{let n={RoleArn:u.role_arn,RoleSessionName:u.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:u.external_id,DurationSeconds:parseInt(u.duration_seconds||`3600`,10)},{mfa_serial:a}=u;if(a){if(!i.mfaCodeProvider)throw new r(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:i.logger,tryNextLink:!1});n.SerialNumber=a,n.TokenCode=await i.mfaCodeProvider(a)}let o=await p;return i.roleAssumer(o,n).then(e=>t(e,`CREDENTIALS_PROFILE_SOURCE_PROFILE`,`o`))}},h=e=>!e.role_arn&&!!e.credential_source})),_,v,y=e((()=>{n(),_=e=>!!(e&&e.login_session),v=async(e,n,r)=>{let{fromLoginCredentials:i}=await import(`./dist-es-DKFm0FJ7.js`);return t(await i({...n,profile:e})({callerClientConfig:r}),`CREDENTIALS_PROFILE_LOGIN`,`AC`)}})),b,x,S=e((()=>{n(),b=e=>!!e&&typeof e==`object`&&typeof e.credential_process==`string`,x=async(e,n)=>{let{fromProcess:r}=await import(`./dist-es-DXIR5NLi.js`);return t(await r({...e,profile:n})(),`CREDENTIALS_PROFILE_PROCESS`,`v`)}})),C,w,T=e((()=>{n(),C=async(e,n,r={},i)=>{let{fromSSO:a}=await import(`./dist-es-B7j_mv242.js`);return a({profile:e,logger:r.logger,parentClientConfig:r.parentClientConfig,clientConfig:r.clientConfig})({callerClientConfig:i}).then(e=>n.sso_session?t(e,`CREDENTIALS_PROFILE_SSO`,`r`):t(e,`CREDENTIALS_PROFILE_SSO_LEGACY`,`t`))},w=e=>e&&(typeof e.sso_start_url==`string`||typeof e.sso_account_id==`string`||typeof e.sso_session==`string`||typeof e.sso_region==`string`||typeof e.sso_role_name==`string`)})),E,D,O=e((()=>{n(),E=e=>!!e&&typeof e==`object`&&typeof e.aws_access_key_id==`string`&&typeof e.aws_secret_access_key==`string`&&[`undefined`,`string`].indexOf(typeof e.aws_session_token)>-1&&[`undefined`,`string`].indexOf(typeof e.aws_account_id)>-1,D=async(e,n)=>(n?.logger?.debug(`@aws-sdk/credential-provider-ini - resolveStaticCredentials`),t({accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}},`CREDENTIALS_PROFILE`,`n`))})),k,A,j=e((()=>{n(),k=e=>!!e&&typeof e==`object`&&typeof e.web_identity_token_file==`string`&&typeof e.role_arn==`string`&&[`undefined`,`string`].indexOf(typeof e.role_session_name)>-1,A=async(e,n,r)=>{let{fromTokenFile:i}=await import(`./dist-es-BSKD_hOQ.js`);return t(await i({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:n.roleAssumerWithWebIdentity,logger:n.logger,parentClientConfig:n.parentClientConfig})({callerClientConfig:r}),`CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN`,`q`)}})),M,N=e((()=>{o(),g(),y(),S(),T(),O(),j(),M=async(e,t,n,i,a={},o=!1)=>{let s=t[e];if(Object.keys(a).length>0&&E(s))return D(s,n);if(o||d(s,{profile:e,logger:n.logger}))return m(e,t,n,i,a,M);if(E(s))return D(s,n);if(k(s))return A(s,n,i);if(b(s))return x(n,e);if(w(s))return await C(e,s,n,i);if(_(s))return v(e,n,i);throw new r(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:n.logger})}})),P,F=e((()=>{o(),N(),P=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug(`@aws-sdk/credential-provider-ini - fromIni`);let n=await s(e);return M(a({profile:e.profile??t?.profile}),n,e,t)}})),I=e((()=>{F()}));export{P as n,F as r,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./dist-es-Cgsa8pb8.js";t();export{e as fromSSO};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./dist-es-BaQndfvh2.js";t();export{e as fromTokenFile};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{L as t,N as n,t as r}from"./config-BSXLgwpD.js";import{c as i,t as a}from"./dist-es-DelBIxNM.js";var o,s=e((()=>{r(),o=async e=>{let{ENV_CMDS_FULL_URI:r,ENV_CMDS_RELATIVE_URI:i,fromContainerMetadata:a,fromInstanceMetadata:o}=await import(`./dist-es-Cwru7c2B.js`);if(process.env[i]||process.env[r]){e.logger?.debug(`@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata`);let{fromHttp:t}=await import(`./dist-es-Byxccz_-.js`);return n(t(e),a(e))}return process.env.AWS_EC2_METADATA_DISABLED&&process.env.AWS_EC2_METADATA_DISABLED!==`false`?async()=>{throw new t(`EC2 Instance Metadata Service access disabled`,{logger:e.logger})}:(e.logger?.debug(`@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata`),o(e))}}));function c(e,t){let n=l(e),r,i,a,o,s=async e=>{if(e?.forceRefresh)return o||(o=n(e).then(e=>{a=e}).finally(()=>{o=void 0})),await o,a;if(a?.expiration&&a?.expiration?.getTime()<Date.now()&&(a=void 0),r)await r;else if(!a||t?.(a))if(a)i||(i=n(e).then(e=>{a=e}).finally(()=>{i=void 0}));else return r=n(e).then(e=>{a=e}).finally(()=>{r=void 0}),s(e);return a};return s}var l,u=e((()=>{l=e=>async t=>{let n;for(let r of e)try{return await r(t)}catch(e){if(n=e,e?.tryNextLink)continue;throw e}throw n}})),d,f,p,m,h=e((()=>{a(),r(),s(),u(),d=!1,f=(e={})=>c([async()=>{if(e.profile??process.env.AWS_PROFILE)throw process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY&&(d||((e.logger?.warn&&e.logger?.constructor?.name!==`NoOpLogger`?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
|
|
2
|
+
Multiple credential sources detected:
|
|
3
|
+
Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
|
|
4
|
+
This SDK will proceed with the AWS_PROFILE value.
|
|
5
|
+
|
|
6
|
+
However, a future version may change this behavior to prefer the ENV static credentials.
|
|
7
|
+
Please ensure that your environment only sets either the AWS_PROFILE or the
|
|
8
|
+
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
|
|
9
|
+
`),d=!0)),new t(`AWS_PROFILE is set, skipping fromEnv provider.`,{logger:e.logger,tryNextLink:!0});return e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv`),i(e)()},async n=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromSSO`);let{ssoStartUrl:r,ssoAccountId:i,ssoRegion:a,ssoRoleName:o,ssoSession:s}=e;if(!r&&!i&&!a&&!o&&!s)throw new t(`Skipping SSO provider in default chain (inputs do not include SSO fields).`,{logger:e.logger});let{fromSSO:c}=await import(`./dist-es-B7j_mv242.js`);return c(e)(n)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromIni`);let{fromIni:n}=await import(`./dist-es-ovsdbtwh.js`);return n(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromProcess`);let{fromProcess:n}=await import(`./dist-es-DXIR5NLi.js`);return n(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile`);let{fromTokenFile:n}=await import(`./dist-es-BSKD_hOQ.js`);return n(e)(t)},async()=>(e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::remoteProvider`),(await o(e))()),async()=>{throw new t(`Could not load credentials from any providers`,{tryNextLink:!1,logger:e.logger})}],m),p=e=>e?.expiration!==void 0,m=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5})),g=e((()=>{h()}));export{h as a,f as i,m as n,p as r,g as t};
|