@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,9 +0,0 @@
|
|
|
1
|
-
import "./paths-D92DjaZ--CTOESW2b.mjs";
|
|
2
|
-
import "./bundled-dir-U738ay4K-DXK0q_TV.mjs";
|
|
3
|
-
import "./io-CH2g3vsv-BOGlLlB8.mjs";
|
|
4
|
-
import "./bundled-compat-BpaDaAAu-D7oazKjD.mjs";
|
|
5
|
-
import "node:path";
|
|
6
|
-
import "node:fs/promises";
|
|
7
|
-
import "node:crypto";
|
|
8
|
-
import "node:util";
|
|
9
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { c as normalizeOptionalString } from "./home-dir-C44RaPME-CBRS4HLP.mjs";
|
|
2
|
-
import { r as normalizeOptionalAccountId } from "./account-id-BM1T6029-DYjVxojW.mjs";
|
|
3
|
-
import { n as normalizeMessageChannel } from "./message-channel-core-DTA--Gjh-CY4Tkb7N.mjs";
|
|
4
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/delivery-context.shared-j5hC5qb1.js
|
|
5
|
-
function normalizeAccountId(value) {
|
|
6
|
-
return normalizeOptionalAccountId(value);
|
|
7
|
-
}
|
|
8
|
-
function normalizeDeliveryContext(context) {
|
|
9
|
-
if (!context) return;
|
|
10
|
-
const channel = typeof context.channel === "string" ? normalizeMessageChannel(context.channel) ?? context.channel.trim() : void 0;
|
|
11
|
-
const to = normalizeOptionalString(context.to);
|
|
12
|
-
const accountId = normalizeAccountId(context.accountId);
|
|
13
|
-
const threadId = typeof context.threadId === "number" && Number.isFinite(context.threadId) ? Math.trunc(context.threadId) : typeof context.threadId === "string" ? normalizeOptionalString(context.threadId) : void 0;
|
|
14
|
-
const normalizedThreadId = typeof threadId === "string" ? threadId ? threadId : void 0 : threadId;
|
|
15
|
-
if (!channel && !to && !accountId && normalizedThreadId == null) return;
|
|
16
|
-
const normalized = {
|
|
17
|
-
channel: channel || void 0,
|
|
18
|
-
to: to || void 0,
|
|
19
|
-
accountId
|
|
20
|
-
};
|
|
21
|
-
if (normalizedThreadId != null) normalized.threadId = normalizedThreadId;
|
|
22
|
-
return normalized;
|
|
23
|
-
}
|
|
24
|
-
function normalizeSessionDeliveryFields(source) {
|
|
25
|
-
if (!source) return {
|
|
26
|
-
deliveryContext: void 0,
|
|
27
|
-
lastChannel: void 0,
|
|
28
|
-
lastTo: void 0,
|
|
29
|
-
lastAccountId: void 0,
|
|
30
|
-
lastThreadId: void 0
|
|
31
|
-
};
|
|
32
|
-
const merged = mergeDeliveryContext(normalizeDeliveryContext({
|
|
33
|
-
channel: source.lastChannel ?? source.channel,
|
|
34
|
-
to: source.lastTo,
|
|
35
|
-
accountId: source.lastAccountId,
|
|
36
|
-
threadId: source.lastThreadId
|
|
37
|
-
}), normalizeDeliveryContext(source.deliveryContext));
|
|
38
|
-
if (!merged) return {
|
|
39
|
-
deliveryContext: void 0,
|
|
40
|
-
lastChannel: void 0,
|
|
41
|
-
lastTo: void 0,
|
|
42
|
-
lastAccountId: void 0,
|
|
43
|
-
lastThreadId: void 0
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
deliveryContext: merged,
|
|
47
|
-
lastChannel: merged.channel,
|
|
48
|
-
lastTo: merged.to,
|
|
49
|
-
lastAccountId: merged.accountId,
|
|
50
|
-
lastThreadId: merged.threadId
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function mergeDeliveryContext(primary, fallback) {
|
|
54
|
-
const normalizedPrimary = normalizeDeliveryContext(primary);
|
|
55
|
-
const normalizedFallback = normalizeDeliveryContext(fallback);
|
|
56
|
-
if (!normalizedPrimary && !normalizedFallback) return;
|
|
57
|
-
const channelsConflict = normalizedPrimary?.channel && normalizedFallback?.channel && normalizedPrimary.channel !== normalizedFallback.channel;
|
|
58
|
-
return normalizeDeliveryContext({
|
|
59
|
-
channel: normalizedPrimary?.channel ?? normalizedFallback?.channel,
|
|
60
|
-
to: channelsConflict ? normalizedPrimary?.to : normalizedPrimary?.to ?? normalizedFallback?.to,
|
|
61
|
-
accountId: channelsConflict ? normalizedPrimary?.accountId : normalizedPrimary?.accountId ?? normalizedFallback?.accountId,
|
|
62
|
-
threadId: channelsConflict ? normalizedPrimary?.threadId : normalizedPrimary?.threadId ?? normalizedFallback?.threadId
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function deliveryContextKey(context) {
|
|
66
|
-
const normalized = normalizeDeliveryContext(context);
|
|
67
|
-
if (!normalized?.channel || !normalized?.to) return;
|
|
68
|
-
const threadId = normalized.threadId != null && normalized.threadId !== "" ? String(normalized.threadId) : "";
|
|
69
|
-
return `${normalized.channel}|${normalized.to}|${normalized.accountId ?? ""}|${threadId}`;
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
export { normalizeSessionDeliveryFields as i, mergeDeliveryContext as n, normalizeDeliveryContext as r, deliveryContextKey as t };
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import "./paths-D92DjaZ--CTOESW2b.mjs";
|
|
2
|
-
import "./io-CH2g3vsv-BOGlLlB8.mjs";
|
|
3
|
-
import { St as createSubsystemLogger } from "./bundled-compat-BpaDaAAu-D7oazKjD.mjs";
|
|
4
|
-
import "./config-Bim2pi8a-BQUdfiEi.mjs";
|
|
5
|
-
import "node:fs";
|
|
6
|
-
import "node:path";
|
|
7
|
-
import "node:process";
|
|
8
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/diagnostic-events-DU0Yv8MX.js
|
|
9
|
-
function getDiagnosticEventsState() {
|
|
10
|
-
const globalStore = globalThis;
|
|
11
|
-
if (!globalStore.__openclawDiagnosticEventsState) globalStore.__openclawDiagnosticEventsState = {
|
|
12
|
-
enabled: true,
|
|
13
|
-
seq: 0,
|
|
14
|
-
listeners: /* @__PURE__ */ new Set(),
|
|
15
|
-
dispatchDepth: 0
|
|
16
|
-
};
|
|
17
|
-
return globalStore.__openclawDiagnosticEventsState;
|
|
18
|
-
}
|
|
19
|
-
function areDiagnosticsEnabledForProcess() {
|
|
20
|
-
return getDiagnosticEventsState().enabled;
|
|
21
|
-
}
|
|
22
|
-
function emitDiagnosticEvent(event) {
|
|
23
|
-
const state = getDiagnosticEventsState();
|
|
24
|
-
if (!state.enabled) return;
|
|
25
|
-
if (state.dispatchDepth > 100) {
|
|
26
|
-
console.error(`[diagnostic-events] recursion guard tripped at depth=${state.dispatchDepth}, dropping type=${event.type}`);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const enriched = {
|
|
30
|
-
...event,
|
|
31
|
-
seq: state.seq += 1,
|
|
32
|
-
ts: Date.now()
|
|
33
|
-
};
|
|
34
|
-
state.dispatchDepth += 1;
|
|
35
|
-
for (const listener of state.listeners) try {
|
|
36
|
-
listener(enriched);
|
|
37
|
-
} catch (err) {
|
|
38
|
-
const errorMessage = err instanceof Error ? err.stack ?? err.message : typeof err === "string" ? err : String(err);
|
|
39
|
-
console.error(`[diagnostic-events] listener error type=${enriched.type} seq=${enriched.seq}: ${errorMessage}`);
|
|
40
|
-
}
|
|
41
|
-
state.dispatchDepth -= 1;
|
|
42
|
-
}
|
|
43
|
-
const diagnosticLogger = createSubsystemLogger("diagnostic");
|
|
44
|
-
function markDiagnosticActivity() {}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/diagnostic-session-state-CnRAerRs.js
|
|
47
|
-
const diagnosticSessionStates = /* @__PURE__ */ new Map();
|
|
48
|
-
const SESSION_STATE_TTL_MS = 1800 * 1e3;
|
|
49
|
-
const SESSION_STATE_PRUNE_INTERVAL_MS = 60 * 1e3;
|
|
50
|
-
const SESSION_STATE_MAX_ENTRIES = 2e3;
|
|
51
|
-
let lastSessionPruneAt = 0;
|
|
52
|
-
function pruneDiagnosticSessionStates(now = Date.now(), force = false) {
|
|
53
|
-
const shouldPruneForSize = diagnosticSessionStates.size > SESSION_STATE_MAX_ENTRIES;
|
|
54
|
-
if (!force && !shouldPruneForSize && now - lastSessionPruneAt < SESSION_STATE_PRUNE_INTERVAL_MS) return;
|
|
55
|
-
lastSessionPruneAt = now;
|
|
56
|
-
for (const [key, state] of diagnosticSessionStates.entries()) {
|
|
57
|
-
const ageMs = now - state.lastActivity;
|
|
58
|
-
if (state.state === "idle" && state.queueDepth <= 0 && ageMs > SESSION_STATE_TTL_MS) diagnosticSessionStates.delete(key);
|
|
59
|
-
}
|
|
60
|
-
if (diagnosticSessionStates.size <= SESSION_STATE_MAX_ENTRIES) return;
|
|
61
|
-
const excess = diagnosticSessionStates.size - SESSION_STATE_MAX_ENTRIES;
|
|
62
|
-
const ordered = Array.from(diagnosticSessionStates.entries()).toSorted((a, b) => a[1].lastActivity - b[1].lastActivity);
|
|
63
|
-
for (let i = 0; i < excess; i += 1) {
|
|
64
|
-
const key = ordered[i]?.[0];
|
|
65
|
-
if (!key) break;
|
|
66
|
-
diagnosticSessionStates.delete(key);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function resolveSessionKey({ sessionKey, sessionId }) {
|
|
70
|
-
return sessionKey ?? sessionId ?? "unknown";
|
|
71
|
-
}
|
|
72
|
-
function findStateBySessionId(sessionId) {
|
|
73
|
-
for (const state of diagnosticSessionStates.values()) if (state.sessionId === sessionId) return state;
|
|
74
|
-
}
|
|
75
|
-
function getDiagnosticSessionState(ref) {
|
|
76
|
-
pruneDiagnosticSessionStates();
|
|
77
|
-
const key = resolveSessionKey(ref);
|
|
78
|
-
const existing = diagnosticSessionStates.get(key) ?? (ref.sessionId && findStateBySessionId(ref.sessionId));
|
|
79
|
-
if (existing) {
|
|
80
|
-
if (ref.sessionId) existing.sessionId = ref.sessionId;
|
|
81
|
-
if (ref.sessionKey) existing.sessionKey = ref.sessionKey;
|
|
82
|
-
return existing;
|
|
83
|
-
}
|
|
84
|
-
const created = {
|
|
85
|
-
sessionId: ref.sessionId,
|
|
86
|
-
sessionKey: ref.sessionKey,
|
|
87
|
-
lastActivity: Date.now(),
|
|
88
|
-
state: "idle",
|
|
89
|
-
queueDepth: 0
|
|
90
|
-
};
|
|
91
|
-
diagnosticSessionStates.set(key, created);
|
|
92
|
-
pruneDiagnosticSessionStates(Date.now(), true);
|
|
93
|
-
return created;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/diagnostic-ClMwNnUA.js
|
|
97
|
-
const MB = 1024 * 1024;
|
|
98
|
-
1536 * MB;
|
|
99
|
-
3072 * MB;
|
|
100
|
-
1024 * MB;
|
|
101
|
-
2048 * MB;
|
|
102
|
-
512 * MB;
|
|
103
|
-
1024 * MB;
|
|
104
|
-
function logMessageQueued(params) {
|
|
105
|
-
if (!areDiagnosticsEnabledForProcess()) return;
|
|
106
|
-
const state = getDiagnosticSessionState(params);
|
|
107
|
-
state.queueDepth += 1;
|
|
108
|
-
state.lastActivity = Date.now();
|
|
109
|
-
if (diagnosticLogger.isEnabled("debug")) diagnosticLogger.debug(`message queued: sessionId=${state.sessionId ?? "unknown"} sessionKey=${state.sessionKey ?? "unknown"} source=${params.source} queueDepth=${state.queueDepth} sessionState=${state.state}`);
|
|
110
|
-
emitDiagnosticEvent({
|
|
111
|
-
type: "message.queued",
|
|
112
|
-
sessionId: state.sessionId,
|
|
113
|
-
sessionKey: state.sessionKey,
|
|
114
|
-
channel: params.channel,
|
|
115
|
-
source: params.source,
|
|
116
|
-
queueDepth: state.queueDepth
|
|
117
|
-
});
|
|
118
|
-
markDiagnosticActivity();
|
|
119
|
-
}
|
|
120
|
-
function logToolLoopAction(params) {
|
|
121
|
-
if (!areDiagnosticsEnabledForProcess()) return;
|
|
122
|
-
const payload = `tool loop: sessionId=${params.sessionId ?? "unknown"} sessionKey=${params.sessionKey ?? "unknown"} tool=${params.toolName} level=${params.level} action=${params.action} detector=${params.detector} count=${params.count}${params.pairedToolName ? ` pairedTool=${params.pairedToolName}` : ""} message="${params.message}"`;
|
|
123
|
-
if (params.level === "critical") diagnosticLogger.error(payload);
|
|
124
|
-
else diagnosticLogger.warn(payload);
|
|
125
|
-
emitDiagnosticEvent({
|
|
126
|
-
type: "tool.loop",
|
|
127
|
-
sessionId: params.sessionId,
|
|
128
|
-
sessionKey: params.sessionKey,
|
|
129
|
-
toolName: params.toolName,
|
|
130
|
-
level: params.level,
|
|
131
|
-
action: params.action,
|
|
132
|
-
detector: params.detector,
|
|
133
|
-
count: params.count,
|
|
134
|
-
message: params.message,
|
|
135
|
-
pairedToolName: params.pairedToolName
|
|
136
|
-
});
|
|
137
|
-
markDiagnosticActivity();
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { diagnosticLogger as i, logToolLoopAction as n, getDiagnosticSessionState as r, logMessageQueued as t };
|
package/dist/dist-CEGw8-2W.mjs
DELETED
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
import { i as __require, t as __commonJSMin } from "./chunk-D6SyT4dJ.mjs";
|
|
2
|
-
import { t as require_src } from "./src-BgCX0MLG.mjs";
|
|
3
|
-
//#region node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
|
|
4
|
-
var require_helpers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === void 0) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function() {
|
|
11
|
-
return m[k];
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === void 0) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
value: v
|
|
23
|
-
});
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) {
|
|
31
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
32
|
-
}
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.req = exports.json = exports.toBuffer = void 0;
|
|
38
|
-
const http$1 = __importStar(__require("http"));
|
|
39
|
-
const https = __importStar(__require("https"));
|
|
40
|
-
async function toBuffer(stream) {
|
|
41
|
-
let length = 0;
|
|
42
|
-
const chunks = [];
|
|
43
|
-
for await (const chunk of stream) {
|
|
44
|
-
length += chunk.length;
|
|
45
|
-
chunks.push(chunk);
|
|
46
|
-
}
|
|
47
|
-
return Buffer.concat(chunks, length);
|
|
48
|
-
}
|
|
49
|
-
exports.toBuffer = toBuffer;
|
|
50
|
-
async function json(stream) {
|
|
51
|
-
const str = (await toBuffer(stream)).toString("utf8");
|
|
52
|
-
try {
|
|
53
|
-
return JSON.parse(str);
|
|
54
|
-
} catch (_err) {
|
|
55
|
-
const err = _err;
|
|
56
|
-
err.message += ` (input: ${str})`;
|
|
57
|
-
throw err;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.json = json;
|
|
61
|
-
function req(url, opts = {}) {
|
|
62
|
-
const req = ((typeof url === "string" ? url : url.href).startsWith("https:") ? https : http$1).request(url, opts);
|
|
63
|
-
const promise = new Promise((resolve, reject) => {
|
|
64
|
-
req.once("response", resolve).once("error", reject).end();
|
|
65
|
-
});
|
|
66
|
-
req.then = promise.then.bind(promise);
|
|
67
|
-
return req;
|
|
68
|
-
}
|
|
69
|
-
exports.req = req;
|
|
70
|
-
}));
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
|
|
73
|
-
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
74
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
75
|
-
if (k2 === void 0) k2 = k;
|
|
76
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
77
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function() {
|
|
80
|
-
return m[k];
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
Object.defineProperty(o, k2, desc);
|
|
84
|
-
}) : (function(o, m, k, k2) {
|
|
85
|
-
if (k2 === void 0) k2 = k;
|
|
86
|
-
o[k2] = m[k];
|
|
87
|
-
}));
|
|
88
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
89
|
-
Object.defineProperty(o, "default", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
value: v
|
|
92
|
-
});
|
|
93
|
-
}) : function(o, v) {
|
|
94
|
-
o["default"] = v;
|
|
95
|
-
});
|
|
96
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
97
|
-
if (mod && mod.__esModule) return mod;
|
|
98
|
-
var result = {};
|
|
99
|
-
if (mod != null) {
|
|
100
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
101
|
-
}
|
|
102
|
-
__setModuleDefault(result, mod);
|
|
103
|
-
return result;
|
|
104
|
-
};
|
|
105
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
|
|
106
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
107
|
-
};
|
|
108
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
109
|
-
exports.Agent = void 0;
|
|
110
|
-
const net$1 = __importStar(__require("net"));
|
|
111
|
-
const http = __importStar(__require("http"));
|
|
112
|
-
const https_1 = __require("https");
|
|
113
|
-
__exportStar(require_helpers(), exports);
|
|
114
|
-
const INTERNAL = Symbol("AgentBaseInternalState");
|
|
115
|
-
var Agent = class extends http.Agent {
|
|
116
|
-
constructor(opts) {
|
|
117
|
-
super(opts);
|
|
118
|
-
this[INTERNAL] = {};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Determine whether this is an `http` or `https` request.
|
|
122
|
-
*/
|
|
123
|
-
isSecureEndpoint(options) {
|
|
124
|
-
if (options) {
|
|
125
|
-
if (typeof options.secureEndpoint === "boolean") return options.secureEndpoint;
|
|
126
|
-
if (typeof options.protocol === "string") return options.protocol === "https:";
|
|
127
|
-
}
|
|
128
|
-
const { stack } = /* @__PURE__ */ new Error();
|
|
129
|
-
if (typeof stack !== "string") return false;
|
|
130
|
-
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
131
|
-
}
|
|
132
|
-
incrementSockets(name) {
|
|
133
|
-
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) return null;
|
|
134
|
-
if (!this.sockets[name]) this.sockets[name] = [];
|
|
135
|
-
const fakeSocket = new net$1.Socket({ writable: false });
|
|
136
|
-
this.sockets[name].push(fakeSocket);
|
|
137
|
-
this.totalSocketCount++;
|
|
138
|
-
return fakeSocket;
|
|
139
|
-
}
|
|
140
|
-
decrementSockets(name, socket) {
|
|
141
|
-
if (!this.sockets[name] || socket === null) return;
|
|
142
|
-
const sockets = this.sockets[name];
|
|
143
|
-
const index = sockets.indexOf(socket);
|
|
144
|
-
if (index !== -1) {
|
|
145
|
-
sockets.splice(index, 1);
|
|
146
|
-
this.totalSocketCount--;
|
|
147
|
-
if (sockets.length === 0) delete this.sockets[name];
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
getName(options) {
|
|
151
|
-
if (this.isSecureEndpoint(options)) return https_1.Agent.prototype.getName.call(this, options);
|
|
152
|
-
return super.getName(options);
|
|
153
|
-
}
|
|
154
|
-
createSocket(req, options, cb) {
|
|
155
|
-
const connectOpts = {
|
|
156
|
-
...options,
|
|
157
|
-
secureEndpoint: this.isSecureEndpoint(options)
|
|
158
|
-
};
|
|
159
|
-
const name = this.getName(connectOpts);
|
|
160
|
-
const fakeSocket = this.incrementSockets(name);
|
|
161
|
-
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
162
|
-
this.decrementSockets(name, fakeSocket);
|
|
163
|
-
if (socket instanceof http.Agent) try {
|
|
164
|
-
return socket.addRequest(req, connectOpts);
|
|
165
|
-
} catch (err) {
|
|
166
|
-
return cb(err);
|
|
167
|
-
}
|
|
168
|
-
this[INTERNAL].currentSocket = socket;
|
|
169
|
-
super.createSocket(req, options, cb);
|
|
170
|
-
}, (err) => {
|
|
171
|
-
this.decrementSockets(name, fakeSocket);
|
|
172
|
-
cb(err);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
createConnection() {
|
|
176
|
-
const socket = this[INTERNAL].currentSocket;
|
|
177
|
-
this[INTERNAL].currentSocket = void 0;
|
|
178
|
-
if (!socket) throw new Error("No socket was returned in the `connect()` function");
|
|
179
|
-
return socket;
|
|
180
|
-
}
|
|
181
|
-
get defaultPort() {
|
|
182
|
-
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
183
|
-
}
|
|
184
|
-
set defaultPort(v) {
|
|
185
|
-
if (this[INTERNAL]) this[INTERNAL].defaultPort = v;
|
|
186
|
-
}
|
|
187
|
-
get protocol() {
|
|
188
|
-
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
189
|
-
}
|
|
190
|
-
set protocol(v) {
|
|
191
|
-
if (this[INTERNAL]) this[INTERNAL].protocol = v;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
exports.Agent = Agent;
|
|
195
|
-
}));
|
|
196
|
-
//#endregion
|
|
197
|
-
//#region node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
198
|
-
var require_parse_proxy_response = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
199
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
200
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
201
|
-
};
|
|
202
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
203
|
-
exports.parseProxyResponse = void 0;
|
|
204
|
-
const debug = (0, __importDefault(require_src()).default)("https-proxy-agent:parse-proxy-response");
|
|
205
|
-
function parseProxyResponse(socket) {
|
|
206
|
-
return new Promise((resolve, reject) => {
|
|
207
|
-
let buffersLength = 0;
|
|
208
|
-
const buffers = [];
|
|
209
|
-
function read() {
|
|
210
|
-
const b = socket.read();
|
|
211
|
-
if (b) ondata(b);
|
|
212
|
-
else socket.once("readable", read);
|
|
213
|
-
}
|
|
214
|
-
function cleanup() {
|
|
215
|
-
socket.removeListener("end", onend);
|
|
216
|
-
socket.removeListener("error", onerror);
|
|
217
|
-
socket.removeListener("readable", read);
|
|
218
|
-
}
|
|
219
|
-
function onend() {
|
|
220
|
-
cleanup();
|
|
221
|
-
debug("onend");
|
|
222
|
-
reject(/* @__PURE__ */ new Error("Proxy connection ended before receiving CONNECT response"));
|
|
223
|
-
}
|
|
224
|
-
function onerror(err) {
|
|
225
|
-
cleanup();
|
|
226
|
-
debug("onerror %o", err);
|
|
227
|
-
reject(err);
|
|
228
|
-
}
|
|
229
|
-
function ondata(b) {
|
|
230
|
-
buffers.push(b);
|
|
231
|
-
buffersLength += b.length;
|
|
232
|
-
const buffered = Buffer.concat(buffers, buffersLength);
|
|
233
|
-
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
234
|
-
if (endOfHeaders === -1) {
|
|
235
|
-
debug("have not received end of HTTP headers yet...");
|
|
236
|
-
read();
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
240
|
-
const firstLine = headerParts.shift();
|
|
241
|
-
if (!firstLine) {
|
|
242
|
-
socket.destroy();
|
|
243
|
-
return reject(/* @__PURE__ */ new Error("No header received from proxy CONNECT response"));
|
|
244
|
-
}
|
|
245
|
-
const firstLineParts = firstLine.split(" ");
|
|
246
|
-
const statusCode = +firstLineParts[1];
|
|
247
|
-
const statusText = firstLineParts.slice(2).join(" ");
|
|
248
|
-
const headers = {};
|
|
249
|
-
for (const header of headerParts) {
|
|
250
|
-
if (!header) continue;
|
|
251
|
-
const firstColon = header.indexOf(":");
|
|
252
|
-
if (firstColon === -1) {
|
|
253
|
-
socket.destroy();
|
|
254
|
-
return reject(/* @__PURE__ */ new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
255
|
-
}
|
|
256
|
-
const key = header.slice(0, firstColon).toLowerCase();
|
|
257
|
-
const value = header.slice(firstColon + 1).trimStart();
|
|
258
|
-
const current = headers[key];
|
|
259
|
-
if (typeof current === "string") headers[key] = [current, value];
|
|
260
|
-
else if (Array.isArray(current)) current.push(value);
|
|
261
|
-
else headers[key] = value;
|
|
262
|
-
}
|
|
263
|
-
debug("got proxy server response: %o %o", firstLine, headers);
|
|
264
|
-
cleanup();
|
|
265
|
-
resolve({
|
|
266
|
-
connect: {
|
|
267
|
-
statusCode,
|
|
268
|
-
statusText,
|
|
269
|
-
headers
|
|
270
|
-
},
|
|
271
|
-
buffered
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
socket.on("error", onerror);
|
|
275
|
-
socket.on("end", onend);
|
|
276
|
-
read();
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
exports.parseProxyResponse = parseProxyResponse;
|
|
280
|
-
}));
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
|
|
283
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
284
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
285
|
-
if (k2 === void 0) k2 = k;
|
|
286
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
287
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
288
|
-
enumerable: true,
|
|
289
|
-
get: function() {
|
|
290
|
-
return m[k];
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
Object.defineProperty(o, k2, desc);
|
|
294
|
-
}) : (function(o, m, k, k2) {
|
|
295
|
-
if (k2 === void 0) k2 = k;
|
|
296
|
-
o[k2] = m[k];
|
|
297
|
-
}));
|
|
298
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
299
|
-
Object.defineProperty(o, "default", {
|
|
300
|
-
enumerable: true,
|
|
301
|
-
value: v
|
|
302
|
-
});
|
|
303
|
-
}) : function(o, v) {
|
|
304
|
-
o["default"] = v;
|
|
305
|
-
});
|
|
306
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
307
|
-
if (mod && mod.__esModule) return mod;
|
|
308
|
-
var result = {};
|
|
309
|
-
if (mod != null) {
|
|
310
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
311
|
-
}
|
|
312
|
-
__setModuleDefault(result, mod);
|
|
313
|
-
return result;
|
|
314
|
-
};
|
|
315
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
316
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
317
|
-
};
|
|
318
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
319
|
-
exports.HttpsProxyAgent = void 0;
|
|
320
|
-
const net = __importStar(__require("net"));
|
|
321
|
-
const tls = __importStar(__require("tls"));
|
|
322
|
-
const assert_1 = __importDefault(__require("assert"));
|
|
323
|
-
const debug_1 = __importDefault(require_src());
|
|
324
|
-
const agent_base_1 = require_dist$1();
|
|
325
|
-
const url_1 = __require("url");
|
|
326
|
-
const parse_proxy_response_1 = require_parse_proxy_response();
|
|
327
|
-
const debug = (0, debug_1.default)("https-proxy-agent");
|
|
328
|
-
const setServernameFromNonIpHost = (options) => {
|
|
329
|
-
if (options.servername === void 0 && options.host && !net.isIP(options.host)) return {
|
|
330
|
-
...options,
|
|
331
|
-
servername: options.host
|
|
332
|
-
};
|
|
333
|
-
return options;
|
|
334
|
-
};
|
|
335
|
-
/**
|
|
336
|
-
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
|
|
337
|
-
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
|
|
338
|
-
*
|
|
339
|
-
* Outgoing HTTP requests are first tunneled through the proxy server using the
|
|
340
|
-
* `CONNECT` HTTP request method to establish a connection to the proxy server,
|
|
341
|
-
* and then the proxy server connects to the destination target and issues the
|
|
342
|
-
* HTTP request from the proxy server.
|
|
343
|
-
*
|
|
344
|
-
* `https:` requests have their socket connection upgraded to TLS once
|
|
345
|
-
* the connection to the proxy server has been established.
|
|
346
|
-
*/
|
|
347
|
-
var HttpsProxyAgent = class extends agent_base_1.Agent {
|
|
348
|
-
constructor(proxy, opts) {
|
|
349
|
-
super(opts);
|
|
350
|
-
this.options = { path: void 0 };
|
|
351
|
-
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
352
|
-
this.proxyHeaders = opts?.headers ?? {};
|
|
353
|
-
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
354
|
-
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
355
|
-
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
356
|
-
this.connectOpts = {
|
|
357
|
-
ALPNProtocols: ["http/1.1"],
|
|
358
|
-
...opts ? omit(opts, "headers") : null,
|
|
359
|
-
host,
|
|
360
|
-
port
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Called when the node-core HTTP client library is creating a
|
|
365
|
-
* new HTTP request.
|
|
366
|
-
*/
|
|
367
|
-
async connect(req, opts) {
|
|
368
|
-
const { proxy } = this;
|
|
369
|
-
if (!opts.host) throw new TypeError("No \"host\" provided");
|
|
370
|
-
let socket;
|
|
371
|
-
if (proxy.protocol === "https:") {
|
|
372
|
-
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
373
|
-
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
374
|
-
} else {
|
|
375
|
-
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
376
|
-
socket = net.connect(this.connectOpts);
|
|
377
|
-
}
|
|
378
|
-
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
379
|
-
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
380
|
-
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
|
|
381
|
-
if (proxy.username || proxy.password) {
|
|
382
|
-
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
383
|
-
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
384
|
-
}
|
|
385
|
-
headers.Host = `${host}:${opts.port}`;
|
|
386
|
-
if (!headers["Proxy-Connection"]) headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
387
|
-
for (const name of Object.keys(headers)) payload += `${name}: ${headers[name]}\r\n`;
|
|
388
|
-
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
389
|
-
socket.write(`${payload}\r\n`);
|
|
390
|
-
const { connect, buffered } = await proxyResponsePromise;
|
|
391
|
-
req.emit("proxyConnect", connect);
|
|
392
|
-
this.emit("proxyConnect", connect, req);
|
|
393
|
-
if (connect.statusCode === 200) {
|
|
394
|
-
req.once("socket", resume);
|
|
395
|
-
if (opts.secureEndpoint) {
|
|
396
|
-
debug("Upgrading socket connection to TLS");
|
|
397
|
-
return tls.connect({
|
|
398
|
-
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
399
|
-
socket
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
return socket;
|
|
403
|
-
}
|
|
404
|
-
socket.destroy();
|
|
405
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
406
|
-
fakeSocket.readable = true;
|
|
407
|
-
req.once("socket", (s) => {
|
|
408
|
-
debug("Replaying proxy buffer for failed request");
|
|
409
|
-
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
410
|
-
s.push(buffered);
|
|
411
|
-
s.push(null);
|
|
412
|
-
});
|
|
413
|
-
return fakeSocket;
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
HttpsProxyAgent.protocols = ["http", "https"];
|
|
417
|
-
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
418
|
-
function resume(socket) {
|
|
419
|
-
socket.resume();
|
|
420
|
-
}
|
|
421
|
-
function omit(obj, ...keys) {
|
|
422
|
-
const ret = {};
|
|
423
|
-
let key;
|
|
424
|
-
for (key in obj) if (!keys.includes(key)) ret[key] = obj[key];
|
|
425
|
-
return ret;
|
|
426
|
-
}
|
|
427
|
-
}));
|
|
428
|
-
//#endregion
|
|
429
|
-
export { require_dist as t };
|