@xopcai/xopc 0.0.211 → 0.0.214
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 +39 -60
- package/README.zh-CN.md +39 -61
- 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-BzjFoSr0.js → activity-store-k-mNF_Dq.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DTfjhfVE.js → agent-avatar-dicebear-B5VyiQ_K.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DM2l0hCI.js +68 -0
- package/dist/gateway/static/root/assets/{api-D269PnU9.js → api-BjN2udFQ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BFpfQDWc.js → app-management-settings-panel-Bbul18ij.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DLxFdqhY.js → appearance-settings-Bvvzgp00.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BWd2KUkp.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DPlH4dnc.js → archive-plugin-DjGVsAgd.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-xqfLLd0I.js → attachment-load-BCuUeuuO.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Doof8nA6.js +1 -0
- package/dist/gateway/static/root/assets/automations-workspace-B2eTpWQN.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-C0tuoPXk.js → binary-plugins-B7WFf-lc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Deyphj1o.js → block-editor-CVwIwyUT.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-D6ua52QD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CYEbXyRF.js → browser-workflow-inputs-Coz8pWzP.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Bf0tPbGi.js → browser-workflows-page-8a3hnSXE.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfTpgo4L.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DPkFA_-R.js → capability-presets-api-BF3G84qe.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DkjsA_Yn.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DqKaAcnZ.js → channel-recipient-api-8Uz95P40.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Cv3pT5iN.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-NfU9X-P5.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CTDRZa7e.js → chat-terminal-dock-BYds3un1.js} +2 -2
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMhrPKJC.js → chunk-KS7C4IRE-BaASWQor.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-Buu8fif8.js → connectors-api-Cj4deNtI.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CL6PMerr.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DTLR82NB.js → cron-expression-DjBh0ZL4.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DyNogHQH.js → date-picker-3cIzKCZU.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BpnCuo7B.js → dependency-picker-VZFStrz_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDKI4gVB.js → desktop-pet-CRNQ4CKZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DjT5C2a3.js → desktop-pet-settings-CJBeLcbV.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-Dbq9_c33.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DWf2z7q5.js → extension-debug-page-CSFZfcz5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Dorx0kf9.js → extension-page-W8vZ3Nl0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B1wU9ZOB.js → extension-settings-page-D5zYR65b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B1lG4dNr.js → gateway-config-api-BnA56bxn.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BIxuwPQi.js → gateway-config-swr-l2w9ecXl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DqIOqJjM.js → gateway-settings-CCOOGd8A.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BpZgd4U-.js → gateway-startup-retry-XUzMGmLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DG4Kmgkc.js → heartbeat-settings-AutxO-ec.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BMpQAeHr.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-PkhYohDa.js → image-generation-api-CDoOrDMq.js} +1 -1
- package/dist/gateway/static/root/assets/index-BIBAmAjw.js +108 -0
- package/dist/gateway/static/root/assets/index-DQzjgIkQ.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6OQT3gQF.js → keyboard-shortcuts-settings-Bcc08kso.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-ctXGGgj1.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DfruRAmE.js → local-apps-page-CuwtmiCt.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-C5MK9WcP.js → locale-store-BIOMAhmR.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Vq-wDYVv.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-L1VYkywO.js → management-settings-gQwyJgL4.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-oqgHbqt-.js → markdown-split-DLSvtLDY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-V4rcPPH0.js → markdown-view-BMDQYc6E.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bb6gSX2o.js → media-plugins-DFdpMglM.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CbbZKEfO.js +3 -0
- package/dist/gateway/static/root/assets/notes-api-lKPk0Voa.js +1 -0
- package/dist/gateway/static/root/assets/{notes-page-B1rOXjpT.js → notes-page-BBhONbU4.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CCFrzDRT.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CBuCKeyy.js → page-tabs-DoQq4tt6.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BQ0tLfPO.js → preview-open-alternatives-BtJkAYOs.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DPeFn7Hu.js → product-open-page-ClyG8t4A.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CVeA23NS.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DFj-bwa5.js +1 -0
- package/dist/gateway/static/root/assets/registry-api-BFwvRxBn.js +2 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BgIrBYNz.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BCfQNzjG.js → runtime-tools-settings-panel-DdTZPRU5.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Bo7YbHYN.js → schema-form-C3Q03Hyv.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-wfBSuhmo.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-4zV9nthi.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B9dnKr3M.js → settings-form-section-DdrNtxul.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CYDV2JtY.js → settings-loading-skeleton-BFvEfK7v.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DbrIYfS9.js → settings-page-B8iNNrLN.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DEBPLh04.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-olgr7LLN.js → share-preview-page-CrsscJs3.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Cpd3s8-P.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BrDL4HAN.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-PE16CNw5.js → skills-page-B1sTkjZH.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-nXmBcBxt.js → skills-page.utils-CIcb0h3E.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C3qPwAdY.js → system-settings-panel-MAl91hH_.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-C5wgYuvF.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-KR5Otp5w.js → theme-store-BrbF9cgL.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-lMZodtDF.js → typed-models-lib-Peglr65V.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CKpatP3S.js → use-autosave-C10PZ1OV.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-DsAfqOJy.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CDcv0Wbh.js → voice-api-key-field-bdYmX3ph.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BI4wbLTm.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BAHYNlQt.js → workflow-run-setup-panel-CfmwGYkr.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-D7tjtD97.js +5 -0
- package/dist/gateway/static/root/index.html +12 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/composio-managed-client.d.ts +60 -0
- package/dist/src/connectors/composio-managed-client.js +135 -0
- package/dist/src/connectors/composio-managed-events.d.ts +41 -0
- package/dist/src/connectors/composio-managed-events.js +105 -0
- package/dist/src/connectors/composio-session-types.d.ts +91 -0
- package/dist/src/connectors/composio-session-types.js +1 -0
- package/dist/src/connectors/composio-sessions.d.ts +3 -91
- package/dist/src/connectors/composio-sessions.js +13 -7
- package/dist/src/connectors/composio.js +2 -1
- package/dist/src/connectors/connected-source-ingestion.js +67 -25
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-recipes.js +2 -0
- package/dist/src/connectors/runtime-adapter-registry.js +2 -2
- package/dist/src/discussions/sealer.js +2 -2
- package/dist/src/discussions/service.js +6 -2
- package/dist/src/discussions/transcript.d.ts +2 -0
- package/dist/src/discussions/transcript.js +16 -3
- package/dist/src/extensions/install.d.ts +10 -0
- package/dist/src/extensions/install.js +111 -14
- package/dist/src/extensions/loader.js +22 -18
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/middleware/auth.js +2 -2
- package/dist/src/gateway/hono/middleware/logger.js +1 -1
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +11 -4
- package/dist/src/gateway/hono/routes/exposure.js +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +1 -1
- package/dist/src/gateway/hono/routes/home.js +2 -2
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js +3 -3
- package/dist/src/gateway/hono/routes/workflows.js +69 -0
- package/dist/src/gateway/index.js +2 -2
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/runtime-config.js +2 -2
- package/dist/src/gateway/security/audit.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +23 -8
- package/dist/src/notes/note-attachment-sync.js +1 -1
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +2 -1
- package/dist/src/notes/types.d.ts +2 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.d.ts +1 -1
- package/dist/src/providers/model-catalog-store.d.ts +2 -60
- package/dist/src/providers/model-catalog-types.d.ts +60 -0
- package/dist/src/providers/model-catalog-types.js +1 -0
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/provider-disconnect-core.d.ts +11 -0
- package/dist/src/providers/provider-disconnect-core.js +35 -0
- package/dist/src/providers/provider-disconnect.d.ts +2 -10
- package/dist/src/providers/provider-disconnect.js +4 -26
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/xopc-cloud-catalog-coordinator.js +2 -2
- package/dist/src/runtime-tools/manager.js +41 -22
- package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +15 -0
- package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +12 -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/tasks/home-query-service.d.ts +12 -127
- package/dist/src/tasks/home-query-service.js +73 -271
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +2 -2
- package/dist/src/tunnel/index.js +2 -2
- package/dist/src/voice/audio/normalize.d.ts +1 -0
- package/dist/src/voice/audio/normalize.js +24 -4
- package/dist/src/voice/local/wav.d.ts +3 -0
- package/dist/src/voice/local/wav.js +10 -4
- package/dist/src/work-discovery/analyzer.js +16 -4
- package/dist/src/work-discovery/service.js +6 -8
- package/dist/src/work-discovery/types.d.ts +3 -0
- package/dist/src/workflows/context/workflow-context-snapshot-repository.d.ts +21 -0
- package/dist/src/workflows/context/workflow-context-snapshot-repository.js +40 -0
- package/dist/src/workflows/context/workflow-context.d.ts +18 -0
- package/dist/src/workflows/context/workflow-context.js +159 -0
- package/dist/src/workflows/domain/run.d.ts +10 -1
- package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
- package/dist/src/workflows/engine/workflow-engine.js +2 -0
- package/dist/src/workflows/project-presets/project-workflow-preset-repository.d.ts +20 -0
- package/dist/src/workflows/project-presets/project-workflow-preset-repository.js +38 -0
- package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +108 -23
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +1 -0
- package/dist/src/workflows/service/workflow-writeback-service.d.ts +9 -0
- package/dist/src/workflows/service/workflow-writeback-service.js +106 -0
- package/package.json +20 -20
- package/dist/gateway/static/root/assets/agents-CjhgfuVJ.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CjmlGB5V.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-4m6Ey6wG.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CAGCYx8U.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CKfLsxTI.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CpipKNqX.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-Bvq-O4pt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CrMld2l7.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CSQRzaVn.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-DlJY90TM.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BhqItS_s.js +0 -1
- package/dist/gateway/static/root/assets/index-DLhvsU9B.css +0 -2
- package/dist/gateway/static/root/assets/index-_cuTcWjB.js +0 -107
- package/dist/gateway/static/root/assets/local-app-workbench-page-DWjTmzxw.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BA5efZ8B.js +0 -2
- package/dist/gateway/static/root/assets/messages-ctG2e-ix.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CkHXVmKP.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DCqet9-L.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0t_AjzG.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUWPoBvw.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-vLhrrM3m.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-OP1y0Y8M.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cxc-Ejl5.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-ZOqC6-aA.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DwvC3Iuf.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DCRB-5q-.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CoiedRuA.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-CGdT22un.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BwaU1RqI.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DHYmh9G7.js +0 -5
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { ToolRouterCreateSessionConfig } from '@composio/core';
|
|
2
|
+
export type ComposioAuthConfigOption = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
status: 'ENABLED' | 'DISABLED';
|
|
6
|
+
authScheme?: string;
|
|
7
|
+
isComposioManaged: boolean;
|
|
8
|
+
isEnabledForToolRouter: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ComposioToolkitAuthState = {
|
|
11
|
+
toolkit: string;
|
|
12
|
+
managedAuthAvailable: boolean;
|
|
13
|
+
requiresCustomAuthConfig: boolean;
|
|
14
|
+
authConfigs: ComposioAuthConfigOption[];
|
|
15
|
+
};
|
|
16
|
+
type SessionToolkitResponse = {
|
|
17
|
+
items: Array<{
|
|
18
|
+
slug: string;
|
|
19
|
+
name: string;
|
|
20
|
+
logo?: string;
|
|
21
|
+
isNoAuth: boolean;
|
|
22
|
+
connection?: {
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
connectedAccount?: {
|
|
25
|
+
status: string;
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ComposioSessionLike = {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
toolkits(options?: {
|
|
35
|
+
toolkits?: string[];
|
|
36
|
+
isConnected?: boolean;
|
|
37
|
+
limit?: number;
|
|
38
|
+
cursor?: string;
|
|
39
|
+
}): Promise<SessionToolkitResponse>;
|
|
40
|
+
authorize(toolkit: string, options?: {
|
|
41
|
+
callbackUrl?: string;
|
|
42
|
+
alias?: string;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
id: string;
|
|
45
|
+
status: string;
|
|
46
|
+
redirectUrl?: string | null;
|
|
47
|
+
}>;
|
|
48
|
+
search(params: {
|
|
49
|
+
query: string;
|
|
50
|
+
toolkits?: string[];
|
|
51
|
+
}): Promise<unknown>;
|
|
52
|
+
execute(toolSlug: string, args?: Record<string, unknown>, options?: {
|
|
53
|
+
account?: string;
|
|
54
|
+
}): Promise<unknown>;
|
|
55
|
+
};
|
|
56
|
+
export type ComposioSessionsClient = {
|
|
57
|
+
mode?: 'managed' | 'byok';
|
|
58
|
+
sessions: {
|
|
59
|
+
create(userId: string, config?: ToolRouterCreateSessionConfig): Promise<ComposioSessionLike>;
|
|
60
|
+
};
|
|
61
|
+
connectedAccounts: {
|
|
62
|
+
list(query?: {
|
|
63
|
+
userIds?: string[];
|
|
64
|
+
toolkitSlugs?: string[];
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
delete(id: string): Promise<unknown>;
|
|
67
|
+
refresh(id: string): Promise<unknown>;
|
|
68
|
+
};
|
|
69
|
+
authConfigs?: {
|
|
70
|
+
list(query?: {
|
|
71
|
+
toolkit?: string;
|
|
72
|
+
showDisabled?: boolean;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
items: Array<{
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
status: 'ENABLED' | 'DISABLED';
|
|
78
|
+
authScheme?: string;
|
|
79
|
+
isComposioManaged?: boolean;
|
|
80
|
+
isEnabledForToolRouter?: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
toolkits?: {
|
|
85
|
+
get(slug: string): Promise<{
|
|
86
|
+
composioManagedAuthSchemes?: string[];
|
|
87
|
+
authConfigDetails?: unknown[];
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ToolRouterCreateSessionConfig } from '@composio/core';
|
|
2
1
|
import { CredentialResolver } from '../auth/credentials.js';
|
|
2
|
+
import type { ComposioSessionLike, ComposioSessionsClient, ComposioToolkitAuthState } from './composio-session-types.js';
|
|
3
3
|
import type { ConnectorActionMetadata, ConnectorConnection, ConnectorInstallationPolicy } from './types.js';
|
|
4
4
|
export declare function resolveComposioApiKey(resolver?: CredentialResolver): Promise<string | null>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function assertComposioAccessConfigured(resolver?: CredentialResolver): Promise<'byok' | 'managed'>;
|
|
6
6
|
export type ComposioToolkitCatalogItem = {
|
|
7
7
|
slug: string;
|
|
8
8
|
name: string;
|
|
@@ -17,94 +17,7 @@ export type ComposioAuthorizeResult = {
|
|
|
17
17
|
connectUrl?: string;
|
|
18
18
|
status: string;
|
|
19
19
|
};
|
|
20
|
-
export type ComposioAuthConfigOption
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
status: 'ENABLED' | 'DISABLED';
|
|
24
|
-
authScheme?: string;
|
|
25
|
-
isComposioManaged: boolean;
|
|
26
|
-
isEnabledForToolRouter: boolean;
|
|
27
|
-
};
|
|
28
|
-
export type ComposioToolkitAuthState = {
|
|
29
|
-
toolkit: string;
|
|
30
|
-
managedAuthAvailable: boolean;
|
|
31
|
-
requiresCustomAuthConfig: boolean;
|
|
32
|
-
authConfigs: ComposioAuthConfigOption[];
|
|
33
|
-
};
|
|
34
|
-
type SessionToolkitResponse = {
|
|
35
|
-
items: Array<{
|
|
36
|
-
slug: string;
|
|
37
|
-
name: string;
|
|
38
|
-
logo?: string;
|
|
39
|
-
isNoAuth: boolean;
|
|
40
|
-
connection?: {
|
|
41
|
-
isActive: boolean;
|
|
42
|
-
connectedAccount?: {
|
|
43
|
-
status: string;
|
|
44
|
-
id: string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}>;
|
|
48
|
-
cursor?: string;
|
|
49
|
-
};
|
|
50
|
-
export type ComposioSessionLike = {
|
|
51
|
-
sessionId: string;
|
|
52
|
-
toolkits(options?: {
|
|
53
|
-
toolkits?: string[];
|
|
54
|
-
isConnected?: boolean;
|
|
55
|
-
limit?: number;
|
|
56
|
-
cursor?: string;
|
|
57
|
-
}): Promise<SessionToolkitResponse>;
|
|
58
|
-
authorize(toolkit: string, options?: {
|
|
59
|
-
callbackUrl?: string;
|
|
60
|
-
alias?: string;
|
|
61
|
-
}): Promise<{
|
|
62
|
-
id: string;
|
|
63
|
-
status: string;
|
|
64
|
-
redirectUrl?: string | null;
|
|
65
|
-
}>;
|
|
66
|
-
search(params: {
|
|
67
|
-
query: string;
|
|
68
|
-
toolkits?: string[];
|
|
69
|
-
}): Promise<unknown>;
|
|
70
|
-
execute(toolSlug: string, args?: Record<string, unknown>, options?: {
|
|
71
|
-
account?: string;
|
|
72
|
-
}): Promise<unknown>;
|
|
73
|
-
};
|
|
74
|
-
export type ComposioSessionsClient = {
|
|
75
|
-
sessions: {
|
|
76
|
-
create(userId: string, config?: ToolRouterCreateSessionConfig): Promise<ComposioSessionLike>;
|
|
77
|
-
};
|
|
78
|
-
connectedAccounts: {
|
|
79
|
-
list(query?: {
|
|
80
|
-
userIds?: string[];
|
|
81
|
-
toolkitSlugs?: string[];
|
|
82
|
-
}): Promise<unknown>;
|
|
83
|
-
delete(id: string): Promise<unknown>;
|
|
84
|
-
refresh(id: string): Promise<unknown>;
|
|
85
|
-
};
|
|
86
|
-
authConfigs?: {
|
|
87
|
-
list(query?: {
|
|
88
|
-
toolkit?: string;
|
|
89
|
-
showDisabled?: boolean;
|
|
90
|
-
}): Promise<{
|
|
91
|
-
items: Array<{
|
|
92
|
-
id: string;
|
|
93
|
-
name: string;
|
|
94
|
-
status: 'ENABLED' | 'DISABLED';
|
|
95
|
-
authScheme?: string;
|
|
96
|
-
isComposioManaged?: boolean;
|
|
97
|
-
isEnabledForToolRouter?: boolean;
|
|
98
|
-
}>;
|
|
99
|
-
}>;
|
|
100
|
-
};
|
|
101
|
-
toolkits?: {
|
|
102
|
-
get(slug: string): Promise<{
|
|
103
|
-
composioManagedAuthSchemes?: string[];
|
|
104
|
-
authConfigDetails?: unknown[];
|
|
105
|
-
}>;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
20
|
+
export type { ComposioAuthConfigOption, ComposioSessionLike, ComposioSessionsClient, ComposioToolkitAuthState, } from './composio-session-types.js';
|
|
108
21
|
export type ComposioSessionContext = {
|
|
109
22
|
principalId: string;
|
|
110
23
|
installationScope?: string;
|
|
@@ -153,4 +66,3 @@ export declare class ComposioSessionsAdapter {
|
|
|
153
66
|
reason: string;
|
|
154
67
|
}>;
|
|
155
68
|
}
|
|
156
|
-
export {};
|
|
@@ -17,10 +17,10 @@ const COMPOSIO_API_KEY_PROVIDER = "connector-composio-api-key";
|
|
|
17
17
|
async function resolveComposioApiKey(resolver = new CredentialResolver()) {
|
|
18
18
|
return (await resolver.resolveApiKey(COMPOSIO_API_KEY_PROVIDER).catch(() => void 0))?.trim() || process.env.XOPC_COMPOSIO_API_KEY?.trim() || process.env.COMPOSIO_API_KEY?.trim() || null;
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
20
|
+
async function assertComposioAccessConfigured(resolver = new CredentialResolver()) {
|
|
21
|
+
if (await resolveComposioApiKey(resolver)) return "byok";
|
|
22
|
+
if ((await resolver.resolveApiKey("xopc-cloud").catch(() => null))?.trim()) return "managed";
|
|
23
|
+
throw new Error("Composio API key is not configured and XOPC Cloud is not signed in. Install the \"Composio API Key\" connector first or sign in to XOPC Cloud.");
|
|
24
24
|
}
|
|
25
25
|
function stableHash(value) {
|
|
26
26
|
return createHash("sha256").update(value).digest("hex").slice(0, 24);
|
|
@@ -91,7 +91,11 @@ var ComposioSessionsAdapter = class {
|
|
|
91
91
|
}
|
|
92
92
|
const resolver = options.resolver ?? new CredentialResolver();
|
|
93
93
|
this.createClient = async () => {
|
|
94
|
-
const apiKey = await
|
|
94
|
+
const apiKey = await resolveComposioApiKey(resolver);
|
|
95
|
+
if (!apiKey) {
|
|
96
|
+
const { ManagedComposioClient } = await import("./composio-managed-client.js");
|
|
97
|
+
return new ManagedComposioClient();
|
|
98
|
+
}
|
|
95
99
|
let Composio;
|
|
96
100
|
let PiProvider;
|
|
97
101
|
try {
|
|
@@ -99,7 +103,7 @@ var ComposioSessionsAdapter = class {
|
|
|
99
103
|
} catch (cause) {
|
|
100
104
|
throw new Error("The xopc installation is missing the bundled Composio runtime. Reinstall @xopcai/xopc and restart the gateway.", { cause });
|
|
101
105
|
}
|
|
102
|
-
|
|
106
|
+
const client = new Composio({
|
|
103
107
|
apiKey,
|
|
104
108
|
baseURL: process.env.XOPC_COMPOSIO_BASE_URL?.trim() || void 0,
|
|
105
109
|
allowTracking: false,
|
|
@@ -109,6 +113,8 @@ var ComposioSessionsAdapter = class {
|
|
|
109
113
|
provider: new PiProvider(),
|
|
110
114
|
host: "xopc"
|
|
111
115
|
});
|
|
116
|
+
client.mode = "byok";
|
|
117
|
+
return client;
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
120
|
async createSession(context) {
|
|
@@ -375,4 +381,4 @@ var ComposioSessionsAdapter = class {
|
|
|
375
381
|
}
|
|
376
382
|
};
|
|
377
383
|
//#endregion
|
|
378
|
-
export { ComposioSessionsAdapter,
|
|
384
|
+
export { ComposioSessionsAdapter, assertComposioAccessConfigured, createComposioPrincipalId, resolveComposioApiKey };
|
|
@@ -2,7 +2,7 @@ import { getConnectorConnection, getConnectorInstallation, listConnectorConnecti
|
|
|
2
2
|
import { getConnectorAccount, refreshConnectorAccountCurrent } from "../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
4
4
|
import { connectorIdentityKey } from "./connector-identity.js";
|
|
5
|
-
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
5
|
+
import { ComposioSessionsAdapter, assertComposioAccessConfigured } from "./composio-sessions.js";
|
|
6
6
|
import { COMPOSIO_AGENT_READY_TOOLKITS, COMPOSIO_TOOLKIT_DISPLAY_NAMES, connectorDefinitionFromComposioToolkit } from "./composio-catalog.js";
|
|
7
7
|
import { consumeConnectorSetupSecretRef } from "./setup-secrets.js";
|
|
8
8
|
//#region src/connectors/composio.ts
|
|
@@ -370,6 +370,7 @@ async function listComposioConnections(resolver = new CredentialResolver()) {
|
|
|
370
370
|
async function inspectComposioConnectorHealth(toolkit, resolver = new CredentialResolver()) {
|
|
371
371
|
const normalizedToolkit = normalizeToolkit(toolkit);
|
|
372
372
|
try {
|
|
373
|
+
await assertComposioAccessConfigured(resolver);
|
|
373
374
|
const connections = (await listComposioConnections(resolver)).filter((connection) => connection.toolkit.toLowerCase() === normalizedToolkit);
|
|
374
375
|
const byAccount = /* @__PURE__ */ new Map();
|
|
375
376
|
for (const connection of connections) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
1
3
|
import { getConnectorInstallation, listConnectorConnections } from "../storage/sqlite/connector-repository.js";
|
|
2
4
|
import "../storage/sqlite/index.js";
|
|
3
5
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
4
6
|
import { decodeConnectedSourceCursor, encodeConnectedSourceCursor } from "./connected-source-cursor.js";
|
|
5
7
|
import { scopeForComposioAction } from "./composio.js";
|
|
6
8
|
import { getConnectorDefinition } from "./catalog.js";
|
|
7
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
8
9
|
import { getConnectorInstance } from "./instances.js";
|
|
10
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
9
11
|
import { KnowledgeIngestionService } from "../knowledge/ingestion-service.js";
|
|
10
12
|
import { ConnectedKnowledgePipeline } from "../knowledge/connected-knowledge-pipeline.js";
|
|
11
13
|
import { LocalFolderKnowledgeSourceAdapter } from "../knowledge/local-folder-adapter.js";
|
|
@@ -14,6 +16,8 @@ import { normalizeConnectedSourceResult } from "./connected-source-normalizers.j
|
|
|
14
16
|
import { sanitizeConnectedSourceValue } from "./connected-source-sanitization.js";
|
|
15
17
|
import { createHash } from "node:crypto";
|
|
16
18
|
//#region src/connectors/connected-source-ingestion.ts
|
|
19
|
+
init_logger();
|
|
20
|
+
const log = createLogger("ConnectedSourceIngestion");
|
|
17
21
|
const COMPOSIO_CONNECTED_SOURCE_TOOLKITS = new Set([
|
|
18
22
|
"gmail",
|
|
19
23
|
"googlecalendar",
|
|
@@ -99,6 +103,17 @@ function paginationValue(result, ...keys) {
|
|
|
99
103
|
if (typeof value === "string" && value.trim()) return value.trim();
|
|
100
104
|
}
|
|
101
105
|
}
|
|
106
|
+
function isPayloadTooLargeError(error) {
|
|
107
|
+
const details = asRecord(error);
|
|
108
|
+
const status = details?.status ?? details?.statusCode;
|
|
109
|
+
const code = details?.code;
|
|
110
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
111
|
+
return String(status) === "413" || String(code) === "4345" || /\b413\b|ToolRouterV2_PayloadTooLarge|payload is too large/i.test(message);
|
|
112
|
+
}
|
|
113
|
+
function maxResultsValue(args) {
|
|
114
|
+
const value = args.max_results;
|
|
115
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
116
|
+
}
|
|
102
117
|
function resultToSourceItems(input) {
|
|
103
118
|
return normalizeConnectedSourceResult(input).slice(0, 200).map((entity) => {
|
|
104
119
|
const record = entity.value;
|
|
@@ -142,6 +157,7 @@ function resultToSourceItems(input) {
|
|
|
142
157
|
}
|
|
143
158
|
var ComposioKnowledgeSourceAdapter = class {
|
|
144
159
|
kind = "composio";
|
|
160
|
+
adaptiveMaxResults;
|
|
145
161
|
constructor(input) {
|
|
146
162
|
this.input = input;
|
|
147
163
|
}
|
|
@@ -149,32 +165,58 @@ var ComposioKnowledgeSourceAdapter = class {
|
|
|
149
165
|
const cursor = decodeConnectedSourceCursor(pull.cursor);
|
|
150
166
|
const scanStartedAt = cursor?.scanStartedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
151
167
|
const warnings = pull.cursor && !cursor ? ["Stored connected-source cursor was invalid and was replaced."] : [];
|
|
152
|
-
const execute = (cursorValue) =>
|
|
153
|
-
|
|
154
|
-
principalId: "local-owner",
|
|
155
|
-
toolkits: [this.input.toolkit]
|
|
156
|
-
},
|
|
157
|
-
installation: {
|
|
158
|
-
...this.input.installation,
|
|
159
|
-
maxScope: "read",
|
|
160
|
-
confirmationPolicy: "never"
|
|
161
|
-
},
|
|
162
|
-
connection: this.input.connection,
|
|
163
|
-
agentId: this.input.agentId,
|
|
164
|
-
action: {
|
|
165
|
-
connectorId: this.input.connectorId,
|
|
166
|
-
actionId: this.input.actionId,
|
|
167
|
-
toolkit: this.input.toolkit,
|
|
168
|
-
scope: "read",
|
|
169
|
-
curated: true,
|
|
170
|
-
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
171
|
-
},
|
|
172
|
-
args: this.input.buildArguments?.({
|
|
168
|
+
const execute = async (cursorValue) => {
|
|
169
|
+
const configuredArgs = this.input.buildArguments?.({
|
|
173
170
|
...pull,
|
|
174
171
|
cursor: cursorValue
|
|
175
|
-
}) ?? this.input.arguments
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
}) ?? this.input.arguments;
|
|
173
|
+
const configuredMaxResults = maxResultsValue(configuredArgs);
|
|
174
|
+
let args = this.adaptiveMaxResults && configuredMaxResults && configuredMaxResults > this.adaptiveMaxResults ? {
|
|
175
|
+
...configuredArgs,
|
|
176
|
+
max_results: this.adaptiveMaxResults
|
|
177
|
+
} : configuredArgs;
|
|
178
|
+
for (;;) try {
|
|
179
|
+
return await this.input.adapter.executeWithPolicy({
|
|
180
|
+
context: {
|
|
181
|
+
principalId: "local-owner",
|
|
182
|
+
toolkits: [this.input.toolkit]
|
|
183
|
+
},
|
|
184
|
+
installation: {
|
|
185
|
+
...this.input.installation,
|
|
186
|
+
maxScope: "read",
|
|
187
|
+
confirmationPolicy: "never"
|
|
188
|
+
},
|
|
189
|
+
connection: this.input.connection,
|
|
190
|
+
agentId: this.input.agentId,
|
|
191
|
+
action: {
|
|
192
|
+
connectorId: this.input.connectorId,
|
|
193
|
+
actionId: this.input.actionId,
|
|
194
|
+
toolkit: this.input.toolkit,
|
|
195
|
+
scope: "read",
|
|
196
|
+
curated: true,
|
|
197
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
198
|
+
},
|
|
199
|
+
args,
|
|
200
|
+
confirmed: true
|
|
201
|
+
});
|
|
202
|
+
} catch (error) {
|
|
203
|
+
const currentMaxResults = maxResultsValue(args);
|
|
204
|
+
if (!isPayloadTooLargeError(error) || !currentMaxResults || currentMaxResults <= 1) throw error;
|
|
205
|
+
const reducedMaxResults = Math.max(1, Math.floor(currentMaxResults / 2));
|
|
206
|
+
this.adaptiveMaxResults = reducedMaxResults;
|
|
207
|
+
log.info({
|
|
208
|
+
connectorId: this.input.connectorId,
|
|
209
|
+
actionId: this.input.actionId,
|
|
210
|
+
previousMaxResults: currentMaxResults,
|
|
211
|
+
maxResults: reducedMaxResults,
|
|
212
|
+
phase: "payload_too_large_retry"
|
|
213
|
+
}, `Retrying connector action with page size ${reducedMaxResults}`);
|
|
214
|
+
args = {
|
|
215
|
+
...args,
|
|
216
|
+
max_results: reducedMaxResults
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
};
|
|
178
220
|
let execution;
|
|
179
221
|
try {
|
|
180
222
|
execution = await execute(pull.cursor);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
2
1
|
import { materializeConnectorMcpServer } from "./materialize.js";
|
|
3
2
|
import { getConnectorInstance } from "./instances.js";
|
|
3
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
4
4
|
import { listBundleMcpServerCapabilitiesForGateway } from "../agent/mcp/bundle-mcp-gateway.js";
|
|
5
5
|
//#region src/connectors/health.ts
|
|
6
6
|
function classifyConnectorHealthError(error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
2
|
import { deleteConnectorInstallation, getConnectorInstallation, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
3
3
|
import "../storage/sqlite/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { assertComposioAccessConfigured } from "./composio-sessions.js";
|
|
5
5
|
import { saveComposioApiKey } from "./composio.js";
|
|
6
6
|
import { saveConnectorSecrets } from "./secret-store.js";
|
|
7
7
|
import { isManagedConnectorServer, materializeConnectorMcpServer } from "./materialize.js";
|
|
@@ -106,7 +106,7 @@ registerConnectorRuntimeAdapter({
|
|
|
106
106
|
async install({ config, definition, input, resolver }) {
|
|
107
107
|
if (definition.runtime.type !== "composio") throw new Error(`Invalid Composio connector definition: ${definition.id}`);
|
|
108
108
|
if (definition.runtime.role === "credential") await saveComposioApiKey(input, resolver);
|
|
109
|
-
if (definition.runtime.role === "toolkit") await
|
|
109
|
+
if (definition.runtime.role === "toolkit") await assertComposioAccessConfigured(resolver);
|
|
110
110
|
const instance = installRecord(config, definition, definition.runtime.role === "toolkit" ? { scope: "read" } : {}, definition.runtime.role === "toolkit" ? { config: input.config ?? {} } : {});
|
|
111
111
|
if (definition.runtime.role === "toolkit" && isXopcDatabaseOpen()) {
|
|
112
112
|
const installationId = `${definition.id}-local-owner`;
|
|
@@ -6,7 +6,7 @@ import { isSTTAvailable } from "../voice/stt/availability.js";
|
|
|
6
6
|
import { mergeSttConfigFromAppConfig } from "../voice/stt/config.js";
|
|
7
7
|
import "../voice/stt/index.js";
|
|
8
8
|
import { getDiscussionCapture, listDiscussionCaptures, listDiscussionTranscriptSegments, updateDiscussionCapture } from "./repository.js";
|
|
9
|
-
import {
|
|
9
|
+
import { appendSequentialTranscript, assembleDiscussionTranscript } from "./transcript.js";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
//#region src/discussions/sealer.ts
|
|
12
12
|
init_logger();
|
|
@@ -96,7 +96,7 @@ var DiscussionSealer = class {
|
|
|
96
96
|
mime: "audio/wav",
|
|
97
97
|
fileName: `discussion-recovery-${index}.wav`
|
|
98
98
|
});
|
|
99
|
-
text =
|
|
99
|
+
text = appendSequentialTranscript(text, result.text);
|
|
100
100
|
language ??= result.language;
|
|
101
101
|
});
|
|
102
102
|
return {
|
|
@@ -153,13 +153,16 @@ var DiscussionService = class {
|
|
|
153
153
|
uploadSegment(input) {
|
|
154
154
|
const capture = getDiscussionCapture(input.discussionId);
|
|
155
155
|
if (!capture) throw new DiscussionServiceError("not_found", "Discussion not found");
|
|
156
|
-
|
|
156
|
+
const acceptsSegments = capture.status === "recording" || capture.status === "stopping";
|
|
157
|
+
const originalRecordingSupersedesSegment = capture.audioAttachmentId && (capture.status === "sealing" || capture.status === "organizing" || capture.status === "completed");
|
|
158
|
+
if (!acceptsSegments && !originalRecordingSupersedesSegment) throw new DiscussionServiceError("conflict", "Discussion no longer accepts transcript segments");
|
|
157
159
|
if (!Number.isInteger(input.sequence) || input.sequence < 0 || input.sequence > 2e3) throw new DiscussionServiceError("invalid_input", "Invalid segment sequence");
|
|
158
160
|
if (input.file.mimeType !== "audio/wav" && input.file.mimeType !== "audio/x-wav") throw new DiscussionServiceError("invalid_input", "Live transcript segments must be WAV audio");
|
|
159
161
|
if (input.file.buffer.length === 0 || input.file.buffer.length > 2097152) throw new DiscussionServiceError("invalid_input", "Live transcript segment is empty or too large");
|
|
160
162
|
if (!Number.isFinite(input.startedAtMs) || !Number.isFinite(input.endedAtMs) || input.startedAtMs < 0 || input.endedAtMs <= input.startedAtMs || input.endedAtMs - input.startedAtMs > 25e3) throw new DiscussionServiceError("invalid_input", "Invalid live transcript segment timing");
|
|
161
163
|
const actualSha256 = createHash("sha256").update(input.file.buffer).digest("hex");
|
|
162
164
|
if (input.sha256 !== actualSha256) throw new DiscussionServiceError("invalid_input", "Segment checksum mismatch");
|
|
165
|
+
if (originalRecordingSupersedesSegment) return this.transcript(input.discussionId);
|
|
163
166
|
const existing = getDiscussionTranscriptSegment(input.discussionId, input.sequence);
|
|
164
167
|
if (existing && existing.audioSha256 !== actualSha256) throw new DiscussionServiceError("conflict", "Segment sequence already contains different audio");
|
|
165
168
|
if (!existing) {
|
|
@@ -219,7 +222,8 @@ var DiscussionService = class {
|
|
|
219
222
|
name: file.name.trim().slice(0, 200) || `discussion-${id}.webm`,
|
|
220
223
|
buffer: file.buffer,
|
|
221
224
|
mimeType: file.mimeType,
|
|
222
|
-
duration: Math.round(durationMs / 1e3)
|
|
225
|
+
duration: Math.round(durationMs / 1e3),
|
|
226
|
+
retainWithoutReference: true
|
|
223
227
|
});
|
|
224
228
|
if (!attachment) throw new DiscussionServiceError("not_found", "Discussion note not found");
|
|
225
229
|
try {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { DiscussionTranscriptSegment } from './types.js';
|
|
2
|
+
/** Joins transcripts from adjacent audio chunks that have no audio overlap. */
|
|
3
|
+
export declare function appendSequentialTranscript(existing: string, next: string): string;
|
|
2
4
|
export declare function appendTranscriptWithoutOverlap(existing: string, next: string): string;
|
|
3
5
|
export declare function assembleDiscussionTranscript(segments: DiscussionTranscriptSegment[]): string;
|
|
@@ -15,7 +15,20 @@ function searchableCharacters(value) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function joinOverlap(left, remainder) {
|
|
18
|
-
|
|
18
|
+
const next = /\p{P}$/u.test(left) ? remainder.replace(/^\p{P}+/u, "") : remainder;
|
|
19
|
+
if (!next || /^\s/u.test(next)) return `${left}${next}`.trim();
|
|
20
|
+
const leftCharacter = Array.from(left).findLast((character) => /[\p{L}\p{N}\p{S}]/u.test(character));
|
|
21
|
+
const rightCharacter = Array.from(next).find((character) => /[\p{L}\p{N}\p{S}]/u.test(character));
|
|
22
|
+
const compactScript = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;
|
|
23
|
+
return `${left}${leftCharacter && rightCharacter && !compactScript.test(leftCharacter) && !compactScript.test(rightCharacter) ? " " : ""}${next}`.trim();
|
|
24
|
+
}
|
|
25
|
+
/** Joins transcripts from adjacent audio chunks that have no audio overlap. */
|
|
26
|
+
function appendSequentialTranscript(existing, next) {
|
|
27
|
+
const left = existing.trim();
|
|
28
|
+
const right = next.trim();
|
|
29
|
+
if (!left) return right;
|
|
30
|
+
if (!right) return left;
|
|
31
|
+
return `${left}\n${right}`;
|
|
19
32
|
}
|
|
20
33
|
function appendTranscriptWithoutOverlap(existing, next) {
|
|
21
34
|
const left = existing.trim();
|
|
@@ -32,10 +45,10 @@ function appendTranscriptWithoutOverlap(existing, next) {
|
|
|
32
45
|
const sourceEnd = rightSearchable.sourceEnds[size - 1];
|
|
33
46
|
return joinOverlap(left, right.slice(sourceEnd));
|
|
34
47
|
}
|
|
35
|
-
return
|
|
48
|
+
return appendSequentialTranscript(left, right);
|
|
36
49
|
}
|
|
37
50
|
function assembleDiscussionTranscript(segments) {
|
|
38
51
|
return segments.reduce((text, segment) => appendTranscriptWithoutOverlap(text, segment.displayText ?? ""), "");
|
|
39
52
|
}
|
|
40
53
|
//#endregion
|
|
41
|
-
export { appendTranscriptWithoutOverlap, assembleDiscussionTranscript };
|
|
54
|
+
export { appendSequentialTranscript, appendTranscriptWithoutOverlap, assembleDiscussionTranscript };
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
* Supports installing from npm packages, local directories, and xopc-store zips
|
|
4
4
|
* Supports three-tier storage: workspace, global, bundled
|
|
5
5
|
*/
|
|
6
|
+
export type ValidatedNpmPackageSpec = {
|
|
7
|
+
ok: true;
|
|
8
|
+
packageName: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
14
|
+
/** Accept registry package names with an optional exact semver; reject URLs, paths, tags, and ranges. */
|
|
15
|
+
export declare function validateNpmPackageSpec(packageSpec: string): ValidatedNpmPackageSpec;
|
|
6
16
|
export interface InstallOptions {
|
|
7
17
|
source: 'npm' | 'local';
|
|
8
18
|
targetDir: string;
|