stableclaw 2026.4.6 → 2026.4.8
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/README.md +22 -290
- package/package.json +1 -73
- package/dist/.buildstamp +0 -1
- package/dist/abort-C9luPDzM.js +0 -192
- package/dist/abort-cutoff-B1ws4nOb.js +0 -56
- package/dist/abort-cutoff.runtime-DyRUNN6p.js +0 -20
- package/dist/abort-cutoff.runtime.js +0 -1
- package/dist/abort-primitives-CGyFwJ93.js +0 -92
- package/dist/abort-signal-CrrraMAi.js +0 -13
- package/dist/abort.runtime-oBiooAFx.js +0 -2
- package/dist/abort.runtime.js +0 -1
- package/dist/access-DIqrGWVo.js +0 -81
- package/dist/access-control-DfV6HWO9.js +0 -152
- package/dist/account-action-gate-eHi2MB4J.js +0 -12
- package/dist/account-core-DOelA7Wl.js +0 -26
- package/dist/account-helpers-CafpxP7V.js +0 -1
- package/dist/account-helpers-jJOgsae3.js +0 -102
- package/dist/account-id-DXal1kRJ.js +0 -1
- package/dist/account-inspect-CfagweUE.js +0 -158
- package/dist/account-inspect-DOt4IDX6.js +0 -92
- package/dist/account-inspect-pnXre-7b.js +0 -81
- package/dist/account-lookup-CLJxpfHr.js +0 -17
- package/dist/account-resolution-CbKUJkzG.js +0 -30
- package/dist/account-selection-B8a_DqXo.js +0 -222
- package/dist/account-snapshot-fields-mr-1u321.js +0 -130
- package/dist/account-summary-DA6ds0Hk.js +0 -36
- package/dist/accounts-CO-lK8jJ.js +0 -150
- package/dist/accounts-D419O6Gq.js +0 -2
- package/dist/accounts-DKMLcV4g.js +0 -132
- package/dist/accounts-DdiZwn14.js +0 -57
- package/dist/accounts-SWhOQhoA.js +0 -58
- package/dist/accounts-iR2U_Vs4.js +0 -41
- package/dist/accounts-jsSym1md.js +0 -102
- package/dist/accounts-p4Eir-wB.js +0 -107
- package/dist/accounts-uAWNlC7q.js +0 -94
- package/dist/accounts-x23pAGjm.js +0 -137
- package/dist/accounts.runtime-PJOhs60R.js +0 -2
- package/dist/accounts.runtime.js +0 -1
- package/dist/ack-reactions-fcKs7CQ_.js +0 -43
- package/dist/acp-cli-ByWTIhFx.js +0 -2207
- package/dist/acp-runtime-D7wrReOP.js +0 -8
- package/dist/acp-stateful-target-driver-DY2EfkQt.js +0 -60
- package/dist/action-runtime-BdRtmydq.js +0 -318
- package/dist/action-runtime-DvNB5A61.js +0 -72
- package/dist/action-runtime-api-BnVs42oX.js +0 -1028
- package/dist/actions-CUYHtUqe.js +0 -531
- package/dist/actions.runtime-BBrSlYkH.js +0 -18
- package/dist/actions.runtime-DB4aKmBO.js +0 -5
- package/dist/actions.runtime-bdKprwSE.js +0 -2
- package/dist/actions.runtime.js +0 -1
- package/dist/active-listener-SB9ihcaC.js +0 -46
- package/dist/agent-command-C_MGil8o.js +0 -1457
- package/dist/agent-list-MRXQwyo0.js +0 -52
- package/dist/agent-media-payload-DDTSvr-n.js +0 -17
- package/dist/agent-paths-D711oayD.js +0 -12
- package/dist/agent-runner-utils-DEYzwZHa.js +0 -182
- package/dist/agent-runner.runtime-v2uIsAVy.js +0 -2218
- package/dist/agent-runner.runtime.js +0 -1
- package/dist/agent-runtime-Cz19IsmJ.js +0 -142
- package/dist/agent-s4m0Xp6V.js +0 -2
- package/dist/agent-scope-rWWUivuC.js +0 -215
- package/dist/agent-tools-login-DU1gQC9-.js +0 -57
- package/dist/agents/auth-profiles.runtime.js +0 -7
- package/dist/agents/pi-model-discovery-runtime.js +0 -2
- package/dist/agents-B2W3IoEe.js +0 -888
- package/dist/agents-DmE3LRim.js +0 -5
- package/dist/agents.config-D6XoJFQ-.js +0 -3
- package/dist/agents.config-Ui_tQc3C.js +0 -121
- package/dist/allow-from-Bj0HDNYh.js +0 -20
- package/dist/allow-from-CJwSUt_K.js +0 -9
- package/dist/allow-from-xOap1t02.js +0 -62
- package/dist/allow-list-DeRUbyj4.js +0 -319
- package/dist/allowed-updates-aOgPxM0g.js +0 -31
- package/dist/allowlist-config-edit-Ch2EvAYo.js +0 -279
- package/dist/allowlist-match-Dm6AqFEs.js +0 -63
- package/dist/ansi-B_0KjIJj.js +0 -54
- package/dist/anthropic-vertex-Stff_3_3.js +0 -21
- package/dist/anthropic-vertex-stream-DgR8-m-G.js +0 -653
- package/dist/api-7Pf2fGBp.js +0 -11
- package/dist/api-B80kCRiV.js +0 -11
- package/dist/api-B8_Wwelx.js +0 -2
- package/dist/api-BLI24uxW.js +0 -2
- package/dist/api-BLSg8PM8.js +0 -2
- package/dist/api-BRy2h4ZA.js +0 -2
- package/dist/api-BU_YBaOK.js +0 -3
- package/dist/api-BXQjqvPC.js +0 -2
- package/dist/api-BY9iT-AK.js +0 -106
- package/dist/api-BipiQQoS.js +0 -2
- package/dist/api-Bk5mFOju.js +0 -10
- package/dist/api-BrsLZRXn.js +0 -3
- package/dist/api-C16j1Xno.js +0 -2
- package/dist/api-CGtiPyfv.js +0 -8358
- package/dist/api-CHIsf5Wl.js +0 -21
- package/dist/api-CP9q4gi6.js +0 -19
- package/dist/api-CWPDpJCM.js +0 -2
- package/dist/api-CaMdAP9T.js +0 -2
- package/dist/api-CftMlodx.js +0 -5
- package/dist/api-Cpj_QQAF.js +0 -5
- package/dist/api-D13mhDzE.js +0 -33
- package/dist/api-DGcbqpSh.js +0 -2
- package/dist/api-DIGFhGqm.js +0 -30
- package/dist/api-DNxTJAiA.js +0 -5
- package/dist/api-DasNTWRo.js +0 -2
- package/dist/api-Dn7n2sWC.js +0 -74
- package/dist/api-Drq06O1M2.js +0 -6
- package/dist/api-OOJHubHS.js +0 -77
- package/dist/api-XH46JouJ.js +0 -2
- package/dist/api-builder-uuKvRs_O.js +0 -66
- package/dist/api-e3cIcFaV.js +0 -1
- package/dist/api-fetch-CvBBI8q8.js +0 -35
- package/dist/api-key-rotation-BCssmYGp.js +0 -150
- package/dist/api-rPpH8518.js +0 -322
- package/dist/api-w-46PN0B.js +0 -2
- package/dist/apply-DfjUTAkv.js +0 -485
- package/dist/apply.runtime-B-srtEUl.js +0 -2
- package/dist/apply.runtime-DOG87kW8.js +0 -166
- package/dist/apply.runtime.js +0 -1
- package/dist/approval-native-CI9-iVJa.js +0 -79
- package/dist/approval-native-runtime-2AVlvrdL.js +0 -399
- package/dist/approval-renderers-BTKeDNRo.js +0 -87
- package/dist/approval-runtime-DIA8ohXa.js +0 -262
- package/dist/archive-BaCqqQP1.js +0 -537
- package/dist/arg-split-get0R_Yr.js +0 -38
- package/dist/artifacts-DXKlQp1z.js +0 -52
- package/dist/assistant-error-format-CFSPB8qt.js +0 -109
- package/dist/async-lock-QqhPYwhW.js +0 -19
- package/dist/attachment-normalize-CMMyswNa.js +0 -921
- package/dist/audio-BxqNDSFq.js +0 -53
- package/dist/audio-DZWA6M9B.js +0 -41
- package/dist/audit-86J-sIQq.js +0 -54
- package/dist/audit-D9O3O-41.js +0 -86
- package/dist/audit-DwAT-Kzg.js +0 -892
- package/dist/audit-channel.allow-from.runtime-DmuUvr2f.js +0 -5
- package/dist/audit-channel.allow-from.runtime.js +0 -1
- package/dist/audit-channel.collect.runtime-B76LAkrF.js +0 -528
- package/dist/audit-channel.collect.runtime.js +0 -1
- package/dist/audit-channel.discord.runtime-qM5u1Hnl.js +0 -5
- package/dist/audit-channel.discord.runtime.js +0 -1
- package/dist/audit-channel.telegram.runtime-DpwmRUPy.js +0 -8
- package/dist/audit-channel.telegram.runtime.js +0 -1
- package/dist/audit-channel.zalouser.runtime-CzlFZYsv.js +0 -5
- package/dist/audit-channel.zalouser.runtime.js +0 -1
- package/dist/audit-extra.async-BupKW2BB.js +0 -820
- package/dist/audit-fs-B3GdTjId.js +0 -375
- package/dist/audit-membership-runtime-n195y1jy.js +0 -55
- package/dist/audit.deep.runtime-2gZPpwj8.js +0 -2
- package/dist/audit.deep.runtime.js +0 -1
- package/dist/audit.nondeep.runtime-6MT8p_25.js +0 -831
- package/dist/audit.nondeep.runtime.js +0 -1
- package/dist/audit.runtime-jdG0-1Bq.js +0 -7
- package/dist/audit.runtime.js +0 -1
- package/dist/auth-CmL8nlqP.js +0 -371
- package/dist/auth-Zya_1BCc.js +0 -181
- package/dist/auth-choice-CSSk-2VN.js +0 -69
- package/dist/auth-choice-Uyll2O8p.js +0 -341
- package/dist/auth-choice-legacy-5XgU4yCZ.js +0 -44
- package/dist/auth-choice-options-DTRb6fq4.js +0 -98
- package/dist/auth-choice-prompt-BAQTSD2R.js +0 -36
- package/dist/auth-choice-prompt-D6qkTw8h.js +0 -2
- package/dist/auth-choice-x5Cm9EXp.js +0 -3
- package/dist/auth-choice.apply-helpers-CtKCiOT4.js +0 -2
- package/dist/auth-choice.plugin-providers.runtime-BVH7Kq_W.js +0 -11
- package/dist/auth-choice.plugin-providers.runtime.js +0 -1
- package/dist/auth-health-BBleirOY.js +0 -165
- package/dist/auth-mode-policy-BD7_M2AG.js +0 -18
- package/dist/auth-profiles-B0SpzBJv.js +0 -440
- package/dist/auth-rate-limit-OkMcM1wH.js +0 -119
- package/dist/auth-store-Bro-SY1-.js +0 -242
- package/dist/avatar-policy-pho6U35i.js +0 -67
- package/dist/backend-config-CNAjcjho.js +0 -311
- package/dist/backoff-nvVV-tHk.js +0 -18
- package/dist/backup-create-CkkM1HNg.js +0 -462
- package/dist/backup-health-BWSliymu.js +0 -59
- package/dist/banner-DPWatUan.js +0 -370
- package/dist/banner-lDKgB6uE.js +0 -2
- package/dist/base-session-key-CRSigEPk.js +0 -14
- package/dist/binaries-CWBYavgU.js +0 -2
- package/dist/binaries-sPf-9aLM.js +0 -11
- package/dist/binding-registry-BkSvI4jO.js +0 -520
- package/dist/binding-targets-CdIq3brX.js +0 -99
- package/dist/bindings-AuReyzvX.js +0 -21
- package/dist/bindings-CYhLRcr8.js +0 -69
- package/dist/block-reply-pipeline-GSCCinHx.js +0 -266
- package/dist/block-streaming-4outFa6R.js +0 -107
- package/dist/bluebubbles-CorTCHc9.js +0 -64
- package/dist/bluebubbles-D2WymlOg.js +0 -235
- package/dist/bluebubbles-policy-C3d8eqhQ.js +0 -13
- package/dist/bonjour-cache-cleanup-BZJ-GrdX.js +0 -126
- package/dist/boolean-BEhDlAk_.js +0 -29
- package/dist/boolean-param-B807dWHx.js +0 -13
- package/dist/bot-BM1bybV7.js +0 -4268
- package/dist/bot-message-context-CdedyAq_.js +0 -2
- package/dist/bot-message-context-DKGx6N8p.js +0 -1175
- package/dist/bot-message-context.runtime-ClW1x1V5.js +0 -7
- package/dist/bot-message-context.runtime.js +0 -1
- package/dist/bot-message-context.session.runtime-BWjdkRuf.js +0 -12
- package/dist/bot-message-context.session.runtime.js +0 -1
- package/dist/bot-native-commands.delivery.runtime-CgfbR-Nj.js +0 -3
- package/dist/bot-native-commands.delivery.runtime.js +0 -1
- package/dist/bot-native-commands.runtime-DCz7w0aK.js +0 -11
- package/dist/bot-native-commands.runtime.js +0 -1
- package/dist/boundary-file-read-DB4ibbUg.js +0 -192
- package/dist/brave-web-search-provider-B7m_Mprt.js +0 -441
- package/dist/brew-B9JEV5Jj.js +0 -44
- package/dist/browser-config-D_OlwMzh.js +0 -226
- package/dist/browser-open-C9FOO4U_.js +0 -94
- package/dist/browser-runtime-CnWZ_eLQ.js +0 -185
- package/dist/browser-support-Cdp2Gr_6.js +0 -34
- package/dist/btw-command-CPUGSdlD.js +0 -16
- package/dist/build-info.json +0 -5
- package/dist/bundle-lsp-CCIAK1od.js +0 -93
- package/dist/bundled/boot-md/HOOK.md +0 -20
- package/dist/bundled/boot-md/handler.js +0 -180
- package/dist/bundled/bootstrap-extra-files/HOOK.md +0 -53
- package/dist/bundled/bootstrap-extra-files/handler.js +0 -42
- package/dist/bundled/command-logger/HOOK.md +0 -122
- package/dist/bundled/command-logger/handler.js +0 -56
- package/dist/bundled/session-memory/HOOK.md +0 -108
- package/dist/bundled/session-memory/handler.js +0 -196
- package/dist/bundled/workflow-summary/HOOK.md +0 -123
- package/dist/bundled/workflow-summary/handler.js +0 -115
- package/dist/bundled-capability-metadata-BpPgIy_5.js +0 -40
- package/dist/bundled-compat-BLlVmkDi.js +0 -64
- package/dist/bundled-sources-BQTCt2mJ.js +0 -53
- package/dist/button-types-B3_mzf8P.js +0 -54
- package/dist/cache-controls-DBdT4I-H.js +0 -40
- package/dist/call-dy-GwrXS.js +0 -649
- package/dist/call-ti-nPnzT.js +0 -2
- package/dist/canvas-host/a2ui/.bundle.hash +0 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +0 -14896
- package/dist/canvas-host/a2ui/index.html +0 -307
- package/dist/capability-provider-runtime-CFUC5NbJ.js +0 -40
- package/dist/catalog-5PPtilI5.js +0 -274
- package/dist/channel-2EW4xzvV.js +0 -788
- package/dist/channel-BiRtGLF8.js +0 -1135
- package/dist/channel-C3AVw0Nl.js +0 -883
- package/dist/channel-CPe2XmyD.js +0 -1217
- package/dist/channel-CVFWRvjf.js +0 -337
- package/dist/channel-Cs0onQ6d.js +0 -4976
- package/dist/channel-D18v9r53.js +0 -1661
- package/dist/channel-D2n2s8Le.js +0 -208
- package/dist/channel-DWKApPW2.js +0 -454
- package/dist/channel-Depm5C-f.js +0 -800
- package/dist/channel-DwTcZxFU.js +0 -1129
- package/dist/channel-LT5vI3EK.js +0 -361
- package/dist/channel-XgThIGmf.js +0 -698
- package/dist/channel-account-context-CWd3uN_m.js +0 -104
- package/dist/channel-actions-DSvaYD1T.js +0 -39
- package/dist/channel-bQKtZIt6.js +0 -599
- package/dist/channel-catalog.json +0 -3
- package/dist/channel-config-D0eO5f5m.js +0 -115
- package/dist/channel-config-helpers-CLFL8FLU.js +0 -482
- package/dist/channel-config-primitives-DwsP66Ak.js +0 -3
- package/dist/channel-config-schema-DsguzRfd.js +0 -6
- package/dist/channel-config-writes-DQZOOZZ8.js +0 -1
- package/dist/channel-configured-B6WgvouH.js +0 -108
- package/dist/channel-feedback-DiLm9hqS.js +0 -257
- package/dist/channel-inbound-CXD3aSAK.js +0 -30
- package/dist/channel-issues-C-49e607.js +0 -13
- package/dist/channel-lifecycle-BnjeZxB6.js +0 -286
- package/dist/channel-lifecycle.core-Cn3zeU0h.js +0 -69
- package/dist/channel-options-DXJ7b7Ye.js +0 -39
- package/dist/channel-pairing-Byr3MFbN.js +0 -68
- package/dist/channel-plugin-common-D2EFcTg8.js +0 -4
- package/dist/channel-plugin-ids-DiOSWlnO.js +0 -56
- package/dist/channel-plugin-resolution-SMHmHx5v.js +0 -144
- package/dist/channel-policy-B-XKjrjK.js +0 -32
- package/dist/channel-reply-pipeline-BtBcBCNu.js +0 -16
- package/dist/channel-resolution-Du3EtWh1.js +0 -60
- package/dist/channel-runtime-F8_51GPp.js +0 -9
- package/dist/channel-selection-Bz3pl14y.js +0 -125
- package/dist/channel-send-result-CyfDCXJG.js +0 -40
- package/dist/channel-setup-yWpuHwhm.js +0 -51
- package/dist/channel-shared-gHcJ8n-f.js +0 -58
- package/dist/channel-status-CyoeLEnj.js +0 -2
- package/dist/channel-summary-5zHt-z1E.js +0 -139
- package/dist/channel-summary-B_fbXZ3l.js +0 -2
- package/dist/channel-target-DHO43h-I.js +0 -157
- package/dist/channel-targets-C8ZPfJmV.js +0 -18
- package/dist/channel-y-bXwYi3.js +0 -783
- package/dist/channel.runtime-B2SEUCf0.js +0 -14
- package/dist/channel.runtime-BF5qdBeA.js +0 -5
- package/dist/channel.runtime-BPaq6EO_.js +0 -108
- package/dist/channel.runtime-BV8FGxyb.js +0 -373
- package/dist/channel.runtime-CGnamSTC.js +0 -125
- package/dist/channel.runtime-CRNf20Ct.js +0 -80
- package/dist/channel.runtime-CRSWVexY.js +0 -335
- package/dist/channel.runtime-Cg6DmoTp.js +0 -783
- package/dist/channel.runtime-CpHTHeFR.js +0 -309
- package/dist/channel.runtime-ZdhCn8XI.js +0 -3315
- package/dist/channel.runtime-cXufT2kW.js +0 -61
- package/dist/channel.runtime.js +0 -1
- package/dist/channel.setup-Bq1vgxXZ.js +0 -279
- package/dist/channels-BZC2kp_G.js +0 -409
- package/dist/channels-CMeYB3bY.js +0 -1134
- package/dist/channels-cli-BIzqRmuu.js +0 -246
- package/dist/channels-status-issues-DqTdy1lq.js +0 -17
- package/dist/chat-envelope-DlGbh8k2.js +0 -158
- package/dist/chat-meta-wVbKo1sw.js +0 -700
- package/dist/chat-target-prefixes-DCF8a_Lp.js +0 -156
- package/dist/chat-type-DXjGtE-S.js +0 -10
- package/dist/chunk-CW-a7Cfh.js +0 -334
- package/dist/chunk-CrysgU_F.js +0 -36
- package/dist/chutes-oauth-Bh3BTMMG.js +0 -127
- package/dist/cjk-chars-Dl_Ko7yI.js +0 -50
- package/dist/clack-prompter-C5PtKpUH.js +0 -112
- package/dist/clawbot-cli-CgHyabtp.js +0 -9
- package/dist/clawhub-CDs2LE11.js +0 -263
- package/dist/clawhub-CO6YnoQZ.js +0 -163
- package/dist/cli/daemon-cli.js +0 -9
- package/dist/cli-CoOwN-V4.js +0 -164
- package/dist/cli-CpOL_jWZ.js +0 -152
- package/dist/cli-DCp06hI2.js +0 -2
- package/dist/cli-DVSDSUQm.js +0 -695
- package/dist/cli-backend-B20k67rv.js +0 -44
- package/dist/cli-backend-CcuyEMrq.js +0 -1
- package/dist/cli-backend-DMTxL8mq.js +0 -40
- package/dist/cli-backend-M4CTb3mq.js +0 -49
- package/dist/cli-migration-BwqQvUer.js +0 -100
- package/dist/cli-name-C3PA6Rhs.js +0 -21
- package/dist/cli-runner-8SNo1pKS.js +0 -1014
- package/dist/cli-runtime-ChUqI2f-.js +0 -3
- package/dist/cli-shared-01J1LZRE.js +0 -72
- package/dist/cli-startup-metadata.json +0 -14
- package/dist/cli-utils-eYXt_xAg.js +0 -40
- package/dist/cli-watchdog-defaults-Dff-MFUz.js +0 -14
- package/dist/cli.runtime-WWGaX6X6.js +0 -547
- package/dist/cli.runtime.js +0 -1
- package/dist/client-BFxjGELJ.js +0 -5
- package/dist/client-C8_DsF-r.js +0 -7
- package/dist/client-bootstrap-BiVps8T6.js +0 -2
- package/dist/client-bootstrap-CFGCltAu.js +0 -121
- package/dist/client-lEilgam1.js +0 -87
- package/dist/cmd-argv-BbyQhzAC.js +0 -68
- package/dist/code-execution-CPcuE0sX.js +0 -142
- package/dist/codex-native-web-search-CyrsDBZ2.js +0 -155
- package/dist/codex-native-web-search-PFJu8fcM.js +0 -2
- package/dist/collection-runtime-DJjFReXJ.js +0 -1
- package/dist/command-auth-BAkZv3cP.js +0 -356
- package/dist/command-auth-native-Bsp5Doyd.js +0 -3
- package/dist/command-auth-tqFmaIaJ.js +0 -64
- package/dist/command-detection-BV7Ipg_0.js +0 -49
- package/dist/command-detection-DyqWl5Nq.js +0 -2
- package/dist/command-format-CX1xXtgB.js +0 -22
- package/dist/command-format-DwYoemR9.js +0 -2
- package/dist/command-gating-NyDk7t84.js +0 -40
- package/dist/command-options-BUoAEXAi.js +0 -25
- package/dist/command-poll-backoff-B7RiSvcV.js +0 -56
- package/dist/command-poll-backoff.runtime-DX9gobB0.js +0 -7
- package/dist/command-poll-backoff.runtime.js +0 -1
- package/dist/command-queue-CxEmvSGT.js +0 -253
- package/dist/command-registry-CaJXKNoO.js +0 -3
- package/dist/command-registry-Ct0qor9d.js +0 -199
- package/dist/command-secret-gateway-43O-1Hnf.js +0 -2
- package/dist/command-secret-gateway-C39SFGHd.js +0 -442
- package/dist/command-secret-targets-Bns-l1xV.js +0 -2
- package/dist/command-secret-targets-CTrFghcj.js +0 -87
- package/dist/command-surface-CfP1vask.js +0 -2
- package/dist/commands/status.summary.runtime.js +0 -146
- package/dist/commands-BxWe27p0.js +0 -42
- package/dist/commands-CiyPyNRY.js +0 -194
- package/dist/commands-acp-BeCm2Wnq.js +0 -990
- package/dist/commands-context-DbfMrVv4.js +0 -33
- package/dist/commands-core-CEmQydIV.js +0 -241
- package/dist/commands-core.runtime-BYooAQbc.js +0 -2
- package/dist/commands-core.runtime.js +0 -1
- package/dist/commands-handlers.runtime-CEAP4Yv2.js +0 -3707
- package/dist/commands-handlers.runtime.js +0 -1
- package/dist/commands-info-COwAtIWb.js +0 -651
- package/dist/commands-models-B4EJh5Fy.js +0 -395
- package/dist/commands-o21Y9Xck.js +0 -4
- package/dist/commands-registry-DgMc5_jk.js +0 -295
- package/dist/commands-registry.data-5O2FOeZl.js +0 -935
- package/dist/commands-registry.runtime-CT_YXpwM.js +0 -2
- package/dist/commands-registry.runtime.js +0 -1
- package/dist/commands-status.runtime-D4F4iVUh.js +0 -2
- package/dist/commands-status.runtime.js +0 -1
- package/dist/commands.runtime-_ALsMFcS.js +0 -4
- package/dist/commands.runtime.js +0 -1
- package/dist/common-Dbmo0I1E.js +0 -206
- package/dist/compact.runtime-CBfyBJbR.js +0 -7
- package/dist/compact.runtime.js +0 -1
- package/dist/completion-cli-COhEd9CF.js +0 -2
- package/dist/completion-cli-DHe4Rit5.js +0 -466
- package/dist/components-CamLdbbq.js +0 -797
- package/dist/components-DPbtLC3x.js +0 -2
- package/dist/config-CKJA2kAO.js +0 -53
- package/dist/config-D7-9dK3i.js +0 -138
- package/dist/config-DJ29sg5U.js +0 -475
- package/dist/config-DJNI2tTK.js +0 -136
- package/dist/config-Dr2GRT3y.js +0 -135
- package/dist/config-DsqKYjeo.js +0 -421
- package/dist/config-Q9kc32gz.js +0 -41
- package/dist/config-RUefx-_1.js +0 -8
- package/dist/config-cli-BqlYHmPA.js +0 -945
- package/dist/config-error-handler-BKRR0_j_.js +0 -197
- package/dist/config-error-handler-CT1igiX6.js +0 -2
- package/dist/config-eval-hTWq4IVy.js +0 -100
- package/dist/config-guard-Bk3_wSTH.js +0 -113
- package/dist/config-helpers-DLVbtn1B.js +0 -117
- package/dist/config-paths-BKYh__Ga.js +0 -8
- package/dist/config-paths-DP5yXXo2.js +0 -102
- package/dist/config-presence-omlqvhAQ.js +0 -79
- package/dist/config-regex-CvZFnWkO.js +0 -39
- package/dist/config-runtime-ngoccXmP.js +0 -13
- package/dist/config-schema-B3sQY5B_.js +0 -133
- package/dist/config-schema-B_2MhEQY.js +0 -71
- package/dist/config-schema-BpIXBNbc.js +0 -202
- package/dist/config-schema-BtfQOmdV.js +0 -115
- package/dist/config-schema-Bw-Xbo_T.js +0 -85
- package/dist/config-schema-Cqj-Mugi.js +0 -105
- package/dist/config-schema-DQSj_ZL_.js +0 -29
- package/dist/config-schema-Pe1Vn9kb.js +0 -17
- package/dist/config-schema-f7nntJMh.js +0 -25
- package/dist/config-schema-lBqODOnr.js +0 -25
- package/dist/config-schema-mfJ91WLf.js +0 -65
- package/dist/config-secret-input.runtime-B_HyRtgE.js +0 -3
- package/dist/config-secret-input.runtime.js +0 -1
- package/dist/config-state-DfIk9ME6.js +0 -289
- package/dist/config-status-Bnobp1-p.js +0 -2
- package/dist/config-status-Db93sFQB.js +0 -109
- package/dist/config-update-B_S0YQ_Y.js +0 -3
- package/dist/config-update-CK4EDDeD.js +0 -127
- package/dist/config-validation-Bh_sg7RW.js +0 -276
- package/dist/config-value-CMTdBw5q.js +0 -25
- package/dist/configure-CGDY1YR7.js +0 -1140
- package/dist/configure-V8jejRHr.js +0 -2
- package/dist/configured-provider-fallback-DWYDg0L7.js +0 -15
- package/dist/connection-auth-CKM60o55.js +0 -30
- package/dist/connection-details-DyVOoGG6.js +0 -56
- package/dist/constants-Bq55qi82.js +0 -71
- package/dist/constants-CimYBSye.js +0 -4
- package/dist/content-blocks-DuKJNUtm.js +0 -785
- package/dist/context-D-9a98Zk.js +0 -227
- package/dist/context-visibility-DTMZdcAH.js +0 -14
- package/dist/context-visibility-vOvLMUrZ.js +0 -35
- package/dist/context-window-guard-WE0ENAeQ.js +0 -46
- package/dist/control-ui-assets-DVYAF-2p.js +0 -240
- package/dist/control-ui-shared-BKXkFsA7.js +0 -29
- package/dist/conversation-binding-C2nuZ3Eg.js +0 -520
- package/dist/conversation-binding-input-CBwdWDC4.js +0 -250
- package/dist/conversation-bindings-Cq4z4vhr.js +0 -210
- package/dist/conversation-id-4JeHag0a.js +0 -168
- package/dist/conversation-id-CXuzm-Ub.js +0 -116
- package/dist/conversation-id-DCTwJCZF.js +0 -43
- package/dist/conversation-label-C2xTELop.js +0 -32
- package/dist/conversation-runtime-bArk0IjJ.js +0 -85
- package/dist/core-DaMVvavf.js +0 -195
- package/dist/core-api-D0U2iGRK.js +0 -670
- package/dist/core-command-descriptors-DxRm2H1p.js +0 -91
- package/dist/create-client-BOKOxyiu.js +0 -58
- package/dist/create-client-Bzn467Jo.js +0 -2
- package/dist/credentials-BGPs1gIX.js +0 -242
- package/dist/credentials-DUoYFiLk.js +0 -22
- package/dist/credentials-read-CDYtvkBt.js +0 -74
- package/dist/credentials-read-KB395CbD.js +0 -2
- package/dist/credentials-write.runtime-Bx7mKj4E.js +0 -9
- package/dist/credentials-write.runtime.js +0 -1
- package/dist/creds-files-CTtTs6zG.js +0 -19
- package/dist/cron-cli-Di3TakVa.js +0 -644
- package/dist/crypto-node.runtime-DI0fQ6wI.js +0 -5
- package/dist/crypto-node.runtime.js +0 -1
- package/dist/crypto-runtime-Bc-jKPlv.js +0 -1036
- package/dist/current-time--aIDbABZ.js +0 -20
- package/dist/daemon-cli-Cnry1ft1.js +0 -370
- package/dist/daemon-install-de_bWPuS.js +0 -63
- package/dist/daemon-install-plan.shared-u00bwv47.js +0 -222
- package/dist/daemon-runtime-DPejcJWG.js +0 -12
- package/dist/dangerous-name-matching-DnCDaXzP.js +0 -48
- package/dist/dangerous-name-runtime-Dinw00TZ.js +0 -1
- package/dist/dangerous-tools-C3RlQe7u.js +0 -38
- package/dist/date-time-DRQ0-oaw.js +0 -118
- package/dist/ddg-search-provider-B0zLjcDN.js +0 -182
- package/dist/dedupe-DZbQYOSD.js +0 -59
- package/dist/default-account-warnings-BCrmijcz.js +0 -15
- package/dist/default-models-Br0v8QOH.js +0 -35
- package/dist/defaults-DAt--D9n.js +0 -6
- package/dist/defaults-D_Y_lvUP.js +0 -7
- package/dist/defaults-MkMfnGzi.js +0 -7
- package/dist/delegate-CLP7zDS_.js +0 -43
- package/dist/deliver-CIUEKe4q.js +0 -954
- package/dist/deliver-LN-Yg8wS.js +0 -3
- package/dist/deliver-reply-DL-CSF43.js +0 -238
- package/dist/deliver-runtime-CoqXhxlS.js +0 -2
- package/dist/delivery-CL_3vFSl.js +0 -834
- package/dist/delivery-context-CoAL-jTI.js +0 -106
- package/dist/delivery-info-DTAUApso.js +0 -40
- package/dist/delivery-queue-DBW69jH4.js +0 -2
- package/dist/delivery-queue-DMubgaLa.js +0 -289
- package/dist/deps-34N0Nmbl.js +0 -67
- package/dist/deps-BVogrCia.js +0 -2
- package/dist/deps-DZJpA4XG.js +0 -153
- package/dist/detect-Zrcrs8SP.js +0 -12
- package/dist/detect-binary-CEX186X6.js +0 -30
- package/dist/device-auth-D_0GUMYY.js +0 -19
- package/dist/device-bootstrap-Bnn4K3fQ.js +0 -3
- package/dist/device-bootstrap-bwpHYQhY.js +0 -176
- package/dist/device-health-B3q7Cmqn.js +0 -2
- package/dist/device-health-DhmPD0gq.js +0 -16
- package/dist/device-identity-Cak311si.js +0 -2
- package/dist/device-identity-Doxo0HJx.js +0 -140
- package/dist/device-metadata-normalization-B5_zplC_.js +0 -21
- package/dist/device-pairing-BCpR-Vtb.js +0 -520
- package/dist/devices-cli-DYPkfzsG.js +0 -328
- package/dist/diagnostic-DfKz60Xk.js +0 -311
- package/dist/diagnostic-events-CUSmY-rn.js +0 -48
- package/dist/diagnostic-flags-DLDDycUv.js +0 -64
- package/dist/diagnostic-runtime-ZQC4AswI.js +0 -1
- package/dist/diagnostics-Cxl1bFGj.js +0 -33
- package/dist/diagnostics-GjF7wpY9.js +0 -2
- package/dist/diagnostics-otel-C2RQUlQT.js +0 -3
- package/dist/diffs-DsHt689X.js +0 -2
- package/dist/direct-dm-ByuWacLn.js +0 -139
- package/dist/direct-management-DEtuCcDL.js +0 -2
- package/dist/direct-management-DMp7MOnt.js +0 -300
- package/dist/direct-room-ARYWsCbX.js +0 -2
- package/dist/direct-room-DYlSJOU_.js +0 -67
- package/dist/directive-handling.defaults-BMh2DXTA.js +0 -19
- package/dist/directive-handling.fast-lane-CBX4jbax.js +0 -2
- package/dist/directive-handling.fast-lane-DRvycpgg.js +0 -64
- package/dist/directive-handling.impl-BKJf5Ltu.js +0 -672
- package/dist/directive-handling.impl-BkdGnm-T.js +0 -2
- package/dist/directive-handling.levels-BHOBnnn8.js +0 -2
- package/dist/directive-handling.levels-CecoBNlK.js +0 -12
- package/dist/directive-handling.parse-BuTiWmrT.js +0 -375
- package/dist/directive-handling.persist-D9RYevoA.js +0 -133
- package/dist/directive-handling.persist.runtime-Cb_unTVH.js +0 -2
- package/dist/directive-handling.persist.runtime.js +0 -1
- package/dist/directive-handling.shared-_Zvt3-ej.js +0 -158
- package/dist/directive-tags-Cm0H6Dn_.js +0 -109
- package/dist/directives-f-UxcP8D.js +0 -209
- package/dist/directory-cache-CM_EUchr.js +0 -62
- package/dist/directory-cli-D6N59tzr.js +0 -238
- package/dist/directory-config-helpers-BCrssKbI.js +0 -141
- package/dist/directory-runtime-CAabZ_XW.js +0 -20
- package/dist/directory.static-TKo2MeNR.js +0 -45
- package/dist/discord-BOpl5w4U.js +0 -5
- package/dist/discord-account-wyFuLDq_.js +0 -11
- package/dist/discord-core-BpzKxDZ7.js +0 -5
- package/dist/discord-lOPvIxp4.js +0 -11
- package/dist/discord-runtime-surface-Dm5WUtCV.js +0 -67
- package/dist/discord-session-key-DaPto1yr.js +0 -11
- package/dist/discord-surface-Cg_Mu9MI.js +0 -30
- package/dist/discord-thread-bindings-zIOp1Tj4.js +0 -29
- package/dist/discord-timeouts-Di5n5LAU.js +0 -12
- package/dist/discovery-DLbFJLD_.js +0 -171
- package/dist/dispatch-C4gGGYZt.js +0 -858
- package/dist/dispatch-acp.runtime-DUHj6bP-.js +0 -884
- package/dist/dispatch-acp.runtime.js +0 -1
- package/dist/dist-7JNqoGV7.js +0 -3
- package/dist/dist-BqJPEiV8.js +0 -14245
- package/dist/dist-DdE56Pmi.js +0 -503
- package/dist/dist-shQCTuJB.js +0 -1239
- package/dist/dm-policy-shared-C99GNVxp.js +0 -188
- package/dist/dns-cli-vQBAzTmg.js +0 -192
- package/dist/docker-BN7sQKCb.js +0 -789
- package/dist/docs-cli-Br6cfKoS.js +0 -156
- package/dist/doctor-completion-Cf0GcTXR.js +0 -90
- package/dist/doctor-config-preflight-C2cKYiKe.js +0 -2
- package/dist/doctor-config-preflight-DNbO-_N8.js +0 -148
- package/dist/doctor-state-migrations-BXkbeSFy.js +0 -2
- package/dist/doctor-state-migrations-G3shZ-W_.js +0 -3
- package/dist/dotenv-CelghjA4.js +0 -11
- package/dist/dotenv-Csg1Xj8n.js +0 -113
- package/dist/embedding-provider-Aey9VsDb.js +0 -129
- package/dist/enable-BgSxsKp_.js +0 -57
- package/dist/encryption-guidance-62xAQFP4.js +0 -33
- package/dist/entry-status-3ymZYX2l.js +0 -172
- package/dist/entry.js +0 -209
- package/dist/env-CK3eZNIX.js +0 -40
- package/dist/env-overrides-CcDOWo0Y.js +0 -346
- package/dist/env-overrides.runtime-CKb7-Q72.js +0 -7
- package/dist/env-overrides.runtime.js +0 -1
- package/dist/env-substitution-UhJwb0ys.js +0 -136
- package/dist/envelope-CrC9AdBL.js +0 -137
- package/dist/error-runtime-D-gKufd_.js +0 -2
- package/dist/error-text-BC9WfvfX.js +0 -24
- package/dist/errors-Bs2h5H8p.js +0 -71
- package/dist/errors-CjFsF-QY.js +0 -9
- package/dist/exa-web-search-provider-DUUlmDcV.js +0 -355
- package/dist/exec-BO6vYjRf.js +0 -368
- package/dist/exec-CD7C9g-b.js +0 -2
- package/dist/exec-approval-reply-CFOEcmIv.js +0 -189
- package/dist/exec-approval-session-target-BbsAlD1Q.js +0 -159
- package/dist/exec-approvals-3UDrE7Q9.js +0 -1565
- package/dist/exec-approvals-CW5axvaY.js +0 -121
- package/dist/exec-approvals-cli-BPYvtJv-.js +0 -483
- package/dist/exec-approvals-effective-DbLJfkpe.js +0 -140
- package/dist/exec-safe-bin-runtime-policy-218hHVyc.js +0 -90
- package/dist/exec-safety-XzKkUSvE.js +0 -24
- package/dist/export-html/template.css +0 -1060
- package/dist/export-html/template.html +0 -88
- package/dist/export-html/template.js +0 -1875
- package/dist/export-html/vendor/highlight.min.js +0 -1213
- package/dist/export-html/vendor/marked.min.js +0 -6
- package/dist/extension-shared-V_4IXpRU.js +0 -74
- package/dist/extensionAPI.js +0 -17
- package/dist/extensions/acpx/index.js +0 -1855
- package/dist/extensions/acpx/mcp-proxy.mjs +0 -151
- package/dist/extensions/acpx/openclaw.plugin.json +0 -132
- package/dist/extensions/acpx/package.json +0 -14
- package/dist/extensions/acpx/runtime-api.js +0 -5
- package/dist/extensions/acpx/skills/acp-router/SKILL.md +0 -245
- package/dist/extensions/aicq-chat/index.js +0 -284
- package/dist/extensions/aicq-chat/openclaw.plugin.json +0 -30
- package/dist/extensions/amazon-bedrock/api.js +0 -3
- package/dist/extensions/amazon-bedrock/discovery.js +0 -2
- package/dist/extensions/amazon-bedrock/index.js +0 -65
- package/dist/extensions/amazon-bedrock/openclaw.plugin.json +0 -44
- package/dist/extensions/amazon-bedrock/package.json +0 -23
- package/dist/extensions/anthropic/api.js +0 -3
- package/dist/extensions/anthropic/cli-backend.js +0 -2
- package/dist/extensions/anthropic/cli-migration.js +0 -2
- package/dist/extensions/anthropic/cli-shared.js +0 -2
- package/dist/extensions/anthropic/index.js +0 -357
- package/dist/extensions/anthropic/media-understanding-provider.js +0 -2
- package/dist/extensions/anthropic/openclaw.plugin.json +0 -64
- package/dist/extensions/anthropic/package.json +0 -12
- package/dist/extensions/anthropic/stream-wrappers.js +0 -2
- package/dist/extensions/anthropic/test-api.js +0 -2
- package/dist/extensions/anthropic-vertex/api.js +0 -4
- package/dist/extensions/anthropic-vertex/index.js +0 -36
- package/dist/extensions/anthropic-vertex/openclaw.plugin.json +0 -12
- package/dist/extensions/anthropic-vertex/package.json +0 -12
- package/dist/extensions/anthropic-vertex/provider-catalog.js +0 -2
- package/dist/extensions/anthropic-vertex/region.js +0 -2
- package/dist/extensions/bluebubbles/api.js +0 -5
- package/dist/extensions/bluebubbles/channel-config-api.js +0 -2
- package/dist/extensions/bluebubbles/index.js +0 -13
- package/dist/extensions/bluebubbles/openclaw.plugin.json +0 -11
- package/dist/extensions/bluebubbles/package.json +0 -48
- package/dist/extensions/bluebubbles/runtime-api.js +0 -2
- package/dist/extensions/bluebubbles/setup-entry.js +0 -26
- package/dist/extensions/brave/index.js +0 -13
- package/dist/extensions/brave/openclaw.plugin.json +0 -50
- package/dist/extensions/brave/package.json +0 -12
- package/dist/extensions/brave/test-api.js +0 -2
- package/dist/extensions/brave/web-search-provider.js +0 -2
- package/dist/extensions/browser/browser-runtime-api.js +0 -4
- package/dist/extensions/browser/index.js +0 -20
- package/dist/extensions/browser/openclaw.plugin.json +0 -9
- package/dist/extensions/browser/package.json +0 -12
- package/dist/extensions/browser/runtime-api.js +0 -6
- package/dist/extensions/browser/test-support.js +0 -50
- package/dist/extensions/byteplus/api.js +0 -3
- package/dist/extensions/byteplus/index.js +0 -63
- package/dist/extensions/byteplus/models.js +0 -2
- package/dist/extensions/byteplus/openclaw.plugin.json +0 -33
- package/dist/extensions/byteplus/package.json +0 -12
- package/dist/extensions/byteplus/provider-catalog.js +0 -2
- package/dist/extensions/chutes/api.js +0 -3
- package/dist/extensions/chutes/index.js +0 -143
- package/dist/extensions/chutes/models.js +0 -2
- package/dist/extensions/chutes/onboard.js +0 -3
- package/dist/extensions/chutes/openclaw.plugin.json +0 -44
- package/dist/extensions/chutes/package.json +0 -12
- package/dist/extensions/chutes/provider-catalog.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/api.js +0 -3
- package/dist/extensions/cloudflare-ai-gateway/index.js +0 -188
- package/dist/extensions/cloudflare-ai-gateway/models.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/onboard.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/openclaw.plugin.json +0 -33
- package/dist/extensions/cloudflare-ai-gateway/package.json +0 -12
- package/dist/extensions/copilot-proxy/index.js +0 -125
- package/dist/extensions/copilot-proxy/openclaw.plugin.json +0 -27
- package/dist/extensions/copilot-proxy/package.json +0 -12
- package/dist/extensions/copilot-proxy/runtime-api.js +0 -3
- package/dist/extensions/deepgram/audio.js +0 -2
- package/dist/extensions/deepgram/index.js +0 -13
- package/dist/extensions/deepgram/media-understanding-provider.js +0 -2
- package/dist/extensions/deepgram/openclaw.plugin.json +0 -13
- package/dist/extensions/deepgram/package.json +0 -12
- package/dist/extensions/deepseek/api.js +0 -3
- package/dist/extensions/deepseek/index.js +0 -33
- package/dist/extensions/deepseek/models.js +0 -2
- package/dist/extensions/deepseek/onboard.js +0 -2
- package/dist/extensions/deepseek/openclaw.plugin.json +0 -32
- package/dist/extensions/deepseek/package.json +0 -12
- package/dist/extensions/deepseek/provider-catalog.js +0 -2
- package/dist/extensions/device-pair/api.js +0 -10
- package/dist/extensions/device-pair/index.js +0 -483
- package/dist/extensions/device-pair/notify.js +0 -2
- package/dist/extensions/device-pair/openclaw.plugin.json +0 -21
- package/dist/extensions/device-pair/qr-image.js +0 -3
- package/dist/extensions/diagnostics-otel/api.js +0 -6
- package/dist/extensions/diagnostics-otel/index.js +0 -485
- package/dist/extensions/diagnostics-otel/openclaw.plugin.json +0 -8
- package/dist/extensions/diagnostics-otel/package.json +0 -27
- package/dist/extensions/diffs/api.js +0 -4
- package/dist/extensions/diffs/assets/viewer-runtime.js +0 -1888
- package/dist/extensions/diffs/index.js +0 -2058
- package/dist/extensions/diffs/openclaw.plugin.json +0 -226
- package/dist/extensions/diffs/package.json +0 -24
- package/dist/extensions/diffs/runtime-api.js +0 -3
- package/dist/extensions/diffs/skills/diffs/SKILL.md +0 -23
- package/dist/extensions/discord/action-runtime-api.js +0 -2
- package/dist/extensions/discord/api.js +0 -14
- package/dist/extensions/discord/channel-config-api.js +0 -2
- package/dist/extensions/discord/index.js +0 -612
- package/dist/extensions/discord/openclaw.plugin.json +0 -11
- package/dist/extensions/discord/package.json +0 -52
- package/dist/extensions/discord/runtime-api.js +0 -230
- package/dist/extensions/discord/session-key-api.js +0 -2
- package/dist/extensions/discord/setup-entry.js +0 -10
- package/dist/extensions/discord/test-api.js +0 -45
- package/dist/extensions/discord/timeouts.js +0 -2
- package/dist/extensions/duckduckgo/index.js +0 -13
- package/dist/extensions/duckduckgo/openclaw.plugin.json +0 -41
- package/dist/extensions/duckduckgo/package.json +0 -12
- package/dist/extensions/duckduckgo/web-search-provider.js +0 -2
- package/dist/extensions/elevenlabs/index.js +0 -13
- package/dist/extensions/elevenlabs/openclaw.plugin.json +0 -13
- package/dist/extensions/elevenlabs/package.json +0 -12
- package/dist/extensions/elevenlabs/speech-provider.js +0 -2
- package/dist/extensions/elevenlabs/test-api.js +0 -2
- package/dist/extensions/elevenlabs/tts.js +0 -2
- package/dist/extensions/exa/index.js +0 -13
- package/dist/extensions/exa/openclaw.plugin.json +0 -39
- package/dist/extensions/exa/package.json +0 -12
- package/dist/extensions/exa/web-search-provider.js +0 -2
- package/dist/extensions/fal/image-generation-provider.js +0 -2
- package/dist/extensions/fal/index.js +0 -45
- package/dist/extensions/fal/onboard.js +0 -2
- package/dist/extensions/fal/openclaw.plugin.json +0 -40
- package/dist/extensions/fal/package.json +0 -12
- package/dist/extensions/feishu/api.js +0 -7
- package/dist/extensions/feishu/index.js +0 -2531
- package/dist/extensions/feishu/openclaw.plugin.json +0 -14
- package/dist/extensions/feishu/package.json +0 -52
- package/dist/extensions/feishu/runtime-api.js +0 -34
- package/dist/extensions/feishu/session-key-api.js +0 -2
- package/dist/extensions/feishu/setup-api.js +0 -2
- package/dist/extensions/feishu/setup-entry.js +0 -6
- package/dist/extensions/feishu/skills/feishu-doc/SKILL.md +0 -211
- package/dist/extensions/feishu/skills/feishu-doc/references/block-types.md +0 -103
- package/dist/extensions/feishu/skills/feishu-drive/SKILL.md +0 -97
- package/dist/extensions/feishu/skills/feishu-perm/SKILL.md +0 -119
- package/dist/extensions/feishu/skills/feishu-wiki/SKILL.md +0 -111
- package/dist/extensions/firecrawl/api.js +0 -33
- package/dist/extensions/firecrawl/index.js +0 -184
- package/dist/extensions/firecrawl/openclaw.plugin.json +0 -87
- package/dist/extensions/firecrawl/package.json +0 -12
- package/dist/extensions/firecrawl/web-search-provider.js +0 -2
- package/dist/extensions/github-copilot/api.js +0 -2
- package/dist/extensions/github-copilot/index.js +0 -138
- package/dist/extensions/github-copilot/login.js +0 -2
- package/dist/extensions/github-copilot/models-defaults.js +0 -38
- package/dist/extensions/github-copilot/models.js +0 -2
- package/dist/extensions/github-copilot/openclaw.plugin.json +0 -31
- package/dist/extensions/github-copilot/package.json +0 -12
- package/dist/extensions/github-copilot/token.js +0 -3
- package/dist/extensions/github-copilot/usage.js +0 -2
- package/dist/extensions/google/api.js +0 -3
- package/dist/extensions/google/cli-backend.js +0 -2
- package/dist/extensions/google/gemini-cli-provider.js +0 -110
- package/dist/extensions/google/google-shared.test-helpers.js +0 -92
- package/dist/extensions/google/image-generation-provider.js +0 -162
- package/dist/extensions/google/index.js +0 -213
- package/dist/extensions/google/media-understanding-provider.js +0 -104
- package/dist/extensions/google/model-id.js +0 -2
- package/dist/extensions/google/oauth.credentials.js +0 -2
- package/dist/extensions/google/oauth.flow.js +0 -2
- package/dist/extensions/google/oauth.http.js +0 -2
- package/dist/extensions/google/oauth.js +0 -3
- package/dist/extensions/google/oauth.project.js +0 -2
- package/dist/extensions/google/oauth.runtime.js +0 -2
- package/dist/extensions/google/oauth.shared.js +0 -2
- package/dist/extensions/google/oauth.token.js +0 -2
- package/dist/extensions/google/openclaw.plugin.json +0 -89
- package/dist/extensions/google/package.json +0 -12
- package/dist/extensions/google/provider-models.js +0 -2
- package/dist/extensions/google/runtime-api.js +0 -4
- package/dist/extensions/google/test-api.js +0 -2
- package/dist/extensions/google/web-search-provider.js +0 -2
- package/dist/extensions/googlechat/api.js +0 -2
- package/dist/extensions/googlechat/channel-config-api.js +0 -7
- package/dist/extensions/googlechat/index.js +0 -13
- package/dist/extensions/googlechat/openclaw.plugin.json +0 -11
- package/dist/extensions/googlechat/package.json +0 -48
- package/dist/extensions/googlechat/runtime-api.js +0 -39
- package/dist/extensions/googlechat/setup-entry.js +0 -6
- package/dist/extensions/googlechat/test-api.js +0 -3
- package/dist/extensions/groq/index.js +0 -13
- package/dist/extensions/groq/media-understanding-provider.js +0 -2
- package/dist/extensions/groq/openclaw.plugin.json +0 -13
- package/dist/extensions/groq/package.json +0 -12
- package/dist/extensions/huggingface/api.js +0 -4
- package/dist/extensions/huggingface/index.js +0 -54
- package/dist/extensions/huggingface/models.js +0 -2
- package/dist/extensions/huggingface/onboard.js +0 -2
- package/dist/extensions/huggingface/openclaw.plugin.json +0 -34
- package/dist/extensions/huggingface/package.json +0 -12
- package/dist/extensions/huggingface/provider-catalog.js +0 -3
- package/dist/extensions/imessage/api.js +0 -4
- package/dist/extensions/imessage/channel-config-api.js +0 -2
- package/dist/extensions/imessage/index.js +0 -211
- package/dist/extensions/imessage/openclaw.plugin.json +0 -11
- package/dist/extensions/imessage/package.json +0 -26
- package/dist/extensions/imessage/runtime-api.js +0 -11
- package/dist/extensions/imessage/setup-entry.js +0 -13
- package/dist/extensions/irc/api.js +0 -2
- package/dist/extensions/irc/channel-config-api.js +0 -2
- package/dist/extensions/irc/index.js +0 -12
- package/dist/extensions/irc/openclaw.plugin.json +0 -11
- package/dist/extensions/irc/package.json +0 -28
- package/dist/extensions/irc/setup-entry.js +0 -6
- package/dist/extensions/kilocode/api.js +0 -3
- package/dist/extensions/kilocode/index.js +0 -37
- package/dist/extensions/kilocode/onboard.js +0 -3
- package/dist/extensions/kilocode/openclaw.plugin.json +0 -33
- package/dist/extensions/kilocode/package.json +0 -12
- package/dist/extensions/kilocode/provider-catalog.js +0 -2
- package/dist/extensions/kilocode/provider-models.js +0 -2
- package/dist/extensions/kilocode/shared.js +0 -2
- package/dist/extensions/kimi-coding/api.js +0 -3
- package/dist/extensions/kimi-coding/index.js +0 -81
- package/dist/extensions/kimi-coding/onboard.js +0 -2
- package/dist/extensions/kimi-coding/openclaw.plugin.json +0 -38
- package/dist/extensions/kimi-coding/package.json +0 -12
- package/dist/extensions/kimi-coding/provider-catalog.js +0 -2
- package/dist/extensions/kimi-coding/stream.js +0 -2
- package/dist/extensions/line/api.js +0 -13
- package/dist/extensions/line/index.js +0 -815
- package/dist/extensions/line/openclaw.plugin.json +0 -11
- package/dist/extensions/line/package.json +0 -41
- package/dist/extensions/line/runtime-api.js +0 -11
- package/dist/extensions/line/setup-api.js +0 -3
- package/dist/extensions/line/setup-entry.js +0 -15
- package/dist/extensions/litellm/api.js +0 -2
- package/dist/extensions/litellm/index.js +0 -36
- package/dist/extensions/litellm/onboard.js +0 -2
- package/dist/extensions/litellm/openclaw.plugin.json +0 -33
- package/dist/extensions/litellm/package.json +0 -12
- package/dist/extensions/litellm/provider-catalog.js +0 -2
- package/dist/extensions/llm-task/api.js +0 -6
- package/dist/extensions/llm-task/index.js +0 -156
- package/dist/extensions/llm-task/openclaw.plugin.json +0 -33
- package/dist/extensions/llm-task/package.json +0 -16
- package/dist/extensions/lobster/index.js +0 -232
- package/dist/extensions/lobster/openclaw.plugin.json +0 -10
- package/dist/extensions/lobster/package.json +0 -17
- package/dist/extensions/lobster/runtime-api.js +0 -4
- package/dist/extensions/matrix/api.js +0 -10
- package/dist/extensions/matrix/helper-api.js +0 -3
- package/dist/extensions/matrix/index.js +0 -44
- package/dist/extensions/matrix/legacy-crypto-inspector.js +0 -41
- package/dist/extensions/matrix/openclaw.plugin.json +0 -11
- package/dist/extensions/matrix/package.json +0 -53
- package/dist/extensions/matrix/plugin-entry.handlers.runtime.js +0 -48
- package/dist/extensions/matrix/runtime-api.js +0 -25
- package/dist/extensions/matrix/setup-entry.js +0 -6
- package/dist/extensions/matrix/test-api.js +0 -3
- package/dist/extensions/matrix/thread-bindings-runtime.js +0 -2
- package/dist/extensions/mattermost/api.js +0 -2
- package/dist/extensions/mattermost/index.js +0 -15
- package/dist/extensions/mattermost/openclaw.plugin.json +0 -11
- package/dist/extensions/mattermost/package.json +0 -41
- package/dist/extensions/mattermost/runtime-api.js +0 -41
- package/dist/extensions/mattermost/setup-entry.js +0 -6
- package/dist/extensions/memory-core/api.js +0 -1
- package/dist/extensions/memory-core/index.js +0 -440
- package/dist/extensions/memory-core/openclaw.plugin.json +0 -9
- package/dist/extensions/memory-core/package.json +0 -23
- package/dist/extensions/memory-core/runtime-api.js +0 -3
- package/dist/extensions/memory-lancedb/api.js +0 -4
- package/dist/extensions/memory-lancedb/config.js +0 -2
- package/dist/extensions/memory-lancedb/index.js +0 -7037
- package/dist/extensions/memory-lancedb/lancedb-runtime.js +0 -2
- package/dist/extensions/memory-lancedb/openclaw.plugin.json +0 -92
- package/dist/extensions/memory-lancedb/package.json +0 -24
- package/dist/extensions/microsoft/index.js +0 -13
- package/dist/extensions/microsoft/openclaw.plugin.json +0 -13
- package/dist/extensions/microsoft/package.json +0 -15
- package/dist/extensions/microsoft/speech-provider.js +0 -2
- package/dist/extensions/microsoft/test-api.js +0 -2
- package/dist/extensions/microsoft/tts.js +0 -2
- package/dist/extensions/microsoft-foundry/auth.js +0 -2
- package/dist/extensions/microsoft-foundry/cli.js +0 -2
- package/dist/extensions/microsoft-foundry/index.js +0 -13
- package/dist/extensions/microsoft-foundry/onboard.js +0 -3
- package/dist/extensions/microsoft-foundry/openclaw.plugin.json +0 -39
- package/dist/extensions/microsoft-foundry/package.json +0 -12
- package/dist/extensions/microsoft-foundry/provider.js +0 -2
- package/dist/extensions/microsoft-foundry/runtime.js +0 -2
- package/dist/extensions/microsoft-foundry/shared-runtime.js +0 -3
- package/dist/extensions/microsoft-foundry/shared.js +0 -2
- package/dist/extensions/minimax/api.js +0 -6
- package/dist/extensions/minimax/image-generation-provider.js +0 -2
- package/dist/extensions/minimax/index.js +0 -219
- package/dist/extensions/minimax/media-understanding-provider.js +0 -2
- package/dist/extensions/minimax/model-definitions.js +0 -2
- package/dist/extensions/minimax/oauth.js +0 -2
- package/dist/extensions/minimax/oauth.runtime.js +0 -2
- package/dist/extensions/minimax/onboard.js +0 -2
- package/dist/extensions/minimax/openclaw.plugin.json +0 -98
- package/dist/extensions/minimax/package.json +0 -12
- package/dist/extensions/minimax/provider-catalog.js +0 -2
- package/dist/extensions/minimax/provider-models.js +0 -2
- package/dist/extensions/mistral/api.js +0 -5
- package/dist/extensions/mistral/index.js +0 -79
- package/dist/extensions/mistral/media-understanding-provider.js +0 -2
- package/dist/extensions/mistral/model-definitions.js +0 -2
- package/dist/extensions/mistral/onboard.js +0 -2
- package/dist/extensions/mistral/openclaw.plugin.json +0 -37
- package/dist/extensions/mistral/package.json +0 -12
- package/dist/extensions/mistral/provider-catalog.js +0 -2
- package/dist/extensions/modelstudio/api.js +0 -4
- package/dist/extensions/modelstudio/index.js +0 -111
- package/dist/extensions/modelstudio/model-definitions.js +0 -2
- package/dist/extensions/modelstudio/models.js +0 -2
- package/dist/extensions/modelstudio/onboard.js +0 -3
- package/dist/extensions/modelstudio/openclaw.plugin.json +0 -75
- package/dist/extensions/modelstudio/package.json +0 -12
- package/dist/extensions/modelstudio/provider-catalog.js +0 -2
- package/dist/extensions/moonshot/api.js +0 -4
- package/dist/extensions/moonshot/index.js +0 -58
- package/dist/extensions/moonshot/media-understanding-provider.js +0 -2
- package/dist/extensions/moonshot/onboard.js +0 -2
- package/dist/extensions/moonshot/openclaw.plugin.json +0 -87
- package/dist/extensions/moonshot/package.json +0 -12
- package/dist/extensions/moonshot/provider-catalog.js +0 -2
- package/dist/extensions/moonshot/test-api.js +0 -2
- package/dist/extensions/moonshot/web-search-provider.js +0 -2
- package/dist/extensions/msteams/api.js +0 -2
- package/dist/extensions/msteams/channel-config-api.js +0 -2
- package/dist/extensions/msteams/index.js +0 -13
- package/dist/extensions/msteams/openclaw.plugin.json +0 -11
- package/dist/extensions/msteams/package.json +0 -48
- package/dist/extensions/msteams/runtime-api.js +0 -47
- package/dist/extensions/msteams/setup-entry.js +0 -6
- package/dist/extensions/msteams/test-api.js +0 -2
- package/dist/extensions/nextcloud-talk/api.js +0 -2
- package/dist/extensions/nextcloud-talk/index.js +0 -12
- package/dist/extensions/nextcloud-talk/openclaw.plugin.json +0 -11
- package/dist/extensions/nextcloud-talk/package.json +0 -45
- package/dist/extensions/nextcloud-talk/runtime-api.js +0 -35
- package/dist/extensions/nextcloud-talk/setup-entry.js +0 -6
- package/dist/extensions/nostr/api.js +0 -15
- package/dist/extensions/nostr/index.js +0 -559
- package/dist/extensions/nostr/openclaw.plugin.json +0 -11
- package/dist/extensions/nostr/package.json +0 -44
- package/dist/extensions/nostr/runtime-api.js +0 -15
- package/dist/extensions/nostr/setup-api.js +0 -2
- package/dist/extensions/nostr/setup-entry.js +0 -6
- package/dist/extensions/nostr/test-api.js +0 -2
- package/dist/extensions/nvidia/api.js +0 -2
- package/dist/extensions/nvidia/index.js +0 -16
- package/dist/extensions/nvidia/openclaw.plugin.json +0 -17
- package/dist/extensions/nvidia/package.json +0 -12
- package/dist/extensions/nvidia/provider-catalog.js +0 -2
- package/dist/extensions/ollama/api.js +0 -3
- package/dist/extensions/ollama/index.js +0 -139
- package/dist/extensions/ollama/openclaw.plugin.json +0 -29
- package/dist/extensions/ollama/package.json +0 -12
- package/dist/extensions/ollama/runtime-api.js +0 -3
- package/dist/extensions/open-prose/index.js +0 -10
- package/dist/extensions/open-prose/openclaw.plugin.json +0 -13
- package/dist/extensions/open-prose/package.json +0 -12
- package/dist/extensions/open-prose/runtime-api.js +0 -3
- package/dist/extensions/open-prose/skills/prose/LICENSE +0 -21
- package/dist/extensions/open-prose/skills/prose/SKILL.md +0 -323
- package/dist/extensions/open-prose/skills/prose/alt-borges.md +0 -141
- package/dist/extensions/open-prose/skills/prose/alts/arabian-nights.md +0 -229
- package/dist/extensions/open-prose/skills/prose/alts/borges.md +0 -360
- package/dist/extensions/open-prose/skills/prose/alts/folk.md +0 -322
- package/dist/extensions/open-prose/skills/prose/alts/homer.md +0 -217
- package/dist/extensions/open-prose/skills/prose/alts/kafka.md +0 -373
- package/dist/extensions/open-prose/skills/prose/alts/shared-appendix.md +0 -35
- package/dist/extensions/open-prose/skills/prose/compiler.md +0 -2971
- package/dist/extensions/open-prose/skills/prose/examples/01-hello-world.prose +0 -4
- package/dist/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +0 -6
- package/dist/extensions/open-prose/skills/prose/examples/03-code-review.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +0 -14
- package/dist/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/07-refactor.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/08-blog-post.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +0 -25
- package/dist/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +0 -32
- package/dist/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +0 -27
- package/dist/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +0 -43
- package/dist/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +0 -51
- package/dist/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +0 -48
- package/dist/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +0 -23
- package/dist/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +0 -19
- package/dist/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +0 -19
- package/dist/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +0 -36
- package/dist/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +0 -71
- package/dist/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +0 -35
- package/dist/extensions/open-prose/skills/prose/examples/22-error-handling.prose +0 -51
- package/dist/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +0 -63
- package/dist/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +0 -86
- package/dist/extensions/open-prose/skills/prose/examples/25-conditionals.prose +0 -114
- package/dist/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +0 -100
- package/dist/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +0 -105
- package/dist/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +0 -37
- package/dist/extensions/open-prose/skills/prose/examples/28-gas-town.prose +0 -1572
- package/dist/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +0 -218
- package/dist/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +0 -42
- package/dist/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +0 -145
- package/dist/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +0 -168
- package/dist/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +0 -204
- package/dist/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +0 -296
- package/dist/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +0 -237
- package/dist/extensions/open-prose/skills/prose/examples/37-the-forge.prose +0 -1474
- package/dist/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +0 -455
- package/dist/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +0 -277
- package/dist/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +0 -32
- package/dist/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +0 -38
- package/dist/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +0 -46
- package/dist/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +0 -50
- package/dist/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +0 -261
- package/dist/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +0 -159
- package/dist/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +0 -637
- package/dist/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +0 -148
- package/dist/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +0 -225
- package/dist/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +0 -356
- package/dist/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +0 -445
- package/dist/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +0 -210
- package/dist/extensions/open-prose/skills/prose/examples/README.md +0 -391
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/README.md +0 -22
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +0 -18
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +0 -223
- package/dist/extensions/open-prose/skills/prose/guidance/antipatterns.md +0 -951
- package/dist/extensions/open-prose/skills/prose/guidance/patterns.md +0 -700
- package/dist/extensions/open-prose/skills/prose/guidance/system-prompt.md +0 -180
- package/dist/extensions/open-prose/skills/prose/help.md +0 -144
- package/dist/extensions/open-prose/skills/prose/lib/README.md +0 -108
- package/dist/extensions/open-prose/skills/prose/lib/calibrator.prose +0 -215
- package/dist/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +0 -174
- package/dist/extensions/open-prose/skills/prose/lib/error-forensics.prose +0 -250
- package/dist/extensions/open-prose/skills/prose/lib/inspector.prose +0 -196
- package/dist/extensions/open-prose/skills/prose/lib/profiler.prose +0 -460
- package/dist/extensions/open-prose/skills/prose/lib/program-improver.prose +0 -275
- package/dist/extensions/open-prose/skills/prose/lib/project-memory.prose +0 -118
- package/dist/extensions/open-prose/skills/prose/lib/user-memory.prose +0 -93
- package/dist/extensions/open-prose/skills/prose/lib/vm-improver.prose +0 -243
- package/dist/extensions/open-prose/skills/prose/primitives/session.md +0 -593
- package/dist/extensions/open-prose/skills/prose/prose.md +0 -1237
- package/dist/extensions/open-prose/skills/prose/state/filesystem.md +0 -498
- package/dist/extensions/open-prose/skills/prose/state/in-context.md +0 -384
- package/dist/extensions/open-prose/skills/prose/state/postgres.md +0 -880
- package/dist/extensions/open-prose/skills/prose/state/sqlite.md +0 -531
- package/dist/extensions/openai/api.js +0 -4
- package/dist/extensions/openai/cli-backend.js +0 -2
- package/dist/extensions/openai/default-models.js +0 -2
- package/dist/extensions/openai/image-generation-provider.js +0 -2
- package/dist/extensions/openai/index.js +0 -24
- package/dist/extensions/openai/media-understanding-provider.js +0 -2
- package/dist/extensions/openai/openai-codex-auth-identity.js +0 -2
- package/dist/extensions/openai/openai-codex-catalog.js +0 -2
- package/dist/extensions/openai/openai-codex-provider.js +0 -2
- package/dist/extensions/openai/openai-codex-provider.runtime.js +0 -14
- package/dist/extensions/openai/openai-provider.js +0 -2
- package/dist/extensions/openai/openclaw.plugin.json +0 -61
- package/dist/extensions/openai/package.json +0 -12
- package/dist/extensions/openai/shared.js +0 -4
- package/dist/extensions/openai/speech-provider.js +0 -2
- package/dist/extensions/openai/test-api.js +0 -5
- package/dist/extensions/openai/tts.js +0 -2
- package/dist/extensions/opencode/api.js +0 -3
- package/dist/extensions/opencode/index.js +0 -63
- package/dist/extensions/opencode/onboard.js +0 -2
- package/dist/extensions/opencode/openclaw.plugin.json +0 -33
- package/dist/extensions/opencode/package.json +0 -12
- package/dist/extensions/opencode-go/api.js +0 -3
- package/dist/extensions/opencode-go/index.js +0 -54
- package/dist/extensions/opencode-go/onboard.js +0 -2
- package/dist/extensions/opencode-go/openclaw.plugin.json +0 -33
- package/dist/extensions/opencode-go/package.json +0 -12
- package/dist/extensions/openrouter/api.js +0 -3
- package/dist/extensions/openrouter/index.js +0 -121
- package/dist/extensions/openrouter/media-understanding-provider.js +0 -2
- package/dist/extensions/openrouter/onboard.js +0 -2
- package/dist/extensions/openrouter/openclaw.plugin.json +0 -37
- package/dist/extensions/openrouter/package.json +0 -12
- package/dist/extensions/openrouter/provider-catalog.js +0 -2
- package/dist/extensions/openshell/index.js +0 -919
- package/dist/extensions/openshell/openclaw.plugin.json +0 -118
- package/dist/extensions/openshell/package.json +0 -12
- package/dist/extensions/perplexity/index.js +0 -13
- package/dist/extensions/perplexity/openclaw.plugin.json +0 -54
- package/dist/extensions/perplexity/package.json +0 -12
- package/dist/extensions/perplexity/test-api.js +0 -2
- package/dist/extensions/perplexity/web-search-provider.js +0 -2
- package/dist/extensions/phone-control/index.js +0 -283
- package/dist/extensions/phone-control/openclaw.plugin.json +0 -11
- package/dist/extensions/phone-control/runtime-api.js +0 -3
- package/dist/extensions/qianfan/api.js +0 -3
- package/dist/extensions/qianfan/index.js +0 -26
- package/dist/extensions/qianfan/onboard.js +0 -2
- package/dist/extensions/qianfan/openclaw.plugin.json +0 -32
- package/dist/extensions/qianfan/package.json +0 -12
- package/dist/extensions/qianfan/provider-catalog.js +0 -2
- package/dist/extensions/qqbot/api.js +0 -173
- package/dist/extensions/qqbot/index.js +0 -445
- package/dist/extensions/qqbot/openclaw.plugin.json +0 -257
- package/dist/extensions/qqbot/package.json +0 -52
- package/dist/extensions/qqbot/runtime-api.js +0 -2
- package/dist/extensions/qqbot/setup-entry.js +0 -6
- package/dist/extensions/qqbot/skills/qqbot-channel/SKILL.md +0 -262
- package/dist/extensions/qqbot/skills/qqbot-channel/references/api_references.md +0 -521
- package/dist/extensions/qqbot/skills/qqbot-media/SKILL.md +0 -36
- package/dist/extensions/qqbot/skills/qqbot-remind/SKILL.md +0 -149
- package/dist/extensions/searxng/index.js +0 -13
- package/dist/extensions/searxng/openclaw.plugin.json +0 -46
- package/dist/extensions/searxng/package.json +0 -12
- package/dist/extensions/searxng/web-search-provider.js +0 -2
- package/dist/extensions/sglang/api.js +0 -4
- package/dist/extensions/sglang/defaults.js +0 -2
- package/dist/extensions/sglang/index.js +0 -77
- package/dist/extensions/sglang/models.js +0 -2
- package/dist/extensions/sglang/openclaw.plugin.json +0 -29
- package/dist/extensions/sglang/package.json +0 -12
- package/dist/extensions/signal/api.js +0 -7
- package/dist/extensions/signal/channel-config-api.js +0 -2
- package/dist/extensions/signal/index.js +0 -319
- package/dist/extensions/signal/openclaw.plugin.json +0 -11
- package/dist/extensions/signal/package.json +0 -24
- package/dist/extensions/signal/reaction-runtime-api.js +0 -2
- package/dist/extensions/signal/runtime-api.js +0 -24
- package/dist/extensions/signal/setup-entry.js +0 -13
- package/dist/extensions/signal/test-api.js +0 -111
- package/dist/extensions/slack/api.js +0 -10
- package/dist/extensions/slack/channel-config-api.js +0 -2
- package/dist/extensions/slack/index.js +0 -12
- package/dist/extensions/slack/openclaw.plugin.json +0 -11
- package/dist/extensions/slack/package.json +0 -31
- package/dist/extensions/slack/runtime-api.js +0 -110
- package/dist/extensions/slack/setup-entry.js +0 -12
- package/dist/extensions/slack/test-api.js +0 -47
- package/dist/extensions/stepfun/index.js +0 -163
- package/dist/extensions/stepfun/onboard.js +0 -3
- package/dist/extensions/stepfun/openclaw.plugin.json +0 -83
- package/dist/extensions/stepfun/package.json +0 -12
- package/dist/extensions/stepfun/provider-catalog.js +0 -2
- package/dist/extensions/synology-chat/index.js +0 -12
- package/dist/extensions/synology-chat/openclaw.plugin.json +0 -11
- package/dist/extensions/synology-chat/package.json +0 -26
- package/dist/extensions/synology-chat/setup-api.js +0 -2
- package/dist/extensions/synology-chat/setup-entry.js +0 -6
- package/dist/extensions/synthetic/api.js +0 -4
- package/dist/extensions/synthetic/index.js +0 -27
- package/dist/extensions/synthetic/models.js +0 -2
- package/dist/extensions/synthetic/onboard.js +0 -3
- package/dist/extensions/synthetic/openclaw.plugin.json +0 -32
- package/dist/extensions/synthetic/package.json +0 -12
- package/dist/extensions/synthetic/provider-catalog.js +0 -2
- package/dist/extensions/talk-voice/api.js +0 -3
- package/dist/extensions/talk-voice/index.js +0 -160
- package/dist/extensions/talk-voice/openclaw.plugin.json +0 -11
- package/dist/extensions/tavily/index.js +0 -128
- package/dist/extensions/tavily/openclaw.plugin.json +0 -53
- package/dist/extensions/tavily/package.json +0 -12
- package/dist/extensions/tavily/skills/tavily/SKILL.md +0 -94
- package/dist/extensions/tavily/web-search-provider.js +0 -2
- package/dist/extensions/telegram/allow-from.js +0 -2
- package/dist/extensions/telegram/api.js +0 -14
- package/dist/extensions/telegram/channel-config-api.js +0 -2
- package/dist/extensions/telegram/index.js +0 -12
- package/dist/extensions/telegram/openclaw.plugin.json +0 -11
- package/dist/extensions/telegram/package.json +0 -37
- package/dist/extensions/telegram/runtime-api.js +0 -25
- package/dist/extensions/telegram/session-key-api.js +0 -2
- package/dist/extensions/telegram/setup-entry.js +0 -13
- package/dist/extensions/telegram/test-api.js +0 -88
- package/dist/extensions/telegram/test-support.js +0 -46
- package/dist/extensions/telegram/update-offset-runtime-api.js +0 -2
- package/dist/extensions/thread-ownership/api.js +0 -5
- package/dist/extensions/thread-ownership/index.js +0 -82
- package/dist/extensions/thread-ownership/openclaw.plugin.json +0 -30
- package/dist/extensions/tlon/api.js +0 -14
- package/dist/extensions/tlon/index.js +0 -150
- package/dist/extensions/tlon/openclaw.plugin.json +0 -12
- package/dist/extensions/tlon/package.json +0 -44
- package/dist/extensions/tlon/runtime-api.js +0 -14
- package/dist/extensions/tlon/setup-api.js +0 -3
- package/dist/extensions/tlon/setup-entry.js +0 -6
- package/dist/extensions/tlon/test-api.js +0 -2
- package/dist/extensions/together/api.js +0 -3
- package/dist/extensions/together/index.js +0 -26
- package/dist/extensions/together/models.js +0 -2
- package/dist/extensions/together/onboard.js +0 -2
- package/dist/extensions/together/openclaw.plugin.json +0 -32
- package/dist/extensions/together/package.json +0 -12
- package/dist/extensions/together/provider-catalog.js +0 -2
- package/dist/extensions/twitch/api.js +0 -9
- package/dist/extensions/twitch/index.js +0 -1090
- package/dist/extensions/twitch/openclaw.plugin.json +0 -11
- package/dist/extensions/twitch/package.json +0 -29
- package/dist/extensions/twitch/runtime-api.js +0 -9
- package/dist/extensions/venice/api.js +0 -3
- package/dist/extensions/venice/index.js +0 -55
- package/dist/extensions/venice/models.js +0 -2
- package/dist/extensions/venice/onboard.js +0 -3
- package/dist/extensions/venice/openclaw.plugin.json +0 -32
- package/dist/extensions/venice/package.json +0 -12
- package/dist/extensions/venice/provider-catalog.js +0 -2
- package/dist/extensions/vercel-ai-gateway/api.js +0 -4
- package/dist/extensions/vercel-ai-gateway/index.js +0 -30
- package/dist/extensions/vercel-ai-gateway/models.js +0 -2
- package/dist/extensions/vercel-ai-gateway/onboard.js +0 -2
- package/dist/extensions/vercel-ai-gateway/openclaw.plugin.json +0 -32
- package/dist/extensions/vercel-ai-gateway/package.json +0 -12
- package/dist/extensions/vercel-ai-gateway/provider-catalog.js +0 -2
- package/dist/extensions/vllm/api.js +0 -4
- package/dist/extensions/vllm/defaults.js +0 -2
- package/dist/extensions/vllm/index.js +0 -78
- package/dist/extensions/vllm/models.js +0 -2
- package/dist/extensions/vllm/openclaw.plugin.json +0 -29
- package/dist/extensions/vllm/package.json +0 -12
- package/dist/extensions/voice-call/api.js +0 -7
- package/dist/extensions/voice-call/index.js +0 -698
- package/dist/extensions/voice-call/openclaw.plugin.json +0 -700
- package/dist/extensions/voice-call/package.json +0 -33
- package/dist/extensions/voice-call/runtime-api.js +0 -7
- package/dist/extensions/voice-call/runtime-entry.js +0 -2
- package/dist/extensions/volcengine/api.js +0 -3
- package/dist/extensions/volcengine/index.js +0 -63
- package/dist/extensions/volcengine/models.js +0 -2
- package/dist/extensions/volcengine/openclaw.plugin.json +0 -33
- package/dist/extensions/volcengine/package.json +0 -12
- package/dist/extensions/volcengine/provider-catalog.js +0 -2
- package/dist/extensions/whatsapp/action-runtime-api.js +0 -2
- package/dist/extensions/whatsapp/action-runtime.runtime.js +0 -2
- package/dist/extensions/whatsapp/api.js +0 -8
- package/dist/extensions/whatsapp/auth-presence.js +0 -2
- package/dist/extensions/whatsapp/channel-config-api.js +0 -2
- package/dist/extensions/whatsapp/constants.js +0 -2
- package/dist/extensions/whatsapp/index.js +0 -12
- package/dist/extensions/whatsapp/light-runtime-api.js +0 -5
- package/dist/extensions/whatsapp/login-qr-api.js +0 -2
- package/dist/extensions/whatsapp/openclaw.plugin.json +0 -11
- package/dist/extensions/whatsapp/package.json +0 -45
- package/dist/extensions/whatsapp/runtime-api.js +0 -334
- package/dist/extensions/whatsapp/setup-entry.js +0 -23
- package/dist/extensions/whatsapp/test-api.js +0 -76
- package/dist/extensions/xai/api.js +0 -6
- package/dist/extensions/xai/code-execution.js +0 -2
- package/dist/extensions/xai/index.js +0 -122
- package/dist/extensions/xai/model-definitions.js +0 -2
- package/dist/extensions/xai/model-id.js +0 -2
- package/dist/extensions/xai/onboard.js +0 -2
- package/dist/extensions/xai/openclaw.plugin.json +0 -157
- package/dist/extensions/xai/package.json +0 -12
- package/dist/extensions/xai/provider-catalog.js +0 -2
- package/dist/extensions/xai/provider-models.js +0 -2
- package/dist/extensions/xai/stream.js +0 -2
- package/dist/extensions/xai/web-search.js +0 -2
- package/dist/extensions/xai/x-search.js +0 -2
- package/dist/extensions/xiaomi/api.js +0 -3
- package/dist/extensions/xiaomi/index.js +0 -37
- package/dist/extensions/xiaomi/onboard.js +0 -2
- package/dist/extensions/xiaomi/openclaw.plugin.json +0 -32
- package/dist/extensions/xiaomi/package.json +0 -12
- package/dist/extensions/xiaomi/provider-catalog.js +0 -2
- package/dist/extensions/zai/api.js +0 -3
- package/dist/extensions/zai/detect.js +0 -2
- package/dist/extensions/zai/index.js +0 -239
- package/dist/extensions/zai/media-understanding-provider.js +0 -2
- package/dist/extensions/zai/model-definitions.js +0 -2
- package/dist/extensions/zai/onboard.js +0 -2
- package/dist/extensions/zai/openclaw.plugin.json +0 -94
- package/dist/extensions/zai/package.json +0 -12
- package/dist/extensions/zai/runtime-api.js +0 -3
- package/dist/extensions/zalo/api.js +0 -3
- package/dist/extensions/zalo/index.js +0 -13
- package/dist/extensions/zalo/openclaw.plugin.json +0 -11
- package/dist/extensions/zalo/package.json +0 -47
- package/dist/extensions/zalo/runtime-api.js +0 -38
- package/dist/extensions/zalo/setup-entry.js +0 -6
- package/dist/extensions/zalo/test-api.js +0 -2
- package/dist/extensions/zalouser/api.js +0 -2
- package/dist/extensions/zalouser/index.js +0 -599
- package/dist/extensions/zalouser/openclaw.plugin.json +0 -11
- package/dist/extensions/zalouser/package.json +0 -48
- package/dist/extensions/zalouser/runtime-api.js +0 -30
- package/dist/extensions/zalouser/setup-entry.js +0 -13
- package/dist/extensions/zalouser/test-api.js +0 -5
- package/dist/external-content-DtoRY-d1.js +0 -242
- package/dist/facade-runtime-Bpi4Gy-u.js +0 -263
- package/dist/failover-error-BrdBIFg2.js +0 -180
- package/dist/feishu-81Iv8tqF.js +0 -18
- package/dist/feishu-conversation-NmEqAxSA.js +0 -17
- package/dist/feishu-setup-DXAK6GqE.js +0 -12
- package/dist/fetch-7dbKQPT5.js +0 -256
- package/dist/fetch-BjiGl865.js +0 -418
- package/dist/fetch-Bp23aO5S.js +0 -65
- package/dist/fetch-guard-BnhVFBtf.js +0 -150
- package/dist/fetch-mock-WghRRNpK.js +0 -6
- package/dist/fetch-runtime-DfFmkkZH.js +0 -4
- package/dist/fetch-timeout-BKMGkHu9.js +0 -58
- package/dist/file-identity-DPm-6kp0.js +0 -567
- package/dist/file-lock-CH0V9dhL.js +0 -141
- package/dist/file-lock-D292sbfa.js +0 -2
- package/dist/firecrawl-client-GOGPuEeg.js +0 -338
- package/dist/firecrawl-search-provider-ptp7GNAt.js +0 -47
- package/dist/format-BwzSM9vY.js +0 -24
- package/dist/format-D38w0aKT.js +0 -817
- package/dist/format-DCFsK8oa.js +0 -19
- package/dist/format-datetime-Bl6-b7G1.js +0 -73
- package/dist/format-duration-DqcpDYkZ.js +0 -57
- package/dist/format-relative-CYrRyrT7.js +0 -54
- package/dist/frontmatter-Ba2Hn11b.js +0 -45
- package/dist/frontmatter-Cjxy4vX8.js +0 -210
- package/dist/fs-safe-BQ59ttjX.js +0 -999
- package/dist/gateway-CWPyH-P7.js +0 -2575
- package/dist/gateway-cli-BmPBPCcJ.js +0 -1572
- package/dist/gateway-discovery-targets--oNzWOVw.js +0 -430
- package/dist/gateway-install-token-tyQyR2ED.js +0 -230
- package/dist/gateway-lock-BbUQuUet.js +0 -292
- package/dist/gateway-presence-BVCIm1hy.js +0 -15
- package/dist/gateway-registry-tQcIThkV.js +0 -74
- package/dist/gateway-rpc-BXdoSPN7.js +0 -26
- package/dist/gateway-runtime-C7EhkU_c.js +0 -12
- package/dist/gaxios-fetch-compat-D4gl5582.js +0 -180
- package/dist/gemini-auth-Dlpcd9MB.js +0 -29
- package/dist/gemini-web-search-provider-CkNEl2du.js +0 -162
- package/dist/get-reply-from-config.runtime-vBmBttxw.js +0 -2
- package/dist/get-reply-from-config.runtime.js +0 -1
- package/dist/git-commit-BS28SZVT.js +0 -2
- package/dist/git-commit-ChiOoWyK.js +0 -177
- package/dist/github-copilot-login-B8s4OVQ4.js +0 -11
- package/dist/github-copilot-token-BwXtH-ZJ.js +0 -2
- package/dist/github-copilot-token-D81Wvm8b.js +0 -2
- package/dist/github-copilot-token-beHjQGOp.js +0 -91
- package/dist/global-singleton-54zT3rCn.js +0 -13
- package/dist/global-singleton-iOq2_-p8.js +0 -1
- package/dist/global-state-DUuMGgts.js +0 -17
- package/dist/globals-CDtV0ht8.js +0 -25
- package/dist/gmail-setup-utils-CxXfU7cy.js +0 -421
- package/dist/google-Cx1_z3Q3.js +0 -24
- package/dist/googlechat-CoiMNDC2.js +0 -37
- package/dist/graph-users-BmZWavVH.js +0 -917
- package/dist/group-access-BZZ3FNmb.js +0 -32
- package/dist/group-access-BjveEAjz.js +0 -113
- package/dist/group-access-owHLoCWX.js +0 -119
- package/dist/group-activation-ClEb7qwj.js +0 -22
- package/dist/group-id-CcsUNOct.js +0 -11
- package/dist/group-policy-Bb8dxOpM.js +0 -25
- package/dist/group-policy-G9GcSyph.js +0 -201
- package/dist/group-policy-wS9F8Y_i.js +0 -51
- package/dist/group-policy-warnings-CL2gHsXM.js +0 -196
- package/dist/groups.runtime-K758xQFV.js +0 -6
- package/dist/groups.runtime.js +0 -1
- package/dist/handle-action-CE4vpa7G.js +0 -500
- package/dist/health-D_KQbqQY.js +0 -577
- package/dist/health-a1VPtSyV.js +0 -2
- package/dist/health-format-COR93f8W.js +0 -26
- package/dist/heartbeat-C_TrErgd.js +0 -122
- package/dist/heartbeat-reply-payload-C7Ac3fOZ.js +0 -13
- package/dist/heartbeat-summary-v5gPj5bd.js +0 -57
- package/dist/heartbeat-visibility-CHMO4pmJ.js +0 -102
- package/dist/help-CyR1Oo4X.js +0 -81
- package/dist/help-format-l1phKNA8.js +0 -15
- package/dist/helpers-COHnQbWX.js +0 -32
- package/dist/helpers-DNpD7VMo.js +0 -24
- package/dist/history-B4mW8GfY.js +0 -102
- package/dist/home-dir-n9onX5PG.js +0 -83
- package/dist/hook-runner-global-C9GhdBtf.js +0 -632
- package/dist/hook-runner-global-Cr_Pthp4.js +0 -2
- package/dist/hook-runtime-DK8QF-2x.js +0 -3
- package/dist/hooks-cli-XCo-7nz9.js +0 -353
- package/dist/hooks-policy-BmULXBcp.js +0 -20
- package/dist/hooks-status-D_ZxRD0H.js +0 -86
- package/dist/host-env-security-SlXI58bc.js +0 -290
- package/dist/host-runtime-BGHb06HN.js +0 -1
- package/dist/hostname-BRYLr_mh.js +0 -8
- package/dist/http-body-CfdQSEp0.js +0 -238
- package/dist/http-client-_3i4-nw5.js +0 -294
- package/dist/http-registry-ZGSBfYSe.js +0 -54
- package/dist/http-route-overlap-C8lbolN5.js +0 -101
- package/dist/identity-BoQQh6Y8.js +0 -26
- package/dist/identity-D64Wfv_s.js +0 -29
- package/dist/identity-DvwF6Yix.js +0 -84
- package/dist/identity-avatar-DPBgVwpU.js +0 -86
- package/dist/identity-file-BtIJI4dn.js +0 -60
- package/dist/image-C4V19x9x.js +0 -152
- package/dist/image-generation-BbOnazXi.js +0 -1
- package/dist/image-generation-provider-CQK8HA0O.js +0 -136
- package/dist/image-generation-provider-CWUvRxmv.js +0 -131
- package/dist/image-generation-provider-F2sfNjcr.js +0 -281
- package/dist/image-ops-BJKjhMAu.js +0 -476
- package/dist/image-runtime-DodXcK2e.js +0 -7
- package/dist/imessage-2ukkzufG.js +0 -19
- package/dist/inbound-context-Cxvd3JHZ.js +0 -59
- package/dist/inbound-context-Czd3FdNb.js +0 -52
- package/dist/inbound-debounce-CI7l3R36.js +0 -159
- package/dist/inbound-envelope-LyHTUTue.js +0 -61
- package/dist/inbound-reply-dispatch-BdeY6N-k.js +0 -73
- package/dist/inbound-text-CacimZtw.js +0 -14
- package/dist/inbound.runtime-CqX3n132.js +0 -3
- package/dist/inbound.runtime.js +0 -1
- package/dist/includes-Ccr-Q5DB.js +0 -188
- package/dist/includes-scan-DVvYLj4S.js +0 -55
- package/dist/index.js +0 -56
- package/dist/infra/warning-filter.js +0 -2
- package/dist/infra-runtime-Cl0iZpRS.js +0 -22
- package/dist/input-files-PZC6ZR4W.js +0 -251
- package/dist/input-provenance-8GBFuk0Q.js +0 -44
- package/dist/inspect-B8dw6NVJ.js +0 -286
- package/dist/install-Bk7XyvtC.js +0 -590
- package/dist/install-package-dir-C2ba2toB.js +0 -284
- package/dist/install-safe-path-CkCd0rWS.js +0 -69
- package/dist/install-security-scan-C02VaEU9.js +0 -22
- package/dist/install-security-scan.runtime-CDUuS6Dl.js +0 -299
- package/dist/install-security-scan.runtime.js +0 -1
- package/dist/install-source-utils-2tdWQmwI.js +0 -167
- package/dist/install-target-CBNysuiP.js +0 -175
- package/dist/install.runtime-D_zKCpnB.js +0 -11
- package/dist/install.runtime-DjQozvMe.js +0 -27
- package/dist/install.runtime.js +0 -1
- package/dist/installs-BnAbQ70v.js +0 -28
- package/dist/interactive-CEnsu1RT.js +0 -8
- package/dist/interactive-runtime-Bxq5ztle.js +0 -1
- package/dist/internal-Lk0wFTNq.js +0 -411
- package/dist/internal-hooks-C3ziA7w_.js +0 -155
- package/dist/io-BUxKr33U.js +0 -2236
- package/dist/io-BuMkfjp3.js +0 -4
- package/dist/ip-BZP18dDl.js +0 -208
- package/dist/ipv4-Xiyu1rvD.js +0 -82
- package/dist/irc-DXfYh-Sd.js +0 -14
- package/dist/irc-surface-Di-joPuc.js +0 -15
- package/dist/is-main-Bv5ej4lF.js +0 -27
- package/dist/issue-format-8Eylt-2O.js +0 -2
- package/dist/issue-format-DLZczJ0U.js +0 -31
- package/dist/json-file-5xJqyXrK.js +0 -23
- package/dist/json-files-C4lsZ_HR.js +0 -72
- package/dist/json-mode-4O1xL2fT.js +0 -34
- package/dist/json-pointer-C30cknnZ.js +0 -43
- package/dist/json-store-FUgu1pyj.js +0 -37
- package/dist/keyed-async-queue-BTOTBE8n.js +0 -32
- package/dist/kill-tree-CIfAbzdN.js +0 -2
- package/dist/kill-tree-CUPpLbeq.js +0 -82
- package/dist/kimi-web-search-provider-Cb3F9_Da.js +0 -224
- package/dist/known-users-DjerpGCB.js +0 -167
- package/dist/lancedb-runtime-DTb_mDUG.js +0 -201
- package/dist/launchd-cp98MUhz.js +0 -517
- package/dist/lazy-runtime-C6LCAM-L.js +0 -29
- package/dist/lazy-runtime-yh_WT4on.js +0 -1
- package/dist/lazy-service-module-CeifO9oo.js +0 -24
- package/dist/legacy-crypto-restore-CsHmLVjY.js +0 -85
- package/dist/legacy-names-CFo8Oe-2.js +0 -9
- package/dist/legacy-web-search-Bn8F2jrN.js +0 -140
- package/dist/legacy.shared-oZM32end.js +0 -45
- package/dist/level-overrides-gqc8xfh2.js +0 -36
- package/dist/library-ChjjeniJ.js +0 -44
- package/dist/lifecycle-core-Ce_ZEvjl.js +0 -402
- package/dist/line-Be0jY3CU.js +0 -4
- package/dist/line-runtime-B0ZGTK81.js +0 -60
- package/dist/line-surface-BTopinac.js +0 -27
- package/dist/links-D7o22Ygt.js +0 -17
- package/dist/listeners-_47QWN8-.js +0 -14
- package/dist/llm-slug-generator-Dv-sLOW9.js +0 -68
- package/dist/llm-slug-generator.js +0 -2
- package/dist/llm-task-BDA3i86A.js +0 -3
- package/dist/load-BXSzQ8YA.js +0 -28
- package/dist/load-options-BqszWkkN.js +0 -36
- package/dist/loader-DsZDoLQ6.js +0 -2519
- package/dist/local-file-access-PajXzDdK.js +0 -49
- package/dist/local-roots-DrpNBv4b.js +0 -46
- package/dist/location-CtMHXE-d.js +0 -42
- package/dist/logger-Bc2lC3X3.js +0 -79
- package/dist/logger-CIV9WBoa.js +0 -11
- package/dist/logger-DdGvppaE.js +0 -75
- package/dist/logger-MWEZrHUL.js +0 -582
- package/dist/logging-B1QD0DRq.js +0 -2
- package/dist/logging-CAfgK7sj.js +0 -3
- package/dist/logging-ColPHIDT.js +0 -16
- package/dist/logging-D4xyCEzZ.js +0 -85
- package/dist/logging-Dt_aiHur.js +0 -13
- package/dist/logging-Dywye6yZ.js +0 -2
- package/dist/logging-core-hw7Df6Hl.js +0 -3
- package/dist/login-BrqdQcNh.js +0 -108
- package/dist/login-DSqrZNW-.js +0 -2333
- package/dist/login-qr-Dm3iC25_.js +0 -212
- package/dist/login-qr-api-BxRDJKkp.js +0 -16
- package/dist/logs-cli-CxjV80As.js +0 -221
- package/dist/magic-string.es-CVHNyqW1.js +0 -1011
- package/dist/main-session-BbO0A-No.js +0 -38
- package/dist/manager-c_fEco8X.js +0 -2773
- package/dist/manager-runtime-Vy_F8ORR.js +0 -2
- package/dist/manager.runtime-Bm1Knq-3.js +0 -670
- package/dist/manager.runtime.js +0 -1
- package/dist/manifest-f_gihArl.js +0 -237
- package/dist/manifest-registry-Kx5Z2lJL.js +0 -1069
- package/dist/map-size-BBQq2RPq.js +0 -15
- package/dist/markdown-table-runtime-Dx12DQTq.js +0 -2
- package/dist/markdown-tables-CSlyhQVP.js +0 -31
- package/dist/mask-api-key-BYVFDQdo.js +0 -10
- package/dist/matrix-NDa-FoaE.js +0 -351
- package/dist/matrix-config-helpers-D0D-oL7I.js +0 -153
- package/dist/matrix-helper-DioFIiaO.js +0 -20
- package/dist/matrix-migration-snapshot-DAOFFSgM.js +0 -714
- package/dist/matrix-ouiFsVI1.js +0 -39
- package/dist/matrix-runtime-heavy-KUEg_MfD.js +0 -4
- package/dist/matrix-runtime-shared-B6aE5Uu6.js +0 -1
- package/dist/matrix-runtime-surface-R78Hde6Q.js +0 -12
- package/dist/matrix-surface-B-nU-e0B.js +0 -13
- package/dist/matrix-thread-bindings-B77Krs8r.js +0 -12
- package/dist/mattermost-Cg2PI71s.js +0 -18
- package/dist/mcp/plugin-tools-serve.js +0 -105
- package/dist/mcp-cli-BMNT4RIm.js +0 -768
- package/dist/mcp-config-3y1z3N2x.js +0 -118
- package/dist/media-CUdiVhEt.js +0 -1691
- package/dist/media-limits-DmcT5KnO.js +0 -14
- package/dist/media-runtime-8QR_uTs0.js +0 -295
- package/dist/media-understanding-CpMkSmKj.js +0 -51
- package/dist/media-understanding-provider-C0xVBaas.js +0 -11
- package/dist/media-understanding-provider-C8RSrdEy.js +0 -16
- package/dist/media-understanding-provider-CCB6_bwc2.js +0 -9
- package/dist/media-understanding-provider-CZ83ep6L.js +0 -16
- package/dist/media-understanding-provider-Cmcg82YY.js +0 -28
- package/dist/media-understanding-provider-D1_z5Kwx.js +0 -11
- package/dist/media-understanding-provider-DC9bhcFj.js +0 -11
- package/dist/media-understanding-provider-DbMV-bHu.js +0 -17
- package/dist/media-understanding-provider-Drg3Vyoe.js +0 -86
- package/dist/media-understanding-runtime-JIhXSD7e.js +0 -15
- package/dist/media-understanding.runtime-2Muvvak4.js +0 -7
- package/dist/media-understanding.runtime.js +0 -1
- package/dist/memory-DPYsR3Cn.js +0 -228
- package/dist/memory-core-engine-runtime-DP_nzKMm.js +0 -14
- package/dist/memory-core-host-engine-embeddings-BhsmnP-6.js +0 -1370
- package/dist/memory-core-host-engine-foundation-CtFD8jpc.js +0 -10
- package/dist/memory-core-host-engine-qmd-DCvmid82.js +0 -375
- package/dist/memory-core-host-engine-storage-N3YflxjF.js +0 -109
- package/dist/memory-core-host-multimodal-BVd6eEE3.js +0 -1
- package/dist/memory-core-host-query-Bxzu0mAD.js +0 -2
- package/dist/memory-core-host-runtime-cli-nz5fxbbn.js +0 -10
- package/dist/memory-core-host-runtime-core-BcGQFQUw.js +0 -8
- package/dist/memory-core-host-runtime-files-DO5A0pY5.js +0 -3
- package/dist/memory-core-host-secret-CQAiTACg.js +0 -1
- package/dist/memory-core-host-status-0g2XexDn.js +0 -44
- package/dist/memory-embedding-providers-BOMS0u3X.js +0 -34
- package/dist/memory-lancedb-kZBcB07O.js +0 -2
- package/dist/memory-runtime-BIGGpmaC.js +0 -2
- package/dist/memory-runtime-XyiDon5w.js +0 -34
- package/dist/memory-search-CQFSugEg.js +0 -2
- package/dist/memory-search-DpAYXyjc.js +0 -202
- package/dist/memory-state-DDJh6L4-.js +0 -41
- package/dist/mention-gating-_kzByrvM.js +0 -25
- package/dist/mentions-BCBF5Klg.js +0 -65
- package/dist/mentions-BKYgZd-C.js +0 -155
- package/dist/merge-patch-CtvE2OP0.js +0 -65
- package/dist/message-Dna6Vsdg.js +0 -205
- package/dist/message-action-discovery-CPTCAl8K.js +0 -133
- package/dist/message-action-runner-Byldnjex.js +0 -1703
- package/dist/message-channel-bEWdw4ul.js +0 -105
- package/dist/message-handler-C9TRy9hy.js +0 -1771
- package/dist/message-hook-mappers-CzwFvq_c.js +0 -255
- package/dist/messages-CQT2FDZ3.js +0 -270
- package/dist/method-scopes-B6e_KuRU.js +0 -2663
- package/dist/migrate-cli-C_iDle77.js +0 -500
- package/dist/migration-snapshot.runtime-DAzTUgU-.js +0 -3
- package/dist/migration-snapshot.runtime.js +0 -1
- package/dist/mime-DkaKoCVP.js +0 -156
- package/dist/min-host-version-CIhgRq0c.js +0 -349
- package/dist/minimax-vlm-Dh6g-MLh.js +0 -512
- package/dist/model-auth-DcCyGs_6.js +0 -377
- package/dist/model-auth-env-OT6ucjoP.js +0 -63
- package/dist/model-auth-label-fGtOs2u-.js +0 -45
- package/dist/model-auth-markers-D2z_AIuC.js +0 -70
- package/dist/model-auth-runtime-shared-DnhseQ_3.js +0 -18
- package/dist/model-buttons-zQ-cRhqo.js +0 -187
- package/dist/model-catalog-f9zO4b6C.js +0 -208
- package/dist/model-catalog.runtime-iRu_OMJS.js +0 -2
- package/dist/model-catalog.runtime.js +0 -1
- package/dist/model-definitions-BGWurJeM.js +0 -49
- package/dist/model-definitions-C-e07VgA.js +0 -255
- package/dist/model-definitions-DUANiLUG.js +0 -126
- package/dist/model-definitions-DrxdjAkB.js +0 -202
- package/dist/model-id-9W_sHLHy.js +0 -12
- package/dist/model-id-DEv7HEyl.js +0 -20
- package/dist/model-input-DwbpFRYm.js +0 -20
- package/dist/model-overrides-BaecXmMv.js +0 -84
- package/dist/model-overrides-UUODi1G1.js +0 -91
- package/dist/model-param-b-BHlbSl5R.js +0 -15
- package/dist/model-picker-BgVMnja3.js +0 -439
- package/dist/model-picker-D8elZqN_.js +0 -3
- package/dist/model-picker.runtime-BUfgRpvT.js +0 -15
- package/dist/model-picker.runtime.js +0 -1
- package/dist/model-runtime-CkjgxQmB.js +0 -1772
- package/dist/model-selection-DXY5nwui.js +0 -407
- package/dist/model-selection-Dx6Ag-ZE.js +0 -505
- package/dist/model-suppression-C8XSEnsv.js +0 -24
- package/dist/model-suppression.runtime-Dqra9AAF.js +0 -7
- package/dist/model-suppression.runtime.js +0 -1
- package/dist/models--Ze_o5z6.js +0 -193
- package/dist/models-7_w_ynp7.js +0 -35
- package/dist/models-BMmB_oQc.js +0 -130
- package/dist/models-B_TKM4gG.js +0 -18
- package/dist/models-B_UROL5b.js +0 -3
- package/dist/models-BmDGSZCK.js +0 -31
- package/dist/models-BywIyTzh.js +0 -126
- package/dist/models-C5GB-E7D.js +0 -154
- package/dist/models-DU3Lv10g.js +0 -754
- package/dist/models-VgpjMiqM.js +0 -138
- package/dist/models-_DZVZ2Na.js +0 -18
- package/dist/models-bBe0FFJe.js +0 -2550
- package/dist/models-cli-kZR11PgM.js +0 -197
- package/dist/models-config-D6j7jkCN.js +0 -2
- package/dist/models-config-lYKxSxLo.js +0 -1106
- package/dist/models-config.runtime-D2tdVUsi.js +0 -2
- package/dist/models-config.runtime.js +0 -1
- package/dist/models-emJUoDsF.js +0 -40
- package/dist/models-gPCm0Fco.js +0 -122
- package/dist/models-mi7nu17U.js +0 -99
- package/dist/models-nUP9ZPV8.js +0 -552
- package/dist/models-provider-runtime-DfIZ0cvV.js +0 -2
- package/dist/monitor-BEjwRY59.js +0 -3622
- package/dist/monitor-BiwufaF7.js +0 -718
- package/dist/monitor-BqwlHm94.js +0 -3660
- package/dist/monitor-Cj6Atk8I.js +0 -676
- package/dist/monitor-D2qBnOYz.js +0 -666
- package/dist/monitor-DZmBV1Nj2.js +0 -2
- package/dist/monitor-RMoB6sGQ.js +0 -4067
- package/dist/monitor-auth-EvlH1zbN.js +0 -192
- package/dist/monitor-lbUydC5_.js +0 -1525
- package/dist/monitor-polling.runtime-O6ZG6yYv.js +0 -307
- package/dist/monitor-polling.runtime.js +0 -1
- package/dist/monitor-provider-x4TUmYNN.js +0 -1782
- package/dist/monitor-vE0skDM1.js +0 -687
- package/dist/monitor-webhook.runtime-DoTv_oZv.js +0 -297
- package/dist/monitor-webhook.runtime.js +0 -1
- package/dist/moonshot-stream-wrappers-Csssd6kW.js +0 -24
- package/dist/moonshot-thinking-stream-wrappers-D3j6Q9Yk.js +0 -69
- package/dist/msteams-DsFLaFEV.js +0 -33
- package/dist/multimodal-DoXQtvBl.js +0 -66
- package/dist/mutable-allowlist-detectors-CbFK2eTK.js +0 -62
- package/dist/native-command-registry-B4BAqmAW.js +0 -2
- package/dist/native-command-session-targets-DfUCBY63.js +0 -10
- package/dist/net-DjzoSxQo.js +0 -265
- package/dist/network-discovery-display-h8MqTMCI.js +0 -48
- package/dist/network-mode-QjJNOXMa.js +0 -17
- package/dist/nextcloud-talk-COZ5YrPY.js +0 -18
- package/dist/node-cli-z8LHYl1w.js +0 -2323
- package/dist/node-command-policy-DoeXKD1V.js +0 -205
- package/dist/node-commands-ycnRypMq.js +0 -11
- package/dist/node-require-BgDD9bTi.js +0 -14
- package/dist/node-resolve-Drr1RIcN.js +0 -110
- package/dist/node-service-Nyf8eLc4.js +0 -68
- package/dist/node-startup-env-CVMjxAUF.js +0 -50
- package/dist/nodes-cli-BMyafV_R.js +0 -1044
- package/dist/nodes-screen-oyGHNlY5.js +0 -219
- package/dist/nodes.helpers-DKBA9twS.js +0 -203
- package/dist/normalize-C46CugdT.js +0 -35
- package/dist/normalize-reply-VrMa_PA2.js +0 -500
- package/dist/normalize-secret-input-CC9iFcnK.js +0 -32
- package/dist/nostr-DGfd-Skj.js +0 -19
- package/dist/note-B5R9zt2K.js +0 -109
- package/dist/notify-CKEt6MKY.js +0 -298
- package/dist/npm-registry-spec-dWUFCqDk.js +0 -100
- package/dist/oauth-BBIy_OBl.js +0 -152
- package/dist/oauth-DzMUt9ZO.js +0 -56
- package/dist/oauth.credentials-CKrXIXPf.js +0 -119
- package/dist/oauth.flow-Dd6MZcHS.js +0 -122
- package/dist/oauth.http-CZlbXoZD.js +0 -23
- package/dist/oauth.project-DAVNbct7.js +0 -125
- package/dist/oauth.shared-D1_wwlyt.js +0 -26
- package/dist/oauth.token-CnB-w_v2.js +0 -42
- package/dist/ollama-EE_SvO8P.js +0 -26
- package/dist/onboard-2otvb4-n.js +0 -307
- package/dist/onboard-72nGEzpd.js +0 -25
- package/dist/onboard-B14oDS4M.js +0 -23
- package/dist/onboard-BH5hcOyK.js +0 -39
- package/dist/onboard-BRkQIFt_.js +0 -25
- package/dist/onboard-BSArlkkq.js +0 -73
- package/dist/onboard-Bau_HSmO.js +0 -36
- package/dist/onboard-BsqpQhXj.js +0 -591
- package/dist/onboard-CBa7u1iZ.js +0 -25
- package/dist/onboard-CLKZrJow.js +0 -29
- package/dist/onboard-COaMJ5wS.js +0 -28
- package/dist/onboard-CbTQZti9.js +0 -48
- package/dist/onboard-Ce3rcBNR.js +0 -29
- package/dist/onboard-CiMzgSvO.js +0 -67
- package/dist/onboard-DNuWjUOg.js +0 -17
- package/dist/onboard-DY3JtOcX.js +0 -47
- package/dist/onboard-Dd_eFJ7g.js +0 -25
- package/dist/onboard-DgMI-C3P.js +0 -24
- package/dist/onboard-Dj3Kkl9C.js +0 -49
- package/dist/onboard-Djne8OY8.js +0 -34
- package/dist/onboard-DnNU28xK.js +0 -48
- package/dist/onboard-MFS79j1I.js +0 -23
- package/dist/onboard-REHqRyQm.js +0 -26
- package/dist/onboard-VVnzyvuh.js +0 -46
- package/dist/onboard-channels-B8UocRdo.js +0 -705
- package/dist/onboard-channels-Ci5QQyQ0.js +0 -2
- package/dist/onboard-config-7edS4yYd.js +0 -2
- package/dist/onboard-config-C-6p2HNL.js +0 -29
- package/dist/onboard-custom-BREC7K0s.js +0 -2
- package/dist/onboard-custom-D7oXiV6u.js +0 -646
- package/dist/onboard-helpers-BCIfy96O.js +0 -4
- package/dist/onboard-helpers-CLedS83g.js +0 -227
- package/dist/onboard-hooks-DW0gav3i.js +0 -52
- package/dist/onboard-lh38uUOa.js +0 -25
- package/dist/onboard-rH_HA9v-.js +0 -34
- package/dist/onboard-remote-DG5Rb2y7.js +0 -2
- package/dist/onboard-remote-DgDwHLCW.js +0 -193
- package/dist/onboard-search-Bz78SAON.js +0 -339
- package/dist/onboard-skills-BK1iF6NI.js +0 -2
- package/dist/onboard-skills-Cfs4Gz-d.js +0 -134
- package/dist/openai-B3atWWiZ.js +0 -21
- package/dist/openai-codex-auth-identity-blYgqX5I.js +0 -40
- package/dist/openai-codex-catalog-DQoW5ntP.js +0 -11
- package/dist/openai-codex-provider-BeX3_fQL.js +0 -254
- package/dist/openai-provider-DfSRc815.js +0 -272
- package/dist/openai-stream-wrappers-Cmn9nSYj.js +0 -338
- package/dist/openclaw-exec-env-DnTrPIdx.js +0 -17
- package/dist/openclaw-root-F1SOdmJ0.js +0 -88
- package/dist/openclaw-tools.runtime-Dx73yE1V.js +0 -2
- package/dist/openclaw-tools.runtime.js +0 -1
- package/dist/operator-approvals-client-NQtGN5k_.js +0 -33
- package/dist/order-DNBhjW6F.js +0 -744
- package/dist/origin-routing-BC2EzQqM.js +0 -15
- package/dist/origin-routing-BVUTLJGu.js +0 -2
- package/dist/os-summary-CdlXkpL1.js +0 -26
- package/dist/outbound-adapter-D6WGzS7P.js +0 -183
- package/dist/outbound-ek4CqhT2.js +0 -2
- package/dist/outbound-hgMEZIU9.js +0 -2739
- package/dist/outbound-media-B2ZrkOxl.js +0 -15
- package/dist/outbound-runtime-CtDmQy3z.js +0 -2
- package/dist/outbound-send-deps-COPf3lwV.js +0 -7
- package/dist/outbound-session-DHKvttsz.js +0 -41
- package/dist/pairing-challenge-O7jo1Q5R.js +0 -33
- package/dist/pairing-cli-BEUxC5EH.js +0 -116
- package/dist/pairing-labels-Cj1fFxG9.js +0 -7
- package/dist/pairing-message-FaqHPEFk.js +0 -4
- package/dist/pairing-messages-DxLpe0GE.js +0 -23
- package/dist/pairing-pending-DGyUpmjC.js +0 -14
- package/dist/pairing-store-B171dUVa.js +0 -617
- package/dist/pairing-token-CnyXOU__.js +0 -88
- package/dist/param-readers-CqAoT2n2.js +0 -2
- package/dist/parse-duration-D9q1V0xx.js +0 -41
- package/dist/parse-finite-number-CzdLC_gQ.js +0 -30
- package/dist/parse-json-compat-DfjRYtKX.js +0 -11
- package/dist/parse-log-line-Cd0JHPGg.js +0 -43
- package/dist/parse-port-BFmNhrtE.js +0 -8
- package/dist/parse-timeout-bktz0495.js +0 -27
- package/dist/path-alias-guards-BeOn9PZR.js +0 -40
- package/dist/path-env-C2F1kvna.js +0 -87
- package/dist/path-safety-2mfHCe0n.js +0 -12
- package/dist/paths-Bw8Ci57u.js +0 -2
- package/dist/paths-GWMNxnBn.js +0 -201
- package/dist/paths-xpks599B.js +0 -180
- package/dist/payload-S8niBCaz.js +0 -90
- package/dist/pdf-extract-Cm83kt2M.js +0 -73
- package/dist/perplexity-web-search-provider-Cgr2BYVk.js +0 -423
- package/dist/persistent-bindings.lifecycle-CAOm8v8I.js +0 -159
- package/dist/persistent-dedupe-DoNHVMWs.js +0 -116
- package/dist/pi-embedded-DEAtCIdT.js +0 -40616
- package/dist/pi-embedded-helpers-BVjvCsor.js +0 -1733
- package/dist/pi-embedded.runtime-Ctj3QFs-.js +0 -4
- package/dist/pi-embedded.runtime.js +0 -1
- package/dist/pi-model-discovery-KjI5xf8m.js +0 -188
- package/dist/pi-settings-BJzoHYF9.js +0 -57
- package/dist/pi-tools.before-tool-call.runtime-DJ6s0GDV.js +0 -354
- package/dist/pi-tools.before-tool-call.runtime.js +0 -1
- package/dist/plugin-auto-enable-BZvicayR.js +0 -400
- package/dist/plugin-entry-D0vhddM4.js +0 -25
- package/dist/plugin-entry.runtime-Xd644UDA.js +0 -112
- package/dist/plugin-entry.runtime.js +0 -1
- package/dist/plugin-error-boundary-RI4ByQoA.js +0 -55
- package/dist/plugin-error-handler-DWUTf_UF.js +0 -109
- package/dist/plugin-health-checker-2c6LyJwr.js +0 -125
- package/dist/plugin-hot-reload-CA3__dZN.js +0 -215
- package/dist/plugin-install-BjVLwj7-.js +0 -230
- package/dist/plugin-install-CjwMt13j.js +0 -2
- package/dist/plugin-install-config-policy-MApev-w-.js +0 -93
- package/dist/plugin-install-path-warnings-BkBH-k4n.js +0 -40
- package/dist/plugin-install-plan-0fWhyVBN.js +0 -50
- package/dist/plugin-registry-CORVyKHv.js +0 -74
- package/dist/plugin-registry-Dl1iIh7W.js +0 -2
- package/dist/plugin-runtime-Dd1YN95W.js +0 -6
- package/dist/plugin-sdk/account-core.js +0 -8
- package/dist/plugin-sdk/account-helpers.js +0 -4
- package/dist/plugin-sdk/account-id.js +0 -3
- package/dist/plugin-sdk/account-resolution.js +0 -12
- package/dist/plugin-sdk/acp-runtime.js +0 -3
- package/dist/plugin-sdk/agent-config-primitives.js +0 -3
- package/dist/plugin-sdk/agent-runtime.js +0 -29
- package/dist/plugin-sdk/allow-from.js +0 -5
- package/dist/plugin-sdk/allowlist-config-edit.js +0 -2
- package/dist/plugin-sdk/amazon-bedrock.js +0 -15
- package/dist/plugin-sdk/anthropic-vertex.js +0 -2
- package/dist/plugin-sdk/approval-runtime.js +0 -8
- package/dist/plugin-sdk/bluebubbles-policy.js +0 -2
- package/dist/plugin-sdk/bluebubbles.js +0 -39
- package/dist/plugin-sdk/boolean-param.js +0 -2
- package/dist/plugin-sdk/browser-runtime.js +0 -3
- package/dist/plugin-sdk/browser-support.js +0 -44
- package/dist/plugin-sdk/browser.js +0 -15
- package/dist/plugin-sdk/byteplus.js +0 -17
- package/dist/plugin-sdk/channel-actions.js +0 -3
- package/dist/plugin-sdk/channel-config-helpers.js +0 -2
- package/dist/plugin-sdk/channel-config-primitives.js +0 -4
- package/dist/plugin-sdk/channel-config-schema.js +0 -7
- package/dist/plugin-sdk/channel-config-writes.js +0 -3
- package/dist/plugin-sdk/channel-contract.js +0 -1
- package/dist/plugin-sdk/channel-feedback.js +0 -5
- package/dist/plugin-sdk/channel-inbound.js +0 -10
- package/dist/plugin-sdk/channel-lifecycle.js +0 -3
- package/dist/plugin-sdk/channel-pairing.js +0 -2
- package/dist/plugin-sdk/channel-policy.js +0 -6
- package/dist/plugin-sdk/channel-reply-pipeline.js +0 -2
- package/dist/plugin-sdk/channel-runtime.js +0 -16
- package/dist/plugin-sdk/channel-send-result.js +0 -2
- package/dist/plugin-sdk/channel-setup.js +0 -5
- package/dist/plugin-sdk/channel-status.js +0 -5
- package/dist/plugin-sdk/channel-targets.js +0 -5
- package/dist/plugin-sdk/chutes.js +0 -20
- package/dist/plugin-sdk/cli-backend.js +0 -3
- package/dist/plugin-sdk/cli-runtime.js +0 -7
- package/dist/plugin-sdk/cloudflare-ai-gateway.js +0 -18
- package/dist/plugin-sdk/collection-runtime.js +0 -3
- package/dist/plugin-sdk/command-auth-native.js +0 -6
- package/dist/plugin-sdk/command-auth.js +0 -14
- package/dist/plugin-sdk/command-detection.js +0 -3
- package/dist/plugin-sdk/command-surface.js +0 -3
- package/dist/plugin-sdk/compat.js +0 -35
- package/dist/plugin-sdk/config-runtime.js +0 -25
- package/dist/plugin-sdk/conversation-runtime.js +0 -15
- package/dist/plugin-sdk/core.js +0 -22
- package/dist/plugin-sdk/dangerous-name-runtime.js +0 -3
- package/dist/plugin-sdk/deepseek.js +0 -14
- package/dist/plugin-sdk/device-bootstrap.js +0 -4
- package/dist/plugin-sdk/diagnostic-runtime.js +0 -4
- package/dist/plugin-sdk/diagnostics-otel.js +0 -6
- package/dist/plugin-sdk/diffs.js +0 -4
- package/dist/plugin-sdk/direct-dm.js +0 -2
- package/dist/plugin-sdk/directory-runtime.js +0 -5
- package/dist/plugin-sdk/discord-account.js +0 -2
- package/dist/plugin-sdk/discord-core.js +0 -9
- package/dist/plugin-sdk/discord-runtime-surface.js +0 -2
- package/dist/plugin-sdk/discord-session-key.js +0 -2
- package/dist/plugin-sdk/discord-surface.js +0 -2
- package/dist/plugin-sdk/discord-thread-bindings.js +0 -2
- package/dist/plugin-sdk/discord-timeouts.js +0 -2
- package/dist/plugin-sdk/discord.js +0 -21
- package/dist/plugin-sdk/error-runtime.js +0 -3
- package/dist/plugin-sdk/extension-shared.js +0 -3
- package/dist/plugin-sdk/feishu-conversation.js +0 -2
- package/dist/plugin-sdk/feishu-setup.js +0 -2
- package/dist/plugin-sdk/feishu.js +0 -34
- package/dist/plugin-sdk/fetch-runtime.js +0 -7
- package/dist/plugin-sdk/file-lock.js +0 -2
- package/dist/plugin-sdk/gateway-runtime.js +0 -4
- package/dist/plugin-sdk/github-copilot-login.js +0 -2
- package/dist/plugin-sdk/github-copilot-token.js +0 -3
- package/dist/plugin-sdk/global-singleton.js +0 -4
- package/dist/plugin-sdk/google.js +0 -2
- package/dist/plugin-sdk/googlechat.js +0 -38
- package/dist/plugin-sdk/group-access.js +0 -2
- package/dist/plugin-sdk/hook-runtime.js +0 -4
- package/dist/plugin-sdk/host-runtime.js +0 -4
- package/dist/plugin-sdk/huggingface.js +0 -18
- package/dist/plugin-sdk/image-generation-core.js +0 -63
- package/dist/plugin-sdk/image-generation.js +0 -2
- package/dist/plugin-sdk/index.js +0 -5
- package/dist/plugin-sdk/infra-runtime.js +0 -45
- package/dist/plugin-sdk/interactive-runtime.js +0 -4
- package/dist/plugin-sdk/irc-surface.js +0 -2
- package/dist/plugin-sdk/irc.js +0 -30
- package/dist/plugin-sdk/json-store.js +0 -3
- package/dist/plugin-sdk/keyed-async-queue.js +0 -2
- package/dist/plugin-sdk/kilocode.js +0 -23
- package/dist/plugin-sdk/kimi-coding.js +0 -11
- package/dist/plugin-sdk/lazy-runtime.js +0 -3
- package/dist/plugin-sdk/line-core.js +0 -6
- package/dist/plugin-sdk/line-runtime.js +0 -2
- package/dist/plugin-sdk/line-surface.js +0 -2
- package/dist/plugin-sdk/line.js +0 -9
- package/dist/plugin-sdk/llm-task.js +0 -6
- package/dist/plugin-sdk/logging-core.js +0 -5
- package/dist/plugin-sdk/markdown-table-runtime.js +0 -3
- package/dist/plugin-sdk/matrix-helper.js +0 -2
- package/dist/plugin-sdk/matrix-runtime-heavy.js +0 -5
- package/dist/plugin-sdk/matrix-runtime-shared.js +0 -3
- package/dist/plugin-sdk/matrix-runtime-surface.js +0 -2
- package/dist/plugin-sdk/matrix-surface.js +0 -2
- package/dist/plugin-sdk/matrix-thread-bindings.js +0 -2
- package/dist/plugin-sdk/matrix.js +0 -53
- package/dist/plugin-sdk/mattermost-policy.js +0 -11
- package/dist/plugin-sdk/mattermost.js +0 -41
- package/dist/plugin-sdk/media-runtime.js +0 -17
- package/dist/plugin-sdk/media-understanding-runtime.js +0 -2
- package/dist/plugin-sdk/media-understanding.js +0 -3
- package/dist/plugin-sdk/memory-core-engine-runtime.js +0 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +0 -6
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +0 -17
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +0 -3
- package/dist/plugin-sdk/memory-core-host-engine-storage.js +0 -4
- package/dist/plugin-sdk/memory-core-host-multimodal.js +0 -3
- package/dist/plugin-sdk/memory-core-host-query.js +0 -3
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +0 -12
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +0 -14
- package/dist/plugin-sdk/memory-core-host-runtime-files.js +0 -4
- package/dist/plugin-sdk/memory-core-host-secret.js +0 -3
- package/dist/plugin-sdk/memory-core-host-status.js +0 -2
- package/dist/plugin-sdk/memory-core.js +0 -29
- package/dist/plugin-sdk/memory-lancedb.js +0 -4
- package/dist/plugin-sdk/minimax.js +0 -24
- package/dist/plugin-sdk/mistral.js +0 -17
- package/dist/plugin-sdk/models-provider-runtime.js +0 -3
- package/dist/plugin-sdk/modelstudio-definitions.js +0 -19
- package/dist/plugin-sdk/modelstudio.js +0 -24
- package/dist/plugin-sdk/moonshot.js +0 -17
- package/dist/plugin-sdk/msteams.js +0 -46
- package/dist/plugin-sdk/native-command-registry.js +0 -3
- package/dist/plugin-sdk/nextcloud-talk.js +0 -35
- package/dist/plugin-sdk/nostr.js +0 -14
- package/dist/plugin-sdk/nvidia.js +0 -11
- package/dist/plugin-sdk/ollama-surface.js +0 -24
- package/dist/plugin-sdk/ollama.js +0 -2
- package/dist/plugin-sdk/openai.js +0 -2
- package/dist/plugin-sdk/opencode-go.js +0 -14
- package/dist/plugin-sdk/opencode.js +0 -15
- package/dist/plugin-sdk/outbound-runtime.js +0 -5
- package/dist/plugin-sdk/param-readers.js +0 -3
- package/dist/plugin-sdk/plugin-entry.js +0 -3
- package/dist/plugin-sdk/plugin-runtime.js +0 -8
- package/dist/plugin-sdk/process-runtime.js +0 -3
- package/dist/plugin-sdk/provider-auth-api-key.js +0 -9
- package/dist/plugin-sdk/provider-auth-login.js +0 -2
- package/dist/plugin-sdk/provider-auth-result.js +0 -2
- package/dist/plugin-sdk/provider-auth-runtime.js +0 -5
- package/dist/plugin-sdk/provider-auth.js +0 -17
- package/dist/plugin-sdk/provider-catalog-shared.js +0 -2
- package/dist/plugin-sdk/provider-entry.js +0 -2
- package/dist/plugin-sdk/provider-env-vars.js +0 -3
- package/dist/plugin-sdk/provider-http.js +0 -6
- package/dist/plugin-sdk/provider-model-shared.js +0 -5
- package/dist/plugin-sdk/provider-moonshot.js +0 -3
- package/dist/plugin-sdk/provider-onboard.js +0 -3
- package/dist/plugin-sdk/provider-setup.js +0 -3
- package/dist/plugin-sdk/provider-stream.js +0 -4
- package/dist/plugin-sdk/provider-tools.js +0 -2
- package/dist/plugin-sdk/provider-usage.js +0 -3
- package/dist/plugin-sdk/provider-web-fetch.js +0 -6
- package/dist/plugin-sdk/provider-web-search.js +0 -7
- package/dist/plugin-sdk/provider-zai-endpoint.js +0 -2
- package/dist/plugin-sdk/qianfan.js +0 -13
- package/dist/plugin-sdk/reply-chunking.js +0 -4
- package/dist/plugin-sdk/reply-dispatch-runtime.js +0 -5
- package/dist/plugin-sdk/reply-history.js +0 -3
- package/dist/plugin-sdk/reply-payload.js +0 -2
- package/dist/plugin-sdk/reply-runtime.js +0 -14
- package/dist/plugin-sdk/request-url.js +0 -2
- package/dist/plugin-sdk/retry-runtime.js +0 -4
- package/dist/plugin-sdk/root-alias.cjs +0 -347
- package/dist/plugin-sdk/routing.js +0 -9
- package/dist/plugin-sdk/runtime-config-snapshot.js +0 -3
- package/dist/plugin-sdk/runtime-env.js +0 -17
- package/dist/plugin-sdk/runtime-group-policy.js +0 -3
- package/dist/plugin-sdk/runtime-store.js +0 -2
- package/dist/plugin-sdk/runtime.js +0 -9
- package/dist/plugin-sdk/sandbox.js +0 -6
- package/dist/plugin-sdk/secret-input.js +0 -4
- package/dist/plugin-sdk/security-runtime.js +0 -6
- package/dist/plugin-sdk/self-hosted-provider-setup.js +0 -2
- package/dist/plugin-sdk/session-store-runtime.js +0 -4
- package/dist/plugin-sdk/setup-adapter-runtime.js +0 -3
- package/dist/plugin-sdk/setup-runtime.js +0 -6
- package/dist/plugin-sdk/setup-tools.js +0 -6
- package/dist/plugin-sdk/setup.js +0 -13
- package/dist/plugin-sdk/sglang.js +0 -15
- package/dist/plugin-sdk/signal-account.js +0 -2
- package/dist/plugin-sdk/signal-surface.js +0 -2
- package/dist/plugin-sdk/signal.js +0 -24
- package/dist/plugin-sdk/skill-commands-runtime.js +0 -3
- package/dist/plugin-sdk/slack-account.js +0 -2
- package/dist/plugin-sdk/slack-core.js +0 -7
- package/dist/plugin-sdk/slack-runtime-surface.js +0 -2
- package/dist/plugin-sdk/slack-surface.js +0 -2
- package/dist/plugin-sdk/slack-target-parser.js +0 -2
- package/dist/plugin-sdk/slack-targets.js +0 -3
- package/dist/plugin-sdk/slack.js +0 -20
- package/dist/plugin-sdk/speech-core.js +0 -4
- package/dist/plugin-sdk/speech-runtime.js +0 -2
- package/dist/plugin-sdk/speech.js +0 -5
- package/dist/plugin-sdk/ssrf-runtime.js +0 -6
- package/dist/plugin-sdk/state-paths.js +0 -3
- package/dist/plugin-sdk/status-helpers.js +0 -4
- package/dist/plugin-sdk/string-normalization-runtime.js +0 -3
- package/dist/plugin-sdk/synthetic.js +0 -17
- package/dist/plugin-sdk/telegram-account.js +0 -2
- package/dist/plugin-sdk/telegram-allow-from.js +0 -12
- package/dist/plugin-sdk/telegram-command-config.js +0 -3
- package/dist/plugin-sdk/telegram-core.js +0 -18
- package/dist/plugin-sdk/telegram-surface.js +0 -42
- package/dist/plugin-sdk/temp-path.js +0 -4
- package/dist/plugin-sdk/testing.js +0 -11
- package/dist/plugin-sdk/text-runtime.js +0 -19
- package/dist/plugin-sdk/thread-bindings-runtime.js +0 -4
- package/dist/plugin-sdk/thread-ownership.js +0 -5
- package/dist/plugin-sdk/tlon.js +0 -13
- package/dist/plugin-sdk/together.js +0 -16
- package/dist/plugin-sdk/tool-send.js +0 -2
- package/dist/plugin-sdk/twitch.js +0 -8
- package/dist/plugin-sdk/venice.js +0 -16
- package/dist/plugin-sdk/vllm.js +0 -15
- package/dist/plugin-sdk/voice-call.js +0 -7
- package/dist/plugin-sdk/volcengine.js +0 -17
- package/dist/plugin-sdk/web-media.js +0 -4
- package/dist/plugin-sdk/webhook-ingress.js +0 -9
- package/dist/plugin-sdk/webhook-path.js +0 -2
- package/dist/plugin-sdk/webhook-request-guards.js +0 -3
- package/dist/plugin-sdk/whatsapp-auth-presence.js +0 -2
- package/dist/plugin-sdk/whatsapp-core.js +0 -11
- package/dist/plugin-sdk/whatsapp-shared.js +0 -5
- package/dist/plugin-sdk/whatsapp-surface.js +0 -2
- package/dist/plugin-sdk/whatsapp-targets.js +0 -2
- package/dist/plugin-sdk/windows-spawn.js +0 -2
- package/dist/plugin-sdk/xai.js +0 -27
- package/dist/plugin-sdk/zalo-setup.js +0 -2
- package/dist/plugin-sdk/zalo.js +0 -38
- package/dist/plugin-sdk/zalouser.js +0 -29
- package/dist/plugin-sdk/zod.js +0 -3
- package/dist/plugins/build-smoke-entry.js +0 -4
- package/dist/plugins/provider-runtime.runtime.js +0 -2
- package/dist/plugins/runtime/index.js +0 -2
- package/dist/plugins/runtime/runtime-line.contract.js +0 -23
- package/dist/plugins-DcjzAZWt.js +0 -5
- package/dist/plugins-allowlist-DoZlIC4p.js +0 -14
- package/dist/plugins-cli-G6GhHHD0.js +0 -561
- package/dist/plugins-command-helpers-CIYzoC65.js +0 -116
- package/dist/plugins-install-persist-C5-bJdRb.js +0 -121
- package/dist/plugins-update-command-CsT_saJm.js +0 -974
- package/dist/plugins-w6xUzHby.js +0 -40
- package/dist/pluralkit-B_DWQnc5.js +0 -21
- package/dist/pluralkit-Bez5QVFC.js +0 -2
- package/dist/policy-D6OQdw73.js +0 -173
- package/dist/policy-DXeeH8B2.js +0 -147
- package/dist/poll-params-DTVSSuok.js +0 -52
- package/dist/polls-CMmT0F_y.js +0 -35
- package/dist/port-defaults-Dajs4Obu.js +0 -30
- package/dist/ports-DuU-A86K.js +0 -262
- package/dist/ports-ZA1n2It7.js +0 -432
- package/dist/ports-lsof-Cw_6T7ru.js +0 -25
- package/dist/ports-probe-DeuK48Pq.js +0 -14
- package/dist/preflight-audio-DTSBExi8.js +0 -48
- package/dist/preflight-audio.runtime-BJRLyBvf.js +0 -7
- package/dist/preflight-audio.runtime.js +0 -1
- package/dist/prepare-BQBndJUC.js +0 -1301
- package/dist/probe-BO4hbHvs.js +0 -435
- package/dist/probe-DPv2pfj5.js +0 -1868
- package/dist/probe-DlO2Q9rN.js +0 -170
- package/dist/probe-RbbTQOHx.js +0 -178
- package/dist/probe-auth-Bl9MHtlP.js +0 -2
- package/dist/probe-auth-CUfEH7di.js +0 -63
- package/dist/probe-eYLpFww_.js +0 -137
- package/dist/probe-kfBMuOWF.js +0 -2
- package/dist/probe-wktb4WTP.js +0 -349
- package/dist/probe.runtime-BhbUesak.js +0 -2
- package/dist/probe.runtime.js +0 -1
- package/dist/process-runtime-CBFMzhIk.js +0 -2
- package/dist/process-scoped-map-C7IoOrV-.js +0 -61
- package/dist/profile-B5n9yLlB.js +0 -2
- package/dist/profile-CmsqnPsu.js +0 -107
- package/dist/profile-update-D6f10CZk.js +0 -67
- package/dist/profile-utils-C7uzTwgJ.js +0 -15
- package/dist/profiles-BoNergZo.js +0 -79
- package/dist/program-BuKG0Ntx.js +0 -158
- package/dist/program-context-DDmlbmbl.js +0 -2
- package/dist/program-context-DQOnR5c_.js +0 -10
- package/dist/progress-DQvXYKne.js +0 -132
- package/dist/prompt-COzf5LIJ.js +0 -2
- package/dist/prompt-OSmU-o7R.js +0 -20
- package/dist/prompt-select-styled-yYL3el77.js +0 -6432
- package/dist/prompt-style-DekFM6h7.js +0 -7
- package/dist/prompts-MtRTsZpw.js +0 -9
- package/dist/prototype-keys-DrjhYNcz.js +0 -11
- package/dist/provider-BWTXmDq3.js +0 -3685
- package/dist/provider-BrmcrkEe.js +0 -70
- package/dist/provider-ByBRbhW5.js +0 -7216
- package/dist/provider-api-key-auth-BcyipSdy.js +0 -109
- package/dist/provider-api-key-auth.runtime-BRu_8L4m.js +0 -14
- package/dist/provider-api-key-auth.runtime.js +0 -1
- package/dist/provider-attribution-DMVujx9B.js +0 -285
- package/dist/provider-auth-DK2UmYsZ.js +0 -43
- package/dist/provider-auth-api-key-99KxscjW.js +0 -5
- package/dist/provider-auth-choice-GbHta8Bp.js +0 -134
- package/dist/provider-auth-choice-helpers-CO2MnSGR.js +0 -58
- package/dist/provider-auth-choice-preference-DvAqSMGK.js +0 -44
- package/dist/provider-auth-choice.runtime-B8R63sLq.js +0 -14
- package/dist/provider-auth-choice.runtime-DypTKgMQ.js +0 -2
- package/dist/provider-auth-choice.runtime.js +0 -1
- package/dist/provider-auth-choices-n-JV1XgU.js +0 -65
- package/dist/provider-auth-guidance-DAB9sGGR.js +0 -35
- package/dist/provider-auth-helpers-gmTAji1W.js +0 -92
- package/dist/provider-auth-input-GgY_tjJh.js +0 -116
- package/dist/provider-auth-login-BYbccnB1.js +0 -8
- package/dist/provider-auth-login.runtime-DnSxCwqU.js +0 -196
- package/dist/provider-auth-login.runtime.js +0 -1
- package/dist/provider-auth-mode-Dbja5LLX.js +0 -20
- package/dist/provider-auth-ref-BErMfwCd.js +0 -171
- package/dist/provider-auth-ref-DEF_hE2R.js +0 -2
- package/dist/provider-auth-result-DiUxDF1G.js +0 -31
- package/dist/provider-auth-runtime-BwMq9oMD.js +0 -32
- package/dist/provider-catalog--Qc0q0I-.js +0 -26
- package/dist/provider-catalog-A_s8JQaq.js +0 -18
- package/dist/provider-catalog-B-EcLvBI.js +0 -11
- package/dist/provider-catalog-Bte-HucL.js +0 -44
- package/dist/provider-catalog-C63Rfat7.js +0 -11
- package/dist/provider-catalog-C7q0Vb3S.js +0 -95
- package/dist/provider-catalog-CCnuf8d3.js +0 -49
- package/dist/provider-catalog-CYQ7k_Db.js +0 -48
- package/dist/provider-catalog-CnlB2mMZ.js +0 -11
- package/dist/provider-catalog-CoyAbDZX.js +0 -56
- package/dist/provider-catalog-CtqhFopw.js +0 -48
- package/dist/provider-catalog-CyGxB_aR.js +0 -18
- package/dist/provider-catalog-D1pmWiDQ.js +0 -48
- package/dist/provider-catalog-DGgsalJv.js +0 -12
- package/dist/provider-catalog-DLdTTMmW.js +0 -11
- package/dist/provider-catalog-DZzX7Vwk.js +0 -54
- package/dist/provider-catalog-J2dZciKS.js +0 -11
- package/dist/provider-catalog-LVrcrz-W.js +0 -36
- package/dist/provider-catalog-aIN0QojF.js +0 -11
- package/dist/provider-catalog-shared-Db9nbr1B.js +0 -28
- package/dist/provider-discovery.runtime-BCUAsMMz.js +0 -10
- package/dist/provider-discovery.runtime.js +0 -1
- package/dist/provider-dispatcher-COxXbow_.js +0 -22
- package/dist/provider-entry-CT_YeII_.js +0 -86
- package/dist/provider-env-vars-4Bon7Y2X.js +0 -121
- package/dist/provider-env-vars-Np7qkDjC.js +0 -2
- package/dist/provider-flow-Dlg1GcXQ.js +0 -93
- package/dist/provider-http-DQQ317hc.js +0 -3
- package/dist/provider-id-CHzLB538.js +0 -30
- package/dist/provider-model-defaults-dSPzPas0.js +0 -5
- package/dist/provider-model-primary-D8SgLcOd.js +0 -26
- package/dist/provider-model-shared-GO1WT2fY.js +0 -104
- package/dist/provider-models-BG8YwJaY.js +0 -117
- package/dist/provider-models-BVVCdM8F.js +0 -22
- package/dist/provider-models-D2UZvTo3.js +0 -46
- package/dist/provider-moonshot-Cl8urWHL.js +0 -2
- package/dist/provider-oauth-flow-Bu2gIeX6.js +0 -33
- package/dist/provider-onboard-CTEHTjfw.js +0 -264
- package/dist/provider-openai-codex-oauth-tls-DdLUDuIM.js +0 -101
- package/dist/provider-registry-Ljtt6CKE.js +0 -49
- package/dist/provider-request-config-CIrbwAnR.js +0 -209
- package/dist/provider-runtime-BBFXlsU0.js +0 -2
- package/dist/provider-runtime-D_itmv9t.js +0 -291
- package/dist/provider-runtime.runtime-B_oC992d.js +0 -26
- package/dist/provider-runtime.runtime.js +0 -1
- package/dist/provider-self-hosted-setup-BlNrSREL.js +0 -272
- package/dist/provider-session.runtime-DQyRV-t3.js +0 -7
- package/dist/provider-session.runtime.js +0 -1
- package/dist/provider-setup-CSrOyU04.js +0 -2
- package/dist/provider-stream-m5D8QZPz.js +0 -289
- package/dist/provider-tools-NuJzTqa1.js +0 -37
- package/dist/provider-usage-BB5mQ8Fg.js +0 -3
- package/dist/provider-usage-CbPs3eFQ.js +0 -2
- package/dist/provider-usage-DG1gff_M.js +0 -375
- package/dist/provider-usage.fetch-DHWQ4YZu.js +0 -633
- package/dist/provider-web-fetch-QzED2vth.js +0 -5
- package/dist/provider-web-search-CVMEZcl8.js +0 -306
- package/dist/provider-wizard-B0ocsg3q.js +0 -209
- package/dist/provider-zai-endpoint-DoIy5HQf.js +0 -116
- package/dist/provider.runtime-jHt6447e.js +0 -2
- package/dist/provider.runtime.js +0 -1
- package/dist/providers-DUy2TaM-.js +0 -59
- package/dist/providers.runtime-Bz0X8DZ2.js +0 -60
- package/dist/providers.runtime.js +0 -1
- package/dist/proxy-env-D4H9qI5l.js +0 -40
- package/dist/proxy-fetch-DiyTLcAR.js +0 -55
- package/dist/proxy-hcRRmsDd.js +0 -121
- package/dist/pw-ai-Cp64-UGh.js +0 -2037
- package/dist/qmd-manager-D2rMomsU.js +0 -1740
- package/dist/qr-cli-DuANCi-n.js +0 -2
- package/dist/qr-cli-lr5CcLr8.js +0 -367
- package/dist/qr-image-DOcoqAUw.js +0 -2
- package/dist/query-expansion-85HlYbKD.js +0 -633
- package/dist/queue-CtO0M_P1.js +0 -663
- package/dist/reaction-runtime-api-B4KmfKtJ.js +0 -114
- package/dist/reactions-5N2KSGJ2.js +0 -258
- package/dist/read-only-account-inspect-Y_ijOKJ3.js +0 -9
- package/dist/read-only-account-inspect.telegram-BSjjDWnM.js +0 -202
- package/dist/reasoning-tags-CAmbBXLr.js +0 -77
- package/dist/recovery-key-store-DqgdfMc7.js +0 -283
- package/dist/redact-BDinS1q9.js +0 -102
- package/dist/redact-identifier-S69DDJn1.js +0 -13
- package/dist/redact-sensitive-url-CAJSZ_7g.js +0 -50
- package/dist/redirect-headers-CGxONG_L.js +0 -25
- package/dist/ref-contract-CC5BLDoS.js +0 -53
- package/dist/region-BFGEM88n.js +0 -62
- package/dist/register-lazy-command-D6EEI-zz.js +0 -43
- package/dist/register.agent-D1eKwVU7.js +0 -239
- package/dist/register.backup-S8hwHpZL.js +0 -236
- package/dist/register.configure-CJrQ3u9y.js +0 -15
- package/dist/register.maintenance-BrKWl7_D.js +0 -449
- package/dist/register.message-BCWJfH2h.js +0 -642
- package/dist/register.onboard-zzNq0pJS.js +0 -79
- package/dist/register.setup-BLQwDKzc.js +0 -104
- package/dist/register.status-health-sessions-B4TUEudf.js +0 -1206
- package/dist/register.subclis-B0pG22H2.js +0 -295
- package/dist/register.subclis-BEM0mzJb.js +0 -3
- package/dist/registry-ByjnKj3u.js +0 -219
- package/dist/registry-CuFNdbH5.js +0 -60
- package/dist/registry-DvqOrcbF.js +0 -675
- package/dist/registry-mVzzlPf7.js +0 -50
- package/dist/repair-IMBZnz-L.js +0 -112
- package/dist/replies-BCoZ2HxY.js +0 -118
- package/dist/reply-D8bUQd-Q.js +0 -3176
- package/dist/reply-blocks-CjCUTZru.js +0 -103
- package/dist/reply-chunking-CxFd5izq.js +0 -3
- package/dist/reply-dispatch-runtime-Bk9RDzB9.js +0 -3
- package/dist/reply-history-DtTaPEgt.js +0 -2
- package/dist/reply-payload-CRYI4jIB.js +0 -232
- package/dist/reply-payloads-CQXH7ury.js +0 -116
- package/dist/reply-payloads-dedupe-BKObDjVe.js +0 -135
- package/dist/reply-payloads-dedupe.runtime-SbVNMvEs.js +0 -2
- package/dist/reply-payloads-dedupe.runtime.js +0 -1
- package/dist/reply-prefix-Eema_xXG.js +0 -39
- package/dist/reply-runtime-DUrpJTzu.js +0 -123
- package/dist/reply.runtime-Cdb_6NI1.js +0 -2
- package/dist/reply.runtime.js +0 -1
- package/dist/request-url-B8k-YRRH.js +0 -10
- package/dist/resolve-C3pJ2gj_.js +0 -174
- package/dist/resolve-C_pCWwC0.js +0 -619
- package/dist/resolve-allowlist-HrJ_3icS.js +0 -147
- package/dist/resolve-cbCi7mbs.js +0 -2
- package/dist/resolve-channels-BTyErRev.js +0 -226
- package/dist/resolve-channels-DvV-fUQv.js +0 -263
- package/dist/resolve-configured-secret-input-string-BasQGOd9.js +0 -112
- package/dist/resolve-route-EE8E7OAF.js +0 -486
- package/dist/resolve-system-bin-TC907QYo.js +0 -120
- package/dist/resolve-targets-B1MvBWpT.js +0 -280
- package/dist/resolve-users-BfVoBZG_.js +0 -145
- package/dist/resolve-utils-ClmKSkEQ.js +0 -102
- package/dist/response-generator-ACP21F1j.js +0 -153
- package/dist/response-prefix-template-Cp4tg6Qw.js +0 -50
- package/dist/restart-sentinel-B3EigRIb.js +0 -70
- package/dist/restart-stale-pids-dsB3eE6_.js +0 -187
- package/dist/retry-CIAqcw7C.js +0 -76
- package/dist/retry-policy-BJ5Q68It.js +0 -58
- package/dist/retry-runtime-Cbu5zDnX.js +0 -3
- package/dist/rooms-B1IyUfuR.js +0 -325
- package/dist/root-help-Bwa-vlhy.js +0 -53
- package/dist/route-reply-bC07YRDb.js +0 -133
- package/dist/route-reply.runtime-dS2XMwkv.js +0 -2
- package/dist/route-reply.runtime.js +0 -1
- package/dist/route-resolution-DQHmIfWN.js +0 -461
- package/dist/routes-CWXihJFR.js +0 -6884
- package/dist/routing-BVt9nMN-.js +0 -16
- package/dist/rpc-5eaI-FsF.js +0 -67
- package/dist/rpc-context-Dimdo4io.js +0 -155
- package/dist/run-command-2jxKF1a6.js +0 -32
- package/dist/run-main-BKeNUaXq.js +0 -425
- package/dist/run-with-concurrency-DGLkItan.js +0 -41
- package/dist/runner-COmi-bB0.js +0 -1479
- package/dist/runs-CX-70k4f.js +0 -616
- package/dist/runtime-1phb9iVo.js +0 -6
- package/dist/runtime-B8hqEtu6.js +0 -181
- package/dist/runtime-BpHrcXgA.js +0 -5
- package/dist/runtime-BscSIjIL.js +0 -126
- package/dist/runtime-C8qvwPYG.js +0 -286
- package/dist/runtime-CBX_rq4O.js +0 -18
- package/dist/runtime-CC1YDOst.js +0 -5
- package/dist/runtime-CIE7xJwu.js +0 -5
- package/dist/runtime-CNZi_czi.js +0 -42
- package/dist/runtime-CPw-0dWW.js +0 -5
- package/dist/runtime-DXdxDbJm.js +0 -102
- package/dist/runtime-DofOSZ5U.js +0 -2153
- package/dist/runtime-api-B4Zb5p1_.js +0 -2
- package/dist/runtime-api-BB2RZPnq.js +0 -2
- package/dist/runtime-api-BJnw1_pK.js +0 -2
- package/dist/runtime-api-BTf2rLCn.js +0 -2
- package/dist/runtime-api-BTgAUySz.js +0 -2
- package/dist/runtime-api-BVftCkYc.js +0 -2484
- package/dist/runtime-api-BWaVsvsK.js +0 -14
- package/dist/runtime-api-BXlE282E.js +0 -2
- package/dist/runtime-api-Ba7wWBWO.js +0 -1
- package/dist/runtime-api-BfZqvwkY.js +0 -2
- package/dist/runtime-api-Bja3afzd.js +0 -3676
- package/dist/runtime-api-C7cX3f2r.js +0 -2
- package/dist/runtime-api-CCKblcQO.js +0 -81
- package/dist/runtime-api-CEmQSooZ.js +0 -2
- package/dist/runtime-api-CWQMIahu.js +0 -241
- package/dist/runtime-api-Ch1E1gvT.js +0 -2
- package/dist/runtime-api-CjgyJEjn.js +0 -2
- package/dist/runtime-api-CuqnElJG.js +0 -3
- package/dist/runtime-api-DOyNJNHi.js +0 -2
- package/dist/runtime-api-DUbp7oPz.js +0 -2
- package/dist/runtime-api-DZDDizAj.js +0 -1
- package/dist/runtime-api-DZcQIyI0.js +0 -1
- package/dist/runtime-api-Di-XE7J4.js +0 -3
- package/dist/runtime-api-Dq7rdsm6.js +0 -2
- package/dist/runtime-api-DxO7sIvA.js +0 -120
- package/dist/runtime-api-Dzz1aWyq.js +0 -29
- package/dist/runtime-api-_dg5Me1l.js +0 -2
- package/dist/runtime-config-snapshot-DqWNFIej.js +0 -2
- package/dist/runtime-d8L2hZ57.js +0 -5
- package/dist/runtime-discord-ops.runtime-C2o0995d.js +0 -25
- package/dist/runtime-discord-ops.runtime.js +0 -1
- package/dist/runtime-embedded-pi.runtime-Bk8vHdbc.js +0 -2
- package/dist/runtime-embedded-pi.runtime.js +0 -1
- package/dist/runtime-entry-BypP0hpR.js +0 -4925
- package/dist/runtime-env-SHKgcATc.js +0 -9
- package/dist/runtime-forwarders-ev8FdVyV.js +0 -44
- package/dist/runtime-group-policy-DXJJCWpk.js +0 -1
- package/dist/runtime-group-policy-zTp8fKRK.js +0 -59
- package/dist/runtime-guard-78ESz4Qy.js +0 -70
- package/dist/runtime-kS8e4c6-.js +0 -125
- package/dist/runtime-media-understanding.runtime-CpPWzWdQ.js +0 -2
- package/dist/runtime-media-understanding.runtime.js +0 -1
- package/dist/runtime-model-auth.runtime-1Gsp1j1n.js +0 -2
- package/dist/runtime-model-auth.runtime.js +0 -1
- package/dist/runtime-parse-vvG9x7Ps.js +0 -83
- package/dist/runtime-paths-NiQSNveu.js +0 -305
- package/dist/runtime-plugin-boundary-CzRNh2jW.js +0 -65
- package/dist/runtime-schema-uKXWjWrD.js +0 -14440
- package/dist/runtime-slack-ops.runtime-MQwSRdp3.js +0 -15
- package/dist/runtime-slack-ops.runtime.js +0 -1
- package/dist/runtime-status-2omGgKaM.js +0 -109
- package/dist/runtime-status-Cc383GkB.js +0 -15
- package/dist/runtime-store-CT3yRBe_.js +0 -22
- package/dist/runtime-tts.runtime-DTfPYn3H.js +0 -2
- package/dist/runtime-tts.runtime.js +0 -1
- package/dist/runtime-uvckmk15.js +0 -68
- package/dist/runtime-web-tools-Cf6BXnCm.js +0 -2042
- package/dist/runtime-whatsapp-boundary-Bs8RrKxP.js +0 -139
- package/dist/runtime-whatsapp-boundary-C5mx67ac.js +0 -2
- package/dist/safe-regex-tLlDZYfM.js +0 -244
- package/dist/safe-text-DhIQbZid.js +0 -16
- package/dist/sandbox-DkZ4-LBj.js +0 -4
- package/dist/sandbox-cli-Cho_k3dA.js +0 -443
- package/dist/sandbox-f4-hZNCj.js +0 -2710
- package/dist/sandbox-paths-Br54mtAJ.js +0 -146
- package/dist/sanitize-env-vars-BpNLWkzd.js +0 -82
- package/dist/scan-paths-Bln7l19-.js +0 -28
- package/dist/schema-validator-DofqBvJi.js +0 -176
- package/dist/scoped-expiring-id-cache-C8wyKEV-.js +0 -35
- package/dist/scp-host-B9NPcVwn.js +0 -62
- package/dist/sdk-Ba91_ru8.js +0 -1108
- package/dist/searxng-search-provider-CUEJoeaQ.js +0 -220
- package/dist/secret-equal-fMR1DjSl.js +0 -9
- package/dist/secret-file-BNKBIds0.js +0 -11
- package/dist/secret-file-DwDmPLSX.js +0 -92
- package/dist/secret-input-4MqmO__N.js +0 -13
- package/dist/secret-input-Bqf5ho4v.js +0 -38
- package/dist/secret-input-DyzcNLLY.js +0 -2
- package/dist/secrets-cli-DAP4hi4r.js +0 -2112
- package/dist/secure-random-Diy9rj1m.js +0 -20
- package/dist/security-cli-2WQVKZ3w.js +0 -477
- package/dist/security-runtime-BSQDlFPi.js +0 -55
- package/dist/semver-compare-DkYCMcwG.js +0 -53
- package/dist/send--GwzHbbI.js +0 -100
- package/dist/send-4ZItW1GB.js +0 -3
- package/dist/send-B1YVZR_q.js +0 -1076
- package/dist/send-B6AgLKhw.js +0 -178
- package/dist/send-CAosrV3E.js +0 -2
- package/dist/send-CTHiX-WN.js +0 -442
- package/dist/send-CywIIzow.js +0 -318
- package/dist/send-DZ2VaVTD.js +0 -856
- package/dist/send-deps-Cuc-dTy5.js +0 -19
- package/dist/send-policy-Dz5lteoO.js +0 -60
- package/dist/send-q09VUMe3.js +0 -532
- package/dist/send.components-Cbi5ixnJ.js +0 -844
- package/dist/send.components-dLe6ppiS.js +0 -2
- package/dist/server-BRW1HQ2M.js +0 -67
- package/dist/server-Clq20rV8.js +0 -27990
- package/dist/server-middleware-Ubw3OFd1.js +0 -108
- package/dist/server-node-events-kgWhdE2I.js +0 -454
- package/dist/server-startup-matrix-migration-DJZgJiUa.js +0 -1348
- package/dist/service-2O78fADl.js +0 -867
- package/dist/service-BCUDr0mF.js +0 -2
- package/dist/session-BIwHn1FL.js +0 -137
- package/dist/session-BJudz6Rb.js +0 -50
- package/dist/session-archive.runtime-8FrIp7MP.js +0 -2
- package/dist/session-archive.runtime.js +0 -1
- package/dist/session-binding-service-D7bUc7mS.js +0 -421
- package/dist/session-context-DbS6R7x0.js +0 -23
- package/dist/session-conversation-5Z-WApq_.js +0 -15
- package/dist/session-conversation-BC-SPGma.js +0 -135
- package/dist/session-conversation-D-Olnomz.js +0 -27
- package/dist/session-cost-usage-5iS5N1Rs.js +0 -651
- package/dist/session-cost-usage-ibiGeH7Z.js +0 -2
- package/dist/session-envelope-RE_1D3fZ.js +0 -18
- package/dist/session-errors-CoC2qhLC.js +0 -63
- package/dist/session-file-CnTnoAyl.js +0 -120
- package/dist/session-fork.runtime-Bb9nNLwX.js +0 -50
- package/dist/session-fork.runtime.js +0 -1
- package/dist/session-hooks-D4zcaOKV.js +0 -109
- package/dist/session-key-CQMUjsSp.js +0 -52
- package/dist/session-key-Do__tq1E.js +0 -279
- package/dist/session-key-normalization-BamCBtxj.js +0 -22
- package/dist/session-override-CHm5auQy.js +0 -100
- package/dist/session-reset-model.runtime-DD5SooaH.js +0 -119
- package/dist/session-reset-model.runtime.js +0 -1
- package/dist/session-route-O1Pb7Oid.js +0 -91
- package/dist/session-store-runtime-ePmbOWO1.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BwUDVflj.js +0 -2
- package/dist/session-subagent-reactivation.runtime.js +0 -1
- package/dist/session-transcript-files.fs-CyBs2u56.js +0 -149
- package/dist/session-updates-C33bkLCm.js +0 -222
- package/dist/session-updates.runtime-BHLQJ71D.js +0 -2
- package/dist/session-updates.runtime.js +0 -1
- package/dist/session-utils-C0HJP9m_.js +0 -1743
- package/dist/session-write-lock-C7svKLqX.js +0 -343
- package/dist/sessions-CkaONOVi.js +0 -224
- package/dist/sessions-Dqj9fL_x.js +0 -2
- package/dist/sessions-j2hbBGOS.js +0 -443
- package/dist/setup-0GrDtpRN.js +0 -427
- package/dist/setup-BrOJEPVN.js +0 -15
- package/dist/setup-adapter-runtime-CyIIvoms.js +0 -2
- package/dist/setup-api-1P88M5pV.js +0 -2
- package/dist/setup-binary-CXmsVXWb.js +0 -2
- package/dist/setup-bootstrap-QdrIAyis.js +0 -54
- package/dist/setup-core-BqPbreVF.js +0 -256
- package/dist/setup-core-CFzSqpD7.js +0 -256
- package/dist/setup-core-DJHWTJKX.js +0 -383
- package/dist/setup-core-DT1fK9yD.js +0 -146
- package/dist/setup-core-kjYyNYvv.js +0 -48
- package/dist/setup-core-t03VZdcn.js +0 -160
- package/dist/setup-group-access-BQbnTk8B.js +0 -70
- package/dist/setup-helpers-0yWIq2cW.js +0 -390
- package/dist/setup-runtime-BChXvJOO.js +0 -4
- package/dist/setup-surface-B8loJ-nJ.js +0 -272
- package/dist/setup-surface-BKizDP2g.js +0 -237
- package/dist/setup-surface-BOd4V0w5.js +0 -261
- package/dist/setup-surface-BaLQtvFW.js +0 -353
- package/dist/setup-surface-Bha7U86Z.js +0 -72
- package/dist/setup-surface-BkHkduRm.js +0 -450
- package/dist/setup-surface-CDfudYpT2.js +0 -261
- package/dist/setup-surface-CT-Erp53.js +0 -346
- package/dist/setup-surface-Co1jSLDk.js +0 -656
- package/dist/setup-surface-D0joW4q1.js +0 -333
- package/dist/setup-surface-D9rWJb4Z.js +0 -1447
- package/dist/setup-surface-D_CJfyJ1.js +0 -381
- package/dist/setup-surface-DbVJ8CAj.js +0 -484
- package/dist/setup-surface-Di1q12ha.js +0 -97
- package/dist/setup-surface-LWupQ_eL.js +0 -304
- package/dist/setup-tools-Cb6PLN3L.js +0 -4
- package/dist/setup-wizard-helpers-CA5yiprq.js +0 -841
- package/dist/setup-wizard-proxy-bmMo6OPA.js +0 -127
- package/dist/setup.finalize-DvGlwfbU.js +0 -443
- package/dist/setup.gateway-config-D_eSo_Jz.js +0 -246
- package/dist/setup.secret-input-BAQnay16.js +0 -25
- package/dist/shared-1nXP7RAM.js +0 -78
- package/dist/shared-6u4-kP5J.js +0 -221
- package/dist/shared-BnSR7joQ.js +0 -144
- package/dist/shared-BsLpgVLV.js +0 -37
- package/dist/shared-C-PSF7Rv.js +0 -64
- package/dist/shared-C1MrVu4M.js +0 -180
- package/dist/shared-CA8QQ_O5.js +0 -94
- package/dist/shared-CCV62W5K.js +0 -2
- package/dist/shared-CHJjz6Zz.js +0 -72
- package/dist/shared-CK49TKED.js +0 -50
- package/dist/shared-CL7I4ij0.js +0 -160
- package/dist/shared-Cr7ijuS4.js +0 -198
- package/dist/shared-D61IX915.js +0 -10
- package/dist/shared-Dr9OQu4c.js +0 -64
- package/dist/shared-DwxV-O-g.js +0 -136
- package/dist/shared-dWHdeoyy.js +0 -126
- package/dist/shared-runtime-yV5uP0IO.js +0 -7
- package/dist/shell-argv-B9p91CMW.js +0 -72
- package/dist/shell-env-BTztt4a1.js +0 -181
- package/dist/signal-B1kD3iF3.js +0 -46
- package/dist/signal-DP8FUJOa.js +0 -6
- package/dist/signal-Dvmeol77.js +0 -13
- package/dist/signal-account-CYKnyxZK.js +0 -11
- package/dist/signal-cli-install-DcmsRDbB.js +0 -188
- package/dist/signal-surface-AbofIH7s.js +0 -21
- package/dist/simple-completion-transport-Dl5DzRWP.js +0 -24
- package/dist/skill-commands-CH4lfyW8.js +0 -77
- package/dist/skill-commands-base-CvVjZByy.js +0 -60
- package/dist/skill-commands-runtime-zpWkVBay.js +0 -2
- package/dist/skill-commands.runtime-BKa5oyH-.js +0 -2
- package/dist/skill-commands.runtime.js +0 -1
- package/dist/skill-scanner-bqroDZTs.js +0 -354
- package/dist/skills-D0K7gu2V.js +0 -972
- package/dist/skills-DFTLIGCd.js +0 -4
- package/dist/skills-clawhub-KJGw0uGT.js +0 -274
- package/dist/skills-cli-DziAPxba.js +0 -369
- package/dist/skills-install-CQeO3Sll.js +0 -819
- package/dist/skills-remote-BojLLDxp.js +0 -584
- package/dist/skills-status-BINZ_svK.js +0 -2
- package/dist/skills-status-CdQUttuP.js +0 -170
- package/dist/slack-BuMSbx3k.js +0 -6
- package/dist/slack-DMg3O5YT.js +0 -9
- package/dist/slack-account-LEbfbXys.js +0 -11
- package/dist/slack-core-oqCiyGw8.js +0 -4
- package/dist/slack-runtime-surface-CyaeT7yk.js +0 -18
- package/dist/slack-surface-1yTIS5Q8.js +0 -44
- package/dist/slack-target-parser-CruIJ5w5.js +0 -12
- package/dist/slack-targets-ukxuKR1I.js +0 -45
- package/dist/slash-commands-CRuXC74L.js +0 -672
- package/dist/slash-commands.runtime-F6b9KUnh.js +0 -20
- package/dist/slash-commands.runtime.js +0 -1
- package/dist/slash-dispatch.runtime-CItGyoBF.js +0 -38
- package/dist/slash-dispatch.runtime.js +0 -1
- package/dist/slash-skill-commands.runtime-Caw0oNvV.js +0 -8
- package/dist/slash-skill-commands.runtime.js +0 -1
- package/dist/slots-Dq-2eIRb.js +0 -93
- package/dist/speech-Ceb4ISD4.js +0 -46
- package/dist/speech-provider-BHjDbut-.js +0 -190
- package/dist/speech-provider-D45m9grJ.js +0 -154
- package/dist/speech-provider-DM1ZXsz2.js +0 -385
- package/dist/speech-runtime-CNvOkPw4.js +0 -34
- package/dist/src-Dn1TYXp6.js +0 -2739
- package/dist/ssh-config-C1ipLHgq.js +0 -77
- package/dist/ssh-tunnel-BwMCLc2e.js +0 -159
- package/dist/ssh-tunnel-D5YdH2SQ.js +0 -2
- package/dist/ssrf-Duye12M_.js +0 -246
- package/dist/ssrf-policy-5L7qS2kK.js +0 -69
- package/dist/ssrf-runtime-bpDM5Bgo.js +0 -5
- package/dist/stable-node-path-n7TARbHZ.js +0 -32
- package/dist/stage-sandbox-media.runtime-Tlgx4F6M.js +0 -229
- package/dist/stage-sandbox-media.runtime.js +0 -1
- package/dist/stagger-Cs-6sySM.js +0 -54
- package/dist/startup-verification-DS8Rlwfj.js +0 -131
- package/dist/state-migrations-ssGF0Trg.js +0 -845
- package/dist/state-paths-LoYjHd5L.js +0 -2
- package/dist/status-B7yRr4OV.js +0 -3
- package/dist/status-BM1Lyqo6.js +0 -261
- package/dist/status-BekOC_tW.js +0 -650
- package/dist/status-CxodlqzZ.js +0 -2
- package/dist/status-DHbl5eIj.js +0 -608
- package/dist/status-PsQV2sfU.js +0 -44
- package/dist/status-all-C53a3881.js +0 -798
- package/dist/status-helpers-CCJSSrVJ.js +0 -170
- package/dist/status-issues-M-RUxHvm.js +0 -336
- package/dist/status-issues-qWKbW6r2.js +0 -187
- package/dist/status-json-B66tF12J.js +0 -86
- package/dist/status.agent-local-B8Sw_p6M.js +0 -59
- package/dist/status.command.text-runtime-csZS5yHm.js +0 -18
- package/dist/status.daemon-D0GzvHft.js +0 -25
- package/dist/status.format-C1VNrTBi.js +0 -44
- package/dist/status.gateway-probe-4INUEsUo.js +0 -15
- package/dist/status.link-channel-CJtR5UX6.js +0 -35
- package/dist/status.node-mode-Bva3wbBI.js +0 -2
- package/dist/status.node-mode-CneoXHPW.js +0 -32
- package/dist/status.scan-t1kfm4e0.js +0 -264
- package/dist/status.scan.deps.runtime-CCaTJlzV.js +0 -18
- package/dist/status.scan.deps.runtime.js +0 -1
- package/dist/status.scan.fast-json-DmzN3HuU.js +0 -97
- package/dist/status.scan.fast-json-gu6uL_BR.js +0 -2
- package/dist/status.scan.json-core-JjMIy9YZ.js +0 -254
- package/dist/status.scan.runtime-r_5mTC8f.js +0 -9
- package/dist/status.scan.runtime.js +0 -1
- package/dist/status.service-summary-DnbDBXMs.js +0 -32
- package/dist/status.summary-CbEhZE0h.js +0 -210
- package/dist/status.summary-SLm6uT22.js +0 -2
- package/dist/status.update-Bw9CvcCc.js +0 -2
- package/dist/status.update-CLnevxJb.js +0 -79
- package/dist/sticker-cache-C_FrWgaA.js +0 -1573
- package/dist/sticker-vision.runtime-DR7e08nD.js +0 -16
- package/dist/sticker-vision.runtime.js +0 -1
- package/dist/storage-CPQLpmgN.js +0 -234
- package/dist/storage-paths-DvC4vQo1.js +0 -51
- package/dist/store-8ONMiMTI.js +0 -365
- package/dist/store-DQJZr0Yf.js +0 -767
- package/dist/store-Dxcm2vsw.js +0 -140
- package/dist/store-_OZh8RrM.js +0 -1343
- package/dist/store-read-JHUhrL0Z.js +0 -16
- package/dist/store.runtime-Dmqv-8M7.js +0 -2
- package/dist/store.runtime.js +0 -1
- package/dist/stream-CGrFe0j0.js +0 -123
- package/dist/stream-D9HOuZmn.js +0 -633
- package/dist/stream-Di_JOWoE.js +0 -180
- package/dist/stream-wrappers-D-DlMIYG.js +0 -136
- package/dist/string-normalization-Ddc4JXRe.js +0 -19
- package/dist/string-normalization-runtime-CCsvs1ds.js +0 -1
- package/dist/string-sample-BIWt11jp.js +0 -11
- package/dist/strip-inbound-meta-DvHTlpJG.js +0 -155
- package/dist/subagent-orphan-recovery-Do8Az2RD.js +0 -206
- package/dist/subagent-registry-runtime-D5PNyCsh.js +0 -2
- package/dist/subcli-descriptors-Dasenv4J.js +0 -151
- package/dist/subsystem-C9VSlEcV.js +0 -582
- package/dist/supervisor-log.runtime-CZe76kAj.js +0 -8
- package/dist/supervisor-log.runtime.js +0 -1
- package/dist/system-cli-2-HDh_Ev.js +0 -58
- package/dist/system-events-5SDw3lix.js +0 -93
- package/dist/system-events-BuGmSpuG.js +0 -34
- package/dist/system-message-0oem5MWV.js +0 -16
- package/dist/system-run-command-BmlO5dn2.js +0 -301
- package/dist/systemd-B2HBHMpF.js +0 -588
- package/dist/systemd-hints-DkRlAuPR.js +0 -325
- package/dist/systemd-linger-BBPBJSm0.js +0 -68
- package/dist/systemd-linger-DiWO9n2E.js +0 -2
- package/dist/table-CY2XIg3l.js +0 -305
- package/dist/tables-D6qL6k4d.js +0 -832
- package/dist/tailnet-CZMxMuGK.js +0 -76
- package/dist/tailscale-mpS_cTve.js +0 -238
- package/dist/tailscale-status-Dg2Iov5f.js +0 -71
- package/dist/target-errors-ThNFqo8X.js +0 -26
- package/dist/target-ids-O3O6piTN.js +0 -76
- package/dist/target-parsing-Boyj_2v0.js +0 -41
- package/dist/target-registry-BHJcVSo1.js +0 -1269
- package/dist/targets-C7I_wjs2.js +0 -283
- package/dist/targets-CZA632lq.js +0 -39
- package/dist/targets-Dz1dx4G8.js +0 -78
- package/dist/targets-Zd0-pJu7.js +0 -748
- package/dist/targets-krmeAAxz.js +0 -70
- package/dist/task-registry-delivery-runtime-BnkUa6Mp.js +0 -2
- package/dist/task-registry.audit-DbCRt5MR.js +0 -320
- package/dist/task-registry.audit.shared-SH4MOLKM.js +0 -18
- package/dist/task-registry.maintenance-DfZmDWog.js +0 -2
- package/dist/task-registry.summary-SoFiECCc.js +0 -44
- package/dist/tavily-search-provider-BCY1kfQB.js +0 -227
- package/dist/telegram/audit.js +0 -2
- package/dist/telegram/token.js +0 -2
- package/dist/telegram-Cq20PSxw.js +0 -23
- package/dist/telegram-account-vRRwyfuA.js +0 -11
- package/dist/telegram-command-config-BiHhXScJ.js +0 -1
- package/dist/telegram-core-DTJayyAj.js +0 -6
- package/dist/telegram-custom-commands-C-nv8yoB.js +0 -75
- package/dist/temp-download-Ccatr7zI.js +0 -62
- package/dist/temp-path-JU2kkd64.js +0 -2
- package/dist/templating-Bu436Euy.js +0 -24
- package/dist/testing-BrrgubIp.js +0 -690
- package/dist/text-chunking-BTs2yTSd.js +0 -12
- package/dist/text-chunking-ByXwyFNP.js +0 -20
- package/dist/text-format-lEYRGxj5.js +0 -8
- package/dist/text-runtime-D9ApM_8O.js +0 -398
- package/dist/theme-Bb-qluq6.js +0 -2
- package/dist/theme-wBMZmJzz.js +0 -34
- package/dist/thinking-Dga2zdtd.js +0 -68
- package/dist/thinking.shared-D6IkoLJU.js +0 -243
- package/dist/thread-bindings-BMnz7w-V.js +0 -219
- package/dist/thread-bindings-BbQWOcMr.js +0 -352
- package/dist/thread-bindings-Bv0I9sBY.js +0 -534
- package/dist/thread-bindings-C3jMrVvp.js +0 -778
- package/dist/thread-bindings-policy-Br8s4hQ6.js +0 -172
- package/dist/thread-bindings-runtime-CbG63N4N.js +0 -2
- package/dist/thread-bindings-shared-DjSYaoHi.js +0 -95
- package/dist/thread-bindings.discord-api-NFR5qsWt.js +0 -487
- package/dist/thread-ownership-DG810AQi.js +0 -3
- package/dist/threading-1Z_3y_Dp.js +0 -2
- package/dist/threading-Hl8nWez6.js +0 -832
- package/dist/threading-helpers-BpqyeyAU.js +0 -14
- package/dist/threading-tool-context-DxV30qIW.js +0 -157
- package/dist/timeouts-B1NiHSGi.js +0 -74
- package/dist/tlon-C54Qojl0.js +0 -20
- package/dist/tmp-openclaw-dir-B44_vmJv.js +0 -102
- package/dist/token-BlUJQi_X.js +0 -2
- package/dist/token-CDYFJvj8.js +0 -82
- package/dist/token-kCjtGElJ.js +0 -45
- package/dist/tokens-C2f9Klbt.js +0 -66
- package/dist/tool-actions.runtime-aB0DgLk7.js +0 -532
- package/dist/tool-actions.runtime.js +0 -1
- package/dist/tool-display-C7h9IZa_.js +0 -1607
- package/dist/tool-images-BDUvc_pd.js +0 -270
- package/dist/tool-mutation-DIBpIegg.js +0 -140
- package/dist/tool-policy-FUm_F19C.js +0 -515
- package/dist/tool-policy-match-CCFHTsu9.js +0 -49
- package/dist/tool-send-DClM4vsZ.js +0 -16
- package/dist/tools-54j1hYBv.js +0 -123
- package/dist/tools-effective-inventory-C09suj6-.js +0 -148
- package/dist/tools.runtime-VBFxIXC8.js +0 -4
- package/dist/tools.runtime.js +0 -1
- package/dist/transcript-events-Dc7U5QmQ.js +0 -29
- package/dist/transport-ready-Cje3USX4.js +0 -36
- package/dist/tts-CTM9C09A.js +0 -2
- package/dist/tts-Ck_K3tIi.js +0 -84
- package/dist/tts-auto-mode-bD-u2biE.js +0 -14
- package/dist/tts-bTuorllO.js +0 -102
- package/dist/tts-eOLiJF6d.js +0 -29
- package/dist/tts.runtime-ChTwy0yH.js +0 -3
- package/dist/tts.runtime.js +0 -1
- package/dist/tui-CrM-Bz3i.js +0 -3899
- package/dist/tui-cli-aVL5aPGw.js +0 -31
- package/dist/twitch-CFFlkhYG.js +0 -15
- package/dist/typebox-DmerPHaM.js +0 -22
- package/dist/types-BzNSmNk3.js +0 -12
- package/dist/types-DAzqpvqD.js +0 -83
- package/dist/types-DVJVELY7.js +0 -471
- package/dist/types-DqNppUoh.js +0 -15
- package/dist/types.secrets-BpcqHPAv.js +0 -80
- package/dist/types.tools-BTQL6INB.js +0 -22
- package/dist/typing-BnCchGtL.js +0 -8
- package/dist/typing-Bugg5LPP.js +0 -68
- package/dist/typing-J_ktpWeA.js +0 -2
- package/dist/typing-mode-DDYL_0TG.js +0 -75
- package/dist/typing-policy-CaZhrM-F.js +0 -11
- package/dist/typing-start-guard-Cgjgzy5e.js +0 -73
- package/dist/ui-BLDY9-7R.js +0 -212
- package/dist/undici-global-dispatcher-CcNdQ7Dt.js +0 -99
- package/dist/unhandled-rejections-CA_e1R-O.js +0 -2
- package/dist/unhandled-rejections-V7U9keRG.js +0 -241
- package/dist/update-CcALvtl_.js +0 -1253
- package/dist/update-channels-Dn1F57Kf.js +0 -78
- package/dist/update-check-CoDVxy35.js +0 -354
- package/dist/update-cli-BWOYy_Mp.js +0 -1447
- package/dist/update-offset-store-BLZmshZE.js +0 -75
- package/dist/usage-CC7-wLUi.js +0 -39
- package/dist/usage-format-C7nMV1jc.js +0 -513
- package/dist/utils-CN_F_3Qg.js +0 -243
- package/dist/utils-Cgw9Y0-Q.js +0 -2
- package/dist/validation-BNNAUmDO.js +0 -18521
- package/dist/verification-B4ogZ29M.js +0 -130
- package/dist/verification-B99uVIxo.js +0 -2
- package/dist/version-BNzJ37Re.js +0 -79
- package/dist/version-Dw0eJ-1F.js +0 -2
- package/dist/voice-call-Dt6m6oA3.js +0 -4
- package/dist/wait-YXJvtMmp.js +0 -7
- package/dist/warning-filter-GX8LpGKz.js +0 -57
- package/dist/web-fetch-utils-CoVia2ez.js +0 -413
- package/dist/web-media-D9opLz21.js +0 -2
- package/dist/web-media-DHlguFej.js +0 -339
- package/dist/web-search-BcSDWJK9.js +0 -169
- package/dist/web-search-providers-CqY6CVp3.js +0 -21
- package/dist/web-search-providers.runtime-BHjzPQW-.js +0 -113
- package/dist/web-search-providers.runtime.js +0 -1
- package/dist/web-search-providers.shared-CMeQec8y.js +0 -421
- package/dist/web-search-shared-B5mHm7QD.js +0 -87
- package/dist/webhook-ingress-CTl81NUR.js +0 -164
- package/dist/webhook-memory-guards-B6k3g-po.js +0 -129
- package/dist/webhook-path-CklCw5kp.js +0 -22
- package/dist/webhook-request-guards-CxDPmU9e.js +0 -178
- package/dist/webhook-shared-Bw9wLe6L.js +0 -370
- package/dist/webhooks-cli-DPRITERU.js +0 -326
- package/dist/whatsapp-CSzf1Nu0.js +0 -5
- package/dist/whatsapp-D18Otn45.js +0 -30
- package/dist/whatsapp-auth-presence-B5GZUgTA.js +0 -41
- package/dist/whatsapp-core-Be0P_p4R.js +0 -7
- package/dist/whatsapp-heartbeat-a2-OB01n.js +0 -85
- package/dist/whatsapp-shared-ChjLiMDw.js +0 -56
- package/dist/whatsapp-shared-FR_Jw-NH.js +0 -4
- package/dist/whatsapp-surface-Dwrfi_SD.js +0 -26
- package/dist/whatsapp-targets-59A3BDBi.js +0 -13
- package/dist/widearea-dns-CfQt6b3q.js +0 -125
- package/dist/windows-argv-DDAf3waz.js +0 -345
- package/dist/windows-install-roots-XI3CvO9O.js +0 -149
- package/dist/windows-spawn-DKvkg_66.js +0 -154
- package/dist/with-timeout-B2smrGj0.js +0 -214
- package/dist/with-timeout-BmJKiOMd.js +0 -13
- package/dist/workflow-summary-BMvffn8D.js +0 -2
- package/dist/workflow-summary-NvN5lUvK.js +0 -167
- package/dist/workspace-D5P9nuJd.js +0 -479
- package/dist/workspace-D5UiPYKk.js +0 -306
- package/dist/workspace-dirs-CRv8Jwfz.js +0 -13
- package/dist/ws-97FEIc7w.js +0 -11
- package/dist/ws-log-BaAOgG9m.js +0 -281
- package/dist/ws-logging-M92fgmyp.js +0 -10
- package/dist/wsl-ytdRZp54.js +0 -57
- package/dist/x-search-FsMNZ7d0.js +0 -166
- package/dist/x-search-shared-D0tVMJk9.js +0 -124
- package/dist/zalo-CNoa7XH7.js +0 -13
- package/dist/zalo-js-HktBGDbg.js +0 -1156
- package/dist/zalo-setup-BT-xGElf.js +0 -14
- package/dist/zalouser-TwyfhIYz.js +0 -22
- package/dist/zod-1Wegy5nx.js +0 -7
- package/dist/zod-parse-HlGwTZP3.js +0 -14
- package/dist/zod-schema.agent-runtime-DFC7a3eV.js +0 -602
- package/dist/zod-schema.core-C1Ewlj9j.js +0 -520
- package/dist/zod-schema.providers-core-Bmbs-R4l.js +0 -1541
- package/dist/zod-schema.providers-whatsapp-CanJPkvb.js +0 -132
- package/dist/zod-schema.sensitive-DEzKzMxI.js +0 -5
package/dist/monitor-RMoB6sGQ.js
DELETED
|
@@ -1,4067 +0,0 @@
|
|
|
1
|
-
import { c as normalizeAgentId, u as resolveAgentIdFromSessionKey } from "./session-key-Do__tq1E.js";
|
|
2
|
-
import { t as safeEqualSecret } from "./secret-equal-fMR1DjSl.js";
|
|
3
|
-
import { t as createDedupeCache } from "./dedupe-DZbQYOSD.js";
|
|
4
|
-
import { t as readJsonFileWithFallback } from "./json-store-FUgu1pyj.js";
|
|
5
|
-
import { r as getSessionBindingService } from "./session-binding-service-D7bUc7mS.js";
|
|
6
|
-
import { a as warnMissingProviderGroupPolicyFallbackOnce, i as resolveOpenProviderRuntimeGroupPolicy, r as resolveDefaultGroupPolicy } from "./runtime-group-policy-zTp8fKRK.js";
|
|
7
|
-
import { n as fetchWithSsrFGuard } from "./fetch-guard-BnhVFBtf.js";
|
|
8
|
-
import { h as sendMediaWithLeadingCaption, m as resolveTextChunksWithFallback, p as resolveSendableOutboundReplyParts } from "./reply-payload-CRYI4jIB.js";
|
|
9
|
-
import { n as deriveLastRoutePolicy } from "./resolve-route-EE8E7OAF.js";
|
|
10
|
-
import "./routing-BVt9nMN-.js";
|
|
11
|
-
import { a as buildPendingHistoryContextFromMap, s as clearHistoryEntriesIfEnabled, u as recordPendingHistoryEntryIfEnabled } from "./history-B4mW8GfY.js";
|
|
12
|
-
import { t as resolveChannelContextVisibilityMode } from "./context-visibility-DTMZdcAH.js";
|
|
13
|
-
import { t as createReplyPrefixContext } from "./reply-prefix-Eema_xXG.js";
|
|
14
|
-
import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-BtBcBCNu.js";
|
|
15
|
-
import { n as resolveAgentOutboundIdentity } from "./identity-D64Wfv_s.js";
|
|
16
|
-
import { a as isRequestBodyLimitError, c as requestBodyErrorToText, i as installRequestBodyLimitGuard, s as readRequestBodyWithLimit } from "./http-body-CfdQSEp0.js";
|
|
17
|
-
import { t as buildAgentMediaPayload } from "./agent-media-payload-DDTSvr-n.js";
|
|
18
|
-
import { i as resolveConfiguredBindingRoute, r as ensureConfiguredBindingRouteReady } from "./conversation-runtime-bArk0IjJ.js";
|
|
19
|
-
import { n as filterSupplementalContextItems, t as evaluateSupplementalContextVisibility } from "./context-visibility-vOvLMUrZ.js";
|
|
20
|
-
import { r as logTypingFailure } from "./logging-ColPHIDT.js";
|
|
21
|
-
import { n as createChannelPairingController } from "./channel-pairing-Byr3MFbN.js";
|
|
22
|
-
import { a as createFixedWindowRateLimiter, o as createWebhookAnomalyTracker, r as WEBHOOK_RATE_LIMIT_DEFAULTS, t as WEBHOOK_ANOMALY_COUNTER_DEFAULTS } from "./webhook-memory-guards-B6k3g-po.js";
|
|
23
|
-
import { r as applyBasicWebhookRequestGuards } from "./webhook-request-guards-CxDPmU9e.js";
|
|
24
|
-
import "./browser-support-Cdp2Gr_6.js";
|
|
25
|
-
import { t as createPersistentDedupe } from "./persistent-dedupe-DoNHVMWs.js";
|
|
26
|
-
import { a as createFeishuClient, c as listEnabledFeishuAccounts, d as resolveFeishuAccount, f as resolveFeishuRuntimeAccount, i as createEventDispatcher, n as raceWithTimeoutAndAbort, o as createFeishuWSClient, r as waitForAbortableDelay, t as probeFeishu } from "./probe-BO4hbHvs.js";
|
|
27
|
-
import { D as deliverCommentThreadText, E as isMentionForwardRequest, I as getFeishuRuntime, N as buildFeishuCommentTarget, P as normalizeCommentFileType, _ as normalizeFeishuExternalKey, b as extractMentionTargets, c as getMessageFeishu, d as sendCardFeishu, g as parsePostContent, i as sendMediaFeishu, l as listFeishuThreadMessages, m as sendStructuredCardFeishu, p as sendMessageFeishu, t as downloadMessageResourceFeishu, u as resolveFeishuCardTemplate, v as buildMentionedCardContent } from "./media-CUdiVhEt.js";
|
|
28
|
-
import "./runtime-api-CuqnElJG.js";
|
|
29
|
-
import { r as resolveReceiveIdType } from "./targets-CZA632lq.js";
|
|
30
|
-
import { a as resolveFeishuReplyPolicy, c as createFeishuCardInteractionEnvelope, l as decodeFeishuCardAction, n as resolveFeishuAllowlistMatch, r as resolveFeishuGroupConfig, s as buildFeishuCardActionTextFallback, t as isFeishuGroupAllowed } from "./policy-D6OQdw73.js";
|
|
31
|
-
import { t as buildFeishuConversationId } from "./conversation-id-CXuzm-Ub.js";
|
|
32
|
-
import { n as createFeishuThreadBindingManager } from "./thread-bindings-BMnz7w-V.js";
|
|
33
|
-
import fsSync from "node:fs";
|
|
34
|
-
import path from "node:path";
|
|
35
|
-
import os from "node:os";
|
|
36
|
-
import crypto from "node:crypto";
|
|
37
|
-
import * as http from "http";
|
|
38
|
-
import * as Lark from "@larksuiteoapi/node-sdk";
|
|
39
|
-
import * as crypto$1 from "crypto";
|
|
40
|
-
//#region extensions/feishu/src/bot-content.ts
|
|
41
|
-
function resolveFeishuGroupSession(params) {
|
|
42
|
-
const { chatId, senderOpenId, messageId, rootId, threadId, groupConfig, feishuCfg } = params;
|
|
43
|
-
const normalizedThreadId = threadId?.trim();
|
|
44
|
-
const normalizedRootId = rootId?.trim();
|
|
45
|
-
const threadReply = Boolean(normalizedThreadId || normalizedRootId);
|
|
46
|
-
const replyInThread = (groupConfig?.replyInThread ?? feishuCfg?.replyInThread ?? "disabled") === "enabled" || threadReply;
|
|
47
|
-
const legacyTopicSessionMode = groupConfig?.topicSessionMode ?? feishuCfg?.topicSessionMode ?? "disabled";
|
|
48
|
-
const groupSessionScope = groupConfig?.groupSessionScope ?? feishuCfg?.groupSessionScope ?? (legacyTopicSessionMode === "enabled" ? "group_topic" : "group");
|
|
49
|
-
const topicScope = groupSessionScope === "group_topic" || groupSessionScope === "group_topic_sender" ? normalizedRootId ?? normalizedThreadId ?? (replyInThread ? messageId : null) : null;
|
|
50
|
-
let peerId = chatId;
|
|
51
|
-
switch (groupSessionScope) {
|
|
52
|
-
case "group_sender":
|
|
53
|
-
peerId = buildFeishuConversationId({
|
|
54
|
-
chatId,
|
|
55
|
-
scope: "group_sender",
|
|
56
|
-
senderOpenId
|
|
57
|
-
});
|
|
58
|
-
break;
|
|
59
|
-
case "group_topic":
|
|
60
|
-
peerId = topicScope ? buildFeishuConversationId({
|
|
61
|
-
chatId,
|
|
62
|
-
scope: "group_topic",
|
|
63
|
-
topicId: topicScope
|
|
64
|
-
}) : chatId;
|
|
65
|
-
break;
|
|
66
|
-
case "group_topic_sender":
|
|
67
|
-
peerId = topicScope ? buildFeishuConversationId({
|
|
68
|
-
chatId,
|
|
69
|
-
scope: "group_topic_sender",
|
|
70
|
-
topicId: topicScope,
|
|
71
|
-
senderOpenId
|
|
72
|
-
}) : buildFeishuConversationId({
|
|
73
|
-
chatId,
|
|
74
|
-
scope: "group_sender",
|
|
75
|
-
senderOpenId
|
|
76
|
-
});
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
peerId = chatId;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
peerId,
|
|
84
|
-
parentPeer: topicScope && (groupSessionScope === "group_topic" || groupSessionScope === "group_topic_sender") ? {
|
|
85
|
-
kind: "group",
|
|
86
|
-
id: chatId
|
|
87
|
-
} : null,
|
|
88
|
-
groupSessionScope,
|
|
89
|
-
replyInThread,
|
|
90
|
-
threadReply
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function parseMessageContent(content, messageType) {
|
|
94
|
-
if (messageType === "post") return parsePostContent(content).textContent;
|
|
95
|
-
try {
|
|
96
|
-
const parsed = JSON.parse(content);
|
|
97
|
-
if (messageType === "text") return parsed.text || "";
|
|
98
|
-
if (messageType === "share_chat") {
|
|
99
|
-
if (parsed && typeof parsed === "object") {
|
|
100
|
-
const share = parsed;
|
|
101
|
-
if (typeof share.body === "string" && share.body.trim()) return share.body.trim();
|
|
102
|
-
if (typeof share.summary === "string" && share.summary.trim()) return share.summary.trim();
|
|
103
|
-
if (typeof share.share_chat_id === "string" && share.share_chat_id.trim()) return `[Forwarded message: ${share.share_chat_id.trim()}]`;
|
|
104
|
-
}
|
|
105
|
-
return "[Forwarded message]";
|
|
106
|
-
}
|
|
107
|
-
if (messageType === "merge_forward") return "[Merged and Forwarded Message - loading...]";
|
|
108
|
-
return content;
|
|
109
|
-
} catch {
|
|
110
|
-
return content;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function formatSubMessageContent(content, contentType) {
|
|
114
|
-
try {
|
|
115
|
-
const parsed = JSON.parse(content);
|
|
116
|
-
switch (contentType) {
|
|
117
|
-
case "text": return parsed.text || content;
|
|
118
|
-
case "post": return parsePostContent(content).textContent;
|
|
119
|
-
case "image": return "[Image]";
|
|
120
|
-
case "file": return `[File: ${parsed.file_name || "unknown"}]`;
|
|
121
|
-
case "audio": return "[Audio]";
|
|
122
|
-
case "video": return "[Video]";
|
|
123
|
-
case "sticker": return "[Sticker]";
|
|
124
|
-
case "merge_forward": return "[Nested Merged Forward]";
|
|
125
|
-
default: return `[${contentType}]`;
|
|
126
|
-
}
|
|
127
|
-
} catch {
|
|
128
|
-
return content;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function parseMergeForwardContent(params) {
|
|
132
|
-
const { content, log } = params;
|
|
133
|
-
const maxMessages = 50;
|
|
134
|
-
log?.("feishu: parsing merge_forward sub-messages from API response");
|
|
135
|
-
let items;
|
|
136
|
-
try {
|
|
137
|
-
items = JSON.parse(content);
|
|
138
|
-
} catch {
|
|
139
|
-
log?.("feishu: merge_forward items parse failed");
|
|
140
|
-
return "[Merged and Forwarded Message - parse error]";
|
|
141
|
-
}
|
|
142
|
-
if (!Array.isArray(items) || items.length === 0) return "[Merged and Forwarded Message - no sub-messages]";
|
|
143
|
-
const subMessages = items.filter((item) => item.upper_message_id);
|
|
144
|
-
if (subMessages.length === 0) return "[Merged and Forwarded Message - no sub-messages found]";
|
|
145
|
-
log?.(`feishu: merge_forward contains ${subMessages.length} sub-messages`);
|
|
146
|
-
subMessages.sort((a, b) => parseInt(a.create_time || "0", 10) - parseInt(b.create_time || "0", 10));
|
|
147
|
-
const lines = ["[Merged and Forwarded Messages]"];
|
|
148
|
-
for (const item of subMessages.slice(0, maxMessages)) lines.push(`- ${formatSubMessageContent(item.body?.content || "", item.msg_type || "text")}`);
|
|
149
|
-
if (subMessages.length > maxMessages) lines.push(`... and ${subMessages.length - maxMessages} more messages`);
|
|
150
|
-
return lines.join("\n");
|
|
151
|
-
}
|
|
152
|
-
function checkBotMentioned(event, botOpenId) {
|
|
153
|
-
if (!botOpenId) return false;
|
|
154
|
-
if ((event.message.content ?? "").includes("@_all")) return true;
|
|
155
|
-
const mentions = event.message.mentions ?? [];
|
|
156
|
-
if (mentions.length > 0) return mentions.some((mention) => mention.id.open_id === botOpenId);
|
|
157
|
-
if (event.message.message_type === "post") return parsePostContent(event.message.content).mentionedOpenIds.some((id) => id === botOpenId);
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
function normalizeMentions(text, mentions, botStripId) {
|
|
161
|
-
if (!mentions || mentions.length === 0) return text;
|
|
162
|
-
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
163
|
-
const escapeName = (value) => value.replace(/</g, "<").replace(/>/g, ">");
|
|
164
|
-
let result = text;
|
|
165
|
-
for (const mention of mentions) {
|
|
166
|
-
const mentionId = mention.id.open_id;
|
|
167
|
-
const replacement = botStripId && mentionId === botStripId ? "" : mentionId ? `<at user_id="${mentionId}">${escapeName(mention.name)}</at>` : `@${mention.name}`;
|
|
168
|
-
result = result.replace(new RegExp(escaped(mention.key), "g"), () => replacement).trim();
|
|
169
|
-
}
|
|
170
|
-
return result;
|
|
171
|
-
}
|
|
172
|
-
function normalizeFeishuCommandProbeBody(text) {
|
|
173
|
-
if (!text) return "";
|
|
174
|
-
return text.replace(/<at\b[^>]*>[^<]*<\/at>/giu, " ").replace(/(^|\s)@[^/\s]+(?=\s|$|\/)/gu, "$1").replace(/\s+/g, " ").trim();
|
|
175
|
-
}
|
|
176
|
-
function parseMediaKeys(content, messageType) {
|
|
177
|
-
try {
|
|
178
|
-
const parsed = JSON.parse(content);
|
|
179
|
-
const imageKey = normalizeFeishuExternalKey(parsed.image_key);
|
|
180
|
-
const fileKey = normalizeFeishuExternalKey(parsed.file_key);
|
|
181
|
-
switch (messageType) {
|
|
182
|
-
case "image": return {
|
|
183
|
-
imageKey,
|
|
184
|
-
fileName: parsed.file_name
|
|
185
|
-
};
|
|
186
|
-
case "file":
|
|
187
|
-
case "audio":
|
|
188
|
-
case "sticker": return {
|
|
189
|
-
fileKey,
|
|
190
|
-
fileName: parsed.file_name
|
|
191
|
-
};
|
|
192
|
-
case "video":
|
|
193
|
-
case "media": return {
|
|
194
|
-
fileKey,
|
|
195
|
-
imageKey,
|
|
196
|
-
fileName: parsed.file_name
|
|
197
|
-
};
|
|
198
|
-
default: return {};
|
|
199
|
-
}
|
|
200
|
-
} catch {
|
|
201
|
-
return {};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function toMessageResourceType(messageType) {
|
|
205
|
-
return messageType === "image" ? "image" : "file";
|
|
206
|
-
}
|
|
207
|
-
function inferPlaceholder(messageType) {
|
|
208
|
-
switch (messageType) {
|
|
209
|
-
case "image": return "<media:image>";
|
|
210
|
-
case "file": return "<media:document>";
|
|
211
|
-
case "audio": return "<media:audio>";
|
|
212
|
-
case "video":
|
|
213
|
-
case "media": return "<media:video>";
|
|
214
|
-
case "sticker": return "<media:sticker>";
|
|
215
|
-
default: return "<media:document>";
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
async function resolveFeishuMediaList(params) {
|
|
219
|
-
const { cfg, messageId, messageType, content, maxBytes, log, accountId } = params;
|
|
220
|
-
if (![
|
|
221
|
-
"image",
|
|
222
|
-
"file",
|
|
223
|
-
"audio",
|
|
224
|
-
"video",
|
|
225
|
-
"media",
|
|
226
|
-
"sticker",
|
|
227
|
-
"post"
|
|
228
|
-
].includes(messageType)) return [];
|
|
229
|
-
const out = [];
|
|
230
|
-
const core = getFeishuRuntime();
|
|
231
|
-
if (messageType === "post") {
|
|
232
|
-
const { imageKeys, mediaKeys } = parsePostContent(content);
|
|
233
|
-
if (imageKeys.length === 0 && mediaKeys.length === 0) return [];
|
|
234
|
-
if (imageKeys.length > 0) log?.(`feishu: post message contains ${imageKeys.length} embedded image(s)`);
|
|
235
|
-
if (mediaKeys.length > 0) log?.(`feishu: post message contains ${mediaKeys.length} embedded media file(s)`);
|
|
236
|
-
for (const imageKey of imageKeys) try {
|
|
237
|
-
const result = await downloadMessageResourceFeishu({
|
|
238
|
-
cfg,
|
|
239
|
-
messageId,
|
|
240
|
-
fileKey: imageKey,
|
|
241
|
-
type: "image",
|
|
242
|
-
accountId
|
|
243
|
-
});
|
|
244
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
245
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
246
|
-
out.push({
|
|
247
|
-
path: saved.path,
|
|
248
|
-
contentType: saved.contentType,
|
|
249
|
-
placeholder: "<media:image>"
|
|
250
|
-
});
|
|
251
|
-
log?.(`feishu: downloaded embedded image ${imageKey}, saved to ${saved.path}`);
|
|
252
|
-
} catch (err) {
|
|
253
|
-
log?.(`feishu: failed to download embedded image ${imageKey}: ${String(err)}`);
|
|
254
|
-
}
|
|
255
|
-
for (const media of mediaKeys) try {
|
|
256
|
-
const result = await downloadMessageResourceFeishu({
|
|
257
|
-
cfg,
|
|
258
|
-
messageId,
|
|
259
|
-
fileKey: media.fileKey,
|
|
260
|
-
type: "file",
|
|
261
|
-
accountId
|
|
262
|
-
});
|
|
263
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
264
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
265
|
-
out.push({
|
|
266
|
-
path: saved.path,
|
|
267
|
-
contentType: saved.contentType,
|
|
268
|
-
placeholder: "<media:video>"
|
|
269
|
-
});
|
|
270
|
-
log?.(`feishu: downloaded embedded media ${media.fileKey}, saved to ${saved.path}`);
|
|
271
|
-
} catch (err) {
|
|
272
|
-
log?.(`feishu: failed to download embedded media ${media.fileKey}: ${String(err)}`);
|
|
273
|
-
}
|
|
274
|
-
return out;
|
|
275
|
-
}
|
|
276
|
-
const mediaKeys = parseMediaKeys(content, messageType);
|
|
277
|
-
if (!mediaKeys.imageKey && !mediaKeys.fileKey) return [];
|
|
278
|
-
try {
|
|
279
|
-
const fileKey = mediaKeys.fileKey || mediaKeys.imageKey;
|
|
280
|
-
if (!fileKey) return [];
|
|
281
|
-
const result = await downloadMessageResourceFeishu({
|
|
282
|
-
cfg,
|
|
283
|
-
messageId,
|
|
284
|
-
fileKey,
|
|
285
|
-
type: toMessageResourceType(messageType),
|
|
286
|
-
accountId
|
|
287
|
-
});
|
|
288
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
289
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes, result.fileName || mediaKeys.fileName);
|
|
290
|
-
out.push({
|
|
291
|
-
path: saved.path,
|
|
292
|
-
contentType: saved.contentType,
|
|
293
|
-
placeholder: inferPlaceholder(messageType)
|
|
294
|
-
});
|
|
295
|
-
log?.(`feishu: downloaded ${messageType} media, saved to ${saved.path}`);
|
|
296
|
-
} catch (err) {
|
|
297
|
-
log?.(`feishu: failed to download ${messageType} media: ${String(err)}`);
|
|
298
|
-
}
|
|
299
|
-
return out;
|
|
300
|
-
}
|
|
301
|
-
//#endregion
|
|
302
|
-
//#region extensions/feishu/src/bot-sender-name.ts
|
|
303
|
-
const IGNORED_PERMISSION_SCOPE_TOKENS = ["contact:contact.base:readonly"];
|
|
304
|
-
const FEISHU_SCOPE_CORRECTIONS = { "contact:contact.base:readonly": "contact:user.base:readonly" };
|
|
305
|
-
const SENDER_NAME_TTL_MS = 600 * 1e3;
|
|
306
|
-
const senderNameCache = /* @__PURE__ */ new Map();
|
|
307
|
-
function correctFeishuScopeInUrl(url) {
|
|
308
|
-
let corrected = url;
|
|
309
|
-
for (const [wrong, right] of Object.entries(FEISHU_SCOPE_CORRECTIONS)) {
|
|
310
|
-
corrected = corrected.replaceAll(encodeURIComponent(wrong), encodeURIComponent(right));
|
|
311
|
-
corrected = corrected.replaceAll(wrong, right);
|
|
312
|
-
}
|
|
313
|
-
return corrected;
|
|
314
|
-
}
|
|
315
|
-
function shouldSuppressPermissionErrorNotice(permissionError) {
|
|
316
|
-
const message = permissionError.message.toLowerCase();
|
|
317
|
-
return IGNORED_PERMISSION_SCOPE_TOKENS.some((token) => message.includes(token));
|
|
318
|
-
}
|
|
319
|
-
function extractPermissionError(err) {
|
|
320
|
-
if (!err || typeof err !== "object") return null;
|
|
321
|
-
const data = err.response?.data;
|
|
322
|
-
if (!data || typeof data !== "object") return null;
|
|
323
|
-
const feishuErr = data;
|
|
324
|
-
if (feishuErr.code !== 99991672) return null;
|
|
325
|
-
const msg = feishuErr.msg ?? "";
|
|
326
|
-
const urlMatch = msg.match(/https:\/\/[^\s,]+\/app\/[^\s,]+/);
|
|
327
|
-
return {
|
|
328
|
-
code: feishuErr.code,
|
|
329
|
-
message: msg,
|
|
330
|
-
grantUrl: urlMatch?.[0] ? correctFeishuScopeInUrl(urlMatch[0]) : void 0
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
function resolveSenderLookupIdType(senderId) {
|
|
334
|
-
const trimmed = senderId.trim();
|
|
335
|
-
if (trimmed.startsWith("ou_")) return "open_id";
|
|
336
|
-
if (trimmed.startsWith("on_")) return "union_id";
|
|
337
|
-
return "user_id";
|
|
338
|
-
}
|
|
339
|
-
async function resolveFeishuSenderName(params) {
|
|
340
|
-
const { account, senderId, log } = params;
|
|
341
|
-
if (!account.configured) return {};
|
|
342
|
-
const normalizedSenderId = senderId.trim();
|
|
343
|
-
if (!normalizedSenderId) return {};
|
|
344
|
-
const cached = senderNameCache.get(normalizedSenderId);
|
|
345
|
-
const now = Date.now();
|
|
346
|
-
if (cached && cached.expireAt > now) return { name: cached.name };
|
|
347
|
-
try {
|
|
348
|
-
const client = createFeishuClient(account);
|
|
349
|
-
const userIdType = resolveSenderLookupIdType(normalizedSenderId);
|
|
350
|
-
const user = (await client.contact.user.get({
|
|
351
|
-
path: { user_id: normalizedSenderId },
|
|
352
|
-
params: { user_id_type: userIdType }
|
|
353
|
-
})).data?.user;
|
|
354
|
-
const name = user?.name ?? user?.nickname ?? user?.en_name;
|
|
355
|
-
if (name) {
|
|
356
|
-
senderNameCache.set(normalizedSenderId, {
|
|
357
|
-
name,
|
|
358
|
-
expireAt: now + SENDER_NAME_TTL_MS
|
|
359
|
-
});
|
|
360
|
-
return { name };
|
|
361
|
-
}
|
|
362
|
-
return {};
|
|
363
|
-
} catch (err) {
|
|
364
|
-
const permErr = extractPermissionError(err);
|
|
365
|
-
if (permErr) {
|
|
366
|
-
if (shouldSuppressPermissionErrorNotice(permErr)) {
|
|
367
|
-
log(`feishu: ignoring stale permission scope error: ${permErr.message}`);
|
|
368
|
-
return {};
|
|
369
|
-
}
|
|
370
|
-
log(`feishu: permission error resolving sender name: code=${permErr.code}`);
|
|
371
|
-
return { permissionError: permErr };
|
|
372
|
-
}
|
|
373
|
-
log(`feishu: failed to resolve sender name for ${normalizedSenderId}: ${String(err)}`);
|
|
374
|
-
return {};
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region extensions/feishu/src/dedup.ts
|
|
379
|
-
const DEDUP_TTL_MS = 1440 * 60 * 1e3;
|
|
380
|
-
const MEMORY_MAX_SIZE = 1e3;
|
|
381
|
-
const FILE_MAX_ENTRIES = 1e4;
|
|
382
|
-
const EVENT_DEDUP_TTL_MS = 300 * 1e3;
|
|
383
|
-
const EVENT_MEMORY_MAX_SIZE = 2e3;
|
|
384
|
-
const memoryDedupe = createDedupeCache({
|
|
385
|
-
ttlMs: DEDUP_TTL_MS,
|
|
386
|
-
maxSize: MEMORY_MAX_SIZE
|
|
387
|
-
});
|
|
388
|
-
const processingClaims = createDedupeCache({
|
|
389
|
-
ttlMs: EVENT_DEDUP_TTL_MS,
|
|
390
|
-
maxSize: EVENT_MEMORY_MAX_SIZE
|
|
391
|
-
});
|
|
392
|
-
function resolveStateDirFromEnv(env = process.env) {
|
|
393
|
-
const stateOverride = env.OPENCLAW_STATE_DIR?.trim();
|
|
394
|
-
if (stateOverride) return stateOverride;
|
|
395
|
-
if (env.VITEST || env.NODE_ENV === "test") return path.join(os.tmpdir(), ["openclaw-vitest", String(process.pid)].join("-"));
|
|
396
|
-
return path.join(os.homedir(), ".openclaw");
|
|
397
|
-
}
|
|
398
|
-
function resolveNamespaceFilePath(namespace) {
|
|
399
|
-
const safe = namespace.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
400
|
-
return path.join(resolveStateDirFromEnv(), "feishu", "dedup", `${safe}.json`);
|
|
401
|
-
}
|
|
402
|
-
const persistentDedupe = createPersistentDedupe({
|
|
403
|
-
ttlMs: DEDUP_TTL_MS,
|
|
404
|
-
memoryMaxSize: MEMORY_MAX_SIZE,
|
|
405
|
-
fileMaxEntries: FILE_MAX_ENTRIES,
|
|
406
|
-
resolveFilePath: resolveNamespaceFilePath
|
|
407
|
-
});
|
|
408
|
-
function resolveEventDedupeKey(namespace, messageId) {
|
|
409
|
-
const trimmed = messageId?.trim();
|
|
410
|
-
if (!trimmed) return null;
|
|
411
|
-
return `${namespace}:${trimmed}`;
|
|
412
|
-
}
|
|
413
|
-
function normalizeMessageId(messageId) {
|
|
414
|
-
const trimmed = messageId?.trim();
|
|
415
|
-
return trimmed ? trimmed : null;
|
|
416
|
-
}
|
|
417
|
-
function resolveMemoryDedupeKey(namespace, messageId) {
|
|
418
|
-
const trimmed = normalizeMessageId(messageId);
|
|
419
|
-
if (!trimmed) return null;
|
|
420
|
-
return `${namespace}:${trimmed}`;
|
|
421
|
-
}
|
|
422
|
-
function tryBeginFeishuMessageProcessing(messageId, namespace = "global") {
|
|
423
|
-
return !processingClaims.check(resolveEventDedupeKey(namespace, messageId));
|
|
424
|
-
}
|
|
425
|
-
function releaseFeishuMessageProcessing(messageId, namespace = "global") {
|
|
426
|
-
processingClaims.delete(resolveEventDedupeKey(namespace, messageId));
|
|
427
|
-
}
|
|
428
|
-
async function finalizeFeishuMessageProcessing(params) {
|
|
429
|
-
const { messageId, namespace = "global", log, claimHeld = false } = params;
|
|
430
|
-
const normalizedMessageId = normalizeMessageId(messageId);
|
|
431
|
-
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
432
|
-
if (!memoryKey || !normalizedMessageId) return false;
|
|
433
|
-
if (!claimHeld && !tryBeginFeishuMessageProcessing(normalizedMessageId, namespace)) return false;
|
|
434
|
-
if (!tryRecordMessage(memoryKey)) {
|
|
435
|
-
releaseFeishuMessageProcessing(normalizedMessageId, namespace);
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
438
|
-
if (!await tryRecordMessagePersistent(normalizedMessageId, namespace, log)) {
|
|
439
|
-
releaseFeishuMessageProcessing(normalizedMessageId, namespace);
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
async function recordProcessedFeishuMessage(messageId, namespace = "global", log) {
|
|
445
|
-
const normalizedMessageId = normalizeMessageId(messageId);
|
|
446
|
-
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
447
|
-
if (!memoryKey || !normalizedMessageId) return false;
|
|
448
|
-
tryRecordMessage(memoryKey);
|
|
449
|
-
return await tryRecordMessagePersistent(normalizedMessageId, namespace, log);
|
|
450
|
-
}
|
|
451
|
-
async function hasProcessedFeishuMessage(messageId, namespace = "global", log) {
|
|
452
|
-
const normalizedMessageId = normalizeMessageId(messageId);
|
|
453
|
-
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
454
|
-
if (!memoryKey || !normalizedMessageId) return false;
|
|
455
|
-
if (hasRecordedMessage(memoryKey)) return true;
|
|
456
|
-
return hasRecordedMessagePersistent(normalizedMessageId, namespace, log);
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Synchronous dedup — memory only.
|
|
460
|
-
* Kept for backward compatibility; prefer {@link tryRecordMessagePersistent}.
|
|
461
|
-
*/
|
|
462
|
-
function tryRecordMessage(messageId) {
|
|
463
|
-
return !memoryDedupe.check(messageId);
|
|
464
|
-
}
|
|
465
|
-
function hasRecordedMessage(messageId) {
|
|
466
|
-
const trimmed = messageId.trim();
|
|
467
|
-
if (!trimmed) return false;
|
|
468
|
-
return memoryDedupe.peek(trimmed);
|
|
469
|
-
}
|
|
470
|
-
async function tryRecordMessagePersistent(messageId, namespace = "global", log) {
|
|
471
|
-
return persistentDedupe.checkAndRecord(messageId, {
|
|
472
|
-
namespace,
|
|
473
|
-
onDiskError: (error) => {
|
|
474
|
-
log?.(`feishu-dedup: disk error, falling back to memory: ${String(error)}`);
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
async function hasRecordedMessagePersistent(messageId, namespace = "global", log) {
|
|
479
|
-
const trimmed = messageId.trim();
|
|
480
|
-
if (!trimmed) return false;
|
|
481
|
-
const now = Date.now();
|
|
482
|
-
const filePath = resolveNamespaceFilePath(namespace);
|
|
483
|
-
try {
|
|
484
|
-
const { value } = await readJsonFileWithFallback(filePath, {});
|
|
485
|
-
const seenAt = value[trimmed];
|
|
486
|
-
if (typeof seenAt !== "number" || !Number.isFinite(seenAt)) return false;
|
|
487
|
-
return DEDUP_TTL_MS <= 0 || now - seenAt < DEDUP_TTL_MS;
|
|
488
|
-
} catch (error) {
|
|
489
|
-
log?.(`feishu-dedup: persistent peek failed: ${String(error)}`);
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
async function warmupDedupFromDisk(namespace, log) {
|
|
494
|
-
return persistentDedupe.warmup(namespace, (error) => {
|
|
495
|
-
log?.(`feishu-dedup: warmup disk error: ${String(error)}`);
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region extensions/feishu/src/dynamic-agent.ts
|
|
500
|
-
/**
|
|
501
|
-
* Check if a dynamic agent should be created for a DM user and create it if needed.
|
|
502
|
-
* This creates a unique agent instance with its own workspace for each DM user.
|
|
503
|
-
*/
|
|
504
|
-
async function maybeCreateDynamicAgent(params) {
|
|
505
|
-
const { cfg, runtime, senderOpenId, dynamicCfg, log } = params;
|
|
506
|
-
const existingBindings = cfg.bindings ?? [];
|
|
507
|
-
if (existingBindings.some((b) => b.match?.channel === "feishu" && b.match?.peer?.kind === "direct" && b.match?.peer?.id === senderOpenId)) return {
|
|
508
|
-
created: false,
|
|
509
|
-
updatedCfg: cfg
|
|
510
|
-
};
|
|
511
|
-
if (dynamicCfg.maxAgents !== void 0) {
|
|
512
|
-
if ((cfg.agents?.list ?? []).filter((a) => a.id.startsWith("feishu-")).length >= dynamicCfg.maxAgents) {
|
|
513
|
-
log(`feishu: maxAgents limit (${dynamicCfg.maxAgents}) reached, not creating agent for ${senderOpenId}`);
|
|
514
|
-
return {
|
|
515
|
-
created: false,
|
|
516
|
-
updatedCfg: cfg
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
const agentId = `feishu-${senderOpenId}`;
|
|
521
|
-
if ((cfg.agents?.list ?? []).find((a) => a.id === agentId)) {
|
|
522
|
-
log(`feishu: agent "${agentId}" exists, adding missing binding for ${senderOpenId}`);
|
|
523
|
-
const updatedCfg = {
|
|
524
|
-
...cfg,
|
|
525
|
-
bindings: [...existingBindings, {
|
|
526
|
-
agentId,
|
|
527
|
-
match: {
|
|
528
|
-
channel: "feishu",
|
|
529
|
-
peer: {
|
|
530
|
-
kind: "direct",
|
|
531
|
-
id: senderOpenId
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}]
|
|
535
|
-
};
|
|
536
|
-
await runtime.config.writeConfigFile(updatedCfg);
|
|
537
|
-
return {
|
|
538
|
-
created: true,
|
|
539
|
-
updatedCfg,
|
|
540
|
-
agentId
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
const workspaceTemplate = dynamicCfg.workspaceTemplate ?? "~/.openclaw/workspace-{agentId}";
|
|
544
|
-
const agentDirTemplate = dynamicCfg.agentDirTemplate ?? "~/.openclaw/agents/{agentId}/agent";
|
|
545
|
-
const workspace = resolveUserPath(workspaceTemplate.replace("{userId}", senderOpenId).replace("{agentId}", agentId));
|
|
546
|
-
const agentDir = resolveUserPath(agentDirTemplate.replace("{userId}", senderOpenId).replace("{agentId}", agentId));
|
|
547
|
-
log(`feishu: creating dynamic agent "${agentId}" for user ${senderOpenId}`);
|
|
548
|
-
log(` workspace: ${workspace}`);
|
|
549
|
-
log(` agentDir: ${agentDir}`);
|
|
550
|
-
await fsSync.promises.mkdir(workspace, { recursive: true });
|
|
551
|
-
await fsSync.promises.mkdir(agentDir, { recursive: true });
|
|
552
|
-
const updatedCfg = {
|
|
553
|
-
...cfg,
|
|
554
|
-
agents: {
|
|
555
|
-
...cfg.agents,
|
|
556
|
-
list: [...cfg.agents?.list ?? [], {
|
|
557
|
-
id: agentId,
|
|
558
|
-
workspace,
|
|
559
|
-
agentDir
|
|
560
|
-
}]
|
|
561
|
-
},
|
|
562
|
-
bindings: [...existingBindings, {
|
|
563
|
-
agentId,
|
|
564
|
-
match: {
|
|
565
|
-
channel: "feishu",
|
|
566
|
-
peer: {
|
|
567
|
-
kind: "direct",
|
|
568
|
-
id: senderOpenId
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}]
|
|
572
|
-
};
|
|
573
|
-
await runtime.config.writeConfigFile(updatedCfg);
|
|
574
|
-
return {
|
|
575
|
-
created: true,
|
|
576
|
-
updatedCfg,
|
|
577
|
-
agentId
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Resolve a path that may start with ~ to the user's home directory.
|
|
582
|
-
*/
|
|
583
|
-
function resolveUserPath(p) {
|
|
584
|
-
if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2));
|
|
585
|
-
return p;
|
|
586
|
-
}
|
|
587
|
-
//#endregion
|
|
588
|
-
//#region extensions/feishu/src/streaming-card.ts
|
|
589
|
-
const tokenCache = /* @__PURE__ */ new Map();
|
|
590
|
-
function resolveApiBase(domain) {
|
|
591
|
-
if (domain === "lark") return "https://open.larksuite.com/open-apis";
|
|
592
|
-
if (domain && domain !== "feishu" && domain.startsWith("http")) return `${domain.replace(/\/+$/, "")}/open-apis`;
|
|
593
|
-
return "https://open.feishu.cn/open-apis";
|
|
594
|
-
}
|
|
595
|
-
function resolveAllowedHostnames(domain) {
|
|
596
|
-
if (domain === "lark") return ["open.larksuite.com"];
|
|
597
|
-
if (domain && domain !== "feishu" && domain.startsWith("http")) try {
|
|
598
|
-
return [new URL(domain).hostname];
|
|
599
|
-
} catch {
|
|
600
|
-
return [];
|
|
601
|
-
}
|
|
602
|
-
return ["open.feishu.cn"];
|
|
603
|
-
}
|
|
604
|
-
async function getToken(creds) {
|
|
605
|
-
const key = `${creds.domain ?? "feishu"}|${creds.appId}`;
|
|
606
|
-
const cached = tokenCache.get(key);
|
|
607
|
-
if (cached && cached.expiresAt > Date.now() + 6e4) return cached.token;
|
|
608
|
-
const { response, release } = await fetchWithSsrFGuard({
|
|
609
|
-
url: `${resolveApiBase(creds.domain)}/auth/v3/tenant_access_token/internal`,
|
|
610
|
-
init: {
|
|
611
|
-
method: "POST",
|
|
612
|
-
headers: { "Content-Type": "application/json" },
|
|
613
|
-
body: JSON.stringify({
|
|
614
|
-
app_id: creds.appId,
|
|
615
|
-
app_secret: creds.appSecret
|
|
616
|
-
})
|
|
617
|
-
},
|
|
618
|
-
policy: { allowedHostnames: resolveAllowedHostnames(creds.domain) },
|
|
619
|
-
auditContext: "feishu.streaming-card.token"
|
|
620
|
-
});
|
|
621
|
-
if (!response.ok) {
|
|
622
|
-
await release();
|
|
623
|
-
throw new Error(`Token request failed with HTTP ${response.status}`);
|
|
624
|
-
}
|
|
625
|
-
const data = await response.json();
|
|
626
|
-
await release();
|
|
627
|
-
if (data.code !== 0 || !data.tenant_access_token) throw new Error(`Token error: ${data.msg}`);
|
|
628
|
-
tokenCache.set(key, {
|
|
629
|
-
token: data.tenant_access_token,
|
|
630
|
-
expiresAt: Date.now() + (data.expire ?? 7200) * 1e3
|
|
631
|
-
});
|
|
632
|
-
return data.tenant_access_token;
|
|
633
|
-
}
|
|
634
|
-
function truncateSummary(text, max = 50) {
|
|
635
|
-
if (!text) return "";
|
|
636
|
-
const clean = text.replace(/\n/g, " ").trim();
|
|
637
|
-
return clean.length <= max ? clean : clean.slice(0, max - 3) + "...";
|
|
638
|
-
}
|
|
639
|
-
function mergeStreamingText(previousText, nextText) {
|
|
640
|
-
const previous = typeof previousText === "string" ? previousText : "";
|
|
641
|
-
const next = typeof nextText === "string" ? nextText : "";
|
|
642
|
-
if (!next) return previous;
|
|
643
|
-
if (!previous || next === previous) return next;
|
|
644
|
-
if (next.startsWith(previous)) return next;
|
|
645
|
-
if (previous.startsWith(next)) return previous;
|
|
646
|
-
if (next.includes(previous)) return next;
|
|
647
|
-
if (previous.includes(next)) return previous;
|
|
648
|
-
const maxOverlap = Math.min(previous.length, next.length);
|
|
649
|
-
for (let overlap = maxOverlap; overlap > 0; overlap -= 1) if (previous.slice(-overlap) === next.slice(0, overlap)) return `${previous}${next.slice(overlap)}`;
|
|
650
|
-
return `${previous}${next}`;
|
|
651
|
-
}
|
|
652
|
-
function resolveStreamingCardSendMode(options) {
|
|
653
|
-
if (options?.replyToMessageId) return "reply";
|
|
654
|
-
if (options?.rootId) return "root_create";
|
|
655
|
-
return "create";
|
|
656
|
-
}
|
|
657
|
-
/** Streaming card session manager */
|
|
658
|
-
var FeishuStreamingSession = class {
|
|
659
|
-
constructor(client, creds, log) {
|
|
660
|
-
this.state = null;
|
|
661
|
-
this.queue = Promise.resolve();
|
|
662
|
-
this.closed = false;
|
|
663
|
-
this.lastUpdateTime = 0;
|
|
664
|
-
this.pendingText = null;
|
|
665
|
-
this.flushTimer = null;
|
|
666
|
-
this.updateThrottleMs = 100;
|
|
667
|
-
this.client = client;
|
|
668
|
-
this.creds = creds;
|
|
669
|
-
this.log = log;
|
|
670
|
-
}
|
|
671
|
-
async start(receiveId, receiveIdType = "chat_id", options) {
|
|
672
|
-
if (this.state) return;
|
|
673
|
-
const apiBase = resolveApiBase(this.creds.domain);
|
|
674
|
-
const elements = [{
|
|
675
|
-
tag: "markdown",
|
|
676
|
-
content: "⏳ Thinking...",
|
|
677
|
-
element_id: "content"
|
|
678
|
-
}];
|
|
679
|
-
if (options?.note) {
|
|
680
|
-
elements.push({ tag: "hr" });
|
|
681
|
-
elements.push({
|
|
682
|
-
tag: "markdown",
|
|
683
|
-
content: `<font color='grey'>${options.note}</font>`,
|
|
684
|
-
element_id: "note"
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
const cardJson = {
|
|
688
|
-
schema: "2.0",
|
|
689
|
-
config: {
|
|
690
|
-
streaming_mode: true,
|
|
691
|
-
summary: { content: "[Generating...]" },
|
|
692
|
-
streaming_config: {
|
|
693
|
-
print_frequency_ms: { default: 50 },
|
|
694
|
-
print_step: { default: 1 }
|
|
695
|
-
}
|
|
696
|
-
},
|
|
697
|
-
body: { elements }
|
|
698
|
-
};
|
|
699
|
-
if (options?.header) cardJson.header = {
|
|
700
|
-
title: {
|
|
701
|
-
tag: "plain_text",
|
|
702
|
-
content: options.header.title
|
|
703
|
-
},
|
|
704
|
-
template: resolveFeishuCardTemplate(options.header.template) ?? "blue"
|
|
705
|
-
};
|
|
706
|
-
const { response: createRes, release: releaseCreate } = await fetchWithSsrFGuard({
|
|
707
|
-
url: `${apiBase}/cardkit/v1/cards`,
|
|
708
|
-
init: {
|
|
709
|
-
method: "POST",
|
|
710
|
-
headers: {
|
|
711
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
712
|
-
"Content-Type": "application/json"
|
|
713
|
-
},
|
|
714
|
-
body: JSON.stringify({
|
|
715
|
-
type: "card_json",
|
|
716
|
-
data: JSON.stringify(cardJson)
|
|
717
|
-
})
|
|
718
|
-
},
|
|
719
|
-
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
720
|
-
auditContext: "feishu.streaming-card.create"
|
|
721
|
-
});
|
|
722
|
-
if (!createRes.ok) {
|
|
723
|
-
await releaseCreate();
|
|
724
|
-
throw new Error(`Create card request failed with HTTP ${createRes.status}`);
|
|
725
|
-
}
|
|
726
|
-
const createData = await createRes.json();
|
|
727
|
-
await releaseCreate();
|
|
728
|
-
if (createData.code !== 0 || !createData.data?.card_id) throw new Error(`Create card failed: ${createData.msg}`);
|
|
729
|
-
const cardId = createData.data.card_id;
|
|
730
|
-
const cardContent = JSON.stringify({
|
|
731
|
-
type: "card",
|
|
732
|
-
data: { card_id: cardId }
|
|
733
|
-
});
|
|
734
|
-
let sendRes;
|
|
735
|
-
const sendOptions = options ?? {};
|
|
736
|
-
const sendMode = resolveStreamingCardSendMode(sendOptions);
|
|
737
|
-
if (sendMode === "reply") sendRes = await this.client.im.message.reply({
|
|
738
|
-
path: { message_id: sendOptions.replyToMessageId },
|
|
739
|
-
data: {
|
|
740
|
-
msg_type: "interactive",
|
|
741
|
-
content: cardContent,
|
|
742
|
-
...sendOptions.replyInThread ? { reply_in_thread: true } : {}
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
else if (sendMode === "root_create") sendRes = await this.client.im.message.create({
|
|
746
|
-
params: { receive_id_type: receiveIdType },
|
|
747
|
-
data: Object.assign({
|
|
748
|
-
receive_id: receiveId,
|
|
749
|
-
msg_type: "interactive",
|
|
750
|
-
content: cardContent
|
|
751
|
-
}, { root_id: sendOptions.rootId })
|
|
752
|
-
});
|
|
753
|
-
else sendRes = await this.client.im.message.create({
|
|
754
|
-
params: { receive_id_type: receiveIdType },
|
|
755
|
-
data: {
|
|
756
|
-
receive_id: receiveId,
|
|
757
|
-
msg_type: "interactive",
|
|
758
|
-
content: cardContent
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
if (sendRes.code !== 0 || !sendRes.data?.message_id) throw new Error(`Send card failed: ${sendRes.msg}`);
|
|
762
|
-
this.state = {
|
|
763
|
-
cardId,
|
|
764
|
-
messageId: sendRes.data.message_id,
|
|
765
|
-
sequence: 1,
|
|
766
|
-
currentText: "",
|
|
767
|
-
hasNote: !!options?.note
|
|
768
|
-
};
|
|
769
|
-
this.log?.(`Started streaming: cardId=${cardId}, messageId=${sendRes.data.message_id}`);
|
|
770
|
-
}
|
|
771
|
-
async updateCardContent(text, onError) {
|
|
772
|
-
if (!this.state) return;
|
|
773
|
-
const apiBase = resolveApiBase(this.creds.domain);
|
|
774
|
-
this.state.sequence += 1;
|
|
775
|
-
await fetchWithSsrFGuard({
|
|
776
|
-
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/content/content`,
|
|
777
|
-
init: {
|
|
778
|
-
method: "PUT",
|
|
779
|
-
headers: {
|
|
780
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
781
|
-
"Content-Type": "application/json"
|
|
782
|
-
},
|
|
783
|
-
body: JSON.stringify({
|
|
784
|
-
content: text,
|
|
785
|
-
sequence: this.state.sequence,
|
|
786
|
-
uuid: `s_${this.state.cardId}_${this.state.sequence}`
|
|
787
|
-
})
|
|
788
|
-
},
|
|
789
|
-
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
790
|
-
auditContext: "feishu.streaming-card.update"
|
|
791
|
-
}).then(async ({ release }) => {
|
|
792
|
-
await release();
|
|
793
|
-
}).catch((error) => onError?.(error));
|
|
794
|
-
}
|
|
795
|
-
async update(text) {
|
|
796
|
-
if (!this.state || this.closed) return;
|
|
797
|
-
const mergedInput = mergeStreamingText(this.pendingText ?? this.state.currentText, text);
|
|
798
|
-
if (!mergedInput || mergedInput === this.state.currentText) return;
|
|
799
|
-
const now = Date.now();
|
|
800
|
-
if (now - this.lastUpdateTime < this.updateThrottleMs) {
|
|
801
|
-
this.pendingText = mergedInput;
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
this.pendingText = null;
|
|
805
|
-
this.lastUpdateTime = now;
|
|
806
|
-
if (this.flushTimer) {
|
|
807
|
-
clearTimeout(this.flushTimer);
|
|
808
|
-
this.flushTimer = null;
|
|
809
|
-
}
|
|
810
|
-
this.queue = this.queue.then(async () => {
|
|
811
|
-
if (!this.state || this.closed) return;
|
|
812
|
-
const mergedText = mergeStreamingText(this.state.currentText, mergedInput);
|
|
813
|
-
if (!mergedText || mergedText === this.state.currentText) return;
|
|
814
|
-
this.state.currentText = mergedText;
|
|
815
|
-
await this.updateCardContent(mergedText, (e) => this.log?.(`Update failed: ${String(e)}`));
|
|
816
|
-
});
|
|
817
|
-
await this.queue;
|
|
818
|
-
}
|
|
819
|
-
async updateNoteContent(note) {
|
|
820
|
-
if (!this.state || !this.state.hasNote) return;
|
|
821
|
-
const apiBase = resolveApiBase(this.creds.domain);
|
|
822
|
-
this.state.sequence += 1;
|
|
823
|
-
await fetchWithSsrFGuard({
|
|
824
|
-
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/note/content`,
|
|
825
|
-
init: {
|
|
826
|
-
method: "PUT",
|
|
827
|
-
headers: {
|
|
828
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
829
|
-
"Content-Type": "application/json"
|
|
830
|
-
},
|
|
831
|
-
body: JSON.stringify({
|
|
832
|
-
content: `<font color='grey'>${note}</font>`,
|
|
833
|
-
sequence: this.state.sequence,
|
|
834
|
-
uuid: `n_${this.state.cardId}_${this.state.sequence}`
|
|
835
|
-
})
|
|
836
|
-
},
|
|
837
|
-
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
838
|
-
auditContext: "feishu.streaming-card.note-update"
|
|
839
|
-
}).then(async ({ release }) => {
|
|
840
|
-
await release();
|
|
841
|
-
}).catch((e) => this.log?.(`Note update failed: ${String(e)}`));
|
|
842
|
-
}
|
|
843
|
-
async close(finalText, options) {
|
|
844
|
-
if (!this.state || this.closed) return;
|
|
845
|
-
this.closed = true;
|
|
846
|
-
if (this.flushTimer) {
|
|
847
|
-
clearTimeout(this.flushTimer);
|
|
848
|
-
this.flushTimer = null;
|
|
849
|
-
}
|
|
850
|
-
await this.queue;
|
|
851
|
-
const pendingMerged = mergeStreamingText(this.state.currentText, this.pendingText ?? void 0);
|
|
852
|
-
const text = finalText ? mergeStreamingText(pendingMerged, finalText) : pendingMerged;
|
|
853
|
-
const apiBase = resolveApiBase(this.creds.domain);
|
|
854
|
-
if (text && text !== this.state.currentText) {
|
|
855
|
-
await this.updateCardContent(text);
|
|
856
|
-
this.state.currentText = text;
|
|
857
|
-
}
|
|
858
|
-
if (options?.note) await this.updateNoteContent(options.note);
|
|
859
|
-
this.state.sequence += 1;
|
|
860
|
-
await fetchWithSsrFGuard({
|
|
861
|
-
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/settings`,
|
|
862
|
-
init: {
|
|
863
|
-
method: "PATCH",
|
|
864
|
-
headers: {
|
|
865
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
866
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
867
|
-
},
|
|
868
|
-
body: JSON.stringify({
|
|
869
|
-
settings: JSON.stringify({ config: {
|
|
870
|
-
streaming_mode: false,
|
|
871
|
-
summary: { content: truncateSummary(text) }
|
|
872
|
-
} }),
|
|
873
|
-
sequence: this.state.sequence,
|
|
874
|
-
uuid: `c_${this.state.cardId}_${this.state.sequence}`
|
|
875
|
-
})
|
|
876
|
-
},
|
|
877
|
-
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
878
|
-
auditContext: "feishu.streaming-card.close"
|
|
879
|
-
}).then(async ({ release }) => {
|
|
880
|
-
await release();
|
|
881
|
-
}).catch((e) => this.log?.(`Close failed: ${String(e)}`));
|
|
882
|
-
const finalState = this.state;
|
|
883
|
-
this.state = null;
|
|
884
|
-
this.pendingText = null;
|
|
885
|
-
this.log?.(`Closed streaming: cardId=${finalState.cardId}`);
|
|
886
|
-
}
|
|
887
|
-
isActive() {
|
|
888
|
-
return this.state !== null && !this.closed;
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
//#endregion
|
|
892
|
-
//#region extensions/feishu/src/typing.ts
|
|
893
|
-
const TYPING_EMOJI = "Typing";
|
|
894
|
-
/**
|
|
895
|
-
* Feishu API error codes that indicate the caller should back off.
|
|
896
|
-
* These must propagate to the typing circuit breaker so the keepalive loop
|
|
897
|
-
* can trip and stop retrying.
|
|
898
|
-
*
|
|
899
|
-
* - 99991400: Rate limit (too many requests per second)
|
|
900
|
-
* - 99991403: Monthly API call quota exceeded
|
|
901
|
-
* - 429: Standard HTTP 429 returned as a Feishu SDK error code
|
|
902
|
-
*
|
|
903
|
-
* @see https://open.feishu.cn/document/server-docs/api-call-guide/generic-error-code
|
|
904
|
-
*/
|
|
905
|
-
const FEISHU_BACKOFF_CODES = new Set([
|
|
906
|
-
99991400,
|
|
907
|
-
99991403,
|
|
908
|
-
429
|
|
909
|
-
]);
|
|
910
|
-
/**
|
|
911
|
-
* Custom error class for Feishu backoff conditions detected from non-throwing
|
|
912
|
-
* SDK responses. Carries a numeric `.code` so that `isFeishuBackoffError()`
|
|
913
|
-
* recognises it when the error is caught downstream.
|
|
914
|
-
*/
|
|
915
|
-
var FeishuBackoffError = class extends Error {
|
|
916
|
-
constructor(code) {
|
|
917
|
-
super(`Feishu API backoff: code ${code}`);
|
|
918
|
-
this.name = "FeishuBackoffError";
|
|
919
|
-
this.code = code;
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
/**
|
|
923
|
-
* Check whether an error represents a rate-limit or quota-exceeded condition
|
|
924
|
-
* from the Feishu API that should stop the typing keepalive loop.
|
|
925
|
-
*
|
|
926
|
-
* Handles two shapes:
|
|
927
|
-
* 1. AxiosError with `response.status` and `response.data.code`
|
|
928
|
-
* 2. Feishu SDK error with a top-level `code` property
|
|
929
|
-
*/
|
|
930
|
-
function isFeishuBackoffError(err) {
|
|
931
|
-
if (typeof err !== "object" || err === null) return false;
|
|
932
|
-
const response = err.response;
|
|
933
|
-
if (response) {
|
|
934
|
-
if (response.status === 429) return true;
|
|
935
|
-
if (typeof response.data?.code === "number" && FEISHU_BACKOFF_CODES.has(response.data.code)) return true;
|
|
936
|
-
}
|
|
937
|
-
const code = err.code;
|
|
938
|
-
if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return true;
|
|
939
|
-
return false;
|
|
940
|
-
}
|
|
941
|
-
/**
|
|
942
|
-
* Check whether a Feishu SDK response object contains a backoff error code.
|
|
943
|
-
*
|
|
944
|
-
* The Feishu SDK sometimes returns a normal response (no throw) with an
|
|
945
|
-
* API-level error code in the response body. This must be detected so the
|
|
946
|
-
* circuit breaker can trip. See codex review on #28157.
|
|
947
|
-
*/
|
|
948
|
-
function getBackoffCodeFromResponse(response) {
|
|
949
|
-
if (typeof response !== "object" || response === null) return;
|
|
950
|
-
const code = response.code;
|
|
951
|
-
if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return code;
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Add a typing indicator (reaction) to a message.
|
|
955
|
-
*
|
|
956
|
-
* Rate-limit and quota errors are re-thrown so the circuit breaker in
|
|
957
|
-
* `createTypingCallbacks` (typing-start-guard) can trip and stop the
|
|
958
|
-
* keepalive loop. See #28062.
|
|
959
|
-
*
|
|
960
|
-
* Also checks for backoff codes in non-throwing SDK responses (#28157).
|
|
961
|
-
*/
|
|
962
|
-
async function addTypingIndicator(params) {
|
|
963
|
-
const { cfg, messageId, accountId, runtime } = params;
|
|
964
|
-
const account = resolveFeishuRuntimeAccount({
|
|
965
|
-
cfg,
|
|
966
|
-
accountId
|
|
967
|
-
});
|
|
968
|
-
if (!account.configured) return {
|
|
969
|
-
messageId,
|
|
970
|
-
reactionId: null
|
|
971
|
-
};
|
|
972
|
-
const client = createFeishuClient(account);
|
|
973
|
-
try {
|
|
974
|
-
const response = await client.im.messageReaction.create({
|
|
975
|
-
path: { message_id: messageId },
|
|
976
|
-
data: { reaction_type: { emoji_type: TYPING_EMOJI } }
|
|
977
|
-
});
|
|
978
|
-
const backoffCode = getBackoffCodeFromResponse(response);
|
|
979
|
-
if (backoffCode !== void 0) {
|
|
980
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] typing indicator response contains backoff code ${backoffCode}, stopping keepalive`);
|
|
981
|
-
throw new FeishuBackoffError(backoffCode);
|
|
982
|
-
}
|
|
983
|
-
return {
|
|
984
|
-
messageId,
|
|
985
|
-
reactionId: response.data?.reaction_id ?? null
|
|
986
|
-
};
|
|
987
|
-
} catch (err) {
|
|
988
|
-
if (isFeishuBackoffError(err)) {
|
|
989
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.("[feishu] typing indicator hit rate-limit/quota, stopping keepalive");
|
|
990
|
-
throw err;
|
|
991
|
-
}
|
|
992
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] failed to add typing indicator: ${String(err)}`);
|
|
993
|
-
return {
|
|
994
|
-
messageId,
|
|
995
|
-
reactionId: null
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Remove a typing indicator (reaction) from a message.
|
|
1001
|
-
*
|
|
1002
|
-
* Rate-limit and quota errors are re-thrown for the same reason as above.
|
|
1003
|
-
*/
|
|
1004
|
-
async function removeTypingIndicator(params) {
|
|
1005
|
-
const { cfg, state, accountId, runtime } = params;
|
|
1006
|
-
if (!state.reactionId) return;
|
|
1007
|
-
const account = resolveFeishuRuntimeAccount({
|
|
1008
|
-
cfg,
|
|
1009
|
-
accountId
|
|
1010
|
-
});
|
|
1011
|
-
if (!account.configured) return;
|
|
1012
|
-
const client = createFeishuClient(account);
|
|
1013
|
-
try {
|
|
1014
|
-
const backoffCode = getBackoffCodeFromResponse(await client.im.messageReaction.delete({ path: {
|
|
1015
|
-
message_id: state.messageId,
|
|
1016
|
-
reaction_id: state.reactionId
|
|
1017
|
-
} }));
|
|
1018
|
-
if (backoffCode !== void 0) {
|
|
1019
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] typing indicator removal response contains backoff code ${backoffCode}, stopping keepalive`);
|
|
1020
|
-
throw new FeishuBackoffError(backoffCode);
|
|
1021
|
-
}
|
|
1022
|
-
} catch (err) {
|
|
1023
|
-
if (isFeishuBackoffError(err)) {
|
|
1024
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.("[feishu] typing indicator removal hit rate-limit/quota, stopping keepalive");
|
|
1025
|
-
throw err;
|
|
1026
|
-
}
|
|
1027
|
-
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] failed to remove typing indicator: ${String(err)}`);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
//#endregion
|
|
1031
|
-
//#region extensions/feishu/src/reply-dispatcher.ts
|
|
1032
|
-
/** Detect if text contains markdown elements that benefit from card rendering */
|
|
1033
|
-
function shouldUseCard(text) {
|
|
1034
|
-
return /```[\s\S]*?```/.test(text) || /\|.+\|[\r\n]+\|[-:| ]+\|/.test(text);
|
|
1035
|
-
}
|
|
1036
|
-
/** Maximum age (ms) for a message to receive a typing indicator reaction.
|
|
1037
|
-
* Messages older than this are likely replays after context compaction (#30418). */
|
|
1038
|
-
const TYPING_INDICATOR_MAX_AGE_MS = 2 * 6e4;
|
|
1039
|
-
const MS_EPOCH_MIN = 0xe8d4a51000;
|
|
1040
|
-
function normalizeEpochMs(timestamp) {
|
|
1041
|
-
if (!Number.isFinite(timestamp) || timestamp === void 0 || timestamp <= 0) return;
|
|
1042
|
-
return timestamp < MS_EPOCH_MIN ? timestamp * 1e3 : timestamp;
|
|
1043
|
-
}
|
|
1044
|
-
/** Build a card header from agent identity config. */
|
|
1045
|
-
function resolveCardHeader(agentId, identity) {
|
|
1046
|
-
const name = identity?.name?.trim() || agentId;
|
|
1047
|
-
const emoji = identity?.emoji?.trim();
|
|
1048
|
-
return {
|
|
1049
|
-
title: emoji ? `${emoji} ${name}` : name,
|
|
1050
|
-
template: identity?.theme ?? "blue"
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
/** Build a card note footer from agent identity and model context. */
|
|
1054
|
-
function resolveCardNote(agentId, identity, prefixCtx) {
|
|
1055
|
-
const parts = [`Agent: ${identity?.name?.trim() || agentId}`];
|
|
1056
|
-
if (prefixCtx.model) parts.push(`Model: ${prefixCtx.model}`);
|
|
1057
|
-
if (prefixCtx.provider) parts.push(`Provider: ${prefixCtx.provider}`);
|
|
1058
|
-
return parts.join(" | ");
|
|
1059
|
-
}
|
|
1060
|
-
function createFeishuReplyDispatcher(params) {
|
|
1061
|
-
const core = getFeishuRuntime();
|
|
1062
|
-
const { cfg, agentId, chatId, replyToMessageId, skipReplyToInMessages, replyInThread, threadReply, rootId, mentionTargets, accountId, identity } = params;
|
|
1063
|
-
const sendReplyToMessageId = skipReplyToInMessages ? void 0 : replyToMessageId;
|
|
1064
|
-
const threadReplyMode = threadReply === true;
|
|
1065
|
-
const effectiveReplyInThread = threadReplyMode ? true : replyInThread;
|
|
1066
|
-
const account = resolveFeishuRuntimeAccount({
|
|
1067
|
-
cfg,
|
|
1068
|
-
accountId
|
|
1069
|
-
});
|
|
1070
|
-
const prefixContext = createReplyPrefixContext({
|
|
1071
|
-
cfg,
|
|
1072
|
-
agentId
|
|
1073
|
-
});
|
|
1074
|
-
let typingState = null;
|
|
1075
|
-
const { typingCallbacks } = createChannelReplyPipeline({
|
|
1076
|
-
cfg,
|
|
1077
|
-
agentId,
|
|
1078
|
-
channel: "feishu",
|
|
1079
|
-
accountId,
|
|
1080
|
-
typing: {
|
|
1081
|
-
start: async () => {
|
|
1082
|
-
if (!(account.config.typingIndicator ?? true)) return;
|
|
1083
|
-
if (!replyToMessageId) return;
|
|
1084
|
-
const messageCreateTimeMs = normalizeEpochMs(params.messageCreateTimeMs);
|
|
1085
|
-
if (messageCreateTimeMs !== void 0 && Date.now() - messageCreateTimeMs > TYPING_INDICATOR_MAX_AGE_MS) return;
|
|
1086
|
-
if (typingState?.reactionId) return;
|
|
1087
|
-
typingState = await addTypingIndicator({
|
|
1088
|
-
cfg,
|
|
1089
|
-
messageId: replyToMessageId,
|
|
1090
|
-
accountId,
|
|
1091
|
-
runtime: params.runtime
|
|
1092
|
-
});
|
|
1093
|
-
},
|
|
1094
|
-
stop: async () => {
|
|
1095
|
-
if (!typingState) return;
|
|
1096
|
-
await removeTypingIndicator({
|
|
1097
|
-
cfg,
|
|
1098
|
-
state: typingState,
|
|
1099
|
-
accountId,
|
|
1100
|
-
runtime: params.runtime
|
|
1101
|
-
});
|
|
1102
|
-
typingState = null;
|
|
1103
|
-
},
|
|
1104
|
-
onStartError: (err) => logTypingFailure({
|
|
1105
|
-
log: (message) => params.runtime.log?.(message),
|
|
1106
|
-
channel: "feishu",
|
|
1107
|
-
action: "start",
|
|
1108
|
-
error: err
|
|
1109
|
-
}),
|
|
1110
|
-
onStopError: (err) => logTypingFailure({
|
|
1111
|
-
log: (message) => params.runtime.log?.(message),
|
|
1112
|
-
channel: "feishu",
|
|
1113
|
-
action: "stop",
|
|
1114
|
-
error: err
|
|
1115
|
-
})
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1118
|
-
const textChunkLimit = core.channel.text.resolveTextChunkLimit(cfg, "feishu", accountId, { fallbackLimit: 4e3 });
|
|
1119
|
-
const chunkMode = core.channel.text.resolveChunkMode(cfg, "feishu");
|
|
1120
|
-
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
1121
|
-
cfg,
|
|
1122
|
-
channel: "feishu"
|
|
1123
|
-
});
|
|
1124
|
-
const renderMode = account.config?.renderMode ?? "auto";
|
|
1125
|
-
const streamingEnabled = !threadReplyMode && account.config?.streaming !== false && renderMode !== "raw";
|
|
1126
|
-
let streaming = null;
|
|
1127
|
-
let streamText = "";
|
|
1128
|
-
let lastPartial = "";
|
|
1129
|
-
let reasoningText = "";
|
|
1130
|
-
const deliveredFinalTexts = /* @__PURE__ */ new Set();
|
|
1131
|
-
let partialUpdateQueue = Promise.resolve();
|
|
1132
|
-
let streamingStartPromise = null;
|
|
1133
|
-
const formatReasoningPrefix = (thinking) => {
|
|
1134
|
-
if (!thinking) return "";
|
|
1135
|
-
return `> 💭 **Thinking**\n${thinking.replace(/^Reasoning:\n/, "").replace(/^_(.*)_$/gm, "$1").split("\n").map((line) => `> ${line}`).join("\n")}`;
|
|
1136
|
-
};
|
|
1137
|
-
const buildCombinedStreamText = (thinking, answer) => {
|
|
1138
|
-
const parts = [];
|
|
1139
|
-
if (thinking) parts.push(formatReasoningPrefix(thinking));
|
|
1140
|
-
if (thinking && answer) parts.push("\n\n---\n\n");
|
|
1141
|
-
if (answer) parts.push(answer);
|
|
1142
|
-
return parts.join("");
|
|
1143
|
-
};
|
|
1144
|
-
const flushStreamingCardUpdate = (combined) => {
|
|
1145
|
-
partialUpdateQueue = partialUpdateQueue.then(async () => {
|
|
1146
|
-
if (streamingStartPromise) await streamingStartPromise;
|
|
1147
|
-
if (streaming?.isActive()) await streaming.update(combined);
|
|
1148
|
-
});
|
|
1149
|
-
};
|
|
1150
|
-
const queueStreamingUpdate = (nextText, options) => {
|
|
1151
|
-
if (!nextText) return;
|
|
1152
|
-
if (options?.dedupeWithLastPartial && nextText === lastPartial) return;
|
|
1153
|
-
if (options?.dedupeWithLastPartial) lastPartial = nextText;
|
|
1154
|
-
streamText = (options?.mode ?? "snapshot") === "delta" ? `${streamText}${nextText}` : mergeStreamingText(streamText, nextText);
|
|
1155
|
-
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
1156
|
-
};
|
|
1157
|
-
const queueReasoningUpdate = (nextThinking) => {
|
|
1158
|
-
if (!nextThinking) return;
|
|
1159
|
-
reasoningText = nextThinking;
|
|
1160
|
-
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
1161
|
-
};
|
|
1162
|
-
const startStreaming = () => {
|
|
1163
|
-
if (!streamingEnabled || streamingStartPromise || streaming) return;
|
|
1164
|
-
streamingStartPromise = (async () => {
|
|
1165
|
-
const creds = account.appId && account.appSecret ? {
|
|
1166
|
-
appId: account.appId,
|
|
1167
|
-
appSecret: account.appSecret,
|
|
1168
|
-
domain: account.domain
|
|
1169
|
-
} : null;
|
|
1170
|
-
if (!creds) return;
|
|
1171
|
-
streaming = new FeishuStreamingSession(createFeishuClient(account), creds, (message) => params.runtime.log?.(`feishu[${account.accountId}] ${message}`));
|
|
1172
|
-
try {
|
|
1173
|
-
const cardHeader = resolveCardHeader(agentId, identity);
|
|
1174
|
-
const cardNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1175
|
-
await streaming.start(chatId, resolveReceiveIdType(chatId), {
|
|
1176
|
-
replyToMessageId,
|
|
1177
|
-
replyInThread: effectiveReplyInThread,
|
|
1178
|
-
rootId,
|
|
1179
|
-
header: cardHeader,
|
|
1180
|
-
note: cardNote
|
|
1181
|
-
});
|
|
1182
|
-
} catch (error) {
|
|
1183
|
-
params.runtime.error?.(`feishu: streaming start failed: ${String(error)}`);
|
|
1184
|
-
streaming = null;
|
|
1185
|
-
streamingStartPromise = null;
|
|
1186
|
-
}
|
|
1187
|
-
})();
|
|
1188
|
-
};
|
|
1189
|
-
const closeStreaming = async () => {
|
|
1190
|
-
if (streamingStartPromise) await streamingStartPromise;
|
|
1191
|
-
await partialUpdateQueue;
|
|
1192
|
-
if (streaming?.isActive()) {
|
|
1193
|
-
let text = buildCombinedStreamText(reasoningText, streamText);
|
|
1194
|
-
if (mentionTargets?.length) text = buildMentionedCardContent(mentionTargets, text);
|
|
1195
|
-
const finalNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1196
|
-
await streaming.close(text, { note: finalNote });
|
|
1197
|
-
}
|
|
1198
|
-
streaming = null;
|
|
1199
|
-
streamingStartPromise = null;
|
|
1200
|
-
streamText = "";
|
|
1201
|
-
lastPartial = "";
|
|
1202
|
-
reasoningText = "";
|
|
1203
|
-
};
|
|
1204
|
-
const sendChunkedTextReply = async (params) => {
|
|
1205
|
-
const chunkSource = params.useCard ? params.text : core.channel.text.convertMarkdownTables(params.text, tableMode);
|
|
1206
|
-
const chunks = resolveTextChunksWithFallback(chunkSource, core.channel.text.chunkTextWithMode(chunkSource, textChunkLimit, chunkMode));
|
|
1207
|
-
for (const [index, chunk] of chunks.entries()) await params.sendChunk({
|
|
1208
|
-
chunk,
|
|
1209
|
-
isFirst: index === 0
|
|
1210
|
-
});
|
|
1211
|
-
if (params.infoKind === "final") deliveredFinalTexts.add(params.text);
|
|
1212
|
-
};
|
|
1213
|
-
const sendMediaReplies = async (payload) => {
|
|
1214
|
-
await sendMediaWithLeadingCaption({
|
|
1215
|
-
mediaUrls: resolveSendableOutboundReplyParts(payload).mediaUrls,
|
|
1216
|
-
caption: "",
|
|
1217
|
-
send: async ({ mediaUrl }) => {
|
|
1218
|
-
await sendMediaFeishu({
|
|
1219
|
-
cfg,
|
|
1220
|
-
to: chatId,
|
|
1221
|
-
mediaUrl,
|
|
1222
|
-
replyToMessageId: sendReplyToMessageId,
|
|
1223
|
-
replyInThread: effectiveReplyInThread,
|
|
1224
|
-
accountId
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
};
|
|
1229
|
-
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
1230
|
-
responsePrefix: prefixContext.responsePrefix,
|
|
1231
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
1232
|
-
humanDelay: core.channel.reply.resolveHumanDelayConfig(cfg, agentId),
|
|
1233
|
-
onReplyStart: async () => {
|
|
1234
|
-
deliveredFinalTexts.clear();
|
|
1235
|
-
if (streamingEnabled && renderMode === "card") startStreaming();
|
|
1236
|
-
await typingCallbacks?.onReplyStart?.();
|
|
1237
|
-
},
|
|
1238
|
-
deliver: async (payload, info) => {
|
|
1239
|
-
const reply = resolveSendableOutboundReplyParts(payload);
|
|
1240
|
-
const text = reply.text;
|
|
1241
|
-
const hasText = reply.hasText;
|
|
1242
|
-
const hasMedia = reply.hasMedia;
|
|
1243
|
-
const skipTextForDuplicateFinal = info?.kind === "final" && hasText && deliveredFinalTexts.has(text);
|
|
1244
|
-
const shouldDeliverText = hasText && !skipTextForDuplicateFinal;
|
|
1245
|
-
if (!shouldDeliverText && !hasMedia) return;
|
|
1246
|
-
if (shouldDeliverText) {
|
|
1247
|
-
const useCard = renderMode === "card" || renderMode === "auto" && shouldUseCard(text);
|
|
1248
|
-
if (info?.kind === "block") {
|
|
1249
|
-
if (!(streamingEnabled && useCard)) return;
|
|
1250
|
-
startStreaming();
|
|
1251
|
-
if (streamingStartPromise) await streamingStartPromise;
|
|
1252
|
-
}
|
|
1253
|
-
if (info?.kind === "final" && streamingEnabled && useCard) {
|
|
1254
|
-
startStreaming();
|
|
1255
|
-
if (streamingStartPromise) await streamingStartPromise;
|
|
1256
|
-
}
|
|
1257
|
-
if (streaming?.isActive()) {
|
|
1258
|
-
if (info?.kind === "block") queueStreamingUpdate(text, { mode: "delta" });
|
|
1259
|
-
if (info?.kind === "final") {
|
|
1260
|
-
streamText = mergeStreamingText(streamText, text);
|
|
1261
|
-
await closeStreaming();
|
|
1262
|
-
deliveredFinalTexts.add(text);
|
|
1263
|
-
}
|
|
1264
|
-
if (hasMedia) await sendMediaReplies(payload);
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
if (useCard) {
|
|
1268
|
-
const cardHeader = resolveCardHeader(agentId, identity);
|
|
1269
|
-
const cardNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1270
|
-
await sendChunkedTextReply({
|
|
1271
|
-
text,
|
|
1272
|
-
useCard: true,
|
|
1273
|
-
infoKind: info?.kind,
|
|
1274
|
-
sendChunk: async ({ chunk, isFirst }) => {
|
|
1275
|
-
await sendStructuredCardFeishu({
|
|
1276
|
-
cfg,
|
|
1277
|
-
to: chatId,
|
|
1278
|
-
text: chunk,
|
|
1279
|
-
replyToMessageId: sendReplyToMessageId,
|
|
1280
|
-
replyInThread: effectiveReplyInThread,
|
|
1281
|
-
mentions: isFirst ? mentionTargets : void 0,
|
|
1282
|
-
accountId,
|
|
1283
|
-
header: cardHeader,
|
|
1284
|
-
note: cardNote
|
|
1285
|
-
});
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
} else await sendChunkedTextReply({
|
|
1289
|
-
text,
|
|
1290
|
-
useCard: false,
|
|
1291
|
-
infoKind: info?.kind,
|
|
1292
|
-
sendChunk: async ({ chunk, isFirst }) => {
|
|
1293
|
-
await sendMessageFeishu({
|
|
1294
|
-
cfg,
|
|
1295
|
-
to: chatId,
|
|
1296
|
-
text: chunk,
|
|
1297
|
-
replyToMessageId: sendReplyToMessageId,
|
|
1298
|
-
replyInThread: effectiveReplyInThread,
|
|
1299
|
-
mentions: isFirst ? mentionTargets : void 0,
|
|
1300
|
-
accountId
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
if (hasMedia) await sendMediaReplies(payload);
|
|
1306
|
-
},
|
|
1307
|
-
onError: async (error, info) => {
|
|
1308
|
-
params.runtime.error?.(`feishu[${account.accountId}] ${info.kind} reply failed: ${String(error)}`);
|
|
1309
|
-
await closeStreaming();
|
|
1310
|
-
typingCallbacks?.onIdle?.();
|
|
1311
|
-
},
|
|
1312
|
-
onIdle: async () => {
|
|
1313
|
-
await closeStreaming();
|
|
1314
|
-
typingCallbacks?.onIdle?.();
|
|
1315
|
-
},
|
|
1316
|
-
onCleanup: () => {
|
|
1317
|
-
typingCallbacks?.onCleanup?.();
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
return {
|
|
1321
|
-
dispatcher,
|
|
1322
|
-
replyOptions: {
|
|
1323
|
-
...replyOptions,
|
|
1324
|
-
onModelSelected: prefixContext.onModelSelected,
|
|
1325
|
-
disableBlockStreaming: true,
|
|
1326
|
-
onPartialReply: streamingEnabled ? (payload) => {
|
|
1327
|
-
if (!payload.text) return;
|
|
1328
|
-
queueStreamingUpdate(payload.text, {
|
|
1329
|
-
dedupeWithLastPartial: true,
|
|
1330
|
-
mode: "snapshot"
|
|
1331
|
-
});
|
|
1332
|
-
} : void 0,
|
|
1333
|
-
onReasoningStream: streamingEnabled ? (payload) => {
|
|
1334
|
-
if (!payload.text) return;
|
|
1335
|
-
startStreaming();
|
|
1336
|
-
queueReasoningUpdate(payload.text);
|
|
1337
|
-
} : void 0,
|
|
1338
|
-
onReasoningEnd: streamingEnabled ? () => {} : void 0
|
|
1339
|
-
},
|
|
1340
|
-
markDispatchIdle
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region extensions/feishu/src/bot.ts
|
|
1345
|
-
const permissionErrorNotifiedAt = /* @__PURE__ */ new Map();
|
|
1346
|
-
const PERMISSION_ERROR_COOLDOWN_MS = 300 * 1e3;
|
|
1347
|
-
function resolveBroadcastAgents(cfg, peerId) {
|
|
1348
|
-
const broadcast = cfg.broadcast;
|
|
1349
|
-
if (!broadcast || typeof broadcast !== "object") return null;
|
|
1350
|
-
const agents = broadcast[peerId];
|
|
1351
|
-
if (!Array.isArray(agents) || agents.length === 0) return null;
|
|
1352
|
-
return agents;
|
|
1353
|
-
}
|
|
1354
|
-
function buildBroadcastSessionKey(baseSessionKey, originalAgentId, targetAgentId) {
|
|
1355
|
-
const prefix = `agent:${originalAgentId}:`;
|
|
1356
|
-
if (baseSessionKey.startsWith(prefix)) return `agent:${targetAgentId}:${baseSessionKey.slice(prefix.length)}`;
|
|
1357
|
-
return baseSessionKey;
|
|
1358
|
-
}
|
|
1359
|
-
/**
|
|
1360
|
-
* Build media payload for inbound context.
|
|
1361
|
-
* Similar to Discord's buildDiscordMediaPayload().
|
|
1362
|
-
*/
|
|
1363
|
-
function parseFeishuMessageEvent(event, botOpenId, _botName) {
|
|
1364
|
-
const rawContent = parseMessageContent(event.message.content, event.message.message_type);
|
|
1365
|
-
const mentionedBot = checkBotMentioned(event, botOpenId);
|
|
1366
|
-
const hasAnyMention = (event.message.mentions?.length ?? 0) > 0;
|
|
1367
|
-
const content = normalizeMentions(rawContent, event.message.mentions, botOpenId);
|
|
1368
|
-
const senderOpenId = event.sender.sender_id.open_id?.trim();
|
|
1369
|
-
const senderUserId = event.sender.sender_id.user_id?.trim();
|
|
1370
|
-
const senderFallbackId = senderOpenId || senderUserId || "";
|
|
1371
|
-
const ctx = {
|
|
1372
|
-
chatId: event.message.chat_id,
|
|
1373
|
-
messageId: event.message.message_id,
|
|
1374
|
-
senderId: senderUserId || senderOpenId || "",
|
|
1375
|
-
senderOpenId: senderFallbackId,
|
|
1376
|
-
chatType: event.message.chat_type,
|
|
1377
|
-
mentionedBot,
|
|
1378
|
-
hasAnyMention,
|
|
1379
|
-
rootId: event.message.root_id || void 0,
|
|
1380
|
-
parentId: event.message.parent_id || void 0,
|
|
1381
|
-
threadId: event.message.thread_id || void 0,
|
|
1382
|
-
content,
|
|
1383
|
-
contentType: event.message.message_type
|
|
1384
|
-
};
|
|
1385
|
-
if (isMentionForwardRequest(event, botOpenId)) {
|
|
1386
|
-
const mentionTargets = extractMentionTargets(event, botOpenId);
|
|
1387
|
-
if (mentionTargets.length > 0) ctx.mentionTargets = mentionTargets;
|
|
1388
|
-
}
|
|
1389
|
-
return ctx;
|
|
1390
|
-
}
|
|
1391
|
-
function buildFeishuAgentBody(params) {
|
|
1392
|
-
const { ctx, quotedContent, permissionErrorForAgent, botOpenId } = params;
|
|
1393
|
-
let messageBody = ctx.content;
|
|
1394
|
-
if (quotedContent) messageBody = `[Replying to: "${quotedContent}"]\n\n${ctx.content}`;
|
|
1395
|
-
messageBody = `${ctx.senderName ?? ctx.senderOpenId}: ${messageBody}`;
|
|
1396
|
-
if (ctx.hasAnyMention) {
|
|
1397
|
-
const botIdHint = botOpenId?.trim();
|
|
1398
|
-
messageBody += "\n\n[System: The content may include mention tags in the form <at user_id=\"...\">name</at>. Treat these as real mentions of Feishu entities (users or bots).]";
|
|
1399
|
-
if (botIdHint) messageBody += `\n[System: If user_id is "${botIdHint}", that mention refers to you.]`;
|
|
1400
|
-
}
|
|
1401
|
-
if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
|
|
1402
|
-
const targetNames = ctx.mentionTargets.map((t) => t.name).join(", ");
|
|
1403
|
-
messageBody += `\n\n[System: Your reply will automatically @mention: ${targetNames}. Do not write @xxx yourself.]`;
|
|
1404
|
-
}
|
|
1405
|
-
messageBody = `[message_id: ${ctx.messageId}]\n${messageBody}`;
|
|
1406
|
-
if (permissionErrorForAgent) {
|
|
1407
|
-
const grantUrl = permissionErrorForAgent.grantUrl ?? "";
|
|
1408
|
-
messageBody += `\n\n[System: The bot encountered a Feishu API permission error. Please inform the user about this issue and provide the permission grant URL for the admin to authorize. Permission grant URL: ${grantUrl}]`;
|
|
1409
|
-
}
|
|
1410
|
-
return messageBody;
|
|
1411
|
-
}
|
|
1412
|
-
function isFetchedGroupContextSenderAllowed(params) {
|
|
1413
|
-
if (!params.isGroup || params.allowFrom.length === 0) return true;
|
|
1414
|
-
if (params.senderType === "app") return true;
|
|
1415
|
-
const senderId = params.senderId?.trim();
|
|
1416
|
-
return !!senderId && isFeishuGroupAllowed({
|
|
1417
|
-
groupPolicy: "allowlist",
|
|
1418
|
-
allowFrom: params.allowFrom,
|
|
1419
|
-
senderId,
|
|
1420
|
-
senderName: void 0
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
function shouldIncludeFetchedGroupContextMessage(params) {
|
|
1424
|
-
const senderAllowed = isFetchedGroupContextSenderAllowed({
|
|
1425
|
-
isGroup: params.isGroup,
|
|
1426
|
-
allowFrom: params.allowFrom,
|
|
1427
|
-
senderId: params.senderId,
|
|
1428
|
-
senderType: params.senderType
|
|
1429
|
-
});
|
|
1430
|
-
return evaluateSupplementalContextVisibility({
|
|
1431
|
-
mode: params.mode,
|
|
1432
|
-
kind: params.kind,
|
|
1433
|
-
senderAllowed
|
|
1434
|
-
}).include;
|
|
1435
|
-
}
|
|
1436
|
-
function filterFetchedGroupContextMessages(messages, params) {
|
|
1437
|
-
return filterSupplementalContextItems({
|
|
1438
|
-
items: messages,
|
|
1439
|
-
mode: params.mode,
|
|
1440
|
-
kind: params.kind,
|
|
1441
|
-
isSenderAllowed: (message) => isFetchedGroupContextSenderAllowed({
|
|
1442
|
-
isGroup: params.isGroup,
|
|
1443
|
-
allowFrom: params.allowFrom,
|
|
1444
|
-
senderId: message.senderId,
|
|
1445
|
-
senderType: message.senderType
|
|
1446
|
-
})
|
|
1447
|
-
}).items;
|
|
1448
|
-
}
|
|
1449
|
-
async function handleFeishuMessage(params) {
|
|
1450
|
-
const { cfg, event, botOpenId, botName, runtime, chatHistories, accountId, processingClaimHeld = false } = params;
|
|
1451
|
-
const account = resolveFeishuRuntimeAccount({
|
|
1452
|
-
cfg,
|
|
1453
|
-
accountId
|
|
1454
|
-
});
|
|
1455
|
-
const feishuCfg = account.config;
|
|
1456
|
-
const log = runtime?.log ?? console.log;
|
|
1457
|
-
const error = runtime?.error ?? console.error;
|
|
1458
|
-
const messageId = event.message.message_id;
|
|
1459
|
-
if (!await finalizeFeishuMessageProcessing({
|
|
1460
|
-
messageId,
|
|
1461
|
-
namespace: account.accountId,
|
|
1462
|
-
log,
|
|
1463
|
-
claimHeld: processingClaimHeld
|
|
1464
|
-
})) {
|
|
1465
|
-
log(`feishu: skipping duplicate message ${messageId}`);
|
|
1466
|
-
return;
|
|
1467
|
-
}
|
|
1468
|
-
let ctx = parseFeishuMessageEvent(event, botOpenId, botName);
|
|
1469
|
-
const isGroup = ctx.chatType === "group";
|
|
1470
|
-
const isDirect = !isGroup;
|
|
1471
|
-
const senderUserId = event.sender.sender_id.user_id?.trim() || void 0;
|
|
1472
|
-
if (event.message.message_type === "merge_forward") {
|
|
1473
|
-
log(`feishu[${account.accountId}]: processing merge_forward message, fetching full content via API`);
|
|
1474
|
-
try {
|
|
1475
|
-
const response = await createFeishuClient(account).im.message.get({ path: { message_id: event.message.message_id } });
|
|
1476
|
-
if (response.code === 0 && response.data?.items && response.data.items.length > 0) {
|
|
1477
|
-
log(`feishu[${account.accountId}]: merge_forward API returned ${response.data.items.length} items`);
|
|
1478
|
-
const expandedContent = parseMergeForwardContent({
|
|
1479
|
-
content: JSON.stringify(response.data.items),
|
|
1480
|
-
log
|
|
1481
|
-
});
|
|
1482
|
-
ctx = {
|
|
1483
|
-
...ctx,
|
|
1484
|
-
content: expandedContent
|
|
1485
|
-
};
|
|
1486
|
-
} else {
|
|
1487
|
-
log(`feishu[${account.accountId}]: merge_forward API returned no items`);
|
|
1488
|
-
ctx = {
|
|
1489
|
-
...ctx,
|
|
1490
|
-
content: "[Merged and Forwarded Message - could not fetch]"
|
|
1491
|
-
};
|
|
1492
|
-
}
|
|
1493
|
-
} catch (err) {
|
|
1494
|
-
log(`feishu[${account.accountId}]: merge_forward fetch failed: ${String(err)}`);
|
|
1495
|
-
ctx = {
|
|
1496
|
-
...ctx,
|
|
1497
|
-
content: "[Merged and Forwarded Message - fetch error]"
|
|
1498
|
-
};
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
let permissionErrorForAgent;
|
|
1502
|
-
if (feishuCfg?.resolveSenderNames ?? true) {
|
|
1503
|
-
const senderResult = await resolveFeishuSenderName({
|
|
1504
|
-
account,
|
|
1505
|
-
senderId: ctx.senderOpenId,
|
|
1506
|
-
log
|
|
1507
|
-
});
|
|
1508
|
-
if (senderResult.name) ctx = {
|
|
1509
|
-
...ctx,
|
|
1510
|
-
senderName: senderResult.name
|
|
1511
|
-
};
|
|
1512
|
-
if (senderResult.permissionError) {
|
|
1513
|
-
const appKey = account.appId ?? "default";
|
|
1514
|
-
const now = Date.now();
|
|
1515
|
-
if (now - (permissionErrorNotifiedAt.get(appKey) ?? 0) > PERMISSION_ERROR_COOLDOWN_MS) {
|
|
1516
|
-
permissionErrorNotifiedAt.set(appKey, now);
|
|
1517
|
-
permissionErrorForAgent = senderResult.permissionError;
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
log(`feishu[${account.accountId}]: received message from ${ctx.senderOpenId} in ${ctx.chatId} (${ctx.chatType})`);
|
|
1522
|
-
if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
|
|
1523
|
-
const names = ctx.mentionTargets.map((t) => t.name).join(", ");
|
|
1524
|
-
log(`feishu[${account.accountId}]: detected @ forward request, targets: [${names}]`);
|
|
1525
|
-
}
|
|
1526
|
-
const historyLimit = Math.max(0, feishuCfg?.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? 50);
|
|
1527
|
-
const groupConfig = isGroup ? resolveFeishuGroupConfig({
|
|
1528
|
-
cfg: feishuCfg,
|
|
1529
|
-
groupId: ctx.chatId
|
|
1530
|
-
}) : void 0;
|
|
1531
|
-
const effectiveGroupSenderAllowFrom = isGroup ? (groupConfig?.allowFrom?.length ?? 0) > 0 ? groupConfig?.allowFrom ?? [] : feishuCfg?.groupSenderAllowFrom ?? [] : [];
|
|
1532
|
-
const groupSession = isGroup ? resolveFeishuGroupSession({
|
|
1533
|
-
chatId: ctx.chatId,
|
|
1534
|
-
senderOpenId: ctx.senderOpenId,
|
|
1535
|
-
messageId: ctx.messageId,
|
|
1536
|
-
rootId: ctx.rootId,
|
|
1537
|
-
threadId: ctx.threadId,
|
|
1538
|
-
groupConfig,
|
|
1539
|
-
feishuCfg
|
|
1540
|
-
}) : null;
|
|
1541
|
-
const groupHistoryKey = isGroup ? groupSession?.peerId ?? ctx.chatId : void 0;
|
|
1542
|
-
const dmPolicy = feishuCfg?.dmPolicy ?? "pairing";
|
|
1543
|
-
const configAllowFrom = feishuCfg?.allowFrom ?? [];
|
|
1544
|
-
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
1545
|
-
const rawBroadcastAgents = isGroup ? resolveBroadcastAgents(cfg, ctx.chatId) : null;
|
|
1546
|
-
const broadcastAgents = rawBroadcastAgents ? [...new Set(rawBroadcastAgents.map((id) => normalizeAgentId(id)))] : null;
|
|
1547
|
-
const messageCreateTimeMs = event.message.create_time ? parseInt(event.message.create_time, 10) : Date.now();
|
|
1548
|
-
let requireMention = false;
|
|
1549
|
-
if (isGroup) {
|
|
1550
|
-
if (groupConfig?.enabled === false) {
|
|
1551
|
-
log(`feishu[${account.accountId}]: group ${ctx.chatId} is disabled`);
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
1555
|
-
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
|
|
1556
|
-
providerConfigPresent: cfg.channels?.feishu !== void 0,
|
|
1557
|
-
groupPolicy: feishuCfg?.groupPolicy,
|
|
1558
|
-
defaultGroupPolicy
|
|
1559
|
-
});
|
|
1560
|
-
warnMissingProviderGroupPolicyFallbackOnce({
|
|
1561
|
-
providerMissingFallbackApplied,
|
|
1562
|
-
providerKey: "feishu",
|
|
1563
|
-
accountId: account.accountId,
|
|
1564
|
-
log
|
|
1565
|
-
});
|
|
1566
|
-
if (!isFeishuGroupAllowed({
|
|
1567
|
-
groupPolicy,
|
|
1568
|
-
allowFrom: feishuCfg?.groupAllowFrom ?? [],
|
|
1569
|
-
senderId: ctx.chatId,
|
|
1570
|
-
senderName: void 0
|
|
1571
|
-
})) {
|
|
1572
|
-
log(`feishu[${account.accountId}]: group ${ctx.chatId} not in groupAllowFrom (groupPolicy=${groupPolicy})`);
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
if (effectiveGroupSenderAllowFrom.length > 0) {
|
|
1576
|
-
if (!isFeishuGroupAllowed({
|
|
1577
|
-
groupPolicy: "allowlist",
|
|
1578
|
-
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1579
|
-
senderId: ctx.senderOpenId,
|
|
1580
|
-
senderIds: [senderUserId],
|
|
1581
|
-
senderName: ctx.senderName
|
|
1582
|
-
})) {
|
|
1583
|
-
log(`feishu: sender ${ctx.senderOpenId} not in group ${ctx.chatId} sender allowlist`);
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
({requireMention} = resolveFeishuReplyPolicy({
|
|
1588
|
-
isDirectMessage: false,
|
|
1589
|
-
cfg,
|
|
1590
|
-
accountId: account.accountId,
|
|
1591
|
-
groupId: ctx.chatId,
|
|
1592
|
-
groupPolicy
|
|
1593
|
-
}));
|
|
1594
|
-
if (requireMention && !ctx.mentionedBot) {
|
|
1595
|
-
log(`feishu[${account.accountId}]: message in group ${ctx.chatId} did not mention bot`);
|
|
1596
|
-
if (!broadcastAgents && chatHistories && groupHistoryKey) recordPendingHistoryEntryIfEnabled({
|
|
1597
|
-
historyMap: chatHistories,
|
|
1598
|
-
historyKey: groupHistoryKey,
|
|
1599
|
-
limit: historyLimit,
|
|
1600
|
-
entry: {
|
|
1601
|
-
sender: ctx.senderOpenId,
|
|
1602
|
-
body: `${ctx.senderName ?? ctx.senderOpenId}: ${ctx.content}`,
|
|
1603
|
-
timestamp: messageCreateTimeMs,
|
|
1604
|
-
messageId: ctx.messageId
|
|
1605
|
-
}
|
|
1606
|
-
});
|
|
1607
|
-
return;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
try {
|
|
1611
|
-
const core = getFeishuRuntime();
|
|
1612
|
-
const pairing = createChannelPairingController({
|
|
1613
|
-
core,
|
|
1614
|
-
channel: "feishu",
|
|
1615
|
-
accountId: account.accountId
|
|
1616
|
-
});
|
|
1617
|
-
const commandProbeBody = isGroup ? normalizeFeishuCommandProbeBody(ctx.content) : ctx.content;
|
|
1618
|
-
const shouldComputeCommandAuthorized = core.channel.commands.shouldComputeCommandAuthorized(commandProbeBody, cfg);
|
|
1619
|
-
const storeAllowFrom = !isGroup && dmPolicy !== "allowlist" && (dmPolicy !== "open" || shouldComputeCommandAuthorized) ? await pairing.readAllowFromStore().catch(() => []) : [];
|
|
1620
|
-
const effectiveDmAllowFrom = [...configAllowFrom, ...storeAllowFrom];
|
|
1621
|
-
const dmAllowed = resolveFeishuAllowlistMatch({
|
|
1622
|
-
allowFrom: effectiveDmAllowFrom,
|
|
1623
|
-
senderId: ctx.senderOpenId,
|
|
1624
|
-
senderIds: [senderUserId],
|
|
1625
|
-
senderName: ctx.senderName
|
|
1626
|
-
}).allowed;
|
|
1627
|
-
if (isDirect && dmPolicy !== "open" && !dmAllowed) {
|
|
1628
|
-
if (dmPolicy === "pairing") await pairing.issueChallenge({
|
|
1629
|
-
senderId: ctx.senderOpenId,
|
|
1630
|
-
senderIdLine: `Your Feishu user id: ${ctx.senderOpenId}`,
|
|
1631
|
-
meta: { name: ctx.senderName },
|
|
1632
|
-
onCreated: () => {
|
|
1633
|
-
log(`feishu[${account.accountId}]: pairing request sender=${ctx.senderOpenId}`);
|
|
1634
|
-
},
|
|
1635
|
-
sendPairingReply: async (text) => {
|
|
1636
|
-
await sendMessageFeishu({
|
|
1637
|
-
cfg,
|
|
1638
|
-
to: `chat:${ctx.chatId}`,
|
|
1639
|
-
text,
|
|
1640
|
-
accountId: account.accountId
|
|
1641
|
-
});
|
|
1642
|
-
},
|
|
1643
|
-
onReplyError: (err) => {
|
|
1644
|
-
log(`feishu[${account.accountId}]: pairing reply failed for ${ctx.senderOpenId}: ${String(err)}`);
|
|
1645
|
-
}
|
|
1646
|
-
});
|
|
1647
|
-
else log(`feishu[${account.accountId}]: blocked unauthorized sender ${ctx.senderOpenId} (dmPolicy=${dmPolicy})`);
|
|
1648
|
-
return;
|
|
1649
|
-
}
|
|
1650
|
-
const commandAllowFrom = isGroup ? groupConfig?.allowFrom ?? configAllowFrom : effectiveDmAllowFrom;
|
|
1651
|
-
const senderAllowedForCommands = resolveFeishuAllowlistMatch({
|
|
1652
|
-
allowFrom: commandAllowFrom,
|
|
1653
|
-
senderId: ctx.senderOpenId,
|
|
1654
|
-
senderIds: [senderUserId],
|
|
1655
|
-
senderName: ctx.senderName
|
|
1656
|
-
}).allowed;
|
|
1657
|
-
const commandAuthorized = shouldComputeCommandAuthorized ? core.channel.commands.resolveCommandAuthorizedFromAuthorizers({
|
|
1658
|
-
useAccessGroups,
|
|
1659
|
-
authorizers: [{
|
|
1660
|
-
configured: commandAllowFrom.length > 0,
|
|
1661
|
-
allowed: senderAllowedForCommands
|
|
1662
|
-
}]
|
|
1663
|
-
}) : void 0;
|
|
1664
|
-
const feishuFrom = `feishu:${ctx.senderOpenId}`;
|
|
1665
|
-
const feishuTo = isGroup ? `chat:${ctx.chatId}` : `user:${ctx.senderOpenId}`;
|
|
1666
|
-
const peerId = isGroup ? groupSession?.peerId ?? ctx.chatId : ctx.senderOpenId;
|
|
1667
|
-
const parentPeer = isGroup ? groupSession?.parentPeer ?? null : null;
|
|
1668
|
-
const replyInThread = isGroup ? groupSession?.replyInThread ?? false : false;
|
|
1669
|
-
const feishuAcpConversationSupported = !isGroup || groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender";
|
|
1670
|
-
if (isGroup && groupSession) log(`feishu[${account.accountId}]: group session scope=${groupSession.groupSessionScope}, peer=${peerId}`);
|
|
1671
|
-
let route = core.channel.routing.resolveAgentRoute({
|
|
1672
|
-
cfg,
|
|
1673
|
-
channel: "feishu",
|
|
1674
|
-
accountId: account.accountId,
|
|
1675
|
-
peer: {
|
|
1676
|
-
kind: isGroup ? "group" : "direct",
|
|
1677
|
-
id: peerId
|
|
1678
|
-
},
|
|
1679
|
-
parentPeer
|
|
1680
|
-
});
|
|
1681
|
-
let effectiveCfg = cfg;
|
|
1682
|
-
if (!isGroup && route.matchedBy === "default") {
|
|
1683
|
-
const dynamicCfg = feishuCfg?.dynamicAgentCreation;
|
|
1684
|
-
if (dynamicCfg?.enabled) {
|
|
1685
|
-
const result = await maybeCreateDynamicAgent({
|
|
1686
|
-
cfg,
|
|
1687
|
-
runtime: getFeishuRuntime(),
|
|
1688
|
-
senderOpenId: ctx.senderOpenId,
|
|
1689
|
-
dynamicCfg,
|
|
1690
|
-
log: (msg) => log(msg)
|
|
1691
|
-
});
|
|
1692
|
-
if (result.created) {
|
|
1693
|
-
effectiveCfg = result.updatedCfg;
|
|
1694
|
-
route = core.channel.routing.resolveAgentRoute({
|
|
1695
|
-
cfg: result.updatedCfg,
|
|
1696
|
-
channel: "feishu",
|
|
1697
|
-
accountId: account.accountId,
|
|
1698
|
-
peer: {
|
|
1699
|
-
kind: "direct",
|
|
1700
|
-
id: ctx.senderOpenId
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
log(`feishu[${account.accountId}]: dynamic agent created, new route: ${route.sessionKey}`);
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
const currentConversationId = peerId;
|
|
1708
|
-
const parentConversationId = isGroup ? parentPeer?.id ?? ctx.chatId : void 0;
|
|
1709
|
-
let configuredBinding = null;
|
|
1710
|
-
if (feishuAcpConversationSupported) {
|
|
1711
|
-
const configuredRoute = resolveConfiguredBindingRoute({
|
|
1712
|
-
cfg: effectiveCfg,
|
|
1713
|
-
route,
|
|
1714
|
-
conversation: {
|
|
1715
|
-
channel: "feishu",
|
|
1716
|
-
accountId: account.accountId,
|
|
1717
|
-
conversationId: currentConversationId,
|
|
1718
|
-
parentConversationId
|
|
1719
|
-
}
|
|
1720
|
-
});
|
|
1721
|
-
configuredBinding = configuredRoute.bindingResolution;
|
|
1722
|
-
route = configuredRoute.route;
|
|
1723
|
-
const threadBinding = getSessionBindingService().resolveByConversation({
|
|
1724
|
-
channel: "feishu",
|
|
1725
|
-
accountId: account.accountId,
|
|
1726
|
-
conversationId: currentConversationId,
|
|
1727
|
-
...parentConversationId ? { parentConversationId } : {}
|
|
1728
|
-
});
|
|
1729
|
-
const boundSessionKey = threadBinding?.targetSessionKey?.trim();
|
|
1730
|
-
if (threadBinding && boundSessionKey) {
|
|
1731
|
-
route = {
|
|
1732
|
-
...route,
|
|
1733
|
-
sessionKey: boundSessionKey,
|
|
1734
|
-
agentId: resolveAgentIdFromSessionKey(boundSessionKey) || route.agentId,
|
|
1735
|
-
lastRoutePolicy: deriveLastRoutePolicy({
|
|
1736
|
-
sessionKey: boundSessionKey,
|
|
1737
|
-
mainSessionKey: route.mainSessionKey
|
|
1738
|
-
}),
|
|
1739
|
-
matchedBy: "binding.channel"
|
|
1740
|
-
};
|
|
1741
|
-
configuredBinding = null;
|
|
1742
|
-
getSessionBindingService().touch(threadBinding.bindingId);
|
|
1743
|
-
log(`feishu[${account.accountId}]: routed via bound conversation ${currentConversationId} -> ${boundSessionKey}`);
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
if (configuredBinding) {
|
|
1747
|
-
const ensured = await ensureConfiguredBindingRouteReady({
|
|
1748
|
-
cfg: effectiveCfg,
|
|
1749
|
-
bindingResolution: configuredBinding
|
|
1750
|
-
});
|
|
1751
|
-
if (!ensured.ok) {
|
|
1752
|
-
const replyTargetMessageId = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender") ? ctx.rootId ?? ctx.messageId : ctx.messageId;
|
|
1753
|
-
await sendMessageFeishu({
|
|
1754
|
-
cfg: effectiveCfg,
|
|
1755
|
-
to: `chat:${ctx.chatId}`,
|
|
1756
|
-
text: `⚠️ Failed to initialize the configured ACP session for this Feishu conversation: ${ensured.error}`,
|
|
1757
|
-
replyToMessageId: replyTargetMessageId,
|
|
1758
|
-
replyInThread: isGroup ? groupSession?.replyInThread ?? false : false,
|
|
1759
|
-
accountId: account.accountId
|
|
1760
|
-
}).catch((err) => {
|
|
1761
|
-
log(`feishu[${account.accountId}]: failed to send ACP init error reply: ${String(err)}`);
|
|
1762
|
-
});
|
|
1763
|
-
return;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
const preview = ctx.content.replace(/\s+/g, " ").slice(0, 160);
|
|
1767
|
-
const inboundLabel = isGroup ? `Feishu[${account.accountId}] message in group ${ctx.chatId}` : `Feishu[${account.accountId}] DM from ${ctx.senderOpenId}`;
|
|
1768
|
-
const contextVisibilityMode = resolveChannelContextVisibilityMode({
|
|
1769
|
-
cfg: effectiveCfg,
|
|
1770
|
-
channel: "feishu",
|
|
1771
|
-
accountId: account.accountId
|
|
1772
|
-
});
|
|
1773
|
-
log(`feishu[${account.accountId}]: ${inboundLabel}: ${preview}`);
|
|
1774
|
-
const mediaMaxBytes = (feishuCfg?.mediaMaxMb ?? 30) * 1024 * 1024;
|
|
1775
|
-
const mediaPayload = buildAgentMediaPayload(await resolveFeishuMediaList({
|
|
1776
|
-
cfg,
|
|
1777
|
-
messageId: ctx.messageId,
|
|
1778
|
-
messageType: event.message.message_type,
|
|
1779
|
-
content: event.message.content,
|
|
1780
|
-
maxBytes: mediaMaxBytes,
|
|
1781
|
-
log,
|
|
1782
|
-
accountId: account.accountId
|
|
1783
|
-
}));
|
|
1784
|
-
let quotedMessageInfo = null;
|
|
1785
|
-
let quotedContent;
|
|
1786
|
-
if (ctx.parentId) try {
|
|
1787
|
-
quotedMessageInfo = await getMessageFeishu({
|
|
1788
|
-
cfg,
|
|
1789
|
-
messageId: ctx.parentId,
|
|
1790
|
-
accountId: account.accountId
|
|
1791
|
-
});
|
|
1792
|
-
if (quotedMessageInfo && shouldIncludeFetchedGroupContextMessage({
|
|
1793
|
-
isGroup,
|
|
1794
|
-
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1795
|
-
mode: contextVisibilityMode,
|
|
1796
|
-
kind: "quote",
|
|
1797
|
-
senderId: quotedMessageInfo.senderId,
|
|
1798
|
-
senderType: quotedMessageInfo.senderType
|
|
1799
|
-
})) {
|
|
1800
|
-
quotedContent = quotedMessageInfo.content;
|
|
1801
|
-
log(`feishu[${account.accountId}]: fetched quoted message: ${quotedContent?.slice(0, 100)}`);
|
|
1802
|
-
} else if (quotedMessageInfo) log(`feishu[${account.accountId}]: skipped quoted message from sender ${quotedMessageInfo.senderId ?? "unknown"} (mode=${contextVisibilityMode})`);
|
|
1803
|
-
} catch (err) {
|
|
1804
|
-
log(`feishu[${account.accountId}]: failed to fetch quoted message: ${String(err)}`);
|
|
1805
|
-
}
|
|
1806
|
-
const isTopicSessionForThread = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender");
|
|
1807
|
-
const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
|
|
1808
|
-
const messageBody = buildFeishuAgentBody({
|
|
1809
|
-
ctx,
|
|
1810
|
-
quotedContent,
|
|
1811
|
-
permissionErrorForAgent,
|
|
1812
|
-
botOpenId
|
|
1813
|
-
});
|
|
1814
|
-
const envelopeFrom = isGroup ? `${ctx.chatId}:${ctx.senderOpenId}` : ctx.senderOpenId;
|
|
1815
|
-
if (permissionErrorForAgent) log(`feishu[${account.accountId}]: appending permission error notice to message body`);
|
|
1816
|
-
let combinedBody = core.channel.reply.formatAgentEnvelope({
|
|
1817
|
-
channel: "Feishu",
|
|
1818
|
-
from: envelopeFrom,
|
|
1819
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
1820
|
-
envelope: envelopeOptions,
|
|
1821
|
-
body: messageBody
|
|
1822
|
-
});
|
|
1823
|
-
const historyKey = groupHistoryKey;
|
|
1824
|
-
if (isGroup && historyKey && chatHistories) combinedBody = buildPendingHistoryContextFromMap({
|
|
1825
|
-
historyMap: chatHistories,
|
|
1826
|
-
historyKey,
|
|
1827
|
-
limit: historyLimit,
|
|
1828
|
-
currentMessage: combinedBody,
|
|
1829
|
-
formatEntry: (entry) => core.channel.reply.formatAgentEnvelope({
|
|
1830
|
-
channel: "Feishu",
|
|
1831
|
-
from: `${ctx.chatId}:${entry.sender}`,
|
|
1832
|
-
timestamp: entry.timestamp,
|
|
1833
|
-
body: entry.body,
|
|
1834
|
-
envelope: envelopeOptions
|
|
1835
|
-
})
|
|
1836
|
-
});
|
|
1837
|
-
const inboundHistory = isGroup && historyKey && historyLimit > 0 && chatHistories ? (chatHistories.get(historyKey) ?? []).map((entry) => ({
|
|
1838
|
-
sender: entry.sender,
|
|
1839
|
-
body: entry.body,
|
|
1840
|
-
timestamp: entry.timestamp
|
|
1841
|
-
})) : void 0;
|
|
1842
|
-
const threadContextBySessionKey = /* @__PURE__ */ new Map();
|
|
1843
|
-
let rootMessageInfo;
|
|
1844
|
-
let rootMessageThreadId;
|
|
1845
|
-
let rootMessageFetched = false;
|
|
1846
|
-
const getRootMessageInfo = async () => {
|
|
1847
|
-
if (!ctx.rootId) return null;
|
|
1848
|
-
if (!rootMessageFetched) {
|
|
1849
|
-
rootMessageFetched = true;
|
|
1850
|
-
if (ctx.rootId === ctx.parentId && quotedMessageInfo) rootMessageInfo = quotedMessageInfo;
|
|
1851
|
-
else try {
|
|
1852
|
-
rootMessageInfo = await getMessageFeishu({
|
|
1853
|
-
cfg,
|
|
1854
|
-
messageId: ctx.rootId,
|
|
1855
|
-
accountId: account.accountId
|
|
1856
|
-
});
|
|
1857
|
-
} catch (err) {
|
|
1858
|
-
log(`feishu[${account.accountId}]: failed to fetch root message: ${String(err)}`);
|
|
1859
|
-
rootMessageInfo = null;
|
|
1860
|
-
}
|
|
1861
|
-
rootMessageThreadId = rootMessageInfo?.threadId;
|
|
1862
|
-
if (rootMessageInfo && !shouldIncludeFetchedGroupContextMessage({
|
|
1863
|
-
isGroup,
|
|
1864
|
-
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1865
|
-
mode: contextVisibilityMode,
|
|
1866
|
-
kind: "thread",
|
|
1867
|
-
senderId: rootMessageInfo.senderId,
|
|
1868
|
-
senderType: rootMessageInfo.senderType
|
|
1869
|
-
})) {
|
|
1870
|
-
log(`feishu[${account.accountId}]: skipped thread starter from sender ${rootMessageInfo.senderId ?? "unknown"} (mode=${contextVisibilityMode})`);
|
|
1871
|
-
rootMessageInfo = null;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
return rootMessageInfo ?? null;
|
|
1875
|
-
};
|
|
1876
|
-
const resolveThreadContextForAgent = async (agentId, agentSessionKey) => {
|
|
1877
|
-
const cached = threadContextBySessionKey.get(agentSessionKey);
|
|
1878
|
-
if (cached) return cached;
|
|
1879
|
-
const threadContext = { threadLabel: (ctx.rootId || ctx.threadId) && isTopicSessionForThread ? `Feishu thread in ${ctx.chatId}` : void 0 };
|
|
1880
|
-
if (!(ctx.rootId || ctx.threadId) || !isTopicSessionForThread) {
|
|
1881
|
-
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1882
|
-
return threadContext;
|
|
1883
|
-
}
|
|
1884
|
-
const storePath = core.channel.session.resolveStorePath(cfg.session?.store, { agentId });
|
|
1885
|
-
if (core.channel.session.readSessionUpdatedAt({
|
|
1886
|
-
storePath,
|
|
1887
|
-
sessionKey: agentSessionKey
|
|
1888
|
-
})) {
|
|
1889
|
-
log(`feishu[${account.accountId}]: skipping thread bootstrap for existing session ${agentSessionKey}`);
|
|
1890
|
-
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1891
|
-
return threadContext;
|
|
1892
|
-
}
|
|
1893
|
-
const rootMsg = await getRootMessageInfo();
|
|
1894
|
-
let feishuThreadId = ctx.threadId ?? rootMessageThreadId ?? rootMsg?.threadId;
|
|
1895
|
-
if (feishuThreadId) log(`feishu[${account.accountId}]: resolved thread ID: ${feishuThreadId}`);
|
|
1896
|
-
if (!feishuThreadId) {
|
|
1897
|
-
log(`feishu[${account.accountId}]: no threadId found for root message ${ctx.rootId ?? "none"}, skipping thread history`);
|
|
1898
|
-
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1899
|
-
return threadContext;
|
|
1900
|
-
}
|
|
1901
|
-
try {
|
|
1902
|
-
const threadMessages = await listFeishuThreadMessages({
|
|
1903
|
-
cfg,
|
|
1904
|
-
threadId: feishuThreadId,
|
|
1905
|
-
currentMessageId: ctx.messageId,
|
|
1906
|
-
rootMessageId: ctx.rootId,
|
|
1907
|
-
limit: 20,
|
|
1908
|
-
accountId: account.accountId
|
|
1909
|
-
});
|
|
1910
|
-
const senderScoped = groupSession?.groupSessionScope === "group_topic_sender";
|
|
1911
|
-
const senderIds = new Set([ctx.senderOpenId, senderUserId].map((id) => id?.trim()).filter((id) => id !== void 0 && id.length > 0));
|
|
1912
|
-
const allowlistedMessages = filterFetchedGroupContextMessages(threadMessages, {
|
|
1913
|
-
isGroup,
|
|
1914
|
-
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1915
|
-
mode: contextVisibilityMode,
|
|
1916
|
-
kind: "history"
|
|
1917
|
-
});
|
|
1918
|
-
const relevantMessages = (senderScoped ? allowlistedMessages.filter((msg) => msg.senderType === "app" || msg.senderId !== void 0 && senderIds.has(msg.senderId.trim())) : allowlistedMessages) ?? [];
|
|
1919
|
-
const threadStarterBody = rootMsg?.content ?? relevantMessages[0]?.content;
|
|
1920
|
-
const historyMessages = Boolean(rootMsg?.content || ctx.rootId) ? relevantMessages : relevantMessages.slice(1);
|
|
1921
|
-
const historyParts = historyMessages.map((msg) => {
|
|
1922
|
-
const role = msg.senderType === "app" ? "assistant" : "user";
|
|
1923
|
-
return core.channel.reply.formatAgentEnvelope({
|
|
1924
|
-
channel: "Feishu",
|
|
1925
|
-
from: `${msg.senderId ?? "Unknown"} (${role})`,
|
|
1926
|
-
timestamp: msg.createTime,
|
|
1927
|
-
body: msg.content,
|
|
1928
|
-
envelope: envelopeOptions
|
|
1929
|
-
});
|
|
1930
|
-
});
|
|
1931
|
-
threadContext.threadStarterBody = threadStarterBody;
|
|
1932
|
-
threadContext.threadHistoryBody = historyParts.length > 0 ? historyParts.join("\n\n") : void 0;
|
|
1933
|
-
log(`feishu[${account.accountId}]: populated thread bootstrap with starter=${threadStarterBody ? "yes" : "no"} history=${historyMessages.length}`);
|
|
1934
|
-
} catch (err) {
|
|
1935
|
-
log(`feishu[${account.accountId}]: failed to fetch thread history: ${String(err)}`);
|
|
1936
|
-
}
|
|
1937
|
-
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1938
|
-
return threadContext;
|
|
1939
|
-
};
|
|
1940
|
-
const buildCtxPayloadForAgent = async (agentId, agentSessionKey, agentAccountId, wasMentioned) => {
|
|
1941
|
-
const threadContext = await resolveThreadContextForAgent(agentId, agentSessionKey);
|
|
1942
|
-
return core.channel.reply.finalizeInboundContext({
|
|
1943
|
-
Body: combinedBody,
|
|
1944
|
-
BodyForAgent: messageBody,
|
|
1945
|
-
InboundHistory: inboundHistory,
|
|
1946
|
-
ReplyToId: ctx.parentId,
|
|
1947
|
-
RootMessageId: ctx.rootId,
|
|
1948
|
-
RawBody: ctx.content,
|
|
1949
|
-
CommandBody: ctx.content,
|
|
1950
|
-
From: feishuFrom,
|
|
1951
|
-
To: feishuTo,
|
|
1952
|
-
SessionKey: agentSessionKey,
|
|
1953
|
-
AccountId: agentAccountId,
|
|
1954
|
-
ChatType: isGroup ? "group" : "direct",
|
|
1955
|
-
GroupSubject: isGroup ? ctx.chatId : void 0,
|
|
1956
|
-
SenderName: ctx.senderName ?? ctx.senderOpenId,
|
|
1957
|
-
SenderId: ctx.senderOpenId,
|
|
1958
|
-
Provider: "feishu",
|
|
1959
|
-
Surface: "feishu",
|
|
1960
|
-
MessageSid: ctx.messageId,
|
|
1961
|
-
ReplyToBody: quotedContent ?? void 0,
|
|
1962
|
-
ThreadStarterBody: threadContext.threadStarterBody,
|
|
1963
|
-
ThreadHistoryBody: threadContext.threadHistoryBody,
|
|
1964
|
-
ThreadLabel: threadContext.threadLabel,
|
|
1965
|
-
MessageThreadId: ctx.rootId && isTopicSessionForThread ? ctx.rootId : void 0,
|
|
1966
|
-
Timestamp: messageCreateTimeMs,
|
|
1967
|
-
WasMentioned: wasMentioned,
|
|
1968
|
-
CommandAuthorized: commandAuthorized,
|
|
1969
|
-
OriginatingChannel: "feishu",
|
|
1970
|
-
OriginatingTo: feishuTo,
|
|
1971
|
-
GroupSystemPrompt: isGroup ? groupConfig?.systemPrompt?.trim() || void 0 : void 0,
|
|
1972
|
-
...mediaPayload
|
|
1973
|
-
});
|
|
1974
|
-
};
|
|
1975
|
-
const isTopicSession = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender");
|
|
1976
|
-
const configReplyInThread = isGroup && (groupConfig?.replyInThread ?? feishuCfg?.replyInThread ?? "disabled") === "enabled";
|
|
1977
|
-
const replyTargetMessageId = isTopicSession || configReplyInThread ? ctx.rootId ?? ctx.messageId : ctx.messageId;
|
|
1978
|
-
const threadReply = isGroup ? groupSession?.threadReply ?? false : false;
|
|
1979
|
-
if (broadcastAgents) {
|
|
1980
|
-
if (!await tryRecordMessagePersistent(ctx.messageId, "broadcast", log)) {
|
|
1981
|
-
log(`feishu[${account.accountId}]: broadcast already claimed by another account for message ${ctx.messageId}; skipping`);
|
|
1982
|
-
return;
|
|
1983
|
-
}
|
|
1984
|
-
const strategy = cfg.broadcast?.strategy || "parallel";
|
|
1985
|
-
const activeAgentId = ctx.mentionedBot || !requireMention ? normalizeAgentId(route.agentId) : null;
|
|
1986
|
-
const agentIds = (cfg.agents?.list ?? []).map((a) => normalizeAgentId(a.id));
|
|
1987
|
-
const hasKnownAgents = agentIds.length > 0;
|
|
1988
|
-
log(`feishu[${account.accountId}]: broadcasting to ${broadcastAgents.length} agents (strategy=${strategy}, active=${activeAgentId ?? "none"})`);
|
|
1989
|
-
const dispatchForAgent = async (agentId) => {
|
|
1990
|
-
if (hasKnownAgents && !agentIds.includes(normalizeAgentId(agentId))) {
|
|
1991
|
-
log(`feishu[${account.accountId}]: broadcast agent ${agentId} not found in agents.list; skipping`);
|
|
1992
|
-
return;
|
|
1993
|
-
}
|
|
1994
|
-
const agentSessionKey = buildBroadcastSessionKey(route.sessionKey, route.agentId, agentId);
|
|
1995
|
-
const agentCtx = await buildCtxPayloadForAgent(agentId, agentSessionKey, route.accountId, ctx.mentionedBot && agentId === activeAgentId);
|
|
1996
|
-
if (agentId === activeAgentId) {
|
|
1997
|
-
const identity = resolveAgentOutboundIdentity(cfg, agentId);
|
|
1998
|
-
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuReplyDispatcher({
|
|
1999
|
-
cfg,
|
|
2000
|
-
agentId,
|
|
2001
|
-
runtime,
|
|
2002
|
-
chatId: ctx.chatId,
|
|
2003
|
-
replyToMessageId: replyTargetMessageId,
|
|
2004
|
-
skipReplyToInMessages: !isGroup,
|
|
2005
|
-
replyInThread,
|
|
2006
|
-
rootId: ctx.rootId,
|
|
2007
|
-
threadReply,
|
|
2008
|
-
mentionTargets: ctx.mentionTargets,
|
|
2009
|
-
accountId: account.accountId,
|
|
2010
|
-
identity,
|
|
2011
|
-
messageCreateTimeMs
|
|
2012
|
-
});
|
|
2013
|
-
log(`feishu[${account.accountId}]: broadcast active dispatch agent=${agentId} (session=${agentSessionKey})`);
|
|
2014
|
-
await core.channel.reply.withReplyDispatcher({
|
|
2015
|
-
dispatcher,
|
|
2016
|
-
onSettled: () => markDispatchIdle(),
|
|
2017
|
-
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2018
|
-
ctx: agentCtx,
|
|
2019
|
-
cfg,
|
|
2020
|
-
dispatcher,
|
|
2021
|
-
replyOptions
|
|
2022
|
-
})
|
|
2023
|
-
});
|
|
2024
|
-
} else {
|
|
2025
|
-
delete agentCtx.CommandAuthorized;
|
|
2026
|
-
const noopDispatcher = {
|
|
2027
|
-
sendToolResult: () => false,
|
|
2028
|
-
sendBlockReply: () => false,
|
|
2029
|
-
sendFinalReply: () => false,
|
|
2030
|
-
waitForIdle: async () => {},
|
|
2031
|
-
getQueuedCounts: () => ({
|
|
2032
|
-
tool: 0,
|
|
2033
|
-
block: 0,
|
|
2034
|
-
final: 0
|
|
2035
|
-
}),
|
|
2036
|
-
getFailedCounts: () => ({
|
|
2037
|
-
tool: 0,
|
|
2038
|
-
block: 0,
|
|
2039
|
-
final: 0
|
|
2040
|
-
}),
|
|
2041
|
-
markComplete: () => {}
|
|
2042
|
-
};
|
|
2043
|
-
log(`feishu[${account.accountId}]: broadcast observer dispatch agent=${agentId} (session=${agentSessionKey})`);
|
|
2044
|
-
await core.channel.reply.withReplyDispatcher({
|
|
2045
|
-
dispatcher: noopDispatcher,
|
|
2046
|
-
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2047
|
-
ctx: agentCtx,
|
|
2048
|
-
cfg,
|
|
2049
|
-
dispatcher: noopDispatcher
|
|
2050
|
-
})
|
|
2051
|
-
});
|
|
2052
|
-
}
|
|
2053
|
-
};
|
|
2054
|
-
if (strategy === "sequential") for (const agentId of broadcastAgents) try {
|
|
2055
|
-
await dispatchForAgent(agentId);
|
|
2056
|
-
} catch (err) {
|
|
2057
|
-
log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${agentId}: ${String(err)}`);
|
|
2058
|
-
}
|
|
2059
|
-
else {
|
|
2060
|
-
const results = await Promise.allSettled(broadcastAgents.map(dispatchForAgent));
|
|
2061
|
-
for (let i = 0; i < results.length; i++) if (results[i].status === "rejected") log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${broadcastAgents[i]}: ${String(results[i].reason)}`);
|
|
2062
|
-
}
|
|
2063
|
-
if (isGroup && historyKey && chatHistories) clearHistoryEntriesIfEnabled({
|
|
2064
|
-
historyMap: chatHistories,
|
|
2065
|
-
historyKey,
|
|
2066
|
-
limit: historyLimit
|
|
2067
|
-
});
|
|
2068
|
-
log(`feishu[${account.accountId}]: broadcast dispatch complete for ${broadcastAgents.length} agents`);
|
|
2069
|
-
} else {
|
|
2070
|
-
const ctxPayload = await buildCtxPayloadForAgent(route.agentId, route.sessionKey, route.accountId, ctx.mentionedBot);
|
|
2071
|
-
const identity = resolveAgentOutboundIdentity(cfg, route.agentId);
|
|
2072
|
-
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuReplyDispatcher({
|
|
2073
|
-
cfg,
|
|
2074
|
-
agentId: route.agentId,
|
|
2075
|
-
runtime,
|
|
2076
|
-
chatId: ctx.chatId,
|
|
2077
|
-
replyToMessageId: replyTargetMessageId,
|
|
2078
|
-
skipReplyToInMessages: !isGroup,
|
|
2079
|
-
replyInThread,
|
|
2080
|
-
rootId: ctx.rootId,
|
|
2081
|
-
threadReply,
|
|
2082
|
-
mentionTargets: ctx.mentionTargets,
|
|
2083
|
-
accountId: account.accountId,
|
|
2084
|
-
identity,
|
|
2085
|
-
messageCreateTimeMs
|
|
2086
|
-
});
|
|
2087
|
-
log(`feishu[${account.accountId}]: dispatching to agent (session=${route.sessionKey})`);
|
|
2088
|
-
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
|
|
2089
|
-
dispatcher,
|
|
2090
|
-
onSettled: () => {
|
|
2091
|
-
markDispatchIdle();
|
|
2092
|
-
},
|
|
2093
|
-
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2094
|
-
ctx: ctxPayload,
|
|
2095
|
-
cfg,
|
|
2096
|
-
dispatcher,
|
|
2097
|
-
replyOptions
|
|
2098
|
-
})
|
|
2099
|
-
});
|
|
2100
|
-
if (isGroup && historyKey && chatHistories) clearHistoryEntriesIfEnabled({
|
|
2101
|
-
historyMap: chatHistories,
|
|
2102
|
-
historyKey,
|
|
2103
|
-
limit: historyLimit
|
|
2104
|
-
});
|
|
2105
|
-
log(`feishu[${account.accountId}]: dispatch complete (queuedFinal=${queuedFinal}, replies=${counts.final})`);
|
|
2106
|
-
}
|
|
2107
|
-
} catch (err) {
|
|
2108
|
-
error(`feishu[${account.accountId}]: failed to dispatch message: ${String(err)}`);
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
//#endregion
|
|
2112
|
-
//#region extensions/feishu/src/card-ux-shared.ts
|
|
2113
|
-
function buildFeishuCardButton(params) {
|
|
2114
|
-
return {
|
|
2115
|
-
tag: "button",
|
|
2116
|
-
text: {
|
|
2117
|
-
tag: "plain_text",
|
|
2118
|
-
content: params.label
|
|
2119
|
-
},
|
|
2120
|
-
type: params.type ?? "default",
|
|
2121
|
-
value: params.value
|
|
2122
|
-
};
|
|
2123
|
-
}
|
|
2124
|
-
function buildFeishuCardInteractionContext(params) {
|
|
2125
|
-
return {
|
|
2126
|
-
u: params.operatorOpenId,
|
|
2127
|
-
...params.chatId ? { h: params.chatId } : {},
|
|
2128
|
-
...params.sessionKey ? { s: params.sessionKey } : {},
|
|
2129
|
-
e: params.expiresAt,
|
|
2130
|
-
...params.chatType ? { t: params.chatType } : {}
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
//#endregion
|
|
2134
|
-
//#region extensions/feishu/src/card-ux-approval.ts
|
|
2135
|
-
const FEISHU_APPROVAL_REQUEST_ACTION = "feishu.quick_actions.request_approval";
|
|
2136
|
-
const FEISHU_APPROVAL_CONFIRM_ACTION = "feishu.approval.confirm";
|
|
2137
|
-
const FEISHU_APPROVAL_CANCEL_ACTION = "feishu.approval.cancel";
|
|
2138
|
-
function createApprovalCard(params) {
|
|
2139
|
-
const context = buildFeishuCardInteractionContext(params);
|
|
2140
|
-
return {
|
|
2141
|
-
schema: "2.0",
|
|
2142
|
-
config: { wide_screen_mode: true },
|
|
2143
|
-
header: {
|
|
2144
|
-
title: {
|
|
2145
|
-
tag: "plain_text",
|
|
2146
|
-
content: "Confirm action"
|
|
2147
|
-
},
|
|
2148
|
-
template: "orange"
|
|
2149
|
-
},
|
|
2150
|
-
body: { elements: [{
|
|
2151
|
-
tag: "markdown",
|
|
2152
|
-
content: params.prompt
|
|
2153
|
-
}, {
|
|
2154
|
-
tag: "action",
|
|
2155
|
-
actions: [buildFeishuCardButton({
|
|
2156
|
-
label: params.confirmLabel ?? "Confirm",
|
|
2157
|
-
type: "primary",
|
|
2158
|
-
value: createFeishuCardInteractionEnvelope({
|
|
2159
|
-
k: "quick",
|
|
2160
|
-
a: FEISHU_APPROVAL_CONFIRM_ACTION,
|
|
2161
|
-
q: params.command,
|
|
2162
|
-
c: context
|
|
2163
|
-
})
|
|
2164
|
-
}), buildFeishuCardButton({
|
|
2165
|
-
label: params.cancelLabel ?? "Cancel",
|
|
2166
|
-
value: createFeishuCardInteractionEnvelope({
|
|
2167
|
-
k: "button",
|
|
2168
|
-
a: FEISHU_APPROVAL_CANCEL_ACTION,
|
|
2169
|
-
c: context
|
|
2170
|
-
})
|
|
2171
|
-
})]
|
|
2172
|
-
}] }
|
|
2173
|
-
};
|
|
2174
|
-
}
|
|
2175
|
-
//#endregion
|
|
2176
|
-
//#region extensions/feishu/src/card-action.ts
|
|
2177
|
-
const FEISHU_APPROVAL_CARD_TTL_MS = 5 * 6e4;
|
|
2178
|
-
const FEISHU_CARD_ACTION_TOKEN_TTL_MS = 15 * 6e4;
|
|
2179
|
-
const processedCardActionTokens = /* @__PURE__ */ new Map();
|
|
2180
|
-
function pruneProcessedCardActionTokens(now) {
|
|
2181
|
-
for (const [key, entry] of processedCardActionTokens.entries()) if (entry.expiresAt <= now) processedCardActionTokens.delete(key);
|
|
2182
|
-
}
|
|
2183
|
-
function beginFeishuCardActionToken(params) {
|
|
2184
|
-
const now = params.now ?? Date.now();
|
|
2185
|
-
pruneProcessedCardActionTokens(now);
|
|
2186
|
-
const normalizedToken = params.token.trim();
|
|
2187
|
-
if (!normalizedToken) return true;
|
|
2188
|
-
const key = `${params.accountId}:${normalizedToken}`;
|
|
2189
|
-
const existing = processedCardActionTokens.get(key);
|
|
2190
|
-
if (existing && existing.expiresAt > now) return false;
|
|
2191
|
-
processedCardActionTokens.set(key, {
|
|
2192
|
-
status: "inflight",
|
|
2193
|
-
expiresAt: now + FEISHU_CARD_ACTION_TOKEN_TTL_MS
|
|
2194
|
-
});
|
|
2195
|
-
return true;
|
|
2196
|
-
}
|
|
2197
|
-
function completeFeishuCardActionToken(params) {
|
|
2198
|
-
const now = params.now ?? Date.now();
|
|
2199
|
-
const normalizedToken = params.token.trim();
|
|
2200
|
-
if (!normalizedToken) return;
|
|
2201
|
-
processedCardActionTokens.set(`${params.accountId}:${normalizedToken}`, {
|
|
2202
|
-
status: "completed",
|
|
2203
|
-
expiresAt: now + FEISHU_CARD_ACTION_TOKEN_TTL_MS
|
|
2204
|
-
});
|
|
2205
|
-
}
|
|
2206
|
-
function releaseFeishuCardActionToken(params) {
|
|
2207
|
-
const normalizedToken = params.token.trim();
|
|
2208
|
-
if (!normalizedToken) return;
|
|
2209
|
-
processedCardActionTokens.delete(`${params.accountId}:${normalizedToken}`);
|
|
2210
|
-
}
|
|
2211
|
-
function buildSyntheticMessageEvent(event, content, chatType) {
|
|
2212
|
-
return {
|
|
2213
|
-
sender: { sender_id: {
|
|
2214
|
-
open_id: event.operator.open_id,
|
|
2215
|
-
user_id: event.operator.user_id,
|
|
2216
|
-
union_id: event.operator.union_id
|
|
2217
|
-
} },
|
|
2218
|
-
message: {
|
|
2219
|
-
message_id: `card-action-${event.token}`,
|
|
2220
|
-
chat_id: event.context.chat_id || event.operator.open_id,
|
|
2221
|
-
chat_type: chatType ?? (event.context.chat_id ? "group" : "p2p"),
|
|
2222
|
-
message_type: "text",
|
|
2223
|
-
content: JSON.stringify({ text: content })
|
|
2224
|
-
}
|
|
2225
|
-
};
|
|
2226
|
-
}
|
|
2227
|
-
function resolveCallbackTarget(event) {
|
|
2228
|
-
const chatId = event.context.chat_id?.trim();
|
|
2229
|
-
if (chatId) return `chat:${chatId}`;
|
|
2230
|
-
return `user:${event.operator.open_id}`;
|
|
2231
|
-
}
|
|
2232
|
-
async function dispatchSyntheticCommand(params) {
|
|
2233
|
-
await handleFeishuMessage({
|
|
2234
|
-
cfg: params.cfg,
|
|
2235
|
-
event: buildSyntheticMessageEvent(params.event, params.command, params.chatType),
|
|
2236
|
-
botOpenId: params.botOpenId,
|
|
2237
|
-
runtime: params.runtime,
|
|
2238
|
-
accountId: params.accountId
|
|
2239
|
-
});
|
|
2240
|
-
}
|
|
2241
|
-
async function sendInvalidInteractionNotice(params) {
|
|
2242
|
-
const reasonText = params.reason === "stale" ? "This card action has expired. Open a fresh launcher card and try again." : params.reason === "wrong_user" ? "This card action belongs to a different user." : params.reason === "wrong_conversation" ? "This card action belongs to a different conversation." : "This card action payload is invalid.";
|
|
2243
|
-
await sendMessageFeishu({
|
|
2244
|
-
cfg: params.cfg,
|
|
2245
|
-
to: resolveCallbackTarget(params.event),
|
|
2246
|
-
text: `⚠️ ${reasonText}`,
|
|
2247
|
-
accountId: params.accountId
|
|
2248
|
-
});
|
|
2249
|
-
}
|
|
2250
|
-
async function handleFeishuCardAction(params) {
|
|
2251
|
-
const { cfg, event, runtime, accountId } = params;
|
|
2252
|
-
const account = resolveFeishuRuntimeAccount({
|
|
2253
|
-
cfg,
|
|
2254
|
-
accountId
|
|
2255
|
-
});
|
|
2256
|
-
const log = runtime?.log ?? console.log;
|
|
2257
|
-
const decoded = decodeFeishuCardAction({ event });
|
|
2258
|
-
if (!beginFeishuCardActionToken({
|
|
2259
|
-
token: event.token,
|
|
2260
|
-
accountId: account.accountId
|
|
2261
|
-
})) {
|
|
2262
|
-
log(`feishu[${account.accountId}]: skipping duplicate card action token ${event.token}`);
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
try {
|
|
2266
|
-
if (decoded.kind === "invalid") {
|
|
2267
|
-
log(`feishu[${account.accountId}]: rejected card action from ${event.operator.open_id}: ${decoded.reason}`);
|
|
2268
|
-
await sendInvalidInteractionNotice({
|
|
2269
|
-
cfg,
|
|
2270
|
-
event,
|
|
2271
|
-
reason: decoded.reason,
|
|
2272
|
-
accountId
|
|
2273
|
-
});
|
|
2274
|
-
completeFeishuCardActionToken({
|
|
2275
|
-
token: event.token,
|
|
2276
|
-
accountId: account.accountId
|
|
2277
|
-
});
|
|
2278
|
-
return;
|
|
2279
|
-
}
|
|
2280
|
-
if (decoded.kind === "structured") {
|
|
2281
|
-
const { envelope } = decoded;
|
|
2282
|
-
log(`feishu[${account.accountId}]: handling structured card action ${envelope.a} from ${event.operator.open_id}`);
|
|
2283
|
-
if (envelope.a === "feishu.quick_actions.request_approval") {
|
|
2284
|
-
const command = typeof envelope.m?.command === "string" ? envelope.m.command.trim() : "";
|
|
2285
|
-
if (!command) {
|
|
2286
|
-
await sendInvalidInteractionNotice({
|
|
2287
|
-
cfg,
|
|
2288
|
-
event,
|
|
2289
|
-
reason: "malformed",
|
|
2290
|
-
accountId
|
|
2291
|
-
});
|
|
2292
|
-
completeFeishuCardActionToken({
|
|
2293
|
-
token: event.token,
|
|
2294
|
-
accountId: account.accountId
|
|
2295
|
-
});
|
|
2296
|
-
return;
|
|
2297
|
-
}
|
|
2298
|
-
const prompt = typeof envelope.m?.prompt === "string" && envelope.m.prompt.trim() ? envelope.m.prompt : `Run \`${command}\` in this Feishu conversation?`;
|
|
2299
|
-
await sendCardFeishu({
|
|
2300
|
-
cfg,
|
|
2301
|
-
to: resolveCallbackTarget(event),
|
|
2302
|
-
card: createApprovalCard({
|
|
2303
|
-
operatorOpenId: event.operator.open_id,
|
|
2304
|
-
chatId: event.context.chat_id || void 0,
|
|
2305
|
-
command,
|
|
2306
|
-
prompt,
|
|
2307
|
-
sessionKey: envelope.c?.s,
|
|
2308
|
-
expiresAt: Date.now() + FEISHU_APPROVAL_CARD_TTL_MS,
|
|
2309
|
-
chatType: envelope.c?.t ?? (event.context.chat_id ? "group" : "p2p"),
|
|
2310
|
-
confirmLabel: command === "/reset" ? "Reset" : "Confirm"
|
|
2311
|
-
}),
|
|
2312
|
-
accountId
|
|
2313
|
-
});
|
|
2314
|
-
completeFeishuCardActionToken({
|
|
2315
|
-
token: event.token,
|
|
2316
|
-
accountId: account.accountId
|
|
2317
|
-
});
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
if (envelope.a === "feishu.approval.cancel") {
|
|
2321
|
-
await sendMessageFeishu({
|
|
2322
|
-
cfg,
|
|
2323
|
-
to: resolveCallbackTarget(event),
|
|
2324
|
-
text: "Cancelled.",
|
|
2325
|
-
accountId
|
|
2326
|
-
});
|
|
2327
|
-
completeFeishuCardActionToken({
|
|
2328
|
-
token: event.token,
|
|
2329
|
-
accountId: account.accountId
|
|
2330
|
-
});
|
|
2331
|
-
return;
|
|
2332
|
-
}
|
|
2333
|
-
if (envelope.a === "feishu.approval.confirm" || envelope.k === "quick") {
|
|
2334
|
-
const command = envelope.q?.trim();
|
|
2335
|
-
if (!command) {
|
|
2336
|
-
await sendInvalidInteractionNotice({
|
|
2337
|
-
cfg,
|
|
2338
|
-
event,
|
|
2339
|
-
reason: "malformed",
|
|
2340
|
-
accountId
|
|
2341
|
-
});
|
|
2342
|
-
completeFeishuCardActionToken({
|
|
2343
|
-
token: event.token,
|
|
2344
|
-
accountId: account.accountId
|
|
2345
|
-
});
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
2348
|
-
await dispatchSyntheticCommand({
|
|
2349
|
-
cfg,
|
|
2350
|
-
event,
|
|
2351
|
-
command,
|
|
2352
|
-
botOpenId: params.botOpenId,
|
|
2353
|
-
runtime,
|
|
2354
|
-
accountId,
|
|
2355
|
-
chatType: envelope.c?.t ?? (event.context.chat_id ? "group" : "p2p")
|
|
2356
|
-
});
|
|
2357
|
-
completeFeishuCardActionToken({
|
|
2358
|
-
token: event.token,
|
|
2359
|
-
accountId: account.accountId
|
|
2360
|
-
});
|
|
2361
|
-
return;
|
|
2362
|
-
}
|
|
2363
|
-
await sendInvalidInteractionNotice({
|
|
2364
|
-
cfg,
|
|
2365
|
-
event,
|
|
2366
|
-
reason: "malformed",
|
|
2367
|
-
accountId
|
|
2368
|
-
});
|
|
2369
|
-
completeFeishuCardActionToken({
|
|
2370
|
-
token: event.token,
|
|
2371
|
-
accountId: account.accountId
|
|
2372
|
-
});
|
|
2373
|
-
return;
|
|
2374
|
-
}
|
|
2375
|
-
const content = buildFeishuCardActionTextFallback(event);
|
|
2376
|
-
log(`feishu[${account.accountId}]: handling card action from ${event.operator.open_id}: ${content}`);
|
|
2377
|
-
await dispatchSyntheticCommand({
|
|
2378
|
-
cfg,
|
|
2379
|
-
event,
|
|
2380
|
-
command: content,
|
|
2381
|
-
botOpenId: params.botOpenId,
|
|
2382
|
-
runtime,
|
|
2383
|
-
accountId
|
|
2384
|
-
});
|
|
2385
|
-
completeFeishuCardActionToken({
|
|
2386
|
-
token: event.token,
|
|
2387
|
-
accountId: account.accountId
|
|
2388
|
-
});
|
|
2389
|
-
} catch (err) {
|
|
2390
|
-
releaseFeishuCardActionToken({
|
|
2391
|
-
token: event.token,
|
|
2392
|
-
accountId: account.accountId
|
|
2393
|
-
});
|
|
2394
|
-
throw err;
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
//#endregion
|
|
2398
|
-
//#region extensions/feishu/src/card-ux-launcher.ts
|
|
2399
|
-
const FEISHU_QUICK_ACTION_CARD_TTL_MS = 10 * 6e4;
|
|
2400
|
-
const QUICK_ACTION_MENU_KEYS = new Set([
|
|
2401
|
-
"quick-actions",
|
|
2402
|
-
"quick_actions",
|
|
2403
|
-
"launcher"
|
|
2404
|
-
]);
|
|
2405
|
-
function isFeishuQuickActionMenuEventKey(eventKey) {
|
|
2406
|
-
return QUICK_ACTION_MENU_KEYS.has(eventKey.trim().toLowerCase());
|
|
2407
|
-
}
|
|
2408
|
-
function createQuickActionLauncherCard(params) {
|
|
2409
|
-
const context = buildFeishuCardInteractionContext(params);
|
|
2410
|
-
return {
|
|
2411
|
-
schema: "2.0",
|
|
2412
|
-
config: { wide_screen_mode: true },
|
|
2413
|
-
header: {
|
|
2414
|
-
title: {
|
|
2415
|
-
tag: "plain_text",
|
|
2416
|
-
content: "Quick actions"
|
|
2417
|
-
},
|
|
2418
|
-
template: "indigo"
|
|
2419
|
-
},
|
|
2420
|
-
body: { elements: [{
|
|
2421
|
-
tag: "markdown",
|
|
2422
|
-
content: "Run common actions without typing raw commands."
|
|
2423
|
-
}, {
|
|
2424
|
-
tag: "action",
|
|
2425
|
-
actions: [
|
|
2426
|
-
buildFeishuCardButton({
|
|
2427
|
-
label: "Help",
|
|
2428
|
-
value: createFeishuCardInteractionEnvelope({
|
|
2429
|
-
k: "quick",
|
|
2430
|
-
a: "feishu.quick_actions.help",
|
|
2431
|
-
q: "/help",
|
|
2432
|
-
c: context
|
|
2433
|
-
})
|
|
2434
|
-
}),
|
|
2435
|
-
buildFeishuCardButton({
|
|
2436
|
-
label: "New session",
|
|
2437
|
-
type: "primary",
|
|
2438
|
-
value: createFeishuCardInteractionEnvelope({
|
|
2439
|
-
k: "meta",
|
|
2440
|
-
a: FEISHU_APPROVAL_REQUEST_ACTION,
|
|
2441
|
-
m: {
|
|
2442
|
-
command: "/new",
|
|
2443
|
-
prompt: "Start a fresh session? This will reset the current chat context."
|
|
2444
|
-
},
|
|
2445
|
-
c: context
|
|
2446
|
-
})
|
|
2447
|
-
}),
|
|
2448
|
-
buildFeishuCardButton({
|
|
2449
|
-
label: "Reset",
|
|
2450
|
-
type: "danger",
|
|
2451
|
-
value: createFeishuCardInteractionEnvelope({
|
|
2452
|
-
k: "meta",
|
|
2453
|
-
a: FEISHU_APPROVAL_REQUEST_ACTION,
|
|
2454
|
-
m: {
|
|
2455
|
-
command: "/reset",
|
|
2456
|
-
prompt: "Reset this session now? Any active conversation state will be cleared."
|
|
2457
|
-
},
|
|
2458
|
-
c: context
|
|
2459
|
-
})
|
|
2460
|
-
})
|
|
2461
|
-
]
|
|
2462
|
-
}] }
|
|
2463
|
-
};
|
|
2464
|
-
}
|
|
2465
|
-
async function maybeHandleFeishuQuickActionMenu(params) {
|
|
2466
|
-
if (!isFeishuQuickActionMenuEventKey(params.eventKey)) return false;
|
|
2467
|
-
const expiresAt = (params.now ?? Date.now()) + FEISHU_QUICK_ACTION_CARD_TTL_MS;
|
|
2468
|
-
try {
|
|
2469
|
-
await sendCardFeishu({
|
|
2470
|
-
cfg: params.cfg,
|
|
2471
|
-
to: `user:${params.operatorOpenId}`,
|
|
2472
|
-
card: createQuickActionLauncherCard({
|
|
2473
|
-
operatorOpenId: params.operatorOpenId,
|
|
2474
|
-
expiresAt,
|
|
2475
|
-
chatType: "p2p"
|
|
2476
|
-
}),
|
|
2477
|
-
accountId: params.accountId
|
|
2478
|
-
});
|
|
2479
|
-
} catch (err) {
|
|
2480
|
-
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: failed to open quick-action launcher for ${params.operatorOpenId}: ${String(err)}`);
|
|
2481
|
-
return false;
|
|
2482
|
-
}
|
|
2483
|
-
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: opened quick-action launcher for ${params.operatorOpenId}`);
|
|
2484
|
-
return true;
|
|
2485
|
-
}
|
|
2486
|
-
//#endregion
|
|
2487
|
-
//#region extensions/feishu/src/comment-dispatcher.ts
|
|
2488
|
-
function createFeishuCommentReplyDispatcher(params) {
|
|
2489
|
-
const core = getFeishuRuntime();
|
|
2490
|
-
const prefixContext = createReplyPrefixContext({
|
|
2491
|
-
cfg: params.cfg,
|
|
2492
|
-
agentId: params.agentId,
|
|
2493
|
-
channel: "feishu",
|
|
2494
|
-
accountId: params.accountId
|
|
2495
|
-
});
|
|
2496
|
-
const client = createFeishuClient(resolveFeishuRuntimeAccount({
|
|
2497
|
-
cfg: params.cfg,
|
|
2498
|
-
accountId: params.accountId
|
|
2499
|
-
}));
|
|
2500
|
-
const textChunkLimit = core.channel.text.resolveTextChunkLimit(params.cfg, "feishu", params.accountId, { fallbackLimit: 4e3 });
|
|
2501
|
-
const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "feishu");
|
|
2502
|
-
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
2503
|
-
responsePrefix: prefixContext.responsePrefix,
|
|
2504
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
2505
|
-
humanDelay: core.channel.reply.resolveHumanDelayConfig(params.cfg, params.agentId),
|
|
2506
|
-
deliver: async (payload, info) => {
|
|
2507
|
-
if (info.kind !== "final") return;
|
|
2508
|
-
const reply = resolveSendableOutboundReplyParts(payload);
|
|
2509
|
-
if (!reply.hasText) {
|
|
2510
|
-
if (reply.hasMedia) params.runtime.log?.(`feishu[${params.accountId ?? "default"}]: comment reply ignored media-only payload for comment=${params.commentId}`);
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
const chunks = core.channel.text.chunkTextWithMode(reply.text, textChunkLimit, chunkMode);
|
|
2514
|
-
for (const chunk of chunks) await deliverCommentThreadText(client, {
|
|
2515
|
-
file_token: params.fileToken,
|
|
2516
|
-
file_type: params.fileType,
|
|
2517
|
-
comment_id: params.commentId,
|
|
2518
|
-
content: chunk,
|
|
2519
|
-
is_whole_comment: params.isWholeComment
|
|
2520
|
-
});
|
|
2521
|
-
},
|
|
2522
|
-
onError: (err, info) => {
|
|
2523
|
-
params.runtime.error?.(`feishu[${params.accountId ?? "default"}]: comment dispatcher failed kind=${info.kind} comment=${params.commentId}: ${String(err)}`);
|
|
2524
|
-
}
|
|
2525
|
-
});
|
|
2526
|
-
return {
|
|
2527
|
-
dispatcher,
|
|
2528
|
-
replyOptions,
|
|
2529
|
-
markDispatchIdle
|
|
2530
|
-
};
|
|
2531
|
-
}
|
|
2532
|
-
//#endregion
|
|
2533
|
-
//#region extensions/feishu/src/monitor.comment.ts
|
|
2534
|
-
const FEISHU_COMMENT_VERIFY_TIMEOUT_MS = 3e3;
|
|
2535
|
-
const FEISHU_COMMENT_REPLY_PAGE_SIZE = 100;
|
|
2536
|
-
const FEISHU_COMMENT_REPLY_PAGE_LIMIT = 5;
|
|
2537
|
-
const FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS = 1e3;
|
|
2538
|
-
const FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT = 6;
|
|
2539
|
-
function isRecord$1(value) {
|
|
2540
|
-
return typeof value === "object" && value !== null;
|
|
2541
|
-
}
|
|
2542
|
-
function readString$1(value) {
|
|
2543
|
-
return typeof value === "string" ? value : void 0;
|
|
2544
|
-
}
|
|
2545
|
-
function readBoolean(value) {
|
|
2546
|
-
return typeof value === "boolean" ? value : void 0;
|
|
2547
|
-
}
|
|
2548
|
-
function safeJsonStringify(value) {
|
|
2549
|
-
try {
|
|
2550
|
-
return JSON.stringify(value);
|
|
2551
|
-
} catch (error) {
|
|
2552
|
-
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
function summarizeCommentRepliesForLog(replies) {
|
|
2556
|
-
return safeJsonStringify(replies.map((reply) => ({
|
|
2557
|
-
reply_id: reply.reply_id,
|
|
2558
|
-
text_len: extractReplyText(reply)?.length ?? 0
|
|
2559
|
-
})));
|
|
2560
|
-
}
|
|
2561
|
-
function encodeQuery(params) {
|
|
2562
|
-
const query = new URLSearchParams();
|
|
2563
|
-
for (const [key, value] of Object.entries(params)) {
|
|
2564
|
-
const trimmed = value?.trim();
|
|
2565
|
-
if (trimmed) query.set(key, trimmed);
|
|
2566
|
-
}
|
|
2567
|
-
const queryString = query.toString();
|
|
2568
|
-
return queryString ? `?${queryString}` : "";
|
|
2569
|
-
}
|
|
2570
|
-
async function delayMs(ms) {
|
|
2571
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
2572
|
-
}
|
|
2573
|
-
function buildDriveCommentTargetUrl(params) {
|
|
2574
|
-
return `/open-apis/drive/v1/files/${encodeURIComponent(params.fileToken)}/comments/batch_query` + encodeQuery({
|
|
2575
|
-
file_type: params.fileType,
|
|
2576
|
-
user_id_type: "open_id"
|
|
2577
|
-
});
|
|
2578
|
-
}
|
|
2579
|
-
function buildDriveCommentRepliesUrl(params) {
|
|
2580
|
-
return `/open-apis/drive/v1/files/${encodeURIComponent(params.fileToken)}/comments/${encodeURIComponent(params.commentId)}/replies` + encodeQuery({
|
|
2581
|
-
file_type: params.fileType,
|
|
2582
|
-
page_token: params.pageToken,
|
|
2583
|
-
page_size: String(FEISHU_COMMENT_REPLY_PAGE_SIZE),
|
|
2584
|
-
user_id_type: "open_id"
|
|
2585
|
-
});
|
|
2586
|
-
}
|
|
2587
|
-
async function requestFeishuOpenApi(params) {
|
|
2588
|
-
const formatErrorDetails = (error) => {
|
|
2589
|
-
if (!isRecord$1(error)) return String(error);
|
|
2590
|
-
const response = isRecord$1(error.response) ? error.response : void 0;
|
|
2591
|
-
const responseData = isRecord$1(response?.data) ? response?.data : void 0;
|
|
2592
|
-
return safeJsonStringify({
|
|
2593
|
-
message: typeof error.message === "string" ? error.message : String(error),
|
|
2594
|
-
code: readString$1(error.code),
|
|
2595
|
-
method: readString$1(isRecord$1(error.config) ? error.config.method : void 0),
|
|
2596
|
-
url: readString$1(isRecord$1(error.config) ? error.config.url : void 0),
|
|
2597
|
-
http_status: typeof response?.status === "number" ? response.status : void 0,
|
|
2598
|
-
feishu_code: typeof responseData?.code === "number" ? responseData.code : readString$1(responseData?.code),
|
|
2599
|
-
feishu_msg: readString$1(responseData?.msg),
|
|
2600
|
-
feishu_log_id: readString$1(responseData?.log_id)
|
|
2601
|
-
});
|
|
2602
|
-
};
|
|
2603
|
-
const result = await raceWithTimeoutAndAbort(params.client.request({
|
|
2604
|
-
method: params.method,
|
|
2605
|
-
url: params.url,
|
|
2606
|
-
data: params.data ?? {},
|
|
2607
|
-
timeout: params.timeoutMs
|
|
2608
|
-
}), { timeoutMs: params.timeoutMs }).then((resolved) => resolved.status === "resolved" ? resolved.value : null).catch((error) => {
|
|
2609
|
-
params.logger?.(`${params.errorLabel}: ${formatErrorDetails(error)}`);
|
|
2610
|
-
return null;
|
|
2611
|
-
});
|
|
2612
|
-
if (!result) params.logger?.(`${params.errorLabel}: request timed out or returned no data`);
|
|
2613
|
-
return result;
|
|
2614
|
-
}
|
|
2615
|
-
function extractCommentElementText(element) {
|
|
2616
|
-
if (!isRecord$1(element)) return;
|
|
2617
|
-
const type = readString$1(element.type)?.trim();
|
|
2618
|
-
if (type === "text_run" && isRecord$1(element.text_run)) return readString$1(element.text_run.content)?.trim() || readString$1(element.text_run.text)?.trim() || void 0;
|
|
2619
|
-
if (type === "mention") {
|
|
2620
|
-
const mention = isRecord$1(element.mention) ? element.mention : void 0;
|
|
2621
|
-
const mentionName = readString$1(mention?.name)?.trim() || readString$1(mention?.display_name)?.trim() || readString$1(element.name)?.trim();
|
|
2622
|
-
return mentionName ? `@${mentionName}` : "@mention";
|
|
2623
|
-
}
|
|
2624
|
-
if (type === "docs_link") {
|
|
2625
|
-
const docsLink = isRecord$1(element.docs_link) ? element.docs_link : void 0;
|
|
2626
|
-
return readString$1(docsLink?.text)?.trim() || readString$1(docsLink?.url)?.trim() || readString$1(element.text)?.trim() || readString$1(element.url)?.trim() || void 0;
|
|
2627
|
-
}
|
|
2628
|
-
return readString$1(element.text)?.trim() || readString$1(element.content)?.trim() || readString$1(element.name)?.trim() || void 0;
|
|
2629
|
-
}
|
|
2630
|
-
function extractReplyText(reply) {
|
|
2631
|
-
if (!reply || !isRecord$1(reply.content)) return;
|
|
2632
|
-
return (Array.isArray(reply.content.elements) ? reply.content.elements : []).map(extractCommentElementText).filter((part) => Boolean(part && part.trim())).join("").trim() || void 0;
|
|
2633
|
-
}
|
|
2634
|
-
async function fetchDriveCommentReplies(params) {
|
|
2635
|
-
const replies = [];
|
|
2636
|
-
const logIds = [];
|
|
2637
|
-
let pageToken;
|
|
2638
|
-
for (let page = 0; page < FEISHU_COMMENT_REPLY_PAGE_LIMIT; page += 1) {
|
|
2639
|
-
const response = await requestFeishuOpenApi({
|
|
2640
|
-
client: params.client,
|
|
2641
|
-
method: "GET",
|
|
2642
|
-
url: buildDriveCommentRepliesUrl({
|
|
2643
|
-
fileToken: params.fileToken,
|
|
2644
|
-
commentId: params.commentId,
|
|
2645
|
-
fileType: params.fileType,
|
|
2646
|
-
pageToken
|
|
2647
|
-
}),
|
|
2648
|
-
timeoutMs: params.timeoutMs,
|
|
2649
|
-
logger: params.logger,
|
|
2650
|
-
errorLabel: `feishu[${params.accountId}]: failed to fetch comment replies for ${params.commentId}`
|
|
2651
|
-
});
|
|
2652
|
-
if (response?.log_id?.trim()) logIds.push(response.log_id.trim());
|
|
2653
|
-
if (response?.code !== 0) {
|
|
2654
|
-
if (response) params.logger?.(`feishu[${params.accountId}]: failed to fetch comment replies for ${params.commentId}: ${response.msg ?? "unknown error"} log_id=${response.log_id?.trim() || "unknown"}`);
|
|
2655
|
-
break;
|
|
2656
|
-
}
|
|
2657
|
-
replies.push(...response.data?.items ?? []);
|
|
2658
|
-
if (response.data?.has_more !== true || !response.data.page_token?.trim()) break;
|
|
2659
|
-
pageToken = response.data.page_token.trim();
|
|
2660
|
-
}
|
|
2661
|
-
return {
|
|
2662
|
-
replies,
|
|
2663
|
-
logIds
|
|
2664
|
-
};
|
|
2665
|
-
}
|
|
2666
|
-
async function fetchDriveCommentContext(params) {
|
|
2667
|
-
const [metaResponse, commentResponse] = await Promise.all([requestFeishuOpenApi({
|
|
2668
|
-
client: params.client,
|
|
2669
|
-
method: "POST",
|
|
2670
|
-
url: "/open-apis/drive/v1/metas/batch_query",
|
|
2671
|
-
data: {
|
|
2672
|
-
request_docs: [{
|
|
2673
|
-
doc_token: params.fileToken,
|
|
2674
|
-
doc_type: params.fileType
|
|
2675
|
-
}],
|
|
2676
|
-
with_url: true
|
|
2677
|
-
},
|
|
2678
|
-
timeoutMs: params.timeoutMs,
|
|
2679
|
-
logger: params.logger,
|
|
2680
|
-
errorLabel: `feishu[${params.accountId}]: failed to fetch drive metadata for ${params.fileToken}`
|
|
2681
|
-
}), requestFeishuOpenApi({
|
|
2682
|
-
client: params.client,
|
|
2683
|
-
method: "POST",
|
|
2684
|
-
url: buildDriveCommentTargetUrl({
|
|
2685
|
-
fileToken: params.fileToken,
|
|
2686
|
-
fileType: params.fileType
|
|
2687
|
-
}),
|
|
2688
|
-
data: { comment_ids: [params.commentId] },
|
|
2689
|
-
timeoutMs: params.timeoutMs,
|
|
2690
|
-
logger: params.logger,
|
|
2691
|
-
errorLabel: `feishu[${params.accountId}]: failed to fetch drive comment ${params.commentId}`
|
|
2692
|
-
})]);
|
|
2693
|
-
const commentCard = commentResponse?.code === 0 ? (commentResponse.data?.items ?? []).find((item) => item.comment_id?.trim() === params.commentId) : void 0;
|
|
2694
|
-
const embeddedReplies = commentCard?.reply_list?.replies ?? [];
|
|
2695
|
-
params.logger?.(`feishu[${params.accountId}]: embedded comment replies comment=${params.commentId} count=${embeddedReplies.length} summary=${summarizeCommentRepliesForLog(embeddedReplies)}`);
|
|
2696
|
-
const embeddedTargetReply = params.replyId ? embeddedReplies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : embeddedReplies.at(-1);
|
|
2697
|
-
let replies = embeddedReplies;
|
|
2698
|
-
let fetchedMatchedReply = params.replyId ? replies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : void 0;
|
|
2699
|
-
if (!embeddedTargetReply || replies.length === 0) {
|
|
2700
|
-
params.logger?.(`feishu[${params.accountId}]: fetching extra comment replies comment=${params.commentId} requested_reply=${params.replyId ?? "none"} embedded_count=${embeddedReplies.length} embedded_hit=${embeddedTargetReply ? "yes" : "no"}`);
|
|
2701
|
-
const fetched = await fetchDriveCommentReplies(params);
|
|
2702
|
-
if (fetched.replies.length > 0) {
|
|
2703
|
-
params.logger?.(`feishu[${params.accountId}]: fetched extra comment replies comment=${params.commentId} count=${fetched.replies.length} log_ids=${safeJsonStringify(fetched.logIds)} summary=${summarizeCommentRepliesForLog(fetched.replies)}`);
|
|
2704
|
-
replies = fetched.replies;
|
|
2705
|
-
fetchedMatchedReply = params.replyId ? replies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : void 0;
|
|
2706
|
-
}
|
|
2707
|
-
if (params.replyId && !embeddedTargetReply && !fetchedMatchedReply) for (let attempt = 1; attempt <= FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT; attempt += 1) {
|
|
2708
|
-
params.logger?.(`feishu[${params.accountId}]: retrying comment reply lookup comment=${params.commentId} requested_reply=${params.replyId} attempt=${attempt}/${FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT} delay_ms=${FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS}`);
|
|
2709
|
-
await params.waitMs(FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS);
|
|
2710
|
-
const retried = await fetchDriveCommentReplies(params);
|
|
2711
|
-
if (retried.replies.length > 0) {
|
|
2712
|
-
params.logger?.(`feishu[${params.accountId}]: fetched retried comment replies comment=${params.commentId} attempt=${attempt} count=${retried.replies.length} log_ids=${safeJsonStringify(retried.logIds)} summary=${summarizeCommentRepliesForLog(retried.replies)}`);
|
|
2713
|
-
replies = retried.replies;
|
|
2714
|
-
}
|
|
2715
|
-
fetchedMatchedReply = replies.find((reply) => reply.reply_id?.trim() === params.replyId);
|
|
2716
|
-
if (fetchedMatchedReply) break;
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
const rootReply = replies[0] ?? embeddedReplies[0];
|
|
2720
|
-
const targetReply = params.replyId ? embeddedTargetReply ?? fetchedMatchedReply ?? void 0 : replies.at(-1) ?? embeddedTargetReply ?? rootReply;
|
|
2721
|
-
const matchSource = params.replyId ? embeddedTargetReply ? "embedded" : fetchedMatchedReply ? "fetched" : "miss" : targetReply === rootReply ? "fallback_root" : targetReply === embeddedTargetReply ? "embedded_latest" : "fetched_latest";
|
|
2722
|
-
params.logger?.(`feishu[${params.accountId}]: comment reply resolution comment=${params.commentId} requested_reply=${params.replyId ?? "none"} match_source=${matchSource} root=${safeJsonStringify({
|
|
2723
|
-
reply_id: rootReply?.reply_id,
|
|
2724
|
-
text_len: extractReplyText(rootReply)?.length ?? 0
|
|
2725
|
-
})} target=${safeJsonStringify({
|
|
2726
|
-
reply_id: targetReply?.reply_id,
|
|
2727
|
-
text_len: extractReplyText(targetReply)?.length ?? 0
|
|
2728
|
-
})}`);
|
|
2729
|
-
const meta = metaResponse?.code === 0 ? metaResponse.data?.metas?.[0] : void 0;
|
|
2730
|
-
return {
|
|
2731
|
-
documentTitle: meta?.title?.trim() || void 0,
|
|
2732
|
-
documentUrl: meta?.url?.trim() || void 0,
|
|
2733
|
-
isWholeComment: commentCard?.is_whole,
|
|
2734
|
-
quoteText: commentCard?.quote?.trim() || void 0,
|
|
2735
|
-
rootCommentText: extractReplyText(rootReply),
|
|
2736
|
-
targetReplyText: extractReplyText(targetReply)
|
|
2737
|
-
};
|
|
2738
|
-
}
|
|
2739
|
-
function buildDriveCommentSurfacePrompt(params) {
|
|
2740
|
-
const documentLabel = params.documentTitle ? `"${params.documentTitle}"` : `${params.fileType} document ${params.fileToken}`;
|
|
2741
|
-
const actionLabel = params.noticeType === "add_reply" ? "reply" : "comment";
|
|
2742
|
-
const lines = [params.targetReplyText ? `The user added a ${actionLabel} in ${documentLabel}: ${params.targetReplyText}` : `The user added a ${actionLabel} in ${documentLabel}.`];
|
|
2743
|
-
if (params.noticeType === "add_reply" && params.rootCommentText && params.rootCommentText !== params.targetReplyText) lines.push(`Original comment: ${params.rootCommentText}`);
|
|
2744
|
-
if (params.quoteText) lines.push(`Quoted content: ${params.quoteText}`);
|
|
2745
|
-
if (params.isMentioned === true) lines.push("This comment mentioned you.");
|
|
2746
|
-
if (params.documentUrl) lines.push(`Document link: ${params.documentUrl}`);
|
|
2747
|
-
lines.push(`Event type: ${params.noticeType}`, `file_token: ${params.fileToken}`, `file_type: ${params.fileType}`, `comment_id: ${params.commentId}`);
|
|
2748
|
-
if (params.isWholeComment === true) lines.push("This is a whole-document comment.");
|
|
2749
|
-
if (params.replyId?.trim()) lines.push(`reply_id: ${params.replyId.trim()}`);
|
|
2750
|
-
lines.push("This is a Feishu document comment-thread event, not a Feishu IM conversation. Your final text reply will be posted automatically to the current comment thread and will not be sent as an instant message.", "If you need to inspect or handle the comment thread, prefer the feishu_drive tools: use list_comments / list_comment_replies to inspect comments, and use reply_comment/add_comment to notify the user after modifying the document.", "Whole-document comments do not support direct replies. When the current comment is whole-document, use feishu_drive.add_comment for any user-visible follow-up instead of reply_comment.", "If the comment asks you to modify document content, such as adding, inserting, replacing, or deleting text, tables, or headings, you must first use feishu_doc to actually modify the document. Do not reply with only \"done\", \"I'll handle it\", or a restated plan without calling tools.", "If the comment quotes document content, that quoted text is usually the edit anchor. For requests like \"insert xxx below this content\", first locate the position around the quoted content, then use feishu_doc to make the change.", "If the comment asks you to summarize, explain, rewrite, translate, refine, continue, or review the document content \"below\", \"above\", \"this paragraph\", \"this section\", or the quoted content, you must also treat the quoted content as the primary target anchor instead of defaulting to the whole document.", "For requests like \"summarize the content below\", \"explain this section\", or \"continue writing from here\", first locate the relevant document fragment based on the comment's quoted content. If the quote is not sufficient to support the answer, then use feishu_doc.read or feishu_doc.list_blocks to read nearby context.", "Do not guess document content based only on the comment text, and do not output a vague summary before reading enough context. Unless the user explicitly asks to summarize the entire document, default to handling only the local scope related to the quoted content.", "When document edits are involved, first use feishu_doc.read or feishu_doc.list_blocks to confirm the context, then use feishu_doc writing or updating capabilities to complete the change. After the edit succeeds, notify the user through feishu_drive.reply_comment.", "If the document edit fails or you cannot locate the anchor, do not pretend it succeeded. Reply clearly in the comment thread with the reason for failure or the missing information.", "If this is a reading-comprehension task, such as summarization, explanation, or extraction, you may directly output the final answer text after confirming the context. The system will automatically reply with that answer in the current comment thread.", "Prefer plain text suitable for a comment thread. Unless the user explicitly asks for Markdown, do not use Markdown headings, bullet lists, numbered lists, tables, blockquotes, or fenced code blocks in the final reply.", "If source content was read in Markdown form, rewrite it into normal plain-text prose before replying in the comment thread instead of copying Markdown syntax through.", "Do not include internal reasoning, analysis, chain-of-thought, scratch work, or any \"Reasoning:\" / \"Thinking:\" section in a user-visible reply. Output only the final answer meant for the user, or NO_REPLY when appropriate.", "Do not narrate your plan or execution process in the user-visible reply. Avoid meta lead-ins such as \"I will...\", \"I’ll first...\", \"I need to...\", \"The user wants...\", \"I have updated...\", or \"I am going to...\".", "When the task is complete, reply only with the user-facing result itself, such as the final answer or a concise completion confirmation. Do not include preambles about what you plan to do next.", "When you produce a user-visible reply, keep it in the same language as the user's original comment or reply unless they explicitly ask for another language.", "If you have already completed the user-visible action through feishu_drive.reply_comment or feishu_drive.add_comment, output NO_REPLY at the end to avoid duplicate sending.", "If the user directly asks a question in the comment and a plain text answer is sufficient, output the answer text directly. The system will automatically reply with your final answer in the current comment thread.", "If you determine that the current comment does not require any user-visible action, output NO_REPLY at the end.");
|
|
2751
|
-
lines.push(`Decide what to do next based on this document ${actionLabel} event.`);
|
|
2752
|
-
return lines.join("\n");
|
|
2753
|
-
}
|
|
2754
|
-
async function resolveDriveCommentEventCore(params) {
|
|
2755
|
-
const { cfg, accountId, event, botOpenId, createClient = (account) => createFeishuClient(account), verificationTimeoutMs = FEISHU_COMMENT_VERIFY_TIMEOUT_MS, logger, waitMs = delayMs } = params;
|
|
2756
|
-
const eventId = event.event_id?.trim();
|
|
2757
|
-
const commentId = event.comment_id?.trim();
|
|
2758
|
-
const replyId = event.reply_id?.trim();
|
|
2759
|
-
const noticeType = event.notice_meta?.notice_type?.trim();
|
|
2760
|
-
const fileToken = event.notice_meta?.file_token?.trim();
|
|
2761
|
-
const fileType = normalizeCommentFileType(event.notice_meta?.file_type);
|
|
2762
|
-
const senderId = event.notice_meta?.from_user_id?.open_id?.trim();
|
|
2763
|
-
const senderUserId = event.notice_meta?.from_user_id?.user_id?.trim() || void 0;
|
|
2764
|
-
if (!eventId || !commentId || !noticeType || !fileToken || !fileType || !senderId) {
|
|
2765
|
-
logger?.(`feishu[${accountId}]: drive comment notice missing required fields event=${eventId ?? "unknown"} comment=${commentId ?? "unknown"}`);
|
|
2766
|
-
return null;
|
|
2767
|
-
}
|
|
2768
|
-
if (noticeType !== "add_comment" && noticeType !== "add_reply") {
|
|
2769
|
-
logger?.(`feishu[${accountId}]: unsupported drive comment notice type ${noticeType}`);
|
|
2770
|
-
return null;
|
|
2771
|
-
}
|
|
2772
|
-
if (!botOpenId) {
|
|
2773
|
-
logger?.(`feishu[${accountId}]: skipping drive comment notice because bot open_id is unavailable event=${eventId}`);
|
|
2774
|
-
return null;
|
|
2775
|
-
}
|
|
2776
|
-
if (senderId === botOpenId) {
|
|
2777
|
-
logger?.(`feishu[${accountId}]: ignoring self-authored drive comment notice event=${eventId} sender=${senderId}`);
|
|
2778
|
-
return null;
|
|
2779
|
-
}
|
|
2780
|
-
const context = await fetchDriveCommentContext({
|
|
2781
|
-
client: createClient(resolveFeishuAccount({
|
|
2782
|
-
cfg,
|
|
2783
|
-
accountId
|
|
2784
|
-
})),
|
|
2785
|
-
fileToken,
|
|
2786
|
-
fileType,
|
|
2787
|
-
commentId,
|
|
2788
|
-
replyId,
|
|
2789
|
-
timeoutMs: verificationTimeoutMs,
|
|
2790
|
-
logger,
|
|
2791
|
-
accountId,
|
|
2792
|
-
waitMs
|
|
2793
|
-
});
|
|
2794
|
-
return {
|
|
2795
|
-
eventId,
|
|
2796
|
-
commentId,
|
|
2797
|
-
replyId,
|
|
2798
|
-
noticeType,
|
|
2799
|
-
fileToken,
|
|
2800
|
-
fileType,
|
|
2801
|
-
isWholeComment: context.isWholeComment,
|
|
2802
|
-
senderId,
|
|
2803
|
-
senderUserId,
|
|
2804
|
-
timestamp: event.timestamp,
|
|
2805
|
-
isMentioned: event.is_mentioned,
|
|
2806
|
-
context
|
|
2807
|
-
};
|
|
2808
|
-
}
|
|
2809
|
-
function parseFeishuDriveCommentNoticeEventPayload(value) {
|
|
2810
|
-
if (!isRecord$1(value) || !isRecord$1(value.notice_meta)) return null;
|
|
2811
|
-
const noticeMeta = value.notice_meta;
|
|
2812
|
-
const fromUserId = isRecord$1(noticeMeta.from_user_id) ? noticeMeta.from_user_id : void 0;
|
|
2813
|
-
const toUserId = isRecord$1(noticeMeta.to_user_id) ? noticeMeta.to_user_id : void 0;
|
|
2814
|
-
return {
|
|
2815
|
-
comment_id: readString$1(value.comment_id),
|
|
2816
|
-
event_id: readString$1(value.event_id),
|
|
2817
|
-
is_mentioned: readBoolean(value.is_mentioned),
|
|
2818
|
-
notice_meta: {
|
|
2819
|
-
file_token: readString$1(noticeMeta.file_token),
|
|
2820
|
-
file_type: readString$1(noticeMeta.file_type),
|
|
2821
|
-
from_user_id: fromUserId ? {
|
|
2822
|
-
open_id: readString$1(fromUserId.open_id),
|
|
2823
|
-
user_id: readString$1(fromUserId.user_id),
|
|
2824
|
-
union_id: readString$1(fromUserId.union_id)
|
|
2825
|
-
} : void 0,
|
|
2826
|
-
notice_type: readString$1(noticeMeta.notice_type),
|
|
2827
|
-
to_user_id: toUserId ? {
|
|
2828
|
-
open_id: readString$1(toUserId.open_id),
|
|
2829
|
-
user_id: readString$1(toUserId.user_id),
|
|
2830
|
-
union_id: readString$1(toUserId.union_id)
|
|
2831
|
-
} : void 0
|
|
2832
|
-
},
|
|
2833
|
-
reply_id: readString$1(value.reply_id),
|
|
2834
|
-
timestamp: readString$1(value.timestamp),
|
|
2835
|
-
type: readString$1(value.type)
|
|
2836
|
-
};
|
|
2837
|
-
}
|
|
2838
|
-
async function resolveDriveCommentEventTurn(params) {
|
|
2839
|
-
const resolved = await resolveDriveCommentEventCore(params);
|
|
2840
|
-
if (!resolved) return null;
|
|
2841
|
-
const prompt = buildDriveCommentSurfacePrompt({
|
|
2842
|
-
noticeType: resolved.noticeType,
|
|
2843
|
-
fileType: resolved.fileType,
|
|
2844
|
-
fileToken: resolved.fileToken,
|
|
2845
|
-
commentId: resolved.commentId,
|
|
2846
|
-
replyId: resolved.replyId,
|
|
2847
|
-
isWholeComment: resolved.isWholeComment,
|
|
2848
|
-
isMentioned: resolved.isMentioned,
|
|
2849
|
-
documentTitle: resolved.context.documentTitle,
|
|
2850
|
-
documentUrl: resolved.context.documentUrl,
|
|
2851
|
-
quoteText: resolved.context.quoteText,
|
|
2852
|
-
rootCommentText: resolved.context.rootCommentText,
|
|
2853
|
-
targetReplyText: resolved.context.targetReplyText
|
|
2854
|
-
});
|
|
2855
|
-
const preview = prompt.replace(/\s+/g, " ").slice(0, 160);
|
|
2856
|
-
return {
|
|
2857
|
-
eventId: resolved.eventId,
|
|
2858
|
-
messageId: `drive-comment:${resolved.eventId}`,
|
|
2859
|
-
commentId: resolved.commentId,
|
|
2860
|
-
replyId: resolved.replyId,
|
|
2861
|
-
noticeType: resolved.noticeType,
|
|
2862
|
-
fileToken: resolved.fileToken,
|
|
2863
|
-
fileType: resolved.fileType,
|
|
2864
|
-
isWholeComment: resolved.isWholeComment,
|
|
2865
|
-
senderId: resolved.senderId,
|
|
2866
|
-
senderUserId: resolved.senderUserId,
|
|
2867
|
-
timestamp: resolved.timestamp,
|
|
2868
|
-
isMentioned: resolved.isMentioned,
|
|
2869
|
-
documentTitle: resolved.context.documentTitle,
|
|
2870
|
-
documentUrl: resolved.context.documentUrl,
|
|
2871
|
-
quoteText: resolved.context.quoteText,
|
|
2872
|
-
rootCommentText: resolved.context.rootCommentText,
|
|
2873
|
-
targetReplyText: resolved.context.targetReplyText,
|
|
2874
|
-
prompt,
|
|
2875
|
-
preview
|
|
2876
|
-
};
|
|
2877
|
-
}
|
|
2878
|
-
//#endregion
|
|
2879
|
-
//#region extensions/feishu/src/comment-handler.ts
|
|
2880
|
-
function buildCommentSessionKey(params) {
|
|
2881
|
-
return params.core.channel.routing.buildAgentSessionKey({
|
|
2882
|
-
agentId: params.route.agentId,
|
|
2883
|
-
channel: "feishu",
|
|
2884
|
-
accountId: params.route.accountId,
|
|
2885
|
-
peer: {
|
|
2886
|
-
kind: "direct",
|
|
2887
|
-
id: params.commentTarget
|
|
2888
|
-
},
|
|
2889
|
-
dmScope: "per-account-channel-peer"
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
function parseTimestampMs(value) {
|
|
2893
|
-
const parsed = value ? Number.parseInt(value, 10) : NaN;
|
|
2894
|
-
return Number.isFinite(parsed) ? parsed : Date.now();
|
|
2895
|
-
}
|
|
2896
|
-
async function handleFeishuCommentEvent(params) {
|
|
2897
|
-
const account = resolveFeishuRuntimeAccount({
|
|
2898
|
-
cfg: params.cfg,
|
|
2899
|
-
accountId: params.accountId
|
|
2900
|
-
});
|
|
2901
|
-
const feishuCfg = account.config;
|
|
2902
|
-
const core = getFeishuRuntime();
|
|
2903
|
-
const log = params.runtime?.log ?? console.log;
|
|
2904
|
-
const error = params.runtime?.error ?? console.error;
|
|
2905
|
-
const runtime = params.runtime ?? {
|
|
2906
|
-
log,
|
|
2907
|
-
error
|
|
2908
|
-
};
|
|
2909
|
-
const turn = await resolveDriveCommentEventTurn({
|
|
2910
|
-
cfg: params.cfg,
|
|
2911
|
-
accountId: account.accountId,
|
|
2912
|
-
event: params.event,
|
|
2913
|
-
botOpenId: params.botOpenId,
|
|
2914
|
-
logger: log
|
|
2915
|
-
});
|
|
2916
|
-
if (!turn) {
|
|
2917
|
-
log(`feishu[${account.accountId}]: drive comment notice skipped event=${params.event.event_id ?? "unknown"} comment=${params.event.comment_id ?? "unknown"}`);
|
|
2918
|
-
return;
|
|
2919
|
-
}
|
|
2920
|
-
const commentTarget = buildFeishuCommentTarget({
|
|
2921
|
-
fileType: turn.fileType,
|
|
2922
|
-
fileToken: turn.fileToken,
|
|
2923
|
-
commentId: turn.commentId
|
|
2924
|
-
});
|
|
2925
|
-
const dmPolicy = feishuCfg?.dmPolicy ?? "pairing";
|
|
2926
|
-
const configAllowFrom = feishuCfg?.allowFrom ?? [];
|
|
2927
|
-
const pairing = createChannelPairingController({
|
|
2928
|
-
core,
|
|
2929
|
-
channel: "feishu",
|
|
2930
|
-
accountId: account.accountId
|
|
2931
|
-
});
|
|
2932
|
-
const storeAllowFrom = dmPolicy !== "allowlist" && dmPolicy !== "open" ? await pairing.readAllowFromStore().catch(() => []) : [];
|
|
2933
|
-
const senderAllowed = resolveFeishuAllowlistMatch({
|
|
2934
|
-
allowFrom: [...configAllowFrom, ...storeAllowFrom],
|
|
2935
|
-
senderId: turn.senderId,
|
|
2936
|
-
senderIds: [turn.senderUserId]
|
|
2937
|
-
}).allowed;
|
|
2938
|
-
if (dmPolicy !== "open" && !senderAllowed) {
|
|
2939
|
-
if (dmPolicy === "pairing") {
|
|
2940
|
-
const client = createFeishuClient(account);
|
|
2941
|
-
await pairing.issueChallenge({
|
|
2942
|
-
senderId: turn.senderId,
|
|
2943
|
-
senderIdLine: `Your Feishu user id: ${turn.senderId}`,
|
|
2944
|
-
meta: { name: turn.senderId },
|
|
2945
|
-
onCreated: ({ code }) => {
|
|
2946
|
-
log(`feishu[${account.accountId}]: comment pairing request sender=${turn.senderId} code=${code}`);
|
|
2947
|
-
},
|
|
2948
|
-
sendPairingReply: async (text) => {
|
|
2949
|
-
await deliverCommentThreadText(client, {
|
|
2950
|
-
file_token: turn.fileToken,
|
|
2951
|
-
file_type: turn.fileType,
|
|
2952
|
-
comment_id: turn.commentId,
|
|
2953
|
-
content: text,
|
|
2954
|
-
is_whole_comment: turn.isWholeComment
|
|
2955
|
-
});
|
|
2956
|
-
},
|
|
2957
|
-
onReplyError: (err) => {
|
|
2958
|
-
log(`feishu[${account.accountId}]: comment pairing reply failed for ${turn.senderId}: ${String(err)}`);
|
|
2959
|
-
}
|
|
2960
|
-
});
|
|
2961
|
-
} else log(`feishu[${account.accountId}]: blocked unauthorized comment sender ${turn.senderId} (dmPolicy=${dmPolicy}, comment=${turn.commentId})`);
|
|
2962
|
-
return;
|
|
2963
|
-
}
|
|
2964
|
-
let effectiveCfg = params.cfg;
|
|
2965
|
-
let route = core.channel.routing.resolveAgentRoute({
|
|
2966
|
-
cfg: params.cfg,
|
|
2967
|
-
channel: "feishu",
|
|
2968
|
-
accountId: account.accountId,
|
|
2969
|
-
peer: {
|
|
2970
|
-
kind: "direct",
|
|
2971
|
-
id: turn.senderId
|
|
2972
|
-
}
|
|
2973
|
-
});
|
|
2974
|
-
if (route.matchedBy === "default") {
|
|
2975
|
-
const dynamicCfg = feishuCfg?.dynamicAgentCreation;
|
|
2976
|
-
if (dynamicCfg?.enabled) {
|
|
2977
|
-
const dynamicResult = await maybeCreateDynamicAgent({
|
|
2978
|
-
cfg: params.cfg,
|
|
2979
|
-
runtime: core,
|
|
2980
|
-
senderOpenId: turn.senderId,
|
|
2981
|
-
dynamicCfg,
|
|
2982
|
-
log: (message) => log(message)
|
|
2983
|
-
});
|
|
2984
|
-
if (dynamicResult.created) {
|
|
2985
|
-
effectiveCfg = dynamicResult.updatedCfg;
|
|
2986
|
-
route = core.channel.routing.resolveAgentRoute({
|
|
2987
|
-
cfg: dynamicResult.updatedCfg,
|
|
2988
|
-
channel: "feishu",
|
|
2989
|
-
accountId: account.accountId,
|
|
2990
|
-
peer: {
|
|
2991
|
-
kind: "direct",
|
|
2992
|
-
id: turn.senderId
|
|
2993
|
-
}
|
|
2994
|
-
});
|
|
2995
|
-
log(`feishu[${account.accountId}]: dynamic agent created for comment flow, route=${route.sessionKey}`);
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
const commentSessionKey = buildCommentSessionKey({
|
|
3000
|
-
core,
|
|
3001
|
-
route,
|
|
3002
|
-
commentTarget
|
|
3003
|
-
});
|
|
3004
|
-
const bodyForAgent = `[message_id: ${turn.messageId}]\n${turn.prompt}`;
|
|
3005
|
-
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
3006
|
-
Body: bodyForAgent,
|
|
3007
|
-
BodyForAgent: bodyForAgent,
|
|
3008
|
-
RawBody: turn.targetReplyText ?? turn.rootCommentText ?? turn.prompt,
|
|
3009
|
-
CommandBody: turn.targetReplyText ?? turn.rootCommentText ?? turn.prompt,
|
|
3010
|
-
From: `feishu:${turn.senderId}`,
|
|
3011
|
-
To: commentTarget,
|
|
3012
|
-
SessionKey: commentSessionKey,
|
|
3013
|
-
AccountId: route.accountId,
|
|
3014
|
-
ChatType: "direct",
|
|
3015
|
-
ConversationLabel: turn.documentTitle ? `Feishu comment · ${turn.documentTitle}` : "Feishu comment",
|
|
3016
|
-
SenderName: turn.senderId,
|
|
3017
|
-
SenderId: turn.senderId,
|
|
3018
|
-
Provider: "feishu",
|
|
3019
|
-
Surface: "feishu-comment",
|
|
3020
|
-
MessageSid: turn.messageId,
|
|
3021
|
-
Timestamp: parseTimestampMs(turn.timestamp),
|
|
3022
|
-
WasMentioned: turn.isMentioned,
|
|
3023
|
-
CommandAuthorized: false,
|
|
3024
|
-
OriginatingChannel: "feishu",
|
|
3025
|
-
OriginatingTo: commentTarget
|
|
3026
|
-
});
|
|
3027
|
-
const storePath = core.channel.session.resolveStorePath(effectiveCfg.session?.store, { agentId: route.agentId });
|
|
3028
|
-
await core.channel.session.recordInboundSession({
|
|
3029
|
-
storePath,
|
|
3030
|
-
sessionKey: commentSessionKey,
|
|
3031
|
-
ctx: ctxPayload,
|
|
3032
|
-
onRecordError: (err) => {
|
|
3033
|
-
error(`feishu[${account.accountId}]: failed to record comment inbound session ${commentSessionKey}: ${String(err)}`);
|
|
3034
|
-
}
|
|
3035
|
-
});
|
|
3036
|
-
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuCommentReplyDispatcher({
|
|
3037
|
-
cfg: effectiveCfg,
|
|
3038
|
-
agentId: route.agentId,
|
|
3039
|
-
runtime,
|
|
3040
|
-
accountId: account.accountId,
|
|
3041
|
-
fileToken: turn.fileToken,
|
|
3042
|
-
fileType: turn.fileType,
|
|
3043
|
-
commentId: turn.commentId,
|
|
3044
|
-
isWholeComment: turn.isWholeComment
|
|
3045
|
-
});
|
|
3046
|
-
log(`feishu[${account.accountId}]: dispatching drive comment to agent (session=${commentSessionKey} comment=${turn.commentId} type=${turn.noticeType})`);
|
|
3047
|
-
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
|
|
3048
|
-
dispatcher,
|
|
3049
|
-
onSettled: () => {
|
|
3050
|
-
markDispatchIdle();
|
|
3051
|
-
},
|
|
3052
|
-
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
3053
|
-
ctx: ctxPayload,
|
|
3054
|
-
cfg: effectiveCfg,
|
|
3055
|
-
dispatcher,
|
|
3056
|
-
replyOptions
|
|
3057
|
-
})
|
|
3058
|
-
});
|
|
3059
|
-
log(`feishu[${account.accountId}]: drive comment dispatch complete (queuedFinal=${queuedFinal}, replies=${counts.final}, session=${commentSessionKey})`);
|
|
3060
|
-
}
|
|
3061
|
-
//#endregion
|
|
3062
|
-
//#region extensions/feishu/src/monitor.startup.ts
|
|
3063
|
-
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS = 3e4;
|
|
3064
|
-
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV = "OPENCLAW_FEISHU_STARTUP_PROBE_TIMEOUT_MS";
|
|
3065
|
-
function resolveStartupProbeTimeoutMs() {
|
|
3066
|
-
const raw = process.env[FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV];
|
|
3067
|
-
if (raw) {
|
|
3068
|
-
const parsed = Number(raw);
|
|
3069
|
-
if (Number.isFinite(parsed) && parsed > 0) return Math.floor(parsed);
|
|
3070
|
-
console.warn(`[feishu] ${FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV}="${raw}" is invalid; using default ${FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS}ms`);
|
|
3071
|
-
}
|
|
3072
|
-
return FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS;
|
|
3073
|
-
}
|
|
3074
|
-
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS = resolveStartupProbeTimeoutMs();
|
|
3075
|
-
function isTimeoutErrorMessage(message) {
|
|
3076
|
-
return message?.toLowerCase().includes("timeout") || message?.toLowerCase().includes("timed out") ? true : false;
|
|
3077
|
-
}
|
|
3078
|
-
function isAbortErrorMessage(message) {
|
|
3079
|
-
return message?.toLowerCase().includes("aborted") ?? false;
|
|
3080
|
-
}
|
|
3081
|
-
async function fetchBotIdentityForMonitor(account, options = {}) {
|
|
3082
|
-
if (options.abortSignal?.aborted) return {};
|
|
3083
|
-
const timeoutMs = options.timeoutMs ?? FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS;
|
|
3084
|
-
const result = await probeFeishu(account, {
|
|
3085
|
-
timeoutMs,
|
|
3086
|
-
abortSignal: options.abortSignal
|
|
3087
|
-
});
|
|
3088
|
-
if (result.ok) return {
|
|
3089
|
-
botOpenId: result.botOpenId,
|
|
3090
|
-
botName: result.botName
|
|
3091
|
-
};
|
|
3092
|
-
if (options.abortSignal?.aborted || isAbortErrorMessage(result.error)) return {};
|
|
3093
|
-
if (isTimeoutErrorMessage(result.error)) (options.runtime?.error ?? console.error)(`feishu[${account.accountId}]: bot info probe timed out after ${timeoutMs}ms; continuing startup`);
|
|
3094
|
-
return {};
|
|
3095
|
-
}
|
|
3096
|
-
//#endregion
|
|
3097
|
-
//#region extensions/feishu/src/monitor.state.ts
|
|
3098
|
-
const wsClients = /* @__PURE__ */ new Map();
|
|
3099
|
-
const httpServers = /* @__PURE__ */ new Map();
|
|
3100
|
-
const botOpenIds = /* @__PURE__ */ new Map();
|
|
3101
|
-
const botNames = /* @__PURE__ */ new Map();
|
|
3102
|
-
const FEISHU_WEBHOOK_MAX_BODY_BYTES = 64 * 1024;
|
|
3103
|
-
const FEISHU_WEBHOOK_BODY_TIMEOUT_MS = 5e3;
|
|
3104
|
-
const FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS = {
|
|
3105
|
-
windowMs: 6e4,
|
|
3106
|
-
maxRequests: 120,
|
|
3107
|
-
maxTrackedKeys: 4096
|
|
3108
|
-
};
|
|
3109
|
-
const FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS = {
|
|
3110
|
-
maxTrackedKeys: 4096,
|
|
3111
|
-
ttlMs: 360 * 6e4,
|
|
3112
|
-
logEvery: 25
|
|
3113
|
-
};
|
|
3114
|
-
function coercePositiveInt(value, fallback) {
|
|
3115
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
|
|
3116
|
-
const normalized = Math.floor(value);
|
|
3117
|
-
return normalized > 0 ? normalized : fallback;
|
|
3118
|
-
}
|
|
3119
|
-
function resolveFeishuWebhookRateLimitDefaultsForTest(defaults) {
|
|
3120
|
-
const resolved = defaults;
|
|
3121
|
-
return {
|
|
3122
|
-
windowMs: coercePositiveInt(resolved?.windowMs, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.windowMs),
|
|
3123
|
-
maxRequests: coercePositiveInt(resolved?.maxRequests, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxRequests),
|
|
3124
|
-
maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxTrackedKeys)
|
|
3125
|
-
};
|
|
3126
|
-
}
|
|
3127
|
-
function resolveFeishuWebhookAnomalyDefaultsForTest(defaults) {
|
|
3128
|
-
const resolved = defaults;
|
|
3129
|
-
return {
|
|
3130
|
-
maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.maxTrackedKeys),
|
|
3131
|
-
ttlMs: coercePositiveInt(resolved?.ttlMs, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.ttlMs),
|
|
3132
|
-
logEvery: coercePositiveInt(resolved?.logEvery, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.logEvery)
|
|
3133
|
-
};
|
|
3134
|
-
}
|
|
3135
|
-
const feishuWebhookRateLimitDefaults = resolveFeishuWebhookRateLimitDefaultsForTest(WEBHOOK_RATE_LIMIT_DEFAULTS);
|
|
3136
|
-
const feishuWebhookAnomalyDefaults = resolveFeishuWebhookAnomalyDefaultsForTest(WEBHOOK_ANOMALY_COUNTER_DEFAULTS);
|
|
3137
|
-
const feishuWebhookRateLimiter = createFixedWindowRateLimiter({
|
|
3138
|
-
windowMs: feishuWebhookRateLimitDefaults.windowMs,
|
|
3139
|
-
maxRequests: feishuWebhookRateLimitDefaults.maxRequests,
|
|
3140
|
-
maxTrackedKeys: feishuWebhookRateLimitDefaults.maxTrackedKeys
|
|
3141
|
-
});
|
|
3142
|
-
const feishuWebhookAnomalyTracker = createWebhookAnomalyTracker({
|
|
3143
|
-
maxTrackedKeys: feishuWebhookAnomalyDefaults.maxTrackedKeys,
|
|
3144
|
-
ttlMs: feishuWebhookAnomalyDefaults.ttlMs,
|
|
3145
|
-
logEvery: feishuWebhookAnomalyDefaults.logEvery
|
|
3146
|
-
});
|
|
3147
|
-
function closeWsClient(client) {
|
|
3148
|
-
if (!client) return;
|
|
3149
|
-
try {
|
|
3150
|
-
client.close();
|
|
3151
|
-
} catch {}
|
|
3152
|
-
}
|
|
3153
|
-
function clearFeishuWebhookRateLimitStateForTest() {
|
|
3154
|
-
feishuWebhookRateLimiter.clear();
|
|
3155
|
-
feishuWebhookAnomalyTracker.clear();
|
|
3156
|
-
}
|
|
3157
|
-
function getFeishuWebhookRateLimitStateSizeForTest() {
|
|
3158
|
-
return feishuWebhookRateLimiter.size();
|
|
3159
|
-
}
|
|
3160
|
-
function isWebhookRateLimitedForTest(key, nowMs) {
|
|
3161
|
-
return feishuWebhookRateLimiter.isRateLimited(key, nowMs);
|
|
3162
|
-
}
|
|
3163
|
-
function recordWebhookStatus(runtime, accountId, path, statusCode) {
|
|
3164
|
-
feishuWebhookAnomalyTracker.record({
|
|
3165
|
-
key: `${accountId}:${path}:${statusCode}`,
|
|
3166
|
-
statusCode,
|
|
3167
|
-
log: runtime?.log ?? console.log,
|
|
3168
|
-
message: (count) => `feishu[${accountId}]: webhook anomaly path=${path} status=${statusCode} count=${count}`
|
|
3169
|
-
});
|
|
3170
|
-
}
|
|
3171
|
-
function stopFeishuMonitorState(accountId) {
|
|
3172
|
-
if (accountId) {
|
|
3173
|
-
closeWsClient(wsClients.get(accountId));
|
|
3174
|
-
wsClients.delete(accountId);
|
|
3175
|
-
const server = httpServers.get(accountId);
|
|
3176
|
-
if (server) {
|
|
3177
|
-
server.close();
|
|
3178
|
-
httpServers.delete(accountId);
|
|
3179
|
-
}
|
|
3180
|
-
botOpenIds.delete(accountId);
|
|
3181
|
-
botNames.delete(accountId);
|
|
3182
|
-
return;
|
|
3183
|
-
}
|
|
3184
|
-
for (const client of wsClients.values()) closeWsClient(client);
|
|
3185
|
-
wsClients.clear();
|
|
3186
|
-
for (const server of httpServers.values()) server.close();
|
|
3187
|
-
httpServers.clear();
|
|
3188
|
-
botOpenIds.clear();
|
|
3189
|
-
botNames.clear();
|
|
3190
|
-
}
|
|
3191
|
-
//#endregion
|
|
3192
|
-
//#region extensions/feishu/src/monitor.bot-identity.ts
|
|
3193
|
-
const BOT_IDENTITY_RETRY_DELAYS_MS = [
|
|
3194
|
-
6e4,
|
|
3195
|
-
12e4,
|
|
3196
|
-
3e5,
|
|
3197
|
-
6e5,
|
|
3198
|
-
9e5
|
|
3199
|
-
];
|
|
3200
|
-
function applyBotIdentityState(accountId, identity) {
|
|
3201
|
-
const botOpenId = identity.botOpenId?.trim() || void 0;
|
|
3202
|
-
const botName = identity.botName?.trim() || void 0;
|
|
3203
|
-
botOpenIds.set(accountId, botOpenId ?? "");
|
|
3204
|
-
if (botName) botNames.set(accountId, botName);
|
|
3205
|
-
else botNames.delete(accountId);
|
|
3206
|
-
return {
|
|
3207
|
-
botOpenId,
|
|
3208
|
-
botName
|
|
3209
|
-
};
|
|
3210
|
-
}
|
|
3211
|
-
async function retryBotIdentityProbe(account, accountId, runtime, abortSignal) {
|
|
3212
|
-
const log = runtime?.log ?? console.log;
|
|
3213
|
-
const error = runtime?.error ?? console.error;
|
|
3214
|
-
for (let i = 0; i < BOT_IDENTITY_RETRY_DELAYS_MS.length; i += 1) {
|
|
3215
|
-
if (abortSignal?.aborted) return;
|
|
3216
|
-
if (!await waitForAbortableDelay(BOT_IDENTITY_RETRY_DELAYS_MS[i], abortSignal)) return;
|
|
3217
|
-
const resolved = applyBotIdentityState(accountId, await fetchBotIdentityForMonitor(account, {
|
|
3218
|
-
runtime,
|
|
3219
|
-
abortSignal
|
|
3220
|
-
}));
|
|
3221
|
-
if (resolved.botOpenId) {
|
|
3222
|
-
log(`feishu[${accountId}]: bot open_id recovered via background retry: ${resolved.botOpenId}`);
|
|
3223
|
-
return;
|
|
3224
|
-
}
|
|
3225
|
-
const nextDelay = BOT_IDENTITY_RETRY_DELAYS_MS[i + 1];
|
|
3226
|
-
error(`feishu[${accountId}]: bot identity background retry ${i + 1}/${BOT_IDENTITY_RETRY_DELAYS_MS.length} failed` + (nextDelay ? `; next attempt in ${nextDelay / 1e3}s` : ""));
|
|
3227
|
-
}
|
|
3228
|
-
error(`feishu[${accountId}]: bot identity background retry exhausted; requireMention group messages may be skipped until restart`);
|
|
3229
|
-
}
|
|
3230
|
-
function startBotIdentityRecovery(params) {
|
|
3231
|
-
const { account, accountId, runtime, abortSignal } = params;
|
|
3232
|
-
const log = runtime?.log ?? console.log;
|
|
3233
|
-
log(`feishu[${accountId}]: bot open_id unknown; starting background retry (delays: ${BOT_IDENTITY_RETRY_DELAYS_MS.map((delay) => `${delay / 1e3}s`).join(", ")})`);
|
|
3234
|
-
log(`feishu[${accountId}]: requireMention group messages stay gated until bot identity recovery succeeds`);
|
|
3235
|
-
retryBotIdentityProbe(account, accountId, runtime, abortSignal);
|
|
3236
|
-
}
|
|
3237
|
-
//#endregion
|
|
3238
|
-
//#region extensions/feishu/src/monitor.transport.ts
|
|
3239
|
-
function isFeishuWebhookPayload(value) {
|
|
3240
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3241
|
-
}
|
|
3242
|
-
function buildFeishuWebhookEnvelope(req, payload) {
|
|
3243
|
-
return Object.assign(Object.create({ headers: req.headers }), payload);
|
|
3244
|
-
}
|
|
3245
|
-
function parseFeishuWebhookPayload(rawBody) {
|
|
3246
|
-
try {
|
|
3247
|
-
const parsed = JSON.parse(rawBody);
|
|
3248
|
-
return isFeishuWebhookPayload(parsed) ? parsed : null;
|
|
3249
|
-
} catch {
|
|
3250
|
-
return null;
|
|
3251
|
-
}
|
|
3252
|
-
}
|
|
3253
|
-
function isFeishuWebhookSignatureValid(params) {
|
|
3254
|
-
const encryptKey = params.encryptKey?.trim();
|
|
3255
|
-
if (!encryptKey) return true;
|
|
3256
|
-
const timestampHeader = params.headers["x-lark-request-timestamp"];
|
|
3257
|
-
const nonceHeader = params.headers["x-lark-request-nonce"];
|
|
3258
|
-
const signatureHeader = params.headers["x-lark-signature"];
|
|
3259
|
-
const timestamp = Array.isArray(timestampHeader) ? timestampHeader[0] : timestampHeader;
|
|
3260
|
-
const nonce = Array.isArray(nonceHeader) ? nonceHeader[0] : nonceHeader;
|
|
3261
|
-
const signature = Array.isArray(signatureHeader) ? signatureHeader[0] : signatureHeader;
|
|
3262
|
-
if (!timestamp || !nonce || !signature) return false;
|
|
3263
|
-
return safeEqualSecret(crypto.createHash("sha256").update(timestamp + nonce + encryptKey + params.rawBody).digest("hex"), signature);
|
|
3264
|
-
}
|
|
3265
|
-
function respondText(res, statusCode, body) {
|
|
3266
|
-
res.statusCode = statusCode;
|
|
3267
|
-
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
3268
|
-
res.end(body);
|
|
3269
|
-
}
|
|
3270
|
-
async function monitorWebSocket({ account, accountId, runtime, abortSignal, eventDispatcher }) {
|
|
3271
|
-
const log = runtime?.log ?? console.log;
|
|
3272
|
-
const error = runtime?.error ?? console.error;
|
|
3273
|
-
log(`feishu[${accountId}]: starting WebSocket connection...`);
|
|
3274
|
-
const wsClient = createFeishuWSClient(account);
|
|
3275
|
-
wsClients.set(accountId, wsClient);
|
|
3276
|
-
return new Promise((resolve, reject) => {
|
|
3277
|
-
let cleanedUp = false;
|
|
3278
|
-
const cleanup = () => {
|
|
3279
|
-
if (cleanedUp) return;
|
|
3280
|
-
cleanedUp = true;
|
|
3281
|
-
abortSignal?.removeEventListener("abort", handleAbort);
|
|
3282
|
-
try {
|
|
3283
|
-
wsClient.close();
|
|
3284
|
-
} catch (err) {
|
|
3285
|
-
error(`feishu[${accountId}]: error closing WebSocket client: ${String(err)}`);
|
|
3286
|
-
} finally {
|
|
3287
|
-
wsClients.delete(accountId);
|
|
3288
|
-
botOpenIds.delete(accountId);
|
|
3289
|
-
botNames.delete(accountId);
|
|
3290
|
-
}
|
|
3291
|
-
};
|
|
3292
|
-
function handleAbort() {
|
|
3293
|
-
log(`feishu[${accountId}]: abort signal received, stopping`);
|
|
3294
|
-
cleanup();
|
|
3295
|
-
resolve();
|
|
3296
|
-
}
|
|
3297
|
-
if (abortSignal?.aborted) {
|
|
3298
|
-
cleanup();
|
|
3299
|
-
resolve();
|
|
3300
|
-
return;
|
|
3301
|
-
}
|
|
3302
|
-
abortSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
3303
|
-
try {
|
|
3304
|
-
wsClient.start({ eventDispatcher });
|
|
3305
|
-
log(`feishu[${accountId}]: WebSocket client started`);
|
|
3306
|
-
} catch (err) {
|
|
3307
|
-
cleanup();
|
|
3308
|
-
reject(err);
|
|
3309
|
-
}
|
|
3310
|
-
});
|
|
3311
|
-
}
|
|
3312
|
-
async function monitorWebhook({ account, accountId, runtime, abortSignal, eventDispatcher }) {
|
|
3313
|
-
const log = runtime?.log ?? console.log;
|
|
3314
|
-
const error = runtime?.error ?? console.error;
|
|
3315
|
-
const port = account.config.webhookPort ?? 3e3;
|
|
3316
|
-
const path = account.config.webhookPath ?? "/feishu/events";
|
|
3317
|
-
const host = account.config.webhookHost ?? "127.0.0.1";
|
|
3318
|
-
log(`feishu[${accountId}]: starting Webhook server on ${host}:${port}, path ${path}...`);
|
|
3319
|
-
const server = http.createServer();
|
|
3320
|
-
server.on("request", (req, res) => {
|
|
3321
|
-
res.on("finish", () => {
|
|
3322
|
-
recordWebhookStatus(runtime, accountId, path, res.statusCode);
|
|
3323
|
-
});
|
|
3324
|
-
if (!applyBasicWebhookRequestGuards({
|
|
3325
|
-
req,
|
|
3326
|
-
res,
|
|
3327
|
-
rateLimiter: feishuWebhookRateLimiter,
|
|
3328
|
-
rateLimitKey: `${accountId}:${path}:${req.socket.remoteAddress ?? "unknown"}`,
|
|
3329
|
-
nowMs: Date.now(),
|
|
3330
|
-
requireJsonContentType: true
|
|
3331
|
-
})) return;
|
|
3332
|
-
const guard = installRequestBodyLimitGuard(req, res, {
|
|
3333
|
-
maxBytes: FEISHU_WEBHOOK_MAX_BODY_BYTES,
|
|
3334
|
-
timeoutMs: FEISHU_WEBHOOK_BODY_TIMEOUT_MS,
|
|
3335
|
-
responseFormat: "text"
|
|
3336
|
-
});
|
|
3337
|
-
if (guard.isTripped()) return;
|
|
3338
|
-
(async () => {
|
|
3339
|
-
try {
|
|
3340
|
-
const rawBody = await readRequestBodyWithLimit(req, {
|
|
3341
|
-
maxBytes: FEISHU_WEBHOOK_MAX_BODY_BYTES,
|
|
3342
|
-
timeoutMs: FEISHU_WEBHOOK_BODY_TIMEOUT_MS
|
|
3343
|
-
});
|
|
3344
|
-
if (guard.isTripped() || res.writableEnded) return;
|
|
3345
|
-
if (!isFeishuWebhookSignatureValid({
|
|
3346
|
-
headers: req.headers,
|
|
3347
|
-
rawBody,
|
|
3348
|
-
encryptKey: account.encryptKey
|
|
3349
|
-
})) {
|
|
3350
|
-
respondText(res, 401, "Invalid signature");
|
|
3351
|
-
return;
|
|
3352
|
-
}
|
|
3353
|
-
const payload = parseFeishuWebhookPayload(rawBody);
|
|
3354
|
-
if (!payload) {
|
|
3355
|
-
respondText(res, 400, "Invalid JSON");
|
|
3356
|
-
return;
|
|
3357
|
-
}
|
|
3358
|
-
const { isChallenge, challenge } = Lark.generateChallenge(payload, { encryptKey: account.encryptKey ?? "" });
|
|
3359
|
-
if (isChallenge) {
|
|
3360
|
-
res.statusCode = 200;
|
|
3361
|
-
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
3362
|
-
res.end(JSON.stringify(challenge));
|
|
3363
|
-
return;
|
|
3364
|
-
}
|
|
3365
|
-
const value = await eventDispatcher.invoke(buildFeishuWebhookEnvelope(req, payload), { needCheck: false });
|
|
3366
|
-
if (!res.headersSent) {
|
|
3367
|
-
res.statusCode = 200;
|
|
3368
|
-
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
3369
|
-
res.end(JSON.stringify(value));
|
|
3370
|
-
}
|
|
3371
|
-
} catch (err) {
|
|
3372
|
-
if (isRequestBodyLimitError(err)) {
|
|
3373
|
-
if (!res.headersSent) respondText(res, err.statusCode, requestBodyErrorToText(err.code));
|
|
3374
|
-
return;
|
|
3375
|
-
}
|
|
3376
|
-
if (!guard.isTripped()) {
|
|
3377
|
-
error(`feishu[${accountId}]: webhook handler error: ${String(err)}`);
|
|
3378
|
-
if (!res.headersSent) respondText(res, 500, "Internal Server Error");
|
|
3379
|
-
}
|
|
3380
|
-
} finally {
|
|
3381
|
-
guard.dispose();
|
|
3382
|
-
}
|
|
3383
|
-
})();
|
|
3384
|
-
});
|
|
3385
|
-
httpServers.set(accountId, server);
|
|
3386
|
-
return new Promise((resolve, reject) => {
|
|
3387
|
-
const cleanup = () => {
|
|
3388
|
-
server.close();
|
|
3389
|
-
httpServers.delete(accountId);
|
|
3390
|
-
botOpenIds.delete(accountId);
|
|
3391
|
-
botNames.delete(accountId);
|
|
3392
|
-
};
|
|
3393
|
-
const handleAbort = () => {
|
|
3394
|
-
log(`feishu[${accountId}]: abort signal received, stopping Webhook server`);
|
|
3395
|
-
cleanup();
|
|
3396
|
-
resolve();
|
|
3397
|
-
};
|
|
3398
|
-
if (abortSignal?.aborted) {
|
|
3399
|
-
cleanup();
|
|
3400
|
-
resolve();
|
|
3401
|
-
return;
|
|
3402
|
-
}
|
|
3403
|
-
abortSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
3404
|
-
server.listen(port, host, () => {
|
|
3405
|
-
log(`feishu[${accountId}]: Webhook server listening on ${host}:${port}`);
|
|
3406
|
-
});
|
|
3407
|
-
server.on("error", (err) => {
|
|
3408
|
-
error(`feishu[${accountId}]: Webhook server error: ${err}`);
|
|
3409
|
-
abortSignal?.removeEventListener("abort", handleAbort);
|
|
3410
|
-
reject(err);
|
|
3411
|
-
});
|
|
3412
|
-
});
|
|
3413
|
-
}
|
|
3414
|
-
//#endregion
|
|
3415
|
-
//#region extensions/feishu/src/monitor.account.ts
|
|
3416
|
-
const FEISHU_REACTION_VERIFY_TIMEOUT_MS = 1500;
|
|
3417
|
-
async function resolveReactionSyntheticEvent(params) {
|
|
3418
|
-
const { cfg, accountId, event, botOpenId, fetchMessage = getMessageFeishu, verificationTimeoutMs = FEISHU_REACTION_VERIFY_TIMEOUT_MS, logger, uuid = () => crypto$1.randomUUID(), action = "created" } = params;
|
|
3419
|
-
const emoji = event.reaction_type?.emoji_type;
|
|
3420
|
-
const messageId = event.message_id;
|
|
3421
|
-
const senderId = event.user_id?.open_id;
|
|
3422
|
-
if (!emoji || !messageId || !senderId) return null;
|
|
3423
|
-
const reactionNotifications = resolveFeishuAccount({
|
|
3424
|
-
cfg,
|
|
3425
|
-
accountId
|
|
3426
|
-
}).config.reactionNotifications ?? "own";
|
|
3427
|
-
if (reactionNotifications === "off") return null;
|
|
3428
|
-
if (event.operator_type === "app" || senderId === botOpenId) return null;
|
|
3429
|
-
if (emoji === "Typing") return null;
|
|
3430
|
-
if (reactionNotifications === "own" && !botOpenId) {
|
|
3431
|
-
logger?.(`feishu[${accountId}]: bot open_id unavailable, skipping reaction ${emoji} on ${messageId}`);
|
|
3432
|
-
return null;
|
|
3433
|
-
}
|
|
3434
|
-
const reactedMsg = await raceWithTimeoutAndAbort(fetchMessage({
|
|
3435
|
-
cfg,
|
|
3436
|
-
messageId,
|
|
3437
|
-
accountId
|
|
3438
|
-
}), { timeoutMs: verificationTimeoutMs }).then((result) => result.status === "resolved" ? result.value : null).catch(() => null);
|
|
3439
|
-
const isBotMessage = reactedMsg?.senderType === "app" || reactedMsg?.senderOpenId === botOpenId;
|
|
3440
|
-
if (!reactedMsg || reactionNotifications === "own" && !isBotMessage) {
|
|
3441
|
-
logger?.(`feishu[${accountId}]: ignoring reaction on non-bot/unverified message ${messageId} (sender: ${reactedMsg?.senderOpenId ?? "unknown"})`);
|
|
3442
|
-
return null;
|
|
3443
|
-
}
|
|
3444
|
-
const fallbackChatType = reactedMsg.chatType;
|
|
3445
|
-
const resolvedChatType = normalizeFeishuChatType(event.chat_type) ?? fallbackChatType;
|
|
3446
|
-
if (!resolvedChatType) {
|
|
3447
|
-
logger?.(`feishu[${accountId}]: skipping reaction ${emoji} on ${messageId} without chat type context`);
|
|
3448
|
-
return null;
|
|
3449
|
-
}
|
|
3450
|
-
const syntheticChatIdRaw = event.chat_id ?? reactedMsg.chatId;
|
|
3451
|
-
const syntheticChatId = syntheticChatIdRaw?.trim() ? syntheticChatIdRaw : `p2p:${senderId}`;
|
|
3452
|
-
const syntheticChatType = resolvedChatType;
|
|
3453
|
-
return {
|
|
3454
|
-
sender: {
|
|
3455
|
-
sender_id: { open_id: senderId },
|
|
3456
|
-
sender_type: "user"
|
|
3457
|
-
},
|
|
3458
|
-
message: {
|
|
3459
|
-
message_id: `${messageId}:reaction:${emoji}:${uuid()}`,
|
|
3460
|
-
chat_id: syntheticChatId,
|
|
3461
|
-
chat_type: syntheticChatType,
|
|
3462
|
-
message_type: "text",
|
|
3463
|
-
content: JSON.stringify({ text: action === "deleted" ? `[removed reaction ${emoji} from message ${messageId}]` : `[reacted with ${emoji} to message ${messageId}]` })
|
|
3464
|
-
}
|
|
3465
|
-
};
|
|
3466
|
-
}
|
|
3467
|
-
function normalizeFeishuChatType(value) {
|
|
3468
|
-
return value === "group" || value === "private" || value === "p2p" ? value : void 0;
|
|
3469
|
-
}
|
|
3470
|
-
function isRecord(value) {
|
|
3471
|
-
return typeof value === "object" && value !== null;
|
|
3472
|
-
}
|
|
3473
|
-
function readString(value) {
|
|
3474
|
-
return typeof value === "string" ? value : void 0;
|
|
3475
|
-
}
|
|
3476
|
-
function readStringOrNumber(value) {
|
|
3477
|
-
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
3478
|
-
}
|
|
3479
|
-
function parseFeishuMessageEventPayload(value) {
|
|
3480
|
-
if (!isRecord(value)) return null;
|
|
3481
|
-
const sender = value.sender;
|
|
3482
|
-
const message = value.message;
|
|
3483
|
-
if (!isRecord(sender) || !isRecord(message)) return null;
|
|
3484
|
-
const senderId = sender.sender_id;
|
|
3485
|
-
if (!isRecord(senderId)) return null;
|
|
3486
|
-
const messageId = readString(message.message_id);
|
|
3487
|
-
const chatId = readString(message.chat_id);
|
|
3488
|
-
const chatType = normalizeFeishuChatType(message.chat_type);
|
|
3489
|
-
const messageType = readString(message.message_type);
|
|
3490
|
-
const content = readString(message.content);
|
|
3491
|
-
if (!messageId || !chatId || !chatType || !messageType || !content) return null;
|
|
3492
|
-
return value;
|
|
3493
|
-
}
|
|
3494
|
-
function parseFeishuBotAddedEventPayload(value) {
|
|
3495
|
-
if (!isRecord(value) || !readString(value.chat_id) || !isRecord(value.operator_id)) return null;
|
|
3496
|
-
return value;
|
|
3497
|
-
}
|
|
3498
|
-
function parseFeishuBotRemovedChatId(value) {
|
|
3499
|
-
if (!isRecord(value)) return null;
|
|
3500
|
-
return readString(value.chat_id) ?? null;
|
|
3501
|
-
}
|
|
3502
|
-
function parseFeishuBotMenuEvent(value) {
|
|
3503
|
-
if (!isRecord(value)) return null;
|
|
3504
|
-
const operator = value.operator;
|
|
3505
|
-
if (operator !== void 0 && !isRecord(operator)) return null;
|
|
3506
|
-
return {
|
|
3507
|
-
event_key: readString(value.event_key),
|
|
3508
|
-
timestamp: readStringOrNumber(value.timestamp),
|
|
3509
|
-
operator: operator ? {
|
|
3510
|
-
operator_name: readString(operator.operator_name),
|
|
3511
|
-
operator_id: isRecord(operator.operator_id) ? {
|
|
3512
|
-
open_id: readString(operator.operator_id.open_id),
|
|
3513
|
-
user_id: readString(operator.operator_id.user_id),
|
|
3514
|
-
union_id: readString(operator.operator_id.union_id)
|
|
3515
|
-
} : void 0
|
|
3516
|
-
} : void 0
|
|
3517
|
-
};
|
|
3518
|
-
}
|
|
3519
|
-
function parseFeishuCardActionEventPayload(value) {
|
|
3520
|
-
if (!isRecord(value)) return null;
|
|
3521
|
-
const operator = value.operator;
|
|
3522
|
-
const action = value.action;
|
|
3523
|
-
const context = value.context;
|
|
3524
|
-
if (!isRecord(operator) || !isRecord(action) || !isRecord(context)) return null;
|
|
3525
|
-
const token = readString(value.token);
|
|
3526
|
-
const openId = readString(operator.open_id);
|
|
3527
|
-
const userId = readString(operator.user_id);
|
|
3528
|
-
const unionId = readString(operator.union_id);
|
|
3529
|
-
const tag = readString(action.tag);
|
|
3530
|
-
const actionValue = action.value;
|
|
3531
|
-
const contextOpenId = readString(context.open_id);
|
|
3532
|
-
const contextUserId = readString(context.user_id);
|
|
3533
|
-
const chatId = readString(context.chat_id);
|
|
3534
|
-
if (!token || !openId || !userId || !unionId || !tag || !isRecord(actionValue) || !contextOpenId || !contextUserId || !chatId) return null;
|
|
3535
|
-
return {
|
|
3536
|
-
operator: {
|
|
3537
|
-
open_id: openId,
|
|
3538
|
-
user_id: userId,
|
|
3539
|
-
union_id: unionId
|
|
3540
|
-
},
|
|
3541
|
-
token,
|
|
3542
|
-
action: {
|
|
3543
|
-
value: actionValue,
|
|
3544
|
-
tag
|
|
3545
|
-
},
|
|
3546
|
-
context: {
|
|
3547
|
-
open_id: contextOpenId,
|
|
3548
|
-
user_id: contextUserId,
|
|
3549
|
-
chat_id: chatId
|
|
3550
|
-
}
|
|
3551
|
-
};
|
|
3552
|
-
}
|
|
3553
|
-
/**
|
|
3554
|
-
* Per-chat serial queue that ensures messages from the same chat are processed
|
|
3555
|
-
* in arrival order while allowing different chats to run concurrently.
|
|
3556
|
-
*/
|
|
3557
|
-
function createChatQueue() {
|
|
3558
|
-
const queues = /* @__PURE__ */ new Map();
|
|
3559
|
-
return (chatId, task) => {
|
|
3560
|
-
const next = (queues.get(chatId) ?? Promise.resolve()).then(task, task);
|
|
3561
|
-
queues.set(chatId, next);
|
|
3562
|
-
next.finally(() => {
|
|
3563
|
-
if (queues.get(chatId) === next) queues.delete(chatId);
|
|
3564
|
-
});
|
|
3565
|
-
return next;
|
|
3566
|
-
};
|
|
3567
|
-
}
|
|
3568
|
-
function mergeFeishuDebounceMentions(entries) {
|
|
3569
|
-
const merged = /* @__PURE__ */ new Map();
|
|
3570
|
-
for (const entry of entries) for (const mention of entry.message.mentions ?? []) {
|
|
3571
|
-
const stableId = mention.id.open_id?.trim() || mention.id.user_id?.trim() || mention.id.union_id?.trim();
|
|
3572
|
-
const mentionName = mention.name?.trim();
|
|
3573
|
-
const mentionKey = mention.key?.trim();
|
|
3574
|
-
const fallback = mentionName && mentionKey ? `${mentionName}|${mentionKey}` : mentionName || mentionKey;
|
|
3575
|
-
const key = stableId || fallback;
|
|
3576
|
-
if (!key || merged.has(key)) continue;
|
|
3577
|
-
merged.set(key, mention);
|
|
3578
|
-
}
|
|
3579
|
-
if (merged.size === 0) return;
|
|
3580
|
-
return Array.from(merged.values());
|
|
3581
|
-
}
|
|
3582
|
-
function dedupeFeishuDebounceEntriesByMessageId(entries) {
|
|
3583
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3584
|
-
const deduped = [];
|
|
3585
|
-
for (const entry of entries) {
|
|
3586
|
-
const messageId = entry.message.message_id?.trim();
|
|
3587
|
-
if (!messageId) {
|
|
3588
|
-
deduped.push(entry);
|
|
3589
|
-
continue;
|
|
3590
|
-
}
|
|
3591
|
-
if (seen.has(messageId)) continue;
|
|
3592
|
-
seen.add(messageId);
|
|
3593
|
-
deduped.push(entry);
|
|
3594
|
-
}
|
|
3595
|
-
return deduped;
|
|
3596
|
-
}
|
|
3597
|
-
function resolveFeishuDebounceMentions(params) {
|
|
3598
|
-
const { entries, botOpenId } = params;
|
|
3599
|
-
if (entries.length === 0) return;
|
|
3600
|
-
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
3601
|
-
const entry = entries[index];
|
|
3602
|
-
if (isMentionForwardRequest(entry, botOpenId)) return mergeFeishuDebounceMentions([entry]);
|
|
3603
|
-
}
|
|
3604
|
-
const merged = mergeFeishuDebounceMentions(entries);
|
|
3605
|
-
if (!merged) return;
|
|
3606
|
-
const normalizedBotOpenId = botOpenId?.trim();
|
|
3607
|
-
if (!normalizedBotOpenId) return;
|
|
3608
|
-
const botMentions = merged.filter((mention) => mention.id.open_id?.trim() === normalizedBotOpenId);
|
|
3609
|
-
return botMentions.length > 0 ? botMentions : void 0;
|
|
3610
|
-
}
|
|
3611
|
-
function registerEventHandlers(eventDispatcher, context) {
|
|
3612
|
-
const { cfg, accountId, runtime, chatHistories, fireAndForget } = context;
|
|
3613
|
-
const core = getFeishuRuntime();
|
|
3614
|
-
const inboundDebounceMs = core.channel.debounce.resolveInboundDebounceMs({
|
|
3615
|
-
cfg,
|
|
3616
|
-
channel: "feishu"
|
|
3617
|
-
});
|
|
3618
|
-
const log = runtime?.log ?? console.log;
|
|
3619
|
-
const error = runtime?.error ?? console.error;
|
|
3620
|
-
const enqueue = createChatQueue();
|
|
3621
|
-
const runFeishuHandler = async (params) => {
|
|
3622
|
-
if (fireAndForget) {
|
|
3623
|
-
params.task().catch((err) => {
|
|
3624
|
-
error(`${params.errorMessage}: ${String(err)}`);
|
|
3625
|
-
});
|
|
3626
|
-
return;
|
|
3627
|
-
}
|
|
3628
|
-
try {
|
|
3629
|
-
await params.task();
|
|
3630
|
-
} catch (err) {
|
|
3631
|
-
error(`${params.errorMessage}: ${String(err)}`);
|
|
3632
|
-
}
|
|
3633
|
-
};
|
|
3634
|
-
const dispatchFeishuMessage = async (event) => {
|
|
3635
|
-
const chatId = event.message.chat_id?.trim() || "unknown";
|
|
3636
|
-
const task = () => handleFeishuMessage({
|
|
3637
|
-
cfg,
|
|
3638
|
-
event,
|
|
3639
|
-
botOpenId: botOpenIds.get(accountId),
|
|
3640
|
-
botName: botNames.get(accountId),
|
|
3641
|
-
runtime,
|
|
3642
|
-
chatHistories,
|
|
3643
|
-
accountId,
|
|
3644
|
-
processingClaimHeld: true
|
|
3645
|
-
});
|
|
3646
|
-
await enqueue(chatId, task);
|
|
3647
|
-
};
|
|
3648
|
-
const resolveSenderDebounceId = (event) => {
|
|
3649
|
-
return event.sender.sender_id.open_id?.trim() || event.sender.sender_id.user_id?.trim() || void 0;
|
|
3650
|
-
};
|
|
3651
|
-
const resolveDebounceText = (event) => {
|
|
3652
|
-
return parseFeishuMessageEvent(event, botOpenIds.get(accountId), botNames.get(accountId)).content.trim();
|
|
3653
|
-
};
|
|
3654
|
-
const recordSuppressedMessageIds = async (entries, dispatchMessageId) => {
|
|
3655
|
-
const keepMessageId = dispatchMessageId?.trim();
|
|
3656
|
-
const suppressedIds = new Set(entries.map((entry) => entry.message.message_id?.trim()).filter((id) => Boolean(id) && (!keepMessageId || id !== keepMessageId)));
|
|
3657
|
-
if (suppressedIds.size === 0) return;
|
|
3658
|
-
for (const messageId of suppressedIds) try {
|
|
3659
|
-
await recordProcessedFeishuMessage(messageId, accountId, log);
|
|
3660
|
-
} catch (err) {
|
|
3661
|
-
error(`feishu[${accountId}]: failed to record merged dedupe id ${messageId}: ${String(err)}`);
|
|
3662
|
-
}
|
|
3663
|
-
};
|
|
3664
|
-
const isMessageAlreadyProcessed = async (entry) => {
|
|
3665
|
-
return await hasProcessedFeishuMessage(entry.message.message_id, accountId, log);
|
|
3666
|
-
};
|
|
3667
|
-
const inboundDebouncer = core.channel.debounce.createInboundDebouncer({
|
|
3668
|
-
debounceMs: inboundDebounceMs,
|
|
3669
|
-
buildKey: (event) => {
|
|
3670
|
-
const chatId = event.message.chat_id?.trim();
|
|
3671
|
-
const senderId = resolveSenderDebounceId(event);
|
|
3672
|
-
if (!chatId || !senderId) return null;
|
|
3673
|
-
const rootId = event.message.root_id?.trim();
|
|
3674
|
-
return `feishu:${accountId}:${chatId}:${rootId ? `thread:${rootId}` : "chat"}:${senderId}`;
|
|
3675
|
-
},
|
|
3676
|
-
shouldDebounce: (event) => {
|
|
3677
|
-
if (event.message.message_type !== "text") return false;
|
|
3678
|
-
const text = resolveDebounceText(event);
|
|
3679
|
-
if (!text) return false;
|
|
3680
|
-
return !core.channel.text.hasControlCommand(text, cfg);
|
|
3681
|
-
},
|
|
3682
|
-
onFlush: async (entries) => {
|
|
3683
|
-
const last = entries.at(-1);
|
|
3684
|
-
if (!last) return;
|
|
3685
|
-
if (entries.length === 1) {
|
|
3686
|
-
await dispatchFeishuMessage(last);
|
|
3687
|
-
return;
|
|
3688
|
-
}
|
|
3689
|
-
const dedupedEntries = dedupeFeishuDebounceEntriesByMessageId(entries);
|
|
3690
|
-
const freshEntries = [];
|
|
3691
|
-
for (const entry of dedupedEntries) if (!await isMessageAlreadyProcessed(entry)) freshEntries.push(entry);
|
|
3692
|
-
const dispatchEntry = freshEntries.at(-1);
|
|
3693
|
-
if (!dispatchEntry) return;
|
|
3694
|
-
await recordSuppressedMessageIds(dedupedEntries, dispatchEntry.message.message_id);
|
|
3695
|
-
const combinedText = freshEntries.map((entry) => resolveDebounceText(entry)).filter(Boolean).join("\n");
|
|
3696
|
-
const mergedMentions = resolveFeishuDebounceMentions({
|
|
3697
|
-
entries: freshEntries,
|
|
3698
|
-
botOpenId: botOpenIds.get(accountId)
|
|
3699
|
-
});
|
|
3700
|
-
if (!combinedText.trim()) {
|
|
3701
|
-
await dispatchFeishuMessage({
|
|
3702
|
-
...dispatchEntry,
|
|
3703
|
-
message: {
|
|
3704
|
-
...dispatchEntry.message,
|
|
3705
|
-
mentions: mergedMentions ?? dispatchEntry.message.mentions
|
|
3706
|
-
}
|
|
3707
|
-
});
|
|
3708
|
-
return;
|
|
3709
|
-
}
|
|
3710
|
-
await dispatchFeishuMessage({
|
|
3711
|
-
...dispatchEntry,
|
|
3712
|
-
message: {
|
|
3713
|
-
...dispatchEntry.message,
|
|
3714
|
-
message_type: "text",
|
|
3715
|
-
content: JSON.stringify({ text: combinedText }),
|
|
3716
|
-
mentions: mergedMentions ?? dispatchEntry.message.mentions
|
|
3717
|
-
}
|
|
3718
|
-
});
|
|
3719
|
-
},
|
|
3720
|
-
onError: (err, entries) => {
|
|
3721
|
-
for (const entry of entries) releaseFeishuMessageProcessing(entry.message.message_id, accountId);
|
|
3722
|
-
error(`feishu[${accountId}]: inbound debounce flush failed: ${String(err)}`);
|
|
3723
|
-
}
|
|
3724
|
-
});
|
|
3725
|
-
eventDispatcher.register({
|
|
3726
|
-
"im.message.receive_v1": async (data) => {
|
|
3727
|
-
const event = parseFeishuMessageEventPayload(data);
|
|
3728
|
-
if (!event) {
|
|
3729
|
-
error(`feishu[${accountId}]: ignoring malformed message event payload`);
|
|
3730
|
-
return;
|
|
3731
|
-
}
|
|
3732
|
-
const messageId = event.message?.message_id?.trim();
|
|
3733
|
-
if (!tryBeginFeishuMessageProcessing(messageId, accountId)) {
|
|
3734
|
-
log(`feishu[${accountId}]: dropping duplicate event for message ${messageId}`);
|
|
3735
|
-
return;
|
|
3736
|
-
}
|
|
3737
|
-
const processMessage = async () => {
|
|
3738
|
-
await inboundDebouncer.enqueue(event);
|
|
3739
|
-
};
|
|
3740
|
-
if (fireAndForget) {
|
|
3741
|
-
processMessage().catch((err) => {
|
|
3742
|
-
releaseFeishuMessageProcessing(messageId, accountId);
|
|
3743
|
-
error(`feishu[${accountId}]: error handling message: ${String(err)}`);
|
|
3744
|
-
});
|
|
3745
|
-
return;
|
|
3746
|
-
}
|
|
3747
|
-
try {
|
|
3748
|
-
await processMessage();
|
|
3749
|
-
} catch (err) {
|
|
3750
|
-
releaseFeishuMessageProcessing(messageId, accountId);
|
|
3751
|
-
error(`feishu[${accountId}]: error handling message: ${String(err)}`);
|
|
3752
|
-
}
|
|
3753
|
-
},
|
|
3754
|
-
"im.message.message_read_v1": async () => {},
|
|
3755
|
-
"im.chat.member.bot.added_v1": async (data) => {
|
|
3756
|
-
try {
|
|
3757
|
-
const event = parseFeishuBotAddedEventPayload(data);
|
|
3758
|
-
if (!event) return;
|
|
3759
|
-
log(`feishu[${accountId}]: bot added to chat ${event.chat_id}`);
|
|
3760
|
-
} catch (err) {
|
|
3761
|
-
error(`feishu[${accountId}]: error handling bot added event: ${String(err)}`);
|
|
3762
|
-
}
|
|
3763
|
-
},
|
|
3764
|
-
"im.chat.member.bot.deleted_v1": async (data) => {
|
|
3765
|
-
try {
|
|
3766
|
-
const chatId = parseFeishuBotRemovedChatId(data);
|
|
3767
|
-
if (!chatId) return;
|
|
3768
|
-
log(`feishu[${accountId}]: bot removed from chat ${chatId}`);
|
|
3769
|
-
} catch (err) {
|
|
3770
|
-
error(`feishu[${accountId}]: error handling bot removed event: ${String(err)}`);
|
|
3771
|
-
}
|
|
3772
|
-
},
|
|
3773
|
-
"drive.notice.comment_add_v1": async (data) => {
|
|
3774
|
-
await runFeishuHandler({
|
|
3775
|
-
errorMessage: `feishu[${accountId}]: error handling drive comment notice`,
|
|
3776
|
-
task: async () => {
|
|
3777
|
-
const event = parseFeishuDriveCommentNoticeEventPayload(data);
|
|
3778
|
-
if (!event) {
|
|
3779
|
-
error(`feishu[${accountId}]: ignoring malformed drive comment notice payload`);
|
|
3780
|
-
return;
|
|
3781
|
-
}
|
|
3782
|
-
const eventId = event.event_id?.trim();
|
|
3783
|
-
const syntheticMessageId = eventId ? `drive-comment:${eventId}` : void 0;
|
|
3784
|
-
if (syntheticMessageId && await hasProcessedFeishuMessage(syntheticMessageId, accountId, log)) {
|
|
3785
|
-
log(`feishu[${accountId}]: dropping duplicate comment event ${syntheticMessageId}`);
|
|
3786
|
-
return;
|
|
3787
|
-
}
|
|
3788
|
-
if (syntheticMessageId && !tryBeginFeishuMessageProcessing(syntheticMessageId, accountId)) {
|
|
3789
|
-
log(`feishu[${accountId}]: dropping in-flight comment event ${syntheticMessageId}`);
|
|
3790
|
-
return;
|
|
3791
|
-
}
|
|
3792
|
-
log(`feishu[${accountId}]: received drive comment notice event=${event.event_id ?? "unknown"} type=${event.notice_meta?.notice_type ?? "unknown"} file=${event.notice_meta?.file_type ?? "unknown"}:${event.notice_meta?.file_token ?? "unknown"} comment=${event.comment_id ?? "unknown"} reply=${event.reply_id ?? "none"} from=${event.notice_meta?.from_user_id?.open_id ?? "unknown"} mentioned=${event.is_mentioned === true ? "yes" : "no"}`);
|
|
3793
|
-
try {
|
|
3794
|
-
await handleFeishuCommentEvent({
|
|
3795
|
-
cfg,
|
|
3796
|
-
accountId,
|
|
3797
|
-
event,
|
|
3798
|
-
botOpenId: botOpenIds.get(accountId),
|
|
3799
|
-
runtime
|
|
3800
|
-
});
|
|
3801
|
-
if (syntheticMessageId) await recordProcessedFeishuMessage(syntheticMessageId, accountId, log);
|
|
3802
|
-
} finally {
|
|
3803
|
-
if (syntheticMessageId) releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
});
|
|
3807
|
-
},
|
|
3808
|
-
"im.message.reaction.created_v1": async (data) => {
|
|
3809
|
-
await runFeishuHandler({
|
|
3810
|
-
errorMessage: `feishu[${accountId}]: error handling reaction event`,
|
|
3811
|
-
task: async () => {
|
|
3812
|
-
const event = data;
|
|
3813
|
-
const myBotId = botOpenIds.get(accountId);
|
|
3814
|
-
const syntheticEvent = await resolveReactionSyntheticEvent({
|
|
3815
|
-
cfg,
|
|
3816
|
-
accountId,
|
|
3817
|
-
event,
|
|
3818
|
-
botOpenId: myBotId,
|
|
3819
|
-
logger: log
|
|
3820
|
-
});
|
|
3821
|
-
if (!syntheticEvent) return;
|
|
3822
|
-
await handleFeishuMessage({
|
|
3823
|
-
cfg,
|
|
3824
|
-
event: syntheticEvent,
|
|
3825
|
-
botOpenId: myBotId,
|
|
3826
|
-
botName: botNames.get(accountId),
|
|
3827
|
-
runtime,
|
|
3828
|
-
chatHistories,
|
|
3829
|
-
accountId
|
|
3830
|
-
});
|
|
3831
|
-
}
|
|
3832
|
-
});
|
|
3833
|
-
},
|
|
3834
|
-
"im.message.reaction.deleted_v1": async (data) => {
|
|
3835
|
-
await runFeishuHandler({
|
|
3836
|
-
errorMessage: `feishu[${accountId}]: error handling reaction removal event`,
|
|
3837
|
-
task: async () => {
|
|
3838
|
-
const event = data;
|
|
3839
|
-
const myBotId = botOpenIds.get(accountId);
|
|
3840
|
-
const syntheticEvent = await resolveReactionSyntheticEvent({
|
|
3841
|
-
cfg,
|
|
3842
|
-
accountId,
|
|
3843
|
-
event,
|
|
3844
|
-
botOpenId: myBotId,
|
|
3845
|
-
logger: log,
|
|
3846
|
-
action: "deleted"
|
|
3847
|
-
});
|
|
3848
|
-
if (!syntheticEvent) return;
|
|
3849
|
-
await handleFeishuMessage({
|
|
3850
|
-
cfg,
|
|
3851
|
-
event: syntheticEvent,
|
|
3852
|
-
botOpenId: myBotId,
|
|
3853
|
-
botName: botNames.get(accountId),
|
|
3854
|
-
runtime,
|
|
3855
|
-
chatHistories,
|
|
3856
|
-
accountId
|
|
3857
|
-
});
|
|
3858
|
-
}
|
|
3859
|
-
});
|
|
3860
|
-
},
|
|
3861
|
-
"application.bot.menu_v6": async (data) => {
|
|
3862
|
-
try {
|
|
3863
|
-
const event = parseFeishuBotMenuEvent(data);
|
|
3864
|
-
if (!event) return;
|
|
3865
|
-
const operatorOpenId = event.operator?.operator_id?.open_id?.trim();
|
|
3866
|
-
const eventKey = event.event_key?.trim();
|
|
3867
|
-
if (!operatorOpenId || !eventKey) return;
|
|
3868
|
-
const syntheticEvent = {
|
|
3869
|
-
sender: {
|
|
3870
|
-
sender_id: {
|
|
3871
|
-
open_id: operatorOpenId,
|
|
3872
|
-
user_id: event.operator?.operator_id?.user_id,
|
|
3873
|
-
union_id: event.operator?.operator_id?.union_id
|
|
3874
|
-
},
|
|
3875
|
-
sender_type: "user"
|
|
3876
|
-
},
|
|
3877
|
-
message: {
|
|
3878
|
-
message_id: `bot-menu:${eventKey}:${event.timestamp ?? Date.now()}`,
|
|
3879
|
-
chat_id: `p2p:${operatorOpenId}`,
|
|
3880
|
-
chat_type: "p2p",
|
|
3881
|
-
message_type: "text",
|
|
3882
|
-
content: JSON.stringify({ text: `/menu ${eventKey}` })
|
|
3883
|
-
}
|
|
3884
|
-
};
|
|
3885
|
-
const syntheticMessageId = syntheticEvent.message.message_id;
|
|
3886
|
-
if (await hasProcessedFeishuMessage(syntheticMessageId, accountId, log)) {
|
|
3887
|
-
log(`feishu[${accountId}]: dropping duplicate bot-menu event for ${syntheticMessageId}`);
|
|
3888
|
-
return;
|
|
3889
|
-
}
|
|
3890
|
-
if (!tryBeginFeishuMessageProcessing(syntheticMessageId, accountId)) {
|
|
3891
|
-
log(`feishu[${accountId}]: dropping in-flight bot-menu event for ${syntheticMessageId}`);
|
|
3892
|
-
return;
|
|
3893
|
-
}
|
|
3894
|
-
const handleLegacyMenu = () => handleFeishuMessage({
|
|
3895
|
-
cfg,
|
|
3896
|
-
event: syntheticEvent,
|
|
3897
|
-
botOpenId: botOpenIds.get(accountId),
|
|
3898
|
-
botName: botNames.get(accountId),
|
|
3899
|
-
runtime,
|
|
3900
|
-
chatHistories,
|
|
3901
|
-
accountId,
|
|
3902
|
-
processingClaimHeld: true
|
|
3903
|
-
});
|
|
3904
|
-
const promise = maybeHandleFeishuQuickActionMenu({
|
|
3905
|
-
cfg,
|
|
3906
|
-
eventKey,
|
|
3907
|
-
operatorOpenId,
|
|
3908
|
-
runtime,
|
|
3909
|
-
accountId
|
|
3910
|
-
}).then(async (handledMenu) => {
|
|
3911
|
-
if (handledMenu) {
|
|
3912
|
-
await recordProcessedFeishuMessage(syntheticMessageId, accountId, log);
|
|
3913
|
-
releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3914
|
-
return;
|
|
3915
|
-
}
|
|
3916
|
-
return await handleLegacyMenu();
|
|
3917
|
-
}).catch((err) => {
|
|
3918
|
-
releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3919
|
-
throw err;
|
|
3920
|
-
});
|
|
3921
|
-
if (fireAndForget) {
|
|
3922
|
-
promise.catch((err) => {
|
|
3923
|
-
error(`feishu[${accountId}]: error handling bot menu event: ${String(err)}`);
|
|
3924
|
-
});
|
|
3925
|
-
return;
|
|
3926
|
-
}
|
|
3927
|
-
await promise;
|
|
3928
|
-
} catch (err) {
|
|
3929
|
-
error(`feishu[${accountId}]: error handling bot menu event: ${String(err)}`);
|
|
3930
|
-
}
|
|
3931
|
-
},
|
|
3932
|
-
"card.action.trigger": async (data) => {
|
|
3933
|
-
try {
|
|
3934
|
-
const event = parseFeishuCardActionEventPayload(data);
|
|
3935
|
-
if (!event) {
|
|
3936
|
-
error(`feishu[${accountId}]: ignoring malformed card action payload`);
|
|
3937
|
-
return;
|
|
3938
|
-
}
|
|
3939
|
-
const promise = handleFeishuCardAction({
|
|
3940
|
-
cfg,
|
|
3941
|
-
event,
|
|
3942
|
-
botOpenId: botOpenIds.get(accountId),
|
|
3943
|
-
runtime,
|
|
3944
|
-
accountId
|
|
3945
|
-
});
|
|
3946
|
-
if (fireAndForget) promise.catch((err) => {
|
|
3947
|
-
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
|
|
3948
|
-
});
|
|
3949
|
-
else await promise;
|
|
3950
|
-
} catch (err) {
|
|
3951
|
-
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
|
|
3952
|
-
}
|
|
3953
|
-
}
|
|
3954
|
-
});
|
|
3955
|
-
}
|
|
3956
|
-
async function monitorSingleAccount(params) {
|
|
3957
|
-
const { cfg, account, runtime, abortSignal } = params;
|
|
3958
|
-
const { accountId } = account;
|
|
3959
|
-
const log = runtime?.log ?? console.log;
|
|
3960
|
-
const botOpenIdSource = params.botOpenIdSource ?? { kind: "fetch" };
|
|
3961
|
-
const { botOpenId } = applyBotIdentityState(accountId, botOpenIdSource.kind === "prefetched" ? {
|
|
3962
|
-
botOpenId: botOpenIdSource.botOpenId,
|
|
3963
|
-
botName: botOpenIdSource.botName
|
|
3964
|
-
} : await fetchBotIdentityForMonitor(account, {
|
|
3965
|
-
runtime,
|
|
3966
|
-
abortSignal
|
|
3967
|
-
}));
|
|
3968
|
-
log(`feishu[${accountId}]: bot open_id resolved: ${botOpenId ?? "unknown"}`);
|
|
3969
|
-
if (!botOpenId && !abortSignal?.aborted) startBotIdentityRecovery({
|
|
3970
|
-
account,
|
|
3971
|
-
accountId,
|
|
3972
|
-
runtime,
|
|
3973
|
-
abortSignal
|
|
3974
|
-
});
|
|
3975
|
-
const connectionMode = account.config.connectionMode ?? "websocket";
|
|
3976
|
-
if (connectionMode === "webhook" && !account.verificationToken?.trim()) throw new Error(`Feishu account "${accountId}" webhook mode requires verificationToken`);
|
|
3977
|
-
if (connectionMode === "webhook" && !account.encryptKey?.trim()) throw new Error(`Feishu account "${accountId}" webhook mode requires encryptKey`);
|
|
3978
|
-
const warmupCount = await warmupDedupFromDisk(accountId, log);
|
|
3979
|
-
if (warmupCount > 0) log(`feishu[${accountId}]: dedup warmup loaded ${warmupCount} entries from disk`);
|
|
3980
|
-
let threadBindingManager = null;
|
|
3981
|
-
try {
|
|
3982
|
-
const eventDispatcher = createEventDispatcher(account);
|
|
3983
|
-
const chatHistories = /* @__PURE__ */ new Map();
|
|
3984
|
-
threadBindingManager = createFeishuThreadBindingManager({
|
|
3985
|
-
accountId,
|
|
3986
|
-
cfg
|
|
3987
|
-
});
|
|
3988
|
-
registerEventHandlers(eventDispatcher, {
|
|
3989
|
-
cfg,
|
|
3990
|
-
accountId,
|
|
3991
|
-
runtime,
|
|
3992
|
-
chatHistories,
|
|
3993
|
-
fireAndForget: true
|
|
3994
|
-
});
|
|
3995
|
-
if (connectionMode === "webhook") return await monitorWebhook({
|
|
3996
|
-
account,
|
|
3997
|
-
accountId,
|
|
3998
|
-
runtime,
|
|
3999
|
-
abortSignal,
|
|
4000
|
-
eventDispatcher
|
|
4001
|
-
});
|
|
4002
|
-
return await monitorWebSocket({
|
|
4003
|
-
account,
|
|
4004
|
-
accountId,
|
|
4005
|
-
runtime,
|
|
4006
|
-
abortSignal,
|
|
4007
|
-
eventDispatcher
|
|
4008
|
-
});
|
|
4009
|
-
} finally {
|
|
4010
|
-
threadBindingManager?.stop();
|
|
4011
|
-
}
|
|
4012
|
-
}
|
|
4013
|
-
//#endregion
|
|
4014
|
-
//#region extensions/feishu/src/monitor.ts
|
|
4015
|
-
async function monitorFeishuProvider(opts = {}) {
|
|
4016
|
-
const cfg = opts.config;
|
|
4017
|
-
if (!cfg) throw new Error("Config is required for Feishu monitor");
|
|
4018
|
-
const log = opts.runtime?.log ?? console.log;
|
|
4019
|
-
if (opts.accountId) {
|
|
4020
|
-
const account = resolveFeishuRuntimeAccount({
|
|
4021
|
-
cfg,
|
|
4022
|
-
accountId: opts.accountId
|
|
4023
|
-
}, { requireEventSecrets: true });
|
|
4024
|
-
if (!account.enabled || !account.configured) throw new Error(`Feishu account "${opts.accountId}" not configured or disabled`);
|
|
4025
|
-
return monitorSingleAccount({
|
|
4026
|
-
cfg,
|
|
4027
|
-
account,
|
|
4028
|
-
runtime: opts.runtime,
|
|
4029
|
-
abortSignal: opts.abortSignal
|
|
4030
|
-
});
|
|
4031
|
-
}
|
|
4032
|
-
const accounts = listEnabledFeishuAccounts(cfg);
|
|
4033
|
-
if (accounts.length === 0) throw new Error("No enabled Feishu accounts configured");
|
|
4034
|
-
log(`feishu: starting ${accounts.length} account(s): ${accounts.map((a) => a.accountId).join(", ")}`);
|
|
4035
|
-
const monitorPromises = [];
|
|
4036
|
-
for (const account of accounts) {
|
|
4037
|
-
if (opts.abortSignal?.aborted) {
|
|
4038
|
-
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
4039
|
-
break;
|
|
4040
|
-
}
|
|
4041
|
-
const { botOpenId, botName } = await fetchBotIdentityForMonitor(account, {
|
|
4042
|
-
runtime: opts.runtime,
|
|
4043
|
-
abortSignal: opts.abortSignal
|
|
4044
|
-
});
|
|
4045
|
-
if (opts.abortSignal?.aborted) {
|
|
4046
|
-
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
4047
|
-
break;
|
|
4048
|
-
}
|
|
4049
|
-
monitorPromises.push(monitorSingleAccount({
|
|
4050
|
-
cfg,
|
|
4051
|
-
account,
|
|
4052
|
-
runtime: opts.runtime,
|
|
4053
|
-
abortSignal: opts.abortSignal,
|
|
4054
|
-
botOpenIdSource: {
|
|
4055
|
-
kind: "prefetched",
|
|
4056
|
-
botOpenId,
|
|
4057
|
-
botName
|
|
4058
|
-
}
|
|
4059
|
-
}));
|
|
4060
|
-
}
|
|
4061
|
-
await Promise.all(monitorPromises);
|
|
4062
|
-
}
|
|
4063
|
-
function stopFeishuMonitor(accountId) {
|
|
4064
|
-
stopFeishuMonitorState(accountId);
|
|
4065
|
-
}
|
|
4066
|
-
//#endregion
|
|
4067
|
-
export { clearFeishuWebhookRateLimitStateForTest, getFeishuWebhookRateLimitStateSizeForTest, isWebhookRateLimitedForTest, monitorFeishuProvider, resolveReactionSyntheticEvent, stopFeishuMonitor };
|