@xopcai/xopc 0.0.303 → 0.0.307
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 +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/browser-ext/dist/assets/{auth-B_9ZuGDx.js → auth-C3yV1y_l.js} +67 -22
- package/dist/browser-ext/dist/background.js +4 -4
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/xopc.extension.json +0 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -4
- package/dist/extensions/weixin/xopc.extension.json +0 -3
- package/dist/gateway/static/root/assets/{activity-store-DCi5rh4e.js → activity-store-wgSB2HYK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ch3DzUvP.js → agent-avatar-dicebear-CZeQo09T.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BPsRb9Ck.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DXHD-ST3.js → agents-BlrHMbRx.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CAV9PN9i.js → api-BKHmTb0w.js} +1 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-Bzw4fQP8.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-8GZpUXva.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BkQQtIxH.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BKGzaVvM.js → archive-plugin-CQ2NaoHb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-8bARdLnp.js → attachment-load-BFi1H7yJ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAEenyzx.js → automations-page-CDBXcii_.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CUpiTTiY.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cv3GS9Eo.js → binary-plugins-D07eWmOx.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D4ZIVQbk.css → block-editor-BdOTO0Yo.css} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUeb92LG.js → block-editor-CtVnjyYU.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BGT0xoTv.js → browser-automation-inputs-BzkJog8e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D1O22WIf.js → browser-automations-page-DyrSbDdG.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CqTxLpil.js +3 -0
- package/dist/gateway/static/root/assets/button-CS04eWY9.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BZ_-pnS6.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DAD9qE3J.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-C_icwbWj.js → channels-status-swr-B2JwuTjG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D-JYPVYl.js → chat-terminal-dock-B62SZdAo.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-Bcfp948A.js → computer-settings-page-ClSresNq.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-CPqVmNvx.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BUQyg3CW.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CTMi_tql.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-B71AJK50.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-UtoUm57Q.js → dependency-picker-DlyGK-kA.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bryx7gRM.js → desktop-pet-DGkbTE8_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BY8r9j66.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DzRrgd59.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DQlFTVBx.js → extension-debug-page-L8Mm1n3A.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BSsqRDXh.js → extension-page-CFc4vSNU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DbVZv9ve.js → extension-settings-page-B5zWyHr3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D5AM8cyQ.js → gateway-config-swr-B6wHa6ZI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-B53R0CA4.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D7qmTH4R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSJWdnFs.js → gateway-startup-retry-DRzGnEV-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cxowc29b.js → heartbeat-settings-Glsl3X5b.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-s9hDQ8Hc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BNh604hw.js → image-generation-api-Ck_pyDom.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-ByBX7ome.js +1 -0
- package/dist/gateway/static/root/assets/index-RBCkv8a_.js +79 -0
- package/dist/gateway/static/root/assets/index-cFU4S35z.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-C45RlO8a.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-DP0x2jpR.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXPaPDGm.js → local-apps-page-C_AQc2bI.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DLK05Y1a.js → locale-store-msTfRK8P.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DvM8Pyok.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-D1uwSutV.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-B8maDRWh.js → markdown-view-BInabSKf.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-tSJ0CvcX.js → media-plugins-C4mhf13f.js} +1 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-D35sErp2.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-8jCDklDn.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CQx6H-GS.js → page-tabs-1go_BtX1.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-DldSX8GX.js → popover-select-9i-ZtHXL.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-A3-bVtdy.js → preview-open-alternatives-DmoSC0j1.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-D46cR3sf.js → proactive-page-xAjKTIID.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CujZXOea.js → product-open-page-gmi5LLwM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BUMQHy_N.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DT-Mt7XR.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BMFL4vis.js → registry-api-BSWtko7U.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Clz3byir.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CR0qvq9C.js → runtime-tools-settings-panel-ClkOoxDl.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BUD9lLEE.js → schema-form-BuEmLiaU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-tQRwktKm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqWg9XS5.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BZPCUH6a.js → settings-form-section-Dor39QON.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-XoHmqIdm.js → settings-page-Xj-yvIc8.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BB_sMB7P.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BFWZoXdm.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-oDALm4b6.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DmwelnfK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BE9JXz4U.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CH-quGxZ.js → skills-page.utils-Ii8qeXhs.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CGC7eBso.js → system-settings-panel-Di6OSO-0.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D1AWszc7.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-1SZ-HFHX.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DDOlOYlj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BydB6x2K.js → use-autosave-CQ8uWNnB.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-C00i4ea0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CPUDBcag.js → voice-api-key-field-COTzshjL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-bZqN8-UF.js → voice-config-api-DgJML_uM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D_FmJbGH.js → work-discovery-overlay-_URrXbi4.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CALs-1nd.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BUiBjz6m.js +6 -0
- package/dist/gateway/static/root/channel-icons/feishu.svg +6 -12
- package/dist/gateway/static/root/connector-icons/SOURCES.md +12 -0
- package/dist/gateway/static/root/connector-icons/dingtalk-mark.svg +1 -0
- package/dist/gateway/static/root/connector-icons/tencent-meeting-mark.svg +37 -0
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-docs.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +7 -0
- package/dist/gateway/static/root/index.html +14 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +100 -7
- package/dist/packages/gateway-contract/src/gateway-scopes.js +53 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/realtime-client/src/index.js +14 -2
- package/dist/packages/realtime-protocol/src/index.js +18 -14
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +40 -12
- package/dist/src/agent/agent-scope.d.ts +4 -1
- package/dist/src/agent/agent-scope.js +19 -3
- package/dist/src/agent/commands/command-isolation.js +11 -9
- package/dist/src/agent/commands/command-registry.js +18 -33
- package/dist/src/agent/context/audit.js +12 -2
- package/dist/src/agent/context/coordinator.d.ts +13 -3
- package/dist/src/agent/context/coordinator.js +27 -11
- package/dist/src/agent/context/execution-context.js +42 -22
- package/dist/src/agent/context/execution-context.types.d.ts +4 -2
- package/dist/src/agent/context/execution-scope.d.ts +2 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.d.ts +2 -2
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +7 -1
- package/dist/src/agent/external-tools/composio-provider.js +83 -20
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +2 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -3
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +5 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/create-memory-manager.js +1 -0
- package/dist/src/agent/memory/manager.d.ts +6 -0
- package/dist/src/agent/memory/manager.js +74 -39
- package/dist/src/agent/memory/runtime.d.ts +3 -3
- package/dist/src/agent/memory/runtime.js +11 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -1
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/service/build-direct-message-content.d.ts +1 -0
- package/dist/src/agent/service/build-direct-message-content.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.js +3 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.d.ts +0 -4
- package/dist/src/agent/service/webchat-tts.js +20 -19
- package/dist/src/agent/tools/factory.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -2
- package/dist/src/agent/tools/knowledge-memory-tool.js +7 -7
- package/dist/src/browser/native-messaging-host.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +22 -9
- package/dist/src/cli/commands/agent.js +2 -0
- package/dist/src/cli/commands/config.js +8 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +69 -44
- package/dist/src/cli/commands/extension-pack.js +0 -2
- package/dist/src/cli/commands/extension.js +4 -25
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard/gateway.js +2 -1
- package/dist/src/cli/utils/init-workspace-core.js +5 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.d.ts +1 -0
- package/dist/src/config/loader.js +14 -1
- package/dist/src/config/schema.d.ts +22 -3
- package/dist/src/config/schema.js +13 -3
- package/dist/src/connectors/account-access.d.ts +4 -0
- package/dist/src/connectors/account-access.js +23 -0
- package/dist/src/connectors/approval-resume.d.ts +4 -0
- package/dist/src/connectors/approval-resume.js +23 -0
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -0
- package/dist/src/connectors/auth-provider-registry.js +2 -1
- package/dist/src/connectors/authorization-attempts.d.ts +21 -0
- package/dist/src/connectors/authorization-attempts.js +33 -0
- package/dist/src/connectors/builtin-catalog.js +1 -3
- package/dist/src/connectors/catalog.js +2 -1
- package/dist/src/connectors/china-catalog.d.ts +2 -0
- package/dist/src/connectors/china-catalog.js +430 -0
- package/dist/src/connectors/composio-backends.d.ts +26 -0
- package/dist/src/connectors/composio-backends.js +65 -0
- package/dist/src/connectors/composio-catalog.js +2 -1
- package/dist/src/connectors/composio-managed-client.js +3 -1
- package/dist/src/connectors/composio-managed-events.js +5 -2
- package/dist/src/connectors/composio-session-types.d.ts +2 -0
- package/dist/src/connectors/composio-sessions.d.ts +11 -2
- package/dist/src/connectors/composio-sessions.js +137 -35
- package/dist/src/connectors/composio-triggers.js +4 -2
- package/dist/src/connectors/composio.d.ts +11 -8
- package/dist/src/connectors/composio.js +68 -84
- package/dist/src/connectors/connected-source-ingestion.js +4 -3
- package/dist/src/connectors/connection-recovery-service.js +25 -13
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +18 -5
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/instances.js +1 -7
- package/dist/src/connectors/learning-coordinator.js +4 -3
- package/dist/src/connectors/materialize.js +14 -1
- package/dist/src/connectors/policy.d.ts +1 -1
- package/dist/src/connectors/policy.js +1 -1
- package/dist/src/connectors/principal.js +24 -3
- package/dist/src/connectors/providers.d.ts +1 -0
- package/dist/src/connectors/providers.js +14 -2
- package/dist/src/connectors/runtime-adapter-registry.js +4 -9
- package/dist/src/connectors/secret-store.d.ts +4 -1
- package/dist/src/connectors/secret-store.js +7 -3
- package/dist/src/connectors/source-change-publisher.js +4 -2
- package/dist/src/connectors/types.d.ts +16 -11
- package/dist/src/connectors/workflow-preflight.d.ts +2 -1
- package/dist/src/connectors/workflow-preflight.js +20 -3
- package/dist/src/execution-environments/local-worktree-manager.js +17 -15
- package/dist/src/execution-environments/store.js +4 -2
- package/dist/src/execution-environments/types.d.ts +3 -0
- package/dist/src/execution-environments/types.js +2 -1
- package/dist/src/execution-environments/worktree-safety.d.ts +8 -0
- package/dist/src/execution-environments/worktree-safety.js +43 -0
- package/dist/src/extensions/activation-planner.d.ts +1 -1
- package/dist/src/extensions/activation-planner.js +1 -1
- package/dist/src/extensions/api-version.d.ts +4 -0
- package/dist/src/extensions/api-version.js +15 -0
- package/dist/src/extensions/api.d.ts +3 -9
- package/dist/src/extensions/api.js +26 -32
- package/dist/src/extensions/config-validation.d.ts +8 -0
- package/dist/src/extensions/config-validation.js +25 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +20 -9
- package/dist/src/extensions/extension-registry-impl.js +79 -11
- package/dist/src/extensions/hooks.d.ts +1 -1
- package/dist/src/extensions/index.d.ts +2 -1
- package/dist/src/extensions/install-transaction.d.ts +2 -0
- package/dist/src/extensions/install-transaction.js +32 -21
- package/dist/src/extensions/install.js +18 -1
- package/dist/src/extensions/loader.d.ts +5 -5
- package/dist/src/extensions/loader.js +109 -47
- package/dist/src/extensions/lockfile.d.ts +3 -5
- package/dist/src/extensions/lockfile.js +41 -14
- package/dist/src/extensions/normalize-manifest.js +6 -60
- package/dist/src/extensions/sdk/index.d.ts +3 -2
- package/dist/src/extensions/sdk/index.js +2 -2
- package/dist/src/extensions/sdk/testing.js +0 -4
- package/dist/src/extensions/security.js +5 -7
- package/dist/src/extensions/types/core.d.ts +0 -5
- package/dist/src/extensions/types/index.d.ts +1 -1
- package/dist/src/extensions/types/manifest.d.ts +1 -25
- package/dist/src/extensions/types/providers.d.ts +1 -1
- package/dist/src/extensions/types/registration.d.ts +0 -12
- package/dist/src/extensions/update.js +71 -30
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +47 -10
- package/dist/src/gateway/hono/routes/connectors.js +208 -17
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +10 -7
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
- package/dist/src/gateway/hono/routes/extension-gateway.js +0 -33
- package/dist/src/gateway/hono/routes/home.js +4 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/realtime.js +30 -8
- package/dist/src/gateway/hono/routes/user-model.js +25 -6
- package/dist/src/gateway/index.js +4 -1
- package/dist/src/gateway/lock.d.ts +2 -0
- package/dist/src/gateway/lock.js +31 -14
- package/dist/src/gateway/run-loop.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.d.ts +2 -5
- package/dist/src/gateway/security/gateway-scopes.js +3 -45
- package/dist/src/gateway/security/index.js +2 -1
- package/dist/src/gateway/service.js +11 -7
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/imports/importService.d.ts +1 -1
- package/dist/src/imports/inventory.js +16 -2
- package/dist/src/imports/productImport.js +5 -5
- package/dist/src/imports/types.d.ts +3 -3
- package/dist/src/infra/exec.d.ts +2 -2
- package/dist/src/infra/exec.js +32 -27
- package/dist/src/infra/run-command.js +15 -50
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +13 -3
- package/dist/src/knowledge-memory/domain.d.ts +17 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +26 -4
- package/dist/src/knowledge-memory/repository.js +171 -36
- package/dist/src/mcp/channel-bridge.js +7 -3
- package/dist/src/media-understanding/registry.js +6 -1
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +2 -0
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +48 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/proactive/follow-ups.js +2 -1
- package/dist/src/process/bounded-output.d.ts +10 -0
- package/dist/src/process/bounded-output.js +41 -0
- package/dist/src/process/kill-tree.d.ts +6 -17
- package/dist/src/process/kill-tree.js +43 -75
- package/dist/src/process/process-spec.d.ts +39 -0
- package/dist/src/process/process-spec.js +13 -0
- package/dist/src/process/run-process.d.ts +4 -0
- package/dist/src/process/run-process.js +97 -0
- package/dist/src/providers/plugin-registry.d.ts +1 -1
- package/dist/src/providers/plugin-registry.js +6 -0
- package/dist/src/realtime/runtime.js +3 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +63 -2
- package/dist/src/storage/sqlite/connector-account-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +35 -7
- package/dist/src/storage/sqlite/connector-repository.js +15 -10
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +1 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +7 -0
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +12 -0
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +92 -0
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +20 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +7 -7
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/transcript-repository.js +36 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tui/backends/embedded-backend.d.ts +24 -8
- package/dist/src/tui/backends/embedded-backend.js +114 -10
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +18 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +31 -4
- package/dist/src/tui/components/assistant-message.d.ts +4 -1
- package/dist/src/tui/components/assistant-message.js +10 -2
- package/dist/src/tui/components/cell-render-mode.d.ts +4 -0
- package/dist/src/tui/components/cell-render-mode.js +1 -0
- package/dist/src/tui/components/chat-log.d.ts +17 -4
- package/dist/src/tui/components/chat-log.js +68 -50
- package/dist/src/tui/components/custom-editor.d.ts +2 -2
- package/dist/src/tui/components/custom-editor.js +5 -1
- package/dist/src/tui/components/pending-input-preview.d.ts +9 -0
- package/dist/src/tui/components/pending-input-preview.js +33 -0
- package/dist/src/tui/components/semantic-cell.d.ts +17 -0
- package/dist/src/tui/components/semantic-cell.js +29 -0
- package/dist/src/tui/components/tool-execution.d.ts +5 -1
- package/dist/src/tui/components/tool-execution.js +33 -10
- package/dist/src/tui/components/transcript-overlay.d.ts +29 -0
- package/dist/src/tui/components/transcript-overlay.js +114 -0
- package/dist/src/tui/components/tui-bottom-bar.js +3 -1
- package/dist/src/tui/components/user-message.d.ts +5 -1
- package/dist/src/tui/components/user-message.js +12 -1
- package/dist/src/tui/extension-host/load-extensions.d.ts +1 -1
- package/dist/src/tui/extension-host/runtime-context.js +2 -1
- package/dist/src/tui/extension-host/runtime.d.ts +1 -1
- package/dist/src/tui/format-tui-hotkeys.js +8 -1
- package/dist/src/tui/tui-agent-events.js +31 -0
- package/dist/src/tui/tui-backend.d.ts +23 -11
- package/dist/src/tui/tui-backend.js +1 -9
- package/dist/src/tui/tui-chat-input-state.d.ts +25 -0
- package/dist/src/tui/tui-chat-input-state.js +36 -0
- package/dist/src/tui/tui-command-formatters.js +2 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -1
- package/dist/src/tui/tui-types.js +2 -1
- package/dist/src/tui/tui.js +122 -30
- package/dist/src/tui/xopc-tui-keybindings.d.ts +23 -3
- package/dist/src/tui/xopc-tui-keybindings.js +22 -2
- package/dist/src/user-context/access-policy.d.ts +2 -2
- package/dist/src/user-context/access-policy.js +10 -2
- package/dist/src/user-context/config.d.ts +23 -6
- package/dist/src/user-context/config.js +54 -7
- package/dist/src/voice/platform-streams.js +11 -1
- package/dist/src/voice/realtime/omniEngine.js +13 -1
- package/dist/src/voice/realtime/runtime.js +2 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/speech-registry.js +6 -1
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/domain/validation.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +14 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +0 -1
- package/dist/gateway/static/root/assets/api-fPapljyb.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-izNAyDhW.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-5vTl4x0h.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +0 -3
- package/dist/gateway/static/root/assets/button-CGlRPNzi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CFBS3Yqy.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DI1c3BMz.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-BJMBFKCh.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BFRIn5y9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CLkumXdN.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DXNfRmk9.js +0 -1
- package/dist/gateway/static/root/assets/index-BLRIcVQa.css +0 -1
- package/dist/gateway/static/root/assets/index-gheM453N.js +0 -79
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BDg1-fcw.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-COa3PhMs.js +0 -1
- package/dist/gateway/static/root/assets/messages-C9h8SImu.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-mmX0SavY.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D8fQF1jZ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BgHqwTuT.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BAwF4LpS.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-1lZ_btki.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +0 -6
- package/dist/src/extensions/when-context.d.ts +0 -6
- package/dist/src/extensions/when-context.js +0 -26
- package/dist/src/extensions/when-expression.d.ts +0 -11
- package/dist/src/extensions/when-expression.js +0 -213
|
@@ -71,6 +71,7 @@ var AgentOrchestrator = class {
|
|
|
71
71
|
await this.sessionHydrator.model(conversationId);
|
|
72
72
|
const channelSystemPrompt = typeof context.metadata?.channelSystemPrompt === "string" ? context.metadata.channelSystemPrompt.trim() : "";
|
|
73
73
|
if (channelSystemPrompt) {
|
|
74
|
+
await this.agentManager.ensureMemoryReadyForSession?.(conversationId);
|
|
74
75
|
this.agentManager.getOrCreateAgent(conversationId);
|
|
75
76
|
this.agentManager.applyTurnChannelSystemPrompt(conversationId, channelSystemPrompt);
|
|
76
77
|
}
|
|
@@ -90,7 +91,8 @@ var AgentOrchestrator = class {
|
|
|
90
91
|
setPendingTranscriptUserMessage(conversationId, userMessage);
|
|
91
92
|
const userPlainForMemory = extractAgentUserPlainText(userMessage);
|
|
92
93
|
const turnId = randomUUID();
|
|
93
|
-
const
|
|
94
|
+
const userContext = await this.agentManager.prepareUserTurnContext(userMessage, conversationId, turnId);
|
|
95
|
+
const userMessageForModel = userMessage;
|
|
94
96
|
const llmTurn = await hydrateUserTurnForLlm({
|
|
95
97
|
message: userMessage,
|
|
96
98
|
modelRef
|
|
@@ -101,6 +103,7 @@ var AgentOrchestrator = class {
|
|
|
101
103
|
conversationId,
|
|
102
104
|
runId: turnId,
|
|
103
105
|
userMessage: userMessageForModel,
|
|
106
|
+
dynamicSystemContext: userContext.dynamicSystemContext,
|
|
104
107
|
llmImages: llmTurn.images,
|
|
105
108
|
sessionStore: this.sessionStore,
|
|
106
109
|
agentManager: this.agentManager,
|
|
@@ -24,3 +24,5 @@ export declare function splitPromptCacheBoundary(text: string): {
|
|
|
24
24
|
export declare function normalizePromptSection(text: string): string;
|
|
25
25
|
/** Add stable content immediately before the cache boundary. */
|
|
26
26
|
export declare function appendStablePromptSection(systemPrompt: string, section: string): string;
|
|
27
|
+
/** Add per-turn context after the cache boundary so the stable prefix remains reusable. */
|
|
28
|
+
export declare function appendDynamicPromptSection(systemPrompt: string, section: string): string;
|
|
@@ -40,5 +40,14 @@ function appendStablePromptSection(systemPrompt, section) {
|
|
|
40
40
|
const stablePrefix = [split.stablePrefix, normalizedSection].filter(Boolean).join("\n\n");
|
|
41
41
|
return split.dynamicSuffix ? `${stablePrefix}${PROMPT_CACHE_BOUNDARY}${split.dynamicSuffix}` : `${stablePrefix}${PROMPT_CACHE_BOUNDARY}`;
|
|
42
42
|
}
|
|
43
|
+
/** Add per-turn context after the cache boundary so the stable prefix remains reusable. */
|
|
44
|
+
function appendDynamicPromptSection(systemPrompt, section) {
|
|
45
|
+
const normalizedSection = normalizePromptSection(section);
|
|
46
|
+
if (!normalizedSection) return systemPrompt;
|
|
47
|
+
const split = splitPromptCacheBoundary(systemPrompt);
|
|
48
|
+
if (!split) return `${normalizePromptSection(systemPrompt)}${PROMPT_CACHE_BOUNDARY}${normalizedSection}`;
|
|
49
|
+
const dynamicSuffix = [split.dynamicSuffix, normalizedSection].filter(Boolean).join("\n\n");
|
|
50
|
+
return `${split.stablePrefix}${PROMPT_CACHE_BOUNDARY}${dynamicSuffix}`;
|
|
51
|
+
}
|
|
43
52
|
//#endregion
|
|
44
|
-
export { PROMPT_CACHE_BOUNDARY, appendStablePromptSection, normalizePromptSection, splitPromptCacheBoundary, stripPromptCacheBoundary };
|
|
53
|
+
export { PROMPT_CACHE_BOUNDARY, appendDynamicPromptSection, appendStablePromptSection, normalizePromptSection, splitPromptCacheBoundary, stripPromptCacheBoundary };
|
|
@@ -11,4 +11,5 @@ export declare function buildDirectUserMessageContent(opts: {
|
|
|
11
11
|
config: Config;
|
|
12
12
|
agentManager: AgentInstanceGateway;
|
|
13
13
|
modelManager: ModelManager;
|
|
14
|
+
suppressMediaPromptUris?: ReadonlySet<string>;
|
|
14
15
|
}): Promise<import("../inbound/attachment-pipeline.js").TranscriptUserMessage>;
|
|
@@ -13,7 +13,8 @@ async function buildDirectUserMessageContent(opts) {
|
|
|
13
13
|
conversationId: sk,
|
|
14
14
|
modelRef: modelRef || getDefaultModelSync(opts.config),
|
|
15
15
|
config: opts.config,
|
|
16
|
-
agentManager: opts.agentManager
|
|
16
|
+
agentManager: opts.agentManager,
|
|
17
|
+
suppressMediaPromptUris: opts.suppressMediaPromptUris
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
//#endregion
|
|
@@ -3,7 +3,6 @@ import { getConnectionResumeInput, init_connection_wait_repository } from "../..
|
|
|
3
3
|
import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
|
|
4
4
|
import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
|
|
5
5
|
import { buildTaskExecutionDirective } from "../../tasks/task-context-assembler.js";
|
|
6
|
-
import { prependAgentContext } from "../context/prepend.js";
|
|
7
6
|
import { extractAgentUserPlainText } from "../memory/user-message-text.js";
|
|
8
7
|
import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
|
|
9
8
|
import { parseSlashCommand } from "../../chat-commands/command-parse.js";
|
|
@@ -11,6 +10,7 @@ import { commandRegistry } from "../../chat-commands/registry.js";
|
|
|
11
10
|
import "../../chat-commands/index.js";
|
|
12
11
|
import { runEmbeddedTurnForSession } from "../embedded/run-for-session.js";
|
|
13
12
|
import { injectSourceContextsIntoUserMessage } from "../source-context/injector.js";
|
|
13
|
+
import { prependAgentContext } from "../context/prepend.js";
|
|
14
14
|
import crypto from "node:crypto";
|
|
15
15
|
//#region src/agent/service/direct-turn-helpers.ts
|
|
16
16
|
/**
|
|
@@ -101,7 +101,7 @@ async function runDirectAgentTurn(deps, input) {
|
|
|
101
101
|
const userPlain = extractAgentUserPlainText(input.userMessage);
|
|
102
102
|
const userContext = await deps.agentManager.prepareUserTurnContext(input.userMessage, input.conversationId, turnId);
|
|
103
103
|
const sourceContexts = input.sourceContexts ?? [];
|
|
104
|
-
const userMessageForModel = prependAgentContext(injectSourceContextsIntoUserMessage(
|
|
104
|
+
const userMessageForModel = prependAgentContext(injectSourceContextsIntoUserMessage(input.userMessage, sourceContexts), buildTaskExecutionDirective(input.conversationId));
|
|
105
105
|
const modelRef = deps.modelManager.getModelForSession(input.conversationId);
|
|
106
106
|
const llmTurn = await hydrateUserTurnForLlm({
|
|
107
107
|
message: input.userMessage,
|
|
@@ -114,6 +114,7 @@ async function runDirectAgentTurn(deps, input) {
|
|
|
114
114
|
conversationId: input.conversationId,
|
|
115
115
|
runId: turnId,
|
|
116
116
|
userMessage: userMessageForModel,
|
|
117
|
+
dynamicSystemContext: userContext.dynamicSystemContext,
|
|
117
118
|
llmImages,
|
|
118
119
|
presentation: input.presentation,
|
|
119
120
|
sessionStore: deps.sessionStore,
|
|
@@ -36,7 +36,9 @@ export interface ProcessDirectStreamingDeps {
|
|
|
36
36
|
sessionConfigStore: SessionConfigStore;
|
|
37
37
|
commandHandler: Pick<CommandHandler, 'executeCommandAndAggregateReply'>;
|
|
38
38
|
prepareInboundAttachments: (conversationId: string, attachments?: DirectStreamInboundAttachment[]) => Promise<MediaRef[] | undefined>;
|
|
39
|
-
buildTranscriptUserMessage: (content: string, prepared: MediaRef[] | undefined, conversationId: string
|
|
39
|
+
buildTranscriptUserMessage: (content: string, prepared: MediaRef[] | undefined, conversationId: string, options?: {
|
|
40
|
+
suppressMediaPromptUris?: ReadonlySet<string>;
|
|
41
|
+
}) => Promise<TranscriptUserMessage>;
|
|
40
42
|
recordTaskReviewStreamHint?: (conversationId: string, task: {
|
|
41
43
|
skipTaskReview: boolean;
|
|
42
44
|
}) => void;
|
|
@@ -11,7 +11,7 @@ import { initSessionTurn } from "../../session/init-session-turn.js";
|
|
|
11
11
|
import "../../session/index.js";
|
|
12
12
|
import { mergeSttConfigFromAppConfig } from "../../voice/stt/config.js";
|
|
13
13
|
import "../../voice/stt/index.js";
|
|
14
|
-
import { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText } from "../../channels/attachments/voice-stt-webchat.js";
|
|
14
|
+
import { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText, requestsOriginalVoiceInspection } from "../../channels/attachments/voice-stt-webchat.js";
|
|
15
15
|
import { applyReasoningVisibility } from "../streaming/reasoning-visibility.js";
|
|
16
16
|
import { isSessionSourceBinding, summarizeSourceContext } from "../source-context/types.js";
|
|
17
17
|
import { injectSourceContextsIntoUserMessage } from "../source-context/injector.js";
|
|
@@ -207,6 +207,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
207
207
|
const voiceMerge = await mergeVoiceTranscriptsIntoUserText(prepared, turnBody, sttCfg);
|
|
208
208
|
mergedUserText = voiceMerge.text;
|
|
209
209
|
inboundVoice = voiceMerge.inboundVoice;
|
|
210
|
+
const suppressMediaPromptUris = requestsOriginalVoiceInspection(mergedUserText) ? void 0 : new Set(voiceMerge.transcribedMediaUris ?? []);
|
|
210
211
|
if (inboundVoice) {
|
|
211
212
|
const transcriptParts = [voiceMerge.voiceTranscripts.filter(Boolean).join("\n"), turnBody.trim()].filter(Boolean);
|
|
212
213
|
const voiceMedia = (prepared ?? []).filter(isVoiceLikeAttachment).map((att) => ({
|
|
@@ -275,7 +276,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
275
276
|
}
|
|
276
277
|
const skillTurn = deps.agentManager.prepareSkillTurn(conversationId, mergedUserText);
|
|
277
278
|
const textForAgent = skillTurn.text;
|
|
278
|
-
const userMessage = await deps.buildTranscriptUserMessage(textForAgent, prepared, conversationId);
|
|
279
|
+
const userMessage = await deps.buildTranscriptUserMessage(textForAgent, prepared, conversationId, { suppressMediaPromptUris });
|
|
279
280
|
const sourceContexts = [...input.sourceContexts ?? []];
|
|
280
281
|
if (deps.sourceContextResolver) {
|
|
281
282
|
const metadata = await deps.sessionStore.getMetadata(conversationId).catch(() => null);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { Config } from '../../config/schema.js';
|
|
2
|
-
import type { MediaRef } from '../../media/types.js';
|
|
3
|
-
import type { SessionStore } from '../../session/index.js';
|
|
4
2
|
export type WebchatTtsResult = {
|
|
5
3
|
type: 'tts_audio';
|
|
6
4
|
uri: string;
|
|
@@ -9,7 +7,6 @@ export type WebchatTtsResult = {
|
|
|
9
7
|
};
|
|
10
8
|
export type WebchatTtsDeps = {
|
|
11
9
|
config: Config | undefined;
|
|
12
|
-
sessionStore: SessionStore;
|
|
13
10
|
getLastAssistantPlainText: (conversationId: string) => string;
|
|
14
11
|
log: {
|
|
15
12
|
warn: (obj: Record<string, unknown>, msg: string) => void;
|
|
@@ -21,4 +18,3 @@ export declare function isSuccessfulWebchatTtsToolEvent(event: unknown): boolean
|
|
|
21
18
|
* Generate TTS for webchat when config allows; persist under `{stateDir}/media/tts/`.
|
|
22
19
|
*/
|
|
23
20
|
export declare function maybeEmitWebchatTts(deps: WebchatTtsDeps, conversationId: string, hadInboundVoice: boolean): Promise<WebchatTtsResult | null>;
|
|
24
|
-
export declare function appendMediaToLastAssistant(sessionStore: SessionStore, conversationId: string, ref: MediaRef): Promise<void>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { appendMediaToAssistantTranscriptEntry, findLatestAssistantTranscriptEntryId } from "../../storage/sqlite/transcript-repository.js";
|
|
2
|
+
import "../../storage/sqlite/index.js";
|
|
1
3
|
import { isTTSAvailable } from "../../voice/tts/factory.js";
|
|
2
4
|
import { speak } from "../../voice/tts/speak-core.js";
|
|
3
5
|
import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
|
|
@@ -5,6 +7,7 @@ import { getChannelOutputFormat, shouldUseTTS } from "../../voice/tts/service.js
|
|
|
5
7
|
import { compressAudio } from "../../voice/tts/audio.js";
|
|
6
8
|
import { persistOutboundTtsAudio } from "../../channels/attachments/outbound-tts-persist.js";
|
|
7
9
|
import "../../voice/tts/index.js";
|
|
10
|
+
import { deleteMediaUris } from "../../media/session-references.js";
|
|
8
11
|
//#region src/agent/service/webchat-tts.ts
|
|
9
12
|
/** True when the explicit TTS tool already produced durable Webchat audio. */
|
|
10
13
|
function isSuccessfulWebchatTtsToolEvent(event) {
|
|
@@ -28,6 +31,12 @@ async function maybeEmitWebchatTts(deps, conversationId, hadInboundVoice) {
|
|
|
28
31
|
if (!shouldUseTTS(ttsConfig, hadInboundVoice).useTTS) return null;
|
|
29
32
|
const text = deps.getLastAssistantPlainText(conversationId).trim();
|
|
30
33
|
if (!text) return null;
|
|
34
|
+
const assistantEntryId = findLatestAssistantTranscriptEntryId(conversationId);
|
|
35
|
+
if (!assistantEntryId) {
|
|
36
|
+
deps.log.warn({ conversationId }, "Webchat TTS skipped because the assistant transcript is unavailable");
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
let persisted;
|
|
31
40
|
try {
|
|
32
41
|
const webOut = getChannelOutputFormat("webchat");
|
|
33
42
|
const fmt = webOut.format;
|
|
@@ -37,8 +46,15 @@ async function maybeEmitWebchatTts(deps, conversationId, hadInboundVoice) {
|
|
|
37
46
|
});
|
|
38
47
|
const { buffer, format } = await compressAudio(Buffer.from(ttsResult.audio), ttsResult.format, webOut.format === "mp3" ? "mp3" : "opus");
|
|
39
48
|
const normalizedMime = format === "opus" || format === "ogg" ? "audio/ogg" : format === "mp3" || format === "mpeg" ? "audio/mpeg" : format === "wav" ? "audio/wav" : `audio/${format}`;
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
persisted = await persistOutboundTtsAudio(buffer, format);
|
|
50
|
+
if (!appendMediaToAssistantTranscriptEntry(conversationId, assistantEntryId, persisted)) {
|
|
51
|
+
await deleteMediaUris([persisted.uri]);
|
|
52
|
+
deps.log.warn({
|
|
53
|
+
conversationId,
|
|
54
|
+
assistantEntryId
|
|
55
|
+
}, "Webchat TTS discarded because its assistant transcript changed");
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
42
58
|
return {
|
|
43
59
|
type: "tts_audio",
|
|
44
60
|
uri: persisted.uri,
|
|
@@ -46,6 +62,7 @@ async function maybeEmitWebchatTts(deps, conversationId, hadInboundVoice) {
|
|
|
46
62
|
name: persisted.name
|
|
47
63
|
};
|
|
48
64
|
} catch (err) {
|
|
65
|
+
if (persisted) await deleteMediaUris([persisted.uri]);
|
|
49
66
|
deps.log.warn({
|
|
50
67
|
err,
|
|
51
68
|
conversationId
|
|
@@ -53,21 +70,5 @@ async function maybeEmitWebchatTts(deps, conversationId, hadInboundVoice) {
|
|
|
53
70
|
return null;
|
|
54
71
|
}
|
|
55
72
|
}
|
|
56
|
-
async function appendMediaToLastAssistant(sessionStore, conversationId, ref) {
|
|
57
|
-
const loaded = await sessionStore.load(conversationId);
|
|
58
|
-
for (let i = loaded.length - 1; i >= 0; i--) {
|
|
59
|
-
const m = loaded[i];
|
|
60
|
-
if (m.role === "assistant") {
|
|
61
|
-
const prev = m.media ?? [];
|
|
62
|
-
if (prev.some((x) => x.uri === ref.uri)) return;
|
|
63
|
-
loaded[i] = {
|
|
64
|
-
...m,
|
|
65
|
-
media: [...prev, ref]
|
|
66
|
-
};
|
|
67
|
-
await sessionStore.saveMessages(conversationId, loaded);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
73
|
//#endregion
|
|
73
|
-
export {
|
|
74
|
+
export { isSuccessfulWebchatTtsToolEvent, maybeEmitWebchatTts };
|
|
@@ -389,7 +389,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
389
389
|
canRead: () => currentAccess().knowledge,
|
|
390
390
|
canWrite: () => currentAccess().knowledge,
|
|
391
391
|
getWritePolicy: knowledgeWritePolicy,
|
|
392
|
-
|
|
392
|
+
getReadPolicy: () => currentAccess().knowledgePolicy
|
|
393
393
|
}),
|
|
394
394
|
createKnowledgeGetTool({
|
|
395
395
|
agentId: resolvedAgentId,
|
|
@@ -399,7 +399,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
399
399
|
canRead: () => currentAccess().knowledge,
|
|
400
400
|
canWrite: () => currentAccess().knowledge,
|
|
401
401
|
getWritePolicy: knowledgeWritePolicy,
|
|
402
|
-
|
|
402
|
+
getReadPolicy: () => currentAccess().knowledgePolicy
|
|
403
403
|
}),
|
|
404
404
|
createKnowledgeWriteTool({
|
|
405
405
|
agentId: resolvedAgentId,
|
|
@@ -409,7 +409,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
409
409
|
canRead: () => currentAccess().knowledge,
|
|
410
410
|
canWrite: () => currentAccess().knowledge,
|
|
411
411
|
getWritePolicy: knowledgeWritePolicy,
|
|
412
|
-
|
|
412
|
+
getReadPolicy: () => currentAccess().knowledgePolicy
|
|
413
413
|
}),
|
|
414
414
|
...this.deps.getSessionStore ? [createSessionRecallTool({
|
|
415
415
|
getSessionStore: this.deps.getSessionStore,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
-
import { type
|
|
2
|
+
import { type KnowledgeReadPolicy } from '../../knowledge-memory/index.js';
|
|
3
3
|
export interface KnowledgeToolOptions {
|
|
4
4
|
agentId: string;
|
|
5
5
|
workspaceId: string;
|
|
@@ -8,7 +8,7 @@ export interface KnowledgeToolOptions {
|
|
|
8
8
|
canRead: () => boolean;
|
|
9
9
|
canWrite: () => boolean;
|
|
10
10
|
getWritePolicy: () => 'deny' | 'confirm' | 'allow';
|
|
11
|
-
|
|
11
|
+
getReadPolicy: () => KnowledgeReadPolicy;
|
|
12
12
|
}
|
|
13
13
|
export declare function createKnowledgeSearchTool(options: KnowledgeToolOptions): AgentTool;
|
|
14
14
|
export declare function createKnowledgeGetTool(options: KnowledgeToolOptions): AgentTool;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getKnowledgeItem,
|
|
1
|
+
import { getKnowledgeItem, knowledgeItemAllowed, searchKnowledgeItems, writeKnowledgeItem } from "../../knowledge-memory/repository.js";
|
|
2
2
|
import "../../knowledge-memory/index.js";
|
|
3
3
|
import { Type } from "@sinclair/typebox";
|
|
4
4
|
//#region src/agent/tools/knowledge-memory-tool.ts
|
|
@@ -60,7 +60,7 @@ function createKnowledgeSearchTool(options) {
|
|
|
60
60
|
const results = searchKnowledgeItems({
|
|
61
61
|
query: input.query,
|
|
62
62
|
context: visibility(options),
|
|
63
|
-
|
|
63
|
+
policy: options.getReadPolicy(),
|
|
64
64
|
limit: input.maxResults ?? 12
|
|
65
65
|
});
|
|
66
66
|
return {
|
|
@@ -92,7 +92,7 @@ function createKnowledgeGetTool(options) {
|
|
|
92
92
|
};
|
|
93
93
|
const id = raw.id;
|
|
94
94
|
const item = getKnowledgeItem(id);
|
|
95
|
-
return item && visibleItem(options, item) &&
|
|
95
|
+
return item && visibleItem(options, item) && knowledgeItemAllowed(item, options.getReadPolicy()) ? {
|
|
96
96
|
content: [{
|
|
97
97
|
type: "text",
|
|
98
98
|
text: JSON.stringify(item, null, 2)
|
|
@@ -131,14 +131,14 @@ function createKnowledgeWriteTool(options) {
|
|
|
131
131
|
details: { error: "knowledge_write_denied" }
|
|
132
132
|
};
|
|
133
133
|
const input = raw;
|
|
134
|
-
if (!options.
|
|
134
|
+
if (!options.getReadPolicy().scopes.includes(input.scope) || !options.getReadPolicy().contentSources.includes("memory")) return {
|
|
135
135
|
content: [{
|
|
136
136
|
type: "text",
|
|
137
|
-
text: `Knowledge
|
|
137
|
+
text: `Knowledge memory writes are disabled for scope: ${input.scope}`
|
|
138
138
|
}],
|
|
139
139
|
details: {
|
|
140
|
-
error: "
|
|
141
|
-
|
|
140
|
+
error: "knowledge_scope_disabled",
|
|
141
|
+
scope: input.scope
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
const sessionId = options.getSessionId();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeXopcDatabase, init_connection, openXopcDatabase } from "../storage/sqlite/connection.js";
|
|
2
|
-
import {
|
|
2
|
+
import { browserPairingInvitationPayloadSchema, formatBrowserPairingInvitation } from "../../packages/gateway-contract/src/device-pairing.js";
|
|
3
3
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
4
4
|
import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity } from "../storage/sqlite/gateway-identity-repository.js";
|
|
5
5
|
import { createDevicePairingSetup } from "../storage/sqlite/device-pairing-repository.js";
|
|
@@ -53,7 +53,7 @@ function createBrowserNativeBootstrap(configPath, request) {
|
|
|
53
53
|
return {
|
|
54
54
|
ok: true,
|
|
55
55
|
gatewayUrl,
|
|
56
|
-
invitation: formatBrowserPairingInvitation(Buffer.from(JSON.stringify(
|
|
56
|
+
invitation: formatBrowserPairingInvitation(Buffer.from(JSON.stringify(browserPairingInvitationPayloadSchema.parse({
|
|
57
57
|
version: 3,
|
|
58
58
|
pairingToken: setup.token,
|
|
59
59
|
gatewayId: identity.id,
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
import type { STTConfig } from '../../voice/stt/types.js';
|
|
5
5
|
import { type InboundAttachmentInput, type MediaRef } from './inbound-persist.js';
|
|
6
6
|
export declare function isVoiceLikeAttachment(att: InboundAttachmentInput | MediaRef): boolean;
|
|
7
|
+
/** True when the user explicitly asks the agent to inspect the original recording. */
|
|
8
|
+
export declare function requestsOriginalVoiceInspection(text: string): boolean;
|
|
7
9
|
export declare function mergeVoiceTranscriptsIntoUserText(prepared: (InboundAttachmentInput | MediaRef)[] | undefined, userText: string, sttConfig: STTConfig, opts?: {
|
|
8
10
|
skipVoiceTranscription?: boolean;
|
|
9
11
|
}): Promise<{
|
|
10
12
|
text: string;
|
|
11
13
|
inboundVoice: boolean;
|
|
12
14
|
voiceTranscripts: string[];
|
|
15
|
+
transcribedMediaUris: string[];
|
|
13
16
|
}>;
|
|
@@ -12,28 +12,39 @@ function isVoiceLikeAttachment(att) {
|
|
|
12
12
|
if (att.type === "voice") return true;
|
|
13
13
|
return (att.mimeType?.toLowerCase() ?? "").startsWith("audio/");
|
|
14
14
|
}
|
|
15
|
+
/** True when the user explicitly asks the agent to inspect the original recording. */
|
|
16
|
+
function requestsOriginalVoiceInspection(text) {
|
|
17
|
+
const normalized = text.trim();
|
|
18
|
+
if (!normalized) return false;
|
|
19
|
+
return /(?:分析|检查|听|辨别|识别|判断|检测|对比|提取).{0,12}(?:原始|原声)?(?:语音|音频|录音|声音)/u.test(normalized) || /(?:原始|原声)?(?:语音|音频|录音|声音).{0,12}(?:分析|检查|听|辨别|识别|判断|检测|对比|音质|音色|语气|情绪|口音|噪声|杂音|背景声|说话人|声纹)/u.test(normalized) || /\b(?:analy[sz]e|inspect|listen\s+to|check|identify|compare|detect)\b.{0,40}\b(?:(?:original|raw)\s+)?(?:audio|recording|voice(?:\s+(?:clip|message))?)\b/iu.test(normalized) || /\b(?:(?:original|raw)\s+)?(?:audio|recording|voice(?:\s+(?:clip|message))?)\b.{0,40}\b(?:analy[sz]e|inspect|listen|quality|tone|emotion|accent|noise|background|speaker|voiceprint)\b/iu.test(normalized);
|
|
20
|
+
}
|
|
15
21
|
async function mergeVoiceTranscriptsIntoUserText(prepared, userText, sttConfig, opts) {
|
|
16
22
|
if (!prepared?.length) return {
|
|
17
23
|
text: userText,
|
|
18
24
|
inboundVoice: false,
|
|
19
|
-
voiceTranscripts: []
|
|
25
|
+
voiceTranscripts: [],
|
|
26
|
+
transcribedMediaUris: []
|
|
20
27
|
};
|
|
21
28
|
if (!prepared.some(isVoiceLikeAttachment)) return {
|
|
22
29
|
text: userText,
|
|
23
30
|
inboundVoice: false,
|
|
24
|
-
voiceTranscripts: []
|
|
31
|
+
voiceTranscripts: [],
|
|
32
|
+
transcribedMediaUris: []
|
|
25
33
|
};
|
|
26
34
|
if (opts?.skipVoiceTranscription === true) return {
|
|
27
35
|
text: userText,
|
|
28
36
|
inboundVoice: true,
|
|
29
|
-
voiceTranscripts: []
|
|
37
|
+
voiceTranscripts: [],
|
|
38
|
+
transcribedMediaUris: []
|
|
30
39
|
};
|
|
31
40
|
if (!isSTTAvailable(sttConfig)) return {
|
|
32
41
|
text: userText,
|
|
33
42
|
inboundVoice: true,
|
|
34
|
-
voiceTranscripts: []
|
|
43
|
+
voiceTranscripts: [],
|
|
44
|
+
transcribedMediaUris: []
|
|
35
45
|
};
|
|
36
46
|
const transcripts = [];
|
|
47
|
+
const transcribedMediaUris = [];
|
|
37
48
|
for (const att of prepared) {
|
|
38
49
|
if (!isVoiceLikeAttachment(att)) continue;
|
|
39
50
|
let buf = null;
|
|
@@ -56,12 +67,13 @@ async function mergeVoiceTranscriptsIntoUserText(prepared, userText, sttConfig,
|
|
|
56
67
|
continue;
|
|
57
68
|
}
|
|
58
69
|
try {
|
|
59
|
-
const
|
|
70
|
+
const transcript = (await transcribe(buf, sttConfig, {
|
|
60
71
|
language: sttConfig.provider === "alibaba" ? "zh" : void 0,
|
|
61
72
|
mime: att.mimeType,
|
|
62
73
|
fileName: att.name
|
|
63
|
-
});
|
|
64
|
-
transcripts.push(
|
|
74
|
+
})).text.trim();
|
|
75
|
+
transcripts.push(transcript || "[Voice: no speech detected]");
|
|
76
|
+
if (transcript && "uri" in att && att.uri?.trim()) transcribedMediaUris.push(att.uri.trim());
|
|
65
77
|
} catch (error) {
|
|
66
78
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
67
79
|
log.error({
|
|
@@ -78,8 +90,9 @@ async function mergeVoiceTranscriptsIntoUserText(prepared, userText, sttConfig,
|
|
|
78
90
|
return {
|
|
79
91
|
text: [transcripts.filter(Boolean).join("\n"), userText.trim()].filter(Boolean).join("\n\n") || userText,
|
|
80
92
|
inboundVoice: true,
|
|
81
|
-
voiceTranscripts: transcripts
|
|
93
|
+
voiceTranscripts: transcripts,
|
|
94
|
+
transcribedMediaUris
|
|
82
95
|
};
|
|
83
96
|
}
|
|
84
97
|
//#endregion
|
|
85
|
-
export { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText };
|
|
98
|
+
export { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText, requestsOriginalVoiceInspection };
|
|
@@ -77,6 +77,7 @@ function createAgentCommand(_ctx) {
|
|
|
77
77
|
extensionLoader.setConfig(config);
|
|
78
78
|
extensionLoader.setRuntimeContext({ bus });
|
|
79
79
|
await extensionLoader.loadByActivationPlan();
|
|
80
|
+
await extensionLoader.startServices();
|
|
80
81
|
const n = extensionLoader.getRegistry().extensions.size;
|
|
81
82
|
if (n > 0) log.info({ count: n }, "Extensions loaded");
|
|
82
83
|
} catch (error) {
|
|
@@ -120,6 +121,7 @@ function createAgentCommand(_ctx) {
|
|
|
120
121
|
running = false;
|
|
121
122
|
bus.shutdown();
|
|
122
123
|
await agent.stop();
|
|
124
|
+
await extensionLoader?.shutdown();
|
|
123
125
|
};
|
|
124
126
|
process.on("SIGINT", shutdown);
|
|
125
127
|
process.on("SIGTERM", shutdown);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
2
|
-
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
3
2
|
import { resolveGatewayLocalClientHost } from "../../config/gateway-bind.js";
|
|
4
3
|
import { formatExamples, register } from "../registry.js";
|
|
5
4
|
import { existsSync, readFileSync } from "fs";
|
|
6
5
|
import { Command } from "commander";
|
|
7
6
|
//#region src/cli/commands/config.ts
|
|
8
|
-
init_write_file_atomic();
|
|
9
7
|
init_schema();
|
|
10
8
|
const MISSING_CONFIG_HINT = "Run: xopc setup, xopc onboard, or xopc init";
|
|
11
9
|
async function loadConfigDeps() {
|
|
12
|
-
const [{ loadConfig }, { createLogger }] = await Promise.all([import("../../config/index.js"), import("../../utils/logger.js")]);
|
|
10
|
+
const [{ loadConfig, saveConfig }, { createLogger }] = await Promise.all([import("../../config/index.js"), import("../../utils/logger.js")]);
|
|
13
11
|
return {
|
|
14
12
|
loadConfig,
|
|
13
|
+
saveConfig,
|
|
15
14
|
log: createLogger("ConfigCommand")
|
|
16
15
|
};
|
|
17
16
|
}
|
|
@@ -108,7 +107,7 @@ function createConfigCommand(ctx) {
|
|
|
108
107
|
console.log(typeof value === "object" ? JSON.stringify(value, null, 2) : value);
|
|
109
108
|
});
|
|
110
109
|
cmd.command("set <path> <value>").description("Set a config value by dot path").action(async (path, value) => {
|
|
111
|
-
const { loadConfig, log } = await loadConfigDeps();
|
|
110
|
+
const { loadConfig, saveConfig, log } = await loadConfigDeps();
|
|
112
111
|
if (!existsSync(ctx.configPath)) {
|
|
113
112
|
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
114
113
|
process.exit(1);
|
|
@@ -121,11 +120,11 @@ function createConfigCommand(ctx) {
|
|
|
121
120
|
}
|
|
122
121
|
const config = loadConfig(ctx.configPath);
|
|
123
122
|
setNestedValue(config, path, parsedValue);
|
|
124
|
-
await
|
|
123
|
+
await saveConfig(config, ctx.configPath);
|
|
125
124
|
log.info({ path }, `Config updated`);
|
|
126
125
|
});
|
|
127
126
|
cmd.command("unset <path>").description("Remove a config value by dot path").action(async (path) => {
|
|
128
|
-
const { loadConfig, log } = await loadConfigDeps();
|
|
127
|
+
const { loadConfig, saveConfig, log } = await loadConfigDeps();
|
|
129
128
|
if (!existsSync(ctx.configPath)) {
|
|
130
129
|
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
131
130
|
process.exit(1);
|
|
@@ -138,7 +137,7 @@ function createConfigCommand(ctx) {
|
|
|
138
137
|
}, config);
|
|
139
138
|
if (target && typeof target === "object" && lastKey in target) {
|
|
140
139
|
delete target[lastKey];
|
|
141
|
-
await
|
|
140
|
+
await saveConfig(config, ctx.configPath);
|
|
142
141
|
log.info({ path }, `Config removed`);
|
|
143
142
|
} else {
|
|
144
143
|
log.error({ path }, `Config path not found`);
|
|
@@ -152,7 +151,7 @@ function createConfigCommand(ctx) {
|
|
|
152
151
|
if (!await runConfigValidate(ctx.configPath)) process.exit(1);
|
|
153
152
|
});
|
|
154
153
|
cmd.command("token").description("Generate or view the gateway auth token").option("--generate", "Generate a new token").option("--show", "Show the current token (unmasked)").action(async (options) => {
|
|
155
|
-
const { loadConfig, log } = await loadConfigDeps();
|
|
154
|
+
const { loadConfig, saveConfig, log } = await loadConfigDeps();
|
|
156
155
|
if (!existsSync(ctx.configPath)) {
|
|
157
156
|
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
158
157
|
process.exit(1);
|
|
@@ -171,7 +170,7 @@ function createConfigCommand(ctx) {
|
|
|
171
170
|
mode: "token",
|
|
172
171
|
token: newToken
|
|
173
172
|
};
|
|
174
|
-
await
|
|
173
|
+
await saveConfig(config, ctx.configPath);
|
|
175
174
|
log.info("New gateway token generated");
|
|
176
175
|
console.log(`Token: ${newToken.slice(0, 8)}...${newToken.slice(-8)}`);
|
|
177
176
|
console.log("\nUse \"xopc config token --show\" to view the full token");
|
|
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
53
53
|
id: "database-schema",
|
|
54
54
|
label: "Database schema",
|
|
55
55
|
status: "pass",
|
|
56
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
56
|
+
message: `SQLite schema v${status.dbVersion} (current release v183).`,
|
|
57
57
|
hints: []
|
|
58
58
|
};
|
|
59
59
|
}
|