@xopcai/xopc 0.0.269 → 0.0.272
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/browser-ext/dist/assets/{auth-cwEj8rFb.js → auth-C1QI-uMG.js} +65 -14
- package/dist/browser-ext/dist/background.js +23 -2
- package/dist/browser-ext/dist/pairing-handoff.js +51 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +39 -27
- package/dist/browser-ext/manifest.json +12 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DcwCSY6s.js → activity-store-DffqjeqQ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D0NBOWC4.js → agent-avatar-dicebear-Cwj4HCYY.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-6CLfLxVc.js +1 -0
- package/dist/gateway/static/root/assets/agents-B6mu64fY.js +1 -0
- package/dist/gateway/static/root/assets/{api-eaPO-mdr.js → api-CGLdye4i.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-E3xm2teY.js → app-management-settings-panel-BLujSbaw.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CiZOjgls.js → appearance-settings-BXMcueb8.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BEgy4hY3.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D09yo_Hc.js → archive-plugin-D4bUampf.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CNYb8Qru.js → attachment-load-CBGNA2Ys.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DsrfW5ii.js → automations-page-dQyolNmy.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DxRFrmrV.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-OWlaGqlY.js → binary-plugins-bbvp81h2.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CVND3M6r.js → block-editor-C8e6Wri4.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D7IzVK_J.js → browser-automation-inputs-oJWJtQa6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CQ6cCpIv.js → browser-automations-page-CAcJQSjN.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-TLAlqcPo.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-z-K_jrZz.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-Dzrk33aB.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-D4JrgJKa.js → channels-status-swr-CfOPNnVr.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BUjnhT7C.js → chat-terminal-dock-9ZOl92kh.js} +2 -2
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-B1dIoRNi.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-C26e13YU.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-Dj6FRLF9.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-Z6Nf0Wjq.js → dependency-picker-D1q89tVc.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C0F5Iqnc.js → desktop-pet-DfqZBvhp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Bj_W6HL1.js → desktop-pet-settings-HCEh2MOm.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CPth92s6.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Ba09EnAn.js → extension-debug-page-C8cAWVoK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C88aGXJs.js → extension-page-5N87Vaym.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-D85SAUFP.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-bjzk_4hn.js → gateway-config-swr-BjsDnB_n.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dqx8PmcT.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrbIzFyB.js → gateway-startup-retry-BIf0eLWX.js} +1 -1
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-BpDWGE1a.js +1 -0
- package/dist/gateway/static/root/assets/home-page-DJaqpC8-.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CBWU9Ner.js → image-generation-api-1m8xTVS_.js} +1 -1
- package/dist/gateway/static/root/assets/index-C6PmD0cK.js +74 -0
- package/dist/gateway/static/root/assets/index-DKy1Qn1_.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8Z7kKQY.js → keyboard-shortcuts-settings-Byy8mCSq.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-l2AEiG2C.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CLSfzkRp.js → local-apps-page-BPo0wBgM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-CRNble2Z.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-X5FdLlXK.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DT6NoIjm.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DIcfrLmG.js → markdown-view-AglreSOj.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CSv6-xTA.js → media-plugins-Bzka9qXu.js} +1 -1
- package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
- package/dist/gateway/static/root/assets/{messages-BRjoarIr.js → messages-DH_HCgmw.js} +3 -3
- package/dist/gateway/static/root/assets/note-detail-panel-BUJPoaGZ.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BwFpWRuo.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BfV-PQa5.js → page-tabs-Ys0p65Lt.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-Dz_Qis2R.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DQS7NFpg.js → preview-open-alternatives-iknB5xEp.js} +1 -1
- package/dist/gateway/static/root/assets/proactive-card-BPZDgNNR.js +1 -0
- package/dist/gateway/static/root/assets/proactive-page-CxdZR-p2.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BIhjZLKg.js → product-open-page-W1o3f-kz.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BU1RKAcy.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-z0X0tL8G.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CwveUfe8.js → registry-api-DmYFpjsH.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-NNTut2I8.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DMQ0wpNg.js → runtime-tools-settings-panel-DP1XyYO8.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-C91g2PRU.js → schema-form-BMYKdzsH.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B6SsHlz5.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BQu8bAcN.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Cem6L49Y.js → settings-form-section-2LGjz7bu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-afDUxqlV.js → settings-page-7DjpC9_C.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Dj9jFWJt.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CVEVHksg.js → share-preview-page-BxYdSi8c.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CMqE0KuK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BXqSJymN.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CNrq1W6C.js → skills-page-DNEScMZH.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page.utils-q88l65YU.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BLE8PxWE.js → system-settings-panel-8NIssGKj.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-L6dp9v2y.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BejLVjIT.js → theme-store-BXZG3S25.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CWsRPM84.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DmgEA8Qb.js → use-autosave-BwQuoTQU.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-D4BucMrZ.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-sZ0J83SF.js → voice-api-key-field-Bd03Ic0s.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BEbz3avx.js → voice-config-api-gggUp3u9.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BXnAlbmO.js → work-discovery-overlay-DF8PR_pK.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BkwFey0a.js → workflow-run-setup-panel-BiAAWlir.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DryKUMfA.js +6 -0
- package/dist/gateway/static/root/index.html +15 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +2 -1
- package/dist/packages/gateway-contract/src/notifications.js +2 -2
- package/dist/packages/gateway-contract/src/proactive.js +22 -6
- package/dist/packages/gateway-contract/src/session-identity.js +37 -0
- package/dist/src/agent/memory/compaction-chunks.d.ts +18 -0
- package/dist/src/agent/memory/compaction-chunks.js +53 -0
- package/dist/src/agent/memory/compaction-request.d.ts +12 -0
- package/dist/src/agent/memory/compaction-request.js +72 -0
- package/dist/src/agent/memory/compaction.d.ts +3 -0
- package/dist/src/agent/memory/compaction.js +166 -118
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +19 -1
- package/dist/src/agent/tools/factory.js +1 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
- package/dist/src/agent/tools/xopc-use-tool.js +48 -4
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +3 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/tunnel.js +5 -0
- package/dist/src/connectors/connected-source-ingestion.js +1 -1
- package/dist/src/connectors/connected-source-normalizers.js +3 -0
- package/dist/src/connectors/connection-recovery-service.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +1 -0
- package/dist/src/gateway/hono/middleware/auth.d.ts +1 -2
- package/dist/src/gateway/hono/middleware/auth.js +49 -31
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +11 -15
- package/dist/src/gateway/hono/routes/browser-session.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-session.js +43 -0
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +61 -96
- package/dist/src/gateway/hono/routes/exposure.js +3 -7
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +60 -1
- package/dist/src/gateway/hono/routes/notes.js +3 -7
- package/dist/src/gateway/hono/routes/proactive-control.js +31 -24
- package/dist/src/gateway/hono/routes/sessions.js +11 -0
- package/dist/src/gateway/hono/routes/shares.js +8 -20
- package/dist/src/gateway/hono/routes/site-shares.js +4 -8
- package/dist/src/gateway/hono/routes/tunnel.js +13 -13
- package/dist/src/gateway/image-generation-setup.d.ts +17 -0
- package/dist/src/gateway/image-generation-setup.js +30 -21
- package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
- package/dist/src/gateway/rate-limit/buckets.js +10 -0
- package/dist/src/gateway/runtime-config.js +2 -0
- package/dist/src/gateway/security/browser-session.d.ts +5 -0
- package/dist/src/gateway/security/browser-session.js +45 -0
- package/dist/src/gateway/security/gateway-principal.d.ts +1 -0
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +21 -11
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/rate-limit/keyed-store.d.ts +3 -0
- package/dist/src/infra/rate-limit/keyed-store.js +9 -2
- package/dist/src/notifications/web-push.js +1 -1
- package/dist/src/proactive/actions/service.js +4 -2
- package/dist/src/proactive/execution/authorization.d.ts +2 -0
- package/dist/src/proactive/execution/authorization.js +39 -1
- package/dist/src/proactive/execution/context.d.ts +4 -0
- package/dist/src/proactive/execution/context.js +51 -5
- package/dist/src/proactive/execution/insight.js +3 -1
- package/dist/src/proactive/execution/repository.js +15 -5
- package/dist/src/proactive/execution/types.d.ts +2 -0
- package/dist/src/proactive/execution/worker.js +7 -2
- package/dist/src/proactive/experience.d.ts +69 -0
- package/dist/src/proactive/experience.js +90 -0
- package/dist/src/proactive/follow-ups.d.ts +123 -0
- package/dist/src/proactive/follow-ups.js +169 -0
- package/dist/src/proactive/inbox/cards.js +35 -6
- package/dist/src/proactive/inbox/delivery.js +4 -2
- package/dist/src/proactive/inbox/digest.js +2 -2
- package/dist/src/proactive/inbox/lifecycle.js +4 -1
- package/dist/src/proactive/inbox/notification-policy.js +4 -2
- package/dist/src/proactive/inbox/repository.js +17 -11
- package/dist/src/proactive/inbox/types.d.ts +2 -0
- package/dist/src/proactive/inbox/worker.js +1 -1
- package/dist/src/proactive/index.js +2 -2
- package/dist/src/proactive/mail-thread.d.ts +13 -0
- package/dist/src/proactive/mail-thread.js +54 -0
- package/dist/src/proactive/policy/service.d.ts +3 -5
- package/dist/src/proactive/policy/service.js +3 -5
- package/dist/src/proactive/scenarios/control.d.ts +4 -7
- package/dist/src/proactive/scenarios/control.js +3 -4
- package/dist/src/proactive/scenarios/preview.js +1 -1
- package/dist/src/proactive/scenarios/prompt-composer.js +2 -0
- package/dist/src/proactive/service.js +1 -1
- package/dist/src/proactive/temporal/worker.d.ts +1 -0
- package/dist/src/proactive/temporal/worker.js +18 -4
- package/dist/src/realtime/runtime.d.ts +2 -1
- package/dist/src/realtime/runtime.js +9 -3
- package/dist/src/realtime/tickets.d.ts +1 -0
- package/dist/src/realtime/tickets.js +3 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +17 -2
- package/dist/src/session/types.d.ts +2 -1
- package/dist/src/storage/sqlite/browser-session-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/browser-session-repository.js +54 -0
- package/dist/src/storage/sqlite/device-pairing-approval.js +2 -1
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +4 -10
- package/dist/src/storage/sqlite/device-pairing-repository.js +10 -62
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +7 -0
- package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +29 -0
- package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +8 -0
- package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +40 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-identity-sql.d.ts +2 -0
- package/dist/src/storage/sqlite/session-identity-sql.js +18 -0
- package/dist/src/storage/sqlite/session-repository.js +26 -22
- package/dist/src/tasks/home-query-service.js +1 -1
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tunnel/auth-policy.d.ts +3 -0
- package/dist/src/tunnel/auth-policy.js +8 -0
- package/dist/src/tunnel/broker-client.d.ts +5 -15
- package/dist/src/tunnel/broker-client.js +37 -49
- package/dist/src/tunnel/frpc-binary.d.ts +8 -6
- package/dist/src/tunnel/frpc-binary.js +76 -88
- package/dist/src/tunnel/frpc-config.d.ts +2 -1
- package/dist/src/tunnel/frpc-config.js +29 -12
- package/dist/src/tunnel/frpc-release.d.ts +27 -0
- package/dist/src/tunnel/frpc-release.js +30 -0
- package/dist/src/tunnel/gateway-lifecycle.js +8 -2
- package/dist/src/tunnel/index.js +2 -1
- package/dist/src/tunnel/registration-proof.d.ts +19 -0
- package/dist/src/tunnel/registration-proof.js +37 -0
- package/dist/src/tunnel/tunnel-persist.js +3 -1
- package/dist/src/tunnel/tunnel-service.d.ts +1 -0
- package/dist/src/tunnel/tunnel-service.js +35 -8
- package/dist/src/tunnel/tunnel-state.js +11 -5
- package/dist/src/tunnel/tunnel-types.d.ts +2 -0
- package/dist/src/tunnel/well-known.js +5 -1
- package/dist/src/user-context/config.js +2 -2
- package/dist/src/utils/logger/redact.js +4 -0
- package/dist/src/voice/dashscope/streaming-stt-session.js +1 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.d.ts +1 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.js +8 -0
- package/dist/src/voice/realtime/agentBroker.js +1 -1
- package/dist/src/voice/realtime/agentEngine.js +1 -1
- package/dist/src/voice/realtime/pcm-output-gain.d.ts +2 -0
- package/dist/src/voice/realtime/pcm-output-gain.js +16 -0
- package/dist/src/voice/realtime/runtime.d.ts +1 -0
- package/dist/src/voice/realtime/runtime.js +21 -3
- package/dist/src/voice/realtime/runtime.types.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +3 -1
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-qKCezlBg.js +0 -1
- package/dist/gateway/static/root/assets/agents-BMhnZKhP.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DduJDWGY.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-X7hNHCjW.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BZ7nK_pN.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BfKvJO1C.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-D1UDxJuA.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C2nuqs_O.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DlyRIyUn.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CU-ij_yE.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CMyt0A32.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-ogv8ZbvG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BnrMRKaZ.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CbcJCREd.js +0 -1
- package/dist/gateway/static/root/assets/index-7PZ6jmhy.css +0 -2
- package/dist/gateway/static/root/assets/index-CfyyA9-g.js +0 -74
- package/dist/gateway/static/root/assets/local-app-workbench-page-D5XVZnK1.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-BQ2HKTWb.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CWDU1AGN.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-CuFNgQUy.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-C7d_ztgp.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-D5JuBLyt.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C5-ccCi4.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-fHjPigmx.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-6v_khvEt.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CCy1aK4V.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-pkqKRnch.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-Cr4E4cap.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D1JRDRyL.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cc_iP_vv.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BrMECMAB.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DuqIDYjc.js +0 -1
- package/dist/gateway/static/root/assets/skills-page.utils-D1wGfm22.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-m0oXUKl2.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Dur80zSQ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Dl10D_5q.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CswgoIFU.js +0 -6
- package/dist/src/proactive/actions/workflow.d.ts +0 -15
- package/dist/src/proactive/actions/workflow.js +0 -88
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const FRPC_VERSION = "0.62.1";
|
|
2
|
+
export declare const FRPC_RELEASES: {
|
|
3
|
+
readonly darwin_amd64: {
|
|
4
|
+
readonly archive: "f951a5aa727a4880f32753ba3c41ecc9dee38a63658760354011e71ea83db995";
|
|
5
|
+
readonly binary: "5ce5258b6ff1a232e9eb8e29247a55badb127e7fc66b5a58c299b442aba2bcb2";
|
|
6
|
+
};
|
|
7
|
+
readonly darwin_arm64: {
|
|
8
|
+
readonly archive: "f9fc616d994a87d790504da21c2f942cd4224637d9ade9a67482f3c23c7f2432";
|
|
9
|
+
readonly binary: "49afde483f55927c3eeac9141cae82857cb2f15b9e9d55f4ac45378e761eabcc";
|
|
10
|
+
};
|
|
11
|
+
readonly linux_amd64: {
|
|
12
|
+
readonly archive: "dcf1c62e5862543b6686a8e4c2f430ef636ac33306167f377e7272875020c4d3";
|
|
13
|
+
readonly binary: "030bff369048a49fce09e44f96e71fab36522394675ab10b2e684c9e3cc0aa26";
|
|
14
|
+
};
|
|
15
|
+
readonly linux_arm64: {
|
|
16
|
+
readonly archive: "94c98c19ce181f8e09e0d0cb79c278c31e9ec936eb713826a1ddf4995e7c2155";
|
|
17
|
+
readonly binary: "3f900ac9b035aac50b117ce5f7c450ca073d3e453448783979e978dc57bc39a9";
|
|
18
|
+
};
|
|
19
|
+
readonly windows_amd64: {
|
|
20
|
+
readonly archive: "a12e3b36b81232ad9888b43519a6dbcacc5c8def52f3a6c6e95d4fae6a373c5d";
|
|
21
|
+
readonly binary: "14cd52ca87fea607852b3a8e194146eeabe6ce87976cd1fc6327b74caebb6c77";
|
|
22
|
+
};
|
|
23
|
+
readonly windows_arm64: {
|
|
24
|
+
readonly archive: "da9e79e7cacc5570631196fae2f9e50ae5202521aa8abaf2e6de85b1778086b9";
|
|
25
|
+
readonly binary: "14b1b4bdd75228dc29dbc3ca264602911242a0e60cb0acb3311eb4926d50cb4b";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/tunnel/frpc-release.ts
|
|
2
|
+
const FRPC_VERSION = "0.62.1";
|
|
3
|
+
const FRPC_RELEASES = {
|
|
4
|
+
"darwin_amd64": {
|
|
5
|
+
"archive": "f951a5aa727a4880f32753ba3c41ecc9dee38a63658760354011e71ea83db995",
|
|
6
|
+
"binary": "5ce5258b6ff1a232e9eb8e29247a55badb127e7fc66b5a58c299b442aba2bcb2"
|
|
7
|
+
},
|
|
8
|
+
"darwin_arm64": {
|
|
9
|
+
"archive": "f9fc616d994a87d790504da21c2f942cd4224637d9ade9a67482f3c23c7f2432",
|
|
10
|
+
"binary": "49afde483f55927c3eeac9141cae82857cb2f15b9e9d55f4ac45378e761eabcc"
|
|
11
|
+
},
|
|
12
|
+
"linux_amd64": {
|
|
13
|
+
"archive": "dcf1c62e5862543b6686a8e4c2f430ef636ac33306167f377e7272875020c4d3",
|
|
14
|
+
"binary": "030bff369048a49fce09e44f96e71fab36522394675ab10b2e684c9e3cc0aa26"
|
|
15
|
+
},
|
|
16
|
+
"linux_arm64": {
|
|
17
|
+
"archive": "94c98c19ce181f8e09e0d0cb79c278c31e9ec936eb713826a1ddf4995e7c2155",
|
|
18
|
+
"binary": "3f900ac9b035aac50b117ce5f7c450ca073d3e453448783979e978dc57bc39a9"
|
|
19
|
+
},
|
|
20
|
+
"windows_amd64": {
|
|
21
|
+
"archive": "a12e3b36b81232ad9888b43519a6dbcacc5c8def52f3a6c6e95d4fae6a373c5d",
|
|
22
|
+
"binary": "14cd52ca87fea607852b3a8e194146eeabe6ce87976cd1fc6327b74caebb6c77"
|
|
23
|
+
},
|
|
24
|
+
"windows_arm64": {
|
|
25
|
+
"archive": "da9e79e7cacc5570631196fae2f9e50ae5202521aa8abaf2e6de85b1778086b9",
|
|
26
|
+
"binary": "14b1b4bdd75228dc29dbc3ca264602911242a0e60cb0acb3311eb4926d50cb4b"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { FRPC_RELEASES, FRPC_VERSION };
|
|
@@ -3,6 +3,8 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
|
|
4
4
|
import { resolveOptionalTunnelRegistrationSecret, resolveTunnelBrokerUrl } from "./env.js";
|
|
5
5
|
import { getTunnelService } from "./tunnel-service.js";
|
|
6
|
+
import { resolveGatewayAuth } from "../gateway/auth.js";
|
|
7
|
+
import { requireTunnelGatewayToken } from "./auth-policy.js";
|
|
6
8
|
import { hasValidTunnelConsent } from "./consent.js";
|
|
7
9
|
import { resolveFrpSubdomainHost } from "./frp-subdomain-host.js";
|
|
8
10
|
import { fetchTunnelWellKnown } from "./well-known.js";
|
|
@@ -99,7 +101,8 @@ async function maybeAutoStartTunnelFromConfig(config, gatewayToken) {
|
|
|
99
101
|
const port = (config.gateway ?? {}).port ?? 18790;
|
|
100
102
|
const host = resolveGatewayEffectiveHost(config);
|
|
101
103
|
await configureTunnelFromGatewayConfig(config);
|
|
102
|
-
|
|
104
|
+
const resolvedAuth = resolveGatewayAuth({ authConfig: config.gateway?.auth });
|
|
105
|
+
if (resolvedAuth.mode !== "token" || !gatewayToken?.trim()) {
|
|
103
106
|
log.warn({ phase: "tunnel_autostart" }, "tunnel.autoStart is enabled but gateway auth token is unavailable (auth mode may be none)");
|
|
104
107
|
return;
|
|
105
108
|
}
|
|
@@ -113,7 +116,10 @@ async function maybeAutoStartTunnelFromConfig(config, gatewayToken) {
|
|
|
113
116
|
return;
|
|
114
117
|
}
|
|
115
118
|
try {
|
|
116
|
-
await tunnel.start(port,
|
|
119
|
+
await tunnel.start(port, requireTunnelGatewayToken({
|
|
120
|
+
mode: resolvedAuth.mode,
|
|
121
|
+
token: gatewayToken
|
|
122
|
+
}));
|
|
117
123
|
log.info({
|
|
118
124
|
phase: "tunnel_autostart",
|
|
119
125
|
host,
|
package/dist/src/tunnel/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TunnelBrokerClient, resolveBrokerApiBase } from "./broker-client.js";
|
|
2
|
-
import { FRPC_VERSION
|
|
2
|
+
import { FRPC_VERSION } from "./frpc-release.js";
|
|
3
|
+
import { clearFrpcPathForProcess, ensureFrpcBinary, publishFrpcPathForProcess } from "./frpc-binary.js";
|
|
3
4
|
import { TUNNEL_REGISTRATION_SECRET_REQUIRED_CODE, TunnelRegistrationSecretError, getTunnelRegistrationSecretMeta, isLocalDevelopmentTunnelBroker, isMaskedTunnelSecretPatchValue, resolveOptionalTunnelRegistrationSecret, resolveTunnelBrokerUrl, resolveTunnelRegistrationSecret, tunnelRegistrationSecretRequiredMessage } from "./env.js";
|
|
4
5
|
import { loadTunnelState, resolveTunnelStatePath, saveTunnelState } from "./tunnel-state.js";
|
|
5
6
|
import { logTunnelAudit } from "./tunnel-audit.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Canonical v2 registration proof, shared with the Broker protocol test vectors. */
|
|
2
|
+
export declare function createTunnelRegistrationProof(input: {
|
|
3
|
+
brokerUrl: string;
|
|
4
|
+
platform: string;
|
|
5
|
+
gatewayVersion: string;
|
|
6
|
+
preferredSubdomain?: string;
|
|
7
|
+
recoveryToken?: string;
|
|
8
|
+
}): {
|
|
9
|
+
version: number;
|
|
10
|
+
gatewayId: string;
|
|
11
|
+
publicKey: string;
|
|
12
|
+
platform: string;
|
|
13
|
+
gatewayVersion: string;
|
|
14
|
+
preferredSubdomain: string;
|
|
15
|
+
recoveryToken: string;
|
|
16
|
+
nonce: string;
|
|
17
|
+
expiresAt: number;
|
|
18
|
+
signature: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity, signGatewayPayload } from "../storage/sqlite/gateway-identity-repository.js";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
//#region src/tunnel/registration-proof.ts
|
|
4
|
+
/** Canonical v2 registration proof, shared with the Broker protocol test vectors. */
|
|
5
|
+
function createTunnelRegistrationProof(input) {
|
|
6
|
+
const identity = getOrCreateGatewayIdentity();
|
|
7
|
+
const publicKey = getGatewayIdentityPublicKeyRaw(identity);
|
|
8
|
+
const nonce = randomBytes(24).toString("base64url");
|
|
9
|
+
const expiresAt = Date.now() + 12e4;
|
|
10
|
+
const audience = input.brokerUrl.replace(/\/+$/, "");
|
|
11
|
+
const payload = JSON.stringify([
|
|
12
|
+
"xopc-tunnel-registration-v2",
|
|
13
|
+
audience,
|
|
14
|
+
identity.id,
|
|
15
|
+
publicKey,
|
|
16
|
+
input.platform,
|
|
17
|
+
input.gatewayVersion,
|
|
18
|
+
input.preferredSubdomain ?? "",
|
|
19
|
+
input.recoveryToken ?? "",
|
|
20
|
+
nonce,
|
|
21
|
+
expiresAt
|
|
22
|
+
]);
|
|
23
|
+
return {
|
|
24
|
+
version: 2,
|
|
25
|
+
gatewayId: identity.id,
|
|
26
|
+
publicKey,
|
|
27
|
+
platform: input.platform,
|
|
28
|
+
gatewayVersion: input.gatewayVersion,
|
|
29
|
+
preferredSubdomain: input.preferredSubdomain,
|
|
30
|
+
recoveryToken: input.recoveryToken,
|
|
31
|
+
nonce,
|
|
32
|
+
expiresAt,
|
|
33
|
+
signature: signGatewayPayload(payload)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { createTunnelRegistrationProof };
|
|
@@ -8,6 +8,7 @@ function persistedFromRegistration(registration) {
|
|
|
8
8
|
frpcAuthToken: registration.frpc.authToken,
|
|
9
9
|
registeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10
10
|
enabled: true,
|
|
11
|
+
frpcSubdomain: registration.frpc.subdomain,
|
|
11
12
|
frpcServerAddr: registration.frpc.serverAddr,
|
|
12
13
|
frpcServerPort: registration.frpc.serverPort,
|
|
13
14
|
proxyName: registration.frpc.proxyName,
|
|
@@ -16,13 +17,14 @@ function persistedFromRegistration(registration) {
|
|
|
16
17
|
}
|
|
17
18
|
/** Rebuild registration from disk when Broker row is still valid (stop without deregister). */
|
|
18
19
|
function registrationFromPersisted(persisted) {
|
|
19
|
-
if (!persisted.frpcAuthToken || !persisted.frpcServerAddr || !persisted.frpcServerPort || !persisted.proxyName) return null;
|
|
20
|
+
if (!persisted.frpcSubdomain || !persisted.frpcAuthToken || !persisted.frpcServerAddr || !persisted.frpcServerPort || !persisted.proxyName) return null;
|
|
20
21
|
return {
|
|
21
22
|
tunnelId: persisted.tunnelId,
|
|
22
23
|
tunnelToken: persisted.tunnelToken,
|
|
23
24
|
subdomain: persisted.subdomain,
|
|
24
25
|
publicUrl: persisted.publicUrl,
|
|
25
26
|
frpc: {
|
|
27
|
+
subdomain: persisted.frpcSubdomain,
|
|
26
28
|
serverAddr: persisted.frpcServerAddr,
|
|
27
29
|
serverPort: persisted.frpcServerPort,
|
|
28
30
|
authToken: persisted.frpcAuthToken,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../package-version.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { TunnelBrokerClient, resolveBrokerApiBase } from "./broker-client.js";
|
|
4
|
+
import { TunnelBrokerClient, TunnelBrokerError, resolveBrokerApiBase } from "./broker-client.js";
|
|
5
5
|
import { clearFrpcPathForProcess, ensureFrpcBinary, publishFrpcPathForProcess } from "./frpc-binary.js";
|
|
6
|
-
import { writeFrpcConfig } from "./frpc-config.js";
|
|
6
|
+
import { removeFrpcConfig, writeFrpcConfig } from "./frpc-config.js";
|
|
7
7
|
import { spawnFrpcProcess } from "./frpc-process.js";
|
|
8
8
|
import { TunnelRegistrationSecretError } from "./env.js";
|
|
9
9
|
import { canResumePersistedTunnel, persistedFromRegistration, registrationFromPersisted } from "./tunnel-persist.js";
|
|
@@ -127,7 +127,7 @@ var TunnelService = class extends EventEmitter {
|
|
|
127
127
|
saveTunnelState(state);
|
|
128
128
|
this.setStartPhase("registering", { publicUrl: registration.publicUrl });
|
|
129
129
|
try {
|
|
130
|
-
const configPath = writeFrpcConfig(registration, gatewayPort, "127.0.0.1"
|
|
130
|
+
const configPath = writeFrpcConfig(registration, gatewayPort, "127.0.0.1");
|
|
131
131
|
this.setStartPhase("starting_frpc", { publicUrl: registration.publicUrl });
|
|
132
132
|
await this.spawnAndWait(frpcBin, configPath, broker, state, registration.heartbeatIntervalMs);
|
|
133
133
|
} catch (err) {
|
|
@@ -161,6 +161,7 @@ var TunnelService = class extends EventEmitter {
|
|
|
161
161
|
let released = false;
|
|
162
162
|
const persisted = loadTunnelState();
|
|
163
163
|
const cfg = this.serviceConfig;
|
|
164
|
+
if (persisted) removeFrpcConfig(persisted.tunnelId);
|
|
164
165
|
if (release && persisted && cfg) {
|
|
165
166
|
const broker = new TunnelBrokerClient(resolveBrokerApiBase(cfg.brokerUrl));
|
|
166
167
|
try {
|
|
@@ -206,6 +207,7 @@ var TunnelService = class extends EventEmitter {
|
|
|
206
207
|
return resumed;
|
|
207
208
|
}
|
|
208
209
|
} catch (err) {
|
|
210
|
+
if (!(err instanceof TunnelBrokerError) || err.status !== 410) throw err;
|
|
209
211
|
log.info({
|
|
210
212
|
err,
|
|
211
213
|
tunnelId: persisted.tunnelId,
|
|
@@ -218,7 +220,7 @@ var TunnelService = class extends EventEmitter {
|
|
|
218
220
|
registrationSecret: cfg.registrationSecret,
|
|
219
221
|
gatewayVersion: PACKAGE_VERSION,
|
|
220
222
|
platform: platformLabel(),
|
|
221
|
-
|
|
223
|
+
recoveryToken: persisted?.tunnelToken,
|
|
222
224
|
preferredSubdomain: persisted?.subdomain
|
|
223
225
|
});
|
|
224
226
|
}
|
|
@@ -285,19 +287,37 @@ var TunnelService = class extends EventEmitter {
|
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
}
|
|
290
|
+
heartbeatGeneration = 0;
|
|
288
291
|
startHeartbeat(broker, state, intervalMs) {
|
|
289
292
|
this.clearHeartbeat();
|
|
293
|
+
const generation = this.heartbeatGeneration;
|
|
294
|
+
let pending = false;
|
|
290
295
|
const tick = async () => {
|
|
296
|
+
if (pending || this.stopping || generation !== this.heartbeatGeneration) return;
|
|
297
|
+
pending = true;
|
|
291
298
|
try {
|
|
292
299
|
await broker.heartbeat(state.tunnelId, state.tunnelToken);
|
|
293
|
-
this.lastHeartbeatAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
300
|
+
if (generation === this.heartbeatGeneration) this.lastHeartbeatAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
294
301
|
} catch (err) {
|
|
295
302
|
log.warn({
|
|
296
303
|
err,
|
|
297
304
|
tunnelId: state.tunnelId
|
|
298
305
|
}, "Tunnel heartbeat failed");
|
|
299
|
-
if (this.stopping) return;
|
|
306
|
+
if (this.stopping || generation !== this.heartbeatGeneration) return;
|
|
307
|
+
if (!(err instanceof TunnelBrokerError) || ![
|
|
308
|
+
401,
|
|
309
|
+
403,
|
|
310
|
+
410
|
|
311
|
+
].includes(err.status)) return;
|
|
300
312
|
this.clearHeartbeat();
|
|
313
|
+
if (err.status === 401 || err.status === 403) {
|
|
314
|
+
await this.stop();
|
|
315
|
+
this.lastError = "TUNNEL_AUTH_REVOKED";
|
|
316
|
+
this.state = "error";
|
|
317
|
+
this.emit("tunnel:error", this.lastError);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const renewalGeneration = this.heartbeatGeneration;
|
|
301
321
|
const ctx = this.startContext;
|
|
302
322
|
const cfg = this.serviceConfig;
|
|
303
323
|
if (!ctx || !cfg) return;
|
|
@@ -308,25 +328,32 @@ var TunnelService = class extends EventEmitter {
|
|
|
308
328
|
registrationSecret: cfg.registrationSecret,
|
|
309
329
|
gatewayVersion: PACKAGE_VERSION,
|
|
310
330
|
platform: platformLabel(),
|
|
311
|
-
|
|
331
|
+
recoveryToken: state.tunnelToken,
|
|
312
332
|
preferredSubdomain: state.subdomain
|
|
313
333
|
});
|
|
334
|
+
if (this.stopping || renewalGeneration !== this.heartbeatGeneration) return;
|
|
314
335
|
const next = persistedFromRegistration(registration);
|
|
336
|
+
removeFrpcConfig(state.tunnelId);
|
|
315
337
|
saveTunnelState(next);
|
|
316
338
|
const frpcBin = await ensureFrpcBinary();
|
|
317
|
-
const configPath = writeFrpcConfig(registration, ctx.gatewayPort, "127.0.0.1"
|
|
339
|
+
const configPath = writeFrpcConfig(registration, ctx.gatewayPort, "127.0.0.1");
|
|
318
340
|
await this.spawnAndWait(frpcBin, configPath, broker, next, registration.heartbeatIntervalMs);
|
|
319
341
|
} catch (reErr) {
|
|
342
|
+
if (this.stopping || renewalGeneration !== this.heartbeatGeneration) return;
|
|
343
|
+
if (reErr instanceof TunnelBrokerError && [401, 403].includes(reErr.status)) await this.stop();
|
|
320
344
|
this.lastError = reErr instanceof Error ? reErr.message : String(reErr);
|
|
321
345
|
this.state = "error";
|
|
322
346
|
this.emit("tunnel:error", this.lastError);
|
|
323
347
|
}
|
|
348
|
+
} finally {
|
|
349
|
+
pending = false;
|
|
324
350
|
}
|
|
325
351
|
};
|
|
326
352
|
tick();
|
|
327
353
|
this.heartbeatTimer = setInterval(() => void tick(), intervalMs);
|
|
328
354
|
}
|
|
329
355
|
clearHeartbeat() {
|
|
356
|
+
this.heartbeatGeneration += 1;
|
|
330
357
|
if (this.heartbeatTimer) {
|
|
331
358
|
clearInterval(this.heartbeatTimer);
|
|
332
359
|
this.heartbeatTimer = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_paths } from "../config/paths.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
//#region src/tunnel/tunnel-state.ts
|
|
6
6
|
init_paths();
|
|
7
7
|
const TUNNEL_STATE_FILE = "tunnel.json";
|
|
@@ -22,8 +22,15 @@ function loadTunnelState() {
|
|
|
22
22
|
}
|
|
23
23
|
function saveTunnelState(state) {
|
|
24
24
|
const path = resolveTunnelStatePath();
|
|
25
|
-
mkdirSync(resolveStateDir(), {
|
|
26
|
-
|
|
25
|
+
mkdirSync(resolveStateDir(), {
|
|
26
|
+
recursive: true,
|
|
27
|
+
mode: 448
|
|
28
|
+
});
|
|
29
|
+
chmodSync(resolveStateDir(), 448);
|
|
30
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
31
|
+
writeFileSync(temporary, `${JSON.stringify(state, null, 2)}\n`, { mode: 384 });
|
|
32
|
+
chmodSync(temporary, 384);
|
|
33
|
+
renameSync(temporary, path);
|
|
27
34
|
}
|
|
28
35
|
function updateTunnelState(patch) {
|
|
29
36
|
const current = loadTunnelState();
|
|
@@ -36,8 +43,7 @@ function updateTunnelState(patch) {
|
|
|
36
43
|
return next;
|
|
37
44
|
}
|
|
38
45
|
function clearTunnelState() {
|
|
39
|
-
|
|
40
|
-
if (existsSync(path)) writeFileSync(path, "{}\n", "utf8");
|
|
46
|
+
rmSync(resolveTunnelStatePath(), { force: true });
|
|
41
47
|
}
|
|
42
48
|
//#endregion
|
|
43
49
|
export { clearTunnelState, loadTunnelState, resolveTunnelStatePath, saveTunnelState, updateTunnelState };
|
|
@@ -21,6 +21,7 @@ export type TunnelRegistration = {
|
|
|
21
21
|
serverPort: number;
|
|
22
22
|
authToken: string;
|
|
23
23
|
proxyName: string;
|
|
24
|
+
subdomain: string;
|
|
24
25
|
};
|
|
25
26
|
expiresAt: string;
|
|
26
27
|
heartbeatIntervalMs: number;
|
|
@@ -34,6 +35,7 @@ export type PersistedTunnelState = {
|
|
|
34
35
|
registeredAt: string;
|
|
35
36
|
enabled?: boolean;
|
|
36
37
|
/** Saved on register so stop/start can resume without re-registering. */
|
|
38
|
+
frpcSubdomain?: string;
|
|
37
39
|
frpcServerAddr?: string;
|
|
38
40
|
frpcServerPort?: number;
|
|
39
41
|
proxyName?: string;
|
|
@@ -16,9 +16,13 @@ async function fetchTunnelWellKnown(brokerUrl) {
|
|
|
16
16
|
const origin = brokerOrigin(brokerUrl);
|
|
17
17
|
if (cached && cached.origin === origin && Date.now() - cached.fetchedAt < CACHE_TTL_MS) return cached.config;
|
|
18
18
|
const url = `${origin}/.well-known/tunnel-config`;
|
|
19
|
-
const res = await fetch(url, {
|
|
19
|
+
const res = await fetch(url, {
|
|
20
|
+
redirect: "error",
|
|
21
|
+
signal: AbortSignal.timeout(1e4)
|
|
22
|
+
});
|
|
20
23
|
if (!res.ok) throw new Error(`Tunnel well-known fetch failed: ${res.status} ${res.statusText}`);
|
|
21
24
|
const body = await res.json();
|
|
25
|
+
if (new URL(body.brokerUrl).origin !== origin) throw new Error("Broker discovery cannot redirect registration credentials to another origin");
|
|
22
26
|
cached = {
|
|
23
27
|
origin,
|
|
24
28
|
config: body,
|
|
@@ -20,7 +20,7 @@ var init_config = __esmMin((() => {
|
|
|
20
20
|
minMessagesBeforeCompact: 10,
|
|
21
21
|
keepRecentTokens: 2e4,
|
|
22
22
|
recentTurnsPreserve: 3,
|
|
23
|
-
summaryMaxTokens:
|
|
23
|
+
summaryMaxTokens: 8e3,
|
|
24
24
|
summaryChunkTokens: 24e3,
|
|
25
25
|
summaryTimeoutMs: 18e4,
|
|
26
26
|
summaryRetries: 2,
|
|
@@ -37,7 +37,7 @@ var init_config = __esmMin((() => {
|
|
|
37
37
|
minMessagesBeforeCompact: z.number().int().min(2).default(10),
|
|
38
38
|
keepRecentTokens: z.number().int().min(1e3).default(2e4),
|
|
39
39
|
recentTurnsPreserve: z.number().int().min(1).max(12).default(3),
|
|
40
|
-
summaryMaxTokens: z.number().int().min(256).default(
|
|
40
|
+
summaryMaxTokens: z.number().int().min(256).default(8e3),
|
|
41
41
|
summaryChunkTokens: z.number().int().min(1e3).default(24e3),
|
|
42
42
|
summaryTimeoutMs: z.number().int().min(1e3).max(6e5).default(18e4),
|
|
43
43
|
summaryRetries: z.number().int().min(0).max(5).default(2),
|
|
@@ -56,6 +56,7 @@ var init_redact = __esmMin((() => {
|
|
|
56
56
|
DEFAULT_REDACT_PATTERNS = [
|
|
57
57
|
/\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD)\b\s*[=:]\s*(["']?)([^\s"'\\]+)\1/gi,
|
|
58
58
|
/"(?:apiKey|token|secret|password|passwd|accessToken|refreshToken|privateKey)"\s*:\s*"([^"]+)"/gi,
|
|
59
|
+
/(?:__Host-xopc-session|xopc-local-session)=([A-Za-z0-9_-]{43})/g,
|
|
59
60
|
/Authorization\s*[:=]\s*Bearer\s+([A-Za-z0-9._\-+=]+)/gi,
|
|
60
61
|
/\b(sk-[A-Za-z0-9_-]{8,})\b/gi,
|
|
61
62
|
/\b(ghp_[A-Za-z0-9]{20,})\b/gi,
|
|
@@ -76,6 +77,9 @@ var init_redact = __esmMin((() => {
|
|
|
76
77
|
"privatekey",
|
|
77
78
|
"private_key",
|
|
78
79
|
"authorization",
|
|
80
|
+
"cookie",
|
|
81
|
+
"set-cookie",
|
|
82
|
+
"signedpayload",
|
|
79
83
|
"credential",
|
|
80
84
|
"credentials"
|
|
81
85
|
]);
|
|
@@ -92,6 +92,7 @@ async function openDashScopeStreamingStt(request) {
|
|
|
92
92
|
sample_rate: request.inputFormat.sampleRate,
|
|
93
93
|
semantic_punctuation_enabled: false,
|
|
94
94
|
max_sentence_silence: request.turnDetection.silenceDurationMs,
|
|
95
|
+
heartbeat: true,
|
|
95
96
|
...request.language && request.language !== "auto" ? { language_hints: [request.language] } : {}
|
|
96
97
|
},
|
|
97
98
|
input: request.prompt ? { context: [{
|
|
@@ -7,6 +7,7 @@ import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
|
7
7
|
init_logger();
|
|
8
8
|
const { WebSocket } = createRequire(import.meta.url)("ws");
|
|
9
9
|
const DEFAULT_REALTIME_URL = "wss://dashscope.aliyuncs.com/api-ws/v1/realtime";
|
|
10
|
+
const DEFAULT_REALTIME_VOLUME = 100;
|
|
10
11
|
const log = createLogger("TTS:DashScope");
|
|
11
12
|
var TtsHandshakeError = class extends Error {
|
|
12
13
|
constructor(statusCode, retryAfterMs) {
|
|
@@ -46,6 +47,12 @@ function event(type, extra = {}) {
|
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
async function openDashScopeStreamingTts(request) {
|
|
50
|
+
const volume = request.volume ?? DEFAULT_REALTIME_VOLUME;
|
|
51
|
+
if (!Number.isInteger(volume) || volume < 0 || volume > 100) throw new Error("DashScope realtime TTS volume must be an integer from 0 to 100");
|
|
52
|
+
request = {
|
|
53
|
+
...request,
|
|
54
|
+
volume
|
|
55
|
+
};
|
|
49
56
|
const deadline = Date.now() + request.timeoutMs;
|
|
50
57
|
for (let attempt = 1;; attempt += 1) {
|
|
51
58
|
request.signal.throwIfAborted();
|
|
@@ -138,6 +145,7 @@ async function openStreamingTtsAttempt(request) {
|
|
|
138
145
|
language_type: "Auto",
|
|
139
146
|
response_format: "pcm",
|
|
140
147
|
sample_rate: 24e3,
|
|
148
|
+
volume: request.volume,
|
|
141
149
|
...request.instructions ? {
|
|
142
150
|
instructions: request.instructions,
|
|
143
151
|
optimize_instructions: false
|
|
@@ -101,7 +101,7 @@ var DurableVoiceAgentBroker = class {
|
|
|
101
101
|
const event = eventData(delivery);
|
|
102
102
|
if (!event) continue;
|
|
103
103
|
yield event;
|
|
104
|
-
if (event.type === "stream_end") {
|
|
104
|
+
if (event.type === "run_end" || event.type === "stream_end") {
|
|
105
105
|
this.runByTask.delete(taskId);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
@@ -284,7 +284,7 @@ function createAgentVoiceEngine(options) {
|
|
|
284
284
|
toolName: event.payload.toolName.slice(0, 256),
|
|
285
285
|
status: event.type === "tool_start" ? "running" : event.payload.status === "error" ? "failed" : "completed"
|
|
286
286
|
});
|
|
287
|
-
if (event.type === "stream_end") {
|
|
287
|
+
if (event.type === "run_end" || event.type === "stream_end") {
|
|
288
288
|
const status = event.payload?.status;
|
|
289
289
|
send("task.done", {
|
|
290
290
|
taskId: task.taskId,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/voice/realtime/pcm-output-gain.ts
|
|
2
|
+
const OUTPUT_GAIN = 1.5;
|
|
3
|
+
/** Raise conversational PCM output without changing the device's system volume. */
|
|
4
|
+
function applyVoiceOutputGain(bytes) {
|
|
5
|
+
if (bytes.byteLength % 2 !== 0) throw new Error("Voice output must contain aligned PCM samples");
|
|
6
|
+
const output = new Uint8Array(bytes.byteLength);
|
|
7
|
+
const inputView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
8
|
+
const outputView = new DataView(output.buffer);
|
|
9
|
+
for (let offset = 0; offset < bytes.byteLength; offset += 2) {
|
|
10
|
+
const amplified = Math.round(inputView.getInt16(offset, true) * OUTPUT_GAIN);
|
|
11
|
+
outputView.setInt16(offset, Math.max(-32768, Math.min(32767, amplified)), true);
|
|
12
|
+
}
|
|
13
|
+
return output;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { applyVoiceOutputGain };
|
|
@@ -28,6 +28,7 @@ export declare class VoiceRealtimeRuntime {
|
|
|
28
28
|
handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean;
|
|
29
29
|
hasConversation(sessionKey: string): boolean;
|
|
30
30
|
cancelSession(sessionId: string, ticket: string, principalId: string): Promise<boolean>;
|
|
31
|
+
disconnectPrincipal(principalId: string): void;
|
|
31
32
|
close(): void;
|
|
32
33
|
private releaseConversationReservation;
|
|
33
34
|
private consumeTicket;
|
|
@@ -15,6 +15,7 @@ import { VOICE_REALTIME_HEARTBEAT_INTERVAL_MS, VOICE_REALTIME_MAX_BINARY_FRAME_B
|
|
|
15
15
|
import { createAgentVoiceEngine } from "./agentEngine.js";
|
|
16
16
|
import { resolveOmniRoute } from "./omniRoute.js";
|
|
17
17
|
import { createOmniVoiceEngine } from "./omniEngine.js";
|
|
18
|
+
import { applyVoiceOutputGain } from "./pcm-output-gain.js";
|
|
18
19
|
import { createRequire } from "node:module";
|
|
19
20
|
import crypto from "node:crypto";
|
|
20
21
|
//#region src/voice/realtime/runtime.ts
|
|
@@ -301,6 +302,13 @@ var VoiceRealtimeRuntime = class {
|
|
|
301
302
|
await active.shutdown();
|
|
302
303
|
return true;
|
|
303
304
|
}
|
|
305
|
+
disconnectPrincipal(principalId) {
|
|
306
|
+
for (const [key, claim] of this.tickets) if (claim.principalId === principalId) {
|
|
307
|
+
this.tickets.delete(key);
|
|
308
|
+
this.releaseConversationReservation(claim);
|
|
309
|
+
}
|
|
310
|
+
for (const socket of this.socketsByPrincipal.get(principalId) ?? []) socket.terminate();
|
|
311
|
+
}
|
|
304
312
|
close() {
|
|
305
313
|
if (this.closed) return;
|
|
306
314
|
this.closed = true;
|
|
@@ -364,6 +372,10 @@ var VoiceRealtimeRuntime = class {
|
|
|
364
372
|
};
|
|
365
373
|
const detachPrincipal = () => {
|
|
366
374
|
if (!claim) return;
|
|
375
|
+
if (this.options.isPrincipalActive?.(claim.principalId) === false) {
|
|
376
|
+
socket.terminate();
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
367
379
|
const sockets = this.socketsByPrincipal.get(claim.principalId);
|
|
368
380
|
sockets?.delete(socket);
|
|
369
381
|
if (sockets?.size === 0) this.socketsByPrincipal.delete(claim.principalId);
|
|
@@ -394,6 +406,10 @@ var VoiceRealtimeRuntime = class {
|
|
|
394
406
|
const startTimer = setTimeout(() => socket.close(4401, "Voice session start timeout"), VOICE_REALTIME_START_TIMEOUT_MS);
|
|
395
407
|
const lifecycleTimer = setInterval(() => {
|
|
396
408
|
if (!claim) return;
|
|
409
|
+
if (this.options.isPrincipalActive?.(claim.principalId) === false) {
|
|
410
|
+
socket.terminate();
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
397
413
|
if (context?.isCurrent && !context.isCurrent()) {
|
|
398
414
|
invalidateContext();
|
|
399
415
|
return;
|
|
@@ -417,7 +433,8 @@ var VoiceRealtimeRuntime = class {
|
|
|
417
433
|
};
|
|
418
434
|
const authenticate = async (message) => {
|
|
419
435
|
const consumed = this.consumeTicket(message.payload.ticket, message.payload.sessionId);
|
|
420
|
-
if (!consumed) {
|
|
436
|
+
if (!consumed || this.options.isPrincipalActive?.(consumed.principalId) === false) {
|
|
437
|
+
if (consumed) this.releaseConversationReservation(consumed);
|
|
421
438
|
socket.close(4401, "Invalid voice session ticket");
|
|
422
439
|
return;
|
|
423
440
|
}
|
|
@@ -465,8 +482,9 @@ var VoiceRealtimeRuntime = class {
|
|
|
465
482
|
const sendAudio = (responseId, bytes) => {
|
|
466
483
|
if (socket.bufferedAmount > 1024 * 1024) throw new Error("Voice client audio backpressure limit exceeded");
|
|
467
484
|
if (closed || socket.readyState !== WebSocketState.OPEN) return;
|
|
468
|
-
|
|
469
|
-
|
|
485
|
+
const amplified = applyVoiceOutputGain(bytes);
|
|
486
|
+
for (let offset = 0; offset < amplified.byteLength; offset += 960) {
|
|
487
|
+
const audio = amplified.subarray(offset, offset + 960);
|
|
470
488
|
if (audio.byteLength !== 960) throw new Error("Realtime output must align to 20 ms PCM frames");
|
|
471
489
|
socket.send(encodeVoiceAudioFrame({
|
|
472
490
|
connectionEpoch: consumed.connectionEpoch,
|
|
@@ -41,6 +41,7 @@ export interface ResolvedStreamingTts {
|
|
|
41
41
|
route: VoiceProviderRoute;
|
|
42
42
|
}
|
|
43
43
|
export interface VoiceRealtimeRuntimeOptions {
|
|
44
|
+
isPrincipalActive?: (principalId: string) => boolean;
|
|
44
45
|
recordOmniTranscript?: (sessionKey: string, callId: string, entry: OmniTranscript, expectedSessionId: string) => Promise<void>;
|
|
45
46
|
getConversationContext?: (sessionKey: string, expectedSessionId: string) => Promise<VoiceConversationContext>;
|
|
46
47
|
getSessionIdentity?: (sessionKey: string) => Promise<string | undefined>;
|
|
@@ -5,9 +5,9 @@ import { init_providers, resolveModel } from "../../providers/index.js";
|
|
|
5
5
|
import { TaskRepository } from "../../tasks/task-repository.js";
|
|
6
6
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
7
7
|
import { getProjectWorkspacePathForSession } from "../../projects/workspace.js";
|
|
8
|
-
import { publishAutomationProductEvent } from "../../automations/product-events.js";
|
|
9
8
|
import { TaskContextRepository } from "../../tasks/task-context-repository.js";
|
|
10
9
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
10
|
+
import { publishAutomationProductEvent } from "../../automations/product-events.js";
|
|
11
11
|
import { resolveModelSelector } from "../../config/agent-model-intents.js";
|
|
12
12
|
import { DelegateSubagentRunner } from "../../agent/workflow/subagent-runner.js";
|
|
13
13
|
import { preflightWorkflowConnectors } from "../../connectors/workflow-preflight.js";
|
|
@@ -192,6 +192,7 @@ var WorkflowRunService = class {
|
|
|
192
192
|
agentId: params.agentId,
|
|
193
193
|
definitionId: params.definitionId,
|
|
194
194
|
definitionTitle: definition.title,
|
|
195
|
+
triggerSource: params.source.kind,
|
|
195
196
|
goal,
|
|
196
197
|
parentSessionKey: params.parentSessionKey,
|
|
197
198
|
projectId
|
|
@@ -387,6 +388,7 @@ var WorkflowRunService = class {
|
|
|
387
388
|
agentId: params.agentId,
|
|
388
389
|
definitionId: existing.run.definitionId,
|
|
389
390
|
definitionTitle: `${definition.title} replay`,
|
|
391
|
+
triggerSource: existing.run.source.kind,
|
|
390
392
|
goal,
|
|
391
393
|
parentSessionKey,
|
|
392
394
|
projectId
|
|
@@ -48,6 +48,7 @@ var WorkflowSessionBridge = class {
|
|
|
48
48
|
workflowRunId: params.runId,
|
|
49
49
|
workflowDefinitionId: params.definitionId,
|
|
50
50
|
workflowGoal: params.goal,
|
|
51
|
+
...params.triggerSource ? { triggerSource: params.triggerSource } : {},
|
|
51
52
|
...params.parentSessionKey ? { parentSessionKey: params.parentSessionKey } : {}
|
|
52
53
|
}
|
|
53
54
|
});
|