@xopcai/xopc 0.0.188 → 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/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store--QoUGhiS.js → activity-store-DTFKTPs8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.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-5laWqfiE.js → api-DWeXfwVU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-BRpV8PXG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.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-Ceh5qrZf.js → archive-plugin-Df7Ycj_7.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.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-XDlkI1r4.js → binary-plugins-BJah99wE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.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-BJa5Iz_v.js → browser-workflow-inputs-vyUfdzAd.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.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-Dn-7MMEo.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-BgIkWq01.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-TRr9ybf6.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-CSwd00CV.js → desktop-pet-BUuBEJuP.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-BGfVIJM3.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-DrQFfHH_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CEnIFOX-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CCqHbexs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-C9ag5tb5.js → extension-settings-page-DEZw_7zN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.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-B2DmdlwO.js → gateway-startup-retry-DxhKNiCF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-fl1oC_-5.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-GMTaS6eI.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-DhGYddbI.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-CmnrBmWi.js → local-apps-page-Ca1RuI13.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D6hs74o5.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-CZaBPOVn.js → markdown-split-BGOYjgnM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.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-Bisbzqlz.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-BxlwhAbH.js → page-tabs-DNrbCgmC.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.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-DdBlibek.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-BDKbpmXv.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-zxo5ZGOu.js → settings-form-section-C4GXGeA4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.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-97LmwrzC.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-BH7i3g1S.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-s-a5WV9j.js → skills-page.utils-zsz2HIlZ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-IWNDBI1O.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-CgtK02kP.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.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-39MjwPSq.js → typed-models-lib-C07LGthO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-save-bar-registration-5aVSjTjO.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-XU-7sBSg.js → voice-api-key-field-Boue1D46.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.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-DXtg8Qxl.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/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 +1 -0
- 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/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/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/index.d.ts +4 -5
- package/dist/src/agent/external-tools/index.js +8 -2
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +2 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -0
- 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/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- 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 -1
- package/dist/src/agent/service.js +6 -4
- package/dist/src/agent/service.types.d.ts +2 -0
- 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/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/factory.d.ts +4 -0
- package/dist/src/agent/tools/factory.js +1 -0
- 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/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- 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/cli/commands/extension-marketplace.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/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/types/hooks.d.ts +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/heartbeat/service.js +4 -1
- 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 +0 -1
- 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/auth-registry-extensions.js +1 -1
- 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/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/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/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -9
- package/dist/src/gateway/hono/routes/you.js +78 -125
- 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/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +13 -13
- 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 +43 -26
- package/dist/src/infra/update-runner.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/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/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/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/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 +1 -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/package.json +6 -3
- package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
- package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- 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,93 @@
|
|
|
1
|
+
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
2
|
+
//#region src/agent/external-tools/endpoint-provider.ts
|
|
3
|
+
function contentText(content) {
|
|
4
|
+
if (content.type === "text") return content.text;
|
|
5
|
+
if (content.type === "json") return JSON.stringify(content.value, null, 2);
|
|
6
|
+
return `[File: ${content.name}, ${content.mimeType}, ${content.size} bytes, id=${content.fileId}]`;
|
|
7
|
+
}
|
|
8
|
+
var EndpointToolProvider = class {
|
|
9
|
+
source = "endpoint";
|
|
10
|
+
constructor(deps) {
|
|
11
|
+
this.deps = deps;
|
|
12
|
+
}
|
|
13
|
+
async search(_query) {
|
|
14
|
+
const endpoint = this.currentEndpoint();
|
|
15
|
+
if (!endpoint) return [];
|
|
16
|
+
return endpoint.tools.map(({ descriptor }) => ({
|
|
17
|
+
toolRef: externalToolRef(this.source, endpoint.endpointId, descriptor.name),
|
|
18
|
+
source: this.source,
|
|
19
|
+
namespace: endpoint.endpointId,
|
|
20
|
+
title: descriptor.title,
|
|
21
|
+
summary: `${descriptor.description} (${endpoint.displayName})`
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
async describe(toolRef) {
|
|
25
|
+
const resolved = this.resolve(toolRef);
|
|
26
|
+
if (!resolved) return void 0;
|
|
27
|
+
return {
|
|
28
|
+
toolRef,
|
|
29
|
+
source: this.source,
|
|
30
|
+
namespace: resolved.endpointId,
|
|
31
|
+
title: resolved.tool.descriptor.title,
|
|
32
|
+
summary: `${resolved.tool.descriptor.description} (${resolved.displayName})`,
|
|
33
|
+
description: resolved.tool.descriptor.description,
|
|
34
|
+
inputSchema: resolved.tool.descriptor.inputSchema
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async execute(toolRef, args, _approvalId, context) {
|
|
38
|
+
const resolved = this.resolve(toolRef);
|
|
39
|
+
if (!resolved) throw new Error(`Endpoint tool is unavailable for this turn: ${toolRef}`);
|
|
40
|
+
const result = await this.deps.runtime.invocations.invoke({
|
|
41
|
+
endpointId: resolved.endpointId,
|
|
42
|
+
toolCallId: context.toolCallId,
|
|
43
|
+
toolName: resolved.tool.descriptor.name,
|
|
44
|
+
arguments: args,
|
|
45
|
+
descriptorRevision: resolved.tool.revision,
|
|
46
|
+
signal: context.signal,
|
|
47
|
+
onProgress: (progress) => {
|
|
48
|
+
context.onUpdate?.({
|
|
49
|
+
content: [{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: progress.message ?? "Endpoint tool is running"
|
|
52
|
+
}],
|
|
53
|
+
details: {
|
|
54
|
+
endpointId: resolved.endpointId,
|
|
55
|
+
...progress.percent === void 0 ? {} : { percent: progress.percent }
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const files = result.content.filter((item) => item.type === "file");
|
|
61
|
+
return {
|
|
62
|
+
content: result.content.map((item) => ({
|
|
63
|
+
type: "text",
|
|
64
|
+
text: contentText(item)
|
|
65
|
+
})),
|
|
66
|
+
details: {
|
|
67
|
+
endpointId: resolved.endpointId,
|
|
68
|
+
endpointToolName: resolved.tool.descriptor.name,
|
|
69
|
+
...result.details ?? {},
|
|
70
|
+
...files.length === 0 ? {} : { endpointFiles: files }
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
currentEndpoint() {
|
|
75
|
+
const origin = this.deps.getCurrentContext()?.origin;
|
|
76
|
+
if (origin?.type !== "endpoint") return void 0;
|
|
77
|
+
return this.deps.runtime.registry.get(origin.endpointId);
|
|
78
|
+
}
|
|
79
|
+
resolve(toolRef) {
|
|
80
|
+
const parsed = parseExternalToolRef(toolRef, this.source);
|
|
81
|
+
if (!parsed) return void 0;
|
|
82
|
+
const endpoint = this.currentEndpoint();
|
|
83
|
+
if (!endpoint || endpoint.endpointId !== parsed.namespace) return void 0;
|
|
84
|
+
const tool = this.deps.runtime.registry.getTool(endpoint.endpointId, parsed.toolName);
|
|
85
|
+
return tool ? {
|
|
86
|
+
endpointId: endpoint.endpointId,
|
|
87
|
+
displayName: endpoint.displayName,
|
|
88
|
+
tool
|
|
89
|
+
} : void 0;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { EndpointToolProvider };
|
|
@@ -44,7 +44,7 @@ function createExternalToolGatewayTools(providers) {
|
|
|
44
44
|
{
|
|
45
45
|
name: EXTERNAL_TOOL_NAMES.search,
|
|
46
46
|
label: "🔎 External Tool Search",
|
|
47
|
-
description: "Search MCP, connected-app, extension,
|
|
47
|
+
description: "Search MCP, connected-app, extension, remote-memory, and current-endpoint tools. Use concise English capability keywords. Returns compact references only; call xopc_tool_describe before execution.",
|
|
48
48
|
parameters: ToolSearchSchema,
|
|
49
49
|
async execute(_toolCallId, params) {
|
|
50
50
|
return textResult(await service.search(params));
|
|
@@ -2,15 +2,14 @@ import type { Config } from '../../config/schema.js';
|
|
|
2
2
|
import type { ExtensionHookRunner } from '../../extensions/index.js';
|
|
3
3
|
import type { ExtensionRegistry } from '../../extensions/types/index.js';
|
|
4
4
|
import type { MemoryManager } from '../memory/manager.js';
|
|
5
|
+
import type { EndpointToolRuntime } from '../../endpoint-tools/index.js';
|
|
5
6
|
import type { ToolExecutorConfig } from '../tools/executor.js';
|
|
7
|
+
import type { ExternalToolTurnContext } from './types.js';
|
|
6
8
|
export interface DefaultExternalToolGatewayDeps {
|
|
7
9
|
workspace: string;
|
|
8
10
|
getConfig: () => Config | undefined;
|
|
9
|
-
getCurrentContext: () =>
|
|
10
|
-
|
|
11
|
-
chatId: string;
|
|
12
|
-
sessionKey: string;
|
|
13
|
-
} | null;
|
|
11
|
+
getCurrentContext: () => ExternalToolTurnContext | null;
|
|
12
|
+
endpointTools?: EndpointToolRuntime;
|
|
14
13
|
agentId?: string;
|
|
15
14
|
extensionRegistry?: ExtensionRegistry;
|
|
16
15
|
disabledTools?: Set<string>;
|
|
@@ -4,9 +4,10 @@ import { ExternalToolService } from "./service.js";
|
|
|
4
4
|
import { EXTERNAL_TOOL_NAMES, createExternalToolGatewayTools } from "./gateway-tools.js";
|
|
5
5
|
import { McpToolProvider } from "./mcp-provider.js";
|
|
6
6
|
import { MemoryToolProvider } from "./memory-provider.js";
|
|
7
|
+
import { EndpointToolProvider } from "./endpoint-provider.js";
|
|
7
8
|
//#region src/agent/external-tools/index.ts
|
|
8
9
|
function createDefaultExternalToolGatewayTools(deps) {
|
|
9
|
-
|
|
10
|
+
const providers = [
|
|
10
11
|
new McpToolProvider({
|
|
11
12
|
workspace: deps.workspace,
|
|
12
13
|
getConfig: deps.getConfig,
|
|
@@ -34,7 +35,12 @@ function createDefaultExternalToolGatewayTools(deps) {
|
|
|
34
35
|
hookRunner: deps.hookRunner,
|
|
35
36
|
toolExecutorConfig: deps.toolExecutorConfig
|
|
36
37
|
})
|
|
37
|
-
]
|
|
38
|
+
];
|
|
39
|
+
if (deps.endpointTools) providers.push(new EndpointToolProvider({
|
|
40
|
+
runtime: deps.endpointTools,
|
|
41
|
+
getCurrentContext: deps.getCurrentContext
|
|
42
|
+
}));
|
|
43
|
+
return createExternalToolGatewayTools(providers);
|
|
38
44
|
}
|
|
39
45
|
//#endregion
|
|
40
46
|
export { EXTERNAL_TOOL_NAMES, ExternalToolService, createDefaultExternalToolGatewayTools };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult, AgentToolUpdateCallback } from '@earendil-works/pi-agent-core';
|
|
2
|
-
|
|
2
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
3
|
+
export declare const EXTERNAL_TOOL_SOURCES: readonly ["mcp", "composio", "extension", "memory", "endpoint"];
|
|
3
4
|
export type ExternalToolSource = (typeof EXTERNAL_TOOL_SOURCES)[number];
|
|
4
5
|
export interface ExternalToolSearchHit {
|
|
5
6
|
toolRef: string;
|
|
@@ -20,6 +21,12 @@ export interface ExternalToolExecutionContext {
|
|
|
20
21
|
signal?: AbortSignal;
|
|
21
22
|
onUpdate?: AgentToolUpdateCallback<Record<string, unknown>>;
|
|
22
23
|
}
|
|
24
|
+
export interface ExternalToolTurnContext {
|
|
25
|
+
channel: string;
|
|
26
|
+
chatId: string;
|
|
27
|
+
sessionKey: string;
|
|
28
|
+
origin: TurnOrigin;
|
|
29
|
+
}
|
|
23
30
|
export interface ExternalToolProvider {
|
|
24
31
|
readonly source: ExternalToolSource;
|
|
25
32
|
search(query: string): Promise<ExternalToolSearchHit[]>;
|
|
@@ -83,6 +83,10 @@ var InboundLoop = class {
|
|
|
83
83
|
chatId: context.chatId,
|
|
84
84
|
senderId: context.senderId || "",
|
|
85
85
|
isGroup: context.isGroup || false,
|
|
86
|
+
origin: {
|
|
87
|
+
type: "channel",
|
|
88
|
+
channel: context.channel
|
|
89
|
+
},
|
|
86
90
|
metadata: { transcribedVoice: msg.metadata?.transcribedVoice === true }
|
|
87
91
|
};
|
|
88
92
|
const sessionMetadata = await this.cfg.sessionStore.getMetadata(sessionContext.sessionKey).catch(() => null);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Wraps the two existing direct-turn runners (one-shot and streaming) so the
|
|
5
5
|
* parent `AgentService` no longer carries a pair of huge `createXxxDeps()`
|
|
6
6
|
* factories. The public surface — `processDirect`, `processDirectStreaming`,
|
|
7
|
-
* `steerWebchatSession`, `
|
|
7
|
+
* `steerWebchatSession`, `enqueueWebchatStreamEvent`,
|
|
8
8
|
* `notifyWebchatTranscriptAppend` — matches what `AgentService` exposed
|
|
9
9
|
* previously, so callers (gateway, CLI) are unchanged.
|
|
10
10
|
*
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* that wires those dependencies together; individual responsibilities now live
|
|
15
15
|
* in their own classes and are unit-testable.
|
|
16
16
|
*/
|
|
17
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
17
18
|
import type { Config } from '../../config/schema.js';
|
|
18
19
|
import type { ContextualLogger } from '../../utils/logger/types.js';
|
|
19
20
|
import type { AgentManager } from '../agent-manager.js';
|
|
@@ -23,7 +24,7 @@ import type { SessionConfigStore } from '../../session/index.js';
|
|
|
23
24
|
import type { SessionStore } from '../../session/store.js';
|
|
24
25
|
import type { SessionContext, SessionHydrator, SessionStateBag } from '../session/index.js';
|
|
25
26
|
import type { InboundAttachmentInput, MediaRef } from '../../channels/attachments/inbound-persist.js';
|
|
26
|
-
import { type
|
|
27
|
+
import { type ProcessDirectStreamEvent } from '../service/process-direct-streaming.js';
|
|
27
28
|
import type { AgentSourceContextResolver } from '../source-context/types.js';
|
|
28
29
|
export interface TurnDispatcherConfig {
|
|
29
30
|
log: ContextualLogger;
|
|
@@ -41,7 +42,7 @@ export interface TurnDispatcherConfig {
|
|
|
41
42
|
chatId: string;
|
|
42
43
|
}>;
|
|
43
44
|
/** Establish per-session context (also creates the Agent + subscribes to events). */
|
|
44
|
-
initSessionContext: (sessionKey: string, channel: string, chatId: string) => SessionContext;
|
|
45
|
+
initSessionContext: (sessionKey: string, channel: string, chatId: string, origin: TurnOrigin) => SessionContext;
|
|
45
46
|
/** Per-session config hydration: workspace, model, thinking. */
|
|
46
47
|
sessionHydrator: SessionHydrator;
|
|
47
48
|
prepareInboundAttachments: (sessionKey: string, attachments?: InboundAttachmentInput[]) => Promise<MediaRef[] | undefined>;
|
|
@@ -67,14 +68,14 @@ export declare class TurnDispatcher {
|
|
|
67
68
|
private readonly log;
|
|
68
69
|
constructor(cfg: TurnDispatcherConfig);
|
|
69
70
|
/** One-shot direct turn (CLI / embedded TUI). */
|
|
70
|
-
processDirect(content: string, sessionKey
|
|
71
|
-
/** Streaming direct turn (webchat
|
|
72
|
-
processDirectStreaming(content: string, sessionKey
|
|
71
|
+
processDirect(content: string, sessionKey: string, origin: TurnOrigin, attachments?: DirectAttachment[], thinking?: string, options?: ProcessDirectOptions): Promise<string>;
|
|
72
|
+
/** Streaming direct turn (webchat realtime / CLI streaming). */
|
|
73
|
+
processDirectStreaming(content: string, sessionKey: string, origin: TurnOrigin, attachments?: DirectAttachment[], thinking?: string, options?: {
|
|
73
74
|
signal?: AbortSignal;
|
|
74
75
|
runId?: string;
|
|
75
|
-
}): AsyncGenerator<
|
|
76
|
+
}): AsyncGenerator<ProcessDirectStreamEvent, void, unknown>;
|
|
76
77
|
/** Push an out-of-band event into the live webchat stream for a session. */
|
|
77
|
-
|
|
78
|
+
enqueueWebchatStreamEvent(sessionKey: string, event: {
|
|
78
79
|
type: string;
|
|
79
80
|
[key: string]: unknown;
|
|
80
81
|
}): void;
|
|
@@ -12,10 +12,11 @@ var TurnDispatcher = class {
|
|
|
12
12
|
this.log = cfg.log;
|
|
13
13
|
}
|
|
14
14
|
/** One-shot direct turn (CLI / embedded TUI). */
|
|
15
|
-
processDirect(content, sessionKey
|
|
15
|
+
processDirect(content, sessionKey, origin, attachments, thinking, options) {
|
|
16
16
|
return runProcessDirect(this.buildOneShotDeps(), {
|
|
17
17
|
content,
|
|
18
18
|
sessionKey,
|
|
19
|
+
origin,
|
|
19
20
|
attachments,
|
|
20
21
|
thinking,
|
|
21
22
|
signal: options?.signal,
|
|
@@ -23,11 +24,12 @@ var TurnDispatcher = class {
|
|
|
23
24
|
deadlineAtMs: options?.deadlineAtMs
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
/** Streaming direct turn (webchat
|
|
27
|
-
async *processDirectStreaming(content, sessionKey
|
|
27
|
+
/** Streaming direct turn (webchat realtime / CLI streaming). */
|
|
28
|
+
async *processDirectStreaming(content, sessionKey, origin, attachments, thinking, options) {
|
|
28
29
|
yield* runProcessDirectStreaming(this.buildStreamingDeps(), {
|
|
29
30
|
content,
|
|
30
31
|
sessionKey,
|
|
32
|
+
origin,
|
|
31
33
|
attachments,
|
|
32
34
|
thinking,
|
|
33
35
|
signal: options?.signal,
|
|
@@ -35,7 +37,7 @@ var TurnDispatcher = class {
|
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
/** Push an out-of-band event into the live webchat stream for a session. */
|
|
38
|
-
|
|
40
|
+
enqueueWebchatStreamEvent(sessionKey, event) {
|
|
39
41
|
const pub = this.cfg.sessionState.getWebchatPublisher(sessionKey);
|
|
40
42
|
if (pub) pub(event);
|
|
41
43
|
}
|
|
@@ -51,15 +53,15 @@ var TurnDispatcher = class {
|
|
|
51
53
|
}],
|
|
52
54
|
timestamp: Date.now()
|
|
53
55
|
};
|
|
54
|
-
this.
|
|
56
|
+
this.enqueueWebchatStreamEvent(sessionKey, {
|
|
55
57
|
type: "message_start",
|
|
56
58
|
message
|
|
57
59
|
});
|
|
58
|
-
this.
|
|
60
|
+
this.enqueueWebchatStreamEvent(sessionKey, {
|
|
59
61
|
type: "message_update",
|
|
60
62
|
message
|
|
61
63
|
});
|
|
62
|
-
this.
|
|
64
|
+
this.enqueueWebchatStreamEvent(sessionKey, {
|
|
63
65
|
type: "message_end",
|
|
64
66
|
message
|
|
65
67
|
});
|
|
@@ -90,8 +92,8 @@ var TurnDispatcher = class {
|
|
|
90
92
|
log: this.log,
|
|
91
93
|
resolveSessionEndpoint: c.resolveSessionEndpoint,
|
|
92
94
|
initDirectStreamingSession: c.initSessionContext,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
registerWebchatStreamPublisher: (sk, publisher) => c.sessionState.registerWebchatPublisher(sk, publisher),
|
|
96
|
+
unregisterWebchatStreamPublisher: (sk) => c.sessionState.unregisterWebchatPublisher(sk),
|
|
95
97
|
agentManager: c.agentManager,
|
|
96
98
|
hydrateSessionWorkspaceFromStore: (sk) => c.sessionHydrator.workspace(sk),
|
|
97
99
|
hydrateSessionModelFromStore: (sk) => c.sessionHydrator.model(sk),
|
|
@@ -139,8 +141,8 @@ var TurnDispatcher = class {
|
|
|
139
141
|
log: this.log,
|
|
140
142
|
config: cfg,
|
|
141
143
|
resolveSessionEndpoint: c.resolveSessionEndpoint,
|
|
142
|
-
initSessionContext: (sk, channel, chatId) => {
|
|
143
|
-
c.initSessionContext(sk, channel, chatId);
|
|
144
|
+
initSessionContext: (sk, channel, chatId, origin) => {
|
|
145
|
+
c.initSessionContext(sk, channel, chatId, origin);
|
|
144
146
|
},
|
|
145
147
|
hydrateSessionWorkspaceFromStore: (sk) => c.sessionHydrator.workspace(sk),
|
|
146
148
|
hydrateSessionModelFromStore: (sk) => c.sessionHydrator.model(sk),
|
|
@@ -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) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Async FIFO queue with `for await` support.
|
|
3
3
|
*
|
|
4
4
|
* Replaces the ad-hoc `eventQueue + resolveWaiting` single-slot pattern that
|
|
5
|
-
* the streaming direct turn used to manage
|
|
5
|
+
* the streaming direct turn used to manage run events. The previous pattern was
|
|
6
6
|
* lossy if two pushes landed before the single waiter resumed; this queue keeps
|
|
7
7
|
* the buffer growing until consumed, and closes cleanly so the iterator drains.
|
|
8
8
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Async FIFO queue with `for await` support.
|
|
4
4
|
*
|
|
5
5
|
* Replaces the ad-hoc `eventQueue + resolveWaiting` single-slot pattern that
|
|
6
|
-
* the streaming direct turn used to manage
|
|
6
|
+
* the streaming direct turn used to manage run events. The previous pattern was
|
|
7
7
|
* lossy if two pushes landed before the single waiter resumed; this queue keeps
|
|
8
8
|
* the buffer growing until consumed, and closes cleanly so the iterator drains.
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared building blocks for the two direct-turn entry points (streaming
|
|
3
|
-
* webchat
|
|
3
|
+
* webchat realtime and one-shot CLI). Both flows do the same hydrate → maybe-slash
|
|
4
4
|
* → run-embedded-turn → after-turn dance; this module captures that core so
|
|
5
5
|
* the entry points only manage their I/O specifics (event sink, voice STT,
|
|
6
6
|
* TTS, transcript persistence).
|
|
@@ -12,7 +12,7 @@ import crypto from "node:crypto";
|
|
|
12
12
|
//#region src/agent/service/direct-turn-helpers.ts
|
|
13
13
|
/**
|
|
14
14
|
* Shared building blocks for the two direct-turn entry points (streaming
|
|
15
|
-
* webchat
|
|
15
|
+
* webchat realtime and one-shot CLI). Both flows do the same hydrate → maybe-slash
|
|
16
16
|
* → run-embedded-turn → after-turn dance; this module captures that core so
|
|
17
17
|
* the entry points only manage their I/O specifics (event sink, voice STT,
|
|
18
18
|
* TTS, transcript persistence).
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
1
2
|
import type { CommandHandler } from '../messaging/command-handler.js';
|
|
2
3
|
import type { AgentInstanceGateway } from '../agent-instance-gateway.js';
|
|
3
4
|
import type { ModelManager } from '../models/index.js';
|
|
@@ -12,7 +13,7 @@ export type RunProcessDirectDeps = {
|
|
|
12
13
|
channel: string;
|
|
13
14
|
chatId: string;
|
|
14
15
|
}>;
|
|
15
|
-
initSessionContext: (sessionKey: string, channel: string, chatId: string) => void;
|
|
16
|
+
initSessionContext: (sessionKey: string, channel: string, chatId: string, origin: TurnOrigin) => void;
|
|
16
17
|
hydrateSessionWorkspaceFromStore: (sessionKey: string) => Promise<void>;
|
|
17
18
|
hydrateSessionModelFromStore: (sessionKey: string) => Promise<void>;
|
|
18
19
|
agentManager: AgentInstanceGateway;
|
|
@@ -31,6 +32,7 @@ export type RunProcessDirectDeps = {
|
|
|
31
32
|
export declare function runProcessDirect(deps: RunProcessDirectDeps, input: {
|
|
32
33
|
content: string;
|
|
33
34
|
sessionKey: string;
|
|
35
|
+
origin: TurnOrigin;
|
|
34
36
|
attachments?: InboundAttachmentInput[];
|
|
35
37
|
thinking?: string;
|
|
36
38
|
signal?: AbortSignal;
|
|
@@ -9,7 +9,7 @@ function isReviewOutput(value) {
|
|
|
9
9
|
}
|
|
10
10
|
async function runProcessDirect(deps, input) {
|
|
11
11
|
const { channel, chatId } = await deps.resolveSessionEndpoint(input.sessionKey);
|
|
12
|
-
deps.initSessionContext(input.sessionKey, channel, chatId);
|
|
12
|
+
deps.initSessionContext(input.sessionKey, channel, chatId, input.origin);
|
|
13
13
|
try {
|
|
14
14
|
let turnBody = input.content;
|
|
15
15
|
let resetTriggeredAtInit = false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
1
2
|
import type { Config } from '../../config/schema.js';
|
|
2
3
|
import type { InboundAttachmentInput, MediaRef } from '../../channels/attachments/inbound-persist.js';
|
|
3
4
|
import { type SessionConfigStore, type SessionStore } from '../../session/index.js';
|
|
@@ -19,12 +20,12 @@ export interface ProcessDirectStreamingDeps {
|
|
|
19
20
|
channel: string;
|
|
20
21
|
chatId: string;
|
|
21
22
|
}>;
|
|
22
|
-
initDirectStreamingSession: (sessionKey: string, channel: string, chatId: string) => SessionContext;
|
|
23
|
-
|
|
23
|
+
initDirectStreamingSession: (sessionKey: string, channel: string, chatId: string, origin: TurnOrigin) => SessionContext;
|
|
24
|
+
registerWebchatStreamPublisher: (sessionKey: string, publisher: (event: {
|
|
24
25
|
type: string;
|
|
25
26
|
[key: string]: unknown;
|
|
26
27
|
}) => void) => void;
|
|
27
|
-
|
|
28
|
+
unregisterWebchatStreamPublisher: (sessionKey: string) => void;
|
|
28
29
|
agentManager: AgentInstanceGateway;
|
|
29
30
|
hydrateSessionWorkspaceFromStore: (sessionKey: string) => Promise<void>;
|
|
30
31
|
hydrateSessionModelFromStore: (sessionKey: string) => Promise<void>;
|
|
@@ -59,13 +60,14 @@ export interface ProcessDirectStreamingDeps {
|
|
|
59
60
|
export interface ProcessDirectStreamingInput {
|
|
60
61
|
content: string;
|
|
61
62
|
sessionKey?: string;
|
|
63
|
+
origin: TurnOrigin;
|
|
62
64
|
attachments?: DirectStreamInboundAttachment[];
|
|
63
65
|
thinking?: string;
|
|
64
66
|
signal?: AbortSignal;
|
|
65
67
|
runId?: string;
|
|
66
68
|
}
|
|
67
|
-
export type
|
|
69
|
+
export type ProcessDirectStreamEvent = {
|
|
68
70
|
type: string;
|
|
69
71
|
[key: string]: unknown;
|
|
70
72
|
};
|
|
71
|
-
export declare function runProcessDirectStreaming(deps: ProcessDirectStreamingDeps, input: ProcessDirectStreamingInput): AsyncGenerator<
|
|
73
|
+
export declare function runProcessDirectStreaming(deps: ProcessDirectStreamingDeps, input: ProcessDirectStreamingInput): AsyncGenerator<ProcessDirectStreamEvent, void, unknown>;
|
|
@@ -8,7 +8,7 @@ import { mergeSttConfigFromAppConfig } from "../../voice/stt/config.js";
|
|
|
8
8
|
import "../../voice/stt/index.js";
|
|
9
9
|
import { abortEmbeddedRun } from "../embedded/runs.js";
|
|
10
10
|
import { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText } from "../../channels/attachments/voice-stt-webchat.js";
|
|
11
|
-
import {
|
|
11
|
+
import { applyReasoningVisibility } from "../streaming/reasoning-visibility.js";
|
|
12
12
|
import { injectSourceContextIntoUserMessage } from "../source-context/injector.js";
|
|
13
13
|
import { isSessionSourceBinding } from "../source-context/types.js";
|
|
14
14
|
import { AsyncQueue } from "./async-queue.js";
|
|
@@ -117,11 +117,11 @@ function pushAssistantReceipt(queue, text, runId, metadata) {
|
|
|
117
117
|
async function* runProcessDirectStreaming(deps, input) {
|
|
118
118
|
const sessionKey = input.sessionKey ?? "agent:main:main";
|
|
119
119
|
const { channel, chatId } = await deps.resolveSessionEndpoint(sessionKey);
|
|
120
|
-
const context = deps.initDirectStreamingSession(sessionKey, channel, chatId);
|
|
120
|
+
const context = deps.initDirectStreamingSession(sessionKey, channel, chatId, input.origin);
|
|
121
121
|
const queue = new AsyncQueue();
|
|
122
122
|
let reasoningLevel = channel === "webchat" ? resolveConfiguredActivityDetailDefault(deps.getConfig()) : "stream";
|
|
123
123
|
const pushVisible = (event) => {
|
|
124
|
-
const visible = channel === "webchat" ? event :
|
|
124
|
+
const visible = channel === "webchat" ? event : applyReasoningVisibility(event, reasoningLevel);
|
|
125
125
|
if (visible !== null) queue.push(visible);
|
|
126
126
|
};
|
|
127
127
|
const formatStreamError = (raw) => {
|
|
@@ -136,7 +136,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
136
136
|
modelRef
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
-
if (channel === "webchat") deps.
|
|
139
|
+
if (channel === "webchat") deps.registerWebchatStreamPublisher(sessionKey, pushVisible);
|
|
140
140
|
const signal = input.signal;
|
|
141
141
|
let userAborted = false;
|
|
142
142
|
let abortHandled = false;
|
|
@@ -352,7 +352,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
352
352
|
}
|
|
353
353
|
deps.recordTaskReviewStreamHint?.(sessionKey, { skipTaskReview: ranSlashCommand });
|
|
354
354
|
} finally {
|
|
355
|
-
if (channel === "webchat") deps.
|
|
355
|
+
if (channel === "webchat") deps.unregisterWebchatStreamPublisher(sessionKey);
|
|
356
356
|
deps.endDirectRequestContext();
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -50,7 +50,7 @@ export declare class AgentService {
|
|
|
50
50
|
private inboundLoop;
|
|
51
51
|
/**
|
|
52
52
|
* Direct-turn entry points: `processDirect` (one-shot), `processDirectStreaming`
|
|
53
|
-
* (
|
|
53
|
+
* (event generator), webchat steering and live event injection. Public so the gateway,
|
|
54
54
|
* TUI, CLI, and automations do not need to thread every call through `AgentService`.
|
|
55
55
|
*/
|
|
56
56
|
readonly turnDispatcher: TurnDispatcher;
|
|
@@ -118,7 +118,7 @@ var AgentService = class {
|
|
|
118
118
|
inboundLoop;
|
|
119
119
|
/**
|
|
120
120
|
* Direct-turn entry points: `processDirect` (one-shot), `processDirectStreaming`
|
|
121
|
-
* (
|
|
121
|
+
* (event generator), webchat steering and live event injection. Public so the gateway,
|
|
122
122
|
* TUI, CLI, and automations do not need to thread every call through `AgentService`.
|
|
123
123
|
*/
|
|
124
124
|
turnDispatcher;
|
|
@@ -218,6 +218,7 @@ var AgentService = class {
|
|
|
218
218
|
model: config.model,
|
|
219
219
|
config: config.config,
|
|
220
220
|
extensionRegistry: config.extensionRegistry,
|
|
221
|
+
endpointTools: config.endpointTools,
|
|
221
222
|
hookRunner: this.hookRunner,
|
|
222
223
|
bus,
|
|
223
224
|
getCurrentContext: () => this.sessionContextManager.getContext(),
|
|
@@ -373,7 +374,7 @@ var AgentService = class {
|
|
|
373
374
|
return c;
|
|
374
375
|
},
|
|
375
376
|
resolveSessionEndpoint: (sk) => this.resolveSessionEndpoint(sk),
|
|
376
|
-
initSessionContext: (sk, channel, chatId) => this.initSessionContext(sk, channel, chatId),
|
|
377
|
+
initSessionContext: (sk, channel, chatId, origin) => this.initSessionContext(sk, channel, chatId, origin),
|
|
377
378
|
sessionHydrator: this.sessionHydrator,
|
|
378
379
|
prepareInboundAttachments: (sk, att) => this.prepareInboundAttachments(sk, att),
|
|
379
380
|
enqueueMaybeAutoTitleAfterPersist: (sk) => this.enqueueMaybeAutoTitleAfterPersist(sk),
|
|
@@ -679,13 +680,14 @@ var AgentService = class {
|
|
|
679
680
|
chatId: metadata?.routing?.peerId?.trim() || metadata?.sourceChatId?.trim() || "main"
|
|
680
681
|
};
|
|
681
682
|
}
|
|
682
|
-
initSessionContext(sessionKey, channel, chatId, senderId = "") {
|
|
683
|
+
initSessionContext(sessionKey, channel, chatId, origin, senderId = "") {
|
|
683
684
|
const context = {
|
|
684
685
|
sessionKey,
|
|
685
686
|
channel,
|
|
686
687
|
chatId,
|
|
687
688
|
senderId,
|
|
688
|
-
isGroup: false
|
|
689
|
+
isGroup: false,
|
|
690
|
+
origin
|
|
689
691
|
};
|
|
690
692
|
this.contextMiddleware.onRequest({
|
|
691
693
|
sessionKey,
|
|
@@ -8,11 +8,13 @@ import type { ProjectService } from '../projects/index.js';
|
|
|
8
8
|
import type { LocalAppService } from '../local-apps/index.js';
|
|
9
9
|
import type { GatewayClarifyRequestFn } from './tools/clarify-tool.js';
|
|
10
10
|
import type { AgentSourceContextResolver } from './source-context/types.js';
|
|
11
|
+
import type { EndpointToolRuntime } from '../endpoint-tools/index.js';
|
|
11
12
|
export interface AgentServiceConfig {
|
|
12
13
|
workspace: string;
|
|
13
14
|
model?: string;
|
|
14
15
|
config?: Config;
|
|
15
16
|
extensionRegistry?: ExtensionRegistry;
|
|
17
|
+
endpointTools?: EndpointToolRuntime;
|
|
16
18
|
maxRequestsPerTurn?: number;
|
|
17
19
|
maxToolFailuresPerTurn?: number;
|
|
18
20
|
maxTaskDurationMs?: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { SessionContextManager, type SessionContext, } from './session-context.js';
|
|
5
5
|
export { SessionLifecycleManager, type SessionLifecycleEvents, type SessionStats, } from './session-lifecycle.js';
|
|
6
|
-
export { SessionStateBag, type SessionStateBagOptions, type
|
|
6
|
+
export { SessionStateBag, type SessionStateBagOptions, type WebchatStreamPublisher, type TaskReviewStreamHint, } from './session-state-bag.js';
|
|
7
7
|
export { SessionConfigService, type SessionConfigServiceOptions, type PatchSessionAgentConfigInput, type PatchSessionAgentConfigResult, } from './session-config-service.js';
|
|
8
8
|
export { SessionHydrator, type SessionHydratorOptions, } from './session-hydrator.js';
|
|
9
9
|
export { SessionInspector, type SessionInspectorOptions, type SessionContextUsage, type SessionAgentConfigView, } from './session-inspector.js';
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* awkward; the context leaks into the rest of the current async resource by
|
|
15
15
|
* design).
|
|
16
16
|
*/
|
|
17
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
17
18
|
import type { InboundMessage } from '../../infra/bus/index.js';
|
|
18
19
|
export interface SessionContext {
|
|
19
20
|
sessionKey: string;
|
|
@@ -21,6 +22,7 @@ export interface SessionContext {
|
|
|
21
22
|
chatId: string;
|
|
22
23
|
senderId: string;
|
|
23
24
|
isGroup: boolean;
|
|
25
|
+
origin: TurnOrigin;
|
|
24
26
|
model?: string;
|
|
25
27
|
metadata?: Record<string, unknown>;
|
|
26
28
|
}
|