remoteclaw 0.1.0-next.da482d8 → 0.1.0-next.db8a792
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts-BZ2kR_Ij.js +47 -0
- package/dist/accounts-Bi4rFQG5.js +272 -0
- package/dist/accounts-Bpk-loA6.js +47 -0
- package/dist/accounts-D1CBpsaa.js +32 -0
- package/dist/accounts-DAdUdbPk.js +36 -0
- package/dist/accounts-WYyfAiie.js +270 -0
- package/dist/accounts-zQKMwnvt.js +36 -0
- package/dist/ack-reactions-B1l-vKPr.js +621 -0
- package/dist/ack-reactions-BnG0DLMu.js +621 -0
- package/dist/acp-cli-Btx71t69.js +1319 -0
- package/dist/acp-cli-DVQMjl0p.js +1324 -0
- package/dist/active-listener-BfN4RKlA.js +37 -0
- package/dist/active-listener-Bq7ckjOV.js +37 -0
- package/dist/agent-D2IwuL6g.js +688 -0
- package/dist/agent-WaE2mXI1.js +687 -0
- package/dist/agent-helpers-BcaiJFiG.js +400 -0
- package/dist/agent-scope-DVvX_nkQ.js +116 -0
- package/dist/agents-BwnT7jca.js +760 -0
- package/dist/agents.config-Dorm30BQ.js +116 -0
- package/dist/audio-B1lTyRqS.js +43 -0
- package/dist/audio-e0dFnrn8.js +43 -0
- package/dist/audit-DZvqycbG.js +3150 -0
- package/dist/audit-Mit73dYD.js +3150 -0
- package/dist/auth-C-XX0Tdt.js +314 -0
- package/dist/auth-D8--b01l.js +315 -0
- package/dist/auth-DJ7XEBDO.js +448 -0
- package/dist/auth-otyjXf9l.js +448 -0
- package/dist/banner-DSE-i7gH.js +294 -0
- package/dist/binaries-BSjilwX-.js +13 -0
- package/dist/bindings-DFTxQj8x.js +69 -0
- package/dist/bonjour-discovery-BnxTMHRd.js +378 -0
- package/dist/bonjour-discovery-CVJYHT3g.js +378 -0
- package/dist/boot/handler.js +28 -44
- package/dist/browser-cli-BR2pZWTC.js +1694 -0
- package/dist/browser-cli-I0kfR7FV.js +1690 -0
- package/dist/build-info.json +3 -3
- package/dist/call-Ck7ysmEl.js +517 -0
- package/dist/call-MN6mCJEB.js +518 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/catalog-Bt9EM4sK.js +185 -0
- package/dist/catalog-BtUvWKd9.js +185 -0
- package/dist/channel-account-context-BLQq9NKz.js +133 -0
- package/dist/channel-account-context-CaCzVa76.js +133 -0
- package/dist/channel-activity-BatlvP_U.js +292 -0
- package/dist/channel-activity-DHVMMb2x.js +94 -0
- package/dist/channel-activity-DtRx3b0W.js +94 -0
- package/dist/channel-options-C6kT3nXB.js +32 -0
- package/dist/channel-options-CbgR_vsp.js +33 -0
- package/dist/channel-selection-CzbrpDPd.js +51 -0
- package/dist/channel-selection-Xv5UFxOx.js +51 -0
- package/dist/channel-web-DfDokU69.js +2134 -0
- package/dist/channel-web-DtvksSuY.js +2132 -0
- package/dist/channels-cli-BmdCVX6O.js +1435 -0
- package/dist/channels-cli-CrAZpaiN.js +1439 -0
- package/dist/channels-status-issues-B77y-TLr.js +18 -0
- package/dist/channels-status-issues-COECL8nx.js +18 -0
- package/dist/chrome-Cr5wmMk8.js +1733 -0
- package/dist/chrome-YBrnJN-g.js +1732 -0
- package/dist/chunk-CrfQ_O--.js +341 -0
- package/dist/chunk-DFBUmlXU.js +341 -0
- package/dist/clack-prompter-CFNKgQXx.js +122 -0
- package/dist/clack-prompter-DDlR2e34.js +121 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-BbOinSy6.js +130 -0
- package/dist/cli-DuvHXQ5h.js +134 -0
- package/dist/client-BZeatr3g.js +2316 -0
- package/dist/client-Bc9JFAwL.js +2316 -0
- package/dist/clipboard-Com-8GBg.js +31 -0
- package/dist/clipboard-J_9AABIu.js +31 -0
- package/dist/command-format-CMAQa4dB.js +32 -0
- package/dist/command-format-KkslAzwV.js +18 -0
- package/dist/command-logger/handler.js +1 -1
- package/dist/command-registry-BJnVtHo0.js +215 -0
- package/dist/commands-ijxtne0J.js +41 -0
- package/dist/commands-kZtQfqDl.js +41 -0
- package/dist/commands-registry-BrBtH2_B.js +891 -0
- package/dist/commands-registry-xZoSouba.js +892 -0
- package/dist/common-6D7nhDP-.js +156 -0
- package/dist/common-B4cjsvqP.js +156 -0
- package/dist/completion-cli-CpUq9QC3.js +452 -0
- package/dist/completion-cli-De4umD_N.js +452 -0
- package/dist/config-C_WcTz_O.js +4231 -0
- package/dist/config-DfcqHTH-.js +4229 -0
- package/dist/config-cli-C7rq2n_m.js +243 -0
- package/dist/config-cli-VToCKln2.js +247 -0
- package/dist/config-guard-BlAcGEao.js +75 -0
- package/dist/config-guard-C-h_KIeI.js +99 -0
- package/dist/config-validation-C0YXR2dY.js +18 -0
- package/dist/config-validation-DDYBTmxT.js +18 -0
- package/dist/configure-Bkre1zEB.js +891 -0
- package/dist/configure-ifuEamRQ.js +889 -0
- package/dist/control-auth-DK6cIBzl.js +397 -0
- package/dist/control-auth-DQ8bfDMk.js +397 -0
- package/dist/control-ui-assets-DLEWfed6.js +186 -0
- package/dist/control-ui-assets-DVhkAyhv.js +186 -0
- package/dist/conversation-label-HuHoShPF.js +36 -0
- package/dist/conversation-label-L0QTtKji.js +36 -0
- package/dist/cron-cli-DnxnTi83.js +498 -0
- package/dist/cron-cli-yqcBkqZT.js +494 -0
- package/dist/daemon-cli-CmQYq8uO.js +735 -0
- package/dist/daemon-cli-_OIRoswC.js +737 -0
- package/dist/daemon-cli.js +34 -69
- package/dist/daemon-install-BEgffqDj.js +56 -0
- package/dist/daemon-install-DAorzotp.js +60 -0
- package/dist/daemon-install-helpers-B82uvJjJ.js +504 -0
- package/dist/daemon-install-helpers-BhL2Gh4l.js +504 -0
- package/dist/deliver-CCvDBk5c.js +481 -0
- package/dist/deliver-CqKw0wFi.js +481 -0
- package/dist/delivery-queue-CK7VnUJf.js +244 -0
- package/dist/delivery-queue-DMeQchpT.js +244 -0
- package/dist/devices-cli-C6UAfRV_.js +323 -0
- package/dist/devices-cli-Le-isdZB.js +319 -0
- package/dist/diagnostics-BhFwk6F3.js +35 -0
- package/dist/diagnostics-BtaQtaVR.js +35 -0
- package/dist/directory-cli-BqMfX5og.js +220 -0
- package/dist/directory-cli-DD72TTD4.js +224 -0
- package/dist/dispatcher-BLC2WYZv.js +173 -0
- package/dist/dispatcher-Cm2FAG_D.js +174 -0
- package/dist/dm-policy-shared-DOzpxMHC.js +22 -0
- package/dist/dm-policy-shared-DZY0f1bR.js +22 -0
- package/dist/dns-cli-BgsNg-bn.js +203 -0
- package/dist/dns-cli-CdMU5yuG.js +199 -0
- package/dist/dock-ByrYnLiz.js +929 -0
- package/dist/dock-CpNmmysM.js +928 -0
- package/dist/doctor-completion-BPeaRbmd.js +92 -0
- package/dist/doctor-completion-CfOyGJd3.js +92 -0
- package/dist/doctor-config-flow-DMyTycn7.js +1935 -0
- package/dist/doctor-config-flow-DoMu-pTm.js +1934 -0
- package/dist/enable-D5KetMo7.js +59 -0
- package/dist/entry.js +61 -1
- package/dist/env-BJ36dSrx.js +60 -0
- package/dist/errors-BfONuT95.js +35 -0
- package/dist/errors-_DSePI1C.js +35 -0
- package/dist/exec-DkFE7lqU.js +164 -0
- package/dist/exec-mY96dhIg.js +164 -0
- package/dist/extensionAPI.js +112 -76
- package/dist/fetch-B3EQXbTa.js +67 -0
- package/dist/fetch-BPeSHPvr.js +281 -0
- package/dist/fetch-BQ7HvRwe.js +67 -0
- package/dist/fetch-CbGTzJ8L.js +281 -0
- package/dist/fetch-CfIaWynF.js +67 -0
- package/dist/file-lock-BHfqppLm.js +107 -0
- package/dist/file-lock-CCBpdPM_.js +107 -0
- package/dist/fs-safe-BcEpbVjc.js +88 -0
- package/dist/fs-safe-S3Zvbabd.js +98 -0
- package/dist/gateway-cli-BXipRcsU.js +24602 -0
- package/dist/gateway-cli-Bv2K3rXx.js +24606 -0
- package/dist/gateway-rpc-BHnd7P1q.js +28 -0
- package/dist/gateway-rpc-COEQDswS.js +28 -0
- package/dist/gmail-setup-utils-BpdKFe3P.js +423 -0
- package/dist/gmail-setup-utils-CqbWr0Kq.js +422 -0
- package/dist/health-1ero5j64.js +1414 -0
- package/dist/health-ioP2au7j.js +1417 -0
- package/dist/heartbeat-visibility-C88L-_f2.js +125 -0
- package/dist/heartbeat-visibility-Dk_Q02qX.js +125 -0
- package/dist/hook-runner-global-BztoD8lu.js +527 -0
- package/dist/hooks-cli-B8D9DzRR.js +1226 -0
- package/dist/hooks-cli-rZ3GOXag.js +1222 -0
- package/dist/image-ops-Cx1ym2Hi.js +354 -0
- package/dist/image-ops-DWytvdh_.js +354 -0
- package/dist/import-CTUBsy7D.js +604 -0
- package/dist/import-cBp4f62k.js +606 -0
- package/dist/inbound-context-COwswi8z.js +68 -0
- package/dist/inbound-context-ChcNR30g.js +68 -0
- package/dist/index.js +127 -102
- package/dist/inspect-BsS3_z-x.js +286 -0
- package/dist/inspect-drfsUSIW.js +286 -0
- package/dist/installs-BFmmM5Zd.js +325 -0
- package/dist/installs-DA7SG0Tx.js +325 -0
- package/dist/ipv4-BZGSwnH4.js +46 -0
- package/dist/ipv4-DsOgHE0B.js +46 -0
- package/dist/ir-R3Pk8Cv8.js +972 -0
- package/dist/lifecycle-core-BZMeOT7u.js +474 -0
- package/dist/lifecycle-core-C6-_Gts0.js +476 -0
- package/dist/loader-CJ2UHqV7.js +22414 -0
- package/dist/loader-dEFvmwXu.js +22411 -0
- package/dist/logger-9I2fg5mr.js +49 -0
- package/dist/login-D9uJTyEv.js +62 -0
- package/dist/login-DTh702_w.js +61 -0
- package/dist/login-qr-BKsmW6XI.js +325 -0
- package/dist/login-qr-SOXdIR58.js +329 -0
- package/dist/logs-cli-BshJBHZQ.js +236 -0
- package/dist/logs-cli-Ckh-BBTT.js +240 -0
- package/dist/markdown-tables-Cfz7zDXI.js +29 -0
- package/dist/markdown-tables-DeFSK6aY.js +29 -0
- package/dist/media-BD2cZGXT.js +971 -0
- package/dist/media-CjvpnJmQ.js +10388 -0
- package/dist/message-action-names-CZHrHMRE.js +2520 -0
- package/dist/message-action-names-CiZ-0Smk.js +2520 -0
- package/dist/message-channel-EMCYRaxk.js +91 -0
- package/dist/mime-1E7nn9IU.js +146 -0
- package/dist/mime-mSgQeDnC.js +146 -0
- package/dist/net-Cg8AQeke.js +225 -0
- package/dist/net-DMh1m8AZ.js +225 -0
- package/dist/node-cli-BJ5CCbqx.js +1462 -0
- package/dist/node-cli-wYYhAs8x.js +1458 -0
- package/dist/node-service-CkwVlcey.js +67 -0
- package/dist/node-service-DTVW9YJh.js +67 -0
- package/dist/nodes-cli-CMFYLD1o.js +1346 -0
- package/dist/nodes-cli-DC2zUx3f.js +1350 -0
- package/dist/nodes-screen-6pXv1lYa.js +250 -0
- package/dist/nodes-screen-CTIZKksn.js +250 -0
- package/dist/note-CMELkPJN.js +92 -0
- package/dist/npm-registry-spec-BiJI7Rkr.js +786 -0
- package/dist/npm-registry-spec-Dza35Ig4.js +786 -0
- package/dist/npm-resolution-CUQGDty4.js +86 -0
- package/dist/npm-resolution-CwbZK9AI.js +86 -0
- package/dist/onboard-8Qd9lU8x.js +649 -0
- package/dist/onboard-Q3cY65m8.js +647 -0
- package/dist/onboard-auth-BUzYDEqf.js +211 -0
- package/dist/onboard-auth-DcVXyd-Z.js +207 -0
- package/dist/onboard-channels-BFHuA-AU.js +2548 -0
- package/dist/onboard-channels-DVrPP_ie.js +2547 -0
- package/dist/onboard-helpers-B-bBSsyR.js +363 -0
- package/dist/onboard-helpers-YsCa-sAt.js +364 -0
- package/dist/onboard-remote-BWFcuEOD.js +127 -0
- package/dist/onboard-remote-C0THuDTK.js +127 -0
- package/dist/onboarding-B31lnOPp.js +586 -0
- package/dist/onboarding-DmN_qC8e.js +588 -0
- package/dist/onboarding.finalize-DGD0PA-D.js +402 -0
- package/dist/onboarding.finalize-DNIb3meE.js +404 -0
- package/dist/onboarding.gateway-config-BaeIuA62.js +195 -0
- package/dist/onboarding.gateway-config-DMV2Odzr.js +201 -0
- package/dist/outbound-BdxBHDax.js +220 -0
- package/dist/outbound-D-Y9rMgB.js +221 -0
- package/dist/outbound-attachment-CvZ04r5k.js +18 -0
- package/dist/outbound-attachment-DYa1asB5.js +18 -0
- package/dist/outbound-attachment-DgUpk7Uh.js +18 -0
- package/dist/pairing-cli-BxTv78V7.js +125 -0
- package/dist/pairing-cli-CxUCzNUc.js +129 -0
- package/dist/pairing-labels-DVO6NJr0.js +9 -0
- package/dist/pairing-labels-D_pD8Cag.js +9 -0
- package/dist/pairing-store-Bu9pVlkO.js +459 -0
- package/dist/pairing-store-CWaGbAGi.js +460 -0
- package/dist/path-env-RsuO6yO-.js +89 -0
- package/dist/path-env-_my-d_iR.js +89 -0
- package/dist/path-safety-CfiVyVz7.js +14 -0
- package/dist/path-safety-D-wLK4pV.js +14 -0
- package/dist/plugin-auto-enable-CW01H36W.js +301 -0
- package/dist/plugin-auto-enable-CeHhBLCU.js +302 -0
- package/dist/plugin-registry-CWL37HnB.js +33 -0
- package/dist/plugin-registry-ELliiumZ.js +33 -0
- package/dist/plugin-sdk/auth/provider-auth.d.ts +0 -6
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +9 -29
- package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +0 -2
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/shared.d.ts +1 -1
- package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +0 -2
- package/dist/plugin-sdk/auto-reply/status.d.ts +0 -4
- package/dist/plugin-sdk/auto-reply/templating.d.ts +0 -4
- package/dist/plugin-sdk/config/sessions/types.d.ts +0 -2
- package/dist/plugin-sdk/config/types.tools.d.ts +1 -59
- package/dist/plugin-sdk/config/types.tts.d.ts +2 -1
- package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +0 -177
- package/dist/plugin-sdk/config/zod-schema.core.d.ts +2 -230
- package/dist/plugin-sdk/config/zod-schema.d.ts +3 -192
- package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +3 -15
- package/dist/plugin-sdk/config/zod-schema.providers.d.ts +2 -10
- package/dist/plugin-sdk/config/zod-schema.session.d.ts +1 -5
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +5 -5
- package/dist/plugin-sdk/index.js +72 -142
- package/dist/plugin-sdk/middleware/cli-runtime-base.d.ts +6 -0
- package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +6 -0
- package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +2 -2
- package/dist/plugin-sdk/plugin-sdk/index.d.ts +2 -0
- package/dist/plugin-sdk/plugins/manifest-registry.d.ts +2 -0
- package/dist/plugin-sdk/plugins/manifest.d.ts +2 -0
- package/dist/plugin-sdk/plugins/registry.d.ts +18 -0
- package/dist/plugin-sdk/plugins/types.d.ts +4 -0
- package/dist/plugin-sdk/stt/preflight.d.ts +2 -4
- package/dist/plugin-sdk/stt/providers/index.d.ts +1 -1
- package/dist/plugin-sdk/stt/providers/shared.d.ts +20 -1
- package/dist/plugin-sdk/tts/providers/edge.d.ts +2 -0
- package/dist/plugin-sdk/tts/providers/elevenlabs.d.ts +2 -0
- package/dist/plugin-sdk/tts/providers/index.d.ts +4 -0
- package/dist/plugin-sdk/tts/providers/openai.d.ts +2 -0
- package/dist/plugin-sdk/tts/tts.d.ts +13 -5
- package/dist/plugin-sdk/tts/types.d.ts +21 -0
- package/dist/plugins-DExsdlTp.js +455 -0
- package/dist/plugins-DdMgSc_b.js +453 -0
- package/dist/plugins-cli-DqBWiT_G.js +806 -0
- package/dist/plugins-cli-KQEzhU6P.js +802 -0
- package/dist/ports-CL0pXAXO.js +96 -0
- package/dist/ports-CRI-HSZx.js +370 -0
- package/dist/ports-DiQFcKUB.js +316 -0
- package/dist/ports-HRurfPIr.js +96 -0
- package/dist/preflight-6QRqxWh7.js +667 -0
- package/dist/preflight-DDZjr5KD.js +667 -0
- package/dist/program-DmhbOJj3.js +249 -0
- package/dist/program-context-PPMzZ6Gu.js +474 -0
- package/dist/prompt-select-styled-CmSWunD8.js +1669 -0
- package/dist/prompt-select-styled-PfxT9zl9.js +1672 -0
- package/dist/provider-auth-CfdnLqh3.js +187 -0
- package/dist/provider-auth-gpHOMUBP.js +187 -0
- package/dist/provider-dispatcher-D4eY8LZW.js +659 -0
- package/dist/provider-dispatcher-D5Q7M15D.js +660 -0
- package/dist/push-apns-BNwVMXX9.js +713 -0
- package/dist/push-apns-BszVkcZK.js +711 -0
- package/dist/pw-ai-Bdb3zrBM.js +1911 -0
- package/dist/pw-ai-BvcvEdGs.js +1908 -0
- package/dist/qr-cli-BBgk2ci1.js +349 -0
- package/dist/qr-cli-BLzVrhia.js +353 -0
- package/dist/redact-snapshot-CyBDcb_a.js +1966 -0
- package/dist/redact-snapshot-D9oPMqA-.js +1966 -0
- package/dist/register.agent-CAhKX3Ft.js +1019 -0
- package/dist/register.agent-RKHXtLLm.js +291 -0
- package/dist/register.configure-CW6XRGxV.js +129 -0
- package/dist/register.configure-dvrKc0j7.js +134 -0
- package/dist/register.import-CRLOolHv.js +31 -0
- package/dist/register.import-dhDEj7Om.js +29 -0
- package/dist/register.maintenance-EAhr1tJ9.js +500 -0
- package/dist/register.maintenance-lWz4v90u.js +502 -0
- package/dist/register.message-DyWkwUIU.js +690 -0
- package/dist/register.message-bl2Khz6c.js +686 -0
- package/dist/register.onboard-BAozmeei.js +97 -0
- package/dist/register.onboard-Da9hWQR1.js +93 -0
- package/dist/register.setup-DVrQWLoF.js +117 -0
- package/dist/register.setup-DbiLuuqg.js +113 -0
- package/dist/register.status-health-sessions-CA8ApUkH.js +668 -0
- package/dist/register.status-health-sessions-lGszs-NJ.js +428 -0
- package/dist/register.subclis-C-lqMygb.js +267 -0
- package/dist/replies-BTC1z8j0.js +136 -0
- package/dist/replies-BhlnuFp0.js +136 -0
- package/dist/reply-DZMooMoq.js +12880 -0
- package/dist/reply-directives-C0-hYyAt.js +182 -0
- package/dist/reply-directives-C_CGXLBJ.js +182 -0
- package/dist/reply-payloads-BospFSPI.js +527 -0
- package/dist/reply-prefix-DDgh77yy.js +37 -0
- package/dist/reply-prefix-DwKZPZyG.js +37 -0
- package/dist/reply-yGEQ0UW4.js +12877 -0
- package/dist/resolve-route-B73QhBIl.js +249 -0
- package/dist/resolve-route-DckdRbW8.js +249 -0
- package/dist/response-prefix-template-x5RBQnEy.js +134 -0
- package/dist/retry-CDrH81GP.js +77 -0
- package/dist/run-main-D869n5qf.js +307 -0
- package/dist/secure-random-CxzxAnMS.js +44 -0
- package/dist/security-cli-CfqosyUf.js +487 -0
- package/dist/security-cli-DMZun6gO.js +482 -0
- package/dist/send-3wvngctD.js +547 -0
- package/dist/send-AY7Fs5ky.js +374 -0
- package/dist/send-BSWD4Kr_.js +2245 -0
- package/dist/send-BT4HhTLm.js +349 -0
- package/dist/send-BvuxToC8.js +2245 -0
- package/dist/send-CaUxFvu0.js +492 -0
- package/dist/send-CiBRE4OY.js +1178 -0
- package/dist/send-Cidd4lQn.js +11 -0
- package/dist/send-Cq_Db9wG.js +1779 -0
- package/dist/send-DBFcxDPm.js +1776 -0
- package/dist/send-DUha0nIz.js +492 -0
- package/dist/send-DgYBI05s.js +332 -0
- package/dist/send-Dnf5bISH.js +426 -0
- package/dist/send-NcQk6UH1.js +547 -0
- package/dist/send-Og0-IMee.js +29 -0
- package/dist/send-oCN80Pl2.js +349 -0
- package/dist/server-DoGGLeP3.js +202 -0
- package/dist/server-V7G9FG2A.js +206 -0
- package/dist/server-lifecycle-CSWpSlvn.js +2437 -0
- package/dist/server-lifecycle-Cal8hBP1.js +2437 -0
- package/dist/server-node-events-DSee6jSG.js +394 -0
- package/dist/server-node-events-DbQWkU3M.js +390 -0
- package/dist/service-Duw0xMJX.js +670 -0
- package/dist/service-SRcnA1Am.js +670 -0
- package/dist/session-BLcfWX5_.js +170 -0
- package/dist/session-CQwkaAs-.js +170 -0
- package/dist/session-cost-usage-C-UcrvL4.js +627 -0
- package/dist/session-cost-usage-Dg3dzS0E.js +627 -0
- package/dist/session-dirs-D6mFEF90.js +318 -0
- package/dist/session-dirs-DVsG6e7L.js +318 -0
- package/dist/session-utils-C6522g3D.js +622 -0
- package/dist/session-utils-Dq2BJyVy.js +622 -0
- package/dist/sessions-CNkj4Eq8.js +247 -0
- package/dist/sessions-DDIoP7Rl.js +2569 -0
- package/dist/shell-env-D8nXPDbP.js +163 -0
- package/dist/ssrf-7I3FUHpm.js +183 -0
- package/dist/ssrf-DZi4qw5c.js +183 -0
- package/dist/status-CrAe8ZYt.js +1983 -0
- package/dist/status-DetRJxvZ.js +1979 -0
- package/dist/status.update-DquSK3p7.js +449 -0
- package/dist/status.update-iABAY3iW.js +449 -0
- package/dist/store-Bnm6zwaq.js +2571 -0
- package/dist/store-CVkGKjWm.js +64 -0
- package/dist/store-D_gpBpAW.js +64 -0
- package/dist/store-mxh63FBa.js +53 -0
- package/dist/subagent-registry-DNAz7Heu.js +4856 -0
- package/dist/subagent-registry-Dhz6HC4Z.js +4854 -0
- package/dist/subsystem-DGSHVL8I.js +1081 -0
- package/dist/subsystem-m7RSGQoR.js +1196 -0
- package/dist/system-cli-ByVDF6p8.js +77 -0
- package/dist/system-cli-CERb89Bl.js +73 -0
- package/dist/systemd-CSUtfsJx.js +547 -0
- package/dist/systemd-hints-BCxkQemJ.js +278 -0
- package/dist/systemd-hints-ef7m-7ZH.js +278 -0
- package/dist/systemd-linger-CWLgT0Wr.js +75 -0
- package/dist/systemd-linger-DT0E7YET.js +75 -0
- package/dist/systemd-tS61V4ao.js +547 -0
- package/dist/tables-DED01JNI.js +55 -0
- package/dist/tables-K3rOiGaJ.js +55 -0
- package/dist/tables-NcsXz3r_.js +55 -0
- package/dist/tailnet-CEudzG0i.js +40 -0
- package/dist/tailnet-D66Y5zC7.js +40 -0
- package/dist/tailscale-DjSRjPA-.js +230 -0
- package/dist/tailscale-DngZHD9L.js +230 -0
- package/dist/targets-BOpYPsGM.js +2545 -0
- package/dist/targets-BVsxzQh1.js +220 -0
- package/dist/targets-C99szk_e.js +114 -0
- package/dist/targets-CA4zx5G4.js +650 -0
- package/dist/targets-CTNm3bJ8.js +2544 -0
- package/dist/targets-DpmQjetK.js +53 -0
- package/dist/targets-Q-YGeAqu.js +650 -0
- package/dist/targets-rdWlC6Y-.js +53 -0
- package/dist/tool-display-Br6mwaJc.js +785 -0
- package/dist/tool-display-CLBf5cRa.js +785 -0
- package/dist/tool-images-DB4f57XK.js +263 -0
- package/dist/tool-images-kloBqxqK.js +263 -0
- package/dist/trash-B32LfX0l.js +125 -0
- package/dist/trash-SlUJxKO7.js +125 -0
- package/dist/tui-CHOtFK6k.js +3282 -0
- package/dist/tui-D4yiSpop.js +3282 -0
- package/dist/tui-cli-CzrjmAMZ.js +66 -0
- package/dist/tui-cli-Dpbs2QW_.js +62 -0
- package/dist/update-B5nYVxpc.js +349 -0
- package/dist/update-Bs3HhSnE.js +349 -0
- package/dist/update-cli-D_yz9Kyz.js +1147 -0
- package/dist/update-cli-DdfwNAsA.js +1149 -0
- package/dist/usage-BVyabt5E.js +5421 -0
- package/dist/voice-credentials-CI4VgB6u.js +46 -0
- package/dist/voice-credentials-l_d_gZiG.js +46 -0
- package/dist/web-B5xSAAH2.js +74 -0
- package/dist/web-Cc4tDVO9.js +3067 -0
- package/dist/web-Cdp9_IUk.js +79 -0
- package/dist/webhooks-cli-BDPcBkZL.js +330 -0
- package/dist/webhooks-cli-sRfsNesg.js +334 -0
- package/dist/whatsapp-actions-BGZXdWiP.js +125 -0
- package/dist/whatsapp-actions-HdmZu8oU.js +130 -0
- package/dist/workspace-D5LAl41l.js +449 -0
- package/dist/workspace-DRYGbrDM.js +447 -0
- package/dist/zod-schema-C8gEV0uz.js +2739 -0
- package/dist/zod-schema-CCUbW_Si.js +2739 -0
- package/package.json +1 -1
- package/dist/accounts-Aqbb2_Fn.js +0 -270
- package/dist/accounts-Bo2bX8jP.js +0 -272
- package/dist/accounts-D3fAPVzU.js +0 -36
- package/dist/accounts-DUEDngp6.js +0 -32
- package/dist/accounts-DZmv4bXS.js +0 -47
- package/dist/accounts-DmB4SVPK.js +0 -47
- package/dist/accounts-DtkyfvwR.js +0 -36
- package/dist/ack-reactions-Bvfy17SM.js +0 -446
- package/dist/ack-reactions-DYU8uhcz.js +0 -446
- package/dist/acp-cli-DVXhDMc6.js +0 -1324
- package/dist/acp-cli-QBL4_qcW.js +0 -1319
- package/dist/active-listener-CwxZ24bZ.js +0 -37
- package/dist/active-listener-v2sItamh.js +0 -37
- package/dist/agent-BisC5WZ6.js +0 -704
- package/dist/agent-Bqdrc0AK.js +0 -703
- package/dist/agent-helpers-BSGqeJr-.js +0 -400
- package/dist/agent-scope-_ND_-bJy.js +0 -116
- package/dist/agents-khSbraAA.js +0 -760
- package/dist/agents.config-D8gLHPWo.js +0 -116
- package/dist/audio-BIvUsncf.js +0 -43
- package/dist/audio-CQ8TfmVN.js +0 -43
- package/dist/audit-C0x7Cm6K.js +0 -3150
- package/dist/audit-CAY-uzWP.js +0 -3150
- package/dist/auth-DGqCLaQq.js +0 -448
- package/dist/auth-DLTRySEi.js +0 -314
- package/dist/auth-Drf91ntw.js +0 -315
- package/dist/auth-ku2khJyQ.js +0 -448
- package/dist/banner-txHC40UW.js +0 -294
- package/dist/binaries-BTvHIrCr.js +0 -13
- package/dist/bindings-DsWJQVKh.js +0 -69
- package/dist/bonjour-discovery-BElR62fH.js +0 -378
- package/dist/bonjour-discovery-C8XyVsjb.js +0 -378
- package/dist/browser-cli-DxJew43l.js +0 -1694
- package/dist/browser-cli-p0nakrjO.js +0 -1690
- package/dist/call-BrTmlOx3.js +0 -518
- package/dist/call-ChdUdwb4.js +0 -517
- package/dist/catalog-DTlcfTT9.js +0 -185
- package/dist/catalog-PixZqhZK.js +0 -185
- package/dist/channel-account-context-BO245Tcn.js +0 -133
- package/dist/channel-account-context-BgK0hm-I.js +0 -133
- package/dist/channel-activity-B0qlUR5e.js +0 -292
- package/dist/channel-activity-C-L6rDrQ.js +0 -94
- package/dist/channel-activity-DdgLBZ7M.js +0 -94
- package/dist/channel-options-CjlvAHSH.js +0 -32
- package/dist/channel-options-DpjP7qQf.js +0 -33
- package/dist/channel-selection-DW21dXB1.js +0 -51
- package/dist/channel-selection-wK_6S2Ku.js +0 -51
- package/dist/channel-web-COTkzJBt.js +0 -2136
- package/dist/channel-web-DUz5bn9h.js +0 -2134
- package/dist/channels-cli-D8RS8g2Q.js +0 -1438
- package/dist/channels-cli-X_8rENR6.js +0 -1434
- package/dist/channels-status-issues-B6I2l7Sm.js +0 -18
- package/dist/channels-status-issues-DhDH2fWp.js +0 -18
- package/dist/chrome-Dqtq7zCc.js +0 -1733
- package/dist/chrome-XeSY99Z_.js +0 -1732
- package/dist/chunk-CWD_zrz_.js +0 -341
- package/dist/chunk-LUabyS9k.js +0 -341
- package/dist/clack-prompter-fAgbvPW4.js +0 -122
- package/dist/clack-prompter-kf9qTN5p.js +0 -121
- package/dist/cli-BjPLpuZR.js +0 -133
- package/dist/cli-fFyOTtkD.js +0 -129
- package/dist/client-B9u3JdT_.js +0 -2316
- package/dist/client-DEEOhx0w.js +0 -2316
- package/dist/clipboard-B2nstLx7.js +0 -31
- package/dist/clipboard-C8QI9fes.js +0 -31
- package/dist/command-format-D0vKipG9.js +0 -32
- package/dist/command-format-LFmgWzKJ.js +0 -18
- package/dist/command-registry-BsPaMI53.js +0 -215
- package/dist/commands-BAYwlS3d.js +0 -41
- package/dist/commands-D842kCjj.js +0 -41
- package/dist/commands-registry-Cg2GTT2J.js +0 -892
- package/dist/commands-registry-Yz-uV5oG.js +0 -891
- package/dist/common-B67cBSew.js +0 -156
- package/dist/common-DEoiTqOr.js +0 -156
- package/dist/completion-cli-BO5mIPLa.js +0 -452
- package/dist/completion-cli-z9a6MVgr.js +0 -452
- package/dist/config-CAa0rZSx.js +0 -4225
- package/dist/config-W0w-gi2j.js +0 -4223
- package/dist/config-cli-DdRue35G.js +0 -243
- package/dist/config-cli-uOwxu5AC.js +0 -247
- package/dist/config-guard-BI85dxHR.js +0 -99
- package/dist/config-guard-DQqnigKh.js +0 -75
- package/dist/config-validation-D-h4LHyA.js +0 -18
- package/dist/config-validation-Df_kroIQ.js +0 -18
- package/dist/configure-B7ChPbXv.js +0 -891
- package/dist/configure-QspkIXME.js +0 -889
- package/dist/control-auth-BrBr2xb8.js +0 -397
- package/dist/control-auth-CehjYKnL.js +0 -397
- package/dist/control-ui-assets-D8F383Mo.js +0 -186
- package/dist/control-ui-assets-DYKtRIm0.js +0 -186
- package/dist/conversation-label-Bn5j3lUT.js +0 -36
- package/dist/conversation-label-CDH4rKMG.js +0 -36
- package/dist/cron-cli-DVzDHzAX.js +0 -494
- package/dist/cron-cli-gkH2qKM4.js +0 -498
- package/dist/daemon-cli-BTdNO1vH.js +0 -737
- package/dist/daemon-cli-DNNqI2LD.js +0 -735
- package/dist/daemon-install-CaEHG92p.js +0 -56
- package/dist/daemon-install-DbpDSDfW.js +0 -60
- package/dist/daemon-install-helpers-DjE_WnlY.js +0 -504
- package/dist/daemon-install-helpers-DocTUxqQ.js +0 -504
- package/dist/deliver-CDcL8ok6.js +0 -481
- package/dist/deliver-CS8JsevV.js +0 -481
- package/dist/delivery-queue-CTaYZQ_8.js +0 -244
- package/dist/delivery-queue-DMZ7mH8P.js +0 -244
- package/dist/devices-cli-BBJ4His-.js +0 -319
- package/dist/devices-cli-DHSJSFW1.js +0 -323
- package/dist/diagnostics-BSvCaLNs.js +0 -35
- package/dist/diagnostics-mWFAsFeo.js +0 -35
- package/dist/directory-cli-C-oHD_XE.js +0 -224
- package/dist/directory-cli-Cw99VGvr.js +0 -220
- package/dist/dispatcher-C8d1NNLZ.js +0 -174
- package/dist/dispatcher-DY6Ga60j.js +0 -173
- package/dist/dm-policy-shared-CRQ-Wr5g.js +0 -22
- package/dist/dm-policy-shared-CXXf2ltd.js +0 -22
- package/dist/dns-cli-BOqx9qo1.js +0 -199
- package/dist/dns-cli-WfqSC3JU.js +0 -203
- package/dist/dock-Big-J2VN.js +0 -929
- package/dist/dock-Cj4PKiUh.js +0 -928
- package/dist/doctor-completion-hYqcZ7IE.js +0 -92
- package/dist/doctor-completion-nxQQ5bEw.js +0 -92
- package/dist/doctor-config-flow-BUuADMDa.js +0 -1935
- package/dist/doctor-config-flow-yOUpQC2B.js +0 -1934
- package/dist/enable-DC9V0nTO.js +0 -59
- package/dist/env-B3zr72vQ.js +0 -60
- package/dist/errors-CdmXrBic.js +0 -35
- package/dist/errors-Cr_NbOb4.js +0 -35
- package/dist/exec-D_s-zAtY.js +0 -164
- package/dist/exec-Zz6eJ6YU.js +0 -164
- package/dist/fetch-BIZkXB5i.js +0 -67
- package/dist/fetch-DRVdxxEj.js +0 -67
- package/dist/fetch-DTR2MlOk.js +0 -67
- package/dist/file-lock-6NXMPZTT.js +0 -107
- package/dist/file-lock-C_KRlR7M.js +0 -107
- package/dist/fs-safe-DZHpH7TI.js +0 -98
- package/dist/fs-safe-vm3JMUkq.js +0 -88
- package/dist/gateway-cli-DEW-Ukmc.js +0 -24351
- package/dist/gateway-cli-DQYcZCOV.js +0 -24347
- package/dist/gateway-rpc-BCFkQPa2.js +0 -28
- package/dist/gateway-rpc-DOgYbsOG.js +0 -28
- package/dist/gmail-setup-utils-DMeA1UM1.js +0 -423
- package/dist/gmail-setup-utils-FHWSAur3.js +0 -422
- package/dist/health-BrLNGkZV.js +0 -1414
- package/dist/health-C8p9mnfl.js +0 -1417
- package/dist/heartbeat-visibility-CJVdaMZF.js +0 -125
- package/dist/heartbeat-visibility-DwK1UL0t.js +0 -125
- package/dist/hook-runner-global-C0DFQmQw.js +0 -527
- package/dist/hooks-cli-DEKi-tbA.js +0 -1221
- package/dist/hooks-cli-FndXPMD3.js +0 -1225
- package/dist/image-ops-B9ofmzSq.js +0 -354
- package/dist/image-ops-CMuvRsMY.js +0 -354
- package/dist/import-BH13F5mT.js +0 -606
- package/dist/import-D8HVcDqO.js +0 -604
- package/dist/inbound-context-BLy-G2Eq.js +0 -68
- package/dist/inbound-context-CmmmT8IP.js +0 -68
- package/dist/inbound-path-policy-BdmTOUka.js +0 -90
- package/dist/inbound-path-policy-BurOAu44.js +0 -90
- package/dist/inspect-nW8LAukU.js +0 -286
- package/dist/inspect-xy2EHy8G.js +0 -286
- package/dist/installs-CpfHmKY1.js +0 -325
- package/dist/installs-DebiMrGj.js +0 -325
- package/dist/ipv4-ysiNGssl.js +0 -46
- package/dist/ipv4-zc_Hfvbp.js +0 -46
- package/dist/ir-CaxTklDC.js +0 -940
- package/dist/lifecycle-core-Z5SScMlU.js +0 -476
- package/dist/lifecycle-core-pPwYSt7m.js +0 -474
- package/dist/loader-BapIdJyx.js +0 -22404
- package/dist/loader-BdAToyDH.js +0 -22401
- package/dist/local-roots-CrJ_Jv_G.js +0 -314
- package/dist/local-roots-n_Y4iYwb.js +0 -313
- package/dist/logger-B8yHnzPl.js +0 -49
- package/dist/login-C99fsB0N.js +0 -61
- package/dist/login-cLvGPjeO.js +0 -62
- package/dist/login-qr-CGqRFwgl.js +0 -329
- package/dist/login-qr-dnY5DC2C.js +0 -325
- package/dist/logs-cli-Bda7xY4N.js +0 -236
- package/dist/logs-cli-HzR-vnpD.js +0 -240
- package/dist/markdown-tables-58Hq__7K.js +0 -29
- package/dist/markdown-tables-GFEX0OR6.js +0 -29
- package/dist/media-CFsyXs3H.js +0 -940
- package/dist/media-Du5SHtnp.js +0 -10452
- package/dist/message-action-names-BfuEvR6j.js +0 -2521
- package/dist/message-action-names-CVBkpOLt.js +0 -2521
- package/dist/message-channel-FMNRI5Ax.js +0 -91
- package/dist/mime-AuIDUZPG.js +0 -149
- package/dist/mime-Cqg1jjia.js +0 -149
- package/dist/net-BEFkF-nI.js +0 -225
- package/dist/net-CNsUGiSw.js +0 -225
- package/dist/node-cli-Bu-InsO9.js +0 -1462
- package/dist/node-cli-DE7Pm7Fr.js +0 -1458
- package/dist/node-service-CumFZc9L.js +0 -67
- package/dist/node-service-DY1gG06I.js +0 -67
- package/dist/nodes-cli-B5aAExN0.js +0 -1350
- package/dist/nodes-cli-eKRqlKuO.js +0 -1346
- package/dist/nodes-screen-B3Sij1uT.js +0 -250
- package/dist/nodes-screen-DEvpoFmH.js +0 -250
- package/dist/note-CPFJCWJJ.js +0 -92
- package/dist/npm-registry-spec-BgMtTHvq.js +0 -786
- package/dist/npm-registry-spec-Dz3z1Zpd.js +0 -786
- package/dist/npm-resolution-Buio63BQ.js +0 -86
- package/dist/npm-resolution-gH1zHW2a.js +0 -86
- package/dist/onboard-BSf6qJWk.js +0 -647
- package/dist/onboard-V-SsZRk-.js +0 -649
- package/dist/onboard-auth-C_wHkop1.js +0 -207
- package/dist/onboard-auth-CkCBLvTg.js +0 -211
- package/dist/onboard-channels-DQTGPC18.js +0 -2548
- package/dist/onboard-channels-DSDQfR0u.js +0 -2547
- package/dist/onboard-helpers-Q7M6vdzh.js +0 -363
- package/dist/onboard-helpers-SCO3k5Y8.js +0 -364
- package/dist/onboard-remote-Co2hv1AD.js +0 -127
- package/dist/onboard-remote-Dl3BFSg2.js +0 -127
- package/dist/onboarding-B0bJfZ20.js +0 -588
- package/dist/onboarding-CeBR9OBi.js +0 -586
- package/dist/onboarding.finalize-BPgfWPB9.js +0 -404
- package/dist/onboarding.finalize-BmfLvNPJ.js +0 -402
- package/dist/onboarding.gateway-config-BL0Q7Wpg.js +0 -201
- package/dist/onboarding.gateway-config-D2QsXMYO.js +0 -195
- package/dist/outbound-CcaPcetn.js +0 -220
- package/dist/outbound-CeiW8z3a.js +0 -221
- package/dist/outbound-attachment-BIvFb3Is.js +0 -18
- package/dist/outbound-attachment-Bfm5-JYe.js +0 -18
- package/dist/outbound-attachment-CZ7zoYxB.js +0 -18
- package/dist/pairing-cli-CgX79ujL.js +0 -125
- package/dist/pairing-cli-DvbbXFgC.js +0 -129
- package/dist/pairing-labels-3wDxaApH.js +0 -9
- package/dist/pairing-labels-DCbWnbWk.js +0 -9
- package/dist/pairing-store-CdY7iRS0.js +0 -459
- package/dist/pairing-store-DykkYpQ7.js +0 -460
- package/dist/path-env-Cqo5LZmw.js +0 -89
- package/dist/path-env-GTM4HXCN.js +0 -89
- package/dist/path-safety-CXKAVpMp.js +0 -14
- package/dist/path-safety-DGB91qBk.js +0 -14
- package/dist/plugin-auto-enable-C6FPGg_-.js +0 -301
- package/dist/plugin-auto-enable-L8eOc8iC.js +0 -302
- package/dist/plugin-registry-CHlaWZD7.js +0 -33
- package/dist/plugin-registry-DQdMze4z.js +0 -33
- package/dist/plugin-sdk/auth/session-override.d.ts +0 -17
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.auth.d.ts +0 -18
- package/dist/plugin-sdk/link-understanding/apply.d.ts +0 -10
- package/dist/plugin-sdk/link-understanding/defaults.d.ts +0 -2
- package/dist/plugin-sdk/link-understanding/detect.d.ts +0 -3
- package/dist/plugin-sdk/link-understanding/format.d.ts +0 -4
- package/dist/plugin-sdk/link-understanding/runner.d.ts +0 -11
- package/dist/plugin-sdk/media/input-files.d.ts +0 -95
- package/dist/plugin-sdk/media-understanding/apply.d.ts +0 -19
- package/dist/plugin-sdk/media-understanding/attachments.d.ts +0 -49
- package/dist/plugin-sdk/media-understanding/concurrency.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding/defaults.d.ts +0 -11
- package/dist/plugin-sdk/media-understanding/errors.d.ts +0 -6
- package/dist/plugin-sdk/media-understanding/format.d.ts +0 -7
- package/dist/plugin-sdk/media-understanding/fs.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding/output-extract.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/anthropic/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/deepgram/audio.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding/providers/deepgram/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/google/audio.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding/providers/google/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/google/video.d.ts +0 -3
- package/dist/plugin-sdk/media-understanding/providers/groq/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/index.d.ts +0 -4
- package/dist/plugin-sdk/media-understanding/providers/minimax/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/mistral/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/moonshot/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/moonshot/video.d.ts +0 -3
- package/dist/plugin-sdk/media-understanding/providers/openai/audio.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding/providers/openai/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/providers/shared.d.ts +0 -20
- package/dist/plugin-sdk/media-understanding/providers/zai/index.d.ts +0 -2
- package/dist/plugin-sdk/media-understanding/resolve.d.ts +0 -44
- package/dist/plugin-sdk/media-understanding/runner.d.ts +0 -34
- package/dist/plugin-sdk/media-understanding/runner.entries.d.ts +0 -33
- package/dist/plugin-sdk/media-understanding/scope.d.ts +0 -9
- package/dist/plugin-sdk/media-understanding/types.d.ts +0 -59
- package/dist/plugin-sdk/media-understanding/video.d.ts +0 -2
- package/dist/plugin-sdk/utils/mask-api-key.d.ts +0 -1
- package/dist/plugin-sdk/utils/run-with-concurrency.d.ts +0 -11
- package/dist/plugins-7B167wIj.js +0 -453
- package/dist/plugins-BRHOfy1Z.js +0 -455
- package/dist/plugins-cli--I43zIaS.js +0 -797
- package/dist/plugins-cli-DIxMbY9I.js +0 -801
- package/dist/ports-BS8kQkd9.js +0 -96
- package/dist/ports-CAqyeQYZ.js +0 -316
- package/dist/ports-CTUgXF2d.js +0 -96
- package/dist/ports-DqfnVnCw.js +0 -370
- package/dist/preflight-CaRJtknt.js +0 -64
- package/dist/preflight-DeDRKMx4.js +0 -68
- package/dist/program-context-9dv7ClZz.js +0 -474
- package/dist/program-wVSvyiD-.js +0 -248
- package/dist/prompt-select-styled-BE_4W66Z.js +0 -1672
- package/dist/prompt-select-styled-BTPf06Os.js +0 -1669
- package/dist/provider-dispatcher-VZWITjmt.js +0 -660
- package/dist/provider-dispatcher-zYYGo00g.js +0 -659
- package/dist/push-apns-Cj0Ryn18.js +0 -713
- package/dist/push-apns-fFfYCqda.js +0 -711
- package/dist/pw-ai-CnN2sITD.js +0 -1908
- package/dist/pw-ai-fnX3cecw.js +0 -1911
- package/dist/qr-cli-CriPg41m.js +0 -349
- package/dist/qr-cli-DSURqD0D.js +0 -353
- package/dist/redact-snapshot-BecRL_h6.js +0 -2016
- package/dist/redact-snapshot-pTdzSrex.js +0 -2016
- package/dist/register.agent-B5_1XatO.js +0 -290
- package/dist/register.agent-Dba3CYyo.js +0 -1018
- package/dist/register.configure-DmwHGsPG.js +0 -128
- package/dist/register.configure-DrPlgBqB.js +0 -133
- package/dist/register.import-CPQqqdje.js +0 -31
- package/dist/register.import-D1UaH1QV.js +0 -29
- package/dist/register.maintenance-D76tiF4W.js +0 -501
- package/dist/register.maintenance-hUriFBfi.js +0 -499
- package/dist/register.message--VzmF3u4.js +0 -685
- package/dist/register.message-itNWUdvP.js +0 -689
- package/dist/register.onboard-Co8D908b.js +0 -93
- package/dist/register.onboard-q8JzWtuv.js +0 -97
- package/dist/register.setup-Djc6jZTc.js +0 -113
- package/dist/register.setup-hhPii4O7.js +0 -117
- package/dist/register.status-health-sessions-C1FhACQB.js +0 -668
- package/dist/register.status-health-sessions-DcUegHcH.js +0 -428
- package/dist/register.subclis-DAfihpBz.js +0 -267
- package/dist/replies-IpiCq1Ht.js +0 -136
- package/dist/replies-LSx_XhsP.js +0 -136
- package/dist/reply-D0CLqcBY.js +0 -13718
- package/dist/reply-Djq8ghfI.js +0 -13715
- package/dist/reply-directives-Cz7622Qx.js +0 -182
- package/dist/reply-directives-ssnaPNiU.js +0 -182
- package/dist/reply-payloads-CQMtrphw.js +0 -527
- package/dist/reply-prefix-CWcAZKhE.js +0 -37
- package/dist/reply-prefix-Drq7Pf3A.js +0 -37
- package/dist/resolve-route-B8uIc2H3.js +0 -249
- package/dist/resolve-route-C8ooNlI4.js +0 -249
- package/dist/response-prefix-template-DPOggmPO.js +0 -134
- package/dist/retry-BdhJlZQI.js +0 -77
- package/dist/run-main-B-Cb62fC.js +0 -306
- package/dist/runner-DUnmgjJ8.js +0 -2394
- package/dist/runner-EobZIrDt.js +0 -2394
- package/dist/secure-random-B5qmFc3N.js +0 -44
- package/dist/security-cli-05blEYyC.js +0 -482
- package/dist/security-cli-DYbt8duB.js +0 -487
- package/dist/send-7O3-bRtl.js +0 -547
- package/dist/send-9Huf62k3.js +0 -2245
- package/dist/send-B9mIJdUo.js +0 -547
- package/dist/send-Bj0RXr-a.js +0 -492
- package/dist/send-BzkAsn7K.js +0 -29
- package/dist/send-CXFhFLP9.js +0 -11
- package/dist/send-Ce_BDa8P.js +0 -349
- package/dist/send-ChvasRSh.js +0 -1779
- package/dist/send-Cl5BhbnF.js +0 -426
- package/dist/send-CpebTvM6.js +0 -374
- package/dist/send-DWf7BCPe.js +0 -492
- package/dist/send-DX8QSuSI.js +0 -1174
- package/dist/send-DZRn6PT2.js +0 -332
- package/dist/send-Dd2_MykI.js +0 -2245
- package/dist/send-IJaUAa8H.js +0 -1776
- package/dist/send-vvZXksNU.js +0 -349
- package/dist/server-BrzR9JmX.js +0 -206
- package/dist/server-_h27-uP_.js +0 -202
- package/dist/server-lifecycle-CUdA6Far.js +0 -2437
- package/dist/server-lifecycle-DQZWL8iP.js +0 -2437
- package/dist/server-node-events-DgB1z2Cx.js +0 -392
- package/dist/server-node-events-DtvPfM1I.js +0 -396
- package/dist/service-9le8AnC-.js +0 -670
- package/dist/service-Drb0kx6I.js +0 -670
- package/dist/session-BIAOl5QR.js +0 -170
- package/dist/session-Wu00pCn_.js +0 -170
- package/dist/session-cost-usage-7plmOKbs.js +0 -627
- package/dist/session-cost-usage-CPFxBFUg.js +0 -627
- package/dist/session-dirs-CfIrIJxG.js +0 -318
- package/dist/session-dirs-DlPpWt5Q.js +0 -318
- package/dist/session-utils-Sd9w4vc1.js +0 -622
- package/dist/session-utils-iL47hYmZ.js +0 -622
- package/dist/sessions-6pKQ3gN3.js +0 -247
- package/dist/sessions-ZRmCDdj1.js +0 -2569
- package/dist/shell-env-DYZq9PqC.js +0 -163
- package/dist/ssrf-B-rF_tZB.js +0 -183
- package/dist/ssrf-DJW14Wkh.js +0 -183
- package/dist/status-CTRQCXRj.js +0 -1979
- package/dist/status-Y67xsH93.js +0 -1983
- package/dist/status.update-DlBReI5-.js +0 -449
- package/dist/status.update-v7fEQ7R9.js +0 -449
- package/dist/store-B5989JkX.js +0 -64
- package/dist/store-BgtgYJoX.js +0 -53
- package/dist/store-DCrrxHyS.js +0 -2571
- package/dist/store-Ql6vAcsg.js +0 -64
- package/dist/subagent-registry-BGknZEUI.js +0 -4856
- package/dist/subagent-registry-CWeRBjfn.js +0 -4854
- package/dist/subsystem-Ct6qOOqZ.js +0 -1079
- package/dist/subsystem-PQ64_nsu.js +0 -1136
- package/dist/system-cli-CmO-4Rju.js +0 -77
- package/dist/system-cli-VBsa18K6.js +0 -73
- package/dist/systemd-CqFpK30Y.js +0 -547
- package/dist/systemd-fK9AV5bP.js +0 -547
- package/dist/systemd-hints-D3rr0j14.js +0 -278
- package/dist/systemd-hints-DNOSRaqA.js +0 -278
- package/dist/systemd-linger-B907NVVy.js +0 -75
- package/dist/systemd-linger-wYksBbM7.js +0 -75
- package/dist/tables-Boxa9MJH.js +0 -55
- package/dist/tables-CO_kxD0e.js +0 -55
- package/dist/tables-WZp8Vt9n.js +0 -55
- package/dist/tailnet-CfZhpSnt.js +0 -40
- package/dist/tailnet-D0NV0tRJ.js +0 -40
- package/dist/tailscale-B__xvMjA.js +0 -230
- package/dist/tailscale-q_ZrxUCc.js +0 -230
- package/dist/targets-B4rMyQFJ.js +0 -53
- package/dist/targets-BHYLCv06.js +0 -2534
- package/dist/targets-BjWhDMJM.js +0 -650
- package/dist/targets-BnpMZZC_.js +0 -120
- package/dist/targets-CHwGDIgO.js +0 -650
- package/dist/targets-DIDKlfKI.js +0 -220
- package/dist/targets-bqjVeCnF.js +0 -2535
- package/dist/targets-mqj9GNg1.js +0 -53
- package/dist/tool-display-C0hpLmkw.js +0 -785
- package/dist/tool-display-CQTRHo3Z.js +0 -785
- package/dist/tool-images-BYY11Gw3.js +0 -263
- package/dist/tool-images-CnJ0R8Fo.js +0 -263
- package/dist/trash-C0mjnHuW.js +0 -125
- package/dist/trash-Cgwc9mLD.js +0 -125
- package/dist/tui-9cJnR1dN.js +0 -3282
- package/dist/tui-BR3egaFJ.js +0 -3282
- package/dist/tui-cli-BYpkhE6J.js +0 -66
- package/dist/tui-cli-DndeZyup.js +0 -62
- package/dist/update-BJVdkzk7.js +0 -349
- package/dist/update-DjI6KTA5.js +0 -349
- package/dist/update-cli-B7Rl2Qr2.js +0 -1146
- package/dist/update-cli-CFk_jqUm.js +0 -1148
- package/dist/usage-CFv4a1Nf.js +0 -5448
- package/dist/voice-credentials-D59RcLbl.js +0 -45
- package/dist/voice-credentials-fjA7GShF.js +0 -45
- package/dist/web-Bs1td8Qw.js +0 -79
- package/dist/web-CSiw--Px.js +0 -3070
- package/dist/web-jRTtDiNf.js +0 -74
- package/dist/webhooks-cli-0yQha2yj.js +0 -334
- package/dist/webhooks-cli-ula0bTX-.js +0 -330
- package/dist/whatsapp-actions-3NdzsNg1.js +0 -130
- package/dist/whatsapp-actions-y_1vjkYY.js +0 -125
- package/dist/workspace-BT3X-qCZ.js +0 -449
- package/dist/workspace-D5hHXubL.js +0 -447
- package/dist/zod-schema-CbqZAIYy.js +0 -2696
- package/dist/zod-schema-YGQJEcnj.js +0 -2696
- /package/dist/{account-lookup-BOCzCnir.js → account-lookup-CIY_RKhi.js} +0 -0
- /package/dist/{account-lookup-C0ndrpt-.js → account-lookup-DGscKBsr.js} +0 -0
- /package/dist/{agent-helpers-eEHy5uX2.js → agent-helpers-D83kfcF9.js} +0 -0
- /package/dist/{agents.config-BgDBcY4h.js → agents.config-BPe_hkMn.js} +0 -0
- /package/dist/{api-Cd_7aESj.js → api-D8QQo5bc.js} +0 -0
- /package/dist/{api-DJ_oWYus.js → api-GywrnwRm.js} +0 -0
- /package/dist/{argv-BY8EVMTP.js → argv-DW4MYBdJ.js} +0 -0
- /package/dist/{bindings-Dr0bGRst.js → bindings-BpL4pISF.js} +0 -0
- /package/dist/{brew-CmTYeZk1.js → brew-CBsS-Vq1.js} +0 -0
- /package/dist/{brew-V4lMBeE3.js → brew-Clw9vXhE.js} +0 -0
- /package/dist/{chat-envelope-CrM0X4sl.js → chat-envelope-CY1yvCc-.js} +0 -0
- /package/dist/{chat-envelope-BIujl9Cj.js → chat-envelope-DUMcMMB2.js} +0 -0
- /package/dist/{chat-type-CH3W-zKy.js → chat-type-BKe459rw.js} +0 -0
- /package/dist/{chat-type-DyovJwCt.js → chat-type-CE6cJOyt.js} +0 -0
- /package/dist/{cleanup-utils-CNwlTKyR.js → cleanup-utils-365rf8YN.js} +0 -0
- /package/dist/{cleanup-utils-gNzIs9yk.js → cleanup-utils-rqUXvR3Z.js} +0 -0
- /package/dist/{cli-name-3MdfbvIR.js → cli-name-7Gb97Vyl.js} +0 -0
- /package/dist/{cli-name-CRLBidNP.js → cli-name-Yv30OygA.js} +0 -0
- /package/dist/{cli-utils-5ZIfXAfM.js → cli-utils-5W6ugvN5.js} +0 -0
- /package/dist/{cli-utils-BUOtyfnU.js → cli-utils-CZJacPS2.js} +0 -0
- /package/dist/{client-D5m46AuY.js → client-DQ-Nh-rV.js} +0 -0
- /package/dist/{client-DFyI5I0n.js → client-Fi2k2G9Z.js} +0 -0
- /package/dist/{command-options-Cn2fc1Of.js → command-options-CXHYeogR.js} +0 -0
- /package/dist/{command-options-D2nN4AXX.js → command-options-Cx6evn0x.js} +0 -0
- /package/dist/{config-eval-CU2G7a83.js → config-eval-DU_v_3lY.js} +0 -0
- /package/dist/{config-eval-BCKpAS_K.js → config-eval-V26Gl6eZ.js} +0 -0
- /package/dist/{constants-CRGAZ2ow.js → constants-C7gkSGRE.js} +0 -0
- /package/dist/{constants-BAZuhSRm.js → constants-DAiBiWlI.js} +0 -0
- /package/dist/{constants-DoYLsBmv.js → constants-DOnQraOP.js} +0 -0
- /package/dist/{constants-BBVTjb1j.js → constants-DQxqJVLu.js} +0 -0
- /package/dist/{credentials-DMAWNZdV.js → credentials-BHWUBHMd.js} +0 -0
- /package/dist/{credentials-Dmc3H-jd.js → credentials-DG0tD6-e.js} +0 -0
- /package/dist/{daemon-runtime-CzFI2dPw.js → daemon-runtime-B7Tmba31.js} +0 -0
- /package/dist/{daemon-runtime-aQhinwSL.js → daemon-runtime-KyXiP2ib.js} +0 -0
- /package/dist/{dangerous-name-matching-BlTBBZns.js → dangerous-name-matching-B4MRPcn-.js} +0 -0
- /package/dist/{dangerous-tools-BRmbBvRf.js → dangerous-tools-CIPZZJoN.js} +0 -0
- /package/dist/{dangerous-tools-E1i3IoxZ.js → dangerous-tools-D-GNbdpV.js} +0 -0
- /package/dist/{fetch-timeout-DBRRPNBi.js → fetch-timeout-CPe2rPLq.js} +0 -0
- /package/dist/{fetch-timeout-l_6RdoMw.js → fetch-timeout-DkT3EnRA.js} +0 -0
- /package/dist/{file-identity-BnGA6wyc.js → file-identity-C8MIb5lb.js} +0 -0
- /package/dist/{format-duration-B-Uv5nOi.js → format-duration-Cd7SCued.js} +0 -0
- /package/dist/{format-duration-D1M3Zxu6.js → format-duration-Oj8pTbYL.js} +0 -0
- /package/dist/{format-relative-Cywx6ldk.js → format-relative-8dpVUfzZ.js} +0 -0
- /package/dist/{format-relative-DcQZUAYl.js → format-relative-BMNeqaxW.js} +0 -0
- /package/dist/{health-format-CL2Xq92A.js → health-format-CwLlmYSK.js} +0 -0
- /package/dist/{health-format-CVgQD-z9.js → health-format-CycFH5Sj.js} +0 -0
- /package/dist/{heartbeat-wake-DLxQm6-U.js → heartbeat-wake-D6Lt5YUk.js} +0 -0
- /package/dist/{heartbeat-wake-DjsTDzF3.js → heartbeat-wake-uZkAP-tP.js} +0 -0
- /package/dist/{help-format-DM6-OBt-.js → help-format-B0YIbosn.js} +0 -0
- /package/dist/{help-format-CJQ7APRn.js → help-format-GeOPYD_A.js} +0 -0
- /package/dist/{helpers-BER76F_2.js → helpers-6_MYSJEW.js} +0 -0
- /package/dist/{helpers-DSMIGYx2.js → helpers-703bXVlF.js} +0 -0
- /package/dist/{helpers-D-r6yhnI.js → helpers-p_u0Gnj_.js} +0 -0
- /package/dist/{input-provenance-BgfeDgck.js → input-provenance-C4nlFv5Y.js} +0 -0
- /package/dist/{input-provenance-xUsSMOsz.js → input-provenance-duDehu0D.js} +0 -0
- /package/dist/{ip-BAhS4rY2.js → ip-BFJnbRh9.js} +0 -0
- /package/dist/{ip-BUhsZdJu.js → ip-D0zgNmBV.js} +0 -0
- /package/dist/{is-main-BmHYGRhd.js → is-main-BE1Jih91.js} +0 -0
- /package/dist/{json-file-B5WEJJye.js → json-file-CsV03dh-.js} +0 -0
- /package/dist/{json-file-Dbg7nZg1.js → json-file-CtQKYRLl.js} +0 -0
- /package/dist/{json-files-BFGbyEzL.js → json-files-B2yMsppu.js} +0 -0
- /package/dist/{json-files-CfhnuGaC.js → json-files-BYH8U7Mx.js} +0 -0
- /package/dist/{lanes-4FoQemog.js → lanes-BWL_LwXG.js} +0 -0
- /package/dist/{lanes-BhdzrAIa.js → lanes-cHJ5arWg.js} +0 -0
- /package/dist/{links-CwTlzaPe.js → links-BFtUmGLH.js} +0 -0
- /package/dist/{links-D5vtq30Q.js → links-BNjLUJ9U.js} +0 -0
- /package/dist/{location-50gaJF5Z.js → location-BC45kOxc.js} +0 -0
- /package/dist/{location-Qo8Ii1zo.js → location-BUhzov-a.js} +0 -0
- /package/dist/{logger-IA_Dr_BT.js → logger-1QWMF9Hc.js} +0 -0
- /package/dist/{logger-nEdVxm5D.js → logger-BWMPnILd.js} +0 -0
- /package/dist/{logger-O6JX52kK.js → logger-Liu31nEU.js} +0 -0
- /package/dist/{logging-FctZEleJ.js → logging-CtbzyUjs.js} +0 -0
- /package/dist/{logging-BiuZwq5D.js → logging-DJFQvfGD.js} +0 -0
- /package/dist/{logging-Bs1VqVFL.js → logging-JiRrQn2_.js} +0 -0
- /package/dist/{logging-JZEg5nDp.js → logging-kuFzZMsG.js} +0 -0
- /package/dist/{message-channel-tuc9CdEw.js → message-channel-DOyKgFu8.js} +0 -0
- /package/dist/{mutable-allowlist-detectors-CtKavajp.js → mutable-allowlist-detectors-4m-Kc8Kn.js} +0 -0
- /package/dist/{mutable-allowlist-detectors-TCG6mnbz.js → mutable-allowlist-detectors-BECxOoKX.js} +0 -0
- /package/dist/{onboard-config-BxfgUqk6.js → onboard-config-C9so5ggC.js} +0 -0
- /package/dist/{onboard-config-DNzlo8Cg.js → onboard-config-oXID97rS.js} +0 -0
- /package/dist/{parse-log-line-CT0H1-oQ.js → parse-log-line-BtFI563v.js} +0 -0
- /package/dist/{parse-log-line-pij_xhtE.js → parse-log-line-COptqka7.js} +0 -0
- /package/dist/{parse-timeout-CvODy9RC.js → parse-timeout-BpphuwYl.js} +0 -0
- /package/dist/{path-guards-DOpzcMXz.js → path-guards-DJteVA0d.js} +0 -0
- /package/dist/{path-guards-DipYoPVw.js → path-guards-DVRUJZVN.js} +0 -0
- /package/dist/plugin-sdk/{media-understanding → stt}/providers/google/inline-data.d.ts +0 -0
- /package/dist/{plugins-allowlist-Bcqe9Gd8.js → plugins-allowlist-Clt6dsY6.js} +0 -0
- /package/dist/{polls-DQrR-qT3.js → polls-C5xr-8pM.js} +0 -0
- /package/dist/{polls-ybwcqkWt.js → polls-DXd67TD8.js} +0 -0
- /package/dist/{ports-lsof-CDyv5GJd.js → ports-lsof-xWMTWvMQ.js} +0 -0
- /package/dist/{process-scoped-map-BwUkYFQV.js → process-scoped-map-C7KeadUK.js} +0 -0
- /package/dist/{process-scoped-map-_zxf_kLz.js → process-scoped-map-CQ1C5MbT.js} +0 -0
- /package/dist/{program-context-CG-t6Yp-.js → program-context-LuBAPt4y.js} +0 -0
- /package/dist/{progress-DRLmcFiG.js → progress-C-hTn2yV.js} +0 -0
- /package/dist/{progress-BOdRbOHD.js → progress-ChmZpgvt.js} +0 -0
- /package/dist/{prompt-WEkXwIMT.js → prompt-BXeXEH0o.js} +0 -0
- /package/dist/{prompt-BRGfic91.js → prompt-C31r0R5I.js} +0 -0
- /package/dist/{prompt-style-B4Cq4PyQ.js → prompt-style-BcM-VSMx.js} +0 -0
- /package/dist/{proxy-BMJL0Qog.js → proxy-dRhp8Ykw.js} +0 -0
- /package/dist/{pw-ai-state-CwXeO5d0.js → pw-ai-state-CjfcKQoO.js} +0 -0
- /package/dist/{pw-ai-state-DaISdsXY.js → pw-ai-state-DfjyEttO.js} +0 -0
- /package/dist/{redact-gXuh8MFk.js → redact-D975G-N6.js} +0 -0
- /package/dist/{redact-CqWx9rpK.js → redact-Dx1Fue21.js} +0 -0
- /package/dist/{redact-identifier-BJOQDEj0.js → redact-identifier-Bqj_YiPd.js} +0 -0
- /package/dist/{redact-identifier-DR54qsoT.js → redact-identifier-HyK89Sod.js} +0 -0
- /package/dist/{remoteclaw-root-CgNyrbxc.js → remoteclaw-root-B1iQBmbi.js} +0 -0
- /package/dist/{remoteclaw-root-u8dAeHID.js → remoteclaw-root-BmYwCzQN.js} +0 -0
- /package/dist/{render-CDCvpfhh.js → render-BvFSFJZW.js} +0 -0
- /package/dist/{render-CJl4GK1B.js → render-flG67HhW.js} +0 -0
- /package/dist/{response-prefix-template-D3ZcJP4E.js → response-prefix-template-DDvbVpx6.js} +0 -0
- /package/dist/{retry-cXXk2j6_.js → retry-CByUYDAZ.js} +0 -0
- /package/dist/{retry-B19gMxS7.js → retry-oNE3cBeG.js} +0 -0
- /package/dist/{runtime-guard-BS55uiSW.js → runtime-guard-CqNug-FG.js} +0 -0
- /package/dist/{runtime-guard-CK80eucm.js → runtime-guard-DAHXelsb.js} +0 -0
- /package/dist/{runtime-status-BhW7hP_U.js → runtime-status-CM4rzyfO.js} +0 -0
- /package/dist/{runtime-status-hFVEC3wO.js → runtime-status-DJYthOLz.js} +0 -0
- /package/dist/{secret-equal-CJzes24Z.js → secret-equal-1-dwi8DL.js} +0 -0
- /package/dist/{secret-equal-CQAmGfGc.js → secret-equal-CXJEZiWb.js} +0 -0
- /package/dist/{secure-random-B3f7Ri2X.js → secure-random-Ba4Y5xG5.js} +0 -0
- /package/dist/{secure-random-BkZFG9cd.js → secure-random-C6AVByhV.js} +0 -0
- /package/dist/{stagger-B-_Wnofy.js → stagger-CjeisVRF.js} +0 -0
- /package/dist/{stagger-B2ORDHsP.js → stagger-vkvpUmOz.js} +0 -0
- /package/dist/{status-C6YNwimj.js → status-DNLnVQZ4.js} +0 -0
- /package/dist/{status-yrDGXYZM.js → status-DZhl73dM.js} +0 -0
- /package/dist/{strip-inbound-meta-0cvL6itU.js → strip-inbound-meta-C3Cwe_ZO.js} +0 -0
- /package/dist/{strip-inbound-meta-DjKcSFaW.js → strip-inbound-meta-DuDjnGjC.js} +0 -0
- /package/dist/{table-ByMyHTh_.js → table-B9zSN_7D.js} +0 -0
- /package/dist/{table-C-dba-5-.js → table-j8Ayarot.js} +0 -0
- /package/dist/{target-errors-DJVRKFcU.js → target-errors-ChjvOMuV.js} +0 -0
- /package/dist/{target-errors-GZXDqlUu.js → target-errors-Dn4aykSV.js} +0 -0
- /package/dist/{targets-B_d_1z3N.js → targets-BtGRUQMa.js} +0 -0
- /package/dist/{targets-DOJXjN1U.js → targets-CE4AYRI9.js} +0 -0
- /package/dist/{targets-D01MJGnh.js → targets-DlufWCmy.js} +0 -0
- /package/dist/{targets-WSwPflb6.js → targets-akvAerZF.js} +0 -0
- /package/dist/{text-format-DarxU3JH.js → text-format-VSogn9Yq.js} +0 -0
- /package/dist/{text-format-mr5bZq0f.js → text-format-xeHt9ywT.js} +0 -0
- /package/dist/{thinking-BqJmU6Zp.js → thinking-B171Rc3-.js} +0 -0
- /package/dist/{tokens-C8yGxAcR.js → tokens-B-jmvNR9.js} +0 -0
- /package/dist/{tokens-DAFBx5qr.js → tokens-kTLGxaAF.js} +0 -0
- /package/dist/{usage-BXi79Rq6.js → usage-CRJFqYf8.js} +0 -0
- /package/dist/{usage-C1lHaofV.js → usage-Txvb0Iq2.js} +0 -0
- /package/dist/{usage-format-CD5jsZY1.js → usage-format-70DvrseE.js} +0 -0
- /package/dist/{usage-format-CRVpDVj1.js → usage-format-Bs8DkQtr.js} +0 -0
- /package/dist/{widearea-dns-C-0P7TRi.js → widearea-dns-BOgHvO4O.js} +0 -0
- /package/dist/{widearea-dns-DFZMcfLf.js → widearea-dns-CGhfClCr.js} +0 -0
- /package/dist/{workspace-BJCKO8Ns.js → workspace-DhUqtMK_.js} +0 -0
- /package/dist/{wsl-kFaeW76c.js → wsl-Cs-gowFJ.js} +0 -0
|
@@ -0,0 +1,2316 @@
|
|
|
1
|
+
import { h as resolveStateDir } from "./paths-BTaH3rLn.js";
|
|
2
|
+
import { d as GATEWAY_CLIENT_IDS, f as GATEWAY_CLIENT_MODES, p as GATEWAY_CLIENT_NAMES } from "./message-channel-EMCYRaxk.js";
|
|
3
|
+
import { t as INPUT_PROVENANCE_KIND_VALUES } from "./input-provenance-C4nlFv5Y.js";
|
|
4
|
+
import { n as readJsonFile, r as writeJsonAtomic, t as createAsyncLock } from "./json-files-B2yMsppu.js";
|
|
5
|
+
import { t as safeEqualSecret } from "./secret-equal-1-dwi8DL.js";
|
|
6
|
+
import { i as isSecureWebSocketUrl, p as rawDataToString } from "./net-DMh1m8AZ.js";
|
|
7
|
+
import { n as logError, t as logDebug } from "./logger-9I2fg5mr.js";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import crypto, { randomBytes, randomUUID } from "node:crypto";
|
|
11
|
+
import AjvPkg from "ajv";
|
|
12
|
+
import { WebSocket as WebSocket$1 } from "ws";
|
|
13
|
+
import { Type } from "@sinclair/typebox";
|
|
14
|
+
|
|
15
|
+
//#region src/infra/device-identity.ts
|
|
16
|
+
function resolveDefaultIdentityPath() {
|
|
17
|
+
return path.join(resolveStateDir(), "identity", "device.json");
|
|
18
|
+
}
|
|
19
|
+
function ensureDir(filePath) {
|
|
20
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
const ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
|
|
23
|
+
function base64UrlEncode(buf) {
|
|
24
|
+
return buf.toString("base64").replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/g, "");
|
|
25
|
+
}
|
|
26
|
+
function base64UrlDecode(input) {
|
|
27
|
+
const normalized = input.replaceAll("-", "+").replaceAll("_", "/");
|
|
28
|
+
const padded = normalized + "=".repeat((4 - normalized.length % 4) % 4);
|
|
29
|
+
return Buffer.from(padded, "base64");
|
|
30
|
+
}
|
|
31
|
+
function derivePublicKeyRaw(publicKeyPem) {
|
|
32
|
+
const spki = crypto.createPublicKey(publicKeyPem).export({
|
|
33
|
+
type: "spki",
|
|
34
|
+
format: "der"
|
|
35
|
+
});
|
|
36
|
+
if (spki.length === ED25519_SPKI_PREFIX.length + 32 && spki.subarray(0, ED25519_SPKI_PREFIX.length).equals(ED25519_SPKI_PREFIX)) return spki.subarray(ED25519_SPKI_PREFIX.length);
|
|
37
|
+
return spki;
|
|
38
|
+
}
|
|
39
|
+
function fingerprintPublicKey(publicKeyPem) {
|
|
40
|
+
const raw = derivePublicKeyRaw(publicKeyPem);
|
|
41
|
+
return crypto.createHash("sha256").update(raw).digest("hex");
|
|
42
|
+
}
|
|
43
|
+
function generateIdentity() {
|
|
44
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync("ed25519");
|
|
45
|
+
const publicKeyPem = publicKey.export({
|
|
46
|
+
type: "spki",
|
|
47
|
+
format: "pem"
|
|
48
|
+
}).toString();
|
|
49
|
+
const privateKeyPem = privateKey.export({
|
|
50
|
+
type: "pkcs8",
|
|
51
|
+
format: "pem"
|
|
52
|
+
}).toString();
|
|
53
|
+
return {
|
|
54
|
+
deviceId: fingerprintPublicKey(publicKeyPem),
|
|
55
|
+
publicKeyPem,
|
|
56
|
+
privateKeyPem
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
60
|
+
try {
|
|
61
|
+
if (fs.existsSync(filePath)) {
|
|
62
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
63
|
+
const parsed = JSON.parse(raw);
|
|
64
|
+
if (parsed?.version === 1 && typeof parsed.deviceId === "string" && typeof parsed.publicKeyPem === "string" && typeof parsed.privateKeyPem === "string") {
|
|
65
|
+
const derivedId = fingerprintPublicKey(parsed.publicKeyPem);
|
|
66
|
+
if (derivedId && derivedId !== parsed.deviceId) {
|
|
67
|
+
const updated = {
|
|
68
|
+
...parsed,
|
|
69
|
+
deviceId: derivedId
|
|
70
|
+
};
|
|
71
|
+
fs.writeFileSync(filePath, `${JSON.stringify(updated, null, 2)}\n`, { mode: 384 });
|
|
72
|
+
try {
|
|
73
|
+
fs.chmodSync(filePath, 384);
|
|
74
|
+
} catch {}
|
|
75
|
+
return {
|
|
76
|
+
deviceId: derivedId,
|
|
77
|
+
publicKeyPem: parsed.publicKeyPem,
|
|
78
|
+
privateKeyPem: parsed.privateKeyPem
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
deviceId: parsed.deviceId,
|
|
83
|
+
publicKeyPem: parsed.publicKeyPem,
|
|
84
|
+
privateKeyPem: parsed.privateKeyPem
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} catch {}
|
|
89
|
+
const identity = generateIdentity();
|
|
90
|
+
ensureDir(filePath);
|
|
91
|
+
const stored = {
|
|
92
|
+
version: 1,
|
|
93
|
+
deviceId: identity.deviceId,
|
|
94
|
+
publicKeyPem: identity.publicKeyPem,
|
|
95
|
+
privateKeyPem: identity.privateKeyPem,
|
|
96
|
+
createdAtMs: Date.now()
|
|
97
|
+
};
|
|
98
|
+
fs.writeFileSync(filePath, `${JSON.stringify(stored, null, 2)}\n`, { mode: 384 });
|
|
99
|
+
try {
|
|
100
|
+
fs.chmodSync(filePath, 384);
|
|
101
|
+
} catch {}
|
|
102
|
+
return identity;
|
|
103
|
+
}
|
|
104
|
+
function signDevicePayload(privateKeyPem, payload) {
|
|
105
|
+
const key = crypto.createPrivateKey(privateKeyPem);
|
|
106
|
+
return base64UrlEncode(crypto.sign(null, Buffer.from(payload, "utf8"), key));
|
|
107
|
+
}
|
|
108
|
+
function normalizeDevicePublicKeyBase64Url(publicKey) {
|
|
109
|
+
try {
|
|
110
|
+
if (publicKey.includes("BEGIN")) return base64UrlEncode(derivePublicKeyRaw(publicKey));
|
|
111
|
+
return base64UrlEncode(base64UrlDecode(publicKey));
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function deriveDeviceIdFromPublicKey(publicKey) {
|
|
117
|
+
try {
|
|
118
|
+
const raw = publicKey.includes("BEGIN") ? derivePublicKeyRaw(publicKey) : base64UrlDecode(publicKey);
|
|
119
|
+
return crypto.createHash("sha256").update(raw).digest("hex");
|
|
120
|
+
} catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function publicKeyRawBase64UrlFromPem(publicKeyPem) {
|
|
125
|
+
return base64UrlEncode(derivePublicKeyRaw(publicKeyPem));
|
|
126
|
+
}
|
|
127
|
+
function verifyDeviceSignature(publicKey, payload, signatureBase64Url) {
|
|
128
|
+
try {
|
|
129
|
+
const key = publicKey.includes("BEGIN") ? crypto.createPublicKey(publicKey) : crypto.createPublicKey({
|
|
130
|
+
key: Buffer.concat([ED25519_SPKI_PREFIX, base64UrlDecode(publicKey)]),
|
|
131
|
+
type: "spki",
|
|
132
|
+
format: "der"
|
|
133
|
+
});
|
|
134
|
+
const sig = (() => {
|
|
135
|
+
try {
|
|
136
|
+
return base64UrlDecode(signatureBase64Url);
|
|
137
|
+
} catch {
|
|
138
|
+
return Buffer.from(signatureBase64Url, "base64");
|
|
139
|
+
}
|
|
140
|
+
})();
|
|
141
|
+
return crypto.verify(null, Buffer.from(payload, "utf8"), key, sig);
|
|
142
|
+
} catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/infra/tls/fingerprint.ts
|
|
149
|
+
function normalizeFingerprint(input) {
|
|
150
|
+
return input.trim().replace(/^sha-?256\s*:?\s*/i, "").replace(/[^a-fA-F0-9]/g, "").toLowerCase();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/shared/device-auth.ts
|
|
155
|
+
function normalizeDeviceAuthRole(role) {
|
|
156
|
+
return role.trim();
|
|
157
|
+
}
|
|
158
|
+
function normalizeDeviceAuthScopes(scopes) {
|
|
159
|
+
if (!Array.isArray(scopes)) return [];
|
|
160
|
+
const out = /* @__PURE__ */ new Set();
|
|
161
|
+
for (const scope of scopes) {
|
|
162
|
+
const trimmed = scope.trim();
|
|
163
|
+
if (trimmed) out.add(trimmed);
|
|
164
|
+
}
|
|
165
|
+
return [...out].toSorted();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/infra/device-auth-store.ts
|
|
170
|
+
const DEVICE_AUTH_FILE = "device-auth.json";
|
|
171
|
+
function resolveDeviceAuthPath(env = process.env) {
|
|
172
|
+
return path.join(resolveStateDir(env), "identity", DEVICE_AUTH_FILE);
|
|
173
|
+
}
|
|
174
|
+
function readStore(filePath) {
|
|
175
|
+
try {
|
|
176
|
+
if (!fs.existsSync(filePath)) return null;
|
|
177
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
178
|
+
const parsed = JSON.parse(raw);
|
|
179
|
+
if (parsed?.version !== 1 || typeof parsed.deviceId !== "string") return null;
|
|
180
|
+
if (!parsed.tokens || typeof parsed.tokens !== "object") return null;
|
|
181
|
+
return parsed;
|
|
182
|
+
} catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function writeStore(filePath, store) {
|
|
187
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
188
|
+
fs.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}\n`, { mode: 384 });
|
|
189
|
+
try {
|
|
190
|
+
fs.chmodSync(filePath, 384);
|
|
191
|
+
} catch {}
|
|
192
|
+
}
|
|
193
|
+
function loadDeviceAuthToken(params) {
|
|
194
|
+
const store = readStore(resolveDeviceAuthPath(params.env));
|
|
195
|
+
if (!store) return null;
|
|
196
|
+
if (store.deviceId !== params.deviceId) return null;
|
|
197
|
+
const role = normalizeDeviceAuthRole(params.role);
|
|
198
|
+
const entry = store.tokens[role];
|
|
199
|
+
if (!entry || typeof entry.token !== "string") return null;
|
|
200
|
+
return entry;
|
|
201
|
+
}
|
|
202
|
+
function storeDeviceAuthToken(params) {
|
|
203
|
+
const filePath = resolveDeviceAuthPath(params.env);
|
|
204
|
+
const existing = readStore(filePath);
|
|
205
|
+
const role = normalizeDeviceAuthRole(params.role);
|
|
206
|
+
const next = {
|
|
207
|
+
version: 1,
|
|
208
|
+
deviceId: params.deviceId,
|
|
209
|
+
tokens: existing && existing.deviceId === params.deviceId && existing.tokens ? { ...existing.tokens } : {}
|
|
210
|
+
};
|
|
211
|
+
const entry = {
|
|
212
|
+
token: params.token,
|
|
213
|
+
role,
|
|
214
|
+
scopes: normalizeDeviceAuthScopes(params.scopes),
|
|
215
|
+
updatedAtMs: Date.now()
|
|
216
|
+
};
|
|
217
|
+
next.tokens[role] = entry;
|
|
218
|
+
writeStore(filePath, next);
|
|
219
|
+
return entry;
|
|
220
|
+
}
|
|
221
|
+
function clearDeviceAuthToken(params) {
|
|
222
|
+
const filePath = resolveDeviceAuthPath(params.env);
|
|
223
|
+
const store = readStore(filePath);
|
|
224
|
+
if (!store || store.deviceId !== params.deviceId) return;
|
|
225
|
+
const role = normalizeDeviceAuthRole(params.role);
|
|
226
|
+
if (!store.tokens[role]) return;
|
|
227
|
+
const next = {
|
|
228
|
+
version: 1,
|
|
229
|
+
deviceId: store.deviceId,
|
|
230
|
+
tokens: { ...store.tokens }
|
|
231
|
+
};
|
|
232
|
+
delete next.tokens[role];
|
|
233
|
+
writeStore(filePath, next);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/shared/operator-scope-compat.ts
|
|
238
|
+
const OPERATOR_ROLE = "operator";
|
|
239
|
+
const OPERATOR_ADMIN_SCOPE = "operator.admin";
|
|
240
|
+
const OPERATOR_READ_SCOPE = "operator.read";
|
|
241
|
+
const OPERATOR_WRITE_SCOPE = "operator.write";
|
|
242
|
+
const OPERATOR_SCOPE_PREFIX = "operator.";
|
|
243
|
+
function normalizeScopeList(scopes) {
|
|
244
|
+
const out = /* @__PURE__ */ new Set();
|
|
245
|
+
for (const scope of scopes) {
|
|
246
|
+
const trimmed = scope.trim();
|
|
247
|
+
if (trimmed) out.add(trimmed);
|
|
248
|
+
}
|
|
249
|
+
return [...out];
|
|
250
|
+
}
|
|
251
|
+
function operatorScopeSatisfied(requestedScope, granted) {
|
|
252
|
+
if (granted.has(OPERATOR_ADMIN_SCOPE) && requestedScope.startsWith(OPERATOR_SCOPE_PREFIX)) return true;
|
|
253
|
+
if (requestedScope === OPERATOR_READ_SCOPE) return granted.has(OPERATOR_READ_SCOPE) || granted.has(OPERATOR_WRITE_SCOPE);
|
|
254
|
+
if (requestedScope === OPERATOR_WRITE_SCOPE) return granted.has(OPERATOR_WRITE_SCOPE);
|
|
255
|
+
return granted.has(requestedScope);
|
|
256
|
+
}
|
|
257
|
+
function roleScopesAllow(params) {
|
|
258
|
+
const requested = normalizeScopeList(params.requestedScopes);
|
|
259
|
+
if (requested.length === 0) return true;
|
|
260
|
+
const allowed = normalizeScopeList(params.allowedScopes);
|
|
261
|
+
if (allowed.length === 0) return false;
|
|
262
|
+
const allowedSet = new Set(allowed);
|
|
263
|
+
if (params.role.trim() !== OPERATOR_ROLE) return requested.every((scope) => allowedSet.has(scope));
|
|
264
|
+
return requested.every((scope) => operatorScopeSatisfied(scope, allowedSet));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/infra/pairing-files.ts
|
|
269
|
+
function resolvePairingPaths(baseDir, subdir) {
|
|
270
|
+
const root = baseDir ?? resolveStateDir();
|
|
271
|
+
const dir = path.join(root, subdir);
|
|
272
|
+
return {
|
|
273
|
+
dir,
|
|
274
|
+
pendingPath: path.join(dir, "pending.json"),
|
|
275
|
+
pairedPath: path.join(dir, "paired.json")
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function pruneExpiredPending(pendingById, nowMs, ttlMs) {
|
|
279
|
+
for (const [id, req] of Object.entries(pendingById)) if (nowMs - req.ts > ttlMs) delete pendingById[id];
|
|
280
|
+
}
|
|
281
|
+
async function upsertPendingPairingRequest(params) {
|
|
282
|
+
const existing = Object.values(params.pendingById).find(params.isExisting);
|
|
283
|
+
if (existing) return {
|
|
284
|
+
status: "pending",
|
|
285
|
+
request: existing,
|
|
286
|
+
created: false
|
|
287
|
+
};
|
|
288
|
+
const request = params.createRequest(params.isRepair);
|
|
289
|
+
params.pendingById[request.requestId] = request;
|
|
290
|
+
await params.persist();
|
|
291
|
+
return {
|
|
292
|
+
status: "pending",
|
|
293
|
+
request,
|
|
294
|
+
created: true
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/infra/pairing-pending.ts
|
|
300
|
+
async function rejectPendingPairingRequest(params) {
|
|
301
|
+
const state = await params.loadState();
|
|
302
|
+
const pending = state.pendingById[params.requestId];
|
|
303
|
+
if (!pending) return null;
|
|
304
|
+
delete state.pendingById[params.requestId];
|
|
305
|
+
await params.persistState(state);
|
|
306
|
+
return {
|
|
307
|
+
requestId: params.requestId,
|
|
308
|
+
[params.idKey]: params.getId(pending)
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/infra/pairing-token.ts
|
|
314
|
+
const PAIRING_TOKEN_BYTES = 32;
|
|
315
|
+
function generatePairingToken() {
|
|
316
|
+
return randomBytes(PAIRING_TOKEN_BYTES).toString("base64url");
|
|
317
|
+
}
|
|
318
|
+
function verifyPairingToken(provided, expected) {
|
|
319
|
+
return safeEqualSecret(provided, expected);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/infra/device-pairing.ts
|
|
324
|
+
const PENDING_TTL_MS = 300 * 1e3;
|
|
325
|
+
const withLock = createAsyncLock();
|
|
326
|
+
async function loadState(baseDir) {
|
|
327
|
+
const { pendingPath, pairedPath } = resolvePairingPaths(baseDir, "devices");
|
|
328
|
+
const [pending, paired] = await Promise.all([readJsonFile(pendingPath), readJsonFile(pairedPath)]);
|
|
329
|
+
const state = {
|
|
330
|
+
pendingById: pending ?? {},
|
|
331
|
+
pairedByDeviceId: paired ?? {}
|
|
332
|
+
};
|
|
333
|
+
pruneExpiredPending(state.pendingById, Date.now(), PENDING_TTL_MS);
|
|
334
|
+
return state;
|
|
335
|
+
}
|
|
336
|
+
async function persistState(state, baseDir) {
|
|
337
|
+
const { pendingPath, pairedPath } = resolvePairingPaths(baseDir, "devices");
|
|
338
|
+
await Promise.all([writeJsonAtomic(pendingPath, state.pendingById), writeJsonAtomic(pairedPath, state.pairedByDeviceId)]);
|
|
339
|
+
}
|
|
340
|
+
function normalizeDeviceId(deviceId) {
|
|
341
|
+
return deviceId.trim();
|
|
342
|
+
}
|
|
343
|
+
function normalizeRole(role) {
|
|
344
|
+
const trimmed = role?.trim();
|
|
345
|
+
return trimmed ? trimmed : null;
|
|
346
|
+
}
|
|
347
|
+
function mergeRoles(...items) {
|
|
348
|
+
const roles = /* @__PURE__ */ new Set();
|
|
349
|
+
for (const item of items) {
|
|
350
|
+
if (!item) continue;
|
|
351
|
+
if (Array.isArray(item)) for (const role of item) {
|
|
352
|
+
const trimmed = role.trim();
|
|
353
|
+
if (trimmed) roles.add(trimmed);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const trimmed = item.trim();
|
|
357
|
+
if (trimmed) roles.add(trimmed);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (roles.size === 0) return;
|
|
361
|
+
return [...roles];
|
|
362
|
+
}
|
|
363
|
+
function mergeScopes(...items) {
|
|
364
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
365
|
+
for (const item of items) {
|
|
366
|
+
if (!item) continue;
|
|
367
|
+
for (const scope of item) {
|
|
368
|
+
const trimmed = scope.trim();
|
|
369
|
+
if (trimmed) scopes.add(trimmed);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (scopes.size === 0) return;
|
|
373
|
+
return [...scopes];
|
|
374
|
+
}
|
|
375
|
+
function mergePendingDevicePairingRequest(existing, incoming, isRepair) {
|
|
376
|
+
const existingRole = normalizeRole(existing.role);
|
|
377
|
+
const incomingRole = normalizeRole(incoming.role);
|
|
378
|
+
return {
|
|
379
|
+
...existing,
|
|
380
|
+
displayName: incoming.displayName ?? existing.displayName,
|
|
381
|
+
platform: incoming.platform ?? existing.platform,
|
|
382
|
+
clientId: incoming.clientId ?? existing.clientId,
|
|
383
|
+
clientMode: incoming.clientMode ?? existing.clientMode,
|
|
384
|
+
role: existingRole ?? incomingRole ?? void 0,
|
|
385
|
+
roles: mergeRoles(existing.roles, existing.role, incoming.role),
|
|
386
|
+
scopes: mergeScopes(existing.scopes, incoming.scopes),
|
|
387
|
+
remoteIp: incoming.remoteIp ?? existing.remoteIp,
|
|
388
|
+
silent: Boolean(existing.silent && incoming.silent),
|
|
389
|
+
isRepair: existing.isRepair || isRepair,
|
|
390
|
+
ts: Date.now()
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function scopesAllow(requested, allowed) {
|
|
394
|
+
if (requested.length === 0) return true;
|
|
395
|
+
if (allowed.length === 0) return false;
|
|
396
|
+
const allowedSet = new Set(allowed);
|
|
397
|
+
return requested.every((scope) => allowedSet.has(scope));
|
|
398
|
+
}
|
|
399
|
+
const DEVICE_SCOPE_IMPLICATIONS = {
|
|
400
|
+
"operator.admin": [
|
|
401
|
+
"operator.read",
|
|
402
|
+
"operator.write",
|
|
403
|
+
"operator.approvals",
|
|
404
|
+
"operator.pairing"
|
|
405
|
+
],
|
|
406
|
+
"operator.write": ["operator.read"]
|
|
407
|
+
};
|
|
408
|
+
function expandScopeImplications(scopes) {
|
|
409
|
+
const expanded = new Set(scopes);
|
|
410
|
+
const queue = [...scopes];
|
|
411
|
+
while (queue.length > 0) {
|
|
412
|
+
const scope = queue.pop();
|
|
413
|
+
if (!scope) continue;
|
|
414
|
+
for (const impliedScope of DEVICE_SCOPE_IMPLICATIONS[scope] ?? []) if (!expanded.has(impliedScope)) {
|
|
415
|
+
expanded.add(impliedScope);
|
|
416
|
+
queue.push(impliedScope);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return [...expanded];
|
|
420
|
+
}
|
|
421
|
+
function scopesAllowWithImplications(requested, allowed) {
|
|
422
|
+
return scopesAllow(expandScopeImplications(requested), expandScopeImplications(allowed));
|
|
423
|
+
}
|
|
424
|
+
function newToken() {
|
|
425
|
+
return generatePairingToken();
|
|
426
|
+
}
|
|
427
|
+
function getPairedDeviceFromState(state, deviceId) {
|
|
428
|
+
return state.pairedByDeviceId[normalizeDeviceId(deviceId)] ?? null;
|
|
429
|
+
}
|
|
430
|
+
function cloneDeviceTokens(device) {
|
|
431
|
+
return device.tokens ? { ...device.tokens } : {};
|
|
432
|
+
}
|
|
433
|
+
function buildDeviceAuthToken(params) {
|
|
434
|
+
return {
|
|
435
|
+
token: newToken(),
|
|
436
|
+
role: params.role,
|
|
437
|
+
scopes: params.scopes,
|
|
438
|
+
createdAtMs: params.existing?.createdAtMs ?? params.now,
|
|
439
|
+
rotatedAtMs: params.rotatedAtMs,
|
|
440
|
+
revokedAtMs: void 0,
|
|
441
|
+
lastUsedAtMs: params.existing?.lastUsedAtMs
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
async function listDevicePairing(baseDir) {
|
|
445
|
+
const state = await loadState(baseDir);
|
|
446
|
+
return {
|
|
447
|
+
pending: Object.values(state.pendingById).toSorted((a, b) => b.ts - a.ts),
|
|
448
|
+
paired: Object.values(state.pairedByDeviceId).toSorted((a, b) => b.approvedAtMs - a.approvedAtMs)
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
async function getPairedDevice(deviceId, baseDir) {
|
|
452
|
+
return (await loadState(baseDir)).pairedByDeviceId[normalizeDeviceId(deviceId)] ?? null;
|
|
453
|
+
}
|
|
454
|
+
async function requestDevicePairing(req, baseDir) {
|
|
455
|
+
return await withLock(async () => {
|
|
456
|
+
const state = await loadState(baseDir);
|
|
457
|
+
const deviceId = normalizeDeviceId(req.deviceId);
|
|
458
|
+
if (!deviceId) throw new Error("deviceId required");
|
|
459
|
+
const isRepair = Boolean(state.pairedByDeviceId[deviceId]);
|
|
460
|
+
const existing = Object.values(state.pendingById).find((pending) => pending.deviceId === deviceId);
|
|
461
|
+
if (existing) {
|
|
462
|
+
const merged = mergePendingDevicePairingRequest(existing, req, isRepair);
|
|
463
|
+
state.pendingById[existing.requestId] = merged;
|
|
464
|
+
await persistState(state, baseDir);
|
|
465
|
+
return {
|
|
466
|
+
status: "pending",
|
|
467
|
+
request: merged,
|
|
468
|
+
created: false
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
const request = {
|
|
472
|
+
requestId: randomUUID(),
|
|
473
|
+
deviceId,
|
|
474
|
+
publicKey: req.publicKey,
|
|
475
|
+
displayName: req.displayName,
|
|
476
|
+
platform: req.platform,
|
|
477
|
+
clientId: req.clientId,
|
|
478
|
+
clientMode: req.clientMode,
|
|
479
|
+
role: req.role,
|
|
480
|
+
roles: req.role ? [req.role] : void 0,
|
|
481
|
+
scopes: req.scopes,
|
|
482
|
+
remoteIp: req.remoteIp,
|
|
483
|
+
silent: req.silent,
|
|
484
|
+
isRepair,
|
|
485
|
+
ts: Date.now()
|
|
486
|
+
};
|
|
487
|
+
state.pendingById[request.requestId] = request;
|
|
488
|
+
await persistState(state, baseDir);
|
|
489
|
+
return {
|
|
490
|
+
status: "pending",
|
|
491
|
+
request,
|
|
492
|
+
created: true
|
|
493
|
+
};
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
async function approveDevicePairing(requestId, baseDir) {
|
|
497
|
+
return await withLock(async () => {
|
|
498
|
+
const state = await loadState(baseDir);
|
|
499
|
+
const pending = state.pendingById[requestId];
|
|
500
|
+
if (!pending) return null;
|
|
501
|
+
const now = Date.now();
|
|
502
|
+
const existing = state.pairedByDeviceId[pending.deviceId];
|
|
503
|
+
const roles = mergeRoles(existing?.roles, existing?.role, pending.roles, pending.role);
|
|
504
|
+
const approvedScopes = mergeScopes(existing?.approvedScopes ?? existing?.scopes, pending.scopes);
|
|
505
|
+
const tokens = existing?.tokens ? { ...existing.tokens } : {};
|
|
506
|
+
const roleForToken = normalizeRole(pending.role);
|
|
507
|
+
if (roleForToken) {
|
|
508
|
+
const existingToken = tokens[roleForToken];
|
|
509
|
+
const requestedScopes = normalizeDeviceAuthScopes(pending.scopes);
|
|
510
|
+
const nextScopes = requestedScopes.length > 0 ? requestedScopes : normalizeDeviceAuthScopes(existingToken?.scopes ?? approvedScopes ?? existing?.approvedScopes ?? existing?.scopes);
|
|
511
|
+
const now = Date.now();
|
|
512
|
+
tokens[roleForToken] = {
|
|
513
|
+
token: newToken(),
|
|
514
|
+
role: roleForToken,
|
|
515
|
+
scopes: nextScopes,
|
|
516
|
+
createdAtMs: existingToken?.createdAtMs ?? now,
|
|
517
|
+
rotatedAtMs: existingToken ? now : void 0,
|
|
518
|
+
revokedAtMs: void 0,
|
|
519
|
+
lastUsedAtMs: existingToken?.lastUsedAtMs
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
const device = {
|
|
523
|
+
deviceId: pending.deviceId,
|
|
524
|
+
publicKey: pending.publicKey,
|
|
525
|
+
displayName: pending.displayName,
|
|
526
|
+
platform: pending.platform,
|
|
527
|
+
clientId: pending.clientId,
|
|
528
|
+
clientMode: pending.clientMode,
|
|
529
|
+
role: pending.role,
|
|
530
|
+
roles,
|
|
531
|
+
scopes: approvedScopes,
|
|
532
|
+
approvedScopes,
|
|
533
|
+
remoteIp: pending.remoteIp,
|
|
534
|
+
tokens,
|
|
535
|
+
createdAtMs: existing?.createdAtMs ?? now,
|
|
536
|
+
approvedAtMs: now
|
|
537
|
+
};
|
|
538
|
+
delete state.pendingById[requestId];
|
|
539
|
+
state.pairedByDeviceId[device.deviceId] = device;
|
|
540
|
+
await persistState(state, baseDir);
|
|
541
|
+
return {
|
|
542
|
+
requestId,
|
|
543
|
+
device
|
|
544
|
+
};
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async function rejectDevicePairing(requestId, baseDir) {
|
|
548
|
+
return await withLock(async () => {
|
|
549
|
+
return await rejectPendingPairingRequest({
|
|
550
|
+
requestId,
|
|
551
|
+
idKey: "deviceId",
|
|
552
|
+
loadState: () => loadState(baseDir),
|
|
553
|
+
persistState: (state) => persistState(state, baseDir),
|
|
554
|
+
getId: (pending) => pending.deviceId
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
async function removePairedDevice(deviceId, baseDir) {
|
|
559
|
+
return await withLock(async () => {
|
|
560
|
+
const state = await loadState(baseDir);
|
|
561
|
+
const normalized = normalizeDeviceId(deviceId);
|
|
562
|
+
if (!normalized || !state.pairedByDeviceId[normalized]) return null;
|
|
563
|
+
delete state.pairedByDeviceId[normalized];
|
|
564
|
+
await persistState(state, baseDir);
|
|
565
|
+
return { deviceId: normalized };
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
async function updatePairedDeviceMetadata(deviceId, patch, baseDir) {
|
|
569
|
+
return await withLock(async () => {
|
|
570
|
+
const state = await loadState(baseDir);
|
|
571
|
+
const existing = state.pairedByDeviceId[normalizeDeviceId(deviceId)];
|
|
572
|
+
if (!existing) return;
|
|
573
|
+
const roles = mergeRoles(existing.roles, existing.role, patch.role);
|
|
574
|
+
const scopes = mergeScopes(existing.scopes, patch.scopes);
|
|
575
|
+
state.pairedByDeviceId[deviceId] = {
|
|
576
|
+
...existing,
|
|
577
|
+
...patch,
|
|
578
|
+
deviceId: existing.deviceId,
|
|
579
|
+
createdAtMs: existing.createdAtMs,
|
|
580
|
+
approvedAtMs: existing.approvedAtMs,
|
|
581
|
+
approvedScopes: existing.approvedScopes,
|
|
582
|
+
role: patch.role ?? existing.role,
|
|
583
|
+
roles,
|
|
584
|
+
scopes
|
|
585
|
+
};
|
|
586
|
+
await persistState(state, baseDir);
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
function summarizeDeviceTokens(tokens) {
|
|
590
|
+
if (!tokens) return;
|
|
591
|
+
const summaries = Object.values(tokens).map((token) => ({
|
|
592
|
+
role: token.role,
|
|
593
|
+
scopes: token.scopes,
|
|
594
|
+
createdAtMs: token.createdAtMs,
|
|
595
|
+
rotatedAtMs: token.rotatedAtMs,
|
|
596
|
+
revokedAtMs: token.revokedAtMs,
|
|
597
|
+
lastUsedAtMs: token.lastUsedAtMs
|
|
598
|
+
})).toSorted((a, b) => a.role.localeCompare(b.role));
|
|
599
|
+
return summaries.length > 0 ? summaries : void 0;
|
|
600
|
+
}
|
|
601
|
+
async function verifyDeviceToken(params) {
|
|
602
|
+
return await withLock(async () => {
|
|
603
|
+
const state = await loadState(params.baseDir);
|
|
604
|
+
const device = getPairedDeviceFromState(state, params.deviceId);
|
|
605
|
+
if (!device) return {
|
|
606
|
+
ok: false,
|
|
607
|
+
reason: "device-not-paired"
|
|
608
|
+
};
|
|
609
|
+
const role = normalizeRole(params.role);
|
|
610
|
+
if (!role) return {
|
|
611
|
+
ok: false,
|
|
612
|
+
reason: "role-missing"
|
|
613
|
+
};
|
|
614
|
+
const entry = device.tokens?.[role];
|
|
615
|
+
if (!entry) return {
|
|
616
|
+
ok: false,
|
|
617
|
+
reason: "token-missing"
|
|
618
|
+
};
|
|
619
|
+
if (entry.revokedAtMs) return {
|
|
620
|
+
ok: false,
|
|
621
|
+
reason: "token-revoked"
|
|
622
|
+
};
|
|
623
|
+
if (!verifyPairingToken(params.token, entry.token)) return {
|
|
624
|
+
ok: false,
|
|
625
|
+
reason: "token-mismatch"
|
|
626
|
+
};
|
|
627
|
+
if (!roleScopesAllow({
|
|
628
|
+
role,
|
|
629
|
+
requestedScopes: normalizeDeviceAuthScopes(params.scopes),
|
|
630
|
+
allowedScopes: entry.scopes
|
|
631
|
+
})) return {
|
|
632
|
+
ok: false,
|
|
633
|
+
reason: "scope-mismatch"
|
|
634
|
+
};
|
|
635
|
+
entry.lastUsedAtMs = Date.now();
|
|
636
|
+
device.tokens ??= {};
|
|
637
|
+
device.tokens[role] = entry;
|
|
638
|
+
state.pairedByDeviceId[device.deviceId] = device;
|
|
639
|
+
await persistState(state, params.baseDir);
|
|
640
|
+
return { ok: true };
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
async function ensureDeviceToken(params) {
|
|
644
|
+
return await withLock(async () => {
|
|
645
|
+
const state = await loadState(params.baseDir);
|
|
646
|
+
const requestedScopes = normalizeDeviceAuthScopes(params.scopes);
|
|
647
|
+
const context = resolveDeviceTokenUpdateContext({
|
|
648
|
+
state,
|
|
649
|
+
deviceId: params.deviceId,
|
|
650
|
+
role: params.role
|
|
651
|
+
});
|
|
652
|
+
if (!context) return null;
|
|
653
|
+
const { device, role, tokens, existing } = context;
|
|
654
|
+
if (existing && !existing.revokedAtMs) {
|
|
655
|
+
if (roleScopesAllow({
|
|
656
|
+
role,
|
|
657
|
+
requestedScopes,
|
|
658
|
+
allowedScopes: existing.scopes
|
|
659
|
+
})) return existing;
|
|
660
|
+
}
|
|
661
|
+
const now = Date.now();
|
|
662
|
+
const next = buildDeviceAuthToken({
|
|
663
|
+
role,
|
|
664
|
+
scopes: requestedScopes,
|
|
665
|
+
existing,
|
|
666
|
+
now,
|
|
667
|
+
rotatedAtMs: existing ? now : void 0
|
|
668
|
+
});
|
|
669
|
+
tokens[role] = next;
|
|
670
|
+
device.tokens = tokens;
|
|
671
|
+
state.pairedByDeviceId[device.deviceId] = device;
|
|
672
|
+
await persistState(state, params.baseDir);
|
|
673
|
+
return next;
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function resolveDeviceTokenUpdateContext(params) {
|
|
677
|
+
const device = getPairedDeviceFromState(params.state, params.deviceId);
|
|
678
|
+
if (!device) return null;
|
|
679
|
+
const role = normalizeRole(params.role);
|
|
680
|
+
if (!role) return null;
|
|
681
|
+
const tokens = cloneDeviceTokens(device);
|
|
682
|
+
return {
|
|
683
|
+
device,
|
|
684
|
+
role,
|
|
685
|
+
tokens,
|
|
686
|
+
existing: tokens[role]
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
async function rotateDeviceToken(params) {
|
|
690
|
+
return await withLock(async () => {
|
|
691
|
+
const state = await loadState(params.baseDir);
|
|
692
|
+
const context = resolveDeviceTokenUpdateContext({
|
|
693
|
+
state,
|
|
694
|
+
deviceId: params.deviceId,
|
|
695
|
+
role: params.role
|
|
696
|
+
});
|
|
697
|
+
if (!context) return null;
|
|
698
|
+
const { device, role, tokens, existing } = context;
|
|
699
|
+
const requestedScopes = normalizeDeviceAuthScopes(params.scopes ?? existing?.scopes ?? device.scopes);
|
|
700
|
+
if (!scopesAllowWithImplications(requestedScopes, normalizeDeviceAuthScopes(device.approvedScopes ?? device.scopes ?? existing?.scopes))) return null;
|
|
701
|
+
const now = Date.now();
|
|
702
|
+
const next = buildDeviceAuthToken({
|
|
703
|
+
role,
|
|
704
|
+
scopes: requestedScopes,
|
|
705
|
+
existing,
|
|
706
|
+
now,
|
|
707
|
+
rotatedAtMs: now
|
|
708
|
+
});
|
|
709
|
+
tokens[role] = next;
|
|
710
|
+
device.tokens = tokens;
|
|
711
|
+
state.pairedByDeviceId[device.deviceId] = device;
|
|
712
|
+
await persistState(state, params.baseDir);
|
|
713
|
+
return next;
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
async function revokeDeviceToken(params) {
|
|
717
|
+
return await withLock(async () => {
|
|
718
|
+
const state = await loadState(params.baseDir);
|
|
719
|
+
const device = state.pairedByDeviceId[normalizeDeviceId(params.deviceId)];
|
|
720
|
+
if (!device) return null;
|
|
721
|
+
const role = normalizeRole(params.role);
|
|
722
|
+
if (!role) return null;
|
|
723
|
+
if (!device.tokens?.[role]) return null;
|
|
724
|
+
const tokens = { ...device.tokens };
|
|
725
|
+
const entry = {
|
|
726
|
+
...tokens[role],
|
|
727
|
+
revokedAtMs: Date.now()
|
|
728
|
+
};
|
|
729
|
+
tokens[role] = entry;
|
|
730
|
+
device.tokens = tokens;
|
|
731
|
+
state.pairedByDeviceId[device.deviceId] = device;
|
|
732
|
+
await persistState(state, params.baseDir);
|
|
733
|
+
return entry;
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
async function clearDevicePairing(deviceId, baseDir) {
|
|
737
|
+
return await withLock(async () => {
|
|
738
|
+
const state = await loadState(baseDir);
|
|
739
|
+
const normalizedId = normalizeDeviceId(deviceId);
|
|
740
|
+
if (!state.pairedByDeviceId[normalizedId]) return false;
|
|
741
|
+
delete state.pairedByDeviceId[normalizedId];
|
|
742
|
+
await persistState(state, baseDir);
|
|
743
|
+
return true;
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/gateway/device-auth.ts
|
|
749
|
+
function buildDeviceAuthPayload(params) {
|
|
750
|
+
const scopes = params.scopes.join(",");
|
|
751
|
+
const token = params.token ?? "";
|
|
752
|
+
return [
|
|
753
|
+
"v2",
|
|
754
|
+
params.deviceId,
|
|
755
|
+
params.clientId,
|
|
756
|
+
params.clientMode,
|
|
757
|
+
params.role,
|
|
758
|
+
scopes,
|
|
759
|
+
String(params.signedAtMs),
|
|
760
|
+
token,
|
|
761
|
+
params.nonce
|
|
762
|
+
].join("|");
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region src/sessions/session-label.ts
|
|
767
|
+
const SESSION_LABEL_MAX_LENGTH = 64;
|
|
768
|
+
function parseSessionLabel(raw) {
|
|
769
|
+
if (typeof raw !== "string") return {
|
|
770
|
+
ok: false,
|
|
771
|
+
error: "invalid label: must be a string"
|
|
772
|
+
};
|
|
773
|
+
const trimmed = raw.trim();
|
|
774
|
+
if (!trimmed) return {
|
|
775
|
+
ok: false,
|
|
776
|
+
error: "invalid label: empty"
|
|
777
|
+
};
|
|
778
|
+
if (trimmed.length > SESSION_LABEL_MAX_LENGTH) return {
|
|
779
|
+
ok: false,
|
|
780
|
+
error: `invalid label: too long (max ${SESSION_LABEL_MAX_LENGTH})`
|
|
781
|
+
};
|
|
782
|
+
return {
|
|
783
|
+
ok: true,
|
|
784
|
+
label: trimmed
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/gateway/protocol/schema/primitives.ts
|
|
790
|
+
const NonEmptyString = Type.String({ minLength: 1 });
|
|
791
|
+
const SessionLabelString = Type.String({
|
|
792
|
+
minLength: 1,
|
|
793
|
+
maxLength: SESSION_LABEL_MAX_LENGTH
|
|
794
|
+
});
|
|
795
|
+
const GatewayClientIdSchema = Type.Union(Object.values(GATEWAY_CLIENT_IDS).map((value) => Type.Literal(value)));
|
|
796
|
+
const GatewayClientModeSchema = Type.Union(Object.values(GATEWAY_CLIENT_MODES).map((value) => Type.Literal(value)));
|
|
797
|
+
|
|
798
|
+
//#endregion
|
|
799
|
+
//#region src/gateway/protocol/schema/agent.ts
|
|
800
|
+
const AgentEventSchema = Type.Object({
|
|
801
|
+
runId: NonEmptyString,
|
|
802
|
+
seq: Type.Integer({ minimum: 0 }),
|
|
803
|
+
stream: NonEmptyString,
|
|
804
|
+
ts: Type.Integer({ minimum: 0 }),
|
|
805
|
+
data: Type.Record(Type.String(), Type.Unknown())
|
|
806
|
+
}, { additionalProperties: false });
|
|
807
|
+
const SendParamsSchema = Type.Object({
|
|
808
|
+
to: NonEmptyString,
|
|
809
|
+
message: Type.Optional(Type.String()),
|
|
810
|
+
mediaUrl: Type.Optional(Type.String()),
|
|
811
|
+
mediaUrls: Type.Optional(Type.Array(Type.String())),
|
|
812
|
+
gifPlayback: Type.Optional(Type.Boolean()),
|
|
813
|
+
channel: Type.Optional(Type.String()),
|
|
814
|
+
accountId: Type.Optional(Type.String()),
|
|
815
|
+
threadId: Type.Optional(Type.String()),
|
|
816
|
+
sessionKey: Type.Optional(Type.String()),
|
|
817
|
+
idempotencyKey: NonEmptyString
|
|
818
|
+
}, { additionalProperties: false });
|
|
819
|
+
const PollParamsSchema = Type.Object({
|
|
820
|
+
to: NonEmptyString,
|
|
821
|
+
question: NonEmptyString,
|
|
822
|
+
options: Type.Array(NonEmptyString, {
|
|
823
|
+
minItems: 2,
|
|
824
|
+
maxItems: 12
|
|
825
|
+
}),
|
|
826
|
+
maxSelections: Type.Optional(Type.Integer({
|
|
827
|
+
minimum: 1,
|
|
828
|
+
maximum: 12
|
|
829
|
+
})),
|
|
830
|
+
durationSeconds: Type.Optional(Type.Integer({
|
|
831
|
+
minimum: 1,
|
|
832
|
+
maximum: 604800
|
|
833
|
+
})),
|
|
834
|
+
durationHours: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
835
|
+
silent: Type.Optional(Type.Boolean()),
|
|
836
|
+
isAnonymous: Type.Optional(Type.Boolean()),
|
|
837
|
+
threadId: Type.Optional(Type.String()),
|
|
838
|
+
channel: Type.Optional(Type.String()),
|
|
839
|
+
accountId: Type.Optional(Type.String()),
|
|
840
|
+
idempotencyKey: NonEmptyString
|
|
841
|
+
}, { additionalProperties: false });
|
|
842
|
+
const AgentParamsSchema = Type.Object({
|
|
843
|
+
message: NonEmptyString,
|
|
844
|
+
agentId: Type.Optional(NonEmptyString),
|
|
845
|
+
to: Type.Optional(Type.String()),
|
|
846
|
+
replyTo: Type.Optional(Type.String()),
|
|
847
|
+
sessionId: Type.Optional(Type.String()),
|
|
848
|
+
sessionKey: Type.Optional(Type.String()),
|
|
849
|
+
thinking: Type.Optional(Type.String()),
|
|
850
|
+
deliver: Type.Optional(Type.Boolean()),
|
|
851
|
+
attachments: Type.Optional(Type.Array(Type.Unknown())),
|
|
852
|
+
channel: Type.Optional(Type.String()),
|
|
853
|
+
replyChannel: Type.Optional(Type.String()),
|
|
854
|
+
accountId: Type.Optional(Type.String()),
|
|
855
|
+
replyAccountId: Type.Optional(Type.String()),
|
|
856
|
+
threadId: Type.Optional(Type.String()),
|
|
857
|
+
groupId: Type.Optional(Type.String()),
|
|
858
|
+
groupChannel: Type.Optional(Type.String()),
|
|
859
|
+
groupSpace: Type.Optional(Type.String()),
|
|
860
|
+
timeout: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
861
|
+
bestEffortDeliver: Type.Optional(Type.Boolean()),
|
|
862
|
+
lane: Type.Optional(Type.String()),
|
|
863
|
+
extraSystemPrompt: Type.Optional(Type.String()),
|
|
864
|
+
inputProvenance: Type.Optional(Type.Object({
|
|
865
|
+
kind: Type.String({ enum: [...INPUT_PROVENANCE_KIND_VALUES] }),
|
|
866
|
+
sourceSessionKey: Type.Optional(Type.String()),
|
|
867
|
+
sourceChannel: Type.Optional(Type.String()),
|
|
868
|
+
sourceTool: Type.Optional(Type.String())
|
|
869
|
+
}, { additionalProperties: false })),
|
|
870
|
+
idempotencyKey: NonEmptyString,
|
|
871
|
+
label: Type.Optional(SessionLabelString),
|
|
872
|
+
spawnedBy: Type.Optional(Type.String())
|
|
873
|
+
}, { additionalProperties: false });
|
|
874
|
+
const AgentIdentityParamsSchema = Type.Object({
|
|
875
|
+
agentId: Type.Optional(NonEmptyString),
|
|
876
|
+
sessionKey: Type.Optional(Type.String())
|
|
877
|
+
}, { additionalProperties: false });
|
|
878
|
+
const AgentIdentityResultSchema = Type.Object({
|
|
879
|
+
agentId: NonEmptyString,
|
|
880
|
+
name: Type.Optional(NonEmptyString),
|
|
881
|
+
avatar: Type.Optional(NonEmptyString),
|
|
882
|
+
emoji: Type.Optional(NonEmptyString)
|
|
883
|
+
}, { additionalProperties: false });
|
|
884
|
+
const AgentWaitParamsSchema = Type.Object({
|
|
885
|
+
runId: NonEmptyString,
|
|
886
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
887
|
+
}, { additionalProperties: false });
|
|
888
|
+
const WakeParamsSchema = Type.Object({
|
|
889
|
+
mode: Type.Union([Type.Literal("now"), Type.Literal("next-heartbeat")]),
|
|
890
|
+
text: NonEmptyString
|
|
891
|
+
}, { additionalProperties: false });
|
|
892
|
+
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/gateway/protocol/schema/agents-models-skills.ts
|
|
895
|
+
const ModelChoiceSchema = Type.Object({
|
|
896
|
+
id: NonEmptyString,
|
|
897
|
+
name: NonEmptyString,
|
|
898
|
+
provider: NonEmptyString,
|
|
899
|
+
contextWindow: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
900
|
+
reasoning: Type.Optional(Type.Boolean())
|
|
901
|
+
}, { additionalProperties: false });
|
|
902
|
+
const AgentSummarySchema = Type.Object({
|
|
903
|
+
id: NonEmptyString,
|
|
904
|
+
name: Type.Optional(NonEmptyString),
|
|
905
|
+
identity: Type.Optional(Type.Object({
|
|
906
|
+
name: Type.Optional(NonEmptyString),
|
|
907
|
+
theme: Type.Optional(NonEmptyString),
|
|
908
|
+
emoji: Type.Optional(NonEmptyString),
|
|
909
|
+
avatar: Type.Optional(NonEmptyString),
|
|
910
|
+
avatarUrl: Type.Optional(NonEmptyString)
|
|
911
|
+
}, { additionalProperties: false }))
|
|
912
|
+
}, { additionalProperties: false });
|
|
913
|
+
const AgentsListParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
914
|
+
const AgentsListResultSchema = Type.Object({
|
|
915
|
+
defaultId: NonEmptyString,
|
|
916
|
+
mainKey: NonEmptyString,
|
|
917
|
+
scope: Type.Union([Type.Literal("per-sender"), Type.Literal("global")]),
|
|
918
|
+
agents: Type.Array(AgentSummarySchema)
|
|
919
|
+
}, { additionalProperties: false });
|
|
920
|
+
const AgentsCreateParamsSchema = Type.Object({
|
|
921
|
+
name: NonEmptyString,
|
|
922
|
+
workspace: NonEmptyString,
|
|
923
|
+
emoji: Type.Optional(Type.String()),
|
|
924
|
+
avatar: Type.Optional(Type.String())
|
|
925
|
+
}, { additionalProperties: false });
|
|
926
|
+
const AgentsCreateResultSchema = Type.Object({
|
|
927
|
+
ok: Type.Literal(true),
|
|
928
|
+
agentId: NonEmptyString,
|
|
929
|
+
name: NonEmptyString,
|
|
930
|
+
workspace: NonEmptyString
|
|
931
|
+
}, { additionalProperties: false });
|
|
932
|
+
const AgentsUpdateParamsSchema = Type.Object({
|
|
933
|
+
agentId: NonEmptyString,
|
|
934
|
+
name: Type.Optional(NonEmptyString),
|
|
935
|
+
workspace: Type.Optional(NonEmptyString),
|
|
936
|
+
model: Type.Optional(NonEmptyString),
|
|
937
|
+
avatar: Type.Optional(Type.String())
|
|
938
|
+
}, { additionalProperties: false });
|
|
939
|
+
const AgentsUpdateResultSchema = Type.Object({
|
|
940
|
+
ok: Type.Literal(true),
|
|
941
|
+
agentId: NonEmptyString
|
|
942
|
+
}, { additionalProperties: false });
|
|
943
|
+
const AgentsDeleteParamsSchema = Type.Object({
|
|
944
|
+
agentId: NonEmptyString,
|
|
945
|
+
deleteFiles: Type.Optional(Type.Boolean())
|
|
946
|
+
}, { additionalProperties: false });
|
|
947
|
+
const AgentsDeleteResultSchema = Type.Object({
|
|
948
|
+
ok: Type.Literal(true),
|
|
949
|
+
agentId: NonEmptyString,
|
|
950
|
+
removedBindings: Type.Integer({ minimum: 0 })
|
|
951
|
+
}, { additionalProperties: false });
|
|
952
|
+
const AgentsFileEntrySchema = Type.Object({
|
|
953
|
+
name: NonEmptyString,
|
|
954
|
+
path: NonEmptyString,
|
|
955
|
+
missing: Type.Boolean(),
|
|
956
|
+
size: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
957
|
+
updatedAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
958
|
+
content: Type.Optional(Type.String())
|
|
959
|
+
}, { additionalProperties: false });
|
|
960
|
+
const AgentsFilesListParamsSchema = Type.Object({ agentId: NonEmptyString }, { additionalProperties: false });
|
|
961
|
+
const AgentsFilesListResultSchema = Type.Object({
|
|
962
|
+
agentId: NonEmptyString,
|
|
963
|
+
workspace: NonEmptyString,
|
|
964
|
+
files: Type.Array(AgentsFileEntrySchema)
|
|
965
|
+
}, { additionalProperties: false });
|
|
966
|
+
const AgentsFilesGetParamsSchema = Type.Object({
|
|
967
|
+
agentId: NonEmptyString,
|
|
968
|
+
name: NonEmptyString
|
|
969
|
+
}, { additionalProperties: false });
|
|
970
|
+
const AgentsFilesGetResultSchema = Type.Object({
|
|
971
|
+
agentId: NonEmptyString,
|
|
972
|
+
workspace: NonEmptyString,
|
|
973
|
+
file: AgentsFileEntrySchema
|
|
974
|
+
}, { additionalProperties: false });
|
|
975
|
+
const AgentsFilesSetParamsSchema = Type.Object({
|
|
976
|
+
agentId: NonEmptyString,
|
|
977
|
+
name: NonEmptyString,
|
|
978
|
+
content: Type.String()
|
|
979
|
+
}, { additionalProperties: false });
|
|
980
|
+
const AgentsFilesSetResultSchema = Type.Object({
|
|
981
|
+
ok: Type.Literal(true),
|
|
982
|
+
agentId: NonEmptyString,
|
|
983
|
+
workspace: NonEmptyString,
|
|
984
|
+
file: AgentsFileEntrySchema
|
|
985
|
+
}, { additionalProperties: false });
|
|
986
|
+
const ModelsListParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
987
|
+
const ModelsListResultSchema = Type.Object({ models: Type.Array(ModelChoiceSchema) }, { additionalProperties: false });
|
|
988
|
+
const ToolsCatalogParamsSchema = Type.Object({
|
|
989
|
+
agentId: Type.Optional(NonEmptyString),
|
|
990
|
+
includePlugins: Type.Optional(Type.Boolean())
|
|
991
|
+
}, { additionalProperties: false });
|
|
992
|
+
const ToolCatalogProfileSchema = Type.Object({
|
|
993
|
+
id: Type.Union([
|
|
994
|
+
Type.Literal("minimal"),
|
|
995
|
+
Type.Literal("coding"),
|
|
996
|
+
Type.Literal("messaging"),
|
|
997
|
+
Type.Literal("full")
|
|
998
|
+
]),
|
|
999
|
+
label: NonEmptyString
|
|
1000
|
+
}, { additionalProperties: false });
|
|
1001
|
+
const ToolCatalogEntrySchema = Type.Object({
|
|
1002
|
+
id: NonEmptyString,
|
|
1003
|
+
label: NonEmptyString,
|
|
1004
|
+
description: Type.String(),
|
|
1005
|
+
source: Type.Union([Type.Literal("core"), Type.Literal("plugin")]),
|
|
1006
|
+
pluginId: Type.Optional(NonEmptyString),
|
|
1007
|
+
optional: Type.Optional(Type.Boolean()),
|
|
1008
|
+
defaultProfiles: Type.Array(Type.Union([
|
|
1009
|
+
Type.Literal("minimal"),
|
|
1010
|
+
Type.Literal("coding"),
|
|
1011
|
+
Type.Literal("messaging"),
|
|
1012
|
+
Type.Literal("full")
|
|
1013
|
+
]))
|
|
1014
|
+
}, { additionalProperties: false });
|
|
1015
|
+
const ToolCatalogGroupSchema = Type.Object({
|
|
1016
|
+
id: NonEmptyString,
|
|
1017
|
+
label: NonEmptyString,
|
|
1018
|
+
source: Type.Union([Type.Literal("core"), Type.Literal("plugin")]),
|
|
1019
|
+
pluginId: Type.Optional(NonEmptyString),
|
|
1020
|
+
tools: Type.Array(ToolCatalogEntrySchema)
|
|
1021
|
+
}, { additionalProperties: false });
|
|
1022
|
+
const ToolsCatalogResultSchema = Type.Object({
|
|
1023
|
+
agentId: NonEmptyString,
|
|
1024
|
+
profiles: Type.Array(ToolCatalogProfileSchema),
|
|
1025
|
+
groups: Type.Array(ToolCatalogGroupSchema)
|
|
1026
|
+
}, { additionalProperties: false });
|
|
1027
|
+
|
|
1028
|
+
//#endregion
|
|
1029
|
+
//#region src/gateway/protocol/schema/channels.ts
|
|
1030
|
+
const TalkModeParamsSchema = Type.Object({
|
|
1031
|
+
enabled: Type.Boolean(),
|
|
1032
|
+
phase: Type.Optional(Type.String())
|
|
1033
|
+
}, { additionalProperties: false });
|
|
1034
|
+
const TalkConfigParamsSchema = Type.Object({ includeSecrets: Type.Optional(Type.Boolean()) }, { additionalProperties: false });
|
|
1035
|
+
const TalkProviderConfigSchema = Type.Object({
|
|
1036
|
+
voiceId: Type.Optional(Type.String()),
|
|
1037
|
+
voiceAliases: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1038
|
+
modelId: Type.Optional(Type.String()),
|
|
1039
|
+
outputFormat: Type.Optional(Type.String()),
|
|
1040
|
+
apiKey: Type.Optional(Type.String())
|
|
1041
|
+
}, { additionalProperties: true });
|
|
1042
|
+
const TalkConfigResultSchema = Type.Object({ config: Type.Object({
|
|
1043
|
+
talk: Type.Optional(Type.Object({
|
|
1044
|
+
provider: Type.Optional(Type.String()),
|
|
1045
|
+
providers: Type.Optional(Type.Record(Type.String(), TalkProviderConfigSchema)),
|
|
1046
|
+
voiceId: Type.Optional(Type.String()),
|
|
1047
|
+
voiceAliases: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1048
|
+
modelId: Type.Optional(Type.String()),
|
|
1049
|
+
outputFormat: Type.Optional(Type.String()),
|
|
1050
|
+
apiKey: Type.Optional(Type.String()),
|
|
1051
|
+
interruptOnSpeech: Type.Optional(Type.Boolean())
|
|
1052
|
+
}, { additionalProperties: false })),
|
|
1053
|
+
session: Type.Optional(Type.Object({ mainKey: Type.Optional(Type.String()) }, { additionalProperties: false })),
|
|
1054
|
+
ui: Type.Optional(Type.Object({ seamColor: Type.Optional(Type.String()) }, { additionalProperties: false }))
|
|
1055
|
+
}, { additionalProperties: false }) }, { additionalProperties: false });
|
|
1056
|
+
const ChannelsStatusParamsSchema = Type.Object({
|
|
1057
|
+
probe: Type.Optional(Type.Boolean()),
|
|
1058
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1059
|
+
}, { additionalProperties: false });
|
|
1060
|
+
const ChannelAccountSnapshotSchema = Type.Object({
|
|
1061
|
+
accountId: NonEmptyString,
|
|
1062
|
+
name: Type.Optional(Type.String()),
|
|
1063
|
+
enabled: Type.Optional(Type.Boolean()),
|
|
1064
|
+
configured: Type.Optional(Type.Boolean()),
|
|
1065
|
+
linked: Type.Optional(Type.Boolean()),
|
|
1066
|
+
running: Type.Optional(Type.Boolean()),
|
|
1067
|
+
connected: Type.Optional(Type.Boolean()),
|
|
1068
|
+
reconnectAttempts: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1069
|
+
lastConnectedAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1070
|
+
lastError: Type.Optional(Type.String()),
|
|
1071
|
+
lastStartAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1072
|
+
lastStopAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1073
|
+
lastInboundAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1074
|
+
lastOutboundAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1075
|
+
lastProbeAt: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1076
|
+
mode: Type.Optional(Type.String()),
|
|
1077
|
+
dmPolicy: Type.Optional(Type.String()),
|
|
1078
|
+
allowFrom: Type.Optional(Type.Array(Type.String())),
|
|
1079
|
+
tokenSource: Type.Optional(Type.String()),
|
|
1080
|
+
botTokenSource: Type.Optional(Type.String()),
|
|
1081
|
+
appTokenSource: Type.Optional(Type.String()),
|
|
1082
|
+
baseUrl: Type.Optional(Type.String()),
|
|
1083
|
+
allowUnmentionedGroups: Type.Optional(Type.Boolean()),
|
|
1084
|
+
cliPath: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
1085
|
+
dbPath: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
1086
|
+
port: Type.Optional(Type.Union([Type.Integer({ minimum: 0 }), Type.Null()])),
|
|
1087
|
+
probe: Type.Optional(Type.Unknown()),
|
|
1088
|
+
audit: Type.Optional(Type.Unknown()),
|
|
1089
|
+
application: Type.Optional(Type.Unknown())
|
|
1090
|
+
}, { additionalProperties: true });
|
|
1091
|
+
const ChannelUiMetaSchema = Type.Object({
|
|
1092
|
+
id: NonEmptyString,
|
|
1093
|
+
label: NonEmptyString,
|
|
1094
|
+
detailLabel: NonEmptyString,
|
|
1095
|
+
systemImage: Type.Optional(Type.String())
|
|
1096
|
+
}, { additionalProperties: false });
|
|
1097
|
+
const ChannelsStatusResultSchema = Type.Object({
|
|
1098
|
+
ts: Type.Integer({ minimum: 0 }),
|
|
1099
|
+
channelOrder: Type.Array(NonEmptyString),
|
|
1100
|
+
channelLabels: Type.Record(NonEmptyString, NonEmptyString),
|
|
1101
|
+
channelDetailLabels: Type.Optional(Type.Record(NonEmptyString, NonEmptyString)),
|
|
1102
|
+
channelSystemImages: Type.Optional(Type.Record(NonEmptyString, NonEmptyString)),
|
|
1103
|
+
channelMeta: Type.Optional(Type.Array(ChannelUiMetaSchema)),
|
|
1104
|
+
channels: Type.Record(NonEmptyString, Type.Unknown()),
|
|
1105
|
+
channelAccounts: Type.Record(NonEmptyString, Type.Array(ChannelAccountSnapshotSchema)),
|
|
1106
|
+
channelDefaultAccountId: Type.Record(NonEmptyString, NonEmptyString)
|
|
1107
|
+
}, { additionalProperties: false });
|
|
1108
|
+
const ChannelsLogoutParamsSchema = Type.Object({
|
|
1109
|
+
channel: NonEmptyString,
|
|
1110
|
+
accountId: Type.Optional(Type.String())
|
|
1111
|
+
}, { additionalProperties: false });
|
|
1112
|
+
const WebLoginStartParamsSchema = Type.Object({
|
|
1113
|
+
force: Type.Optional(Type.Boolean()),
|
|
1114
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1115
|
+
verbose: Type.Optional(Type.Boolean()),
|
|
1116
|
+
accountId: Type.Optional(Type.String())
|
|
1117
|
+
}, { additionalProperties: false });
|
|
1118
|
+
const WebLoginWaitParamsSchema = Type.Object({
|
|
1119
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1120
|
+
accountId: Type.Optional(Type.String())
|
|
1121
|
+
}, { additionalProperties: false });
|
|
1122
|
+
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region src/gateway/protocol/schema/config.ts
|
|
1125
|
+
const ConfigGetParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1126
|
+
const ConfigSetParamsSchema = Type.Object({
|
|
1127
|
+
raw: NonEmptyString,
|
|
1128
|
+
baseHash: Type.Optional(NonEmptyString)
|
|
1129
|
+
}, { additionalProperties: false });
|
|
1130
|
+
const ConfigApplyLikeParamsSchema = Type.Object({
|
|
1131
|
+
raw: NonEmptyString,
|
|
1132
|
+
baseHash: Type.Optional(NonEmptyString),
|
|
1133
|
+
sessionKey: Type.Optional(Type.String()),
|
|
1134
|
+
note: Type.Optional(Type.String()),
|
|
1135
|
+
restartDelayMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1136
|
+
}, { additionalProperties: false });
|
|
1137
|
+
const ConfigApplyParamsSchema = ConfigApplyLikeParamsSchema;
|
|
1138
|
+
const ConfigPatchParamsSchema = ConfigApplyLikeParamsSchema;
|
|
1139
|
+
const ConfigSchemaParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1140
|
+
const UpdateRunParamsSchema = Type.Object({
|
|
1141
|
+
sessionKey: Type.Optional(Type.String()),
|
|
1142
|
+
note: Type.Optional(Type.String()),
|
|
1143
|
+
restartDelayMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1144
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 1 }))
|
|
1145
|
+
}, { additionalProperties: false });
|
|
1146
|
+
const ConfigUiHintSchema = Type.Object({
|
|
1147
|
+
label: Type.Optional(Type.String()),
|
|
1148
|
+
help: Type.Optional(Type.String()),
|
|
1149
|
+
tags: Type.Optional(Type.Array(Type.String())),
|
|
1150
|
+
group: Type.Optional(Type.String()),
|
|
1151
|
+
order: Type.Optional(Type.Integer()),
|
|
1152
|
+
advanced: Type.Optional(Type.Boolean()),
|
|
1153
|
+
sensitive: Type.Optional(Type.Boolean()),
|
|
1154
|
+
placeholder: Type.Optional(Type.String()),
|
|
1155
|
+
itemTemplate: Type.Optional(Type.Unknown())
|
|
1156
|
+
}, { additionalProperties: false });
|
|
1157
|
+
const ConfigSchemaResponseSchema = Type.Object({
|
|
1158
|
+
schema: Type.Unknown(),
|
|
1159
|
+
uiHints: Type.Record(Type.String(), ConfigUiHintSchema),
|
|
1160
|
+
version: NonEmptyString,
|
|
1161
|
+
generatedAt: NonEmptyString
|
|
1162
|
+
}, { additionalProperties: false });
|
|
1163
|
+
|
|
1164
|
+
//#endregion
|
|
1165
|
+
//#region src/gateway/protocol/schema/cron.ts
|
|
1166
|
+
function cronAgentTurnPayloadSchema(params) {
|
|
1167
|
+
return Type.Object({
|
|
1168
|
+
kind: Type.Literal("agentTurn"),
|
|
1169
|
+
message: params.message,
|
|
1170
|
+
model: Type.Optional(Type.String()),
|
|
1171
|
+
thinking: Type.Optional(Type.String()),
|
|
1172
|
+
timeoutSeconds: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1173
|
+
allowUnsafeExternalContent: Type.Optional(Type.Boolean()),
|
|
1174
|
+
deliver: Type.Optional(Type.Boolean()),
|
|
1175
|
+
channel: Type.Optional(Type.String()),
|
|
1176
|
+
to: Type.Optional(Type.String()),
|
|
1177
|
+
bestEffortDeliver: Type.Optional(Type.Boolean())
|
|
1178
|
+
}, { additionalProperties: false });
|
|
1179
|
+
}
|
|
1180
|
+
const CronSessionTargetSchema = Type.Union([Type.Literal("main"), Type.Literal("isolated")]);
|
|
1181
|
+
const CronWakeModeSchema = Type.Union([Type.Literal("next-heartbeat"), Type.Literal("now")]);
|
|
1182
|
+
const CronRunStatusSchema = Type.Union([
|
|
1183
|
+
Type.Literal("ok"),
|
|
1184
|
+
Type.Literal("error"),
|
|
1185
|
+
Type.Literal("skipped")
|
|
1186
|
+
]);
|
|
1187
|
+
const CronSortDirSchema = Type.Union([Type.Literal("asc"), Type.Literal("desc")]);
|
|
1188
|
+
const CronJobsEnabledFilterSchema = Type.Union([
|
|
1189
|
+
Type.Literal("all"),
|
|
1190
|
+
Type.Literal("enabled"),
|
|
1191
|
+
Type.Literal("disabled")
|
|
1192
|
+
]);
|
|
1193
|
+
const CronJobsSortBySchema = Type.Union([
|
|
1194
|
+
Type.Literal("nextRunAtMs"),
|
|
1195
|
+
Type.Literal("updatedAtMs"),
|
|
1196
|
+
Type.Literal("name")
|
|
1197
|
+
]);
|
|
1198
|
+
const CronRunsStatusFilterSchema = Type.Union([
|
|
1199
|
+
Type.Literal("all"),
|
|
1200
|
+
Type.Literal("ok"),
|
|
1201
|
+
Type.Literal("error"),
|
|
1202
|
+
Type.Literal("skipped")
|
|
1203
|
+
]);
|
|
1204
|
+
const CronRunsStatusValueSchema = Type.Union([
|
|
1205
|
+
Type.Literal("ok"),
|
|
1206
|
+
Type.Literal("error"),
|
|
1207
|
+
Type.Literal("skipped")
|
|
1208
|
+
]);
|
|
1209
|
+
const CronDeliveryStatusSchema = Type.Union([
|
|
1210
|
+
Type.Literal("delivered"),
|
|
1211
|
+
Type.Literal("not-delivered"),
|
|
1212
|
+
Type.Literal("unknown"),
|
|
1213
|
+
Type.Literal("not-requested")
|
|
1214
|
+
]);
|
|
1215
|
+
const CronCommonOptionalFields = {
|
|
1216
|
+
agentId: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1217
|
+
sessionKey: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1218
|
+
description: Type.Optional(Type.String()),
|
|
1219
|
+
enabled: Type.Optional(Type.Boolean()),
|
|
1220
|
+
deleteAfterRun: Type.Optional(Type.Boolean())
|
|
1221
|
+
};
|
|
1222
|
+
function cronIdOrJobIdParams(extraFields) {
|
|
1223
|
+
return Type.Union([Type.Object({
|
|
1224
|
+
id: NonEmptyString,
|
|
1225
|
+
...extraFields
|
|
1226
|
+
}, { additionalProperties: false }), Type.Object({
|
|
1227
|
+
jobId: NonEmptyString,
|
|
1228
|
+
...extraFields
|
|
1229
|
+
}, { additionalProperties: false })]);
|
|
1230
|
+
}
|
|
1231
|
+
const CronRunLogJobIdSchema = Type.String({
|
|
1232
|
+
minLength: 1,
|
|
1233
|
+
pattern: "^[^/\\\\]+$"
|
|
1234
|
+
});
|
|
1235
|
+
const CronScheduleSchema = Type.Union([
|
|
1236
|
+
Type.Object({
|
|
1237
|
+
kind: Type.Literal("at"),
|
|
1238
|
+
at: NonEmptyString
|
|
1239
|
+
}, { additionalProperties: false }),
|
|
1240
|
+
Type.Object({
|
|
1241
|
+
kind: Type.Literal("every"),
|
|
1242
|
+
everyMs: Type.Integer({ minimum: 1 }),
|
|
1243
|
+
anchorMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1244
|
+
}, { additionalProperties: false }),
|
|
1245
|
+
Type.Object({
|
|
1246
|
+
kind: Type.Literal("cron"),
|
|
1247
|
+
expr: NonEmptyString,
|
|
1248
|
+
tz: Type.Optional(Type.String()),
|
|
1249
|
+
staggerMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1250
|
+
}, { additionalProperties: false })
|
|
1251
|
+
]);
|
|
1252
|
+
const CronPayloadSchema = Type.Union([Type.Object({
|
|
1253
|
+
kind: Type.Literal("systemEvent"),
|
|
1254
|
+
text: NonEmptyString
|
|
1255
|
+
}, { additionalProperties: false }), cronAgentTurnPayloadSchema({ message: NonEmptyString })]);
|
|
1256
|
+
const CronPayloadPatchSchema = Type.Union([Type.Object({
|
|
1257
|
+
kind: Type.Literal("systemEvent"),
|
|
1258
|
+
text: Type.Optional(NonEmptyString)
|
|
1259
|
+
}, { additionalProperties: false }), cronAgentTurnPayloadSchema({ message: Type.Optional(NonEmptyString) })]);
|
|
1260
|
+
const CronDeliverySharedProperties = {
|
|
1261
|
+
channel: Type.Optional(Type.Union([Type.Literal("last"), NonEmptyString])),
|
|
1262
|
+
bestEffort: Type.Optional(Type.Boolean())
|
|
1263
|
+
};
|
|
1264
|
+
const CronDeliveryNoopSchema = Type.Object({
|
|
1265
|
+
mode: Type.Literal("none"),
|
|
1266
|
+
...CronDeliverySharedProperties,
|
|
1267
|
+
to: Type.Optional(Type.String())
|
|
1268
|
+
}, { additionalProperties: false });
|
|
1269
|
+
const CronDeliveryAnnounceSchema = Type.Object({
|
|
1270
|
+
mode: Type.Literal("announce"),
|
|
1271
|
+
...CronDeliverySharedProperties,
|
|
1272
|
+
to: Type.Optional(Type.String())
|
|
1273
|
+
}, { additionalProperties: false });
|
|
1274
|
+
const CronDeliveryWebhookSchema = Type.Object({
|
|
1275
|
+
mode: Type.Literal("webhook"),
|
|
1276
|
+
...CronDeliverySharedProperties,
|
|
1277
|
+
to: NonEmptyString
|
|
1278
|
+
}, { additionalProperties: false });
|
|
1279
|
+
const CronDeliverySchema = Type.Union([
|
|
1280
|
+
CronDeliveryNoopSchema,
|
|
1281
|
+
CronDeliveryAnnounceSchema,
|
|
1282
|
+
CronDeliveryWebhookSchema
|
|
1283
|
+
]);
|
|
1284
|
+
const CronDeliveryPatchSchema = Type.Object({
|
|
1285
|
+
mode: Type.Optional(Type.Union([
|
|
1286
|
+
Type.Literal("none"),
|
|
1287
|
+
Type.Literal("announce"),
|
|
1288
|
+
Type.Literal("webhook")
|
|
1289
|
+
])),
|
|
1290
|
+
...CronDeliverySharedProperties,
|
|
1291
|
+
to: Type.Optional(Type.String())
|
|
1292
|
+
}, { additionalProperties: false });
|
|
1293
|
+
const CronJobStateSchema = Type.Object({
|
|
1294
|
+
nextRunAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1295
|
+
runningAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1296
|
+
lastRunAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1297
|
+
lastRunStatus: Type.Optional(CronRunStatusSchema),
|
|
1298
|
+
lastStatus: Type.Optional(CronRunStatusSchema),
|
|
1299
|
+
lastError: Type.Optional(Type.String()),
|
|
1300
|
+
lastDurationMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1301
|
+
consecutiveErrors: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1302
|
+
lastDelivered: Type.Optional(Type.Boolean()),
|
|
1303
|
+
lastDeliveryStatus: Type.Optional(CronDeliveryStatusSchema),
|
|
1304
|
+
lastDeliveryError: Type.Optional(Type.String())
|
|
1305
|
+
}, { additionalProperties: false });
|
|
1306
|
+
const CronJobSchema = Type.Object({
|
|
1307
|
+
id: NonEmptyString,
|
|
1308
|
+
agentId: Type.Optional(NonEmptyString),
|
|
1309
|
+
sessionKey: Type.Optional(NonEmptyString),
|
|
1310
|
+
name: NonEmptyString,
|
|
1311
|
+
description: Type.Optional(Type.String()),
|
|
1312
|
+
enabled: Type.Boolean(),
|
|
1313
|
+
deleteAfterRun: Type.Optional(Type.Boolean()),
|
|
1314
|
+
createdAtMs: Type.Integer({ minimum: 0 }),
|
|
1315
|
+
updatedAtMs: Type.Integer({ minimum: 0 }),
|
|
1316
|
+
schedule: CronScheduleSchema,
|
|
1317
|
+
sessionTarget: CronSessionTargetSchema,
|
|
1318
|
+
wakeMode: CronWakeModeSchema,
|
|
1319
|
+
payload: CronPayloadSchema,
|
|
1320
|
+
delivery: Type.Optional(CronDeliverySchema),
|
|
1321
|
+
state: CronJobStateSchema
|
|
1322
|
+
}, { additionalProperties: false });
|
|
1323
|
+
const CronListParamsSchema = Type.Object({
|
|
1324
|
+
includeDisabled: Type.Optional(Type.Boolean()),
|
|
1325
|
+
limit: Type.Optional(Type.Integer({
|
|
1326
|
+
minimum: 1,
|
|
1327
|
+
maximum: 200
|
|
1328
|
+
})),
|
|
1329
|
+
offset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1330
|
+
query: Type.Optional(Type.String()),
|
|
1331
|
+
enabled: Type.Optional(CronJobsEnabledFilterSchema),
|
|
1332
|
+
sortBy: Type.Optional(CronJobsSortBySchema),
|
|
1333
|
+
sortDir: Type.Optional(CronSortDirSchema)
|
|
1334
|
+
}, { additionalProperties: false });
|
|
1335
|
+
const CronStatusParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1336
|
+
const CronAddParamsSchema = Type.Object({
|
|
1337
|
+
name: NonEmptyString,
|
|
1338
|
+
...CronCommonOptionalFields,
|
|
1339
|
+
schedule: CronScheduleSchema,
|
|
1340
|
+
sessionTarget: CronSessionTargetSchema,
|
|
1341
|
+
wakeMode: CronWakeModeSchema,
|
|
1342
|
+
payload: CronPayloadSchema,
|
|
1343
|
+
delivery: Type.Optional(CronDeliverySchema)
|
|
1344
|
+
}, { additionalProperties: false });
|
|
1345
|
+
const CronJobPatchSchema = Type.Object({
|
|
1346
|
+
name: Type.Optional(NonEmptyString),
|
|
1347
|
+
...CronCommonOptionalFields,
|
|
1348
|
+
schedule: Type.Optional(CronScheduleSchema),
|
|
1349
|
+
sessionTarget: Type.Optional(CronSessionTargetSchema),
|
|
1350
|
+
wakeMode: Type.Optional(CronWakeModeSchema),
|
|
1351
|
+
payload: Type.Optional(CronPayloadPatchSchema),
|
|
1352
|
+
delivery: Type.Optional(CronDeliveryPatchSchema),
|
|
1353
|
+
state: Type.Optional(Type.Partial(CronJobStateSchema))
|
|
1354
|
+
}, { additionalProperties: false });
|
|
1355
|
+
const CronUpdateParamsSchema = cronIdOrJobIdParams({ patch: CronJobPatchSchema });
|
|
1356
|
+
const CronRemoveParamsSchema = cronIdOrJobIdParams({});
|
|
1357
|
+
const CronRunParamsSchema = cronIdOrJobIdParams({ mode: Type.Optional(Type.Union([Type.Literal("due"), Type.Literal("force")])) });
|
|
1358
|
+
const CronRunsParamsSchema = Type.Object({
|
|
1359
|
+
scope: Type.Optional(Type.Union([Type.Literal("job"), Type.Literal("all")])),
|
|
1360
|
+
id: Type.Optional(CronRunLogJobIdSchema),
|
|
1361
|
+
jobId: Type.Optional(CronRunLogJobIdSchema),
|
|
1362
|
+
limit: Type.Optional(Type.Integer({
|
|
1363
|
+
minimum: 1,
|
|
1364
|
+
maximum: 200
|
|
1365
|
+
})),
|
|
1366
|
+
offset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1367
|
+
statuses: Type.Optional(Type.Array(CronRunsStatusValueSchema, {
|
|
1368
|
+
minItems: 1,
|
|
1369
|
+
maxItems: 3
|
|
1370
|
+
})),
|
|
1371
|
+
status: Type.Optional(CronRunsStatusFilterSchema),
|
|
1372
|
+
deliveryStatuses: Type.Optional(Type.Array(CronDeliveryStatusSchema, {
|
|
1373
|
+
minItems: 1,
|
|
1374
|
+
maxItems: 4
|
|
1375
|
+
})),
|
|
1376
|
+
deliveryStatus: Type.Optional(CronDeliveryStatusSchema),
|
|
1377
|
+
query: Type.Optional(Type.String()),
|
|
1378
|
+
sortDir: Type.Optional(CronSortDirSchema)
|
|
1379
|
+
}, { additionalProperties: false });
|
|
1380
|
+
const CronRunLogEntrySchema = Type.Object({
|
|
1381
|
+
ts: Type.Integer({ minimum: 0 }),
|
|
1382
|
+
jobId: NonEmptyString,
|
|
1383
|
+
action: Type.Literal("finished"),
|
|
1384
|
+
status: Type.Optional(CronRunStatusSchema),
|
|
1385
|
+
error: Type.Optional(Type.String()),
|
|
1386
|
+
summary: Type.Optional(Type.String()),
|
|
1387
|
+
delivered: Type.Optional(Type.Boolean()),
|
|
1388
|
+
deliveryStatus: Type.Optional(CronDeliveryStatusSchema),
|
|
1389
|
+
deliveryError: Type.Optional(Type.String()),
|
|
1390
|
+
sessionId: Type.Optional(NonEmptyString),
|
|
1391
|
+
sessionKey: Type.Optional(NonEmptyString),
|
|
1392
|
+
runAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1393
|
+
durationMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1394
|
+
nextRunAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1395
|
+
model: Type.Optional(Type.String()),
|
|
1396
|
+
provider: Type.Optional(Type.String()),
|
|
1397
|
+
usage: Type.Optional(Type.Object({
|
|
1398
|
+
input_tokens: Type.Optional(Type.Number()),
|
|
1399
|
+
output_tokens: Type.Optional(Type.Number()),
|
|
1400
|
+
total_tokens: Type.Optional(Type.Number()),
|
|
1401
|
+
cache_read_tokens: Type.Optional(Type.Number()),
|
|
1402
|
+
cache_write_tokens: Type.Optional(Type.Number())
|
|
1403
|
+
}, { additionalProperties: false })),
|
|
1404
|
+
jobName: Type.Optional(Type.String())
|
|
1405
|
+
}, { additionalProperties: false });
|
|
1406
|
+
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/gateway/protocol/schema/error-codes.ts
|
|
1409
|
+
const ErrorCodes = {
|
|
1410
|
+
NOT_LINKED: "NOT_LINKED",
|
|
1411
|
+
NOT_PAIRED: "NOT_PAIRED",
|
|
1412
|
+
AGENT_TIMEOUT: "AGENT_TIMEOUT",
|
|
1413
|
+
INVALID_REQUEST: "INVALID_REQUEST",
|
|
1414
|
+
UNAVAILABLE: "UNAVAILABLE"
|
|
1415
|
+
};
|
|
1416
|
+
function errorShape(code, message, opts) {
|
|
1417
|
+
return {
|
|
1418
|
+
code,
|
|
1419
|
+
message,
|
|
1420
|
+
...opts
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/gateway/protocol/schema/devices.ts
|
|
1426
|
+
const DevicePairListParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1427
|
+
const DevicePairApproveParamsSchema = Type.Object({ requestId: NonEmptyString }, { additionalProperties: false });
|
|
1428
|
+
const DevicePairRejectParamsSchema = Type.Object({ requestId: NonEmptyString }, { additionalProperties: false });
|
|
1429
|
+
const DevicePairRemoveParamsSchema = Type.Object({ deviceId: NonEmptyString }, { additionalProperties: false });
|
|
1430
|
+
const DeviceTokenRotateParamsSchema = Type.Object({
|
|
1431
|
+
deviceId: NonEmptyString,
|
|
1432
|
+
role: NonEmptyString,
|
|
1433
|
+
scopes: Type.Optional(Type.Array(NonEmptyString))
|
|
1434
|
+
}, { additionalProperties: false });
|
|
1435
|
+
const DeviceTokenRevokeParamsSchema = Type.Object({
|
|
1436
|
+
deviceId: NonEmptyString,
|
|
1437
|
+
role: NonEmptyString
|
|
1438
|
+
}, { additionalProperties: false });
|
|
1439
|
+
const DevicePairRequestedEventSchema = Type.Object({
|
|
1440
|
+
requestId: NonEmptyString,
|
|
1441
|
+
deviceId: NonEmptyString,
|
|
1442
|
+
publicKey: NonEmptyString,
|
|
1443
|
+
displayName: Type.Optional(NonEmptyString),
|
|
1444
|
+
platform: Type.Optional(NonEmptyString),
|
|
1445
|
+
clientId: Type.Optional(NonEmptyString),
|
|
1446
|
+
clientMode: Type.Optional(NonEmptyString),
|
|
1447
|
+
role: Type.Optional(NonEmptyString),
|
|
1448
|
+
roles: Type.Optional(Type.Array(NonEmptyString)),
|
|
1449
|
+
scopes: Type.Optional(Type.Array(NonEmptyString)),
|
|
1450
|
+
remoteIp: Type.Optional(NonEmptyString),
|
|
1451
|
+
silent: Type.Optional(Type.Boolean()),
|
|
1452
|
+
isRepair: Type.Optional(Type.Boolean()),
|
|
1453
|
+
ts: Type.Integer({ minimum: 0 })
|
|
1454
|
+
}, { additionalProperties: false });
|
|
1455
|
+
const DevicePairResolvedEventSchema = Type.Object({
|
|
1456
|
+
requestId: NonEmptyString,
|
|
1457
|
+
deviceId: NonEmptyString,
|
|
1458
|
+
decision: NonEmptyString,
|
|
1459
|
+
ts: Type.Integer({ minimum: 0 })
|
|
1460
|
+
}, { additionalProperties: false });
|
|
1461
|
+
|
|
1462
|
+
//#endregion
|
|
1463
|
+
//#region src/gateway/protocol/schema/snapshot.ts
|
|
1464
|
+
const PresenceEntrySchema = Type.Object({
|
|
1465
|
+
host: Type.Optional(NonEmptyString),
|
|
1466
|
+
ip: Type.Optional(NonEmptyString),
|
|
1467
|
+
version: Type.Optional(NonEmptyString),
|
|
1468
|
+
platform: Type.Optional(NonEmptyString),
|
|
1469
|
+
deviceFamily: Type.Optional(NonEmptyString),
|
|
1470
|
+
modelIdentifier: Type.Optional(NonEmptyString),
|
|
1471
|
+
mode: Type.Optional(NonEmptyString),
|
|
1472
|
+
lastInputSeconds: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1473
|
+
reason: Type.Optional(NonEmptyString),
|
|
1474
|
+
tags: Type.Optional(Type.Array(NonEmptyString)),
|
|
1475
|
+
text: Type.Optional(Type.String()),
|
|
1476
|
+
ts: Type.Integer({ minimum: 0 }),
|
|
1477
|
+
deviceId: Type.Optional(NonEmptyString),
|
|
1478
|
+
roles: Type.Optional(Type.Array(NonEmptyString)),
|
|
1479
|
+
scopes: Type.Optional(Type.Array(NonEmptyString)),
|
|
1480
|
+
instanceId: Type.Optional(NonEmptyString)
|
|
1481
|
+
}, { additionalProperties: false });
|
|
1482
|
+
const HealthSnapshotSchema = Type.Any();
|
|
1483
|
+
const SessionDefaultsSchema = Type.Object({
|
|
1484
|
+
defaultAgentId: NonEmptyString,
|
|
1485
|
+
mainKey: NonEmptyString,
|
|
1486
|
+
mainSessionKey: NonEmptyString,
|
|
1487
|
+
scope: Type.Optional(NonEmptyString)
|
|
1488
|
+
}, { additionalProperties: false });
|
|
1489
|
+
const StateVersionSchema = Type.Object({
|
|
1490
|
+
presence: Type.Integer({ minimum: 0 }),
|
|
1491
|
+
health: Type.Integer({ minimum: 0 })
|
|
1492
|
+
}, { additionalProperties: false });
|
|
1493
|
+
const SnapshotSchema = Type.Object({
|
|
1494
|
+
presence: Type.Array(PresenceEntrySchema),
|
|
1495
|
+
health: HealthSnapshotSchema,
|
|
1496
|
+
stateVersion: StateVersionSchema,
|
|
1497
|
+
uptimeMs: Type.Integer({ minimum: 0 }),
|
|
1498
|
+
configPath: Type.Optional(NonEmptyString),
|
|
1499
|
+
stateDir: Type.Optional(NonEmptyString),
|
|
1500
|
+
sessionDefaults: Type.Optional(SessionDefaultsSchema),
|
|
1501
|
+
authMode: Type.Optional(Type.Union([
|
|
1502
|
+
Type.Literal("none"),
|
|
1503
|
+
Type.Literal("token"),
|
|
1504
|
+
Type.Literal("password"),
|
|
1505
|
+
Type.Literal("trusted-proxy")
|
|
1506
|
+
])),
|
|
1507
|
+
updateAvailable: Type.Optional(Type.Object({
|
|
1508
|
+
currentVersion: NonEmptyString,
|
|
1509
|
+
latestVersion: NonEmptyString,
|
|
1510
|
+
channel: NonEmptyString
|
|
1511
|
+
}))
|
|
1512
|
+
}, { additionalProperties: false });
|
|
1513
|
+
|
|
1514
|
+
//#endregion
|
|
1515
|
+
//#region src/gateway/protocol/schema/frames.ts
|
|
1516
|
+
const TickEventSchema = Type.Object({ ts: Type.Integer({ minimum: 0 }) }, { additionalProperties: false });
|
|
1517
|
+
const ShutdownEventSchema = Type.Object({
|
|
1518
|
+
reason: NonEmptyString,
|
|
1519
|
+
restartExpectedMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1520
|
+
}, { additionalProperties: false });
|
|
1521
|
+
const ConnectParamsSchema = Type.Object({
|
|
1522
|
+
minProtocol: Type.Integer({ minimum: 1 }),
|
|
1523
|
+
maxProtocol: Type.Integer({ minimum: 1 }),
|
|
1524
|
+
client: Type.Object({
|
|
1525
|
+
id: GatewayClientIdSchema,
|
|
1526
|
+
displayName: Type.Optional(NonEmptyString),
|
|
1527
|
+
version: NonEmptyString,
|
|
1528
|
+
platform: NonEmptyString,
|
|
1529
|
+
deviceFamily: Type.Optional(NonEmptyString),
|
|
1530
|
+
modelIdentifier: Type.Optional(NonEmptyString),
|
|
1531
|
+
mode: GatewayClientModeSchema,
|
|
1532
|
+
instanceId: Type.Optional(NonEmptyString)
|
|
1533
|
+
}, { additionalProperties: false }),
|
|
1534
|
+
caps: Type.Optional(Type.Array(NonEmptyString, { default: [] })),
|
|
1535
|
+
commands: Type.Optional(Type.Array(NonEmptyString)),
|
|
1536
|
+
permissions: Type.Optional(Type.Record(NonEmptyString, Type.Boolean())),
|
|
1537
|
+
pathEnv: Type.Optional(Type.String()),
|
|
1538
|
+
role: Type.Optional(NonEmptyString),
|
|
1539
|
+
scopes: Type.Optional(Type.Array(NonEmptyString)),
|
|
1540
|
+
device: Type.Optional(Type.Object({
|
|
1541
|
+
id: NonEmptyString,
|
|
1542
|
+
publicKey: NonEmptyString,
|
|
1543
|
+
signature: NonEmptyString,
|
|
1544
|
+
signedAt: Type.Integer({ minimum: 0 }),
|
|
1545
|
+
nonce: NonEmptyString
|
|
1546
|
+
}, { additionalProperties: false })),
|
|
1547
|
+
auth: Type.Optional(Type.Object({
|
|
1548
|
+
token: Type.Optional(Type.String()),
|
|
1549
|
+
deviceToken: Type.Optional(Type.String()),
|
|
1550
|
+
password: Type.Optional(Type.String())
|
|
1551
|
+
}, { additionalProperties: false })),
|
|
1552
|
+
locale: Type.Optional(Type.String()),
|
|
1553
|
+
userAgent: Type.Optional(Type.String())
|
|
1554
|
+
}, { additionalProperties: false });
|
|
1555
|
+
const HelloOkSchema = Type.Object({
|
|
1556
|
+
type: Type.Literal("hello-ok"),
|
|
1557
|
+
protocol: Type.Integer({ minimum: 1 }),
|
|
1558
|
+
server: Type.Object({
|
|
1559
|
+
version: NonEmptyString,
|
|
1560
|
+
connId: NonEmptyString
|
|
1561
|
+
}, { additionalProperties: false }),
|
|
1562
|
+
features: Type.Object({
|
|
1563
|
+
methods: Type.Array(NonEmptyString),
|
|
1564
|
+
events: Type.Array(NonEmptyString)
|
|
1565
|
+
}, { additionalProperties: false }),
|
|
1566
|
+
snapshot: SnapshotSchema,
|
|
1567
|
+
canvasHostUrl: Type.Optional(NonEmptyString),
|
|
1568
|
+
auth: Type.Optional(Type.Object({
|
|
1569
|
+
deviceToken: NonEmptyString,
|
|
1570
|
+
role: NonEmptyString,
|
|
1571
|
+
scopes: Type.Array(NonEmptyString),
|
|
1572
|
+
issuedAtMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1573
|
+
}, { additionalProperties: false })),
|
|
1574
|
+
policy: Type.Object({
|
|
1575
|
+
maxPayload: Type.Integer({ minimum: 1 }),
|
|
1576
|
+
maxBufferedBytes: Type.Integer({ minimum: 1 }),
|
|
1577
|
+
tickIntervalMs: Type.Integer({ minimum: 1 })
|
|
1578
|
+
}, { additionalProperties: false })
|
|
1579
|
+
}, { additionalProperties: false });
|
|
1580
|
+
const ErrorShapeSchema = Type.Object({
|
|
1581
|
+
code: NonEmptyString,
|
|
1582
|
+
message: NonEmptyString,
|
|
1583
|
+
details: Type.Optional(Type.Unknown()),
|
|
1584
|
+
retryable: Type.Optional(Type.Boolean()),
|
|
1585
|
+
retryAfterMs: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
1586
|
+
}, { additionalProperties: false });
|
|
1587
|
+
const RequestFrameSchema = Type.Object({
|
|
1588
|
+
type: Type.Literal("req"),
|
|
1589
|
+
id: NonEmptyString,
|
|
1590
|
+
method: NonEmptyString,
|
|
1591
|
+
params: Type.Optional(Type.Unknown())
|
|
1592
|
+
}, { additionalProperties: false });
|
|
1593
|
+
const ResponseFrameSchema = Type.Object({
|
|
1594
|
+
type: Type.Literal("res"),
|
|
1595
|
+
id: NonEmptyString,
|
|
1596
|
+
ok: Type.Boolean(),
|
|
1597
|
+
payload: Type.Optional(Type.Unknown()),
|
|
1598
|
+
error: Type.Optional(ErrorShapeSchema)
|
|
1599
|
+
}, { additionalProperties: false });
|
|
1600
|
+
const EventFrameSchema = Type.Object({
|
|
1601
|
+
type: Type.Literal("event"),
|
|
1602
|
+
event: NonEmptyString,
|
|
1603
|
+
payload: Type.Optional(Type.Unknown()),
|
|
1604
|
+
seq: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1605
|
+
stateVersion: Type.Optional(StateVersionSchema)
|
|
1606
|
+
}, { additionalProperties: false });
|
|
1607
|
+
const GatewayFrameSchema = Type.Union([
|
|
1608
|
+
RequestFrameSchema,
|
|
1609
|
+
ResponseFrameSchema,
|
|
1610
|
+
EventFrameSchema
|
|
1611
|
+
], { discriminator: "type" });
|
|
1612
|
+
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/gateway/protocol/schema/logs-chat.ts
|
|
1615
|
+
const LogsTailParamsSchema = Type.Object({
|
|
1616
|
+
cursor: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1617
|
+
limit: Type.Optional(Type.Integer({
|
|
1618
|
+
minimum: 1,
|
|
1619
|
+
maximum: 5e3
|
|
1620
|
+
})),
|
|
1621
|
+
maxBytes: Type.Optional(Type.Integer({
|
|
1622
|
+
minimum: 1,
|
|
1623
|
+
maximum: 1e6
|
|
1624
|
+
}))
|
|
1625
|
+
}, { additionalProperties: false });
|
|
1626
|
+
const LogsTailResultSchema = Type.Object({
|
|
1627
|
+
file: NonEmptyString,
|
|
1628
|
+
cursor: Type.Integer({ minimum: 0 }),
|
|
1629
|
+
size: Type.Integer({ minimum: 0 }),
|
|
1630
|
+
lines: Type.Array(Type.String()),
|
|
1631
|
+
truncated: Type.Optional(Type.Boolean()),
|
|
1632
|
+
reset: Type.Optional(Type.Boolean())
|
|
1633
|
+
}, { additionalProperties: false });
|
|
1634
|
+
const ChatHistoryParamsSchema = Type.Object({
|
|
1635
|
+
sessionKey: NonEmptyString,
|
|
1636
|
+
limit: Type.Optional(Type.Integer({
|
|
1637
|
+
minimum: 1,
|
|
1638
|
+
maximum: 1e3
|
|
1639
|
+
}))
|
|
1640
|
+
}, { additionalProperties: false });
|
|
1641
|
+
const ChatSendParamsSchema = Type.Object({
|
|
1642
|
+
sessionKey: NonEmptyString,
|
|
1643
|
+
message: Type.String(),
|
|
1644
|
+
thinking: Type.Optional(Type.String()),
|
|
1645
|
+
deliver: Type.Optional(Type.Boolean()),
|
|
1646
|
+
attachments: Type.Optional(Type.Array(Type.Unknown())),
|
|
1647
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1648
|
+
idempotencyKey: NonEmptyString
|
|
1649
|
+
}, { additionalProperties: false });
|
|
1650
|
+
const ChatAbortParamsSchema = Type.Object({
|
|
1651
|
+
sessionKey: NonEmptyString,
|
|
1652
|
+
runId: Type.Optional(NonEmptyString)
|
|
1653
|
+
}, { additionalProperties: false });
|
|
1654
|
+
const ChatInjectParamsSchema = Type.Object({
|
|
1655
|
+
sessionKey: NonEmptyString,
|
|
1656
|
+
message: NonEmptyString,
|
|
1657
|
+
label: Type.Optional(Type.String({ maxLength: 100 }))
|
|
1658
|
+
}, { additionalProperties: false });
|
|
1659
|
+
const ChatEventSchema = Type.Object({
|
|
1660
|
+
runId: NonEmptyString,
|
|
1661
|
+
sessionKey: NonEmptyString,
|
|
1662
|
+
seq: Type.Integer({ minimum: 0 }),
|
|
1663
|
+
state: Type.Union([
|
|
1664
|
+
Type.Literal("delta"),
|
|
1665
|
+
Type.Literal("final"),
|
|
1666
|
+
Type.Literal("aborted"),
|
|
1667
|
+
Type.Literal("error")
|
|
1668
|
+
]),
|
|
1669
|
+
message: Type.Optional(Type.Unknown()),
|
|
1670
|
+
errorMessage: Type.Optional(Type.String()),
|
|
1671
|
+
usage: Type.Optional(Type.Unknown()),
|
|
1672
|
+
stopReason: Type.Optional(Type.String())
|
|
1673
|
+
}, { additionalProperties: false });
|
|
1674
|
+
|
|
1675
|
+
//#endregion
|
|
1676
|
+
//#region src/gateway/protocol/schema/nodes.ts
|
|
1677
|
+
const NodePairRequestParamsSchema = Type.Object({
|
|
1678
|
+
nodeId: NonEmptyString,
|
|
1679
|
+
displayName: Type.Optional(NonEmptyString),
|
|
1680
|
+
platform: Type.Optional(NonEmptyString),
|
|
1681
|
+
version: Type.Optional(NonEmptyString),
|
|
1682
|
+
coreVersion: Type.Optional(NonEmptyString),
|
|
1683
|
+
uiVersion: Type.Optional(NonEmptyString),
|
|
1684
|
+
deviceFamily: Type.Optional(NonEmptyString),
|
|
1685
|
+
modelIdentifier: Type.Optional(NonEmptyString),
|
|
1686
|
+
caps: Type.Optional(Type.Array(NonEmptyString)),
|
|
1687
|
+
commands: Type.Optional(Type.Array(NonEmptyString)),
|
|
1688
|
+
remoteIp: Type.Optional(NonEmptyString),
|
|
1689
|
+
silent: Type.Optional(Type.Boolean())
|
|
1690
|
+
}, { additionalProperties: false });
|
|
1691
|
+
const NodePairListParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1692
|
+
const NodePairApproveParamsSchema = Type.Object({ requestId: NonEmptyString }, { additionalProperties: false });
|
|
1693
|
+
const NodePairRejectParamsSchema = Type.Object({ requestId: NonEmptyString }, { additionalProperties: false });
|
|
1694
|
+
const NodePairVerifyParamsSchema = Type.Object({
|
|
1695
|
+
nodeId: NonEmptyString,
|
|
1696
|
+
token: NonEmptyString
|
|
1697
|
+
}, { additionalProperties: false });
|
|
1698
|
+
const NodeRenameParamsSchema = Type.Object({
|
|
1699
|
+
nodeId: NonEmptyString,
|
|
1700
|
+
displayName: NonEmptyString
|
|
1701
|
+
}, { additionalProperties: false });
|
|
1702
|
+
const NodeListParamsSchema = Type.Object({}, { additionalProperties: false });
|
|
1703
|
+
const NodeDescribeParamsSchema = Type.Object({ nodeId: NonEmptyString }, { additionalProperties: false });
|
|
1704
|
+
const NodeInvokeParamsSchema = Type.Object({
|
|
1705
|
+
nodeId: NonEmptyString,
|
|
1706
|
+
command: NonEmptyString,
|
|
1707
|
+
params: Type.Optional(Type.Unknown()),
|
|
1708
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1709
|
+
idempotencyKey: NonEmptyString
|
|
1710
|
+
}, { additionalProperties: false });
|
|
1711
|
+
const NodeInvokeResultParamsSchema = Type.Object({
|
|
1712
|
+
id: NonEmptyString,
|
|
1713
|
+
nodeId: NonEmptyString,
|
|
1714
|
+
ok: Type.Boolean(),
|
|
1715
|
+
payload: Type.Optional(Type.Unknown()),
|
|
1716
|
+
payloadJSON: Type.Optional(Type.String()),
|
|
1717
|
+
error: Type.Optional(Type.Object({
|
|
1718
|
+
code: Type.Optional(NonEmptyString),
|
|
1719
|
+
message: Type.Optional(NonEmptyString)
|
|
1720
|
+
}, { additionalProperties: false }))
|
|
1721
|
+
}, { additionalProperties: false });
|
|
1722
|
+
const NodeEventParamsSchema = Type.Object({
|
|
1723
|
+
event: NonEmptyString,
|
|
1724
|
+
payload: Type.Optional(Type.Unknown()),
|
|
1725
|
+
payloadJSON: Type.Optional(Type.String())
|
|
1726
|
+
}, { additionalProperties: false });
|
|
1727
|
+
const NodeInvokeRequestEventSchema = Type.Object({
|
|
1728
|
+
id: NonEmptyString,
|
|
1729
|
+
nodeId: NonEmptyString,
|
|
1730
|
+
command: NonEmptyString,
|
|
1731
|
+
paramsJSON: Type.Optional(Type.String()),
|
|
1732
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
1733
|
+
idempotencyKey: Type.Optional(NonEmptyString)
|
|
1734
|
+
}, { additionalProperties: false });
|
|
1735
|
+
|
|
1736
|
+
//#endregion
|
|
1737
|
+
//#region src/gateway/protocol/schema/push.ts
|
|
1738
|
+
const ApnsEnvironmentSchema = Type.String({ enum: ["sandbox", "production"] });
|
|
1739
|
+
const PushTestParamsSchema = Type.Object({
|
|
1740
|
+
nodeId: NonEmptyString,
|
|
1741
|
+
title: Type.Optional(Type.String()),
|
|
1742
|
+
body: Type.Optional(Type.String()),
|
|
1743
|
+
environment: Type.Optional(ApnsEnvironmentSchema)
|
|
1744
|
+
}, { additionalProperties: false });
|
|
1745
|
+
const PushTestResultSchema = Type.Object({
|
|
1746
|
+
ok: Type.Boolean(),
|
|
1747
|
+
status: Type.Integer(),
|
|
1748
|
+
apnsId: Type.Optional(Type.String()),
|
|
1749
|
+
reason: Type.Optional(Type.String()),
|
|
1750
|
+
tokenSuffix: Type.String(),
|
|
1751
|
+
topic: Type.String(),
|
|
1752
|
+
environment: ApnsEnvironmentSchema
|
|
1753
|
+
}, { additionalProperties: false });
|
|
1754
|
+
|
|
1755
|
+
//#endregion
|
|
1756
|
+
//#region src/gateway/protocol/schema/sessions.ts
|
|
1757
|
+
const SessionsListParamsSchema = Type.Object({
|
|
1758
|
+
limit: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
1759
|
+
activeMinutes: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
1760
|
+
includeGlobal: Type.Optional(Type.Boolean()),
|
|
1761
|
+
includeUnknown: Type.Optional(Type.Boolean()),
|
|
1762
|
+
includeDerivedTitles: Type.Optional(Type.Boolean()),
|
|
1763
|
+
includeLastMessage: Type.Optional(Type.Boolean()),
|
|
1764
|
+
label: Type.Optional(SessionLabelString),
|
|
1765
|
+
spawnedBy: Type.Optional(NonEmptyString),
|
|
1766
|
+
agentId: Type.Optional(NonEmptyString),
|
|
1767
|
+
search: Type.Optional(Type.String())
|
|
1768
|
+
}, { additionalProperties: false });
|
|
1769
|
+
const SessionsPreviewParamsSchema = Type.Object({
|
|
1770
|
+
keys: Type.Array(NonEmptyString, { minItems: 1 }),
|
|
1771
|
+
limit: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
1772
|
+
maxChars: Type.Optional(Type.Integer({ minimum: 20 }))
|
|
1773
|
+
}, { additionalProperties: false });
|
|
1774
|
+
const SessionsResolveParamsSchema = Type.Object({
|
|
1775
|
+
key: Type.Optional(NonEmptyString),
|
|
1776
|
+
sessionId: Type.Optional(NonEmptyString),
|
|
1777
|
+
label: Type.Optional(SessionLabelString),
|
|
1778
|
+
agentId: Type.Optional(NonEmptyString),
|
|
1779
|
+
spawnedBy: Type.Optional(NonEmptyString),
|
|
1780
|
+
includeGlobal: Type.Optional(Type.Boolean()),
|
|
1781
|
+
includeUnknown: Type.Optional(Type.Boolean())
|
|
1782
|
+
}, { additionalProperties: false });
|
|
1783
|
+
const SessionsPatchParamsSchema = Type.Object({
|
|
1784
|
+
key: NonEmptyString,
|
|
1785
|
+
label: Type.Optional(Type.Union([SessionLabelString, Type.Null()])),
|
|
1786
|
+
verboseLevel: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1787
|
+
responseUsage: Type.Optional(Type.Union([
|
|
1788
|
+
Type.Literal("off"),
|
|
1789
|
+
Type.Literal("tokens"),
|
|
1790
|
+
Type.Literal("full"),
|
|
1791
|
+
Type.Literal("on"),
|
|
1792
|
+
Type.Null()
|
|
1793
|
+
])),
|
|
1794
|
+
elevatedLevel: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1795
|
+
execHost: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1796
|
+
execSecurity: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1797
|
+
execAsk: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1798
|
+
execNode: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1799
|
+
model: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1800
|
+
spawnedBy: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
|
|
1801
|
+
spawnDepth: Type.Optional(Type.Union([Type.Integer({ minimum: 0 }), Type.Null()])),
|
|
1802
|
+
sendPolicy: Type.Optional(Type.Union([
|
|
1803
|
+
Type.Literal("allow"),
|
|
1804
|
+
Type.Literal("deny"),
|
|
1805
|
+
Type.Null()
|
|
1806
|
+
])),
|
|
1807
|
+
groupActivation: Type.Optional(Type.Union([
|
|
1808
|
+
Type.Literal("mention"),
|
|
1809
|
+
Type.Literal("always"),
|
|
1810
|
+
Type.Null()
|
|
1811
|
+
]))
|
|
1812
|
+
}, { additionalProperties: false });
|
|
1813
|
+
const SessionsResetParamsSchema = Type.Object({
|
|
1814
|
+
key: NonEmptyString,
|
|
1815
|
+
reason: Type.Optional(Type.Union([Type.Literal("new"), Type.Literal("reset")]))
|
|
1816
|
+
}, { additionalProperties: false });
|
|
1817
|
+
const SessionsDeleteParamsSchema = Type.Object({
|
|
1818
|
+
key: NonEmptyString,
|
|
1819
|
+
deleteTranscript: Type.Optional(Type.Boolean()),
|
|
1820
|
+
emitLifecycleHooks: Type.Optional(Type.Boolean())
|
|
1821
|
+
}, { additionalProperties: false });
|
|
1822
|
+
const SessionsCompactParamsSchema = Type.Object({
|
|
1823
|
+
key: NonEmptyString,
|
|
1824
|
+
maxLines: Type.Optional(Type.Integer({ minimum: 1 }))
|
|
1825
|
+
}, { additionalProperties: false });
|
|
1826
|
+
const SessionsUsageParamsSchema = Type.Object({
|
|
1827
|
+
key: Type.Optional(NonEmptyString),
|
|
1828
|
+
startDate: Type.Optional(Type.String({ pattern: "^\\d{4}-\\d{2}-\\d{2}$" })),
|
|
1829
|
+
endDate: Type.Optional(Type.String({ pattern: "^\\d{4}-\\d{2}-\\d{2}$" })),
|
|
1830
|
+
mode: Type.Optional(Type.Union([
|
|
1831
|
+
Type.Literal("utc"),
|
|
1832
|
+
Type.Literal("gateway"),
|
|
1833
|
+
Type.Literal("specific")
|
|
1834
|
+
])),
|
|
1835
|
+
utcOffset: Type.Optional(Type.String({ pattern: "^UTC[+-]\\d{1,2}(?::[0-5]\\d)?$" })),
|
|
1836
|
+
limit: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
1837
|
+
includeContextWeight: Type.Optional(Type.Boolean())
|
|
1838
|
+
}, { additionalProperties: false });
|
|
1839
|
+
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region src/gateway/protocol/schema/wizard.ts
|
|
1842
|
+
const WizardRunStatusSchema = Type.Union([
|
|
1843
|
+
Type.Literal("running"),
|
|
1844
|
+
Type.Literal("done"),
|
|
1845
|
+
Type.Literal("cancelled"),
|
|
1846
|
+
Type.Literal("error")
|
|
1847
|
+
]);
|
|
1848
|
+
const WizardStartParamsSchema = Type.Object({
|
|
1849
|
+
mode: Type.Optional(Type.Union([Type.Literal("local"), Type.Literal("remote")])),
|
|
1850
|
+
workspace: Type.Optional(Type.String())
|
|
1851
|
+
}, { additionalProperties: false });
|
|
1852
|
+
const WizardAnswerSchema = Type.Object({
|
|
1853
|
+
stepId: NonEmptyString,
|
|
1854
|
+
value: Type.Optional(Type.Unknown())
|
|
1855
|
+
}, { additionalProperties: false });
|
|
1856
|
+
const WizardNextParamsSchema = Type.Object({
|
|
1857
|
+
sessionId: NonEmptyString,
|
|
1858
|
+
answer: Type.Optional(WizardAnswerSchema)
|
|
1859
|
+
}, { additionalProperties: false });
|
|
1860
|
+
const WizardSessionIdParamsSchema = Type.Object({ sessionId: NonEmptyString }, { additionalProperties: false });
|
|
1861
|
+
const WizardCancelParamsSchema = WizardSessionIdParamsSchema;
|
|
1862
|
+
const WizardStatusParamsSchema = WizardSessionIdParamsSchema;
|
|
1863
|
+
const WizardStepOptionSchema = Type.Object({
|
|
1864
|
+
value: Type.Unknown(),
|
|
1865
|
+
label: NonEmptyString,
|
|
1866
|
+
hint: Type.Optional(Type.String())
|
|
1867
|
+
}, { additionalProperties: false });
|
|
1868
|
+
const WizardStepSchema = Type.Object({
|
|
1869
|
+
id: NonEmptyString,
|
|
1870
|
+
type: Type.Union([
|
|
1871
|
+
Type.Literal("note"),
|
|
1872
|
+
Type.Literal("select"),
|
|
1873
|
+
Type.Literal("text"),
|
|
1874
|
+
Type.Literal("confirm"),
|
|
1875
|
+
Type.Literal("multiselect"),
|
|
1876
|
+
Type.Literal("progress"),
|
|
1877
|
+
Type.Literal("action")
|
|
1878
|
+
]),
|
|
1879
|
+
title: Type.Optional(Type.String()),
|
|
1880
|
+
message: Type.Optional(Type.String()),
|
|
1881
|
+
options: Type.Optional(Type.Array(WizardStepOptionSchema)),
|
|
1882
|
+
initialValue: Type.Optional(Type.Unknown()),
|
|
1883
|
+
placeholder: Type.Optional(Type.String()),
|
|
1884
|
+
sensitive: Type.Optional(Type.Boolean()),
|
|
1885
|
+
executor: Type.Optional(Type.Union([Type.Literal("gateway"), Type.Literal("client")]))
|
|
1886
|
+
}, { additionalProperties: false });
|
|
1887
|
+
const WizardResultFields = {
|
|
1888
|
+
done: Type.Boolean(),
|
|
1889
|
+
step: Type.Optional(WizardStepSchema),
|
|
1890
|
+
status: Type.Optional(WizardRunStatusSchema),
|
|
1891
|
+
error: Type.Optional(Type.String())
|
|
1892
|
+
};
|
|
1893
|
+
const WizardNextResultSchema = Type.Object(WizardResultFields, { additionalProperties: false });
|
|
1894
|
+
const WizardStartResultSchema = Type.Object({
|
|
1895
|
+
sessionId: NonEmptyString,
|
|
1896
|
+
...WizardResultFields
|
|
1897
|
+
}, { additionalProperties: false });
|
|
1898
|
+
const WizardStatusResultSchema = Type.Object({
|
|
1899
|
+
status: WizardRunStatusSchema,
|
|
1900
|
+
error: Type.Optional(Type.String())
|
|
1901
|
+
}, { additionalProperties: false });
|
|
1902
|
+
|
|
1903
|
+
//#endregion
|
|
1904
|
+
//#region src/gateway/protocol/schema/protocol-schemas.ts
|
|
1905
|
+
const PROTOCOL_VERSION = 3;
|
|
1906
|
+
|
|
1907
|
+
//#endregion
|
|
1908
|
+
//#region src/gateway/protocol/index.ts
|
|
1909
|
+
const ajv = new AjvPkg({
|
|
1910
|
+
allErrors: true,
|
|
1911
|
+
strict: false,
|
|
1912
|
+
removeAdditional: false
|
|
1913
|
+
});
|
|
1914
|
+
const validateConnectParams = ajv.compile(ConnectParamsSchema);
|
|
1915
|
+
const validateRequestFrame = ajv.compile(RequestFrameSchema);
|
|
1916
|
+
const validateResponseFrame = ajv.compile(ResponseFrameSchema);
|
|
1917
|
+
const validateEventFrame = ajv.compile(EventFrameSchema);
|
|
1918
|
+
const validateSendParams = ajv.compile(SendParamsSchema);
|
|
1919
|
+
const validatePollParams = ajv.compile(PollParamsSchema);
|
|
1920
|
+
const validateAgentParams = ajv.compile(AgentParamsSchema);
|
|
1921
|
+
const validateAgentIdentityParams = ajv.compile(AgentIdentityParamsSchema);
|
|
1922
|
+
const validateAgentWaitParams = ajv.compile(AgentWaitParamsSchema);
|
|
1923
|
+
const validateWakeParams = ajv.compile(WakeParamsSchema);
|
|
1924
|
+
const validateAgentsListParams = ajv.compile(AgentsListParamsSchema);
|
|
1925
|
+
const validateAgentsCreateParams = ajv.compile(AgentsCreateParamsSchema);
|
|
1926
|
+
const validateAgentsUpdateParams = ajv.compile(AgentsUpdateParamsSchema);
|
|
1927
|
+
const validateAgentsDeleteParams = ajv.compile(AgentsDeleteParamsSchema);
|
|
1928
|
+
const validateAgentsFilesListParams = ajv.compile(AgentsFilesListParamsSchema);
|
|
1929
|
+
const validateAgentsFilesGetParams = ajv.compile(AgentsFilesGetParamsSchema);
|
|
1930
|
+
const validateAgentsFilesSetParams = ajv.compile(AgentsFilesSetParamsSchema);
|
|
1931
|
+
const validateNodePairRequestParams = ajv.compile(NodePairRequestParamsSchema);
|
|
1932
|
+
const validateNodePairListParams = ajv.compile(NodePairListParamsSchema);
|
|
1933
|
+
const validateNodePairApproveParams = ajv.compile(NodePairApproveParamsSchema);
|
|
1934
|
+
const validateNodePairRejectParams = ajv.compile(NodePairRejectParamsSchema);
|
|
1935
|
+
const validateNodePairVerifyParams = ajv.compile(NodePairVerifyParamsSchema);
|
|
1936
|
+
const validateNodeRenameParams = ajv.compile(NodeRenameParamsSchema);
|
|
1937
|
+
const validateNodeListParams = ajv.compile(NodeListParamsSchema);
|
|
1938
|
+
const validateNodeDescribeParams = ajv.compile(NodeDescribeParamsSchema);
|
|
1939
|
+
const validateNodeInvokeParams = ajv.compile(NodeInvokeParamsSchema);
|
|
1940
|
+
const validateNodeInvokeResultParams = ajv.compile(NodeInvokeResultParamsSchema);
|
|
1941
|
+
const validateNodeEventParams = ajv.compile(NodeEventParamsSchema);
|
|
1942
|
+
const validatePushTestParams = ajv.compile(PushTestParamsSchema);
|
|
1943
|
+
const validateSessionsListParams = ajv.compile(SessionsListParamsSchema);
|
|
1944
|
+
const validateSessionsPreviewParams = ajv.compile(SessionsPreviewParamsSchema);
|
|
1945
|
+
const validateSessionsResolveParams = ajv.compile(SessionsResolveParamsSchema);
|
|
1946
|
+
const validateSessionsPatchParams = ajv.compile(SessionsPatchParamsSchema);
|
|
1947
|
+
const validateSessionsResetParams = ajv.compile(SessionsResetParamsSchema);
|
|
1948
|
+
const validateSessionsDeleteParams = ajv.compile(SessionsDeleteParamsSchema);
|
|
1949
|
+
const validateSessionsCompactParams = ajv.compile(SessionsCompactParamsSchema);
|
|
1950
|
+
const validateSessionsUsageParams = ajv.compile(SessionsUsageParamsSchema);
|
|
1951
|
+
const validateConfigGetParams = ajv.compile(ConfigGetParamsSchema);
|
|
1952
|
+
const validateConfigSetParams = ajv.compile(ConfigSetParamsSchema);
|
|
1953
|
+
const validateConfigApplyParams = ajv.compile(ConfigApplyParamsSchema);
|
|
1954
|
+
const validateConfigPatchParams = ajv.compile(ConfigPatchParamsSchema);
|
|
1955
|
+
const validateConfigSchemaParams = ajv.compile(ConfigSchemaParamsSchema);
|
|
1956
|
+
const validateWizardStartParams = ajv.compile(WizardStartParamsSchema);
|
|
1957
|
+
const validateWizardNextParams = ajv.compile(WizardNextParamsSchema);
|
|
1958
|
+
const validateWizardCancelParams = ajv.compile(WizardCancelParamsSchema);
|
|
1959
|
+
const validateWizardStatusParams = ajv.compile(WizardStatusParamsSchema);
|
|
1960
|
+
const validateTalkModeParams = ajv.compile(TalkModeParamsSchema);
|
|
1961
|
+
const validateTalkConfigParams = ajv.compile(TalkConfigParamsSchema);
|
|
1962
|
+
const validateChannelsStatusParams = ajv.compile(ChannelsStatusParamsSchema);
|
|
1963
|
+
const validateChannelsLogoutParams = ajv.compile(ChannelsLogoutParamsSchema);
|
|
1964
|
+
const validateModelsListParams = ajv.compile(ModelsListParamsSchema);
|
|
1965
|
+
const validateToolsCatalogParams = ajv.compile(ToolsCatalogParamsSchema);
|
|
1966
|
+
const validateCronListParams = ajv.compile(CronListParamsSchema);
|
|
1967
|
+
const validateCronStatusParams = ajv.compile(CronStatusParamsSchema);
|
|
1968
|
+
const validateCronAddParams = ajv.compile(CronAddParamsSchema);
|
|
1969
|
+
const validateCronUpdateParams = ajv.compile(CronUpdateParamsSchema);
|
|
1970
|
+
const validateCronRemoveParams = ajv.compile(CronRemoveParamsSchema);
|
|
1971
|
+
const validateCronRunParams = ajv.compile(CronRunParamsSchema);
|
|
1972
|
+
const validateCronRunsParams = ajv.compile(CronRunsParamsSchema);
|
|
1973
|
+
const validateDevicePairListParams = ajv.compile(DevicePairListParamsSchema);
|
|
1974
|
+
const validateDevicePairApproveParams = ajv.compile(DevicePairApproveParamsSchema);
|
|
1975
|
+
const validateDevicePairRejectParams = ajv.compile(DevicePairRejectParamsSchema);
|
|
1976
|
+
const validateDevicePairRemoveParams = ajv.compile(DevicePairRemoveParamsSchema);
|
|
1977
|
+
const validateDeviceTokenRotateParams = ajv.compile(DeviceTokenRotateParamsSchema);
|
|
1978
|
+
const validateDeviceTokenRevokeParams = ajv.compile(DeviceTokenRevokeParamsSchema);
|
|
1979
|
+
const validateLogsTailParams = ajv.compile(LogsTailParamsSchema);
|
|
1980
|
+
const validateChatHistoryParams = ajv.compile(ChatHistoryParamsSchema);
|
|
1981
|
+
const validateChatSendParams = ajv.compile(ChatSendParamsSchema);
|
|
1982
|
+
const validateChatAbortParams = ajv.compile(ChatAbortParamsSchema);
|
|
1983
|
+
const validateChatInjectParams = ajv.compile(ChatInjectParamsSchema);
|
|
1984
|
+
const validateChatEvent = ajv.compile(ChatEventSchema);
|
|
1985
|
+
const validateUpdateRunParams = ajv.compile(UpdateRunParamsSchema);
|
|
1986
|
+
const validateWebLoginStartParams = ajv.compile(WebLoginStartParamsSchema);
|
|
1987
|
+
const validateWebLoginWaitParams = ajv.compile(WebLoginWaitParamsSchema);
|
|
1988
|
+
function formatValidationErrors(errors) {
|
|
1989
|
+
if (!errors?.length) return "unknown validation error";
|
|
1990
|
+
const parts = [];
|
|
1991
|
+
for (const err of errors) {
|
|
1992
|
+
const keyword = typeof err?.keyword === "string" ? err.keyword : "";
|
|
1993
|
+
const instancePath = typeof err?.instancePath === "string" ? err.instancePath : "";
|
|
1994
|
+
if (keyword === "additionalProperties") {
|
|
1995
|
+
const additionalProperty = (err?.params)?.additionalProperty;
|
|
1996
|
+
if (typeof additionalProperty === "string" && additionalProperty.trim()) {
|
|
1997
|
+
const where = instancePath ? `at ${instancePath}` : "at root";
|
|
1998
|
+
parts.push(`${where}: unexpected property '${additionalProperty}'`);
|
|
1999
|
+
continue;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
const message = typeof err?.message === "string" && err.message.trim() ? err.message : "validation error";
|
|
2003
|
+
const where = instancePath ? `at ${instancePath}: ` : "";
|
|
2004
|
+
parts.push(`${where}${message}`);
|
|
2005
|
+
}
|
|
2006
|
+
const unique = Array.from(new Set(parts.filter((part) => part.trim())));
|
|
2007
|
+
if (!unique.length) return ajv.errorsText(errors, { separator: "; " }) || "unknown validation error";
|
|
2008
|
+
return unique.join("; ");
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
//#endregion
|
|
2012
|
+
//#region src/gateway/client.ts
|
|
2013
|
+
var GatewayClient = class {
|
|
2014
|
+
constructor(opts) {
|
|
2015
|
+
this.ws = null;
|
|
2016
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
2017
|
+
this.backoffMs = 1e3;
|
|
2018
|
+
this.closed = false;
|
|
2019
|
+
this.lastSeq = null;
|
|
2020
|
+
this.connectNonce = null;
|
|
2021
|
+
this.connectSent = false;
|
|
2022
|
+
this.connectTimer = null;
|
|
2023
|
+
this.lastTick = null;
|
|
2024
|
+
this.tickIntervalMs = 3e4;
|
|
2025
|
+
this.tickTimer = null;
|
|
2026
|
+
this.opts = {
|
|
2027
|
+
...opts,
|
|
2028
|
+
deviceIdentity: opts.deviceIdentity ?? loadOrCreateDeviceIdentity()
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
start() {
|
|
2032
|
+
if (this.closed) return;
|
|
2033
|
+
const url = this.opts.url ?? "ws://127.0.0.1:18789";
|
|
2034
|
+
if (this.opts.tlsFingerprint && !url.startsWith("wss://")) {
|
|
2035
|
+
this.opts.onConnectError?.(/* @__PURE__ */ new Error("gateway tls fingerprint requires wss:// gateway url"));
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
if (!isSecureWebSocketUrl(url)) {
|
|
2039
|
+
let displayHost = url;
|
|
2040
|
+
try {
|
|
2041
|
+
displayHost = new URL(url).hostname || url;
|
|
2042
|
+
} catch {}
|
|
2043
|
+
const error = /* @__PURE__ */ new Error(`SECURITY ERROR: Cannot connect to "${displayHost}" over plaintext ws://. Both credentials and chat data would be exposed to network interception. Use wss:// for remote URLs. Safe defaults: keep gateway.bind=loopback and connect via SSH tunnel (ssh -N -L 18789:127.0.0.1:18789 user@gateway-host), or use Tailscale Serve/Funnel. Run \`remoteclaw doctor --fix\` for guidance.`);
|
|
2044
|
+
this.opts.onConnectError?.(error);
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
const wsOptions = { maxPayload: 25 * 1024 * 1024 };
|
|
2048
|
+
if (url.startsWith("wss://") && this.opts.tlsFingerprint) {
|
|
2049
|
+
wsOptions.rejectUnauthorized = false;
|
|
2050
|
+
wsOptions.checkServerIdentity = ((_host, cert) => {
|
|
2051
|
+
const fingerprintValue = typeof cert === "object" && cert && "fingerprint256" in cert ? cert.fingerprint256 ?? "" : "";
|
|
2052
|
+
const fingerprint = normalizeFingerprint(typeof fingerprintValue === "string" ? fingerprintValue : "");
|
|
2053
|
+
const expected = normalizeFingerprint(this.opts.tlsFingerprint ?? "");
|
|
2054
|
+
if (!expected) return /* @__PURE__ */ new Error("gateway tls fingerprint missing");
|
|
2055
|
+
if (!fingerprint) return /* @__PURE__ */ new Error("gateway tls fingerprint unavailable");
|
|
2056
|
+
if (fingerprint !== expected) return /* @__PURE__ */ new Error("gateway tls fingerprint mismatch");
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
this.ws = new WebSocket$1(url, wsOptions);
|
|
2060
|
+
this.ws.on("open", () => {
|
|
2061
|
+
if (url.startsWith("wss://") && this.opts.tlsFingerprint) {
|
|
2062
|
+
const tlsError = this.validateTlsFingerprint();
|
|
2063
|
+
if (tlsError) {
|
|
2064
|
+
this.opts.onConnectError?.(tlsError);
|
|
2065
|
+
this.ws?.close(1008, tlsError.message);
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
this.queueConnect();
|
|
2070
|
+
});
|
|
2071
|
+
this.ws.on("message", (data) => this.handleMessage(rawDataToString(data)));
|
|
2072
|
+
this.ws.on("close", (code, reason) => {
|
|
2073
|
+
const reasonText = rawDataToString(reason);
|
|
2074
|
+
this.ws = null;
|
|
2075
|
+
if (code === 1008 && reasonText.toLowerCase().includes("device token mismatch") && !this.opts.token && !this.opts.password && this.opts.deviceIdentity) {
|
|
2076
|
+
const deviceId = this.opts.deviceIdentity.deviceId;
|
|
2077
|
+
const role = this.opts.role ?? "operator";
|
|
2078
|
+
try {
|
|
2079
|
+
clearDeviceAuthToken({
|
|
2080
|
+
deviceId,
|
|
2081
|
+
role
|
|
2082
|
+
});
|
|
2083
|
+
clearDevicePairing(deviceId).catch((err) => {
|
|
2084
|
+
logDebug(`failed clearing stale device pairing for device ${deviceId}: ${String(err)}`);
|
|
2085
|
+
});
|
|
2086
|
+
logDebug(`cleared stale device-auth token for device ${deviceId}`);
|
|
2087
|
+
} catch (err) {
|
|
2088
|
+
logDebug(`failed clearing stale device-auth token for device ${deviceId}: ${String(err)}`);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
this.flushPendingErrors(/* @__PURE__ */ new Error(`gateway closed (${code}): ${reasonText}`));
|
|
2092
|
+
this.scheduleReconnect();
|
|
2093
|
+
this.opts.onClose?.(code, reasonText);
|
|
2094
|
+
});
|
|
2095
|
+
this.ws.on("error", (err) => {
|
|
2096
|
+
logDebug(`gateway client error: ${String(err)}`);
|
|
2097
|
+
if (!this.connectSent) this.opts.onConnectError?.(err instanceof Error ? err : new Error(String(err)));
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
stop() {
|
|
2101
|
+
this.closed = true;
|
|
2102
|
+
if (this.tickTimer) {
|
|
2103
|
+
clearInterval(this.tickTimer);
|
|
2104
|
+
this.tickTimer = null;
|
|
2105
|
+
}
|
|
2106
|
+
this.ws?.close();
|
|
2107
|
+
this.ws = null;
|
|
2108
|
+
this.flushPendingErrors(/* @__PURE__ */ new Error("gateway client stopped"));
|
|
2109
|
+
}
|
|
2110
|
+
sendConnect() {
|
|
2111
|
+
if (this.connectSent) return;
|
|
2112
|
+
const nonce = this.connectNonce?.trim() ?? "";
|
|
2113
|
+
if (!nonce) {
|
|
2114
|
+
this.opts.onConnectError?.(/* @__PURE__ */ new Error("gateway connect challenge missing nonce"));
|
|
2115
|
+
this.ws?.close(1008, "connect challenge missing nonce");
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
this.connectSent = true;
|
|
2119
|
+
if (this.connectTimer) {
|
|
2120
|
+
clearTimeout(this.connectTimer);
|
|
2121
|
+
this.connectTimer = null;
|
|
2122
|
+
}
|
|
2123
|
+
const role = this.opts.role ?? "operator";
|
|
2124
|
+
const explicitGatewayToken = this.opts.token?.trim() || void 0;
|
|
2125
|
+
const explicitDeviceToken = this.opts.deviceToken?.trim() || void 0;
|
|
2126
|
+
const storedToken = this.opts.deviceIdentity ? loadDeviceAuthToken({
|
|
2127
|
+
deviceId: this.opts.deviceIdentity.deviceId,
|
|
2128
|
+
role
|
|
2129
|
+
})?.token : null;
|
|
2130
|
+
const resolvedDeviceToken = explicitDeviceToken ?? (!explicitGatewayToken ? storedToken ?? void 0 : void 0);
|
|
2131
|
+
const authToken = explicitGatewayToken ?? resolvedDeviceToken;
|
|
2132
|
+
const authPassword = this.opts.password?.trim() || void 0;
|
|
2133
|
+
const auth = authToken || authPassword || resolvedDeviceToken ? {
|
|
2134
|
+
token: authToken,
|
|
2135
|
+
deviceToken: resolvedDeviceToken,
|
|
2136
|
+
password: authPassword
|
|
2137
|
+
} : void 0;
|
|
2138
|
+
const signedAtMs = Date.now();
|
|
2139
|
+
const scopes = this.opts.scopes ?? ["operator.admin"];
|
|
2140
|
+
const device = (() => {
|
|
2141
|
+
if (!this.opts.deviceIdentity) return;
|
|
2142
|
+
const payload = buildDeviceAuthPayload({
|
|
2143
|
+
deviceId: this.opts.deviceIdentity.deviceId,
|
|
2144
|
+
clientId: this.opts.clientName ?? GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
|
|
2145
|
+
clientMode: this.opts.mode ?? GATEWAY_CLIENT_MODES.BACKEND,
|
|
2146
|
+
role,
|
|
2147
|
+
scopes,
|
|
2148
|
+
signedAtMs,
|
|
2149
|
+
token: authToken ?? null,
|
|
2150
|
+
nonce
|
|
2151
|
+
});
|
|
2152
|
+
const signature = signDevicePayload(this.opts.deviceIdentity.privateKeyPem, payload);
|
|
2153
|
+
return {
|
|
2154
|
+
id: this.opts.deviceIdentity.deviceId,
|
|
2155
|
+
publicKey: publicKeyRawBase64UrlFromPem(this.opts.deviceIdentity.publicKeyPem),
|
|
2156
|
+
signature,
|
|
2157
|
+
signedAt: signedAtMs,
|
|
2158
|
+
nonce
|
|
2159
|
+
};
|
|
2160
|
+
})();
|
|
2161
|
+
const params = {
|
|
2162
|
+
minProtocol: this.opts.minProtocol ?? PROTOCOL_VERSION,
|
|
2163
|
+
maxProtocol: this.opts.maxProtocol ?? PROTOCOL_VERSION,
|
|
2164
|
+
client: {
|
|
2165
|
+
id: this.opts.clientName ?? GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
|
|
2166
|
+
displayName: this.opts.clientDisplayName,
|
|
2167
|
+
version: this.opts.clientVersion ?? "dev",
|
|
2168
|
+
platform: this.opts.platform ?? process.platform,
|
|
2169
|
+
mode: this.opts.mode ?? GATEWAY_CLIENT_MODES.BACKEND,
|
|
2170
|
+
instanceId: this.opts.instanceId
|
|
2171
|
+
},
|
|
2172
|
+
caps: Array.isArray(this.opts.caps) ? this.opts.caps : [],
|
|
2173
|
+
commands: Array.isArray(this.opts.commands) ? this.opts.commands : void 0,
|
|
2174
|
+
permissions: this.opts.permissions && typeof this.opts.permissions === "object" ? this.opts.permissions : void 0,
|
|
2175
|
+
pathEnv: this.opts.pathEnv,
|
|
2176
|
+
auth,
|
|
2177
|
+
role,
|
|
2178
|
+
scopes,
|
|
2179
|
+
device
|
|
2180
|
+
};
|
|
2181
|
+
this.request("connect", params).then((helloOk) => {
|
|
2182
|
+
const authInfo = helloOk?.auth;
|
|
2183
|
+
if (authInfo?.deviceToken && this.opts.deviceIdentity) storeDeviceAuthToken({
|
|
2184
|
+
deviceId: this.opts.deviceIdentity.deviceId,
|
|
2185
|
+
role: authInfo.role ?? role,
|
|
2186
|
+
token: authInfo.deviceToken,
|
|
2187
|
+
scopes: authInfo.scopes ?? []
|
|
2188
|
+
});
|
|
2189
|
+
this.backoffMs = 1e3;
|
|
2190
|
+
this.tickIntervalMs = typeof helloOk.policy?.tickIntervalMs === "number" ? helloOk.policy.tickIntervalMs : 3e4;
|
|
2191
|
+
this.lastTick = Date.now();
|
|
2192
|
+
this.startTickWatch();
|
|
2193
|
+
this.opts.onHelloOk?.(helloOk);
|
|
2194
|
+
}).catch((err) => {
|
|
2195
|
+
this.opts.onConnectError?.(err instanceof Error ? err : new Error(String(err)));
|
|
2196
|
+
const msg = `gateway connect failed: ${String(err)}`;
|
|
2197
|
+
if (this.opts.mode === GATEWAY_CLIENT_MODES.PROBE) logDebug(msg);
|
|
2198
|
+
else logError(msg);
|
|
2199
|
+
this.ws?.close(1008, "connect failed");
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
handleMessage(raw) {
|
|
2203
|
+
try {
|
|
2204
|
+
const parsed = JSON.parse(raw);
|
|
2205
|
+
if (validateEventFrame(parsed)) {
|
|
2206
|
+
const evt = parsed;
|
|
2207
|
+
if (evt.event === "connect.challenge") {
|
|
2208
|
+
const payload = evt.payload;
|
|
2209
|
+
const nonce = payload && typeof payload.nonce === "string" ? payload.nonce : null;
|
|
2210
|
+
if (!nonce || nonce.trim().length === 0) {
|
|
2211
|
+
this.opts.onConnectError?.(/* @__PURE__ */ new Error("gateway connect challenge missing nonce"));
|
|
2212
|
+
this.ws?.close(1008, "connect challenge missing nonce");
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
this.connectNonce = nonce.trim();
|
|
2216
|
+
this.sendConnect();
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
const seq = typeof evt.seq === "number" ? evt.seq : null;
|
|
2220
|
+
if (seq !== null) {
|
|
2221
|
+
if (this.lastSeq !== null && seq > this.lastSeq + 1) this.opts.onGap?.({
|
|
2222
|
+
expected: this.lastSeq + 1,
|
|
2223
|
+
received: seq
|
|
2224
|
+
});
|
|
2225
|
+
this.lastSeq = seq;
|
|
2226
|
+
}
|
|
2227
|
+
if (evt.event === "tick") this.lastTick = Date.now();
|
|
2228
|
+
this.opts.onEvent?.(evt);
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
if (validateResponseFrame(parsed)) {
|
|
2232
|
+
const pending = this.pending.get(parsed.id);
|
|
2233
|
+
if (!pending) return;
|
|
2234
|
+
const status = parsed.payload?.status;
|
|
2235
|
+
if (pending.expectFinal && status === "accepted") return;
|
|
2236
|
+
this.pending.delete(parsed.id);
|
|
2237
|
+
if (parsed.ok) pending.resolve(parsed.payload);
|
|
2238
|
+
else pending.reject(new Error(parsed.error?.message ?? "unknown error"));
|
|
2239
|
+
}
|
|
2240
|
+
} catch (err) {
|
|
2241
|
+
logDebug(`gateway client parse error: ${String(err)}`);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
queueConnect() {
|
|
2245
|
+
this.connectNonce = null;
|
|
2246
|
+
this.connectSent = false;
|
|
2247
|
+
const rawConnectDelayMs = this.opts.connectDelayMs;
|
|
2248
|
+
const connectChallengeTimeoutMs = typeof rawConnectDelayMs === "number" && Number.isFinite(rawConnectDelayMs) ? Math.max(250, Math.min(1e4, rawConnectDelayMs)) : 2e3;
|
|
2249
|
+
if (this.connectTimer) clearTimeout(this.connectTimer);
|
|
2250
|
+
this.connectTimer = setTimeout(() => {
|
|
2251
|
+
if (this.connectSent || this.ws?.readyState !== WebSocket$1.OPEN) return;
|
|
2252
|
+
this.opts.onConnectError?.(/* @__PURE__ */ new Error("gateway connect challenge timeout"));
|
|
2253
|
+
this.ws?.close(1008, "connect challenge timeout");
|
|
2254
|
+
}, connectChallengeTimeoutMs);
|
|
2255
|
+
}
|
|
2256
|
+
scheduleReconnect() {
|
|
2257
|
+
if (this.closed) return;
|
|
2258
|
+
if (this.tickTimer) {
|
|
2259
|
+
clearInterval(this.tickTimer);
|
|
2260
|
+
this.tickTimer = null;
|
|
2261
|
+
}
|
|
2262
|
+
const delay = this.backoffMs;
|
|
2263
|
+
this.backoffMs = Math.min(this.backoffMs * 2, 3e4);
|
|
2264
|
+
setTimeout(() => this.start(), delay).unref();
|
|
2265
|
+
}
|
|
2266
|
+
flushPendingErrors(err) {
|
|
2267
|
+
for (const [, p] of this.pending) p.reject(err);
|
|
2268
|
+
this.pending.clear();
|
|
2269
|
+
}
|
|
2270
|
+
startTickWatch() {
|
|
2271
|
+
if (this.tickTimer) clearInterval(this.tickTimer);
|
|
2272
|
+
const rawMinInterval = this.opts.tickWatchMinIntervalMs;
|
|
2273
|
+
const minInterval = typeof rawMinInterval === "number" && Number.isFinite(rawMinInterval) ? Math.max(1, Math.min(3e4, rawMinInterval)) : 1e3;
|
|
2274
|
+
const interval = Math.max(this.tickIntervalMs, minInterval);
|
|
2275
|
+
this.tickTimer = setInterval(() => {
|
|
2276
|
+
if (this.closed) return;
|
|
2277
|
+
if (!this.lastTick) return;
|
|
2278
|
+
if (Date.now() - this.lastTick > this.tickIntervalMs * 2) this.ws?.close(4e3, "tick timeout");
|
|
2279
|
+
}, interval);
|
|
2280
|
+
}
|
|
2281
|
+
validateTlsFingerprint() {
|
|
2282
|
+
if (!this.opts.tlsFingerprint || !this.ws) return null;
|
|
2283
|
+
const expected = normalizeFingerprint(this.opts.tlsFingerprint);
|
|
2284
|
+
if (!expected) return /* @__PURE__ */ new Error("gateway tls fingerprint missing");
|
|
2285
|
+
const socket = this.ws._socket;
|
|
2286
|
+
if (!socket || typeof socket.getPeerCertificate !== "function") return /* @__PURE__ */ new Error("gateway tls fingerprint unavailable");
|
|
2287
|
+
const fingerprint = normalizeFingerprint(socket.getPeerCertificate()?.fingerprint256 ?? "");
|
|
2288
|
+
if (!fingerprint) return /* @__PURE__ */ new Error("gateway tls fingerprint unavailable");
|
|
2289
|
+
if (fingerprint !== expected) return /* @__PURE__ */ new Error("gateway tls fingerprint mismatch");
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
async request(method, params, opts) {
|
|
2293
|
+
if (!this.ws || this.ws.readyState !== WebSocket$1.OPEN) throw new Error("gateway not connected");
|
|
2294
|
+
const id = randomUUID();
|
|
2295
|
+
const frame = {
|
|
2296
|
+
type: "req",
|
|
2297
|
+
id,
|
|
2298
|
+
method,
|
|
2299
|
+
params
|
|
2300
|
+
};
|
|
2301
|
+
if (!validateRequestFrame(frame)) throw new Error(`invalid request frame: ${JSON.stringify(validateRequestFrame.errors, null, 2)}`);
|
|
2302
|
+
const expectFinal = opts?.expectFinal === true;
|
|
2303
|
+
const p = new Promise((resolve, reject) => {
|
|
2304
|
+
this.pending.set(id, {
|
|
2305
|
+
resolve: (value) => resolve(value),
|
|
2306
|
+
reject,
|
|
2307
|
+
expectFinal
|
|
2308
|
+
});
|
|
2309
|
+
});
|
|
2310
|
+
this.ws.send(JSON.stringify(frame));
|
|
2311
|
+
return p;
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
|
|
2315
|
+
//#endregion
|
|
2316
|
+
export { validateSendParams as $, validateCronStatusParams as A, removePairedDevice as At, validateNodeEventParams as B, pruneExpiredPending as Bt, validateConfigSetParams as C, parseSessionLabel as Ct, validateCronRemoveParams as D, getPairedDevice as Dt, validateCronListParams as E, ensureDeviceToken as Et, validateDevicePairRemoveParams as F, updatePairedDeviceMetadata as Ft, validateNodePairListParams as G, deriveDeviceIdFromPublicKey as Gt, validateNodeInvokeResultParams as H, upsertPendingPairingRequest as Ht, validateDeviceTokenRevokeParams as I, verifyDeviceToken as It, validateNodePairVerifyParams as J, verifyDeviceSignature as Jt, validateNodePairRejectParams as K, loadOrCreateDeviceIdentity as Kt, validateDeviceTokenRotateParams as L, generatePairingToken as Lt, validateDevicePairApproveParams as M, revokeDeviceToken as Mt, validateDevicePairListParams as N, rotateDeviceToken as Nt, validateCronRunParams as O, listDevicePairing as Ot, validateDevicePairRejectParams as P, summarizeDeviceTokens as Pt, validateRequestFrame as Q, validateLogsTailParams as R, verifyPairingToken as Rt, validateConfigSchemaParams as S, SESSION_LABEL_MAX_LENGTH as St, validateCronAddParams as T, approveDevicePairing as Tt, validateNodeListParams as U, roleScopesAllow as Ut, validateNodeInvokeParams as V, resolvePairingPaths as Vt, validateNodePairApproveParams as W, normalizeFingerprint as Wt, validatePollParams as X, validateNodeRenameParams as Y, validatePushTestParams as Z, validateChatInjectParams as _, validateWizardStartParams as _t, validateAgentWaitParams as a, validateSessionsResetParams as at, validateConfigGetParams as b, ErrorCodes as bt, validateAgentsFilesGetParams as c, validateTalkConfigParams as ct, validateAgentsListParams as d, validateUpdateRunParams as dt, validateSessionsCompactParams as et, validateAgentsUpdateParams as f, validateWakeParams as ft, validateChatHistoryParams as g, validateWizardNextParams as gt, validateChatAbortParams as h, validateWizardCancelParams as ht, validateAgentParams as i, validateSessionsPreviewParams as it, validateCronUpdateParams as j, requestDevicePairing as jt, validateCronRunsParams as k, rejectDevicePairing as kt, validateAgentsFilesListParams as l, validateTalkModeParams as lt, validateChannelsStatusParams as m, validateWebLoginWaitParams as mt, formatValidationErrors as n, validateSessionsListParams as nt, validateAgentsCreateParams as o, validateSessionsResolveParams as ot, validateChannelsLogoutParams as p, validateWebLoginStartParams as pt, validateNodePairRequestParams as q, normalizeDevicePublicKeyBase64Url as qt, validateAgentIdentityParams as r, validateSessionsPatchParams as rt, validateAgentsDeleteParams as s, validateSessionsUsageParams as st, GatewayClient as t, validateSessionsDeleteParams as tt, validateAgentsFilesSetParams as u, validateToolsCatalogParams as ut, validateChatSendParams as v, validateWizardStatusParams as vt, validateConnectParams as w, buildDeviceAuthPayload as wt, validateConfigPatchParams as x, errorShape as xt, validateConfigApplyParams as y, PROTOCOL_VERSION as yt, validateNodeDescribeParams as z, rejectPendingPairingRequest as zt };
|