@lawpath-tech/openclaw 2026.2.21-10 → 2026.2.21-12
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/{agents-XFUpnhyw.js → agents-Acsw6oEr.js} +4 -4
- package/dist/{agents.config-DjELUleJ.js → agents.config-BAILtL0e.js} +1 -1
- package/dist/{agents.config-CTbtf-Et.js → agents.config-DA4Kt9C5.js} +1 -1
- package/dist/{audio-preflight-Bqg8wRF0.js → audio-preflight-BnwMjf3g.js} +3 -3
- package/dist/{audio-preflight-0nE4BIvV.js → audio-preflight-C56sndLt.js} +4 -4
- package/dist/{audio-preflight-DUN77LMG.js → audio-preflight-DTxmK1ti.js} +3 -3
- package/dist/{audio-preflight-DESlWRvS.js → audio-preflight-UmMU18Rf.js} +3 -3
- package/dist/{auth-choice-C-VbNMFC.js → auth-choice-B0ExtimG.js} +1 -1
- package/dist/{auth-choice-Ce5ZhgZB.js → auth-choice-Cc9nPCSG.js} +1 -1
- package/dist/{banner-BO0EC6gi.js → banner-l8hdGVT6.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +5 -5
- package/dist/bundled/session-memory/handler.js +5 -5
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-Dnl_ON0t.js → channel-options-BOgY_qkz.js} +1 -1
- package/dist/{channel-options-CJ562Awb.js → channel-options-DU0lH77F.js} +1 -1
- package/dist/{channel-web-C6by66Ik.js → channel-web-Bn_o0ClJ.js} +2 -2
- package/dist/{channels-cli-DmemjJTj.js → channels-cli-B8iPHVyY.js} +8 -8
- package/dist/{channels-cli-CX3e33oJ.js → channels-cli-HyoLT0X_.js} +8 -8
- package/dist/{chrome-Cag1SQQf.js → chrome-EGHj-WC_.js} +7 -7
- package/dist/{cli-CZYqgXep.js → cli-BjW27QBR.js} +5 -5
- package/dist/{cli-C-oUtdv5.js → cli-CB8wKUFa.js} +5 -5
- package/dist/{command-registry-DPgcpkAs.js → command-registry-hszLgVfh.js} +9 -9
- package/dist/{completion-cli-BIW77wm1.js → completion-cli-BTOzPrOy.js} +2 -2
- package/dist/{completion-cli-B8nHppfQ.js → completion-cli-jFF5jQZF.js} +1 -1
- package/dist/{config-cli-DLSqMYRk.js → config-cli-CV3y1IAq.js} +1 -1
- package/dist/{config-cli-DF3Frhtb.js → config-cli-Cuv_T0Jj.js} +1 -1
- package/dist/{configure-DIlxSV4l.js → configure-80FWz9jT.js} +3 -3
- package/dist/{configure-ku8C0kaJ.js → configure-BHGABgNw.js} +3 -3
- package/dist/control-ui/assets/{index-Cx1_w3YP.js → index-BfDl8X4O.js} +2 -2
- package/dist/control-ui/assets/index-BfDl8X4O.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/{deliver-D3HyJhTX.js → deliver-B1Ddgm7X.js} +11 -6
- package/dist/{deliver-CX6Se-jI.js → deliver-BLkQFTzD.js} +11 -6
- package/dist/{deliver-Ct_AlJg5.js → deliver-J2cVd3TS.js} +11 -6
- package/dist/{deliver-BAjdrEoI.js → deliver-meQdcFaA.js} +11 -6
- package/dist/{doctor-completion-Dqrz2Mxm.js → doctor-completion-BSCz_dGZ.js} +1 -1
- package/dist/{doctor-completion-BpvOQ6nZ.js → doctor-completion-DGHNIbJN.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +6 -6
- package/dist/{gateway-cli-eWm9cU71.js → gateway-cli-DYYSJuSK.js} +13 -13
- package/dist/{gateway-cli-DbV5glYW.js → gateway-cli-gLp4lZSu.js} +13 -13
- package/dist/{health-DxhXaHDj.js → health-BfWYn33I.js} +2 -2
- package/dist/{health-TlGblGrz.js → health-DEibfTDK.js} +2 -2
- package/dist/{hooks-cli-DN_-ZC-d.js → hooks-cli-D-nL8J6w.js} +6 -6
- package/dist/{hooks-cli-CNBIyMVL.js → hooks-cli-wQnxbc8T.js} +6 -6
- package/dist/{image-D-DzmVjC.js → image-BZOs5dHY.js} +2 -2
- package/dist/{image-CvBYo9Bu.js → image-C8HOu4vb.js} +2 -2
- package/dist/{image-paXd6zl5.js → image-Cj9tfO74.js} +2 -2
- package/dist/{image-Cgalj9ct.js → image-DuT8yGCI.js} +2 -2
- package/dist/index.js +10 -10
- package/dist/llm-slug-generator.js +5 -5
- package/dist/{models-CSk9HAo_.js → models-DFRcZ415.js} +2 -2
- package/dist/{models-cli-Cw6yV7Hw.js → models-cli-CwEUrjU_.js} +7 -7
- package/dist/{models-cli-DDUpEy7b.js → models-cli-t1rYl_DG.js} +6 -6
- package/dist/{onboard-BHWdJtCd.js → onboard-8PGPC4o-.js} +2 -2
- package/dist/{onboard-B-sVSXzj.js → onboard-XsnXtjOy.js} +2 -2
- package/dist/{onboard-channels-BCAVs_mB.js → onboard-channels-Cb8T_ers.js} +1 -1
- package/dist/{onboard-channels-CWxLkkUp.js → onboard-channels-vQihczqp.js} +1 -1
- package/dist/{onboarding-BRNVJxT8.js → onboarding-C_807D1O.js} +3 -3
- package/dist/{onboarding-BoSfn2h0.js → onboarding-EwJ1WIut.js} +3 -3
- package/dist/{onboarding.finalize-Uy8WceA5.js → onboarding.finalize-Crpg17t7.js} +10 -10
- package/dist/{onboarding.finalize-D1hu4S6g.js → onboarding.finalize-DWFR8IbD.js} +11 -11
- package/dist/{pi-embedded-CZT36FAl.js → pi-embedded-Be34NhAY.js} +29 -12
- package/dist/{pi-embedded-1isHWl0U.js → pi-embedded-BywyyGi2.js} +34 -17
- package/dist/{pi-embedded-helpers-ISSMvBMe.js → pi-embedded-helpers-BVCPWN6Q.js} +40 -8
- package/dist/{pi-embedded-helpers-Cx3WmubG.js → pi-embedded-helpers-C4Annkh_.js} +40 -8
- package/dist/{pi-embedded-helpers-DOmGm3QX.js → pi-embedded-helpers-C_U_c_EU.js} +40 -8
- package/dist/{pi-embedded-helpers-DWuT7Pe9.js → pi-embedded-helpers-Dl_FdUMU.js} +44 -12
- package/dist/{plugin-registry-CGpIcEOM.js → plugin-registry-BrN1y1ig.js} +1 -1
- package/dist/{plugin-registry-qgZzbjWa.js → plugin-registry-CtLhKV8N.js} +1 -1
- package/dist/plugin-sdk/{accounts-DUBJHEgi.js → accounts-BcQo4OUu.js} +1 -1
- package/dist/plugin-sdk/{accounts-wSu5JyDM.js → accounts-DEsAwvaZ.js} +1 -1
- package/dist/plugin-sdk/{accounts-Ciwy7Yxd.js → accounts-fnLsjAOi.js} +3 -3
- package/dist/plugin-sdk/{active-listener-Bnau4oiu.js → active-listener-CeaKSm29.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-j9eoKDzr.js → agent-scope-DnU66cJq.js} +2 -2
- package/dist/plugin-sdk/agents/pi-embedded-helpers/errors.d.ts +1 -0
- package/dist/plugin-sdk/{api-key-rotation-BKOzXMVg.js → api-key-rotation-DRhVpAS4.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-BWBtA5BS.js → audio-preflight-zFFuY6Bd.js} +24 -24
- package/dist/plugin-sdk/auto-reply/reply/reply-dispatcher.d.ts +1 -0
- package/dist/plugin-sdk/{bindings-BxwR115d.js → bindings-HAeLX6mi.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-CCnr-9bS.js → channel-activity-WgE8Z4Bb.js} +1 -1
- package/dist/plugin-sdk/{channel-web-C6_SUXeh.js → channel-web-DfA1sgI9.js} +22 -22
- package/dist/plugin-sdk/{chrome-CAPUVzg9.js → chrome-NvVwZ3Xn.js} +3 -3
- package/dist/plugin-sdk/{chunk-DyzO7IVo.js → chunk-CQk9vawA.js} +1 -1
- package/dist/plugin-sdk/{command-format-DcBXOX9Z.js → command-format-DHXa0Clc.js} +1 -1
- package/dist/plugin-sdk/{commands-registry-C-WjNyFR.js → commands-registry-C0vBsgUy.js} +4 -4
- package/dist/plugin-sdk/{config-DxWaFEai.js → config-C1a-yGCa.js} +9 -9
- package/dist/plugin-sdk/{deliver-C9FGk-m8.js → deliver-D4QMj1KQ.js} +20 -15
- package/dist/plugin-sdk/{diagnostic-DKyVS3IK.js → diagnostic-Up1aMyxZ.js} +1 -1
- package/dist/plugin-sdk/{image-DiGppfRt.js → image-Bu6pmW6i.js} +5 -5
- package/dist/plugin-sdk/{image-ops-Bjog8bLM.js → image-ops-6S8Fa1d6.js} +1 -1
- package/dist/plugin-sdk/index.js +53 -53
- package/dist/plugin-sdk/{ir-98uc6iQ2.js → ir-yosTlCQ0.js} +4 -4
- package/dist/plugin-sdk/{local-roots-9jdLho_V.js → local-roots-CW6TWE2a.js} +3 -3
- package/dist/plugin-sdk/{login-DTf65Ckq.js → login-CkOX36_Y.js} +7 -7
- package/dist/plugin-sdk/{login-qr-CRlrA1Km.js → login-qr-DyxTgmGK.js} +9 -9
- package/dist/plugin-sdk/{manager-B44bHk5P.js → manager-CtapJqej.js} +8 -8
- package/dist/plugin-sdk/{manifest-registry-sgHvjA6E.js → manifest-registry-DvEm2HHf.js} +1 -1
- package/dist/plugin-sdk/{markdown-tables-DV9FqwR1.js → markdown-tables-OYHjLFmr.js} +1 -1
- package/dist/plugin-sdk/{message-channel-DmB4bGFh.js → message-channel-DY9wVB2A.js} +1 -1
- package/dist/plugin-sdk/{model-selection-BALQkWtM.js → model-selection-TMsqRl-p.js} +4 -4
- package/dist/plugin-sdk/{outbound-CjucU9tz.js → outbound-Cs6LZhj-.js} +7 -7
- package/dist/plugin-sdk/{outbound-attachment-BGKevRhJ.js → outbound-attachment-C1DtqQQb.js} +2 -2
- package/dist/plugin-sdk/{pi-auth-json-CYvT0sDr.js → pi-auth-json-Dpj7O31p.js} +5 -5
- package/dist/plugin-sdk/{pi-embedded-helpers-BMLQ8noc.js → pi-embedded-helpers-DBCtPcLq.js} +57 -25
- package/dist/plugin-sdk/{plugins-DwNa_Bjz.js → plugins-BizZYn_y.js} +4 -4
- package/dist/plugin-sdk/{pw-ai-mUE_oZph.js → pw-ai-CtYVo9Ju.js} +8 -8
- package/dist/plugin-sdk/{qmd-manager-CxvLwD3u.js → qmd-manager-qSSWvVwi.js} +4 -4
- package/dist/plugin-sdk/{registry-O1yza0Vh.js → registry-DL-33c9X.js} +2 -2
- package/dist/plugin-sdk/{replies-BLJ6SuWd.js → replies-YDjHVGij.js} +3 -3
- package/dist/plugin-sdk/{reply-Fe-yY6qo.js → reply-Dl9JHnGW.js} +96 -79
- package/dist/plugin-sdk/{reply-prefix-Ohtg483v.js → reply-prefix-DNmkrWtV.js} +1 -1
- package/dist/plugin-sdk/{resolve-outbound-target-vib4nnNx.js → resolve-outbound-target-DCb1ht31.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-DM-CdB9Z.js → resolve-route-BDLDhEh_.js} +3 -3
- package/dist/plugin-sdk/{retry-JFNwfUew.js → retry-5P3d0rYw.js} +1 -1
- package/dist/plugin-sdk/{runner-CCzW7WWc.js → runner-DvYaPG7_.js} +9 -9
- package/dist/plugin-sdk/{send-C-9MUMZ2.js → send-3DmbiJfM.js} +6 -6
- package/dist/plugin-sdk/{send-D4OqVuu3.js → send-BsKrW0Xh.js} +6 -6
- package/dist/plugin-sdk/{send-DQL4fKTV.js → send-CNMXFSjB.js} +10 -10
- package/dist/plugin-sdk/{send-CAhPO5Zx.js → send-DU1Pnsmd.js} +7 -7
- package/dist/plugin-sdk/{send-BzXVnK8V.js → send-DZQYUVIY.js} +10 -10
- package/dist/plugin-sdk/{session-B-KGD6AG.js → session-D38ojZ3_.js} +4 -4
- package/dist/plugin-sdk/{skill-commands-DzurlBtL.js → skill-commands-D7degVS7.js} +5 -5
- package/dist/plugin-sdk/{skills-aG_v8SgP.js → skills-DBG2n4rQ.js} +7 -7
- package/dist/plugin-sdk/slack/monitor/context.d.ts +1 -0
- package/dist/plugin-sdk/{sqlite-DUu0dwic.js → sqlite-ulpcowfN.js} +1 -1
- package/dist/plugin-sdk/{store-gutZwMLb.js → store-CMGBlFGX.js} +2 -2
- package/dist/plugin-sdk/{subsystem-C4Rh0kdL.js → subsystem-C9WnrKN8.js} +1 -1
- package/dist/plugin-sdk/{tables-DhuVe5ji.js → tables-DzujD35V.js} +1 -1
- package/dist/plugin-sdk/{target-errors-2VrFN2Zl.js → target-errors-KOPdGMxQ.js} +2 -2
- package/dist/plugin-sdk/{thinking-DK3F1Tth.js → thinking-BiNjzudU.js} +5 -5
- package/dist/plugin-sdk/{tokens-K9ITCatc.js → tokens-2475WU2Z.js} +1 -1
- package/dist/plugin-sdk/{tool-images-Bu_rB65-.js → tool-images-BlYojiWx.js} +2 -2
- package/dist/plugin-sdk/{tool-loop-detection-BBRtoox8.js → tool-loop-detection-D0ADW0h2.js} +2 -2
- package/dist/plugin-sdk/web-BFEz8bk-.js +65 -0
- package/dist/plugin-sdk/{whatsapp-actions-DfsMoZFo.js → whatsapp-actions-Bffbt65T.js} +21 -21
- package/dist/{plugins-cli-DjCM2809.js → plugins-cli-ByB9fyeR.js} +6 -6
- package/dist/{plugins-cli-CTlSXbxE.js → plugins-cli-CP_m4f99.js} +6 -6
- package/dist/{program-lAdk-rjf.js → program-DlspJVqc.js} +11 -11
- package/dist/{program-context-DvlZb8HS.js → program-context-CpcNVMdA.js} +18 -18
- package/dist/{prompt-select-styled-Ct2adJGY.js → prompt-select-styled-CWRcbfIK.js} +4 -4
- package/dist/{prompt-select-styled-BR9UJTaa.js → prompt-select-styled-DHXAx5uX.js} +4 -4
- package/dist/{provider-auth-helpers-B7pkCdJK.js → provider-auth-helpers-AORB3hk9.js} +1 -1
- package/dist/{provider-auth-helpers-B22yzT-e.js → provider-auth-helpers-TZ3D-fXq.js} +1 -1
- package/dist/{push-apns-CA7elLw_.js → push-apns-BTcu7pip.js} +1 -1
- package/dist/{push-apns-BLrPdufQ.js → push-apns-CSSSwhDY.js} +1 -1
- package/dist/{pw-ai-Bib1qJp-.js → pw-ai-Cs2YQmkQ.js} +1 -1
- package/dist/{register.agent-DWWw3Tcp.js → register.agent-C4G2zuxZ.js} +9 -9
- package/dist/{register.agent-DnXXai-R.js → register.agent-xMmK5W-R.js} +10 -10
- package/dist/{register.configure-wl-tJn4s.js → register.configure-CeFYJnjt.js} +10 -10
- package/dist/{register.configure-DzpjSPql.js → register.configure-aXmgTNuB.js} +10 -10
- package/dist/{register.maintenance-BkvduEtB.js → register.maintenance-B_bQy-mZ.js} +11 -11
- package/dist/{register.maintenance-B7aWrfAO.js → register.maintenance-CWHUzso3.js} +12 -12
- package/dist/{register.message-DooMLu1o.js → register.message-42he49is.js} +6 -6
- package/dist/{register.message-CL812HS5.js → register.message-Cx6UTHOb.js} +6 -6
- package/dist/{register.onboard-DkQtlTNE.js → register.onboard-BmtcBw-6.js} +8 -8
- package/dist/{register.onboard-C6f5DRg1.js → register.onboard-C9pozCFG.js} +8 -8
- package/dist/{register.setup-9RQgdDUL.js → register.setup-C4TWvr5B.js} +8 -8
- package/dist/{register.setup-zBBsTx7h.js → register.setup-C54kkyhM.js} +8 -8
- package/dist/{register.status-health-sessions-hl3bzjXd.js → register.status-health-sessions-DHHGaJsX.js} +7 -7
- package/dist/{register.status-health-sessions-DLETokGZ.js → register.status-health-sessions-DNqvYowR.js} +7 -7
- package/dist/{register.subclis-DJkdsClC.js → register.subclis-m5WJHhwT.js} +10 -10
- package/dist/{reply-B4tyXo72.js → reply-V8UXM1XU.js} +29 -12
- package/dist/{run-main-C1xUseJS.js → run-main-Djlctozd.js} +18 -18
- package/dist/{runner-B9g6ervv.js → runner-BMHyFfIL.js} +1 -1
- package/dist/{runner-Be7-7BcC.js → runner-CbkB3vpb.js} +1 -1
- package/dist/{runner-BIWQkeih.js → runner-DkWpm1Ly.js} +1 -1
- package/dist/{runner-U_c8SvOa.js → runner-DzmbTP-U.js} +1 -1
- package/dist/{server-node-events-CXomRKtF.js → server-node-events-D5Fen-q2.js} +6 -6
- package/dist/{server-node-events-CRVgNQ0_.js → server-node-events-Dm6MSKk0.js} +6 -6
- package/dist/{session-dirs-2TEacrvL.js → session-dirs-BmVdF2KM.js} +1 -1
- package/dist/{session-dirs-C7dOvbkp.js → session-dirs-CRnGB63U.js} +1 -1
- package/dist/{status-BlmQ68Lr.js → status-2w8d47j-.js} +2 -2
- package/dist/{status-BjUudjm_.js → status-Bi_g-8aS.js} +1 -1
- package/dist/{status-Cd-_yawg.js → status-BjjDHl4v.js} +1 -1
- package/dist/{status-CDINUwpc.js → status-DQEnKbht.js} +2 -2
- package/dist/{subagent-registry-CWSe1lKN.js → subagent-registry-DGNGenUN.js} +29 -12
- package/dist/{tui-C8TIc36Z.js → tui-BPSckkGa.js} +1 -1
- package/dist/{tui-dDj0kI9K.js → tui-Dn3NzP7B.js} +1 -1
- package/dist/{tui-cli-B1R2UxjK.js → tui-cli-DYhd0RT6.js} +2 -2
- package/dist/{tui-cli-DXNQuXf_.js → tui-cli-Dscc8usx.js} +2 -2
- package/dist/{update-cli-HS6kiKIK.js → update-cli-BQIIdEwf.js} +11 -11
- package/dist/{update-cli-BUIB_VFr.js → update-cli-C-xMtbk9.js} +12 -12
- package/dist/{web-CO5qanzX.js → web-CIdW3A5E.js} +5 -5
- package/dist/{web-Cz_gOgql.js → web-Ciz1i7yI.js} +6 -6
- package/dist/{web-CmGHJmHB.js → web-H55ayBNa.js} +5 -5
- package/dist/{web-0-iNcZsR.js → web-aUEiU7C4.js} +6 -6
- package/package.json +1 -1
- package/dist/control-ui/assets/index-Cx1_w3YP.js.map +0 -1
- package/dist/plugin-sdk/web-DbHQRXHi.js +0 -65
|
@@ -211,9 +211,9 @@ function isCompactionFailureError(errorMessage) {
|
|
|
211
211
|
if (isLikelyContextOverflowError(errorMessage)) return true;
|
|
212
212
|
return lower.includes("context overflow");
|
|
213
213
|
}
|
|
214
|
-
const ERROR_PAYLOAD_PREFIX_RE = /^(?:error|api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error)[:\s-]+/i;
|
|
214
|
+
const ERROR_PAYLOAD_PREFIX_RE = /^(?:error|(?:[a-z][\w-]*\s+)?api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error|codex\s*error)[:\s-]+/i;
|
|
215
215
|
const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/gi;
|
|
216
|
-
const ERROR_PREFIX_RE = /^(?:error|api\s*error|openai\s*error|anthropic\s*error|gateway\s*error|request failed|failed|exception)[:\s-]+/i;
|
|
216
|
+
const ERROR_PREFIX_RE = /^(?:error|(?:[a-z][\w-]*\s+)?api\s*error|openai\s*error|anthropic\s*error|gateway\s*error|codex\s*error|request failed|failed|exception)(?:\s+\d{3})?[:\s-]+/i;
|
|
217
217
|
const CONTEXT_OVERFLOW_ERROR_HEAD_RE = /^(?:context overflow:|request_too_large\b|request size exceeds\b|request exceeds the maximum size\b|context length exceeded\b|maximum context length\b|prompt is too long\b|exceeds model context window\b)/i;
|
|
218
218
|
const BILLING_ERROR_HEAD_RE = /^(?:error[:\s-]+)?billing(?:\s+error)?(?:[:\s-]+|$)|^(?:error[:\s-]+)?(?:credit balance|insufficient credits?|payment required|http\s*402\b)/i;
|
|
219
219
|
const HTTP_STATUS_PREFIX_RE = /^(?:http\s*)?(\d{3})\s+(.+)$/i;
|
|
@@ -356,6 +356,25 @@ function getApiErrorPayloadFingerprint(raw) {
|
|
|
356
356
|
function isRawApiErrorPayload(raw) {
|
|
357
357
|
return getApiErrorPayloadFingerprint(raw) !== null;
|
|
358
358
|
}
|
|
359
|
+
function isLikelyProviderErrorType(type) {
|
|
360
|
+
const normalized = type?.trim().toLowerCase();
|
|
361
|
+
if (!normalized) return false;
|
|
362
|
+
return normalized.endsWith("_error");
|
|
363
|
+
}
|
|
364
|
+
const NON_ERROR_PROVIDER_PAYLOAD_MAX_LENGTH = 16384;
|
|
365
|
+
const NON_ERROR_PROVIDER_PAYLOAD_PREFIX_RE = /^codex\s*error(?:\s+\d{3})?[:\s-]+/i;
|
|
366
|
+
function shouldRewriteRawPayloadWithoutErrorContext(raw) {
|
|
367
|
+
if (raw.length > NON_ERROR_PROVIDER_PAYLOAD_MAX_LENGTH) return false;
|
|
368
|
+
if (!NON_ERROR_PROVIDER_PAYLOAD_PREFIX_RE.test(raw)) return false;
|
|
369
|
+
const info = parseApiErrorInfo(raw);
|
|
370
|
+
if (!info) return false;
|
|
371
|
+
if (isLikelyProviderErrorType(info.type)) return true;
|
|
372
|
+
if (info.httpCode) {
|
|
373
|
+
const parsedCode = Number(info.httpCode);
|
|
374
|
+
if (Number.isFinite(parsedCode) && parsedCode >= 400) return true;
|
|
375
|
+
}
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
359
378
|
function parseApiErrorInfo(raw) {
|
|
360
379
|
if (!raw) return null;
|
|
361
380
|
const trimmed = raw.trim();
|
|
@@ -398,12 +417,7 @@ function formatRawAssistantErrorForUi(raw) {
|
|
|
398
417
|
if (!rest.startsWith("{")) return `HTTP ${httpMatch[1]}: ${rest}`;
|
|
399
418
|
}
|
|
400
419
|
const info = parseApiErrorInfo(trimmed);
|
|
401
|
-
if (info?.message) {
|
|
402
|
-
const prefix = info.httpCode ? `HTTP ${info.httpCode}` : "LLM error";
|
|
403
|
-
const type = info.type ? ` ${info.type}` : "";
|
|
404
|
-
const requestId = info.requestId ? ` (request_id: ${info.requestId})` : "";
|
|
405
|
-
return `${prefix}${type}: ${info.message}${requestId}`;
|
|
406
|
-
}
|
|
420
|
+
if (info?.message) return `${info.httpCode ? `HTTP ${info.httpCode}` : "LLM error"}${info.type ? ` ${info.type}` : ""}: ${info.message}`;
|
|
407
421
|
return trimmed.length > 600 ? `${trimmed.slice(0, 600)}…` : trimmed;
|
|
408
422
|
}
|
|
409
423
|
function formatAssistantErrorText(msg, opts) {
|
|
@@ -438,6 +452,7 @@ function sanitizeUserFacingText(text, opts) {
|
|
|
438
452
|
const stripped = stripFinalTagsFromText(text);
|
|
439
453
|
const trimmed = stripped.trim();
|
|
440
454
|
if (!trimmed) return "";
|
|
455
|
+
if (!errorContext && shouldRewriteRawPayloadWithoutErrorContext(trimmed)) return formatRawAssistantErrorForUi(trimmed);
|
|
441
456
|
if (errorContext) {
|
|
442
457
|
if (/incorrect role information|roles must alternate/i.test(trimmed)) return "Message ordering conflict - please try again. If this persists, use /new to start a fresh session.";
|
|
443
458
|
if (shouldRewriteContextOverflowText(trimmed)) return "Context overflow: prompt too large for the model. Try /reset (or /new) to start a fresh session, or use a larger-context model.";
|
|
@@ -472,6 +487,19 @@ const ERROR_PATTERNS = {
|
|
|
472
487
|
"service unavailable",
|
|
473
488
|
"high demand"
|
|
474
489
|
],
|
|
490
|
+
serverError: [
|
|
491
|
+
"an error occurred while processing",
|
|
492
|
+
"internal server error",
|
|
493
|
+
"internal_error",
|
|
494
|
+
"server_error",
|
|
495
|
+
"service temporarily unavailable",
|
|
496
|
+
"service_unavailable",
|
|
497
|
+
"bad gateway",
|
|
498
|
+
"gateway timeout",
|
|
499
|
+
"upstream error",
|
|
500
|
+
"upstream connect error",
|
|
501
|
+
"connection reset"
|
|
502
|
+
],
|
|
475
503
|
timeout: [
|
|
476
504
|
"timeout",
|
|
477
505
|
"timed out",
|
|
@@ -552,6 +580,9 @@ function isAuthErrorMessage(raw) {
|
|
|
552
580
|
function isOverloadedErrorMessage(raw) {
|
|
553
581
|
return matchesErrorPatterns(raw, ERROR_PATTERNS.overloaded);
|
|
554
582
|
}
|
|
583
|
+
function isServerErrorMessage(raw) {
|
|
584
|
+
return matchesErrorPatterns(raw, ERROR_PATTERNS.serverError);
|
|
585
|
+
}
|
|
555
586
|
function isJsonApiInternalServerError(raw) {
|
|
556
587
|
if (!raw) return false;
|
|
557
588
|
const value = raw.toLowerCase();
|
|
@@ -613,6 +644,7 @@ function classifyFailoverReason(raw) {
|
|
|
613
644
|
if (isBillingErrorMessage(raw)) return "billing";
|
|
614
645
|
if (isTimeoutErrorMessage(raw)) return "timeout";
|
|
615
646
|
if (isAuthErrorMessage(raw)) return "auth";
|
|
647
|
+
if (isServerErrorMessage(raw)) return "timeout";
|
|
616
648
|
return null;
|
|
617
649
|
}
|
|
618
650
|
function isFailoverErrorMessage(raw) {
|
|
@@ -10,7 +10,7 @@ import { t as normalizeChatType } from "./chat-type-DFDuk3FY.js";
|
|
|
10
10
|
import { c as SafeOpenError, i as getImageMetadata, l as openFileWithinRoot, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-BJidZpId.js";
|
|
11
11
|
import { o as listDeliverableMessageChannels, s as normalizeMessageChannel } from "./message-channel-DNOtJsL1.js";
|
|
12
12
|
import { _ as parseDurationMs, a as writeConfigFile, n as loadConfig, s as parseByteSize, t as createConfigIO } from "./config-Bj1BETyH.js";
|
|
13
|
-
import { A as DEFAULT_BROWSER_EVALUATE_ENABLED, D as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, E as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, M as DEFAULT_OPENCLAW_BROWSER_ENABLED, N as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, S as stopChromeExtensionRelayServer, _ as fetchJson, a as resolveOpenClawUserDataDir, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, g as appendCdpPath, h as withBrowserNavigationPolicy, i as launchOpenClawChrome, j as DEFAULT_OPENCLAW_BROWSER_COLOR, k as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, l as createTargetViaCdp, m as assertBrowserNavigationAllowed, n as isChromeCdpReady, o as stopOpenClawChrome, p as InvalidBrowserNavigationUrlError, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as fetchOk, w as isLoopbackHost, x as ensureChromeExtensionRelayServer } from "./chrome-
|
|
13
|
+
import { A as DEFAULT_BROWSER_EVALUATE_ENABLED, D as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, E as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, M as DEFAULT_OPENCLAW_BROWSER_ENABLED, N as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, S as stopChromeExtensionRelayServer, _ as fetchJson, a as resolveOpenClawUserDataDir, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, g as appendCdpPath, h as withBrowserNavigationPolicy, i as launchOpenClawChrome, j as DEFAULT_OPENCLAW_BROWSER_COLOR, k as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, l as createTargetViaCdp, m as assertBrowserNavigationAllowed, n as isChromeCdpReady, o as stopOpenClawChrome, p as InvalidBrowserNavigationUrlError, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as fetchOk, w as isLoopbackHost, x as ensureChromeExtensionRelayServer } from "./chrome-EGHj-WC_.js";
|
|
14
14
|
import { a as syncSkillsToWorkspace, l as resolveSandboxInputPath, m as sanitizeEnvVars, u as resolveSandboxPath } from "./skills-BZ3AnzBD.js";
|
|
15
15
|
import { n as formatErrorMessage, t as extractErrorCode } from "./errors-CPfngF0S.js";
|
|
16
16
|
import { t as SsrFBlockedError } from "./ssrf-CxfFyMRZ.js";
|
|
@@ -931,7 +931,7 @@ function isModuleNotFoundError(err) {
|
|
|
931
931
|
}
|
|
932
932
|
async function loadPwAiModule(mode) {
|
|
933
933
|
try {
|
|
934
|
-
return await import("./pw-ai-
|
|
934
|
+
return await import("./pw-ai-Cs2YQmkQ.js");
|
|
935
935
|
} catch (err) {
|
|
936
936
|
if (mode === "soft") return null;
|
|
937
937
|
if (isModuleNotFoundError(err)) return null;
|
|
@@ -3471,11 +3471,11 @@ function createProfileContext(opts, profile) {
|
|
|
3471
3471
|
const userDataDir = resolveOpenClawUserDataDir(profile.name);
|
|
3472
3472
|
const profileState = getProfileState();
|
|
3473
3473
|
if (await isHttpReachable(300) && !profileState.running) try {
|
|
3474
|
-
await (await import("./pw-ai-
|
|
3474
|
+
await (await import("./pw-ai-Cs2YQmkQ.js")).closePlaywrightBrowserConnection();
|
|
3475
3475
|
} catch {}
|
|
3476
3476
|
if (profileState.running) await stopRunningBrowser();
|
|
3477
3477
|
try {
|
|
3478
|
-
await (await import("./pw-ai-
|
|
3478
|
+
await (await import("./pw-ai-Cs2YQmkQ.js")).closePlaywrightBrowserConnection();
|
|
3479
3479
|
} catch {}
|
|
3480
3480
|
if (!fs.existsSync(userDataDir)) return {
|
|
3481
3481
|
moved: false,
|
|
@@ -6908,9 +6908,9 @@ function isCompactionFailureError(errorMessage) {
|
|
|
6908
6908
|
if (isLikelyContextOverflowError(errorMessage)) return true;
|
|
6909
6909
|
return lower.includes("context overflow");
|
|
6910
6910
|
}
|
|
6911
|
-
const ERROR_PAYLOAD_PREFIX_RE = /^(?:error|api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error)[:\s-]+/i;
|
|
6911
|
+
const ERROR_PAYLOAD_PREFIX_RE = /^(?:error|(?:[a-z][\w-]*\s+)?api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error|codex\s*error)[:\s-]+/i;
|
|
6912
6912
|
const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/gi;
|
|
6913
|
-
const ERROR_PREFIX_RE = /^(?:error|api\s*error|openai\s*error|anthropic\s*error|gateway\s*error|request failed|failed|exception)[:\s-]+/i;
|
|
6913
|
+
const ERROR_PREFIX_RE = /^(?:error|(?:[a-z][\w-]*\s+)?api\s*error|openai\s*error|anthropic\s*error|gateway\s*error|codex\s*error|request failed|failed|exception)(?:\s+\d{3})?[:\s-]+/i;
|
|
6914
6914
|
const CONTEXT_OVERFLOW_ERROR_HEAD_RE = /^(?:context overflow:|request_too_large\b|request size exceeds\b|request exceeds the maximum size\b|context length exceeded\b|maximum context length\b|prompt is too long\b|exceeds model context window\b)/i;
|
|
6915
6915
|
const BILLING_ERROR_HEAD_RE = /^(?:error[:\s-]+)?billing(?:\s+error)?(?:[:\s-]+|$)|^(?:error[:\s-]+)?(?:credit balance|insufficient credits?|payment required|http\s*402\b)/i;
|
|
6916
6916
|
const HTTP_STATUS_PREFIX_RE = /^(?:http\s*)?(\d{3})\s+(.+)$/i;
|
|
@@ -7053,6 +7053,25 @@ function getApiErrorPayloadFingerprint(raw) {
|
|
|
7053
7053
|
function isRawApiErrorPayload(raw) {
|
|
7054
7054
|
return getApiErrorPayloadFingerprint(raw) !== null;
|
|
7055
7055
|
}
|
|
7056
|
+
function isLikelyProviderErrorType(type) {
|
|
7057
|
+
const normalized = type?.trim().toLowerCase();
|
|
7058
|
+
if (!normalized) return false;
|
|
7059
|
+
return normalized.endsWith("_error");
|
|
7060
|
+
}
|
|
7061
|
+
const NON_ERROR_PROVIDER_PAYLOAD_MAX_LENGTH = 16384;
|
|
7062
|
+
const NON_ERROR_PROVIDER_PAYLOAD_PREFIX_RE = /^codex\s*error(?:\s+\d{3})?[:\s-]+/i;
|
|
7063
|
+
function shouldRewriteRawPayloadWithoutErrorContext(raw) {
|
|
7064
|
+
if (raw.length > NON_ERROR_PROVIDER_PAYLOAD_MAX_LENGTH) return false;
|
|
7065
|
+
if (!NON_ERROR_PROVIDER_PAYLOAD_PREFIX_RE.test(raw)) return false;
|
|
7066
|
+
const info = parseApiErrorInfo(raw);
|
|
7067
|
+
if (!info) return false;
|
|
7068
|
+
if (isLikelyProviderErrorType(info.type)) return true;
|
|
7069
|
+
if (info.httpCode) {
|
|
7070
|
+
const parsedCode = Number(info.httpCode);
|
|
7071
|
+
if (Number.isFinite(parsedCode) && parsedCode >= 400) return true;
|
|
7072
|
+
}
|
|
7073
|
+
return false;
|
|
7074
|
+
}
|
|
7056
7075
|
function parseApiErrorInfo(raw) {
|
|
7057
7076
|
if (!raw) return null;
|
|
7058
7077
|
const trimmed = raw.trim();
|
|
@@ -7095,12 +7114,7 @@ function formatRawAssistantErrorForUi(raw) {
|
|
|
7095
7114
|
if (!rest.startsWith("{")) return `HTTP ${httpMatch[1]}: ${rest}`;
|
|
7096
7115
|
}
|
|
7097
7116
|
const info = parseApiErrorInfo(trimmed);
|
|
7098
|
-
if (info?.message) {
|
|
7099
|
-
const prefix = info.httpCode ? `HTTP ${info.httpCode}` : "LLM error";
|
|
7100
|
-
const type = info.type ? ` ${info.type}` : "";
|
|
7101
|
-
const requestId = info.requestId ? ` (request_id: ${info.requestId})` : "";
|
|
7102
|
-
return `${prefix}${type}: ${info.message}${requestId}`;
|
|
7103
|
-
}
|
|
7117
|
+
if (info?.message) return `${info.httpCode ? `HTTP ${info.httpCode}` : "LLM error"}${info.type ? ` ${info.type}` : ""}: ${info.message}`;
|
|
7104
7118
|
return trimmed.length > 600 ? `${trimmed.slice(0, 600)}…` : trimmed;
|
|
7105
7119
|
}
|
|
7106
7120
|
function formatAssistantErrorText(msg, opts) {
|
|
@@ -7135,6 +7149,7 @@ function sanitizeUserFacingText(text, opts) {
|
|
|
7135
7149
|
const stripped = stripFinalTagsFromText(text);
|
|
7136
7150
|
const trimmed = stripped.trim();
|
|
7137
7151
|
if (!trimmed) return "";
|
|
7152
|
+
if (!errorContext && shouldRewriteRawPayloadWithoutErrorContext(trimmed)) return formatRawAssistantErrorForUi(trimmed);
|
|
7138
7153
|
if (errorContext) {
|
|
7139
7154
|
if (/incorrect role information|roles must alternate/i.test(trimmed)) return "Message ordering conflict - please try again. If this persists, use /new to start a fresh session.";
|
|
7140
7155
|
if (shouldRewriteContextOverflowText(trimmed)) return "Context overflow: prompt too large for the model. Try /reset (or /new) to start a fresh session, or use a larger-context model.";
|
|
@@ -7169,6 +7184,19 @@ const ERROR_PATTERNS = {
|
|
|
7169
7184
|
"service unavailable",
|
|
7170
7185
|
"high demand"
|
|
7171
7186
|
],
|
|
7187
|
+
serverError: [
|
|
7188
|
+
"an error occurred while processing",
|
|
7189
|
+
"internal server error",
|
|
7190
|
+
"internal_error",
|
|
7191
|
+
"server_error",
|
|
7192
|
+
"service temporarily unavailable",
|
|
7193
|
+
"service_unavailable",
|
|
7194
|
+
"bad gateway",
|
|
7195
|
+
"gateway timeout",
|
|
7196
|
+
"upstream error",
|
|
7197
|
+
"upstream connect error",
|
|
7198
|
+
"connection reset"
|
|
7199
|
+
],
|
|
7172
7200
|
timeout: [
|
|
7173
7201
|
"timeout",
|
|
7174
7202
|
"timed out",
|
|
@@ -7249,6 +7277,9 @@ function isAuthErrorMessage(raw) {
|
|
|
7249
7277
|
function isOverloadedErrorMessage(raw) {
|
|
7250
7278
|
return matchesErrorPatterns(raw, ERROR_PATTERNS.overloaded);
|
|
7251
7279
|
}
|
|
7280
|
+
function isServerErrorMessage(raw) {
|
|
7281
|
+
return matchesErrorPatterns(raw, ERROR_PATTERNS.serverError);
|
|
7282
|
+
}
|
|
7252
7283
|
function isJsonApiInternalServerError(raw) {
|
|
7253
7284
|
if (!raw) return false;
|
|
7254
7285
|
const value = raw.toLowerCase();
|
|
@@ -7310,6 +7341,7 @@ function classifyFailoverReason(raw) {
|
|
|
7310
7341
|
if (isBillingErrorMessage(raw)) return "billing";
|
|
7311
7342
|
if (isTimeoutErrorMessage(raw)) return "timeout";
|
|
7312
7343
|
if (isAuthErrorMessage(raw)) return "auth";
|
|
7344
|
+
if (isServerErrorMessage(raw)) return "timeout";
|
|
7313
7345
|
return null;
|
|
7314
7346
|
}
|
|
7315
7347
|
function isFailoverErrorMessage(raw) {
|
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
|
2
2
|
import { M as getActivePluginRegistry, o as createSubsystemLogger } from "./entry.js";
|
|
3
3
|
import { c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-BhZr1_OI.js";
|
|
4
4
|
import { i as loadConfig } from "./config-26MDXfhB.js";
|
|
5
|
-
import { g as loadOpenClawPlugins } from "./subagent-registry-
|
|
5
|
+
import { g as loadOpenClawPlugins } from "./subagent-registry-DGNGenUN.js";
|
|
6
6
|
|
|
7
7
|
//#region src/cli/plugin-registry.ts
|
|
8
8
|
var plugin_registry_exports = /* @__PURE__ */ __exportAll({ ensurePluginRegistryLoaded: () => ensurePluginRegistryLoaded });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { gt as loadOpenClawPlugins } from "./reply-
|
|
2
|
+
import { gt as loadOpenClawPlugins } from "./reply-V8UXM1XU.js";
|
|
3
3
|
import { d as getActivePluginRegistry } from "./registry-Dygi7Azw.js";
|
|
4
4
|
import { t as createSubsystemLogger } from "./subsystem-8bY95KEB.js";
|
|
5
5
|
import { c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-Dl-vG2QO.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as normalizeAccountId } from "./session-key-C_0eELjb.js";
|
|
2
|
-
import { _ as createAccountListHelpers } from "./accounts-
|
|
2
|
+
import { _ as createAccountListHelpers } from "./accounts-fnLsjAOi.js";
|
|
3
3
|
|
|
4
4
|
//#region src/signal/accounts.ts
|
|
5
5
|
const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("signal");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as normalizeAccountId } from "./session-key-C_0eELjb.js";
|
|
2
|
-
import { _ as createAccountListHelpers } from "./accounts-
|
|
2
|
+
import { _ as createAccountListHelpers } from "./accounts-fnLsjAOi.js";
|
|
3
3
|
|
|
4
4
|
//#region src/imessage/accounts.ts
|
|
5
5
|
const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("imessage");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as DEFAULT_ACCOUNT_ID, p as normalizeAccountId } from "./session-key-C_0eELjb.js";
|
|
2
2
|
import { a as resolveOAuthDir } from "./paths-DVWx7USN.js";
|
|
3
|
-
import { P as resolveUserPath, W as info, X as success, k as jidToE164, tt as getChildLogger } from "./registry-
|
|
4
|
-
import { i as defaultRuntime } from "./subsystem-
|
|
5
|
-
import { t as formatCliCommand } from "./command-format-
|
|
3
|
+
import { P as resolveUserPath, W as info, X as success, k as jidToE164, tt as getChildLogger } from "./registry-DL-33c9X.js";
|
|
4
|
+
import { i as defaultRuntime } from "./subsystem-C9WnrKN8.js";
|
|
5
|
+
import { t as formatCliCommand } from "./command-format-DHXa0Clc.js";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fs$1 from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as DEFAULT_ACCOUNT_ID } from "./session-key-C_0eELjb.js";
|
|
2
|
-
import { t as formatCliCommand } from "./command-format-
|
|
2
|
+
import { t as formatCliCommand } from "./command-format-DHXa0Clc.js";
|
|
3
3
|
|
|
4
4
|
//#region src/web/active-listener.ts
|
|
5
5
|
const listeners = /* @__PURE__ */ new Map();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as isCronSessionKey, s as normalizeAgentId, t as DEFAULT_AGENT_ID, v as isSubagentSessionKey, y as parseAgentSessionKey } from "./session-key-C_0eELjb.js";
|
|
2
2
|
import { s as resolveStateDir, u as resolveRequiredHomeDir } from "./paths-DVWx7USN.js";
|
|
3
|
-
import { P as resolveUserPath, U as danger, W as info, Y as shouldLogVerbose, Z as warn, j as pathExists, nt as getLogger, q as logVerboseConsole } from "./registry-
|
|
4
|
-
import { i as defaultRuntime, t as createSubsystemLogger } from "./subsystem-
|
|
3
|
+
import { P as resolveUserPath, U as danger, W as info, Y as shouldLogVerbose, Z as warn, j as pathExists, nt as getLogger, q as logVerboseConsole } from "./registry-DL-33c9X.js";
|
|
4
|
+
import { i as defaultRuntime, t as createSubsystemLogger } from "./subsystem-C9WnrKN8.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import os from "node:os";
|
|
@@ -35,6 +35,7 @@ export declare function isMissingToolCallInputError(raw: string): boolean;
|
|
|
35
35
|
export declare function isBillingAssistantError(msg: AssistantMessage | undefined): boolean;
|
|
36
36
|
export declare function isAuthErrorMessage(raw: string): boolean;
|
|
37
37
|
export declare function isOverloadedErrorMessage(raw: string): boolean;
|
|
38
|
+
export declare function isServerErrorMessage(raw: string): boolean;
|
|
38
39
|
export declare function parseImageDimensionError(raw: string): {
|
|
39
40
|
maxDimensionPx?: number;
|
|
40
41
|
messageIndex?: number;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import "./accounts-
|
|
1
|
+
import "./accounts-fnLsjAOi.js";
|
|
2
2
|
import "./paths-DVWx7USN.js";
|
|
3
3
|
import "./github-copilot-token-Cg0YPPSu.js";
|
|
4
|
-
import "./plugins-
|
|
5
|
-
import { K as logVerbose, Y as shouldLogVerbose } from "./registry-
|
|
6
|
-
import "./config-
|
|
7
|
-
import "./subsystem-
|
|
8
|
-
import "./command-format-
|
|
9
|
-
import "./model-selection-
|
|
10
|
-
import "./agent-scope-
|
|
11
|
-
import "./manifest-registry-
|
|
4
|
+
import "./plugins-BizZYn_y.js";
|
|
5
|
+
import { K as logVerbose, Y as shouldLogVerbose } from "./registry-DL-33c9X.js";
|
|
6
|
+
import "./config-C1a-yGCa.js";
|
|
7
|
+
import "./subsystem-C9WnrKN8.js";
|
|
8
|
+
import "./command-format-DHXa0Clc.js";
|
|
9
|
+
import "./model-selection-TMsqRl-p.js";
|
|
10
|
+
import "./agent-scope-DnU66cJq.js";
|
|
11
|
+
import "./manifest-registry-DvEm2HHf.js";
|
|
12
12
|
import "./redact-DPnDWsnT.js";
|
|
13
13
|
import "./errors-Bv8oZiTO.js";
|
|
14
|
-
import "./image-ops-
|
|
14
|
+
import "./image-ops-6S8Fa1d6.js";
|
|
15
15
|
import "./ssrf-DKZ8eBrk.js";
|
|
16
|
-
import "./local-roots-
|
|
17
|
-
import "./message-channel-
|
|
18
|
-
import "./bindings-
|
|
19
|
-
import "./tool-images-
|
|
20
|
-
import { a as resolveMediaAttachmentLocalRoots, n as createMediaAttachmentCache, o as runCapability, r as normalizeMediaAttachments, t as buildProviderRegistry, u as isAudioAttachment } from "./runner-
|
|
21
|
-
import "./skills-
|
|
22
|
-
import "./chrome-
|
|
23
|
-
import "./thinking-
|
|
24
|
-
import "./accounts-
|
|
25
|
-
import "./accounts-
|
|
26
|
-
import "./pi-embedded-helpers-
|
|
16
|
+
import "./local-roots-CW6TWE2a.js";
|
|
17
|
+
import "./message-channel-DY9wVB2A.js";
|
|
18
|
+
import "./bindings-HAeLX6mi.js";
|
|
19
|
+
import "./tool-images-BlYojiWx.js";
|
|
20
|
+
import { a as resolveMediaAttachmentLocalRoots, n as createMediaAttachmentCache, o as runCapability, r as normalizeMediaAttachments, t as buildProviderRegistry, u as isAudioAttachment } from "./runner-DvYaPG7_.js";
|
|
21
|
+
import "./skills-DBG2n4rQ.js";
|
|
22
|
+
import "./chrome-NvVwZ3Xn.js";
|
|
23
|
+
import "./thinking-BiNjzudU.js";
|
|
24
|
+
import "./accounts-DEsAwvaZ.js";
|
|
25
|
+
import "./accounts-BcQo4OUu.js";
|
|
26
|
+
import "./pi-embedded-helpers-DBCtPcLq.js";
|
|
27
27
|
import "./paths-BNQjLbn7.js";
|
|
28
|
-
import "./store-
|
|
29
|
-
import "./image-
|
|
28
|
+
import "./store-CMGBlFGX.js";
|
|
29
|
+
import "./image-Bu6pmW6i.js";
|
|
30
30
|
import "./pi-model-discovery-LbcEa65a.js";
|
|
31
|
-
import "./api-key-rotation-
|
|
31
|
+
import "./api-key-rotation-DRhVpAS4.js";
|
|
32
32
|
|
|
33
33
|
//#region src/media-understanding/audio-preflight.ts
|
|
34
34
|
/**
|
|
@@ -37,6 +37,7 @@ export type ReplyDispatcherWithTypingOptions = Omit<ReplyDispatcherOptions, "onI
|
|
|
37
37
|
type ReplyDispatcherWithTypingResult = {
|
|
38
38
|
dispatcher: ReplyDispatcher;
|
|
39
39
|
replyOptions: Pick<GetReplyOptions, "onReplyStart" | "onTypingController" | "onTypingCleanup">;
|
|
40
|
+
markRunComplete: () => void;
|
|
40
41
|
markDispatchIdle: () => void;
|
|
41
42
|
};
|
|
42
43
|
export type ReplyDispatcher = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as normalizeAccountId, s as normalizeAgentId } from "./session-key-C_0eELjb.js";
|
|
2
|
-
import { s as normalizeChatChannelId } from "./registry-
|
|
3
|
-
import { c as resolveDefaultAgentId } from "./agent-scope-
|
|
2
|
+
import { s as normalizeChatChannelId } from "./registry-DL-33c9X.js";
|
|
3
|
+
import { c as resolveDefaultAgentId } from "./agent-scope-DnU66cJq.js";
|
|
4
4
|
|
|
5
5
|
//#region src/routing/bindings.ts
|
|
6
6
|
function normalizeBindingChannelId(raw) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as retryAsync, t as resolveRetryConfig } from "./retry-
|
|
1
|
+
import { n as retryAsync, t as resolveRetryConfig } from "./retry-5P3d0rYw.js";
|
|
2
2
|
import { n as formatErrorMessage } from "./errors-Bv8oZiTO.js";
|
|
3
3
|
import { RateLimitError } from "@buape/carbon";
|
|
4
4
|
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { a as buildGroupHistoryKey, n as DEFAULT_MAIN_KEY, r as buildAgentMainSessionKey, s as normalizeAgentId } from "./session-key-C_0eELjb.js";
|
|
2
|
-
import { f as readWebSelfId, o as getWebAuthAgeMs, r as resolveWhatsAppAccount } from "./accounts-
|
|
3
|
-
import { E as enqueueSystemEvent, G as resolveMentionGating, W as shouldAckReactionForWhatsApp, X as buildHistoryContextFromEntries, Y as DEFAULT_GROUP_HISTORY_LIMIT, _ as resolveEnvelopeFormatOptions, c as computeBackoff, d as formatDurationPrecise, f as dispatchReplyWithBufferedBlockDispatcher, g as formatInboundEnvelope, h as resolveInboundDebounceMs, ht as createDedupeCache, l as sleepWithAbort, m as createInboundDebouncer, n as normalizeGroupActivation, nt as buildMentionRegexes, r as parseActivationCommand, rt as normalizeMentionText, t as getReplyFromConfig, tt as recordPendingHistoryEntryIfEnabled, u as buildPairingReply, v as hasControlCommand, y as shouldComputeCommandAuthorized } from "./reply-
|
|
4
|
-
import { A as normalizeE164, B as toWhatsappJid, K as logVerbose, N as resolveJidToE164, O as isSelfChatMode, R as sleep, Y as shouldLogVerbose, k as jidToE164, s as normalizeChatChannelId, tt as getChildLogger, x as clamp } from "./registry-
|
|
5
|
-
import { n as loadConfig } from "./config-
|
|
6
|
-
import { i as defaultRuntime, t as createSubsystemLogger } from "./subsystem-
|
|
7
|
-
import { t as formatCliCommand } from "./command-format-
|
|
8
|
-
import { n as recordChannelActivity } from "./channel-activity-
|
|
9
|
-
import { t as getAgentScopedMediaLocalRoots } from "./local-roots-
|
|
10
|
-
import { a as loadWebMedia } from "./ir-
|
|
11
|
-
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit } from "./chunk-
|
|
12
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
13
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
14
|
-
import { G as readChannelAllowFromStore, J as upsertChannelPairingRequest, K as readChannelAllowFromStoreSync, nt as toLocationContext, tt as formatLocationText } from "./send-
|
|
15
|
-
import { f as registerUnhandledRejectionHandler } from "./runner-
|
|
16
|
-
import { l as resolveIdentityNamePrefix, n as createReplyPrefixOptions, u as resolveMessagePrefix } from "./reply-prefix-
|
|
17
|
-
import { F as resolveChannelGroupRequireMention, P as resolveChannelGroupPolicy } from "./thinking-
|
|
18
|
-
import { Xt as resolveGroupSessionKey, _t as updateLastRoute, gt as recordSessionMetaFromInbound, ht as readSessionUpdatedAt, mt as loadSessionStore } from "./pi-embedded-helpers-
|
|
2
|
+
import { f as readWebSelfId, o as getWebAuthAgeMs, r as resolveWhatsAppAccount } from "./accounts-fnLsjAOi.js";
|
|
3
|
+
import { E as enqueueSystemEvent, G as resolveMentionGating, W as shouldAckReactionForWhatsApp, X as buildHistoryContextFromEntries, Y as DEFAULT_GROUP_HISTORY_LIMIT, _ as resolveEnvelopeFormatOptions, c as computeBackoff, d as formatDurationPrecise, f as dispatchReplyWithBufferedBlockDispatcher, g as formatInboundEnvelope, h as resolveInboundDebounceMs, ht as createDedupeCache, l as sleepWithAbort, m as createInboundDebouncer, n as normalizeGroupActivation, nt as buildMentionRegexes, r as parseActivationCommand, rt as normalizeMentionText, t as getReplyFromConfig, tt as recordPendingHistoryEntryIfEnabled, u as buildPairingReply, v as hasControlCommand, y as shouldComputeCommandAuthorized } from "./reply-Dl9JHnGW.js";
|
|
4
|
+
import { A as normalizeE164, B as toWhatsappJid, K as logVerbose, N as resolveJidToE164, O as isSelfChatMode, R as sleep, Y as shouldLogVerbose, k as jidToE164, s as normalizeChatChannelId, tt as getChildLogger, x as clamp } from "./registry-DL-33c9X.js";
|
|
5
|
+
import { n as loadConfig } from "./config-C1a-yGCa.js";
|
|
6
|
+
import { i as defaultRuntime, t as createSubsystemLogger } from "./subsystem-C9WnrKN8.js";
|
|
7
|
+
import { t as formatCliCommand } from "./command-format-DHXa0Clc.js";
|
|
8
|
+
import { n as recordChannelActivity } from "./channel-activity-WgE8Z4Bb.js";
|
|
9
|
+
import { t as getAgentScopedMediaLocalRoots } from "./local-roots-CW6TWE2a.js";
|
|
10
|
+
import { a as loadWebMedia } from "./ir-yosTlCQ0.js";
|
|
11
|
+
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit } from "./chunk-CQk9vawA.js";
|
|
12
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-OYHjLFmr.js";
|
|
13
|
+
import { t as convertMarkdownTables } from "./tables-DzujD35V.js";
|
|
14
|
+
import { G as readChannelAllowFromStore, J as upsertChannelPairingRequest, K as readChannelAllowFromStoreSync, nt as toLocationContext, tt as formatLocationText } from "./send-CNMXFSjB.js";
|
|
15
|
+
import { f as registerUnhandledRejectionHandler } from "./runner-DvYaPG7_.js";
|
|
16
|
+
import { l as resolveIdentityNamePrefix, n as createReplyPrefixOptions, u as resolveMessagePrefix } from "./reply-prefix-DNmkrWtV.js";
|
|
17
|
+
import { F as resolveChannelGroupRequireMention, P as resolveChannelGroupPolicy } from "./thinking-BiNjzudU.js";
|
|
18
|
+
import { Xt as resolveGroupSessionKey, _t as updateLastRoute, gt as recordSessionMetaFromInbound, ht as readSessionUpdatedAt, mt as loadSessionStore } from "./pi-embedded-helpers-DBCtPcLq.js";
|
|
19
19
|
import { s as resolveStorePath } from "./paths-BNQjLbn7.js";
|
|
20
|
-
import { i as saveMediaBuffer } from "./store-
|
|
20
|
+
import { i as saveMediaBuffer } from "./store-CMGBlFGX.js";
|
|
21
21
|
import { t as finalizeInboundContext } from "./inbound-context-D5EzMeL_.js";
|
|
22
|
-
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-
|
|
23
|
-
import { r as setActiveWebListener } from "./active-listener-
|
|
24
|
-
import { i as markdownToWhatsApp, r as sendReactionWhatsApp } from "./outbound-
|
|
25
|
-
import { i as waitForWaConnection, n as formatError, r as getStatusCode, t as createWaSocket } from "./session-
|
|
22
|
+
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-BDLDhEh_.js";
|
|
23
|
+
import { r as setActiveWebListener } from "./active-listener-CeaKSm29.js";
|
|
24
|
+
import { i as markdownToWhatsApp, r as sendReactionWhatsApp } from "./outbound-Cs6LZhj-.js";
|
|
25
|
+
import { i as waitForWaConnection, n as formatError, r as getStatusCode, t as createWaSocket } from "./session-D38ojZ3_.js";
|
|
26
26
|
import { randomUUID } from "node:crypto";
|
|
27
27
|
import { DisconnectReason, downloadMediaMessage, extractMessageContent, getContentType, isJidGroup, normalizeMessageContent } from "@whiskeysockets/baileys";
|
|
28
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as CONFIG_DIR } from "./registry-
|
|
2
|
-
import { n as loadConfig } from "./config-
|
|
3
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
1
|
+
import { b as CONFIG_DIR } from "./registry-DL-33c9X.js";
|
|
2
|
+
import { n as loadConfig } from "./config-C1a-yGCa.js";
|
|
3
|
+
import { t as createSubsystemLogger } from "./subsystem-C9WnrKN8.js";
|
|
4
4
|
import { i as isErrno } from "./errors-Bv8oZiTO.js";
|
|
5
5
|
import { s as resolvePinnedHostnameWithPolicy } from "./ssrf-DKZ8eBrk.js";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
2
|
import { p as normalizeAccountId } from "./session-key-C_0eELjb.js";
|
|
3
|
-
import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-
|
|
3
|
+
import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-DY9wVB2A.js";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/fences.ts
|
|
6
6
|
function parseFenceSpans(buffer) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { r as normalizeChannelId } from "./plugins-
|
|
3
|
-
import { H as isPlainObject, T as escapeRegExp, c as getActivePluginRegistry } from "./registry-
|
|
4
|
-
import { J as DEFAULT_MODEL, Y as DEFAULT_PROVIDER, u as resolveConfiguredModelRef } from "./model-selection-
|
|
5
|
-
import { f as listChannelDocks, r as listThinkingLevels } from "./thinking-
|
|
2
|
+
import { r as normalizeChannelId } from "./plugins-BizZYn_y.js";
|
|
3
|
+
import { H as isPlainObject, T as escapeRegExp, c as getActivePluginRegistry } from "./registry-DL-33c9X.js";
|
|
4
|
+
import { J as DEFAULT_MODEL, Y as DEFAULT_PROVIDER, u as resolveConfiguredModelRef } from "./model-selection-TMsqRl-p.js";
|
|
5
|
+
import { f as listChannelDocks, r as listThinkingLevels } from "./thinking-BiNjzudU.js";
|
|
6
6
|
|
|
7
7
|
//#region src/config/commands.ts
|
|
8
8
|
function resolveAutoDefault(providerId) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { s as normalizeAgentId, t as DEFAULT_AGENT_ID } from "./session-key-C_0eELjb.js";
|
|
2
2
|
import { n as resolveConfigPath, r as resolveDefaultConfigCandidates, s as resolveStateDir, u as resolveRequiredHomeDir } from "./paths-DVWx7USN.js";
|
|
3
|
-
import { D as isRecord, H as isPlainObject$1, M as resolveConfigDir, P as resolveUserPath, s as normalizeChatChannelId, t as CHANNEL_IDS } from "./registry-
|
|
4
|
-
import { $ as shouldDeferShellEnvFallback, Q as resolveShellEnvFallbackTimeoutMs, Z as loadShellEnvFallback, et as shouldEnableShellEnvFallback, l as parseModelRef, q as DEFAULT_CONTEXT_TOKENS } from "./model-selection-
|
|
5
|
-
import { c as resolveDefaultAgentId, s as resolveAgentWorkspaceDir } from "./agent-scope-
|
|
6
|
-
import { c as normalizePluginsConfig, d as isPathInside, l as resolveEnableState, m as normalizeEnvVarKey, p as isDangerousHostEnvVarName, t as loadPluginManifestRegistry, u as resolveMemorySlotDecision } from "./manifest-registry-
|
|
3
|
+
import { D as isRecord, H as isPlainObject$1, M as resolveConfigDir, P as resolveUserPath, s as normalizeChatChannelId, t as CHANNEL_IDS } from "./registry-DL-33c9X.js";
|
|
4
|
+
import { $ as shouldDeferShellEnvFallback, Q as resolveShellEnvFallbackTimeoutMs, Z as loadShellEnvFallback, et as shouldEnableShellEnvFallback, l as parseModelRef, q as DEFAULT_CONTEXT_TOKENS } from "./model-selection-TMsqRl-p.js";
|
|
5
|
+
import { c as resolveDefaultAgentId, s as resolveAgentWorkspaceDir } from "./agent-scope-DnU66cJq.js";
|
|
6
|
+
import { c as normalizePluginsConfig, d as isPathInside, l as resolveEnableState, m as normalizeEnvVarKey, p as isDangerousHostEnvVarName, t as loadPluginManifestRegistry, u as resolveMemorySlotDecision } from "./manifest-registry-DvEm2HHf.js";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import os from "node:os";
|
|
11
|
-
import
|
|
11
|
+
import json5 from "json5";
|
|
12
12
|
import crypto from "node:crypto";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
import dotenv from "dotenv";
|
|
@@ -892,7 +892,7 @@ function safeRealpath(target) {
|
|
|
892
892
|
}
|
|
893
893
|
const defaultResolver = {
|
|
894
894
|
readFile: (p) => fs.readFileSync(p, "utf-8"),
|
|
895
|
-
parseJson: (raw) =>
|
|
895
|
+
parseJson: (raw) => json5.parse(raw)
|
|
896
896
|
};
|
|
897
897
|
/**
|
|
898
898
|
* Resolves all $include directives in a parsed config object.
|
|
@@ -5546,7 +5546,7 @@ function resolveConfigPathForDeps(deps) {
|
|
|
5546
5546
|
function normalizeDeps(overrides = {}) {
|
|
5547
5547
|
return {
|
|
5548
5548
|
fs: overrides.fs ?? fs,
|
|
5549
|
-
json5: overrides.json5 ??
|
|
5549
|
+
json5: overrides.json5 ?? json5,
|
|
5550
5550
|
env: overrides.env ?? process.env,
|
|
5551
5551
|
homedir: overrides.homedir ?? (() => resolveRequiredHomeDir(overrides.env ?? process.env, os.homedir)),
|
|
5552
5552
|
configPath: overrides.configPath ?? "",
|
|
@@ -5557,11 +5557,11 @@ function maybeLoadDotEnvForConfig(env) {
|
|
|
5557
5557
|
if (env !== process.env) return;
|
|
5558
5558
|
loadDotEnv({ quiet: true });
|
|
5559
5559
|
}
|
|
5560
|
-
function parseConfigJson5(raw, json5 =
|
|
5560
|
+
function parseConfigJson5(raw, json5$1 = json5) {
|
|
5561
5561
|
try {
|
|
5562
5562
|
return {
|
|
5563
5563
|
ok: true,
|
|
5564
|
-
parsed: json5.parse(raw)
|
|
5564
|
+
parsed: json5$1.parse(raw)
|
|
5565
5565
|
};
|
|
5566
5566
|
} catch (err) {
|
|
5567
5567
|
return {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
2
|
import { m as normalizeOptionalAccountId, p as normalizeAccountId } from "./session-key-C_0eELjb.js";
|
|
3
3
|
import { s as resolveStateDir } from "./paths-DVWx7USN.js";
|
|
4
|
-
import { r as normalizeChannelId, t as getChannelPlugin } from "./plugins-
|
|
5
|
-
import { c as getActivePluginRegistry, v as createInternalHookEvent, y as triggerInternalHook } from "./registry-
|
|
6
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
7
|
-
import { t as getAgentScopedMediaLocalRoots } from "./local-roots-
|
|
8
|
-
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit, n as chunkByParagraph, p as parseFenceSpans } from "./chunk-
|
|
9
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
10
|
-
import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN } from "./tokens-
|
|
11
|
-
import { d as getChannelDock } from "./thinking-
|
|
12
|
-
import { dt as appendAssistantMessageToSessionTranscript, ft as resolveMirroredTranscriptText, i as isMessagingToolDuplicate } from "./pi-embedded-helpers-
|
|
13
|
-
import { a as markdownToSignalTextChunks, t as sendMessageSignal } from "./send-
|
|
4
|
+
import { r as normalizeChannelId, t as getChannelPlugin } from "./plugins-BizZYn_y.js";
|
|
5
|
+
import { c as getActivePluginRegistry, v as createInternalHookEvent, y as triggerInternalHook } from "./registry-DL-33c9X.js";
|
|
6
|
+
import { t as createSubsystemLogger } from "./subsystem-C9WnrKN8.js";
|
|
7
|
+
import { t as getAgentScopedMediaLocalRoots } from "./local-roots-CW6TWE2a.js";
|
|
8
|
+
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit, n as chunkByParagraph, p as parseFenceSpans } from "./chunk-CQk9vawA.js";
|
|
9
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-OYHjLFmr.js";
|
|
10
|
+
import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN } from "./tokens-2475WU2Z.js";
|
|
11
|
+
import { d as getChannelDock } from "./thinking-BiNjzudU.js";
|
|
12
|
+
import { dt as appendAssistantMessageToSessionTranscript, ft as resolveMirroredTranscriptText, i as isMessagingToolDuplicate } from "./pi-embedded-helpers-DBCtPcLq.js";
|
|
13
|
+
import { a as markdownToSignalTextChunks, t as sendMessageSignal } from "./send-BsKrW0Xh.js";
|
|
14
14
|
import fs from "node:fs";
|
|
15
15
|
import path from "node:path";
|
|
16
16
|
import crypto from "node:crypto";
|
|
@@ -539,8 +539,13 @@ async function failDelivery(id, error, stateDir) {
|
|
|
539
539
|
//#region src/utils/directive-tags.ts
|
|
540
540
|
const AUDIO_TAG_RE = /\[\[\s*audio_as_voice\s*\]\]/gi;
|
|
541
541
|
const REPLY_TAG_RE = /\[\[\s*(?:reply_to_current|reply_to\s*:\s*([^\]\n]+))\s*\]\]/gi;
|
|
542
|
+
function replacementPreservesWordBoundary(source, offset, length) {
|
|
543
|
+
const before = source[offset - 1];
|
|
544
|
+
const after = source[offset + length];
|
|
545
|
+
return before && after && !/\s/u.test(before) && !/\s/u.test(after) ? " " : "";
|
|
546
|
+
}
|
|
542
547
|
function normalizeDirectiveWhitespace(text) {
|
|
543
|
-
return text.replace(/[ \t]
|
|
548
|
+
return text.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();
|
|
544
549
|
}
|
|
545
550
|
function parseInlineDirectives(text, options = {}) {
|
|
546
551
|
const { currentMessageId, stripAudioTag = true, stripReplyTags = true } = options;
|
|
@@ -557,19 +562,19 @@ function parseInlineDirectives(text, options = {}) {
|
|
|
557
562
|
let hasReplyTag = false;
|
|
558
563
|
let sawCurrent = false;
|
|
559
564
|
let lastExplicitId;
|
|
560
|
-
cleaned = cleaned.replace(AUDIO_TAG_RE, (match) => {
|
|
565
|
+
cleaned = cleaned.replace(AUDIO_TAG_RE, (match, offset, source) => {
|
|
561
566
|
audioAsVoice = true;
|
|
562
567
|
hasAudioTag = true;
|
|
563
|
-
return stripAudioTag ?
|
|
568
|
+
return stripAudioTag ? replacementPreservesWordBoundary(source, offset, match.length) : match;
|
|
564
569
|
});
|
|
565
|
-
cleaned = cleaned.replace(REPLY_TAG_RE, (match, idRaw) => {
|
|
570
|
+
cleaned = cleaned.replace(REPLY_TAG_RE, (match, idRaw, offset, source) => {
|
|
566
571
|
hasReplyTag = true;
|
|
567
572
|
if (idRaw === void 0) sawCurrent = true;
|
|
568
573
|
else {
|
|
569
574
|
const id = idRaw.trim();
|
|
570
575
|
if (id) lastExplicitId = id;
|
|
571
576
|
}
|
|
572
|
-
return stripReplyTags ?
|
|
577
|
+
return stripReplyTags ? replacementPreservesWordBoundary(source, offset, match.length) : match;
|
|
573
578
|
});
|
|
574
579
|
cleaned = normalizeDirectiveWhitespace(cleaned);
|
|
575
580
|
const replyToId = lastExplicitId ?? (sawCurrent ? currentMessageId?.trim() || void 0 : void 0);
|