openclaw-multi-auto 1.8.0 → 1.8.3
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/{agent-BomWJjOy.js → agent-ef71Xoo3.js} +10 -10
- package/dist/{audio-preflight-GAYJDgGF.js → audio-preflight-BK4MI6Gs.js} +1 -1
- package/dist/{audio-preflight-CZHCr2-5.js → audio-preflight-BQoP-O-0.js} +9 -9
- package/dist/{audio-preflight-SOY4qjTl.js → audio-preflight-DcneE70v.js} +6 -6
- package/dist/{audit-membership-runtime-fBOVjLNx.js → audit-membership-runtime-0b4ZhE41.js} +4 -4
- package/dist/{audit-membership-runtime-BQmoiW7f.js → audit-membership-runtime-BDoMjPgy.js} +3 -3
- package/dist/{auth-profiles-CEEqFOKJ.js → auth-profiles-Dta-Mhaw.js} +438 -438
- package/dist/auth-profiles.runtime-CLSx3zsq.js +7 -0
- package/dist/auth-profiles.runtime-CuInvQ6F.js +11 -0
- package/dist/{auth-profiles.runtime-IXde-3_L.js → auth-profiles.runtime-DEhTAVAo.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +10 -10
- package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +9 -9
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/compact.runtime-BOg89Gro.js +11 -0
- package/dist/compact.runtime-BgRco6mO.js +7 -0
- package/dist/{compact.runtime-BCHQpekB.js → compact.runtime-CH24Vvny.js} +1 -1
- package/dist/daemon-cli.js +53 -53
- package/dist/{deliver-runtime-Bm3VqH55.js → deliver-runtime-6WeFOxSI.js} +1 -1
- package/dist/deliver-runtime-BBwve6gL.js +7 -0
- package/dist/deliver-runtime-CUrIlSzN.js +11 -0
- package/dist/extensionAPI.js +1 -1
- package/dist/{fetch-wjPVlu-r.js → fetch-Bdod8UI1.js} +3 -3
- package/dist/{fetch-BdTTF2z-.js → fetch-sH_NN8SV.js} +2 -2
- package/dist/{frontmatter-DZlWsaUx.js → frontmatter-DhmdUnBP.js} +3 -3
- package/dist/{github-copilot-token-C-NbPL95.js → github-copilot-token-368sRGBD.js} +2 -2
- package/dist/{github-copilot-token-BeFx3MLn.js → github-copilot-token-BgPOyCXe.js} +7 -7
- package/dist/{image-runtime-CReMeTZL.js → image-runtime-BwzYRCA5.js} +1 -1
- package/dist/image-runtime-DiA6CU2y.js +7 -0
- package/dist/image-runtime-Dur8cmII.js +11 -0
- package/dist/llm-slug-generator.js +9 -9
- package/dist/{logger-mQKrXyAc.js → logger-Budylr6i.js} +18 -18
- package/dist/{logger-DCBlX1uz.js → logger-C0l_Gj8Y.js} +7 -7
- package/dist/{login-xsvrgJJt.js → login-BEOnxdap.js} +2 -2
- package/dist/{login-Ctt81ov4.js → login-Bk8BjEUN.js} +3 -3
- package/dist/{login-CKmmxErc.js → login-CvFRLU0k.js} +4 -4
- package/dist/{login-qr-CHrXhUJY.js → login-qr-CVQlH0l0.js} +7 -7
- package/dist/{login-qr-KVA4wuh0.js → login-qr-D-_3HfJq.js} +10 -10
- package/dist/{login-qr-D2jYdV8v.js → login-qr-FW_sLvPl.js} +2 -2
- package/dist/manager-runtime-BW_M_Kzt.js +7 -0
- package/dist/manager-runtime-CfBjUnwB.js +11 -0
- package/dist/{manager-runtime-BBxiBzvv.js → manager-runtime-DV0_pZDZ.js} +1 -1
- package/dist/{manager.runtime-CF3GyuMb.js → manager.runtime-CynsHdcO.js} +7 -7
- package/dist/{manager.runtime-BV-CBNb2.js → manager.runtime-DF-LRAbL.js} +10 -10
- package/dist/{manager.runtime-C5odxL4B.js → manager.runtime-KPIwNjNW.js} +12 -12
- package/dist/{model-selection-CNRMBWfR.js → model-selection-C9tlIhgN.js} +271 -271
- package/dist/{model-selection-BQm6_iuT.js → model-selection-qaBek98Q.js} +43 -43
- package/dist/{paths-jtwudEDq.js → paths-BnSNMlFT.js} +5 -5
- package/dist/{paths-CNIc83Pn.js → paths-BwJ6yG6k.js} +5 -5
- package/dist/pi-model-discovery-runtime-CK36RhYz.js +11 -0
- package/dist/{pi-model-discovery-runtime-C-YPAOQR.js → pi-model-discovery-runtime-CLfgSk3o.js} +6 -6
- package/dist/{pi-model-discovery-runtime-DeRljgTs.js → pi-model-discovery-runtime-Q0BoklY3.js} +1 -1
- package/dist/{pi-tools.before-tool-call.runtime-PhxG0y1R.js → pi-tools.before-tool-call.runtime-B_uML_Gt.js} +1 -1
- package/dist/{pi-tools.before-tool-call.runtime-CWgsv7kC.js → pi-tools.before-tool-call.runtime-CKzFGrVv.js} +6 -6
- package/dist/{pi-tools.before-tool-call.runtime-DgAiY2la.js → pi-tools.before-tool-call.runtime-CLRTNt4A.js} +9 -9
- package/dist/plugin-sdk/{audio-preflight-yyFn-I5K.js → audio-preflight-CVWl4NKo.js} +12 -12
- package/dist/plugin-sdk/{audit-membership-runtime-DHo6vLy0.js → audit-membership-runtime-D1VvFm38.js} +5 -5
- package/dist/plugin-sdk/{auth-profiles.runtime-DN3bNNeo.js → auth-profiles.runtime-Cy2e2Wah.js} +12 -12
- package/dist/plugin-sdk/{bluebubbles-BPDNQxEz.js → bluebubbles-B_tcmPhi.js} +1 -1
- package/dist/plugin-sdk/bluebubbles.js +15 -15
- package/dist/plugin-sdk/{channel-access-BaZDvsTA.js → channel-access-GDk6vyOi.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-DLZc22_m.js → channel-access-configure-CerQrsyV.js} +1 -1
- package/dist/plugin-sdk/{channel-config-helpers-CFkTEzkz.js → channel-config-helpers-CX9AfjCJ.js} +3 -3
- package/dist/plugin-sdk/{compact.runtime-D1HfZ8IJ.js → compact.runtime-0XuiRVw-.js} +12 -12
- package/dist/plugin-sdk/compat.js +28 -28
- package/dist/plugin-sdk/core.js +14 -14
- package/dist/plugin-sdk/{deliver-runtime-DrD2s_GI.js → deliver-runtime-D37pd8wU.js} +12 -12
- package/dist/plugin-sdk/device-pair.js +5 -5
- package/dist/plugin-sdk/diagnostics-otel.js +2 -2
- package/dist/plugin-sdk/{discord-BZR9M1Ft.js → discord-dU71XVvQ.js} +4 -4
- package/dist/plugin-sdk/discord.js +16 -16
- package/dist/plugin-sdk/{exec-BvTkR9oI.js → exec-88qB5pUO.js} +2 -2
- package/dist/plugin-sdk/feishu.js +14 -14
- package/dist/plugin-sdk/{fetch-yk-axchG.js → fetch-Cqwcg-Kq.js} +2 -2
- package/dist/plugin-sdk/{fetch-guard-Cwx1pJhf.js → fetch-guard-DEyOIg88.js} +1 -1
- package/dist/plugin-sdk/google-gemini-cli-auth.js +4 -4
- package/dist/plugin-sdk/googlechat.js +14 -14
- package/dist/plugin-sdk/{helpers-Cj2lgcNt.js → helpers-zm9M-XCJ.js} +1 -1
- package/dist/plugin-sdk/{http-registry-DyBqqyPO.js → http-registry-CR-l0QpT.js} +2 -2
- package/dist/plugin-sdk/{image-runtime-ChtfQsK-.js → image-runtime-CSZNFoHc.js} +12 -12
- package/dist/plugin-sdk/{imessage-DtibPuZP.js → imessage-DvtFTwJr.js} +3 -3
- package/dist/plugin-sdk/imessage.js +14 -14
- package/dist/plugin-sdk/{inbound-reply-dispatch-CfNEV0ZG.js → inbound-reply-dispatch-DpGprwTU.js} +1 -1
- package/dist/plugin-sdk/index.js +28 -28
- package/dist/plugin-sdk/irc.js +15 -15
- package/dist/plugin-sdk/{logger-C9fkmDdb.js → logger-D-go2oXy.js} +2 -2
- package/dist/plugin-sdk/{logger-DXnvMlr-.js → logger-Jt8cCPPV.js} +2 -2
- package/dist/plugin-sdk/{login-BC7QDpvj.js → login-CnT14vQ1.js} +5 -5
- package/dist/plugin-sdk/{login-qr-rnZFcwNs.js → login-qr-Di9Gqms7.js} +13 -13
- package/dist/plugin-sdk/{manager-runtime-B8O--3Jt.js → manager-runtime-DzCE2bL1.js} +12 -12
- package/dist/plugin-sdk/{manager.runtime-U_d65Qv1.js → manager.runtime-D6nT5fqn.js} +18 -18
- package/dist/plugin-sdk/matrix.js +16 -16
- package/dist/plugin-sdk/mattermost.js +14 -14
- package/dist/plugin-sdk/msteams.js +16 -16
- package/dist/plugin-sdk/nextcloud-talk.js +15 -15
- package/dist/plugin-sdk/nostr.js +4 -4
- package/dist/plugin-sdk/{outbound-media-DWtG1X8J.js → outbound-media-CN8bsq-T.js} +1 -1
- package/dist/plugin-sdk/{persistent-dedupe-BroxGf3Q.js → persistent-dedupe-CjCe_L5g.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-DWyENOD9.js → pi-model-discovery-runtime-1vkd_hCn.js} +12 -12
- package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-CPBeYJY2.js → pi-tools.before-tool-call.runtime-D0XEYwCa.js} +12 -12
- package/dist/plugin-sdk/{pw-ai-DR8Hjs-J.js → pw-ai-DkDE5awL.js} +12 -12
- package/dist/plugin-sdk/{qmd-manager-3qRPZ5ye.js → qmd-manager-CguAGtaF.js} +7 -7
- package/dist/plugin-sdk/{query-expansion-BnFYorqr.js → query-expansion-ChYs46vb.js} +5 -5
- package/dist/plugin-sdk/{redact-DTcVTGFU.js → redact-CqHkGWow.js} +1 -1
- package/dist/plugin-sdk/{run-command-qzkvaQG1.js → run-command-nYfMDZC3.js} +1 -1
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-UvsfFa7Q.js +24 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-CYBj8E4x.js +23 -0
- package/dist/plugin-sdk/{send-BZgg6N38.js → send-BDZssl9O.js} +5 -5
- package/dist/plugin-sdk/{session-Dm0FT_vI.js → session-DPhL1rLb.js} +5 -5
- package/dist/plugin-sdk/{signal-Dy_XjHKL.js → signal-BKMAyRnz.js} +6 -6
- package/dist/plugin-sdk/signal.js +14 -14
- package/dist/plugin-sdk/{slack-DNwpGTSd.js → slack-jues0BBq.js} +3 -3
- package/dist/plugin-sdk/slack.js +16 -16
- package/dist/plugin-sdk/{slash-commands.runtime-Bn7T59g3.js → slash-commands.runtime-BJ6veGjC.js} +12 -12
- package/dist/plugin-sdk/{slash-dispatch.runtime-BPsvStS0.js → slash-dispatch.runtime-CyWyh0DI.js} +12 -12
- package/dist/plugin-sdk/{slash-skill-commands.runtime-TDVZ7jxr.js → slash-skill-commands.runtime-BiDqNceZ.js} +12 -12
- package/dist/plugin-sdk/{subagent-registry-runtime-D3DovVGQ.js → subagent-registry-runtime-BVsFNLUF.js} +12 -12
- package/dist/plugin-sdk/{subsystem-DXcqLSNd.js → subsystem-DOh66yR6.js} +1 -1
- package/dist/plugin-sdk/synology-chat.js +4 -4
- package/dist/plugin-sdk/{telegram-B1RGxv8p.js → telegram-D3JLaXTI.js} +4 -4
- package/dist/plugin-sdk/telegram.js +14 -14
- package/dist/plugin-sdk/{text-chunking-CaqMErUv.js → text-chunking-Bd2LMKfE.js} +1 -1
- package/dist/plugin-sdk/{thread-bindings-Bp_o0GHR.js → thread-bindings-Cc59nx4d.js} +48 -48
- package/dist/plugin-sdk/tlon.js +13 -13
- package/dist/plugin-sdk/twitch.js +14 -14
- package/dist/plugin-sdk/{utils-BQpbGej3.js → utils-BhiRkVxe.js} +1 -1
- package/dist/plugin-sdk/{vllm-setup-wjrX_svM.js → vllm-setup-R5M9rOvm.js} +2 -2
- package/dist/plugin-sdk/voice-call.js +12 -12
- package/dist/plugin-sdk/{web-Dz6AjTQn.js → web-BpHTS6sG.js} +16 -16
- package/dist/plugin-sdk/{webhook-targets-yTQuv0k1.js → webhook-targets-t3fxeJQf.js} +1 -1
- package/dist/plugin-sdk/{whatsapp-actions-C5SohPL-.js → whatsapp-actions-BAJ27s8B.js} +13 -13
- package/dist/plugin-sdk/{whatsapp-heartbeat-_Kw4PPKA.js → whatsapp-heartbeat-D6NF4OC0.js} +3 -3
- package/dist/plugin-sdk/whatsapp.js +13 -13
- package/dist/plugin-sdk/zalo.js +15 -15
- package/dist/plugin-sdk/zalouser.js +16 -16
- package/dist/{pw-ai-BFfAJexr.js → pw-ai-BZnl84YT.js} +6 -6
- package/dist/{pw-ai-3ual6adI.js → pw-ai-CRL5SGWK.js} +9 -9
- package/dist/{pw-ai-CzFFsGR7.js → pw-ai-DzdseGw2.js} +1 -1
- package/dist/{qmd-manager-rY-Y6sbN.js → qmd-manager-BmuMJQP3.js} +3 -3
- package/dist/{qmd-manager-DvglNhlJ.js → qmd-manager-CFVuAj9l.js} +5 -5
- package/dist/{query-expansion-BIMwPSMg.js → query-expansion-BMQzl41m.js} +89 -89
- package/dist/{query-expansion-DXwSmE_K.js → query-expansion-DnS6CGY2.js} +8 -8
- package/dist/runtime-whatsapp-login.runtime-CO-iUlqS.js +13 -0
- package/dist/runtime-whatsapp-login.runtime-Dd6rJjLo.js +9 -0
- package/dist/{runtime-whatsapp-login.runtime-vKFKNi8Z.js → runtime-whatsapp-login.runtime-Dsz-DNfa.js} +3 -3
- package/dist/{runtime-whatsapp-outbound.runtime-SAT-C6UE.js → runtime-whatsapp-outbound.runtime-BeZMBTt6.js} +2 -2
- package/dist/runtime-whatsapp-outbound.runtime-CatYliOE.js +8 -0
- package/dist/runtime-whatsapp-outbound.runtime-IeVUgrJu.js +12 -0
- package/dist/{send-UG1n3OAg.js → send-CHO1gc7n.js} +2 -2
- package/dist/{send-CXnKWzde.js → send-CsgNtXyY.js} +3 -3
- package/dist/{send-DGQUY-kp.js → send-DxYxezcL.js} +1 -1
- package/dist/{session-CbQ43pUq.js → session--tqRfZQU.js} +1 -1
- package/dist/{session-kt-bqE_z.js → session-BhX4LYCK.js} +7 -7
- package/dist/{session-Bpmn--zO.js → session-r38wrRC6.js} +6 -6
- package/dist/slash-commands.runtime-BTNXGYOP.js +11 -0
- package/dist/{slash-commands.runtime-DoT9bJKb.js → slash-commands.runtime-C8j-n-bX.js} +1 -1
- package/dist/{slash-commands.runtime-DIrX0Ynq.js → slash-commands.runtime-J-gBOPcL.js} +6 -6
- package/dist/{slash-dispatch.runtime--9HmQuIE.js → slash-dispatch.runtime-BA-MMy0P.js} +1 -1
- package/dist/{slash-dispatch.runtime-CG-xSDdf.js → slash-dispatch.runtime-CwO02PY8.js} +6 -6
- package/dist/{slash-dispatch.runtime-Cu8ghe1h.js → slash-dispatch.runtime-cYx62DOd.js} +9 -9
- package/dist/slash-skill-commands.runtime-BQRfyLdb.js +7 -0
- package/dist/{slash-skill-commands.runtime-BZqnnkHJ.js → slash-skill-commands.runtime-Cm8K1kWM.js} +1 -1
- package/dist/slash-skill-commands.runtime-ThOxhaze.js +11 -0
- package/dist/{subagent-registry-runtime-rBYzVSXG.js → subagent-registry-runtime-1IiL0xom.js} +6 -6
- package/dist/{subagent-registry-runtime-9WfVik2h.js → subagent-registry-runtime-DKOXxZgH.js} +1 -1
- package/dist/{subagent-registry-runtime-Z0fdsGSq.js → subagent-registry-runtime-DkamrsVw.js} +9 -9
- package/dist/{subsystem-Cr1MiLhx.js → subsystem-CDcEQtQK.js} +14 -14
- package/dist/{web-DbsQPRh2.js → web-B_GcnsRF.js} +9 -9
- package/dist/{web-B_EVHbEP.js → web-RzQ9jrtt.js} +4 -4
- package/dist/{web-CXyjF_si.js → web-bHB4SzXZ.js} +12 -12
- package/dist/{whatsapp-actions-CnWp29AN.js → whatsapp-actions-BCgsmzOa.js} +7 -7
- package/dist/{whatsapp-actions-pQqLTCXJ.js → whatsapp-actions-BmDvJijd.js} +2 -2
- package/dist/{whatsapp-actions-BUvGEDSk.js → whatsapp-actions-BqFiZbuw.js} +10 -10
- package/dist/{workspace-Bi8vpJN0.js → workspace-Cg3kGb1y.js} +20 -20
- package/package.json +1 -1
- package/scripts/create-instance.sh +21 -3
- package/dist/auth-profiles.runtime-DNqCx0L5.js +0 -11
- package/dist/auth-profiles.runtime-DXPqJP5A.js +0 -7
- package/dist/compact.runtime-DS9UVeOh.js +0 -7
- package/dist/compact.runtime-pgjSlzSY.js +0 -11
- package/dist/deliver-runtime-D4aWAXZ9.js +0 -11
- package/dist/deliver-runtime-D929PgeO.js +0 -7
- package/dist/image-runtime-Brryt_BU.js +0 -11
- package/dist/image-runtime-CkdY0-Oo.js +0 -7
- package/dist/manager-runtime-D9AEoM1M.js +0 -11
- package/dist/manager-runtime-PqJtJx-b.js +0 -7
- package/dist/pi-model-discovery-runtime-CDKkuBYh.js +0 -11
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BDbgMnYK.js +0 -24
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-BYZKJw25.js +0 -23
- package/dist/runtime-whatsapp-login.runtime-Br3SxDXL.js +0 -13
- package/dist/runtime-whatsapp-login.runtime-DeV-bhiR.js +0 -9
- package/dist/runtime-whatsapp-outbound.runtime-BFY32bnC.js +0 -8
- package/dist/runtime-whatsapp-outbound.runtime-L3Qkst0n.js +0 -12
- package/dist/slash-commands.runtime-BYfxn_xu.js +0 -11
- package/dist/slash-skill-commands.runtime-8dS5PTaH.js +0 -11
- package/dist/slash-skill-commands.runtime-JEA80FeR.js +0 -7
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { $ as appendFileWithinRoot, A as supportsMemoryMultimodalEmbeddings, At as normalizeAtHashSlug, B as resolveWindowsSpawnProgram, C as isFileMissingError, Ct as resolveAgentWorkspaceDir, D as getMemoryMultimodalExtensions, Dt as resolveSessionAgentId, E as classifyMemoryMultimodalPath, Et as resolveRunModelFallbacksOverride, F as resolveSessionTranscriptPath$1, Ft as resolveAgentModelPrimaryValue, G as isAudioFileName, H as extensionForMime, I as resolveSessionTranscriptPathInDir, It as toAgentModelListLike, J as normalizeMimeType$1, K as isGifMedia, L as resolveSessionTranscriptsDirForAgent, M as resolveDefaultSessionStorePath, Mt as normalizeStringEntries, N as resolveSessionFilePath, Nt as normalizeStringEntriesLower, O as isMemoryMultimodalEnabled, Ot as resolveSessionAgentIds, P as resolveSessionFilePathOptions, Pt as resolveAgentModelFallbackValues, Q as SafeOpenError, R as resolveStorePath$1, S as splitTextToUtf8ByteLimit, St as resolveAgentSkillsFilter, T as buildCaseInsensitiveExtensionGlob, U as getFileExtension, V as detectMime, W as imageMimeFromFormat, X as maxBytesForKind, Y as MAX_IMAGE_BYTES$1, Z as mediaKindFromMime, _ as remapChunkLines, _t as resolveAgentConfig, a as listSessionFilesForAgent, b as estimateStructuredEmbeddingInputBytes, c as buildMultimodalChunkForIndexing, ct as assertNoPathAliasEscape, d as ensureDir$3, dt as redactToolDetail, et as copyFileWithinRoot, f as hashText$1, ft as compileSafeRegex, g as parseEmbedding, gt as listAgentIds, h as normalizeExtraMemoryPaths, ht as hasConfiguredModelFallbacks, i as buildSessionEntry, it as readLocalFileSafely, j as resolveAgentsDirFromSessionStorePath, jt as normalizeHyphenSlug, k as normalizeMemoryMultimodalSettings, kt as normalizeSkillFilter, l as chunkMarkdown, lt as getDefaultRedactPatterns, m as listMemoryFiles, mt as runTasksWithConcurrency, n as isQueryStopWordToken, nt as openFileWithinRoot, o as sessionPathForFile, ot as writeFileWithinRoot, p as isMemoryPath, pt as testRegexWithBoundedInput, q as kindFromMime, r as requireNodeSqlite, rt as readFileWithinRoot, s as buildFileEntry, st as PATH_ALIAS_POLICIES, t as extractKeywords, tt as createRootScopedReadFile, u as cosineSimilarity, ut as redactSensitiveText, v as runWithConcurrency$1, vt as resolveAgentDir, w as statRegularFile, wt as resolveDefaultAgentId, x as estimateUtf8Bytes, xt as resolveAgentModelFallbacksOverride, y as hasNonTextEmbeddingParts, yt as resolveAgentEffectiveModelPrimary, z as materializeWindowsSpawnProgram } from "./query-expansion-
|
|
3
|
-
import { a as resolveGatewayPort, c as resolveStateDir, f as resolveRequiredHomeDir, i as resolveDefaultConfigCandidates, l as expandHomePrefix, n as STATE_DIR, o as resolveOAuthDir, r as resolveConfigPath, s as resolveOAuthPath, t as DEFAULT_GATEWAY_PORT } from "./paths-
|
|
4
|
-
import { D as consumeRootOptionToken, E as resolvePreferredOpenClawTmpDir, T as readLoggingConfig, _ as colorize, a as defaultRuntime, b as getChildLogger, c as unregisterActiveProgressLine, d as logVerbose, g as warn, h as success, i as createNonExitingRuntime, l as danger, m as shouldLogVerbose, n as sanitizeForLog, o as clearActiveProgressLine, p as setVerbose, r as stripAnsi, s as registerActiveProgressLine, t as createSubsystemLogger, u as info, v as isRich, w as normalizeLogLevel, y as theme } from "./subsystem-
|
|
5
|
-
import { $ as deriveSessionChatType, A as isNotFoundPathError, B as isValidAgentId, C as openBoundaryFileSync, F as DEFAULT_MAIN_KEY, G as sanitizeAgentId, H as normalizeMainKey, I as buildAgentMainSessionKey, K as scopedHeartbeatWakeOptions, L as buildAgentPeerSessionKey, N as normalizeWindowsPathForComparison, O as resolvePathViaExistingAncestorSync, P as DEFAULT_AGENT_ID, Q as isBlockedObjectKey, S as openBoundaryFile, U as resolveAgentIdFromSessionKey, V as normalizeAgentId, W as resolveThreadSessionKeys, X as normalizeAccountId$3, Y as DEFAULT_ACCOUNT_ID, Z as normalizeOptionalAccountId, _ as runExec, a as DEFAULT_IDENTITY_FILENAME, at as resolveThreadParentSessionKey, b as markOpenClawExecEnv, c as DEFAULT_USER_FILENAME, et as getSubagentDepth, f as loadWorkspaceBootstrapFiles, g as runCommandWithTimeout, h as resolveOpenClawPackageRootSync, i as DEFAULT_HEARTBEAT_FILENAME, it as parseAgentSessionKey, j as isPathInside$2, l as ensureAgentWorkspace, m as resolveOpenClawPackageRoot, n as DEFAULT_AGENT_WORKSPACE_DIR, nt as isCronSessionKey, o as DEFAULT_SOUL_FILENAME, q as toAgentRequestSessionKey, r as DEFAULT_BOOTSTRAP_FILENAME, rt as isSubagentSessionKey, s as DEFAULT_TOOLS_FILENAME, t as DEFAULT_AGENTS_FILENAME, tt as isAcpSessionKey, u as filterBootstrapFilesForSession, v as resolveWindowsCommandShim, w as openVerifiedFileSync, x as canUseBoundaryFileOpen, y as spawnWithFallback, z as classifySessionKeyShape } from "./workspace-
|
|
6
|
-
import { C as sleep$2, D as isPlainObject$2, E as truncateUtf16Safe, S as shortenHomePath, _ as resolveConfigDir, a as CONFIG_DIR, b as safeParseJson, c as clampNumber$1, d as formatTerminalLink, f as isRecord$7, h as normalizeE164, i as logWarn, l as ensureDir$4, m as jidToE164, n as logError, r as logInfo, s as clampInt, t as logDebug, u as escapeRegExp, w as sliceUtf16Safe, x as shortenHomeInString, y as resolveUserPath } from "./logger-
|
|
7
|
-
import { a as saveJsonFile, i as loadJsonFile, r as resolveCopilotApiToken, t as DEFAULT_COPILOT_API_BASE_URL } from "./github-copilot-token-
|
|
2
|
+
import { $ as appendFileWithinRoot, A as supportsMemoryMultimodalEmbeddings, At as normalizeAtHashSlug, B as resolveWindowsSpawnProgram, C as isFileMissingError, Ct as resolveAgentWorkspaceDir, D as getMemoryMultimodalExtensions, Dt as resolveSessionAgentId, E as classifyMemoryMultimodalPath, Et as resolveRunModelFallbacksOverride, F as resolveSessionTranscriptPath$1, Ft as resolveAgentModelPrimaryValue, G as isAudioFileName, H as extensionForMime, I as resolveSessionTranscriptPathInDir, It as toAgentModelListLike, J as normalizeMimeType$1, K as isGifMedia, L as resolveSessionTranscriptsDirForAgent, M as resolveDefaultSessionStorePath, Mt as normalizeStringEntries, N as resolveSessionFilePath, Nt as normalizeStringEntriesLower, O as isMemoryMultimodalEnabled, Ot as resolveSessionAgentIds, P as resolveSessionFilePathOptions, Pt as resolveAgentModelFallbackValues, Q as SafeOpenError, R as resolveStorePath$1, S as splitTextToUtf8ByteLimit, St as resolveAgentSkillsFilter, T as buildCaseInsensitiveExtensionGlob, U as getFileExtension, V as detectMime, W as imageMimeFromFormat, X as maxBytesForKind, Y as MAX_IMAGE_BYTES$1, Z as mediaKindFromMime, _ as remapChunkLines, _t as resolveAgentConfig, a as listSessionFilesForAgent, b as estimateStructuredEmbeddingInputBytes, c as buildMultimodalChunkForIndexing, ct as assertNoPathAliasEscape, d as ensureDir$3, dt as redactToolDetail, et as copyFileWithinRoot, f as hashText$1, ft as compileSafeRegex, g as parseEmbedding, gt as listAgentIds, h as normalizeExtraMemoryPaths, ht as hasConfiguredModelFallbacks, i as buildSessionEntry, it as readLocalFileSafely, j as resolveAgentsDirFromSessionStorePath, jt as normalizeHyphenSlug, k as normalizeMemoryMultimodalSettings, kt as normalizeSkillFilter, l as chunkMarkdown, lt as getDefaultRedactPatterns, m as listMemoryFiles, mt as runTasksWithConcurrency, n as isQueryStopWordToken, nt as openFileWithinRoot, o as sessionPathForFile, ot as writeFileWithinRoot, p as isMemoryPath, pt as testRegexWithBoundedInput, q as kindFromMime, r as requireNodeSqlite, rt as readFileWithinRoot, s as buildFileEntry, st as PATH_ALIAS_POLICIES, t as extractKeywords, tt as createRootScopedReadFile, u as cosineSimilarity, ut as redactSensitiveText, v as runWithConcurrency$1, vt as resolveAgentDir, w as statRegularFile, wt as resolveDefaultAgentId, x as estimateUtf8Bytes, xt as resolveAgentModelFallbacksOverride, y as hasNonTextEmbeddingParts, yt as resolveAgentEffectiveModelPrimary, z as materializeWindowsSpawnProgram } from "./query-expansion-DnS6CGY2.js";
|
|
3
|
+
import { a as resolveGatewayPort, c as resolveStateDir, f as resolveRequiredHomeDir, i as resolveDefaultConfigCandidates, l as expandHomePrefix, n as STATE_DIR, o as resolveOAuthDir, r as resolveConfigPath, s as resolveOAuthPath, t as DEFAULT_GATEWAY_PORT } from "./paths-BwJ6yG6k.js";
|
|
4
|
+
import { D as consumeRootOptionToken, E as resolvePreferredOpenClawTmpDir, T as readLoggingConfig, _ as colorize, a as defaultRuntime, b as getChildLogger, c as unregisterActiveProgressLine, d as logVerbose, g as warn, h as success, i as createNonExitingRuntime, l as danger, m as shouldLogVerbose, n as sanitizeForLog, o as clearActiveProgressLine, p as setVerbose, r as stripAnsi, s as registerActiveProgressLine, t as createSubsystemLogger, u as info, v as isRich, w as normalizeLogLevel, y as theme } from "./subsystem-CDcEQtQK.js";
|
|
5
|
+
import { $ as deriveSessionChatType, A as isNotFoundPathError, B as isValidAgentId, C as openBoundaryFileSync, F as DEFAULT_MAIN_KEY, G as sanitizeAgentId, H as normalizeMainKey, I as buildAgentMainSessionKey, K as scopedHeartbeatWakeOptions, L as buildAgentPeerSessionKey, N as normalizeWindowsPathForComparison, O as resolvePathViaExistingAncestorSync, P as DEFAULT_AGENT_ID, Q as isBlockedObjectKey, S as openBoundaryFile, U as resolveAgentIdFromSessionKey, V as normalizeAgentId, W as resolveThreadSessionKeys, X as normalizeAccountId$3, Y as DEFAULT_ACCOUNT_ID, Z as normalizeOptionalAccountId, _ as runExec, a as DEFAULT_IDENTITY_FILENAME, at as resolveThreadParentSessionKey, b as markOpenClawExecEnv, c as DEFAULT_USER_FILENAME, et as getSubagentDepth, f as loadWorkspaceBootstrapFiles, g as runCommandWithTimeout, h as resolveOpenClawPackageRootSync, i as DEFAULT_HEARTBEAT_FILENAME, it as parseAgentSessionKey, j as isPathInside$2, l as ensureAgentWorkspace, m as resolveOpenClawPackageRoot, n as DEFAULT_AGENT_WORKSPACE_DIR, nt as isCronSessionKey, o as DEFAULT_SOUL_FILENAME, q as toAgentRequestSessionKey, r as DEFAULT_BOOTSTRAP_FILENAME, rt as isSubagentSessionKey, s as DEFAULT_TOOLS_FILENAME, t as DEFAULT_AGENTS_FILENAME, tt as isAcpSessionKey, u as filterBootstrapFilesForSession, v as resolveWindowsCommandShim, w as openVerifiedFileSync, x as canUseBoundaryFileOpen, y as spawnWithFallback, z as classifySessionKeyShape } from "./workspace-Cg3kGb1y.js";
|
|
6
|
+
import { C as sleep$2, D as isPlainObject$2, E as truncateUtf16Safe, S as shortenHomePath, _ as resolveConfigDir, a as CONFIG_DIR, b as safeParseJson, c as clampNumber$1, d as formatTerminalLink, f as isRecord$7, h as normalizeE164, i as logWarn, l as ensureDir$4, m as jidToE164, n as logError, r as logInfo, s as clampInt, t as logDebug, u as escapeRegExp, w as sliceUtf16Safe, x as shortenHomeInString, y as resolveUserPath } from "./logger-C0l_Gj8Y.js";
|
|
7
|
+
import { a as saveJsonFile, i as loadJsonFile, r as resolveCopilotApiToken, t as DEFAULT_COPILOT_API_BASE_URL } from "./github-copilot-token-368sRGBD.js";
|
|
8
8
|
import { t as parseBooleanValue$1 } from "./boolean-C7Ct_klp.js";
|
|
9
|
-
import { a as wrapFetchWithAbortSignal, c as bindAbortRelay, d as hasProxyEnvConfigured, f as isTruthyEnvValue, i as resolveFetch, l as fetchWithTimeout, n as resolveTelegramTransport, o as makeProxyFetch, r as shouldRetryTelegramIpv4Fallback, s as resolveProxyFetchFromEnv, t as resolveTelegramFetch, u as hasEnvHttpProxyConfigured } from "./fetch-
|
|
10
|
-
import { a as parseOpenClawManifestInstallBase, c as resolveOpenClawManifestOs, d as evaluateRuntimeEligibility, f as hasBinary$1, h as createInternalHookEvent, i as parseFrontmatterBool, l as resolveOpenClawManifestRequires, m as MANIFEST_KEY, n as getFrontmatterString, o as resolveOpenClawManifestBlock, p as isConfigPathTruthyWithDefaults, r as normalizeStringList$2, s as resolveOpenClawManifestInstall, t as applyOpenClawManifestInstallCommonFields, u as parseFrontmatterBlock, v as registerInternalHook, y as triggerInternalHook } from "./frontmatter-
|
|
9
|
+
import { a as wrapFetchWithAbortSignal, c as bindAbortRelay, d as hasProxyEnvConfigured, f as isTruthyEnvValue, i as resolveFetch, l as fetchWithTimeout, n as resolveTelegramTransport, o as makeProxyFetch, r as shouldRetryTelegramIpv4Fallback, s as resolveProxyFetchFromEnv, t as resolveTelegramFetch, u as hasEnvHttpProxyConfigured } from "./fetch-sH_NN8SV.js";
|
|
10
|
+
import { a as parseOpenClawManifestInstallBase, c as resolveOpenClawManifestOs, d as evaluateRuntimeEligibility, f as hasBinary$1, h as createInternalHookEvent, i as parseFrontmatterBool, l as resolveOpenClawManifestRequires, m as MANIFEST_KEY, n as getFrontmatterString, o as resolveOpenClawManifestBlock, p as isConfigPathTruthyWithDefaults, r as normalizeStringList$2, s as resolveOpenClawManifestInstall, t as applyOpenClawManifestInstallCommonFields, u as parseFrontmatterBlock, v as registerInternalHook, y as triggerInternalHook } from "./frontmatter-DhmdUnBP.js";
|
|
11
11
|
import { n as recordCommandPoll, r as resetCommandPollCount } from "./command-poll-backoff-D_rJDals.js";
|
|
12
12
|
import { createRequire } from "node:module";
|
|
13
|
-
import * as fs$
|
|
13
|
+
import * as fs$2 from "node:fs/promises";
|
|
14
14
|
import fs, { appendFile, mkdir } from "node:fs/promises";
|
|
15
15
|
import os, { homedir } from "node:os";
|
|
16
16
|
import * as path$1 from "node:path";
|
|
17
17
|
import path, { isAbsolute, join, posix } from "node:path";
|
|
18
|
-
import
|
|
18
|
+
import fs$1, { constants, existsSync, mkdirSync, mkdtempSync, promises, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
19
19
|
import JSON5 from "json5";
|
|
20
20
|
import util, { inspect, isDeepStrictEqual, promisify } from "node:util";
|
|
21
21
|
import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -521,7 +521,7 @@ function isValidPid(pid) {
|
|
|
521
521
|
function isZombieProcess(pid) {
|
|
522
522
|
if (process.platform !== "linux") return false;
|
|
523
523
|
try {
|
|
524
|
-
return
|
|
524
|
+
return fs$1.readFileSync(`/proc/${pid}/status`, "utf8").match(/^State:\s+(\S)/m)?.[1] === "Z";
|
|
525
525
|
} catch {
|
|
526
526
|
return false;
|
|
527
527
|
}
|
|
@@ -548,7 +548,7 @@ function getProcessStartTime(pid) {
|
|
|
548
548
|
if (process.platform !== "linux") return null;
|
|
549
549
|
if (!isValidPid(pid)) return null;
|
|
550
550
|
try {
|
|
551
|
-
const stat =
|
|
551
|
+
const stat = fs$1.readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
552
552
|
const commEndIndex = stat.lastIndexOf(")");
|
|
553
553
|
if (commEndIndex < 0) return null;
|
|
554
554
|
const fields = stat.slice(commEndIndex + 1).trimStart().split(/\s+/);
|
|
@@ -685,7 +685,7 @@ function resolveCodexHomePath() {
|
|
|
685
685
|
const configured = process.env.CODEX_HOME;
|
|
686
686
|
const home = configured ? resolveUserPath(configured) : resolveUserPath("~/.codex");
|
|
687
687
|
try {
|
|
688
|
-
return
|
|
688
|
+
return fs$1.realpathSync.native(home);
|
|
689
689
|
} catch {
|
|
690
690
|
return home;
|
|
691
691
|
}
|
|
@@ -782,7 +782,7 @@ function readCodexCliCredentials(options) {
|
|
|
782
782
|
if (typeof refreshToken !== "string" || !refreshToken) return null;
|
|
783
783
|
let expires;
|
|
784
784
|
try {
|
|
785
|
-
expires =
|
|
785
|
+
expires = fs$1.statSync(authPath).mtimeMs + 3600 * 1e3;
|
|
786
786
|
} catch {
|
|
787
787
|
expires = Date.now() + 3600 * 1e3;
|
|
788
788
|
}
|
|
@@ -917,7 +917,7 @@ function resolveAuthStorePathForDisplay(agentDir) {
|
|
|
917
917
|
return pathname.startsWith("~") ? pathname : resolveUserPath(pathname);
|
|
918
918
|
}
|
|
919
919
|
function ensureAuthStoreFile(pathname) {
|
|
920
|
-
if (
|
|
920
|
+
if (fs$1.existsSync(pathname)) return;
|
|
921
921
|
saveJsonFile(pathname, {
|
|
922
922
|
version: 1,
|
|
923
923
|
profiles: {}
|
|
@@ -1178,7 +1178,7 @@ function loadAuthProfileStoreForAgent(agentDir, options) {
|
|
|
1178
1178
|
if (shouldWrite && legacy !== null) {
|
|
1179
1179
|
const legacyPath = resolveLegacyAuthStorePath(agentDir);
|
|
1180
1180
|
try {
|
|
1181
|
-
|
|
1181
|
+
fs$1.unlinkSync(legacyPath);
|
|
1182
1182
|
} catch (err) {
|
|
1183
1183
|
if (err?.code !== "ENOENT") log$51.warn("failed to delete legacy auth.json after migration", {
|
|
1184
1184
|
err,
|
|
@@ -1361,7 +1361,7 @@ function loadDotEnv(opts) {
|
|
|
1361
1361
|
const quiet = opts?.quiet ?? true;
|
|
1362
1362
|
dotenv.config({ quiet });
|
|
1363
1363
|
const globalEnvPath = path.join(resolveConfigDir(process.env), ".env");
|
|
1364
|
-
if (!
|
|
1364
|
+
if (!fs$1.existsSync(globalEnvPath)) return;
|
|
1365
1365
|
dotenv.config({
|
|
1366
1366
|
quiet,
|
|
1367
1367
|
path: globalEnvPath,
|
|
@@ -1516,7 +1516,7 @@ function resolveTimeoutMs$3(timeoutMs) {
|
|
|
1516
1516
|
function readEtcShells() {
|
|
1517
1517
|
if (cachedEtcShells !== void 0) return cachedEtcShells;
|
|
1518
1518
|
try {
|
|
1519
|
-
const entries =
|
|
1519
|
+
const entries = fs$1.readFileSync("/etc/shells", "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#") && path.isAbsolute(line));
|
|
1520
1520
|
cachedEtcShells = new Set(entries);
|
|
1521
1521
|
} catch {
|
|
1522
1522
|
cachedEtcShells = null;
|
|
@@ -2003,7 +2003,7 @@ function resolveActiveTalkProviderConfig(talk) {
|
|
|
2003
2003
|
};
|
|
2004
2004
|
}
|
|
2005
2005
|
function readTalkApiKeyFromProfile(deps = {}) {
|
|
2006
|
-
const fsImpl = deps.fs ??
|
|
2006
|
+
const fsImpl = deps.fs ?? fs$1;
|
|
2007
2007
|
const osImpl = deps.os ?? os;
|
|
2008
2008
|
const pathImpl = deps.path ?? path;
|
|
2009
2009
|
const home = osImpl.homedir();
|
|
@@ -2653,7 +2653,7 @@ function isPathInside$1(basePath, candidatePath) {
|
|
|
2653
2653
|
}
|
|
2654
2654
|
function safeRealpathSync$1(filePath) {
|
|
2655
2655
|
try {
|
|
2656
|
-
return
|
|
2656
|
+
return fs$1.realpathSync(filePath);
|
|
2657
2657
|
} catch {
|
|
2658
2658
|
return null;
|
|
2659
2659
|
}
|
|
@@ -2760,7 +2760,7 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
2760
2760
|
const normalized = path.normalize(resolved);
|
|
2761
2761
|
if (!isPathInside$1(this.rootDir, normalized)) throw new ConfigIncludeError(`Include path escapes config directory: ${includePath} (root: ${this.rootDir})`, includePath);
|
|
2762
2762
|
try {
|
|
2763
|
-
const real =
|
|
2763
|
+
const real = fs$1.realpathSync(normalized);
|
|
2764
2764
|
if (!isPathInside$1(this.rootRealDir, real)) throw new ConfigIncludeError(`Include path resolves outside config directory (symlink): ${includePath} (root: ${this.rootDir})`, includePath);
|
|
2765
2765
|
} catch (err) {
|
|
2766
2766
|
if (err instanceof ConfigIncludeError) throw err;
|
|
@@ -2802,13 +2802,13 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
2802
2802
|
};
|
|
2803
2803
|
function safeRealpath(target) {
|
|
2804
2804
|
try {
|
|
2805
|
-
return
|
|
2805
|
+
return fs$1.realpathSync(target);
|
|
2806
2806
|
} catch {
|
|
2807
2807
|
return target;
|
|
2808
2808
|
}
|
|
2809
2809
|
}
|
|
2810
2810
|
function readConfigIncludeFileWithGuards(params) {
|
|
2811
|
-
const ioFs = params.ioFs ??
|
|
2811
|
+
const ioFs = params.ioFs ?? fs$1;
|
|
2812
2812
|
const maxBytes = params.maxBytes ?? 2097152;
|
|
2813
2813
|
if (!canUseBoundaryFileOpen(ioFs)) return ioFs.readFileSync(params.resolvedPath, "utf-8");
|
|
2814
2814
|
const opened = openBoundaryFileSync({
|
|
@@ -2831,7 +2831,7 @@ function readConfigIncludeFileWithGuards(params) {
|
|
|
2831
2831
|
}
|
|
2832
2832
|
}
|
|
2833
2833
|
const defaultResolver = {
|
|
2834
|
-
readFile: (p) =>
|
|
2834
|
+
readFile: (p) => fs$1.readFileSync(p, "utf-8"),
|
|
2835
2835
|
readFileWithGuards: ({ includePath, resolvedPath, rootRealDir }) => readConfigIncludeFileWithGuards({
|
|
2836
2836
|
includePath,
|
|
2837
2837
|
resolvedPath,
|
|
@@ -4469,7 +4469,7 @@ function normalizeMatchTarget(value) {
|
|
|
4469
4469
|
}
|
|
4470
4470
|
function tryRealpath$1(value) {
|
|
4471
4471
|
try {
|
|
4472
|
-
return
|
|
4472
|
+
return fs$1.realpathSync(value);
|
|
4473
4473
|
} catch {
|
|
4474
4474
|
return null;
|
|
4475
4475
|
}
|
|
@@ -5033,13 +5033,13 @@ function resolveWindowsExecutableExtSet(env) {
|
|
|
5033
5033
|
}
|
|
5034
5034
|
function isExecutableFile(filePath) {
|
|
5035
5035
|
try {
|
|
5036
|
-
if (!
|
|
5036
|
+
if (!fs$1.statSync(filePath).isFile()) return false;
|
|
5037
5037
|
if (process.platform === "win32") {
|
|
5038
5038
|
const ext = path.extname(filePath).toLowerCase();
|
|
5039
5039
|
if (!ext) return true;
|
|
5040
5040
|
return resolveWindowsExecutableExtSet(void 0).has(ext);
|
|
5041
5041
|
}
|
|
5042
|
-
|
|
5042
|
+
fs$1.accessSync(filePath, fs$1.constants.X_OK);
|
|
5043
5043
|
return true;
|
|
5044
5044
|
} catch {
|
|
5045
5045
|
return false;
|
|
@@ -5077,7 +5077,7 @@ const DEFAULT_SAFE_BINS = [
|
|
|
5077
5077
|
function tryResolveRealpath(filePath) {
|
|
5078
5078
|
if (!filePath) return;
|
|
5079
5079
|
try {
|
|
5080
|
-
return
|
|
5080
|
+
return fs$1.realpathSync(filePath);
|
|
5081
5081
|
} catch {
|
|
5082
5082
|
return;
|
|
5083
5083
|
}
|
|
@@ -5957,7 +5957,7 @@ function listWritableExplicitTrustedSafeBinDirs(entries) {
|
|
|
5957
5957
|
for (const dir of resolved) {
|
|
5958
5958
|
let stat;
|
|
5959
5959
|
try {
|
|
5960
|
-
stat =
|
|
5960
|
+
stat = fs$1.statSync(dir);
|
|
5961
5961
|
} catch {
|
|
5962
5962
|
continue;
|
|
5963
5963
|
}
|
|
@@ -7430,7 +7430,7 @@ function normalizeStringList$1(value) {
|
|
|
7430
7430
|
function resolvePluginManifestPath(rootDir) {
|
|
7431
7431
|
for (const filename of PLUGIN_MANIFEST_FILENAMES) {
|
|
7432
7432
|
const candidate = path.join(rootDir, filename);
|
|
7433
|
-
if (
|
|
7433
|
+
if (fs$1.existsSync(candidate)) return candidate;
|
|
7434
7434
|
}
|
|
7435
7435
|
return path.join(rootDir, PLUGIN_MANIFEST_FILENAME);
|
|
7436
7436
|
}
|
|
@@ -7456,7 +7456,7 @@ function loadPluginManifest(rootDir, rejectHardlinks = true) {
|
|
|
7456
7456
|
}
|
|
7457
7457
|
let raw;
|
|
7458
7458
|
try {
|
|
7459
|
-
raw = JSON.parse(
|
|
7459
|
+
raw = JSON.parse(fs$1.readFileSync(opened.fd, "utf-8"));
|
|
7460
7460
|
} catch (err) {
|
|
7461
7461
|
return {
|
|
7462
7462
|
ok: false,
|
|
@@ -7464,7 +7464,7 @@ function loadPluginManifest(rootDir, rejectHardlinks = true) {
|
|
|
7464
7464
|
manifestPath
|
|
7465
7465
|
};
|
|
7466
7466
|
} finally {
|
|
7467
|
-
|
|
7467
|
+
fs$1.closeSync(opened.fd);
|
|
7468
7468
|
}
|
|
7469
7469
|
if (!isRecord$7(raw)) return {
|
|
7470
7470
|
ok: false,
|
|
@@ -7544,7 +7544,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
7544
7544
|
const cached = cache?.get(targetPath);
|
|
7545
7545
|
if (cached) return cached;
|
|
7546
7546
|
try {
|
|
7547
|
-
const resolved =
|
|
7547
|
+
const resolved = fs$1.realpathSync(targetPath);
|
|
7548
7548
|
cache?.set(targetPath, resolved);
|
|
7549
7549
|
return resolved;
|
|
7550
7550
|
} catch {
|
|
@@ -7553,7 +7553,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
7553
7553
|
}
|
|
7554
7554
|
function safeStatSync(targetPath) {
|
|
7555
7555
|
try {
|
|
7556
|
-
return
|
|
7556
|
+
return fs$1.statSync(targetPath);
|
|
7557
7557
|
} catch {
|
|
7558
7558
|
return null;
|
|
7559
7559
|
}
|
|
@@ -7569,13 +7569,13 @@ function resolveBundledPluginsDir(env = process.env) {
|
|
|
7569
7569
|
try {
|
|
7570
7570
|
const execDir = path.dirname(process.execPath);
|
|
7571
7571
|
const sibling = path.join(execDir, "extensions");
|
|
7572
|
-
if (
|
|
7572
|
+
if (fs$1.existsSync(sibling)) return sibling;
|
|
7573
7573
|
} catch {}
|
|
7574
7574
|
try {
|
|
7575
7575
|
let cursor = path.dirname(fileURLToPath(import.meta.url));
|
|
7576
7576
|
for (let i = 0; i < 6; i += 1) {
|
|
7577
7577
|
const candidate = path.join(cursor, "extensions");
|
|
7578
|
-
if (
|
|
7578
|
+
if (fs$1.existsSync(candidate)) return candidate;
|
|
7579
7579
|
const parent = path.dirname(cursor);
|
|
7580
7580
|
if (parent === cursor) break;
|
|
7581
7581
|
cursor = parent;
|
|
@@ -7675,7 +7675,7 @@ function checkPathStatAndPermissions(params) {
|
|
|
7675
7675
|
};
|
|
7676
7676
|
let modeBits = stat.mode & 511;
|
|
7677
7677
|
if ((modeBits & 2) !== 0 && params.origin === "bundled") try {
|
|
7678
|
-
|
|
7678
|
+
fs$1.chmodSync(targetPath, modeBits & -19);
|
|
7679
7679
|
const repairedStat = safeStatSync(targetPath);
|
|
7680
7680
|
if (!repairedStat) return {
|
|
7681
7681
|
reason: "path_stat_failed",
|
|
@@ -7760,12 +7760,12 @@ function readPackageManifest(dir, rejectHardlinks = true) {
|
|
|
7760
7760
|
});
|
|
7761
7761
|
if (!opened.ok) return null;
|
|
7762
7762
|
try {
|
|
7763
|
-
const raw =
|
|
7763
|
+
const raw = fs$1.readFileSync(opened.fd, "utf-8");
|
|
7764
7764
|
return JSON.parse(raw);
|
|
7765
7765
|
} catch {
|
|
7766
7766
|
return null;
|
|
7767
7767
|
} finally {
|
|
7768
|
-
|
|
7768
|
+
fs$1.closeSync(opened.fd);
|
|
7769
7769
|
}
|
|
7770
7770
|
}
|
|
7771
7771
|
function deriveIdHint(params) {
|
|
@@ -7823,14 +7823,14 @@ function resolvePackageEntrySource(params) {
|
|
|
7823
7823
|
return null;
|
|
7824
7824
|
}
|
|
7825
7825
|
const safeSource = opened.path;
|
|
7826
|
-
|
|
7826
|
+
fs$1.closeSync(opened.fd);
|
|
7827
7827
|
return safeSource;
|
|
7828
7828
|
}
|
|
7829
7829
|
function discoverInDirectory(params) {
|
|
7830
|
-
if (!
|
|
7830
|
+
if (!fs$1.existsSync(params.dir)) return;
|
|
7831
7831
|
let entries = [];
|
|
7832
7832
|
try {
|
|
7833
|
-
entries =
|
|
7833
|
+
entries = fs$1.readdirSync(params.dir, { withFileTypes: true });
|
|
7834
7834
|
} catch (err) {
|
|
7835
7835
|
params.diagnostics.push({
|
|
7836
7836
|
level: "warn",
|
|
@@ -7891,7 +7891,7 @@ function discoverInDirectory(params) {
|
|
|
7891
7891
|
}
|
|
7892
7892
|
continue;
|
|
7893
7893
|
}
|
|
7894
|
-
const indexFile = [...DEFAULT_PLUGIN_ENTRY_CANDIDATES].map((candidate) => path.join(fullPath, candidate)).find((candidate) =>
|
|
7894
|
+
const indexFile = [...DEFAULT_PLUGIN_ENTRY_CANDIDATES].map((candidate) => path.join(fullPath, candidate)).find((candidate) => fs$1.existsSync(candidate));
|
|
7895
7895
|
if (indexFile && isExtensionFile(indexFile)) addCandidate({
|
|
7896
7896
|
candidates: params.candidates,
|
|
7897
7897
|
diagnostics: params.diagnostics,
|
|
@@ -7909,7 +7909,7 @@ function discoverInDirectory(params) {
|
|
|
7909
7909
|
}
|
|
7910
7910
|
function discoverFromPath(params) {
|
|
7911
7911
|
const resolved = resolveUserPath(params.rawPath, params.env);
|
|
7912
|
-
if (!
|
|
7912
|
+
if (!fs$1.existsSync(resolved)) {
|
|
7913
7913
|
params.diagnostics.push({
|
|
7914
7914
|
level: "error",
|
|
7915
7915
|
message: `plugin path not found: ${resolved}`,
|
|
@@ -7917,7 +7917,7 @@ function discoverFromPath(params) {
|
|
|
7917
7917
|
});
|
|
7918
7918
|
return;
|
|
7919
7919
|
}
|
|
7920
|
-
const stat =
|
|
7920
|
+
const stat = fs$1.statSync(resolved);
|
|
7921
7921
|
if (stat.isFile()) {
|
|
7922
7922
|
if (!isExtensionFile(resolved)) {
|
|
7923
7923
|
params.diagnostics.push({
|
|
@@ -7975,7 +7975,7 @@ function discoverFromPath(params) {
|
|
|
7975
7975
|
}
|
|
7976
7976
|
return;
|
|
7977
7977
|
}
|
|
7978
|
-
const indexFile = [...DEFAULT_PLUGIN_ENTRY_CANDIDATES].map((candidate) => path.join(resolved, candidate)).find((candidate) =>
|
|
7978
|
+
const indexFile = [...DEFAULT_PLUGIN_ENTRY_CANDIDATES].map((candidate) => path.join(resolved, candidate)).find((candidate) => fs$1.existsSync(candidate));
|
|
7979
7979
|
if (indexFile && isExtensionFile(indexFile)) {
|
|
7980
7980
|
addCandidate({
|
|
7981
7981
|
candidates: params.candidates,
|
|
@@ -8112,7 +8112,7 @@ function buildCacheKey$2(params) {
|
|
|
8112
8112
|
}
|
|
8113
8113
|
function safeStatMtimeMs(filePath) {
|
|
8114
8114
|
try {
|
|
8115
|
-
return
|
|
8115
|
+
return fs$1.statSync(filePath).mtimeMs;
|
|
8116
8116
|
} catch {
|
|
8117
8117
|
return null;
|
|
8118
8118
|
}
|
|
@@ -13456,7 +13456,7 @@ function resolveConfigPathForDeps(deps) {
|
|
|
13456
13456
|
}
|
|
13457
13457
|
function normalizeDeps(overrides = {}) {
|
|
13458
13458
|
return {
|
|
13459
|
-
fs: overrides.fs ??
|
|
13459
|
+
fs: overrides.fs ?? fs$1,
|
|
13460
13460
|
json5: overrides.json5 ?? JSON5,
|
|
13461
13461
|
env: overrides.env ?? process.env,
|
|
13462
13462
|
homedir: overrides.homedir ?? (() => resolveRequiredHomeDir(overrides.env ?? process.env, os.homedir)),
|
|
@@ -17639,13 +17639,13 @@ function shortPath(value) {
|
|
|
17639
17639
|
//#region src/agents/skills/bundled-dir.ts
|
|
17640
17640
|
function looksLikeSkillsDir(dir) {
|
|
17641
17641
|
try {
|
|
17642
|
-
const entries =
|
|
17642
|
+
const entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
17643
17643
|
for (const entry of entries) {
|
|
17644
17644
|
if (entry.name.startsWith(".")) continue;
|
|
17645
17645
|
const fullPath = path.join(dir, entry.name);
|
|
17646
17646
|
if (entry.isFile() && entry.name.endsWith(".md")) return true;
|
|
17647
17647
|
if (entry.isDirectory()) {
|
|
17648
|
-
if (
|
|
17648
|
+
if (fs$1.existsSync(path.join(fullPath, "SKILL.md"))) return true;
|
|
17649
17649
|
}
|
|
17650
17650
|
}
|
|
17651
17651
|
} catch {
|
|
@@ -17660,7 +17660,7 @@ function resolveBundledSkillsDir(opts = {}) {
|
|
|
17660
17660
|
const execPath = opts.execPath ?? process.execPath;
|
|
17661
17661
|
const execDir = path.dirname(execPath);
|
|
17662
17662
|
const sibling = path.join(execDir, "skills");
|
|
17663
|
-
if (
|
|
17663
|
+
if (fs$1.existsSync(sibling)) return sibling;
|
|
17664
17664
|
} catch {}
|
|
17665
17665
|
try {
|
|
17666
17666
|
const moduleUrl = opts.moduleUrl ?? import.meta.url;
|
|
@@ -17722,7 +17722,7 @@ function resolvePluginSkillDirs(params) {
|
|
|
17722
17722
|
const trimmed = raw.trim();
|
|
17723
17723
|
if (!trimmed) continue;
|
|
17724
17724
|
const candidate = path.resolve(record.rootDir, trimmed);
|
|
17725
|
-
if (!
|
|
17725
|
+
if (!fs$1.existsSync(candidate)) {
|
|
17726
17726
|
log$48.warn(`plugin skill path not found (${record.id}): ${candidate}`);
|
|
17727
17727
|
continue;
|
|
17728
17728
|
}
|
|
@@ -17751,7 +17751,7 @@ async function serializeByKey(key, task) {
|
|
|
17751
17751
|
}
|
|
17752
17752
|
//#endregion
|
|
17753
17753
|
//#region src/agents/skills/workspace.ts
|
|
17754
|
-
const fsp =
|
|
17754
|
+
const fsp = fs$1.promises;
|
|
17755
17755
|
const skillsLogger = createSubsystemLogger("skills");
|
|
17756
17756
|
const skillCommandDebugOnce = /* @__PURE__ */ new Set();
|
|
17757
17757
|
/**
|
|
@@ -17828,7 +17828,7 @@ function resolveSkillsLimits(config) {
|
|
|
17828
17828
|
}
|
|
17829
17829
|
function listChildDirectories(dir) {
|
|
17830
17830
|
try {
|
|
17831
|
-
const entries =
|
|
17831
|
+
const entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
17832
17832
|
const dirs = [];
|
|
17833
17833
|
for (const entry of entries) {
|
|
17834
17834
|
if (entry.name.startsWith(".")) continue;
|
|
@@ -17839,7 +17839,7 @@ function listChildDirectories(dir) {
|
|
|
17839
17839
|
continue;
|
|
17840
17840
|
}
|
|
17841
17841
|
if (entry.isSymbolicLink()) try {
|
|
17842
|
-
if (
|
|
17842
|
+
if (fs$1.statSync(fullPath).isDirectory()) dirs.push(entry.name);
|
|
17843
17843
|
} catch {}
|
|
17844
17844
|
}
|
|
17845
17845
|
return dirs;
|
|
@@ -17849,7 +17849,7 @@ function listChildDirectories(dir) {
|
|
|
17849
17849
|
}
|
|
17850
17850
|
function tryRealpath(filePath) {
|
|
17851
17851
|
try {
|
|
17852
|
-
return
|
|
17852
|
+
return fs$1.realpathSync(filePath);
|
|
17853
17853
|
} catch {
|
|
17854
17854
|
return null;
|
|
17855
17855
|
}
|
|
@@ -17894,7 +17894,7 @@ function filterLoadedSkillsInsideRoot(params) {
|
|
|
17894
17894
|
function resolveNestedSkillsRoot(dir, opts) {
|
|
17895
17895
|
const nested = path.join(dir, "skills");
|
|
17896
17896
|
try {
|
|
17897
|
-
if (!
|
|
17897
|
+
if (!fs$1.existsSync(nested) || !fs$1.statSync(nested).isDirectory()) return { baseDir: dir };
|
|
17898
17898
|
} catch {
|
|
17899
17899
|
return { baseDir: dir };
|
|
17900
17900
|
}
|
|
@@ -17903,7 +17903,7 @@ function resolveNestedSkillsRoot(dir, opts) {
|
|
|
17903
17903
|
const toScan = scanLimit === 0 ? [] : nestedDirs.slice(0, Math.min(nestedDirs.length, scanLimit));
|
|
17904
17904
|
for (const name of toScan) {
|
|
17905
17905
|
const skillMd = path.join(nested, name, "SKILL.md");
|
|
17906
|
-
if (
|
|
17906
|
+
if (fs$1.existsSync(skillMd)) return {
|
|
17907
17907
|
baseDir: nested,
|
|
17908
17908
|
note: `Detected nested skills root at ${nested}`
|
|
17909
17909
|
};
|
|
@@ -17932,7 +17932,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
17932
17932
|
});
|
|
17933
17933
|
if (!baseDirRealPath) return [];
|
|
17934
17934
|
const rootSkillMd = path.join(baseDir, "SKILL.md");
|
|
17935
|
-
if (
|
|
17935
|
+
if (fs$1.existsSync(rootSkillMd)) {
|
|
17936
17936
|
const rootSkillRealPath = resolveContainedSkillPath({
|
|
17937
17937
|
source: params.source,
|
|
17938
17938
|
rootDir,
|
|
@@ -17941,7 +17941,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
17941
17941
|
});
|
|
17942
17942
|
if (!rootSkillRealPath) return [];
|
|
17943
17943
|
try {
|
|
17944
|
-
const size =
|
|
17944
|
+
const size = fs$1.statSync(rootSkillRealPath).size;
|
|
17945
17945
|
if (size > limits.maxSkillFileBytes) {
|
|
17946
17946
|
skillsLogger.warn("Skipping skills root due to oversized SKILL.md.", {
|
|
17947
17947
|
dir: baseDir,
|
|
@@ -17991,7 +17991,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
17991
17991
|
candidatePath: skillDir
|
|
17992
17992
|
})) continue;
|
|
17993
17993
|
const skillMd = path.join(skillDir, "SKILL.md");
|
|
17994
|
-
if (!
|
|
17994
|
+
if (!fs$1.existsSync(skillMd)) continue;
|
|
17995
17995
|
const skillMdRealPath = resolveContainedSkillPath({
|
|
17996
17996
|
source: params.source,
|
|
17997
17997
|
rootDir,
|
|
@@ -18000,7 +18000,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
18000
18000
|
});
|
|
18001
18001
|
if (!skillMdRealPath) continue;
|
|
18002
18002
|
try {
|
|
18003
|
-
const size =
|
|
18003
|
+
const size = fs$1.statSync(skillMdRealPath).size;
|
|
18004
18004
|
if (size > limits.maxSkillFileBytes) {
|
|
18005
18005
|
skillsLogger.warn("Skipping skill due to oversized SKILL.md.", {
|
|
18006
18006
|
skill: name,
|
|
@@ -18073,7 +18073,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
18073
18073
|
return Array.from(merged.values()).map((skill) => {
|
|
18074
18074
|
let frontmatter = {};
|
|
18075
18075
|
try {
|
|
18076
|
-
frontmatter = parseFrontmatter(
|
|
18076
|
+
frontmatter = parseFrontmatter(fs$1.readFileSync(skill.filePath, "utf-8"));
|
|
18077
18077
|
} catch {}
|
|
18078
18078
|
return {
|
|
18079
18079
|
skill,
|
|
@@ -19108,7 +19108,7 @@ function isModuleNotFoundError(err) {
|
|
|
19108
19108
|
}
|
|
19109
19109
|
async function loadPwAiModule(mode) {
|
|
19110
19110
|
try {
|
|
19111
|
-
return await import("./pw-ai-
|
|
19111
|
+
return await import("./pw-ai-CRL5SGWK.js");
|
|
19112
19112
|
} catch (err) {
|
|
19113
19113
|
if (mode === "soft") return null;
|
|
19114
19114
|
if (isModuleNotFoundError(err)) return null;
|
|
@@ -21212,7 +21212,7 @@ function markPwAiLoaded() {}
|
|
|
21212
21212
|
const LSOF_CANDIDATES = process.platform === "darwin" ? ["/usr/sbin/lsof", "/usr/bin/lsof"] : ["/usr/bin/lsof", "/usr/sbin/lsof"];
|
|
21213
21213
|
function resolveLsofCommandSync() {
|
|
21214
21214
|
for (const candidate of LSOF_CANDIDATES) try {
|
|
21215
|
-
|
|
21215
|
+
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
21216
21216
|
return candidate;
|
|
21217
21217
|
} catch {}
|
|
21218
21218
|
return "lsof";
|
|
@@ -21324,7 +21324,7 @@ const CHROMIUM_EXE_NAMES = new Set([
|
|
|
21324
21324
|
]);
|
|
21325
21325
|
function exists$1(filePath) {
|
|
21326
21326
|
try {
|
|
21327
|
-
return
|
|
21327
|
+
return fs$1.existsSync(filePath);
|
|
21328
21328
|
} catch {
|
|
21329
21329
|
return false;
|
|
21330
21330
|
}
|
|
@@ -21467,7 +21467,7 @@ function findDesktopFilePath(desktopId) {
|
|
|
21467
21467
|
}
|
|
21468
21468
|
function readDesktopExecLine(desktopPath) {
|
|
21469
21469
|
try {
|
|
21470
|
-
const lines =
|
|
21470
|
+
const lines = fs$1.readFileSync(desktopPath, "utf8").split(/\r?\n/);
|
|
21471
21471
|
for (const line of lines) if (line.startsWith("Exec=")) return line.slice(5).trim();
|
|
21472
21472
|
} catch {}
|
|
21473
21473
|
return null;
|
|
@@ -21726,8 +21726,8 @@ function decoratedMarkerPath(userDataDir) {
|
|
|
21726
21726
|
}
|
|
21727
21727
|
function safeReadJson(filePath) {
|
|
21728
21728
|
try {
|
|
21729
|
-
if (!
|
|
21730
|
-
const raw =
|
|
21729
|
+
if (!fs$1.existsSync(filePath)) return null;
|
|
21730
|
+
const raw = fs$1.readFileSync(filePath, "utf-8");
|
|
21731
21731
|
const parsed = JSON.parse(raw);
|
|
21732
21732
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
|
|
21733
21733
|
return parsed;
|
|
@@ -21736,8 +21736,8 @@ function safeReadJson(filePath) {
|
|
|
21736
21736
|
}
|
|
21737
21737
|
}
|
|
21738
21738
|
function safeWriteJson(filePath, data) {
|
|
21739
|
-
|
|
21740
|
-
|
|
21739
|
+
fs$1.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
21740
|
+
fs$1.writeFileSync(filePath, JSON.stringify(data, null, 2));
|
|
21741
21741
|
}
|
|
21742
21742
|
function setDeep(obj, keys, value) {
|
|
21743
21743
|
let node = obj;
|
|
@@ -21864,7 +21864,7 @@ function decorateOpenClawProfile(userDataDir, opts) {
|
|
|
21864
21864
|
}
|
|
21865
21865
|
safeWriteJson(preferencesPath, prefs);
|
|
21866
21866
|
try {
|
|
21867
|
-
|
|
21867
|
+
fs$1.writeFileSync(decoratedMarkerPath(userDataDir), `${Date.now()}\n`, "utf-8");
|
|
21868
21868
|
} catch {}
|
|
21869
21869
|
}
|
|
21870
21870
|
function ensureProfileCleanExit(userDataDir) {
|
|
@@ -21879,7 +21879,7 @@ function ensureProfileCleanExit(userDataDir) {
|
|
|
21879
21879
|
const log$47 = createSubsystemLogger("browser").child("chrome");
|
|
21880
21880
|
function exists(filePath) {
|
|
21881
21881
|
try {
|
|
21882
|
-
return
|
|
21882
|
+
return fs$1.existsSync(filePath);
|
|
21883
21883
|
} catch {
|
|
21884
21884
|
return false;
|
|
21885
21885
|
}
|
|
@@ -21991,7 +21991,7 @@ async function launchOpenClawChrome(resolved, profile) {
|
|
|
21991
21991
|
const exe = resolveBrowserExecutable(resolved);
|
|
21992
21992
|
if (!exe) throw new Error("No supported browser found (Chrome/Brave/Edge/Chromium on macOS, Linux, or Windows).");
|
|
21993
21993
|
const userDataDir = resolveOpenClawUserDataDir(profile.name);
|
|
21994
|
-
|
|
21994
|
+
fs$1.mkdirSync(userDataDir, { recursive: true });
|
|
21995
21995
|
const needsDecorate = !isProfileDecorated(userDataDir, profile.name, (profile.color ?? "#FF4500").toUpperCase());
|
|
21996
21996
|
const spawnOnce = () => {
|
|
21997
21997
|
const args = [
|
|
@@ -22996,7 +22996,7 @@ function createProfileAvailability({ opts, profile, state, getProfileState, setP
|
|
|
22996
22996
|
};
|
|
22997
22997
|
const closePlaywrightBrowserConnectionForProfile = async (cdpUrl) => {
|
|
22998
22998
|
try {
|
|
22999
|
-
await (await import("./pw-ai-
|
|
22999
|
+
await (await import("./pw-ai-CRL5SGWK.js")).closePlaywrightBrowserConnection(cdpUrl ? { cdpUrl } : void 0);
|
|
23000
23000
|
} catch {}
|
|
23001
23001
|
};
|
|
23002
23002
|
const reconcileProfileRuntime = async () => {
|
|
@@ -23111,11 +23111,11 @@ async function movePathToTrash(targetPath) {
|
|
|
23111
23111
|
return targetPath;
|
|
23112
23112
|
} catch {
|
|
23113
23113
|
const trashDir = path.join(os.homedir(), ".Trash");
|
|
23114
|
-
|
|
23114
|
+
fs$1.mkdirSync(trashDir, { recursive: true });
|
|
23115
23115
|
const base = path.basename(targetPath);
|
|
23116
23116
|
let dest = path.join(trashDir, `${base}-${Date.now()}`);
|
|
23117
|
-
if (
|
|
23118
|
-
|
|
23117
|
+
if (fs$1.existsSync(dest)) dest = path.join(trashDir, `${base}-${Date.now()}-${generateSecureToken(6)}`);
|
|
23118
|
+
fs$1.renameSync(targetPath, dest);
|
|
23119
23119
|
return dest;
|
|
23120
23120
|
}
|
|
23121
23121
|
}
|
|
@@ -23123,7 +23123,7 @@ async function movePathToTrash(targetPath) {
|
|
|
23123
23123
|
//#region src/browser/server-context.reset.ts
|
|
23124
23124
|
async function closePlaywrightBrowserConnectionForProfile(cdpUrl) {
|
|
23125
23125
|
try {
|
|
23126
|
-
await (await import("./pw-ai-
|
|
23126
|
+
await (await import("./pw-ai-CRL5SGWK.js")).closePlaywrightBrowserConnection(cdpUrl ? { cdpUrl } : void 0);
|
|
23127
23127
|
} catch {}
|
|
23128
23128
|
}
|
|
23129
23129
|
function createProfileResetOps({ profile, getProfileState, stopRunningBrowser, isHttpReachable, resolveOpenClawUserDataDir }) {
|
|
@@ -23142,7 +23142,7 @@ function createProfileResetOps({ profile, getProfileState, stopRunningBrowser, i
|
|
|
23142
23142
|
if (await isHttpReachable(300) && !profileState.running) await closePlaywrightBrowserConnectionForProfile(profile.cdpUrl);
|
|
23143
23143
|
if (profileState.running) await stopRunningBrowser();
|
|
23144
23144
|
await closePlaywrightBrowserConnectionForProfile(profile.cdpUrl);
|
|
23145
|
-
if (!
|
|
23145
|
+
if (!fs$1.existsSync(userDataDir)) return {
|
|
23146
23146
|
moved: false,
|
|
23147
23147
|
from: userDataDir
|
|
23148
23148
|
};
|
|
@@ -26028,7 +26028,7 @@ function createBrowserProfilesService(ctx) {
|
|
|
26028
26028
|
} catch {}
|
|
26029
26029
|
const userDataDir = resolveOpenClawUserDataDir(name);
|
|
26030
26030
|
const profileDir = path.dirname(userDataDir);
|
|
26031
|
-
if (
|
|
26031
|
+
if (fs$1.existsSync(profileDir)) {
|
|
26032
26032
|
await movePathToTrash(profileDir);
|
|
26033
26033
|
deleted = true;
|
|
26034
26034
|
}
|
|
@@ -26753,7 +26753,7 @@ function releaseAllLocksSync() {
|
|
|
26753
26753
|
if (typeof held.handle.close === "function") held.handle.close().catch(() => {});
|
|
26754
26754
|
} catch {}
|
|
26755
26755
|
try {
|
|
26756
|
-
|
|
26756
|
+
fs$1.rmSync(held.lockPath, { force: true });
|
|
26757
26757
|
} catch {}
|
|
26758
26758
|
HELD_LOCKS.delete(sessionFile);
|
|
26759
26759
|
}
|
|
@@ -28350,7 +28350,7 @@ var SandboxFsPathGuard = class {
|
|
|
28350
28350
|
if (guarded.reason !== "path") {
|
|
28351
28351
|
if (!(options.allowedType === "directory" && this.pathIsExistingDirectory(target.hostPath))) throw guarded.error instanceof Error ? guarded.error : /* @__PURE__ */ new Error(`Sandbox boundary checks failed; cannot ${options.action}: ${target.containerPath}`);
|
|
28352
28352
|
}
|
|
28353
|
-
} else
|
|
28353
|
+
} else fs$1.closeSync(guarded.fd);
|
|
28354
28354
|
const canonicalContainerPath = await this.resolveCanonicalContainerPath({
|
|
28355
28355
|
containerPath: target.containerPath,
|
|
28356
28356
|
allowFinalSymlinkForUnlink: options.aliasPolicy?.allowFinalSymlinkForUnlink === true
|
|
@@ -28417,7 +28417,7 @@ var SandboxFsPathGuard = class {
|
|
|
28417
28417
|
}
|
|
28418
28418
|
pathIsExistingDirectory(hostPath) {
|
|
28419
28419
|
try {
|
|
28420
|
-
return
|
|
28420
|
+
return fs$1.statSync(hostPath).isDirectory();
|
|
28421
28421
|
} catch {
|
|
28422
28422
|
return false;
|
|
28423
28423
|
}
|
|
@@ -28767,9 +28767,9 @@ var SandboxFsBridgeImpl = class {
|
|
|
28767
28767
|
async readPinnedFile(target) {
|
|
28768
28768
|
const opened = await this.pathGuard.openReadableFile(target);
|
|
28769
28769
|
try {
|
|
28770
|
-
return
|
|
28770
|
+
return fs$1.readFileSync(opened.fd);
|
|
28771
28771
|
} finally {
|
|
28772
|
-
|
|
28772
|
+
fs$1.closeSync(opened.fd);
|
|
28773
28773
|
}
|
|
28774
28774
|
}
|
|
28775
28775
|
async runCheckedCommand(plan) {
|
|
@@ -29532,7 +29532,7 @@ function loadSecretFileSync(filePath, label, options = {}) {
|
|
|
29532
29532
|
const maxBytes = options.maxBytes ?? 16384;
|
|
29533
29533
|
let previewStat;
|
|
29534
29534
|
try {
|
|
29535
|
-
previewStat =
|
|
29535
|
+
previewStat = fs$1.lstatSync(resolvedPath);
|
|
29536
29536
|
} catch (error) {
|
|
29537
29537
|
return {
|
|
29538
29538
|
ok: false,
|
|
@@ -29571,7 +29571,7 @@ function loadSecretFileSync(filePath, label, options = {}) {
|
|
|
29571
29571
|
};
|
|
29572
29572
|
}
|
|
29573
29573
|
try {
|
|
29574
|
-
const secret =
|
|
29574
|
+
const secret = fs$1.readFileSync(opened.fd, "utf8").trim();
|
|
29575
29575
|
if (!secret) return {
|
|
29576
29576
|
ok: false,
|
|
29577
29577
|
resolvedPath,
|
|
@@ -29590,7 +29590,7 @@ function loadSecretFileSync(filePath, label, options = {}) {
|
|
|
29590
29590
|
message: `Failed to read ${label} file at ${resolvedPath}: ${String(error)}`
|
|
29591
29591
|
};
|
|
29592
29592
|
} finally {
|
|
29593
|
-
|
|
29593
|
+
fs$1.closeSync(opened.fd);
|
|
29594
29594
|
}
|
|
29595
29595
|
}
|
|
29596
29596
|
function tryReadSecretFileSync(filePath, label, options = {}) {
|
|
@@ -30304,7 +30304,7 @@ function resolveWebCredsBackupPath(authDir) {
|
|
|
30304
30304
|
}
|
|
30305
30305
|
function hasWebCredsSync(authDir) {
|
|
30306
30306
|
try {
|
|
30307
|
-
const stats =
|
|
30307
|
+
const stats = fs$1.statSync(resolveWebCredsPath(authDir));
|
|
30308
30308
|
return stats.isFile() && stats.size > 1;
|
|
30309
30309
|
} catch {
|
|
30310
30310
|
return false;
|
|
@@ -30312,10 +30312,10 @@ function hasWebCredsSync(authDir) {
|
|
|
30312
30312
|
}
|
|
30313
30313
|
function readCredsJsonRaw(filePath) {
|
|
30314
30314
|
try {
|
|
30315
|
-
if (!
|
|
30316
|
-
const stats =
|
|
30315
|
+
if (!fs$1.existsSync(filePath)) return null;
|
|
30316
|
+
const stats = fs$1.statSync(filePath);
|
|
30317
30317
|
if (!stats.isFile() || stats.size <= 1) return null;
|
|
30318
|
-
return
|
|
30318
|
+
return fs$1.readFileSync(filePath, "utf-8");
|
|
30319
30319
|
} catch {
|
|
30320
30320
|
return null;
|
|
30321
30321
|
}
|
|
@@ -30333,9 +30333,9 @@ function maybeRestoreCredsFromBackup(authDir) {
|
|
|
30333
30333
|
const backupRaw = readCredsJsonRaw(backupPath);
|
|
30334
30334
|
if (!backupRaw) return;
|
|
30335
30335
|
JSON.parse(backupRaw);
|
|
30336
|
-
|
|
30336
|
+
fs$1.copyFileSync(backupPath, credsPath);
|
|
30337
30337
|
try {
|
|
30338
|
-
|
|
30338
|
+
fs$1.chmodSync(credsPath, 384);
|
|
30339
30339
|
} catch {}
|
|
30340
30340
|
logger.warn({ credsPath }, "restored corrupted WhatsApp creds.json from backup");
|
|
30341
30341
|
} catch {}
|
|
@@ -30391,11 +30391,11 @@ async function logoutWeb(params) {
|
|
|
30391
30391
|
function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
30392
30392
|
try {
|
|
30393
30393
|
const credsPath = resolveWebCredsPath(resolveUserPath(authDir));
|
|
30394
|
-
if (!
|
|
30394
|
+
if (!fs$1.existsSync(credsPath)) return {
|
|
30395
30395
|
e164: null,
|
|
30396
30396
|
jid: null
|
|
30397
30397
|
};
|
|
30398
|
-
const raw =
|
|
30398
|
+
const raw = fs$1.readFileSync(credsPath, "utf-8");
|
|
30399
30399
|
const jid = JSON.parse(raw)?.me?.id ?? null;
|
|
30400
30400
|
return {
|
|
30401
30401
|
e164: jid ? jidToE164(jid, { authDir }) : null,
|
|
@@ -30414,7 +30414,7 @@ function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
|
30414
30414
|
*/
|
|
30415
30415
|
function getWebAuthAgeMs(authDir = resolveDefaultWebAuthDir()) {
|
|
30416
30416
|
try {
|
|
30417
|
-
const stats =
|
|
30417
|
+
const stats = fs$1.statSync(resolveWebCredsPath(resolveUserPath(authDir)));
|
|
30418
30418
|
return Date.now() - stats.mtimeMs;
|
|
30419
30419
|
} catch {
|
|
30420
30420
|
return null;
|
|
@@ -30443,7 +30443,7 @@ function listWhatsAppAuthDirs(cfg) {
|
|
|
30443
30443
|
accountId
|
|
30444
30444
|
}).authDir);
|
|
30445
30445
|
try {
|
|
30446
|
-
const entries =
|
|
30446
|
+
const entries = fs$1.readdirSync(whatsappDir, { withFileTypes: true });
|
|
30447
30447
|
for (const entry of entries) {
|
|
30448
30448
|
if (!entry.isDirectory()) continue;
|
|
30449
30449
|
authDirs.add(path.join(whatsappDir, entry.name));
|
|
@@ -30465,7 +30465,7 @@ function resolveLegacyAuthDir() {
|
|
|
30465
30465
|
}
|
|
30466
30466
|
function legacyAuthExists(authDir) {
|
|
30467
30467
|
try {
|
|
30468
|
-
return
|
|
30468
|
+
return fs$1.existsSync(path.join(authDir, "creds.json"));
|
|
30469
30469
|
} catch {
|
|
30470
30470
|
return false;
|
|
30471
30471
|
}
|
|
@@ -32269,14 +32269,14 @@ function resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, a
|
|
|
32269
32269
|
function canonicalizePathForComparison$1(filePath) {
|
|
32270
32270
|
const resolved = path.resolve(filePath);
|
|
32271
32271
|
try {
|
|
32272
|
-
return
|
|
32272
|
+
return fs$1.realpathSync(resolved);
|
|
32273
32273
|
} catch {
|
|
32274
32274
|
return resolved;
|
|
32275
32275
|
}
|
|
32276
32276
|
}
|
|
32277
32277
|
function archiveFileOnDisk(filePath, reason) {
|
|
32278
32278
|
const archived = `${filePath}.${reason}.${formatSessionArchiveTimestamp()}`;
|
|
32279
|
-
|
|
32279
|
+
fs$1.renameSync(filePath, archived);
|
|
32280
32280
|
return archived;
|
|
32281
32281
|
}
|
|
32282
32282
|
/**
|
|
@@ -32292,7 +32292,7 @@ function archiveSessionTranscripts(opts) {
|
|
|
32292
32292
|
const relative = path.relative(storeDir, candidatePath);
|
|
32293
32293
|
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) continue;
|
|
32294
32294
|
}
|
|
32295
|
-
if (!
|
|
32295
|
+
if (!fs$1.existsSync(candidatePath)) continue;
|
|
32296
32296
|
try {
|
|
32297
32297
|
archived.push(archiveFileOnDisk(candidatePath, opts.reason));
|
|
32298
32298
|
} catch {}
|
|
@@ -32310,15 +32310,15 @@ async function cleanupArchivedSessionTranscripts(opts) {
|
|
|
32310
32310
|
let removed = 0;
|
|
32311
32311
|
let scanned = 0;
|
|
32312
32312
|
for (const dir of directories) {
|
|
32313
|
-
const entries = await
|
|
32313
|
+
const entries = await fs$1.promises.readdir(dir).catch(() => []);
|
|
32314
32314
|
for (const entry of entries) {
|
|
32315
32315
|
const timestamp = parseSessionArchiveTimestamp(entry, reason);
|
|
32316
32316
|
if (timestamp == null) continue;
|
|
32317
32317
|
scanned += 1;
|
|
32318
32318
|
if (now - timestamp <= opts.olderThanMs) continue;
|
|
32319
32319
|
const fullPath = path.join(dir, entry);
|
|
32320
|
-
if (!(await
|
|
32321
|
-
await
|
|
32320
|
+
if (!(await fs$1.promises.stat(fullPath).catch(() => null))?.isFile()) continue;
|
|
32321
|
+
await fs$1.promises.rm(fullPath).catch(() => void 0);
|
|
32322
32322
|
removed += 1;
|
|
32323
32323
|
}
|
|
32324
32324
|
}
|
|
@@ -32465,7 +32465,7 @@ function isCacheEnabled(ttlMs) {
|
|
|
32465
32465
|
}
|
|
32466
32466
|
function getFileStatSnapshot(filePath) {
|
|
32467
32467
|
try {
|
|
32468
|
-
const stats =
|
|
32468
|
+
const stats = fs$1.statSync(filePath);
|
|
32469
32469
|
return {
|
|
32470
32470
|
mtimeMs: stats.mtimeMs,
|
|
32471
32471
|
sizeBytes: stats.size
|
|
@@ -32483,7 +32483,7 @@ const NOOP_LOGGER = {
|
|
|
32483
32483
|
function canonicalizePathForComparison(filePath) {
|
|
32484
32484
|
const resolved = path.resolve(filePath);
|
|
32485
32485
|
try {
|
|
32486
|
-
return
|
|
32486
|
+
return fs$1.realpathSync(resolved);
|
|
32487
32487
|
} catch {
|
|
32488
32488
|
return resolved;
|
|
32489
32489
|
}
|
|
@@ -32541,12 +32541,12 @@ function resolveReferencedSessionTranscriptPaths(params) {
|
|
|
32541
32541
|
return referenced;
|
|
32542
32542
|
}
|
|
32543
32543
|
async function readSessionsDirFiles(sessionsDir) {
|
|
32544
|
-
const dirEntries = await
|
|
32544
|
+
const dirEntries = await fs$1.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
|
|
32545
32545
|
const files = [];
|
|
32546
32546
|
for (const dirent of dirEntries) {
|
|
32547
32547
|
if (!dirent.isFile()) continue;
|
|
32548
32548
|
const filePath = path.join(sessionsDir, dirent.name);
|
|
32549
|
-
const stat = await
|
|
32549
|
+
const stat = await fs$1.promises.stat(filePath).catch(() => null);
|
|
32550
32550
|
if (!stat?.isFile()) continue;
|
|
32551
32551
|
files.push({
|
|
32552
32552
|
path: filePath,
|
|
@@ -32559,9 +32559,9 @@ async function readSessionsDirFiles(sessionsDir) {
|
|
|
32559
32559
|
return files;
|
|
32560
32560
|
}
|
|
32561
32561
|
async function removeFileIfExists(filePath) {
|
|
32562
|
-
const stat = await
|
|
32562
|
+
const stat = await fs$1.promises.stat(filePath).catch(() => null);
|
|
32563
32563
|
if (!stat?.isFile()) return 0;
|
|
32564
|
-
await
|
|
32564
|
+
await fs$1.promises.rm(filePath, { force: true }).catch(() => void 0);
|
|
32565
32565
|
return stat.size;
|
|
32566
32566
|
}
|
|
32567
32567
|
async function removeFileForBudget(params) {
|
|
@@ -32918,7 +32918,7 @@ function capEntryCount(store, overrideMax, opts = {}) {
|
|
|
32918
32918
|
}
|
|
32919
32919
|
async function getSessionFileSize(storePath) {
|
|
32920
32920
|
try {
|
|
32921
|
-
return (await
|
|
32921
|
+
return (await fs$1.promises.stat(storePath)).size;
|
|
32922
32922
|
} catch {
|
|
32923
32923
|
return null;
|
|
32924
32924
|
}
|
|
@@ -32935,7 +32935,7 @@ async function rotateSessionFile(storePath, overrideBytes) {
|
|
|
32935
32935
|
if (fileSize <= maxBytes) return false;
|
|
32936
32936
|
const backupPath = `${storePath}.bak.${Date.now()}`;
|
|
32937
32937
|
try {
|
|
32938
|
-
await
|
|
32938
|
+
await fs$1.promises.rename(storePath, backupPath);
|
|
32939
32939
|
log$44.info("rotated session store file", {
|
|
32940
32940
|
backupPath: path.basename(backupPath),
|
|
32941
32941
|
sizeBytes: fileSize
|
|
@@ -32946,11 +32946,11 @@ async function rotateSessionFile(storePath, overrideBytes) {
|
|
|
32946
32946
|
try {
|
|
32947
32947
|
const dir = path.dirname(storePath);
|
|
32948
32948
|
const baseName = path.basename(storePath);
|
|
32949
|
-
const backups = (await
|
|
32949
|
+
const backups = (await fs$1.promises.readdir(dir)).filter((f) => f.startsWith(`${baseName}.bak.`)).toSorted().toReversed();
|
|
32950
32950
|
const maxBackups = 3;
|
|
32951
32951
|
if (backups.length > maxBackups) {
|
|
32952
32952
|
const toDelete = backups.slice(maxBackups);
|
|
32953
|
-
for (const old of toDelete) await
|
|
32953
|
+
for (const old of toDelete) await fs$1.promises.unlink(path.join(dir, old)).catch(() => void 0);
|
|
32954
32954
|
log$44.info("cleaned up old session store backups", { deleted: toDelete.length });
|
|
32955
32955
|
}
|
|
32956
32956
|
} catch {}
|
|
@@ -33071,7 +33071,7 @@ function loadSessionStore(storePath, opts = {}) {
|
|
|
33071
33071
|
const maxReadAttempts = process.platform === "win32" ? 3 : 1;
|
|
33072
33072
|
const retryBuf = maxReadAttempts > 1 ? new Int32Array(new SharedArrayBuffer(4)) : void 0;
|
|
33073
33073
|
for (let attempt = 0; attempt < maxReadAttempts; attempt++) try {
|
|
33074
|
-
const raw =
|
|
33074
|
+
const raw = fs$1.readFileSync(storePath, "utf-8");
|
|
33075
33075
|
if (raw.length === 0 && attempt < maxReadAttempts - 1) {
|
|
33076
33076
|
Atomics.wait(retryBuf, 0, 0, 50);
|
|
33077
33077
|
continue;
|
|
@@ -33221,7 +33221,7 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
|
|
|
33221
33221
|
});
|
|
33222
33222
|
}
|
|
33223
33223
|
}
|
|
33224
|
-
await
|
|
33224
|
+
await fs$1.promises.mkdir(path.dirname(storePath), { recursive: true });
|
|
33225
33225
|
const json = JSON.stringify(store, null, 2);
|
|
33226
33226
|
if (getSerializedSessionStore(storePath) === json) {
|
|
33227
33227
|
updateSessionStoreWriteCaches({
|
|
@@ -33630,8 +33630,8 @@ function resolveMirroredTranscriptText(params) {
|
|
|
33630
33630
|
return trimmed ? trimmed : null;
|
|
33631
33631
|
}
|
|
33632
33632
|
async function ensureSessionHeader(params) {
|
|
33633
|
-
if (
|
|
33634
|
-
await
|
|
33633
|
+
if (fs$1.existsSync(params.sessionFile)) return;
|
|
33634
|
+
await fs$1.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
|
|
33635
33635
|
const header = {
|
|
33636
33636
|
type: "session",
|
|
33637
33637
|
version: CURRENT_SESSION_VERSION,
|
|
@@ -33639,7 +33639,7 @@ async function ensureSessionHeader(params) {
|
|
|
33639
33639
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33640
33640
|
cwd: process.cwd()
|
|
33641
33641
|
};
|
|
33642
|
-
await
|
|
33642
|
+
await fs$1.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
|
|
33643
33643
|
encoding: "utf-8",
|
|
33644
33644
|
mode: 384
|
|
33645
33645
|
});
|
|
@@ -33753,7 +33753,7 @@ async function appendAssistantMessageToSessionTranscript(params) {
|
|
|
33753
33753
|
}
|
|
33754
33754
|
async function transcriptHasIdempotencyKey(transcriptPath, idempotencyKey) {
|
|
33755
33755
|
try {
|
|
33756
|
-
const raw = await
|
|
33756
|
+
const raw = await fs$1.promises.readFile(transcriptPath, "utf-8");
|
|
33757
33757
|
for (const line of raw.split(/\r?\n/)) {
|
|
33758
33758
|
if (!line.trim()) continue;
|
|
33759
33759
|
try {
|
|
@@ -33785,7 +33785,7 @@ async function resolveAgentSessionDirsFromAgentsDir(agentsDir) {
|
|
|
33785
33785
|
function resolveAgentSessionDirsFromAgentsDirSync(agentsDir) {
|
|
33786
33786
|
let entries = [];
|
|
33787
33787
|
try {
|
|
33788
|
-
entries =
|
|
33788
|
+
entries = fs$1.readdirSync(agentsDir, { withFileTypes: true });
|
|
33789
33789
|
} catch (err) {
|
|
33790
33790
|
if (err.code === "ENOENT") return [];
|
|
33791
33791
|
throw err;
|
|
@@ -33820,10 +33820,10 @@ function shouldSkipDiscoveredAgentDirName(dirName, agentId) {
|
|
|
33820
33820
|
function resolveValidatedDiscoveredStorePathSync(params) {
|
|
33821
33821
|
const storePath = path.join(params.sessionsDir, "sessions.json");
|
|
33822
33822
|
try {
|
|
33823
|
-
const stat =
|
|
33823
|
+
const stat = fs$1.lstatSync(storePath);
|
|
33824
33824
|
if (stat.isSymbolicLink() || !stat.isFile()) return;
|
|
33825
|
-
const realStorePath =
|
|
33826
|
-
return isWithinRoot(realStorePath, params.realAgentsRoot ??
|
|
33825
|
+
const realStorePath = fs$1.realpathSync.native(storePath);
|
|
33826
|
+
return isWithinRoot(realStorePath, params.realAgentsRoot ?? fs$1.realpathSync.native(params.agentsRoot)) ? realStorePath : void 0;
|
|
33827
33827
|
} catch (err) {
|
|
33828
33828
|
if (shouldSkipDiscoveryError(err)) return;
|
|
33829
33829
|
throw err;
|
|
@@ -33870,7 +33870,7 @@ function resolveAllAgentSessionStoreTargetsSync(cfg, params = {}) {
|
|
|
33870
33870
|
const cached = realAgentsRoots.get(agentsRoot);
|
|
33871
33871
|
if (cached !== void 0) return cached;
|
|
33872
33872
|
try {
|
|
33873
|
-
const realAgentsRoot =
|
|
33873
|
+
const realAgentsRoot = fs$1.realpathSync.native(agentsRoot);
|
|
33874
33874
|
realAgentsRoots.set(agentsRoot, realAgentsRoot);
|
|
33875
33875
|
return realAgentsRoot;
|
|
33876
33876
|
} catch (err) {
|
|
@@ -34115,13 +34115,13 @@ async function ensureSandboxWorkspace(workspaceDir, seedFrom, skipBootstrap) {
|
|
|
34115
34115
|
});
|
|
34116
34116
|
if (!opened.ok) continue;
|
|
34117
34117
|
try {
|
|
34118
|
-
const content =
|
|
34118
|
+
const content = fs$1.readFileSync(opened.fd, "utf-8");
|
|
34119
34119
|
await fs.writeFile(dest, content, {
|
|
34120
34120
|
encoding: "utf-8",
|
|
34121
34121
|
flag: "wx"
|
|
34122
34122
|
});
|
|
34123
34123
|
} finally {
|
|
34124
|
-
|
|
34124
|
+
fs$1.closeSync(opened.fd);
|
|
34125
34125
|
}
|
|
34126
34126
|
} catch {}
|
|
34127
34127
|
}
|
|
@@ -40076,7 +40076,7 @@ async function ensureOpenClawModelsJson(config, agentDirOverride) {
|
|
|
40076
40076
|
const log$31 = createSubsystemLogger("model-catalog");
|
|
40077
40077
|
let modelCatalogPromise = null;
|
|
40078
40078
|
let hasLoggedModelCatalogError = false;
|
|
40079
|
-
const defaultImportPiSdk = () => import("./pi-model-discovery-runtime-
|
|
40079
|
+
const defaultImportPiSdk = () => import("./pi-model-discovery-runtime-CK36RhYz.js");
|
|
40080
40080
|
let importPiSdk = defaultImportPiSdk;
|
|
40081
40081
|
const CODEX_PROVIDER = "openai-codex";
|
|
40082
40082
|
const OPENAI_PROVIDER = "openai";
|
|
@@ -43248,7 +43248,7 @@ function resolveProviderVisionModelFromConfig(params) {
|
|
|
43248
43248
|
//#region src/media-understanding/providers/image.ts
|
|
43249
43249
|
let piModelDiscoveryRuntimePromise = null;
|
|
43250
43250
|
function loadPiModelDiscoveryRuntime() {
|
|
43251
|
-
piModelDiscoveryRuntimePromise ??= import("./pi-model-discovery-runtime-
|
|
43251
|
+
piModelDiscoveryRuntimePromise ??= import("./pi-model-discovery-runtime-CK36RhYz.js");
|
|
43252
43252
|
return piModelDiscoveryRuntimePromise;
|
|
43253
43253
|
}
|
|
43254
43254
|
async function describeImageWithModel(params) {
|
|
@@ -46426,10 +46426,10 @@ function isRecord$2(value) {
|
|
|
46426
46426
|
}
|
|
46427
46427
|
function scrubLegacyStaticAuthJsonEntries(pathname) {
|
|
46428
46428
|
if (process.env.OPENCLAW_AUTH_STORE_READONLY === "1") return;
|
|
46429
|
-
if (!
|
|
46429
|
+
if (!fs$1.existsSync(pathname)) return;
|
|
46430
46430
|
let parsed;
|
|
46431
46431
|
try {
|
|
46432
|
-
parsed = JSON.parse(
|
|
46432
|
+
parsed = JSON.parse(fs$1.readFileSync(pathname, "utf8"));
|
|
46433
46433
|
} catch {
|
|
46434
46434
|
return;
|
|
46435
46435
|
}
|
|
@@ -46443,11 +46443,11 @@ function scrubLegacyStaticAuthJsonEntries(pathname) {
|
|
|
46443
46443
|
}
|
|
46444
46444
|
if (!changed) return;
|
|
46445
46445
|
if (Object.keys(parsed).length === 0) {
|
|
46446
|
-
|
|
46446
|
+
fs$1.rmSync(pathname, { force: true });
|
|
46447
46447
|
return;
|
|
46448
46448
|
}
|
|
46449
|
-
|
|
46450
|
-
|
|
46449
|
+
fs$1.writeFileSync(pathname, `${JSON.stringify(parsed, null, 2)}\n`, "utf8");
|
|
46450
|
+
fs$1.chmodSync(pathname, 384);
|
|
46451
46451
|
}
|
|
46452
46452
|
function createAuthStorage(AuthStorageLike, path, creds) {
|
|
46453
46453
|
const withInMemory = AuthStorageLike;
|
|
@@ -53482,7 +53482,7 @@ function getPairingAdapter(channelId) {
|
|
|
53482
53482
|
//#region src/plugin-sdk/json-store.ts
|
|
53483
53483
|
async function readJsonFileWithFallback(filePath, fallback) {
|
|
53484
53484
|
try {
|
|
53485
|
-
const parsed = safeParseJson(await
|
|
53485
|
+
const parsed = safeParseJson(await fs$1.promises.readFile(filePath, "utf-8"));
|
|
53486
53486
|
if (parsed == null) return {
|
|
53487
53487
|
value: fallback,
|
|
53488
53488
|
exists: true
|
|
@@ -53568,7 +53568,7 @@ async function readPairingRequests(filePath) {
|
|
|
53568
53568
|
}
|
|
53569
53569
|
async function ensureJsonFile(filePath, fallback) {
|
|
53570
53570
|
try {
|
|
53571
|
-
await
|
|
53571
|
+
await fs$1.promises.access(filePath);
|
|
53572
53572
|
} catch {
|
|
53573
53573
|
await writeJsonFile(filePath, fallback);
|
|
53574
53574
|
}
|
|
@@ -53724,7 +53724,7 @@ function resolveAllowFromReadCacheOrMissing(filePath, stat) {
|
|
|
53724
53724
|
async function readAllowFromStateForPathWithExists(channel, filePath) {
|
|
53725
53725
|
let stat = null;
|
|
53726
53726
|
try {
|
|
53727
|
-
stat = await
|
|
53727
|
+
stat = await fs$1.promises.stat(filePath);
|
|
53728
53728
|
} catch (err) {
|
|
53729
53729
|
if (err.code !== "ENOENT") throw err;
|
|
53730
53730
|
}
|
|
@@ -53767,7 +53767,7 @@ async function writeAllowFromState(filePath, allowFrom) {
|
|
|
53767
53767
|
});
|
|
53768
53768
|
let stat = null;
|
|
53769
53769
|
try {
|
|
53770
|
-
stat = await
|
|
53770
|
+
stat = await fs$1.promises.stat(filePath);
|
|
53771
53771
|
} catch {}
|
|
53772
53772
|
setAllowFromReadCache(filePath, {
|
|
53773
53773
|
exists: true,
|
|
@@ -54760,7 +54760,7 @@ function shouldPersistAnyBindingState() {
|
|
|
54760
54760
|
}
|
|
54761
54761
|
function shouldPersistBindingMutations() {
|
|
54762
54762
|
if (shouldPersistAnyBindingState()) return true;
|
|
54763
|
-
return
|
|
54763
|
+
return fs$1.existsSync(resolveThreadBindingsPath());
|
|
54764
54764
|
}
|
|
54765
54765
|
function saveBindingsToDisk(params = {}) {
|
|
54766
54766
|
if (!params.force && !shouldPersistAnyBindingState()) return;
|
|
@@ -58788,7 +58788,7 @@ var LegacyContextEngine = class {
|
|
|
58788
58788
|
}
|
|
58789
58789
|
async afterTurn(_params) {}
|
|
58790
58790
|
async compact(params) {
|
|
58791
|
-
const { compactEmbeddedPiSessionDirect } = await import("./compact.runtime-
|
|
58791
|
+
const { compactEmbeddedPiSessionDirect } = await import("./compact.runtime-BOg89Gro.js");
|
|
58792
58792
|
const runtimeContext = params.runtimeContext ?? {};
|
|
58793
58793
|
const currentTokenCount = params.currentTokenCount ?? (typeof runtimeContext.currentTokenCount === "number" && Number.isFinite(runtimeContext.currentTokenCount) && runtimeContext.currentTokenCount > 0 ? Math.floor(runtimeContext.currentTokenCount) : void 0);
|
|
58794
58794
|
const result = await compactEmbeddedPiSessionDirect({
|
|
@@ -59654,7 +59654,7 @@ function canAutoSelectLocal(options) {
|
|
|
59654
59654
|
if (/^(hf:|https?:)/i.test(modelPath)) return false;
|
|
59655
59655
|
const resolved = resolveUserPath(modelPath);
|
|
59656
59656
|
try {
|
|
59657
|
-
return
|
|
59657
|
+
return fs$1.statSync(resolved).isFile();
|
|
59658
59658
|
} catch {
|
|
59659
59659
|
return false;
|
|
59660
59660
|
}
|
|
@@ -61177,7 +61177,7 @@ var MemoryManagerSyncOps = class {
|
|
|
61177
61177
|
]);
|
|
61178
61178
|
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
61179
61179
|
for (const entry of additionalPaths) try {
|
|
61180
|
-
const stat =
|
|
61180
|
+
const stat = fs$1.lstatSync(entry);
|
|
61181
61181
|
if (stat.isSymbolicLink()) continue;
|
|
61182
61182
|
if (stat.isDirectory()) {
|
|
61183
61183
|
watchPaths.add(path.join(entry, "**", "*.md"));
|
|
@@ -63227,7 +63227,7 @@ const log$24 = createSubsystemLogger("memory");
|
|
|
63227
63227
|
const QMD_MANAGER_CACHE = /* @__PURE__ */ new Map();
|
|
63228
63228
|
let managerRuntimePromise = null;
|
|
63229
63229
|
function loadManagerRuntime() {
|
|
63230
|
-
managerRuntimePromise ??= import("./manager-runtime-
|
|
63230
|
+
managerRuntimePromise ??= import("./manager-runtime-CfBjUnwB.js");
|
|
63231
63231
|
return managerRuntimePromise;
|
|
63232
63232
|
}
|
|
63233
63233
|
async function getMemorySearchManager(params) {
|
|
@@ -63241,7 +63241,7 @@ async function getMemorySearchManager(params) {
|
|
|
63241
63241
|
if (cached) return { manager: cached };
|
|
63242
63242
|
}
|
|
63243
63243
|
try {
|
|
63244
|
-
const { QmdMemoryManager } = await import("./qmd-manager-
|
|
63244
|
+
const { QmdMemoryManager } = await import("./qmd-manager-CFVuAj9l.js");
|
|
63245
63245
|
const primary = await QmdMemoryManager.create({
|
|
63246
63246
|
cfg: params.cfg,
|
|
63247
63247
|
agentId: params.agentId,
|
|
@@ -64168,7 +64168,7 @@ async function resolveOpenClawDocsPath(params) {
|
|
|
64168
64168
|
const workspaceDir = params.workspaceDir?.trim();
|
|
64169
64169
|
if (workspaceDir) {
|
|
64170
64170
|
const workspaceDocs = path.join(workspaceDir, "docs");
|
|
64171
|
-
if (
|
|
64171
|
+
if (fs$1.existsSync(workspaceDocs)) return workspaceDocs;
|
|
64172
64172
|
}
|
|
64173
64173
|
const packageRoot = await resolveOpenClawPackageRoot({
|
|
64174
64174
|
cwd: params.cwd,
|
|
@@ -64177,7 +64177,7 @@ async function resolveOpenClawDocsPath(params) {
|
|
|
64177
64177
|
});
|
|
64178
64178
|
if (!packageRoot) return null;
|
|
64179
64179
|
const packageDocs = path.join(packageRoot, "docs");
|
|
64180
|
-
return
|
|
64180
|
+
return fs$1.existsSync(packageDocs) ? packageDocs : null;
|
|
64181
64181
|
}
|
|
64182
64182
|
//#endregion
|
|
64183
64183
|
//#region src/agents/model-tool-support.ts
|
|
@@ -65180,9 +65180,9 @@ function resolvePatchFileOps(options) {
|
|
|
65180
65180
|
});
|
|
65181
65181
|
assertBoundaryRead(opened, filePath);
|
|
65182
65182
|
try {
|
|
65183
|
-
return
|
|
65183
|
+
return fs$1.readFileSync(opened.fd, "utf8");
|
|
65184
65184
|
} finally {
|
|
65185
|
-
|
|
65185
|
+
fs$1.closeSync(opened.fd);
|
|
65186
65186
|
}
|
|
65187
65187
|
},
|
|
65188
65188
|
writeFile: async (filePath, content) => {
|
|
@@ -65462,7 +65462,7 @@ function mergeLegacyAgent(current, legacy) {
|
|
|
65462
65462
|
}
|
|
65463
65463
|
function ensureDir$1(filePath) {
|
|
65464
65464
|
const dir = path.dirname(filePath);
|
|
65465
|
-
|
|
65465
|
+
fs$1.mkdirSync(dir, { recursive: true });
|
|
65466
65466
|
}
|
|
65467
65467
|
function coerceAllowlistEntries(allowlist) {
|
|
65468
65468
|
if (!Array.isArray(allowlist) || allowlist.length === 0) return Array.isArray(allowlist) ? allowlist : void 0;
|
|
@@ -65532,11 +65532,11 @@ function generateToken() {
|
|
|
65532
65532
|
function loadExecApprovals() {
|
|
65533
65533
|
const filePath = resolveExecApprovalsPath();
|
|
65534
65534
|
try {
|
|
65535
|
-
if (!
|
|
65535
|
+
if (!fs$1.existsSync(filePath)) return normalizeExecApprovals({
|
|
65536
65536
|
version: 1,
|
|
65537
65537
|
agents: {}
|
|
65538
65538
|
});
|
|
65539
|
-
const raw =
|
|
65539
|
+
const raw = fs$1.readFileSync(filePath, "utf8");
|
|
65540
65540
|
const parsed = JSON.parse(raw);
|
|
65541
65541
|
if (parsed?.version !== 1) return normalizeExecApprovals({
|
|
65542
65542
|
version: 1,
|
|
@@ -65553,9 +65553,9 @@ function loadExecApprovals() {
|
|
|
65553
65553
|
function saveExecApprovals(file) {
|
|
65554
65554
|
const filePath = resolveExecApprovalsPath();
|
|
65555
65555
|
ensureDir$1(filePath);
|
|
65556
|
-
|
|
65556
|
+
fs$1.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}\n`, { mode: 384 });
|
|
65557
65557
|
try {
|
|
65558
|
-
|
|
65558
|
+
fs$1.chmodSync(filePath, 384);
|
|
65559
65559
|
} catch {}
|
|
65560
65560
|
}
|
|
65561
65561
|
function ensureExecApprovals() {
|
|
@@ -66356,18 +66356,18 @@ function applyPathPrepend(env, prepend, options) {
|
|
|
66356
66356
|
function resolvePowerShellPath() {
|
|
66357
66357
|
const programFiles = process.env.ProgramFiles || process.env.PROGRAMFILES || "C:\\Program Files";
|
|
66358
66358
|
const pwsh7 = path.join(programFiles, "PowerShell", "7", "pwsh.exe");
|
|
66359
|
-
if (
|
|
66359
|
+
if (fs$1.existsSync(pwsh7)) return pwsh7;
|
|
66360
66360
|
const programW6432 = process.env.ProgramW6432;
|
|
66361
66361
|
if (programW6432 && programW6432 !== programFiles) {
|
|
66362
66362
|
const pwsh7Alt = path.join(programW6432, "PowerShell", "7", "pwsh.exe");
|
|
66363
|
-
if (
|
|
66363
|
+
if (fs$1.existsSync(pwsh7Alt)) return pwsh7Alt;
|
|
66364
66364
|
}
|
|
66365
66365
|
const pwshInPath = resolveShellFromPath("pwsh");
|
|
66366
66366
|
if (pwshInPath) return pwshInPath;
|
|
66367
66367
|
const systemRoot = process.env.SystemRoot || process.env.WINDIR;
|
|
66368
66368
|
if (systemRoot) {
|
|
66369
66369
|
const candidate = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
66370
|
-
if (
|
|
66370
|
+
if (fs$1.existsSync(candidate)) return candidate;
|
|
66371
66371
|
}
|
|
66372
66372
|
return "powershell.exe";
|
|
66373
66373
|
}
|
|
@@ -66405,7 +66405,7 @@ function resolveShellFromPath(name) {
|
|
|
66405
66405
|
for (const entry of entries) {
|
|
66406
66406
|
const candidate = path.join(entry, name);
|
|
66407
66407
|
try {
|
|
66408
|
-
|
|
66408
|
+
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
66409
66409
|
return candidate;
|
|
66410
66410
|
} catch {}
|
|
66411
66411
|
}
|
|
@@ -67628,7 +67628,7 @@ function resolveDefaultIdentityPath() {
|
|
|
67628
67628
|
return path.join(resolveStateDir(), "identity", "device.json");
|
|
67629
67629
|
}
|
|
67630
67630
|
function ensureDir(filePath) {
|
|
67631
|
-
|
|
67631
|
+
fs$1.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
67632
67632
|
}
|
|
67633
67633
|
const ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
|
|
67634
67634
|
function base64UrlEncode(buf) {
|
|
@@ -67664,8 +67664,8 @@ function generateIdentity() {
|
|
|
67664
67664
|
}
|
|
67665
67665
|
function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
67666
67666
|
try {
|
|
67667
|
-
if (
|
|
67668
|
-
const raw =
|
|
67667
|
+
if (fs$1.existsSync(filePath)) {
|
|
67668
|
+
const raw = fs$1.readFileSync(filePath, "utf8");
|
|
67669
67669
|
const parsed = JSON.parse(raw);
|
|
67670
67670
|
if (parsed?.version === 1 && typeof parsed.deviceId === "string" && typeof parsed.publicKeyPem === "string" && typeof parsed.privateKeyPem === "string") {
|
|
67671
67671
|
const derivedId = fingerprintPublicKey(parsed.publicKeyPem);
|
|
@@ -67674,9 +67674,9 @@ function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
|
67674
67674
|
...parsed,
|
|
67675
67675
|
deviceId: derivedId
|
|
67676
67676
|
};
|
|
67677
|
-
|
|
67677
|
+
fs$1.writeFileSync(filePath, `${JSON.stringify(updated, null, 2)}\n`, { mode: 384 });
|
|
67678
67678
|
try {
|
|
67679
|
-
|
|
67679
|
+
fs$1.chmodSync(filePath, 384);
|
|
67680
67680
|
} catch {}
|
|
67681
67681
|
return {
|
|
67682
67682
|
deviceId: derivedId,
|
|
@@ -67701,9 +67701,9 @@ function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
|
67701
67701
|
privateKeyPem: identity.privateKeyPem,
|
|
67702
67702
|
createdAtMs: Date.now()
|
|
67703
67703
|
};
|
|
67704
|
-
|
|
67704
|
+
fs$1.writeFileSync(filePath, `${JSON.stringify(stored, null, 2)}\n`, { mode: 384 });
|
|
67705
67705
|
try {
|
|
67706
|
-
|
|
67706
|
+
fs$1.chmodSync(filePath, 384);
|
|
67707
67707
|
} catch {}
|
|
67708
67708
|
return identity;
|
|
67709
67709
|
}
|
|
@@ -67911,8 +67911,8 @@ function resolveDeviceAuthPath(env = process.env) {
|
|
|
67911
67911
|
}
|
|
67912
67912
|
function readStore(filePath) {
|
|
67913
67913
|
try {
|
|
67914
|
-
if (!
|
|
67915
|
-
const raw =
|
|
67914
|
+
if (!fs$1.existsSync(filePath)) return null;
|
|
67915
|
+
const raw = fs$1.readFileSync(filePath, "utf8");
|
|
67916
67916
|
const parsed = JSON.parse(raw);
|
|
67917
67917
|
if (parsed?.version !== 1 || typeof parsed.deviceId !== "string") return null;
|
|
67918
67918
|
if (!parsed.tokens || typeof parsed.tokens !== "object") return null;
|
|
@@ -67922,10 +67922,10 @@ function readStore(filePath) {
|
|
|
67922
67922
|
}
|
|
67923
67923
|
}
|
|
67924
67924
|
function writeStore(filePath, store) {
|
|
67925
|
-
|
|
67926
|
-
|
|
67925
|
+
fs$1.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
67926
|
+
fs$1.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}\n`, { mode: 384 });
|
|
67927
67927
|
try {
|
|
67928
|
-
|
|
67928
|
+
fs$1.chmodSync(filePath, 384);
|
|
67929
67929
|
} catch {}
|
|
67930
67930
|
}
|
|
67931
67931
|
function loadDeviceAuthToken(params) {
|
|
@@ -77588,7 +77588,7 @@ function asBoolean(value) {
|
|
|
77588
77588
|
}
|
|
77589
77589
|
function resolveTempPathParts(opts) {
|
|
77590
77590
|
const tmpDir = opts.tmpDir ?? resolvePreferredOpenClawTmpDir();
|
|
77591
|
-
if (!opts.tmpDir)
|
|
77591
|
+
if (!opts.tmpDir) fs$1.mkdirSync(tmpDir, {
|
|
77592
77592
|
recursive: true,
|
|
77593
77593
|
mode: 448
|
|
77594
77594
|
});
|
|
@@ -77673,7 +77673,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
77673
77673
|
if (typeof contentLength === "number" && Number.isFinite(contentLength) && contentLength > MAX_CAMERA_URL_DOWNLOAD_BYTES) throw new Error(`writeUrlToFile: content-length ${contentLength} exceeds max ${MAX_CAMERA_URL_DOWNLOAD_BYTES}`);
|
|
77674
77674
|
const body = res.body;
|
|
77675
77675
|
if (!body) throw new Error(`failed to download ${url}: empty response body`);
|
|
77676
|
-
const fileHandle = await fs$
|
|
77676
|
+
const fileHandle = await fs$2.open(filePath, "w");
|
|
77677
77677
|
let thrown;
|
|
77678
77678
|
try {
|
|
77679
77679
|
const reader = body.getReader();
|
|
@@ -77691,7 +77691,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
77691
77691
|
await fileHandle.close();
|
|
77692
77692
|
}
|
|
77693
77693
|
if (thrown) {
|
|
77694
|
-
await fs$
|
|
77694
|
+
await fs$2.unlink(filePath).catch(() => {});
|
|
77695
77695
|
throw thrown;
|
|
77696
77696
|
}
|
|
77697
77697
|
} finally {
|
|
@@ -77704,7 +77704,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
77704
77704
|
}
|
|
77705
77705
|
async function writeBase64ToFile(filePath, base64) {
|
|
77706
77706
|
const buf = Buffer.from(base64, "base64");
|
|
77707
|
-
await fs$
|
|
77707
|
+
await fs$2.writeFile(filePath, buf);
|
|
77708
77708
|
return {
|
|
77709
77709
|
path: filePath,
|
|
77710
77710
|
bytes: buf.length
|
|
@@ -78992,7 +78992,7 @@ function relaunchGatewayScheduledTask(env = process.env) {
|
|
|
78992
78992
|
const scriptPath = path.join(resolvePreferredOpenClawTmpDir(), `openclaw-schtasks-restart-${randomUUID()}.cmd`);
|
|
78993
78993
|
const quotedScriptPath = quoteCmdScriptArg(scriptPath);
|
|
78994
78994
|
try {
|
|
78995
|
-
|
|
78995
|
+
fs$1.writeFileSync(scriptPath, `${buildScheduledTaskRestartScript(taskName)}\r\n`, "utf8");
|
|
78996
78996
|
spawn("cmd.exe", [
|
|
78997
78997
|
"/d",
|
|
78998
78998
|
"/s",
|
|
@@ -79010,7 +79010,7 @@ function relaunchGatewayScheduledTask(env = process.env) {
|
|
|
79010
79010
|
};
|
|
79011
79011
|
} catch (err) {
|
|
79012
79012
|
try {
|
|
79013
|
-
|
|
79013
|
+
fs$1.unlinkSync(scriptPath);
|
|
79014
79014
|
} catch {}
|
|
79015
79015
|
return {
|
|
79016
79016
|
ok: false,
|
|
@@ -81947,9 +81947,9 @@ function loadExternalCatalogEntries(options) {
|
|
|
81947
81947
|
const entries = [];
|
|
81948
81948
|
for (const rawPath of paths) {
|
|
81949
81949
|
const resolved = resolveUserPath(rawPath, env);
|
|
81950
|
-
if (!
|
|
81950
|
+
if (!fs$1.existsSync(resolved)) continue;
|
|
81951
81951
|
try {
|
|
81952
|
-
const payload = JSON.parse(
|
|
81952
|
+
const payload = JSON.parse(fs$1.readFileSync(resolved, "utf-8"));
|
|
81953
81953
|
entries.push(...parseCatalogEntries(payload));
|
|
81954
81954
|
} catch {}
|
|
81955
81955
|
}
|
|
@@ -83214,17 +83214,17 @@ function getErrnoCode(err) {
|
|
|
83214
83214
|
}
|
|
83215
83215
|
async function unlinkBestEffort(filePath) {
|
|
83216
83216
|
try {
|
|
83217
|
-
await
|
|
83217
|
+
await fs$1.promises.unlink(filePath);
|
|
83218
83218
|
} catch {}
|
|
83219
83219
|
}
|
|
83220
83220
|
/** Ensure the queue directory (and failed/ subdirectory) exist. */
|
|
83221
83221
|
async function ensureQueueDir(stateDir) {
|
|
83222
83222
|
const queueDir = resolveQueueDir(stateDir);
|
|
83223
|
-
await
|
|
83223
|
+
await fs$1.promises.mkdir(queueDir, {
|
|
83224
83224
|
recursive: true,
|
|
83225
83225
|
mode: 448
|
|
83226
83226
|
});
|
|
83227
|
-
await
|
|
83227
|
+
await fs$1.promises.mkdir(resolveFailedDir(stateDir), {
|
|
83228
83228
|
recursive: true,
|
|
83229
83229
|
mode: 448
|
|
83230
83230
|
});
|
|
@@ -83252,11 +83252,11 @@ async function enqueueDelivery(params, stateDir) {
|
|
|
83252
83252
|
const filePath = path.join(queueDir, `${id}.json`);
|
|
83253
83253
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
83254
83254
|
const json = JSON.stringify(entry, null, 2);
|
|
83255
|
-
await
|
|
83255
|
+
await fs$1.promises.writeFile(tmp, json, {
|
|
83256
83256
|
encoding: "utf-8",
|
|
83257
83257
|
mode: 384
|
|
83258
83258
|
});
|
|
83259
|
-
await
|
|
83259
|
+
await fs$1.promises.rename(tmp, filePath);
|
|
83260
83260
|
return id;
|
|
83261
83261
|
}
|
|
83262
83262
|
/** Remove a successfully delivered entry from the queue.
|
|
@@ -83271,7 +83271,7 @@ async function enqueueDelivery(params, stateDir) {
|
|
|
83271
83271
|
async function ackDelivery(id, stateDir) {
|
|
83272
83272
|
const { jsonPath, deliveredPath } = resolveQueueEntryPaths(id, stateDir);
|
|
83273
83273
|
try {
|
|
83274
|
-
await
|
|
83274
|
+
await fs$1.promises.rename(jsonPath, deliveredPath);
|
|
83275
83275
|
} catch (err) {
|
|
83276
83276
|
if (getErrnoCode(err) === "ENOENT") {
|
|
83277
83277
|
await unlinkBestEffort(deliveredPath);
|
|
@@ -83284,17 +83284,17 @@ async function ackDelivery(id, stateDir) {
|
|
|
83284
83284
|
/** Update a queue entry after a failed delivery attempt. */
|
|
83285
83285
|
async function failDelivery(id, error, stateDir) {
|
|
83286
83286
|
const filePath = path.join(resolveQueueDir(stateDir), `${id}.json`);
|
|
83287
|
-
const raw = await
|
|
83287
|
+
const raw = await fs$1.promises.readFile(filePath, "utf-8");
|
|
83288
83288
|
const entry = JSON.parse(raw);
|
|
83289
83289
|
entry.retryCount += 1;
|
|
83290
83290
|
entry.lastAttemptAt = Date.now();
|
|
83291
83291
|
entry.lastError = error;
|
|
83292
83292
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
83293
|
-
await
|
|
83293
|
+
await fs$1.promises.writeFile(tmp, JSON.stringify(entry, null, 2), {
|
|
83294
83294
|
encoding: "utf-8",
|
|
83295
83295
|
mode: 384
|
|
83296
83296
|
});
|
|
83297
|
-
await
|
|
83297
|
+
await fs$1.promises.rename(tmp, filePath);
|
|
83298
83298
|
}
|
|
83299
83299
|
//#endregion
|
|
83300
83300
|
//#region src/auto-reply/reply/reply-tags.ts
|
|
@@ -89192,7 +89192,7 @@ function normalizeReplyPayload(payload, opts = {}) {
|
|
|
89192
89192
|
*/
|
|
89193
89193
|
let deliverRuntimePromise$2 = null;
|
|
89194
89194
|
function loadDeliverRuntime$2() {
|
|
89195
|
-
deliverRuntimePromise$2 ??= import("./deliver-runtime-
|
|
89195
|
+
deliverRuntimePromise$2 ??= import("./deliver-runtime-CUrIlSzN.js");
|
|
89196
89196
|
return deliverRuntimePromise$2;
|
|
89197
89197
|
}
|
|
89198
89198
|
/**
|
|
@@ -89742,7 +89742,7 @@ function ensureContextWindowCacheLoaded() {
|
|
|
89742
89742
|
await ensureOpenClawModelsJson(cfg);
|
|
89743
89743
|
} catch {}
|
|
89744
89744
|
try {
|
|
89745
|
-
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-runtime-
|
|
89745
|
+
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-runtime-CK36RhYz.js");
|
|
89746
89746
|
const agentDir = resolveOpenClawAgentDir();
|
|
89747
89747
|
const modelRegistry = discoverModels(discoverAuthStorage(agentDir), agentDir);
|
|
89748
89748
|
applyDiscoveredContextWindows({
|
|
@@ -90002,7 +90002,7 @@ function walkUpFrom(startDir, opts, resolveAtDir) {
|
|
|
90002
90002
|
function hasGitMarker(repoRoot) {
|
|
90003
90003
|
const gitPath = path.join(repoRoot, ".git");
|
|
90004
90004
|
try {
|
|
90005
|
-
const stat =
|
|
90005
|
+
const stat = fs$1.statSync(gitPath);
|
|
90006
90006
|
return stat.isDirectory() || stat.isFile();
|
|
90007
90007
|
} catch {
|
|
90008
90008
|
return false;
|
|
@@ -90014,10 +90014,10 @@ function findGitRoot(startDir, opts = {}) {
|
|
|
90014
90014
|
function resolveGitDirFromMarker(repoRoot) {
|
|
90015
90015
|
const gitPath = path.join(repoRoot, ".git");
|
|
90016
90016
|
try {
|
|
90017
|
-
const stat =
|
|
90017
|
+
const stat = fs$1.statSync(gitPath);
|
|
90018
90018
|
if (stat.isDirectory()) return gitPath;
|
|
90019
90019
|
if (!stat.isFile()) return null;
|
|
90020
|
-
const match =
|
|
90020
|
+
const match = fs$1.readFileSync(gitPath, "utf-8").match(/gitdir:\s*(.+)/i);
|
|
90021
90021
|
if (!match?.[1]) return null;
|
|
90022
90022
|
return path.resolve(repoRoot, match[1].trim());
|
|
90023
90023
|
} catch {
|
|
@@ -90055,13 +90055,13 @@ const resolveCommitSearchDir = (options) => {
|
|
|
90055
90055
|
};
|
|
90056
90056
|
/** Read at most `limit` bytes from a file to avoid unbounded reads. */
|
|
90057
90057
|
const safeReadFilePrefix = (filePath, limit = 256) => {
|
|
90058
|
-
const fd =
|
|
90058
|
+
const fd = fs$1.openSync(filePath, "r");
|
|
90059
90059
|
try {
|
|
90060
90060
|
const buf = Buffer.alloc(limit);
|
|
90061
|
-
const bytesRead =
|
|
90061
|
+
const bytesRead = fs$1.readSync(fd, buf, 0, limit, 0);
|
|
90062
90062
|
return buf.subarray(0, bytesRead).toString("utf-8");
|
|
90063
90063
|
} finally {
|
|
90064
|
-
|
|
90064
|
+
fs$1.closeSync(fd);
|
|
90065
90065
|
}
|
|
90066
90066
|
};
|
|
90067
90067
|
const cacheGitCommit = (searchDir, commit) => {
|
|
@@ -90077,7 +90077,7 @@ const resolveGitLookupDepth = (searchDir, packageRoot) => {
|
|
|
90077
90077
|
const readCommitFromGit = (searchDir, packageRoot) => {
|
|
90078
90078
|
const headPath = resolveGitHeadPath(searchDir, { maxDepth: resolveGitLookupDepth(searchDir, packageRoot) });
|
|
90079
90079
|
if (!headPath) return;
|
|
90080
|
-
const head =
|
|
90080
|
+
const head = fs$1.readFileSync(headPath, "utf-8").trim();
|
|
90081
90081
|
if (!head) return null;
|
|
90082
90082
|
if (head.startsWith("ref:")) {
|
|
90083
90083
|
const refPath = resolveRefPath(headPath, head.replace(/^ref:\s*/i, "").trim());
|
|
@@ -90404,17 +90404,17 @@ const readUsageFromSessionLog = (sessionId, sessionEntry, agentId, sessionKey, s
|
|
|
90404
90404
|
} catch {
|
|
90405
90405
|
return;
|
|
90406
90406
|
}
|
|
90407
|
-
if (!
|
|
90407
|
+
if (!fs$1.existsSync(logPath)) return;
|
|
90408
90408
|
try {
|
|
90409
90409
|
const TAIL_BYTES = 8192;
|
|
90410
|
-
const stat =
|
|
90410
|
+
const stat = fs$1.statSync(logPath);
|
|
90411
90411
|
const offset = Math.max(0, stat.size - TAIL_BYTES);
|
|
90412
90412
|
const buf = Buffer.alloc(Math.min(TAIL_BYTES, stat.size));
|
|
90413
|
-
const fd =
|
|
90413
|
+
const fd = fs$1.openSync(logPath, "r");
|
|
90414
90414
|
try {
|
|
90415
|
-
|
|
90415
|
+
fs$1.readSync(fd, buf, 0, buf.length, offset);
|
|
90416
90416
|
} finally {
|
|
90417
|
-
|
|
90417
|
+
fs$1.closeSync(fd);
|
|
90418
90418
|
}
|
|
90419
90419
|
const tail = buf.toString("utf-8");
|
|
90420
90420
|
const lines = (offset > 0 ? tail.slice(tail.indexOf("\n") + 1) : tail).split(/\n+/);
|
|
@@ -90981,8 +90981,8 @@ function resolveZaiApiKey() {
|
|
|
90981
90981
|
}
|
|
90982
90982
|
try {
|
|
90983
90983
|
const authPath = path.join(resolveRequiredHomeDir(process.env, os.homedir), ".pi", "agent", "auth.json");
|
|
90984
|
-
if (!
|
|
90985
|
-
const data = JSON.parse(
|
|
90984
|
+
if (!fs$1.existsSync(authPath)) return;
|
|
90985
|
+
const data = JSON.parse(fs$1.readFileSync(authPath, "utf-8"));
|
|
90986
90986
|
return data["z-ai"]?.access || data.zai?.access;
|
|
90987
90987
|
} catch {
|
|
90988
90988
|
return;
|
|
@@ -94662,7 +94662,7 @@ function normalizeSessionKey$1(value) {
|
|
|
94662
94662
|
}
|
|
94663
94663
|
function readSessionStore$1(storePath) {
|
|
94664
94664
|
try {
|
|
94665
|
-
const raw =
|
|
94665
|
+
const raw = fs$1.readFileSync(storePath, "utf-8");
|
|
94666
94666
|
const parsed = JSON5.parse(raw);
|
|
94667
94667
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
94668
94668
|
} catch {}
|
|
@@ -94742,7 +94742,7 @@ const MAX_TIMER_SAFE_TIMEOUT_MS = 2147e6;
|
|
|
94742
94742
|
const GATEWAY_TIMEOUT_PATTERN = /gateway timeout/i;
|
|
94743
94743
|
let subagentRegistryRuntimePromise = null;
|
|
94744
94744
|
function loadSubagentRegistryRuntime() {
|
|
94745
|
-
subagentRegistryRuntimePromise ??= import("./subagent-registry-runtime-
|
|
94745
|
+
subagentRegistryRuntimePromise ??= import("./subagent-registry-runtime-DkamrsVw.js");
|
|
94746
94746
|
return subagentRegistryRuntimePromise;
|
|
94747
94747
|
}
|
|
94748
94748
|
const DIRECT_ANNOUNCE_TRANSIENT_RETRY_DELAYS_MS = FAST_TEST_MODE ? [
|
|
@@ -100767,7 +100767,7 @@ const LOOP_WARNING_BUCKET_SIZE = 10;
|
|
|
100767
100767
|
const MAX_LOOP_WARNING_KEYS = 256;
|
|
100768
100768
|
let beforeToolCallRuntimePromise = null;
|
|
100769
100769
|
function loadBeforeToolCallRuntime() {
|
|
100770
|
-
beforeToolCallRuntimePromise ??= import("./pi-tools.before-tool-call.runtime-
|
|
100770
|
+
beforeToolCallRuntimePromise ??= import("./pi-tools.before-tool-call.runtime-CLRTNt4A.js");
|
|
100771
100771
|
return beforeToolCallRuntimePromise;
|
|
100772
100772
|
}
|
|
100773
100773
|
function buildAdjustedParamsKey(params) {
|
|
@@ -103869,9 +103869,9 @@ async function readPostCompactionContext(workspaceDir, cfg, nowMs) {
|
|
|
103869
103869
|
if (!opened.ok) return null;
|
|
103870
103870
|
const content = (() => {
|
|
103871
103871
|
try {
|
|
103872
|
-
return
|
|
103872
|
+
return fs$1.readFileSync(opened.fd, "utf-8");
|
|
103873
103873
|
} finally {
|
|
103874
|
-
|
|
103874
|
+
fs$1.closeSync(opened.fd);
|
|
103875
103875
|
}
|
|
103876
103876
|
})();
|
|
103877
103877
|
const configuredSections = cfg?.agents?.defaults?.compaction?.postCompactionSections;
|
|
@@ -104623,9 +104623,9 @@ async function readWorkspaceContextForSummary() {
|
|
|
104623
104623
|
if (!opened.ok) return "";
|
|
104624
104624
|
const content = (() => {
|
|
104625
104625
|
try {
|
|
104626
|
-
return
|
|
104626
|
+
return fs$1.readFileSync(opened.fd, "utf-8");
|
|
104627
104627
|
} finally {
|
|
104628
|
-
|
|
104628
|
+
fs$1.closeSync(opened.fd);
|
|
104629
104629
|
}
|
|
104630
104630
|
})();
|
|
104631
104631
|
let sections = extractSections(content, ["Session Startup", "Red Lines"]);
|
|
@@ -106640,7 +106640,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
106640
106640
|
if (!apiKeyInfo.apiKey) {
|
|
106641
106641
|
if (apiKeyInfo.mode !== "aws-sdk") throw new Error(`No API key resolved for provider "${model.provider}" (auth mode: ${apiKeyInfo.mode}).`);
|
|
106642
106642
|
} else if (model.provider === "github-copilot") {
|
|
106643
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
106643
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-368sRGBD.js").then((n) => n.n);
|
|
106644
106644
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
106645
106645
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
106646
106646
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
@@ -110095,11 +110095,11 @@ function appendRawStream(payload) {
|
|
|
110095
110095
|
if (!rawStreamReady) {
|
|
110096
110096
|
rawStreamReady = true;
|
|
110097
110097
|
try {
|
|
110098
|
-
|
|
110098
|
+
fs$1.mkdirSync(path.dirname(RAW_STREAM_PATH), { recursive: true });
|
|
110099
110099
|
} catch {}
|
|
110100
110100
|
}
|
|
110101
110101
|
try {
|
|
110102
|
-
|
|
110102
|
+
fs$1.promises.appendFile(RAW_STREAM_PATH, `${JSON.stringify(payload)}\n`);
|
|
110103
110103
|
} catch {}
|
|
110104
110104
|
}
|
|
110105
110105
|
//#endregion
|
|
@@ -111647,7 +111647,7 @@ function resolveRepoRoot(params) {
|
|
|
111647
111647
|
const configured = params.config?.agents?.defaults?.repoRoot?.trim();
|
|
111648
111648
|
if (configured) try {
|
|
111649
111649
|
const resolved = path.resolve(configured);
|
|
111650
|
-
if (
|
|
111650
|
+
if (fs$1.statSync(resolved).isDirectory()) return resolved;
|
|
111651
111651
|
} catch {}
|
|
111652
111652
|
const candidates = [params.workspaceDir, params.cwd].map((value) => value?.trim()).filter(Boolean);
|
|
111653
111653
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -114603,7 +114603,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
114603
114603
|
await copilotTokenState.refreshInFlight;
|
|
114604
114604
|
return;
|
|
114605
114605
|
}
|
|
114606
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
114606
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-368sRGBD.js").then((n) => n.n);
|
|
114607
114607
|
copilotTokenState.refreshInFlight = (async () => {
|
|
114608
114608
|
const githubToken = copilotTokenState.githubToken.trim();
|
|
114609
114609
|
if (!githubToken) throw new Error("Copilot refresh requires a GitHub token.");
|
|
@@ -114695,7 +114695,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
114695
114695
|
return;
|
|
114696
114696
|
}
|
|
114697
114697
|
if (model.provider === "github-copilot") {
|
|
114698
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
114698
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-368sRGBD.js").then((n) => n.n);
|
|
114699
114699
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
114700
114700
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
114701
114701
|
if (copilotTokenState) {
|
|
@@ -117006,7 +117006,7 @@ async function runWithConcurrency(tasks, limit) {
|
|
|
117006
117006
|
//#region src/media-understanding/echo-transcript.ts
|
|
117007
117007
|
let deliverRuntimePromise$1 = null;
|
|
117008
117008
|
function loadDeliverRuntime$1() {
|
|
117009
|
-
deliverRuntimePromise$1 ??= import("./deliver-runtime-
|
|
117009
|
+
deliverRuntimePromise$1 ??= import("./deliver-runtime-CUrIlSzN.js");
|
|
117010
117010
|
return deliverRuntimePromise$1;
|
|
117011
117011
|
}
|
|
117012
117012
|
function formatEchoTranscript(transcript, format) {
|
|
@@ -122432,13 +122432,13 @@ function listSkillCommandsForAgents(params) {
|
|
|
122432
122432
|
const workspaceFilters = /* @__PURE__ */ new Map();
|
|
122433
122433
|
for (const agentId of agentIds) {
|
|
122434
122434
|
const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId);
|
|
122435
|
-
if (!
|
|
122435
|
+
if (!fs$1.existsSync(workspaceDir)) {
|
|
122436
122436
|
logVerbose(`Skipping agent "${agentId}": workspace does not exist: ${workspaceDir}`);
|
|
122437
122437
|
continue;
|
|
122438
122438
|
}
|
|
122439
122439
|
let canonicalDir;
|
|
122440
122440
|
try {
|
|
122441
|
-
canonicalDir =
|
|
122441
|
+
canonicalDir = fs$1.realpathSync(workspaceDir);
|
|
122442
122442
|
} catch {
|
|
122443
122443
|
logVerbose(`Skipping agent "${agentId}": cannot resolve workspace: ${workspaceDir}`);
|
|
122444
122444
|
continue;
|
|
@@ -122815,7 +122815,7 @@ async function buildContextReply(params) {
|
|
|
122815
122815
|
//#region src/auto-reply/reply/commands-export-session.ts
|
|
122816
122816
|
const EXPORT_HTML_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "export-html");
|
|
122817
122817
|
function loadTemplate(fileName) {
|
|
122818
|
-
return
|
|
122818
|
+
return fs$1.readFileSync(path.join(EXPORT_HTML_DIR, fileName), "utf-8");
|
|
122819
122819
|
}
|
|
122820
122820
|
function generateHtml(sessionData) {
|
|
122821
122821
|
const template = loadTemplate("template.html");
|
|
@@ -122889,7 +122889,7 @@ async function buildExportSessionReply(params) {
|
|
|
122889
122889
|
} catch (err) {
|
|
122890
122890
|
return { text: `❌ Failed to resolve session file: ${err instanceof Error ? err.message : String(err)}` };
|
|
122891
122891
|
}
|
|
122892
|
-
if (!
|
|
122892
|
+
if (!fs$1.existsSync(sessionFile)) return { text: `❌ Session file not found: ${sessionFile}` };
|
|
122893
122893
|
const sessionManager = SessionManager.open(sessionFile);
|
|
122894
122894
|
const entries = sessionManager.getEntries();
|
|
122895
122895
|
const header = sessionManager.getHeader();
|
|
@@ -122910,8 +122910,8 @@ async function buildExportSessionReply(params) {
|
|
|
122910
122910
|
const defaultFileName = `openclaw-session-${entry.sessionId.slice(0, 8)}-${timestamp}.html`;
|
|
122911
122911
|
const outputPath = args.outputPath ? path.resolve(args.outputPath.startsWith("~") ? args.outputPath.replace("~", process.env.HOME ?? "") : args.outputPath) : path.join(params.workspaceDir, defaultFileName);
|
|
122912
122912
|
const outputDir = path.dirname(outputPath);
|
|
122913
|
-
if (!
|
|
122914
|
-
|
|
122913
|
+
if (!fs$1.existsSync(outputDir)) fs$1.mkdirSync(outputDir, { recursive: true });
|
|
122914
|
+
fs$1.writeFileSync(outputPath, html, "utf-8");
|
|
122915
122915
|
const relativePath = path.relative(params.workspaceDir, outputPath);
|
|
122916
122916
|
return { text: [
|
|
122917
122917
|
"✅ Session exported!",
|
|
@@ -124394,7 +124394,7 @@ function summarizeLifecycleForLog(record, defaults) {
|
|
|
124394
124394
|
function loadBindingsFromDisk(accountId) {
|
|
124395
124395
|
const filePath = resolveBindingsPath(accountId);
|
|
124396
124396
|
try {
|
|
124397
|
-
const raw =
|
|
124397
|
+
const raw = fs$1.readFileSync(filePath, "utf-8");
|
|
124398
124398
|
const parsed = JSON.parse(raw);
|
|
124399
124399
|
if (parsed?.version !== STORE_VERSION$1 || !Array.isArray(parsed.bindings)) return [];
|
|
124400
124400
|
const bindings = [];
|
|
@@ -124836,7 +124836,7 @@ const applyCostTotal = (totals, costTotal) => {
|
|
|
124836
124836
|
totals.totalCost += costTotal;
|
|
124837
124837
|
};
|
|
124838
124838
|
async function* readJsonlRecords(filePath) {
|
|
124839
|
-
const fileStream =
|
|
124839
|
+
const fileStream = fs$1.createReadStream(filePath, { encoding: "utf-8" });
|
|
124840
124840
|
const rl = readline.createInterface({
|
|
124841
124841
|
input: fileStream,
|
|
124842
124842
|
crlfDelay: Infinity
|
|
@@ -124908,10 +124908,10 @@ async function loadCostUsageSummary(params) {
|
|
|
124908
124908
|
const dailyMap = /* @__PURE__ */ new Map();
|
|
124909
124909
|
const totals = emptyTotals();
|
|
124910
124910
|
const sessionsDir = resolveSessionTranscriptsDirForAgent(params?.agentId);
|
|
124911
|
-
const entries = await
|
|
124911
|
+
const entries = await fs$1.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
|
|
124912
124912
|
const files = (await Promise.all(entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map(async (entry) => {
|
|
124913
124913
|
const filePath = path.join(sessionsDir, entry.name);
|
|
124914
|
-
const stats = await
|
|
124914
|
+
const stats = await fs$1.promises.stat(filePath).catch(() => null);
|
|
124915
124915
|
if (!stats) return null;
|
|
124916
124916
|
if (stats.mtimeMs < sinceTime) return null;
|
|
124917
124917
|
return filePath;
|
|
@@ -124944,7 +124944,7 @@ async function loadCostUsageSummary(params) {
|
|
|
124944
124944
|
}
|
|
124945
124945
|
async function loadSessionCostSummary(params) {
|
|
124946
124946
|
const sessionFile = params.sessionFile ?? (params.sessionId ? resolveSessionFilePath(params.sessionId, params.sessionEntry, { agentId: params.agentId }) : void 0);
|
|
124947
|
-
if (!sessionFile || !
|
|
124947
|
+
if (!sessionFile || !fs$1.existsSync(sessionFile)) return null;
|
|
124948
124948
|
const totals = emptyTotals();
|
|
124949
124949
|
let firstActivity;
|
|
124950
124950
|
let lastActivity;
|
|
@@ -126839,7 +126839,7 @@ async function createModelSelectionState(params) {
|
|
|
126839
126839
|
}
|
|
126840
126840
|
}
|
|
126841
126841
|
if (sessionEntry && sessionStore && sessionKey && sessionEntry.authProfileOverride) {
|
|
126842
|
-
const { ensureAuthProfileStore } = await import("./auth-profiles.runtime-
|
|
126842
|
+
const { ensureAuthProfileStore } = await import("./auth-profiles.runtime-CuInvQ6F.js");
|
|
126843
126843
|
const profile = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }).profiles[sessionEntry.authProfileOverride];
|
|
126844
126844
|
const providerKey = normalizeProviderId(provider);
|
|
126845
126845
|
if (!profile || normalizeProviderId(profile.provider) !== providerKey) await clearSessionAuthProfileOverride({
|
|
@@ -130980,7 +130980,7 @@ async function runAgentTurnWithFallback(params) {
|
|
|
130980
130980
|
if (corruptedSessionId) {
|
|
130981
130981
|
const transcriptPath = resolveSessionTranscriptPath$1(corruptedSessionId);
|
|
130982
130982
|
try {
|
|
130983
|
-
|
|
130983
|
+
fs$1.unlinkSync(transcriptPath);
|
|
130984
130984
|
} catch {}
|
|
130985
130985
|
}
|
|
130986
130986
|
delete params.activeSessionStore[sessionKey];
|
|
@@ -131238,7 +131238,7 @@ async function readSessionLogSnapshot(params) {
|
|
|
131238
131238
|
if (!logPath) return {};
|
|
131239
131239
|
const snapshot = {};
|
|
131240
131240
|
if (params.includeByteSize) try {
|
|
131241
|
-
const stat = await
|
|
131241
|
+
const stat = await fs$1.promises.stat(logPath);
|
|
131242
131242
|
const size = Math.floor(stat.size);
|
|
131243
131243
|
snapshot.byteSize = Number.isFinite(size) && size >= 0 ? size : void 0;
|
|
131244
131244
|
} catch {
|
|
@@ -131252,7 +131252,7 @@ async function readSessionLogSnapshot(params) {
|
|
|
131252
131252
|
return snapshot;
|
|
131253
131253
|
}
|
|
131254
131254
|
async function readLastNonzeroUsageFromSessionLog(logPath) {
|
|
131255
|
-
const handle = await
|
|
131255
|
+
const handle = await fs$1.promises.open(logPath, "r");
|
|
131256
131256
|
try {
|
|
131257
131257
|
let position = (await handle.stat()).size;
|
|
131258
131258
|
let leadingPartial = "";
|
|
@@ -131567,7 +131567,7 @@ function resolveCronStorePath(storePath) {
|
|
|
131567
131567
|
}
|
|
131568
131568
|
async function loadCronStore(storePath) {
|
|
131569
131569
|
try {
|
|
131570
|
-
const raw = await
|
|
131570
|
+
const raw = await fs$1.promises.readFile(storePath, "utf-8");
|
|
131571
131571
|
let parsed;
|
|
131572
131572
|
try {
|
|
131573
131573
|
parsed = JSON5.parse(raw);
|
|
@@ -131593,21 +131593,21 @@ async function loadCronStore(storePath) {
|
|
|
131593
131593
|
}
|
|
131594
131594
|
}
|
|
131595
131595
|
async function setSecureFileMode(filePath) {
|
|
131596
|
-
await
|
|
131596
|
+
await fs$1.promises.chmod(filePath, 384).catch(() => void 0);
|
|
131597
131597
|
}
|
|
131598
131598
|
async function saveCronStore(storePath, store, opts) {
|
|
131599
131599
|
const storeDir = path.dirname(storePath);
|
|
131600
|
-
await
|
|
131600
|
+
await fs$1.promises.mkdir(storeDir, {
|
|
131601
131601
|
recursive: true,
|
|
131602
131602
|
mode: 448
|
|
131603
131603
|
});
|
|
131604
|
-
await
|
|
131604
|
+
await fs$1.promises.chmod(storeDir, 448).catch(() => void 0);
|
|
131605
131605
|
const json = JSON.stringify(store, null, 2);
|
|
131606
131606
|
const cached = serializedStoreCache.get(storePath);
|
|
131607
131607
|
if (cached === json) return;
|
|
131608
131608
|
let previous = cached ?? null;
|
|
131609
131609
|
if (previous === null) try {
|
|
131610
|
-
previous = await
|
|
131610
|
+
previous = await fs$1.promises.readFile(storePath, "utf-8");
|
|
131611
131611
|
} catch (err) {
|
|
131612
131612
|
if (err.code !== "ENOENT") throw err;
|
|
131613
131613
|
}
|
|
@@ -131616,14 +131616,14 @@ async function saveCronStore(storePath, store, opts) {
|
|
|
131616
131616
|
return;
|
|
131617
131617
|
}
|
|
131618
131618
|
const tmp = `${storePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
|
|
131619
|
-
await
|
|
131619
|
+
await fs$1.promises.writeFile(tmp, json, {
|
|
131620
131620
|
encoding: "utf-8",
|
|
131621
131621
|
mode: 384
|
|
131622
131622
|
});
|
|
131623
131623
|
await setSecureFileMode(tmp);
|
|
131624
131624
|
if (previous !== null && !opts?.skipBackup) try {
|
|
131625
131625
|
const backupPath = `${storePath}.bak`;
|
|
131626
|
-
await
|
|
131626
|
+
await fs$1.promises.copyFile(storePath, backupPath);
|
|
131627
131627
|
await setSecureFileMode(backupPath);
|
|
131628
131628
|
} catch {}
|
|
131629
131629
|
await renameWithRetry(tmp, storePath);
|
|
@@ -131634,7 +131634,7 @@ const RENAME_MAX_RETRIES = 3;
|
|
|
131634
131634
|
const RENAME_BASE_DELAY_MS = 50;
|
|
131635
131635
|
async function renameWithRetry(src, dest) {
|
|
131636
131636
|
for (let attempt = 0; attempt <= RENAME_MAX_RETRIES; attempt++) try {
|
|
131637
|
-
await
|
|
131637
|
+
await fs$1.promises.rename(src, dest);
|
|
131638
131638
|
return;
|
|
131639
131639
|
} catch (err) {
|
|
131640
131640
|
const code = err.code;
|
|
@@ -131643,8 +131643,8 @@ async function renameWithRetry(src, dest) {
|
|
|
131643
131643
|
continue;
|
|
131644
131644
|
}
|
|
131645
131645
|
if (code === "EPERM" || code === "EEXIST") {
|
|
131646
|
-
await
|
|
131647
|
-
await
|
|
131646
|
+
await fs$1.promises.copyFile(src, dest);
|
|
131647
|
+
await fs$1.promises.unlink(src).catch(() => {});
|
|
131648
131648
|
return;
|
|
131649
131649
|
}
|
|
131650
131650
|
throw err;
|
|
@@ -132251,7 +132251,7 @@ async function runReplyAgent(params) {
|
|
|
132251
132251
|
if (resolved) transcriptCandidates.add(resolved);
|
|
132252
132252
|
transcriptCandidates.add(resolveSessionTranscriptPath$1(prevSessionId, agentId));
|
|
132253
132253
|
for (const candidate of transcriptCandidates) try {
|
|
132254
|
-
|
|
132254
|
+
fs$1.unlinkSync(candidate);
|
|
132255
132255
|
} catch {}
|
|
132256
132256
|
}
|
|
132257
132257
|
return true;
|
|
@@ -133199,7 +133199,7 @@ const warnedContexts = /* @__PURE__ */ new Map();
|
|
|
133199
133199
|
const log$5 = createSubsystemLogger("session-maintenance-warning");
|
|
133200
133200
|
let deliverRuntimePromise = null;
|
|
133201
133201
|
function loadDeliverRuntime() {
|
|
133202
|
-
deliverRuntimePromise ??= import("./deliver-runtime-
|
|
133202
|
+
deliverRuntimePromise ??= import("./deliver-runtime-CUrIlSzN.js");
|
|
133203
133203
|
return deliverRuntimePromise;
|
|
133204
133204
|
}
|
|
133205
133205
|
function shouldSendWarning() {
|
|
@@ -133383,7 +133383,7 @@ function forkSessionFromParent(params) {
|
|
|
133383
133383
|
agentId: params.agentId,
|
|
133384
133384
|
sessionsDir: params.sessionsDir
|
|
133385
133385
|
});
|
|
133386
|
-
if (!parentSessionFile || !
|
|
133386
|
+
if (!parentSessionFile || !fs$1.existsSync(parentSessionFile)) return null;
|
|
133387
133387
|
try {
|
|
133388
133388
|
const manager = SessionManager.open(parentSessionFile);
|
|
133389
133389
|
const leafId = manager.getLeafId();
|
|
@@ -133407,7 +133407,7 @@ function forkSessionFromParent(params) {
|
|
|
133407
133407
|
cwd: manager.getCwd(),
|
|
133408
133408
|
parentSession: parentSessionFile
|
|
133409
133409
|
};
|
|
133410
|
-
|
|
133410
|
+
fs$1.writeFileSync(sessionFile, `${JSON.stringify(header)}\n`, "utf-8");
|
|
133411
133411
|
return {
|
|
133412
133412
|
sessionId,
|
|
133413
133413
|
sessionFile
|
|
@@ -136954,7 +136954,7 @@ function identityHasValues(identity) {
|
|
|
136954
136954
|
}
|
|
136955
136955
|
function loadIdentityFromFile(identityPath) {
|
|
136956
136956
|
try {
|
|
136957
|
-
const parsed = parseIdentityMarkdown(
|
|
136957
|
+
const parsed = parseIdentityMarkdown(fs$1.readFileSync(identityPath, "utf-8"));
|
|
136958
136958
|
if (!identityHasValues(parsed)) return null;
|
|
136959
136959
|
return parsed;
|
|
136960
136960
|
} catch {
|
|
@@ -136977,7 +136977,7 @@ function resolveAvatarSource(cfg, agentId) {
|
|
|
136977
136977
|
}
|
|
136978
136978
|
function resolveExistingPath(value) {
|
|
136979
136979
|
try {
|
|
136980
|
-
return
|
|
136980
|
+
return fs$1.realpathSync(value);
|
|
136981
136981
|
} catch {
|
|
136982
136982
|
return path.resolve(value);
|
|
136983
136983
|
}
|
|
@@ -136995,7 +136995,7 @@ function resolveLocalAvatarPath(params) {
|
|
|
136995
136995
|
reason: "unsupported_extension"
|
|
136996
136996
|
};
|
|
136997
136997
|
try {
|
|
136998
|
-
const stat =
|
|
136998
|
+
const stat = fs$1.statSync(realPath);
|
|
136999
136999
|
if (!stat.isFile()) return {
|
|
137000
137000
|
ok: false,
|
|
137001
137001
|
reason: "missing"
|
|
@@ -138363,7 +138363,7 @@ async function resolveDiscordPreflightAudioMentionContext(params) {
|
|
|
138363
138363
|
hasTypedText
|
|
138364
138364
|
};
|
|
138365
138365
|
try {
|
|
138366
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
138366
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-BQoP-O-0.js");
|
|
138367
138367
|
if (params.abortSignal?.aborted) return {
|
|
138368
138368
|
hasAudioAttachment,
|
|
138369
138369
|
hasTypedText
|
|
@@ -144699,7 +144699,7 @@ function resolveDiscordRestFetch(proxyUrl, runtime) {
|
|
|
144699
144699
|
//#region extensions/discord/src/monitor/provider.ts
|
|
144700
144700
|
let discordVoiceRuntimePromise;
|
|
144701
144701
|
async function loadDiscordVoiceRuntime() {
|
|
144702
|
-
discordVoiceRuntimePromise ??= import("./manager.runtime-
|
|
144702
|
+
discordVoiceRuntimePromise ??= import("./manager.runtime-DF-LRAbL.js");
|
|
144703
144703
|
return await discordVoiceRuntimePromise;
|
|
144704
144704
|
}
|
|
144705
144705
|
function formatThreadBindingDurationForConfigLabel(durationMs) {
|
|
@@ -152679,15 +152679,15 @@ let slashCommandsRuntimePromise = null;
|
|
|
152679
152679
|
let slashDispatchRuntimePromise = null;
|
|
152680
152680
|
let slashSkillCommandsRuntimePromise = null;
|
|
152681
152681
|
function loadSlashCommandsRuntime() {
|
|
152682
|
-
slashCommandsRuntimePromise ??= import("./slash-commands.runtime-
|
|
152682
|
+
slashCommandsRuntimePromise ??= import("./slash-commands.runtime-BTNXGYOP.js");
|
|
152683
152683
|
return slashCommandsRuntimePromise;
|
|
152684
152684
|
}
|
|
152685
152685
|
function loadSlashDispatchRuntime() {
|
|
152686
|
-
slashDispatchRuntimePromise ??= import("./slash-dispatch.runtime-
|
|
152686
|
+
slashDispatchRuntimePromise ??= import("./slash-dispatch.runtime-cYx62DOd.js");
|
|
152687
152687
|
return slashDispatchRuntimePromise;
|
|
152688
152688
|
}
|
|
152689
152689
|
function loadSlashSkillCommandsRuntime() {
|
|
152690
|
-
slashSkillCommandsRuntimePromise ??= import("./slash-skill-commands.runtime-
|
|
152690
|
+
slashSkillCommandsRuntimePromise ??= import("./slash-skill-commands.runtime-ThOxhaze.js");
|
|
152691
152691
|
return slashSkillCommandsRuntimePromise;
|
|
152692
152692
|
}
|
|
152693
152693
|
const slackExternalArgMenuStore = createSlackExternalArgMenuStore();
|
|
@@ -153698,7 +153698,7 @@ function collectTelegramUnmentionedGroupIds(groups) {
|
|
|
153698
153698
|
}
|
|
153699
153699
|
let auditMembershipRuntimePromise = null;
|
|
153700
153700
|
function loadAuditMembershipRuntime() {
|
|
153701
|
-
auditMembershipRuntimePromise ??= import("./audit-membership-runtime-
|
|
153701
|
+
auditMembershipRuntimePromise ??= import("./audit-membership-runtime-0b4ZhE41.js");
|
|
153702
153702
|
return auditMembershipRuntimePromise;
|
|
153703
153703
|
}
|
|
153704
153704
|
async function auditTelegramGroupMembership(params) {
|
|
@@ -156307,7 +156307,7 @@ function getCacheStats() {
|
|
|
156307
156307
|
const STICKER_DESCRIPTION_PROMPT = "Describe this sticker image in 1-2 sentences. Focus on what the sticker depicts (character, object, action, emotion). Be concise and objective.";
|
|
156308
156308
|
let imageRuntimePromise = null;
|
|
156309
156309
|
function loadImageRuntime() {
|
|
156310
|
-
imageRuntimePromise ??= import("./image-runtime-
|
|
156310
|
+
imageRuntimePromise ??= import("./image-runtime-Dur8cmII.js");
|
|
156311
156311
|
return imageRuntimePromise;
|
|
156312
156312
|
}
|
|
156313
156313
|
/**
|
|
@@ -158039,7 +158039,7 @@ async function resolveTelegramInboundBody(params) {
|
|
|
158039
158039
|
const disableAudioPreflight = (topicConfig?.disableAudioPreflight ?? groupConfig?.disableAudioPreflight) === true;
|
|
158040
158040
|
let preflightTranscript;
|
|
158041
158041
|
if (isGroup && requireMention && hasAudio && !hasUserText && mentionRegexes.length > 0 && !disableAudioPreflight) try {
|
|
158042
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
158042
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-BQoP-O-0.js");
|
|
158043
158043
|
preflightTranscript = await transcribeFirstAudio({
|
|
158044
158044
|
ctx: {
|
|
158045
158045
|
MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
|
|
@@ -164834,7 +164834,7 @@ async function downloadLineMedia(messageId, channelAccessToken, maxBytes = 10 *
|
|
|
164834
164834
|
prefix: "line-media",
|
|
164835
164835
|
extension: getExtensionForContentType(contentType)
|
|
164836
164836
|
});
|
|
164837
|
-
await
|
|
164837
|
+
await fs$1.promises.writeFile(filePath, buffer);
|
|
164838
164838
|
logVerbose(`line: downloaded media ${messageId} to ${filePath} (${buffer.length} bytes)`);
|
|
164839
164839
|
return {
|
|
164840
164840
|
path: filePath,
|
|
@@ -166161,7 +166161,7 @@ function createWhatsAppLoginTool() {
|
|
|
166161
166161
|
force: Type.Optional(Type.Boolean())
|
|
166162
166162
|
}),
|
|
166163
166163
|
execute: async (_toolCallId, args) => {
|
|
166164
|
-
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-
|
|
166164
|
+
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-D-_3HfJq.js");
|
|
166165
166165
|
if ((args?.action ?? "start") === "wait") {
|
|
166166
166166
|
const result = await waitForWebLogin({ timeoutMs: typeof args.timeoutMs === "number" ? args.timeoutMs : void 0 });
|
|
166167
166167
|
return {
|
|
@@ -166235,23 +166235,23 @@ let webOutboundPromise = null;
|
|
|
166235
166235
|
let webLoginPromise = null;
|
|
166236
166236
|
let whatsappActionsPromise = null;
|
|
166237
166237
|
function loadWebOutbound() {
|
|
166238
|
-
webOutboundPromise ??= import("./runtime-whatsapp-outbound.runtime-
|
|
166238
|
+
webOutboundPromise ??= import("./runtime-whatsapp-outbound.runtime-IeVUgrJu.js");
|
|
166239
166239
|
return webOutboundPromise;
|
|
166240
166240
|
}
|
|
166241
166241
|
function loadWebLogin() {
|
|
166242
|
-
webLoginPromise ??= import("./runtime-whatsapp-login.runtime-
|
|
166242
|
+
webLoginPromise ??= import("./runtime-whatsapp-login.runtime-CO-iUlqS.js");
|
|
166243
166243
|
return webLoginPromise;
|
|
166244
166244
|
}
|
|
166245
166245
|
function loadWebLoginQr() {
|
|
166246
|
-
webLoginQrPromise ??= import("./login-qr-
|
|
166246
|
+
webLoginQrPromise ??= import("./login-qr-D-_3HfJq.js");
|
|
166247
166247
|
return webLoginQrPromise;
|
|
166248
166248
|
}
|
|
166249
166249
|
function loadWebChannel() {
|
|
166250
|
-
webChannelPromise ??= import("./web-
|
|
166250
|
+
webChannelPromise ??= import("./web-bHB4SzXZ.js");
|
|
166251
166251
|
return webChannelPromise;
|
|
166252
166252
|
}
|
|
166253
166253
|
function loadWhatsAppActions() {
|
|
166254
|
-
whatsappActionsPromise ??= import("./whatsapp-actions-
|
|
166254
|
+
whatsappActionsPromise ??= import("./whatsapp-actions-BqFiZbuw.js");
|
|
166255
166255
|
return whatsappActionsPromise;
|
|
166256
166256
|
}
|
|
166257
166257
|
function createRuntimeWhatsApp() {
|
|
@@ -167295,7 +167295,7 @@ async function withMemoryManagerForAgent(params) {
|
|
|
167295
167295
|
}
|
|
167296
167296
|
async function checkReadableFile(pathname) {
|
|
167297
167297
|
try {
|
|
167298
|
-
await fs.access(pathname,
|
|
167298
|
+
await fs.access(pathname, fs$1.constants.R_OK);
|
|
167299
167299
|
return { exists: true };
|
|
167300
167300
|
} catch (err) {
|
|
167301
167301
|
const code = err.code;
|
|
@@ -167354,7 +167354,7 @@ async function scanMemoryFiles(workspaceDir, extraPaths = []) {
|
|
|
167354
167354
|
}
|
|
167355
167355
|
let dirReadable = null;
|
|
167356
167356
|
try {
|
|
167357
|
-
await fs.access(memoryDir,
|
|
167357
|
+
await fs.access(memoryDir, fs$1.constants.R_OK);
|
|
167358
167358
|
dirReadable = true;
|
|
167359
167359
|
} catch (err) {
|
|
167360
167360
|
const code = err.code;
|
|
@@ -167846,7 +167846,7 @@ const resolvePluginSdkAliasFile = (params) => {
|
|
|
167846
167846
|
srcFile: params.srcFile,
|
|
167847
167847
|
distFile: params.distFile,
|
|
167848
167848
|
modulePath
|
|
167849
|
-
})) if (
|
|
167849
|
+
})) if (fs$1.existsSync(candidate)) return candidate;
|
|
167850
167850
|
} catch {}
|
|
167851
167851
|
return null;
|
|
167852
167852
|
};
|
|
@@ -167862,7 +167862,7 @@ function listPluginSdkExportedSubpaths(params = {}) {
|
|
|
167862
167862
|
const cached = cachedPluginSdkExportedSubpaths.get(packageRoot);
|
|
167863
167863
|
if (cached) return cached;
|
|
167864
167864
|
try {
|
|
167865
|
-
const pkgRaw =
|
|
167865
|
+
const pkgRaw = fs$1.readFileSync(path.join(packageRoot, "package.json"), "utf-8");
|
|
167866
167866
|
const pkg = JSON.parse(pkgRaw);
|
|
167867
167867
|
const subpaths = Object.keys(pkg.exports ?? {}).filter((key) => key.startsWith("./plugin-sdk/")).map((key) => key.slice(13)).filter((subpath) => Boolean(subpath) && !subpath.includes("/")).toSorted();
|
|
167868
167868
|
cachedPluginSdkExportedSubpaths.set(packageRoot, subpaths);
|
|
@@ -168336,7 +168336,7 @@ function loadOpenClawPlugins(options = {}) {
|
|
|
168336
168336
|
continue;
|
|
168337
168337
|
}
|
|
168338
168338
|
const safeSource = opened.path;
|
|
168339
|
-
|
|
168339
|
+
fs$1.closeSync(opened.fd);
|
|
168340
168340
|
let mod = null;
|
|
168341
168341
|
try {
|
|
168342
168342
|
mod = getJiti()(safeSource);
|
|
@@ -168454,7 +168454,7 @@ function loadOpenClawPlugins(options = {}) {
|
|
|
168454
168454
|
}
|
|
168455
168455
|
function safeRealpathOrResolve(value) {
|
|
168456
168456
|
try {
|
|
168457
|
-
return
|
|
168457
|
+
return fs$1.realpathSync(value);
|
|
168458
168458
|
} catch {
|
|
168459
168459
|
return path.resolve(value);
|
|
168460
168460
|
}
|