@xopcai/xopc 0.0.231 → 0.0.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.js +5 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -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/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../config/schema.js';
|
|
2
|
-
export type MobilePairUrlValidationCode = 'INVALID_URL' | 'LOOPBACK_NOT_REACHABLE';
|
|
3
|
-
export type MobilePairUrlValidationResult = {
|
|
4
|
-
ok: true;
|
|
5
|
-
url: string;
|
|
6
|
-
loopback: false;
|
|
7
|
-
} | {
|
|
8
|
-
ok: false;
|
|
9
|
-
code: MobilePairUrlValidationCode;
|
|
10
|
-
message: string;
|
|
11
|
-
};
|
|
12
|
-
/** Normalize a gateway root URL (no trailing slash, no path). */
|
|
13
|
-
export declare function normalizeGatewayBaseUrl(raw: string): string | null;
|
|
14
|
-
/** True when a phone on the network cannot reach this gateway root URL. */
|
|
15
|
-
export declare function isLoopbackGatewayBaseUrl(raw: string): boolean;
|
|
16
|
-
export declare function validateMobilePairBaseUrl(raw: string): MobilePairUrlValidationResult;
|
|
17
|
-
export type ParsedMobileConnectDeepLink = {
|
|
18
|
-
baseUrl: string;
|
|
19
|
-
lanUrl: string | null;
|
|
20
|
-
pairingSecret: string;
|
|
21
|
-
};
|
|
22
|
-
/** Parse `xopc://gateway/mobile-connect?...` payloads from QR codes. */
|
|
23
|
-
export declare function parseMobileConnectDeepLink(raw: string): ParsedMobileConnectDeepLink | null;
|
|
24
|
-
/**
|
|
25
|
-
* Ordered URLs for mobile clients. Priority:
|
|
26
|
-
* 1. reverse-proxy public URL (user-deployed HTTPS, typically fastest + works on cellular)
|
|
27
|
-
* 2. LAN URL (zero-RTT on same network)
|
|
28
|
-
* 3. baseUrl (legacy: usually the FRP tunnel public URL, kept for callers that
|
|
29
|
-
* do not yet split reverseProxyUrl from tunnelUrl)
|
|
30
|
-
* 4. tunnelUrl (explicit FRP tunnel URL, kept as a fallback even when a
|
|
31
|
-
* reverse-proxy URL is also configured)
|
|
32
|
-
*
|
|
33
|
-
* Loopback URLs are dropped (they only work on the gateway host) and
|
|
34
|
-
* duplicates are de-duped while preserving first occurrence order.
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildMobileConnectUrlOrder(params: {
|
|
37
|
-
baseUrl: string | null | undefined;
|
|
38
|
-
lanUrl: string | null | undefined;
|
|
39
|
-
reverseProxyUrl?: string | null | undefined;
|
|
40
|
-
tunnelUrl?: string | null | undefined;
|
|
41
|
-
}): string[];
|
|
42
|
-
/** First LAN URL when the gateway listens on a network-accessible bind host. */
|
|
43
|
-
export declare function resolveMobilePairLanUrl(config: Config): string | null;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { enumerateLanGatewayCandidates } from "../gateway/host.js";
|
|
2
|
-
import { isNetworkAccessibleBindHost, resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
|
|
3
|
-
import net from "node:net";
|
|
4
|
-
//#region src/tunnel/pair-url.ts
|
|
5
|
-
/** Normalize a gateway root URL (no trailing slash, no path). */
|
|
6
|
-
function normalizeGatewayBaseUrl(raw) {
|
|
7
|
-
const trimmed = raw.trim();
|
|
8
|
-
if (!trimmed) return null;
|
|
9
|
-
try {
|
|
10
|
-
const u = new URL(trimmed);
|
|
11
|
-
if (u.protocol !== "http:" && u.protocol !== "https:") return null;
|
|
12
|
-
if (u.username || u.password) return null;
|
|
13
|
-
if (u.pathname && u.pathname !== "/") return null;
|
|
14
|
-
if (u.search || u.hash) return null;
|
|
15
|
-
const portSuffix = u.port ? `:${u.port}` : "";
|
|
16
|
-
return `${u.protocol}//${u.hostname}${portSuffix}`;
|
|
17
|
-
} catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/** True when a phone on the network cannot reach this gateway root URL. */
|
|
22
|
-
function isLoopbackGatewayBaseUrl(raw) {
|
|
23
|
-
const normalized = normalizeGatewayBaseUrl(raw);
|
|
24
|
-
if (!normalized) return false;
|
|
25
|
-
try {
|
|
26
|
-
const host = new URL(normalized).hostname.trim().toLowerCase();
|
|
27
|
-
if (host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]") return true;
|
|
28
|
-
if (net.isIP(host) === 4) {
|
|
29
|
-
const parts = host.split(".").map((p) => Number(p));
|
|
30
|
-
if (parts.length === 4 && parts.every((n) => Number.isInteger(n)) && parts[0] === 127) return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
} catch {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function validateMobilePairBaseUrl(raw) {
|
|
38
|
-
const url = normalizeGatewayBaseUrl(raw);
|
|
39
|
-
if (!url) return {
|
|
40
|
-
ok: false,
|
|
41
|
-
code: "INVALID_URL",
|
|
42
|
-
message: "Enter an absolute gateway URL starting with http:// or https:// (no path)."
|
|
43
|
-
};
|
|
44
|
-
if (isLoopbackGatewayBaseUrl(url)) return {
|
|
45
|
-
ok: false,
|
|
46
|
-
code: "LOOPBACK_NOT_REACHABLE",
|
|
47
|
-
message: "127.0.0.1 and localhost only work on the gateway machine. Use a LAN IP or tunnel URL instead."
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
ok: true,
|
|
51
|
-
url,
|
|
52
|
-
loopback: false
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/** Parse `xopc://gateway/mobile-connect?...` payloads from QR codes. */
|
|
56
|
-
function parseMobileConnectDeepLink(raw) {
|
|
57
|
-
const trimmed = raw.trim();
|
|
58
|
-
if (!trimmed) return null;
|
|
59
|
-
try {
|
|
60
|
-
const u = new URL(trimmed);
|
|
61
|
-
if (u.protocol !== "xopc:" || u.hostname !== "gateway" || u.pathname !== "/mobile-connect") return null;
|
|
62
|
-
const baseUrl = u.searchParams.get("baseUrl")?.trim() ?? "";
|
|
63
|
-
const psRaw = u.searchParams.get("ps")?.trim() ?? "";
|
|
64
|
-
let pairingSecret = psRaw;
|
|
65
|
-
if (psRaw) try {
|
|
66
|
-
pairingSecret = decodeURIComponent(psRaw);
|
|
67
|
-
} catch {
|
|
68
|
-
pairingSecret = psRaw;
|
|
69
|
-
}
|
|
70
|
-
if (!baseUrl || !pairingSecret) return null;
|
|
71
|
-
const lanRaw = u.searchParams.get("lanUrl")?.trim() ?? "";
|
|
72
|
-
const lanUrl = lanRaw ? normalizeGatewayBaseUrl(lanRaw) : null;
|
|
73
|
-
const normalizedBase = normalizeGatewayBaseUrl(baseUrl);
|
|
74
|
-
if (!normalizedBase) return null;
|
|
75
|
-
return {
|
|
76
|
-
baseUrl: normalizedBase,
|
|
77
|
-
lanUrl,
|
|
78
|
-
pairingSecret
|
|
79
|
-
};
|
|
80
|
-
} catch {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Ordered URLs for mobile clients. Priority:
|
|
86
|
-
* 1. reverse-proxy public URL (user-deployed HTTPS, typically fastest + works on cellular)
|
|
87
|
-
* 2. LAN URL (zero-RTT on same network)
|
|
88
|
-
* 3. baseUrl (legacy: usually the FRP tunnel public URL, kept for callers that
|
|
89
|
-
* do not yet split reverseProxyUrl from tunnelUrl)
|
|
90
|
-
* 4. tunnelUrl (explicit FRP tunnel URL, kept as a fallback even when a
|
|
91
|
-
* reverse-proxy URL is also configured)
|
|
92
|
-
*
|
|
93
|
-
* Loopback URLs are dropped (they only work on the gateway host) and
|
|
94
|
-
* duplicates are de-duped while preserving first occurrence order.
|
|
95
|
-
*/
|
|
96
|
-
function buildMobileConnectUrlOrder(params) {
|
|
97
|
-
const ordered = [];
|
|
98
|
-
const seen = /* @__PURE__ */ new Set();
|
|
99
|
-
const push = (raw) => {
|
|
100
|
-
const url = raw ? normalizeGatewayBaseUrl(raw) : null;
|
|
101
|
-
if (!url || isLoopbackGatewayBaseUrl(url) || seen.has(url)) return;
|
|
102
|
-
seen.add(url);
|
|
103
|
-
ordered.push(url);
|
|
104
|
-
};
|
|
105
|
-
push(params.reverseProxyUrl);
|
|
106
|
-
push(params.lanUrl);
|
|
107
|
-
push(params.baseUrl);
|
|
108
|
-
push(params.tunnelUrl);
|
|
109
|
-
return ordered;
|
|
110
|
-
}
|
|
111
|
-
/** First LAN URL when the gateway listens on a network-accessible bind host. */
|
|
112
|
-
function resolveMobilePairLanUrl(config) {
|
|
113
|
-
if (!isNetworkAccessibleBindHost(resolveGatewayEffectiveHost(config))) return null;
|
|
114
|
-
return enumerateLanGatewayCandidates(config.gateway?.port ?? 18790)[0]?.url ?? null;
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
export { buildMobileConnectUrlOrder, isLoopbackGatewayBaseUrl, normalizeGatewayBaseUrl, parseMobileConnectDeepLink, resolveMobilePairLanUrl, validateMobilePairBaseUrl };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type PairingFailureLimitResult = {
|
|
2
|
-
allowed: boolean;
|
|
3
|
-
retryAfterMs: number;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Records a failed pairing exchange and returns whether subsequent attempts
|
|
7
|
-
* are still permitted. Called from the route handler on every invalid /
|
|
8
|
-
* expired pairing secret — successful exchanges do NOT call this.
|
|
9
|
-
*/
|
|
10
|
-
export declare function consumePairingExchangeFailLimit(clientKey: string): PairingFailureLimitResult;
|
|
11
|
-
/** @internal */
|
|
12
|
-
export declare function resetPairingExchangeLimitsForTests(): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { buckets } from "../gateway/rate-limit/buckets.js";
|
|
2
|
-
import "../gateway/rate-limit/index.js";
|
|
3
|
-
//#region src/tunnel/pairing-rate-limit.ts
|
|
4
|
-
/**
|
|
5
|
-
* Records a failed pairing exchange and returns whether subsequent attempts
|
|
6
|
-
* are still permitted. Called from the route handler on every invalid /
|
|
7
|
-
* expired pairing secret — successful exchanges do NOT call this.
|
|
8
|
-
*/
|
|
9
|
-
function consumePairingExchangeFailLimit(clientKey) {
|
|
10
|
-
const fl = buckets.pairingExchange();
|
|
11
|
-
const key = clientKey.trim() || "unknown";
|
|
12
|
-
fl.fail(key);
|
|
13
|
-
const status = fl.check(key);
|
|
14
|
-
if (status.blocked) return {
|
|
15
|
-
allowed: false,
|
|
16
|
-
retryAfterMs: status.retryAfterSec * 1e3
|
|
17
|
-
};
|
|
18
|
-
return {
|
|
19
|
-
allowed: true,
|
|
20
|
-
retryAfterMs: 0
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/** @internal */
|
|
24
|
-
function resetPairingExchangeLimitsForTests() {
|
|
25
|
-
buckets.pairingExchange().resetForTests();
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { consumePairingExchangeFailLimit, resetPairingExchangeLimitsForTests };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type PairingSecretResult = {
|
|
2
|
-
secret: string;
|
|
3
|
-
expiresAt: Date;
|
|
4
|
-
};
|
|
5
|
-
export type PairingExchangePayload = {
|
|
6
|
-
token: string;
|
|
7
|
-
baseUrl: string | null;
|
|
8
|
-
lanUrl: string | null;
|
|
9
|
-
connectUrls: string[];
|
|
10
|
-
};
|
|
11
|
-
export declare function cachePairingExchange(secret: string, payload: PairingExchangePayload): void;
|
|
12
|
-
export declare function getCachedPairingExchange(secret: string): PairingExchangePayload | null;
|
|
13
|
-
/**
|
|
14
|
-
* Consume a pairing secret once and build the exchange payload.
|
|
15
|
-
* Concurrent requests for the same secret share one in-flight exchange (mobile cold-start deeplink).
|
|
16
|
-
*/
|
|
17
|
-
export declare function exchangePairingSecretOnce(secret: string, buildPayload: () => PairingExchangePayload): Promise<PairingExchangePayload | null>;
|
|
18
|
-
export declare function createPairingSecret(): PairingSecretResult;
|
|
19
|
-
export declare function consumePairingSecret(secret: string): boolean;
|
|
20
|
-
/** @internal */
|
|
21
|
-
export declare function resetPairingSessionsForTests(): void;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { randomBytes } from "node:crypto";
|
|
4
|
-
//#region src/tunnel/pairing.ts
|
|
5
|
-
init_logger();
|
|
6
|
-
const log = createLogger("TunnelPairing");
|
|
7
|
-
const PAIRING_TTL_MS = 5 * 6e4;
|
|
8
|
-
const CLEANUP_INTERVAL_MS = 6e4;
|
|
9
|
-
const sessions = /* @__PURE__ */ new Map();
|
|
10
|
-
let cleanupTimer = null;
|
|
11
|
-
function ensureCleanupTimer() {
|
|
12
|
-
if (cleanupTimer) return;
|
|
13
|
-
cleanupTimer = setInterval(() => {
|
|
14
|
-
const now = Date.now();
|
|
15
|
-
for (const [key, session] of sessions) if (now > session.expiresAt.getTime()) sessions.delete(key);
|
|
16
|
-
}, CLEANUP_INTERVAL_MS);
|
|
17
|
-
cleanupTimer.unref?.();
|
|
18
|
-
}
|
|
19
|
-
const EXCHANGE_REPLAY_MS = 6e4;
|
|
20
|
-
const exchangeReplayCache = /* @__PURE__ */ new Map();
|
|
21
|
-
function cachePairingExchange(secret, payload) {
|
|
22
|
-
exchangeReplayCache.set(secret, {
|
|
23
|
-
expiresAt: Date.now() + EXCHANGE_REPLAY_MS,
|
|
24
|
-
payload
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function getCachedPairingExchange(secret) {
|
|
28
|
-
const entry = exchangeReplayCache.get(secret);
|
|
29
|
-
if (!entry) return null;
|
|
30
|
-
if (Date.now() > entry.expiresAt) {
|
|
31
|
-
exchangeReplayCache.delete(secret);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return entry.payload;
|
|
35
|
-
}
|
|
36
|
-
const inflightExchanges = /* @__PURE__ */ new Map();
|
|
37
|
-
/**
|
|
38
|
-
* Consume a pairing secret once and build the exchange payload.
|
|
39
|
-
* Concurrent requests for the same secret share one in-flight exchange (mobile cold-start deeplink).
|
|
40
|
-
*/
|
|
41
|
-
async function exchangePairingSecretOnce(secret, buildPayload) {
|
|
42
|
-
const key = secret.trim();
|
|
43
|
-
if (!key) return null;
|
|
44
|
-
const replay = getCachedPairingExchange(key);
|
|
45
|
-
if (replay) return replay;
|
|
46
|
-
let inflight = inflightExchanges.get(key);
|
|
47
|
-
if (!inflight) {
|
|
48
|
-
inflight = (async () => {
|
|
49
|
-
const cached = getCachedPairingExchange(key);
|
|
50
|
-
if (cached) return cached;
|
|
51
|
-
if (!consumePairingSecret(key)) return getCachedPairingExchange(key);
|
|
52
|
-
const payload = buildPayload();
|
|
53
|
-
cachePairingExchange(key, payload);
|
|
54
|
-
return payload;
|
|
55
|
-
})();
|
|
56
|
-
inflightExchanges.set(key, inflight);
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
return await inflight;
|
|
60
|
-
} finally {
|
|
61
|
-
if (inflightExchanges.get(key) === inflight) inflightExchanges.delete(key);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function createPairingSecret() {
|
|
65
|
-
ensureCleanupTimer();
|
|
66
|
-
const secret = randomBytes(32).toString("base64url");
|
|
67
|
-
const expiresAt = new Date(Date.now() + PAIRING_TTL_MS);
|
|
68
|
-
sessions.set(secret, {
|
|
69
|
-
expiresAt,
|
|
70
|
-
consumed: false
|
|
71
|
-
});
|
|
72
|
-
log.info({ expiresAt: expiresAt.toISOString() }, "Pairing session created");
|
|
73
|
-
return {
|
|
74
|
-
secret,
|
|
75
|
-
expiresAt
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function consumePairingSecret(secret) {
|
|
79
|
-
if (!secret.trim()) return false;
|
|
80
|
-
const session = sessions.get(secret);
|
|
81
|
-
if (!session) return false;
|
|
82
|
-
if (session.consumed) return false;
|
|
83
|
-
if (Date.now() > session.expiresAt.getTime()) {
|
|
84
|
-
sessions.delete(secret);
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
session.consumed = true;
|
|
88
|
-
sessions.delete(secret);
|
|
89
|
-
log.info("Pairing session consumed");
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
/** @internal */
|
|
93
|
-
function resetPairingSessionsForTests() {
|
|
94
|
-
sessions.clear();
|
|
95
|
-
exchangeReplayCache.clear();
|
|
96
|
-
inflightExchanges.clear();
|
|
97
|
-
if (cleanupTimer) {
|
|
98
|
-
clearInterval(cleanupTimer);
|
|
99
|
-
cleanupTimer = null;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
//#endregion
|
|
103
|
-
export { cachePairingExchange, consumePairingSecret, createPairingSecret, exchangePairingSecretOnce, getCachedPairingExchange, resetPairingSessionsForTests };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TunnelQrPayload } from './tunnel-types.js';
|
|
2
|
-
/** First non-internal IPv4 suitable for LAN QR (when gateway listens on 0.0.0.0). */
|
|
3
|
-
export declare function resolveLanGatewayUrl(gatewayHost: string, gatewayPort: number): string | null;
|
|
4
|
-
export declare function buildMobileConnectQrPayload(input: {
|
|
5
|
-
publicUrl: string;
|
|
6
|
-
lanUrl: string | null;
|
|
7
|
-
pairingSecret: string;
|
|
8
|
-
expiresAt?: string;
|
|
9
|
-
}): TunnelQrPayload;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { enumerateLanGatewayCandidates } from "../gateway/host.js";
|
|
2
|
-
//#region src/tunnel/tunnel-qr.ts
|
|
3
|
-
function trimBase(raw) {
|
|
4
|
-
return raw.trim().replace(/\/+$/, "");
|
|
5
|
-
}
|
|
6
|
-
/** First non-internal IPv4 suitable for LAN QR (when gateway listens on 0.0.0.0). */
|
|
7
|
-
function resolveLanGatewayUrl(gatewayHost, gatewayPort) {
|
|
8
|
-
const host = gatewayHost.trim().toLowerCase();
|
|
9
|
-
if (host === "127.0.0.1" || host === "localhost" || host === "::1") return null;
|
|
10
|
-
let ip;
|
|
11
|
-
if (host === "0.0.0.0" || host === "::" || host === "") ip = enumerateLanGatewayCandidates(gatewayPort)[0]?.address;
|
|
12
|
-
else if (!host.includes(":")) ip = host;
|
|
13
|
-
if (!ip) return null;
|
|
14
|
-
return trimBase(`http://${ip}:${gatewayPort}`);
|
|
15
|
-
}
|
|
16
|
-
function buildMobileConnectQrPayload(input) {
|
|
17
|
-
const params = new URLSearchParams();
|
|
18
|
-
params.set("baseUrl", input.publicUrl);
|
|
19
|
-
if (input.lanUrl) params.set("lanUrl", input.lanUrl);
|
|
20
|
-
if (input.pairingSecret) params.set("ps", input.pairingSecret);
|
|
21
|
-
return {
|
|
22
|
-
qrPayload: `xopc://gateway/mobile-connect?${params.toString()}`,
|
|
23
|
-
publicUrl: input.publicUrl,
|
|
24
|
-
lanUrl: input.lanUrl,
|
|
25
|
-
expiresAt: input.expiresAt
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { buildMobileConnectQrPayload, resolveLanGatewayUrl };
|