@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,83 @@
|
|
|
1
|
+
import { clientEndpointMessageSchema, endpointHelloPayloadSchema, serverEndpointMessageSchema } from "../../endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const REALTIME_MAX_CLIENT_FRAME_BYTES = 256 * 1024;
|
|
4
|
+
const REALTIME_HELLO_TIMEOUT_MS = 5e3;
|
|
5
|
+
const REALTIME_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
6
|
+
const REALTIME_HEARTBEAT_TIMEOUT_MS = 45e3;
|
|
7
|
+
const realtimeClientKindSchema = z.enum([
|
|
8
|
+
"web",
|
|
9
|
+
"desktop",
|
|
10
|
+
"mobile",
|
|
11
|
+
"tui",
|
|
12
|
+
"mcp"
|
|
13
|
+
]);
|
|
14
|
+
const realtimeTopicSchema = z.string().min(1).max(512);
|
|
15
|
+
const realtimeEventNameSchema = z.string().regex(/^[a-z][a-z0-9_.-]*$/).max(160);
|
|
16
|
+
const messageIdSchema = z.uuid();
|
|
17
|
+
const timestampSchema = z.number().int().nonnegative();
|
|
18
|
+
const sequenceSchema = z.number().int().positive();
|
|
19
|
+
const envelope = (kind, payload) => z.strictObject({
|
|
20
|
+
protocolVersion: z.literal(1),
|
|
21
|
+
messageId: messageIdSchema,
|
|
22
|
+
kind: z.literal(kind),
|
|
23
|
+
sentAt: timestampSchema,
|
|
24
|
+
payload
|
|
25
|
+
});
|
|
26
|
+
const realtimeSubscriptionSchema = z.strictObject({
|
|
27
|
+
topic: realtimeTopicSchema,
|
|
28
|
+
afterSeq: z.number().int().nonnegative().optional()
|
|
29
|
+
});
|
|
30
|
+
const clientRealtimeMessageSchema = z.discriminatedUnion("kind", [
|
|
31
|
+
envelope("realtime.hello", z.strictObject({
|
|
32
|
+
ticket: z.string().min(32).max(512),
|
|
33
|
+
clientId: z.string().min(1).max(160),
|
|
34
|
+
clientKind: realtimeClientKindSchema,
|
|
35
|
+
subscriptions: z.array(realtimeSubscriptionSchema).max(100).default([]),
|
|
36
|
+
endpoint: endpointHelloPayloadSchema.optional()
|
|
37
|
+
})),
|
|
38
|
+
envelope("realtime.subscribe", z.strictObject({ subscriptions: z.array(realtimeSubscriptionSchema).min(1).max(100) })),
|
|
39
|
+
envelope("realtime.unsubscribe", z.strictObject({ topics: z.array(realtimeTopicSchema).min(1).max(100) })),
|
|
40
|
+
envelope("realtime.ping", z.strictObject({})),
|
|
41
|
+
envelope("endpoint.message", clientEndpointMessageSchema)
|
|
42
|
+
]);
|
|
43
|
+
const realtimeEventPayloadSchema = z.strictObject({
|
|
44
|
+
topic: realtimeTopicSchema,
|
|
45
|
+
seq: sequenceSchema,
|
|
46
|
+
event: realtimeEventNameSchema,
|
|
47
|
+
data: z.unknown()
|
|
48
|
+
});
|
|
49
|
+
const serverRealtimeMessageSchema = z.discriminatedUnion("kind", [
|
|
50
|
+
envelope("realtime.ready", z.strictObject({
|
|
51
|
+
connectionId: z.uuid(),
|
|
52
|
+
heartbeatIntervalMs: z.literal(REALTIME_HEARTBEAT_INTERVAL_MS),
|
|
53
|
+
heartbeatTimeoutMs: z.literal(REALTIME_HEARTBEAT_TIMEOUT_MS),
|
|
54
|
+
endpoint: z.strictObject({
|
|
55
|
+
endpointId: z.string().min(1).max(160),
|
|
56
|
+
turnToken: z.string().min(32).max(160)
|
|
57
|
+
}).optional()
|
|
58
|
+
})),
|
|
59
|
+
envelope("realtime.event", realtimeEventPayloadSchema),
|
|
60
|
+
envelope("realtime.gap", z.strictObject({
|
|
61
|
+
topic: realtimeTopicSchema,
|
|
62
|
+
requestedSeq: z.number().int().nonnegative(),
|
|
63
|
+
earliestSeq: sequenceSchema
|
|
64
|
+
})),
|
|
65
|
+
envelope("realtime.pong", z.strictObject({})),
|
|
66
|
+
envelope("realtime.error", z.strictObject({
|
|
67
|
+
code: z.string().min(1).max(80),
|
|
68
|
+
message: z.string().min(1).max(500)
|
|
69
|
+
})),
|
|
70
|
+
envelope("endpoint.message", serverEndpointMessageSchema)
|
|
71
|
+
]);
|
|
72
|
+
function parseClientRealtimeMessage(value) {
|
|
73
|
+
return clientRealtimeMessageSchema.parse(value);
|
|
74
|
+
}
|
|
75
|
+
function parseServerRealtimeMessage(value) {
|
|
76
|
+
return serverRealtimeMessageSchema.parse(value);
|
|
77
|
+
}
|
|
78
|
+
function parseClientRealtimeJsonFrame(text) {
|
|
79
|
+
if (new TextEncoder().encode(text).byteLength > 262144) throw new Error(`Realtime client frame exceeds ${REALTIME_MAX_CLIENT_FRAME_BYTES} bytes`);
|
|
80
|
+
return JSON.parse(text);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { REALTIME_HEARTBEAT_INTERVAL_MS, REALTIME_HEARTBEAT_TIMEOUT_MS, REALTIME_HELLO_TIMEOUT_MS, REALTIME_MAX_CLIENT_FRAME_BYTES, parseClientRealtimeJsonFrame, parseClientRealtimeMessage, parseServerRealtimeMessage, realtimeClientKindSchema, realtimeEventNameSchema, realtimeTopicSchema };
|
|
@@ -70,6 +70,7 @@ export interface AgentManagerConfig {
|
|
|
70
70
|
model?: string;
|
|
71
71
|
config?: Config;
|
|
72
72
|
extensionRegistry?: ExtensionRegistry;
|
|
73
|
+
endpointTools?: import('../endpoint-tools/index.js').EndpointToolRuntime;
|
|
73
74
|
hookRunner?: import('../extensions/index.js').ExtensionHookRunner;
|
|
74
75
|
bus: MessageBus;
|
|
75
76
|
getCurrentContext: () => SessionContext | null;
|
|
@@ -18,6 +18,7 @@ import { buildExecutionScopeContextForPrompt } from "./context/execution-scope.j
|
|
|
18
18
|
import { clearBootstrapSnapshot } from "./bootstrap/bootstrap-cache.js";
|
|
19
19
|
import { resolveBootstrapContextSync } from "./bootstrap/bootstrap-files.js";
|
|
20
20
|
import { loadProjectAgentsContextFile } from "./bootstrap/project-agents-context.js";
|
|
21
|
+
import { disposeAllSessionMcpRuntimes, retireSessionMcpRuntimeForSessionKey } from "./mcp/bundle-mcp-runtime.js";
|
|
21
22
|
import { createSkillConfigManager, isSkillEnabled, resolveSkillConfig } from "./skills/config.js";
|
|
22
23
|
import { isValidSkillEnvVarName } from "./skills/required-env-vars.js";
|
|
23
24
|
import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "./skills/workspace-skills-dir.js";
|
|
@@ -26,8 +27,6 @@ import { isUnderManagedSkillsDir } from "./skills/managed-store.js";
|
|
|
26
27
|
import { createAgentCapabilitySessionState, resolveAgentCapabilityCatalog } from "./capabilities/registry.js";
|
|
27
28
|
import "./capabilities/index.js";
|
|
28
29
|
import { AgentToolsFactory } from "./tools/factory.js";
|
|
29
|
-
import { parseMcpToolName } from "./mcp/bundle-mcp-policy.js";
|
|
30
|
-
import { disposeAllSessionMcpRuntimes, retireSessionMcpRuntimeForSessionKey } from "./mcp/bundle-mcp-runtime.js";
|
|
31
30
|
import "./mcp/bundle-mcp-tools.js";
|
|
32
31
|
import { evictAllEmbeddedSessionRunners, evictEmbeddedSessionRunner } from "./embedded/session-runner.js";
|
|
33
32
|
import { isMemorySubsystemEnabled } from "./memory/memory-config.js";
|
|
@@ -226,6 +225,7 @@ var AgentManager = class {
|
|
|
226
225
|
return {
|
|
227
226
|
workspace: this.baseWorkspacePath,
|
|
228
227
|
extensionRegistry: this.config.extensionRegistry,
|
|
228
|
+
endpointTools: this.config.endpointTools,
|
|
229
229
|
getCurrentContext: this.config.getCurrentContext,
|
|
230
230
|
hookRunner: this.config.hookRunner,
|
|
231
231
|
bus: this.config.bus,
|
|
@@ -914,12 +914,7 @@ var AgentManager = class {
|
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
if (!this.config.hookRunner) return;
|
|
917
|
-
const
|
|
918
|
-
const hookResult = await this.config.hookRunner.runBeforeToolCall(toolName, args ?? {}, {
|
|
919
|
-
sessionKey,
|
|
920
|
-
isMcpTool: parsed !== null,
|
|
921
|
-
mcpServerId: parsed?.serverId
|
|
922
|
-
});
|
|
917
|
+
const hookResult = await this.config.hookRunner.runBeforeToolCall(toolName, args ?? {}, { sessionKey });
|
|
923
918
|
if (!hookResult.allowed) return {
|
|
924
919
|
block: true,
|
|
925
920
|
reason: hookResult.reason ?? "Tool call blocked by policy hook."
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MEMORY_REVIEW_USER_PROMPT = "Review the conversation above and identify durable user-understanding candidates.\n\nFocus on:\n1. Has the user revealed things about themselves \u2014 persona, desires, preferences, or personal details worth remembering?\n2. Has the user expressed expectations about how you should behave, their work style, emotional-support preferences, boundaries, or how they want you to communicate?\n3. Has the user explicitly corrected a prior assumption? Prefer the correction and do not preserve the contradicted interpretation.\n\nReturn JSON only, with this shape:\n{\"candidates\":[{\"kind\":\"preference\",\"content\":\"...\",\"confidence\":0.8,\"importance\":0.7,\"durability\":\"durable\",\"sensitivity\":\"normal\",\"disclosurePolicy\":\"referenceable\",\"tags\":[\"background-review\"]}]}\n\nAllowed kinds: preference, boundary, relationship, project_context, commitment, routine, personal_logistics, open_question, milestone, current_state, task_lesson, tool_preference, long_term_goal, derived_insight.\nOnly include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {\"candidates\":[]} when nothing qualifies.";
|
|
1
|
+
export declare const MEMORY_REVIEW_USER_PROMPT = "Review the conversation above and identify durable user-understanding candidates.\n\nFocus on:\n1. Has the user revealed things about themselves \u2014 persona, desires, preferences, or personal details worth remembering?\n2. Has the user expressed expectations about how you should behave, their work style, emotional-support preferences, boundaries, or how they want you to communicate?\n3. Has the user explicitly corrected a prior assumption? Prefer the correction and do not preserve the contradicted interpretation.\n\nReturn JSON only, with this shape:\n{\"candidates\":[{\"kind\":\"preference\",\"content\":\"...\",\"confidence\":0.8,\"importance\":0.7,\"durability\":\"durable\",\"sensitivity\":\"normal\",\"disclosurePolicy\":\"referenceable\",\"tags\":[\"background-review\"]}]}\n\nAllowed kinds: preference, boundary, relationship, project_context, commitment, routine, personal_logistics, open_question, milestone, current_state, task_lesson, tool_preference, long_term_goal, derived_insight.\nOnly include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {\"candidates\":[]} when nothing qualifies.\n\nDo not turn a request about the current task into user understanding. Exclude requested outputs, follow-up instructions, project-note edits, investigations, and other one-off work. Every candidate must be a complete standalone statement about the user or an enduring pattern; never return a clause fragment beginning with a connector such as \"and\", \"also\", \"\u5E76\u4E14\", \"\u4EE5\u53CA\", or \"\u7684\u4E8B\u9879\". Use long_term_goal only when the user states an enduring personal goal, not when they ask the assistant to create, update, investigate, summarize, or track something.";
|
|
2
2
|
export declare const UNDERSTANDING_REVIEW_SYSTEM_PROMPT = "You are the user-understanding synthesis stage for the same session. You do not chat with the user and cannot write storage directly. Extract only evidence-backed, durable candidates and return strict JSON matching the requested schema.";
|
|
@@ -10,7 +10,9 @@ Return JSON only, with this shape:
|
|
|
10
10
|
{"candidates":[{"kind":"preference","content":"...","confidence":0.8,"importance":0.7,"durability":"durable","sensitivity":"normal","disclosurePolicy":"referenceable","tags":["background-review"]}]}
|
|
11
11
|
|
|
12
12
|
Allowed kinds: preference, boundary, relationship, project_context, commitment, routine, personal_logistics, open_question, milestone, current_state, task_lesson, tool_preference, long_term_goal, derived_insight.
|
|
13
|
-
Only include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {"candidates":[]} when nothing qualifies
|
|
13
|
+
Only include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {"candidates":[]} when nothing qualifies.
|
|
14
|
+
|
|
15
|
+
Do not turn a request about the current task into user understanding. Exclude requested outputs, follow-up instructions, project-note edits, investigations, and other one-off work. Every candidate must be a complete standalone statement about the user or an enduring pattern; never return a clause fragment beginning with a connector such as "and", "also", "并且", "以及", or "的事项". Use long_term_goal only when the user states an enduring personal goal, not when they ask the assistant to create, update, investigate, summarize, or track something.`;
|
|
14
16
|
const UNDERSTANDING_REVIEW_SYSTEM_PROMPT = `You are the user-understanding synthesis stage for the same session. You do not chat with the user and cannot write storage directly. Extract only evidence-backed, durable candidates and return strict JSON matching the requested schema.`;
|
|
15
17
|
//#endregion
|
|
16
18
|
export { MEMORY_REVIEW_USER_PROMPT, UNDERSTANDING_REVIEW_SYSTEM_PROMPT };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Agent } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { Config } from '../../config/schema.js';
|
|
3
3
|
import type { MemoryManager } from '../memory/manager.js';
|
|
4
|
+
import type { UnderstandingCandidate } from '../memory/understanding/types.js';
|
|
4
5
|
import type { BackgroundReviewSettings } from './settings.js';
|
|
5
6
|
export interface RunBackgroundReviewParams {
|
|
6
7
|
sessionKey: string;
|
|
@@ -9,4 +10,5 @@ export interface RunBackgroundReviewParams {
|
|
|
9
10
|
memoryManager: MemoryManager;
|
|
10
11
|
getConfig: () => Config | undefined;
|
|
11
12
|
}
|
|
13
|
+
export declare function parseUnderstandingCandidates(raw: string): UnderstandingCandidate[];
|
|
12
14
|
export declare function runBackgroundReviewTurn(params: RunBackgroundReviewParams): Promise<void>;
|
|
@@ -6,6 +6,7 @@ import { createExtensionAwareStreamFn } from "../../providers/extension-stream-b
|
|
|
6
6
|
import { extractTextContent } from "../context/workspace.js";
|
|
7
7
|
import { resolveAgentTurnTimeoutMs, runAgentTurnWithTimeout } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
8
8
|
import { isAssistantTurnAborted, isAssistantTurnFailed } from "../orchestration/llm-turn-retry.js";
|
|
9
|
+
import { isDurableUnderstandingCandidate } from "../../user-context/understandingQuality.js";
|
|
9
10
|
import { MEMORY_REVIEW_USER_PROMPT, UNDERSTANDING_REVIEW_SYSTEM_PROMPT } from "./prompts.js";
|
|
10
11
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
11
12
|
//#region src/agent/background-review/run-background-review.ts
|
|
@@ -61,13 +62,15 @@ function parseUnderstandingCandidates(raw) {
|
|
|
61
62
|
const item = value;
|
|
62
63
|
if (!ALLOWED_UNDERSTANDING_KINDS.has(item.kind)) continue;
|
|
63
64
|
if (typeof item.content !== "string" || item.content.trim().length < 4) continue;
|
|
65
|
+
const kind = item.kind;
|
|
66
|
+
if (!isDurableUnderstandingCandidate(kind, item.content)) continue;
|
|
64
67
|
const confidence = typeof item.confidence === "number" ? item.confidence : .65;
|
|
65
68
|
const importance = typeof item.importance === "number" ? item.importance : .5;
|
|
66
69
|
const durability = item.durability === "ephemeral" || item.durability === "recurring" ? item.durability : "durable";
|
|
67
70
|
const sensitivity = ALLOWED_SENSITIVITIES.has(item.sensitivity) ? item.sensitivity : "personal";
|
|
68
71
|
const disclosurePolicy = item.disclosurePolicy === "silent" || item.disclosurePolicy === "ask_before_reference" ? item.disclosurePolicy : "referenceable";
|
|
69
72
|
output.push({
|
|
70
|
-
kind
|
|
73
|
+
kind,
|
|
71
74
|
content: item.content.trim(),
|
|
72
75
|
confidence: Math.max(0, Math.min(1, confidence)),
|
|
73
76
|
importance: Math.max(0, Math.min(1, importance)),
|
|
@@ -133,4 +136,4 @@ async function runBackgroundReviewTurn(params) {
|
|
|
133
136
|
await runUnderstandingReview(params);
|
|
134
137
|
}
|
|
135
138
|
//#endregion
|
|
136
|
-
export { runBackgroundReviewTurn };
|
|
139
|
+
export { parseUnderstandingCandidates, runBackgroundReviewTurn };
|
|
@@ -16,5 +16,5 @@ export declare function formatAgentRunErrorForClient(rawError: string, context?:
|
|
|
16
16
|
provider?: string;
|
|
17
17
|
modelRef?: string;
|
|
18
18
|
}): string;
|
|
19
|
-
/** Human-readable text for TUI/CLI when
|
|
19
|
+
/** Human-readable text for TUI/CLI when a run event carries structured JSON. */
|
|
20
20
|
export declare function formatAgentRunErrorForDisplay(content: string): string;
|
|
@@ -87,7 +87,7 @@ function formatAgentRunErrorForClient(rawError, context) {
|
|
|
87
87
|
}
|
|
88
88
|
return JSON.stringify(payload);
|
|
89
89
|
}
|
|
90
|
-
/** Human-readable text for TUI/CLI when
|
|
90
|
+
/** Human-readable text for TUI/CLI when a run event carries structured JSON. */
|
|
91
91
|
function formatAgentRunErrorForDisplay(content) {
|
|
92
92
|
const trimmed = content.trim();
|
|
93
93
|
if (trimmed.startsWith("Error: ")) return trimmed.slice(7);
|
|
@@ -8,9 +8,9 @@ import { dirname, join, resolve } from "node:path";
|
|
|
8
8
|
import { accessSync, chmodSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { execFile } from "node:child_process";
|
|
10
10
|
import { createHash, randomBytes } from "node:crypto";
|
|
11
|
+
import { Readable } from "node:stream";
|
|
11
12
|
import { promisify } from "node:util";
|
|
12
13
|
import { pipeline } from "node:stream/promises";
|
|
13
|
-
import { Readable } from "node:stream";
|
|
14
14
|
import lockfile from "proper-lockfile";
|
|
15
15
|
//#region src/agent/code-intelligence/binary.ts
|
|
16
16
|
init_paths();
|
|
@@ -23,7 +23,5 @@ export type RunEmbeddedForSessionParams = {
|
|
|
23
23
|
startupAction?: 'new' | 'reset';
|
|
24
24
|
forceStartupContext?: boolean;
|
|
25
25
|
applyStartupContext?: boolean;
|
|
26
|
-
/** When true, dispose session MCP runtime after this turn completes. */
|
|
27
|
-
cleanupBundleMcpOnRunEnd?: boolean;
|
|
28
26
|
};
|
|
29
27
|
export declare function runEmbeddedTurnForSession(params: RunEmbeddedForSessionParams): Promise<RunXopcEmbeddedTurnResult>;
|
|
@@ -6,7 +6,6 @@ import { evaluateContextBudget } from "../memory/context-budget.js";
|
|
|
6
6
|
import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
|
|
7
7
|
import { runXopcEmbeddedTurn } from "./run-turn.js";
|
|
8
8
|
import { applyStartupContextToUserMessage } from "../reply/apply-turn-user-enrichment.js";
|
|
9
|
-
import { mergeTurnTools, resolveEmbeddedMcpToolsForTurn } from "../mcp/resolve-embedded-mcp-tools.js";
|
|
10
9
|
import crypto from "node:crypto";
|
|
11
10
|
//#region src/agent/embedded/run-for-session.ts
|
|
12
11
|
init_logger();
|
|
@@ -61,133 +60,121 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
61
60
|
force: params.forceStartupContext
|
|
62
61
|
});
|
|
63
62
|
return await (async () => {
|
|
64
|
-
|
|
63
|
+
await maybeAutoCompactBeforeTurn({
|
|
65
64
|
sessionKey,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
sessionStore,
|
|
66
|
+
agentManager,
|
|
67
|
+
model,
|
|
68
|
+
config,
|
|
69
|
+
systemPrompt,
|
|
70
|
+
userMessage: userMessageForTurn,
|
|
71
|
+
tools,
|
|
72
|
+
imageCount: params.llmImages?.length ?? 0,
|
|
73
|
+
fallbackModels: resolvedCandidates.slice(1).map((candidate) => candidate.model),
|
|
74
|
+
abortSignal: params.abortSignal,
|
|
75
|
+
onEvent: params.onEvent
|
|
70
76
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
log.info({
|
|
78
|
+
sessionKey,
|
|
79
|
+
runId,
|
|
80
|
+
configuredModelRef,
|
|
81
|
+
primaryModelRef: modelRef,
|
|
82
|
+
candidateModelRefs: resolvedCandidates.map((candidate) => candidate.ref)
|
|
83
|
+
}, "Agent model fallback candidates resolved");
|
|
84
|
+
let lastResult;
|
|
85
|
+
let lastError;
|
|
86
|
+
let resumeLastUserMessage = false;
|
|
87
|
+
const primaryModelRef = modelRef;
|
|
88
|
+
for (let i = 0; i < resolvedCandidates.length; i++) {
|
|
89
|
+
const candidate = resolvedCandidates[i];
|
|
90
|
+
const candidateModelRef = candidate.ref;
|
|
91
|
+
const isFallbackAttempt = i > 0;
|
|
92
|
+
const candidateModel = candidate.model;
|
|
93
|
+
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
94
|
+
const rowsBeforeAttempt = hasNextCandidate ? await sessionStore.loadTranscriptRows(sessionKey) : void 0;
|
|
95
|
+
if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, candidateModel, candidateModelRef);
|
|
96
|
+
agentManager.setModelForSession(sessionKey, candidateModelRef);
|
|
97
|
+
if (isFallbackAttempt) log.info({
|
|
88
98
|
sessionKey,
|
|
89
99
|
runId,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const primaryModelRef = modelRef;
|
|
98
|
-
for (let i = 0; i < resolvedCandidates.length; i++) {
|
|
99
|
-
const candidate = resolvedCandidates[i];
|
|
100
|
-
const candidateModelRef = candidate.ref;
|
|
101
|
-
const isFallbackAttempt = i > 0;
|
|
102
|
-
const candidateModel = candidate.model;
|
|
103
|
-
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
104
|
-
const rowsBeforeAttempt = hasNextCandidate ? await sessionStore.loadTranscriptRows(sessionKey) : void 0;
|
|
105
|
-
if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, candidateModel, candidateModelRef);
|
|
106
|
-
agentManager.setModelForSession(sessionKey, candidateModelRef);
|
|
107
|
-
if (isFallbackAttempt) log.info({
|
|
100
|
+
primaryModelRef,
|
|
101
|
+
fallbackModelRef: candidateModelRef,
|
|
102
|
+
attempt: i + 1,
|
|
103
|
+
total: resolvedCandidates.length
|
|
104
|
+
}, "Agent model fallback started");
|
|
105
|
+
try {
|
|
106
|
+
const turnResult = await runXopcEmbeddedTurn({
|
|
108
107
|
sessionKey,
|
|
109
108
|
runId,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
109
|
+
userMessage: userMessageForTurn,
|
|
110
|
+
images: params.llmImages,
|
|
111
|
+
model: candidateModel,
|
|
112
|
+
modelRef: candidateModelRef,
|
|
113
|
+
tools,
|
|
114
|
+
systemPrompt,
|
|
115
|
+
thinkingLevel,
|
|
116
|
+
workspaceDir,
|
|
117
|
+
sessionStore,
|
|
118
|
+
timeoutMs: turnTimeoutMs,
|
|
119
|
+
abortSignal: params.abortSignal,
|
|
120
|
+
onEvent: params.onEvent,
|
|
121
|
+
resumeLastUserMessage
|
|
122
|
+
});
|
|
123
|
+
if (turnResult.ok) {
|
|
124
|
+
if (isFallbackAttempt) log.info({
|
|
117
125
|
sessionKey,
|
|
118
126
|
runId,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
model: candidateModel,
|
|
122
|
-
modelRef: candidateModelRef,
|
|
123
|
-
tools: turnTools,
|
|
124
|
-
systemPrompt,
|
|
125
|
-
thinkingLevel,
|
|
126
|
-
workspaceDir,
|
|
127
|
-
sessionStore,
|
|
128
|
-
timeoutMs: turnTimeoutMs,
|
|
129
|
-
abortSignal: params.abortSignal,
|
|
130
|
-
onEvent: params.onEvent,
|
|
131
|
-
resumeLastUserMessage
|
|
132
|
-
});
|
|
133
|
-
if (turnResult.ok) {
|
|
134
|
-
if (isFallbackAttempt) log.info({
|
|
135
|
-
sessionKey,
|
|
136
|
-
runId,
|
|
137
|
-
primaryModelRef,
|
|
138
|
-
fallbackModelRef: candidateModelRef,
|
|
139
|
-
attempt: i + 1,
|
|
140
|
-
total: resolvedCandidates.length
|
|
141
|
-
}, "Agent model fallback succeeded");
|
|
142
|
-
return turnResult;
|
|
143
|
-
}
|
|
144
|
-
lastResult = turnResult;
|
|
145
|
-
log.warn({
|
|
146
|
-
sessionKey,
|
|
147
|
-
runId,
|
|
148
|
-
modelRef: candidateModelRef,
|
|
127
|
+
primaryModelRef,
|
|
128
|
+
fallbackModelRef: candidateModelRef,
|
|
149
129
|
attempt: i + 1,
|
|
150
|
-
total: resolvedCandidates.length
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
130
|
+
total: resolvedCandidates.length
|
|
131
|
+
}, "Agent model fallback succeeded");
|
|
132
|
+
return turnResult;
|
|
133
|
+
}
|
|
134
|
+
lastResult = turnResult;
|
|
135
|
+
log.warn({
|
|
136
|
+
sessionKey,
|
|
137
|
+
runId,
|
|
138
|
+
modelRef: candidateModelRef,
|
|
139
|
+
attempt: i + 1,
|
|
140
|
+
total: resolvedCandidates.length,
|
|
141
|
+
hasNextCandidate,
|
|
142
|
+
errorMessage: turnResult.errorMessage
|
|
143
|
+
}, hasNextCandidate ? "Agent model turn failed, trying fallback" : "Agent model turn failed, no fallback remains");
|
|
144
|
+
} catch (err) {
|
|
145
|
+
lastError = err;
|
|
146
|
+
if (err instanceof DOMException && err.name === "AbortError") throw err;
|
|
147
|
+
log.warn({
|
|
148
|
+
err,
|
|
149
|
+
sessionKey,
|
|
150
|
+
runId,
|
|
151
|
+
modelRef: candidateModelRef,
|
|
152
|
+
attempt: i + 1,
|
|
153
|
+
total: resolvedCandidates.length,
|
|
154
|
+
hasNextCandidate
|
|
155
|
+
}, hasNextCandidate ? "Agent model call threw, trying fallback" : "Agent model call threw, no fallback remains");
|
|
156
|
+
}
|
|
157
|
+
if (hasNextCandidate && rowsBeforeAttempt) {
|
|
158
|
+
const preparation = await sessionStore.prepareModelFallback(sessionKey, rowsBeforeAttempt);
|
|
159
|
+
if (preparation === "unsafe") {
|
|
157
160
|
log.warn({
|
|
158
|
-
err,
|
|
159
161
|
sessionKey,
|
|
160
162
|
runId,
|
|
161
163
|
modelRef: candidateModelRef,
|
|
162
|
-
attempt: i + 1
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}, hasNextCandidate ? "Agent model call threw, trying fallback" : "Agent model call threw, no fallback remains");
|
|
166
|
-
}
|
|
167
|
-
if (hasNextCandidate && rowsBeforeAttempt) {
|
|
168
|
-
const preparation = await sessionStore.prepareModelFallback(sessionKey, rowsBeforeAttempt);
|
|
169
|
-
if (preparation === "unsafe") {
|
|
170
|
-
log.warn({
|
|
171
|
-
sessionKey,
|
|
172
|
-
runId,
|
|
173
|
-
modelRef: candidateModelRef,
|
|
174
|
-
attempt: i + 1
|
|
175
|
-
}, "Agent model fallback skipped because the failed attempt changed the transcript");
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
resumeLastUserMessage = preparation === "resume";
|
|
164
|
+
attempt: i + 1
|
|
165
|
+
}, "Agent model fallback skipped because the failed attempt changed the transcript");
|
|
166
|
+
break;
|
|
179
167
|
}
|
|
168
|
+
resumeLastUserMessage = preparation === "resume";
|
|
180
169
|
}
|
|
181
|
-
if (lastResult) return lastResult;
|
|
182
|
-
if (lastError instanceof Error) throw lastError;
|
|
183
|
-
if (lastError != null) throw new Error(String(lastError));
|
|
184
|
-
return {
|
|
185
|
-
ok: false,
|
|
186
|
-
errorMessage: "No model candidates available"
|
|
187
|
-
};
|
|
188
|
-
} finally {
|
|
189
|
-
await mcpResolved.dispose().catch(() => {});
|
|
190
170
|
}
|
|
171
|
+
if (lastResult) return lastResult;
|
|
172
|
+
if (lastError instanceof Error) throw lastError;
|
|
173
|
+
if (lastError != null) throw new Error(String(lastError));
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
errorMessage: "No model candidates available"
|
|
177
|
+
};
|
|
191
178
|
})();
|
|
192
179
|
}
|
|
193
180
|
function serializedTranscriptBytes(messages) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentToolResult } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import type { Config } from '../../config/schema.js';
|
|
3
|
+
import type { ExtensionHookRunner } from '../../extensions/index.js';
|
|
4
|
+
import { ComposioSessionsAdapter } from '../../connectors/composio-sessions.js';
|
|
5
|
+
import type { ExternalToolDescriptor, ExternalToolExecutionContext, ExternalToolProvider, ExternalToolSearchHit } from './types.js';
|
|
6
|
+
type CurrentContext = {
|
|
7
|
+
channel: string;
|
|
8
|
+
chatId: string;
|
|
9
|
+
sessionKey: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export interface ComposioToolProviderDeps {
|
|
12
|
+
getConfig: () => Config | undefined;
|
|
13
|
+
getCurrentContext: () => CurrentContext;
|
|
14
|
+
agentId?: string;
|
|
15
|
+
adapter?: ComposioSessionsAdapter;
|
|
16
|
+
hookRunner?: ExtensionHookRunner;
|
|
17
|
+
}
|
|
18
|
+
export declare class ComposioToolProvider implements ExternalToolProvider {
|
|
19
|
+
private readonly deps;
|
|
20
|
+
readonly source: "composio";
|
|
21
|
+
private readonly adapter;
|
|
22
|
+
constructor(deps: ComposioToolProviderDeps);
|
|
23
|
+
search(query: string): Promise<ExternalToolSearchHit[]>;
|
|
24
|
+
describe(toolRef: string): Promise<ExternalToolDescriptor | undefined>;
|
|
25
|
+
execute(toolRef: string, args: Record<string, unknown>, approvalId: string | undefined, _context: ExternalToolExecutionContext): Promise<AgentToolResult<Record<string, unknown>>>;
|
|
26
|
+
private availableInstallations;
|
|
27
|
+
private resolve;
|
|
28
|
+
}
|
|
29
|
+
export {};
|