@xopcai/xopc 0.0.187 → 0.0.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.js +1 -0
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -3
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +0 -2
- package/dist/extensions/telegram/src/draft-stream.d.ts +0 -4
- package/dist/extensions/telegram/src/draft-stream.js +1 -53
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-WlR2zEvA.js → activity-store-DTFKTPs8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-RedDszrG.js → agent-avatar-dicebear-DqO25Qe5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BvdqdER9.js +2 -0
- package/dist/gateway/static/root/assets/{api-tVOllncq.js → api-DWeXfwVU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C9hKBzaF.js → app-management-settings-panel-BRpV8PXG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-5cQvq7hd.js → appearance-settings-3ntKM9nQ.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-nKLsfy6C.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ct-shK4n.js → archive-plugin-Df7Ycj_7.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CpPj3m-q.js → attachment-load-UHgfZYtj.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Dh5bdZiN.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpSXZBle.js → binary-plugins-BJah99wE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B8hR2tXc.js → block-editor-DNlY5KqF.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CRJ_nAuh.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_LAXUrh.js → browser-workflow-inputs-vyUfdzAd.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CPAs7-6s.js → browser-workflows-page-C1cKZjx-.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DeQR5BZt.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CKklVY2p.js → capability-presets-api-D7tkhDMv.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7uK3q1p.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-WWN-nbFL.js → channel-recipient-api-BGG2kpJB.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bw6Dniyq.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-BrUTz4uU.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CdNkVFdB.js → connector-logo-8YU53RUT.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-k9tMiOL5.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-Bm_IEAf3.js → desktop-pet-BUuBEJuP.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C0Ve04-G.js → desktop-pet-settings-BGfVIJM3.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B2cvhvAI.js → directory-picker-path-field-DrQFfHH_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DNashgGu.js → extension-debug-page-CEnIFOX-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bvo-5htX.js → extension-page-CCqHbexs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BBESdISV.js → extension-settings-page-DEZw_7zN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-ClQvokMo.js → gateway-config-api-CgUE2Ii1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dg8qCiIp.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CntXJF6W.js → gateway-startup-retry-DxhKNiCF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CWKcZuvc.js → heartbeat-settings-27tRzDEo.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-VA511kMr.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DjSAQwGy.js → image-generation-api-DCFdc-HD.js} +1 -1
- package/dist/gateway/static/root/assets/index-BvR-i-m6.js +216 -0
- package/dist/gateway/static/root/assets/index-zybP34zk.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ahKHpjoW.js → keyboard-shortcuts-settings-Bf2VLtXW.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CaJq4-wV.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-B6GKdgza.js → local-apps-page-Ca1RuI13.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bff30u5V.js → locale-store-DUW5YE3R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BLTCg69e.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B3Eop1zn.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-BeNMJm_i.js → markdown-split-BGOYjgnM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bdzrj_-6.js → media-plugins-CT0txyM4.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CMjnbdbn.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-MYIi-9S9.js → notes-page-DfKgAe78.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Bp1w9UM1.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-3t88bbGx.js → page-tabs-DNrbCgmC.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cf_BWbeE.js → preview-open-alternatives-BTqViDOR.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CKq73c98.js → product-open-page-C_2L4_Iu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CZmbPDQN.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D5pzqfm5.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CC-XhVGI.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-NqOm-OG1.js → schema-form-BFLfkDGG.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B2eTLVDV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CRuZ_bl0.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DYAS8p8z.js → settings-form-section-C4GXGeA4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DZFhxihA.js → settings-loading-skeleton-C9a-EbTZ.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DI9qDH5x.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DfFfkdED.js → settings-page-layout-D-LWQdI5.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CJwmPvgs.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CYtrQaZN.js → share-preview-page-BKSMG9r5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-YzSDS4G_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CwOo8zZk.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-xd1cgSGN.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-BBXirAjc.js → skills-page.utils-zsz2HIlZ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DLf5YvFl.js → system-settings-panel-IWNDBI1O.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DFGkuYfl.js → task-detail-page-CgtK02kP.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-y7e_tvYi.js → theme-store-BkJe7UDo.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-CstQ___Y.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-DR12j_dr.js → typed-models-lib-C07LGthO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-save-bar-registration-BsvcJgZl.js → use-save-bar-registration-CQYE0l6z.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BnQAWS_B.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DKADXFWD.js → voice-api-key-field-Boue1D46.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BC1nExf8.js → work-discovery-overlay-bbmvCmc8.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CAszL1y8.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C8X5W-8k.js → workflow-run-setup-panel-DlHv-GZC.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DxGzo3-x.js +11 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
- package/dist/packages/gateway-contract/src/tool-activity.js +223 -0
- package/dist/packages/realtime-client/src/index.js +199 -0
- package/dist/packages/realtime-protocol/src/index.js +83 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +3 -8
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
- package/dist/src/agent/background-review/run-background-review.js +5 -2
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +0 -2
- package/dist/src/agent/embedded/run-for-session.js +99 -112
- package/dist/src/agent/external-tools/composio-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/composio-provider.js +307 -0
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
- package/dist/src/agent/external-tools/extension-provider.d.ts +20 -0
- package/dist/src/agent/external-tools/extension-provider.js +68 -0
- package/dist/src/agent/external-tools/gateway-tools.d.ts +8 -0
- package/dist/src/agent/external-tools/gateway-tools.js +89 -0
- package/dist/src/agent/external-tools/index.d.ts +23 -0
- package/dist/src/agent/external-tools/index.js +46 -0
- package/dist/src/agent/external-tools/mcp-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/mcp-provider.js +118 -0
- package/dist/src/agent/external-tools/memory-provider.d.ts +21 -0
- package/dist/src/agent/external-tools/memory-provider.js +56 -0
- package/dist/src/agent/external-tools/refs.d.ts +5 -0
- package/dist/src/agent/external-tools/refs.js +18 -0
- package/dist/src/agent/external-tools/service.d.ts +26 -0
- package/dist/src/agent/external-tools/service.js +117 -0
- package/dist/src/agent/external-tools/types.d.ts +35 -0
- package/dist/src/agent/external-tools/types.js +10 -0
- package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
- package/dist/src/agent/inbound/inbound-loop.js +4 -3
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
- package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
- package/dist/src/agent/mcp/{bundle-mcp-materialize.d.ts → bundle-mcp-gateway.d.ts} +1 -19
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +60 -0
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -8
- package/dist/src/agent/mcp/bundle-mcp-names.js +2 -29
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +4 -7
- package/dist/src/agent/mcp/bundle-mcp-policy.js +6 -20
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +1 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -5
- package/dist/src/agent/mcp/index.d.ts +0 -2
- package/dist/src/agent/mcp/index.js +2 -5
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +1 -0
- package/dist/src/agent/memory/context/planner.js +22 -7
- package/dist/src/agent/memory/manager.d.ts +4 -1
- package/dist/src/agent/memory/manager.js +5 -2
- package/dist/src/agent/memory/types.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- package/dist/src/agent/messaging/stream-manager.d.ts +2 -14
- package/dist/src/agent/messaging/stream-manager.js +0 -12
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -3
- package/dist/src/agent/orchestration/agent-event-handler.js +0 -36
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -5
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -5
- package/dist/src/agent/prompt/sections/behavior.js +6 -4
- package/dist/src/agent/service/async-queue.d.ts +1 -1
- package/dist/src/agent/service/async-queue.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service.d.ts +1 -4
- package/dist/src/agent/service.js +6 -32
- package/dist/src/agent/service.types.d.ts +2 -3
- package/dist/src/agent/session/index.d.ts +1 -1
- package/dist/src/agent/session/session-context.d.ts +2 -0
- package/dist/src/agent/session/session-context.js +4 -0
- package/dist/src/agent/session/session-state-bag.d.ts +4 -4
- package/dist/src/agent/session/session-state-bag.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/starter-agents.js +2 -2
- package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
- package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
- package/dist/src/agent/tools/delegate-tool.js +5 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +6 -1
- package/dist/src/agent/tools/factory.js +17 -22
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/workflow/workflow-child-tools.js +7 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +1 -1
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/channels/channel-domain.d.ts +0 -4
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/channels/plugin-types.d.ts +0 -2
- package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +3 -5
- package/dist/src/config/schema.js +0 -3
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/endpoint-tools/auth.d.ts +20 -0
- package/dist/src/endpoint-tools/auth.js +51 -0
- package/dist/src/endpoint-tools/index.d.ts +5 -0
- package/dist/src/endpoint-tools/index.js +6 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
- package/dist/src/endpoint-tools/invocation-service.js +190 -0
- package/dist/src/endpoint-tools/policy.d.ts +10 -0
- package/dist/src/endpoint-tools/policy.js +18 -0
- package/dist/src/endpoint-tools/registry.d.ts +45 -0
- package/dist/src/endpoint-tools/registry.js +121 -0
- package/dist/src/endpoint-tools/runtime.d.ts +23 -0
- package/dist/src/endpoint-tools/runtime.js +86 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
- package/dist/src/endpoint-tools/upload-service.js +103 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +3 -1
- package/dist/src/extensions/extension-registry-impl.js +7 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/types/core.d.ts +2 -1
- package/dist/src/extensions/types/hooks.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +5 -2
- package/dist/src/gateway/chat-stream/mapper.js +16 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/file-reference-errors.d.ts +6 -0
- package/dist/src/gateway/file-reference-errors.js +21 -0
- package/dist/src/gateway/heartbeat/service.js +5 -2
- package/dist/src/gateway/hono/app.js +1 -5
- package/dist/src/gateway/hono/index.d.ts +0 -1
- package/dist/src/gateway/hono/index.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +34 -13
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
- package/dist/src/gateway/hono/routes/realtime.js +35 -0
- package/dist/src/gateway/hono/routes/workspace.js +34 -13
- package/dist/src/gateway/hono/routes/you.d.ts +0 -9
- package/dist/src/gateway/hono/routes/you.js +81 -128
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +1 -2
- package/dist/src/gateway/protocol.d.ts +1 -7
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/security/operator-scopes.js +1 -1
- package/dist/src/gateway/server.js +4 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -9
- package/dist/src/gateway/service/agent-runner.js +18 -18
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +17 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service/types.d.ts +0 -5
- package/dist/src/gateway/service.d.ts +7 -6
- package/dist/src/gateway/service.js +39 -22
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/mcp/channel-bridge.d.ts +6 -9
- package/dist/src/mcp/channel-bridge.js +48 -76
- package/dist/src/mcp/channel-server.js +2 -6
- package/dist/src/realtime/broker.d.ts +30 -0
- package/dist/src/realtime/broker.js +97 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +258 -0
- package/dist/src/realtime/tickets.d.ts +15 -0
- package/dist/src/realtime/tickets.js +38 -0
- package/dist/src/realtime/writer.d.ts +15 -0
- package/dist/src/realtime/writer.js +78 -0
- package/dist/src/share/share-config.js +0 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -0
- package/dist/src/storage/sqlite/index.js +3 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +3 -1
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +18 -0
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -3
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -2
- package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
- package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
- package/dist/src/tui/tool-summary.d.ts +1 -2
- package/dist/src/tui/tool-summary.js +2 -18
- package/dist/src/tui/tui-agent-events.d.ts +0 -1
- package/dist/src/tui/tui-agent-events.js +2 -15
- package/dist/src/tui/tui-backend.d.ts +4 -4
- package/dist/src/tui/tui-run-state.js +0 -4
- package/dist/src/tui/tui-types.d.ts +2 -9
- package/dist/src/tui/tui-types.js +0 -1
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/actionableInsights.d.ts +14 -0
- package/dist/src/user-context/actionableInsights.js +34 -0
- package/dist/src/user-context/manual-understanding.js +6 -1
- package/dist/src/user-context/projection.d.ts +2 -1
- package/dist/src/user-context/projection.js +2 -1
- package/dist/src/user-context/understandingQuality.d.ts +5 -0
- package/dist/src/user-context/understandingQuality.js +44 -0
- package/dist/src/utils/logger/log-stream.d.ts +3 -10
- package/dist/src/utils/logger/log-stream.js +2 -73
- package/dist/src/utils/logger/pino-record.d.ts +1 -1
- package/dist/src/utils/logger/streams.js +1 -1
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/work-discovery/service.js +1 -1
- package/package.json +6 -3
- package/dist/gateway/static/root/assets/agents-Df9mTa-K.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Bd3tN-k2.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-w6K9GZQ7.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-jb5Hf-hm.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjUe4raq.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DiWIMYRr.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-D8IkjMuX.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CySs1GQX.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BT2ahw52.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CIRs2QVy.js +0 -1
- package/dist/gateway/static/root/assets/home-page-C59f8UJw.js +0 -3
- package/dist/gateway/static/root/assets/index-D-YfWVyS.css +0 -1
- package/dist/gateway/static/root/assets/index-vi5KlR5_.js +0 -222
- package/dist/gateway/static/root/assets/local-app-workbench-page-DRB4UQBE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CNp4XiBN.js +0 -7
- package/dist/gateway/static/root/assets/messages-CPxz48hr.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DqSkeDXX.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BrbHs4Wp.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B80rtkj6.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-_Q3GEznb.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-55dJOUVg.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CSFCZj14.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BSIiMLi-.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-q_yE6-H1.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-gYkRX9Ik.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BoNBMKW6.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-GZHKDFSb.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-5sHEZ5w5.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-q5dr8JFG.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-fNvSg40M.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-YJBKmPYK.js +0 -11
- package/dist/src/agent/feedback/feedback-coordinator.d.ts +0 -73
- package/dist/src/agent/feedback/feedback-coordinator.js +0 -156
- package/dist/src/agent/feedback/index.d.ts +0 -4
- package/dist/src/agent/feedback/index.js +0 -2
- package/dist/src/agent/lifecycle/progress.d.ts +0 -90
- package/dist/src/agent/lifecycle/progress.js +0 -339
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +0 -183
- package/dist/src/agent/mcp/mcp-tool-meta.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-tool-meta.js +0 -13
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.d.ts +0 -14
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +0 -48
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- package/dist/src/agent/tools/composio-tool.d.ts +0 -21
- package/dist/src/agent/tools/composio-tool.js +0 -261
- package/dist/src/gateway/agent-run-relay.d.ts +0 -19
- package/dist/src/gateway/agent-run-relay.js +0 -169
- package/dist/src/gateway/hono/sse.d.ts +0 -53
- package/dist/src/gateway/hono/sse.js +0 -207
- package/dist/src/gateway/service/sse-hub.d.ts +0 -10
- package/dist/src/gateway/service/sse-hub.js +0 -53
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { mcpToolPolicyId } from "./bundle-mcp-policy.js";
|
|
2
|
+
import { createSessionMcpRuntime } from "./bundle-mcp-runtime.js";
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
//#region src/agent/mcp/bundle-mcp-gateway.ts
|
|
5
|
+
function mapTools(tools, serverId) {
|
|
6
|
+
return tools.filter((tool) => tool.serverName === serverId).map((tool) => ({
|
|
7
|
+
name: mcpToolPolicyId(tool.safeServerName, tool.toolName),
|
|
8
|
+
shortName: tool.toolName,
|
|
9
|
+
description: tool.description || tool.title || tool.fallbackDescription
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
function mapResources(resources, serverId) {
|
|
13
|
+
return resources.filter((resource) => resource.serverName === serverId).map((resource) => ({
|
|
14
|
+
uri: resource.uri,
|
|
15
|
+
name: resource.name,
|
|
16
|
+
title: resource.title,
|
|
17
|
+
description: resource.description,
|
|
18
|
+
mimeType: resource.mimeType
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function mapPrompts(prompts, serverId) {
|
|
22
|
+
return prompts.filter((prompt) => prompt.serverName === serverId).map((prompt) => ({
|
|
23
|
+
name: prompt.name,
|
|
24
|
+
title: prompt.title,
|
|
25
|
+
description: prompt.description,
|
|
26
|
+
argumentCount: prompt.argumentCount
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
async function loadCatalog(params) {
|
|
30
|
+
const runtime = createSessionMcpRuntime({
|
|
31
|
+
sessionId: `mcp-gateway:${crypto.randomUUID()}`,
|
|
32
|
+
workspaceDir: params.workspaceDir,
|
|
33
|
+
cfg: params.cfg
|
|
34
|
+
});
|
|
35
|
+
try {
|
|
36
|
+
return await runtime.getCatalog();
|
|
37
|
+
} finally {
|
|
38
|
+
await runtime.dispose();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function listBundleMcpServerToolsForGateway(params) {
|
|
42
|
+
return mapTools((await loadCatalog(params)).tools, params.serverId);
|
|
43
|
+
}
|
|
44
|
+
async function listBundleMcpServerCapabilitiesForGateway(params) {
|
|
45
|
+
const catalog = await loadCatalog(params);
|
|
46
|
+
const tools = mapTools(catalog.tools, params.serverId);
|
|
47
|
+
const resources = mapResources(catalog.resources, params.serverId);
|
|
48
|
+
const prompts = mapPrompts(catalog.prompts, params.serverId);
|
|
49
|
+
return {
|
|
50
|
+
serverId: params.serverId,
|
|
51
|
+
toolCount: tools.length,
|
|
52
|
+
resourceCount: resources.length,
|
|
53
|
+
promptCount: prompts.length,
|
|
54
|
+
tools,
|
|
55
|
+
resources,
|
|
56
|
+
prompts
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway };
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export declare const TOOL_NAME_SEPARATOR = "__";
|
|
2
1
|
export declare function sanitizeServerName(raw: string, usedNames: Set<string>): string;
|
|
3
|
-
export declare function sanitizeToolName(raw: string): string;
|
|
4
|
-
export declare function normalizeReservedToolNames(names?: Iterable<string>): Set<string>;
|
|
5
|
-
export declare function buildSafeToolName(params: {
|
|
6
|
-
serverName: string;
|
|
7
|
-
toolName: string;
|
|
8
|
-
reservedNames: Set<string>;
|
|
9
|
-
}): string;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { init_string_coerce, normalizeLowercaseStringOrEmpty
|
|
1
|
+
import { init_string_coerce, normalizeLowercaseStringOrEmpty } from "../../utils/string-coerce.js";
|
|
2
2
|
//#region src/agent/mcp/bundle-mcp-names.ts
|
|
3
3
|
init_string_coerce();
|
|
4
|
-
function normalizeOptionalLowercaseString(value) {
|
|
5
|
-
const s = normalizeOptionalString(value);
|
|
6
|
-
return s ? s.toLowerCase() : void 0;
|
|
7
|
-
}
|
|
8
4
|
const TOOL_NAME_SAFE_RE = /[^A-Za-z0-9_-]/g;
|
|
9
|
-
const TOOL_NAME_SEPARATOR = "__";
|
|
10
5
|
const TOOL_NAME_MAX_PREFIX = 30;
|
|
11
|
-
const TOOL_NAME_MAX_TOTAL = 64;
|
|
12
6
|
function sanitizeToolFragment(raw, fallback, maxChars) {
|
|
13
7
|
const normalized = raw.trim().replace(TOOL_NAME_SAFE_RE, "-") || fallback;
|
|
14
8
|
if (!maxChars) return normalized;
|
|
@@ -26,26 +20,5 @@ function sanitizeServerName(raw, usedNames) {
|
|
|
26
20
|
usedNames.add(normalizeLowercaseStringOrEmpty(candidate));
|
|
27
21
|
return candidate;
|
|
28
22
|
}
|
|
29
|
-
function sanitizeToolName(raw) {
|
|
30
|
-
return sanitizeToolFragment(raw, "tool");
|
|
31
|
-
}
|
|
32
|
-
function normalizeReservedToolNames(names) {
|
|
33
|
-
return new Set(Array.from(names ?? [], (name) => normalizeOptionalLowercaseString(name)).filter((name) => Boolean(name)));
|
|
34
|
-
}
|
|
35
|
-
function buildSafeToolName(params) {
|
|
36
|
-
const cleanedToolName = sanitizeToolName(params.toolName);
|
|
37
|
-
const maxToolChars = Math.max(1, TOOL_NAME_MAX_TOTAL - params.serverName.length - 2);
|
|
38
|
-
const truncatedToolName = cleanedToolName.slice(0, maxToolChars);
|
|
39
|
-
let candidateToolName = truncatedToolName || "tool";
|
|
40
|
-
let candidate = `${params.serverName}__${candidateToolName}`;
|
|
41
|
-
let n = 2;
|
|
42
|
-
while (params.reservedNames.has(normalizeLowercaseStringOrEmpty(candidate))) {
|
|
43
|
-
const suffix = `-${n}`;
|
|
44
|
-
candidateToolName = `${(truncatedToolName || "tool").slice(0, Math.max(1, maxToolChars - suffix.length))}${suffix}`;
|
|
45
|
-
candidate = `${params.serverName}__${candidateToolName}`;
|
|
46
|
-
n += 1;
|
|
47
|
-
}
|
|
48
|
-
return candidate;
|
|
49
|
-
}
|
|
50
23
|
//#endregion
|
|
51
|
-
export {
|
|
24
|
+
export { sanitizeServerName };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { AgentManifest } from '../../agent-manifest/schema.js';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function isMcpToolName(toolName: string): boolean;
|
|
5
|
-
export declare function parseMcpToolName(toolName: string): {
|
|
2
|
+
export declare function mcpToolPolicyId(serverId: string, toolName: string): string;
|
|
3
|
+
export declare function isMcpCatalogToolDenied(identity: {
|
|
6
4
|
serverId: string;
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export declare function isMcpToolDenied(toolName: string, policy: AgentManifest['tools']['mcp']): boolean;
|
|
5
|
+
policyToolId: string;
|
|
6
|
+
}, policy: AgentManifest['tools']['mcp']): boolean;
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import "./bundle-mcp-names.js";
|
|
2
|
-
import { hasAnyMcpServers } from "../../extensions/bundle-mcp.js";
|
|
3
1
|
//#region src/agent/mcp/bundle-mcp-policy.ts
|
|
4
|
-
function
|
|
5
|
-
return
|
|
2
|
+
function mcpToolPolicyId(serverId, toolName) {
|
|
3
|
+
return `mcp:${encodeURIComponent(serverId)}:${encodeURIComponent(toolName)}`;
|
|
6
4
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function parseMcpToolName(toolName) {
|
|
11
|
-
const idx = toolName.indexOf("__");
|
|
12
|
-
if (idx <= 0) return null;
|
|
13
|
-
return {
|
|
14
|
-
serverId: toolName.slice(0, idx),
|
|
15
|
-
toolId: toolName.slice(idx + 2)
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function isMcpToolDenied(toolName, policy) {
|
|
19
|
-
const parsed = parseMcpToolName(toolName);
|
|
20
|
-
if (!parsed || !policy) return false;
|
|
21
|
-
return policy.servers?.[parsed.serverId]?.mode === "deny" || policy.tools?.[toolName]?.mode === "deny";
|
|
5
|
+
function isMcpCatalogToolDenied(identity, policy) {
|
|
6
|
+
if (!policy) return false;
|
|
7
|
+
return policy.servers?.[identity.serverId]?.mode === "deny" || policy.tools?.[identity.policyToolId]?.mode === "deny";
|
|
22
8
|
}
|
|
23
9
|
//#endregion
|
|
24
|
-
export {
|
|
10
|
+
export { isMcpCatalogToolDenied, mcpToolPolicyId };
|
|
@@ -2,12 +2,12 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
4
4
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
5
|
-
import { sanitizeServerName } from "./bundle-mcp-names.js";
|
|
6
5
|
import { redactSensitiveUrlLikeString } from "../../utils/redact-sensitive-url.js";
|
|
7
6
|
import { loadEmbeddedMcpConfig } from "./embedded-mcp.js";
|
|
8
7
|
import { resolveConnectorSecretReferences } from "../../connectors/secret-store.js";
|
|
9
8
|
import { isMcpConfigRecord } from "./mcp-config-shared.js";
|
|
10
9
|
import { resolveMcpTransport } from "./mcp-transport.js";
|
|
10
|
+
import { sanitizeServerName } from "./bundle-mcp-names.js";
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
13
13
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
@@ -182,7 +182,7 @@ function createSessionMcpRuntime(params) {
|
|
|
182
182
|
phase: "agent.mcp_connect",
|
|
183
183
|
serverName,
|
|
184
184
|
safeServerName
|
|
185
|
-
}, `bundle-mcp: server key "${serverName}"
|
|
185
|
+
}, `bundle-mcp: server key "${serverName}" uses policy namespace "${safeServerName}"`);
|
|
186
186
|
const client = new Client({
|
|
187
187
|
name: "xopc-bundle-mcp",
|
|
188
188
|
version: "0.0.0"
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { McpCatalogTool, McpServerCatalog, McpToolCatalog, SessionMcpRuntime, SessionMcpRuntimeManager, } from "./bundle-mcp-types.js";
|
|
2
2
|
export { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey, } from "./bundle-mcp-runtime.js";
|
|
3
|
-
export { createBundleMcpToolRuntime, materializeBundleMcpToolsForRun, } from "./bundle-mcp-materialize.js";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey } from "./bundle-mcp-runtime.js";
|
|
2
|
-
|
|
3
|
-
export { __testing, createBundleMcpToolRuntime, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, materializeBundleMcpToolsForRun, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
2
|
+
export { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import type { JsonSchemaType } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
3
3
|
import type { Config } from "../../config/schema.js";
|
|
4
|
-
import type { AgentTool as AnyAgentTool } from "@earendil-works/pi-agent-core";
|
|
5
|
-
export type BundleMcpToolRuntime = {
|
|
6
|
-
tools: AnyAgentTool[];
|
|
7
|
-
dispose: () => Promise<void>;
|
|
8
|
-
};
|
|
9
4
|
export type McpServerCatalog = {
|
|
10
5
|
serverName: string;
|
|
11
6
|
launchSummary: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isMcpCatalogToolDenied, mcpToolPolicyId } from "./bundle-mcp-policy.js";
|
|
2
2
|
import { loadMergedBundleMcpConfig } from "./bundle-mcp-config.js";
|
|
3
3
|
import { loadEmbeddedMcpConfig } from "./embedded-mcp.js";
|
|
4
4
|
import { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey } from "./bundle-mcp-runtime.js";
|
|
5
|
-
import { isBundleMcpTool } from "./mcp-tool-meta.js";
|
|
6
|
-
import { createBundleMcpToolRuntime, materializeBundleMcpToolsForRun } from "./bundle-mcp-materialize.js";
|
|
7
5
|
import "./bundle-mcp-tools.js";
|
|
8
|
-
|
|
9
|
-
export { __testing, createBundleMcpToolRuntime, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, isBundleMcpTool, isMcpToolDenied, isMcpToolName, loadEmbeddedMcpConfig, loadMergedBundleMcpConfig, materializeBundleMcpToolsForRun, mergeTurnTools, parseMcpToolName, resolveEmbeddedMcpToolsForTurn, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey, shouldCreateBundleMcpRuntimeForAttempt };
|
|
6
|
+
export { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, isMcpCatalogToolDenied, loadEmbeddedMcpConfig, loadMergedBundleMcpConfig, mcpToolPolicyId, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { killProcessTree } from "../../process/kill-tree.js";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { PassThrough } from "node:stream";
|
|
4
3
|
import process from "node:process";
|
|
4
|
+
import { PassThrough } from "node:stream";
|
|
5
5
|
import { getDefaultEnvironment } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
6
6
|
import { ReadBuffer, serializeMessage } from "@modelcontextprotocol/sdk/shared/stdio.js";
|
|
7
7
|
//#region src/agent/mcp/mcp-stdio-transport.ts
|
|
@@ -3,9 +3,9 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
4
4
|
import { XopcStdioClientTransport } from "./mcp-stdio-transport.js";
|
|
5
5
|
import { resolveMcpTransportConfig } from "./mcp-transport-config.js";
|
|
6
|
-
import { fetch } from "undici";
|
|
7
6
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
8
7
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
|
+
import { fetch } from "undici";
|
|
9
9
|
//#region src/agent/mcp/mcp-transport.ts
|
|
10
10
|
init_logger();
|
|
11
11
|
init_string_coerce();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentMessage } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { MemoryManager } from '../manager.js';
|
|
3
3
|
import type { UserContextPlan } from './types.js';
|
|
4
|
+
export declare function isUserSelfSummaryQuery(query: string): boolean;
|
|
4
5
|
export declare function prependAgentContext(message: AgentMessage, block: string): AgentMessage;
|
|
5
6
|
export declare class UserContextPlanner {
|
|
6
7
|
plan(params: {
|
|
@@ -4,9 +4,10 @@ import { appendMemorySignal, appendMemoryTraceEvent, hasUnresolvedMemoryConflict
|
|
|
4
4
|
import { consumeMemoryReferenceConsent, ensureMemoryReferenceConsentRequest, hasMemoryReferenceConsent } from "../../../storage/sqlite/memory-reference-consent-repository.js";
|
|
5
5
|
import "../../../storage/sqlite/index.js";
|
|
6
6
|
import { readAgentMessageContent } from "../agent-message-access.js";
|
|
7
|
-
import { buildUserContextBlock } from "../context-fence.js";
|
|
8
7
|
import { resolveMemoryStability } from "../lifecycle.js";
|
|
9
8
|
import { classifyMemoryContextOrigin } from "../source-origin.js";
|
|
9
|
+
import { USER_CONTEXT_MEMORY_KINDS, isUserContextRecord } from "../../../user-context/projection.js";
|
|
10
|
+
import { buildUserContextBlock } from "../context-fence.js";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
//#region src/agent/memory/context/planner.ts
|
|
12
13
|
init_logger();
|
|
@@ -20,7 +21,18 @@ const BASELINE_KINDS = [
|
|
|
20
21
|
"user_profile",
|
|
21
22
|
"personal_logistics"
|
|
22
23
|
];
|
|
24
|
+
const SELF_SUMMARY_PATTERNS = [
|
|
25
|
+
/(?:介绍|说说|描述|总结)(?:一下|下)?你?(?:所)?(?:了解|知道|认知)(?:到)?的?我/u,
|
|
26
|
+
/你眼中的我/u,
|
|
27
|
+
/(?:关于我你|你(?:对我|关于我))(?:有)?(?:哪些|什么)?(?:了解|认知|知道|记得|印象)/u,
|
|
28
|
+
/(?:what (?:do|can) you|what you) (?:know|understand|remember) about me/i,
|
|
29
|
+
/(?:describe|summari[sz]e|introduce) me/i,
|
|
30
|
+
/(?:how do you see|your impression of) me/i
|
|
31
|
+
];
|
|
23
32
|
const log = createLogger("UserContextPlanner");
|
|
33
|
+
function isUserSelfSummaryQuery(query) {
|
|
34
|
+
return SELF_SUMMARY_PATTERNS.some((pattern) => pattern.test(query));
|
|
35
|
+
}
|
|
24
36
|
function sectionFor(record) {
|
|
25
37
|
if (record.kind === "boundary") return "safety";
|
|
26
38
|
if (record.kind === "preference" || record.kind === "user_profile" || record.kind === "relationship" || record.kind === "routine" || record.kind === "personal_logistics" || record.kind === "tool_preference") return "interaction";
|
|
@@ -104,23 +116,26 @@ var UserContextPlanner = class {
|
|
|
104
116
|
userId: "local-owner",
|
|
105
117
|
sessionKey: params.sessionKey
|
|
106
118
|
};
|
|
107
|
-
const
|
|
119
|
+
const selfSummary = isUserSelfSummaryQuery(query);
|
|
120
|
+
const baselineKinds = selfSummary ? USER_CONTEXT_MEMORY_KINDS : BASELINE_KINDS;
|
|
121
|
+
const [searchedResults, baselineLists] = await Promise.all([params.memoryManager.search({
|
|
108
122
|
query,
|
|
109
123
|
scope,
|
|
110
124
|
maxResults,
|
|
111
125
|
minScore: .15
|
|
112
|
-
}).catch(() => []), Promise.all(
|
|
126
|
+
}).catch(() => []), Promise.all(baselineKinds.map((kind) => params.memoryManager.list({
|
|
113
127
|
kind,
|
|
114
128
|
status: "active",
|
|
115
129
|
scope
|
|
116
130
|
}).catch(() => [])))]);
|
|
131
|
+
const taskResults = selfSummary ? searchedResults.filter((result) => isUserContextRecord(result.record)) : searchedResults;
|
|
117
132
|
const taskIds = new Set(taskResults.map((result) => result.record.id));
|
|
118
|
-
const baselineResults = baselineLists.flat().filter((record) => !taskIds.has(record.id)).filter((record) => record.kind === "boundary" || record.explicitness === "explicit" || record.importance >= .7).map((record) => ({
|
|
133
|
+
const baselineResults = baselineLists.flat().filter((record) => !taskIds.has(record.id)).filter((record) => isUserContextRecord(record)).filter((record) => selfSummary || record.kind === "boundary" || record.explicitness === "explicit" || record.importance >= .7).map((record) => ({
|
|
119
134
|
record,
|
|
120
|
-
score: record.kind === "boundary" ? .7 : .42,
|
|
135
|
+
score: record.kind === "boundary" ? .7 : selfSummary ? .6 : .42,
|
|
121
136
|
snippet: record.content,
|
|
122
137
|
citation: {
|
|
123
|
-
providerId: record.
|
|
138
|
+
providerId: record.providerId,
|
|
124
139
|
recordId: record.id,
|
|
125
140
|
path: record.source.path,
|
|
126
141
|
lineStart: record.source.lineStart,
|
|
@@ -268,4 +283,4 @@ var UserContextPlanner = class {
|
|
|
268
283
|
}
|
|
269
284
|
};
|
|
270
285
|
//#endregion
|
|
271
|
-
export { UserContextPlanner, prependAgentContext };
|
|
286
|
+
export { UserContextPlanner, isUserSelfSummaryQuery, prependAgentContext };
|
|
@@ -56,7 +56,10 @@ export declare class MemoryManager {
|
|
|
56
56
|
source?: MemoryRecord['source'];
|
|
57
57
|
reviewSource?: 'turn' | 'background';
|
|
58
58
|
}): Promise<import('./understanding/types.js').UnderstandingReviewResult>;
|
|
59
|
-
|
|
59
|
+
getExternalToolEntries(): Array<{
|
|
60
|
+
providerId: string;
|
|
61
|
+
tool: AgentTool;
|
|
62
|
+
}>;
|
|
60
63
|
handleToolCall(toolName: string, args: Record<string, unknown>): Promise<string>;
|
|
61
64
|
search(request: MemorySearchRequest): Promise<MemorySearchResult[]>;
|
|
62
65
|
read(request: MemoryReadRequest): Promise<MemoryReadResult | null>;
|
|
@@ -140,7 +140,7 @@ var MemoryManager = class {
|
|
|
140
140
|
...sourceItemId ? { sourceItemId } : {}
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
getExternalToolEntries() {
|
|
144
144
|
const out = [];
|
|
145
145
|
const seen = /* @__PURE__ */ new Set();
|
|
146
146
|
for (const p of this.providers) {
|
|
@@ -148,7 +148,10 @@ var MemoryManager = class {
|
|
|
148
148
|
try {
|
|
149
149
|
for (const t of p.getToolSchemas?.() ?? []) if (t.name && !seen.has(t.name)) {
|
|
150
150
|
seen.add(t.name);
|
|
151
|
-
out.push(
|
|
151
|
+
out.push({
|
|
152
|
+
providerId: p.id,
|
|
153
|
+
tool: t
|
|
154
|
+
});
|
|
152
155
|
}
|
|
153
156
|
} catch (err) {
|
|
154
157
|
log.warn({
|
|
@@ -75,7 +75,7 @@ export declare class CommandHandler {
|
|
|
75
75
|
updateAgentConfig(config: Config): void;
|
|
76
76
|
/**
|
|
77
77
|
* Build the unified command context shared by all execute paths.
|
|
78
|
-
* When `recorder` is set, every reply text is also captured (for
|
|
78
|
+
* When `recorder` is set, every reply text is also captured (for realtime / CLI aggregation).
|
|
79
79
|
*/
|
|
80
80
|
private buildCommandContext;
|
|
81
81
|
/**
|
|
@@ -83,7 +83,7 @@ export declare class CommandHandler {
|
|
|
83
83
|
*/
|
|
84
84
|
executeCommand(commandName: string, args: string, context: CommandContext): Promise<boolean>;
|
|
85
85
|
/**
|
|
86
|
-
* Run command and return all user-visible text (ctx.reply + result.content) for
|
|
86
|
+
* Run command and return all user-visible text (ctx.reply + result.content) for realtime/CLI.
|
|
87
87
|
* Same bus side effects as {@link executeCommand}.
|
|
88
88
|
*/
|
|
89
89
|
executeCommandAndAggregateReply(commandName: string, args: string, context: CommandContext, options?: {
|
|
@@ -8,7 +8,7 @@ import "../../chat-commands/index.js";
|
|
|
8
8
|
init_providers();
|
|
9
9
|
init_logger();
|
|
10
10
|
const log = createLogger("CommandHandler");
|
|
11
|
-
/** Gateway console direct stream uses
|
|
11
|
+
/** Gateway console direct stream uses realtime events; there is no ChannelPlugin outbound for `webchat`. */
|
|
12
12
|
function shouldSkipBusOutboundForChannel(channel) {
|
|
13
13
|
return channel === "webchat";
|
|
14
14
|
}
|
|
@@ -53,7 +53,7 @@ var CommandHandler = class {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Build the unified command context shared by all execute paths.
|
|
56
|
-
* When `recorder` is set, every reply text is also captured (for
|
|
56
|
+
* When `recorder` is set, every reply text is also captured (for realtime / CLI aggregation).
|
|
57
57
|
*/
|
|
58
58
|
buildCommandContext(context, recorder, emitEvent) {
|
|
59
59
|
const skipBusOutbound = shouldSkipBusOutboundForChannel(context.channel);
|
|
@@ -162,7 +162,7 @@ var CommandHandler = class {
|
|
|
162
162
|
return true;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
* Run command and return all user-visible text (ctx.reply + result.content) for
|
|
165
|
+
* Run command and return all user-visible text (ctx.reply + result.content) for realtime/CLI.
|
|
166
166
|
* Same bus side effects as {@link executeCommand}.
|
|
167
167
|
*/
|
|
168
168
|
async executeCommandAndAggregateReply(commandName, args, context, options) {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Stream Manager - Manages
|
|
2
|
+
* Stream Manager - Manages channel response streams.
|
|
3
3
|
*
|
|
4
|
-
* Handles creation and lifecycle of stream handles for
|
|
5
|
-
* and streaming responses.
|
|
4
|
+
* Handles creation and lifecycle of stream handles for streaming responses.
|
|
6
5
|
*/
|
|
7
|
-
import type { ProgressStage } from '../lifecycle/progress.js';
|
|
8
6
|
export interface StreamHandle {
|
|
9
7
|
update: (text: string) => void;
|
|
10
8
|
updateReasoning?: (text: string) => void;
|
|
11
|
-
updateProgress?: (text: string, stage: ProgressStage, detail?: string) => void;
|
|
12
|
-
setProgress?: (stage: ProgressStage, detail?: string) => void;
|
|
13
9
|
end: () => Promise<void>;
|
|
14
10
|
abort: () => Promise<void>;
|
|
15
11
|
messageId: () => number | undefined;
|
|
@@ -56,12 +52,4 @@ export declare class StreamManager {
|
|
|
56
52
|
* Get the current message ID from the stream handle
|
|
57
53
|
*/
|
|
58
54
|
getMessageId(): number | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Update progress via the stream handle
|
|
61
|
-
*/
|
|
62
|
-
updateProgress(text: string, stage: ProgressStage, detail?: string): void;
|
|
63
|
-
/**
|
|
64
|
-
* Set progress stage via the stream handle
|
|
65
|
-
*/
|
|
66
|
-
setProgress(stage: ProgressStage, detail?: string): void;
|
|
67
55
|
}
|
|
@@ -71,18 +71,6 @@ var StreamManager = class {
|
|
|
71
71
|
getMessageId() {
|
|
72
72
|
return this.currentHandle?.messageId();
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Update progress via the stream handle
|
|
76
|
-
*/
|
|
77
|
-
updateProgress(text, stage, detail) {
|
|
78
|
-
if (this.currentHandle?.updateProgress) this.currentHandle.updateProgress(text, stage, detail);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Set progress stage via the stream handle
|
|
82
|
-
*/
|
|
83
|
-
setProgress(stage, detail) {
|
|
84
|
-
if (this.currentHandle?.setProgress) this.currentHandle.setProgress(stage, detail);
|
|
85
|
-
}
|
|
86
74
|
};
|
|
87
75
|
//#endregion
|
|
88
76
|
export { StreamManager };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent Event Handler — coordinates listeners on pi-agent events.
|
|
3
3
|
*
|
|
4
4
|
* Previously a single god-handler with ten manager fields and one `switch`. Now a
|
|
5
|
-
* thin façade around {@link SessionEventBus}: each concern (
|
|
5
|
+
* thin façade around {@link SessionEventBus}: each concern (lifecycle
|
|
6
6
|
* hooks, tool-chain recording, error tracking, self-verify, etc.) registers its
|
|
7
7
|
* own listener at construction time, and external code can add new listeners via
|
|
8
8
|
* {@link AgentEventHandler.registerListener} without modifying this file (OCP).
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { AgentEvent } from '@earendil-works/pi-agent-core';
|
|
16
16
|
import type { SessionContext } from '../session/session-context.js';
|
|
17
|
-
import type { ProgressFeedbackManager } from '../lifecycle/progress.js';
|
|
18
17
|
import type { ToolErrorTracker } from '../tools/error-tracker.js';
|
|
19
18
|
import type { RequestLimiter } from '../models/request-limiter.js';
|
|
20
19
|
import type { LifecycleManager } from '../lifecycle/index.js';
|
|
@@ -38,7 +37,6 @@ export declare class SessionEventBus {
|
|
|
38
37
|
}
|
|
39
38
|
export declare function readChangedPathsFromToolEnd(toolName: string, args: unknown, result: unknown): string[];
|
|
40
39
|
export interface AgentEventHandlerConfig {
|
|
41
|
-
progressManager: ProgressFeedbackManager;
|
|
42
40
|
errorTracker: ToolErrorTracker;
|
|
43
41
|
requestLimiter: RequestLimiter;
|
|
44
42
|
lifecycleManager: LifecycleManager;
|
|
@@ -33,39 +33,6 @@ var SessionEventBus = class {
|
|
|
33
33
|
if (all) for (const listener of all) listener(event, context);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
function installProgressListener(bus, progressManager) {
|
|
37
|
-
bus.on("agent_start", () => {
|
|
38
|
-
log.debug("Agent turn started");
|
|
39
|
-
progressManager.startTask();
|
|
40
|
-
});
|
|
41
|
-
bus.on("turn_start", () => {
|
|
42
|
-
log.debug("Turn started");
|
|
43
|
-
progressManager.onTurnStart();
|
|
44
|
-
});
|
|
45
|
-
bus.on("tool_execution_start", (event) => {
|
|
46
|
-
const e = event;
|
|
47
|
-
log.debug({
|
|
48
|
-
tool: e.toolName,
|
|
49
|
-
args: e.args
|
|
50
|
-
}, "Tool execution started");
|
|
51
|
-
progressManager.onToolStart(e.toolName, e.args || {});
|
|
52
|
-
});
|
|
53
|
-
bus.on("tool_execution_update", (event) => {
|
|
54
|
-
const e = event;
|
|
55
|
-
progressManager.onToolUpdate(e.toolName, e.partialResult);
|
|
56
|
-
});
|
|
57
|
-
bus.on("tool_execution_end", (event) => {
|
|
58
|
-
const e = event;
|
|
59
|
-
log.debug({
|
|
60
|
-
tool: e.toolName,
|
|
61
|
-
isError: e.isError
|
|
62
|
-
}, "Tool execution complete");
|
|
63
|
-
progressManager.onToolEnd(e.toolName, e.result, e.isError);
|
|
64
|
-
});
|
|
65
|
-
bus.on("agent_end", () => {
|
|
66
|
-
progressManager.endTask();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
36
|
function installRequestLimitListener(bus, deps) {
|
|
70
37
|
bus.on("agent_start", (_event, context) => {
|
|
71
38
|
const result = deps.requestLimiter.recordRequest();
|
|
@@ -82,7 +49,6 @@ function installRequestLimitListener(bus, deps) {
|
|
|
82
49
|
maxRequests: result.limit
|
|
83
50
|
}, `Lifecycle emit llm_request failed: ${em}`);
|
|
84
51
|
});
|
|
85
|
-
deps.progressManager.onRequestLimitStatus(result.count, result.limit, result.remaining, result.isWarning, result.shouldStop);
|
|
86
52
|
if (result.shouldStop) log.error({
|
|
87
53
|
count: result.count,
|
|
88
54
|
limit: result.limit,
|
|
@@ -316,10 +282,8 @@ var AgentEventHandler = class {
|
|
|
316
282
|
bus;
|
|
317
283
|
constructor(config) {
|
|
318
284
|
this.bus = new SessionEventBus();
|
|
319
|
-
installProgressListener(this.bus, config.progressManager);
|
|
320
285
|
installRequestLimitListener(this.bus, {
|
|
321
286
|
requestLimiter: config.requestLimiter,
|
|
322
|
-
progressManager: config.progressManager,
|
|
323
287
|
lifecycleManager: config.lifecycleManager
|
|
324
288
|
});
|
|
325
289
|
installLifecycleHookListener(this.bus, config.lifecycleManager);
|
|
@@ -11,16 +11,12 @@ import type { SessionHydrator } from '../session/index.js';
|
|
|
11
11
|
import type { ThinkLevel } from '../transcript/thinking-types.js';
|
|
12
12
|
import type { ModelManager } from '../models/index.js';
|
|
13
13
|
import type { SessionContext } from '../session/session-context.js';
|
|
14
|
-
import type { AgentEventHandler } from './agent-event-handler.js';
|
|
15
|
-
import type { FeedbackCoordinator } from '../feedback/feedback-coordinator.js';
|
|
16
14
|
import type { AgentManager } from '../agent-manager.js';
|
|
17
15
|
import type { EmbeddedStreamEvent } from '../embedded/types.js';
|
|
18
16
|
export interface AgentOrchestratorConfig {
|
|
19
17
|
agentManager: AgentManager;
|
|
20
18
|
sessionStore: SessionStore;
|
|
21
19
|
modelManager: ModelManager;
|
|
22
|
-
eventHandler: AgentEventHandler;
|
|
23
|
-
feedbackCoordinator: FeedbackCoordinator;
|
|
24
20
|
sessionConfigStore: SessionConfigStore;
|
|
25
21
|
/** Per-session hydration (workspace override + model override) before the agent runs. */
|
|
26
22
|
sessionHydrator: SessionHydrator;
|
|
@@ -46,7 +42,6 @@ export declare class AgentOrchestrator {
|
|
|
46
42
|
private agentManager;
|
|
47
43
|
private sessionStore;
|
|
48
44
|
private modelManager;
|
|
49
|
-
private feedbackCoordinator;
|
|
50
45
|
private sessionConfigStore;
|
|
51
46
|
private sessionHydrator;
|
|
52
47
|
private getThinkingDefault;
|
|
@@ -22,7 +22,6 @@ var AgentOrchestrator = class {
|
|
|
22
22
|
agentManager;
|
|
23
23
|
sessionStore;
|
|
24
24
|
modelManager;
|
|
25
|
-
feedbackCoordinator;
|
|
26
25
|
sessionConfigStore;
|
|
27
26
|
sessionHydrator;
|
|
28
27
|
getThinkingDefault;
|
|
@@ -35,7 +34,6 @@ var AgentOrchestrator = class {
|
|
|
35
34
|
this.agentManager = config.agentManager;
|
|
36
35
|
this.sessionStore = config.sessionStore;
|
|
37
36
|
this.modelManager = config.modelManager;
|
|
38
|
-
this.feedbackCoordinator = config.feedbackCoordinator;
|
|
39
37
|
this.sessionConfigStore = config.sessionConfigStore;
|
|
40
38
|
this.sessionHydrator = config.sessionHydrator;
|
|
41
39
|
this.getThinkingDefault = config.getThinkingDefault;
|
|
@@ -96,7 +94,6 @@ var AgentOrchestrator = class {
|
|
|
96
94
|
message: userMessage,
|
|
97
95
|
modelRef
|
|
98
96
|
});
|
|
99
|
-
this.feedbackCoordinator.startTask();
|
|
100
97
|
const turnResult = await (async () => {
|
|
101
98
|
try {
|
|
102
99
|
return await runEmbeddedTurnForSession({
|
|
@@ -125,13 +122,11 @@ var AgentOrchestrator = class {
|
|
|
125
122
|
sessionKey,
|
|
126
123
|
errorMessage: turnResult.errorMessage
|
|
127
124
|
}, "Embedded inbound turn failed");
|
|
128
|
-
this.feedbackCoordinator.endTask();
|
|
129
125
|
} catch (error) {
|
|
130
126
|
log.error({
|
|
131
127
|
err: error,
|
|
132
128
|
sessionKey
|
|
133
129
|
}, "Error in agent orchestration");
|
|
134
|
-
this.feedbackCoordinator.endTask();
|
|
135
130
|
throw error;
|
|
136
131
|
}
|
|
137
132
|
}
|