@xopcai/xopc 0.0.208 → 0.0.211
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-D0mYZqhc.js → activity-store-BzjFoSr0.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-MWLQWL_i.js → agent-avatar-dicebear-DTfjhfVE.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CjhgfuVJ.js +68 -0
- package/dist/gateway/static/root/assets/{api-DZA1yVzM.js → api-D269PnU9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B2X6quAF.js → app-management-settings-panel-BFpfQDWc.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZW-c38q.js → appearance-settings-DLxFdqhY.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CjmlGB5V.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CK-gsjsJ.js → archive-plugin-DPlH4dnc.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-EJGP4rCw.js → attachment-load-xqfLLd0I.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-4m6Ey6wG.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Tbss_4P-.js → binary-plugins-C0tuoPXk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C-dOWigw.js → block-editor-Deyphj1o.js} +6 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CAGCYx8U.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DW06Zo1N.js → browser-workflow-inputs-CYEbXyRF.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B6RnRGwm.js → browser-workflows-page-Bf0tPbGi.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CKfLsxTI.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-Cc3BtQar.js → capability-presets-api-DPkFA_-R.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CpipKNqX.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BvZO5FaO.js → channel-recipient-api-DqKaAcnZ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bvq-O4pt.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CrMld2l7.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-CTDRZa7e.js +36 -0
- package/dist/gateway/static/root/assets/{connectors-api-CUl6_EQJ.js → connectors-api-Buu8fif8.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CSQRzaVn.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BD9MgoE_.js → cron-expression-DTLR82NB.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-ChqNmoxw.js → date-picker-DyNogHQH.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CDUmFs6H.js → dependency-picker-BpnCuo7B.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D61gqxaD.js → desktop-pet-CDKI4gVB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-QvuJvIX_.js → desktop-pet-settings-DjT5C2a3.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DvXMvDNY.js → directory-picker-path-field-DlJY90TM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DMdVTAQ3.js → extension-debug-page-DWf2z7q5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BNzxZtaK.js → extension-page-Dorx0kf9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DoEfyizU.js → extension-settings-page-B1wU9ZOB.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-o7AKvthC.js → gateway-config-api-B1lG4dNr.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BQbkUP5X.js → gateway-config-swr-BIxuwPQi.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-TO5YYZ9a.js → gateway-settings-DqIOqJjM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DIgdpHgk.js → gateway-startup-retry-BpZgd4U-.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DG4Kmgkc.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BhqItS_s.js +1 -0
- package/dist/gateway/static/root/assets/image-generation-api-PkhYohDa.js +1 -0
- package/dist/gateway/static/root/assets/index-DLhvsU9B.css +2 -0
- package/dist/gateway/static/root/assets/index-_cuTcWjB.js +107 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-4xaM3jjU.js → keyboard-shortcuts-settings-6OQT3gQF.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DWjTmzxw.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C1xDicdr.js → local-apps-page-DfruRAmE.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-pByvK12G.js → locale-store-C5MK9WcP.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BA5efZ8B.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D1XdHm7v.js → management-settings-L1VYkywO.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B_Ijq1Fr.js → markdown-split-oqgHbqt-.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DD_PgVue.css +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CyJlGUxB.js → markdown-view-V4rcPPH0.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CXXNRROJ.js → media-plugins-Bb6gSX2o.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ctG2e-ix.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-rkePB4CB.js → notes-page-B1rOXjpT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CkHXVmKP.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-gw-RMQCV.js → page-tabs-CBuCKeyy.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B8aMScJ2.js → preview-open-alternatives-BQ0tLfPO.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CjcpkWAz.js → product-open-page-DPeFn7Hu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DCqet9-L.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D0t_AjzG.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BUWPoBvw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Ch5qq86o.js → runtime-tools-settings-panel-BCfQNzjG.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DHYWYUFt.js → schema-form-Bo7YbHYN.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-vLhrrM3m.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-OP1y0Y8M.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DlzZx0-i.js → settings-form-section-B9dnKr3M.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BVLhreQi.js → settings-loading-skeleton-CYDV2JtY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BJU-kUnN.js → settings-page-DbrIYfS9.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cxc-Ejl5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-hvIuZXMe.js → share-preview-page-olgr7LLN.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-ZOqC6-aA.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DwvC3Iuf.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Dlvuh7D-.js → skills-page-PE16CNw5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-B6ddOpnf.js → skills-page.utils-nXmBcBxt.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BdbCAyoA.js → system-settings-panel-C3qPwAdY.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DCRB-5q-.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BtdGacMI.js → theme-store-KR5Otp5w.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CL6qHYJA.js → typed-models-lib-lMZodtDF.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DysNnqCS.js → use-autosave-CKpatP3S.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CoiedRuA.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-UEsO9Jr-.js → voice-api-key-field-CDcv0Wbh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B9disASf.js → work-discovery-overlay-CGdT22un.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BwaU1RqI.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-A0zTQHFQ.js → workflow-run-setup-panel-BAHYNlQt.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DHYmh9G7.js +5 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/coordinator.d.ts +1 -1
- package/dist/src/agent/background-review/coordinator.js +4 -5
- package/dist/src/agent/background-review/run-background-review.js +0 -1
- package/dist/src/agent/background-review/settings.d.ts +1 -2
- package/dist/src/agent/background-review/settings.js +3 -4
- package/dist/src/agent/external-tools/composio-provider.js +8 -4
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -1
- package/dist/src/agent/image/tool-model-config.js +15 -9
- package/dist/src/agent/memory/builtin-provider.js +1 -2
- package/dist/src/agent/memory/manager.js +2 -0
- package/dist/src/agent/memory/sensitivity.js +1 -1
- package/dist/src/agent/memory/understanding/service.js +43 -19
- package/dist/src/agent/memory/user-context-coordinator.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +23 -7
- package/dist/src/automations/domain/validation.d.ts +7 -7
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/capabilities/readiness/from-config.d.ts +10 -0
- package/dist/src/capabilities/readiness/from-config.js +128 -0
- package/dist/src/capabilities/readiness/index.d.ts +3 -0
- package/dist/src/capabilities/readiness/index.js +3 -0
- package/dist/src/capabilities/readiness/planner.d.ts +3 -0
- package/dist/src/capabilities/readiness/planner.js +56 -0
- package/dist/src/capabilities/readiness/types.d.ts +35 -0
- package/dist/src/capabilities/readiness/types.js +1 -0
- package/dist/src/cli/commands/agent.js +9 -0
- package/dist/src/cli/commands/auth.js +4 -3
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/models.js +2 -1
- package/dist/src/cli/commands/onboard/model.d.ts +3 -21
- package/dist/src/cli/commands/onboard/model.js +10 -86
- package/dist/src/cli/utils/oauth-login.d.ts +2 -0
- package/dist/src/cli/utils/oauth-login.js +9 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/paths-state.d.ts +2 -0
- package/dist/src/config/paths-state.js +5 -1
- package/dist/src/config/paths.d.ts +1 -1
- package/dist/src/config/paths.js +2 -2
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/auth-provider-registry.d.ts +2 -1
- package/dist/src/connectors/auth-provider-registry.js +5 -2
- package/dist/src/connectors/composio-sessions.d.ts +39 -0
- package/dist/src/connectors/composio-sessions.js +66 -7
- package/dist/src/connectors/composio.d.ts +4 -1
- package/dist/src/connectors/composio.js +34 -7
- package/dist/src/connectors/connected-source-cursor.d.ts +9 -0
- package/dist/src/connectors/connected-source-cursor.js +30 -0
- package/dist/src/connectors/connected-source-ingestion.js +67 -46
- package/dist/src/connectors/connected-source-normalizers.d.ts +1 -0
- package/dist/src/connectors/connected-source-normalizers.js +33 -2
- package/dist/src/connectors/connected-source-sanitization.d.ts +1 -0
- package/dist/src/connectors/connected-source-sanitization.js +21 -0
- package/dist/src/connectors/connector-identity.js +10 -2
- package/dist/src/connectors/content-enrichment.d.ts +29 -0
- package/dist/src/connectors/content-enrichment.js +273 -0
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +1 -2
- package/dist/src/connectors/learning-recipes.js +28 -33
- package/dist/src/connectors/runtime-adapter-registry.js +14 -1
- package/dist/src/discussions/live-worker.d.ts +1 -0
- package/dist/src/discussions/live-worker.js +7 -1
- package/dist/src/discussions/repository.js +11 -1
- package/dist/src/discussions/sealer.d.ts +1 -1
- package/dist/src/discussions/sealer.js +16 -7
- package/dist/src/discussions/transcript.js +27 -1
- package/dist/src/discussions/types.d.ts +4 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
- package/dist/src/gateway/hono/oauth-async.d.ts +11 -5
- package/dist/src/gateway/hono/oauth-async.js +29 -16
- package/dist/src/gateway/hono/oauth.d.ts +1 -3
- package/dist/src/gateway/hono/oauth.js +22 -22
- package/dist/src/gateway/hono/routes/agent-stream.js +4 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +16 -3
- package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
- package/dist/src/gateway/hono/routes/discussions.js +2 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +59 -5
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +60 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +75 -1
- package/dist/src/gateway/hono/routes/understanding-sources.js +29 -0
- package/dist/src/gateway/hono/routes/voice.d.ts +1 -2
- package/dist/src/gateway/hono/routes/voice.js +16 -35
- package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
- package/dist/src/gateway/rate-limit/buckets.js +12 -0
- package/dist/src/gateway/service/agent-runner.d.ts +9 -1
- package/dist/src/gateway/service/agent-runner.js +9 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +12 -0
- package/dist/src/gateway/service/session-input-coordinator.js +63 -6
- package/dist/src/gateway/service.d.ts +8 -0
- package/dist/src/gateway/service.js +18 -0
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +74 -25
- package/dist/src/knowledge/ingestion-service.js +33 -15
- package/dist/src/knowledge/types.d.ts +2 -0
- package/dist/src/media-understanding/audio-transcription-runner.d.ts +2 -0
- package/dist/src/media-understanding/audio-transcription-runner.js +3 -1
- package/dist/src/media-understanding/runner.js +3 -1
- package/dist/src/media-understanding/types.d.ts +2 -0
- package/dist/src/providers/model-catalog-persistence.d.ts +9 -0
- package/dist/src/providers/model-catalog-persistence.js +172 -0
- package/dist/src/providers/model-catalog-ranking.d.ts +2 -0
- package/dist/src/providers/model-catalog-ranking.js +17 -0
- package/dist/src/providers/model-catalog-store.d.ts +13 -3
- package/dist/src/providers/model-catalog-store.js +24 -5
- package/dist/src/providers/model-catalog-sync-service.d.ts +3 -3
- package/dist/src/providers/model-catalog-sync-service.js +12 -7
- package/dist/src/providers/provider-auth-service.d.ts +1 -0
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/provider-disconnect.d.ts +11 -0
- package/dist/src/providers/provider-disconnect.js +33 -0
- package/dist/src/providers/xopc-cloud-catalog-coordinator.d.ts +56 -0
- package/dist/src/providers/xopc-cloud-catalog-coordinator.js +182 -0
- package/dist/src/providers/xopc-cloud-model-source.d.ts +6 -10
- package/dist/src/providers/xopc-cloud-model-source.js +49 -27
- package/dist/src/retrieval/audit.d.ts +1 -0
- package/dist/src/retrieval/audit.js +8 -0
- package/dist/src/retrieval/candidateFusion.d.ts +5 -0
- package/dist/src/retrieval/candidateFusion.js +20 -0
- package/dist/src/retrieval/queryProfile.d.ts +16 -0
- package/dist/src/retrieval/queryProfile.js +66 -0
- package/dist/src/retrieval/textFeatures.d.ts +5 -0
- package/dist/src/retrieval/textFeatures.js +71 -0
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +4 -0
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/fts.d.ts +0 -4
- package/dist/src/storage/sqlite/fts.js +2 -49
- package/dist/src/storage/sqlite/index.d.ts +3 -2
- package/dist/src/storage/sqlite/index.js +6 -5
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +4 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +60 -38
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/session-repository.js +2 -2
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +110 -0
- package/dist/src/storage/sqlite/transcript-repository.js +1 -1
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +15 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +46 -2
- package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/user-context-repository.js +29 -3
- package/dist/src/tasks/home-query-service.d.ts +3 -1
- package/dist/src/tasks/home-query-service.js +73 -70
- package/dist/src/tui/backends/embedded-backend.js +12 -4
- package/dist/src/tui/tui-oauth-login.js +5 -0
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/user-context/planner.d.ts +1 -0
- package/dist/src/user-context/planner.js +16 -29
- package/dist/src/user-context/retriever.d.ts +15 -0
- package/dist/src/user-context/retriever.js +65 -0
- package/dist/src/user-context/scope.d.ts +7 -0
- package/dist/src/user-context/scope.js +9 -0
- package/dist/src/user-context/sources/activity-clustering.js +30 -117
- package/dist/src/user-context/sources/index.d.ts +1 -0
- package/dist/src/user-context/sources/index.js +2 -1
- package/dist/src/user-context/sources/signal-clustering.d.ts +18 -0
- package/dist/src/user-context/sources/signal-clustering.js +131 -0
- package/dist/src/voice/audio/normalize.d.ts +17 -0
- package/dist/src/voice/audio/normalize.js +155 -0
- package/dist/src/voice/language-profile.d.ts +1 -4
- package/dist/src/voice/language-profile.js +2 -25
- package/dist/src/voice/local/runtime-client.d.ts +2 -0
- package/dist/src/voice/local/runtime-client.js +20 -1
- package/dist/src/voice/local/runtime-worker.js +7 -13
- package/dist/src/voice/local/wav.js +1 -1
- package/dist/src/voice/stt/availability.d.ts +1 -4
- package/dist/src/voice/stt/availability.js +3 -15
- package/dist/src/voice/stt/config.js +1 -0
- package/dist/src/voice/stt/factory.js +23 -0
- package/dist/src/voice/stt/index.d.ts +1 -0
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/list-providers.js +1 -1
- package/dist/src/voice/stt/providers/local-transcription.js +7 -3
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -1
- package/dist/src/voice/stt/transcribe-core.d.ts +5 -1
- package/dist/src/voice/stt/transcribe-core.js +13 -5
- package/dist/src/voice/stt/types.d.ts +2 -0
- package/dist/src/voice/tts/factory.d.ts +1 -1
- package/dist/src/voice/tts/factory.js +23 -1
- package/dist/src/voice/tts/merge-config.js +5 -3
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +3 -1
- package/dist/src/voice/tts/types.d.ts +2 -0
- package/dist/src/voice/tts/types.js +4 -2
- package/dist/src/work-discovery/evaluation.d.ts +23 -0
- package/dist/src/work-discovery/evaluation.js +18 -1
- package/dist/src/work-discovery/index.js +2 -2
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agents-Bl8FQZxW.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CRUgTO10.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DrSwolhG.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-NlvDyMwD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BWXUznw5.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D0loEbzq.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-CcivCw8U.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DkHAD2Zn.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-DVedGAeX.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-DlBSlfkv.js +0 -2
- package/dist/gateway/static/root/assets/heartbeat-settings-UZAn1aAQ.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CRJDpy5E.js +0 -3
- package/dist/gateway/static/root/assets/index-BSjP0Wsx.css +0 -2
- package/dist/gateway/static/root/assets/index-C2ZYFBGL.js +0 -85
- package/dist/gateway/static/root/assets/local-app-workbench-page-D9bguWRo.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Gr-nE4nW.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-B12xeflb.css +0 -1
- package/dist/gateway/static/root/assets/messages-yG5P43Q9.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CpbD4XG2.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-GvSYDbjR.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DPRxKGbs.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-WIzeu-gB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-2XEJM0YE.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-g1GThZ0O.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C6qj2L-q.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BBpE1bep.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DXORBJNk.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DC0hc8hp.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Bwg4KV8B.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CmPfOfHl.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DhQNh7W6.js +0 -5
- package/dist/src/voice/local/runtime-dispatcher.d.ts +0 -9
- package/dist/src/voice/local/runtime-dispatcher.js +0 -20
|
@@ -15,6 +15,7 @@ export declare class ProviderAuthService {
|
|
|
15
15
|
private runtime;
|
|
16
16
|
constructor(options?: ProviderAuthServiceOptions);
|
|
17
17
|
resolveApiKey(providerId: string, signal?: AbortSignal): Promise<string | null>;
|
|
18
|
+
invalidate(): void;
|
|
18
19
|
private getRuntime;
|
|
19
20
|
}
|
|
20
21
|
export declare function getProviderAuthService(): ProviderAuthService;
|
|
@@ -55,6 +55,9 @@ var init_provider_auth_service = __esmMin((() => {
|
|
|
55
55
|
}
|
|
56
56
|
return await this.resolver.resolveApiKey(providerId);
|
|
57
57
|
}
|
|
58
|
+
invalidate() {
|
|
59
|
+
this.runtime = void 0;
|
|
60
|
+
}
|
|
58
61
|
getRuntime() {
|
|
59
62
|
this.runtime ??= this.runtimeFactory(this.credentials).catch((error) => {
|
|
60
63
|
this.runtime = void 0;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CredentialResolver } from '../auth/credentials.js';
|
|
2
|
+
interface ProviderDisconnectOptions {
|
|
3
|
+
resolver?: Pick<CredentialResolver, 'deleteProviderCredential'>;
|
|
4
|
+
invalidateAuth?: () => void;
|
|
5
|
+
clearCloudCatalog?: () => Promise<void>;
|
|
6
|
+
refreshModels?: () => void;
|
|
7
|
+
evictRunners?: () => void;
|
|
8
|
+
withLock?: <T>(providerId: string, operation: () => Promise<T>) => Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
export declare function disconnectProvider(providerId: string, options?: ProviderDisconnectOptions): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
4
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "../auth/oauth-provider-lock.js";
|
|
5
|
+
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
6
|
+
import { getProviderAuthService, init_provider_auth_service } from "./provider-auth-service.js";
|
|
7
|
+
import { evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
|
|
8
|
+
import { getXopcCloudCatalogCoordinator } from "./xopc-cloud-catalog-coordinator.js";
|
|
9
|
+
//#region src/providers/provider-disconnect.ts
|
|
10
|
+
init_credentials();
|
|
11
|
+
init_oauth_provider_lock();
|
|
12
|
+
init_logger();
|
|
13
|
+
init_model_registry();
|
|
14
|
+
init_provider_auth_service();
|
|
15
|
+
const log = createLogger("ProviderDisconnect");
|
|
16
|
+
async function disconnectProvider(providerId, options = {}) {
|
|
17
|
+
const provider = providerId.trim().toLowerCase();
|
|
18
|
+
if (!provider) throw new Error("Provider id is required");
|
|
19
|
+
const resolver = options.resolver ?? new CredentialResolver();
|
|
20
|
+
await (options.withLock ?? ((id, operation) => withOAuthProviderLock(id, operation)))(provider, async () => {
|
|
21
|
+
await resolver.deleteProviderCredential(provider);
|
|
22
|
+
(options.invalidateAuth ?? (() => getProviderAuthService().invalidate()))();
|
|
23
|
+
if (provider === "xopc-cloud") await (options.clearCloudCatalog ?? (() => getXopcCloudCatalogCoordinator().clear("revoke")))();
|
|
24
|
+
else (options.refreshModels ?? (() => getModelRegistry().refresh()))();
|
|
25
|
+
(options.evictRunners ?? (() => evictAllEmbeddedSessionRunners("provider_disconnected")))();
|
|
26
|
+
});
|
|
27
|
+
log.info({
|
|
28
|
+
provider,
|
|
29
|
+
phase: "provider_revoked"
|
|
30
|
+
}, `Disconnected provider: ${provider}`);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { disconnectProvider };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ModelCatalogPersistence } from './model-catalog-persistence.js';
|
|
2
|
+
import { type CatalogSourceOrigin, type ModelCatalogStore } from './model-catalog-store.js';
|
|
3
|
+
import { XopcCloudModelSource } from './xopc-cloud-model-source.js';
|
|
4
|
+
export type CatalogEnsureReason = 'startup' | 'oauth' | 'agent-run' | 'manual' | 'recovery';
|
|
5
|
+
export interface EnsureCatalogOptions {
|
|
6
|
+
reason: CatalogEnsureReason;
|
|
7
|
+
network: 'never' | 'if-empty' | 'always';
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CatalogReadiness {
|
|
11
|
+
state: 'not-authorized' | 'ready' | 'stale' | 'refreshing' | 'unavailable';
|
|
12
|
+
source: CatalogSourceOrigin | 'none';
|
|
13
|
+
fetchedAt?: number;
|
|
14
|
+
catalogVersion?: string | null;
|
|
15
|
+
modelCount: number;
|
|
16
|
+
error?: {
|
|
17
|
+
code: string;
|
|
18
|
+
message: string;
|
|
19
|
+
retryable: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface CatalogCoordinatorOptions {
|
|
23
|
+
source?: Pick<XopcCloudModelSource, 'fetch'>;
|
|
24
|
+
store?: ModelCatalogStore;
|
|
25
|
+
persistence?: Pick<ModelCatalogPersistence, 'loadSync' | 'save' | 'clear'>;
|
|
26
|
+
staleAfterMs?: number;
|
|
27
|
+
refreshModels?: () => void;
|
|
28
|
+
reloadImageProviders?: () => void;
|
|
29
|
+
withLock?: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
30
|
+
onPermanentAuthFailure?: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare class XopcCloudCatalogCoordinator {
|
|
33
|
+
private readonly source;
|
|
34
|
+
private readonly store;
|
|
35
|
+
private readonly persistence;
|
|
36
|
+
private readonly staleAfterMs;
|
|
37
|
+
private readonly refreshModels;
|
|
38
|
+
private readonly reloadImageProviders;
|
|
39
|
+
private readonly withLock;
|
|
40
|
+
private readonly onPermanentAuthFailure;
|
|
41
|
+
private refreshPromise;
|
|
42
|
+
private generation;
|
|
43
|
+
private lastError;
|
|
44
|
+
private notAuthorized;
|
|
45
|
+
constructor(options?: CatalogCoordinatorOptions);
|
|
46
|
+
hydrate(): Promise<CatalogReadiness>;
|
|
47
|
+
ensure(options: EnsureCatalogOptions): Promise<CatalogReadiness>;
|
|
48
|
+
refresh(reason: CatalogEnsureReason, timeoutMs?: number): Promise<CatalogReadiness>;
|
|
49
|
+
clear(reason: 'revoke' | 'invalid-grant'): Promise<void>;
|
|
50
|
+
snapshot(): CatalogReadiness;
|
|
51
|
+
private buildSnapshot;
|
|
52
|
+
private runRefresh;
|
|
53
|
+
}
|
|
54
|
+
export declare function getXopcCloudCatalogCoordinator(): XopcCloudCatalogCoordinator;
|
|
55
|
+
export declare function resetXopcCloudCatalogCoordinator(): void;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { ModelCatalogPersistence, init_model_catalog_persistence } from "./model-catalog-persistence.js";
|
|
4
|
+
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
5
|
+
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
6
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "../auth/oauth-provider-lock.js";
|
|
7
|
+
import { reloadImageGenerationProviders } from "../agent/image/generation/provider-registry.js";
|
|
8
|
+
import { XopcCloudModelSource } from "./xopc-cloud-model-source.js";
|
|
9
|
+
//#region src/providers/xopc-cloud-catalog-coordinator.ts
|
|
10
|
+
init_oauth_provider_lock();
|
|
11
|
+
init_logger();
|
|
12
|
+
init_model_catalog_persistence();
|
|
13
|
+
init_model_catalog_store();
|
|
14
|
+
init_model_registry();
|
|
15
|
+
const log = createLogger("XopcCloudCatalog");
|
|
16
|
+
const DEFAULT_STALE_AFTER_MS = 1440 * 6e4;
|
|
17
|
+
var XopcCloudCatalogCoordinator = class {
|
|
18
|
+
source;
|
|
19
|
+
store;
|
|
20
|
+
persistence;
|
|
21
|
+
staleAfterMs;
|
|
22
|
+
refreshModels;
|
|
23
|
+
reloadImageProviders;
|
|
24
|
+
withLock;
|
|
25
|
+
onPermanentAuthFailure;
|
|
26
|
+
refreshPromise = null;
|
|
27
|
+
generation = 0;
|
|
28
|
+
lastError;
|
|
29
|
+
notAuthorized = false;
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.source = options.source ?? new XopcCloudModelSource();
|
|
32
|
+
this.store = options.store ?? getModelCatalogStore();
|
|
33
|
+
this.persistence = options.persistence ?? new ModelCatalogPersistence();
|
|
34
|
+
this.staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_AFTER_MS;
|
|
35
|
+
this.refreshModels = options.refreshModels ?? (() => getModelRegistry().refresh());
|
|
36
|
+
this.reloadImageProviders = options.reloadImageProviders ?? reloadImageGenerationProviders;
|
|
37
|
+
this.withLock = options.withLock ?? ((operation) => withOAuthProviderLock("xopc-cloud", operation));
|
|
38
|
+
this.onPermanentAuthFailure = options.onPermanentAuthFailure ?? (async () => {
|
|
39
|
+
const { disconnectProvider } = await import("./provider-disconnect.js");
|
|
40
|
+
await disconnectProvider("xopc-cloud");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async hydrate() {
|
|
44
|
+
if (!this.store.getSource("xopc-cloud")) {
|
|
45
|
+
const source = this.persistence.loadSync();
|
|
46
|
+
if (source) this.store.saveSource("xopc-cloud", source, "disk");
|
|
47
|
+
}
|
|
48
|
+
return this.snapshot();
|
|
49
|
+
}
|
|
50
|
+
async ensure(options) {
|
|
51
|
+
await this.hydrate();
|
|
52
|
+
if (options.network === "never") return this.snapshot();
|
|
53
|
+
if (options.network === "if-empty" && this.store.getSource("xopc-cloud")) return this.snapshot();
|
|
54
|
+
return this.refresh(options.reason, options.timeoutMs);
|
|
55
|
+
}
|
|
56
|
+
refresh(reason, timeoutMs = 3e4) {
|
|
57
|
+
if (this.refreshPromise) return this.refreshPromise;
|
|
58
|
+
const generation = this.generation;
|
|
59
|
+
this.refreshPromise = this.runRefresh(reason, generation, timeoutMs).finally(() => {
|
|
60
|
+
this.refreshPromise = null;
|
|
61
|
+
});
|
|
62
|
+
return this.refreshPromise;
|
|
63
|
+
}
|
|
64
|
+
async clear(reason) {
|
|
65
|
+
this.generation += 1;
|
|
66
|
+
await this.withLock(async () => {
|
|
67
|
+
this.store.removeSource("xopc-cloud");
|
|
68
|
+
await this.persistence.clear();
|
|
69
|
+
this.lastError = void 0;
|
|
70
|
+
this.notAuthorized = reason === "revoke" || reason === "invalid-grant";
|
|
71
|
+
this.refreshModels();
|
|
72
|
+
this.reloadImageProviders();
|
|
73
|
+
log.info({
|
|
74
|
+
provider: "xopc-cloud",
|
|
75
|
+
reason,
|
|
76
|
+
phase: "catalog_commit"
|
|
77
|
+
}, "Cleared XOPC Cloud model catalog");
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
snapshot() {
|
|
81
|
+
return this.buildSnapshot(this.refreshPromise !== null);
|
|
82
|
+
}
|
|
83
|
+
buildSnapshot(refreshing) {
|
|
84
|
+
const source = this.store.getSource("xopc-cloud");
|
|
85
|
+
if (!source) return {
|
|
86
|
+
state: this.notAuthorized ? "not-authorized" : "unavailable",
|
|
87
|
+
source: "none",
|
|
88
|
+
modelCount: 0,
|
|
89
|
+
...this.lastError ? { error: this.lastError } : {}
|
|
90
|
+
};
|
|
91
|
+
const stale = Date.now() - source.lastSuccessAt > this.staleAfterMs;
|
|
92
|
+
return {
|
|
93
|
+
state: refreshing ? "refreshing" : stale ? "stale" : "ready",
|
|
94
|
+
source: this.store.getSourceOrigin("xopc-cloud") ?? "memory",
|
|
95
|
+
fetchedAt: source.lastSuccessAt,
|
|
96
|
+
catalogVersion: source.etag,
|
|
97
|
+
modelCount: source.models.filter((model) => model.availability === "available").length,
|
|
98
|
+
...this.lastError ? { error: this.lastError } : {}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async runRefresh(reason, generation, timeoutMs) {
|
|
102
|
+
const startedAt = Date.now();
|
|
103
|
+
try {
|
|
104
|
+
const readiness = await this.withLock(async () => {
|
|
105
|
+
const result = await this.source.fetch(AbortSignal.timeout(timeoutMs));
|
|
106
|
+
if (result.status === "skipped") {
|
|
107
|
+
await this.clear("revoke");
|
|
108
|
+
return this.buildSnapshot(false);
|
|
109
|
+
}
|
|
110
|
+
if (generation !== this.generation) return this.buildSnapshot(false);
|
|
111
|
+
const previous = this.store.getSource("xopc-cloud");
|
|
112
|
+
const previousOrigin = this.store.getSourceOrigin("xopc-cloud");
|
|
113
|
+
this.store.replaceSourceModels("xopc-cloud", result.source, result.models, "network");
|
|
114
|
+
const committed = this.store.getSource("xopc-cloud");
|
|
115
|
+
if (!committed) throw new Error("XOPC Cloud catalog commit failed");
|
|
116
|
+
try {
|
|
117
|
+
await this.persistence.save(committed);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (previous) this.store.saveSource("xopc-cloud", previous, previousOrigin ?? "memory");
|
|
120
|
+
else this.store.removeSource("xopc-cloud");
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
if (generation !== this.generation) {
|
|
124
|
+
this.store.removeSource("xopc-cloud");
|
|
125
|
+
await this.persistence.clear();
|
|
126
|
+
return this.buildSnapshot(false);
|
|
127
|
+
}
|
|
128
|
+
this.notAuthorized = false;
|
|
129
|
+
this.lastError = void 0;
|
|
130
|
+
this.refreshModels();
|
|
131
|
+
this.reloadImageProviders();
|
|
132
|
+
return this.buildSnapshot(false);
|
|
133
|
+
});
|
|
134
|
+
log.info({
|
|
135
|
+
provider: "xopc-cloud",
|
|
136
|
+
reason,
|
|
137
|
+
phase: "catalog_refresh",
|
|
138
|
+
durationMs: Date.now() - startedAt
|
|
139
|
+
}, `XOPC Cloud model catalog refresh completed with ${readiness.modelCount} models`);
|
|
140
|
+
return readiness;
|
|
141
|
+
} catch (err) {
|
|
142
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
143
|
+
const modelError = asXopcCloudModelError(err);
|
|
144
|
+
if (modelError?.status === 401 && (modelError.code === "invalid_grant" || modelError.code === "invalid_token")) {
|
|
145
|
+
await this.onPermanentAuthFailure();
|
|
146
|
+
this.notAuthorized = true;
|
|
147
|
+
}
|
|
148
|
+
this.lastError = {
|
|
149
|
+
code: modelError ? modelError.code ?? `http_${modelError.status}` : "refresh_failed",
|
|
150
|
+
message,
|
|
151
|
+
retryable: !modelError || modelError.status === 429 || modelError.status >= 500
|
|
152
|
+
};
|
|
153
|
+
log.warn({
|
|
154
|
+
err,
|
|
155
|
+
provider: "xopc-cloud",
|
|
156
|
+
reason,
|
|
157
|
+
phase: "catalog_refresh",
|
|
158
|
+
durationMs: Date.now() - startedAt
|
|
159
|
+
}, `XOPC Cloud model catalog refresh failed: ${message}`);
|
|
160
|
+
return this.buildSnapshot(false);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function asXopcCloudModelError(error) {
|
|
165
|
+
if (!(error instanceof Error) || error.name !== "XopcCloudModelError") return void 0;
|
|
166
|
+
const candidate = error;
|
|
167
|
+
if (typeof candidate.status !== "number") return void 0;
|
|
168
|
+
return {
|
|
169
|
+
status: candidate.status,
|
|
170
|
+
...typeof candidate.code === "string" ? { code: candidate.code } : {}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
let globalCoordinator;
|
|
174
|
+
function getXopcCloudCatalogCoordinator() {
|
|
175
|
+
globalCoordinator ??= new XopcCloudCatalogCoordinator();
|
|
176
|
+
return globalCoordinator;
|
|
177
|
+
}
|
|
178
|
+
function resetXopcCloudCatalogCoordinator() {
|
|
179
|
+
globalCoordinator = void 0;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { XopcCloudCatalogCoordinator, getXopcCloudCatalogCoordinator, resetXopcCloudCatalogCoordinator };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AvailableCatalogModel, CatalogSource } from './model-catalog-store.js';
|
|
2
2
|
import { type ProviderAuthService } from './provider-auth-service.js';
|
|
3
|
-
export type
|
|
3
|
+
export type XopcCloudCatalogFetchResult = {
|
|
4
4
|
status: 'skipped';
|
|
5
5
|
reason: 'not_configured';
|
|
6
6
|
} | {
|
|
7
|
-
status: '
|
|
8
|
-
|
|
9
|
-
models:
|
|
7
|
+
status: 'fetched';
|
|
8
|
+
source: Omit<CatalogSource, 'models'>;
|
|
9
|
+
models: AvailableCatalogModel[];
|
|
10
10
|
};
|
|
11
11
|
export declare class XopcCloudModelError extends Error {
|
|
12
12
|
readonly status: number;
|
|
@@ -17,14 +17,10 @@ export declare class XopcCloudModelSource {
|
|
|
17
17
|
private readonly fetchImpl;
|
|
18
18
|
private readonly routerUrl;
|
|
19
19
|
private readonly credentials;
|
|
20
|
-
private readonly catalogStore;
|
|
21
|
-
private readonly refreshModels;
|
|
22
20
|
constructor(options?: {
|
|
23
21
|
fetchImpl?: typeof fetch;
|
|
24
22
|
routerUrl?: string;
|
|
25
23
|
credentials?: Pick<ProviderAuthService, 'resolveApiKey'>;
|
|
26
|
-
catalogStore?: ModelCatalogStore;
|
|
27
|
-
refreshModels?: () => void;
|
|
28
24
|
});
|
|
29
|
-
|
|
25
|
+
fetch(signal?: AbortSignal): Promise<XopcCloudCatalogFetchResult>;
|
|
30
26
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
2
|
-
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
3
1
|
import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
4
2
|
import { getProviderAuthService, init_provider_auth_service } from "./provider-auth-service.js";
|
|
5
|
-
import { reloadImageGenerationProviders } from "../agent/image/generation/provider-registry.js";
|
|
6
3
|
//#region src/providers/xopc-cloud-model-source.ts
|
|
7
|
-
init_model_catalog_store();
|
|
8
|
-
init_model_registry();
|
|
9
4
|
init_provider_auth_service();
|
|
10
5
|
init_xopc_cloud_config();
|
|
11
6
|
var XopcCloudModelError = class extends Error {
|
|
@@ -20,17 +15,14 @@ var XopcCloudModelSource = class {
|
|
|
20
15
|
fetchImpl;
|
|
21
16
|
routerUrl;
|
|
22
17
|
credentials;
|
|
23
|
-
catalogStore;
|
|
24
|
-
refreshModels;
|
|
25
18
|
constructor(options = {}) {
|
|
26
19
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
27
20
|
this.routerUrl = resolveXopcModelRouterUrl(options.routerUrl);
|
|
28
21
|
this.credentials = options.credentials ?? getProviderAuthService();
|
|
29
|
-
this.catalogStore = options.catalogStore ?? getModelCatalogStore();
|
|
30
|
-
this.refreshModels = options.refreshModels ?? (() => getModelRegistry().refresh());
|
|
31
22
|
}
|
|
32
|
-
async
|
|
33
|
-
const
|
|
23
|
+
async fetch(signal) {
|
|
24
|
+
const requestSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(3e4)]) : AbortSignal.timeout(3e4);
|
|
25
|
+
const accessToken = await this.credentials.resolveApiKey("xopc-cloud", requestSignal);
|
|
34
26
|
if (!accessToken) return {
|
|
35
27
|
status: "skipped",
|
|
36
28
|
reason: "not_configured"
|
|
@@ -40,7 +32,7 @@ var XopcCloudModelSource = class {
|
|
|
40
32
|
authorization: `Bearer ${accessToken}`,
|
|
41
33
|
accept: "application/json"
|
|
42
34
|
},
|
|
43
|
-
signal:
|
|
35
|
+
signal: requestSignal
|
|
44
36
|
});
|
|
45
37
|
const body = await response.json().catch(() => null);
|
|
46
38
|
if (!response.ok) throw new XopcCloudModelError(typeof body?.error?.message === "string" ? body.error.message : `XOPC model discovery failed (${response.status})`, response.status, typeof body?.error?.code === "string" ? body.error.code : void 0);
|
|
@@ -58,7 +50,7 @@ var XopcCloudModelSource = class {
|
|
|
58
50
|
const generation = parseImageGenerationCapabilities(model.xopc?.capabilities?.imageGeneration);
|
|
59
51
|
const stt = kind === "stt" ? parseSttCapabilities(model.xopc?.capabilities) : void 0;
|
|
60
52
|
const tts = kind === "tts" ? parseTtsCapabilities(model.xopc?.capabilities, model.xopc?.defaultVoice) : void 0;
|
|
61
|
-
|
|
53
|
+
const catalogModel = {
|
|
62
54
|
id: model.id,
|
|
63
55
|
name: model.id,
|
|
64
56
|
kind,
|
|
@@ -68,28 +60,58 @@ var XopcCloudModelSource = class {
|
|
|
68
60
|
reasoning: model.xopc?.capabilities?.reasoning === true,
|
|
69
61
|
contextWindow: 128e3,
|
|
70
62
|
maxOutputTokens: typeof maxOutputTokens === "number" && Number.isSafeInteger(maxOutputTokens) ? maxOutputTokens : null,
|
|
63
|
+
...model.xopc?.stability === "stable" || model.xopc?.stability === "preview" || model.xopc?.stability === "deprecated" ? { stability: model.xopc.stability } : {},
|
|
64
|
+
...typeof model.xopc?.priority === "number" && Number.isFinite(model.xopc.priority) ? { priority: model.xopc.priority } : {},
|
|
65
|
+
...typeof model.xopc?.tier === "string" && model.xopc.tier ? { tier: model.xopc.tier } : {},
|
|
66
|
+
...typeof model.xopc?.bestEffort === "boolean" ? { bestEffort: model.xopc.bestEffort } : {},
|
|
71
67
|
...generation ? { imageGeneration: generation } : {},
|
|
72
68
|
...stt ? { stt } : {},
|
|
73
69
|
...tts ? { tts } : {}
|
|
74
|
-
}
|
|
70
|
+
};
|
|
71
|
+
return [model.id, catalogModel];
|
|
75
72
|
})).values()];
|
|
76
|
-
|
|
77
|
-
providerId: "xopc-cloud",
|
|
78
|
-
baseUrl: this.routerUrl,
|
|
79
|
-
api: "openai-completions",
|
|
80
|
-
etag: response.headers.get("x-xopc-model-catalog-version"),
|
|
81
|
-
recommendedModel: models[0]?.id ?? null,
|
|
82
|
-
lastSuccessAt: Date.now()
|
|
83
|
-
}, models);
|
|
84
|
-
this.refreshModels();
|
|
85
|
-
reloadImageGenerationProviders();
|
|
73
|
+
const recommended = parseRecommendations(body.xopc?.defaults, models);
|
|
86
74
|
return {
|
|
87
|
-
status: "
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
status: "fetched",
|
|
76
|
+
source: {
|
|
77
|
+
providerId: "xopc-cloud",
|
|
78
|
+
baseUrl: this.routerUrl,
|
|
79
|
+
api: "openai-completions",
|
|
80
|
+
etag: response.headers.get("x-xopc-model-catalog-version"),
|
|
81
|
+
recommendedModel: models[0]?.id ?? null,
|
|
82
|
+
...Object.keys(recommended).length > 0 ? { recommended } : {},
|
|
83
|
+
lastSuccessAt: Date.now()
|
|
84
|
+
},
|
|
85
|
+
models
|
|
90
86
|
};
|
|
91
87
|
}
|
|
92
88
|
};
|
|
89
|
+
function parseRecommendations(value, models) {
|
|
90
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
91
|
+
const raw = value;
|
|
92
|
+
const capabilities = [
|
|
93
|
+
"vision",
|
|
94
|
+
"image-generation",
|
|
95
|
+
"stt",
|
|
96
|
+
"tts"
|
|
97
|
+
];
|
|
98
|
+
const recommended = {};
|
|
99
|
+
for (const capability of capabilities) {
|
|
100
|
+
const modelId = raw[capability];
|
|
101
|
+
if (typeof modelId !== "string") continue;
|
|
102
|
+
const model = models.find((entry) => entry.id === modelId);
|
|
103
|
+
if (model && modelMatchesRecommendation(model, capability)) recommended[capability] = modelId;
|
|
104
|
+
}
|
|
105
|
+
return recommended;
|
|
106
|
+
}
|
|
107
|
+
function modelMatchesRecommendation(model, capability) {
|
|
108
|
+
switch (capability) {
|
|
109
|
+
case "vision": return model.kind === "language" && model.input.includes("image");
|
|
110
|
+
case "image-generation": return model.kind === "image" && model.operations.includes("images.generate");
|
|
111
|
+
case "stt": return model.kind === "stt" && model.operations.includes("audio.transcription");
|
|
112
|
+
case "tts": return model.kind === "tts" && model.operations.includes("audio.speech");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
93
115
|
function parseSttCapabilities(value) {
|
|
94
116
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
95
117
|
const raw = value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function retrievalQueryAuditValue(query: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
//#region src/retrieval/audit.ts
|
|
3
|
+
function retrievalQueryAuditValue(query) {
|
|
4
|
+
const normalized = query.normalize("NFKC").trim();
|
|
5
|
+
return `sha256:${createHash("sha256").update(normalized).digest("hex").slice(0, 24)};length=${[...normalized].length}`;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { retrievalQueryAuditValue };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/retrieval/candidateFusion.ts
|
|
2
|
+
function fuseRankedCandidates(channels, rankConstant = 60) {
|
|
3
|
+
const activeChannels = channels.filter((channel) => channel.weight > 0 && channel.ids.length > 0);
|
|
4
|
+
if (!activeChannels.length) return /* @__PURE__ */ new Map();
|
|
5
|
+
const maximum = activeChannels.reduce((sum, channel) => sum + channel.weight / (rankConstant + 1), 0);
|
|
6
|
+
const scores = /* @__PURE__ */ new Map();
|
|
7
|
+
for (const channel of activeChannels) {
|
|
8
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9
|
+
channel.ids.forEach((id, index) => {
|
|
10
|
+
if (!id || seen.has(id)) return;
|
|
11
|
+
seen.add(id);
|
|
12
|
+
const contribution = channel.weight / (rankConstant + index + 1);
|
|
13
|
+
scores.set(id, (scores.get(id) ?? 0) + contribution);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
for (const [id, score] of scores) scores.set(id, score / maximum);
|
|
17
|
+
return scores;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { fuseRankedCandidates };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type RetrievalTimeHint = 'current' | 'recent' | 'historical' | 'future';
|
|
2
|
+
export interface RetrievalScope {
|
|
3
|
+
sessionKey?: string;
|
|
4
|
+
workspaceId?: string;
|
|
5
|
+
projectId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RetrievalQueryProfile {
|
|
8
|
+
normalized: string;
|
|
9
|
+
terms: string[];
|
|
10
|
+
cjkBigrams: string[];
|
|
11
|
+
identifiers: string[];
|
|
12
|
+
intentKinds: string[];
|
|
13
|
+
timeHints: RetrievalTimeHint[];
|
|
14
|
+
scope: RetrievalScope;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildRetrievalQueryProfile(query: string, scope?: RetrievalScope): RetrievalQueryProfile;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { extractCjkBigrams, extractLexicalTerms, extractRetrievalIdentifiers, normalizeRetrievalText } from "./textFeatures.js";
|
|
2
|
+
//#region src/retrieval/queryProfile.ts
|
|
3
|
+
const INTENT_RULES = [
|
|
4
|
+
{
|
|
5
|
+
kinds: ["boundary"],
|
|
6
|
+
pattern: /\b(?:avoid|never|permission|confirm|approval)\b|不要|禁止|避免|确认|授权|边界/i
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
kinds: ["preference", "tool_preference"],
|
|
10
|
+
pattern: /\b(?:prefer|preference|format|language|style)\b|喜欢|偏好|格式|语言|风格|简洁|详细/i
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
kinds: [
|
|
14
|
+
"project_context",
|
|
15
|
+
"workspace_fact",
|
|
16
|
+
"task_lesson"
|
|
17
|
+
],
|
|
18
|
+
pattern: /\b(?:project|repository|repo|workspace|codebase|deploy|release)\b|项目|仓库|代码库|工作区|发布|部署/i
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
kinds: ["long_term_goal", "commitment"],
|
|
22
|
+
pattern: /\b(?:goal|plan|deadline|commitment)\b|目标|计划|截止|承诺/i
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
kinds: ["routine"],
|
|
26
|
+
pattern: /\b(?:routine|usually|weekly|daily|every time)\b|习惯|通常|每周|每天|每次/i
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
kinds: ["relationship"],
|
|
30
|
+
pattern: /\b(?:person|people|colleague|collaborator|relationship)\b|同事|合作伙伴|关系|联系人/i
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
const TIME_RULES = [
|
|
34
|
+
{
|
|
35
|
+
hint: "current",
|
|
36
|
+
pattern: /\b(?:now|current|today)\b|现在|当前|今天/i
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
hint: "recent",
|
|
40
|
+
pattern: /\b(?:recent|recently|latest)\b|最近|近期|最新/i
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
hint: "historical",
|
|
44
|
+
pattern: /\b(?:previous|before|history|last time)\b|之前|以前|历史|上次/i
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
hint: "future",
|
|
48
|
+
pattern: /\b(?:future|next|later|upcoming)\b|未来|下次|之后|即将/i
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
function buildRetrievalQueryProfile(query, scope = {}) {
|
|
52
|
+
const normalized = normalizeRetrievalText(query);
|
|
53
|
+
const intentKinds = INTENT_RULES.filter((rule) => rule.pattern.test(normalized)).flatMap((rule) => rule.kinds);
|
|
54
|
+
const timeHints = TIME_RULES.filter((rule) => rule.pattern.test(normalized)).map((rule) => rule.hint);
|
|
55
|
+
return {
|
|
56
|
+
normalized,
|
|
57
|
+
terms: extractLexicalTerms(normalized),
|
|
58
|
+
cjkBigrams: extractCjkBigrams(normalized),
|
|
59
|
+
identifiers: extractRetrievalIdentifiers(normalized),
|
|
60
|
+
intentKinds: [...new Set(intentKinds)],
|
|
61
|
+
timeHints: [...new Set(timeHints)],
|
|
62
|
+
scope: { ...scope }
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { buildRetrievalQueryProfile };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function normalizeRetrievalText(value: string): string;
|
|
2
|
+
export declare function extractLexicalTerms(value: string): string[];
|
|
3
|
+
export declare function extractCjkBigrams(value: string): string[];
|
|
4
|
+
export declare function extractRetrievalIdentifiers(value: string): string[];
|
|
5
|
+
export declare function retrievalLexicalSimilarity(left: string, right: string): number;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//#region src/retrieval/textFeatures.ts
|
|
2
|
+
const ENGLISH_STOP_WORDS = new Set([
|
|
3
|
+
"a",
|
|
4
|
+
"an",
|
|
5
|
+
"and",
|
|
6
|
+
"are",
|
|
7
|
+
"can",
|
|
8
|
+
"did",
|
|
9
|
+
"do",
|
|
10
|
+
"does",
|
|
11
|
+
"for",
|
|
12
|
+
"how",
|
|
13
|
+
"i",
|
|
14
|
+
"in",
|
|
15
|
+
"is",
|
|
16
|
+
"it",
|
|
17
|
+
"me",
|
|
18
|
+
"my",
|
|
19
|
+
"of",
|
|
20
|
+
"on",
|
|
21
|
+
"or",
|
|
22
|
+
"the",
|
|
23
|
+
"to",
|
|
24
|
+
"was",
|
|
25
|
+
"what",
|
|
26
|
+
"when",
|
|
27
|
+
"where",
|
|
28
|
+
"which",
|
|
29
|
+
"who",
|
|
30
|
+
"why",
|
|
31
|
+
"with",
|
|
32
|
+
"you",
|
|
33
|
+
"your"
|
|
34
|
+
]);
|
|
35
|
+
function normalizeRetrievalText(value) {
|
|
36
|
+
return value.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim();
|
|
37
|
+
}
|
|
38
|
+
function extractLexicalTerms(value) {
|
|
39
|
+
const terms = normalizeRetrievalText(value).match(/[\p{L}\p{N}_]+/gu)?.filter((term) => term.length > 1 && !ENGLISH_STOP_WORDS.has(term)) ?? [];
|
|
40
|
+
return [...new Set(terms)];
|
|
41
|
+
}
|
|
42
|
+
function extractCjkBigrams(value) {
|
|
43
|
+
const features = [];
|
|
44
|
+
for (const sequence of normalizeRetrievalText(value).match(/\p{Script=Han}+/gu) ?? []) {
|
|
45
|
+
const characters = [...sequence];
|
|
46
|
+
for (let index = 0; index < characters.length - 1; index += 1) features.push(`${characters[index]}${characters[index + 1]}`);
|
|
47
|
+
}
|
|
48
|
+
return [...new Set(features)];
|
|
49
|
+
}
|
|
50
|
+
function extractRetrievalIdentifiers(value) {
|
|
51
|
+
const normalized = normalizeRetrievalText(value);
|
|
52
|
+
const identifiers = [
|
|
53
|
+
...normalized.match(/@[a-z0-9_.-]+\/[a-z0-9_.-]+/g) ?? [],
|
|
54
|
+
...normalized.match(/(?:[a-z0-9_.-]+\/)+[a-z0-9_.-]+/g) ?? [],
|
|
55
|
+
...normalized.match(/\b[a-z0-9_-]+\.[a-z0-9]{1,12}\b/g) ?? [],
|
|
56
|
+
...normalized.match(/#[0-9]+\b/g) ?? [],
|
|
57
|
+
...normalized.match(/\b[a-z]+-[a-z0-9-]*[0-9][a-z0-9-]*\b/g) ?? []
|
|
58
|
+
];
|
|
59
|
+
const unique = [...new Set(identifiers)];
|
|
60
|
+
return unique.filter((identifier) => !unique.includes(`@${identifier}`));
|
|
61
|
+
}
|
|
62
|
+
function retrievalLexicalSimilarity(left, right) {
|
|
63
|
+
const leftFeatures = new Set([...extractLexicalTerms(left).map((term) => `term:${term}`), ...extractCjkBigrams(left).map((term) => `han:${term}`)]);
|
|
64
|
+
const rightFeatures = new Set([...extractLexicalTerms(right).map((term) => `term:${term}`), ...extractCjkBigrams(right).map((term) => `han:${term}`)]);
|
|
65
|
+
if (leftFeatures.size === 0 || rightFeatures.size === 0) return 0;
|
|
66
|
+
let shared = 0;
|
|
67
|
+
for (const feature of leftFeatures) if (rightFeatures.has(feature)) shared += 1;
|
|
68
|
+
return 2 * shared / (leftFeatures.size + rightFeatures.size);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { extractCjkBigrams, extractLexicalTerms, extractRetrievalIdentifiers, normalizeRetrievalText, retrievalLexicalSimilarity };
|