@readmagic/workmate 0.0.19 → 0.0.20
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-9FcHMKgX.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-DLnj3JQO.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
- package/dist/chunks/{App-NkBqbDbC.js → App-W_9d1DjK.js} +1 -1
- package/dist/chunks/{ApproveApiKey-rgB6AsYD.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
- package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
- package/dist/chunks/{BackgroundTasksDialog-CcViruUO.js → BackgroundTasksDialog-lGn1Wj1k.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-D254L98G.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
- package/dist/chunks/{DiffDialog-6Srcz3NW.js → DiffDialog-DCpchgp5.js} +1 -1
- package/dist/chunks/Doctor-6SjW91rd.js +1 -0
- package/dist/chunks/{Doctor-DiNxlXfC.js → Doctor-FPYTivHw.js} +1 -1
- package/dist/chunks/{ExitFlow-Bt2De110.js → ExitFlow-Dy8_1D8J.js} +1 -1
- package/dist/chunks/{Grove-DC4jyxeB.js → Grove-Dd6rjs5P.js} +1 -1
- package/dist/chunks/{HybridTransport-DArmWb1V.js → HybridTransport-CJVkWa2u.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-DFiB0Kzc.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BHNo2__T.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-CdpO2Tj9.js → MCPConnectionManager-DfyoZaiu.js} +1 -1
- package/dist/chunks/{MCPToolListView-Ch4jOk_x.js → MCPToolListView-Dioupv8F.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-D4UQ8Q2e.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
- package/dist/chunks/{MessageSelector-BgsrdJur.js → MessageSelector-D8fylxPg.js} +1 -1
- package/dist/chunks/{Messages-DB1pmDY_.js → Messages-BZDFMYBT.js} +1 -1
- package/dist/chunks/{Onboarding-BnjdTwci.js → Onboarding-BKLomZYo.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-Chg9U-BC.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-C0ZSo12s.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
- package/dist/chunks/{QueryEngine-bKlupZpA.js → QueryEngine-CyGHpX7M.js} +1 -1
- package/dist/chunks/REPL-BDsz8KIx.js +1 -0
- package/dist/chunks/{REPL-Cg8UXYpX.js → REPL-CCBNfZfs.js} +5 -5
- package/dist/chunks/{RemoteSessionManager-CRWOHvKf.js → RemoteSessionManager-BfsOv4K6.js} +1 -1
- package/dist/chunks/{ResumeConversation-Ld7tYLKO.js → ResumeConversation-pC8NLq0F.js} +1 -1
- package/dist/chunks/{SSETransport-pPrlSZNF.js → SSETransport-B3K6eH9I.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
- package/dist/chunks/{Settings-CsOlPcIW.js → Settings-CKaGmKg2.js} +2 -2
- package/dist/chunks/{TeleportProgress-Di-PMey7.js → TeleportProgress-CkgSp1cs.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CDv1cbo-.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Bmf13tGU.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
- package/dist/chunks/{ThemePicker-B3AO3_jA.js → ThemePicker-iD9ufy99.js} +1 -1
- package/dist/chunks/{TrustDialog-C0aiR_LU.js → TrustDialog-qO5OdQt8.js} +1 -1
- package/dist/chunks/{add-dir-w1Ay3861.js → add-dir-C4eSVlZ6.js} +1 -1
- package/dist/chunks/{agentDisplay-D01ZlnVX.js → agentDisplay-BM4QG_RX.js} +1 -1
- package/dist/chunks/{agents-Bxenhf8S.js → agents-BbDBN5l9.js} +1 -1
- package/dist/chunks/{agents-B_hUgPnR.js → agents-D3APE_8d.js} +1 -1
- package/dist/chunks/{allErrors-C_iHQOlK.js → allErrors-BkgB7JNK.js} +1 -1
- package/dist/chunks/api-BHBK9axp.js +1 -0
- package/dist/chunks/{api-C5ULzZny.js → api-DyUWfg3a.js} +1 -1
- package/dist/chunks/{auth-DvcZHXGk.js → auth-0rn1U4Eq.js} +1 -1
- package/dist/chunks/auth-BEoTPSgC.js +1 -0
- package/dist/chunks/auth-BPug7U_u.js +1 -0
- package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-BGKR5cdA.js → backgroundHousekeeping-km82qEh0.js} +2 -2
- package/dist/chunks/{branch-CqQxCSHG.js → branch-CQ38cx5n.js} +1 -1
- package/dist/chunks/{bridgeConfig-MxsnEEPx.js → bridgeConfig-C5L-7KaP.js} +1 -1
- package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
- package/dist/chunks/{bridgeMessaging-Bx5pkkkx.js → bridgeMessaging-DVC3qj-C.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-B9EcQksI.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
- package/dist/chunks/{btw-DeznoRrw.js → btw-_P96ffHR.js} +1 -1
- package/dist/chunks/caches-DH-q8Fjf.js +1 -0
- package/dist/chunks/caches-Dq0pJFDP.js +1 -0
- package/dist/chunks/{ccrClient-CimQTd0b.js → ccrClient-DO563xlf.js} +1 -1
- package/dist/chunks/{clear-KvoD-lFN.js → clear-DmqQBNKg.js} +1 -1
- package/dist/chunks/client-C19cqYQS.js +1 -0
- package/dist/chunks/commands-BkpqHY9F.js +1 -0
- package/dist/chunks/{compact-Dgzve3dI.js → compact-DuVIvqMu.js} +1 -1
- package/dist/chunks/config-DMP6-Ccr.js +1 -0
- package/dist/chunks/{context-Dz-bbYCw.js → context-DjgMzIfe.js} +1 -1
- package/dist/chunks/{context-noninteractive-ApbVPU86.js → context-noninteractive-BzDVMnWC.js} +1 -1
- package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
- package/dist/chunks/{conversation-CJ-d0O-U.js → conversation-BBOE_EoE.js} +1 -1
- package/dist/chunks/conversation-WxH5pb2z.js +1 -0
- package/dist/chunks/{createSSHSession-DOz_Ox1_.js → createSSHSession-LVGVXHXL.js} +1 -1
- package/dist/chunks/createSession-BUzna9-E.js +1 -0
- package/dist/chunks/{createSession-yR87Rhiv.js → createSession-Dgwxk1WA.js} +1 -1
- package/dist/chunks/{crossProjectResume-DNnZo3gU.js → crossProjectResume-6B2NYy8a.js} +1 -1
- package/dist/chunks/{datadog-DBgIEaEd.js → datadog-Bc6wkPne.js} +1 -1
- package/dist/chunks/{diff-qOom_T1G.js → diff-DIg66U_d.js} +1 -1
- package/dist/chunks/doctor-BhUmhHQU.js +1 -0
- package/dist/chunks/{entry-EmOA7oWN.js → entry-B-Y-AYeK.js} +1 -1
- package/dist/chunks/{esm-DBMVQDVv.js → esm-CvHtYRrr.js} +1 -1
- package/dist/chunks/{exit-DDrAFCzE.js → exit-CW2eqUrR.js} +1 -1
- package/dist/chunks/{extraUsage-DylXI7Fc.js → extraUsage-CkTon7ib.js} +1 -1
- package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
- package/dist/chunks/fast-ByahC7Gw.js +1 -0
- package/dist/chunks/{fast-BCkhj9Dq.js → fast-xtIP4u4y.js} +1 -1
- package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
- package/dist/chunks/{fetchModelList-BbjuFHQT.js → fetchModelList-Dy-x4h3G.js} +1 -1
- package/dist/chunks/{fileSuggestions-Ct7vKEpR.js → fileSuggestions-CFkJktgc.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-CxUuXQhL.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
- package/dist/chunks/{flushGate-BZe_QwEz.js → flushGate-BjKW7PFC.js} +1 -1
- package/dist/chunks/{gemini-8sSwOtEf.js → gemini-NnmxBoEp.js} +1 -1
- package/dist/chunks/{generateSessionName-vT1khubt.js → generateSessionName-EpqGW-T2.js} +1 -1
- package/dist/chunks/{goal-CznQA1n1.js → goal-DbS8yJfB.js} +1 -1
- package/dist/chunks/{grok-cEzUsG-s.js → grok-BxZ4vTDw.js} +1 -1
- package/dist/chunks/{grove--HtQL4QZ.js → grove-CYE1Cfcz.js} +1 -1
- package/dist/chunks/{help-B6A_kDQA.js → help-DatnwM25.js} +1 -1
- package/dist/chunks/{hooks-CN5hLrhi.js → hooks-7iyENdDG.js} +1 -1
- package/dist/chunks/hooks-DjbqtbUV.js +1 -0
- package/dist/chunks/{initReplBridge-BJhmlcVt.js → initReplBridge-BEZW5PEY.js} +1 -1
- package/dist/chunks/{install-DUOtI2Hq.js → install-DJukI-kL.js} +1 -1
- package/dist/chunks/{instrumentation-DpgB3GFx.js → instrumentation-2HH15DPu.js} +3 -3
- package/dist/chunks/{job-DDoX1iFe.js → job-CXz7SLZp.js} +1 -1
- package/dist/chunks/{keybindings-BGTuYfk-.js → keybindings-C9l5il16.js} +1 -1
- package/dist/chunks/{launchLocalMemory-CoWeLNeP.js → launchLocalMemory-BfGenqj1.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTIBGSLV.js → launchOnboarding-DjMmXeQE.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DXOkUcW3.js → loadAgentsDir-DaNpxaO-.js} +587 -612
- package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
- package/dist/chunks/{loadPluginHooks-DrNVtTBq.js → loadPluginHooks-CGgpcyEC.js} +1 -1
- package/dist/chunks/{localSearch-DnT21UkF.js → localSearch-C2SZ9bGW.js} +1 -1
- package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
- package/dist/chunks/{logoUtils-YwL3izJt.js → logoUtils-CbIqOFrX.js} +1 -1
- package/dist/chunks/{magicDocs-rxv0rR8E.js → magicDocs-CrTwULyJ.js} +1 -1
- package/dist/chunks/{main-BOvY4O6D.js → main-bJXadFi0.js} +10 -10
- package/dist/chunks/{managedEnv-CpgCYISH.js → managedEnv-CUsdYhAI.js} +1 -1
- package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
- package/dist/chunks/{mappers-DYtq2XVS.js → mappers-_B-s9fNz.js} +1 -1
- package/dist/chunks/{mcp-BoU3TNFs.js → mcp-BbbYzWpy.js} +2 -2
- package/dist/chunks/{mcp-BPvcoKDY.js → mcp-D91sH9a8.js} +1 -1
- package/dist/chunks/{mcp-BfqsHRx0.js → mcp-Dx-zgUgu.js} +1 -1
- package/dist/chunks/{memory-BPKRdkBb.js → memory-BeL7ui9m.js} +1 -1
- package/dist/chunks/{mode-CXpXux2s.js → mode-D695kgLI.js} +1 -1
- package/dist/chunks/model-DX0TtzqX.js +1 -0
- package/dist/chunks/{model-Cxx3suBa.js → model-Do0f476p.js} +1 -1
- package/dist/chunks/{model-CxPYKiW1.js → model-DpcM8dz5.js} +1 -1
- package/dist/chunks/{modelOptions-BqBHEyiR.js → modelOptions-B3nis9cC.js} +1 -1
- package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
- package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
- package/dist/chunks/{nativeInstaller-CaXwRpoR.js → nativeInstaller-CymO8TNe.js} +1 -1
- package/dist/chunks/{omit-DZUxsClb.js → omit-DO61BHZu.js} +1 -1
- package/dist/chunks/{onChangeAppState-qHXqufwy.js → onChangeAppState-vKml_lit.js} +1 -1
- package/dist/chunks/{openai-_FQ9EhuR.js → openai-DdupGVdC.js} +1 -1
- package/dist/chunks/{partition-BgwHlPsO.js → partition-BivH9MBJ.js} +1 -1
- package/dist/chunks/{permissions-Dv5d5Nu3.js → permissions-C9iqR4_N.js} +1 -1
- package/dist/chunks/{pidLock-CEhbTkBE.js → pidLock-DiKz5Tza.js} +2 -2
- package/dist/chunks/{plan-DVPBW5OS.js → plan-KDN5IGWY.js} +1 -1
- package/dist/chunks/{plugin-Bh2eBwLW.js → plugin-D0rzUb8E.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-C2YbEHrP.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
- package/dist/chunks/{pluginBlocklist-B2NAKaB9.js → pluginBlocklist-xdiUmUpt.js} +1 -1
- package/dist/chunks/{pluginCliCommands-Cw5TrYYb.js → pluginCliCommands-CIDDvVN7.js} +1 -1
- package/dist/chunks/{pluginFlagging-BDTgCYuC.js → pluginFlagging-DRA0m76J.js} +1 -1
- package/dist/chunks/{pluginOperations-BBwGEdfC.js → pluginOperations-BEYsarAn.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DhhMk3dA.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
- package/dist/chunks/{plugins-r0h93GT_.js → plugins-CWWU4BKs.js} +1 -1
- package/dist/chunks/{print-CDzhHi2F.js → print-B5H2xbBS.js} +3 -3
- package/dist/chunks/{processBashCommand-DmdCAWOR.js → processBashCommand-EQ9EWaRV.js} +1 -1
- package/dist/chunks/{processSlashCommand-B43TkiaI.js → processSlashCommand-C4PKNyFT.js} +1 -1
- package/dist/chunks/{prompt-DEioJrx_.js → prompt-8u06WVES.js} +1 -1
- package/dist/chunks/prompt-B9sDzLPK.js +1 -0
- package/dist/chunks/prompt-WsoTRhoh.js +1 -0
- package/dist/chunks/{promptEditor-eJzbtNn4.js → promptEditor-Cr4w-4Bz.js} +1 -1
- package/dist/chunks/{protocolHandler-C-CFTcUJ.js → protocolHandler-DzHVaPl3.js} +2 -2
- package/dist/chunks/{reconciler-DZP4dJJG.js → reconciler-RIKmaPg7.js} +1 -1
- package/dist/chunks/{refresh-vaY-Sr80.js → refresh-CCSCAjgz.js} +1 -1
- package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
- package/dist/chunks/{reload-plugins-m9CzoIxu.js → reload-plugins-DC-tbXVv.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-C4vSr1gp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-6RAHPt_g.js → remoteManagedSettings-BoOYHzYP.js} +1 -1
- package/dist/chunks/{rename-DmauGVBX.js → rename-DS1AmW-F.js} +1 -1
- package/dist/chunks/{resume-ut_pBrLN.js → resume-Cf5PSoPw.js} +1 -1
- package/dist/chunks/{runtimeObserver-CSroopId.js → runtimeObserver-DzesbvgI.js} +1 -1
- package/dist/chunks/{runtimeObserver-C2vjqtCE.js → runtimeObserver-L6041elO.js} +2 -2
- package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
- package/dist/chunks/{sandbox-toggle-BJKd1ZYk.js → sandbox-toggle-COZE8Lo4.js} +1 -1
- package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
- package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
- package/dist/chunks/{session-DTin6hOR.js → session-BvA99K4j.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
- package/dist/chunks/{sessionObserver-iAJLH92a.js → sessionObserver-0D8xFoRK.js} +1 -1
- package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
- package/dist/chunks/{sessionState-DAcub-HK.js → sessionState-CQhbGfmh.js} +1 -1
- package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
- package/dist/chunks/{sessionTracing-Dvi520eN.js → sessionTracing-BoOZsXU2.js} +1 -1
- package/dist/chunks/{settingsSync-aHn3p-6J.js → settingsSync-rkWmClKS.js} +1 -1
- package/dist/chunks/{setup-CK3ybjjM.js → setup-D8L275fT.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-BL7dEv-u.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
- package/dist/chunks/{sideQuestion-Ct87yvOR.js → sideQuestion-Ds7Elgs4.js} +1 -1
- package/dist/chunks/{sinks-Bmn3li0M.js → sinks-BXX72cbf.js} +1 -1
- package/dist/chunks/sinks-DMp6uEzM.js +1 -0
- package/dist/chunks/{skillChangeDetector-Bco3UoeW.js → skillChangeDetector-CtithJ4a.js} +1 -1
- package/dist/chunks/{skillGapStore-MtlRyYmT.js → skillGapStore-BxCxKPev.js} +2 -2
- package/dist/chunks/{skillLifecycle-Drs6gEv9.js → skillLifecycle-CfyNC3sW.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DkvmjNaw.js → skillSearchPanel-CMNJFIEC.js} +2 -2
- package/dist/chunks/{skills-axToWEo0.js → skills-DXMk-498.js} +1 -1
- package/dist/chunks/{status-CGp4uRlH.js → status-CFrLuGbf.js} +1 -1
- package/dist/chunks/status-D5OCkMZG.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-BrN_2q7H.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
- package/dist/chunks/switcher-AiMcRzoi.js +1 -0
- package/dist/chunks/{switcher-99gm2vpe.js → switcher-DQF5ZNal.js} +1 -1
- package/dist/chunks/{syncCache-B3OVvp8K.js → syncCache-qWJ_VfBo.js} +1 -1
- package/dist/chunks/{tasks-t5zT_D32.js → tasks-C8pb6ftc.js} +1 -1
- package/dist/chunks/{teleport-CvX_nUjQ.js → teleport-Bi_1VFIZ.js} +1 -1
- package/dist/chunks/{templateJobs-Bm8bovHx.js → templateJobs-DJ4dcfcL.js} +1 -1
- package/dist/chunks/{theme-DzaSXOpQ.js → theme-CEKOCSLw.js} +1 -1
- package/dist/chunks/{toolEventObserver-C_nHI27x.js → toolEventObserver-D2nk8ZbW.js} +1 -1
- package/dist/chunks/{toolPool-CgKK0K8f.js → toolPool-Df5iUqJ-.js} +1 -1
- package/dist/chunks/{trustedDevice-Bb7O8_tj.js → trustedDevice-CB6rNzl-.js} +1 -1
- package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D0uqGxGw.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
- package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
- package/dist/chunks/{useManagePlugins-ITVFO9dz.js → useManagePlugins-MSHw-qHx.js} +1 -1
- package/dist/chunks/{useMergedTools-rQ19rFvH.js → useMergedTools-Bb-INJa2.js} +1 -1
- package/dist/chunks/{useSearchInput-CXTa-leH.js → useSearchInput-QL_VtdJD.js} +1 -1
- package/dist/chunks/{useSettingsErrors-Xc6RYjYF.js → useSettingsErrors-Dvi6zLCr.js} +1 -1
- package/dist/chunks/{userAgent-CJ5Rp9kc.js → userAgent-i-oGzf40.js} +1 -1
- package/dist/chunks/{util-CD3ar4of.js → util-CLQvtXuD.js} +1 -1
- package/dist/chunks/{validatePlugin-CxrlCKc1.js → validatePlugin-1mTZ3TJR.js} +1 -1
- package/dist/chunks/{workerRegistry-BGJtgrko.js → workerRegistry-BjxoZ12l.js} +2 -2
- package/dist/chunks/worktree-DpksgxdF.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -5
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bny8WDwC.js +0 -1
- package/dist/chunks/ApproveApiKey-BKzkEkW-.js +0 -1
- package/dist/chunks/Doctor-DYEdLRxR.js +0 -1
- package/dist/chunks/REPL-yzvMFfaU.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CdgQlm--.js +0 -1
- package/dist/chunks/api-CB3e0De0.js +0 -1
- package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
- package/dist/chunks/auth-CsYEYXBO.js +0 -1
- package/dist/chunks/auth-CubXYcRl.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CykbtljP.js +0 -1
- package/dist/chunks/bridgeConfig-Cp2x_wtE.js +0 -1
- package/dist/chunks/caches-BiVRgePi.js +0 -1
- package/dist/chunks/caches-CGzKSWiP.js +0 -1
- package/dist/chunks/client-CmnPWgLq.js +0 -1
- package/dist/chunks/commands-CrzVgHxp.js +0 -1
- package/dist/chunks/config-Df8jooTW.js +0 -1
- package/dist/chunks/context-noninteractive-m4O3VtG7.js +0 -1
- package/dist/chunks/conversation-BYBX07j8.js +0 -1
- package/dist/chunks/createSession-C_-ZEQT5.js +0 -1
- package/dist/chunks/doctor-CflXjqVK.js +0 -1
- package/dist/chunks/extractMemories-B_8wZpXA.js +0 -1
- package/dist/chunks/fast-4ajfJv-M.js +0 -1
- package/dist/chunks/fetchModelList-V8_e2O1N.js +0 -1
- package/dist/chunks/firstPartyEventLogger-YQm0DoVu.js +0 -1
- package/dist/chunks/hooks-CJY5Vfy6.js +0 -1
- package/dist/chunks/loadAgentsDir-Dxz1vp3F.js +0 -1
- package/dist/chunks/localSearch-CCs5fOd_.js +0 -1
- package/dist/chunks/managedEnv-CrnBYTtQ.js +0 -1
- package/dist/chunks/model-aEJ54cMA.js +0 -1
- package/dist/chunks/pluginStartupCheck-CHx379_R.js +0 -1
- package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
- package/dist/chunks/prompt-C50mDqWv.js +0 -1
- package/dist/chunks/prompt-WGH9CcXh.js +0 -1
- package/dist/chunks/registerProtocol-Xsq4ldwg.js +0 -1
- package/dist/chunks/sandbox-adapter-CL0qdcxn.js +0 -1
- package/dist/chunks/searchExtraTools-ByWuNCGo.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DorzHolr.js +0 -1
- package/dist/chunks/sessionObserver-Dy6NFlzL.js +0 -1
- package/dist/chunks/sessionStorage-DItJMkwx.js +0 -1
- package/dist/chunks/sinks-QQ_6Op7q.js +0 -1
- package/dist/chunks/src-DPUAq5Ty.js +0 -1
- package/dist/chunks/status-3uevwSMo.js +0 -1
- package/dist/chunks/switcher-DJDxjLPQ.js +0 -1
- package/dist/chunks/trustedDevice-C2gnF9Lc.js +0 -1
- package/dist/chunks/useMainLoopModel-BGPOmBkl.js +0 -1
- package/dist/chunks/worktree-CanG5GhE.js +0 -1
- /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{$C as a,$u as o,Da as s,Ds as c,Fc as l,Ic as u,Iy as d,La as f,Lc as p,Ly as m,Mu as h,Pu as g,QC as _,Qu as v,Sa as y,Ts as b,Ua as x,Va as S,XC as C,Xh as w,Zh as T,bg as E,dn as D,ep as O,gC as k,hg as A,hn as j,mg as M,nn as N,np as ee,pg as P,uC as te,wa as F,ws as ne,ya as I,za as re,zc as L}from"./loadAgentsDir-DXOkUcW3.js";import{C as ie,Gt as ae,I as R,P as z,Wt as oe,ai as se,ot as ce,t as le}from"./src-DL3w8VPk2.js";import{t as ue}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as de,Wn as fe}from"./state-D5D6QpTX.js";import{In as B,Ln as pe}from"./settings-3xZ0fsvE.js";import{h as V,m as me,o as he,q as ge,s as H,w as _e}from"./log-CZ7ploQm.js";import{n as U,r as W}from"./analytics-DJobLaWP.js";import{b as ve,m as ye,v as be}from"./startupProfiler-CbzxVmbv.js";import{E as xe,T as Se,c as Ce,d as we,w as Te}from"./sessionTracing-Dvi520eN.js";import{n as Ee,t as De}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(se(),1),J=ue();le(),de(),ge(),me(),he(),pe(),U(),be(),_(),d(),Te(),O(),Ce(),p(),l(),c(),f(),j();function Oe(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function ke(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function Ae(e,t,n,r,i,a,o){let s=K();fe(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;we(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Se(`user_prompt`,{prompt_length:String(l.length),prompt:xe(l),"prompt.id":s}),W(`tengu_input_prompt`,{is_negative:Oe(c),is_keep_going:ke(c)}),t.length>0?{messages:[y({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[y({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}U(),f();async function je({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:c,setUserInputOnProcessing:l,uuid:u,isAlreadyProcessing:d,querySource:f,canUseTool:p,skipSlashCommands:m,bridgeOrigin:h,isMeta:g,skipAttachments:_,autonomy:v}){let b=typeof e==`string`?e:null,x=b?.startsWith(`/`)&&!m;n===`prompt`&&b!==null&&!g&&!x&&l?.(b),L(`query_process_user_input_base_start`);let S=i.getAppState(),C=await Ne(e,n,r,i,a,o,c,u,d,f,p,S.toolPermissionContext.mode,m,h,g,_,t,v);if(L(`query_process_user_input_base_end`),!C.shouldQuery)return C;L(`query_hooks_start`);let w=s(e)||``;for await(let t of N(w,S.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[I(`${D(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:C.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return C.messages.push(y({content:e})),C.shouldQuery=!1,C}if(t.additionalContexts&&t.additionalContexts.length>0&&C.messages.push(ne({type:`hook_additional_context`,content:t.additionalContexts.map(Me),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;C.messages.push({...t.message,attachment:{...t.message.attachment,content:Me(t.message.attachment.content)}});break;default:C.messages.push(t.message);break}}return L(`query_hooks_end`),C}var Y=1e4;function Me(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Ne(e,t,n,r,i,o,s,c,l,d,f,p,h,g,_,v,y,x){let S=null,w=[],T=[],E=e;if(typeof e==`string`)S=e;else if(e.length>0){L(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await a(n);if(e.dimensions){let t=C(e.dimensions);t&&T.push(t)}t.push(e.block)}else t.push(n);E=t,L(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(S=n.text,w=t.slice(0,-1)):w=t}if(S===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let D=i?Object.values(i).filter(m):[],O=D.map(e=>e.id),k=i?await ee(i):new Map;L(`query_pasted_image_processing_start`);let A=await Promise.all(D.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return W(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await a(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??k.get(e.id)}})),j=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of A){if(e.dimensions){let t=C(e.dimensions,n);t&&T.push(t)}else if(t){let e=C(t,n);e&&T.push(e)}else n&&T.push(`[Image source: ${n}]`);j.push(e.block)}L(`query_pasted_image_processing_end`);let M=h,N=!v&&S!==null&&(t!==`prompt`||M||!S.startsWith(`/`));L(`query_attachment_loading_start`);let P=N?await u(b(S,r,o??null,[],s,d)):[];if(L(`query_attachment_loading_end`),S!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-DmdCAWOR.js`);return X(await e(S,w,P,r,n),T)}if(S!==null&&!M&&S.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-B43TkiaI.js`);return X(await e(S,w,j,P,r,n,c,l,f,x),T)}if(S!==null&&t===`prompt`){let e=S.trim(),t=P.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;W(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return X(Ae(E,j,O,P,c,p,_),T)}function X(e,t){return t.length>0&&e.messages.push(y({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Pe=n({MessageSelector:()=>Ie,messagesAfterAreOnlySynthetic:()=>Ue,selectableUserMessagesFilter:()=>Q});function Fe(e){return e.type===`text`}function Z(e){return e===`summarize`}function Ie({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:s}){let c=T(e=>e.fileHistory),[l,u]=(0,q.useState)(void 0),d=M(),f=(0,q.useMemo)(K,[]),p=(0,q.useMemo)(()=>[...e.filter(Q),{...y({content:``}),uuid:f}],[e,f]),[m,g]=(0,q.useState)(p.length-1),_=Math.max(0,Math.min(m-Math.floor($/2),p.length-$)),b=p.length>1,[x,S]=(0,q.useState)(s),[C,w]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!s||!d)return;let e=!1;return A(c,s.uuid).then(t=>{e||w(t)}),()=>{e=!0}},[s,d,c]);let[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(null),[j,N]=(0,q.useState)(`both`),[ee,te]=(0,q.useState)(``);function F(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:te}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{W(`tengu_message_selector_opened`,{})},[]);async function ne(e){t(),D(!0);try{await n(e),D(!1),o()}catch(e){H(e),D(!1),u(`Failed to restore the conversation:\n${e}`)}}async function I(t){let n=e.indexOf(t);if(W(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){o();return}if(!d){await ne(t);return}let r=await A(c,t.uuid);S(t),w(r)}async function re(e){if(W(`tengu_message_selector_restore_option_selected`,{option:e}),!x){u(`Message not found.`);return}if(e===`nevermind`){s?o():S(void 0);return}if(Z(e)){t(),D(!0),k(e),u(void 0);try{let e=ee.trim()||void 0;await a(x,e,`from`),D(!1),k(null),S(void 0),o()}catch(e){H(e),D(!1),k(null),S(void 0),u(`Failed to summarize:\n${e}`)}return}t(),D(!0),u(void 0);let i=null,c=null;if(e===`code`||e===`both`)try{await r(x)}catch(e){i=e,H(i)}if(e===`conversation`||e===`both`)try{await n(x)}catch(e){c=e,H(c)}D(!1),S(void 0),c&&i?u(`Failed to restore the conversation and code:\n${c}\n${i}`):c?u(`Failed to restore the conversation:\n${c}`):i?u(`Failed to restore the code:\n${i}`):o()}let L=Ee(),se=(0,q.useCallback)(()=>{if(x&&!s){S(void 0);return}W(`tengu_message_selector_cancelled`,{}),o()},[o,x,s]),ce=(0,q.useCallback)(()=>g(e=>Math.max(0,e-1)),[]),le=(0,q.useCallback)(()=>g(e=>Math.min(p.length-1,e+1)),[p.length]),ue=(0,q.useCallback)(()=>g(0),[]),de=(0,q.useCallback)(()=>g(p.length-1),[p.length]),fe=(0,q.useCallback)(()=>{let e=p[m];e&&I(e)},[p,m,I]);oe(`confirm:no`,se,{context:`Confirmation`,isActive:!x}),ae({"messageSelector:up":ce,"messageSelector:down":le,"messageSelector:top":ue,"messageSelector:bottom":de,"messageSelector:select":fe},{context:`MessageSelector`,isActive:!E&&!l&&!x&&b});let[B,pe]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){d&&Promise.all(p.map(async(t,n)=>{if(t.uuid!==f){let r=P(c,t.uuid),i=p.at(n+1),a=r?He(e,t.uuid,i?.uuid===f?void 0:i?.uuid):void 0;pe(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[p,e,f,c,d]);let V=d&&C?.filesChanged&&C.filesChanged.length>0,me=!l&&!x&&!s&&b;return(0,J.jsxs)(R,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(ie,{color:`suggestion`}),(0,J.jsxs)(R,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(z,{bold:!0,color:`suggestion`,children:`Rewind`}),l&&(0,J.jsxs)(z,{color:`error`,children:[`Error: `,l]}),!b&&(0,J.jsx)(z,{children:`Nothing to rewind to yet.`}),!l&&x&&b&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{children:[`Confirm you want to restore `,!C&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(R,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(Ve,{userMessage:x,color:`text`,isCurrent:!1}),(0,J.jsxs)(z,{dimColor:!0,children:[`(`,ye(new Date(x.timestamp)),`)`]})]}),(0,J.jsx)(Re,{selectedRestoreOption:j,canRestoreCode:!!V,diffStatsForRestore:C}),E&&Z(O)?(0,J.jsxs)(R,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(h,{}),(0,J.jsx)(z,{children:`Summarizing…`})]}):(0,J.jsx)(v,{isDisabled:E,options:F(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>N(e),onChange:e=>re(e),onCancel:()=>s?o():S(void 0)}),V&&(0,J.jsx)(R,{marginBottom:1,children:(0,J.jsxs)(z,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),me&&(0,J.jsxs)(J.Fragment,{children:[d?(0,J.jsx)(z,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(z,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(R,{width:`100%`,flexDirection:`column`,children:p.slice(_,_+$).map((e,t)=>{let n=_+t,r=n===m,a=e.uuid===f,o=n in B,s=B[n],c=s?.filesChanged?.length;return(0,J.jsxs)(R,{height:d?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(R,{width:2,minWidth:2,children:r?(0,J.jsxs)(z,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(z,{children:` `})}),(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(R,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(Ve,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),d&&o&&(0,J.jsx)(R,{height:1,flexDirection:`row`,children:s?(0,J.jsx)(z,{dimColor:!r,color:`inactive`,children:c?(0,J.jsxs)(J.Fragment,{children:[c===1&&s.filesChanged[0]?`${G.basename(s.filesChanged[0])} `:`${c} files changed `,(0,J.jsx)(Be,{diffStats:s})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})}):(0,J.jsxs)(z,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!x&&(0,J.jsx)(z,{dimColor:!0,italic:!0,children:L.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!l&&b&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Le(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Re({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(z,{dimColor:!0,children:Le(e)}),!Z(e)&&(r?(0,J.jsx)(ze,{diffStatsForRestore:n}):(0,J.jsx)(z,{dimColor:!0,children:`The code will be unchanged.`}))]})}function ze({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,J.jsx)(z,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsxs)(z,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(Be,{diffStats:e}),` in `,n,`.`]})}function Be({diffStats:e}){if(e?.filesChanged)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(z,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Ve({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=ce();if(r)return(0,J.jsx)(R,{width:`100%`,children:(0,J.jsx)(z,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,s=typeof o==`string`?null:o[o.length-1],c=V(typeof o==`string`?o.trim():s&&Fe(s)?s.text.trim():`(no prompt)`);if(re(c))return(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(z,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(c.includes(`<bash-input>`)){let e=F(c,`bash-input`);if(e)return(0,J.jsxs)(R,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(z,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(z,{color:t,dimColor:n,children:[` `,e]})]})}if(c.includes(`<command-message>`)){let e=F(c,_e),r=F(c,`command-args`),i=F(c,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(z,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(z,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(z,{color:t,dimColor:n,children:i?ve(c,a-i,!0):c.slice(0,500).split(`
|
|
1
|
+
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{$C as a,$u as o,Da as s,Ds as c,Fc as l,Ic as u,Iy as d,La as f,Lc as p,Ly as m,Mu as h,Pu as g,QC as _,Qu as v,Sa as y,Ts as b,Ua as x,Va as S,XC as C,Xh as w,Zh as T,bg as E,dn as D,ep as O,gC as k,hg as A,hn as j,mg as M,nn as N,np as ee,pg as P,uC as te,wa as F,ws as ne,ya as I,za as re,zc as L}from"./loadAgentsDir-DaNpxaO-.js";import{C as ie,Gt as ae,I as R,P as z,Wt as oe,ai as se,ot as ce,t as le}from"./src-DL3w8VPk2.js";import{t as ue}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as de,Wn as fe}from"./state-D5D6QpTX.js";import{In as B,Ln as pe}from"./settings-3xZ0fsvE.js";import{h as V,m as me,o as he,q as ge,s as H,w as _e}from"./log-CZ7ploQm.js";import{n as U,r as W}from"./analytics-DJobLaWP.js";import{b as ve,m as ye,v as be}from"./startupProfiler-CbzxVmbv.js";import{E as xe,T as Se,c as Ce,d as we,w as Te}from"./sessionTracing-BoOZsXU2.js";import{n as Ee,t as De}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(se(),1),J=ue();le(),de(),ge(),me(),he(),pe(),U(),be(),_(),d(),Te(),O(),Ce(),p(),l(),c(),f(),j();function Oe(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function ke(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function Ae(e,t,n,r,i,a,o){let s=K();fe(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;we(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Se(`user_prompt`,{prompt_length:String(l.length),prompt:xe(l),"prompt.id":s}),W(`tengu_input_prompt`,{is_negative:Oe(c),is_keep_going:ke(c)}),t.length>0?{messages:[y({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[y({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}U(),f();async function je({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:c,setUserInputOnProcessing:l,uuid:u,isAlreadyProcessing:d,querySource:f,canUseTool:p,skipSlashCommands:m,bridgeOrigin:h,isMeta:g,skipAttachments:_,autonomy:v}){let b=typeof e==`string`?e:null,x=b?.startsWith(`/`)&&!m;n===`prompt`&&b!==null&&!g&&!x&&l?.(b),L(`query_process_user_input_base_start`);let S=i.getAppState(),C=await Ne(e,n,r,i,a,o,c,u,d,f,p,S.toolPermissionContext.mode,m,h,g,_,t,v);if(L(`query_process_user_input_base_end`),!C.shouldQuery)return C;L(`query_hooks_start`);let w=s(e)||``;for await(let t of N(w,S.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[I(`${D(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:C.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return C.messages.push(y({content:e})),C.shouldQuery=!1,C}if(t.additionalContexts&&t.additionalContexts.length>0&&C.messages.push(ne({type:`hook_additional_context`,content:t.additionalContexts.map(Me),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;C.messages.push({...t.message,attachment:{...t.message.attachment,content:Me(t.message.attachment.content)}});break;default:C.messages.push(t.message);break}}return L(`query_hooks_end`),C}var Y=1e4;function Me(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Ne(e,t,n,r,i,o,s,c,l,d,f,p,h,g,_,v,y,x){let S=null,w=[],T=[],E=e;if(typeof e==`string`)S=e;else if(e.length>0){L(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await a(n);if(e.dimensions){let t=C(e.dimensions);t&&T.push(t)}t.push(e.block)}else t.push(n);E=t,L(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(S=n.text,w=t.slice(0,-1)):w=t}if(S===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let D=i?Object.values(i).filter(m):[],O=D.map(e=>e.id),k=i?await ee(i):new Map;L(`query_pasted_image_processing_start`);let A=await Promise.all(D.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return W(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await a(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??k.get(e.id)}})),j=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of A){if(e.dimensions){let t=C(e.dimensions,n);t&&T.push(t)}else if(t){let e=C(t,n);e&&T.push(e)}else n&&T.push(`[Image source: ${n}]`);j.push(e.block)}L(`query_pasted_image_processing_end`);let M=h,N=!v&&S!==null&&(t!==`prompt`||M||!S.startsWith(`/`));L(`query_attachment_loading_start`);let P=N?await u(b(S,r,o??null,[],s,d)):[];if(L(`query_attachment_loading_end`),S!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-EQ9EWaRV.js`);return X(await e(S,w,P,r,n),T)}if(S!==null&&!M&&S.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-C4PKNyFT.js`);return X(await e(S,w,j,P,r,n,c,l,f,x),T)}if(S!==null&&t===`prompt`){let e=S.trim(),t=P.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;W(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return X(Ae(E,j,O,P,c,p,_),T)}function X(e,t){return t.length>0&&e.messages.push(y({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Pe=n({MessageSelector:()=>Ie,messagesAfterAreOnlySynthetic:()=>Ue,selectableUserMessagesFilter:()=>Q});function Fe(e){return e.type===`text`}function Z(e){return e===`summarize`}function Ie({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:s}){let c=T(e=>e.fileHistory),[l,u]=(0,q.useState)(void 0),d=M(),f=(0,q.useMemo)(K,[]),p=(0,q.useMemo)(()=>[...e.filter(Q),{...y({content:``}),uuid:f}],[e,f]),[m,g]=(0,q.useState)(p.length-1),_=Math.max(0,Math.min(m-Math.floor($/2),p.length-$)),b=p.length>1,[x,S]=(0,q.useState)(s),[C,w]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!s||!d)return;let e=!1;return A(c,s.uuid).then(t=>{e||w(t)}),()=>{e=!0}},[s,d,c]);let[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(null),[j,N]=(0,q.useState)(`both`),[ee,te]=(0,q.useState)(``);function F(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:te}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{W(`tengu_message_selector_opened`,{})},[]);async function ne(e){t(),D(!0);try{await n(e),D(!1),o()}catch(e){H(e),D(!1),u(`Failed to restore the conversation:\n${e}`)}}async function I(t){let n=e.indexOf(t);if(W(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){o();return}if(!d){await ne(t);return}let r=await A(c,t.uuid);S(t),w(r)}async function re(e){if(W(`tengu_message_selector_restore_option_selected`,{option:e}),!x){u(`Message not found.`);return}if(e===`nevermind`){s?o():S(void 0);return}if(Z(e)){t(),D(!0),k(e),u(void 0);try{let e=ee.trim()||void 0;await a(x,e,`from`),D(!1),k(null),S(void 0),o()}catch(e){H(e),D(!1),k(null),S(void 0),u(`Failed to summarize:\n${e}`)}return}t(),D(!0),u(void 0);let i=null,c=null;if(e===`code`||e===`both`)try{await r(x)}catch(e){i=e,H(i)}if(e===`conversation`||e===`both`)try{await n(x)}catch(e){c=e,H(c)}D(!1),S(void 0),c&&i?u(`Failed to restore the conversation and code:\n${c}\n${i}`):c?u(`Failed to restore the conversation:\n${c}`):i?u(`Failed to restore the code:\n${i}`):o()}let L=Ee(),se=(0,q.useCallback)(()=>{if(x&&!s){S(void 0);return}W(`tengu_message_selector_cancelled`,{}),o()},[o,x,s]),ce=(0,q.useCallback)(()=>g(e=>Math.max(0,e-1)),[]),le=(0,q.useCallback)(()=>g(e=>Math.min(p.length-1,e+1)),[p.length]),ue=(0,q.useCallback)(()=>g(0),[]),de=(0,q.useCallback)(()=>g(p.length-1),[p.length]),fe=(0,q.useCallback)(()=>{let e=p[m];e&&I(e)},[p,m,I]);oe(`confirm:no`,se,{context:`Confirmation`,isActive:!x}),ae({"messageSelector:up":ce,"messageSelector:down":le,"messageSelector:top":ue,"messageSelector:bottom":de,"messageSelector:select":fe},{context:`MessageSelector`,isActive:!E&&!l&&!x&&b});let[B,pe]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){d&&Promise.all(p.map(async(t,n)=>{if(t.uuid!==f){let r=P(c,t.uuid),i=p.at(n+1),a=r?He(e,t.uuid,i?.uuid===f?void 0:i?.uuid):void 0;pe(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[p,e,f,c,d]);let V=d&&C?.filesChanged&&C.filesChanged.length>0,me=!l&&!x&&!s&&b;return(0,J.jsxs)(R,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(ie,{color:`suggestion`}),(0,J.jsxs)(R,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(z,{bold:!0,color:`suggestion`,children:`Rewind`}),l&&(0,J.jsxs)(z,{color:`error`,children:[`Error: `,l]}),!b&&(0,J.jsx)(z,{children:`Nothing to rewind to yet.`}),!l&&x&&b&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{children:[`Confirm you want to restore `,!C&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(R,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(Ve,{userMessage:x,color:`text`,isCurrent:!1}),(0,J.jsxs)(z,{dimColor:!0,children:[`(`,ye(new Date(x.timestamp)),`)`]})]}),(0,J.jsx)(Re,{selectedRestoreOption:j,canRestoreCode:!!V,diffStatsForRestore:C}),E&&Z(O)?(0,J.jsxs)(R,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(h,{}),(0,J.jsx)(z,{children:`Summarizing…`})]}):(0,J.jsx)(v,{isDisabled:E,options:F(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>N(e),onChange:e=>re(e),onCancel:()=>s?o():S(void 0)}),V&&(0,J.jsx)(R,{marginBottom:1,children:(0,J.jsxs)(z,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),me&&(0,J.jsxs)(J.Fragment,{children:[d?(0,J.jsx)(z,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(z,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(R,{width:`100%`,flexDirection:`column`,children:p.slice(_,_+$).map((e,t)=>{let n=_+t,r=n===m,a=e.uuid===f,o=n in B,s=B[n],c=s?.filesChanged?.length;return(0,J.jsxs)(R,{height:d?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(R,{width:2,minWidth:2,children:r?(0,J.jsxs)(z,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(z,{children:` `})}),(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(R,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(Ve,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),d&&o&&(0,J.jsx)(R,{height:1,flexDirection:`row`,children:s?(0,J.jsx)(z,{dimColor:!r,color:`inactive`,children:c?(0,J.jsxs)(J.Fragment,{children:[c===1&&s.filesChanged[0]?`${G.basename(s.filesChanged[0])} `:`${c} files changed `,(0,J.jsx)(Be,{diffStats:s})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})}):(0,J.jsxs)(z,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!x&&(0,J.jsx)(z,{dimColor:!0,italic:!0,children:L.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!l&&b&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Le(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Re({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(z,{dimColor:!0,children:Le(e)}),!Z(e)&&(r?(0,J.jsx)(ze,{diffStatsForRestore:n}):(0,J.jsx)(z,{dimColor:!0,children:`The code will be unchanged.`}))]})}function ze({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,J.jsx)(z,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsxs)(z,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(Be,{diffStats:e}),` in `,n,`.`]})}function Be({diffStats:e}){if(e?.filesChanged)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(z,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Ve({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=ce();if(r)return(0,J.jsx)(R,{width:`100%`,children:(0,J.jsx)(z,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,s=typeof o==`string`?null:o[o.length-1],c=V(typeof o==`string`?o.trim():s&&Fe(s)?s.text.trim():`(no prompt)`);if(re(c))return(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(z,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(c.includes(`<bash-input>`)){let e=F(c,`bash-input`);if(e)return(0,J.jsxs)(R,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(z,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(z,{color:t,dimColor:n,children:[` `,e]})]})}if(c.includes(`<command-message>`)){let e=F(c,_e),r=F(c,`command-args`),i=F(c,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(z,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(z,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(R,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(z,{color:t,dimColor:n,children:i?ve(c,a-i,!0):c.slice(0,500).split(`
|
|
2
2
|
`).slice(0,4).join(`
|
|
3
3
|
`)})})}function He(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!x(n))continue;let r=n.toolUseResult;if(!(!r?.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=B(e.lines,e=>e.startsWith(`+`)),n=B(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||S(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Fe(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function Ue(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!S(t)&&!x(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var $,We=e((()=>{r(),U(),w(),E(),De(),te(),f(),o(),g(),k(),$=7}));export{Q as a,Ue as i,Pe as n,je as o,We as r,Ie as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Aa as o,Af as s,Ag as c,Ba as l,Bu as u,By as d,Ca as f,Cp as p,Ga as m,Gf as h,Hf as g,Ia as _,Ja as v,Jm as y,Jw as b,Kf as x,Ky as S,La as C,Ma as w,Mf as T,Na as ee,Qw as E,Rf as D,Uf as O,Uh as k,Uy as te,Vf as ne,Vu as re,Wf as A,Wh as j,Wy as M,Xh as N,Ya as ie,Za as ae,Zh as oe,aC as se,cC as ce,dC as le,eS as P,fC as ue,gC as F,gp as de,hp as fe,iC as pe,ja as me,jf as he,ka as ge,la as _e,ma as ve,nC as ye,nS as be,na as xe,oC as Se,qm as Ce,qw as we,ra as Te,sC as Ee,tS as I,tT as De,ta as Oe,ua as ke,wa as Ae,wp as je,zu as Me}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Aa as o,Af as s,Ag as c,Ba as l,Bu as u,By as d,Ca as f,Cp as p,Ga as m,Gf as h,Hf as g,Ia as _,Ja as v,Jm as y,Jw as b,Kf as x,Ky as S,La as C,Ma as w,Mf as T,Na as ee,Qw as E,Rf as D,Uf as O,Uh as k,Uy as te,Vf as ne,Vu as re,Wf as A,Wh as j,Wy as M,Xh as N,Ya as ie,Za as ae,Zh as oe,aC as se,cC as ce,dC as le,eS as P,fC as ue,gC as F,gp as de,hp as fe,iC as pe,ja as me,jf as he,ka as ge,la as _e,ma as ve,nC as ye,nS as be,na as xe,oC as Se,qm as Ce,qw as we,ra as Te,sC as Ee,tS as I,tT as De,ta as Oe,ua as ke,wa as Ae,wp as je,zu as Me}from"./loadAgentsDir-DaNpxaO-.js";import{C as Ne,Gr as L,I as R,N as Pe,P as z,Pn as Fe,Rn as Ie,ai as B,di as Le,fi as Re,j as ze,mt as Be,ot as Ve,t as V,xt as He}from"./src-DL3w8VPk2.js";import{t as H}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as Ue,z as We}from"./state-D5D6QpTX.js";import{n as Ge,t as Ke}from"./cwd-Nh5IZNKO.js";import{a as qe,c as Je,i as Ye,n as Xe,o as Ze}from"./debug-D58GQBDG.js";import{Ut as Qe,Vt as $e,h as et,t as tt}from"./settings-3xZ0fsvE.js";import{c as nt,h as rt,y as it}from"./config-DRy1I12M.js";import{B as at,L as ot,R as st,q as ct}from"./log-CZ7ploQm.js";import{b as lt,f as ut,m as dt,v as ft}from"./startupProfiler-CbzxVmbv.js";import{l as pt,o as mt}from"./stringUtils-CKD8qDqx.js";import{E as ht,Pt as gt,_ as _t,b as vt,dn as yt,fn as bt,gt as xt,xt as St,yt as Ct,zt as wt}from"./model-Do0f476p.js";import{gn as Tt,vn as Et}from"./prompt-8u06WVES.js";import{d as Dt,f as Ot,h as kt,p as At}from"./terminalSetup-kWdZRKWq.js";import{at as jt,st as Mt}from"./sessionState-CQhbGfmh.js";import{n as Nt,t as Pt}from"./systemTheme-Ceakddth.js";import{n as Ft,r as It}from"./PromptInputFooterSuggestions-DCum89fF.js";import{n as Lt,t as Rt}from"./useMainLoopModel-CIG2cjS2.js";import{n as zt,t as Bt}from"./modalContext-wY9CeN4G.js";import{n as Vt,r as Ht,t as Ut}from"./statusNoticeHelpers-CZoOse-_.js";import{a as Wt,c as Gt,i as Kt,l as qt,n as Jt,o as Yt,r as Xt,t as Zt,u as Qt}from"./logoUtils-CbIqOFrX.js";import{homedir as $t}from"os";import{relative as en}from"path";import{fileURLToPath as tn}from"url";function nn(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var rn=e((()=>{}));function an(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||Ae(t.text,`status`)!==`completed`?!1:Ae(t.text,`summary`)?.startsWith(`Background command `)??!1}function on(e,t){if(!j()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(an(t)){let i=0;for(;r<e.length&&an(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${at}><${ot}>completed</${ot}><${st}>${i} background commands completed</${st}></${at}>`}]}})}else n.push(t),r++}return n}var sn=e((()=>{ct(),c(),k(),C()}));function cn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function ln(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(cn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!cn(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var un=e((()=>{}));function dn(e){let t=mn.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),mn.set(e,t)),t}function fn(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function pn(e,t,n=!1){if(n)return{messages:e};let r=dn(t),i=new Map;for(let t of e){let e=fn(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=fn(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=fn(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var mn,hn=e((()=>{mn=new WeakMap}));function gn(e){let t=Sn.get(e);if(t!==void 0)return t;let n=_n(e).toLowerCase();return Sn.set(e,n),n}function _n(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=xn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?xn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(yn(e.toolUseResult));t=r.join(`
|
|
2
2
|
`)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[vn(e.input)]:[]).join(`
|
|
3
3
|
`));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
|
|
4
4
|
`);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,o as n}from"./envUtils-DcaKZlRU.js";import{$u as r,Pu as i,Qu as a,od as o,sd as s,uC as c}from"./loadAgentsDir-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,o as n}from"./envUtils-DcaKZlRU.js";import{$u as r,Pu as i,Qu as a,od as o,sd as s,uC as c}from"./loadAgentsDir-DaNpxaO-.js";import{Gt as l,H as u,I as d,Lt as f,P as p,ai as m,kt as h,t as g}from"./src-DL3w8VPk2.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as v,Jt as y}from"./settings-3xZ0fsvE.js";import{h as b,s as x}from"./config-DRy1I12M.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{It as w,Pt as T,hr as E,mr as D}from"./model-Do0f476p.js";import{c as O,i as k,s as A}from"./terminalSetup-kWdZRKWq.js";import{n as j,t as M}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{n as N,t as P}from"./ThemePicker-iD9ufy99.js";import{n as F,t as I}from"./PressEnterToContinue-Dwoh6CaW.js";import{t as L}from"./ApproveApiKey-Bf1Rb8Ql.js";n();var R=e(m(),1),z=_();S(),y(),b(),D(),T(),c(),k(),M(),g(),g(),i(),s(),r(),g();var B=58;function V(){let[e]=u(),t=`Welcome to Work Mate`;return v.terminal===`Apple_Terminal`?(0,z.jsx)(H,{theme:e,welcomeMessage:t}):[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,z.jsxs)(d,{width:B,flexDirection:`column`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(p,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,z.jsxs)(p,{dimColor:!0,children:[`v`,`0.0.20`,` `]})]}),(0,z.jsx)(p,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,z.jsx)(p,{children:` ░░░░░░ `}),(0,z.jsx)(p,{children:` ░░░ ░░░░░░░░░░ `}),(0,z.jsx)(p,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,z.jsx)(p,{children:` `})]}):(0,z.jsxs)(d,{width:B,flexDirection:`column`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(p,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,z.jsxs)(p,{dimColor:!0,children:[`v`,`0.0.20`,` `]})]}),(0,z.jsx)(p,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,z.jsx)(p,{children:` * █████▓▓░ `}),(0,z.jsx)(p,{children:` * ███▓░ ░░ `}),(0,z.jsx)(p,{children:` ░░░░░░ ███▓░ `}),(0,z.jsx)(p,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,z.jsxs)(p,{children:[(0,z.jsx)(p,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,z.jsx)(p,{bold:!0,children:`*`}),(0,z.jsx)(p,{children:` ██▓░░ ▓ `})]}),(0,z.jsx)(p,{children:` ░▓▓███▓▓░ `}),(0,z.jsx)(p,{dimColor:!0,children:` * ░░░░ `}),(0,z.jsx)(p,{dimColor:!0,children:` ░░░░░░░░ `}),(0,z.jsx)(p,{dimColor:!0,children:` * ░░░░░░░░░░░░░░░░ `}),(0,z.jsx)(p,{dimColor:!0,children:` * `})]})}function H({theme:e,welcomeMessage:t}){return[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,z.jsxs)(d,{width:B,flexDirection:`column`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(p,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,z.jsxs)(p,{dimColor:!0,children:[`v`,`0.0.20`,` `]})]}),(0,z.jsx)(p,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,z.jsx)(p,{children:` ░░░░░░ `}),(0,z.jsx)(p,{children:` ░░░ ░░░░░░░░░░ `}),(0,z.jsx)(p,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,z.jsx)(p,{children:` `})]}):(0,z.jsxs)(d,{width:B,flexDirection:`column`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(p,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,z.jsxs)(p,{dimColor:!0,children:[`v`,`0.0.20`,` `]})]}),(0,z.jsx)(p,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,z.jsx)(p,{children:` * █████▓▓░ `}),(0,z.jsx)(p,{children:` * ███▓░ ░░ `}),(0,z.jsx)(p,{children:` ░░░░░░ ███▓░ `}),(0,z.jsx)(p,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,z.jsxs)(p,{children:[(0,z.jsx)(p,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,z.jsx)(p,{bold:!0,children:`*`}),(0,z.jsx)(p,{children:` ██▓░░ ▓ `})]}),(0,z.jsx)(p,{children:` ░▓▓███▓▓░ `}),(0,z.jsx)(p,{dimColor:!0,children:` * ░░░░ `}),(0,z.jsx)(p,{dimColor:!0,children:` ░░░░░░░░ `}),(0,z.jsx)(p,{dimColor:!0,children:` ░░░░░░░░░░░░░░░░ `})]})}N(),F(),g();var U=(0,R.createContext)({marker:``});function W({children:e}){let{marker:t}=(0,R.useContext)(U);return(0,z.jsxs)(d,{gap:1,children:[(0,z.jsx)(p,{dimColor:!0,children:t}),(0,z.jsx)(d,{flexDirection:`column`,children:e})]})}g();var G=(0,R.createContext)({marker:``});function K({children:e}){let{marker:t}=(0,R.useContext)(G),n=0;for(let t of R.Children.toArray(e))!(0,R.isValidElement)(t)||t.type!==W||n++;let r=String(n).length;return(0,z.jsx)(d,{flexDirection:`column`,children:R.Children.map(e,(e,n)=>{if(!(0,R.isValidElement)(e)||e.type!==W)return e;let i=`${String(n+1).padStart(r)}.`,a=`${t}${i}`;return(0,z.jsx)(G.Provider,{value:{marker:a},children:(0,z.jsx)(U.Provider,{value:{marker:a},children:e})})})})}K.Item=W;var q=K;g(),y();function J({onDone:e}){let[n,r]=(0,R.useState)(0),[i,s]=(0,R.useState)(!1),[c]=(0,R.useState)(()=>w()),[m,g]=u();(0,R.useEffect)(()=>{C(`tengu_began_setup`,{oauthEnabled:c})},[c]);function _(){if(n<M.length-1){let e=n+1;r(e),C(`tengu_onboarding_step`,{oauthEnabled:c,stepId:M[e]?.id})}else e()}function y(e){g(e),_()}let b=j(),S=(0,z.jsx)(d,{marginX:1,children:(0,z.jsx)(P,{onThemeSelect:y,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),T=(0,z.jsxs)(d,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,z.jsx)(p,{bold:!0,children:`Before you start, keep in mind:`}),(0,z.jsx)(d,{flexDirection:`column`,width:70,children:(0,z.jsxs)(q,{children:[(0,z.jsxs)(q.Item,{children:[(0,z.jsx)(p,{children:`Always review changes before accepting`}),(0,z.jsxs)(p,{dimColor:!0,wrap:`wrap`,children:[`Work Mate can make mistakes — especially when running commands`,(0,z.jsx)(h,{}),`or editing files. You stay in control of every action.`,(0,z.jsx)(h,{})]})]}),(0,z.jsxs)(q.Item,{children:[(0,z.jsx)(p,{children:`Only use Work Mate on projects you trust`}),(0,z.jsxs)(p,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,z.jsx)(h,{}),(0,z.jsx)(f,{url:`https://code.workmate.com/docs/en/security`})]})]})]})}),(0,z.jsx)(I,{})]}),D=(0,R.useMemo)(()=>{if(!process.env.ANTHROPIC_API_KEY||t())return``;let e=E(process.env.ANTHROPIC_API_KEY);if(x(e)===`new`)return e},[]);function k(e){e&&s(!0),_()}let M=[];M.push({id:`theme`,component:S}),D&&M.push({id:`api-key`,component:(0,z.jsx)(L,{customApiKeyTruncated:D,onDone:k})}),c&&M.push({id:`oauth`,component:(0,z.jsx)(Y,{skip:i,onSkip:_,children:(0,z.jsx)(o,{onDone:_})})}),M.push({id:`security`,component:T}),O()&&M.push({id:`terminal-setup`,component:(0,z.jsxs)(d,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,z.jsx)(p,{bold:!0,children:`Use Work Mate's terminal setup?`}),(0,z.jsxs)(d,{flexDirection:`column`,width:70,gap:1,children:[(0,z.jsxs)(p,{children:[`For the optimal coding experience, enable the recommended settings`,(0,z.jsx)(h,{}),`for your terminal:`,` `,v.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,z.jsx)(a,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(m).catch(()=>{}).finally(_):_()},onCancel:()=>_()}),(0,z.jsx)(p,{dimColor:!0,children:b.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,z.jsx)(z.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let N=M[n],F=(0,R.useCallback)(()=>{n===M.length-1?e():_()},[n,M.length,c,e]),B=(0,R.useCallback)(()=>{_()},[n,M.length,c,e]);return l({"confirm:yes":F},{context:`Confirmation`,isActive:N?.id===`security`}),l({"confirm:no":B},{context:`Confirmation`,isActive:N?.id===`terminal-setup`}),(0,z.jsxs)(d,{flexDirection:`column`,children:[(0,z.jsx)(V,{}),(0,z.jsxs)(d,{flexDirection:`column`,marginTop:1,children:[N?.component,b.pending&&(0,z.jsx)(d,{padding:1,children:(0,z.jsxs)(p,{dimColor:!0,children:[`Press `,b.keyName,` again to exit`]})})]})]})}function Y({skip:e,onSkip:t,children:n}){return(0,R.useEffect)(()=>{e&&t()},[e,t]),e?null:n}export{J as Onboarding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{gC as n}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{gC as n}from"./loadAgentsDir-DaNpxaO-.js";import{Gr as r,I as i,P as a,ai as o,ot as s,t as c}from"./src-DL3w8VPk2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{C as u,v as d,x as f}from"./startupProfiler-CbzxVmbv.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:n,overlay:a}){let{rows:o}=s(),c=a?5:Math.min(6,Math.max(1,o-3));if(e.length===0)return null;let l=n??Math.max(...e.map(e=>r(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(i,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(o(),1),n(),c(),d(),_=l(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:n}){let i=s().columns;if(m(e.id)){let t=p(e.id),o=n?`suggestion`:void 0,s=!n,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),d=e.description?3:0,m;if(c){let t=e.description?Math.min(20,r(e.description)):0,n=i-2-4-d-t;m=f(e.displayText,n)}else m=l?u(e.displayText,30):e.displayText;let h=i-2-r(m)-d-4,g;if(e.description){let n=Math.max(0,h),r=u(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(a,{color:o,dimColor:s,wrap:`truncate`,children:g})}let o=Math.floor(i*.4),c=Math.min(t??r(e.displayText)+5,o),l=e.color||(n?`suggestion`:void 0),d=!n,h=e.displayText;r(h)>c-2&&(h=u(h,c-2));let g=h+` `.repeat(Math.max(0,c-r(h))),v=e.tag?`[${e.tag}] `:``,y=r(v),b=Math.max(0,i-c-y-4),x=e.description?u(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(a,{wrap:`truncate`,children:[(0,_.jsx)(a,{color:l,dimColor:d,children:g}),v?(0,_.jsx)(a,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(a,{color:n?`suggestion`:void 0,dimColor:!n,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AT as t,dC as n,fC as r,jT as i}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AT as t,dC as n,fC as r,jT as i}from"./loadAgentsDir-DaNpxaO-.js";import{I as a,P as o,t as s}from"./src-DL3w8VPk2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as l,Jt as u}from"./settings-3xZ0fsvE.js";import{c as d,h as f}from"./config-DRy1I12M.js";import{i as p,o as m}from"./platform-DMQxcm4K.js";import{J as h,Y as g,Z as _}from"./model-Do0f476p.js";import{a as v,i as y,r as b}from"./terminalSetup-kWdZRKWq.js";function x(){return d().editorMode===`vim`}function S(){return l.terminal===`Apple_Terminal`&&process.platform===`darwin`||v()?`shift + ⏎ for newline`:b()?`\\⏎ for newline`:`backslash (\\) + return (⏎) for newline`}function C(e,t){return t.ctrl||t.meta||t.escape||t.return||t.tab||t.backspace||t.delete||t.upArrow||t.downArrow||t.leftArrow||t.rightArrow||t.pageUp||t.pageDown||t.home||t.end?!1:e.length>0&&!/^\s/.test(e)&&!e.startsWith(`\x1B`)}var w=e((()=>{y(),f(),u()}));function T(e){return e.replace(/\+/g,` + `)}function E(e){let{dimColor:t,fixedWidth:n,gap:s,paddingX:c}=e,l=T(r(`app:toggleTranscript`,`Global`,`ctrl+o`)),u=T(r(`app:toggleTodos`,`Global`,`ctrl+t`)),d=T(r(`chat:undo`,`Chat`,`ctrl+_`)),f=T(r(`chat:stash`,`Chat`,`ctrl+s`)),m=T(r(`chat:cycleMode`,`Chat`,`shift+tab`)),h=T(r(`chat:modelPicker`,`Chat`,`alt+p`)),v=T(r(`chat:fastMode`,`Chat`,`alt+o`)),y=T(r(`chat:externalEditor`,`Chat`,`ctrl+g`));T(r(`app:toggleTerminal`,`Global`,`meta+j`));let b=T(r(`chat:imagePaste`,`Chat`,`ctrl+v`));return(0,D.jsxs)(a,{paddingX:c,flexDirection:`row`,gap:s,children:[(0,D.jsxs)(a,{flexDirection:`column`,width:n?24:void 0,children:[(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`! for bash mode`})}),(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`/ for commands`})}),(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`@ for file paths`})}),(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`& for background`})}),(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`/btw for side question`})})]}),(0,D.jsxs)(a,{flexDirection:`column`,width:n?35:void 0,children:[(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`double tap esc to clear input`})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[m,` to auto-accept edits`]})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[l,` for verbose output`]})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[u,` to toggle tasks`]})}),(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:S()})})]}),(0,D.jsxs)(a,{flexDirection:`column`,children:[(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[d,` to undo`]})}),p()!==`windows`&&(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`ctrl + z to suspend`})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[b,` to paste images`]})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[h,` to switch model`]})}),_()&&g()&&(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[v,` to toggle fast mode`]})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[f,` to stash prompt`]})}),(0,D.jsx)(a,{children:(0,D.jsxs)(o,{dimColor:t,children:[y,` to edit in $EDITOR`]})}),i()&&(0,D.jsx)(a,{children:(0,D.jsx)(o,{dimColor:t,children:`/keybindings to customize`})})]})]})}var D,O=e((()=>{s(),m(),t(),n(),h(),w(),D=c()}));export{x as a,C as i,O as n,w as r,E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{$ as o,$n as s,$y as c,AC as ee,Fb as l,Fi as u,J_ as d,Js as te,Ks as f,La as p,Li as m,Mv as h,Nv as g,Ny as ne,Pb as _,X as v,Xr as y,Y as re,Y_ as b,Ys as x,Zy as ie,_g as ae,_n as S,aE as oe,at as C,bg as w,br as T,by as E,ca as se,co as ce,da as le,fc as D,fm as O,iE as ue,kC as k,mg as de,no as A,ot as fe,pc as pe,q_ as j,qs as M,sp as N,um as P,uo as me,up as he,vT as F,vn as ge,yT as _e}from"./loadAgentsDir-DXOkUcW3.js";import{Kr as ve,qr as ye}from"./src-DL3w8VPk2.js";import{Tt as I,Ut as L,Wt as be,Z as R,ft as z,ut as xe,xt as B}from"./state-D5D6QpTX.js";import{n as V,t as Se}from"./cwd-Nh5IZNKO.js";import{J as H,Z as Ce,d as we,h as U}from"./settings-3xZ0fsvE.js";import{M as W,c as Te,h as Ee,j as De}from"./config-DRy1I12M.js";import{i as Oe,o as ke,q as Ae}from"./log-CZ7ploQm.js";import{C as je,J as Me,Pt as G,U as K,_ as Ne,gt as Pe,u as Fe}from"./model-Cxx3suBa.js";import{at as Ie,bn as Le,nt as Re,vn as q}from"./prompt-DEioJrx_.js";import{Q as ze,T as Be,et as Ve}from"./sessionState-DAcub-HK.js";import{a as He,n as Ue,r as We}from"./mappers-DYtq2XVS.js";import{n as J,o as Ge,r as Y}from"./MessageSelector-BgsrdJur.js";import{n as Ke,t as X}from"./systemTheme-Ceakddth.js";import{randomUUID as Z}from"crypto";n(),i(),ve(),L(),V(),Ae(),ke(),Ce(),U(),W(),q(),Ee(),ue(),G(),Me(),F(),Be(),c(),ne(),Ie(),g(),w(),O(),D(),ce(),A(),p(),m(),T(),S(),v(),fe(),b(),l(),Ne(),E(),N();async function qe({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?C(e,t,n,r):Promise.resolve([]),d(),i===void 0?j():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function Je({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:ee,agents:l}){let u=Fe(),d=a(),{defaultSystemPrompt:te,userContext:f,systemContext:p}=await qe({tools:e,mainLoopModel:u,additionalWorkingDirectories:Array.from(d.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),m=ze([...s===void 0?te:[s],...c?[c]:[]]),h=r.at(-1),g=h?.type===`assistant`&&h.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:m,userContext:f,systemContext:p,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:u,tools:e,verbose:!1,thinkingConfig:ee??(he()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:l,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:_(),readFileState:i,getAppState:a,setAppState:o,messages:g,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:g}}k(),Ue(),X();function Ye(e){return e===`Agent`?H:e}function Xe(e){let t=we()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:Se(),session_id:z(),tools:e.tools.map(e=>Ye(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:Pe().source,betas:xe(),claude_code_version:`0.0.19`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:Z()};return n.fast_mode_state=K(e.model,e.fastMode),n}L(),l(),V(),Me(),Ne(),E(),N(),M();var Ze=()=>{try{return Y(),e(J)}catch{return null}},Q=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??_(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=Ve}async*submitMessage(e,n){let{cwd:i,commands:a,tools:c,mcpClients:l,verbose:d=!1,thinkingConfig:p,maxTurns:m,maxBudgetUsd:g,taskBudget:ne,canUseTool:_,customSystemPrompt:v,appendSystemPrompt:b,userSpecifiedModel:ie,fallbackModel:S,jsonSchema:C,getAppState:w,setAppState:T,replayUserMessages:E=!1,includePartialMessages:ce=!1,agents:D=[],setSDKStatus:O,orphanedPermission:ue}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],ee(i);let k=!be(),A=Date.now(),fe=async(e,t,n,r,i,a)=>{let o=await _(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:Ye(e.name),tool_use_id:i,tool_input:t}),o},j=w(),M=ie?je(ie):Fe(),N=p||(he()===!1?{type:`disabled`}:{type:`adaptive`});P(`before_getSystemPrompt`);let F=typeof v==`string`?v:void 0,{defaultSystemPrompt:ve,userContext:L,systemContext:xe}=await qe({tools:c,mainLoopModel:M,additionalWorkingDirectories:Array.from(j.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:l,customSystemPrompt:F});P(`after_getSystemPrompt`);let V={...L},H=F!==void 0&&De()?await oe():null,Ce=ze([...F===void 0?ve:[F],...H?[H]:[],...b?[b]:[]]),we=c.some(e=>Le(e,Re));C&&we&&ge(T,z());let U={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:d,mainLoopModel:M,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:b,agentDefinitions:{activeAgents:D,allAgents:[]},theme:Ke(Te().theme),maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{T(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{T(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:O};if(ue&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of f(ue,c,this.mutableMessages,U))yield e}let{messages:W,shouldQuery:Ee,allowedTools:ke,model:Ae,resultText:Me}=await Ge({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...U,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...W);let G=[...this.mutableMessages];if(k&&W.length>0){let e=y(G);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s())}let Ne=Ze(),Pe=W.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(Ne?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),Ie=E?Pe:[];T(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:ke}}}));let q=Ae??M;U={messages:G,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:d,mainLoopModel:q,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:b,theme:Ke(Te().theme),agentDefinitions:{activeAgents:D,allAgents:[]},maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:U.updateFileHistoryState,updateAttributionState:U.updateAttributionState,setSDKStatus:O},P(`before_skills_plugins`);let[Be,{enabled:Ue}]=await Promise.all([u(Se()),me()]);if(P(`after_skills_plugins`),yield Xe({tools:c,mcpClients:l,model:q,permissionMode:j.toolPermissionContext.mode,commands:a,agents:D,skills:Be,plugins:Ue,fastMode:j.fastMode}),P(`system_message_yielded`),!Ee){for(let e of W)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:ye(e.message.content)},session_id:z(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield We(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:z(),uuid:e.uuid,compact_metadata:He(t.compactMetadata)}}k&&(await y(G),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-A,duration_api_ms:B(),num_turns:G.length-1,result:Me??``,stop_reason:null,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z()};return}if(de()&&k){let e=Ze()?.selectableUserMessagesFilter??(e=>!0);W.filter(e).forEach(e=>{ae(e=>{T(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let J=Ve,Y=1,X=!1,Je,Q=null,Qe=Oe().at(-1),$e=C?le(this.mutableMessages,Re):0;for await(let e of pe({messages:G,systemPrompt:Ce,userContext:V,systemContext:xe,canUseTool:fe,toolUseContext:U,fallbackModel:S,querySource:`sdk`,maxTurns:m,taskBudget:ne})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(k&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await y(this.mutableMessages.slice(0,e+1))}}if(G.push(e),k&&(e.type===`assistant`?y(G):await y(G)),!X&&Ie.length>0){X=!0;for(let e of Ie)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:z(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&Y++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Q=n),this.mutableMessages.push(t),yield*x(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),k&&(G.push(t),y(G)),yield*x(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*x(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){J=Ve;let e=t.message;J=o(J,e.usage)}if(t.type===`message_delta`){J=o(J,t.usage);let e=t.delta;e.stop_reason!=null&&(Q=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=re(this.totalUsage,J)),ce&&(yield{type:`stream_event`,event:t,session_id:z(),parent_tool_use_id:null,uuid:Z()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),k&&(G.push(n),y(G));let r=n.attachment;if(r.type===`structured_output`)Je=r.data;else if(r.type===`max_turns_reached`){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:r.turnCount,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else E&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:z(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=G.length-1;r>0&&G.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:z(),uuid:t.uuid,compact_metadata:He(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:h(e.error),session_id:z(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:z(),uuid:t.uuid};break}}if(g!==void 0&&I()>=g){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Reached maximum budget ($${g}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&C){let e=le(this.mutableMessages,Re)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=G.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?_e($.message.content)?.type??`none`:`n/a`;if(k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),!te($,Q)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:(()=>{let e=Oe(),t=Qe?e.lastIndexOf(Qe)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Q}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=_e($.message.content);e?.type===`text`&&!se.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-A,duration_api_ms:B(),num_turns:Y,result:nt,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,structured_output:Je,fast_mode_state:K(q,j.fastMode),uuid:Z()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=_()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return z()}setModel(e){this.config.userSpecifiedModel=e}};async function*Qe({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:ee,maxBudgetUsd:l,taskBudget:u,canUseTool:d,mutableMessages:te=[],getReadFileCache:f,setReadFileCache:p,customSystemPrompt:m,appendSystemPrompt:h,userSpecifiedModel:g,fallbackModel:ne,jsonSchema:_,getAppState:v,setAppState:y,abortController:re,replayUserMessages:b=!1,includePartialMessages:x=!1,handleElicitation:ae,agents:S=[],setSDKStatus:oe,orphanedPermission:C}){let w=new Q({cwd:i,tools:a,commands:e,mcpClients:o,agents:S??[],canUseTool:d,getAppState:v,setAppState:y,initialMessages:te,readFileCache:ie(f()),customSystemPrompt:m,appendSystemPrompt:h,userSpecifiedModel:g,fallbackModel:ne,thinkingConfig:c,maxTurns:ee,maxBudgetUsd:l,taskBudget:u,jsonSchema:_,verbose:s,handleElicitation:ae,replayUserMessages:b,includePartialMessages:x,setSDKStatus:oe,abortController:re,orphanedPermission:C});try{yield*w.submitMessage(t,{uuid:n,isMeta:r})}finally{p(w.getReadFileState())}}export{Qe as n,Je as r,Q as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{$ as o,$n as s,$y as c,AC as ee,Fb as l,Fi as u,J_ as d,Js as te,Ks as f,La as p,Li as m,Mv as h,Nv as g,Ny as ne,Pb as _,X as v,Xr as y,Y as re,Y_ as b,Ys as x,Zy as ie,_g as ae,_n as S,aE as oe,at as C,bg as w,br as T,by as E,ca as se,co as ce,da as le,fc as D,fm as O,iE as ue,kC as k,mg as de,no as A,ot as fe,pc as pe,q_ as j,qs as M,sp as N,um as P,uo as me,up as he,vT as F,vn as ge,yT as _e}from"./loadAgentsDir-DaNpxaO-.js";import{Kr as ve,qr as ye}from"./src-DL3w8VPk2.js";import{Tt as I,Ut as L,Wt as be,Z as R,ft as z,ut as xe,xt as B}from"./state-D5D6QpTX.js";import{n as V,t as Se}from"./cwd-Nh5IZNKO.js";import{J as H,Z as Ce,d as we,h as U}from"./settings-3xZ0fsvE.js";import{M as W,c as Te,h as Ee,j as De}from"./config-DRy1I12M.js";import{i as Oe,o as ke,q as Ae}from"./log-CZ7ploQm.js";import{C as je,J as Me,Pt as G,U as K,_ as Ne,gt as Pe,u as Fe}from"./model-Do0f476p.js";import{at as Ie,bn as Le,nt as Re,vn as q}from"./prompt-8u06WVES.js";import{Q as ze,T as Be,et as Ve}from"./sessionState-CQhbGfmh.js";import{a as He,n as Ue,r as We}from"./mappers-_B-s9fNz.js";import{n as J,o as Ge,r as Y}from"./MessageSelector-D8fylxPg.js";import{n as Ke,t as X}from"./systemTheme-Ceakddth.js";import{randomUUID as Z}from"crypto";n(),i(),ve(),L(),V(),Ae(),ke(),Ce(),U(),W(),q(),Ee(),ue(),G(),Me(),F(),Be(),c(),ne(),Ie(),g(),w(),O(),D(),ce(),A(),p(),m(),T(),S(),v(),fe(),b(),l(),Ne(),E(),N();async function qe({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?C(e,t,n,r):Promise.resolve([]),d(),i===void 0?j():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function Je({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:ee,agents:l}){let u=Fe(),d=a(),{defaultSystemPrompt:te,userContext:f,systemContext:p}=await qe({tools:e,mainLoopModel:u,additionalWorkingDirectories:Array.from(d.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),m=ze([...s===void 0?te:[s],...c?[c]:[]]),h=r.at(-1),g=h?.type===`assistant`&&h.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:m,userContext:f,systemContext:p,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:u,tools:e,verbose:!1,thinkingConfig:ee??(he()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:l,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:_(),readFileState:i,getAppState:a,setAppState:o,messages:g,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:g}}k(),Ue(),X();function Ye(e){return e===`Agent`?H:e}function Xe(e){let t=we()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:Se(),session_id:z(),tools:e.tools.map(e=>Ye(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:Pe().source,betas:xe(),claude_code_version:`0.0.20`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:Z()};return n.fast_mode_state=K(e.model,e.fastMode),n}L(),l(),V(),Me(),Ne(),E(),N(),M();var Ze=()=>{try{return Y(),e(J)}catch{return null}},Q=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??_(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=Ve}async*submitMessage(e,n){let{cwd:i,commands:a,tools:c,mcpClients:l,verbose:d=!1,thinkingConfig:p,maxTurns:m,maxBudgetUsd:g,taskBudget:ne,canUseTool:_,customSystemPrompt:v,appendSystemPrompt:b,userSpecifiedModel:ie,fallbackModel:S,jsonSchema:C,getAppState:w,setAppState:T,replayUserMessages:E=!1,includePartialMessages:ce=!1,agents:D=[],setSDKStatus:O,orphanedPermission:ue}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],ee(i);let k=!be(),A=Date.now(),fe=async(e,t,n,r,i,a)=>{let o=await _(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:Ye(e.name),tool_use_id:i,tool_input:t}),o},j=w(),M=ie?je(ie):Fe(),N=p||(he()===!1?{type:`disabled`}:{type:`adaptive`});P(`before_getSystemPrompt`);let F=typeof v==`string`?v:void 0,{defaultSystemPrompt:ve,userContext:L,systemContext:xe}=await qe({tools:c,mainLoopModel:M,additionalWorkingDirectories:Array.from(j.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:l,customSystemPrompt:F});P(`after_getSystemPrompt`);let V={...L},H=F!==void 0&&De()?await oe():null,Ce=ze([...F===void 0?ve:[F],...H?[H]:[],...b?[b]:[]]),we=c.some(e=>Le(e,Re));C&&we&&ge(T,z());let U={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:d,mainLoopModel:M,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:b,agentDefinitions:{activeAgents:D,allAgents:[]},theme:Ke(Te().theme),maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{T(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{T(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:O};if(ue&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of f(ue,c,this.mutableMessages,U))yield e}let{messages:W,shouldQuery:Ee,allowedTools:ke,model:Ae,resultText:Me}=await Ge({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...U,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...W);let G=[...this.mutableMessages];if(k&&W.length>0){let e=y(G);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s())}let Ne=Ze(),Pe=W.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(Ne?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),Ie=E?Pe:[];T(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:ke}}}));let q=Ae??M;U={messages:G,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:d,mainLoopModel:q,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:b,theme:Ke(Te().theme),agentDefinitions:{activeAgents:D,allAgents:[]},maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:U.updateFileHistoryState,updateAttributionState:U.updateAttributionState,setSDKStatus:O},P(`before_skills_plugins`);let[Be,{enabled:Ue}]=await Promise.all([u(Se()),me()]);if(P(`after_skills_plugins`),yield Xe({tools:c,mcpClients:l,model:q,permissionMode:j.toolPermissionContext.mode,commands:a,agents:D,skills:Be,plugins:Ue,fastMode:j.fastMode}),P(`system_message_yielded`),!Ee){for(let e of W)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:ye(e.message.content)},session_id:z(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield We(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:z(),uuid:e.uuid,compact_metadata:He(t.compactMetadata)}}k&&(await y(G),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-A,duration_api_ms:B(),num_turns:G.length-1,result:Me??``,stop_reason:null,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z()};return}if(de()&&k){let e=Ze()?.selectableUserMessagesFilter??(e=>!0);W.filter(e).forEach(e=>{ae(e=>{T(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let J=Ve,Y=1,X=!1,Je,Q=null,Qe=Oe().at(-1),$e=C?le(this.mutableMessages,Re):0;for await(let e of pe({messages:G,systemPrompt:Ce,userContext:V,systemContext:xe,canUseTool:fe,toolUseContext:U,fallbackModel:S,querySource:`sdk`,maxTurns:m,taskBudget:ne})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(k&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await y(this.mutableMessages.slice(0,e+1))}}if(G.push(e),k&&(e.type===`assistant`?y(G):await y(G)),!X&&Ie.length>0){X=!0;for(let e of Ie)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:z(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&Y++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Q=n),this.mutableMessages.push(t),yield*x(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),k&&(G.push(t),y(G)),yield*x(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*x(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){J=Ve;let e=t.message;J=o(J,e.usage)}if(t.type===`message_delta`){J=o(J,t.usage);let e=t.delta;e.stop_reason!=null&&(Q=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=re(this.totalUsage,J)),ce&&(yield{type:`stream_event`,event:t,session_id:z(),parent_tool_use_id:null,uuid:Z()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),k&&(G.push(n),y(G));let r=n.attachment;if(r.type===`structured_output`)Je=r.data;else if(r.type===`max_turns_reached`){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:r.turnCount,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else E&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:z(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=G.length-1;r>0&&G.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:z(),uuid:t.uuid,compact_metadata:He(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:h(e.error),session_id:z(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:z(),uuid:t.uuid};break}}if(g!==void 0&&I()>=g){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Reached maximum budget ($${g}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&C){let e=le(this.mutableMessages,Re)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=G.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?_e($.message.content)?.type??`none`:`n/a`;if(k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),!te($,Q)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-A,duration_api_ms:B(),is_error:!0,num_turns:Y,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:Z(),errors:(()=>{let e=Oe(),t=Qe?e.lastIndexOf(Qe)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Q}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=_e($.message.content);e?.type===`text`&&!se.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-A,duration_api_ms:B(),num_turns:Y,result:nt,stop_reason:Q,session_id:z(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:R(),permission_denials:this.permissionDenials,structured_output:Je,fast_mode_state:K(q,j.fastMode),uuid:Z()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=_()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return z()}setModel(e){this.config.userSpecifiedModel=e}};async function*Qe({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:ee,maxBudgetUsd:l,taskBudget:u,canUseTool:d,mutableMessages:te=[],getReadFileCache:f,setReadFileCache:p,customSystemPrompt:m,appendSystemPrompt:h,userSpecifiedModel:g,fallbackModel:ne,jsonSchema:_,getAppState:v,setAppState:y,abortController:re,replayUserMessages:b=!1,includePartialMessages:x=!1,handleElicitation:ae,agents:S=[],setSDKStatus:oe,orphanedPermission:C}){let w=new Q({cwd:i,tools:a,commands:e,mcpClients:o,agents:S??[],canUseTool:d,getAppState:v,setAppState:y,initialMessages:te,readFileCache:ie(f()),customSystemPrompt:m,appendSystemPrompt:h,userSpecifiedModel:g,fallbackModel:ne,thinkingConfig:c,maxTurns:ee,maxBudgetUsd:l,taskBudget:u,jsonSchema:_,verbose:s,handleElicitation:ae,replayUserMessages:b,includePartialMessages:x,setSDKStatus:oe,abortController:re,orphanedPermission:C});try{yield*w.submitMessage(t,{uuid:n,isMeta:r})}finally{p(w.getReadFileState())}}export{Qe as n,Je as r,Q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./REPL-CCBNfZfs.js";export{e as REPL};
|