@xopcai/xopc 0.0.188 → 0.0.190
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 -4
- package/README.zh-CN.md +0 -3
- 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-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
- package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
- package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
- package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
- package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
- package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.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-Dc9CcWdu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.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-Dzxlq1F0.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
- package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
- package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.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 +0 -36
- package/dist/packages/realtime-client/src/index.js +256 -0
- package/dist/packages/realtime-protocol/src/index.js +88 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- 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 +10 -9
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
- package/dist/src/agent/bootstrap/types.d.ts +1 -1
- 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/context/workspace-templates/SOUL.md +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/memory/builtin-provider.d.ts +2 -4
- package/dist/src/agent/memory/builtin-provider.js +35 -15
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -0
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +9 -1
- package/dist/src/agent/memory/manager.js +39 -9
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/source-origin.js +0 -2
- package/dist/src/agent/memory/types.d.ts +5 -1
- package/dist/src/agent/memory/understanding/service.d.ts +10 -10
- package/dist/src/agent/memory/understanding/service.js +108 -176
- package/dist/src/agent/memory/understanding/types.d.ts +7 -8
- package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
- package/dist/src/agent/memory/user-context-coordinator.js +27 -41
- 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/orchestration/agent-orchestrator.js +4 -7
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js +0 -10
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
- package/dist/src/agent/prompt/system-prompt.js +1 -2
- 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 +2 -2
- 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 +2 -3
- package/dist/src/agent/service.js +10 -21
- 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/skills/marketplace/adapters/clawhub/adapter.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/dreaming-tool.d.ts +0 -2
- package/dist/src/agent/tools/dreaming-tool.js +13 -38
- package/dist/src/agent/tools/factory.d.ts +4 -3
- package/dist/src/agent/tools/factory.js +2 -10
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
- package/dist/src/agent/workspace-runtime/registry.js +2 -15
- package/dist/src/agent-manifest/schema.d.ts +17 -17
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +29 -29
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- 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/chat-commands/builtins/understanding.js +2 -5
- 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/cli/commands/init.js +3 -22
- package/dist/src/cli/templates.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/paths.d.ts +0 -5
- package/dist/src/config/paths.js +2 -11
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +27 -122
- package/dist/src/config/schema.js +9 -42
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/learning-coordinator.js +75 -3
- 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/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +0 -5
- package/dist/src/gateway/agents-admin.d.ts +0 -7
- package/dist/src/gateway/agents-admin.js +3 -32
- 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/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- 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 +20 -9
- package/dist/src/gateway/hono/lib/config-payload.js +3 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +17 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/agents.js +1 -33
- 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/config-patch/misc.js +17 -1
- package/dist/src/gateway/hono/routes/connectors.js +13 -12
- 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 +6 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- 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/status.js +0 -7
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -31
- package/dist/src/gateway/hono/routes/you.js +230 -1161
- 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 +3 -3
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +15 -17
- 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/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
- package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/people-graph.d.ts +22 -25
- package/dist/src/knowledge/people-graph.js +76 -43
- 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/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +31 -0
- package/dist/src/realtime/broker.js +114 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +263 -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/connector-account-repository.js +0 -1
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
- package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
- 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/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +6 -6
- package/dist/src/storage/sqlite/index.js +7 -7
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
- package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
- 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/113_memory_evidence_single_source.sql +54 -0
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -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/schema.sql +0 -20
- 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/storage/sqlite/user-context-quality-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
- package/dist/src/storage/sqlite/user-context-repository.js +383 -0
- 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.js +1 -7
- 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-startup-resources.js +1 -2
- 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/config.d.ts +17 -210
- package/dist/src/user-context/config.js +19 -85
- package/dist/src/user-context/consolidation.d.ts +26 -0
- package/dist/src/user-context/consolidation.js +115 -0
- package/dist/src/user-context/domain.d.ts +75 -0
- package/dist/src/user-context/domain.js +4 -0
- package/dist/src/user-context/manual-understanding.d.ts +7 -14
- package/dist/src/user-context/manual-understanding.js +19 -49
- package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
- package/dist/src/user-context/planner.js +311 -0
- package/dist/src/user-context/relationship-continuity.d.ts +3 -6
- package/dist/src/user-context/relationship-continuity.js +39 -32
- package/dist/src/user-context/sources/catalog.d.ts +2 -0
- package/dist/src/user-context/sources/catalog.js +149 -0
- package/dist/src/user-context/sources/index.d.ts +3 -0
- package/dist/src/user-context/sources/index.js +3 -0
- package/dist/src/user-context/sources/repository.d.ts +40 -0
- package/dist/src/user-context/sources/repository.js +164 -0
- package/dist/src/user-context/sources/types.d.ts +83 -0
- 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/work-discovery/analyzer.d.ts +4 -3
- package/dist/src/work-discovery/analyzer.js +21 -16
- package/dist/src/work-discovery/incremental-repository.js +42 -40
- package/dist/src/work-discovery/index.js +3 -3
- package/dist/src/work-discovery/service.d.ts +7 -7
- package/dist/src/work-discovery/service.js +241 -190
- package/dist/src/work-discovery/source-repository.js +42 -53
- package/dist/src/work-discovery/types.d.ts +2 -14
- package/package.json +5 -7
- 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-api-Dn-7MMEo.js +0 -1
- 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/connector-logo-TRr9ybf6.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.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/locale-store-D6hs74o5.js +0 -1
- 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/segmented-styles-BL8oLBEp.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-form-section-zxo5ZGOu.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/use-save-bar-registration-5aVSjTjO.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/code-intelligence/binary.d.ts +0 -15
- package/dist/src/agent/code-intelligence/binary.js +0 -372
- package/dist/src/agent/code-intelligence/index.d.ts +0 -4
- package/dist/src/agent/code-intelligence/index.js +0 -4
- package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
- package/dist/src/agent/code-intelligence/runtime.js +0 -280
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
- package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
- package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
- package/dist/src/agent/code-intelligence/tools.js +0 -266
- package/dist/src/agent/code-intelligence/types.d.ts +0 -22
- package/dist/src/agent/memory/context/planner.js +0 -286
- package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
- package/dist/src/agent/memory/dreaming/config.js +0 -98
- package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
- package/dist/src/agent/memory/dreaming/constants.js +0 -18
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
- package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/preview.js +0 -52
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
- package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
- package/dist/src/agent/memory/dreaming/runner.js +0 -78
- package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/schedule.js +0 -38
- package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
- package/dist/src/agent/memory/dreaming/scope.js +0 -33
- package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
- package/dist/src/agent/memory/dreaming/utils.js +0 -31
- 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/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- 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/storage/sqlite/dreaming-repository.d.ts +0 -61
- package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
- package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
- package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
- package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
- package/dist/src/user-context/context-compiler.d.ts +0 -27
- package/dist/src/user-context/context-compiler.js +0 -48
- package/dist/src/user-context/import.d.ts +0 -12
- package/dist/src/user-context/import.js +0 -51
- package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
- package/dist/src/user-context/memory-episode-evaluator.js +0 -35
- package/dist/src/user-context/memory-readiness.d.ts +0 -33
- package/dist/src/user-context/memory-readiness.js +0 -41
- package/dist/src/user-context/memory-use-audit.d.ts +0 -10
- package/dist/src/user-context/memory-use-audit.js +0 -26
- package/dist/src/user-context/personal-playbook.d.ts +0 -11
- package/dist/src/user-context/personal-playbook.js +0 -41
- package/dist/src/user-context/profile.d.ts +0 -37
- package/dist/src/user-context/profile.js +0 -163
- package/dist/src/user-context/projection.d.ts +0 -120
- package/dist/src/user-context/projection.js +0 -262
- package/dist/src/user-context/source-recommendations.d.ts +0 -13
- package/dist/src/user-context/source-recommendations.js +0 -85
- /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
|
@@ -39,7 +39,6 @@ export declare class SystemPromptBuilder {
|
|
|
39
39
|
constructor(config: SystemPromptBuilderConfig);
|
|
40
40
|
build(contextFiles: EmbeddedContextFile[], options: SystemPromptBuildOptions): string;
|
|
41
41
|
rebuild(contextFiles: EmbeddedContextFile[], options: SystemPromptBuildOptions): string;
|
|
42
|
-
private extractTimezone;
|
|
43
42
|
getSkillPrompt(): string;
|
|
44
43
|
getBasePrompt(contextFiles: EmbeddedContextFile[], options?: {
|
|
45
44
|
externalMemoryInstructions?: string;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
4
|
+
import { getUserProfile } from "../../storage/sqlite/user-context-repository.js";
|
|
4
5
|
import { buildInteractionStatePrompt } from "../../user-context/interaction-state.js";
|
|
5
6
|
import { getInteractionState } from "../../storage/sqlite/interaction-state-repository.js";
|
|
6
|
-
import { buildRelationshipPrompt, getRelationshipSettings } from "../../storage/sqlite/relationship-settings-repository.js";
|
|
7
|
-
import { listMemoryRecords } from "../../storage/sqlite/memory-records-repository.js";
|
|
8
7
|
import { DEFAULT_USER_TRUST_LEVEL } from "../../user-context/trust-policy.js";
|
|
9
8
|
import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
|
|
10
9
|
import "../../storage/sqlite/index.js";
|
|
11
|
-
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
12
10
|
import { resolveSystemPromptBuildParams } from "./system-prompt-params.js";
|
|
13
11
|
import { buildSystemPrompt } from "./system-prompt.js";
|
|
14
12
|
import { resolveResponseLanguageForSession } from "./response-language.js";
|
|
15
13
|
import { buildTtsSystemPromptHint } from "../../voice/tts/directives.js";
|
|
16
14
|
import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
|
|
17
|
-
import { buildPersonalPlaybookPrompt } from "../../user-context/personal-playbook.js";
|
|
18
|
-
import { buildRelationshipContinuityPrompt } from "../../user-context/relationship-continuity.js";
|
|
19
15
|
//#region src/agent/prompt/service-prompt-builder.ts
|
|
20
|
-
init_session_key();
|
|
21
16
|
init_logger();
|
|
22
17
|
const log = createLogger("SystemPromptBuilder");
|
|
23
18
|
var SystemPromptBuilder = class {
|
|
@@ -32,21 +27,10 @@ var SystemPromptBuilder = class {
|
|
|
32
27
|
build(contextFiles, options) {
|
|
33
28
|
const ws = options.workspaceOverride ?? this.workspace;
|
|
34
29
|
const actionTrustLevel = isXopcDatabaseOpen() ? getUserTrustPolicy().defaultActionLevel : DEFAULT_USER_TRUST_LEVEL;
|
|
35
|
-
const relationshipPrompt = isXopcDatabaseOpen() ? buildRelationshipPrompt(getRelationshipSettings()) : "";
|
|
36
30
|
const interactionState = isXopcDatabaseOpen() && options.sessionKey ? getInteractionState(options.sessionKey) : void 0;
|
|
37
|
-
const session = parseSessionKey(options.sessionKey);
|
|
38
|
-
const activeMemories = isXopcDatabaseOpen() ? listMemoryRecords({
|
|
39
|
-
status: "active",
|
|
40
|
-
limit: 500
|
|
41
|
-
}) : [];
|
|
42
|
-
const playbookPrompt = isXopcDatabaseOpen() ? buildPersonalPlaybookPrompt(activeMemories, {
|
|
43
|
-
...session ? { channel: session.source } : {},
|
|
44
|
-
...interactionState ? { supportNeed: interactionState.supportNeed } : {}
|
|
45
|
-
}) : "";
|
|
46
|
-
const continuityPrompt = buildRelationshipContinuityPrompt(activeMemories);
|
|
47
31
|
const interactionPrompt = interactionState ? buildInteractionStatePrompt(interactionState) : "";
|
|
48
32
|
const heartbeatEnabled = this.config.gateway?.heartbeat?.includeSystemPromptSection ?? false;
|
|
49
|
-
const userTimezone =
|
|
33
|
+
const userTimezone = isXopcDatabaseOpen() ? getUserProfile().timezone || void 0 : void 0;
|
|
50
34
|
const ttsMerged = mergeTtsConfigFromAppConfig(this.config.messages?.tts);
|
|
51
35
|
const reg = options.registeredToolNames ?? [];
|
|
52
36
|
const ttsSystemHint = buildTtsSystemPromptHint({
|
|
@@ -66,13 +50,7 @@ var SystemPromptBuilder = class {
|
|
|
66
50
|
externalMemoryInstructions: options.externalMemoryInstructions,
|
|
67
51
|
heartbeatEnabled,
|
|
68
52
|
ttsSystemHint,
|
|
69
|
-
extraSystemPrompt: [
|
|
70
|
-
options.extraSystemPrompt,
|
|
71
|
-
relationshipPrompt,
|
|
72
|
-
playbookPrompt,
|
|
73
|
-
interactionPrompt,
|
|
74
|
-
continuityPrompt
|
|
75
|
-
].filter(Boolean).join("\n\n"),
|
|
53
|
+
extraSystemPrompt: [options.extraSystemPrompt, interactionPrompt].filter(Boolean).join("\n\n"),
|
|
76
54
|
activeProjectContext: options.activeProjectContext,
|
|
77
55
|
modelRef: options.modelRef,
|
|
78
56
|
agentId: options.agentId,
|
|
@@ -122,13 +100,6 @@ var SystemPromptBuilder = class {
|
|
|
122
100
|
this.skillManager.reload();
|
|
123
101
|
return this.build(contextFiles, options);
|
|
124
102
|
}
|
|
125
|
-
extractTimezone(contextFiles) {
|
|
126
|
-
const userContext = contextFiles.find((file) => file.path.replace(/\\/g, "/").toLowerCase().endsWith("/user/profile.md"));
|
|
127
|
-
if (userContext?.content) {
|
|
128
|
-
const match = userContext.content.match(/Timezone:\s*(.+)/i);
|
|
129
|
-
if (match) return match[1].trim();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
103
|
getSkillPrompt() {
|
|
133
104
|
return this.skillManager.getPrompt();
|
|
134
105
|
}
|
|
@@ -138,7 +109,7 @@ var SystemPromptBuilder = class {
|
|
|
138
109
|
workspaceDir: ws,
|
|
139
110
|
sessionKey: options?.sessionKey,
|
|
140
111
|
toolNames: options?.registeredToolNames,
|
|
141
|
-
userTimezone:
|
|
112
|
+
userTimezone: isXopcDatabaseOpen() ? getUserProfile().timezone || void 0 : void 0,
|
|
142
113
|
externalMemoryInstructions: options?.externalMemoryInstructions,
|
|
143
114
|
heartbeatEnabled: this.config.gateway?.heartbeat?.includeSystemPromptSection ?? false
|
|
144
115
|
});
|
|
@@ -117,8 +117,7 @@ function buildCoderHarnessSection() {
|
|
|
117
117
|
return [
|
|
118
118
|
"## Coder Harness",
|
|
119
119
|
"- Inspect relevant repository instructions, files, symbols, tests, and call sites before editing.",
|
|
120
|
-
"-
|
|
121
|
-
"- Treat code intelligence as indexed evidence, not ground truth: honor freshness and coverage warnings, and verify affected source directly before editing or making absence claims.",
|
|
120
|
+
"- Use grep and find to locate code, then read the current source before editing or claiming that something is absent.",
|
|
122
121
|
"- Make the smallest coherent source change that solves the requested behavior.",
|
|
123
122
|
"- Protect user work: do not discard or overwrite unrelated changes.",
|
|
124
123
|
"- After edits, inspect the diff and run the smallest meaningful verification; explain any skipped checks.",
|
|
@@ -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).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildTaskExecutionDirective } from "../../tasks/task-context-assembler.js";
|
|
2
2
|
import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
|
|
3
3
|
import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
|
|
4
|
-
import { prependAgentContext } from "
|
|
4
|
+
import { prependAgentContext } from "../../user-context/planner.js";
|
|
5
5
|
import { extractAgentUserPlainText } from "../memory/user-message-text.js";
|
|
6
6
|
import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
|
|
7
7
|
import { parseSlashCommand } from "../../chat-commands/command-parse.js";
|
|
@@ -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;
|
|
@@ -130,7 +130,6 @@ export declare class AgentService {
|
|
|
130
130
|
takeTaskReviewStreamHint(sessionKey: string): import("./session/session-state-bag.js").TaskReviewStreamHint;
|
|
131
131
|
start(): Promise<void>;
|
|
132
132
|
stop(): Promise<void>;
|
|
133
|
-
reconcileDreamingNow(): Promise<void>;
|
|
134
133
|
/**
|
|
135
134
|
* Persist agent messages with the same sanitizer + transcript hygiene as AgentOrchestrator.
|
|
136
135
|
* Uses persistence hygiene so `thinking` blocks remain on disk for the web UI (LLM load path still drops them).
|
|
@@ -176,7 +175,7 @@ export declare class AgentService {
|
|
|
176
175
|
getEffectiveWorkspacePathForSession(sessionKey: string): Promise<string>;
|
|
177
176
|
/**
|
|
178
177
|
* Best-effort timezone resolution for webchat envelope timestamps.
|
|
179
|
-
* Reads the global user profile
|
|
178
|
+
* Reads the structured global user profile.
|
|
180
179
|
*/
|
|
181
180
|
resolveUserTimezoneForSession(sessionKey: string): string | undefined;
|
|
182
181
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getUserProfile } from "../storage/sqlite/user-context-repository.js";
|
|
3
4
|
import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
|
|
4
5
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
5
6
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
6
7
|
import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
|
|
7
8
|
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
8
|
-
import { init_paths, resolveUserProfilePath } from "../config/paths.js";
|
|
9
9
|
import { extractTextContent } from "./context/workspace.js";
|
|
10
10
|
import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
|
|
11
11
|
import { getProjectForSession } from "../projects/workspace.js";
|
|
@@ -57,19 +57,17 @@ import { SessionHydrator } from "./session/session-hydrator.js";
|
|
|
57
57
|
import { SessionInspector } from "./session/session-inspector.js";
|
|
58
58
|
import "./session/index.js";
|
|
59
59
|
import { AgentOrchestrator } from "./orchestration/agent-orchestrator.js";
|
|
60
|
-
import { AgentEventHandler
|
|
60
|
+
import { AgentEventHandler } from "./orchestration/agent-event-handler.js";
|
|
61
61
|
import "./orchestration/index.js";
|
|
62
62
|
import { getWorkflowProgressBroker } from "./workflow/progress-broker.js";
|
|
63
63
|
import "./workflow/index.js";
|
|
64
64
|
import { TaskJudgeService } from "./tasks/task-judge-service.js";
|
|
65
65
|
import { analyzeResponseLanguage } from "../i18n/language-consistency.js";
|
|
66
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
67
66
|
import { readFile } from "node:fs/promises";
|
|
68
67
|
//#region src/agent/service.ts
|
|
69
68
|
init_schema();
|
|
70
69
|
init_logger();
|
|
71
70
|
init_agent_scope();
|
|
72
|
-
init_paths();
|
|
73
71
|
const log = createLogger("AgentService");
|
|
74
72
|
function assistantMessageText(message) {
|
|
75
73
|
const content = message.content;
|
|
@@ -118,7 +116,7 @@ var AgentService = class {
|
|
|
118
116
|
inboundLoop;
|
|
119
117
|
/**
|
|
120
118
|
* Direct-turn entry points: `processDirect` (one-shot), `processDirectStreaming`
|
|
121
|
-
* (
|
|
119
|
+
* (event generator), webchat steering and live event injection. Public so the gateway,
|
|
122
120
|
* TUI, CLI, and automations do not need to thread every call through `AgentService`.
|
|
123
121
|
*/
|
|
124
122
|
turnDispatcher;
|
|
@@ -218,6 +216,7 @@ var AgentService = class {
|
|
|
218
216
|
model: config.model,
|
|
219
217
|
config: config.config,
|
|
220
218
|
extensionRegistry: config.extensionRegistry,
|
|
219
|
+
endpointTools: config.endpointTools,
|
|
221
220
|
hookRunner: this.hookRunner,
|
|
222
221
|
bus,
|
|
223
222
|
getCurrentContext: () => this.sessionContextManager.getContext(),
|
|
@@ -251,12 +250,6 @@ var AgentService = class {
|
|
|
251
250
|
errorPatternMatcher: this.errorPatternMatcher,
|
|
252
251
|
turnDiffTracker: this.turnDiffTracker
|
|
253
252
|
});
|
|
254
|
-
this.agentEventHandler.registerListener("tool_execution_end", (event, context) => {
|
|
255
|
-
const e = event;
|
|
256
|
-
if (e.isError) return;
|
|
257
|
-
const changedPaths = readChangedPathsFromToolEnd(e.toolName, e.args, e.result);
|
|
258
|
-
this.agentManager.markCodeIntelligenceDirty(context.sessionKey, changedPaths);
|
|
259
|
-
});
|
|
260
253
|
this.agentEventHandler.registerListener("message_end", (event, context) => {
|
|
261
254
|
const message = event.message;
|
|
262
255
|
if (message.role !== "assistant") return;
|
|
@@ -373,7 +366,7 @@ var AgentService = class {
|
|
|
373
366
|
return c;
|
|
374
367
|
},
|
|
375
368
|
resolveSessionEndpoint: (sk) => this.resolveSessionEndpoint(sk),
|
|
376
|
-
initSessionContext: (sk, channel, chatId) => this.initSessionContext(sk, channel, chatId),
|
|
369
|
+
initSessionContext: (sk, channel, chatId, origin) => this.initSessionContext(sk, channel, chatId, origin),
|
|
377
370
|
sessionHydrator: this.sessionHydrator,
|
|
378
371
|
prepareInboundAttachments: (sk, att) => this.prepareInboundAttachments(sk, att),
|
|
379
372
|
enqueueMaybeAutoTitleAfterPersist: (sk) => this.enqueueMaybeAutoTitleAfterPersist(sk),
|
|
@@ -628,9 +621,6 @@ var AgentService = class {
|
|
|
628
621
|
log.debug("Agent service stopped");
|
|
629
622
|
return Promise.resolve();
|
|
630
623
|
}
|
|
631
|
-
async reconcileDreamingNow() {
|
|
632
|
-
return Promise.resolve();
|
|
633
|
-
}
|
|
634
624
|
/**
|
|
635
625
|
* Persist agent messages with the same sanitizer + transcript hygiene as AgentOrchestrator.
|
|
636
626
|
* Uses persistence hygiene so `thinking` blocks remain on disk for the web UI (LLM load path still drops them).
|
|
@@ -679,13 +669,14 @@ var AgentService = class {
|
|
|
679
669
|
chatId: metadata?.routing?.peerId?.trim() || metadata?.sourceChatId?.trim() || "main"
|
|
680
670
|
};
|
|
681
671
|
}
|
|
682
|
-
initSessionContext(sessionKey, channel, chatId, senderId = "") {
|
|
672
|
+
initSessionContext(sessionKey, channel, chatId, origin, senderId = "") {
|
|
683
673
|
const context = {
|
|
684
674
|
sessionKey,
|
|
685
675
|
channel,
|
|
686
676
|
chatId,
|
|
687
677
|
senderId,
|
|
688
|
-
isGroup: false
|
|
678
|
+
isGroup: false,
|
|
679
|
+
origin
|
|
689
680
|
};
|
|
690
681
|
this.contextMiddleware.onRequest({
|
|
691
682
|
sessionKey,
|
|
@@ -767,14 +758,12 @@ var AgentService = class {
|
|
|
767
758
|
}
|
|
768
759
|
/**
|
|
769
760
|
* Best-effort timezone resolution for webchat envelope timestamps.
|
|
770
|
-
* Reads the global user profile
|
|
761
|
+
* Reads the structured global user profile.
|
|
771
762
|
*/
|
|
772
763
|
resolveUserTimezoneForSession(sessionKey) {
|
|
773
764
|
try {
|
|
774
765
|
if (!this.effectiveAppConfig()) return void 0;
|
|
775
|
-
|
|
776
|
-
if (!existsSync(userPath)) return void 0;
|
|
777
|
-
return readFileSync(userPath, "utf-8").match(/Timezone:\s*(.+)/i)?.[1]?.trim() || void 0;
|
|
766
|
+
return getUserProfile().timezone || void 0;
|
|
778
767
|
} catch {
|
|
779
768
|
return;
|
|
780
769
|
}
|
|
@@ -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
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* `sessionEventUnsubscribers`) are still cleared via `disposeSession`, but they
|
|
17
17
|
* are NOT subject to TTL — sweeping them would race with their owners.
|
|
18
18
|
*/
|
|
19
|
-
export type
|
|
19
|
+
export type WebchatStreamPublisher = (event: {
|
|
20
20
|
type: string;
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
}) => void;
|
|
@@ -34,7 +34,7 @@ export interface SessionStateBagOptions {
|
|
|
34
34
|
now?: () => number;
|
|
35
35
|
}
|
|
36
36
|
export declare class SessionStateBag {
|
|
37
|
-
/** Webchat
|
|
37
|
+
/** Webchat run publisher (register/unregister + TTL fallback). */
|
|
38
38
|
private readonly webchatPublishers;
|
|
39
39
|
/** Last assistant plain text (TTL + LRU). */
|
|
40
40
|
private readonly lastAssistantText;
|
|
@@ -51,9 +51,9 @@ export declare class SessionStateBag {
|
|
|
51
51
|
private readonly now;
|
|
52
52
|
private readonly sweepTimer;
|
|
53
53
|
constructor(opts?: SessionStateBagOptions);
|
|
54
|
-
registerWebchatPublisher(sessionKey: string, publisher:
|
|
54
|
+
registerWebchatPublisher(sessionKey: string, publisher: WebchatStreamPublisher): void;
|
|
55
55
|
unregisterWebchatPublisher(sessionKey: string): void;
|
|
56
|
-
getWebchatPublisher(sessionKey: string):
|
|
56
|
+
getWebchatPublisher(sessionKey: string): WebchatStreamPublisher | undefined;
|
|
57
57
|
setLastAssistantText(sessionKey: string, text: string): void;
|
|
58
58
|
getLastAssistantText(sessionKey: string): string | undefined;
|
|
59
59
|
appendEmbeddedStreamText(sessionKey: string, chunk: string): string;
|
|
@@ -7,7 +7,7 @@ const DEFAULT_TTL_MS = 3600 * 1e3;
|
|
|
7
7
|
const DEFAULT_SWEEP_INTERVAL_MS = 600 * 1e3;
|
|
8
8
|
const DEFAULT_MAX_ENTRIES = 5e3;
|
|
9
9
|
var SessionStateBag = class {
|
|
10
|
-
/** Webchat
|
|
10
|
+
/** Webchat run publisher (register/unregister + TTL fallback). */
|
|
11
11
|
webchatPublishers = /* @__PURE__ */ new Map();
|
|
12
12
|
/** Last assistant plain text (TTL + LRU). */
|
|
13
13
|
lastAssistantText = /* @__PURE__ */ new Map();
|
|
@@ -202,7 +202,7 @@ function convertListItemToPackageItem(item) {
|
|
|
202
202
|
}
|
|
203
203
|
function convertSearchResultToPackageItem(item, enrichment) {
|
|
204
204
|
return {
|
|
205
|
-
id: item.
|
|
205
|
+
id: item.install?.reference ?? item.slug,
|
|
206
206
|
name: item.displayName || item.slug,
|
|
207
207
|
type: "skill",
|
|
208
208
|
description: item.summary || "",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReasoningLevel } from '../transcript/thinking-types.js';
|
|
2
|
+
export type AgentStreamEvent = {
|
|
3
|
+
type: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare function applyReasoningVisibility(event: AgentStreamEvent, reasoningLevel: ReasoningLevel): AgentStreamEvent | null;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
//#region src/agent/streaming/reasoning-visibility
|
|
2
|
-
|
|
3
|
-
* @returns `null` to drop the event; unchanged `event` otherwise.
|
|
4
|
-
*/
|
|
5
|
-
function applyReasoningVisibilityToSseEvent(event, reasoningLevel) {
|
|
1
|
+
//#region src/agent/streaming/reasoning-visibility.ts
|
|
2
|
+
function applyReasoningVisibility(event, reasoningLevel) {
|
|
6
3
|
if (reasoningLevel !== "off") return event;
|
|
7
4
|
if (event.type === "thinking") return null;
|
|
8
5
|
if (event.type === "message_update" && event.assistantMessageEvent?.type === "thinking_delta") return null;
|
|
@@ -10,4 +7,4 @@ function applyReasoningVisibilityToSseEvent(event, reasoningLevel) {
|
|
|
10
7
|
return event;
|
|
11
8
|
}
|
|
12
9
|
//#endregion
|
|
13
|
-
export {
|
|
10
|
+
export { applyReasoningVisibility };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { Config } from '../../config/schema.js';
|
|
3
3
|
export interface DreamingToolDeps {
|
|
4
|
-
getWorkspace: () => string;
|
|
5
4
|
getConfig: () => Config | undefined;
|
|
6
|
-
getAgentId?: () => string | undefined;
|
|
7
5
|
}
|
|
8
6
|
export declare function createDreamingTool(deps: DreamingToolDeps): AgentTool;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { evaluateMemoryReadiness } from "../../user-context/memory-readiness.js";
|
|
3
|
-
import { getMemoryReadiness } from "../../storage/sqlite/memory-readiness-repository.js";
|
|
4
|
-
import { listDreamingRuns } from "../../storage/sqlite/dreaming-repository.js";
|
|
5
|
-
import { listMemorySignals } from "../../storage/sqlite/memory-records-repository.js";
|
|
1
|
+
import { listContextConsolidationRuns } from "../../storage/sqlite/context-consolidation-repository.js";
|
|
6
2
|
import "../../storage/sqlite/index.js";
|
|
7
|
-
import {
|
|
3
|
+
import { resolveContextConsolidationConfig } from "../../user-context/consolidation.js";
|
|
8
4
|
import { Type } from "@sinclair/typebox";
|
|
9
5
|
//#region src/agent/tools/dreaming-tool.ts
|
|
10
6
|
const DreamingSchema = Type.Object({ action: Type.Literal("status") });
|
|
@@ -12,44 +8,23 @@ function createDreamingTool(deps) {
|
|
|
12
8
|
return {
|
|
13
9
|
name: "dreaming",
|
|
14
10
|
label: "💤 Dreaming",
|
|
15
|
-
description: "Show
|
|
11
|
+
description: "Show structured user-context review configuration and recent activity.",
|
|
16
12
|
parameters: DreamingSchema,
|
|
17
13
|
async execute() {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
agentId,
|
|
22
|
-
workspaceId
|
|
23
|
-
}) : evaluateMemoryReadiness({
|
|
24
|
-
evaluatedTurns: 0,
|
|
25
|
-
helpfulTurns: 0,
|
|
26
|
-
recordFeedback: 0,
|
|
27
|
-
recordErrors: 0,
|
|
28
|
-
sensitiveFeedback: 0,
|
|
29
|
-
dreamingRuns: 0,
|
|
30
|
-
dreamingFailures: 0
|
|
31
|
-
});
|
|
32
|
-
const resolved = resolveDreamingConfig(deps.getConfig(), { automaticReady: readiness.ready });
|
|
33
|
-
const signals = listMemorySignals({
|
|
34
|
-
workspaceId,
|
|
35
|
-
limit: 500
|
|
36
|
-
});
|
|
37
|
-
const runs = listDreamingRuns({
|
|
38
|
-
agentId,
|
|
39
|
-
workspaceId,
|
|
40
|
-
limit: 20
|
|
41
|
-
});
|
|
14
|
+
const config = deps.getConfig();
|
|
15
|
+
const resolved = config ? resolveContextConsolidationConfig(config) : null;
|
|
16
|
+
const runs = listContextConsolidationRuns(20);
|
|
42
17
|
return {
|
|
43
18
|
content: [{
|
|
44
19
|
type: "text",
|
|
45
20
|
text: JSON.stringify({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
enabled: resolved?.enabled ?? false,
|
|
22
|
+
schedule: resolved ? {
|
|
23
|
+
time: resolved.time,
|
|
24
|
+
timezone: resolved.timezone
|
|
25
|
+
} : null,
|
|
26
|
+
policy: "review_only",
|
|
27
|
+
storage: "sqlite://user_understandings",
|
|
53
28
|
lastRun: runs[0] ?? null
|
|
54
29
|
}, null, 2)
|
|
55
30
|
}],
|