@vibe-lark/larkpal 0.1.86 → 0.1.87
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/account-id-BM1T6029-BzQ_cMoi.mjs +1 -0
- package/dist/activation-context--5yu1dPF-XV0Y0pTy.mjs +1 -0
- package/dist/anthropic-CFZUCb1w.mjs +39 -0
- package/dist/assistant-visible-text-DuFWokAt-BOJV_zwc.mjs +9 -0
- package/dist/azure-openai-responses-BEuiMaF-.mjs +1 -0
- package/dist/boundary-file-read-BSd9MXPy-gnNVhPKT.mjs +1 -0
- package/dist/browser-lifecycle-cleanup-BdNsMhMD-BM97qA_M.mjs +1 -0
- package/dist/build-Bkj0hOS2.mjs +3 -0
- package/dist/bundled-compat-BpaDaAAu-DJtrIX6i.mjs +27 -0
- package/dist/bundled-dir-U738ay4K-BxbzrJOo.mjs +1 -0
- package/dist/call-DimWbpgJ-B4pv55RH.mjs +20 -0
- package/dist/channel-bootstrap.runtime-BVclcGv1-CEZ0-JP9.mjs +1 -0
- package/dist/channel-bootstrap.runtime-Cwcr38m2-Dt6QlQkX.mjs +1 -0
- package/dist/chunk-DHbaKqs-.mjs +1 -0
- package/dist/cli.mjs +7 -92
- package/dist/command-format-LSnUCVVF-Dn4h9IOh.mjs +16 -0
- package/dist/config-Bim2pi8a-03N-28sw.mjs +1 -0
- package/dist/delivery-context.shared-j5hC5qb1-BSLQG47q.mjs +1 -0
- package/dist/diagnostic-ClMwNnUA-BMKvPQJT.mjs +1 -0
- package/dist/dist-J5UB83Ws.mjs +601 -0
- package/dist/dist-coestTs9.mjs +5 -0
- package/dist/env-api-keys-Cuz5irWW.mjs +1 -0
- package/dist/event-stream-B7Ei41Bu.mjs +1 -0
- package/dist/facade-loader-DFzIYYt_-4bzFvy-b.mjs +1 -0
- package/dist/from-Ba69_5cR.mjs +14 -0
- package/dist/gateway-method-policy-C7rf0SeV-CTJcMQCE.mjs +1 -0
- package/dist/github-copilot-headers-BfhryVuU.mjs +1 -0
- package/dist/google-ABo-1guT.mjs +1 -0
- package/dist/google-gemini-cli-CGlN1zUA.mjs +2 -0
- package/dist/google-shared-C60sNhwd.mjs +301 -0
- package/dist/google-vertex-De0nAItu.mjs +1 -0
- package/dist/hash-Dw-N8Y9l.mjs +1 -0
- package/dist/headers-Bpsp70B9.mjs +1 -0
- package/dist/home-dir-C44RaPME-B5iLWwCq.mjs +1 -0
- package/dist/ids-BPsM98Uu-CJBJAeVC.mjs +1 -0
- package/dist/image-2w3cApg7-CrpUMCvm.mjs +3 -0
- package/dist/interactive-init-C5MFL5MW.mjs +8 -0
- package/dist/io-CH2g3vsv-JJtUIa_U.mjs +10 -0
- package/dist/jiti-loader-cache-Bat69wam-DNIteTtO.mjs +9 -0
- package/dist/json-file-BQRNuxmK-hRjIgOXI.mjs +1 -0
- package/dist/json-parse-BESd8UAM.mjs +3 -0
- package/dist/jws-YaZ38F_i.mjs +12 -0
- package/dist/lark-cli-provider-BLMxH6CN.mjs +4 -0
- package/dist/lark-logger-xpMKNNtY.mjs +1 -0
- package/dist/live-smoke-DpURW676.mjs +33 -0
- package/dist/load-context-mb7uvLSn-3xYwSnOZ.mjs +1 -0
- package/dist/loader-708jrx4Y-BbJRXNlQ.mjs +4 -0
- package/dist/main.mjs +153 -74571
- package/dist/manifest-registry-_hxKCS2K-OL8KK_o4.mjs +15 -0
- package/dist/mcp-server.mjs +4 -527
- package/dist/message-channel-Bk_YHfQg-n2Hw2Y0L.mjs +1 -0
- package/dist/message-channel-core-DTA--Gjh-CIh10vfo.mjs +1 -0
- package/dist/message.config.runtime-K-k4XOyq-F_h0Cgkl.mjs +1 -0
- package/dist/message.gateway.runtime-DqHOHRTQ-ge4c5p4s.mjs +1 -0
- package/dist/mistral-DyL3Zo1b.mjs +7 -0
- package/dist/model-auth-env-oyg2Hexc-DJbt9J3o.mjs +1 -0
- package/dist/models-config-BmpSQJQF-BL6S5qAo.mjs +1 -0
- package/dist/models-config.runtime-SOhLEw-f.mjs +1 -0
- package/dist/multipart-parser-B9dwXBqu.mjs +2 -0
- package/dist/oauth-25y2wc7K.mjs +75 -0
- package/dist/openai-C-rgGb7X.mjs +16 -0
- package/dist/openai-codex-responses-BbyAPsP1.mjs +7 -0
- package/dist/openai-completions-Bu5qvQzb.mjs +5 -0
- package/dist/openai-responses-pIdwQBc4.mjs +1 -0
- package/dist/openai-responses-shared-DqW1JSux.mjs +10 -0
- package/dist/paths-D6msg0S1-BO4XgM1u.mjs +1 -0
- package/dist/paths-D92DjaZ--DdtJ-zYp.mjs +1 -0
- package/dist/pi-model-discovery-Bd0TWzo8-DvSM0eWu.mjs +1 -0
- package/dist/pi-model-discovery-runtime-PrjWOmsV.mjs +1 -0
- package/dist/pi-tools.before-tool-call.runtime-Bn7uqKie-WPxU5oNX.mjs +2 -0
- package/dist/plugin-auto-enable-DdH3n9V8-Dr_bUXkG.mjs +1 -0
- package/dist/process-scoped-map-B2cWkYET-Co-i-MXA.mjs +1 -0
- package/dist/provider-discovery.runtime-DY0VWQ81.mjs +1 -0
- package/dist/provider-model-compat-CFqcq0it-BUwZENrz.mjs +1 -0
- package/dist/provider-runtime-C8rljsNs-BDvu6FW3.mjs +1 -0
- package/dist/provider-runtime-CT50mNIX-DImw7ZZu.mjs +79 -0
- package/dist/provider-stream-COLujAAo-Dpq1DSIk.mjs +248 -0
- package/dist/providers.runtime-Ba7tOlq7-B4t6ywCr.mjs +1 -0
- package/dist/public-surface-loader-BVl0NQAE-TfJ3izj1.mjs +1 -0
- package/dist/resolve-C33B7eeu-DZM_z6Wr.mjs +1 -0
- package/dist/runtime-Cym-fqI8-1GOIuRRQ.mjs +1 -0
- package/dist/runtime-channel-state-CohMybAh-BBzhl07Q.mjs +1 -0
- package/dist/runtime-snapshot-C54O1-gI-DxusscPf.mjs +1 -0
- package/dist/runtime-state-IBOIXKOx-Cw1GA1td.mjs +1 -0
- package/dist/runtime-web-tools-fallback.runtime-Ca-qn1mj-BsYE2gOd.mjs +1 -0
- package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-P6MKP9gQ.mjs +1 -0
- package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-5VoyjouO.mjs +1 -0
- package/dist/session-archive.runtime-B52_5vs4-cU2tYbBz.mjs +1 -0
- package/dist/session-key-Cn2QoOyX-QZeYmbxd.mjs +1 -0
- package/dist/session-transcript-files.fs-DEeFXruQ-CXIAFSsr.mjs +1 -0
- package/dist/src-CCDx_C-U.mjs +3 -0
- package/dist/src-DACmA9V6.mjs +5 -0
- package/dist/subagent-announce-L5WsQatW--rMn240x.mjs +2 -0
- package/dist/subagent-announce.registry.runtime-DiqZyeTs-DNfNHsls.mjs +1 -0
- package/dist/subagent-registry-steer-runtime-DFgZFC0j-XYS1_qwl.mjs +1 -0
- package/dist/subagent-system-prompt-C1qnN--K-CsU4f97T.mjs +23 -0
- package/dist/target-parsing-loaded-DKkb6jJY-B830OA1a.mjs +12 -0
- package/dist/task-registry-delivery-runtime-Dd1CUkZF-B2Hj2k8C.mjs +16 -0
- package/dist/task-registry-delivery-runtime-ragbeVx5-Bdvo2Q5u.mjs +1 -0
- package/dist/thinking-Bh-7MqXz-uApNUe6g.mjs +1 -0
- package/dist/transcript-E_-ISOkD-VTwb782D.mjs +5 -0
- package/dist/transcript.runtime-BqhvZZdl-B4E0TiX5.mjs +1 -0
- package/dist/transform-messages-BTA3xbAI.mjs +1 -0
- package/dist/web-provider-public-artifacts-BlpRwIUS-DbVhDOrY.mjs +1 -0
- package/dist/web-search-providers.runtime--0aUtC3b-Bjh4Bmrz.mjs +1 -0
- package/package.json +2 -3
- package/dist/account-id-BM1T6029-DYjVxojW.mjs +0 -46
- package/dist/activation-context--5yu1dPF-Bwsn3moT.mjs +0 -172
- package/dist/anthropic-TH8ERTXK.mjs +0 -5962
- package/dist/assistant-visible-text-DuFWokAt-CsbII5KS.mjs +0 -596
- package/dist/azure-openai-responses-Bt_Ag9Er.mjs +0 -166
- package/dist/boundary-file-read-BSd9MXPy--KThL5e6.mjs +0 -594
- package/dist/browser-lifecycle-cleanup-BdNsMhMD-O3tnAM4i.mjs +0 -60
- package/dist/build-DgTrEpge.mjs +0 -3333
- package/dist/bundled-compat-BpaDaAAu-D7oazKjD.mjs +0 -5216
- package/dist/bundled-dir-U738ay4K-DXK0q_TV.mjs +0 -258
- package/dist/call-DimWbpgJ-ColD4W-y.mjs +0 -9993
- package/dist/channel-bootstrap.runtime-BVclcGv1-DJv_Z-Kr.mjs +0 -2
- package/dist/channel-bootstrap.runtime-Cwcr38m2-VRfVCR-i.mjs +0 -33
- package/dist/chunk-D6SyT4dJ.mjs +0 -36
- package/dist/command-format-LSnUCVVF-BQ2SMKka.mjs +0 -685
- package/dist/config-Bim2pi8a-BQUdfiEi.mjs +0 -9
- package/dist/delivery-context.shared-j5hC5qb1-CI83RXXZ.mjs +0 -72
- package/dist/diagnostic-ClMwNnUA-D6nUtLnb.mjs +0 -140
- package/dist/dist-CEGw8-2W.mjs +0 -429
- package/dist/dist-DD2aJ2UL.mjs +0 -125135
- package/dist/env-api-keys-BVvSg7T2.mjs +0 -68
- package/dist/event-stream-xaQWmyas.mjs +0 -15226
- package/dist/facade-loader-DFzIYYt_-CIr4HKtE.mjs +0 -194
- package/dist/from-DF7cl2wz.mjs +0 -3842
- package/dist/gateway-method-policy-C7rf0SeV-CJQMEYIE.mjs +0 -28
- package/dist/github-copilot-headers-DjqWtUoP.mjs +0 -22
- package/dist/google-C2pVrgBZ.mjs +0 -336
- package/dist/google-gemini-cli-BBxgS5Ho.mjs +0 -623
- package/dist/google-shared-BsWgwEk1.mjs +0 -22791
- package/dist/google-vertex-BsVLJrrC.mjs +0 -358
- package/dist/hash-DAFtW_W7.mjs +0 -16
- package/dist/headers-R3HdCbAE.mjs +0 -8
- package/dist/home-dir-C44RaPME-CBRS4HLP.mjs +0 -93
- package/dist/ids-BPsM98Uu-CwuxvUai.mjs +0 -77
- package/dist/image-2w3cApg7-CxpHvoB5.mjs +0 -207
- package/dist/interactive-init-BXQBalNr.mjs +0 -450
- package/dist/io-CH2g3vsv-BOGlLlB8.mjs +0 -26218
- package/dist/jiti-loader-cache-Bat69wam-D6hCxboy.mjs +0 -5049
- package/dist/json-file-BQRNuxmK-DhJM5NsG.mjs +0 -108
- package/dist/json-parse-v_HIJjjI.mjs +0 -381
- package/dist/jws-GFcTvvVT.mjs +0 -2291
- package/dist/lark-cli-provider-BARgbbmo.mjs +0 -554
- package/dist/lark-logger-D7_pEVQc.mjs +0 -143
- package/dist/live-smoke-BhkBOcH9.mjs +0 -7135
- package/dist/load-context-mb7uvLSn-B10MAi3I.mjs +0 -29
- package/dist/loader-708jrx4Y-BOswuvpe.mjs +0 -5053
- package/dist/manifest-registry-_hxKCS2K-CZdeyN0f.mjs +0 -3512
- package/dist/message-channel-Bk_YHfQg-AeNrPPpp.mjs +0 -50
- package/dist/message-channel-core-DTA--Gjh-CY4Tkb7N.mjs +0 -29
- package/dist/message.config.runtime-K-k4XOyq-DZTmXomP.mjs +0 -2
- package/dist/message.gateway.runtime-DqHOHRTQ-DH4ml0YF.mjs +0 -2
- package/dist/mistral-CaR4DiLu.mjs +0 -28657
- package/dist/model-auth-env-oyg2Hexc-DU_rOUU5.mjs +0 -1306
- package/dist/models-config-BmpSQJQF-Gfvh1n3A.mjs +0 -1282
- package/dist/models-config.runtime-BsU_22xk.mjs +0 -2
- package/dist/multipart-parser-DedmaB5g.mjs +0 -294
- package/dist/oauth-DOJeGfcE.mjs +0 -6392
- package/dist/openai-BDtIh3Ja.mjs +0 -6693
- package/dist/openai-codex-responses-C5EORu31.mjs +0 -664
- package/dist/openai-completions-CR_cS6gX.mjs +0 -669
- package/dist/openai-responses-oGxwZyuC.mjs +0 -184
- package/dist/openai-responses-shared-BixMSDZE.mjs +0 -398
- package/dist/paths-D6msg0S1-C2lYuisN.mjs +0 -189
- package/dist/paths-D92DjaZ--CTOESW2b.mjs +0 -192
- package/dist/pi-model-discovery-Bd0TWzo8-BFsJmeMb.mjs +0 -227
- package/dist/pi-model-discovery-runtime-CCCZxkd8.mjs +0 -2
- package/dist/pi-tools.before-tool-call.runtime-Bn7uqKie-C5ewk8kK.mjs +0 -399
- package/dist/plugin-auto-enable-DdH3n9V8-DsA1isaF.mjs +0 -1456
- package/dist/process-scoped-map-B2cWkYET-CXwUZ8CZ.mjs +0 -61
- package/dist/provider-discovery.runtime-BPzz1PFj.mjs +0 -58
- package/dist/provider-model-compat-CFqcq0it-BDDuBI3A.mjs +0 -118
- package/dist/provider-runtime-C8rljsNs-CIT93zoy.mjs +0 -2
- package/dist/provider-runtime-CT50mNIX-BwEV6GyO.mjs +0 -573
- package/dist/provider-stream-COLujAAo-CbJPDngm.mjs +0 -35449
- package/dist/providers.runtime-Ba7tOlq7-CXkhkzU9.mjs +0 -219
- package/dist/public-surface-loader-BVl0NQAE-C0piXtsT.mjs +0 -117
- package/dist/resolve-C33B7eeu-BNvYTl6k.mjs +0 -1041
- package/dist/runtime-Cym-fqI8-DaSDMH-a.mjs +0 -120
- package/dist/runtime-channel-state-CohMybAh-hXR6y5Gx.mjs +0 -19
- package/dist/runtime-snapshot-C54O1-gI-40cbyi7P.mjs +0 -677
- package/dist/runtime-state-IBOIXKOx-Bf9tcLvc.mjs +0 -10
- package/dist/runtime-web-tools-fallback.runtime-Ca-qn1mj-BCVImm7a.mjs +0 -39
- package/dist/runtime-web-tools-manifest.runtime-BgxQTjmq-Cb4nJkRT.mjs +0 -2
- package/dist/runtime-web-tools-public-artifacts.runtime-D9qcoWIX-BrQdXzOQ.mjs +0 -2
- package/dist/session-archive.runtime-B52_5vs4-BG-_IwNJ.mjs +0 -2
- package/dist/session-key-Cn2QoOyX-CuHbJMgR.mjs +0 -82
- package/dist/session-transcript-files.fs-DEeFXruQ-B1PF6nLy.mjs +0 -147
- package/dist/src-BgCX0MLG.mjs +0 -813
- package/dist/src-DYbqlAqf.mjs +0 -1177
- package/dist/subagent-announce-L5WsQatW-CQWI9GMd.mjs +0 -344
- package/dist/subagent-announce.registry.runtime-DiqZyeTs-BKuniyi3.mjs +0 -28
- package/dist/subagent-registry-steer-runtime-DFgZFC0j-BhBz0roy.mjs +0 -211
- package/dist/subagent-system-prompt-C1qnN--K-DpnTFP47.mjs +0 -3061
- package/dist/target-parsing-loaded-DKkb6jJY-BMD4CkpS.mjs +0 -1002
- package/dist/task-registry-delivery-runtime-Dd1CUkZF-C8U40a3O.mjs +0 -2950
- package/dist/task-registry-delivery-runtime-ragbeVx5-CNbFAkjD.mjs +0 -2
- package/dist/thinking-Bh-7MqXz-D3woGbO7.mjs +0 -2
- package/dist/transcript-E_-ISOkD-DWCfZP2p.mjs +0 -2019
- package/dist/transcript.runtime-BqhvZZdl-BPy42vBP.mjs +0 -2
- package/dist/transform-messages-DbhIzTxq.mjs +0 -207
- package/dist/web-provider-public-artifacts-BlpRwIUS-CGPSV4W2.mjs +0 -295
- package/dist/web-search-providers.runtime--0aUtC3b-DyuhC95V.mjs +0 -200
|
@@ -1,594 +0,0 @@
|
|
|
1
|
-
import { o as normalizeLowercaseStringOrEmpty } from "./home-dir-C44RaPME-CBRS4HLP.mjs";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import "node:fs/promises";
|
|
5
|
-
import os from "node:os";
|
|
6
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/boundary-path-BSBSMt0u.js
|
|
7
|
-
const NOT_FOUND_CODES = new Set(["ENOENT", "ENOTDIR"]);
|
|
8
|
-
const SYMLINK_OPEN_CODES = new Set([
|
|
9
|
-
"ELOOP",
|
|
10
|
-
"EINVAL",
|
|
11
|
-
"ENOTSUP"
|
|
12
|
-
]);
|
|
13
|
-
const PARENT_SEGMENT_PREFIX = /^\.\.(?:[\\/]|$)/u;
|
|
14
|
-
function normalizeWindowsPathForComparison(input) {
|
|
15
|
-
let normalized = path.win32.normalize(input);
|
|
16
|
-
if (normalized.startsWith("\\\\?\\")) {
|
|
17
|
-
normalized = normalized.slice(4);
|
|
18
|
-
if (normalized.toUpperCase().startsWith("UNC\\")) normalized = `\\\\${normalized.slice(4)}`;
|
|
19
|
-
}
|
|
20
|
-
return normalizeLowercaseStringOrEmpty(normalized.replaceAll("/", "\\"));
|
|
21
|
-
}
|
|
22
|
-
function isNodeError(value) {
|
|
23
|
-
return Boolean(value && typeof value === "object" && "code" in value);
|
|
24
|
-
}
|
|
25
|
-
function hasNodeErrorCode(value, code) {
|
|
26
|
-
return isNodeError(value) && value.code === code;
|
|
27
|
-
}
|
|
28
|
-
function isNotFoundPathError(value) {
|
|
29
|
-
return isNodeError(value) && typeof value.code === "string" && NOT_FOUND_CODES.has(value.code);
|
|
30
|
-
}
|
|
31
|
-
function isSymlinkOpenError(value) {
|
|
32
|
-
return isNodeError(value) && typeof value.code === "string" && SYMLINK_OPEN_CODES.has(value.code);
|
|
33
|
-
}
|
|
34
|
-
function isPathInside(root, target) {
|
|
35
|
-
if (process.platform === "win32") {
|
|
36
|
-
const rootForCompare = normalizeWindowsPathForComparison(path.win32.resolve(root));
|
|
37
|
-
const targetForCompare = normalizeWindowsPathForComparison(path.win32.resolve(target));
|
|
38
|
-
const relative = path.win32.relative(rootForCompare, targetForCompare);
|
|
39
|
-
return relative === "" || !PARENT_SEGMENT_PREFIX.test(relative) && !path.win32.isAbsolute(relative);
|
|
40
|
-
}
|
|
41
|
-
const resolvedRoot = path.resolve(root);
|
|
42
|
-
const resolvedTarget = path.resolve(target);
|
|
43
|
-
const relative = path.relative(resolvedRoot, resolvedTarget);
|
|
44
|
-
return relative === "" || !PARENT_SEGMENT_PREFIX.test(relative) && !path.isAbsolute(relative);
|
|
45
|
-
}
|
|
46
|
-
Object.freeze({
|
|
47
|
-
allowFinalSymlinkForUnlink: false,
|
|
48
|
-
allowFinalHardlinkForUnlink: false
|
|
49
|
-
}), Object.freeze({
|
|
50
|
-
allowFinalSymlinkForUnlink: true,
|
|
51
|
-
allowFinalHardlinkForUnlink: true
|
|
52
|
-
});
|
|
53
|
-
function resolveBoundaryPathSync(params) {
|
|
54
|
-
const rootPath = path.resolve(params.rootPath);
|
|
55
|
-
const absolutePath = path.resolve(params.absolutePath);
|
|
56
|
-
const context = createBoundaryResolutionContext({
|
|
57
|
-
resolveParams: params,
|
|
58
|
-
rootPath,
|
|
59
|
-
absolutePath,
|
|
60
|
-
rootCanonicalPath: params.rootCanonicalPath ? path.resolve(params.rootCanonicalPath) : resolvePathViaExistingAncestorSync(rootPath),
|
|
61
|
-
outsideLexicalCanonicalPath: resolveOutsideLexicalCanonicalPathSync({
|
|
62
|
-
rootPath,
|
|
63
|
-
absolutePath
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
const outsideResult = resolveOutsideBoundaryPathSync({
|
|
67
|
-
boundaryLabel: params.boundaryLabel,
|
|
68
|
-
context
|
|
69
|
-
});
|
|
70
|
-
if (outsideResult) return outsideResult;
|
|
71
|
-
return resolveBoundaryPathLexicalSync({
|
|
72
|
-
params,
|
|
73
|
-
absolutePath: context.absolutePath,
|
|
74
|
-
rootPath: context.rootPath,
|
|
75
|
-
rootCanonicalPath: context.rootCanonicalPath
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function isPromiseLike(value) {
|
|
79
|
-
return Boolean(value && (typeof value === "object" || typeof value === "function") && "then" in value && typeof value.then === "function");
|
|
80
|
-
}
|
|
81
|
-
function createLexicalTraversalState(params) {
|
|
82
|
-
return {
|
|
83
|
-
segments: path.relative(params.rootPath, params.absolutePath).split(path.sep).filter(Boolean),
|
|
84
|
-
allowFinalSymlink: params.params.policy?.allowFinalSymlinkForUnlink === true,
|
|
85
|
-
canonicalCursor: params.rootCanonicalPath,
|
|
86
|
-
lexicalCursor: params.rootPath,
|
|
87
|
-
preserveFinalSymlink: false
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function assertLexicalCursorInsideBoundary(params) {
|
|
91
|
-
assertInsideBoundary({
|
|
92
|
-
boundaryLabel: params.params.boundaryLabel,
|
|
93
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
94
|
-
candidatePath: params.candidatePath,
|
|
95
|
-
absolutePath: params.absolutePath
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function applyMissingSuffixToCanonicalCursor(params) {
|
|
99
|
-
const missingSuffix = params.state.segments.slice(params.missingFromIndex);
|
|
100
|
-
params.state.canonicalCursor = path.resolve(params.state.canonicalCursor, ...missingSuffix);
|
|
101
|
-
assertLexicalCursorInsideBoundary({
|
|
102
|
-
params: params.params,
|
|
103
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
104
|
-
candidatePath: params.state.canonicalCursor,
|
|
105
|
-
absolutePath: params.absolutePath
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function advanceCanonicalCursorForSegment(params) {
|
|
109
|
-
params.state.canonicalCursor = path.resolve(params.state.canonicalCursor, params.segment);
|
|
110
|
-
assertLexicalCursorInsideBoundary({
|
|
111
|
-
params: params.params,
|
|
112
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
113
|
-
candidatePath: params.state.canonicalCursor,
|
|
114
|
-
absolutePath: params.absolutePath
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function finalizeLexicalResolution(params) {
|
|
118
|
-
assertLexicalCursorInsideBoundary({
|
|
119
|
-
params: params.params,
|
|
120
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
121
|
-
candidatePath: params.state.canonicalCursor,
|
|
122
|
-
absolutePath: params.absolutePath
|
|
123
|
-
});
|
|
124
|
-
return buildResolvedBoundaryPath({
|
|
125
|
-
absolutePath: params.absolutePath,
|
|
126
|
-
canonicalPath: params.state.canonicalCursor,
|
|
127
|
-
rootPath: params.rootPath,
|
|
128
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
129
|
-
kind: params.kind
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function handleLexicalLstatFailure(params) {
|
|
133
|
-
if (!isNotFoundPathError(params.error)) return false;
|
|
134
|
-
applyMissingSuffixToCanonicalCursor({
|
|
135
|
-
state: params.state,
|
|
136
|
-
missingFromIndex: params.missingFromIndex,
|
|
137
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
138
|
-
params: params.resolveParams,
|
|
139
|
-
absolutePath: params.absolutePath
|
|
140
|
-
});
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
function handleLexicalStatReadFailure(params) {
|
|
144
|
-
if (handleLexicalLstatFailure({
|
|
145
|
-
error: params.error,
|
|
146
|
-
state: params.state,
|
|
147
|
-
missingFromIndex: params.missingFromIndex,
|
|
148
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
149
|
-
resolveParams: params.resolveParams,
|
|
150
|
-
absolutePath: params.absolutePath
|
|
151
|
-
})) return null;
|
|
152
|
-
throw params.error;
|
|
153
|
-
}
|
|
154
|
-
function handleLexicalStatDisposition(params) {
|
|
155
|
-
if (!params.isSymbolicLink) {
|
|
156
|
-
advanceCanonicalCursorForSegment({
|
|
157
|
-
state: params.state,
|
|
158
|
-
segment: params.segment,
|
|
159
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
160
|
-
params: params.resolveParams,
|
|
161
|
-
absolutePath: params.absolutePath
|
|
162
|
-
});
|
|
163
|
-
return "continue";
|
|
164
|
-
}
|
|
165
|
-
if (params.state.allowFinalSymlink && params.isLast) {
|
|
166
|
-
params.state.preserveFinalSymlink = true;
|
|
167
|
-
advanceCanonicalCursorForSegment({
|
|
168
|
-
state: params.state,
|
|
169
|
-
segment: params.segment,
|
|
170
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
171
|
-
params: params.resolveParams,
|
|
172
|
-
absolutePath: params.absolutePath
|
|
173
|
-
});
|
|
174
|
-
return "break";
|
|
175
|
-
}
|
|
176
|
-
return "resolve-link";
|
|
177
|
-
}
|
|
178
|
-
function applyResolvedSymlinkHop(params) {
|
|
179
|
-
if (!isPathInside(params.rootCanonicalPath, params.linkCanonical)) throw symlinkEscapeError({
|
|
180
|
-
boundaryLabel: params.boundaryLabel,
|
|
181
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
182
|
-
symlinkPath: params.state.lexicalCursor
|
|
183
|
-
});
|
|
184
|
-
params.state.canonicalCursor = params.linkCanonical;
|
|
185
|
-
params.state.lexicalCursor = params.linkCanonical;
|
|
186
|
-
}
|
|
187
|
-
function readLexicalStat(params) {
|
|
188
|
-
try {
|
|
189
|
-
const stat = params.read(params.state.lexicalCursor);
|
|
190
|
-
if (isPromiseLike(stat)) return Promise.resolve(stat).catch((error) => handleLexicalStatReadFailure({
|
|
191
|
-
...params,
|
|
192
|
-
error
|
|
193
|
-
}));
|
|
194
|
-
return stat;
|
|
195
|
-
} catch (error) {
|
|
196
|
-
return handleLexicalStatReadFailure({
|
|
197
|
-
...params,
|
|
198
|
-
error
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function resolveAndApplySymlinkHop(params) {
|
|
203
|
-
const linkCanonical = params.resolveLinkCanonical(params.state.lexicalCursor);
|
|
204
|
-
if (isPromiseLike(linkCanonical)) return Promise.resolve(linkCanonical).then((value) => applyResolvedSymlinkHop({
|
|
205
|
-
state: params.state,
|
|
206
|
-
linkCanonical: value,
|
|
207
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
208
|
-
boundaryLabel: params.boundaryLabel
|
|
209
|
-
}));
|
|
210
|
-
applyResolvedSymlinkHop({
|
|
211
|
-
state: params.state,
|
|
212
|
-
linkCanonical,
|
|
213
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
214
|
-
boundaryLabel: params.boundaryLabel
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function resolveBoundaryPathLexicalSync(params) {
|
|
218
|
-
const state = createLexicalTraversalState(params);
|
|
219
|
-
for (let idx = 0; idx < state.segments.length; idx += 1) {
|
|
220
|
-
const segment = state.segments[idx] ?? "";
|
|
221
|
-
const isLast = idx === state.segments.length - 1;
|
|
222
|
-
state.lexicalCursor = path.join(state.lexicalCursor, segment);
|
|
223
|
-
const maybeStat = readLexicalStat({
|
|
224
|
-
state,
|
|
225
|
-
missingFromIndex: idx,
|
|
226
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
227
|
-
resolveParams: params.params,
|
|
228
|
-
absolutePath: params.absolutePath,
|
|
229
|
-
read: (cursor) => fs.lstatSync(cursor)
|
|
230
|
-
});
|
|
231
|
-
if (isPromiseLike(maybeStat)) throw new Error("Unexpected async lexical stat");
|
|
232
|
-
const stat = maybeStat;
|
|
233
|
-
if (!stat) break;
|
|
234
|
-
const disposition = handleLexicalStatDisposition({
|
|
235
|
-
state,
|
|
236
|
-
isSymbolicLink: stat.isSymbolicLink(),
|
|
237
|
-
segment,
|
|
238
|
-
isLast,
|
|
239
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
240
|
-
resolveParams: params.params,
|
|
241
|
-
absolutePath: params.absolutePath
|
|
242
|
-
});
|
|
243
|
-
if (disposition === "continue") continue;
|
|
244
|
-
if (disposition === "break") break;
|
|
245
|
-
if (isPromiseLike(resolveAndApplySymlinkHop({
|
|
246
|
-
state,
|
|
247
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
248
|
-
boundaryLabel: params.params.boundaryLabel,
|
|
249
|
-
resolveLinkCanonical: (cursor) => resolveSymlinkHopPathSync(cursor)
|
|
250
|
-
}))) throw new Error("Unexpected async symlink resolution");
|
|
251
|
-
}
|
|
252
|
-
const kind = getPathKindSync(params.absolutePath, state.preserveFinalSymlink);
|
|
253
|
-
return finalizeLexicalResolution({
|
|
254
|
-
...params,
|
|
255
|
-
state,
|
|
256
|
-
kind
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function resolveCanonicalOutsideLexicalPath(params) {
|
|
260
|
-
return params.outsideLexicalCanonicalPath ?? params.absolutePath;
|
|
261
|
-
}
|
|
262
|
-
function createBoundaryResolutionContext(params) {
|
|
263
|
-
const lexicalInside = isPathInside(params.rootPath, params.absolutePath);
|
|
264
|
-
const canonicalOutsideLexicalPath = resolveCanonicalOutsideLexicalPath({
|
|
265
|
-
absolutePath: params.absolutePath,
|
|
266
|
-
outsideLexicalCanonicalPath: params.outsideLexicalCanonicalPath
|
|
267
|
-
});
|
|
268
|
-
assertLexicalBoundaryOrCanonicalAlias({
|
|
269
|
-
skipLexicalRootCheck: params.resolveParams.skipLexicalRootCheck,
|
|
270
|
-
lexicalInside,
|
|
271
|
-
canonicalOutsideLexicalPath,
|
|
272
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
273
|
-
boundaryLabel: params.resolveParams.boundaryLabel,
|
|
274
|
-
rootPath: params.rootPath,
|
|
275
|
-
absolutePath: params.absolutePath
|
|
276
|
-
});
|
|
277
|
-
return {
|
|
278
|
-
rootPath: params.rootPath,
|
|
279
|
-
absolutePath: params.absolutePath,
|
|
280
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
281
|
-
lexicalInside,
|
|
282
|
-
canonicalOutsideLexicalPath
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
function resolveOutsideBoundaryPathSync(params) {
|
|
286
|
-
if (params.context.lexicalInside) return null;
|
|
287
|
-
const kind = getPathKindSync(params.context.absolutePath, false);
|
|
288
|
-
return buildOutsideBoundaryPathFromContext({
|
|
289
|
-
boundaryLabel: params.boundaryLabel,
|
|
290
|
-
context: params.context,
|
|
291
|
-
kind
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
function buildOutsideBoundaryPathFromContext(params) {
|
|
295
|
-
return buildOutsideLexicalBoundaryPath({
|
|
296
|
-
boundaryLabel: params.boundaryLabel,
|
|
297
|
-
rootCanonicalPath: params.context.rootCanonicalPath,
|
|
298
|
-
absolutePath: params.context.absolutePath,
|
|
299
|
-
canonicalOutsideLexicalPath: params.context.canonicalOutsideLexicalPath,
|
|
300
|
-
rootPath: params.context.rootPath,
|
|
301
|
-
kind: params.kind
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
function resolveOutsideLexicalCanonicalPathSync(params) {
|
|
305
|
-
if (isPathInside(params.rootPath, params.absolutePath)) return;
|
|
306
|
-
return resolvePathViaExistingAncestorSync(params.absolutePath);
|
|
307
|
-
}
|
|
308
|
-
function buildOutsideLexicalBoundaryPath(params) {
|
|
309
|
-
assertInsideBoundary({
|
|
310
|
-
boundaryLabel: params.boundaryLabel,
|
|
311
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
312
|
-
candidatePath: params.canonicalOutsideLexicalPath,
|
|
313
|
-
absolutePath: params.absolutePath
|
|
314
|
-
});
|
|
315
|
-
return buildResolvedBoundaryPath({
|
|
316
|
-
absolutePath: params.absolutePath,
|
|
317
|
-
canonicalPath: params.canonicalOutsideLexicalPath,
|
|
318
|
-
rootPath: params.rootPath,
|
|
319
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
320
|
-
kind: params.kind
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function assertLexicalBoundaryOrCanonicalAlias(params) {
|
|
324
|
-
if (params.skipLexicalRootCheck || params.lexicalInside) return;
|
|
325
|
-
if (isPathInside(params.rootCanonicalPath, params.canonicalOutsideLexicalPath)) return;
|
|
326
|
-
throw pathEscapeError({
|
|
327
|
-
boundaryLabel: params.boundaryLabel,
|
|
328
|
-
rootPath: params.rootPath,
|
|
329
|
-
absolutePath: params.absolutePath
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
function buildResolvedBoundaryPath(params) {
|
|
333
|
-
return {
|
|
334
|
-
absolutePath: params.absolutePath,
|
|
335
|
-
canonicalPath: params.canonicalPath,
|
|
336
|
-
rootPath: params.rootPath,
|
|
337
|
-
rootCanonicalPath: params.rootCanonicalPath,
|
|
338
|
-
relativePath: relativeInsideRoot(params.rootCanonicalPath, params.canonicalPath),
|
|
339
|
-
exists: params.kind.exists,
|
|
340
|
-
kind: params.kind.kind
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
function resolvePathViaExistingAncestorSync(targetPath) {
|
|
344
|
-
const normalized = path.resolve(targetPath);
|
|
345
|
-
let cursor = normalized;
|
|
346
|
-
const missingSuffix = [];
|
|
347
|
-
while (!isFilesystemRoot(cursor) && !fs.existsSync(cursor)) {
|
|
348
|
-
missingSuffix.unshift(path.basename(cursor));
|
|
349
|
-
const parent = path.dirname(cursor);
|
|
350
|
-
if (parent === cursor) break;
|
|
351
|
-
cursor = parent;
|
|
352
|
-
}
|
|
353
|
-
if (!fs.existsSync(cursor)) return normalized;
|
|
354
|
-
try {
|
|
355
|
-
const resolvedAncestor = path.resolve(fs.realpathSync(cursor));
|
|
356
|
-
if (missingSuffix.length === 0) return resolvedAncestor;
|
|
357
|
-
return path.resolve(resolvedAncestor, ...missingSuffix);
|
|
358
|
-
} catch {
|
|
359
|
-
return normalized;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function getPathKindSync(absolutePath, preserveFinalSymlink) {
|
|
363
|
-
try {
|
|
364
|
-
return {
|
|
365
|
-
exists: true,
|
|
366
|
-
kind: toResolvedKind(preserveFinalSymlink ? fs.lstatSync(absolutePath) : fs.statSync(absolutePath))
|
|
367
|
-
};
|
|
368
|
-
} catch (error) {
|
|
369
|
-
if (isNotFoundPathError(error)) return {
|
|
370
|
-
exists: false,
|
|
371
|
-
kind: "missing"
|
|
372
|
-
};
|
|
373
|
-
throw error;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function toResolvedKind(stat) {
|
|
377
|
-
if (stat.isFile()) return "file";
|
|
378
|
-
if (stat.isDirectory()) return "directory";
|
|
379
|
-
if (stat.isSymbolicLink()) return "symlink";
|
|
380
|
-
return "other";
|
|
381
|
-
}
|
|
382
|
-
function relativeInsideRoot(rootPath, targetPath) {
|
|
383
|
-
const relative = path.relative(path.resolve(rootPath), path.resolve(targetPath));
|
|
384
|
-
if (!relative || relative === ".") return "";
|
|
385
|
-
if (relative.startsWith("..") || path.isAbsolute(relative)) return "";
|
|
386
|
-
return relative;
|
|
387
|
-
}
|
|
388
|
-
function assertInsideBoundary(params) {
|
|
389
|
-
if (isPathInside(params.rootCanonicalPath, params.candidatePath)) return;
|
|
390
|
-
throw new Error(`Path resolves outside ${params.boundaryLabel} (${shortPath(params.rootCanonicalPath)}): ${shortPath(params.absolutePath)}`);
|
|
391
|
-
}
|
|
392
|
-
function pathEscapeError(params) {
|
|
393
|
-
return /* @__PURE__ */ new Error(`Path escapes ${params.boundaryLabel} (${shortPath(params.rootPath)}): ${shortPath(params.absolutePath)}`);
|
|
394
|
-
}
|
|
395
|
-
function symlinkEscapeError(params) {
|
|
396
|
-
return /* @__PURE__ */ new Error(`Symlink escapes ${params.boundaryLabel} (${shortPath(params.rootCanonicalPath)}): ${shortPath(params.symlinkPath)}`);
|
|
397
|
-
}
|
|
398
|
-
function shortPath(value) {
|
|
399
|
-
const home = os.homedir();
|
|
400
|
-
if (value.startsWith(home)) return `~${value.slice(home.length)}`;
|
|
401
|
-
return value;
|
|
402
|
-
}
|
|
403
|
-
function isFilesystemRoot(candidate) {
|
|
404
|
-
return path.parse(candidate).root === candidate;
|
|
405
|
-
}
|
|
406
|
-
function resolveSymlinkHopPathSync(symlinkPath) {
|
|
407
|
-
try {
|
|
408
|
-
return path.resolve(fs.realpathSync(symlinkPath));
|
|
409
|
-
} catch (error) {
|
|
410
|
-
if (!isNotFoundPathError(error)) throw error;
|
|
411
|
-
const linkTarget = fs.readlinkSync(symlinkPath);
|
|
412
|
-
return resolvePathViaExistingAncestorSync(path.resolve(path.dirname(symlinkPath), linkTarget));
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
//#endregion
|
|
416
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/file-identity-DBd-elc3.js
|
|
417
|
-
function isZero(value) {
|
|
418
|
-
return value === 0 || value === 0n;
|
|
419
|
-
}
|
|
420
|
-
function sameFileIdentity$1(left, right, platform = process.platform) {
|
|
421
|
-
if (left.ino !== right.ino) return false;
|
|
422
|
-
if (left.dev === right.dev) return true;
|
|
423
|
-
return platform === "win32" && (isZero(left.dev) || isZero(right.dev));
|
|
424
|
-
}
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/safe-open-sync-X8Q1U9Y1.js
|
|
427
|
-
function isExpectedPathError(error) {
|
|
428
|
-
const code = typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
|
|
429
|
-
return code === "ENOENT" || code === "ENOTDIR" || code === "ELOOP";
|
|
430
|
-
}
|
|
431
|
-
function sameFileIdentity(left, right) {
|
|
432
|
-
return sameFileIdentity$1(left, right);
|
|
433
|
-
}
|
|
434
|
-
function openVerifiedFileSync(params) {
|
|
435
|
-
const ioFs = params.ioFs ?? fs;
|
|
436
|
-
const allowedType = params.allowedType ?? "file";
|
|
437
|
-
const openReadFlags = ioFs.constants.O_RDONLY | (typeof ioFs.constants.O_NOFOLLOW === "number" ? ioFs.constants.O_NOFOLLOW : 0);
|
|
438
|
-
let fd = null;
|
|
439
|
-
try {
|
|
440
|
-
if (params.rejectPathSymlink) {
|
|
441
|
-
if (ioFs.lstatSync(params.filePath).isSymbolicLink()) return {
|
|
442
|
-
ok: false,
|
|
443
|
-
reason: "validation"
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
const realPath = params.resolvedPath ?? ioFs.realpathSync(params.filePath);
|
|
447
|
-
const preOpenStat = ioFs.lstatSync(realPath);
|
|
448
|
-
if (!isAllowedType(preOpenStat, allowedType)) return {
|
|
449
|
-
ok: false,
|
|
450
|
-
reason: "validation"
|
|
451
|
-
};
|
|
452
|
-
if (params.rejectHardlinks && preOpenStat.isFile() && preOpenStat.nlink > 1) return {
|
|
453
|
-
ok: false,
|
|
454
|
-
reason: "validation"
|
|
455
|
-
};
|
|
456
|
-
if (params.maxBytes !== void 0 && preOpenStat.isFile() && preOpenStat.size > params.maxBytes) return {
|
|
457
|
-
ok: false,
|
|
458
|
-
reason: "validation"
|
|
459
|
-
};
|
|
460
|
-
fd = ioFs.openSync(realPath, openReadFlags);
|
|
461
|
-
const openedStat = ioFs.fstatSync(fd);
|
|
462
|
-
if (!isAllowedType(openedStat, allowedType)) return {
|
|
463
|
-
ok: false,
|
|
464
|
-
reason: "validation"
|
|
465
|
-
};
|
|
466
|
-
if (params.rejectHardlinks && openedStat.isFile() && openedStat.nlink > 1) return {
|
|
467
|
-
ok: false,
|
|
468
|
-
reason: "validation"
|
|
469
|
-
};
|
|
470
|
-
if (params.maxBytes !== void 0 && openedStat.isFile() && openedStat.size > params.maxBytes) return {
|
|
471
|
-
ok: false,
|
|
472
|
-
reason: "validation"
|
|
473
|
-
};
|
|
474
|
-
if (!sameFileIdentity(preOpenStat, openedStat)) return {
|
|
475
|
-
ok: false,
|
|
476
|
-
reason: "validation"
|
|
477
|
-
};
|
|
478
|
-
const opened = {
|
|
479
|
-
ok: true,
|
|
480
|
-
path: realPath,
|
|
481
|
-
fd,
|
|
482
|
-
stat: openedStat
|
|
483
|
-
};
|
|
484
|
-
fd = null;
|
|
485
|
-
return opened;
|
|
486
|
-
} catch (error) {
|
|
487
|
-
if (isExpectedPathError(error)) return {
|
|
488
|
-
ok: false,
|
|
489
|
-
reason: "path",
|
|
490
|
-
error
|
|
491
|
-
};
|
|
492
|
-
return {
|
|
493
|
-
ok: false,
|
|
494
|
-
reason: "io",
|
|
495
|
-
error
|
|
496
|
-
};
|
|
497
|
-
} finally {
|
|
498
|
-
if (fd !== null) ioFs.closeSync(fd);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
function isAllowedType(stat, allowedType) {
|
|
502
|
-
if (allowedType === "directory") return stat.isDirectory();
|
|
503
|
-
return stat.isFile();
|
|
504
|
-
}
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/boundary-file-read-BSd9MXPy.js
|
|
507
|
-
function canUseBoundaryFileOpen(ioFs) {
|
|
508
|
-
return typeof ioFs.openSync === "function" && typeof ioFs.closeSync === "function" && typeof ioFs.fstatSync === "function" && typeof ioFs.lstatSync === "function" && typeof ioFs.realpathSync === "function" && typeof ioFs.readFileSync === "function" && typeof ioFs.constants === "object" && ioFs.constants !== null;
|
|
509
|
-
}
|
|
510
|
-
function openBoundaryFileSync(params) {
|
|
511
|
-
const ioFs = params.ioFs ?? fs;
|
|
512
|
-
const resolved = resolveBoundaryFilePathGeneric({
|
|
513
|
-
absolutePath: params.absolutePath,
|
|
514
|
-
resolve: (absolutePath) => resolveBoundaryPathSync({
|
|
515
|
-
absolutePath,
|
|
516
|
-
rootPath: params.rootPath,
|
|
517
|
-
rootCanonicalPath: params.rootRealPath,
|
|
518
|
-
boundaryLabel: params.boundaryLabel,
|
|
519
|
-
skipLexicalRootCheck: params.skipLexicalRootCheck
|
|
520
|
-
})
|
|
521
|
-
});
|
|
522
|
-
if (resolved instanceof Promise) return toBoundaryValidationError(/* @__PURE__ */ new Error("Unexpected async boundary resolution"));
|
|
523
|
-
return finalizeBoundaryFileOpen({
|
|
524
|
-
resolved,
|
|
525
|
-
maxBytes: params.maxBytes,
|
|
526
|
-
rejectHardlinks: params.rejectHardlinks,
|
|
527
|
-
allowedType: params.allowedType,
|
|
528
|
-
ioFs
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
function matchBoundaryFileOpenFailure(failure, handlers) {
|
|
532
|
-
switch (failure.reason) {
|
|
533
|
-
case "path": return handlers.path ? handlers.path(failure) : handlers.fallback(failure);
|
|
534
|
-
case "validation": return handlers.validation ? handlers.validation(failure) : handlers.fallback(failure);
|
|
535
|
-
case "io": return handlers.io ? handlers.io(failure) : handlers.fallback(failure);
|
|
536
|
-
}
|
|
537
|
-
return handlers.fallback(failure);
|
|
538
|
-
}
|
|
539
|
-
function openBoundaryFileResolved(params) {
|
|
540
|
-
const opened = openVerifiedFileSync({
|
|
541
|
-
filePath: params.absolutePath,
|
|
542
|
-
resolvedPath: params.resolvedPath,
|
|
543
|
-
rejectHardlinks: params.rejectHardlinks ?? true,
|
|
544
|
-
maxBytes: params.maxBytes,
|
|
545
|
-
allowedType: params.allowedType,
|
|
546
|
-
ioFs: params.ioFs
|
|
547
|
-
});
|
|
548
|
-
if (!opened.ok) return opened;
|
|
549
|
-
return {
|
|
550
|
-
ok: true,
|
|
551
|
-
path: opened.path,
|
|
552
|
-
fd: opened.fd,
|
|
553
|
-
stat: opened.stat,
|
|
554
|
-
rootRealPath: params.rootRealPath
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
function finalizeBoundaryFileOpen(params) {
|
|
558
|
-
if ("ok" in params.resolved) return params.resolved;
|
|
559
|
-
return openBoundaryFileResolved({
|
|
560
|
-
absolutePath: params.resolved.absolutePath,
|
|
561
|
-
resolvedPath: params.resolved.resolvedPath,
|
|
562
|
-
rootRealPath: params.resolved.rootRealPath,
|
|
563
|
-
maxBytes: params.maxBytes,
|
|
564
|
-
rejectHardlinks: params.rejectHardlinks,
|
|
565
|
-
allowedType: params.allowedType,
|
|
566
|
-
ioFs: params.ioFs
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
function toBoundaryValidationError(error) {
|
|
570
|
-
return {
|
|
571
|
-
ok: false,
|
|
572
|
-
reason: "validation",
|
|
573
|
-
error
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
function mapResolvedBoundaryPath(absolutePath, resolved) {
|
|
577
|
-
return {
|
|
578
|
-
absolutePath,
|
|
579
|
-
resolvedPath: resolved.canonicalPath,
|
|
580
|
-
rootRealPath: resolved.rootCanonicalPath
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
function resolveBoundaryFilePathGeneric(params) {
|
|
584
|
-
const absolutePath = path.resolve(params.absolutePath);
|
|
585
|
-
try {
|
|
586
|
-
const resolved = params.resolve(absolutePath);
|
|
587
|
-
if (resolved instanceof Promise) return resolved.then((value) => mapResolvedBoundaryPath(absolutePath, value)).catch((error) => toBoundaryValidationError(error));
|
|
588
|
-
return mapResolvedBoundaryPath(absolutePath, resolved);
|
|
589
|
-
} catch (error) {
|
|
590
|
-
return toBoundaryValidationError(error);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
//#endregion
|
|
594
|
-
export { hasNodeErrorCode as a, isSymlinkOpenError as c, sameFileIdentity$1 as i, resolveBoundaryPathSync as l, matchBoundaryFileOpenFailure as n, isNotFoundPathError as o, openBoundaryFileSync as r, isPathInside as s, canUseBoundaryFileOpen as t };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { n as loadBundledPluginPublicSurfaceModuleSync } from "./facade-loader-DFzIYYt_-CIr4HKtE.mjs";
|
|
2
|
-
import "node:fs";
|
|
3
|
-
import "node:path";
|
|
4
|
-
import "node:os";
|
|
5
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/browser-maintenance-CgzwL4B_.js
|
|
6
|
-
let cachedBrowserMaintenanceSurface;
|
|
7
|
-
function hasRequestedSessionKeys(sessionKeys) {
|
|
8
|
-
return sessionKeys.some((key) => Boolean(key?.trim()));
|
|
9
|
-
}
|
|
10
|
-
function loadBrowserMaintenanceSurface() {
|
|
11
|
-
cachedBrowserMaintenanceSurface ??= loadBundledPluginPublicSurfaceModuleSync({
|
|
12
|
-
dirName: "browser",
|
|
13
|
-
artifactBasename: "browser-maintenance.js"
|
|
14
|
-
});
|
|
15
|
-
return cachedBrowserMaintenanceSurface;
|
|
16
|
-
}
|
|
17
|
-
async function closeTrackedBrowserTabsForSessions(params) {
|
|
18
|
-
if (!hasRequestedSessionKeys(params.sessionKeys)) return 0;
|
|
19
|
-
let surface;
|
|
20
|
-
try {
|
|
21
|
-
surface = loadBrowserMaintenanceSurface();
|
|
22
|
-
} catch (error) {
|
|
23
|
-
params.onWarn?.(`browser cleanup unavailable: ${String(error)}`);
|
|
24
|
-
return 0;
|
|
25
|
-
}
|
|
26
|
-
return await surface.closeTrackedBrowserTabsForSessions(params);
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/browser-lifecycle-cleanup-D8s47iQX.js
|
|
30
|
-
async function runBestEffortCleanup(params) {
|
|
31
|
-
try {
|
|
32
|
-
return await params.cleanup();
|
|
33
|
-
} catch (error) {
|
|
34
|
-
params.onError?.(error);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function normalizeSessionKeys(sessionKeys) {
|
|
39
|
-
const keys = /* @__PURE__ */ new Set();
|
|
40
|
-
for (const sessionKey of sessionKeys) {
|
|
41
|
-
const normalized = sessionKey.trim();
|
|
42
|
-
if (normalized) keys.add(normalized);
|
|
43
|
-
}
|
|
44
|
-
return [...keys];
|
|
45
|
-
}
|
|
46
|
-
async function cleanupBrowserSessionsForLifecycleEnd(params) {
|
|
47
|
-
const sessionKeys = normalizeSessionKeys(params.sessionKeys);
|
|
48
|
-
if (sessionKeys.length === 0) return;
|
|
49
|
-
await runBestEffortCleanup({
|
|
50
|
-
cleanup: async () => {
|
|
51
|
-
await closeTrackedBrowserTabsForSessions({
|
|
52
|
-
sessionKeys,
|
|
53
|
-
onWarn: params.onWarn
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
onError: params.onError
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { cleanupBrowserSessionsForLifecycleEnd };
|