@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,1762 @@
|
|
|
1
|
+
import "../../logger-BFfIIIKH.js";
|
|
2
|
+
import "../../paths-D6AgsMTU.js";
|
|
3
|
+
import "../../tmp-moldclaw-dir-DWF-d8qD.js";
|
|
4
|
+
import "../../theme-BSXzMzAA.js";
|
|
5
|
+
import "../../globals-DESrFYmC.js";
|
|
6
|
+
import "../../subsystem-S4LNMNHd.js";
|
|
7
|
+
import "../../ansi-BPhP6LBZ.js";
|
|
8
|
+
import "../../utils-rjVNXUns.js";
|
|
9
|
+
import "../../agent-scope-DA7O8MVG.js";
|
|
10
|
+
import "../../boundary-file-read-Y1cMjPlu.js";
|
|
11
|
+
import "../../logger-wrbK9-ju.js";
|
|
12
|
+
import "../../exec-CoBTyh8B.js";
|
|
13
|
+
import "../../workspace-CxNKYS0V.js";
|
|
14
|
+
import "../../registry-DcDGl2X7.js";
|
|
15
|
+
import "../../resolve-route-IkBfMjBz.js";
|
|
16
|
+
import "../../secret-file-Bjh19aoH.js";
|
|
17
|
+
import { t as defineChannelPluginEntry } from "../../core-EKuk2FxR.js";
|
|
18
|
+
import { t as createPluginRuntimeStore } from "../../runtime-store-BIrp4FYB.js";
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
//#region extensions/kakao-talkchannel/src/config/schema.ts
|
|
21
|
+
/**
|
|
22
|
+
* Zod schemas for Kakao plugin configuration validation
|
|
23
|
+
*
|
|
24
|
+
* Simplified: Single channel + Relay mode only
|
|
25
|
+
* Direct mode and multi-channel support are planned for future releases.
|
|
26
|
+
*/
|
|
27
|
+
const DEFAULT_RELAY_URL = "https://k.tess.dev/";
|
|
28
|
+
/**
|
|
29
|
+
* Single account configuration schema
|
|
30
|
+
*/
|
|
31
|
+
const KakaoAccountConfigSchema = z.object({
|
|
32
|
+
enabled: z.boolean().default(true),
|
|
33
|
+
dmPolicy: z.enum([
|
|
34
|
+
"pairing",
|
|
35
|
+
"allowlist",
|
|
36
|
+
"open",
|
|
37
|
+
"disabled"
|
|
38
|
+
]).default("pairing"),
|
|
39
|
+
allowFrom: z.array(z.string()).optional(),
|
|
40
|
+
responsePrefix: z.string().optional(),
|
|
41
|
+
channelId: z.string().min(1, "channelId๋ ํ์์
๋๋ค").optional(),
|
|
42
|
+
relayUrl: z.string().default(DEFAULT_RELAY_URL),
|
|
43
|
+
relayToken: z.string().optional(),
|
|
44
|
+
sessionToken: z.string().optional(),
|
|
45
|
+
reconnectDelayMs: z.number().min(500).max(1e4).default(1e3),
|
|
46
|
+
maxReconnectDelayMs: z.number().min(5e3).max(6e4).default(3e4),
|
|
47
|
+
textChunkLimit: z.number().min(100, "textChunkLimit์ ์ต์ 100์ ์ด์์ด์ด์ผ ํฉ๋๋ค").max(1e3, "textChunkLimit์ ์ต๋ 1000์ ์ดํ์ฌ์ผ ํฉ๋๋ค").default(400),
|
|
48
|
+
chunkMode: z.enum([
|
|
49
|
+
"sentence",
|
|
50
|
+
"newline",
|
|
51
|
+
"length"
|
|
52
|
+
]).default("sentence")
|
|
53
|
+
});
|
|
54
|
+
z.object({ accounts: z.record(z.string(), KakaoAccountConfigSchema).optional() });
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region extensions/kakao-talkchannel/src/adapters/config.ts
|
|
57
|
+
/**
|
|
58
|
+
* Get the kakao-talkchannel config object
|
|
59
|
+
*/
|
|
60
|
+
function getKakaoTalkchannelConfig$1(cfg) {
|
|
61
|
+
if (!cfg || typeof cfg !== "object") return void 0;
|
|
62
|
+
const channels = cfg.channels;
|
|
63
|
+
if (!channels || typeof channels !== "object") return void 0;
|
|
64
|
+
const talkchannelConfig = channels["kakao-talkchannel"];
|
|
65
|
+
if (!talkchannelConfig || typeof talkchannelConfig !== "object") return void 0;
|
|
66
|
+
return talkchannelConfig;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get accounts object from kakao-talkchannel config
|
|
70
|
+
* Returns empty object if not present (will use defaults)
|
|
71
|
+
*/
|
|
72
|
+
function getAccounts(cfg) {
|
|
73
|
+
const talkchannelConfig = getKakaoTalkchannelConfig$1(cfg);
|
|
74
|
+
if (!talkchannelConfig) return {};
|
|
75
|
+
const accounts = talkchannelConfig.accounts;
|
|
76
|
+
if (!accounts || typeof accounts !== "object") return {};
|
|
77
|
+
return accounts;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get account config by accountId
|
|
81
|
+
* Falls back to default account if not found
|
|
82
|
+
*/
|
|
83
|
+
function getAccountConfig(cfg, accountId) {
|
|
84
|
+
const account = getAccounts(cfg)[accountId];
|
|
85
|
+
if (account && typeof account === "object") return account;
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Resolve Kakao TalkChannel from configuration
|
|
90
|
+
* Uses schema defaults if no config provided
|
|
91
|
+
*/
|
|
92
|
+
function resolveKakaoTalkChannel(cfg, accountId) {
|
|
93
|
+
const rawConfig = getAccountConfig(cfg, accountId);
|
|
94
|
+
const validationResult = KakaoAccountConfigSchema.safeParse(rawConfig);
|
|
95
|
+
if (!validationResult.success) {
|
|
96
|
+
const errors = validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
97
|
+
throw new Error(`Invalid Kakao TalkChannel configuration: ${errors}`);
|
|
98
|
+
}
|
|
99
|
+
const config = validationResult.data;
|
|
100
|
+
let tokenSource = "none";
|
|
101
|
+
if (config.sessionToken) tokenSource = "session";
|
|
102
|
+
else if (config.relayToken) tokenSource = "config";
|
|
103
|
+
else if (process.env.OPENCLAW_TALKCHANNEL_RELAY_TOKEN) tokenSource = "env";
|
|
104
|
+
return {
|
|
105
|
+
talkchannelId: accountId,
|
|
106
|
+
config,
|
|
107
|
+
enabled: config.enabled,
|
|
108
|
+
name: rawConfig.name,
|
|
109
|
+
channelId: config.channelId,
|
|
110
|
+
tokenSource
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Kakao channel configuration adapter (simplified)
|
|
115
|
+
* Uses moldClaw standard accounts structure
|
|
116
|
+
*/
|
|
117
|
+
const configAdapter = {
|
|
118
|
+
listAccountIds: (cfg) => {
|
|
119
|
+
const accounts = getAccounts(cfg);
|
|
120
|
+
const ids = Object.keys(accounts);
|
|
121
|
+
return ids.length > 0 ? ids : ["default"];
|
|
122
|
+
},
|
|
123
|
+
resolveAccount: (cfg, accountId) => {
|
|
124
|
+
return resolveKakaoTalkChannel(cfg, accountId ?? "default");
|
|
125
|
+
},
|
|
126
|
+
defaultAccountId: (_cfg) => {
|
|
127
|
+
return "default";
|
|
128
|
+
},
|
|
129
|
+
isConfigured: (_account) => {
|
|
130
|
+
return true;
|
|
131
|
+
},
|
|
132
|
+
isEnabled: (account) => {
|
|
133
|
+
return account.config.enabled;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region extensions/kakao-talkchannel/src/kakao/response.ts
|
|
138
|
+
/**
|
|
139
|
+
* Strip markdown formatting from text for Kakao (which doesn't support markdown)
|
|
140
|
+
*
|
|
141
|
+
* Handles:
|
|
142
|
+
* - Headers (# ## ### etc.)
|
|
143
|
+
* - Bold (**text** or __text__)
|
|
144
|
+
* - Italic (*text* or _text_)
|
|
145
|
+
* - Strikethrough (~~text~~)
|
|
146
|
+
* - Code blocks (```code``` and `inline code`)
|
|
147
|
+
* - Links ([text](url)) -> text (url)
|
|
148
|
+
* - Images () -> [์ด๋ฏธ์ง: alt]
|
|
149
|
+
* - Blockquotes (> text)
|
|
150
|
+
* - Horizontal rules (--- or ***)
|
|
151
|
+
* - List markers (* - + and numbered lists)
|
|
152
|
+
*
|
|
153
|
+
* @param text - Text with potential markdown formatting
|
|
154
|
+
* @returns Plain text with markdown stripped
|
|
155
|
+
*/
|
|
156
|
+
function stripMarkdown(text) {
|
|
157
|
+
if (!text) return text;
|
|
158
|
+
let result = text;
|
|
159
|
+
result = result.replace(/```[\s\S]*?```/g, (match) => {
|
|
160
|
+
return match.replace(/```\w*\n?/g, "").replace(/```$/g, "").trim();
|
|
161
|
+
});
|
|
162
|
+
result = result.replace(/`([^`]+)`/g, "$1");
|
|
163
|
+
result = result.replace(/!\[([^\]]*)\]\([^)]+\)/g, "[์ด๋ฏธ์ง: $1]");
|
|
164
|
+
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1 ($2)");
|
|
165
|
+
result = result.replace(/^#{1,6}\s+/gm, "");
|
|
166
|
+
result = result.replace(/\*\*([^*]+)\*\*/g, "$1");
|
|
167
|
+
result = result.replace(/__([^_]+)__/g, "$1");
|
|
168
|
+
result = result.replace(/(?<!\n|\*)\*([^*\n]+)\*(?!\*)/g, "$1");
|
|
169
|
+
result = result.replace(/(?<!\n|_)_([^_\n]+)_(?!_)/g, "$1");
|
|
170
|
+
result = result.replace(/~~([^~]+)~~/g, "$1");
|
|
171
|
+
result = result.replace(/^>\s?/gm, "");
|
|
172
|
+
result = result.replace(/^[-*_]{3,}\s*$/gm, "");
|
|
173
|
+
result = result.replace(/^[\s]*[-*+]\s+/gm, "โข ");
|
|
174
|
+
result = result.replace(/^[\s]*\d+\.\s+/gm, "");
|
|
175
|
+
result = result.replace(/\n{3,}/g, "\n\n");
|
|
176
|
+
result = result.trim();
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
const DEFAULT_CHUNK_LIMIT = 400;
|
|
180
|
+
function chunkBySentence(text, limit) {
|
|
181
|
+
const chunks = [];
|
|
182
|
+
let remaining = text;
|
|
183
|
+
while (remaining.length > 0) {
|
|
184
|
+
if (remaining.length <= limit) {
|
|
185
|
+
chunks.push(remaining);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
const substring = remaining.substring(0, limit);
|
|
189
|
+
const lastSentenceEnd = Math.max(substring.lastIndexOf("."), substring.lastIndexOf("!"), substring.lastIndexOf("?"));
|
|
190
|
+
if (lastSentenceEnd > 0) {
|
|
191
|
+
chunks.push(remaining.substring(0, lastSentenceEnd + 1));
|
|
192
|
+
remaining = remaining.substring(lastSentenceEnd + 1).trim();
|
|
193
|
+
} else {
|
|
194
|
+
chunks.push(remaining.substring(0, limit));
|
|
195
|
+
remaining = remaining.substring(limit).trim();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return chunks;
|
|
199
|
+
}
|
|
200
|
+
function chunkByNewline(text, limit) {
|
|
201
|
+
const paragraphs = text.split(/\n\s*\n/);
|
|
202
|
+
const chunks = [];
|
|
203
|
+
let currentChunk = "";
|
|
204
|
+
for (const paragraph of paragraphs) {
|
|
205
|
+
const trimmed = paragraph.trim();
|
|
206
|
+
if (!trimmed) continue;
|
|
207
|
+
if (currentChunk.length === 0) if (trimmed.length <= limit) currentChunk = trimmed;
|
|
208
|
+
else chunks.push(...chunkBySentence(trimmed, limit));
|
|
209
|
+
else if (currentChunk.length + 2 + trimmed.length <= limit) currentChunk += "\n\n" + trimmed;
|
|
210
|
+
else {
|
|
211
|
+
chunks.push(currentChunk);
|
|
212
|
+
if (trimmed.length <= limit) currentChunk = trimmed;
|
|
213
|
+
else {
|
|
214
|
+
chunks.push(...chunkBySentence(trimmed, limit));
|
|
215
|
+
currentChunk = "";
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (currentChunk) chunks.push(currentChunk);
|
|
220
|
+
return chunks;
|
|
221
|
+
}
|
|
222
|
+
function chunkByLength(text, limit) {
|
|
223
|
+
const chunks = [];
|
|
224
|
+
let remaining = text;
|
|
225
|
+
while (remaining.length > 0) {
|
|
226
|
+
if (remaining.length <= limit) {
|
|
227
|
+
chunks.push(remaining);
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
chunks.push(remaining.substring(0, limit));
|
|
231
|
+
remaining = remaining.substring(limit);
|
|
232
|
+
}
|
|
233
|
+
return chunks;
|
|
234
|
+
}
|
|
235
|
+
function chunkTextForKakao$1(text, limit = DEFAULT_CHUNK_LIMIT, mode = "sentence") {
|
|
236
|
+
if (!text || text.length <= limit) return [text];
|
|
237
|
+
switch (mode) {
|
|
238
|
+
case "newline": return chunkByNewline(text, limit);
|
|
239
|
+
case "length": return chunkByLength(text, limit);
|
|
240
|
+
default: return chunkBySentence(text, limit);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region extensions/kakao-talkchannel/src/adapters/outbound.ts
|
|
245
|
+
function chunkTextForKakao(text, limit = 400, mode = "sentence") {
|
|
246
|
+
return chunkTextForKakao$1(text, limit, mode);
|
|
247
|
+
}
|
|
248
|
+
const outboundAdapter = {
|
|
249
|
+
deliveryMode: "direct",
|
|
250
|
+
textChunkLimit: 400,
|
|
251
|
+
chunkerMode: "text",
|
|
252
|
+
chunkMode: "sentence",
|
|
253
|
+
chunker: chunkTextForKakao,
|
|
254
|
+
sendText: async (_ctx) => {
|
|
255
|
+
return {
|
|
256
|
+
channel: "kakao-talkchannel",
|
|
257
|
+
success: true
|
|
258
|
+
};
|
|
259
|
+
},
|
|
260
|
+
sendMedia: async (_ctx) => {
|
|
261
|
+
return {
|
|
262
|
+
channel: "kakao-talkchannel",
|
|
263
|
+
success: true
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region extensions/kakao-talkchannel/src/adapters/status.ts
|
|
269
|
+
const statusAdapter = {
|
|
270
|
+
defaultRuntime: {
|
|
271
|
+
accountId: "default",
|
|
272
|
+
running: false,
|
|
273
|
+
lastStartAt: null,
|
|
274
|
+
lastStopAt: null,
|
|
275
|
+
lastError: null
|
|
276
|
+
},
|
|
277
|
+
probeAccount: async ({ account, timeoutMs }) => {
|
|
278
|
+
if (!account.config.relayUrl) return {
|
|
279
|
+
ok: false,
|
|
280
|
+
error: "relayUrl not configured"
|
|
281
|
+
};
|
|
282
|
+
const start = Date.now();
|
|
283
|
+
try {
|
|
284
|
+
const response = await fetch(`${account.config.relayUrl}/health`, {
|
|
285
|
+
method: "GET",
|
|
286
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
287
|
+
});
|
|
288
|
+
if (!response.ok) return {
|
|
289
|
+
ok: false,
|
|
290
|
+
error: `HTTP ${response.status}`
|
|
291
|
+
};
|
|
292
|
+
return {
|
|
293
|
+
ok: true,
|
|
294
|
+
latencyMs: Date.now() - start
|
|
295
|
+
};
|
|
296
|
+
} catch (error) {
|
|
297
|
+
return {
|
|
298
|
+
ok: false,
|
|
299
|
+
error: String(error)
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
buildAccountSnapshot: ({ account, runtime, probe }) => {
|
|
304
|
+
const snapshot = {
|
|
305
|
+
accountId: account.talkchannelId,
|
|
306
|
+
enabled: account.config.enabled,
|
|
307
|
+
configured: Boolean(account.config.relayUrl),
|
|
308
|
+
running: runtime?.running ?? false,
|
|
309
|
+
connected: runtime?.connected,
|
|
310
|
+
lastStartAt: runtime?.lastStartAt ?? null,
|
|
311
|
+
lastStopAt: runtime?.lastStopAt ?? null,
|
|
312
|
+
lastError: runtime?.lastError ?? null,
|
|
313
|
+
lastInboundAt: runtime?.lastInboundAt ?? null,
|
|
314
|
+
lastOutboundAt: runtime?.lastOutboundAt ?? null
|
|
315
|
+
};
|
|
316
|
+
if (probe !== void 0) snapshot.probe = probe;
|
|
317
|
+
return snapshot;
|
|
318
|
+
},
|
|
319
|
+
collectStatusIssues: (accounts) => {
|
|
320
|
+
const issues = [];
|
|
321
|
+
for (const account of accounts) {
|
|
322
|
+
const ext = account;
|
|
323
|
+
if (ext.configured && !ext.enabled) issues.push({
|
|
324
|
+
level: "warn",
|
|
325
|
+
message: `Kakao TalkChannel "${ext.accountId}" is configured but disabled`
|
|
326
|
+
});
|
|
327
|
+
if (ext.probe && !ext.probe.ok) issues.push({
|
|
328
|
+
level: "error",
|
|
329
|
+
message: `Kakao relay server unreachable: ${ext.probe.error}`
|
|
330
|
+
});
|
|
331
|
+
if (ext.running && ext.lastInboundAt) {
|
|
332
|
+
const silentMs = Date.now() - ext.lastInboundAt;
|
|
333
|
+
if (silentMs > 1800 * 1e3) issues.push({
|
|
334
|
+
level: "warn",
|
|
335
|
+
message: `Kakao TalkChannel "${ext.accountId}" has not received messages for ${Math.round(silentMs / 6e4)} minutes`
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return issues;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region extensions/kakao-talkchannel/src/adapters/security.ts
|
|
344
|
+
const securityAdapter = {
|
|
345
|
+
resolveDmPolicy: (ctx) => {
|
|
346
|
+
const account = ctx.account ?? ctx.talkchannel;
|
|
347
|
+
if (!account) return null;
|
|
348
|
+
return {
|
|
349
|
+
policy: account.config.dmPolicy ?? "pairing",
|
|
350
|
+
allowFrom: account.config.allowFrom ?? [],
|
|
351
|
+
policyPath: `channels["kakao-talkchannel"].dmPolicy`,
|
|
352
|
+
allowFromPath: `channels["kakao-talkchannel"].allowFrom`,
|
|
353
|
+
approveHint: "moldclaw pairing approve kakao-talkchannel <userId>",
|
|
354
|
+
normalizeEntry: (raw) => raw.trim().replace(/^(kakao|kakaotalk):/i, "").trim()
|
|
355
|
+
};
|
|
356
|
+
},
|
|
357
|
+
collectWarnings: (ctx) => {
|
|
358
|
+
const account = ctx.account ?? ctx.talkchannel;
|
|
359
|
+
if (!account) return [];
|
|
360
|
+
const warnings = [];
|
|
361
|
+
if (account.config.dmPolicy === "open") warnings.push("- Kakao DM: dmPolicy='open' allows any user to message. Consider 'pairing' or 'allowlist' for production.");
|
|
362
|
+
return warnings;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region extensions/kakao-talkchannel/src/runtime.ts
|
|
367
|
+
const { setRuntime: setKakaoRuntime, getRuntime: getKakaoRuntime } = createPluginRuntimeStore("Kakao runtime not initialized");
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region extensions/kakao-talkchannel/src/adapters/pairing.ts
|
|
370
|
+
/**
|
|
371
|
+
* Kakao Channel Pairing Adapter
|
|
372
|
+
*
|
|
373
|
+
* Handles user pairing for dmPolicy="pairing" mode.
|
|
374
|
+
*/
|
|
375
|
+
const PAIRING_APPROVED_MESSAGE = "โ
moldClaw ์ฐ๋์ด ์น์ธ๋์์ต๋๋ค. ์ด์ ๋ํ๋ฅผ ์์ํ ์ ์์ต๋๋ค.";
|
|
376
|
+
const pairingAdapter = {
|
|
377
|
+
idLabel: "kakaoUserId",
|
|
378
|
+
normalizeAllowEntry: (entry) => {
|
|
379
|
+
return entry.trim().replace(/^(kakao|kakaotalk):/i, "").trim();
|
|
380
|
+
},
|
|
381
|
+
notifyApproval: async (ctx) => {
|
|
382
|
+
try {
|
|
383
|
+
getKakaoRuntime().logger.info(`[kakao:pairing] Approval notification for user ${ctx.id}: ${PAIRING_APPROVED_MESSAGE}`);
|
|
384
|
+
} catch {}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region extensions/kakao-talkchannel/src/relay/sse.ts
|
|
389
|
+
const DEFAULT_RECONNECT_DELAY_MS = 1e3;
|
|
390
|
+
const DEFAULT_MAX_RECONNECT_DELAY_MS = 3e4;
|
|
391
|
+
const DEFAULT_TIMEOUT_MS$1 = 3e5;
|
|
392
|
+
function calculateReconnectDelay(attempt, baseDelayMs, maxDelayMs) {
|
|
393
|
+
const exponentialDelay = baseDelayMs * Math.pow(2, attempt);
|
|
394
|
+
const cappedDelay = Math.min(exponentialDelay, maxDelayMs);
|
|
395
|
+
const jitter = cappedDelay * .2 * Math.random();
|
|
396
|
+
return Math.floor(cappedDelay + jitter);
|
|
397
|
+
}
|
|
398
|
+
function parseSSEChunk(chunk) {
|
|
399
|
+
const events = [];
|
|
400
|
+
let consumed = 0;
|
|
401
|
+
let searchFrom = 0;
|
|
402
|
+
let parseErrors = 0;
|
|
403
|
+
while (true) {
|
|
404
|
+
const boundary = chunk.indexOf("\n\n", searchFrom);
|
|
405
|
+
if (boundary === -1) break;
|
|
406
|
+
const block = chunk.slice(consumed, boundary);
|
|
407
|
+
const endPos = boundary + 2;
|
|
408
|
+
const currentEvent = {};
|
|
409
|
+
const lines = block.split("\n");
|
|
410
|
+
for (const line of lines) {
|
|
411
|
+
if (line === "") continue;
|
|
412
|
+
if (line.startsWith("event:")) currentEvent.event = line.slice(6).trim();
|
|
413
|
+
else if (line.startsWith("data:")) currentEvent.data = line.slice(5).trim();
|
|
414
|
+
else if (line.startsWith("id:")) currentEvent.id = line.slice(3).trim();
|
|
415
|
+
}
|
|
416
|
+
if (currentEvent.event && currentEvent.data) try {
|
|
417
|
+
const parsedData = JSON.parse(currentEvent.data);
|
|
418
|
+
events.push({
|
|
419
|
+
event: currentEvent.event,
|
|
420
|
+
data: parsedData,
|
|
421
|
+
id: currentEvent.id
|
|
422
|
+
});
|
|
423
|
+
} catch {
|
|
424
|
+
parseErrors++;
|
|
425
|
+
}
|
|
426
|
+
consumed = endPos;
|
|
427
|
+
searchFrom = endPos;
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
events,
|
|
431
|
+
consumed,
|
|
432
|
+
parseErrors
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function createTimeoutSignal$1(timeoutMs, parentSignal) {
|
|
436
|
+
const controller = new AbortController();
|
|
437
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
438
|
+
let parentAbortHandler;
|
|
439
|
+
if (parentSignal) {
|
|
440
|
+
parentAbortHandler = () => {
|
|
441
|
+
clearTimeout(timeoutId);
|
|
442
|
+
controller.abort();
|
|
443
|
+
};
|
|
444
|
+
parentSignal.addEventListener("abort", parentAbortHandler, { once: true });
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
signal: controller.signal,
|
|
448
|
+
clear: () => {
|
|
449
|
+
clearTimeout(timeoutId);
|
|
450
|
+
if (parentSignal && parentAbortHandler) parentSignal.removeEventListener("abort", parentAbortHandler);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
async function connectSSE(config, handlers, abortSignal) {
|
|
455
|
+
const reconnectDelayMs = config.reconnectDelayMs ?? DEFAULT_RECONNECT_DELAY_MS;
|
|
456
|
+
const maxReconnectDelayMs = config.maxReconnectDelayMs ?? DEFAULT_MAX_RECONNECT_DELAY_MS;
|
|
457
|
+
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS$1;
|
|
458
|
+
let reconnectAttempt = 0;
|
|
459
|
+
let lastEventId;
|
|
460
|
+
while (!abortSignal.aborted) {
|
|
461
|
+
const timeout = createTimeoutSignal$1(timeoutMs, abortSignal);
|
|
462
|
+
try {
|
|
463
|
+
const token = config.sessionToken ?? config.relayToken;
|
|
464
|
+
if (!token) throw new Error("SSE connection requires sessionToken or relayToken");
|
|
465
|
+
const headers = {
|
|
466
|
+
Authorization: `Bearer ${token}`,
|
|
467
|
+
Accept: "text/event-stream",
|
|
468
|
+
"Cache-Control": "no-cache"
|
|
469
|
+
};
|
|
470
|
+
if (lastEventId) headers["Last-Event-ID"] = lastEventId;
|
|
471
|
+
const baseUrl = config.relayUrl.endsWith("/") ? config.relayUrl : `${config.relayUrl}/`;
|
|
472
|
+
const response = await fetch(`${baseUrl}v1/events`, {
|
|
473
|
+
method: "GET",
|
|
474
|
+
headers,
|
|
475
|
+
signal: timeout.signal
|
|
476
|
+
});
|
|
477
|
+
if (!response.ok) {
|
|
478
|
+
if (response.status === 401 || response.status === 410) {
|
|
479
|
+
handlers.onSessionInvalidated?.(response.status);
|
|
480
|
+
throw new Error(`SSE session invalidated: HTTP ${response.status}`);
|
|
481
|
+
}
|
|
482
|
+
throw new Error(`SSE connection failed: HTTP ${response.status}`);
|
|
483
|
+
}
|
|
484
|
+
if (!response.body) throw new Error("SSE connection failed: no response body");
|
|
485
|
+
reconnectAttempt = 0;
|
|
486
|
+
handlers.onConnected?.();
|
|
487
|
+
const reader = response.body.getReader();
|
|
488
|
+
try {
|
|
489
|
+
const decoder = new TextDecoder();
|
|
490
|
+
let buffer = "";
|
|
491
|
+
while (!abortSignal.aborted) {
|
|
492
|
+
const { done, value } = await reader.read();
|
|
493
|
+
if (done) break;
|
|
494
|
+
buffer += decoder.decode(value, { stream: true });
|
|
495
|
+
const { events, consumed, parseErrors } = parseSSEChunk(buffer);
|
|
496
|
+
if (consumed > 0) buffer = buffer.slice(consumed);
|
|
497
|
+
if (parseErrors > 0) handlers.onError?.(/* @__PURE__ */ new Error(`Skipped ${parseErrors} SSE event(s) with malformed JSON`));
|
|
498
|
+
for (const event of events) {
|
|
499
|
+
if (event.id) lastEventId = event.id;
|
|
500
|
+
if (event.event === "message") try {
|
|
501
|
+
await handlers.onMessage(event.data);
|
|
502
|
+
} catch (msgError) {
|
|
503
|
+
const err = msgError instanceof Error ? msgError : new Error(String(msgError));
|
|
504
|
+
handlers.onError?.(err);
|
|
505
|
+
}
|
|
506
|
+
else if (event.event === "error") handlers.onError?.(new Error(event.data.message));
|
|
507
|
+
else if (event.event === "pairing_complete") handlers.onPairingComplete?.(event.data);
|
|
508
|
+
else if (event.event === "pairing_expired") handlers.onPairingExpired?.(event.data.reason);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
} finally {
|
|
512
|
+
reader.cancel().catch(() => {});
|
|
513
|
+
}
|
|
514
|
+
} catch (error) {
|
|
515
|
+
if (abortSignal.aborted) return;
|
|
516
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
517
|
+
if (err.message.startsWith("SSE session invalidated")) {
|
|
518
|
+
handlers.onError?.(err);
|
|
519
|
+
throw err;
|
|
520
|
+
}
|
|
521
|
+
handlers.onError?.(err);
|
|
522
|
+
handlers.onDisconnected?.();
|
|
523
|
+
reconnectAttempt++;
|
|
524
|
+
handlers.onReconnect?.(reconnectAttempt);
|
|
525
|
+
if (config.maxRetries !== void 0 && reconnectAttempt >= config.maxRetries) throw new Error(`Max reconnect attempts (${config.maxRetries}) exceeded`);
|
|
526
|
+
await sleep(calculateReconnectDelay(reconnectAttempt, reconnectDelayMs, maxReconnectDelayMs), abortSignal);
|
|
527
|
+
} finally {
|
|
528
|
+
timeout.clear();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function sleep(ms, signal) {
|
|
533
|
+
return new Promise((resolve, reject) => {
|
|
534
|
+
if (signal.aborted) {
|
|
535
|
+
reject(/* @__PURE__ */ new Error("Aborted"));
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const abortHandler = () => {
|
|
539
|
+
clearTimeout(timeout);
|
|
540
|
+
reject(/* @__PURE__ */ new Error("Aborted"));
|
|
541
|
+
};
|
|
542
|
+
const timeout = setTimeout(() => {
|
|
543
|
+
signal.removeEventListener("abort", abortHandler);
|
|
544
|
+
resolve();
|
|
545
|
+
}, ms);
|
|
546
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region extensions/kakao-talkchannel/src/relay/session.ts
|
|
551
|
+
/**
|
|
552
|
+
* Relay Server Session API Client
|
|
553
|
+
*
|
|
554
|
+
* Handles session creation and management for relay mode.
|
|
555
|
+
* Sessions are created without authentication and provide:
|
|
556
|
+
* - sessionToken: For SSE connection authentication
|
|
557
|
+
* - pairingCode: For users to enter in KakaoTalk
|
|
558
|
+
*/
|
|
559
|
+
/**
|
|
560
|
+
* Create a new session on the relay server
|
|
561
|
+
*
|
|
562
|
+
* @param relayUrl - Relay server URL (defaults to https://k.tess.dev/)
|
|
563
|
+
* @returns Session token and pairing code
|
|
564
|
+
*/
|
|
565
|
+
async function createSession(relayUrl = DEFAULT_RELAY_URL) {
|
|
566
|
+
const url = normalizeRelayUrl(relayUrl);
|
|
567
|
+
try {
|
|
568
|
+
const response = await fetch(`${url}v1/sessions/create`, {
|
|
569
|
+
method: "POST",
|
|
570
|
+
headers: { "Content-Type": "application/json" },
|
|
571
|
+
body: JSON.stringify({})
|
|
572
|
+
});
|
|
573
|
+
if (!response.ok) {
|
|
574
|
+
const errorData = await response.json().catch(() => ({}));
|
|
575
|
+
return {
|
|
576
|
+
ok: false,
|
|
577
|
+
error: {
|
|
578
|
+
code: `HTTP_${response.status}`,
|
|
579
|
+
message: errorData.message ?? `Failed to create session: HTTP ${response.status}`
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
ok: true,
|
|
585
|
+
data: await response.json()
|
|
586
|
+
};
|
|
587
|
+
} catch (error) {
|
|
588
|
+
return {
|
|
589
|
+
ok: false,
|
|
590
|
+
error: {
|
|
591
|
+
code: "NETWORK_ERROR",
|
|
592
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Normalize relay URL to ensure it ends with a slash
|
|
599
|
+
*/
|
|
600
|
+
function normalizeRelayUrl(url) {
|
|
601
|
+
return url.endsWith("/") ? url : `${url}/`;
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region extensions/kakao-talkchannel/src/relay/stream.ts
|
|
605
|
+
const DEFAULT_STREAM_OPTIONS = { maxRetries: 10 };
|
|
606
|
+
/**
|
|
607
|
+
* Sanitize tokens and sensitive values from log messages.
|
|
608
|
+
* Masks Bearer tokens, token= params, sessionToken= params, and UUID-like patterns in auth context.
|
|
609
|
+
*/
|
|
610
|
+
function sanitizeTokenFromLog(message) {
|
|
611
|
+
let sanitized = message;
|
|
612
|
+
sanitized = sanitized.replace(/Authorization:\s*Bearer\s+[^\s,;]+/gi, "Authorization: ***");
|
|
613
|
+
sanitized = sanitized.replace(/Bearer\s+[^\s,;]+/gi, "Bearer ***");
|
|
614
|
+
sanitized = sanitized.replace(/sessionToken=[^&\s]+/gi, "sessionToken=***");
|
|
615
|
+
sanitized = sanitized.replace(/(?<!session)token=[^&\s]+/gi, "token=***");
|
|
616
|
+
return sanitized;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Resolve the authentication token for relay connection
|
|
620
|
+
*
|
|
621
|
+
* Priority:
|
|
622
|
+
* 1. sessionToken from config
|
|
623
|
+
* 2. relayToken from config
|
|
624
|
+
* 3. OPENCLAW_TALKCHANNEL_RELAY_TOKEN environment variable
|
|
625
|
+
* 4. Create new session (returns pairing code via callback)
|
|
626
|
+
*/
|
|
627
|
+
async function resolveToken(talkchannel, callbacks) {
|
|
628
|
+
const relayUrl = talkchannel.config.relayUrl ?? "https://k.tess.dev/";
|
|
629
|
+
if (talkchannel.config.sessionToken) return {
|
|
630
|
+
token: talkchannel.config.sessionToken,
|
|
631
|
+
relayUrl,
|
|
632
|
+
isNewSession: false
|
|
633
|
+
};
|
|
634
|
+
if (talkchannel.config.relayToken) return {
|
|
635
|
+
token: talkchannel.config.relayToken,
|
|
636
|
+
relayUrl,
|
|
637
|
+
isNewSession: false
|
|
638
|
+
};
|
|
639
|
+
const envToken = process.env.OPENCLAW_TALKCHANNEL_RELAY_TOKEN;
|
|
640
|
+
if (envToken) return {
|
|
641
|
+
token: envToken,
|
|
642
|
+
relayUrl,
|
|
643
|
+
isNewSession: false
|
|
644
|
+
};
|
|
645
|
+
const result = await createSession(relayUrl);
|
|
646
|
+
if (!result.ok) throw new Error(`Failed to create session: ${result.error.message}`);
|
|
647
|
+
callbacks.onPairingRequired?.(result.data.pairingCode, result.data.expiresIn);
|
|
648
|
+
return {
|
|
649
|
+
token: result.data.sessionToken,
|
|
650
|
+
relayUrl,
|
|
651
|
+
isNewSession: true
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
async function startRelayStream(talkchannel, onMessage, abortSignal, opts = {}, callbacks = {}, log) {
|
|
655
|
+
const runtime = getKakaoRuntime();
|
|
656
|
+
const logger = log ?? runtime.logger;
|
|
657
|
+
const options = {
|
|
658
|
+
...DEFAULT_STREAM_OPTIONS,
|
|
659
|
+
...opts
|
|
660
|
+
};
|
|
661
|
+
logger.info(`[kakao:${talkchannel.talkchannelId}] Resolving token...`);
|
|
662
|
+
const { token, relayUrl, isNewSession } = await resolveToken(talkchannel, callbacks);
|
|
663
|
+
logger.info(`[kakao:${talkchannel.talkchannelId}] Token resolved (newSession=${isNewSession})`);
|
|
664
|
+
callbacks.onTokenResolved?.(token, relayUrl);
|
|
665
|
+
const { reconnectDelayMs, maxReconnectDelayMs } = talkchannel.config;
|
|
666
|
+
await connectSSE({
|
|
667
|
+
relayUrl,
|
|
668
|
+
sessionToken: token,
|
|
669
|
+
reconnectDelayMs,
|
|
670
|
+
maxReconnectDelayMs,
|
|
671
|
+
maxRetries: options.maxRetries
|
|
672
|
+
}, {
|
|
673
|
+
onMessage: async (msg) => {
|
|
674
|
+
await onMessage(msg);
|
|
675
|
+
},
|
|
676
|
+
onConnected: () => {
|
|
677
|
+
logger.info(`[kakao:${talkchannel.talkchannelId}] SSE connected to ${relayUrl}`);
|
|
678
|
+
callbacks.onConnected?.();
|
|
679
|
+
},
|
|
680
|
+
onDisconnected: () => {
|
|
681
|
+
callbacks.onDisconnected?.();
|
|
682
|
+
},
|
|
683
|
+
onError: (error) => {
|
|
684
|
+
const sanitizedError = sanitizeTokenFromLog(error.message);
|
|
685
|
+
logger.warn(`[kakao:${talkchannel.talkchannelId}] SSE error: ${sanitizedError}`);
|
|
686
|
+
},
|
|
687
|
+
onReconnect: (attempt) => {
|
|
688
|
+
logger.info(`[kakao:${talkchannel.talkchannelId}] SSE reconnecting (attempt ${attempt}/${options.maxRetries})`);
|
|
689
|
+
},
|
|
690
|
+
onPairingComplete: (data) => {
|
|
691
|
+
logger.info(`[kakao:${talkchannel.talkchannelId}] Pairing complete: ${data.kakaoUserId}`);
|
|
692
|
+
callbacks.onPairingComplete?.(data.kakaoUserId);
|
|
693
|
+
},
|
|
694
|
+
onPairingExpired: (reason) => {
|
|
695
|
+
logger.warn(`[kakao:${talkchannel.talkchannelId}] Pairing expired: ${reason}`);
|
|
696
|
+
callbacks.onPairingExpired?.(reason);
|
|
697
|
+
},
|
|
698
|
+
onSessionInvalidated: (status) => {
|
|
699
|
+
logger.warn(`[kakao:${talkchannel.talkchannelId}] Session invalidated: HTTP ${status}`);
|
|
700
|
+
callbacks.onSessionInvalidated?.(status);
|
|
701
|
+
}
|
|
702
|
+
}, abortSignal);
|
|
703
|
+
}
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region extensions/kakao-talkchannel/src/relay/client.ts
|
|
706
|
+
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
707
|
+
const AUTH_ERROR_STATUSES = new Set([401, 410]);
|
|
708
|
+
var RelayHttpError = class extends Error {
|
|
709
|
+
constructor(status, statusText, detail) {
|
|
710
|
+
super(`HTTP ${status} ${statusText}: ${detail}`);
|
|
711
|
+
this.name = "RelayHttpError";
|
|
712
|
+
this.status = status;
|
|
713
|
+
this.statusText = statusText;
|
|
714
|
+
this.isAuthError = AUTH_ERROR_STATUSES.has(status);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
function isObject(value) {
|
|
718
|
+
return value !== null && typeof value === "object";
|
|
719
|
+
}
|
|
720
|
+
function validateSendReplyResponse(data) {
|
|
721
|
+
if (!isObject(data)) throw new Error("Invalid relay response: expected object");
|
|
722
|
+
if (typeof data.success !== "boolean") throw new Error("Invalid relay response: success must be a boolean");
|
|
723
|
+
return data;
|
|
724
|
+
}
|
|
725
|
+
function createTimeoutSignal(timeoutMs) {
|
|
726
|
+
const controller = new AbortController();
|
|
727
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
728
|
+
return {
|
|
729
|
+
signal: controller.signal,
|
|
730
|
+
clear: () => clearTimeout(timeoutId)
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function parseErrorBody(body) {
|
|
734
|
+
if (body === null || body === void 0) return "Unknown error";
|
|
735
|
+
if (!isObject(body)) return String(body);
|
|
736
|
+
const error = body.error;
|
|
737
|
+
if (typeof error === "string") return error;
|
|
738
|
+
if (isObject(error) && typeof error.message === "string") return error.message;
|
|
739
|
+
if (typeof body.message === "string") return body.message;
|
|
740
|
+
return "Unknown error";
|
|
741
|
+
}
|
|
742
|
+
async function sendReply(config, messageId, response) {
|
|
743
|
+
if (!messageId || typeof messageId !== "string") throw new Error("sendReply: messageId is required and must be a non-empty string");
|
|
744
|
+
if (!config.relayUrl || typeof config.relayUrl !== "string") throw new Error("sendReply: relayUrl is required and must be a non-empty string");
|
|
745
|
+
if (!config.relayToken || typeof config.relayToken !== "string") throw new Error("sendReply: relayToken is required and must be a non-empty string");
|
|
746
|
+
const timeout = createTimeoutSignal(config.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
747
|
+
try {
|
|
748
|
+
const baseUrl = config.relayUrl.endsWith("/") ? config.relayUrl : `${config.relayUrl}/`;
|
|
749
|
+
const fetchResponse = await fetch(`${baseUrl}openclaw/reply`, {
|
|
750
|
+
method: "POST",
|
|
751
|
+
headers: {
|
|
752
|
+
Authorization: `Bearer ${config.relayToken}`,
|
|
753
|
+
"Content-Type": "application/json"
|
|
754
|
+
},
|
|
755
|
+
body: JSON.stringify({
|
|
756
|
+
messageId,
|
|
757
|
+
response
|
|
758
|
+
}),
|
|
759
|
+
signal: timeout.signal
|
|
760
|
+
});
|
|
761
|
+
if (!fetchResponse.ok) {
|
|
762
|
+
const errorBody = await fetchResponse.json().catch(() => ({}));
|
|
763
|
+
throw new RelayHttpError(fetchResponse.status, fetchResponse.statusText, parseErrorBody(errorBody));
|
|
764
|
+
}
|
|
765
|
+
return validateSendReplyResponse(await fetchResponse.json());
|
|
766
|
+
} finally {
|
|
767
|
+
timeout.clear();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region extensions/kakao-talkchannel/src/version.ts
|
|
772
|
+
const PLUGIN_VERSION = "0.5.1";
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region extensions/kakao-talkchannel/src/commands/card.ts
|
|
775
|
+
/**
|
|
776
|
+
* /card ์ปค๋งจ๋ ์ธ์ ํ์ฑ
|
|
777
|
+
*
|
|
778
|
+
* ์
๋ ฅ ํ์: `<type> "arg1" "arg2" --flag1 value1 --flag2 "value2"`
|
|
779
|
+
* - ๋ฐ์ดํ๋ก ๋ฌถ์ธ ๋ฌธ์์ด โ ์์น ์ธ์ (args)
|
|
780
|
+
* - `--key value` ๋๋ `--key "value"` โ ํ๋๊ทธ (flags)
|
|
781
|
+
* - ํ๋๊ทธ์ ๋ฐ์ดํ ๊ฐ์ ์์น ์ธ์๋ก ์ค๋ณต ์์ง๋์ง ์์
|
|
782
|
+
*/
|
|
783
|
+
function parseCardArgs(input) {
|
|
784
|
+
const trimmed = input.trim();
|
|
785
|
+
const typeMatch = trimmed.match(/^(\w+)/);
|
|
786
|
+
if (!typeMatch) return {
|
|
787
|
+
type: "",
|
|
788
|
+
args: [],
|
|
789
|
+
flags: {}
|
|
790
|
+
};
|
|
791
|
+
const type = typeMatch[1].toLowerCase();
|
|
792
|
+
const rest = trimmed.slice(typeMatch[0].length).trim();
|
|
793
|
+
const args = [];
|
|
794
|
+
const flags = {};
|
|
795
|
+
const regex = /--(\w+)\s+(?:"([^"]*?)"|(\S+))|"([^"]*?)"/g;
|
|
796
|
+
let match;
|
|
797
|
+
while ((match = regex.exec(rest)) !== null) if (match[1] !== void 0) flags[match[1]] = match[2] ?? match[3] ?? "";
|
|
798
|
+
else if (match[4] !== void 0) args.push(match[4]);
|
|
799
|
+
return {
|
|
800
|
+
type,
|
|
801
|
+
args,
|
|
802
|
+
flags
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* ๋ฒํผ ๋ฌธ์์ด ํ์ฑ
|
|
807
|
+
*
|
|
808
|
+
* ํ์: "๋ผ๋ฒจ1|๋ฐ์ดํฐ1,๋ผ๋ฒจ2|๋ฐ์ดํฐ2"
|
|
809
|
+
* - ๋ฐ์ดํฐ๊ฐ http(s):// ๋ก ์์ โ webLink
|
|
810
|
+
* - ๋ฐ์ดํฐ๊ฐ ์ ํ๋ฒํธ ํ์ (7์๋ฆฌ ์ด์ ์ซ์/๊ธฐํธ) โ phone
|
|
811
|
+
* - ๊ทธ ์ธ โ message
|
|
812
|
+
* - ์ต๋ 3๊ฐ (์นด์นด์ค ์ ํ)
|
|
813
|
+
*/
|
|
814
|
+
function parseButtons(input) {
|
|
815
|
+
if (!input.trim()) return [];
|
|
816
|
+
return input.split(",").map((item) => item.trim()).filter(Boolean).slice(0, 3).map((item) => {
|
|
817
|
+
const pipeIndex = item.lastIndexOf("|");
|
|
818
|
+
if (pipeIndex === -1) return {
|
|
819
|
+
label: item,
|
|
820
|
+
action: "message",
|
|
821
|
+
messageText: item
|
|
822
|
+
};
|
|
823
|
+
const label = item.slice(0, pipeIndex).trim();
|
|
824
|
+
const data = item.slice(pipeIndex + 1).trim();
|
|
825
|
+
if (data.startsWith("http://") || data.startsWith("https://")) return {
|
|
826
|
+
label,
|
|
827
|
+
action: "webLink",
|
|
828
|
+
webLinkUrl: data
|
|
829
|
+
};
|
|
830
|
+
if (/^[\d\-+\s]+$/.test(data) && data.replace(/\D/g, "").length >= 7) return {
|
|
831
|
+
label,
|
|
832
|
+
action: "phone",
|
|
833
|
+
phoneNumber: data
|
|
834
|
+
};
|
|
835
|
+
return {
|
|
836
|
+
label,
|
|
837
|
+
action: "message",
|
|
838
|
+
messageText: data
|
|
839
|
+
};
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* ๋น ๋ฅธ ์๋ต ๋ฒํผ ํ์ฑ
|
|
844
|
+
*
|
|
845
|
+
* ํ์: "๋ผ๋ฒจ1,๋ผ๋ฒจ2,๋ผ๋ฒจ3"
|
|
846
|
+
* - ๋ชจ๋ message action (messageText = label)
|
|
847
|
+
* - ์ต๋ 10๊ฐ (์นด์นด์ค ์ ํ)
|
|
848
|
+
*/
|
|
849
|
+
function parseQuickReplies(input) {
|
|
850
|
+
if (!input.trim()) return [];
|
|
851
|
+
return input.split(",").map((item) => item.trim()).filter(Boolean).slice(0, 10).map((label) => ({
|
|
852
|
+
label,
|
|
853
|
+
action: "message",
|
|
854
|
+
messageText: label
|
|
855
|
+
}));
|
|
856
|
+
}
|
|
857
|
+
function buildUsageError(type, usage) {
|
|
858
|
+
return {
|
|
859
|
+
version: "2.0",
|
|
860
|
+
template: { outputs: [{ textCard: {
|
|
861
|
+
title: `/card ${type} ์ฌ์ฉ๋ฒ`,
|
|
862
|
+
description: usage
|
|
863
|
+
} }] }
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
function buildTextCard(args, flags) {
|
|
867
|
+
const title = args[0];
|
|
868
|
+
const description = args[1];
|
|
869
|
+
if (!title && !description) return buildUsageError("text", "/card text \"์ ๋ชฉ\" \"์ค๋ช
\" [--buttons \"๋ฒํผ1|url,๋ฒํผ2|msg\"] [--quick \"์ต์
1,์ต์
2\"]");
|
|
870
|
+
const buttons = flags.buttons ? parseButtons(flags.buttons) : void 0;
|
|
871
|
+
const quickReplies = flags.quick ? parseQuickReplies(flags.quick) : void 0;
|
|
872
|
+
return {
|
|
873
|
+
version: "2.0",
|
|
874
|
+
template: {
|
|
875
|
+
outputs: [{ textCard: {
|
|
876
|
+
...title && { title },
|
|
877
|
+
...description && { description },
|
|
878
|
+
...buttons?.length && { buttons }
|
|
879
|
+
} }],
|
|
880
|
+
...quickReplies?.length && { quickReplies }
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
function buildBasicCard(args, flags) {
|
|
885
|
+
const imageUrl = flags.image;
|
|
886
|
+
if (!imageUrl) return buildUsageError("basic", "/card basic \"์ ๋ชฉ\" \"์ค๋ช
\" --image <url> [--buttons \"๋ฒํผ|url\"] [--quick \"์ต์
1,์ต์
2\"]");
|
|
887
|
+
const title = args[0];
|
|
888
|
+
const description = args[1];
|
|
889
|
+
const buttons = flags.buttons ? parseButtons(flags.buttons) : void 0;
|
|
890
|
+
const quickReplies = flags.quick ? parseQuickReplies(flags.quick) : void 0;
|
|
891
|
+
return {
|
|
892
|
+
version: "2.0",
|
|
893
|
+
template: {
|
|
894
|
+
outputs: [{ basicCard: {
|
|
895
|
+
...title && { title },
|
|
896
|
+
...description && { description },
|
|
897
|
+
thumbnail: { imageUrl },
|
|
898
|
+
...buttons?.length && { buttons }
|
|
899
|
+
} }],
|
|
900
|
+
...quickReplies?.length && { quickReplies }
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
function buildListCard(args, flags) {
|
|
905
|
+
const headerTitle = args[0];
|
|
906
|
+
const itemsStr = args[1];
|
|
907
|
+
if (!headerTitle || !itemsStr) return buildUsageError("list", "/card list \"ํค๋\" \"ํญ๋ชฉ1|์ค๋ช
1,ํญ๋ชฉ2|์ค๋ช
2\" [--buttons \"๋ฒํผ|url\"] [--quick \"์ต์
1,์ต์
2\"]");
|
|
908
|
+
const items = itemsStr.split(",").map((item) => item.trim()).filter(Boolean).slice(0, 5).map((item) => {
|
|
909
|
+
const pipeIndex = item.lastIndexOf("|");
|
|
910
|
+
if (pipeIndex === -1) return { title: item };
|
|
911
|
+
const title = item.slice(0, pipeIndex).trim();
|
|
912
|
+
const description = item.slice(pipeIndex + 1).trim() || void 0;
|
|
913
|
+
return {
|
|
914
|
+
title,
|
|
915
|
+
...description && { description }
|
|
916
|
+
};
|
|
917
|
+
});
|
|
918
|
+
if (items.length < 2) return buildUsageError("list", "listCard๋ ํญ๋ชฉ์ด ์ต์ 2๊ฐ ํ์ํฉ๋๋ค. ์: \"ํญ๋ชฉ1|์ค๋ช
1,ํญ๋ชฉ2|์ค๋ช
2\"");
|
|
919
|
+
const buttons = flags.buttons ? parseButtons(flags.buttons) : void 0;
|
|
920
|
+
const quickReplies = flags.quick ? parseQuickReplies(flags.quick) : void 0;
|
|
921
|
+
return {
|
|
922
|
+
version: "2.0",
|
|
923
|
+
template: {
|
|
924
|
+
outputs: [{ listCard: {
|
|
925
|
+
header: { title: headerTitle },
|
|
926
|
+
items,
|
|
927
|
+
...buttons?.length && { buttons }
|
|
928
|
+
} }],
|
|
929
|
+
...quickReplies?.length && { quickReplies }
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
function buildCommerceCard(args, flags) {
|
|
934
|
+
const title = args[0];
|
|
935
|
+
const priceStr = flags.price;
|
|
936
|
+
if (!title || !priceStr) return buildUsageError("commerce", "/card commerce \"์ํ๋ช
\" --price 15000 [--description \"์ค๋ช
\"] [--discount 2000] [--image <url>] [--buttons \"๋ฒํผ|url\"]");
|
|
937
|
+
const price = parseInt(priceStr, 10);
|
|
938
|
+
if (isNaN(price)) return buildUsageError("commerce", "๊ฐ๊ฒฉ์ ์ซ์์ฌ์ผ ํฉ๋๋ค. ์: --price 15000");
|
|
939
|
+
const imageUrl = flags.image;
|
|
940
|
+
if (!imageUrl) return buildUsageError("commerce", "/card commerce \"์ํ๋ช
\" --price 15000 --image <url> [--description \"์ค๋ช
\"] [--discount 2000] [--buttons \"๋ฒํผ|url\"]");
|
|
941
|
+
const description = flags.description ?? args[1];
|
|
942
|
+
let discount;
|
|
943
|
+
if (flags.discount !== void 0) {
|
|
944
|
+
discount = parseInt(flags.discount, 10);
|
|
945
|
+
if (isNaN(discount)) return buildUsageError("commerce", "ํ ์ธ ๊ธ์ก์ ์ซ์์ฌ์ผ ํฉ๋๋ค. ์: --discount 2000");
|
|
946
|
+
}
|
|
947
|
+
const buttons = flags.buttons ? parseButtons(flags.buttons) : void 0;
|
|
948
|
+
const quickReplies = flags.quick ? parseQuickReplies(flags.quick) : void 0;
|
|
949
|
+
return {
|
|
950
|
+
version: "2.0",
|
|
951
|
+
template: {
|
|
952
|
+
outputs: [{ commerceCard: {
|
|
953
|
+
title,
|
|
954
|
+
...description && { description },
|
|
955
|
+
price,
|
|
956
|
+
currency: "won",
|
|
957
|
+
...discount !== void 0 && { discount },
|
|
958
|
+
thumbnails: [{ imageUrl }],
|
|
959
|
+
...buttons?.length && { buttons }
|
|
960
|
+
} }],
|
|
961
|
+
...quickReplies?.length && { quickReplies }
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
function buildCardHelpResponse() {
|
|
966
|
+
return {
|
|
967
|
+
version: "2.0",
|
|
968
|
+
template: { outputs: [{ listCard: {
|
|
969
|
+
header: { title: "์นด๋ ์ปค๋งจ๋ ๋ชฉ๋ก" },
|
|
970
|
+
items: [
|
|
971
|
+
{
|
|
972
|
+
title: "/card text",
|
|
973
|
+
description: "\"์ ๋ชฉ\" \"์ค๋ช
\" [--buttons] [--quick]"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
title: "/card basic",
|
|
977
|
+
description: "\"์ ๋ชฉ\" \"์ค๋ช
\" --image <url> [--buttons]"
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
title: "/card list",
|
|
981
|
+
description: "\"ํค๋\" \"ํญ๋ชฉ1|์ค๋ช
,ํญ๋ชฉ2|์ค๋ช
\" [--buttons]"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
title: "/card commerce",
|
|
985
|
+
description: "\"์ํ๋ช
\" --price 15000 --image <url> [--discount]"
|
|
986
|
+
}
|
|
987
|
+
]
|
|
988
|
+
} }] }
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
async function handleCardCommand(msg, _account, _accountId, relayUrl, relayToken, log) {
|
|
992
|
+
const messageText = msg.normalized.text?.trim() ?? "";
|
|
993
|
+
const argsStr = messageText.slice(5).trim();
|
|
994
|
+
let response;
|
|
995
|
+
if (!argsStr) response = buildCardHelpResponse();
|
|
996
|
+
else {
|
|
997
|
+
const { type, args, flags } = parseCardArgs(argsStr);
|
|
998
|
+
switch (type) {
|
|
999
|
+
case "text":
|
|
1000
|
+
response = buildTextCard(args, flags);
|
|
1001
|
+
break;
|
|
1002
|
+
case "basic":
|
|
1003
|
+
response = buildBasicCard(args, flags);
|
|
1004
|
+
break;
|
|
1005
|
+
case "list":
|
|
1006
|
+
response = buildListCard(args, flags);
|
|
1007
|
+
break;
|
|
1008
|
+
case "commerce":
|
|
1009
|
+
response = buildCommerceCard(args, flags);
|
|
1010
|
+
break;
|
|
1011
|
+
default: response = buildCardHelpResponse();
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
log?.info(`[kakao-talkchannel] /card: ${messageText.slice(0, 60)}`);
|
|
1015
|
+
await sendReply({
|
|
1016
|
+
relayUrl,
|
|
1017
|
+
relayToken
|
|
1018
|
+
}, msg.id, response);
|
|
1019
|
+
}
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region extensions/kakao-talkchannel/src/adapters/gateway.ts
|
|
1022
|
+
const MAX_USER_ACTIVITY_SIZE = 1e4;
|
|
1023
|
+
const CLEANUP_INTERVAL = 100;
|
|
1024
|
+
let cleanupCounter = 0;
|
|
1025
|
+
const userActivity = /* @__PURE__ */ new Map();
|
|
1026
|
+
/**
|
|
1027
|
+
* TTL ๋ง๋ฃ๋ ํญ๋ชฉ ์ ๋ฆฌ
|
|
1028
|
+
*/
|
|
1029
|
+
function cleanupExpiredUserActivity() {
|
|
1030
|
+
const now = Date.now();
|
|
1031
|
+
let removed = 0;
|
|
1032
|
+
for (const [key, activity] of userActivity) if (now - activity.lastAccessedAt > 864e5) {
|
|
1033
|
+
userActivity.delete(key);
|
|
1034
|
+
removed++;
|
|
1035
|
+
}
|
|
1036
|
+
return removed;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* ์ฃผ๊ธฐ์ ์ ๋ฆฌ ํธ๋ฆฌ๊ฑฐ (๋งค CLEANUP_INTERVAL ํธ์ถ๋ง๋ค)
|
|
1040
|
+
*/
|
|
1041
|
+
function maybeCleanup() {
|
|
1042
|
+
cleanupCounter++;
|
|
1043
|
+
if (cleanupCounter >= CLEANUP_INTERVAL) {
|
|
1044
|
+
cleanupCounter = 0;
|
|
1045
|
+
cleanupExpiredUserActivity();
|
|
1046
|
+
if (userActivity.size > 1e4) {
|
|
1047
|
+
const entries = [...userActivity.entries()].sort((a, b) => a[1].lastAccessedAt - b[1].lastAccessedAt);
|
|
1048
|
+
const toRemove = userActivity.size - MAX_USER_ACTIVITY_SIZE;
|
|
1049
|
+
for (let i = 0; i < toRemove; i++) userActivity.delete(entries[i][0]);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* ์ฌ์ฉ์ ํ๋ ์
๋ฐ์ดํธ ๋ฐ ๊ฒฝ๊ณ ํ์ ์ฌ๋ถ ํ๋จ
|
|
1055
|
+
* 50๊ฐ ๋ฉ์์ง๋ง๋ค ๊ฒฝ๊ณ ํ๋, ๋ง์ง๋ง ๊ฒฝ๊ณ ํ ์ต์ 50๊ฐ ๊ฐ๊ฒฉ ์ ์ง
|
|
1056
|
+
*/
|
|
1057
|
+
function shouldShowSessionWarning(userId) {
|
|
1058
|
+
maybeCleanup();
|
|
1059
|
+
const activity = userActivity.get(userId) || {
|
|
1060
|
+
messageCount: 0,
|
|
1061
|
+
lastWarningCount: -50,
|
|
1062
|
+
lastAccessedAt: Date.now()
|
|
1063
|
+
};
|
|
1064
|
+
activity.messageCount++;
|
|
1065
|
+
activity.lastAccessedAt = Date.now();
|
|
1066
|
+
userActivity.set(userId, activity);
|
|
1067
|
+
const isCheckpoint = activity.messageCount % 50 === 0;
|
|
1068
|
+
const enoughGap = activity.messageCount - activity.lastWarningCount >= 50;
|
|
1069
|
+
if (isCheckpoint && enoughGap) {
|
|
1070
|
+
activity.lastWarningCount = activity.messageCount;
|
|
1071
|
+
userActivity.set(userId, activity);
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* ๋ฉ์์ง ํ
์คํธ์์ ์นด์นด์ค ์นด๋ JSON ๊ฐ์ง
|
|
1078
|
+
* JSON ํํ์ด๊ณ ์นด๋ ํค๊ฐ ์์ผ๋ฉด ํ์ฑํ์ฌ ๋ฐํ
|
|
1079
|
+
*/
|
|
1080
|
+
function tryParseKakaoCard(text) {
|
|
1081
|
+
const trimmed = text.trim();
|
|
1082
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) return null;
|
|
1083
|
+
try {
|
|
1084
|
+
const parsed = JSON.parse(trimmed);
|
|
1085
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
|
|
1086
|
+
const objectCardKeys = [
|
|
1087
|
+
"textCard",
|
|
1088
|
+
"basicCard",
|
|
1089
|
+
"listCard",
|
|
1090
|
+
"commerceCard",
|
|
1091
|
+
"itemCard",
|
|
1092
|
+
"carousel",
|
|
1093
|
+
"simpleText",
|
|
1094
|
+
"simpleImage"
|
|
1095
|
+
];
|
|
1096
|
+
const arrayCardKeys = ["quickReplies", "outputs"];
|
|
1097
|
+
let hasValidCard = false;
|
|
1098
|
+
for (const key of objectCardKeys) if (key in parsed) {
|
|
1099
|
+
if (typeof parsed[key] !== "object" || parsed[key] === null || Array.isArray(parsed[key])) return null;
|
|
1100
|
+
hasValidCard = true;
|
|
1101
|
+
}
|
|
1102
|
+
for (const key of arrayCardKeys) if (key in parsed) {
|
|
1103
|
+
if (!Array.isArray(parsed[key])) return null;
|
|
1104
|
+
hasValidCard = true;
|
|
1105
|
+
}
|
|
1106
|
+
if (hasValidCard) return parsed;
|
|
1107
|
+
} catch {}
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
function buildOutputsFromChannelData(kakaoData) {
|
|
1111
|
+
if (kakaoData.outputs && kakaoData.outputs.length > 0) return kakaoData.outputs;
|
|
1112
|
+
const outputs = [];
|
|
1113
|
+
if (kakaoData.simpleText) outputs.push({ simpleText: kakaoData.simpleText });
|
|
1114
|
+
if (kakaoData.simpleImage) outputs.push({ simpleImage: kakaoData.simpleImage });
|
|
1115
|
+
if (kakaoData.textCard) outputs.push({ textCard: kakaoData.textCard });
|
|
1116
|
+
if (kakaoData.basicCard) outputs.push({ basicCard: kakaoData.basicCard });
|
|
1117
|
+
if (kakaoData.commerceCard) outputs.push({ commerceCard: kakaoData.commerceCard });
|
|
1118
|
+
if (kakaoData.listCard) outputs.push({ listCard: kakaoData.listCard });
|
|
1119
|
+
if (kakaoData.itemCard) outputs.push({ itemCard: kakaoData.itemCard });
|
|
1120
|
+
if (kakaoData.carousel) outputs.push({ carousel: kakaoData.carousel });
|
|
1121
|
+
return outputs;
|
|
1122
|
+
}
|
|
1123
|
+
const pendingPairingInfoMap = /* @__PURE__ */ new Map();
|
|
1124
|
+
const activeSessionTokenMap = /* @__PURE__ */ new Map();
|
|
1125
|
+
function invalidateSessionToken(accountId, reason, log) {
|
|
1126
|
+
if (activeSessionTokenMap.delete(accountId)) log?.warn(`[kakao-talkchannel] Session token invalidated for ${accountId}: ${reason}`);
|
|
1127
|
+
}
|
|
1128
|
+
function getPendingPairingInfo(accountId) {
|
|
1129
|
+
if (accountId) {
|
|
1130
|
+
const info = pendingPairingInfoMap.get(accountId) ?? null;
|
|
1131
|
+
pendingPairingInfoMap.delete(accountId);
|
|
1132
|
+
return info;
|
|
1133
|
+
}
|
|
1134
|
+
const first = pendingPairingInfoMap.entries().next();
|
|
1135
|
+
if (first.done) return null;
|
|
1136
|
+
pendingPairingInfoMap.delete(first.value[0]);
|
|
1137
|
+
return first.value[1];
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Build moldClaw message context from InboundMessage
|
|
1141
|
+
*/
|
|
1142
|
+
function buildMessageContext(msg, account, accountId) {
|
|
1143
|
+
const { normalized } = msg;
|
|
1144
|
+
const sessionKey = `agent:main:kakao-talkchannel:dm:${normalized.userId}`;
|
|
1145
|
+
return {
|
|
1146
|
+
Body: normalized.text,
|
|
1147
|
+
RawBody: normalized.text,
|
|
1148
|
+
BodyForAgent: normalized.text,
|
|
1149
|
+
BodyForCommands: normalized.text,
|
|
1150
|
+
From: `kakao:${normalized.userId}`,
|
|
1151
|
+
To: `kakao:${normalized.channelId}`,
|
|
1152
|
+
Provider: "kakao-talkchannel",
|
|
1153
|
+
Surface: "kakao-talkchannel",
|
|
1154
|
+
MessageSid: msg.id,
|
|
1155
|
+
MessageSidFull: msg.id,
|
|
1156
|
+
SessionKey: sessionKey,
|
|
1157
|
+
AccountId: accountId,
|
|
1158
|
+
ChatType: "direct",
|
|
1159
|
+
Timestamp: msg.createdAt ? new Date(msg.createdAt).getTime() : Date.now(),
|
|
1160
|
+
SenderId: normalized.userId,
|
|
1161
|
+
CommandAuthorized: true
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* /help ๋๋ /? - ์ฌ์ฉ ๊ฐ์ด๋ ์บ๋ฌ์
(3์ฅ)
|
|
1166
|
+
*/
|
|
1167
|
+
async function handleHelpCommand(msg, account, _accountId, relayUrl, relayToken, log) {
|
|
1168
|
+
const response = {
|
|
1169
|
+
version: "2.0",
|
|
1170
|
+
template: {
|
|
1171
|
+
outputs: [{ carousel: {
|
|
1172
|
+
type: "itemCard",
|
|
1173
|
+
items: [
|
|
1174
|
+
{
|
|
1175
|
+
thumbnail: {
|
|
1176
|
+
imageUrl: "https://raw.githubusercontent.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/main/images/openclaw-icon.png",
|
|
1177
|
+
fixedRatio: true
|
|
1178
|
+
},
|
|
1179
|
+
head: { title: "๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ" },
|
|
1180
|
+
itemList: [
|
|
1181
|
+
{
|
|
1182
|
+
title: "/help, /?",
|
|
1183
|
+
description: "๋์๋ง ๋ณด๊ธฐ"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
title: "/session, /s",
|
|
1187
|
+
description: "์ธ์
์ ๋ณด ํ์ธ"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
title: "/relay",
|
|
1191
|
+
description: "์๋ฒ ์ํ ํ์ธ"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
title: "/about",
|
|
1195
|
+
description: "ํ๋ฌ๊ทธ์ธ ์ ๋ณด"
|
|
1196
|
+
}
|
|
1197
|
+
],
|
|
1198
|
+
buttons: [{
|
|
1199
|
+
label: "GitHub",
|
|
1200
|
+
action: "webLink",
|
|
1201
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin"
|
|
1202
|
+
}]
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
thumbnail: {
|
|
1206
|
+
imageUrl: "https://raw.githubusercontent.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/main/images/lobster-emoji-large-google.png",
|
|
1207
|
+
fixedRatio: true
|
|
1208
|
+
},
|
|
1209
|
+
head: { title: "์ธ์
๊ด๋ฆฌ" },
|
|
1210
|
+
itemList: [
|
|
1211
|
+
{
|
|
1212
|
+
title: "/compact",
|
|
1213
|
+
description: "ํ์คํ ๋ฆฌ ์์ถ"
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
title: "/reset",
|
|
1217
|
+
description: "์ธ์
์ด๊ธฐํ"
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
title: "/session, /s",
|
|
1221
|
+
description: "์ธ์
์ ๋ณด ํ์ธ"
|
|
1222
|
+
}
|
|
1223
|
+
],
|
|
1224
|
+
buttons: [{
|
|
1225
|
+
label: "compact",
|
|
1226
|
+
action: "message",
|
|
1227
|
+
messageText: "/compact"
|
|
1228
|
+
}, {
|
|
1229
|
+
label: "reset",
|
|
1230
|
+
action: "message",
|
|
1231
|
+
messageText: "/reset"
|
|
1232
|
+
}],
|
|
1233
|
+
buttonLayout: "horizontal"
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
thumbnail: {
|
|
1237
|
+
imageUrl: "https://raw.githubusercontent.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/main/images/github-social.png",
|
|
1238
|
+
fixedRatio: true
|
|
1239
|
+
},
|
|
1240
|
+
head: { title: "๋ฆด๋ ์ด ์๋ฒ" },
|
|
1241
|
+
itemList: [
|
|
1242
|
+
{
|
|
1243
|
+
title: "/pair",
|
|
1244
|
+
description: "ํ์ด๋ง ์ฝ๋๋ก ์ฐ๊ฒฐ"
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
title: "/unpair",
|
|
1248
|
+
description: "์ฐ๊ฒฐ ํด์ "
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
title: "/status",
|
|
1252
|
+
description: "์ฐ๊ฒฐ ์ํ ํ์ธ"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
title: "/code",
|
|
1256
|
+
description: "์ ์ ์ฝ๋ ์์ฑ"
|
|
1257
|
+
}
|
|
1258
|
+
],
|
|
1259
|
+
buttons: [{
|
|
1260
|
+
label: "๋ฆด๋ ์ด ์๋ฒ",
|
|
1261
|
+
action: "webLink",
|
|
1262
|
+
webLinkUrl: "https://k.tess.dev"
|
|
1263
|
+
}]
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
thumbnail: {
|
|
1267
|
+
imageUrl: "https://raw.githubusercontent.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/main/images/github-logo.webp",
|
|
1268
|
+
fixedRatio: true
|
|
1269
|
+
},
|
|
1270
|
+
head: { title: "๋งํฌ & ์ ๋ณด" },
|
|
1271
|
+
itemList: [{
|
|
1272
|
+
title: "/github",
|
|
1273
|
+
description: "์์ค์ฝ๋ ๋ณด๊ธฐ"
|
|
1274
|
+
}, {
|
|
1275
|
+
title: "/about",
|
|
1276
|
+
description: "ํ๋ฌ๊ทธ์ธ ์ ๋ณด"
|
|
1277
|
+
}],
|
|
1278
|
+
buttons: [{
|
|
1279
|
+
label: "์ด์ ์ ๋ณด",
|
|
1280
|
+
action: "webLink",
|
|
1281
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/issues"
|
|
1282
|
+
}, {
|
|
1283
|
+
label: "README",
|
|
1284
|
+
action: "webLink",
|
|
1285
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin#readme"
|
|
1286
|
+
}],
|
|
1287
|
+
buttonLayout: "horizontal"
|
|
1288
|
+
}
|
|
1289
|
+
]
|
|
1290
|
+
} }],
|
|
1291
|
+
quickReplies: [
|
|
1292
|
+
{
|
|
1293
|
+
label: "session",
|
|
1294
|
+
action: "message",
|
|
1295
|
+
messageText: "/session"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
label: "reset",
|
|
1299
|
+
action: "message",
|
|
1300
|
+
messageText: "/reset"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
label: "about",
|
|
1304
|
+
action: "message",
|
|
1305
|
+
messageText: "/about"
|
|
1306
|
+
}
|
|
1307
|
+
]
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
try {
|
|
1311
|
+
await sendReply({
|
|
1312
|
+
relayUrl,
|
|
1313
|
+
relayToken
|
|
1314
|
+
}, msg.id, response);
|
|
1315
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Help carousel sent`);
|
|
1316
|
+
} catch (err) {
|
|
1317
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1318
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Help command failed: ${errMsg}`);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* /github - GitHub ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฐ๋ก๊ฐ๊ธฐ
|
|
1323
|
+
*/
|
|
1324
|
+
async function handleGithubCommand(msg, account, _accountId, relayUrl, relayToken, log) {
|
|
1325
|
+
const response = {
|
|
1326
|
+
version: "2.0",
|
|
1327
|
+
template: { outputs: [{ basicCard: {
|
|
1328
|
+
title: "๐ฆ moldClaw Kakao TalkChannel",
|
|
1329
|
+
description: "GitHub ๋ฆฌํฌ์งํ ๋ฆฌ\n\nโญ Star & ๊ธฐ์ฌ ํ์!\n๐ README์์ ์์ธํ ์ฌ์ฉ๋ฒ ํ์ธ\n๐ ์ด์ ์ ๋ณด ๋ฐ ๊ธฐ๋ฅ ์ ์",
|
|
1330
|
+
thumbnail: { imageUrl: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" },
|
|
1331
|
+
buttons: [
|
|
1332
|
+
{
|
|
1333
|
+
label: "๋ฆฌํฌ์งํ ๋ฆฌ ์ด๊ธฐ",
|
|
1334
|
+
action: "webLink",
|
|
1335
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
label: "์ด์ ์ ๋ณด",
|
|
1339
|
+
action: "webLink",
|
|
1340
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin/issues"
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
label: "README",
|
|
1344
|
+
action: "webLink",
|
|
1345
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin#readme"
|
|
1346
|
+
}
|
|
1347
|
+
]
|
|
1348
|
+
} }] }
|
|
1349
|
+
};
|
|
1350
|
+
try {
|
|
1351
|
+
await sendReply({
|
|
1352
|
+
relayUrl,
|
|
1353
|
+
relayToken
|
|
1354
|
+
}, msg.id, response);
|
|
1355
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] GitHub card sent`);
|
|
1356
|
+
} catch (err) {
|
|
1357
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1358
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] GitHub command failed: ${errMsg}`);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* /about - ํ๋ฌ๊ทธ์ธ ์ ๋ณด
|
|
1363
|
+
*/
|
|
1364
|
+
async function handleAboutCommand(msg, account, _accountId, relayUrl, relayToken, log) {
|
|
1365
|
+
const response = {
|
|
1366
|
+
version: "2.0",
|
|
1367
|
+
template: { outputs: [{ listCard: {
|
|
1368
|
+
header: { title: "โน๏ธ ํ๋ฌ๊ทธ์ธ ์ ๋ณด" },
|
|
1369
|
+
items: [
|
|
1370
|
+
{
|
|
1371
|
+
title: "๋ฒ์ ",
|
|
1372
|
+
description: `v${PLUGIN_VERSION}`
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
title: "ํจํค์ง",
|
|
1376
|
+
description: "@moldclaw/kakao-talkchannel"
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
title: "์ค๋ช
",
|
|
1380
|
+
description: "Kakao TalkChannel โ moldClaw ์ฐ๊ฒฐ"
|
|
1381
|
+
}
|
|
1382
|
+
],
|
|
1383
|
+
buttons: [{
|
|
1384
|
+
label: "GitHub",
|
|
1385
|
+
action: "webLink",
|
|
1386
|
+
webLinkUrl: "https://github.com/kakao-bart-lee/openclaw-kakao-talkchannel-plugin"
|
|
1387
|
+
}, {
|
|
1388
|
+
label: "๋์๋ง",
|
|
1389
|
+
action: "message",
|
|
1390
|
+
messageText: "/help"
|
|
1391
|
+
}]
|
|
1392
|
+
} }] }
|
|
1393
|
+
};
|
|
1394
|
+
try {
|
|
1395
|
+
await sendReply({
|
|
1396
|
+
relayUrl,
|
|
1397
|
+
relayToken
|
|
1398
|
+
}, msg.id, response);
|
|
1399
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] About card sent`);
|
|
1400
|
+
} catch (err) {
|
|
1401
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1402
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] About command failed: ${errMsg}`);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* /relay - ๋ฆด๋ ์ด ์๋ฒ ์ํ ํ์ธ
|
|
1407
|
+
*/
|
|
1408
|
+
async function handleRelayCommand(msg, account, _accountId, relayUrl, relayToken, log) {
|
|
1409
|
+
const startTime = Date.now();
|
|
1410
|
+
let status = "โ ์ฐ๊ฒฐ ์คํจ";
|
|
1411
|
+
let latency = "N/A";
|
|
1412
|
+
let sessionStatus = "์ ์ ์์";
|
|
1413
|
+
try {
|
|
1414
|
+
const healthUrl = `${relayUrl}health`;
|
|
1415
|
+
const healthResponse = await fetch(healthUrl, {
|
|
1416
|
+
method: "GET",
|
|
1417
|
+
headers: { "Authorization": `Bearer ${relayToken}` }
|
|
1418
|
+
});
|
|
1419
|
+
if (healthResponse.ok) {
|
|
1420
|
+
const responseTime = Date.now() - startTime;
|
|
1421
|
+
status = "โ
์ ์";
|
|
1422
|
+
latency = `${responseTime}ms`;
|
|
1423
|
+
sessionStatus = relayToken ? "ํ์ด๋ง ์๋ฃ" : "ํ ํฐ ์์";
|
|
1424
|
+
} else status = `โ ๏ธ HTTP ${healthResponse.status}`;
|
|
1425
|
+
} catch (err) {
|
|
1426
|
+
status = "โ ์ฐ๊ฒฐ ์คํจ";
|
|
1427
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Relay health check failed: ${err}`);
|
|
1428
|
+
}
|
|
1429
|
+
const response = {
|
|
1430
|
+
version: "2.0",
|
|
1431
|
+
template: { outputs: [{ textCard: {
|
|
1432
|
+
title: "๐ ๋ฆด๋ ์ด ์๋ฒ ์ํ",
|
|
1433
|
+
description: `์๋ฒ: ${relayUrl}\n์ํ: ${status}\n์๋ต์๊ฐ: ${latency}\n์ธ์
: ${sessionStatus}`,
|
|
1434
|
+
buttons: [{
|
|
1435
|
+
label: "์ฌํ์ธ",
|
|
1436
|
+
action: "message",
|
|
1437
|
+
messageText: "/relay"
|
|
1438
|
+
}, {
|
|
1439
|
+
label: "์ธ์
์ ๋ณด",
|
|
1440
|
+
action: "message",
|
|
1441
|
+
messageText: "/session"
|
|
1442
|
+
}]
|
|
1443
|
+
} }] }
|
|
1444
|
+
};
|
|
1445
|
+
try {
|
|
1446
|
+
await sendReply({
|
|
1447
|
+
relayUrl,
|
|
1448
|
+
relayToken
|
|
1449
|
+
}, msg.id, response);
|
|
1450
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Relay status sent`);
|
|
1451
|
+
} catch (err) {
|
|
1452
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1453
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Relay command failed: ${errMsg}`);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* /session - ์ธ์
์ ๋ณด
|
|
1458
|
+
*/
|
|
1459
|
+
async function handleSessionCommand(msg, account, _accountId, relayUrl, relayToken, log) {
|
|
1460
|
+
const userId = msg.normalized.userId;
|
|
1461
|
+
const activity = userActivity.get(userId);
|
|
1462
|
+
const messageCount = activity?.messageCount || 0;
|
|
1463
|
+
const lastWarningCount = activity?.lastWarningCount || 0;
|
|
1464
|
+
const response = {
|
|
1465
|
+
version: "2.0",
|
|
1466
|
+
template: { outputs: [{ textCard: {
|
|
1467
|
+
title: "๐ ํ์ฌ ์ธ์
",
|
|
1468
|
+
description: `๋ฉ์์ง: ${messageCount}๊ฐ\n๋ง์ง๋ง ๊ฒฝ๊ณ : ${lastWarningCount > 0 ? lastWarningCount + "๊ฐ ์์ " : "์์"}\nํ์ด๋ง: โ
${userId}\nํ ํฐ: ${relayToken ? "์ฐ๊ฒฐ๋จ" : "์์"}`,
|
|
1469
|
+
buttons: [{
|
|
1470
|
+
label: "compact",
|
|
1471
|
+
action: "message",
|
|
1472
|
+
messageText: "/compact"
|
|
1473
|
+
}, {
|
|
1474
|
+
label: "reset",
|
|
1475
|
+
action: "message",
|
|
1476
|
+
messageText: "/reset"
|
|
1477
|
+
}],
|
|
1478
|
+
buttonLayout: "horizontal"
|
|
1479
|
+
} }] }
|
|
1480
|
+
};
|
|
1481
|
+
try {
|
|
1482
|
+
await sendReply({
|
|
1483
|
+
relayUrl,
|
|
1484
|
+
relayToken
|
|
1485
|
+
}, msg.id, response);
|
|
1486
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Session info sent`);
|
|
1487
|
+
} catch (err) {
|
|
1488
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1489
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Session command failed: ${errMsg}`);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* ํ๋ฌ๊ทธ์ธ ์ปค๋งจ๋ ๋งต
|
|
1494
|
+
*/
|
|
1495
|
+
const PLUGIN_COMMANDS = {
|
|
1496
|
+
"/help": handleHelpCommand,
|
|
1497
|
+
"/?": handleHelpCommand,
|
|
1498
|
+
"/github": handleGithubCommand,
|
|
1499
|
+
"/about": handleAboutCommand,
|
|
1500
|
+
"/relay": handleRelayCommand,
|
|
1501
|
+
"/session": handleSessionCommand,
|
|
1502
|
+
"/s": handleSessionCommand,
|
|
1503
|
+
"/card": handleCardCommand
|
|
1504
|
+
};
|
|
1505
|
+
/**
|
|
1506
|
+
* Handle inbound message by dispatching to moldClaw agent system
|
|
1507
|
+
*/
|
|
1508
|
+
async function handleInboundMessage(msg, account, accountId, cfg, log) {
|
|
1509
|
+
const channel = getKakaoRuntime().channel;
|
|
1510
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Received message: ${msg.id}`);
|
|
1511
|
+
const activeSession = activeSessionTokenMap.get(accountId);
|
|
1512
|
+
const relayUrl = activeSession?.relayUrl ?? account.config.relayUrl ?? "https://k.tess.dev/";
|
|
1513
|
+
const relayToken = activeSession?.sessionToken ?? account.config.sessionToken ?? account.config.relayToken ?? "";
|
|
1514
|
+
const messageText = msg.normalized.text?.trim() ?? "";
|
|
1515
|
+
if (messageText.startsWith("/")) {
|
|
1516
|
+
const command = messageText.split(" ")[0].toLowerCase();
|
|
1517
|
+
const handler = PLUGIN_COMMANDS[command];
|
|
1518
|
+
if (handler) {
|
|
1519
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Plugin command: ${command}`);
|
|
1520
|
+
try {
|
|
1521
|
+
await handler(msg, account, accountId, relayUrl, relayToken, log);
|
|
1522
|
+
} catch (err) {
|
|
1523
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1524
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Command ${command} error: ${errMsg}`);
|
|
1525
|
+
try {
|
|
1526
|
+
await sendReply({
|
|
1527
|
+
relayUrl,
|
|
1528
|
+
relayToken
|
|
1529
|
+
}, msg.id, {
|
|
1530
|
+
version: "2.0",
|
|
1531
|
+
template: { outputs: [{ simpleText: { text: `๋ช
๋ น์ด ์ฒ๋ฆฌ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: ${errMsg}` } }] }
|
|
1532
|
+
});
|
|
1533
|
+
} catch (replyErr) {
|
|
1534
|
+
const replyErrMsg = replyErr instanceof Error ? replyErr.message : String(replyErr);
|
|
1535
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Failed to send error feedback: ${replyErrMsg}`);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
const userId = msg.normalized.userId;
|
|
1542
|
+
const shouldWarn = shouldShowSessionWarning(userId);
|
|
1543
|
+
if (shouldWarn) log?.info(`[kakao-talkchannel:${account.talkchannelId}] Session warning triggered for ${userId}`);
|
|
1544
|
+
const rawCtx = buildMessageContext(msg, account, accountId);
|
|
1545
|
+
const ctxPayload = channel.reply.finalizeInboundContext(rawCtx);
|
|
1546
|
+
await channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
1547
|
+
ctx: ctxPayload,
|
|
1548
|
+
cfg,
|
|
1549
|
+
dispatcherOptions: {
|
|
1550
|
+
deliver: async (payload) => {
|
|
1551
|
+
const outboundPayload = payload;
|
|
1552
|
+
const template = { outputs: [] };
|
|
1553
|
+
const kakaoData = outboundPayload.channelData?.kakao;
|
|
1554
|
+
if (kakaoData) {
|
|
1555
|
+
const channelOutputs = buildOutputsFromChannelData(kakaoData);
|
|
1556
|
+
template.outputs.push(...channelOutputs);
|
|
1557
|
+
if (kakaoData.quickReplies && kakaoData.quickReplies.length > 0) template.quickReplies = kakaoData.quickReplies.slice(0, 10);
|
|
1558
|
+
}
|
|
1559
|
+
if (template.outputs.length === 0) {
|
|
1560
|
+
if (outboundPayload.mediaUrls && outboundPayload.mediaUrls.length > 0) for (const url of outboundPayload.mediaUrls.slice(0, 3)) template.outputs.push({ simpleImage: { imageUrl: url } });
|
|
1561
|
+
if (outboundPayload.text) {
|
|
1562
|
+
const cardData = tryParseKakaoCard(outboundPayload.text);
|
|
1563
|
+
if (cardData) {
|
|
1564
|
+
const cardOutputs = buildOutputsFromChannelData(cardData);
|
|
1565
|
+
template.outputs.push(...cardOutputs);
|
|
1566
|
+
if (cardData.quickReplies && cardData.quickReplies.length > 0) template.quickReplies = cardData.quickReplies.slice(0, 10);
|
|
1567
|
+
} else {
|
|
1568
|
+
const plainText = stripMarkdown(outboundPayload.text);
|
|
1569
|
+
template.outputs.push({ simpleText: { text: plainText } });
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
if (template.outputs.length === 0) return;
|
|
1574
|
+
template.outputs = template.outputs.slice(0, 3);
|
|
1575
|
+
if (shouldWarn) {
|
|
1576
|
+
const messageCount = userActivity.get(msg.normalized.userId)?.messageCount || 0;
|
|
1577
|
+
if (!template.quickReplies) template.quickReplies = [];
|
|
1578
|
+
template.quickReplies.unshift({
|
|
1579
|
+
label: `๐ก /compact (${messageCount}๊ฐ)`,
|
|
1580
|
+
action: "message",
|
|
1581
|
+
messageText: "/compact"
|
|
1582
|
+
}, {
|
|
1583
|
+
label: "๋์๋ง",
|
|
1584
|
+
action: "message",
|
|
1585
|
+
messageText: "์ธ์
๊ด๋ฆฌ๊ฐ ๋ญ์ผ?"
|
|
1586
|
+
});
|
|
1587
|
+
template.quickReplies = template.quickReplies.slice(0, 10);
|
|
1588
|
+
}
|
|
1589
|
+
const response = {
|
|
1590
|
+
version: "2.0",
|
|
1591
|
+
template
|
|
1592
|
+
};
|
|
1593
|
+
try {
|
|
1594
|
+
await sendReply({
|
|
1595
|
+
relayUrl,
|
|
1596
|
+
relayToken
|
|
1597
|
+
}, msg.id, response);
|
|
1598
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Reply sent for ${msg.id}`);
|
|
1599
|
+
} catch (err) {
|
|
1600
|
+
if (err instanceof RelayHttpError && err.isAuthError) invalidateSessionToken(accountId, `sendReply HTTP ${err.status}`, log);
|
|
1601
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1602
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Reply failed: ${errMsg}`);
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
onReplyStart: async () => {},
|
|
1606
|
+
onIdle: async () => {},
|
|
1607
|
+
onError: (err, info) => {
|
|
1608
|
+
log?.error(`[kakao-talkchannel:${account.talkchannelId}] Dispatch ${info.kind} error: ${err.message}`);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
const gatewayAdapter = {
|
|
1614
|
+
startAccount: async (ctx) => {
|
|
1615
|
+
const { account, accountId, cfg, abortSignal, log } = ctx;
|
|
1616
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Starting SSE stream to ${account.config.relayUrl}`);
|
|
1617
|
+
const callbacks = {
|
|
1618
|
+
onConnected: () => {
|
|
1619
|
+
if (ctx.getStatus && ctx.setStatus) ctx.setStatus({
|
|
1620
|
+
...ctx.getStatus(),
|
|
1621
|
+
connected: true
|
|
1622
|
+
});
|
|
1623
|
+
},
|
|
1624
|
+
onDisconnected: () => {
|
|
1625
|
+
if (ctx.getStatus && ctx.setStatus) ctx.setStatus({
|
|
1626
|
+
...ctx.getStatus(),
|
|
1627
|
+
connected: false
|
|
1628
|
+
});
|
|
1629
|
+
},
|
|
1630
|
+
onTokenResolved: (sessionToken, relayUrl) => {
|
|
1631
|
+
activeSessionTokenMap.set(accountId, {
|
|
1632
|
+
sessionToken,
|
|
1633
|
+
relayUrl
|
|
1634
|
+
});
|
|
1635
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] Session token stored for account`);
|
|
1636
|
+
},
|
|
1637
|
+
onPairingRequired: (pairingCode, expiresIn) => {
|
|
1638
|
+
pendingPairingInfoMap.set(accountId, {
|
|
1639
|
+
pairingCode,
|
|
1640
|
+
expiresIn
|
|
1641
|
+
});
|
|
1642
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] ========================================`);
|
|
1643
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] ๐ ํ์ด๋ง ์ฝ๋: ${pairingCode}`);
|
|
1644
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] ์นด์นด์คํก์์ /pair ${pairingCode} ์
๋ ฅํ์ธ์`);
|
|
1645
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] ์ ํจ์๊ฐ: ${Math.floor(expiresIn / 60)}๋ถ`);
|
|
1646
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] ========================================`);
|
|
1647
|
+
},
|
|
1648
|
+
onPairingComplete: (kakaoUserId) => {
|
|
1649
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] โ
ํ์ด๋ง ์๋ฃ: ${kakaoUserId}`);
|
|
1650
|
+
},
|
|
1651
|
+
onPairingExpired: (reason) => {
|
|
1652
|
+
log?.info(`[kakao-talkchannel:${account.talkchannelId}] โ ๏ธ ํ์ด๋ง ๋ง๋ฃ: ${reason}`);
|
|
1653
|
+
},
|
|
1654
|
+
onSessionInvalidated: (status) => {
|
|
1655
|
+
invalidateSessionToken(accountId, `SSE HTTP ${status}`, log);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
const onMessage = async (msg) => {
|
|
1659
|
+
await handleInboundMessage(msg, account, accountId, cfg, log);
|
|
1660
|
+
};
|
|
1661
|
+
return startRelayStream(account, onMessage, abortSignal, {}, callbacks, log);
|
|
1662
|
+
},
|
|
1663
|
+
stopAccount: async (ctx) => {
|
|
1664
|
+
activeSessionTokenMap.delete(ctx.accountId);
|
|
1665
|
+
return Promise.resolve();
|
|
1666
|
+
},
|
|
1667
|
+
getPendingPairingInfo
|
|
1668
|
+
};
|
|
1669
|
+
//#endregion
|
|
1670
|
+
//#region extensions/kakao-talkchannel/src/adapters/setup.ts
|
|
1671
|
+
function getKakaoTalkchannelConfig(cfg) {
|
|
1672
|
+
const config = cfg ?? {};
|
|
1673
|
+
const channels = config.channels ?? {};
|
|
1674
|
+
return {
|
|
1675
|
+
config,
|
|
1676
|
+
channels,
|
|
1677
|
+
talkchannelConfig: channels["kakao-talkchannel"] ?? {}
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region extensions/kakao-talkchannel/index.ts
|
|
1682
|
+
var kakao_talkchannel_default = defineChannelPluginEntry({
|
|
1683
|
+
id: "kakao-talkchannel",
|
|
1684
|
+
name: "Kakao TalkChannel",
|
|
1685
|
+
description: "KakaoTalk ์ฑ๋ ์ฑ๋ด์ moldClaw์ ์ฐ๊ฒฐํฉ๋๋ค",
|
|
1686
|
+
plugin: {
|
|
1687
|
+
id: "kakao-talkchannel",
|
|
1688
|
+
meta: {
|
|
1689
|
+
id: "kakao-talkchannel",
|
|
1690
|
+
label: "Kakao TalkChannel",
|
|
1691
|
+
selectionLabel: "์นด์นด์คํก ์ฑ๋",
|
|
1692
|
+
detailLabel: "KakaoTalk Bot",
|
|
1693
|
+
docsPath: "/channels/kakao-talkchannel",
|
|
1694
|
+
docsLabel: "kakao-talkchannel",
|
|
1695
|
+
blurb: "KakaoTalk ์ฑ๋ ์ฑ๋ด์ moldClaw์ ์ฐ๊ฒฐํฉ๋๋ค",
|
|
1696
|
+
systemImage: "message.fill",
|
|
1697
|
+
aliases: ["kakaotalk", "kakao-channel"],
|
|
1698
|
+
quickstartAllowFrom: false
|
|
1699
|
+
},
|
|
1700
|
+
pairing: pairingAdapter,
|
|
1701
|
+
capabilities: {
|
|
1702
|
+
chatTypes: ["direct"],
|
|
1703
|
+
reactions: false,
|
|
1704
|
+
threads: false,
|
|
1705
|
+
media: true,
|
|
1706
|
+
nativeCommands: false,
|
|
1707
|
+
blockStreaming: true
|
|
1708
|
+
},
|
|
1709
|
+
reload: { configPrefixes: ["channels.kakao-talkchannel"] },
|
|
1710
|
+
config: configAdapter,
|
|
1711
|
+
security: securityAdapter,
|
|
1712
|
+
outbound: outboundAdapter,
|
|
1713
|
+
status: statusAdapter,
|
|
1714
|
+
gateway: gatewayAdapter,
|
|
1715
|
+
setup: {
|
|
1716
|
+
resolveTalkChannelId: (_ctx) => {
|
|
1717
|
+
return "default";
|
|
1718
|
+
},
|
|
1719
|
+
applyTalkChannelName: (ctx) => {
|
|
1720
|
+
if (!ctx.name) return ctx.cfg;
|
|
1721
|
+
const { config, channels, talkchannelConfig } = getKakaoTalkchannelConfig(ctx.cfg);
|
|
1722
|
+
return {
|
|
1723
|
+
...config,
|
|
1724
|
+
channels: {
|
|
1725
|
+
...channels,
|
|
1726
|
+
"kakao-talkchannel": {
|
|
1727
|
+
...talkchannelConfig,
|
|
1728
|
+
name: ctx.name
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
},
|
|
1733
|
+
validateInput: (_ctx) => {
|
|
1734
|
+
return null;
|
|
1735
|
+
},
|
|
1736
|
+
applyTalkChannelConfig: (ctx) => {
|
|
1737
|
+
const { input } = ctx;
|
|
1738
|
+
const { config, channels, talkchannelConfig } = getKakaoTalkchannelConfig(ctx.cfg);
|
|
1739
|
+
const accountConfig = {
|
|
1740
|
+
...talkchannelConfig,
|
|
1741
|
+
enabled: true,
|
|
1742
|
+
dmPolicy: talkchannelConfig.dmPolicy ?? "pairing"
|
|
1743
|
+
};
|
|
1744
|
+
if (input.channelId) accountConfig.channelId = input.channelId;
|
|
1745
|
+
if (input.relayUrl) accountConfig.relayUrl = input.relayUrl;
|
|
1746
|
+
if (input.relayToken) accountConfig.relayToken = input.relayToken;
|
|
1747
|
+
if (input.sessionToken) accountConfig.sessionToken = input.sessionToken;
|
|
1748
|
+
if (input.name) accountConfig.name = input.name;
|
|
1749
|
+
return {
|
|
1750
|
+
...config,
|
|
1751
|
+
channels: {
|
|
1752
|
+
...channels,
|
|
1753
|
+
"kakao-talkchannel": accountConfig
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
setRuntime: setKakaoRuntime
|
|
1760
|
+
});
|
|
1761
|
+
//#endregion
|
|
1762
|
+
export { kakao_talkchannel_default as default, getPendingPairingInfo };
|