@spacebar_ai/moldclaw-core 2026.3.14 → 2026.3.16
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 +108 -3
- package/dist/account-id-plS5L20e.d.ts +1 -0
- package/dist/accounts-BAYVGC2k.js +109 -0
- package/dist/accounts-DrjRgReV.d.ts +103 -0
- package/dist/acp-cli-at_UYEOS.js +2088 -0
- package/dist/acpx-Chy1GQ_k.d.ts +5 -0
- package/dist/actions.runtime-C0F7dMfO.js +114 -0
- package/dist/actions.runtime-caI2LG9o.js +128 -0
- package/dist/agent-media-payload-CkpAqaOh.d.ts +16 -0
- package/dist/agents-B98yPGc5.js +853 -0
- package/dist/agents-BrLr08L3.js +217 -0
- package/dist/allow-from-BIwT4dl7.d.ts +42 -0
- package/dist/allow-list-CHt7yvAf.js +81 -0
- package/dist/allowlist-CxQo2wQc.js +142 -0
- package/dist/allowlist-resolution-B7ib7gye.d.ts +17 -0
- package/dist/api-Co7TNHbL.js +6953 -0
- package/dist/api-cEQ_ql_8.js +112 -0
- package/dist/audit-AnKnnlaZ.js +787 -0
- package/dist/audit-channel.collect.runtime-CAk1DFQ3.js +600 -0
- package/dist/audit-channel.runtime-5phdZp_m.js +116 -0
- package/dist/audit-extra.async-B8ZXFxic.js +813 -0
- package/dist/audit-hdKa3D-u.js +54 -0
- package/dist/audit-membership-runtime-CJV5XvGU.js +157 -0
- package/dist/audit.deep.runtime-DNMcRQrp.js +24 -0
- package/dist/audit.nondeep.runtime-DhNDL6yM.js +831 -0
- package/dist/audit.runtime-Bx7uWEh8.js +113 -0
- package/dist/auth-choice-C37W9MA7.js +268 -0
- package/dist/auth-choice-CNppOY_V.js +117 -0
- package/dist/auth-choice-XYFnp6fI.js +502 -0
- package/dist/auth-choice-options-D6oZY4Xo.js +123 -0
- package/dist/auth-choice-prompt-BhRqchJx.js +110 -0
- package/dist/auth-choice-prompt-C1xv0N08.js +36 -0
- package/dist/auth-choice.plugin-providers.runtime-DhLEtbmR.js +114 -0
- package/dist/auth-profiles-9zZdaXJK.js +127756 -0
- package/dist/auth-profiles.runtime-HONFDgiu.js +111 -0
- package/dist/bluebubbles-BY8JhO4y.js +64 -0
- package/dist/bluebubbles-CQjEnzK_.d.ts +6 -0
- package/dist/bluebubbles-RmcKgkBa.d.ts +45 -0
- package/dist/boolean-param-F1sMwnPu.d.ts +5 -0
- package/dist/bot-BGh-ATV7.d.ts +478 -0
- package/dist/brave-CljenznH.js +24 -0
- package/dist/browser-cli-CX8i0wf0.js +1492 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.d.ts +6 -0
- package/dist/bundled/boot-md/handler.js +26 -26
- package/dist/bundled/bootstrap-extra-files/handler.d.ts +6 -0
- package/dist/bundled/command-logger/handler.d.ts +9 -0
- package/dist/bundled/session-memory/handler.d.ts +9 -0
- package/dist/bundled/session-memory/handler.js +27 -27
- package/dist/call-Bc257L16.js +37 -0
- package/dist/call-DYFR7oGy.js +639 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/channel-Bd-igGEW.js +803 -0
- package/dist/channel-BgRMb6bZ.js +575 -0
- package/dist/channel-BtcLrU6J.js +1598 -0
- package/dist/channel-Bwf6m_hD.js +538 -0
- package/dist/channel-C7-kgDBd.js +562 -0
- package/dist/channel-CEXOAxIc.js +949 -0
- package/dist/channel-CpZ3p9MJ.js +226 -0
- package/dist/channel-CqBlN6A2.js +619 -0
- package/dist/channel-DKhfHW4U.js +352 -0
- package/dist/channel-DS3t_KdJ2.js +316 -0
- package/dist/channel-DY24FA1v.js +4681 -0
- package/dist/channel-DYFGmImJ.js +542 -0
- package/dist/channel-DcyIqX5p.js +207 -0
- package/dist/channel-J-2XcAli.js +214 -0
- package/dist/channel-N616f4gZ.js +306 -0
- package/dist/channel-NY7aU2Gj.js +397 -0
- package/dist/channel-PNI8BOmm.js +1321 -0
- package/dist/channel-UcXepDJs.js +943 -0
- package/dist/channel-account-context-CL3hEq1j.js +103 -0
- package/dist/channel-config-schema-Q2nzcCCR.d.ts +1 -0
- package/dist/channel-jA_jodJo.js +920 -0
- package/dist/channel-options-CtgU5qkG.js +50 -0
- package/dist/channel-policy-7wXDp6d3.d.ts +1 -0
- package/dist/channel-rGI8uig4.js +497 -0
- package/dist/channel-summary-DGJZXo0r.js +106 -0
- package/dist/channel.runtime--WZvlNJM.js +413 -0
- package/dist/channel.runtime-B0ct42DL.js +122 -0
- package/dist/channel.runtime-BEZUZrYB.js +177 -0
- package/dist/channel.runtime-BMuWmsIC.js +166 -0
- package/dist/channel.runtime-BtvHP0po.js +4006 -0
- package/dist/channel.runtime-Cwf993pX.js +194 -0
- package/dist/channel.runtime-Cy4lEpTX.js +174 -0
- package/dist/channel.runtime-DAz6axda.js +865 -0
- package/dist/channel.runtime-DdQ2mOVh.js +236 -0
- package/dist/channel.runtime-Dy3HPgOU.js +399 -0
- package/dist/channel.runtime-iqfC25k7.js +213 -0
- package/dist/channel.setup-B4VYMZlQ.js +9 -0
- package/dist/channel.setup-BohGbCbI.js +57 -0
- package/dist/channel.setup-Bq2AQqqc.js +6 -0
- package/dist/channel.setup-BxiSfLp1.js +8 -0
- package/dist/channel.setup-DOUS6fjO.js +8 -0
- package/dist/channel.setup-DXhdYU3g.js +9 -0
- package/dist/channel.setup-N51CgfNy.js +11 -0
- package/dist/channels/plugins/actions/discord.d.ts +3 -0
- package/dist/channels/plugins/actions/discord.js +26 -26
- package/dist/channels/plugins/actions/signal.d.ts +2 -0
- package/dist/channels/plugins/actions/signal.js +26 -26
- package/dist/channels/plugins/actions/telegram.d.ts +3 -0
- package/dist/channels/plugins/actions/telegram.js +26 -26
- package/dist/channels/plugins/agent-tools/whatsapp-login.d.ts +4 -0
- package/dist/channels/plugins/agent-tools/whatsapp-login.js +26 -26
- package/dist/channels-CueeFf0q.js +404 -0
- package/dist/channels-PheAd73E.js +1113 -0
- package/dist/channels-cli-CXzVF84v.js +286 -0
- package/dist/channels-status-issues-BjWBQHhU.js +16 -0
- package/dist/chat-type-BlSN0vo4.d.ts +5 -0
- package/dist/clawbot-cli-BBehDXW1.js +113 -0
- package/dist/cli/daemon-cli.d.ts +58 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-CIm7d5Id.js +149 -0
- package/dist/command-format-pq3tS8t2.d.ts +4 -0
- package/dist/command-registry-CDkp__KH.js +13 -0
- package/dist/command-registry-DSEkUBW1.js +212 -0
- package/dist/command-secret-gateway-CqP_o0n8.js +106 -0
- package/dist/compact.runtime-Qm_csEtG.js +111 -0
- package/dist/completion-cli-Ch1sgSLQ.js +445 -0
- package/dist/completion-cli-vF067Tso.js +16 -0
- package/dist/config-B2W1zTP1.js +44 -0
- package/dist/config-CMhKplgO.js +938 -0
- package/dist/config-DchtRsvs.js +30 -0
- package/dist/config-cli-C41d88_c.js +428 -0
- package/dist/config-guard-B_vjkXCQ.js +117 -0
- package/dist/config-schema-pPBCF4hz.js +31 -0
- package/dist/config-validation-6om9cBUx.js +262 -0
- package/dist/config-value-Dl3XEpA6.js +132 -0
- package/dist/configure-BxzvDSzu.js +1100 -0
- package/dist/configure-CLMLoWAn.js +238 -0
- package/dist/control-ui-shared-E8Nz6uKZ.js +29 -0
- package/dist/core-Cd3fMFKq.d.ts +87 -0
- package/dist/credentials-yYt6VWCq.js +268 -0
- package/dist/cron-cli-CA3lV3kh.js +634 -0
- package/dist/daemon-cli-BtQuIXEk.js +339 -0
- package/dist/daemon-install-BWKGzgMm.js +175 -0
- package/dist/deliver-CgMNmfTy.js +106 -0
- package/dist/deliver-runtime-Bn1KWoiQ.js +106 -0
- package/dist/devices-cli-D601npiL.js +340 -0
- package/dist/diagnostic-CkiYEGqt.js +310 -0
- package/dist/diffs-B5tZ8Coj.d.ts +1 -0
- package/dist/directory-cli-skEV8MT7.js +306 -0
- package/dist/directory-config-helpers-B-tiBKIv.d.ts +38 -0
- package/dist/directory-runtime-BEJ2fCIR.d.ts +1 -0
- package/dist/directory.static-CnyzoWbV.js +44 -0
- package/dist/discord-B_gbzPti.js +109 -0
- package/dist/discovery-CqI-e_Mv.js +48 -0
- package/dist/dm-policy-shared-nybkS1uP.d.ts +95 -0
- package/dist/dns-cli-Cjes3Ruw.js +216 -0
- package/dist/docs-cli-C3g3Gi_d.js +173 -0
- package/dist/doctor-completion-TvgV4SZH.js +90 -0
- package/dist/doctor-config-flow-0w9Ux7V8.js +107 -0
- package/dist/doctor-config-flow-DLzr8W7Y.js +2437 -0
- package/dist/enable-VYzv8b2z.js +24 -0
- package/dist/entry.d.ts +7 -0
- package/dist/entry.js +1 -1
- package/dist/env-overrides-DYVIkuvN.js +434 -0
- package/dist/env-overrides.runtime-6kijpIuu.js +17 -0
- package/dist/exec-approvals-cli-D_lkTG-l.js +419 -0
- package/dist/exec-sVmouhA9.d.ts +39 -0
- package/dist/extensions/acpx/index.d.ts +11 -0
- package/dist/extensions/acpx/index.js +1 -1
- package/dist/extensions/amazon-bedrock/index.d.ts +11 -0
- package/dist/extensions/anthropic/index.d.ts +11 -0
- package/dist/extensions/anthropic/index.js +26 -26
- package/dist/extensions/bluebubbles/index.d.ts +11 -0
- package/dist/extensions/bluebubbles/index.js +30 -30
- package/dist/extensions/bluebubbles/setup-entry.d.ts +59 -0
- package/dist/extensions/bluebubbles/setup-entry.js +30 -30
- package/dist/extensions/brave/index.d.ts +11 -0
- package/dist/extensions/brave/index.js +2 -2
- package/dist/extensions/byteplus/index.d.ts +11 -0
- package/dist/extensions/byteplus/index.js +26 -26
- package/dist/extensions/cloudflare-ai-gateway/index.d.ts +11 -0
- package/dist/extensions/cloudflare-ai-gateway/index.js +27 -27
- package/dist/extensions/copilot-proxy/index.d.ts +11 -0
- package/dist/extensions/device-pair/index.d.ts +12 -0
- package/dist/extensions/diagnostics-otel/index.d.ts +11 -0
- package/dist/extensions/diffs/index.d.ts +11 -0
- package/dist/extensions/discord/index.d.ts +11 -0
- package/dist/extensions/discord/index.js +31 -31
- package/dist/extensions/discord/setup-entry.d.ts +7 -0
- package/dist/extensions/discord/setup-entry.js +29 -29
- package/dist/extensions/elevenlabs/index.d.ts +11 -0
- package/dist/extensions/elevenlabs/index.js +26 -26
- package/dist/extensions/feishu/index.d.ts +229 -0
- package/dist/extensions/feishu/index.js +31 -31
- package/dist/extensions/feishu/setup-entry.d.ts +9 -0
- package/dist/extensions/feishu/setup-entry.js +28 -28
- package/dist/extensions/firecrawl/index.d.ts +11 -0
- package/dist/extensions/firecrawl/index.js +26 -26
- package/dist/extensions/github-copilot/index.d.ts +11 -0
- package/dist/extensions/github-copilot/index.js +27 -27
- package/dist/extensions/google/index.d.ts +11 -0
- package/dist/extensions/google/index.js +26 -26
- package/dist/extensions/googlechat/index.d.ts +11 -0
- package/dist/extensions/googlechat/index.js +30 -30
- package/dist/extensions/googlechat/setup-entry.d.ts +19 -0
- package/dist/extensions/googlechat/setup-entry.js +30 -30
- package/dist/extensions/huggingface/index.d.ts +11 -0
- package/dist/extensions/huggingface/index.js +26 -26
- package/dist/extensions/imessage/index.d.ts +11 -0
- package/dist/extensions/imessage/index.js +30 -30
- package/dist/extensions/imessage/setup-entry.d.ts +7 -0
- package/dist/extensions/imessage/setup-entry.js +30 -30
- package/dist/extensions/irc/index.d.ts +11 -0
- package/dist/extensions/irc/index.js +29 -29
- package/dist/extensions/irc/setup-entry.d.ts +8 -0
- package/dist/extensions/irc/setup-entry.js +29 -29
- package/dist/extensions/kakao-talkchannel/index.d.ts +19 -0
- package/dist/extensions/kakao-talkchannel/index.js +1762 -0
- package/dist/extensions/kakao-talkchannel/moldclaw.plugin.json +111 -0
- package/dist/extensions/kakao-talkchannel/package.json +12 -0
- package/dist/extensions/kilocode/index.d.ts +11 -0
- package/dist/extensions/kilocode/index.js +26 -26
- package/dist/extensions/kimi-coding/index.d.ts +11 -0
- package/dist/extensions/kimi-coding/index.js +26 -26
- package/dist/extensions/line/index.d.ts +11 -0
- package/dist/extensions/line/index.js +28 -28
- package/dist/extensions/line/setup-entry.d.ts +7 -0
- package/dist/extensions/line/setup-entry.js +28 -28
- package/dist/extensions/llm-task/index.d.ts +11 -0
- package/dist/extensions/llm-task/index.js +28 -28
- package/dist/extensions/lobster/index.d.ts +11 -0
- package/dist/extensions/matrix/index.d.ts +11 -0
- package/dist/extensions/matrix/index.js +31 -31
- package/dist/extensions/matrix/setup-entry.d.ts +20 -0
- package/dist/extensions/matrix/setup-entry.js +31 -31
- package/dist/extensions/mattermost/index.d.ts +11 -0
- package/dist/extensions/mattermost/index.js +28 -28
- package/dist/extensions/mattermost/setup-entry.d.ts +88 -0
- package/dist/extensions/mattermost/setup-entry.js +28 -28
- package/dist/extensions/memory-core/index.d.ts +11 -0
- package/dist/extensions/memory-lancedb/index.d.ts +25 -0
- package/dist/extensions/microsoft/index.d.ts +11 -0
- package/dist/extensions/microsoft/index.js +26 -26
- package/dist/extensions/minimax/index.d.ts +11 -0
- package/dist/extensions/minimax/index.js +26 -26
- package/dist/extensions/mistral/index.d.ts +11 -0
- package/dist/extensions/mistral/index.js +26 -26
- package/dist/extensions/modelstudio/index.d.ts +11 -0
- package/dist/extensions/modelstudio/index.js +26 -26
- package/dist/extensions/moonshot/index.d.ts +11 -0
- package/dist/extensions/moonshot/index.js +26 -26
- package/dist/extensions/msteams/index.d.ts +11 -0
- package/dist/extensions/msteams/index.js +31 -31
- package/dist/extensions/msteams/setup-entry.d.ts +11 -0
- package/dist/extensions/msteams/setup-entry.js +31 -31
- package/dist/extensions/nextcloud-talk/index.d.ts +11 -0
- package/dist/extensions/nextcloud-talk/index.js +28 -28
- package/dist/extensions/nextcloud-talk/setup-entry.d.ts +60 -0
- package/dist/extensions/nextcloud-talk/setup-entry.js +28 -28
- package/dist/extensions/nostr/index.d.ts +11 -0
- package/dist/extensions/nostr/index.js +28 -28
- package/dist/extensions/nostr/setup-entry.d.ts +49 -0
- package/dist/extensions/nostr/setup-entry.js +28 -28
- package/dist/extensions/nvidia/index.d.ts +11 -0
- package/dist/extensions/ollama/index.d.ts +11 -0
- package/dist/extensions/open-prose/index.d.ts +11 -0
- package/dist/extensions/openai/index.d.ts +11 -0
- package/dist/extensions/openai/index.js +26 -26
- package/dist/extensions/opencode/index.d.ts +11 -0
- package/dist/extensions/opencode/index.js +26 -26
- package/dist/extensions/opencode-go/index.d.ts +11 -0
- package/dist/extensions/opencode-go/index.js +26 -26
- package/dist/extensions/openrouter/index.d.ts +11 -0
- package/dist/extensions/openrouter/index.js +26 -26
- package/dist/extensions/openshell/index.d.ts +11 -0
- package/dist/extensions/openshell/index.js +26 -26
- package/dist/extensions/perplexity/index.d.ts +11 -0
- package/dist/extensions/perplexity/index.js +2 -2
- package/dist/extensions/phone-control/index.d.ts +12 -0
- package/dist/extensions/qianfan/index.d.ts +11 -0
- package/dist/extensions/qianfan/index.js +26 -26
- package/dist/extensions/qwen-portal-auth/index.d.ts +12 -0
- package/dist/extensions/qwen-portal-auth/index.js +26 -26
- package/dist/extensions/sglang/index.d.ts +11 -0
- package/dist/extensions/sglang/index.js +26 -26
- package/dist/extensions/signal/index.d.ts +11 -0
- package/dist/extensions/signal/index.js +29 -29
- package/dist/extensions/signal/setup-entry.d.ts +7 -0
- package/dist/extensions/signal/setup-entry.js +29 -29
- package/dist/extensions/slack/index.d.ts +11 -0
- package/dist/extensions/slack/index.js +30 -30
- package/dist/extensions/slack/setup-entry.d.ts +7 -0
- package/dist/extensions/slack/setup-entry.js +29 -29
- package/dist/extensions/synology-chat/index.d.ts +11 -0
- package/dist/extensions/synology-chat/index.js +28 -28
- package/dist/extensions/synology-chat/setup-entry.d.ts +138 -0
- package/dist/extensions/synology-chat/setup-entry.js +28 -28
- package/dist/extensions/synthetic/index.d.ts +11 -0
- package/dist/extensions/synthetic/index.js +26 -26
- package/dist/extensions/talk-voice/index.d.ts +12 -0
- package/dist/extensions/talk-voice/index.js +26 -26
- package/dist/extensions/telegram/index.d.ts +11 -0
- package/dist/extensions/telegram/index.js +29 -29
- package/dist/extensions/telegram/setup-entry.d.ts +7 -0
- package/dist/extensions/telegram/setup-entry.js +28 -28
- package/dist/extensions/thread-ownership/index.d.ts +12 -0
- package/dist/extensions/tlon/index.d.ts +11 -0
- package/dist/extensions/tlon/index.js +28 -28
- package/dist/extensions/tlon/setup-entry.d.ts +7 -0
- package/dist/extensions/tlon/setup-entry.js +28 -28
- package/dist/extensions/together/index.d.ts +11 -0
- package/dist/extensions/together/index.js +26 -26
- package/dist/extensions/twitch/index.d.ts +39 -0
- package/dist/extensions/twitch/index.js +28 -28
- package/dist/extensions/venice/index.d.ts +11 -0
- package/dist/extensions/venice/index.js +26 -26
- package/dist/extensions/vercel-ai-gateway/index.d.ts +11 -0
- package/dist/extensions/vercel-ai-gateway/index.js +26 -26
- package/dist/extensions/vllm/index.d.ts +11 -0
- package/dist/extensions/vllm/index.js +26 -26
- package/dist/extensions/voice-call/index.d.ts +11 -0
- package/dist/extensions/voice-call/index.js +26 -26
- package/dist/extensions/volcengine/index.d.ts +11 -0
- package/dist/extensions/volcengine/index.js +26 -26
- package/dist/extensions/whatsapp/index.d.ts +11 -0
- package/dist/extensions/whatsapp/index.js +29 -29
- package/dist/extensions/whatsapp/setup-entry.d.ts +7 -0
- package/dist/extensions/whatsapp/setup-entry.js +29 -29
- package/dist/extensions/xai/index.d.ts +11 -0
- package/dist/extensions/xai/index.js +26 -26
- package/dist/extensions/xiaomi/index.d.ts +11 -0
- package/dist/extensions/xiaomi/index.js +26 -26
- package/dist/extensions/zai/index.d.ts +11 -0
- package/dist/extensions/zai/index.js +26 -26
- package/dist/extensions/zalo/index.d.ts +11 -0
- package/dist/extensions/zalo/index.js +30 -30
- package/dist/extensions/zalo/setup-entry.d.ts +34 -0
- package/dist/extensions/zalo/setup-entry.js +30 -30
- package/dist/extensions/zalouser/index.d.ts +11 -0
- package/dist/extensions/zalouser/index.js +31 -31
- package/dist/extensions/zalouser/setup-entry.d.ts +42 -0
- package/dist/extensions/zalouser/setup-entry.js +31 -31
- package/dist/feishu-DCKEC3ao.d.ts +36 -0
- package/dist/gateway-cli-DN1Ii6J-.js +26432 -0
- package/dist/gateway-install-token-CJYFJBaC.js +163 -0
- package/dist/gateway-rpc-CroQg9MB.js +26 -0
- package/dist/gateway-runtime-D9FRZqKP.js +69 -0
- package/dist/googlechat-CBCkerAy.js +307 -0
- package/dist/googlechat-CSUNieHX.d.ts +12 -0
- package/dist/group-access-rSvkIglb.d.ts +61 -0
- package/dist/health-B6WwLJp4.js +570 -0
- package/dist/health-CAlJydXv.js +108 -0
- package/dist/history-BwNxb0sJ.d.ts +75 -0
- package/dist/hooks-BYlfU3Nf.d.ts +6 -0
- package/dist/hooks-cli-DuKmdo_H.js +995 -0
- package/dist/http-registry-DX_LVtuK.d.ts +20 -0
- package/dist/image-generation-DKkdRpve.d.ts +9 -0
- package/dist/imessage-7abjbe2Q.js +31 -0
- package/dist/imessage-DOH1yaDE.js +110 -0
- package/dist/inbound-envelope-CmvweL6U.d.ts +78 -0
- package/dist/inbound-reply-dispatch-BvnKTOec.js +71 -0
- package/dist/inbound-reply-dispatch-C7LjHRZN.d.ts +72 -0
- package/dist/index-DTQqfqj9.d.ts +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +2 -2
- package/dist/infra/warning-filter.d.ts +10 -0
- package/dist/install-target-tXRD7VkM.js +574 -0
- package/dist/installs-C8fz8sm3.js +532 -0
- package/dist/io-C6XifaT4.js +9737 -0
- package/dist/io-C8awRnSW.js +28 -0
- package/dist/ipv4-d88_Jn2p.js +82 -0
- package/dist/irc-DpR6FXjN.js +672 -0
- package/dist/json-store-Sr_kk-II.d.ts +14 -0
- package/dist/keyed-async-queue-BA3BKukE.d.ts +19 -0
- package/dist/library-DOwowAGN.js +107 -0
- package/dist/lifecycle-core-BHHBoRTY.js +382 -0
- package/dist/line/accounts.d.ts +3 -0
- package/dist/line/send.d.ts +2 -0
- package/dist/line/send.js +4 -4
- package/dist/line/template-messages.d.ts +2 -0
- package/dist/line-8rsNbJCP.js +530 -0
- package/dist/line-D_cvIf6B.d.ts +75 -0
- package/dist/links-BOnvOj1z.d.ts +7 -0
- package/dist/llm-slug-generator-D9HjWtJT.js +67 -0
- package/dist/llm-slug-generator.d.ts +12 -0
- package/dist/llm-slug-generator.js +27 -27
- package/dist/logging-BhqLWxTD.js +13 -0
- package/dist/logging-DfaiL4OX.js +29 -0
- package/dist/login-qr-COBYR52w.js +233 -0
- package/dist/login-qr-xK4QIpPc.js +107 -0
- package/dist/logs-cli-RSSTw8L_.js +254 -0
- package/dist/manager-runtime-DL6JoSj9.js +106 -0
- package/dist/manager.runtime-Cbyhg1vB.js +710 -0
- package/dist/markdown-to-line-BTlEkOls.d.ts +91 -0
- package/dist/matrix-DX-jaB88.js +1490 -0
- package/dist/matrix-H6Yyj1QZ.d.ts +68 -0
- package/dist/matrix-J8s45tRw.js +1269 -0
- package/dist/mattermost-D75n6bRI.d.ts +6 -0
- package/dist/mcp-cli-CLc3_yCO.js +86 -0
- package/dist/media-understanding.runtime-BI0Lljbl.js +111 -0
- package/dist/memory-cli-CTp2cYrf.js +106 -0
- package/dist/method-scopes-Du8ODGFW.js +2586 -0
- package/dist/model-auth-markers-DEDakSUW.d.ts +20 -0
- package/dist/model-picker-CDBs7LJF.js +390 -0
- package/dist/model-picker-CRix4Wwv.js +107 -0
- package/dist/model-picker.runtime-CITyy3Rn.js +120 -0
- package/dist/model-suppression.runtime-Ce7D6QUT.js +111 -0
- package/dist/models-BK1eanuP.js +113 -0
- package/dist/models-X4Czy3uE.js +2514 -0
- package/dist/models-cli-C79Ulviy.js +304 -0
- package/dist/models-config-DALlu3S9.js +106 -0
- package/dist/models-config.providers.discovery-CSJ1STM1.d.ts +18 -0
- package/dist/monitor-B45a_RpX.js +3468 -0
- package/dist/monitor-C8KbJ-i0.js +767 -0
- package/dist/monitor-CIhrvegZ.js +3076 -0
- package/dist/monitor-CQut7klP.js +6823 -0
- package/dist/monitor-DZb5IJle.js +777 -0
- package/dist/monitor-DaFkdD27.js +108 -0
- package/dist/monitor-Do9Tp2Ii.js +110 -0
- package/dist/monitor-shared-CMK9cDOb.js +444 -0
- package/dist/msteams-A6H_wv5F.js +852 -0
- package/dist/net-DpMJgN-o.d.ts +19 -0
- package/dist/nextcloud-talk-f1pZ5Bge.d.ts +1 -0
- package/dist/node-cli-BXnmsjzL.js +2498 -0
- package/dist/node-resolve-CupmrA0Y.js +835 -0
- package/dist/nodes-cli-DZVrah_8.js +1375 -0
- package/dist/nostr-DMV534Ks.d.ts +7 -0
- package/dist/nostr-SAk3tjtR.js +8744 -0
- package/dist/npm-resolution-Dr9wssCY.js +60 -0
- package/dist/oauth-utils-DnyXdWU9.d.ts +10 -0
- package/dist/onboard-BE5pmb1g.js +589 -0
- package/dist/onboard-channels-3hNVY0E7.js +1241 -0
- package/dist/onboard-channels-vaO3nWLL.js +200 -0
- package/dist/onboard-custom-CI5uFyWH.js +571 -0
- package/dist/onboard-custom-eIvRswgv.js +109 -0
- package/dist/onboard-helpers-ChMWfUnl.js +335 -0
- package/dist/onboard-helpers-DRFi9oaD.js +108 -0
- package/dist/onboard-remote-BTspTgA4.js +112 -0
- package/dist/onboard-remote-so38yXlX.js +181 -0
- package/dist/onboard-search-DS0tZS24.js +297 -0
- package/dist/onboard-skills-B9DxCCiU.js +133 -0
- package/dist/onboard-skills-so0a_BJV.js +112 -0
- package/dist/outbound-media-BiJscGlR.js +11 -0
- package/dist/outbound-media-DJF-TuJu.d.ts +11 -0
- package/dist/pairing-access-CuiJP9xN.d.ts +21 -0
- package/dist/pairing-cli-DN0u1Cez.js +212 -0
- package/dist/parse-finite-number-B3FJTjyQ.d.ts +5 -0
- package/dist/perplexity-Bw1u3CAF.js +24 -0
- package/dist/persistent-dedupe-DR5Ka6BX.d.ts +26 -0
- package/dist/pi-model-discovery-runtime-iwKNCaYu.js +106 -0
- package/dist/pi-tools.before-tool-call.runtime-BM_N-JZe.js +380 -0
- package/dist/plugin-install--KVul05Z.js +184 -0
- package/dist/plugin-install-DVpPsLkS.js +112 -0
- package/dist/plugin-install-plan-Dwc6-coz.js +49 -0
- package/dist/plugin-registry-XRswugE9.js +108 -0
- package/dist/plugin-registry-jozQafRo.js +49 -0
- package/dist/plugin-sdk/account-resolution.js +26 -26
- package/dist/plugin-sdk/acp-runtime.js +26 -26
- package/dist/plugin-sdk/acpx.js +1 -1
- package/dist/plugin-sdk/agent-runtime.js +26 -26
- package/dist/plugin-sdk/bluebubbles.js +29 -29
- package/dist/plugin-sdk/channel-config-helpers.js +26 -26
- package/dist/plugin-sdk/channel-config-schema.js +2 -2
- package/dist/plugin-sdk/channel-policy.js +26 -26
- package/dist/plugin-sdk/channel-runtime.js +26 -26
- package/dist/plugin-sdk/compat.js +27 -27
- package/dist/plugin-sdk/config-runtime.js +28 -28
- package/dist/plugin-sdk/conversation-runtime.js +26 -26
- package/dist/plugin-sdk/discord.js +26 -26
- package/dist/plugin-sdk/feishu.js +27 -27
- package/dist/plugin-sdk/gateway-runtime.js +8 -8
- package/dist/plugin-sdk/googlechat.js +29 -29
- package/dist/plugin-sdk/image-generation-runtime.js +26 -26
- package/dist/plugin-sdk/image-generation.js +26 -26
- package/dist/plugin-sdk/imessage.js +27 -27
- package/dist/plugin-sdk/index.js +26 -26
- package/dist/plugin-sdk/infra-runtime.js +26 -26
- package/dist/plugin-sdk/irc.js +29 -29
- package/dist/plugin-sdk/line.js +27 -27
- package/dist/plugin-sdk/llm-task.js +26 -26
- package/dist/plugin-sdk/matrix.js +29 -29
- package/dist/plugin-sdk/mattermost.js +28 -28
- package/dist/plugin-sdk/media-runtime.js +26 -26
- package/dist/plugin-sdk/media-understanding-runtime.js +26 -26
- package/dist/plugin-sdk/media-understanding.js +26 -26
- package/dist/plugin-sdk/msteams.js +30 -30
- package/dist/plugin-sdk/nextcloud-talk.js +28 -28
- package/dist/plugin-sdk/nostr.js +27 -27
- package/dist/plugin-sdk/plugin-runtime.js +26 -26
- package/dist/plugin-sdk/provider-auth.js +28 -28
- package/dist/plugin-sdk/provider-setup.js +27 -27
- package/dist/plugin-sdk/provider-web-search.js +1 -1
- package/dist/plugin-sdk/qwen-portal-auth.js +26 -26
- package/dist/plugin-sdk/reply-history.js +26 -26
- package/dist/plugin-sdk/reply-runtime.js +26 -26
- package/dist/plugin-sdk/sandbox.js +26 -26
- package/dist/plugin-sdk/security-runtime.js +26 -26
- package/dist/plugin-sdk/self-hosted-provider-setup.js +27 -27
- package/dist/plugin-sdk/setup.js +27 -27
- package/dist/plugin-sdk/signal.js +26 -26
- package/dist/plugin-sdk/slack.js +26 -26
- package/dist/plugin-sdk/speech-runtime.js +26 -26
- package/dist/plugin-sdk/speech.js +26 -26
- package/dist/plugin-sdk/src/channels/plugins/setup-wizard-helpers.d.ts +3 -0
- package/dist/plugin-sdk/src/config/config-lock.d.ts +38 -0
- package/dist/plugin-sdk/src/config/config.d.ts +1 -1
- package/dist/plugin-sdk/src/config/io.d.ts +39 -0
- package/dist/plugin-sdk/src/config/types.gateway.d.ts +12 -0
- package/dist/plugin-sdk/src/config/types.secrets.d.ts +10 -0
- package/dist/plugin-sdk/src/config/zod-schema.d.ts +2 -0
- package/dist/plugin-sdk/src/gateway/credential-planner.d.ts +3 -1
- package/dist/plugin-sdk/src/secrets/provider-env-vars.d.ts +61 -0
- package/dist/plugin-sdk/src/secrets/sec1-placeholder.d.ts +181 -0
- package/dist/plugin-sdk/src/secrets/sec1-utils.d.ts +57 -0
- package/dist/plugin-sdk/synology-chat.js +27 -27
- package/dist/plugin-sdk/telegram.js +26 -26
- package/dist/plugin-sdk/text-runtime.js +4 -4
- package/dist/plugin-sdk/tlon.js +27 -27
- package/dist/plugin-sdk/twitch.js +26 -26
- package/dist/plugin-sdk/voice-call.js +26 -26
- package/dist/plugin-sdk/whatsapp.js +26 -26
- package/dist/plugin-sdk/zalo.js +30 -30
- package/dist/plugin-sdk/zalouser.js +29 -29
- package/dist/plugins/runtime/index.d.ts +22 -0
- package/dist/plugins/runtime/index.js +26 -26
- package/dist/plugins-C4PiDdjc.js +106 -0
- package/dist/plugins-cli-zhmliYNU.js +912 -0
- package/dist/policy-CcSolumc.js +143 -0
- package/dist/preflight-audio.runtime-BAbfqqzW.js +111 -0
- package/dist/probe-Bgt5c-cr.js +129 -0
- package/dist/probe-CPk5iGcg.js +47 -0
- package/dist/probe-DR4KRKXz.js +19 -0
- package/dist/probe-DnoCyJ_m.js +1793 -0
- package/dist/probe-VsLtK3vQ.js +6328 -0
- package/dist/probe-auth-BnsKrQt7.js +38 -0
- package/dist/probe-auth-DYdUG8l1.js +48 -0
- package/dist/program-8enYYBsc.js +247 -0
- package/dist/prompt-select-styled-DxBcUasv.js +2673 -0
- package/dist/provider-api-key-auth.runtime-DsLZyt6h.js +116 -0
- package/dist/provider-auth-choice-30EvRxqc.js +126 -0
- package/dist/provider-auth-choice-preference-DMr1WmRg.js +189 -0
- package/dist/provider-auth-choice.runtime-CI98BgQF.js +118 -0
- package/dist/provider-auth-guidance-WKDIi_wk.js +34 -0
- package/dist/provider-auth-result-Cs8wguSI.d.ts +18 -0
- package/dist/provider-models-EOys_Nvi.d.ts +867 -0
- package/dist/provider-ollama-setup-D89zlm9C.d.ts +32 -0
- package/dist/provider-onboard-BzOpgCLu.d.ts +40 -0
- package/dist/provider-runtime.runtime-Cm4as2KG.js +106 -0
- package/dist/provider-self-hosted-setup-Bmv_AQmw.d.ts +61 -0
- package/dist/provider-self-hosted-setup-CJwFVVB4.js +182 -0
- package/dist/provider-usage-CVNyLLDb.js +106 -0
- package/dist/provider-usage.types-CdTymHNu.d.ts +16 -0
- package/dist/provider-web-search-BJhXD5dH.js +2392 -0
- package/dist/provider-wizard-DMMYXjlW.js +152 -0
- package/dist/push-apns-BnWTdTEk.js +1038 -0
- package/dist/pw-ai-CtK_7Cy2.js +1866 -0
- package/dist/qr-cli-CA-BF0--.js +108 -0
- package/dist/qr-cli-D18HiUkh.js +369 -0
- package/dist/reactions-Df7XG8Uh.js +281 -0
- package/dist/read-only-account-inspect.discord.runtime-B-FP0mwb.js +111 -0
- package/dist/read-only-account-inspect.slack.runtime-DkWZ2ccW.js +111 -0
- package/dist/read-only-account-inspect.telegram.runtime-BnlTkn_e.js +111 -0
- package/dist/redact-snapshot-DVdstBvO.js +2661 -0
- package/dist/ref-contract-RPkB754Q.js +53 -0
- package/dist/register.agent-DVAxXQKW.js +434 -0
- package/dist/register.backup-CUuL5KUZ.js +624 -0
- package/dist/register.configure-bC0UEwfU.js +247 -0
- package/dist/register.maintenance-iIqvl_eT.js +569 -0
- package/dist/register.message-CEDd4z07.js +704 -0
- package/dist/register.onboard-Cejfnysy.js +187 -0
- package/dist/register.setup-DU7uHdYt.js +207 -0
- package/dist/register.status-health-sessions-BWphMXNR.js +493 -0
- package/dist/register.subclis-DnIweTEG.js +315 -0
- package/dist/register.subclis-gJX_Pbub.js +12 -0
- package/dist/registry-Dgwc-7eS.js +1183 -0
- package/dist/replies-D9PEZ8yn.js +110 -0
- package/dist/reply-history-lHgoC4l3.d.ts +1 -0
- package/dist/reply-payload-Bd2HuR4g.d.ts +46 -0
- package/dist/request-url-BcSJaiiu.d.ts +5 -0
- package/dist/resolve-BbsCHGLY.js +660 -0
- package/dist/resolve-channels-BtrGC95o.js +262 -0
- package/dist/resolve-channels-C1SthO1N.js +226 -0
- package/dist/resolve-users-CgSxHrU0.js +143 -0
- package/dist/routes-BZtqNrBf.js +7097 -0
- package/dist/rpc-D3KMxG4J.js +67 -0
- package/dist/run-command-C8b3dCZV.d.ts +16 -0
- package/dist/run-main-BlWJVotF.js +423 -0
- package/dist/runtime-RWGbO5Qy.d.ts +26 -0
- package/dist/runtime-discord-ops.runtime-DUXIYvQr.js +9073 -0
- package/dist/runtime-slack-ops.runtime-n1yFfyp1.js +4551 -0
- package/dist/runtime-telegram-ops.runtime-PZUWchjT.js +128 -0
- package/dist/runtime-whatsapp-login.runtime-xsuNyvGz.js +109 -0
- package/dist/runtime-whatsapp-outbound.runtime-5EfEyCsO.js +112 -0
- package/dist/sandbox-cli-Dw1nWNmQ.js +530 -0
- package/dist/search-manager-BJoRxOaf.js +15 -0
- package/dist/search-manager-DxkQvUrW.js +386 -0
- package/dist/secret-input-schema-Cp_La9qv.d.ts +19 -0
- package/dist/secrets-cli-BPyV2gSq.js +2065 -0
- package/dist/security-cli-EK4sSRfG.js +570 -0
- package/dist/send-B01Gvh9m.js +629 -0
- package/dist/send-B4L4wRJO.js +100 -0
- package/dist/send-BDcGrXt0.js +1025 -0
- package/dist/send-BRRtHxyR.js +283 -0
- package/dist/send-DU6dmMXW.js +631 -0
- package/dist/server-CWw5GFEg.js +106 -0
- package/dist/server-node-events-92cDVswC.js +501 -0
- package/dist/session-key-DbkfhOjM.d.ts +46 -0
- package/dist/sessions-B052uHA3.js +218 -0
- package/dist/sessions-Cef4dZNP.js +107 -0
- package/dist/setup-BlQPyDPy.js +387 -0
- package/dist/setup-DcSZ_pTn.d.ts +37 -0
- package/dist/setup-core-B9mdZYnU.js +166 -0
- package/dist/setup-core-Cj0sLkpP.js +47 -0
- package/dist/setup-core-CkZbebOv.js +143 -0
- package/dist/setup-core-MRNjnrJl.js +205 -0
- package/dist/setup-surface-3ZY0JtWE.js +490 -0
- package/dist/setup-wizard-helpers-Dwzb9Dcz.d.ts +203 -0
- package/dist/setup.finalize-B5ETm3Ui.js +517 -0
- package/dist/setup.gateway-config-C8hdtlbw.js +338 -0
- package/dist/setup.secret-input-BZSIeiqy.js +25 -0
- package/dist/shared--9_eQ_lc.js +75 -0
- package/dist/shared-CxkH3H0U.js +102 -0
- package/dist/shared-DTNL0hA9.js +298 -0
- package/dist/shared-HSP1OV-Q.js +96 -0
- package/dist/shared-UIjWb_3B.js +182 -0
- package/dist/signal-CTI6bSmB.js +109 -0
- package/dist/skills-4-r1mfJM.js +853 -0
- package/dist/skills-RNm54CBO.js +19 -0
- package/dist/skills-cli-te7dSs5p.js +291 -0
- package/dist/skills-install-Del-Ogv8.js +763 -0
- package/dist/skills-status-BZpoMXrR.js +169 -0
- package/dist/skills-status-Dq61Sz8U.js +20 -0
- package/dist/slack-oc-viUtl.js +109 -0
- package/dist/slash-commands.runtime-NdkD2LZV.js +123 -0
- package/dist/slash-dispatch.runtime-DQgeaF3J.js +136 -0
- package/dist/slash-skill-commands.runtime-DmOl2DnL.js +111 -0
- package/dist/src-0wtt7seR.js +1696 -0
- package/dist/status-5oR_gqv_.js +121 -0
- package/dist/status-BO8LY0hC.js +1599 -0
- package/dist/status-D_oHA9yO.js +126 -0
- package/dist/status-IrMacJRj.js +606 -0
- package/dist/status-Prdeg53E.js +43 -0
- package/dist/status-json-Da0hR-1Z.js +286 -0
- package/dist/status.link-channel-BgUJEZAz.js +138 -0
- package/dist/status.scan.deps.runtime-D9vHTxOW.js +121 -0
- package/dist/status.scan.runtime-D-EdD5CW.js +114 -0
- package/dist/status.summary--i6xduWH.js +592 -0
- package/dist/status.summary.runtime-BqMXjaBc.js +113 -0
- package/dist/subagent-orphan-recovery-DiRJcFQc.js +302 -0
- package/dist/subagent-registry-runtime-B66EYEYm.js +106 -0
- package/dist/synology-chat-BemXqdzG.js +297 -0
- package/dist/system-cli-CSuiia4-.js +92 -0
- package/dist/telegram/audit.d.ts +2 -0
- package/dist/telegram/audit.js +1 -1
- package/dist/telegram/token.d.ts +2 -0
- package/dist/telegram/token.js +26 -26
- package/dist/telegram-DLFcRv5a.js +109 -0
- package/dist/testing-DZrulv-n.d.ts +1755 -0
- package/dist/text-chunking-BaYBIUoR.d.ts +79 -0
- package/dist/text-chunking-C8kmbNfa.js +84 -0
- package/dist/thinking-D8aqmr3o.d.ts +13 -0
- package/dist/tlon-Bpr4f3yF.js +433 -0
- package/dist/tool-send-BHKm5ztm.d.ts +9 -0
- package/dist/tui-BY3QRgC1.js +3834 -0
- package/dist/tui-cli-CCfZOlV0.js +132 -0
- package/dist/types-CKx5nDZB.d.ts +45 -0
- package/dist/types-DBhDdMQd.d.ts +22670 -0
- package/dist/types.base-B_TkkSS8.d.ts +188 -0
- package/dist/types.secrets-Bojc4omL.js +92 -0
- package/dist/ui-1UpZZyI3.js +31 -0
- package/dist/update-BR4JvFpV.js +1036 -0
- package/dist/update-cli-BZv44lFq.js +1498 -0
- package/dist/update-offset-store-DGdBotIW.js +107 -0
- package/dist/update-runner-D34sooPe.js +1496 -0
- package/dist/vllm-defaults-BCGSJ7K0.d.ts +13 -0
- package/dist/wait-BU9vJv22.d.ts +4 -0
- package/dist/web-CXpU2D41.js +107 -0
- package/dist/web-shared-B4sL45ah.d.ts +45 -0
- package/dist/webhook-memory-guards-B7oLVseG.d.ts +43 -0
- package/dist/webhook-request-guards-CqIH7equ.d.ts +76 -0
- package/dist/webhook-targets-CAAGATtk.js +181 -0
- package/dist/webhook-targets-oQ0jd4r0.d.ts +106 -0
- package/dist/webhooks-cli-B46t2VT5.js +349 -0
- package/dist/whatsapp-Dniwd4Rv.js +109 -0
- package/dist/whatsapp-actions-fL46PsNs.js +162 -0
- package/dist/windows-spawn-DGeE98SH.d.ts +43 -0
- package/dist/workspace-dirs-d3Ms_ryk.js +2002 -0
- package/dist/zalo-Csulx0XK.d.ts +9 -0
- package/dist/zalo-gh0yAWmS.js +415 -0
- package/dist/zalouser-CuxRvztM.js +30911 -0
- package/dist/zod-schema.agent-runtime-B4MkB-_3.d.ts +10 -0
- package/dist/zod-schema.core-D5reNip6.js +541 -0
- package/dist/zod-schema.core-DN3RhEUG.d.ts +173 -0
- package/docs/SEC1.md +523 -0
- package/docs/SEC1_IMPLEMENTATION/CHANNELS_REPORT.md +173 -0
- package/docs/SEC1_IMPLEMENTATION/CORE_UTIL_REPORT.md +139 -0
- package/docs/SEC1_IMPLEMENTATION/DOCS_REPORT.md +134 -0
- package/docs/SEC1_IMPLEMENTATION/ENV_MAP_DRAFT.md +148 -0
- package/docs/SEC1_IMPLEMENTATION/INTEGRATION_REPORT.md +170 -0
- package/docs/SEC1_IMPLEMENTATION/PROVIDERS_REPORT.md +291 -0
- package/docs/SEC1_IMPLEMENTATION/QA_REPORT.md +249 -0
- package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-channels.md +317 -0
- package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-docs.md +212 -0
- package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-security.md +368 -0
- package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave2-critic-consolidated.md +195 -0
- package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave3-fix-report.md +105 -0
- package/docs/SEC1_IMPLEMENTATION/STRATEGY.md +451 -0
- package/docs/SEC1_IMPLEMENTATION/TEST_REPORT.md +156 -0
- package/docs/pipeline-sdk/CLI_SPEC.md +609 -0
- package/docs/pipeline-sdk/PIPELINE_SDK_DESIGN.md +1372 -0
- package/extensions/kakao-talkchannel/MIGRATION_ARCH_ANALYSIS.md +455 -0
- package/extensions/kakao-talkchannel/MIGRATION_CODE_ANALYSIS.md +383 -0
- package/extensions/kakao-talkchannel/MIGRATION_STRATEGY.md +115 -0
- package/extensions/kakao-talkchannel/README.md +50 -0
- package/extensions/kakao-talkchannel/index.ts +20 -0
- package/extensions/kakao-talkchannel/moldclaw.plugin.json +98 -0
- package/extensions/kakao-talkchannel/package.json +12 -0
- package/extensions/kakao-talkchannel/src/adapters/config.ts +132 -0
- package/extensions/kakao-talkchannel/src/adapters/gateway.ts +974 -0
- package/extensions/kakao-talkchannel/src/adapters/outbound.ts +52 -0
- package/extensions/kakao-talkchannel/src/adapters/pairing.ts +35 -0
- package/extensions/kakao-talkchannel/src/adapters/security.ts +57 -0
- package/extensions/kakao-talkchannel/src/adapters/setup.ts +105 -0
- package/extensions/kakao-talkchannel/src/adapters/status.ts +117 -0
- package/extensions/kakao-talkchannel/src/channel.ts +58 -0
- package/extensions/kakao-talkchannel/src/commands/card.ts +413 -0
- package/extensions/kakao-talkchannel/src/config/schema.ts +129 -0
- package/extensions/kakao-talkchannel/src/kakao/callback.ts +133 -0
- package/extensions/kakao-talkchannel/src/kakao/limits.ts +129 -0
- package/extensions/kakao-talkchannel/src/kakao/payload.ts +138 -0
- package/extensions/kakao-talkchannel/src/kakao/response.ts +373 -0
- package/extensions/kakao-talkchannel/src/relay/client.ts +146 -0
- package/extensions/kakao-talkchannel/src/relay/session.ts +137 -0
- package/extensions/kakao-talkchannel/src/relay/sse.ts +258 -0
- package/extensions/kakao-talkchannel/src/relay/stream.ts +149 -0
- package/extensions/kakao-talkchannel/src/runtime.ts +21 -0
- package/extensions/kakao-talkchannel/src/types.ts +447 -0
- package/extensions/kakao-talkchannel/src/version.ts +3 -0
- package/extensions/kakao-talkchannel/tsconfig.json +19 -0
- package/package.json +23 -8
- package/skills/meshy/SKILL.md +69 -0
- package/skills/meshy/scripts/__pycache__/check_status.cpython-312.pyc +0 -0
- package/skills/meshy/scripts/__pycache__/image_to_3d.cpython-312.pyc +0 -0
- package/skills/meshy/scripts/__pycache__/text_to_3d.cpython-312.pyc +0 -0
- package/skills/meshy/scripts/check_status.py +147 -0
- package/skills/meshy/scripts/image_to_3d.py +229 -0
- package/skills/meshy/scripts/text_to_3d.py +214 -0
- package/skills/nano-banana-pro/scripts/generate_image.py +1 -1
- package/skills/openai-whisper-api/scripts/transcribe.sh +0 -0
- package/skills/tavily-search/SKILL.md +61 -0
- package/skills/tavily-search/scripts/__pycache__/search.cpython-312.pyc +0 -0
- package/skills/tavily-search/scripts/search.py +238 -0
- package/skills/video-frames/scripts/frame.sh +0 -0
- package/LICENSE +0 -21
- package/dist/accounts-UcSvD34O.js +0 -109
- package/dist/acp-cli-BPb8PgHP.js +0 -2088
- package/dist/actions.runtime-BL5QRooG.js +0 -114
- package/dist/actions.runtime-DSdfSo40.js +0 -128
- package/dist/agents-CHeX_5-H.js +0 -217
- package/dist/agents-DQRL9XKP.js +0 -853
- package/dist/allow-list-Boi79v-U.js +0 -81
- package/dist/allowlist-B2eBBeMF.js +0 -142
- package/dist/api-CFAtRSYL.js +0 -6953
- package/dist/api-D5JNJj8n.js +0 -112
- package/dist/audit-BM0GsdzV.js +0 -787
- package/dist/audit-BqRK9OSj.js +0 -54
- package/dist/audit-channel.collect.runtime-BPvDB8aq.js +0 -600
- package/dist/audit-channel.runtime-D3fzHiAo.js +0 -116
- package/dist/audit-extra.async-NveNIzX0.js +0 -813
- package/dist/audit-membership-runtime-mu470WFO.js +0 -157
- package/dist/audit.deep.runtime-RdxvW8Tj.js +0 -24
- package/dist/audit.nondeep.runtime-DDu8vA9Z.js +0 -831
- package/dist/audit.runtime-Y8C9W7s9.js +0 -113
- package/dist/auth-choice-C1CIxRsi.js +0 -268
- package/dist/auth-choice-CTvqWiDI.js +0 -117
- package/dist/auth-choice-Ddzko1B8.js +0 -502
- package/dist/auth-choice-options-BIAmAiCe.js +0 -123
- package/dist/auth-choice-prompt-B815kArz.js +0 -110
- package/dist/auth-choice-prompt-CGhTNCJx.js +0 -36
- package/dist/auth-choice.plugin-providers.runtime-AvAZ6S5W.js +0 -114
- package/dist/auth-profiles-BJcHzwPy.js +0 -127650
- package/dist/auth-profiles.runtime-CieFilK5.js +0 -111
- package/dist/bluebubbles-F8FGE9cH.js +0 -64
- package/dist/brave-BG5Yopn8.js +0 -24
- package/dist/browser-cli-Co7PJGZF.js +0 -1492
- package/dist/call-CoaQYq7c.js +0 -639
- package/dist/call-D3eu5Jjh.js +0 -37
- package/dist/channel-BftWD6yu.js +0 -1321
- package/dist/channel-Bub9U5Xg.js +0 -214
- package/dist/channel-C0oDs7TO.js +0 -4681
- package/dist/channel-C8CnEdkZ.js +0 -352
- package/dist/channel-CI-RC-xf.js +0 -497
- package/dist/channel-CY-hZCOJ.js +0 -397
- package/dist/channel-CbtGJB2x.js +0 -943
- package/dist/channel-CcfK3wP8.js +0 -803
- package/dist/channel-DBoDIeVj.js +0 -619
- package/dist/channel-DEq6Ecs-.js +0 -920
- package/dist/channel-DH4dhW1n.js +0 -226
- package/dist/channel-DQ_wdKg_.js +0 -575
- package/dist/channel-DT6qD1Ic.js +0 -207
- package/dist/channel-DZNAyxwr.js +0 -542
- package/dist/channel-DtakwAEe.js +0 -538
- package/dist/channel-DuYgH6p1.js +0 -562
- package/dist/channel-Hn-AN-d52.js +0 -316
- package/dist/channel-_R4hbD5h.js +0 -1598
- package/dist/channel-account-context-DXq8dlvI.js +0 -103
- package/dist/channel-kQmEVn3I.js +0 -306
- package/dist/channel-options-DHfxaklg.js +0 -50
- package/dist/channel-summary-DUpnoYhI.js +0 -106
- package/dist/channel-t-JxCWk6.js +0 -949
- package/dist/channel.runtime--GYriaXU.js +0 -213
- package/dist/channel.runtime-BJtn3GOH.js +0 -174
- package/dist/channel.runtime-BV7t_oNz.js +0 -166
- package/dist/channel.runtime-Bi8a3n9S.js +0 -865
- package/dist/channel.runtime-BjsYF0NN.js +0 -122
- package/dist/channel.runtime-BnI6YtmI.js +0 -413
- package/dist/channel.runtime-CQOftcCd.js +0 -194
- package/dist/channel.runtime-CuIAcPjZ.js +0 -4006
- package/dist/channel.runtime-DH1Q1G4k.js +0 -399
- package/dist/channel.runtime-DYYUPKxr.js +0 -236
- package/dist/channel.runtime-U5Gszsr5.js +0 -177
- package/dist/channel.setup-BQFHmgki.js +0 -9
- package/dist/channel.setup-BVoDwklu.js +0 -8
- package/dist/channel.setup-Bf73HsXr.js +0 -57
- package/dist/channel.setup-CblD4flM.js +0 -11
- package/dist/channel.setup-DgxlrPgz.js +0 -6
- package/dist/channel.setup-GLIAEVKL.js +0 -8
- package/dist/channel.setup-YTy5R1sz.js +0 -9
- package/dist/channels-CTL8iR9J.js +0 -404
- package/dist/channels-DBGvnjHY.js +0 -1113
- package/dist/channels-cli-BmVO5-sq.js +0 -286
- package/dist/channels-status-issues-kDtsWzA-.js +0 -16
- package/dist/clawbot-cli-DtcMJHqX.js +0 -113
- package/dist/cli-BNGECGVY.js +0 -149
- package/dist/command-registry-1SDrWgER.js +0 -13
- package/dist/command-registry-DNorYU4w.js +0 -212
- package/dist/command-secret-gateway-DqDZparO.js +0 -106
- package/dist/compact.runtime-C1ZN8UGb.js +0 -111
- package/dist/completion-cli-Q_Jt5Foc.js +0 -16
- package/dist/completion-cli-QkTXhuJh.js +0 -445
- package/dist/config-BbxrRaLf.js +0 -938
- package/dist/config-CkD8DJ7L.js +0 -44
- package/dist/config-cli-BoPrlYTp.js +0 -428
- package/dist/config-guard-CEhCvr_u.js +0 -117
- package/dist/config-schema-GQ6uWjXe.js +0 -31
- package/dist/config-validation-woE2_LpC.js +0 -262
- package/dist/config-value-Dh8m-CFf.js +0 -132
- package/dist/config-y4i5g7s4.js +0 -30
- package/dist/configure-DGRzwdFN.js +0 -1100
- package/dist/configure-S4AHE3k_.js +0 -238
- package/dist/control-ui-shared-kLBp4YlS.js +0 -29
- package/dist/credentials-D5uBf_C5.js +0 -265
- package/dist/cron-cli-lGupeVCW.js +0 -634
- package/dist/daemon-cli-Cs_edi0I.js +0 -339
- package/dist/daemon-install-DIFpP_qv.js +0 -175
- package/dist/deliver-DYa_DFZU.js +0 -106
- package/dist/deliver-runtime-DCW_o2Ot.js +0 -106
- package/dist/devices-cli-YsGOW2-w.js +0 -340
- package/dist/diagnostic-vMghIesG.js +0 -310
- package/dist/directory-cli-DtjMQjU5.js +0 -306
- package/dist/directory.static-DBZGvsdF.js +0 -44
- package/dist/discord-DYCu19HT.js +0 -109
- package/dist/discovery-DZYAoDF_.js +0 -48
- package/dist/dns-cli-DqW4pNgW.js +0 -216
- package/dist/docs-cli-Bu9TBlDU.js +0 -173
- package/dist/doctor-completion-B5hcQD5c.js +0 -90
- package/dist/doctor-config-flow-BBB2ZKfT.js +0 -107
- package/dist/doctor-config-flow-DDBYUS9f.js +0 -2437
- package/dist/enable-Tmsp8QuB.js +0 -24
- package/dist/env-overrides-BHxqjYZG.js +0 -434
- package/dist/env-overrides.runtime-Cz98bf-l.js +0 -17
- package/dist/exec-approvals-cli-wO5cYfMa.js +0 -419
- package/dist/gateway-cli-CFvDGhB9.js +0 -26429
- package/dist/gateway-install-token-CskJfo_N.js +0 -163
- package/dist/gateway-rpc-srYfBID9.js +0 -26
- package/dist/gateway-runtime-C76hUmUV.js +0 -69
- package/dist/googlechat-Cha5utST.js +0 -307
- package/dist/health-DDQYYsJy.js +0 -108
- package/dist/health-DXZykGaX.js +0 -570
- package/dist/hooks-cli-DfkurPYP.js +0 -995
- package/dist/imessage-B26k39pl.js +0 -110
- package/dist/imessage-Bp1_6cws.js +0 -31
- package/dist/inbound-reply-dispatch-DoIJLztA.js +0 -71
- package/dist/install-target-BjOuS4I8.js +0 -574
- package/dist/installs-Cz4k0W1Y.js +0 -532
- package/dist/io-B0OKifLZ.js +0 -28
- package/dist/io-DcoxdH6t.js +0 -9570
- package/dist/ipv4-CTQQ4_IW.js +0 -82
- package/dist/irc-B8vBDigm.js +0 -672
- package/dist/library-VCM_cQY4.js +0 -107
- package/dist/lifecycle-core-Ctz36PdQ.js +0 -382
- package/dist/line-B_uTLrdI.js +0 -530
- package/dist/llm-slug-generator-YWg0g2pj.js +0 -67
- package/dist/logging-S-5LPdfQ.js +0 -13
- package/dist/logging-ueBMCGMR.js +0 -29
- package/dist/login-qr-pcACm2Ng.js +0 -107
- package/dist/login-qr-pv-kxMfF.js +0 -233
- package/dist/logs-cli-RgADgSMO.js +0 -254
- package/dist/manager-runtime-BhTkoKmb.js +0 -106
- package/dist/manager.runtime-BjHzikoK.js +0 -710
- package/dist/matrix-C4EEu2Qp.js +0 -1490
- package/dist/matrix-Dfzcc5nV.js +0 -1269
- package/dist/mcp-cli-CJmOm9Oj.js +0 -86
- package/dist/media-understanding.runtime-DCETFCw_.js +0 -111
- package/dist/memory-cli-DFqd6tYx.js +0 -106
- package/dist/method-scopes-D-Q9dvbj.js +0 -2586
- package/dist/model-picker-Z-CUcuMr.js +0 -390
- package/dist/model-picker-v5mUsZ4J.js +0 -107
- package/dist/model-picker.runtime-A_z0dHfS.js +0 -120
- package/dist/model-suppression.runtime-QVWVJRr-.js +0 -111
- package/dist/models-Bbj0xV4F.js +0 -2514
- package/dist/models-D-OIjZqU.js +0 -113
- package/dist/models-cli-Bpn-5i4h.js +0 -304
- package/dist/models-config-Cwa5cJbC.js +0 -106
- package/dist/monitor-BchfCAaU.js +0 -6823
- package/dist/monitor-BydV44SP.js +0 -3076
- package/dist/monitor-CT8axwfm.js +0 -767
- package/dist/monitor-CZGWNOvn.js +0 -777
- package/dist/monitor-DN62r69g.js +0 -3468
- package/dist/monitor-DZ0fzJku.js +0 -110
- package/dist/monitor-DvNjzWFu.js +0 -108
- package/dist/monitor-shared-B-DBSlkQ.js +0 -444
- package/dist/msteams-Bf-wk2Rp.js +0 -852
- package/dist/node-cli-kH16TQI7.js +0 -2498
- package/dist/node-resolve-DfOpQmxm.js +0 -835
- package/dist/nodes-cli-CkAMXW5u.js +0 -1375
- package/dist/nostr-B8UGHclZ.js +0 -8744
- package/dist/npm-resolution-DmjlifII.js +0 -60
- package/dist/onboard-C883nfyw.js +0 -589
- package/dist/onboard-channels-Dc-BxN7p.js +0 -200
- package/dist/onboard-channels-j5EENtum.js +0 -1241
- package/dist/onboard-custom-0atne0C5.js +0 -571
- package/dist/onboard-custom-CWMqwjJx.js +0 -109
- package/dist/onboard-helpers-D3wWfH8F.js +0 -335
- package/dist/onboard-helpers-DZmRCe8l.js +0 -108
- package/dist/onboard-remote-Cn6kW-p0.js +0 -112
- package/dist/onboard-remote-Cx4w5VAk.js +0 -181
- package/dist/onboard-search-Ck9HRh2M.js +0 -297
- package/dist/onboard-skills-BtqrGioT.js +0 -133
- package/dist/onboard-skills-Dnw19Os8.js +0 -112
- package/dist/outbound-media-C5Nv4o18.js +0 -11
- package/dist/pairing-cli-Cwy9QZ_4.js +0 -212
- package/dist/perplexity-Brhpb45X.js +0 -24
- package/dist/pi-model-discovery-runtime-DIOdo6D8.js +0 -106
- package/dist/pi-tools.before-tool-call.runtime-CFM4gsDF.js +0 -380
- package/dist/plugin-install-BOV00hia.js +0 -112
- package/dist/plugin-install-Bak8fUBv.js +0 -184
- package/dist/plugin-install-plan-bKkEefRf.js +0 -49
- package/dist/plugin-registry-DxAXQUlZ.js +0 -108
- package/dist/plugin-registry-n0p3phem.js +0 -49
- package/dist/plugins-Ca3RK8Fi.js +0 -106
- package/dist/plugins-cli-BnC51H2R.js +0 -912
- package/dist/policy-BJv97w9e.js +0 -143
- package/dist/preflight-audio.runtime-BrFcf-6_.js +0 -111
- package/dist/probe-063xvvZc.js +0 -19
- package/dist/probe-BJEb2wGv.js +0 -1793
- package/dist/probe-CJQlxgsl.js +0 -47
- package/dist/probe-Caa2HznF.js +0 -6328
- package/dist/probe-CfL4tnJ6.js +0 -129
- package/dist/probe-auth-DN2Ec83-.js +0 -38
- package/dist/probe-auth-D_UKzu4m.js +0 -48
- package/dist/program-BOMdC7MC.js +0 -247
- package/dist/prompt-select-styled-DDnCfM3j.js +0 -2673
- package/dist/provider-api-key-auth.runtime-DUns3fwX.js +0 -116
- package/dist/provider-auth-choice-B_j1ctT2.js +0 -126
- package/dist/provider-auth-choice-preference-BaOBZ_Xn.js +0 -189
- package/dist/provider-auth-choice.runtime-DOako_zV.js +0 -118
- package/dist/provider-auth-guidance-CrjxnoNZ.js +0 -34
- package/dist/provider-runtime.runtime-BkOkgmTw.js +0 -106
- package/dist/provider-self-hosted-setup-BFDU6dRa.js +0 -182
- package/dist/provider-usage-CaDE0mqq.js +0 -106
- package/dist/provider-web-search-BR7etTjJ.js +0 -2392
- package/dist/provider-wizard-DCPdKUvb.js +0 -152
- package/dist/push-apns-B_OZjm4v.js +0 -1038
- package/dist/pw-ai-dG60P0hQ.js +0 -1866
- package/dist/qr-cli-DWfiw79I.js +0 -369
- package/dist/qr-cli-DwuKtyZQ.js +0 -108
- package/dist/reactions-CIGAPBn8.js +0 -281
- package/dist/read-only-account-inspect.discord.runtime-D54mnq8l.js +0 -111
- package/dist/read-only-account-inspect.slack.runtime-Bxs9ObMC.js +0 -111
- package/dist/read-only-account-inspect.telegram.runtime-UoVuf_Yo.js +0 -111
- package/dist/redact-snapshot-DZ3Vq-SC.js +0 -2657
- package/dist/ref-contract-D96lSYLs.js +0 -53
- package/dist/register.agent-2KmeahEL.js +0 -434
- package/dist/register.backup-ECBnWVR7.js +0 -624
- package/dist/register.configure-Doz1daCp.js +0 -247
- package/dist/register.maintenance-C33cV-WM.js +0 -569
- package/dist/register.message-CnL0NiF6.js +0 -704
- package/dist/register.onboard-BrYGZeQA.js +0 -187
- package/dist/register.setup-Bx6gEg6X.js +0 -207
- package/dist/register.status-health-sessions-FLb0CUOO.js +0 -493
- package/dist/register.subclis-BuqgaeIf.js +0 -12
- package/dist/register.subclis-DwdgfdnT.js +0 -315
- package/dist/registry-xhgvU89y.js +0 -1107
- package/dist/replies-hB2aipLu.js +0 -110
- package/dist/resolve-3ErMOltL.js +0 -660
- package/dist/resolve-channels-BV8GXuPe.js +0 -226
- package/dist/resolve-channels-CTY_XRIP.js +0 -262
- package/dist/resolve-users-DQ4Ne4Zc.js +0 -143
- package/dist/routes-BNDsNO_e.js +0 -7097
- package/dist/rpc-BLGTBWXq.js +0 -67
- package/dist/run-main-COAE4GlI.js +0 -423
- package/dist/runtime-discord-ops.runtime-Dxg-nlgd.js +0 -9073
- package/dist/runtime-slack-ops.runtime-Di474LJr.js +0 -4551
- package/dist/runtime-telegram-ops.runtime-Da8vgf3O.js +0 -128
- package/dist/runtime-whatsapp-login.runtime-DcouP4iF.js +0 -109
- package/dist/runtime-whatsapp-outbound.runtime-CYamaEJX.js +0 -112
- package/dist/sandbox-cli-U5ZTxhxL.js +0 -530
- package/dist/search-manager-CfizyEMk.js +0 -386
- package/dist/search-manager-DaF2QP4s.js +0 -15
- package/dist/secrets-cli-C0gytFip.js +0 -2065
- package/dist/security-cli-C74EuLUO.js +0 -570
- package/dist/send-BTLVBf_E.js +0 -631
- package/dist/send-BlWWCEZE.js +0 -1025
- package/dist/send-CfypD1B_.js +0 -100
- package/dist/send-Cm9v3uhF.js +0 -283
- package/dist/send-g2odQuYI.js +0 -629
- package/dist/server-C8b5QJ2s.js +0 -106
- package/dist/server-node-events-xqQe5xiu.js +0 -501
- package/dist/sessions-CSSzvgPQ.js +0 -107
- package/dist/sessions-z0GIvdKa.js +0 -218
- package/dist/setup-D9XTmlF8.js +0 -387
- package/dist/setup-core-BDrLOwYO.js +0 -143
- package/dist/setup-core-CM7cY7_i.js +0 -166
- package/dist/setup-core-CnmgANY-.js +0 -205
- package/dist/setup-core-DgcjCKmG.js +0 -47
- package/dist/setup-surface-DzRrVKYj.js +0 -490
- package/dist/setup.finalize-UaPu_adv.js +0 -517
- package/dist/setup.gateway-config-Djc1ceEh.js +0 -338
- package/dist/setup.secret-input-BkczghbR.js +0 -25
- package/dist/shared-BHizGoNk.js +0 -298
- package/dist/shared-CUfYhQkP.js +0 -96
- package/dist/shared-DYYqr9EC.js +0 -75
- package/dist/shared-DthOxMRQ.js +0 -182
- package/dist/shared-On_A5_hW.js +0 -102
- package/dist/signal-D6px9PGZ.js +0 -109
- package/dist/skills-B4h1k-SP.js +0 -853
- package/dist/skills-Bto10BGB.js +0 -19
- package/dist/skills-cli-CXGR3Y5j.js +0 -291
- package/dist/skills-install-B1AlkK8C.js +0 -763
- package/dist/skills-status-BsmJ_iSg.js +0 -20
- package/dist/skills-status-DGdxY3OI.js +0 -169
- package/dist/slack-B7vWFmxP.js +0 -109
- package/dist/slash-commands.runtime-DXdAT84n.js +0 -123
- package/dist/slash-dispatch.runtime-CNf2-9Aj.js +0 -136
- package/dist/slash-skill-commands.runtime-CBjffHRX.js +0 -111
- package/dist/src-Cp7P7T08.js +0 -1696
- package/dist/status-158fWh4A.js +0 -43
- package/dist/status-BJIVLJnb.js +0 -1599
- package/dist/status-BQiBI6N9.js +0 -126
- package/dist/status-CZipXGUu.js +0 -121
- package/dist/status-ZZIVFLI-.js +0 -606
- package/dist/status-json-BNUy5Mem.js +0 -286
- package/dist/status.link-channel-B694y1Xu.js +0 -138
- package/dist/status.scan.deps.runtime-BcoKEzQD.js +0 -121
- package/dist/status.scan.runtime-CqScDt-p.js +0 -114
- package/dist/status.summary-AMek7qvI.js +0 -592
- package/dist/status.summary.runtime-XgkcQ_kr.js +0 -113
- package/dist/subagent-orphan-recovery-CrCYTmFC.js +0 -302
- package/dist/subagent-registry-runtime-Cg-YvLx3.js +0 -106
- package/dist/synology-chat-0G85jIqQ.js +0 -297
- package/dist/system-cli-kZtSxKNm.js +0 -92
- package/dist/telegram-DV0Wy89w.js +0 -109
- package/dist/text-chunking-C2J2Oeul.js +0 -84
- package/dist/tlon-DmK1NUVP.js +0 -433
- package/dist/tui-D3bNPLG7.js +0 -3834
- package/dist/tui-cli-DtMp9k_s.js +0 -132
- package/dist/types.secrets-DuSPmmWB.js +0 -80
- package/dist/ui-CeGztSEL.js +0 -31
- package/dist/update-De7VudzP.js +0 -1036
- package/dist/update-cli-BH8Pb-So.js +0 -1498
- package/dist/update-offset-store-syELkdEW.js +0 -107
- package/dist/update-runner-Cq-Q40T9.js +0 -1496
- package/dist/web-CjMtvfSq.js +0 -107
- package/dist/webhook-targets-_jTR0Bb_.js +0 -181
- package/dist/webhooks-cli-DQ6u2Qau.js +0 -349
- package/dist/whatsapp-CyLk16SZ.js +0 -109
- package/dist/whatsapp-actions-Dzr2Wzqw.js +0 -162
- package/dist/workspace-dirs-L1_QQ9mB.js +0 -2002
- package/dist/zalo-CrehfXvK.js +0 -415
- package/dist/zalouser-D1QD-O-I.js +0 -30911
- package/dist/zod-schema.core-CWxzqcUs.js +0 -541
|
@@ -0,0 +1,1038 @@
|
|
|
1
|
+
import { n as redactSensitiveText, t as getDefaultRedactPatterns } from "./redact-fatrROh9.js";
|
|
2
|
+
import { _ as resolveStateDir } from "./paths-D6AgsMTU.js";
|
|
3
|
+
import { r as isVerbose } from "./globals-DESrFYmC.js";
|
|
4
|
+
import { f as shouldLogSubsystemToConsole, t as createSubsystemLogger } from "./subsystem-S4LNMNHd.js";
|
|
5
|
+
import { al as sniffMimeFromBase64 } from "./auth-profiles-9zZdaXJK.js";
|
|
6
|
+
import { S as parseAgentSessionKey } from "./session-key-DyhRsRh-.js";
|
|
7
|
+
import { G as estimateBase64DecodedBytes } from "./provider-web-search-BJhXD5dH.js";
|
|
8
|
+
import { n as readJsonFile, r as writeJsonAtomic, t as createAsyncLock } from "./json-files-BhLX9wE7.js";
|
|
9
|
+
import { an as signDevicePayload, nn as loadOrCreateDeviceIdentity } from "./method-scopes-Du8ODGFW.js";
|
|
10
|
+
import { URL } from "node:url";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import chalk from "chalk";
|
|
13
|
+
import fs from "node:fs/promises";
|
|
14
|
+
import { createHash, createPrivateKey, sign } from "node:crypto";
|
|
15
|
+
import http2 from "node:http2";
|
|
16
|
+
//#region src/gateway/ws-logging.ts
|
|
17
|
+
let gatewayWsLogStyle = "auto";
|
|
18
|
+
function setGatewayWsLogStyle(style) {
|
|
19
|
+
gatewayWsLogStyle = style;
|
|
20
|
+
}
|
|
21
|
+
function getGatewayWsLogStyle() {
|
|
22
|
+
return gatewayWsLogStyle;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/gateway/ws-log.ts
|
|
26
|
+
const LOG_VALUE_LIMIT = 240;
|
|
27
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
28
|
+
const WS_LOG_REDACT_OPTIONS = {
|
|
29
|
+
mode: "tools",
|
|
30
|
+
patterns: getDefaultRedactPatterns()
|
|
31
|
+
};
|
|
32
|
+
const wsInflightCompact = /* @__PURE__ */ new Map();
|
|
33
|
+
let wsLastCompactConnId;
|
|
34
|
+
const wsInflightOptimized = /* @__PURE__ */ new Map();
|
|
35
|
+
const wsInflightSince = /* @__PURE__ */ new Map();
|
|
36
|
+
const wsLog = createSubsystemLogger("gateway/ws");
|
|
37
|
+
const WS_META_SKIP_KEYS = new Set([
|
|
38
|
+
"connId",
|
|
39
|
+
"id",
|
|
40
|
+
"method",
|
|
41
|
+
"ok",
|
|
42
|
+
"event"
|
|
43
|
+
]);
|
|
44
|
+
function collectWsRestMeta(meta) {
|
|
45
|
+
const restMeta = [];
|
|
46
|
+
if (!meta) return restMeta;
|
|
47
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
48
|
+
if (value === void 0) continue;
|
|
49
|
+
if (WS_META_SKIP_KEYS.has(key)) continue;
|
|
50
|
+
restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`);
|
|
51
|
+
}
|
|
52
|
+
return restMeta;
|
|
53
|
+
}
|
|
54
|
+
function buildWsHeadline(params) {
|
|
55
|
+
if ((params.kind === "req" || params.kind === "res") && params.method) return chalk.bold(params.method);
|
|
56
|
+
if (params.kind === "event" && params.event) return chalk.bold(params.event);
|
|
57
|
+
}
|
|
58
|
+
function buildWsStatusToken(kind, ok) {
|
|
59
|
+
if (kind !== "res" || ok === void 0) return;
|
|
60
|
+
return ok ? chalk.greenBright("✓") : chalk.redBright("✗");
|
|
61
|
+
}
|
|
62
|
+
function logWsInfoLine(params) {
|
|
63
|
+
const tokens = [
|
|
64
|
+
params.prefix,
|
|
65
|
+
params.statusToken,
|
|
66
|
+
params.headline,
|
|
67
|
+
params.durationToken,
|
|
68
|
+
...params.restMeta,
|
|
69
|
+
...params.trailing
|
|
70
|
+
].filter((t) => Boolean(t));
|
|
71
|
+
wsLog.info(tokens.join(" "));
|
|
72
|
+
}
|
|
73
|
+
function shouldLogWs() {
|
|
74
|
+
return shouldLogSubsystemToConsole("gateway/ws");
|
|
75
|
+
}
|
|
76
|
+
function shortId(value) {
|
|
77
|
+
const s = value.trim();
|
|
78
|
+
if (UUID_RE.test(s)) return `${s.slice(0, 8)}…${s.slice(-4)}`;
|
|
79
|
+
if (s.length <= 24) return s;
|
|
80
|
+
return `${s.slice(0, 12)}…${s.slice(-4)}`;
|
|
81
|
+
}
|
|
82
|
+
function formatForLog(value) {
|
|
83
|
+
try {
|
|
84
|
+
if (value instanceof Error) {
|
|
85
|
+
const parts = [];
|
|
86
|
+
if (value.name) parts.push(value.name);
|
|
87
|
+
if (value.message) parts.push(value.message);
|
|
88
|
+
const code = "code" in value && (typeof value.code === "string" || typeof value.code === "number") ? String(value.code) : "";
|
|
89
|
+
if (code) parts.push(`code=${code}`);
|
|
90
|
+
const combined = parts.filter(Boolean).join(": ").trim();
|
|
91
|
+
if (combined) return combined.length > LOG_VALUE_LIMIT ? `${combined.slice(0, LOG_VALUE_LIMIT)}...` : combined;
|
|
92
|
+
}
|
|
93
|
+
if (value && typeof value === "object") {
|
|
94
|
+
const rec = value;
|
|
95
|
+
if (typeof rec.message === "string" && rec.message.trim()) {
|
|
96
|
+
const name = typeof rec.name === "string" ? rec.name.trim() : "";
|
|
97
|
+
const code = typeof rec.code === "string" || typeof rec.code === "number" ? String(rec.code) : "";
|
|
98
|
+
const parts = [name, rec.message.trim()].filter(Boolean);
|
|
99
|
+
if (code) parts.push(`code=${code}`);
|
|
100
|
+
const combined = parts.join(": ").trim();
|
|
101
|
+
return combined.length > LOG_VALUE_LIMIT ? `${combined.slice(0, LOG_VALUE_LIMIT)}...` : combined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const str = typeof value === "string" || typeof value === "number" ? String(value) : JSON.stringify(value);
|
|
105
|
+
if (!str) return "";
|
|
106
|
+
const redacted = redactSensitiveText(str, WS_LOG_REDACT_OPTIONS);
|
|
107
|
+
return redacted.length > LOG_VALUE_LIMIT ? `${redacted.slice(0, LOG_VALUE_LIMIT)}...` : redacted;
|
|
108
|
+
} catch {
|
|
109
|
+
return String(value);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function compactPreview(input, maxLen = 160) {
|
|
113
|
+
const oneLine = input.replace(/\s+/g, " ").trim();
|
|
114
|
+
if (oneLine.length <= maxLen) return oneLine;
|
|
115
|
+
return `${oneLine.slice(0, Math.max(0, maxLen - 1))}…`;
|
|
116
|
+
}
|
|
117
|
+
function summarizeAgentEventForWsLog(payload) {
|
|
118
|
+
if (!payload || typeof payload !== "object") return {};
|
|
119
|
+
const rec = payload;
|
|
120
|
+
const runId = typeof rec.runId === "string" ? rec.runId : void 0;
|
|
121
|
+
const stream = typeof rec.stream === "string" ? rec.stream : void 0;
|
|
122
|
+
const seq = typeof rec.seq === "number" ? rec.seq : void 0;
|
|
123
|
+
const sessionKey = typeof rec.sessionKey === "string" ? rec.sessionKey : void 0;
|
|
124
|
+
const data = rec.data && typeof rec.data === "object" ? rec.data : void 0;
|
|
125
|
+
const extra = {};
|
|
126
|
+
if (runId) extra.run = shortId(runId);
|
|
127
|
+
if (sessionKey) {
|
|
128
|
+
const parsed = parseAgentSessionKey(sessionKey);
|
|
129
|
+
if (parsed) {
|
|
130
|
+
extra.agent = parsed.agentId;
|
|
131
|
+
extra.session = parsed.rest;
|
|
132
|
+
} else extra.session = sessionKey;
|
|
133
|
+
}
|
|
134
|
+
if (stream) extra.stream = stream;
|
|
135
|
+
if (seq !== void 0) extra.aseq = seq;
|
|
136
|
+
if (!data) return extra;
|
|
137
|
+
if (stream === "assistant") {
|
|
138
|
+
const text = typeof data.text === "string" ? data.text : void 0;
|
|
139
|
+
if (text?.trim()) extra.text = compactPreview(text);
|
|
140
|
+
const mediaUrls = Array.isArray(data.mediaUrls) ? data.mediaUrls : void 0;
|
|
141
|
+
if (mediaUrls && mediaUrls.length > 0) extra.media = mediaUrls.length;
|
|
142
|
+
return extra;
|
|
143
|
+
}
|
|
144
|
+
if (stream === "tool") {
|
|
145
|
+
const phase = typeof data.phase === "string" ? data.phase : void 0;
|
|
146
|
+
const name = typeof data.name === "string" ? data.name : void 0;
|
|
147
|
+
if (phase || name) extra.tool = `${phase ?? "?"}:${name ?? "?"}`;
|
|
148
|
+
const toolCallId = typeof data.toolCallId === "string" ? data.toolCallId : void 0;
|
|
149
|
+
if (toolCallId) extra.call = shortId(toolCallId);
|
|
150
|
+
const meta = typeof data.meta === "string" ? data.meta : void 0;
|
|
151
|
+
if (meta?.trim()) extra.meta = meta;
|
|
152
|
+
if (typeof data.isError === "boolean") extra.err = data.isError;
|
|
153
|
+
return extra;
|
|
154
|
+
}
|
|
155
|
+
if (stream === "lifecycle") {
|
|
156
|
+
const phase = typeof data.phase === "string" ? data.phase : void 0;
|
|
157
|
+
if (phase) extra.phase = phase;
|
|
158
|
+
if (typeof data.aborted === "boolean") extra.aborted = data.aborted;
|
|
159
|
+
const error = typeof data.error === "string" ? data.error : void 0;
|
|
160
|
+
if (error?.trim()) extra.error = compactPreview(error, 120);
|
|
161
|
+
return extra;
|
|
162
|
+
}
|
|
163
|
+
const reason = typeof data.reason === "string" ? data.reason : void 0;
|
|
164
|
+
if (reason?.trim()) extra.reason = reason;
|
|
165
|
+
return extra;
|
|
166
|
+
}
|
|
167
|
+
function logWs(direction, kind, meta) {
|
|
168
|
+
if (!shouldLogSubsystemToConsole("gateway/ws")) return;
|
|
169
|
+
const style = getGatewayWsLogStyle();
|
|
170
|
+
if (!isVerbose()) {
|
|
171
|
+
logWsOptimized(direction, kind, meta);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (style === "compact" || style === "auto") {
|
|
175
|
+
logWsCompact(direction, kind, meta);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const now = Date.now();
|
|
179
|
+
const connId = typeof meta?.connId === "string" ? meta.connId : void 0;
|
|
180
|
+
const id = typeof meta?.id === "string" ? meta.id : void 0;
|
|
181
|
+
const method = typeof meta?.method === "string" ? meta.method : void 0;
|
|
182
|
+
const ok = typeof meta?.ok === "boolean" ? meta.ok : void 0;
|
|
183
|
+
const event = typeof meta?.event === "string" ? meta.event : void 0;
|
|
184
|
+
const inflightKey = connId && id ? `${connId}:${id}` : void 0;
|
|
185
|
+
if (direction === "in" && kind === "req" && inflightKey) wsInflightSince.set(inflightKey, now);
|
|
186
|
+
const durationMs = direction === "out" && kind === "res" && inflightKey ? (() => {
|
|
187
|
+
const startedAt = wsInflightSince.get(inflightKey);
|
|
188
|
+
if (startedAt === void 0) return;
|
|
189
|
+
wsInflightSince.delete(inflightKey);
|
|
190
|
+
return now - startedAt;
|
|
191
|
+
})() : void 0;
|
|
192
|
+
const dirArrow = direction === "in" ? "←" : "→";
|
|
193
|
+
const prefix = `${(direction === "in" ? chalk.greenBright : chalk.cyanBright)(dirArrow)} ${chalk.bold(kind)}`;
|
|
194
|
+
const headline = buildWsHeadline({
|
|
195
|
+
kind,
|
|
196
|
+
method,
|
|
197
|
+
event
|
|
198
|
+
});
|
|
199
|
+
const statusToken = buildWsStatusToken(kind, ok);
|
|
200
|
+
const durationToken = typeof durationMs === "number" ? chalk.dim(`${durationMs}ms`) : void 0;
|
|
201
|
+
const restMeta = collectWsRestMeta(meta);
|
|
202
|
+
const trailing = [];
|
|
203
|
+
if (connId) trailing.push(`${chalk.dim("conn")}=${chalk.gray(shortId(connId))}`);
|
|
204
|
+
if (id) trailing.push(`${chalk.dim("id")}=${chalk.gray(shortId(id))}`);
|
|
205
|
+
logWsInfoLine({
|
|
206
|
+
prefix,
|
|
207
|
+
statusToken,
|
|
208
|
+
headline,
|
|
209
|
+
durationToken,
|
|
210
|
+
restMeta,
|
|
211
|
+
trailing
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function logWsOptimized(direction, kind, meta) {
|
|
215
|
+
const connId = typeof meta?.connId === "string" ? meta.connId : void 0;
|
|
216
|
+
const id = typeof meta?.id === "string" ? meta.id : void 0;
|
|
217
|
+
const ok = typeof meta?.ok === "boolean" ? meta.ok : void 0;
|
|
218
|
+
const method = typeof meta?.method === "string" ? meta.method : void 0;
|
|
219
|
+
const inflightKey = connId && id ? `${connId}:${id}` : void 0;
|
|
220
|
+
if (direction === "in" && kind === "req" && inflightKey) {
|
|
221
|
+
wsInflightOptimized.set(inflightKey, Date.now());
|
|
222
|
+
if (wsInflightOptimized.size > 2e3) wsInflightOptimized.clear();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (kind === "parse-error") {
|
|
226
|
+
const errorMsg = typeof meta?.error === "string" ? formatForLog(meta.error) : void 0;
|
|
227
|
+
wsLog.warn([
|
|
228
|
+
`${chalk.redBright("✗")} ${chalk.bold("parse-error")}`,
|
|
229
|
+
errorMsg ? `${chalk.dim("error")}=${errorMsg}` : void 0,
|
|
230
|
+
`${chalk.dim("conn")}=${chalk.gray(shortId(connId ?? "?"))}`
|
|
231
|
+
].filter((t) => Boolean(t)).join(" "));
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (direction !== "out" || kind !== "res") return;
|
|
235
|
+
const startedAt = inflightKey ? wsInflightOptimized.get(inflightKey) : void 0;
|
|
236
|
+
if (inflightKey) wsInflightOptimized.delete(inflightKey);
|
|
237
|
+
const durationMs = typeof startedAt === "number" ? Date.now() - startedAt : void 0;
|
|
238
|
+
if (!(ok === false || typeof durationMs === "number" && durationMs >= 50)) return;
|
|
239
|
+
const statusToken = buildWsStatusToken("res", ok);
|
|
240
|
+
const durationToken = typeof durationMs === "number" ? chalk.dim(`${durationMs}ms`) : void 0;
|
|
241
|
+
const restMeta = collectWsRestMeta(meta);
|
|
242
|
+
logWsInfoLine({
|
|
243
|
+
prefix: `${chalk.yellowBright("⇄")} ${chalk.bold("res")}`,
|
|
244
|
+
statusToken,
|
|
245
|
+
headline: method ? chalk.bold(method) : void 0,
|
|
246
|
+
durationToken,
|
|
247
|
+
restMeta,
|
|
248
|
+
trailing: [connId ? `${chalk.dim("conn")}=${chalk.gray(shortId(connId))}` : "", id ? `${chalk.dim("id")}=${chalk.gray(shortId(id))}` : ""].filter(Boolean)
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function logWsCompact(direction, kind, meta) {
|
|
252
|
+
const now = Date.now();
|
|
253
|
+
const connId = typeof meta?.connId === "string" ? meta.connId : void 0;
|
|
254
|
+
const id = typeof meta?.id === "string" ? meta.id : void 0;
|
|
255
|
+
const method = typeof meta?.method === "string" ? meta.method : void 0;
|
|
256
|
+
const ok = typeof meta?.ok === "boolean" ? meta.ok : void 0;
|
|
257
|
+
const inflightKey = connId && id ? `${connId}:${id}` : void 0;
|
|
258
|
+
if (kind === "req" && direction === "in" && inflightKey) {
|
|
259
|
+
wsInflightCompact.set(inflightKey, {
|
|
260
|
+
ts: now,
|
|
261
|
+
method,
|
|
262
|
+
meta
|
|
263
|
+
});
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const compactArrow = (() => {
|
|
267
|
+
if (kind === "req" || kind === "res") return "⇄";
|
|
268
|
+
return direction === "in" ? "←" : "→";
|
|
269
|
+
})();
|
|
270
|
+
const prefix = `${(kind === "req" || kind === "res" ? chalk.yellowBright : direction === "in" ? chalk.greenBright : chalk.cyanBright)(compactArrow)} ${chalk.bold(kind)}`;
|
|
271
|
+
const statusToken = buildWsStatusToken(kind, ok);
|
|
272
|
+
const startedAt = kind === "res" && direction === "out" && inflightKey ? wsInflightCompact.get(inflightKey)?.ts : void 0;
|
|
273
|
+
if (kind === "res" && direction === "out" && inflightKey) wsInflightCompact.delete(inflightKey);
|
|
274
|
+
const durationToken = typeof startedAt === "number" ? chalk.dim(`${now - startedAt}ms`) : void 0;
|
|
275
|
+
const headline = buildWsHeadline({
|
|
276
|
+
kind,
|
|
277
|
+
method,
|
|
278
|
+
event: typeof meta?.event === "string" ? meta.event : void 0
|
|
279
|
+
});
|
|
280
|
+
const restMeta = collectWsRestMeta(meta);
|
|
281
|
+
const trailing = [];
|
|
282
|
+
if (connId && connId !== wsLastCompactConnId) {
|
|
283
|
+
trailing.push(`${chalk.dim("conn")}=${chalk.gray(shortId(connId))}`);
|
|
284
|
+
wsLastCompactConnId = connId;
|
|
285
|
+
}
|
|
286
|
+
if (id) trailing.push(`${chalk.dim("id")}=${chalk.gray(shortId(id))}`);
|
|
287
|
+
logWsInfoLine({
|
|
288
|
+
prefix,
|
|
289
|
+
statusToken,
|
|
290
|
+
headline,
|
|
291
|
+
durationToken,
|
|
292
|
+
restMeta,
|
|
293
|
+
trailing
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/gateway/chat-attachments.ts
|
|
298
|
+
function normalizeMime(mime) {
|
|
299
|
+
if (!mime) return;
|
|
300
|
+
return mime.split(";")[0]?.trim().toLowerCase() || void 0;
|
|
301
|
+
}
|
|
302
|
+
function isImageMime(mime) {
|
|
303
|
+
return typeof mime === "string" && mime.startsWith("image/");
|
|
304
|
+
}
|
|
305
|
+
function isValidBase64(value) {
|
|
306
|
+
return value.length > 0 && value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
|
|
307
|
+
}
|
|
308
|
+
function normalizeAttachment(att, idx, opts) {
|
|
309
|
+
const mime = att.mimeType ?? "";
|
|
310
|
+
const content = att.content;
|
|
311
|
+
const label = att.fileName || att.type || `attachment-${idx + 1}`;
|
|
312
|
+
if (typeof content !== "string") throw new Error(`attachment ${label}: content must be base64 string`);
|
|
313
|
+
if (opts.requireImageMime && !mime.startsWith("image/")) throw new Error(`attachment ${label}: only image/* supported`);
|
|
314
|
+
let base64 = content.trim();
|
|
315
|
+
if (opts.stripDataUrlPrefix) {
|
|
316
|
+
const dataUrlMatch = /^data:[^;]+;base64,(.*)$/.exec(base64);
|
|
317
|
+
if (dataUrlMatch) base64 = dataUrlMatch[1];
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
label,
|
|
321
|
+
mime,
|
|
322
|
+
base64
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function validateAttachmentBase64OrThrow(normalized, opts) {
|
|
326
|
+
if (!isValidBase64(normalized.base64)) throw new Error(`attachment ${normalized.label}: invalid base64 content`);
|
|
327
|
+
const sizeBytes = estimateBase64DecodedBytes(normalized.base64);
|
|
328
|
+
if (sizeBytes <= 0 || sizeBytes > opts.maxBytes) throw new Error(`attachment ${normalized.label}: exceeds size limit (${sizeBytes} > ${opts.maxBytes} bytes)`);
|
|
329
|
+
return sizeBytes;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Parse attachments and extract images as structured content blocks.
|
|
333
|
+
* Returns the message text and an array of image content blocks
|
|
334
|
+
* compatible with Claude API's image format.
|
|
335
|
+
*/
|
|
336
|
+
async function parseMessageWithAttachments(message, attachments, opts) {
|
|
337
|
+
const maxBytes = opts?.maxBytes ?? 5e6;
|
|
338
|
+
const log = opts?.log;
|
|
339
|
+
if (!attachments || attachments.length === 0) return {
|
|
340
|
+
message,
|
|
341
|
+
images: []
|
|
342
|
+
};
|
|
343
|
+
const images = [];
|
|
344
|
+
for (const [idx, att] of attachments.entries()) {
|
|
345
|
+
if (!att) continue;
|
|
346
|
+
const normalized = normalizeAttachment(att, idx, {
|
|
347
|
+
stripDataUrlPrefix: true,
|
|
348
|
+
requireImageMime: false
|
|
349
|
+
});
|
|
350
|
+
validateAttachmentBase64OrThrow(normalized, { maxBytes });
|
|
351
|
+
const { base64: b64, label, mime } = normalized;
|
|
352
|
+
const providedMime = normalizeMime(mime);
|
|
353
|
+
const sniffedMime = normalizeMime(await sniffMimeFromBase64(b64));
|
|
354
|
+
if (sniffedMime && !isImageMime(sniffedMime)) {
|
|
355
|
+
log?.warn(`attachment ${label}: detected non-image (${sniffedMime}), dropping`);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (!sniffedMime && !isImageMime(providedMime)) {
|
|
359
|
+
log?.warn(`attachment ${label}: unable to detect image mime type, dropping`);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (sniffedMime && providedMime && sniffedMime !== providedMime) log?.warn(`attachment ${label}: mime mismatch (${providedMime} -> ${sniffedMime}), using sniffed`);
|
|
363
|
+
images.push({
|
|
364
|
+
type: "image",
|
|
365
|
+
data: b64,
|
|
366
|
+
mimeType: sniffedMime ?? providedMime ?? mime
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
message,
|
|
371
|
+
images
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/gateway/server-methods/attachment-normalize.ts
|
|
376
|
+
function normalizeRpcAttachmentsToChatAttachments(attachments) {
|
|
377
|
+
return attachments?.map((a) => ({
|
|
378
|
+
type: typeof a?.type === "string" ? a.type : void 0,
|
|
379
|
+
mimeType: typeof a?.mimeType === "string" ? a.mimeType : void 0,
|
|
380
|
+
fileName: typeof a?.fileName === "string" ? a.fileName : void 0,
|
|
381
|
+
content: typeof a?.content === "string" ? a.content : ArrayBuffer.isView(a?.content) ? Buffer.from(a.content.buffer, a.content.byteOffset, a.content.byteLength).toString("base64") : a?.content instanceof ArrayBuffer ? Buffer.from(a.content).toString("base64") : void 0
|
|
382
|
+
})).filter((a) => a.content) ?? [];
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/infra/push-apns.relay.ts
|
|
386
|
+
const DEFAULT_APNS_RELAY_TIMEOUT_MS = 1e4;
|
|
387
|
+
const GATEWAY_DEVICE_ID_HEADER = "x-moldclaw-gateway-device-id";
|
|
388
|
+
const GATEWAY_SIGNATURE_HEADER = "x-moldclaw-gateway-signature";
|
|
389
|
+
const GATEWAY_SIGNED_AT_HEADER = "x-moldclaw-gateway-signed-at-ms";
|
|
390
|
+
function normalizeNonEmptyString$1(value) {
|
|
391
|
+
const trimmed = value?.trim() ?? "";
|
|
392
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
393
|
+
}
|
|
394
|
+
function normalizeTimeoutMs(value) {
|
|
395
|
+
const raw = typeof value === "number" ? value : typeof value === "string" ? value.trim() : void 0;
|
|
396
|
+
if (raw === void 0 || raw === "") return DEFAULT_APNS_RELAY_TIMEOUT_MS;
|
|
397
|
+
const parsed = Number(raw);
|
|
398
|
+
if (!Number.isFinite(parsed)) return DEFAULT_APNS_RELAY_TIMEOUT_MS;
|
|
399
|
+
return Math.max(1e3, Math.trunc(parsed));
|
|
400
|
+
}
|
|
401
|
+
function readAllowHttp(value) {
|
|
402
|
+
const normalized = value?.trim().toLowerCase();
|
|
403
|
+
return normalized === "1" || normalized === "true" || normalized === "yes";
|
|
404
|
+
}
|
|
405
|
+
function isLoopbackRelayHostname(hostname) {
|
|
406
|
+
const normalized = hostname.trim().toLowerCase();
|
|
407
|
+
return normalized === "localhost" || normalized === "::1" || normalized === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(normalized);
|
|
408
|
+
}
|
|
409
|
+
function parseReason$1(value) {
|
|
410
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
411
|
+
}
|
|
412
|
+
function buildRelayGatewaySignaturePayload(params) {
|
|
413
|
+
return [
|
|
414
|
+
"moldclaw-relay-send-v1",
|
|
415
|
+
params.gatewayDeviceId.trim(),
|
|
416
|
+
String(Math.trunc(params.signedAtMs)),
|
|
417
|
+
params.bodyJson
|
|
418
|
+
].join("\n");
|
|
419
|
+
}
|
|
420
|
+
function resolveApnsRelayConfigFromEnv(env = process.env, gatewayConfig) {
|
|
421
|
+
const configuredRelay = gatewayConfig?.push?.apns?.relay;
|
|
422
|
+
const envBaseUrl = normalizeNonEmptyString$1(env.MOLDCLAW_APNS_RELAY_BASE_URL);
|
|
423
|
+
const configBaseUrl = normalizeNonEmptyString$1(configuredRelay?.baseUrl);
|
|
424
|
+
const baseUrl = envBaseUrl ?? configBaseUrl;
|
|
425
|
+
const baseUrlSource = envBaseUrl ? "MOLDCLAW_APNS_RELAY_BASE_URL" : "gateway.push.apns.relay.baseUrl";
|
|
426
|
+
if (!baseUrl) return {
|
|
427
|
+
ok: false,
|
|
428
|
+
error: "APNs relay config missing: set gateway.push.apns.relay.baseUrl or MOLDCLAW_APNS_RELAY_BASE_URL"
|
|
429
|
+
};
|
|
430
|
+
try {
|
|
431
|
+
const parsed = new URL(baseUrl);
|
|
432
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error("unsupported protocol");
|
|
433
|
+
if (!parsed.hostname) throw new Error("host required");
|
|
434
|
+
if (parsed.protocol === "http:" && !readAllowHttp(env.MOLDCLAW_APNS_RELAY_ALLOW_HTTP)) throw new Error("http relay URLs require MOLDCLAW_APNS_RELAY_ALLOW_HTTP=true (development only)");
|
|
435
|
+
if (parsed.protocol === "http:" && !isLoopbackRelayHostname(parsed.hostname)) throw new Error("http relay URLs are limited to loopback hosts");
|
|
436
|
+
if (parsed.username || parsed.password) throw new Error("userinfo is not allowed");
|
|
437
|
+
if (parsed.search || parsed.hash) throw new Error("query and fragment are not allowed");
|
|
438
|
+
return {
|
|
439
|
+
ok: true,
|
|
440
|
+
value: {
|
|
441
|
+
baseUrl: parsed.toString().replace(/\/+$/, ""),
|
|
442
|
+
timeoutMs: normalizeTimeoutMs(env.MOLDCLAW_APNS_RELAY_TIMEOUT_MS ?? configuredRelay?.timeoutMs)
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
} catch (err) {
|
|
446
|
+
return {
|
|
447
|
+
ok: false,
|
|
448
|
+
error: `invalid ${baseUrlSource} (${baseUrl}): ${err instanceof Error ? err.message : String(err)}`
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
async function sendApnsRelayRequest(params) {
|
|
453
|
+
const response = await fetch(`${params.relayConfig.baseUrl}/v1/push/send`, {
|
|
454
|
+
method: "POST",
|
|
455
|
+
redirect: "manual",
|
|
456
|
+
headers: {
|
|
457
|
+
authorization: `Bearer ${params.sendGrant}`,
|
|
458
|
+
"content-type": "application/json",
|
|
459
|
+
[GATEWAY_DEVICE_ID_HEADER]: params.gatewayDeviceId,
|
|
460
|
+
[GATEWAY_SIGNATURE_HEADER]: params.signature,
|
|
461
|
+
[GATEWAY_SIGNED_AT_HEADER]: String(params.signedAtMs)
|
|
462
|
+
},
|
|
463
|
+
body: params.bodyJson,
|
|
464
|
+
signal: AbortSignal.timeout(params.relayConfig.timeoutMs)
|
|
465
|
+
});
|
|
466
|
+
if (response.status >= 300 && response.status < 400) return {
|
|
467
|
+
ok: false,
|
|
468
|
+
status: response.status,
|
|
469
|
+
reason: "RelayRedirectNotAllowed",
|
|
470
|
+
environment: "production"
|
|
471
|
+
};
|
|
472
|
+
let json = null;
|
|
473
|
+
try {
|
|
474
|
+
json = await response.json();
|
|
475
|
+
} catch {
|
|
476
|
+
json = null;
|
|
477
|
+
}
|
|
478
|
+
const body = json && typeof json === "object" && !Array.isArray(json) ? json : {};
|
|
479
|
+
const status = typeof body.status === "number" && Number.isFinite(body.status) ? Math.trunc(body.status) : response.status;
|
|
480
|
+
return {
|
|
481
|
+
ok: typeof body.ok === "boolean" ? body.ok : response.ok && status >= 200 && status < 300,
|
|
482
|
+
status,
|
|
483
|
+
apnsId: parseReason$1(body.apnsId),
|
|
484
|
+
reason: parseReason$1(body.reason),
|
|
485
|
+
environment: "production",
|
|
486
|
+
tokenSuffix: parseReason$1(body.tokenSuffix)
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
async function sendApnsRelayPush(params) {
|
|
490
|
+
const sender = params.requestSender ?? sendApnsRelayRequest;
|
|
491
|
+
const gatewayIdentity = params.gatewayIdentity ?? loadOrCreateDeviceIdentity();
|
|
492
|
+
const signedAtMs = Date.now();
|
|
493
|
+
const bodyJson = JSON.stringify({
|
|
494
|
+
relayHandle: params.relayHandle,
|
|
495
|
+
pushType: params.pushType,
|
|
496
|
+
priority: Number(params.priority),
|
|
497
|
+
payload: params.payload
|
|
498
|
+
});
|
|
499
|
+
const signature = signDevicePayload(gatewayIdentity.privateKeyPem, buildRelayGatewaySignaturePayload({
|
|
500
|
+
gatewayDeviceId: gatewayIdentity.deviceId,
|
|
501
|
+
signedAtMs,
|
|
502
|
+
bodyJson
|
|
503
|
+
}));
|
|
504
|
+
return await sender({
|
|
505
|
+
relayConfig: params.relayConfig,
|
|
506
|
+
sendGrant: params.sendGrant,
|
|
507
|
+
relayHandle: params.relayHandle,
|
|
508
|
+
gatewayDeviceId: gatewayIdentity.deviceId,
|
|
509
|
+
signature,
|
|
510
|
+
signedAtMs,
|
|
511
|
+
bodyJson,
|
|
512
|
+
pushType: params.pushType,
|
|
513
|
+
priority: params.priority,
|
|
514
|
+
payload: params.payload
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/infra/push-apns.ts
|
|
519
|
+
const APNS_STATE_FILENAME = "push/apns-registrations.json";
|
|
520
|
+
const APNS_JWT_TTL_MS = 3e3 * 1e3;
|
|
521
|
+
const DEFAULT_APNS_TIMEOUT_MS = 1e4;
|
|
522
|
+
const MAX_NODE_ID_LENGTH = 256;
|
|
523
|
+
const MAX_TOPIC_LENGTH = 255;
|
|
524
|
+
const MAX_APNS_TOKEN_HEX_LENGTH = 512;
|
|
525
|
+
const MAX_RELAY_IDENTIFIER_LENGTH = 256;
|
|
526
|
+
const MAX_SEND_GRANT_LENGTH = 1024;
|
|
527
|
+
const withLock = createAsyncLock();
|
|
528
|
+
let cachedJwt = null;
|
|
529
|
+
function resolveApnsRegistrationPath(baseDir) {
|
|
530
|
+
const root = baseDir ?? resolveStateDir();
|
|
531
|
+
return path.join(root, APNS_STATE_FILENAME);
|
|
532
|
+
}
|
|
533
|
+
function normalizeNodeId(value) {
|
|
534
|
+
return value.trim();
|
|
535
|
+
}
|
|
536
|
+
function isValidNodeId(value) {
|
|
537
|
+
return value.length > 0 && value.length <= MAX_NODE_ID_LENGTH;
|
|
538
|
+
}
|
|
539
|
+
function normalizeApnsToken(value) {
|
|
540
|
+
return value.trim().replace(/[<>\s]/g, "").toLowerCase();
|
|
541
|
+
}
|
|
542
|
+
function normalizeRelayHandle(value) {
|
|
543
|
+
return value.trim();
|
|
544
|
+
}
|
|
545
|
+
function normalizeInstallationId(value) {
|
|
546
|
+
return value.trim();
|
|
547
|
+
}
|
|
548
|
+
function validateRelayIdentifier(value, fieldName, maxLength = MAX_RELAY_IDENTIFIER_LENGTH) {
|
|
549
|
+
if (!value) throw new Error(`${fieldName} required`);
|
|
550
|
+
if (value.length > maxLength) throw new Error(`${fieldName} too long`);
|
|
551
|
+
if (/[^\x21-\x7e]/.test(value)) throw new Error(`${fieldName} invalid`);
|
|
552
|
+
return value;
|
|
553
|
+
}
|
|
554
|
+
function normalizeTopic(value) {
|
|
555
|
+
return value.trim();
|
|
556
|
+
}
|
|
557
|
+
function isValidTopic(value) {
|
|
558
|
+
return value.length > 0 && value.length <= MAX_TOPIC_LENGTH;
|
|
559
|
+
}
|
|
560
|
+
function normalizeTokenDebugSuffix(value) {
|
|
561
|
+
if (typeof value !== "string") return;
|
|
562
|
+
const normalized = value.trim().toLowerCase().replace(/[^0-9a-z]/g, "");
|
|
563
|
+
return normalized.length > 0 ? normalized.slice(-8) : void 0;
|
|
564
|
+
}
|
|
565
|
+
function isLikelyApnsToken(value) {
|
|
566
|
+
return value.length <= MAX_APNS_TOKEN_HEX_LENGTH && /^[0-9a-f]{32,}$/i.test(value);
|
|
567
|
+
}
|
|
568
|
+
function parseReason(body) {
|
|
569
|
+
const trimmed = body.trim();
|
|
570
|
+
if (!trimmed) return;
|
|
571
|
+
try {
|
|
572
|
+
const parsed = JSON.parse(trimmed);
|
|
573
|
+
return typeof parsed.reason === "string" && parsed.reason.trim().length > 0 ? parsed.reason.trim() : trimmed.slice(0, 200);
|
|
574
|
+
} catch {
|
|
575
|
+
return trimmed.slice(0, 200);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function toBase64UrlBytes(value) {
|
|
579
|
+
return Buffer.from(value).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
580
|
+
}
|
|
581
|
+
function toBase64UrlJson(value) {
|
|
582
|
+
return toBase64UrlBytes(Buffer.from(JSON.stringify(value)));
|
|
583
|
+
}
|
|
584
|
+
function getJwtCacheKey(auth) {
|
|
585
|
+
const keyHash = createHash("sha256").update(auth.privateKey).digest("hex");
|
|
586
|
+
return `${auth.teamId}:${auth.keyId}:${keyHash}`;
|
|
587
|
+
}
|
|
588
|
+
function getApnsBearerToken(auth, nowMs = Date.now()) {
|
|
589
|
+
const cacheKey = getJwtCacheKey(auth);
|
|
590
|
+
if (cachedJwt && cachedJwt.cacheKey === cacheKey && nowMs < cachedJwt.expiresAtMs) return cachedJwt.token;
|
|
591
|
+
const iat = Math.floor(nowMs / 1e3);
|
|
592
|
+
const signingInput = `${toBase64UrlJson({
|
|
593
|
+
alg: "ES256",
|
|
594
|
+
kid: auth.keyId,
|
|
595
|
+
typ: "JWT"
|
|
596
|
+
})}.${toBase64UrlJson({
|
|
597
|
+
iss: auth.teamId,
|
|
598
|
+
iat
|
|
599
|
+
})}`;
|
|
600
|
+
const token = `${signingInput}.${toBase64UrlBytes(sign("sha256", Buffer.from(signingInput, "utf8"), {
|
|
601
|
+
key: createPrivateKey(auth.privateKey),
|
|
602
|
+
dsaEncoding: "ieee-p1363"
|
|
603
|
+
}))}`;
|
|
604
|
+
cachedJwt = {
|
|
605
|
+
cacheKey,
|
|
606
|
+
token,
|
|
607
|
+
expiresAtMs: nowMs + APNS_JWT_TTL_MS
|
|
608
|
+
};
|
|
609
|
+
return token;
|
|
610
|
+
}
|
|
611
|
+
function normalizePrivateKey(value) {
|
|
612
|
+
return value.trim().replace(/\\n/g, "\n");
|
|
613
|
+
}
|
|
614
|
+
function normalizeNonEmptyString(value) {
|
|
615
|
+
const trimmed = value?.trim() ?? "";
|
|
616
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
617
|
+
}
|
|
618
|
+
function normalizeDistribution(value) {
|
|
619
|
+
if (typeof value !== "string") return null;
|
|
620
|
+
return value.trim().toLowerCase() === "official" ? "official" : null;
|
|
621
|
+
}
|
|
622
|
+
function normalizeDirectRegistration(record) {
|
|
623
|
+
if (typeof record.nodeId !== "string" || typeof record.token !== "string") return null;
|
|
624
|
+
const nodeId = normalizeNodeId(record.nodeId);
|
|
625
|
+
const token = normalizeApnsToken(record.token);
|
|
626
|
+
const topic = normalizeTopic(typeof record.topic === "string" ? record.topic : "");
|
|
627
|
+
const environment = normalizeApnsEnvironment(record.environment) ?? "sandbox";
|
|
628
|
+
const updatedAtMs = typeof record.updatedAtMs === "number" && Number.isFinite(record.updatedAtMs) ? Math.trunc(record.updatedAtMs) : 0;
|
|
629
|
+
if (!isValidNodeId(nodeId) || !isValidTopic(topic) || !isLikelyApnsToken(token)) return null;
|
|
630
|
+
return {
|
|
631
|
+
nodeId,
|
|
632
|
+
transport: "direct",
|
|
633
|
+
token,
|
|
634
|
+
topic,
|
|
635
|
+
environment,
|
|
636
|
+
updatedAtMs
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function normalizeRelayRegistration(record) {
|
|
640
|
+
if (typeof record.nodeId !== "string" || typeof record.relayHandle !== "string" || typeof record.sendGrant !== "string" || typeof record.installationId !== "string") return null;
|
|
641
|
+
const nodeId = normalizeNodeId(record.nodeId);
|
|
642
|
+
const relayHandle = normalizeRelayHandle(record.relayHandle);
|
|
643
|
+
const sendGrant = record.sendGrant.trim();
|
|
644
|
+
const installationId = normalizeInstallationId(record.installationId);
|
|
645
|
+
const topic = normalizeTopic(typeof record.topic === "string" ? record.topic : "");
|
|
646
|
+
const environment = normalizeApnsEnvironment(record.environment);
|
|
647
|
+
const distribution = normalizeDistribution(record.distribution);
|
|
648
|
+
const updatedAtMs = typeof record.updatedAtMs === "number" && Number.isFinite(record.updatedAtMs) ? Math.trunc(record.updatedAtMs) : 0;
|
|
649
|
+
if (!isValidNodeId(nodeId) || !relayHandle || !sendGrant || !installationId || !isValidTopic(topic) || environment !== "production" || distribution !== "official") return null;
|
|
650
|
+
return {
|
|
651
|
+
nodeId,
|
|
652
|
+
transport: "relay",
|
|
653
|
+
relayHandle,
|
|
654
|
+
sendGrant,
|
|
655
|
+
installationId,
|
|
656
|
+
topic,
|
|
657
|
+
environment,
|
|
658
|
+
distribution,
|
|
659
|
+
updatedAtMs,
|
|
660
|
+
tokenDebugSuffix: normalizeTokenDebugSuffix(record.tokenDebugSuffix)
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
function normalizeStoredRegistration(record) {
|
|
664
|
+
if (!record || typeof record !== "object" || Array.isArray(record)) return null;
|
|
665
|
+
const candidate = record;
|
|
666
|
+
if ((typeof candidate.transport === "string" ? candidate.transport.trim().toLowerCase() : "direct") === "relay") return normalizeRelayRegistration(candidate);
|
|
667
|
+
return normalizeDirectRegistration(candidate);
|
|
668
|
+
}
|
|
669
|
+
async function loadRegistrationsState(baseDir) {
|
|
670
|
+
const existing = await readJsonFile(resolveApnsRegistrationPath(baseDir));
|
|
671
|
+
if (!existing || typeof existing !== "object") return { registrationsByNodeId: {} };
|
|
672
|
+
const registrations = existing.registrationsByNodeId && typeof existing.registrationsByNodeId === "object" && !Array.isArray(existing.registrationsByNodeId) ? existing.registrationsByNodeId : {};
|
|
673
|
+
const normalized = {};
|
|
674
|
+
for (const [nodeId, record] of Object.entries(registrations)) {
|
|
675
|
+
const registration = normalizeStoredRegistration(record);
|
|
676
|
+
if (registration) {
|
|
677
|
+
const normalizedNodeId = normalizeNodeId(nodeId);
|
|
678
|
+
normalized[isValidNodeId(normalizedNodeId) ? normalizedNodeId : registration.nodeId] = registration;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return { registrationsByNodeId: normalized };
|
|
682
|
+
}
|
|
683
|
+
async function persistRegistrationsState(state, baseDir) {
|
|
684
|
+
await writeJsonAtomic(resolveApnsRegistrationPath(baseDir), state, {
|
|
685
|
+
mode: 384,
|
|
686
|
+
ensureDirMode: 448,
|
|
687
|
+
trailingNewline: true
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function normalizeApnsEnvironment(value) {
|
|
691
|
+
if (typeof value !== "string") return null;
|
|
692
|
+
const normalized = value.trim().toLowerCase();
|
|
693
|
+
if (normalized === "sandbox" || normalized === "production") return normalized;
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
async function registerApnsRegistration(params) {
|
|
697
|
+
const nodeId = normalizeNodeId(params.nodeId);
|
|
698
|
+
const topic = normalizeTopic(params.topic);
|
|
699
|
+
if (!isValidNodeId(nodeId)) throw new Error("nodeId required");
|
|
700
|
+
if (!isValidTopic(topic)) throw new Error("topic required");
|
|
701
|
+
return await withLock(async () => {
|
|
702
|
+
const state = await loadRegistrationsState(params.baseDir);
|
|
703
|
+
const updatedAtMs = Date.now();
|
|
704
|
+
let next;
|
|
705
|
+
if (params.transport === "relay") {
|
|
706
|
+
const relayHandle = validateRelayIdentifier(normalizeRelayHandle(params.relayHandle), "relayHandle");
|
|
707
|
+
const sendGrant = validateRelayIdentifier(params.sendGrant.trim(), "sendGrant", MAX_SEND_GRANT_LENGTH);
|
|
708
|
+
const installationId = validateRelayIdentifier(normalizeInstallationId(params.installationId), "installationId");
|
|
709
|
+
const environment = normalizeApnsEnvironment(params.environment);
|
|
710
|
+
const distribution = normalizeDistribution(params.distribution);
|
|
711
|
+
if (environment !== "production") throw new Error("relay registrations must use production environment");
|
|
712
|
+
if (distribution !== "official") throw new Error("relay registrations must use official distribution");
|
|
713
|
+
next = {
|
|
714
|
+
nodeId,
|
|
715
|
+
transport: "relay",
|
|
716
|
+
relayHandle,
|
|
717
|
+
sendGrant,
|
|
718
|
+
installationId,
|
|
719
|
+
topic,
|
|
720
|
+
environment,
|
|
721
|
+
distribution,
|
|
722
|
+
updatedAtMs,
|
|
723
|
+
tokenDebugSuffix: normalizeTokenDebugSuffix(params.tokenDebugSuffix)
|
|
724
|
+
};
|
|
725
|
+
} else {
|
|
726
|
+
const token = normalizeApnsToken(params.token);
|
|
727
|
+
const environment = normalizeApnsEnvironment(params.environment) ?? "sandbox";
|
|
728
|
+
if (!isLikelyApnsToken(token)) throw new Error("invalid APNs token");
|
|
729
|
+
next = {
|
|
730
|
+
nodeId,
|
|
731
|
+
transport: "direct",
|
|
732
|
+
token,
|
|
733
|
+
topic,
|
|
734
|
+
environment,
|
|
735
|
+
updatedAtMs
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
state.registrationsByNodeId[nodeId] = next;
|
|
739
|
+
await persistRegistrationsState(state, params.baseDir);
|
|
740
|
+
return next;
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
async function loadApnsRegistration(nodeId, baseDir) {
|
|
744
|
+
const normalizedNodeId = normalizeNodeId(nodeId);
|
|
745
|
+
if (!normalizedNodeId) return null;
|
|
746
|
+
return (await loadRegistrationsState(baseDir)).registrationsByNodeId[normalizedNodeId] ?? null;
|
|
747
|
+
}
|
|
748
|
+
function isSameApnsRegistration(a, b) {
|
|
749
|
+
if (a.nodeId !== b.nodeId || a.transport !== b.transport || a.topic !== b.topic || a.environment !== b.environment || a.updatedAtMs !== b.updatedAtMs) return false;
|
|
750
|
+
if (a.transport === "direct" && b.transport === "direct") return a.token === b.token;
|
|
751
|
+
if (a.transport === "relay" && b.transport === "relay") return a.relayHandle === b.relayHandle && a.sendGrant === b.sendGrant && a.installationId === b.installationId && a.distribution === b.distribution && a.tokenDebugSuffix === b.tokenDebugSuffix;
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
async function clearApnsRegistrationIfCurrent(params) {
|
|
755
|
+
const normalizedNodeId = normalizeNodeId(params.nodeId);
|
|
756
|
+
if (!normalizedNodeId) return false;
|
|
757
|
+
return await withLock(async () => {
|
|
758
|
+
const state = await loadRegistrationsState(params.baseDir);
|
|
759
|
+
const current = state.registrationsByNodeId[normalizedNodeId];
|
|
760
|
+
if (!current || !isSameApnsRegistration(current, params.registration)) return false;
|
|
761
|
+
delete state.registrationsByNodeId[normalizedNodeId];
|
|
762
|
+
await persistRegistrationsState(state, params.baseDir);
|
|
763
|
+
return true;
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function shouldInvalidateApnsRegistration(result) {
|
|
767
|
+
if (result.status === 410) return true;
|
|
768
|
+
return result.status === 400 && result.reason?.trim() === "BadDeviceToken";
|
|
769
|
+
}
|
|
770
|
+
function shouldClearStoredApnsRegistration(params) {
|
|
771
|
+
if (params.registration.transport !== "direct") return false;
|
|
772
|
+
if (params.overrideEnvironment && params.overrideEnvironment !== params.registration.environment) return false;
|
|
773
|
+
return shouldInvalidateApnsRegistration(params.result);
|
|
774
|
+
}
|
|
775
|
+
async function resolveApnsAuthConfigFromEnv(env = process.env) {
|
|
776
|
+
const teamId = normalizeNonEmptyString(env.MOLDCLAW_APNS_TEAM_ID);
|
|
777
|
+
const keyId = normalizeNonEmptyString(env.MOLDCLAW_APNS_KEY_ID);
|
|
778
|
+
if (!teamId || !keyId) return {
|
|
779
|
+
ok: false,
|
|
780
|
+
error: "APNs auth missing: set MOLDCLAW_APNS_TEAM_ID and MOLDCLAW_APNS_KEY_ID"
|
|
781
|
+
};
|
|
782
|
+
const inlineKeyRaw = normalizeNonEmptyString(env.MOLDCLAW_APNS_PRIVATE_KEY_P8) ?? normalizeNonEmptyString(env.MOLDCLAW_APNS_PRIVATE_KEY);
|
|
783
|
+
if (inlineKeyRaw) return {
|
|
784
|
+
ok: true,
|
|
785
|
+
value: {
|
|
786
|
+
teamId,
|
|
787
|
+
keyId,
|
|
788
|
+
privateKey: normalizePrivateKey(inlineKeyRaw)
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
const keyPath = normalizeNonEmptyString(env.MOLDCLAW_APNS_PRIVATE_KEY_PATH);
|
|
792
|
+
if (!keyPath) return {
|
|
793
|
+
ok: false,
|
|
794
|
+
error: "APNs private key missing: set MOLDCLAW_APNS_PRIVATE_KEY_P8 or MOLDCLAW_APNS_PRIVATE_KEY_PATH"
|
|
795
|
+
};
|
|
796
|
+
try {
|
|
797
|
+
return {
|
|
798
|
+
ok: true,
|
|
799
|
+
value: {
|
|
800
|
+
teamId,
|
|
801
|
+
keyId,
|
|
802
|
+
privateKey: normalizePrivateKey(await fs.readFile(keyPath, "utf8"))
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
} catch (err) {
|
|
806
|
+
return {
|
|
807
|
+
ok: false,
|
|
808
|
+
error: `failed reading MOLDCLAW_APNS_PRIVATE_KEY_PATH (${keyPath}): ${err instanceof Error ? err.message : String(err)}`
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
async function sendApnsRequest(params) {
|
|
813
|
+
const authority = params.environment === "production" ? "https://api.push.apple.com" : "https://api.sandbox.push.apple.com";
|
|
814
|
+
const body = JSON.stringify(params.payload);
|
|
815
|
+
const requestPath = `/3/device/${params.token}`;
|
|
816
|
+
return await new Promise((resolve, reject) => {
|
|
817
|
+
const client = http2.connect(authority);
|
|
818
|
+
let settled = false;
|
|
819
|
+
const fail = (err) => {
|
|
820
|
+
if (settled) return;
|
|
821
|
+
settled = true;
|
|
822
|
+
client.destroy();
|
|
823
|
+
reject(err);
|
|
824
|
+
};
|
|
825
|
+
const finish = (result) => {
|
|
826
|
+
if (settled) return;
|
|
827
|
+
settled = true;
|
|
828
|
+
client.close();
|
|
829
|
+
resolve(result);
|
|
830
|
+
};
|
|
831
|
+
client.once("error", (err) => fail(err));
|
|
832
|
+
const req = client.request({
|
|
833
|
+
":method": "POST",
|
|
834
|
+
":path": requestPath,
|
|
835
|
+
authorization: `bearer ${params.bearerToken}`,
|
|
836
|
+
"apns-topic": params.topic,
|
|
837
|
+
"apns-push-type": params.pushType,
|
|
838
|
+
"apns-priority": params.priority,
|
|
839
|
+
"apns-expiration": "0",
|
|
840
|
+
"content-type": "application/json",
|
|
841
|
+
"content-length": Buffer.byteLength(body).toString()
|
|
842
|
+
});
|
|
843
|
+
let statusCode = 0;
|
|
844
|
+
let apnsId;
|
|
845
|
+
let responseBody = "";
|
|
846
|
+
req.setEncoding("utf8");
|
|
847
|
+
req.setTimeout(params.timeoutMs, () => {
|
|
848
|
+
req.close(http2.constants.NGHTTP2_CANCEL);
|
|
849
|
+
fail(/* @__PURE__ */ new Error(`APNs request timed out after ${params.timeoutMs}ms`));
|
|
850
|
+
});
|
|
851
|
+
req.on("response", (headers) => {
|
|
852
|
+
const statusHeader = headers[":status"];
|
|
853
|
+
statusCode = typeof statusHeader === "number" ? statusHeader : Number(statusHeader ?? 0);
|
|
854
|
+
const idHeader = headers["apns-id"];
|
|
855
|
+
if (typeof idHeader === "string" && idHeader.trim().length > 0) apnsId = idHeader.trim();
|
|
856
|
+
});
|
|
857
|
+
req.on("data", (chunk) => {
|
|
858
|
+
if (typeof chunk === "string") responseBody += chunk;
|
|
859
|
+
});
|
|
860
|
+
req.on("end", () => {
|
|
861
|
+
finish({
|
|
862
|
+
status: statusCode,
|
|
863
|
+
apnsId,
|
|
864
|
+
body: responseBody
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
req.on("error", (err) => fail(err));
|
|
868
|
+
req.end(body);
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
function resolveApnsTimeoutMs(timeoutMs) {
|
|
872
|
+
return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) ? Math.max(1e3, Math.trunc(timeoutMs)) : DEFAULT_APNS_TIMEOUT_MS;
|
|
873
|
+
}
|
|
874
|
+
function resolveDirectSendContext(params) {
|
|
875
|
+
const token = normalizeApnsToken(params.registration.token);
|
|
876
|
+
if (!isLikelyApnsToken(token)) throw new Error("invalid APNs token");
|
|
877
|
+
const topic = normalizeTopic(params.registration.topic);
|
|
878
|
+
if (!isValidTopic(topic)) throw new Error("topic required");
|
|
879
|
+
return {
|
|
880
|
+
token,
|
|
881
|
+
topic,
|
|
882
|
+
environment: params.registration.environment,
|
|
883
|
+
bearerToken: getApnsBearerToken(params.auth)
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function toPushMetadata(params) {
|
|
887
|
+
return {
|
|
888
|
+
kind: params.kind,
|
|
889
|
+
nodeId: params.nodeId,
|
|
890
|
+
ts: Date.now(),
|
|
891
|
+
...params.reason ? { reason: params.reason } : {}
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
function resolveRegistrationDebugSuffix(registration, relayResult) {
|
|
895
|
+
if (registration.transport === "direct") return registration.token.slice(-8);
|
|
896
|
+
return relayResult?.tokenSuffix ?? registration.tokenDebugSuffix ?? registration.relayHandle.slice(-8);
|
|
897
|
+
}
|
|
898
|
+
function toPushResult(params) {
|
|
899
|
+
const response = "body" in params.response ? {
|
|
900
|
+
ok: params.response.status === 200,
|
|
901
|
+
status: params.response.status,
|
|
902
|
+
apnsId: params.response.apnsId,
|
|
903
|
+
reason: parseReason(params.response.body),
|
|
904
|
+
environment: params.registration.environment,
|
|
905
|
+
tokenSuffix: params.tokenSuffix
|
|
906
|
+
} : params.response;
|
|
907
|
+
return {
|
|
908
|
+
ok: response.ok,
|
|
909
|
+
status: response.status,
|
|
910
|
+
apnsId: response.apnsId,
|
|
911
|
+
reason: response.reason,
|
|
912
|
+
tokenSuffix: params.tokenSuffix ?? resolveRegistrationDebugSuffix(params.registration, "tokenSuffix" in response ? response : void 0),
|
|
913
|
+
topic: params.registration.topic,
|
|
914
|
+
environment: params.registration.transport === "relay" ? "production" : response.environment,
|
|
915
|
+
transport: params.registration.transport
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
async function sendDirectApnsPush(params) {
|
|
919
|
+
const { token, topic, environment, bearerToken } = resolveDirectSendContext({
|
|
920
|
+
auth: params.auth,
|
|
921
|
+
registration: params.registration
|
|
922
|
+
});
|
|
923
|
+
const response = await (params.requestSender ?? sendApnsRequest)({
|
|
924
|
+
token,
|
|
925
|
+
topic,
|
|
926
|
+
environment,
|
|
927
|
+
bearerToken,
|
|
928
|
+
payload: params.payload,
|
|
929
|
+
timeoutMs: resolveApnsTimeoutMs(params.timeoutMs),
|
|
930
|
+
pushType: params.pushType,
|
|
931
|
+
priority: params.priority
|
|
932
|
+
});
|
|
933
|
+
return toPushResult({
|
|
934
|
+
registration: params.registration,
|
|
935
|
+
response,
|
|
936
|
+
tokenSuffix: token.slice(-8)
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
async function sendRelayApnsPush(params) {
|
|
940
|
+
const response = await sendApnsRelayPush({
|
|
941
|
+
relayConfig: params.relayConfig,
|
|
942
|
+
sendGrant: params.registration.sendGrant,
|
|
943
|
+
relayHandle: params.registration.relayHandle,
|
|
944
|
+
payload: params.payload,
|
|
945
|
+
pushType: params.pushType,
|
|
946
|
+
priority: params.priority,
|
|
947
|
+
gatewayIdentity: params.gatewayIdentity,
|
|
948
|
+
requestSender: params.requestSender
|
|
949
|
+
});
|
|
950
|
+
return toPushResult({
|
|
951
|
+
registration: params.registration,
|
|
952
|
+
response
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function createAlertPayload(params) {
|
|
956
|
+
return {
|
|
957
|
+
aps: {
|
|
958
|
+
alert: {
|
|
959
|
+
title: params.title,
|
|
960
|
+
body: params.body
|
|
961
|
+
},
|
|
962
|
+
sound: "default"
|
|
963
|
+
},
|
|
964
|
+
moldclaw: toPushMetadata({
|
|
965
|
+
kind: "push.test",
|
|
966
|
+
nodeId: params.nodeId
|
|
967
|
+
})
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function createBackgroundPayload(params) {
|
|
971
|
+
return {
|
|
972
|
+
aps: { "content-available": 1 },
|
|
973
|
+
moldclaw: toPushMetadata({
|
|
974
|
+
kind: "node.wake",
|
|
975
|
+
reason: params.wakeReason ?? "node.invoke",
|
|
976
|
+
nodeId: params.nodeId
|
|
977
|
+
})
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
async function sendApnsAlert(params) {
|
|
981
|
+
const payload = createAlertPayload({
|
|
982
|
+
nodeId: params.nodeId,
|
|
983
|
+
title: params.title,
|
|
984
|
+
body: params.body
|
|
985
|
+
});
|
|
986
|
+
if (params.registration.transport === "relay") {
|
|
987
|
+
const relayParams = params;
|
|
988
|
+
return await sendRelayApnsPush({
|
|
989
|
+
relayConfig: relayParams.relayConfig,
|
|
990
|
+
registration: relayParams.registration,
|
|
991
|
+
payload,
|
|
992
|
+
pushType: "alert",
|
|
993
|
+
priority: "10",
|
|
994
|
+
gatewayIdentity: relayParams.relayGatewayIdentity,
|
|
995
|
+
requestSender: relayParams.relayRequestSender
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
const directParams = params;
|
|
999
|
+
return await sendDirectApnsPush({
|
|
1000
|
+
auth: directParams.auth,
|
|
1001
|
+
registration: directParams.registration,
|
|
1002
|
+
payload,
|
|
1003
|
+
timeoutMs: directParams.timeoutMs,
|
|
1004
|
+
requestSender: directParams.requestSender,
|
|
1005
|
+
pushType: "alert",
|
|
1006
|
+
priority: "10"
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
async function sendApnsBackgroundWake(params) {
|
|
1010
|
+
const payload = createBackgroundPayload({
|
|
1011
|
+
nodeId: params.nodeId,
|
|
1012
|
+
wakeReason: params.wakeReason
|
|
1013
|
+
});
|
|
1014
|
+
if (params.registration.transport === "relay") {
|
|
1015
|
+
const relayParams = params;
|
|
1016
|
+
return await sendRelayApnsPush({
|
|
1017
|
+
relayConfig: relayParams.relayConfig,
|
|
1018
|
+
registration: relayParams.registration,
|
|
1019
|
+
payload,
|
|
1020
|
+
pushType: "background",
|
|
1021
|
+
priority: "5",
|
|
1022
|
+
gatewayIdentity: relayParams.relayGatewayIdentity,
|
|
1023
|
+
requestSender: relayParams.relayRequestSender
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
const directParams = params;
|
|
1027
|
+
return await sendDirectApnsPush({
|
|
1028
|
+
auth: directParams.auth,
|
|
1029
|
+
registration: directParams.registration,
|
|
1030
|
+
payload,
|
|
1031
|
+
timeoutMs: directParams.timeoutMs,
|
|
1032
|
+
requestSender: directParams.requestSender,
|
|
1033
|
+
pushType: "background",
|
|
1034
|
+
priority: "5"
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
//#endregion
|
|
1038
|
+
export { resolveApnsAuthConfigFromEnv as a, shouldClearStoredApnsRegistration as c, parseMessageWithAttachments as d, formatForLog as f, setGatewayWsLogStyle as g, summarizeAgentEventForWsLog as h, registerApnsRegistration as i, resolveApnsRelayConfigFromEnv as l, shouldLogWs as m, loadApnsRegistration as n, sendApnsAlert as o, logWs as p, normalizeApnsEnvironment as r, sendApnsBackgroundWake as s, clearApnsRegistrationIfCurrent as t, normalizeRpcAttachmentsToChatAttachments as u };
|