@xopcai/xopc 0.0.385 → 0.0.387
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/dist/browser-ext/dist/sidepanel.js +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/{agent-avatar-dicebear-Cb9eaXxR.js → agent-avatar-dicebear-Bv8M5ygD.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DEV-xtgm.js → agent-defaults-settings-panel-UBy01-65.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DXKc3Luj.js → agent-plugin-dialog-Q9guA8kU.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DcNxwpJQ.js → agents-yfJFubD0.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-X5i0Tz7_.js → app-management-settings-panel-Cdyad8c1.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CmHHzquT.js → appearance-settings-DPPvnKH_.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-ChFA4Zp0.js → apps-page-Bn_jwaeA.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BFqsIqOI.js → automations-page-CAB2sLJ5.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-Blfak-fT.js → automations-workspace-CYRUhhH4.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CpOLG3Co.js → block-editor-B9DmMEa8.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BSbTJ9j2.js → browser-automations-page-BHAWpZE2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BUlILJrB.js → browser-settings-page-BG_17NcQ.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-2Do3eKMM.js → capabilities-BX1rCiVm.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-XFwwUNU3.js → capabilities-CW389yo6.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CeRdkwRf.js → capabilities-page-BAnBYWlY.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-S-cKsGja.js → capabilities-settings-panel-Ca-d6lXk.js} +3 -3
- package/dist/gateway/static/root/assets/{capability-header-actions-6w8pQhnn.js → capability-header-actions-B3TL8TcF.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DfNTGBmp.js → channels-BadpS-nq.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DnoQHpDc.js → chat-terminal-dock-C_vntFpP.js} +1 -1
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-7yliE7sG.js → computer-settings-page-B-5kxk70.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DOLAUFSW.js → connector-service-page-DTnfpLHL.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DAsn97XG.js → connectors-page-CmJV7gqj.js} +1 -1
- package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-DNDqr4Fk.js → date-picker-D5zYeC8q.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-B5oG7RgE.js → dependency-picker-D72vT-tb.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-K7kUCX1O.js → desktop-pet-DvoeVPf_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-KgOAuqSh.js → desktop-pet-settings-Dfb392hs.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DvqniZDm.js → device-pairing-wizard-B06Sqn5D.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BmOguLDl.js → directory-picker-path-field-CA3H3bc-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DtHNy4TE.js → extension-debug-page-B0wTBCx4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DSSuMQxp.js → extension-page-BeHiXhB1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-nbgU7xBS.js → extension-provider-CJZ5EVpQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DSd__mNd.js → extension-settings-page-Q88-LFCJ.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-D7bjbiwZ.js → fallback-models-BXoPCvzq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-hSXGWumL.js → gateway-settings-IICLMGDI.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-C7xJwE61.js → highlighted-body-KQOG7T2V-D336so8z.js} +1 -1
- package/dist/gateway/static/root/assets/home-page--MvqsFhQ.js +2 -0
- package/dist/gateway/static/root/assets/{imports-page-BufZPzGE.js → imports-page-muV1SduS.js} +1 -1
- package/dist/gateway/static/root/assets/index-D0qMv3jf.js +260 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8pPP5RF.js → keyboard-shortcuts-settings-i1sDWcwl.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-zEtvE7pJ.js → local-app-workbench-page-DY9tXEO6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Bli7e_eg.js → local-apps-page-BHD73STy.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
- package/dist/gateway/static/root/assets/{logs-page-BimZk3R4.js → logs-page-DsPpe8Ws.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-5Y4COyU9.js → management-settings-Buwi2wQE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-KLDPLVg7.js → note-detail-panel-D8n80Gbr.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DST0oPXD.js → notes-page-Btf-jSS_.js} +5 -5
- package/dist/gateway/static/root/assets/{page-context-capture-button-Bmed83-6.js → page-context-capture-button-97RL8Gc7.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BG4Ystrm.js → personal-page-B04L8Oz5.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-9zEDvZa7.js +1 -0
- package/dist/gateway/static/root/assets/{product-preview-content-DjmupQSq.js → product-preview-content-DynBrIXq.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CzBmV0P6.js → project-detail-page-BM7MsoVA.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DByqe5Em.js → projects-page-pcyeEJnz.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DTjj-odF.js → remote-access-hub-CphyTu22.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B_ptn3T8.js → runtime-tools-settings-panel-DPafoO0G.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-wkua4l5y.js → scenes-page-j97FrDRW.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-VvOSM84Y.js → schema-form-CuJNwKHO.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-BCAF-Ikt.js → send-session-input-C293-Hbx.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-COd9RECl.js +16 -0
- package/dist/gateway/static/root/assets/{sessions-page-D06XwYAT.js → sessions-page-D8t_8fMl.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C-6BJdb1.js → settings-page-DS9DMYUe.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-L0JSG0K-.js → setup-status-panel-DRDvm9yZ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-nJ2FWAEP.js → share-preview-page-BF2WaO43.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BbgAUM3v.js → shares-settings-DQTQZu6V.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BFU1tPyw.js → skill-api-DzVa7G-O.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DZw6el4o.js → skills-page-CfJIjRdS.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DshSGWNg.js → system-settings-panel-Bzhqed-a.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BYQFC0-U.js +2 -0
- package/dist/gateway/static/root/assets/task-expandable-content-C9ohICpw.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-DJIeIk9C.js → tasks-PuIUgF9L.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DFDXwWnU.js → tunnel-api-DrgpZ81I.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-2RJLg54s.js → usage-page-Drk8FWnj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-BFP3k6oC.js → use-composer-attachments-rgW7h4sD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-B1BiTQNS.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-y1gjGYPI.js → user-model-page-07t2-nFE.js} +2 -2
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ch-KfpCF.js → work-discovery-overlay-TQ5bjVot.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CTu297Hc.js → workflow-run-setup-panel-C9HP2uGG.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-CRZXG_rm.js → workflows-page-DK01JRI1.js} +3 -3
- package/dist/gateway/static/root/assets/{workspace-api-Xr3wz8T3.js → workspace-api-JWHOFos6.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-hEfjVjnc.js → xopc-cloud-account-card-B-BhQdAf.js} +1 -1
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/result-reference.js +25 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
- package/dist/packages/gateway-contract/src/task-research-result.js +90 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
- package/dist/packages/gateway-contract/src/tasks.js +7 -1
- package/dist/packages/gateway-contract/src/turn-outcome.js +4 -0
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +4 -1
- package/dist/src/agent/child-agent-factory.js +86 -12
- package/dist/src/agent/context/connection-objective-context.d.ts +1 -0
- package/dist/src/agent/context/connection-objective-context.js +33 -0
- package/dist/src/agent/data-acquisition/service.js +41 -6
- package/dist/src/agent/data-acquisition/types.d.ts +2 -0
- package/dist/src/agent/embedded/agent-profile-context.d.ts +7 -0
- package/dist/src/agent/embedded/agent-profile-context.js +92 -0
- package/dist/src/agent/embedded/run-for-session.js +5 -2
- package/dist/src/agent/embedded/run-turn.js +19 -6
- package/dist/src/agent/embedded/runs.d.ts +9 -2
- package/dist/src/agent/embedded/runs.js +30 -7
- package/dist/src/agent/embedded/session-runner.js +5 -2
- package/dist/src/agent/embedded/types.d.ts +4 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
- package/dist/src/agent/external-tools/cliProvider.js +1 -1
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.js +8 -4
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/orchestration/agent-run-supervisor.js +2 -1
- package/dist/src/agent/orchestration/agent-turn-policy.js +5 -1
- package/dist/src/agent/orchestration/delegation-budget.d.ts +7 -1
- package/dist/src/agent/orchestration/delegation-budget.js +17 -9
- package/dist/src/agent/orchestration/research-checkpoint.d.ts +56 -0
- package/dist/src/agent/orchestration/research-checkpoint.js +64 -0
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +3 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +15 -2
- package/dist/src/agent/orchestration/run-termination.d.ts +12 -0
- package/dist/src/agent/orchestration/run-termination.js +24 -0
- package/dist/src/agent/orchestration/turn-recovery.d.ts +4 -1
- package/dist/src/agent/orchestration/turn-recovery.js +19 -3
- package/dist/src/agent/prompt/sections/agent-identity.js +12 -7
- package/dist/src/agent/prompt/sections/messaging-runtime.js +1 -1
- package/dist/src/agent/prompt/sections/project-context.js +1 -1
- package/dist/src/agent/prompt/sections/response-language.d.ts +1 -1
- package/dist/src/agent/prompt/sections/response-language.js +6 -2
- package/dist/src/agent/prompt/subagent-context.js +1 -1
- package/dist/src/agent/prompt/system-prompt.js +4 -6
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +4 -0
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/source-context/index.js +1 -1
- package/dist/src/agent/source-context/result-context.d.ts +2 -0
- package/dist/src/agent/source-context/result-context.js +32 -0
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -1
- package/dist/src/agent/tools/apply-patch.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +216 -121
- package/dist/src/agent/tools/delegation-policy.js +13 -1
- package/dist/src/agent/tools/exec-command.js +47 -2
- package/dist/src/agent/tools/factory.js +19 -10
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-performance.d.ts +2 -0
- package/dist/src/agent/tools/personal-performance.js +82 -0
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +9 -14
- package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
- package/dist/src/agent/tools/personal-result-tool.js +106 -0
- package/dist/src/agent/tools/personal-task-tool.d.ts +12 -3
- package/dist/src/agent/tools/personal-task-tool.js +115 -10
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/research-checkpoint-tool.d.ts +3 -0
- package/dist/src/agent/tools/research-checkpoint-tool.js +28 -0
- package/dist/src/agent/tools/review-workspace.js +21 -2
- package/dist/src/agent/tools/search/cache.d.ts +20 -0
- package/dist/src/agent/tools/search/cache.js +19 -0
- package/dist/src/agent/tools/search/errors.d.ts +19 -0
- package/dist/src/agent/tools/search/errors.js +69 -0
- package/dist/src/agent/tools/search/providers/bing-api.js +2 -1
- package/dist/src/agent/tools/search/providers/bing-html.js +2 -1
- package/dist/src/agent/tools/search/providers/brave.js +2 -1
- package/dist/src/agent/tools/search/providers/duckduckgo-html.js +2 -1
- package/dist/src/agent/tools/search/providers/searxng.js +2 -1
- package/dist/src/agent/tools/search/providers/tavily.js +2 -1
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +1 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +7 -2
- package/dist/src/agent/tools/search/registry.d.ts +21 -5
- package/dist/src/agent/tools/search/registry.js +252 -25
- package/dist/src/agent/tools/search/types.d.ts +25 -0
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +121 -2
- package/dist/src/agent/tools/task-evidence.d.ts +3 -0
- package/dist/src/agent/tools/task-evidence.js +71 -0
- package/dist/src/agent/tools/task-result-tool.d.ts +2 -0
- package/dist/src/agent/tools/task-result-tool.js +93 -0
- package/dist/src/agent/tools/tool-media.js +1 -1
- package/dist/src/agent/tools/web.d.ts +16 -2
- package/dist/src/agent/tools/web.js +74 -29
- package/dist/src/agent/tools/xopc-use-tool.js +27 -6
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +4 -4
- package/dist/src/automations/domain/validation.d.ts +8 -8
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/automations/schema.d.ts +2 -2
- package/dist/src/browser/automations/service.d.ts +2 -2
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +1 -0
- package/dist/src/config/schema.js +5 -2
- package/dist/src/connectors/connection-recovery-service.d.ts +3 -1
- package/dist/src/connectors/connection-recovery-service.js +67 -6
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +18 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
- package/dist/src/gateway/hono/routes/tasks.js +2 -2
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +2 -0
- package/dist/src/gateway/service/agent-runner.js +30 -17
- package/dist/src/gateway/service/run-gateway-agent.js +32 -2
- package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
- package/dist/src/gateway/service/session-input-coordinator.js +214 -27
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +49 -16
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/media/session-references.js +1 -1
- package/dist/src/personal-agent/communication.js +1 -0
- package/dist/src/personal-agent/performance.d.ts +83 -0
- package/dist/src/personal-agent/performance.js +65 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +1 -0
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompt-context.js +3 -1
- package/dist/src/personal-agent/prompts.js +10 -4
- package/dist/src/personal-agent/reply-composer.d.ts +1 -0
- package/dist/src/personal-agent/reply-composer.js +149 -20
- package/dist/src/personal-agent/reply-style.d.ts +1 -1
- package/dist/src/personal-agent/reply-style.js +1 -0
- package/dist/src/personal-agent/repository.d.ts +1 -1
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +3 -1
- package/dist/src/personal-agent/request-repository.d.ts +2 -0
- package/dist/src/personal-agent/request-service.d.ts +4 -0
- package/dist/src/personal-agent/request-service.js +91 -20
- package/dist/src/personal-agent/result-extraction.d.ts +42 -0
- package/dist/src/personal-agent/result-extraction.js +209 -0
- package/dist/src/personal-agent/result-file-links.d.ts +3 -0
- package/dist/src/personal-agent/result-file-links.js +21 -0
- package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
- package/dist/src/personal-agent/result-read-continuations.js +78 -0
- package/dist/src/personal-agent/result-reader.d.ts +43 -0
- package/dist/src/personal-agent/result-reader.js +461 -0
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/personal-agent/task-cancel.js +85 -35
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/scenes/taskFollowUp/service.d.ts +15 -5
- package/dist/src/session/client-history.d.ts +1 -1
- package/dist/src/session/client-history.js +1 -1
- package/dist/src/session/session-context-for-llm.js +4 -2
- package/dist/src/session/store.d.ts +3 -1
- package/dist/src/session/store.js +13 -3
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +5 -2
- package/dist/src/storage/sqlite/connection-wait-repository.js +42 -17
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +3 -1
- package/dist/src/storage/sqlite/migrations/250_research_checkpoints.sql +15 -0
- package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
- package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -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/research-checkpoint-repository.d.ts +24 -0
- package/dist/src/storage/sqlite/research-checkpoint-repository.js +91 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-creation-repository.js +3 -2
- package/dist/src/storage/sqlite/session-input-repository.d.ts +16 -0
- package/dist/src/storage/sqlite/session-input-repository.js +41 -7
- package/dist/src/tasks/capabilities/management.d.ts +2 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/relations.d.ts +7 -7
- package/dist/src/tasks/capabilities/write.d.ts +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.d.ts +2 -0
- package/dist/src/tasks/task-allocation-service.js +100 -8
- package/dist/src/tasks/task-application-service.d.ts +18 -0
- package/dist/src/tasks/task-application-service.js +133 -2
- package/dist/src/tasks/task-context-assembler.js +13 -5
- package/dist/src/tasks/task-continuation.d.ts +1 -0
- package/dist/src/tasks/task-continuation.js +1 -0
- package/dist/src/tasks/task-contract-definition.d.ts +3 -0
- package/dist/src/tasks/task-contract-planner.d.ts +1 -0
- package/dist/src/tasks/task-contract-planner.js +61 -20
- package/dist/src/tasks/task-conversation-repository.js +1 -1
- package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
- package/dist/src/tasks/task-evidence-ranges.js +20 -0
- package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
- package/dist/src/tasks/task-execution-capabilities.js +117 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.d.ts +56 -0
- package/dist/src/tasks/task-handoff.js +510 -0
- package/dist/src/tasks/task-model-call.d.ts +7 -0
- package/dist/src/tasks/task-model-call.js +35 -0
- package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
- package/dist/src/tasks/task-read-model-projector.js +12 -1
- package/dist/src/tasks/task-research-repair.d.ts +19 -0
- package/dist/src/tasks/task-research-repair.js +79 -0
- package/dist/src/tasks/task-research-result.d.ts +99 -0
- package/dist/src/tasks/task-research-result.js +478 -0
- package/dist/src/tasks/task-result-delivery-repository.js +37 -3
- package/dist/src/tasks/task-result-delivery-service.js +38 -10
- package/dist/src/tasks/task-run-coordinator.js +71 -15
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +3 -1
- package/dist/src/tasks/task-run-repository.d.ts +5 -0
- package/dist/src/tasks/task-run-repository.js +88 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +12 -6
- package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DJNmlMfH.js +0 -2
- package/dist/gateway/static/root/assets/index-K8SXDtxr.js +0 -260
- package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DBRj4-1-.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CXkYP9xE.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-_yy4bxhT.js +0 -16
- package/dist/gateway/static/root/assets/settings-advanced-gate-DoAHy1wj.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CfZhq4XZ.js +0 -2
- package/dist/gateway/static/root/assets/task-expandable-content-CF6Bj-Qa.js +0 -1
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
4
|
+
import { init_session_instance_repository, readCurrentTranscriptId } from "../../storage/sqlite/session-instance-repository.js";
|
|
3
5
|
import { SessionInstanceChangedError, cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, findSessionInputByRunId, finishSessionInputRun, getSessionInputById, getSessionInputState, init_session_input_repository, insertSessionInput, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus } from "../../storage/sqlite/session-input-repository.js";
|
|
4
|
-
import {
|
|
6
|
+
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
7
|
+
import { consumeClarificationResume, getActiveClarification, init_clarification_wait_repository, supersedeActiveClarification } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
5
8
|
import { replaceLatestSessionTurnAndQueueInput, validateLatestSessionTurnTarget } from "../../storage/sqlite/session-turn-replace-repository.js";
|
|
6
|
-
import { cancelConnectionObjective, consumeConnectionResume, init_connection_wait_repository,
|
|
9
|
+
import { cancelConnectionObjective, consumeConnectionResume, getActiveConnectionWait, getConnectionWait, hasPendingConnectionMessages, init_connection_wait_repository, interruptedConnectionMessage, publishConnectionWait, reconcileConnectionWaits } from "../../storage/sqlite/connection-wait-repository.js";
|
|
10
|
+
import { appendTranscriptEntry, init_transcript_repository } from "../../storage/sqlite/transcript-repository.js";
|
|
7
11
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
12
|
+
import { emitSessionTranscriptUpdate } from "../../session/transcript-events.js";
|
|
8
13
|
import { summarizeSourceContext } from "../../agent/source-context/types.js";
|
|
14
|
+
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
9
15
|
import { injectSourceContextsIntoUserMessage } from "../../agent/source-context/injector.js";
|
|
10
16
|
import { deleteMediaUrisNoLongerReferenced } from "../../media/session-references.js";
|
|
11
17
|
import { fitSourceContextsToBudget } from "../../agent/source-context/budget.js";
|
|
@@ -14,11 +20,37 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
14
20
|
//#region src/gateway/service/session-input-coordinator.ts
|
|
15
21
|
init_session_input_repository();
|
|
16
22
|
init_connection_wait_repository();
|
|
23
|
+
init_transaction();
|
|
24
|
+
init_transcript_repository();
|
|
25
|
+
init_session_instance_repository();
|
|
17
26
|
init_clarification_wait_repository();
|
|
18
27
|
init_sqlite();
|
|
19
28
|
init_logger();
|
|
29
|
+
init_task_run_repository();
|
|
20
30
|
const log = createLogger("SessionInputCoordinator");
|
|
21
31
|
const MAX_PENDING_INPUTS = 10;
|
|
32
|
+
function connectionControl(input, wait) {
|
|
33
|
+
if (input.attachments?.length || input.contextRefs?.length || input.sourceContexts?.some((source) => source.kind !== "device_context") || input.origin.type === "system" && input.origin.source !== "cli") return void 0;
|
|
34
|
+
const text = input.content.trim().toLowerCase().replace(/[。.!!??]+$/u, "").trim();
|
|
35
|
+
if (/^(?:继续|继续看下|继续看看|继续这个目标|继续原目标|continue|resume)$/u.test(text)) {
|
|
36
|
+
if (text !== "继续原目标" && (hasPendingConnectionMessages(wait) || getActiveClarification(wait.conversationId))) return void 0;
|
|
37
|
+
return "continue";
|
|
38
|
+
}
|
|
39
|
+
if (/^(?:取消这个目标|取消原目标|取消当前目标|cancel this objective|cancel the original objective)$/u.test(text)) return "cancel";
|
|
40
|
+
}
|
|
41
|
+
function connectionInputPayload(wait, control) {
|
|
42
|
+
if (!wait) return void 0;
|
|
43
|
+
if (control) return {
|
|
44
|
+
waitId: wait.id,
|
|
45
|
+
objectiveRevision: wait.objectiveRevision,
|
|
46
|
+
connectionAction: control
|
|
47
|
+
};
|
|
48
|
+
if (wait.status !== "closed") return {
|
|
49
|
+
waitId: wait.id,
|
|
50
|
+
objectiveRevision: wait.objectiveRevision,
|
|
51
|
+
connectionBarrier: true
|
|
52
|
+
};
|
|
53
|
+
}
|
|
22
54
|
function sameAppContext(input, existing) {
|
|
23
55
|
const identity = (sources) => sources?.filter((source) => source.kind === "app_context").map((source) => ({
|
|
24
56
|
snapshot: source.appContext,
|
|
@@ -40,7 +72,7 @@ function steeringText(content, contexts) {
|
|
|
40
72
|
}, contexts).content[0].text;
|
|
41
73
|
}
|
|
42
74
|
function contextRefsMatchFrozenSnapshot(requested, frozen) {
|
|
43
|
-
const editable = frozen?.filter((ref) => ref.kind === "note" || ref.kind === "task" || ref.kind === "file" || ref.kind === "session" || ref.kind === "browser_tab" || ref.kind === "user_assertion") ?? [];
|
|
75
|
+
const editable = frozen?.filter((ref) => ref.kind === "result" || ref.kind === "note" || ref.kind === "task" || ref.kind === "file" || ref.kind === "session" || ref.kind === "browser_tab" || ref.kind === "user_assertion") ?? [];
|
|
44
76
|
if (requested.length !== editable.length) return false;
|
|
45
77
|
return requested.every((ref, index) => {
|
|
46
78
|
const snapshot = editable[index];
|
|
@@ -52,6 +84,7 @@ var SessionInputCoordinator = class {
|
|
|
52
84
|
resumeAfter = /* @__PURE__ */ new Map();
|
|
53
85
|
draining = /* @__PURE__ */ new Set();
|
|
54
86
|
submissionTails = /* @__PURE__ */ new Map();
|
|
87
|
+
pendingConnectionStops = /* @__PURE__ */ new Set();
|
|
55
88
|
constructor(deps) {
|
|
56
89
|
this.deps = deps;
|
|
57
90
|
}
|
|
@@ -61,9 +94,15 @@ var SessionInputCoordinator = class {
|
|
|
61
94
|
snapshot(conversationId) {
|
|
62
95
|
return getSessionInputState(conversationId);
|
|
63
96
|
}
|
|
97
|
+
connectionTarget(conversationId, runtime = this.snapshot(conversationId)) {
|
|
98
|
+
const active = runtime.activeInputId ? getSessionInputById(conversationId, runtime.activeInputId) : void 0;
|
|
99
|
+
return getActiveConnectionWait(conversationId) ?? (active?.kind === "connection_resume" && active.payload ? getConnectionWait(active.payload.waitId) : void 0);
|
|
100
|
+
}
|
|
64
101
|
async prepareInput(input) {
|
|
65
102
|
const attachments = await this.deps.prepareAttachments(input.conversationId, input.attachments);
|
|
66
103
|
const contexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(input.conversationId, input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
104
|
+
const wait = this.connectionTarget(input.conversationId);
|
|
105
|
+
const payload = connectionInputPayload(wait, wait?.principalId === "local-owner" ? connectionControl(input, wait) : void 0);
|
|
67
106
|
return {
|
|
68
107
|
status: "queued",
|
|
69
108
|
requestedDelivery: input.delivery,
|
|
@@ -71,10 +110,11 @@ var SessionInputCoordinator = class {
|
|
|
71
110
|
content: input.content.trim(),
|
|
72
111
|
attachments,
|
|
73
112
|
contextRefs: contexts.map(summarizeSourceContext),
|
|
74
|
-
interruptRequested: input.interrupt !== false && this.deps.prioritizeInput?.(input) === true,
|
|
113
|
+
interruptRequested: !wait && input.interrupt !== false && this.deps.prioritizeInput?.(input) === true,
|
|
75
114
|
contextSnapshots: contexts,
|
|
76
115
|
thinking: input.thinking,
|
|
77
|
-
origin: input.origin
|
|
116
|
+
origin: input.origin,
|
|
117
|
+
...payload ? { payload } : {}
|
|
78
118
|
};
|
|
79
119
|
}
|
|
80
120
|
async dispatchAcceptedInput(conversationId, inputId) {
|
|
@@ -84,6 +124,11 @@ var SessionInputCoordinator = class {
|
|
|
84
124
|
const row = getSessionInputById(conversationId, inputId);
|
|
85
125
|
const state = this.snapshot(input.conversationId);
|
|
86
126
|
if (!row || row.status !== "queued") return;
|
|
127
|
+
if (row.payload?.connectionAction === "cancel") this.completeConnectionCancellation(row);
|
|
128
|
+
if (row.payload?.connectionAction || this.connectionTarget(row.conversationId, state)) {
|
|
129
|
+
this.requestConnectionStop(row);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
87
132
|
if (row.interruptRequested) {
|
|
88
133
|
this.prioritizeAcceptedInput(row, state);
|
|
89
134
|
return;
|
|
@@ -158,6 +203,7 @@ var SessionInputCoordinator = class {
|
|
|
158
203
|
const remaining = (this.pendingSubmissions.get(conversationId) ?? 1) - 1;
|
|
159
204
|
if (remaining) this.pendingSubmissions.set(conversationId, remaining);
|
|
160
205
|
else this.pendingSubmissions.delete(conversationId);
|
|
206
|
+
this.drain(conversationId);
|
|
161
207
|
}
|
|
162
208
|
}
|
|
163
209
|
async submit(input) {
|
|
@@ -303,27 +349,36 @@ var SessionInputCoordinator = class {
|
|
|
303
349
|
};
|
|
304
350
|
}
|
|
305
351
|
const runtime = this.snapshot(conversationId);
|
|
306
|
-
const
|
|
307
|
-
const
|
|
352
|
+
const wait = this.connectionTarget(conversationId, runtime);
|
|
353
|
+
const control = wait?.principalId === "local-owner" ? connectionControl(input, wait) : void 0;
|
|
354
|
+
const payload = connectionInputPayload(wait, control);
|
|
355
|
+
const priority = !wait && input.interrupt !== false && this.deps.prioritizeInput?.(input) === true;
|
|
356
|
+
const canSteer = !wait && !priority && input.delivery === "steer" && runtime.activeRunId !== void 0 && !attachments?.length && canSteerContexts(runtime, input.origin, sourceContexts);
|
|
308
357
|
const effectiveDelivery = canSteer ? "steer" : "next";
|
|
309
|
-
const row =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
358
|
+
const row = runSqliteWriteTransaction(() => {
|
|
359
|
+
const row = insertSessionInput({
|
|
360
|
+
expectedTranscriptId: input.expectedTranscriptId ?? (payload ? wait?.transcriptId : void 0),
|
|
361
|
+
id: crypto.randomUUID(),
|
|
362
|
+
conversationId,
|
|
363
|
+
clientMessageId,
|
|
364
|
+
requestedDelivery: input.delivery,
|
|
365
|
+
interruptRequested: priority,
|
|
366
|
+
effectiveDelivery,
|
|
367
|
+
status: canSteer ? "injecting" : "queued",
|
|
368
|
+
content,
|
|
369
|
+
attachments,
|
|
370
|
+
contextRefs: sourceContexts?.map(summarizeSourceContext),
|
|
371
|
+
contextSnapshots: sourceContexts,
|
|
372
|
+
thinking: input.thinking,
|
|
373
|
+
origin: input.origin,
|
|
374
|
+
targetRunId: canSteer ? runtime.activeRunId : void 0,
|
|
375
|
+
...payload ? { payload } : {}
|
|
376
|
+
});
|
|
377
|
+
if (control === "cancel") cancelConnectionObjective(conversationId, wait?.id, wait?.objectiveRevision);
|
|
378
|
+
return row;
|
|
325
379
|
});
|
|
326
|
-
|
|
380
|
+
if (control === "cancel") this.completeConnectionCancellation(row);
|
|
381
|
+
this.requestConnectionStop(row);
|
|
327
382
|
supersedeActiveClarification(conversationId);
|
|
328
383
|
if (priority) {
|
|
329
384
|
this.prioritizeAcceptedInput(row, runtime);
|
|
@@ -364,6 +419,7 @@ var SessionInputCoordinator = class {
|
|
|
364
419
|
this.draining.add(conversationId);
|
|
365
420
|
try {
|
|
366
421
|
while (true) {
|
|
422
|
+
if (this.isAcceptingInput(conversationId)) return;
|
|
367
423
|
const delay = (this.resumeAfter.get(conversationId) ?? 0) - Date.now();
|
|
368
424
|
if (delay > 0) {
|
|
369
425
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
@@ -375,7 +431,15 @@ var SessionInputCoordinator = class {
|
|
|
375
431
|
if (!input) return;
|
|
376
432
|
let allowed;
|
|
377
433
|
try {
|
|
378
|
-
allowed =
|
|
434
|
+
allowed = !this.deps.beforeExecute || await this.deps.beforeExecute(input);
|
|
435
|
+
const wait = input.kind === "connection_resume" && input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
436
|
+
if (allowed && wait?.status === "queued" && wait.queuedInputId === input.id && (this.isAcceptingInput(conversationId) || hasPendingConnectionMessages(wait, true))) {
|
|
437
|
+
finishSessionInputRun(conversationId, runId, "interrupted");
|
|
438
|
+
setSessionInputStatus(input.id, "queued");
|
|
439
|
+
this.publish(conversationId);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
allowed = allowed && consumeConnectionResume(input) && consumeClarificationResume(input);
|
|
379
443
|
} catch (err) {
|
|
380
444
|
log.warn({
|
|
381
445
|
err,
|
|
@@ -397,7 +461,7 @@ var SessionInputCoordinator = class {
|
|
|
397
461
|
this.publish(conversationId);
|
|
398
462
|
let result;
|
|
399
463
|
try {
|
|
400
|
-
result = await this.deps.execute({
|
|
464
|
+
result = input.payload?.connectionAction ? await this.executeConnectionControl(input) : await this.deps.execute({
|
|
401
465
|
inputReceivedAtMs: input.createdAtMs,
|
|
402
466
|
runId,
|
|
403
467
|
taskRunId: input.taskRunId,
|
|
@@ -420,7 +484,37 @@ var SessionInputCoordinator = class {
|
|
|
420
484
|
inputId: input.id
|
|
421
485
|
}, "Session input execution failed");
|
|
422
486
|
}
|
|
423
|
-
const
|
|
487
|
+
const cancelledWait = input.kind === "connection_resume" && input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
488
|
+
const cancelled = cancelledWait?.resolution === "cancelled" && cancelledWait.objectiveRevision === input.payload?.objectiveRevision;
|
|
489
|
+
if (cancelled && input.taskRunId) {
|
|
490
|
+
const run = new TaskRunRepository().get(input.taskRunId);
|
|
491
|
+
if (run && [
|
|
492
|
+
"queued",
|
|
493
|
+
"running",
|
|
494
|
+
"waiting",
|
|
495
|
+
"verifying"
|
|
496
|
+
].includes(run.status)) new TaskApplicationService().completeRun({
|
|
497
|
+
runId: run.id,
|
|
498
|
+
expectedRunVersion: run.version,
|
|
499
|
+
actor: { kind: "user" },
|
|
500
|
+
terminalCode: "cancelled_by_user",
|
|
501
|
+
suppressAttention: true,
|
|
502
|
+
receipt: {
|
|
503
|
+
status: "cancelled",
|
|
504
|
+
summary: "Connection objective cancelled",
|
|
505
|
+
changes: [],
|
|
506
|
+
evidence: [],
|
|
507
|
+
verification: {
|
|
508
|
+
status: "unverified",
|
|
509
|
+
checks: []
|
|
510
|
+
},
|
|
511
|
+
remainingWork: [],
|
|
512
|
+
needsUser: false,
|
|
513
|
+
completionVerdict: "not_achieved"
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
const terminal = cancelled ? "cancelled" : result.status === "suspended" ? "suspended" : result.status === "ok" ? "completed" : result.status === "aborted" ? "cancelled" : "failed";
|
|
424
518
|
finishSessionInputRun(conversationId, runId, terminal, terminal === "failed" ? result.summary : void 0);
|
|
425
519
|
this.publish(conversationId);
|
|
426
520
|
}
|
|
@@ -428,6 +522,94 @@ var SessionInputCoordinator = class {
|
|
|
428
522
|
this.draining.delete(conversationId);
|
|
429
523
|
}
|
|
430
524
|
}
|
|
525
|
+
requestConnectionStop(input) {
|
|
526
|
+
const target = input.payload;
|
|
527
|
+
if (target?.connectionAction !== "cancel" || !this.deps.interrupt) return;
|
|
528
|
+
const wait = getConnectionWait(target.waitId);
|
|
529
|
+
if (!wait || wait.resolution !== "cancelled" || wait.objectiveRevision !== target.objectiveRevision || wait.transcriptId !== input.expectedTranscriptId) return;
|
|
530
|
+
const runtime = this.snapshot(input.conversationId);
|
|
531
|
+
const active = runtime.activeInputId ? getSessionInputById(input.conversationId, runtime.activeInputId) : void 0;
|
|
532
|
+
if (!runtime.activeRunId || active?.kind !== "connection_resume" || !active.payload) return;
|
|
533
|
+
const sameVersion = active.payload.waitId === target.waitId && active.payload.objectiveRevision === target.objectiveRevision;
|
|
534
|
+
const parent = getConnectionWait(active.payload.waitId);
|
|
535
|
+
const sameExecution = wait.originInputId === active.id && parent?.objectiveId === wait.objectiveId;
|
|
536
|
+
if (!sameVersion && !sameExecution || this.pendingConnectionStops.has(runtime.activeRunId)) return;
|
|
537
|
+
const runId = runtime.activeRunId;
|
|
538
|
+
this.pendingConnectionStops.add(runId);
|
|
539
|
+
this.deps.emit("session.input-interrupt", {
|
|
540
|
+
conversationId: input.conversationId,
|
|
541
|
+
runId,
|
|
542
|
+
inputId: input.id
|
|
543
|
+
});
|
|
544
|
+
this.deps.interrupt(input.conversationId, runId, "connection_cancel").catch((err) => {
|
|
545
|
+
log.warn({
|
|
546
|
+
err,
|
|
547
|
+
conversationId: input.conversationId,
|
|
548
|
+
runId
|
|
549
|
+
}, "Connection cancellation saved; execution stop was not confirmed");
|
|
550
|
+
}).finally(() => {
|
|
551
|
+
this.pendingConnectionStops.delete(runId);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
completeConnectionCancellation(input) {
|
|
555
|
+
const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
556
|
+
if (wait?.objectiveRevision !== input.payload?.objectiveRevision || wait?.resolution !== "cancelled") return;
|
|
557
|
+
try {
|
|
558
|
+
this.deps.cancelConnection?.(wait);
|
|
559
|
+
} catch (err) {
|
|
560
|
+
log.warn({
|
|
561
|
+
err,
|
|
562
|
+
conversationId: input.conversationId,
|
|
563
|
+
waitId: wait.id
|
|
564
|
+
}, "Connection cancellation saved; domain cleanup will retry with its control");
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
async executeConnectionControl(input) {
|
|
568
|
+
const target = input.payload;
|
|
569
|
+
if (!target?.connectionAction) throw new Error("Connection control is required");
|
|
570
|
+
let wait = getConnectionWait(target.waitId);
|
|
571
|
+
if (target.connectionAction === "cancel" && wait?.objectiveRevision === target.objectiveRevision) this.deps.cancelConnection?.(wait);
|
|
572
|
+
if (target.connectionAction === "continue" && wait?.objectiveRevision === target.objectiveRevision) try {
|
|
573
|
+
await this.deps.continueConnection?.(wait, `connection-control:${input.id}`);
|
|
574
|
+
} catch (err) {
|
|
575
|
+
log.warn({
|
|
576
|
+
err,
|
|
577
|
+
conversationId: input.conversationId,
|
|
578
|
+
waitId: target.waitId
|
|
579
|
+
}, "Connection control preserved for current status feedback");
|
|
580
|
+
}
|
|
581
|
+
wait = getConnectionWait(target.waitId);
|
|
582
|
+
const zh = /[\u3400-\u9fff]/u.test(input.content);
|
|
583
|
+
const summary = !wait || wait.objectiveRevision !== target.objectiveRevision ? zh ? "原目标已发生变化,请查看当前目标状态。" : "The original objective changed. Check the current objective status." : target.connectionAction === "cancel" ? zh ? "已取消原目标。" : "The original objective was cancelled." : interruptedConnectionMessage(wait) ? zh ? "原目标已保留。请重新发送重启时中断的补充要求,或移除中断的消息后继续。" : "The original objective is saved. Resend the interrupted message or remove it before continuing." : wait.resolution === "cancelled" ? zh ? "原目标已取消。" : "The original objective was cancelled." : wait.status === "closed" ? zh ? "原目标已交给执行流程,无需重复继续。" : "The original objective has already been handed to execution. No additional continuation is needed." : wait.status === "queued" ? zh ? "原目标已准备好,正在等待执行,无需重复继续。" : "The original objective is queued. No additional continuation is needed." : wait.intent ? zh ? "原目标已保留,完成连接和能力检查后会自动继续。" : "The original objective is saved and will continue automatically after connection and capability checks." : zh ? "原目标已保留,请查看连接操作区完成所需操作。" : "The original objective is saved. Complete the required action in the connection panel.";
|
|
584
|
+
const persisted = runSqliteWriteTransaction(() => {
|
|
585
|
+
const runtime = this.snapshot(input.conversationId);
|
|
586
|
+
if (runtime.activeInputId !== input.id || runtime.activeRunId !== input.runId || readCurrentTranscriptId(getSqliteDatabase(), input.conversationId) !== input.expectedTranscriptId) return false;
|
|
587
|
+
appendTranscriptEntry(input.conversationId, {
|
|
588
|
+
role: "user",
|
|
589
|
+
content: input.content,
|
|
590
|
+
timestamp: input.createdAtMs
|
|
591
|
+
});
|
|
592
|
+
appendTranscriptEntry(input.conversationId, {
|
|
593
|
+
role: "custom",
|
|
594
|
+
customType: "connection_control_status",
|
|
595
|
+
content: summary,
|
|
596
|
+
details: {
|
|
597
|
+
inputId: input.id,
|
|
598
|
+
waitId: target.waitId,
|
|
599
|
+
objectiveRevision: target.objectiveRevision
|
|
600
|
+
},
|
|
601
|
+
display: true,
|
|
602
|
+
timestamp: Date.now()
|
|
603
|
+
});
|
|
604
|
+
finishSessionInputRun(input.conversationId, input.runId, "completed");
|
|
605
|
+
return true;
|
|
606
|
+
});
|
|
607
|
+
if (persisted) emitSessionTranscriptUpdate({ conversationId: input.conversationId });
|
|
608
|
+
return {
|
|
609
|
+
status: persisted ? "ok" : "aborted",
|
|
610
|
+
summary: persisted ? summary : ""
|
|
611
|
+
};
|
|
612
|
+
}
|
|
431
613
|
async update(conversationId, id, body) {
|
|
432
614
|
const attachments = body.attachments === void 0 ? void 0 : await this.deps.prepareAttachments(conversationId, body.attachments);
|
|
433
615
|
let sourceContexts;
|
|
@@ -464,6 +646,10 @@ var SessionInputCoordinator = class {
|
|
|
464
646
|
}
|
|
465
647
|
remove(conversationId, id, version) {
|
|
466
648
|
const ok = cancelQueuedSessionInput(conversationId, id, version);
|
|
649
|
+
if (ok) {
|
|
650
|
+
publishConnectionWait(conversationId);
|
|
651
|
+
this.drain(conversationId);
|
|
652
|
+
}
|
|
467
653
|
return {
|
|
468
654
|
ok,
|
|
469
655
|
state: ok ? this.publish(conversationId) : this.snapshot(conversationId)
|
|
@@ -480,6 +666,7 @@ var SessionInputCoordinator = class {
|
|
|
480
666
|
}
|
|
481
667
|
recover() {
|
|
482
668
|
const interrupted = recoverSessionInputState();
|
|
669
|
+
new TaskRunRepository().reconcileCancelledRuns();
|
|
483
670
|
for (const conversationId of new Set([...interrupted, ...reconcileConnectionWaits(true)])) {
|
|
484
671
|
this.publish(conversationId);
|
|
485
672
|
this.drain(conversationId);
|
|
@@ -155,6 +155,7 @@ export declare class GatewayService {
|
|
|
155
155
|
}>;
|
|
156
156
|
withSessionInputSubmission<T>(conversationId: string, operation: () => Promise<T>): Promise<T>;
|
|
157
157
|
prepareSessionCommandInput(input: Parameters<GatewayAgentRunner['inputs']['prepareInput']>[0]): Promise<{
|
|
158
|
+
payload?: import("../storage/sqlite/session-input-repository.js").SessionInputPayload;
|
|
158
159
|
status: "queued";
|
|
159
160
|
requestedDelivery: import("../storage/sqlite/session-input-repository.js").SessionInputDelivery;
|
|
160
161
|
effectiveDelivery: "next";
|
|
@@ -20,13 +20,13 @@ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js
|
|
|
20
20
|
import { init_session_repository, listSessionMetadata, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
21
21
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
22
22
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
23
|
-
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
24
|
-
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
25
23
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
26
24
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
27
25
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
28
26
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
29
27
|
import "../knowledge-memory/index.js";
|
|
28
|
+
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
29
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
30
30
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
31
31
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
32
32
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
@@ -38,12 +38,15 @@ import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvent
|
|
|
38
38
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
39
39
|
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
40
40
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
41
|
+
import { TaskAllocationRepository } from "../tasks/task-allocation-repository.js";
|
|
42
|
+
import { stopPersonalResultPreparations } from "../personal-agent/result-reader.js";
|
|
41
43
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
42
44
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
43
45
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
44
46
|
import { ProjectService } from "../projects/project-service.js";
|
|
45
47
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
46
48
|
import "../projects/index.js";
|
|
49
|
+
import { onTaskResultQueued } from "../tasks/task-result-delivery-repository.js";
|
|
47
50
|
import { runMemoryMaintenance } from "../memory-maintenance/service.js";
|
|
48
51
|
import "../memory-maintenance/index.js";
|
|
49
52
|
import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
|
|
@@ -52,14 +55,19 @@ import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
|
52
55
|
import { NotesStore } from "../notes/store.js";
|
|
53
56
|
import { NotesService } from "../notes/service.js";
|
|
54
57
|
import { LocalAppService } from "../local-apps/service.js";
|
|
55
|
-
import {
|
|
58
|
+
import { buildResultAgentContext } from "../agent/source-context/result-context.js";
|
|
59
|
+
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
60
|
+
import { buildUserAssertionAgentContext } from "../agent/source-context/user-assertion-context.js";
|
|
61
|
+
import { assertTaskHandoffAccess, getTaskHandoff } from "../tasks/task-handoff.js";
|
|
56
62
|
import { TaskApplicationService } from "../tasks/task-application-service.js";
|
|
57
63
|
import { AutomationService } from "../automations/service/automation-service.js";
|
|
58
64
|
import { TaskSignalService } from "../tasks/task-signal-service.js";
|
|
59
65
|
import { createProductDispatcher } from "../capabilities/runtime/product.js";
|
|
60
66
|
import "../automations/index.js";
|
|
67
|
+
import { assertTaskExecutorReady } from "../tasks/task-execution-capabilities.js";
|
|
61
68
|
import { TaskRunDispatcher } from "../tasks/task-run-dispatcher.js";
|
|
62
69
|
import "../tasks/index.js";
|
|
70
|
+
import { drainPersonalResultReads } from "../personal-agent/result-read-continuations.js";
|
|
63
71
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
64
72
|
import { SessionIndex } from "../session/manager.js";
|
|
65
73
|
import "../session/index.js";
|
|
@@ -79,12 +87,6 @@ import { ChannelManager } from "../channels/manager.js";
|
|
|
79
87
|
import { ChatPreviewService } from "../chat-previews/service.js";
|
|
80
88
|
import "../chat-previews/index.js";
|
|
81
89
|
import "../config/index.js";
|
|
82
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
83
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
84
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
85
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
86
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
87
|
-
import "../discussions/index.js";
|
|
88
90
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
89
91
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
90
92
|
import "../knowledge/index.js";
|
|
@@ -92,12 +94,14 @@ import { PersonalReplyComposer } from "../personal-agent/reply-composer.js";
|
|
|
92
94
|
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
93
95
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
94
96
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
97
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
98
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
99
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
100
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
101
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
102
|
+
import "../discussions/index.js";
|
|
95
103
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
96
104
|
import "../endpoint-tools/index.js";
|
|
97
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
98
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
99
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
100
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
101
105
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
102
106
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
103
107
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
@@ -106,11 +110,9 @@ import { reconcileHomeIntelligenceAutomation } from "./home-intelligence-automat
|
|
|
106
110
|
import { PersonalProactivityService } from "../personal-agent/proactivity/service.js";
|
|
107
111
|
import { reconcilePersonalProactivityAutomation } from "../personal-agent/proactivity/automation.js";
|
|
108
112
|
import { createBackgroundTask } from "../infra/background-task.js";
|
|
109
|
-
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
110
113
|
import { buildFileAgentContext } from "../agent/source-context/file-context.js";
|
|
111
114
|
import { buildSessionAgentContext } from "../agent/source-context/session-context.js";
|
|
112
115
|
import { buildBrowserTabAgentContext } from "../agent/source-context/browser-tab.js";
|
|
113
|
-
import { buildUserAssertionAgentContext } from "../agent/source-context/user-assertion-context.js";
|
|
114
116
|
import { WorkDiscoveryService } from "../work-discovery/service.js";
|
|
115
117
|
import { buildVoiceMemoryContext } from "../voice/realtime/memory-context.js";
|
|
116
118
|
import { buildVoicePersonaContext } from "../voice/realtime/persona-context.js";
|
|
@@ -160,6 +162,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
|
|
|
160
162
|
import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
|
|
161
163
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
162
164
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
165
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
166
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
167
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
168
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
163
169
|
import crypto from "node:crypto";
|
|
164
170
|
//#region src/gateway/service.ts
|
|
165
171
|
init_session_repository();
|
|
@@ -515,6 +521,8 @@ var GatewayService = class {
|
|
|
515
521
|
});
|
|
516
522
|
this.chatPreviews = new ChatPreviewService({ localApps: this.localApps });
|
|
517
523
|
this.agentRunner = new GatewayAgentRunner({
|
|
524
|
+
continueConnection: (wait, idempotencyKey) => this.connectionRecovery.continueObjective(wait, idempotencyKey),
|
|
525
|
+
cancelConnection: (wait) => this.connectionRecovery.cancelObjective(wait),
|
|
518
526
|
validateConnectionResume: async (input) => {
|
|
519
527
|
for (const source of input.contextSnapshots ?? []) if (source.kind === "app_context") await checkAppContextAccess(source, this.appContextDispatcher(), this.auth);
|
|
520
528
|
return this.connectionRecovery.preflight(input);
|
|
@@ -525,6 +533,7 @@ var GatewayService = class {
|
|
|
525
533
|
getChannelManager: () => this.channelManager,
|
|
526
534
|
getConfig: () => this.config,
|
|
527
535
|
resolveTurnContext: async (ref, conversationId) => {
|
|
536
|
+
if (ref.kind === "result") return buildResultAgentContext(conversationId, ref.sourceId, ref.expectedVersion);
|
|
528
537
|
if (ref.kind === "task") return buildTaskAgentContext(new TaskRepository().get(ref.sourceId), ref.expectedVersion);
|
|
529
538
|
if (ref.kind === "user_assertion") {
|
|
530
539
|
const metadata = await this.sessionIndex.getSessionMetadata(conversationId);
|
|
@@ -773,6 +782,18 @@ var GatewayService = class {
|
|
|
773
782
|
requestedAgentId
|
|
774
783
|
})).conversationId;
|
|
775
784
|
},
|
|
785
|
+
validateExecutor: (taskId, agentId) => {
|
|
786
|
+
const allocation = new TaskAllocationRepository().get(taskId);
|
|
787
|
+
if (!allocation || !agentId) return;
|
|
788
|
+
const handoff = getTaskHandoff(taskId);
|
|
789
|
+
if (handoff) assertTaskHandoffAccess(handoff);
|
|
790
|
+
assertTaskExecutorReady(taskId, allocation.origin_conversation_id, agentId, {
|
|
791
|
+
ownAgentId: getSessionMetadata(allocation.origin_conversation_id)?.agentId ?? "",
|
|
792
|
+
getConfig: () => this.config,
|
|
793
|
+
getAgentSkillAvailability: (id) => this.agentService.getAgentSkillAvailability(id),
|
|
794
|
+
getAgentToolAvailability: (id, tool) => this.agentService.getAgentToolAvailability(id, tool)
|
|
795
|
+
});
|
|
796
|
+
},
|
|
776
797
|
runAgent: async (runId, conversationId, message) => {
|
|
777
798
|
for (const adapter of this.sceneHost?.http.activationAdapters.list() ?? []) if (adapter.executeTask && await adapter.executeTask(runId, conversationId)) {
|
|
778
799
|
this.ensureAgentService();
|
|
@@ -912,6 +933,17 @@ var GatewayService = class {
|
|
|
912
933
|
if (reply) this.emit("personal.reply.delivered", reply);
|
|
913
934
|
};
|
|
914
935
|
await new TaskResultDeliveryService().drain(notify);
|
|
936
|
+
await drainPersonalResultReads({
|
|
937
|
+
isAvailable: (conversationId) => !this.stopping && !this.agentRunner.hasActiveRun(conversationId) && !this.agentRunner.inputs.isAcceptingInput(conversationId) && !this.voiceRealtime.hasConversation(conversationId),
|
|
938
|
+
submit: async (input) => (await this.agentRunner.submitSessionInput({
|
|
939
|
+
...input,
|
|
940
|
+
delivery: "next",
|
|
941
|
+
origin: {
|
|
942
|
+
type: "system",
|
|
943
|
+
source: "task_update"
|
|
944
|
+
}
|
|
945
|
+
})).ok
|
|
946
|
+
});
|
|
915
947
|
new PersonalReplyComposer().drain(async (conversationId, deliveryId) => {
|
|
916
948
|
const reply = personalReplyNotification(conversationId, deliveryId);
|
|
917
949
|
notify(conversationId, deliveryId);
|
|
@@ -975,7 +1007,7 @@ var GatewayService = class {
|
|
|
975
1007
|
conversation
|
|
976
1008
|
};
|
|
977
1009
|
}
|
|
978
|
-
const peerId = `task-${sanitizeSegment(task.id) || Date.now()}`;
|
|
1010
|
+
const peerId = `task-${sanitizeSegment(task.id) || Date.now()}${options.runId ? `-${sanitizeSegment(options.runId)}` : ""}`;
|
|
979
1011
|
const conversationId = resolveConversationId({
|
|
980
1012
|
agentId,
|
|
981
1013
|
source: "webchat",
|
|
@@ -1575,6 +1607,7 @@ var GatewayService = class {
|
|
|
1575
1607
|
this.taskRunDispatchTimer = null;
|
|
1576
1608
|
}
|
|
1577
1609
|
await this.sessionPreparations.stop();
|
|
1610
|
+
await stopPersonalResultPreparations();
|
|
1578
1611
|
setPairingBroadcastSink(null);
|
|
1579
1612
|
this.stopRealtimeLogBridge?.();
|
|
1580
1613
|
this.stopRealtimeLogBridge = null;
|
|
@@ -11,8 +11,8 @@ import { effectiveWorkspacePathForSession } from "../session/session-workspace.j
|
|
|
11
11
|
import { ProjectStore } from "../projects/project-store.js";
|
|
12
12
|
import { TaskOriginRepository } from "../tasks/task-origin-repository.js";
|
|
13
13
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
14
|
-
import { runExec } from "../infra/exec.js";
|
|
15
14
|
import { TaskCollaborationRepository } from "../tasks/task-collaboration-repository.js";
|
|
15
|
+
import { runExec } from "../infra/exec.js";
|
|
16
16
|
import { isSessionSourceBinding } from "../agent/source-context/types.js";
|
|
17
17
|
import { realpath, stat } from "node:fs/promises";
|
|
18
18
|
//#region src/gateway/session-context-summary.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
2
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
3
2
|
import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
|
|
4
3
|
import { getAvailableModels, init_providers } from "../providers/index.js";
|
|
5
4
|
import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
|
|
5
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
6
6
|
import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
|
|
7
7
|
//#region src/gateway/xopc-cloud-capability-setup.ts
|
|
8
8
|
init_repository();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
3
4
|
import { homePatternKey } from "./strategy.js";
|
|
5
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
4
6
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
5
7
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
|
-
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
8
8
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
//#region src/home-intelligence/host.ts
|
|
@@ -5,10 +5,10 @@ import { currentOperationId, init_operation_context } from "../infra/operation-c
|
|
|
5
5
|
import { afterSqliteCommit, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
6
6
|
import { ExtensionCapabilityBindingsSchema, extensionCapabilityPermissions } from "../../packages/gateway-contract/src/extension-capabilities.js";
|
|
7
7
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
8
|
-
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
9
8
|
import { init_paths, resolveExtensionsDir } from "../config/paths.js";
|
|
10
9
|
import { slugifyProjectName } from "../projects/project-store.js";
|
|
11
10
|
import { LocalAppStore } from "./store.js";
|
|
11
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
12
12
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
13
13
|
import { validateLocalAppCapabilityContracts } from "./capabilities/contracts.js";
|
|
14
14
|
import { buildLocalAppFixGuidance } from "./fix-guidance.js";
|
|
@@ -66,7 +66,7 @@ function isMediaUriReferencedByLiveSession(uri) {
|
|
|
66
66
|
UNION ALL
|
|
67
67
|
SELECT 1 AS referenced FROM task_result_deliveries d
|
|
68
68
|
JOIN sessions s ON s.conversation_id = d.conversation_id
|
|
69
|
-
WHERE d.status IN ('pending', 'delivered') AND d.payload_json LIKE ? ESCAPE '\\'
|
|
69
|
+
WHERE d.status IN ('pending', 'delivered', 'stale') AND d.payload_json LIKE ? ESCAPE '\\'
|
|
70
70
|
LIMIT 1`).get(`%${escaped}%`, `%${escaped}%`)?.referenced === 1;
|
|
71
71
|
}
|
|
72
72
|
async function deleteMediaUris(uris) {
|
|
@@ -18,6 +18,7 @@ const PERSONAL_COMMUNICATION_RULES = [
|
|
|
18
18
|
];
|
|
19
19
|
const PERSONAL_WORKER_RESULT_GUIDANCE = [
|
|
20
20
|
"## Result for the originating conversation",
|
|
21
|
+
"For ordinary Tasks when publish_task_result is available, use it before completion to review the actual result. Connected Requests use their own structured result tool instead. When files were published, finalArtifactIds must select the exact final artifact IDs from publication receipts, including [] for a text-only result. Exclude intermediate, obsolete and failed files; publication history is not the final delivery manifest.",
|
|
21
22
|
"Provide a complete, evidence-grounded result for the originating conversation. The personal assistant may synthesize its final reply from your report. Match the user’s language and requested depth; preserve requested content, relevant sources, verified data cutoffs, uncertainty, and partial failures. Distinguish reported findings from verified facts. Do not invent a friendly opening or assume a new user request.",
|
|
22
23
|
"Keep internal planning, Agent names, tool logs, and task progress links out of the result unless the user specifically requested them or they are necessary to explain a blocker. Never substitute a progress page, a plan, or a promise for the requested result. Publish required files through the available artifact tools; do not repeat the same attachments or send the user to a Task page to collect them."
|
|
23
24
|
].join("\n");
|