@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,1002 +0,0 @@
|
|
|
1
|
-
import { a as __toESM } from "./chunk-D6SyT4dJ.mjs";
|
|
2
|
-
import { c as normalizeOptionalString, l as normalizeOptionalThreadValue, o as normalizeLowercaseStringOrEmpty, s as normalizeOptionalLowercaseString } from "./home-dir-C44RaPME-CBRS4HLP.mjs";
|
|
3
|
-
import { n as STATE_DIR } from "./paths-D92DjaZ--CTOESW2b.mjs";
|
|
4
|
-
import { a as escapeRegExp } from "./bundled-dir-U738ay4K-DXK0q_TV.mjs";
|
|
5
|
-
import "./io-CH2g3vsv-BOGlLlB8.mjs";
|
|
6
|
-
import { t as CHANNEL_IDS } from "./ids-BPsM98Uu-CwuxvUai.mjs";
|
|
7
|
-
import { t as getActivePluginChannelRegistryFromState } from "./runtime-channel-state-CohMybAh-hXR6y5Gx.mjs";
|
|
8
|
-
import { Pt as resolveNodeRequireFromMeta, St as createSubsystemLogger } from "./bundled-compat-BpaDaAAu-D7oazKjD.mjs";
|
|
9
|
-
import "./message-channel-Bk_YHfQg-AeNrPPpp.mjs";
|
|
10
|
-
import { j as require_lib } from "./manifest-registry-_hxKCS2K-CZdeyN0f.mjs";
|
|
11
|
-
import { f as resolveDefaultAgentId, p as resolveSessionAgentId } from "./runtime-snapshot-C54O1-gI-40cbyi7P.mjs";
|
|
12
|
-
import "./runtime-Cym-fqI8-DaSDMH-a.mjs";
|
|
13
|
-
import "./thinking-Bh-7MqXz-D3woGbO7.mjs";
|
|
14
|
-
import { a as normalizeMainKey, i as normalizeAgentId, n as getSubagentDepth, o as parseAgentSessionKey } from "./session-key-Cn2QoOyX-CuHbJMgR.mjs";
|
|
15
|
-
import { a as resolveStorePath } from "./paths-D6msg0S1-C2lYuisN.mjs";
|
|
16
|
-
import "./transcript-E_-ISOkD-DWCfZP2p.mjs";
|
|
17
|
-
import "./delivery-context.shared-j5hC5qb1-CI83RXXZ.mjs";
|
|
18
|
-
import "./command-format-LSnUCVVF-BQ2SMKka.mjs";
|
|
19
|
-
import fs from "node:fs";
|
|
20
|
-
import path from "node:path";
|
|
21
|
-
import "node:fs/promises";
|
|
22
|
-
import "node:crypto";
|
|
23
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/tokens-Dfz45F3S.js
|
|
24
|
-
const SILENT_REPLY_TOKEN = "NO_REPLY";
|
|
25
|
-
const silentExactRegexByToken = /* @__PURE__ */ new Map();
|
|
26
|
-
const silentTrailingRegexByToken = /* @__PURE__ */ new Map();
|
|
27
|
-
const silentLeadingAttachedRegexByToken = /* @__PURE__ */ new Map();
|
|
28
|
-
function getSilentExactRegex(token) {
|
|
29
|
-
const cached = silentExactRegexByToken.get(token);
|
|
30
|
-
if (cached) return cached;
|
|
31
|
-
const escaped = escapeRegExp(token);
|
|
32
|
-
const regex = new RegExp(`^\\s*${escaped}\\s*$`, "i");
|
|
33
|
-
silentExactRegexByToken.set(token, regex);
|
|
34
|
-
return regex;
|
|
35
|
-
}
|
|
36
|
-
function getSilentTrailingRegex(token) {
|
|
37
|
-
const cached = silentTrailingRegexByToken.get(token);
|
|
38
|
-
if (cached) return cached;
|
|
39
|
-
const escaped = escapeRegExp(token);
|
|
40
|
-
const regex = new RegExp(`(?:^|\\s+|\\*+)${escaped}\\s*$`, "i");
|
|
41
|
-
silentTrailingRegexByToken.set(token, regex);
|
|
42
|
-
return regex;
|
|
43
|
-
}
|
|
44
|
-
function isSilentReplyText(text, token = SILENT_REPLY_TOKEN) {
|
|
45
|
-
if (!text) return false;
|
|
46
|
-
return getSilentExactRegex(token).test(text);
|
|
47
|
-
}
|
|
48
|
-
function isSilentReplyEnvelopeText(text, token = SILENT_REPLY_TOKEN) {
|
|
49
|
-
if (!text) return false;
|
|
50
|
-
const trimmed = text.trim();
|
|
51
|
-
if (!trimmed || !trimmed.startsWith("{") || !trimmed.endsWith("}") || !trimmed.includes(token)) return false;
|
|
52
|
-
try {
|
|
53
|
-
const parsed = JSON.parse(trimmed);
|
|
54
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return false;
|
|
55
|
-
const keys = Object.keys(parsed);
|
|
56
|
-
return keys.length === 1 && keys[0] === "action" && typeof parsed.action === "string" && parsed.action.trim() === token;
|
|
57
|
-
} catch {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function isSilentReplyPayloadText(text, token = SILENT_REPLY_TOKEN) {
|
|
62
|
-
return isSilentReplyText(text, token) || isSilentReplyEnvelopeText(text, token);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Strip a trailing silent reply token from mixed-content text.
|
|
66
|
-
* Returns the remaining text with the token removed (trimmed).
|
|
67
|
-
* If the result is empty, the entire message should be treated as silent.
|
|
68
|
-
*/
|
|
69
|
-
function stripSilentToken(text, token = SILENT_REPLY_TOKEN) {
|
|
70
|
-
return text.replace(getSilentTrailingRegex(token), "").trim();
|
|
71
|
-
}
|
|
72
|
-
const silentLeadingRegexByToken = /* @__PURE__ */ new Map();
|
|
73
|
-
function getSilentLeadingAttachedRegex(token) {
|
|
74
|
-
const cached = silentLeadingAttachedRegexByToken.get(token);
|
|
75
|
-
if (cached) return cached;
|
|
76
|
-
const escaped = escapeRegExp(token);
|
|
77
|
-
const regex = new RegExp(`^\\s*(?:${escaped}\\s+)*${escaped}(?=[\\p{L}\\p{N}])`, "iu");
|
|
78
|
-
silentLeadingAttachedRegexByToken.set(token, regex);
|
|
79
|
-
return regex;
|
|
80
|
-
}
|
|
81
|
-
function getSilentLeadingRegex(token) {
|
|
82
|
-
const cached = silentLeadingRegexByToken.get(token);
|
|
83
|
-
if (cached) return cached;
|
|
84
|
-
const escaped = escapeRegExp(token);
|
|
85
|
-
const regex = new RegExp(`^(?:\\s*${escaped})+\\s*`, "i");
|
|
86
|
-
silentLeadingRegexByToken.set(token, regex);
|
|
87
|
-
return regex;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Strip leading silent reply tokens from text.
|
|
91
|
-
* Handles cases like "NO_REPLYThe user is saying..." where the token
|
|
92
|
-
* is not separated from the following text.
|
|
93
|
-
*/
|
|
94
|
-
function stripLeadingSilentToken(text, token = SILENT_REPLY_TOKEN) {
|
|
95
|
-
return text.replace(getSilentLeadingRegex(token), "").trim();
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Check whether text starts with one or more leading silent reply tokens where
|
|
99
|
-
* the final token is glued directly to visible content.
|
|
100
|
-
*/
|
|
101
|
-
function startsWithSilentToken(text, token = SILENT_REPLY_TOKEN) {
|
|
102
|
-
if (!text) return false;
|
|
103
|
-
return getSilentLeadingAttachedRegex(token).test(text);
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/registry-loaded-read-DzkS-do4.js
|
|
107
|
-
function coerceLoadedChannelPlugin(plugin) {
|
|
108
|
-
const id = normalizeOptionalString(plugin?.id) ?? "";
|
|
109
|
-
if (!plugin || !id) return;
|
|
110
|
-
if (!plugin.meta || typeof plugin.meta !== "object") plugin.meta = {};
|
|
111
|
-
return plugin;
|
|
112
|
-
}
|
|
113
|
-
function getLoadedChannelPluginForRead(id) {
|
|
114
|
-
const resolvedId = normalizeOptionalString(id) ?? "";
|
|
115
|
-
if (!resolvedId) return;
|
|
116
|
-
const registry = getActivePluginChannelRegistryFromState();
|
|
117
|
-
if (!registry || !Array.isArray(registry.channels)) return;
|
|
118
|
-
for (const entry of registry.channels) {
|
|
119
|
-
const plugin = coerceLoadedChannelPlugin(entry?.plugin);
|
|
120
|
-
if (plugin && plugin.id === resolvedId) return plugin;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/silent-reply-CSdlYCIT.js
|
|
125
|
-
const DEFAULT_SILENT_REPLY_POLICY = {
|
|
126
|
-
direct: "disallow",
|
|
127
|
-
group: "allow",
|
|
128
|
-
internal: "allow"
|
|
129
|
-
};
|
|
130
|
-
const DEFAULT_SILENT_REPLY_REWRITE = {
|
|
131
|
-
direct: true,
|
|
132
|
-
group: false,
|
|
133
|
-
internal: false
|
|
134
|
-
};
|
|
135
|
-
const SILENT_REPLY_REWRITE_TEXTS = [
|
|
136
|
-
"Nothing to add right now.",
|
|
137
|
-
"All quiet on my side.",
|
|
138
|
-
"No extra notes from me.",
|
|
139
|
-
"Standing by.",
|
|
140
|
-
"No update from me on this one.",
|
|
141
|
-
"Nothing further to report.",
|
|
142
|
-
"I have nothing else to add.",
|
|
143
|
-
"No follow-up needed from me.",
|
|
144
|
-
"No additional reply from me here.",
|
|
145
|
-
"No extra comment on my end.",
|
|
146
|
-
"No further note from me.",
|
|
147
|
-
"That is all from me for now.",
|
|
148
|
-
"No added response from me.",
|
|
149
|
-
"Nothing else to say here.",
|
|
150
|
-
"No extra message needed from me.",
|
|
151
|
-
"No additional note on this one.",
|
|
152
|
-
"No further response from me.",
|
|
153
|
-
"Nothing new to add from my side.",
|
|
154
|
-
"No extra update from me.",
|
|
155
|
-
"I have no further reply here.",
|
|
156
|
-
"Nothing additional from me.",
|
|
157
|
-
"No added note from my side.",
|
|
158
|
-
"No more to report from me.",
|
|
159
|
-
"No extra reply needed here.",
|
|
160
|
-
"No further word from me.",
|
|
161
|
-
"Nothing further on my end.",
|
|
162
|
-
"No extra answer from me.",
|
|
163
|
-
"No additional response from my side."
|
|
164
|
-
];
|
|
165
|
-
function hashSeed(seed) {
|
|
166
|
-
let hash = 0;
|
|
167
|
-
for (let index = 0; index < seed.length; index += 1) hash = hash * 31 + seed.charCodeAt(index) >>> 0;
|
|
168
|
-
return hash;
|
|
169
|
-
}
|
|
170
|
-
function classifySilentReplyConversationType(params) {
|
|
171
|
-
if (params.conversationType) return params.conversationType;
|
|
172
|
-
const normalizedSessionKey = normalizeLowercaseStringOrEmpty(params.sessionKey);
|
|
173
|
-
if (normalizedSessionKey.includes(":group:") || normalizedSessionKey.includes(":channel:")) return "group";
|
|
174
|
-
if (normalizedSessionKey.includes(":direct:") || normalizedSessionKey.includes(":dm:")) return "direct";
|
|
175
|
-
if (normalizeLowercaseStringOrEmpty(params.surface) === "webchat") return "direct";
|
|
176
|
-
return "internal";
|
|
177
|
-
}
|
|
178
|
-
function resolveSilentReplyPolicyFromPolicies(params) {
|
|
179
|
-
return params.surfacePolicy?.[params.conversationType] ?? params.defaultPolicy?.[params.conversationType] ?? DEFAULT_SILENT_REPLY_POLICY[params.conversationType];
|
|
180
|
-
}
|
|
181
|
-
function resolveSilentReplyRewriteFromPolicies(params) {
|
|
182
|
-
return params.surfaceRewrite?.[params.conversationType] ?? params.defaultRewrite?.[params.conversationType] ?? DEFAULT_SILENT_REPLY_REWRITE[params.conversationType];
|
|
183
|
-
}
|
|
184
|
-
function resolveSilentReplyRewriteText(params) {
|
|
185
|
-
return SILENT_REPLY_REWRITE_TEXTS[hashSeed(params.seed?.trim() || "silent-reply") % SILENT_REPLY_REWRITE_TEXTS.length] ?? SILENT_REPLY_REWRITE_TEXTS[0];
|
|
186
|
-
}
|
|
187
|
-
function resolveSilentReplyConversationContext(params) {
|
|
188
|
-
const conversationType = classifySilentReplyConversationType({
|
|
189
|
-
sessionKey: params.sessionKey,
|
|
190
|
-
surface: params.surface,
|
|
191
|
-
conversationType: params.conversationType
|
|
192
|
-
});
|
|
193
|
-
const normalizedSurface = normalizeLowercaseStringOrEmpty(params.surface);
|
|
194
|
-
const surface = normalizedSurface ? params.cfg?.surfaces?.[normalizedSurface] : void 0;
|
|
195
|
-
return {
|
|
196
|
-
conversationType,
|
|
197
|
-
defaultPolicy: params.cfg?.agents?.defaults?.silentReply,
|
|
198
|
-
defaultRewrite: params.cfg?.agents?.defaults?.silentReplyRewrite,
|
|
199
|
-
surfacePolicy: surface?.silentReply,
|
|
200
|
-
surfaceRewrite: surface?.silentReplyRewrite
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function resolveSilentReplySettings(params) {
|
|
204
|
-
const context = resolveSilentReplyConversationContext(params);
|
|
205
|
-
return {
|
|
206
|
-
policy: resolveSilentReplyPolicyFromPolicies(context),
|
|
207
|
-
rewrite: resolveSilentReplyRewriteFromPolicies(context)
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/payload-BBeNQmgo.js
|
|
212
|
-
function normalizeButtonStyle(value) {
|
|
213
|
-
const style = normalizeOptionalLowercaseString(value);
|
|
214
|
-
return style === "primary" || style === "secondary" || style === "success" || style === "danger" ? style : void 0;
|
|
215
|
-
}
|
|
216
|
-
function normalizePresentationTone(value) {
|
|
217
|
-
const tone = normalizeOptionalLowercaseString(value);
|
|
218
|
-
return tone === "info" || tone === "success" || tone === "warning" || tone === "danger" || tone === "neutral" ? tone : void 0;
|
|
219
|
-
}
|
|
220
|
-
function normalizeInteractiveButton(raw) {
|
|
221
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
222
|
-
const record = raw;
|
|
223
|
-
const label = normalizeOptionalString(record.label) ?? normalizeOptionalString(record.text);
|
|
224
|
-
const value = normalizeOptionalString(record.value) ?? normalizeOptionalString(record.callbackData) ?? normalizeOptionalString(record.callback_data);
|
|
225
|
-
const url = normalizeOptionalString(record.url);
|
|
226
|
-
if (!label || !value && !url) return;
|
|
227
|
-
return {
|
|
228
|
-
label,
|
|
229
|
-
...value ? { value } : {},
|
|
230
|
-
...url ? { url } : {},
|
|
231
|
-
style: normalizeButtonStyle(record.style)
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function normalizeInteractiveOption(raw) {
|
|
235
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
236
|
-
const record = raw;
|
|
237
|
-
const label = normalizeOptionalString(record.label) ?? normalizeOptionalString(record.text);
|
|
238
|
-
const value = normalizeOptionalString(record.value);
|
|
239
|
-
if (!label || !value) return;
|
|
240
|
-
return {
|
|
241
|
-
label,
|
|
242
|
-
value
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
function normalizeInteractiveBlock(raw) {
|
|
246
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
247
|
-
const record = raw;
|
|
248
|
-
const type = normalizeOptionalLowercaseString(record.type);
|
|
249
|
-
if (type === "text") {
|
|
250
|
-
const text = normalizeOptionalString(record.text);
|
|
251
|
-
return text ? {
|
|
252
|
-
type: "text",
|
|
253
|
-
text
|
|
254
|
-
} : void 0;
|
|
255
|
-
}
|
|
256
|
-
if (type === "buttons") {
|
|
257
|
-
const buttons = Array.isArray(record.buttons) ? record.buttons.map((entry) => normalizeInteractiveButton(entry)).filter((entry) => Boolean(entry)) : [];
|
|
258
|
-
return buttons.length > 0 ? {
|
|
259
|
-
type: "buttons",
|
|
260
|
-
buttons
|
|
261
|
-
} : void 0;
|
|
262
|
-
}
|
|
263
|
-
if (type === "select") {
|
|
264
|
-
const options = Array.isArray(record.options) ? record.options.map((entry) => normalizeInteractiveOption(entry)).filter((entry) => Boolean(entry)) : [];
|
|
265
|
-
return options.length > 0 ? {
|
|
266
|
-
type: "select",
|
|
267
|
-
placeholder: normalizeOptionalString(record.placeholder),
|
|
268
|
-
options
|
|
269
|
-
} : void 0;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
function normalizeInteractiveReply(raw) {
|
|
273
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
274
|
-
const record = raw;
|
|
275
|
-
const blocks = Array.isArray(record.blocks) ? record.blocks.map((entry) => normalizeInteractiveBlock(entry)).filter((entry) => Boolean(entry)) : [];
|
|
276
|
-
return blocks.length > 0 ? { blocks } : void 0;
|
|
277
|
-
}
|
|
278
|
-
function normalizePresentationButton(raw) {
|
|
279
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
280
|
-
const record = raw;
|
|
281
|
-
const label = normalizeOptionalString(record.label) ?? normalizeOptionalString(record.text);
|
|
282
|
-
const value = normalizeOptionalString(record.value) ?? normalizeOptionalString(record.callbackData) ?? normalizeOptionalString(record.callback_data);
|
|
283
|
-
const url = normalizeOptionalString(record.url);
|
|
284
|
-
if (!label || !value && !url) return;
|
|
285
|
-
return {
|
|
286
|
-
label,
|
|
287
|
-
...value ? { value } : {},
|
|
288
|
-
...url ? { url } : {},
|
|
289
|
-
style: normalizeButtonStyle(record.style)
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
function normalizePresentationOption(raw) {
|
|
293
|
-
const option = normalizeInteractiveOption(raw);
|
|
294
|
-
return option ? {
|
|
295
|
-
label: option.label,
|
|
296
|
-
value: option.value
|
|
297
|
-
} : void 0;
|
|
298
|
-
}
|
|
299
|
-
function normalizePresentationBlock(raw) {
|
|
300
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
301
|
-
const record = raw;
|
|
302
|
-
const type = normalizeOptionalLowercaseString(record.type);
|
|
303
|
-
if (type === "text" || type === "context") {
|
|
304
|
-
const text = normalizeOptionalString(record.text);
|
|
305
|
-
return text ? {
|
|
306
|
-
type,
|
|
307
|
-
text
|
|
308
|
-
} : void 0;
|
|
309
|
-
}
|
|
310
|
-
if (type === "divider") return { type: "divider" };
|
|
311
|
-
if (type === "buttons") {
|
|
312
|
-
const buttons = Array.isArray(record.buttons) ? record.buttons.map((entry) => normalizePresentationButton(entry)).filter((entry) => Boolean(entry)) : [];
|
|
313
|
-
return buttons.length > 0 ? {
|
|
314
|
-
type: "buttons",
|
|
315
|
-
buttons
|
|
316
|
-
} : void 0;
|
|
317
|
-
}
|
|
318
|
-
if (type === "select") {
|
|
319
|
-
const options = Array.isArray(record.options) ? record.options.map((entry) => normalizePresentationOption(entry)).filter((entry) => Boolean(entry)) : [];
|
|
320
|
-
return options.length > 0 ? {
|
|
321
|
-
type: "select",
|
|
322
|
-
placeholder: normalizeOptionalString(record.placeholder),
|
|
323
|
-
options
|
|
324
|
-
} : void 0;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
function normalizeMessagePresentation(raw) {
|
|
328
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
329
|
-
const record = raw;
|
|
330
|
-
const blocks = Array.isArray(record.blocks) ? record.blocks.map((entry) => normalizePresentationBlock(entry)).filter((entry) => Boolean(entry)) : [];
|
|
331
|
-
const title = normalizeOptionalString(record.title);
|
|
332
|
-
if (!title && blocks.length === 0) return;
|
|
333
|
-
return {
|
|
334
|
-
...title ? { title } : {},
|
|
335
|
-
tone: normalizePresentationTone(record.tone),
|
|
336
|
-
blocks
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
function hasInteractiveReplyBlocks(value) {
|
|
340
|
-
return Boolean(normalizeInteractiveReply(value));
|
|
341
|
-
}
|
|
342
|
-
function hasMessagePresentationBlocks(value) {
|
|
343
|
-
return Boolean(normalizeMessagePresentation(value));
|
|
344
|
-
}
|
|
345
|
-
function renderMessagePresentationFallbackText(params) {
|
|
346
|
-
const lines = [];
|
|
347
|
-
const text = normalizeOptionalString(params.text);
|
|
348
|
-
if (text) lines.push(text);
|
|
349
|
-
const presentation = params.presentation;
|
|
350
|
-
if (!presentation) return lines.join("\n\n");
|
|
351
|
-
if (presentation.title) lines.push(presentation.title);
|
|
352
|
-
for (const block of presentation.blocks) {
|
|
353
|
-
if (block.type === "text" || block.type === "context") {
|
|
354
|
-
lines.push(block.text);
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
if (block.type === "buttons") {
|
|
358
|
-
const labels = block.buttons.map((button) => button.url ? `${button.label}: ${button.url}` : button.label).filter(Boolean);
|
|
359
|
-
if (labels.length > 0) lines.push(labels.map((label) => `- ${label}`).join("\n"));
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
if (block.type === "select") {
|
|
363
|
-
const labels = block.options.map((option) => option.label).filter(Boolean);
|
|
364
|
-
if (labels.length > 0) {
|
|
365
|
-
const heading = block.placeholder ? `${block.placeholder}:` : "Options:";
|
|
366
|
-
lines.push(`${heading}\n${labels.map((label) => `- ${label}`).join("\n")}`);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return lines.join("\n\n");
|
|
371
|
-
}
|
|
372
|
-
function hasReplyChannelData(value) {
|
|
373
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0);
|
|
374
|
-
}
|
|
375
|
-
function hasReplyContent(params) {
|
|
376
|
-
const text = normalizeOptionalString(params.text);
|
|
377
|
-
const mediaUrl = normalizeOptionalString(params.mediaUrl);
|
|
378
|
-
return Boolean(text || mediaUrl || params.mediaUrls?.some((entry) => Boolean(normalizeOptionalString(entry))) || hasMessagePresentationBlocks(params.presentation) || hasInteractiveReplyBlocks(params.interactive) || params.hasChannelData || params.extraContent);
|
|
379
|
-
}
|
|
380
|
-
function hasReplyPayloadContent(payload, options) {
|
|
381
|
-
return hasReplyContent({
|
|
382
|
-
text: options?.trimText ? payload.text?.trim() : payload.text,
|
|
383
|
-
mediaUrl: payload.mediaUrl,
|
|
384
|
-
mediaUrls: payload.mediaUrls,
|
|
385
|
-
interactive: payload.interactive,
|
|
386
|
-
presentation: payload.presentation,
|
|
387
|
-
hasChannelData: options?.hasChannelData ?? hasReplyChannelData(payload.channelData),
|
|
388
|
-
extraContent: options?.extraContent
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/main-session-B78uK7Dt.js
|
|
393
|
-
const FALLBACK_DEFAULT_AGENT_ID = "main";
|
|
394
|
-
function buildMainSessionKey(agentId, mainKey) {
|
|
395
|
-
return `agent:${normalizeAgentId(agentId)}:${normalizeMainKey(mainKey)}`;
|
|
396
|
-
}
|
|
397
|
-
function resolveMainSessionKey(cfg) {
|
|
398
|
-
if (cfg?.session?.scope === "global") return "global";
|
|
399
|
-
const agents = cfg?.agents?.list ?? [];
|
|
400
|
-
return buildMainSessionKey(agents.find((agent) => agent?.default)?.id ?? agents[0]?.id ?? FALLBACK_DEFAULT_AGENT_ID, cfg?.session?.mainKey);
|
|
401
|
-
}
|
|
402
|
-
const CORE_TOOL_DEFINITIONS = [
|
|
403
|
-
{
|
|
404
|
-
id: "read",
|
|
405
|
-
label: "read",
|
|
406
|
-
description: "Read file contents",
|
|
407
|
-
sectionId: "fs",
|
|
408
|
-
profiles: ["coding"]
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
id: "write",
|
|
412
|
-
label: "write",
|
|
413
|
-
description: "Create or overwrite files",
|
|
414
|
-
sectionId: "fs",
|
|
415
|
-
profiles: ["coding"]
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
id: "edit",
|
|
419
|
-
label: "edit",
|
|
420
|
-
description: "Make precise edits",
|
|
421
|
-
sectionId: "fs",
|
|
422
|
-
profiles: ["coding"]
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
id: "apply_patch",
|
|
426
|
-
label: "apply_patch",
|
|
427
|
-
description: "Patch files",
|
|
428
|
-
sectionId: "fs",
|
|
429
|
-
profiles: ["coding"]
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
id: "exec",
|
|
433
|
-
label: "exec",
|
|
434
|
-
description: "Run shell commands that start now.",
|
|
435
|
-
sectionId: "runtime",
|
|
436
|
-
profiles: ["coding"]
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
id: "process",
|
|
440
|
-
label: "process",
|
|
441
|
-
description: "Inspect and control running exec sessions.",
|
|
442
|
-
sectionId: "runtime",
|
|
443
|
-
profiles: ["coding"]
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
id: "code_execution",
|
|
447
|
-
label: "code_execution",
|
|
448
|
-
description: "Run sandboxed remote analysis",
|
|
449
|
-
sectionId: "runtime",
|
|
450
|
-
profiles: ["coding"],
|
|
451
|
-
includeInOpenClawGroup: true
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
id: "web_search",
|
|
455
|
-
label: "web_search",
|
|
456
|
-
description: "Search the web",
|
|
457
|
-
sectionId: "web",
|
|
458
|
-
profiles: ["coding"],
|
|
459
|
-
includeInOpenClawGroup: true
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
id: "web_fetch",
|
|
463
|
-
label: "web_fetch",
|
|
464
|
-
description: "Fetch web content",
|
|
465
|
-
sectionId: "web",
|
|
466
|
-
profiles: ["coding"],
|
|
467
|
-
includeInOpenClawGroup: true
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
id: "x_search",
|
|
471
|
-
label: "x_search",
|
|
472
|
-
description: "Search X posts",
|
|
473
|
-
sectionId: "web",
|
|
474
|
-
profiles: ["coding"],
|
|
475
|
-
includeInOpenClawGroup: true
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
id: "memory_search",
|
|
479
|
-
label: "memory_search",
|
|
480
|
-
description: "Semantic search",
|
|
481
|
-
sectionId: "memory",
|
|
482
|
-
profiles: ["coding"],
|
|
483
|
-
includeInOpenClawGroup: true
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
id: "memory_get",
|
|
487
|
-
label: "memory_get",
|
|
488
|
-
description: "Read memory files",
|
|
489
|
-
sectionId: "memory",
|
|
490
|
-
profiles: ["coding"],
|
|
491
|
-
includeInOpenClawGroup: true
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
id: "sessions_list",
|
|
495
|
-
label: "sessions_list",
|
|
496
|
-
description: "List visible sessions with mailbox filters and optional previews.",
|
|
497
|
-
sectionId: "sessions",
|
|
498
|
-
profiles: ["coding", "messaging"],
|
|
499
|
-
includeInOpenClawGroup: true
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
id: "sessions_history",
|
|
503
|
-
label: "sessions_history",
|
|
504
|
-
description: "Read sanitized message history for a visible session.",
|
|
505
|
-
sectionId: "sessions",
|
|
506
|
-
profiles: ["coding", "messaging"],
|
|
507
|
-
includeInOpenClawGroup: true
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
id: "sessions_send",
|
|
511
|
-
label: "sessions_send",
|
|
512
|
-
description: "Send a message to another visible session.",
|
|
513
|
-
sectionId: "sessions",
|
|
514
|
-
profiles: ["coding", "messaging"],
|
|
515
|
-
includeInOpenClawGroup: true
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
id: "sessions_spawn",
|
|
519
|
-
label: "sessions_spawn",
|
|
520
|
-
description: "Spawn sub-agent or ACP sessions.",
|
|
521
|
-
sectionId: "sessions",
|
|
522
|
-
profiles: ["coding"],
|
|
523
|
-
includeInOpenClawGroup: true
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
id: "sessions_yield",
|
|
527
|
-
label: "sessions_yield",
|
|
528
|
-
description: "End turn to receive sub-agent results",
|
|
529
|
-
sectionId: "sessions",
|
|
530
|
-
profiles: ["coding"],
|
|
531
|
-
includeInOpenClawGroup: true
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
id: "subagents",
|
|
535
|
-
label: "subagents",
|
|
536
|
-
description: "Manage sub-agents",
|
|
537
|
-
sectionId: "sessions",
|
|
538
|
-
profiles: ["coding"],
|
|
539
|
-
includeInOpenClawGroup: true
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
id: "session_status",
|
|
543
|
-
label: "session_status",
|
|
544
|
-
description: "Show session status, usage, and model state.",
|
|
545
|
-
sectionId: "sessions",
|
|
546
|
-
profiles: [
|
|
547
|
-
"minimal",
|
|
548
|
-
"coding",
|
|
549
|
-
"messaging"
|
|
550
|
-
],
|
|
551
|
-
includeInOpenClawGroup: true
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
id: "browser",
|
|
555
|
-
label: "browser",
|
|
556
|
-
description: "Control web browser",
|
|
557
|
-
sectionId: "ui",
|
|
558
|
-
profiles: [],
|
|
559
|
-
includeInOpenClawGroup: true
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
id: "canvas",
|
|
563
|
-
label: "canvas",
|
|
564
|
-
description: "Control canvases",
|
|
565
|
-
sectionId: "ui",
|
|
566
|
-
profiles: [],
|
|
567
|
-
includeInOpenClawGroup: true
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
id: "message",
|
|
571
|
-
label: "message",
|
|
572
|
-
description: "Send messages",
|
|
573
|
-
sectionId: "messaging",
|
|
574
|
-
profiles: ["messaging"],
|
|
575
|
-
includeInOpenClawGroup: true
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
id: "cron",
|
|
579
|
-
label: "cron",
|
|
580
|
-
description: "Schedule cron jobs, reminders, and wake events.",
|
|
581
|
-
sectionId: "automation",
|
|
582
|
-
profiles: ["coding"],
|
|
583
|
-
includeInOpenClawGroup: true
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
id: "gateway",
|
|
587
|
-
label: "gateway",
|
|
588
|
-
description: "Gateway control",
|
|
589
|
-
sectionId: "automation",
|
|
590
|
-
profiles: [],
|
|
591
|
-
includeInOpenClawGroup: true
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
id: "nodes",
|
|
595
|
-
label: "nodes",
|
|
596
|
-
description: "Nodes + devices",
|
|
597
|
-
sectionId: "nodes",
|
|
598
|
-
profiles: [],
|
|
599
|
-
includeInOpenClawGroup: true
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
id: "agents_list",
|
|
603
|
-
label: "agents_list",
|
|
604
|
-
description: "List agents",
|
|
605
|
-
sectionId: "agents",
|
|
606
|
-
profiles: [],
|
|
607
|
-
includeInOpenClawGroup: true
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
id: "update_plan",
|
|
611
|
-
label: "update_plan",
|
|
612
|
-
description: "Track a short structured work plan.",
|
|
613
|
-
sectionId: "agents",
|
|
614
|
-
profiles: ["coding"],
|
|
615
|
-
includeInOpenClawGroup: true
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
id: "image",
|
|
619
|
-
label: "image",
|
|
620
|
-
description: "Image understanding",
|
|
621
|
-
sectionId: "media",
|
|
622
|
-
profiles: ["coding"],
|
|
623
|
-
includeInOpenClawGroup: true
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
id: "image_generate",
|
|
627
|
-
label: "image_generate",
|
|
628
|
-
description: "Image generation",
|
|
629
|
-
sectionId: "media",
|
|
630
|
-
profiles: ["coding"],
|
|
631
|
-
includeInOpenClawGroup: true
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
id: "music_generate",
|
|
635
|
-
label: "music_generate",
|
|
636
|
-
description: "Music generation",
|
|
637
|
-
sectionId: "media",
|
|
638
|
-
profiles: ["coding"],
|
|
639
|
-
includeInOpenClawGroup: true
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
id: "video_generate",
|
|
643
|
-
label: "video_generate",
|
|
644
|
-
description: "Video generation",
|
|
645
|
-
sectionId: "media",
|
|
646
|
-
profiles: ["coding"],
|
|
647
|
-
includeInOpenClawGroup: true
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
id: "tts",
|
|
651
|
-
label: "tts",
|
|
652
|
-
description: "Text-to-speech conversion",
|
|
653
|
-
sectionId: "media",
|
|
654
|
-
profiles: [],
|
|
655
|
-
includeInOpenClawGroup: true
|
|
656
|
-
}
|
|
657
|
-
];
|
|
658
|
-
new Map(CORE_TOOL_DEFINITIONS.map((tool) => [tool.id, tool]));
|
|
659
|
-
function listCoreToolIdsForProfile(profile) {
|
|
660
|
-
return CORE_TOOL_DEFINITIONS.filter((tool) => tool.profiles.includes(profile)).map((tool) => tool.id);
|
|
661
|
-
}
|
|
662
|
-
const CORE_TOOL_PROFILES = {
|
|
663
|
-
minimal: { allow: listCoreToolIdsForProfile("minimal") },
|
|
664
|
-
coding: { allow: [...listCoreToolIdsForProfile("coding"), "bundle-mcp"] },
|
|
665
|
-
messaging: { allow: [...listCoreToolIdsForProfile("messaging"), "bundle-mcp"] },
|
|
666
|
-
full: {}
|
|
667
|
-
};
|
|
668
|
-
function buildCoreToolGroupMap() {
|
|
669
|
-
const sectionToolMap = /* @__PURE__ */ new Map();
|
|
670
|
-
for (const tool of CORE_TOOL_DEFINITIONS) {
|
|
671
|
-
const groupId = `group:${tool.sectionId}`;
|
|
672
|
-
const list = sectionToolMap.get(groupId) ?? [];
|
|
673
|
-
list.push(tool.id);
|
|
674
|
-
sectionToolMap.set(groupId, list);
|
|
675
|
-
}
|
|
676
|
-
return {
|
|
677
|
-
"group:openclaw": CORE_TOOL_DEFINITIONS.filter((tool) => tool.includeInOpenClawGroup).map((tool) => tool.id),
|
|
678
|
-
...Object.fromEntries(sectionToolMap.entries())
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
const CORE_TOOL_GROUPS = buildCoreToolGroupMap();
|
|
682
|
-
function resolveCoreToolProfilePolicy(profile) {
|
|
683
|
-
if (!profile) return;
|
|
684
|
-
const resolved = CORE_TOOL_PROFILES[profile];
|
|
685
|
-
if (!resolved) return;
|
|
686
|
-
if (!resolved.allow && !resolved.deny) return;
|
|
687
|
-
return {
|
|
688
|
-
allow: resolved.allow ? [...resolved.allow] : void 0,
|
|
689
|
-
deny: resolved.deny ? [...resolved.deny] : void 0
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
const TOOL_NAME_ALIASES = {
|
|
693
|
-
bash: "exec",
|
|
694
|
-
"apply-patch": "apply_patch"
|
|
695
|
-
};
|
|
696
|
-
const TOOL_GROUPS = { ...CORE_TOOL_GROUPS };
|
|
697
|
-
function normalizeToolName(name) {
|
|
698
|
-
const normalized = normalizeLowercaseStringOrEmpty(name);
|
|
699
|
-
return TOOL_NAME_ALIASES[normalized] ?? normalized;
|
|
700
|
-
}
|
|
701
|
-
function normalizeToolList(list) {
|
|
702
|
-
if (!list) return [];
|
|
703
|
-
return list.map(normalizeToolName).filter(Boolean);
|
|
704
|
-
}
|
|
705
|
-
function expandToolGroups(list) {
|
|
706
|
-
const normalized = normalizeToolList(list);
|
|
707
|
-
const expanded = [];
|
|
708
|
-
for (const value of normalized) {
|
|
709
|
-
const group = TOOL_GROUPS[value];
|
|
710
|
-
if (group) {
|
|
711
|
-
expanded.push(...group);
|
|
712
|
-
continue;
|
|
713
|
-
}
|
|
714
|
-
expanded.push(value);
|
|
715
|
-
}
|
|
716
|
-
return Array.from(new Set(expanded));
|
|
717
|
-
}
|
|
718
|
-
function resolveToolProfilePolicy(profile) {
|
|
719
|
-
return resolveCoreToolProfilePolicy(profile);
|
|
720
|
-
}
|
|
721
|
-
function mergeAlsoAllowPolicy(policy, alsoAllow) {
|
|
722
|
-
if (!policy?.allow || !Array.isArray(alsoAllow) || alsoAllow.length === 0) return policy;
|
|
723
|
-
return {
|
|
724
|
-
...policy,
|
|
725
|
-
allow: Array.from(new Set([...policy.allow, ...alsoAllow]))
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
path.join(STATE_DIR, "sandboxes");
|
|
729
|
-
[...CHANNEL_IDS];
|
|
730
|
-
const SANDBOX_STATE_DIR = path.join(STATE_DIR, "sandbox");
|
|
731
|
-
path.join(SANDBOX_STATE_DIR, "containers.json");
|
|
732
|
-
path.join(SANDBOX_STATE_DIR, "browsers.json");
|
|
733
|
-
//#endregion
|
|
734
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/glob-pattern-BclDUhwX.js
|
|
735
|
-
function escapeRegex(value) {
|
|
736
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
737
|
-
}
|
|
738
|
-
function compileGlobPattern(params) {
|
|
739
|
-
const normalized = params.normalize(params.raw);
|
|
740
|
-
if (!normalized) return {
|
|
741
|
-
kind: "exact",
|
|
742
|
-
value: ""
|
|
743
|
-
};
|
|
744
|
-
if (normalized === "*") return { kind: "all" };
|
|
745
|
-
if (!normalized.includes("*")) return {
|
|
746
|
-
kind: "exact",
|
|
747
|
-
value: normalized
|
|
748
|
-
};
|
|
749
|
-
return {
|
|
750
|
-
kind: "regex",
|
|
751
|
-
value: new RegExp(`^${escapeRegex(normalized).replaceAll("\\*", ".*")}$`)
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
function compileGlobPatterns(params) {
|
|
755
|
-
if (!Array.isArray(params.raw)) return [];
|
|
756
|
-
return params.raw.map((raw) => compileGlobPattern({
|
|
757
|
-
raw,
|
|
758
|
-
normalize: params.normalize
|
|
759
|
-
})).filter((pattern) => pattern.kind !== "exact" || pattern.value);
|
|
760
|
-
}
|
|
761
|
-
function matchesAnyGlobPattern(value, patterns) {
|
|
762
|
-
for (const pattern of patterns) {
|
|
763
|
-
if (pattern.kind === "all") return true;
|
|
764
|
-
if (pattern.kind === "exact" && value === pattern.value) return true;
|
|
765
|
-
if (pattern.kind === "regex" && pattern.value.test(value)) return true;
|
|
766
|
-
}
|
|
767
|
-
return false;
|
|
768
|
-
}
|
|
769
|
-
//#endregion
|
|
770
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/session-context-SMJ8NYHX.js
|
|
771
|
-
function buildOutboundSessionContext(params) {
|
|
772
|
-
const key = normalizeOptionalString(params.sessionKey);
|
|
773
|
-
const policyKey = normalizeOptionalString(params.policySessionKey);
|
|
774
|
-
const explicitAgentId = normalizeOptionalString(params.agentId);
|
|
775
|
-
const requesterAccountId = normalizeOptionalString(params.requesterAccountId);
|
|
776
|
-
const requesterSenderId = normalizeOptionalString(params.requesterSenderId);
|
|
777
|
-
const requesterSenderName = normalizeOptionalString(params.requesterSenderName);
|
|
778
|
-
const requesterSenderUsername = normalizeOptionalString(params.requesterSenderUsername);
|
|
779
|
-
const requesterSenderE164 = normalizeOptionalString(params.requesterSenderE164);
|
|
780
|
-
const derivedAgentId = key ? resolveSessionAgentId({
|
|
781
|
-
sessionKey: key,
|
|
782
|
-
config: params.cfg
|
|
783
|
-
}) : void 0;
|
|
784
|
-
const agentId = explicitAgentId ?? derivedAgentId;
|
|
785
|
-
if (!key && !policyKey && !agentId && !requesterAccountId && !requesterSenderId && !requesterSenderName && !requesterSenderUsername && !requesterSenderE164) return;
|
|
786
|
-
return {
|
|
787
|
-
...key ? { key } : {},
|
|
788
|
-
...policyKey ? { policyKey } : {},
|
|
789
|
-
...agentId ? { agentId } : {},
|
|
790
|
-
...requesterAccountId ? { requesterAccountId } : {},
|
|
791
|
-
...requesterSenderId ? { requesterSenderId } : {},
|
|
792
|
-
...requesterSenderName ? { requesterSenderName } : {},
|
|
793
|
-
...requesterSenderUsername ? { requesterSenderUsername } : {},
|
|
794
|
-
...requesterSenderE164 ? { requesterSenderE164 } : {}
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
//#endregion
|
|
798
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/directive-tags-DBhdh5UC.js
|
|
799
|
-
const AUDIO_TAG_RE = /\[\[\s*audio_as_voice\s*\]\]/gi;
|
|
800
|
-
const REPLY_TAG_RE = /\[\[\s*(?:reply_to_current|reply_to\s*:\s*([^\]\n]+))\s*\]\]/gi;
|
|
801
|
-
function replacementPreservesWordBoundary(source, offset, length) {
|
|
802
|
-
const before = source[offset - 1];
|
|
803
|
-
const after = source[offset + length];
|
|
804
|
-
return before && after && !/\s/u.test(before) && !/\s/u.test(after) ? " " : "";
|
|
805
|
-
}
|
|
806
|
-
const BLOCK_SENTINEL_SEED = "";
|
|
807
|
-
function createBlockSentinel(text) {
|
|
808
|
-
let sentinel = BLOCK_SENTINEL_SEED;
|
|
809
|
-
while (text.includes(sentinel)) sentinel += BLOCK_SENTINEL_SEED;
|
|
810
|
-
return sentinel;
|
|
811
|
-
}
|
|
812
|
-
function normalizeDirectiveWhitespace(text) {
|
|
813
|
-
const blockSentinel = createBlockSentinel(text);
|
|
814
|
-
const blockPlaceholderRe = new RegExp(`${blockSentinel}(\\d+)${blockSentinel}`, "g");
|
|
815
|
-
const blocks = [];
|
|
816
|
-
return text.replace(/(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n\1[^\n]*|(?:(?:^|\n)(?: |\t)[^\n]*)+/gm, (block) => {
|
|
817
|
-
blocks.push(block);
|
|
818
|
-
return `${blockSentinel}${blocks.length - 1}${blockSentinel}`;
|
|
819
|
-
}).replace(/\r\n/g, "\n").replace(/([^\s])[ \t]{2,}([^\s])/g, "$1 $2").replace(/^\n+/, "").replace(/^[ \t](?=\S)/, "").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trimEnd().replace(blockPlaceholderRe, (_, i) => blocks[Number(i)]);
|
|
820
|
-
}
|
|
821
|
-
function parseInlineDirectives(text, options = {}) {
|
|
822
|
-
const { currentMessageId, stripAudioTag = true, stripReplyTags = true } = options;
|
|
823
|
-
if (!text) return {
|
|
824
|
-
text: "",
|
|
825
|
-
audioAsVoice: false,
|
|
826
|
-
replyToCurrent: false,
|
|
827
|
-
hasAudioTag: false,
|
|
828
|
-
hasReplyTag: false
|
|
829
|
-
};
|
|
830
|
-
if (!text.includes("[[")) return {
|
|
831
|
-
text: normalizeDirectiveWhitespace(text),
|
|
832
|
-
audioAsVoice: false,
|
|
833
|
-
replyToCurrent: false,
|
|
834
|
-
hasAudioTag: false,
|
|
835
|
-
hasReplyTag: false
|
|
836
|
-
};
|
|
837
|
-
let cleaned = text;
|
|
838
|
-
let audioAsVoice = false;
|
|
839
|
-
let hasAudioTag = false;
|
|
840
|
-
let hasReplyTag = false;
|
|
841
|
-
let sawCurrent = false;
|
|
842
|
-
let lastExplicitId;
|
|
843
|
-
cleaned = cleaned.replace(AUDIO_TAG_RE, (match, offset, source) => {
|
|
844
|
-
audioAsVoice = true;
|
|
845
|
-
hasAudioTag = true;
|
|
846
|
-
return stripAudioTag ? replacementPreservesWordBoundary(source, offset, match.length) : match;
|
|
847
|
-
});
|
|
848
|
-
cleaned = cleaned.replace(REPLY_TAG_RE, (match, idRaw, offset, source) => {
|
|
849
|
-
hasReplyTag = true;
|
|
850
|
-
if (idRaw === void 0) sawCurrent = true;
|
|
851
|
-
else {
|
|
852
|
-
const id = idRaw.trim();
|
|
853
|
-
if (id) lastExplicitId = id;
|
|
854
|
-
}
|
|
855
|
-
return stripReplyTags ? replacementPreservesWordBoundary(source, offset, match.length) : match;
|
|
856
|
-
});
|
|
857
|
-
cleaned = normalizeDirectiveWhitespace(cleaned);
|
|
858
|
-
const replyToId = lastExplicitId ?? (sawCurrent ? normalizeOptionalString(currentMessageId) : void 0);
|
|
859
|
-
return {
|
|
860
|
-
text: cleaned,
|
|
861
|
-
audioAsVoice,
|
|
862
|
-
replyToId,
|
|
863
|
-
replyToExplicitId: lastExplicitId,
|
|
864
|
-
replyToCurrent: sawCurrent,
|
|
865
|
-
hasAudioTag,
|
|
866
|
-
hasReplyTag
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
resolveNodeRequireFromMeta(import.meta.url);
|
|
870
|
-
createSubsystemLogger("errors");
|
|
871
|
-
createSubsystemLogger("agents/tool-images");
|
|
872
|
-
//#endregion
|
|
873
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/reply-payloads-sQYfT3-G.js
|
|
874
|
-
function formatBtwTextForExternalDelivery(payload) {
|
|
875
|
-
const text = normalizeOptionalString(payload.text);
|
|
876
|
-
if (!text) return payload.text;
|
|
877
|
-
const question = normalizeOptionalString(payload.btw?.question);
|
|
878
|
-
if (!question) return payload.text;
|
|
879
|
-
const formatted = `BTW\nQuestion: ${question}\n\n${text}`;
|
|
880
|
-
return text === formatted || text.startsWith("BTW\nQuestion:") ? text : formatted;
|
|
881
|
-
}
|
|
882
|
-
function isRenderablePayload(payload) {
|
|
883
|
-
return hasReplyPayloadContent(payload, { extraContent: payload.audioAsVoice });
|
|
884
|
-
}
|
|
885
|
-
function shouldSuppressReasoningPayload(payload) {
|
|
886
|
-
return payload.isReasoning === true;
|
|
887
|
-
}
|
|
888
|
-
//#endregion
|
|
889
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/parse-json-compat-KOQ1_0YH.js
|
|
890
|
-
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
891
|
-
function parseJsonWithJson5Fallback(raw) {
|
|
892
|
-
try {
|
|
893
|
-
return JSON.parse(raw);
|
|
894
|
-
} catch {
|
|
895
|
-
return import_lib.default.parse(raw);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
//#endregion
|
|
899
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/subagent-depth-Dgw7X4Ok.js
|
|
900
|
-
const normalizeSubagentSessionKey = normalizeOptionalString;
|
|
901
|
-
function normalizeSpawnDepth(value) {
|
|
902
|
-
if (typeof value === "number") return Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
903
|
-
if (typeof value === "string") {
|
|
904
|
-
const trimmed = value.trim();
|
|
905
|
-
if (!trimmed) return;
|
|
906
|
-
const numeric = Number(trimmed);
|
|
907
|
-
return Number.isInteger(numeric) && numeric >= 0 ? numeric : void 0;
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
function readSessionStore(storePath) {
|
|
911
|
-
try {
|
|
912
|
-
const parsed = parseJsonWithJson5Fallback(fs.readFileSync(storePath, "utf-8"));
|
|
913
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
914
|
-
} catch {}
|
|
915
|
-
return {};
|
|
916
|
-
}
|
|
917
|
-
function buildKeyCandidates(rawKey, cfg) {
|
|
918
|
-
if (!cfg) return [rawKey];
|
|
919
|
-
if (rawKey === "global" || rawKey === "unknown") return [rawKey];
|
|
920
|
-
if (parseAgentSessionKey(rawKey)) return [rawKey];
|
|
921
|
-
const prefixed = `agent:${resolveDefaultAgentId(cfg)}:${rawKey}`;
|
|
922
|
-
return prefixed === rawKey ? [rawKey] : [rawKey, prefixed];
|
|
923
|
-
}
|
|
924
|
-
function findEntryBySessionId(store, sessionId) {
|
|
925
|
-
const normalizedSessionId = normalizeSubagentSessionKey(sessionId);
|
|
926
|
-
if (!normalizedSessionId) return;
|
|
927
|
-
for (const entry of Object.values(store)) {
|
|
928
|
-
const candidateSessionId = normalizeSubagentSessionKey(entry?.sessionId);
|
|
929
|
-
if (candidateSessionId && candidateSessionId === normalizedSessionId) return entry;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
function resolveEntryForSessionKey(params) {
|
|
933
|
-
const candidates = buildKeyCandidates(params.sessionKey, params.cfg);
|
|
934
|
-
if (params.store) {
|
|
935
|
-
for (const key of candidates) {
|
|
936
|
-
const entry = params.store[key];
|
|
937
|
-
if (entry) return entry;
|
|
938
|
-
}
|
|
939
|
-
return findEntryBySessionId(params.store, params.sessionKey);
|
|
940
|
-
}
|
|
941
|
-
if (!params.cfg) return;
|
|
942
|
-
for (const key of candidates) {
|
|
943
|
-
const parsed = parseAgentSessionKey(key);
|
|
944
|
-
if (!parsed?.agentId) continue;
|
|
945
|
-
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: parsed.agentId });
|
|
946
|
-
let store = params.cache.get(storePath);
|
|
947
|
-
if (!store) {
|
|
948
|
-
store = readSessionStore(storePath);
|
|
949
|
-
params.cache.set(storePath, store);
|
|
950
|
-
}
|
|
951
|
-
const entry = store[key] ?? findEntryBySessionId(store, params.sessionKey);
|
|
952
|
-
if (entry) return entry;
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
function getSubagentDepthFromSessionStore(sessionKey, opts) {
|
|
956
|
-
const raw = (sessionKey ?? "").trim();
|
|
957
|
-
const fallbackDepth = getSubagentDepth(raw);
|
|
958
|
-
if (!raw) return fallbackDepth;
|
|
959
|
-
const cache = /* @__PURE__ */ new Map();
|
|
960
|
-
const visited = /* @__PURE__ */ new Set();
|
|
961
|
-
const depthFromStore = (key) => {
|
|
962
|
-
const normalizedKey = normalizeSubagentSessionKey(key);
|
|
963
|
-
if (!normalizedKey) return;
|
|
964
|
-
if (visited.has(normalizedKey)) return;
|
|
965
|
-
visited.add(normalizedKey);
|
|
966
|
-
const entry = resolveEntryForSessionKey({
|
|
967
|
-
sessionKey: normalizedKey,
|
|
968
|
-
cfg: opts?.cfg,
|
|
969
|
-
store: opts?.store,
|
|
970
|
-
cache
|
|
971
|
-
});
|
|
972
|
-
const storedDepth = normalizeSpawnDepth(entry?.spawnDepth);
|
|
973
|
-
if (storedDepth !== void 0) return storedDepth;
|
|
974
|
-
const spawnedBy = normalizeSubagentSessionKey(entry?.spawnedBy);
|
|
975
|
-
if (!spawnedBy) return;
|
|
976
|
-
const parentDepth = depthFromStore(spawnedBy);
|
|
977
|
-
if (parentDepth !== void 0) return parentDepth + 1;
|
|
978
|
-
return getSubagentDepth(spawnedBy) + 1;
|
|
979
|
-
};
|
|
980
|
-
return depthFromStore(raw) ?? fallbackDepth;
|
|
981
|
-
}
|
|
982
|
-
//#endregion
|
|
983
|
-
//#region node_modules/.pnpm/openclaw@2026.4.22_@napi-rs+canvas@0.1.99/node_modules/openclaw/dist/target-parsing-loaded-DKkb6jJY.js
|
|
984
|
-
function parseExplicitTargetForLoadedChannel(channel, rawTarget) {
|
|
985
|
-
const resolvedChannel = normalizeOptionalString(channel);
|
|
986
|
-
if (!resolvedChannel) return null;
|
|
987
|
-
return getLoadedChannelPluginForRead(resolvedChannel)?.messaging?.parseExplicitTarget?.({ raw: rawTarget }) ?? null;
|
|
988
|
-
}
|
|
989
|
-
function resolveComparableTargetForLoadedChannel(params) {
|
|
990
|
-
const rawTo = normalizeOptionalString(params.rawTarget);
|
|
991
|
-
if (!rawTo) return null;
|
|
992
|
-
const parsed = parseExplicitTargetForLoadedChannel(params.channel, rawTo);
|
|
993
|
-
const fallbackThreadId = normalizeOptionalThreadValue(params.fallbackThreadId);
|
|
994
|
-
return {
|
|
995
|
-
rawTo,
|
|
996
|
-
to: parsed?.to ?? rawTo,
|
|
997
|
-
threadId: normalizeOptionalThreadValue(parsed?.threadId ?? fallbackThreadId),
|
|
998
|
-
chatType: parsed?.chatType
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
//#endregion
|
|
1002
|
-
export { SILENT_REPLY_TOKEN as C, stripLeadingSilentToken as D, startsWithSilentToken as E, stripSilentToken as O, resolveSilentReplySettings as S, isSilentReplyText as T, hasReplyChannelData as _, shouldSuppressReasoningPayload as a, renderMessagePresentationFallbackText as b, compileGlobPatterns as c, mergeAlsoAllowPolicy as d, normalizeToolName as f, hasMessagePresentationBlocks as g, hasInteractiveReplyBlocks as h, isRenderablePayload as i, matchesAnyGlobPattern as l, resolveMainSessionKey as m, getSubagentDepthFromSessionStore as n, parseInlineDirectives as o, resolveToolProfilePolicy as p, formatBtwTextForExternalDelivery as r, buildOutboundSessionContext as s, resolveComparableTargetForLoadedChannel as t, expandToolGroups as u, hasReplyPayloadContent as v, isSilentReplyPayloadText as w, resolveSilentReplyRewriteText as x, normalizeMessagePresentation as y };
|