@xopcai/xopc 0.0.384 → 0.0.386
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BSel9yf8.js → agent-avatar-dicebear-D-86VOlb.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DgHMyhuY.js → agent-defaults-settings-panel-SmeUVHY8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BosuN4dO.js → agent-plugin-dialog-BVT3wXq5.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-B-pw5RKI.js → agents-D7rLQFhX.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DuOqKkfH.js → app-management-settings-panel-CUR7n5iP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-8JF9rXFr.js → appearance-settings-BCotSGep.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cuclpk0A.js → apps-page-hk0bo9LT.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D7NwNy2I.js → automations-page-CqxuUwox.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CSxW4wX0.js → automations-workspace-11_Z69pr.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dnb7CH_l.js → block-editor-eldB84Mj.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-GBgDe21o.js → browser-automations-page-D4TaUPYT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-B2FXaO3n.js → browser-settings-page-BXRlxeGV.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-XFwwUNU3.js → capabilities-BkKgImWi.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-2Do3eKMM.js → capabilities-DVj9n65C.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-f2-MquJn.js → capabilities-page-CyYlueEd.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-D9F0mw16.js → capabilities-settings-panel-uVEgfvo0.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-DVRxJPQP.js → capability-header-actions-BXv0xu56.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CnDm5T1t.js → channels-fNb3SOzm.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BxSCDbK7.js → chat-terminal-dock-CnLtparQ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DVAB-kQw.js → computer-settings-page-xM0AnOlP.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-D2EeLXei.js → connector-service-page-CdG2WUb6.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DK9n4hgZ.js → connectors-page-BRd08GH6.js} +1 -1
- package/dist/gateway/static/root/assets/constants-CpWu0oHS.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-Cl9KfFj8.js → date-picker-DIBbE-O8.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Ei6aX5WM.js → dependency-picker-DDD8zokD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-4Evl4RKX.js → desktop-pet-KlF390Xn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DAD_OWcX.js → desktop-pet-settings-CgqQMKDC.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BA21epMn.js → device-pairing-wizard-BR6isfG2.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B_Zb5nNR.js → directory-picker-path-field-vPQsW05P.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DtHNy4TE.js → extension-debug-page-ZHLPrLbH.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-8gWSThWP.js → extension-page-DJ42KFRN.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-nbgU7xBS.js → extension-provider-6IcsyNaV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CunUbB09.js → extension-settings-page-D7-5v0V4.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BSAfzXby.js → fallback-models-DnYn7qOV.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CN-2229W.js → gateway-settings-Bwe3JWX-.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DktBCtHF.js → highlighted-body-KQOG7T2V-DefTxF3q.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CUJcNW3H.js → home-page-BtSy2hRV.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DQm1MNNC.js → imports-page-CTdBYZib.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BPNL54bv.js → index-B08iR7fT.js} +10 -10
- package/dist/gateway/static/root/assets/index-DBRwvWzm.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DaC5YjuJ.js → keyboard-shortcuts-settings-CXKp57O_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DwQyyo7a.js → local-app-workbench-page-DzD_OzGY.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CpZhivpf.js → local-apps-page-B0E0vttg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Db43nh1M.js → logs-page-eL4fYcMl.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DrKejBEZ.js → management-settings-DSpjodMC.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BTrk2wWv.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-a8NSwmmW.js → note-detail-panel-CsY5tQp5.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-BKRke43F.js → notes-page-D09LjNoj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-DUaMkmxv.js → page-context-capture-button-DO-aP3D9.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BqF-HHw1.js → personal-page-E8F2aGNB.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-GrhtTQIz.js → product-open-page-aUoA-uPw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-zdP7gN0y.js → product-preview-content-B-cz-pIV.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-9Vd_AqDW.js → project-detail-page-WhefAh8E.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DGunhjoM.js → projects-page-CyqAs0tO.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BoRsF3Lx.js → remote-access-hub-BwhRGL6m.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-W0HDm--J.js → runtime-tools-settings-panel-o26dmPNq.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CYsFOfVJ.js → scenes-page-D_e19kv_.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CBxEbBQq.js → schema-form-DLLdqUC3.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-BCAF-Ikt.js → send-session-input-2I-nFJcE.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-Co5ozD0l.js +16 -0
- package/dist/gateway/static/root/assets/{sessions-page-Dthfx_vc.js → sessions-page-DX6INsiS.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C4_gW1vw.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CFs-WP_2.js → settings-page-Bc_zxxRu.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-D2-9fXYL.js → setup-status-panel-FpF_cPPr.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-nJ2FWAEP.js → share-preview-page-BOCcPBqQ.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DTb88RHD.js → shares-settings-CInxjxgJ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DJ8UBsxq.js → skill-api-Bjd8WAA4.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DjbBOikT.js → skills-page-8CKS3Oo2.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Dt5GkLhM.js → system-settings-panel-BgQdsrNw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BnG5ehZ6.js +2 -0
- package/dist/gateway/static/root/assets/task-expandable-content-BCuc70Vc.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-JHttXi63.js → tunnel-api-CY7MoDGf.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-B3rUa0fW.js → usage-page-s8Sv_PIG.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-BFP3k6oC.js → use-composer-attachments-D0S2iZF4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-B1BiTQNS.js → use-file-preview-expanded-BElqELib.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Cq1VSsZw.js → user-model-page-CyWrEtHY.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BAtG_JHv.js → work-discovery-overlay-DmZXLs1v.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cw12NFgx.js → workflow-run-setup-panel-BdLOzHm4.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-kR5ouOuM.js → workflows-page-Cx3I3AV5.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Xr3wz8T3.js → workspace-api-Du7-xJ0q.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BTBVKpSg.js → xopc-cloud-account-card-D8B136vW.js} +1 -1
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/task-research-result.js +89 -0
- package/dist/packages/gateway-contract/src/tasks.js +7 -1
- package/dist/packages/gateway-contract/src/turn-outcome.js +3 -0
- package/dist/src/agent/child-agent-factory.d.ts +4 -1
- package/dist/src/agent/child-agent-factory.js +91 -11
- 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/execution-tool-policy.d.ts +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.js +3 -2
- package/dist/src/agent/embedded/run-for-session.js +37 -14
- package/dist/src/agent/embedded/run-turn.js +123 -26
- 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 +14 -3
- package/dist/src/agent/embedded/types.d.ts +6 -1
- package/dist/src/agent/external-tools/cliProvider.d.ts +1 -0
- package/dist/src/agent/external-tools/cliProvider.js +1 -0
- package/dist/src/agent/external-tools/composio-provider.js +2 -0
- package/dist/src/agent/external-tools/gateway-tools.js +15 -5
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +3 -1
- package/dist/src/agent/external-tools/types.d.ts +4 -0
- package/dist/src/agent/orchestration/agent-run-supervisor.js +2 -1
- package/dist/src/agent/orchestration/agent-turn-policy.d.ts +1 -0
- 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 +19 -10
- package/dist/src/agent/orchestration/llm-turn-retry.d.ts +5 -0
- package/dist/src/agent/orchestration/llm-turn-retry.js +15 -5
- 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 +9 -0
- package/dist/src/agent/orchestration/turn-recovery.js +45 -0
- 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.js +6 -5
- package/dist/src/agent/service/process-direct-streaming.js +7 -1
- package/dist/src/agent/tasks/task-judge-service.js +30 -10
- 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/factory.js +12 -1
- package/dist/src/agent/tools/index.d.ts +2 -0
- package/dist/src/agent/tools/index.js +3 -1
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-request-result-tool.js +20 -3
- package/dist/src/agent/tools/personal-request-tool.js +165 -23
- package/dist/src/agent/tools/personal-task-tool.d.ts +6 -3
- package/dist/src/agent/tools/personal-task-tool.js +146 -23
- 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 +1 -1
- 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/task-collaboration-tool.d.ts +16 -0
- package/dist/src/agent/tools/task-collaboration-tool.js +153 -0
- package/dist/src/agent/tools/task-result-tool.d.ts +2 -0
- package/dist/src/agent/tools/task-result-tool.js +73 -0
- 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 +3 -3
- 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/browser/automations/schema.d.ts +2 -2
- package/dist/src/browser/automations/service.d.ts +2 -2
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -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/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +1 -0
- package/dist/src/config/schema.js +4 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +9 -1
- package/dist/src/connectors/connection-recovery-service.js +213 -33
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -1
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +16 -0
- package/dist/src/gateway/hono/routes/tasks.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 +21 -6
- package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
- package/dist/src/gateway/service/session-input-coordinator.js +216 -27
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +6 -4
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/personal-agent/prompts.js +10 -3
- package/dist/src/personal-agent/reply-composer.d.ts +1 -0
- package/dist/src/personal-agent/reply-composer.js +91 -19
- 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-access.d.ts +3 -0
- package/dist/src/personal-agent/request-access.js +31 -0
- package/dist/src/personal-agent/request-delivery.js +9 -4
- package/dist/src/personal-agent/request-repository.d.ts +3 -0
- package/dist/src/personal-agent/request-service.d.ts +6 -0
- package/dist/src/personal-agent/request-service.js +121 -25
- 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/task-cancel.js +85 -35
- package/dist/src/providers/model-response.js +13 -2
- package/dist/src/scenes/taskFollowUp/service.d.ts +15 -5
- package/dist/src/session/session-context-for-llm.js +2 -2
- package/dist/src/session/store.d.ts +3 -1
- package/dist/src/session/store.js +30 -7
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +7 -2
- package/dist/src/storage/sqlite/connection-wait-repository.js +124 -20
- 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/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/storage/sqlite/transcript-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/transcript-repository.js +25 -1
- package/dist/src/tasks/capabilities/management.d.ts +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/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.d.ts +2 -0
- package/dist/src/tasks/task-allocation-service.js +43 -2
- package/dist/src/tasks/task-application-service.js +3 -3
- package/dist/src/tasks/task-collaboration-delivery.js +4 -1
- package/dist/src/tasks/task-collaboration-repository.d.ts +3 -0
- package/dist/src/tasks/task-collaboration-repository.js +11 -1
- package/dist/src/tasks/task-context-assembler.js +19 -6
- package/dist/src/tasks/task-continuation.d.ts +6 -0
- package/dist/src/tasks/task-continuation.js +33 -0
- package/dist/src/tasks/task-contract-planner.d.ts +1 -0
- package/dist/src/tasks/task-contract-planner.js +22 -15
- package/dist/src/tasks/task-main-update-delivery.js +13 -8
- 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.js +1 -1
- package/dist/src/tasks/task-research-repair.d.ts +19 -0
- package/dist/src/tasks/task-research-repair.js +75 -0
- package/dist/src/tasks/task-research-result.d.ts +85 -0
- package/dist/src/tasks/task-research-result.js +394 -0
- package/dist/src/tasks/task-result-delivery-repository.js +13 -2
- package/dist/src/tasks/task-result-delivery-service.js +1 -1
- package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
- package/dist/src/tasks/task-run-coordinator.js +80 -11
- package/dist/src/tasks/task-run-dispatcher.js +12 -0
- package/dist/src/tasks/task-run-repository.d.ts +13 -0
- package/dist/src/tasks/task-run-repository.js +120 -2
- package/package.json +7 -3
- package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
- package/dist/gateway/static/root/assets/index-yseLAt9D.css +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C4VzqE9z.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-_yy4bxhT.js +0 -16
- package/dist/gateway/static/root/assets/settings-advanced-gate-O_0Lk38S.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-88EShcbs.js +0 -2
- package/dist/gateway/static/root/assets/task-expandable-content-CF6Bj-Qa.js +0 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { init_research_checkpoint, researchResumeContext } from "../orchestration/research-checkpoint.js";
|
|
2
|
+
import { claimResearchCheckpoint, createResearchCheckpoint, finishResearchCheckpoint, getResearchCheckpoint, init_research_checkpoint_repository, recordResearchEvidence, recordResearchSearch, saveResearchCheckpoint } from "../../storage/sqlite/research-checkpoint-repository.js";
|
|
3
|
+
import { resolveAgentAbortReason } from "../orchestration/run-termination.js";
|
|
1
4
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
2
5
|
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
3
6
|
import "../external-tools/index.js";
|
|
@@ -8,8 +11,11 @@ import { runGit } from "../../execution-environments/git.js";
|
|
|
8
11
|
import { LocalWorktreeManager } from "../../execution-environments/local-worktree-manager.js";
|
|
9
12
|
import { SessionEnvironmentService } from "../../execution-environments/session-environment-service.js";
|
|
10
13
|
import { DELEGATION_CAPABILITIES, DELEGATION_TOOL_CAPABILITIES, protectDelegatedTool, resolveDelegationTools } from "./delegation-policy.js";
|
|
14
|
+
import { resolve } from "node:path";
|
|
11
15
|
import { Type } from "@sinclair/typebox";
|
|
12
16
|
//#region src/agent/tools/delegate-tool.ts
|
|
17
|
+
init_research_checkpoint();
|
|
18
|
+
init_research_checkpoint_repository();
|
|
13
19
|
const DEFAULT_DELEGATE_TOOLS = resolveDelegationTools(Object.keys(DELEGATION_TOOL_CAPABILITIES), "research").granted;
|
|
14
20
|
/** Tools never passed to a delegated sub-agent (even if requested). */
|
|
15
21
|
const DELEGATE_BLOCKED_TOOLS = new Set([
|
|
@@ -25,10 +31,23 @@ const DELEGATE_BLOCKED_TOOLS = new Set([
|
|
|
25
31
|
"skill_install",
|
|
26
32
|
EXTERNAL_TOOL_NAMES.requireConnection,
|
|
27
33
|
EXTERNAL_TOOL_NAMES.updateConnectionObjective,
|
|
28
|
-
"managed_job"
|
|
34
|
+
"managed_job",
|
|
35
|
+
"research_checkpoint"
|
|
29
36
|
]);
|
|
30
37
|
const DelegateTaskSchema = Type.Object({
|
|
31
|
-
goal: Type.String({
|
|
38
|
+
goal: Type.String({
|
|
39
|
+
minLength: 1,
|
|
40
|
+
maxLength: 8e3
|
|
41
|
+
}),
|
|
42
|
+
resumeId: Type.Optional(Type.String({
|
|
43
|
+
format: "uuid",
|
|
44
|
+
description: "Resume a saved research checkpoint owned by this conversation and workspace; preserve the original goal."
|
|
45
|
+
})),
|
|
46
|
+
maxAttempts: Type.Optional(Type.Integer({
|
|
47
|
+
minimum: 1,
|
|
48
|
+
maximum: 3,
|
|
49
|
+
description: "Research attempts in this call, including bounded automatic continuation after budget exhaustion. Default 2; cancellation, permissions and provider failures are not automatically retried."
|
|
50
|
+
})),
|
|
32
51
|
context: Type.Optional(Type.String()),
|
|
33
52
|
mode: Type.Optional(Type.Union([
|
|
34
53
|
"inspect",
|
|
@@ -54,16 +73,48 @@ function createDelegateTool(deps) {
|
|
|
54
73
|
name: "delegate_task",
|
|
55
74
|
label: "Delegate task",
|
|
56
75
|
parameters: DelegateTaskSchema,
|
|
57
|
-
description: "Delegate a bounded task with a fresh context; supply relevant facts and constraints in context. Default research inherits the parent's local, web, knowledge, skill and approved external read tools. read/inspect/review are local read-only. toolset and capabilities only narrow parent access; custom requires explicit capabilities. Browser interaction is opt-in. implement requires a project and clean Git workspace and returns changes in a separate worktree for review. No nested delegation, external writes, installation or background jobs. budgetTier selects light, standard (default), or deep; token budgets sum all model requests, not context size. Reports stop reason, budget usage, partial handoff and rejected tools.",
|
|
76
|
+
description: "Delegate a bounded task with a fresh context; supply relevant facts and constraints in context. Default research inherits the parent's local, web, knowledge, skill and approved external read tools. read/inspect/review are local read-only. toolset and capabilities only narrow parent access; custom requires explicit capabilities. Browser interaction is opt-in. implement requires a project and clean Git workspace and returns changes in a separate worktree for review. No nested delegation, external writes, installation or background jobs. budgetTier selects light, standard (default), or deep; token budgets sum all model requests, not context size. Research saves structured findings and source evidence durably for the current conversation. Use resumeId to continue unfinished work; maxAttempts bounds automatic budget continuation (default 2). Reports stop reason, budget usage, partial handoff and rejected tools.",
|
|
58
77
|
supportsParallel: false,
|
|
59
78
|
idempotent: false,
|
|
79
|
+
timeoutMs: DELEGATION_BUDGETS.deep.timeoutMs * 3 + 3e4,
|
|
60
80
|
async execute(_id, input, signal) {
|
|
61
81
|
signal?.throwIfAborted();
|
|
62
82
|
const mode = input.mode ?? "research";
|
|
83
|
+
if (input.resumeId && mode !== "research") throw new Error("resumeId is only supported for research");
|
|
63
84
|
const scope = getDelegationScope();
|
|
64
85
|
const parentTools = scope?.tools ?? deps.getParentTools();
|
|
65
86
|
const access = resolveDelegationTools(parentTools.map((tool) => tool.name), mode, input.toolset, input.capabilities);
|
|
66
87
|
const tools = access.granted;
|
|
88
|
+
const parentConversationId = deps.getCurrentContext?.()?.conversationId;
|
|
89
|
+
let workspace = deps.workspace, environmentId;
|
|
90
|
+
if (mode === "implement") {
|
|
91
|
+
if (!parentConversationId) throw new Error("Implementation delegation requires a project session");
|
|
92
|
+
const parent = new SessionEnvironmentService().get(parentConversationId);
|
|
93
|
+
if (!parent?.projectId) throw new Error("Attach this session to a project before implementation delegation");
|
|
94
|
+
const environment = await new LocalWorktreeManager().provisionManagedWorktree({
|
|
95
|
+
projectId: parent.projectId,
|
|
96
|
+
repositoryPath: workspace
|
|
97
|
+
});
|
|
98
|
+
workspace = environment.rootPath;
|
|
99
|
+
environmentId = environment.id;
|
|
100
|
+
}
|
|
101
|
+
const revision = mode === "review" ? await readWorkspaceRevision(workspace) : void 0;
|
|
102
|
+
const authorizeToolCall = scope?.authorizeToolCall ?? deps.createParentPolicy?.().beforeToolCall;
|
|
103
|
+
let research = mode === "research" && parentConversationId && (tools.length > 0 || input.resumeId) ? input.resumeId ? getResearchCheckpoint(input.resumeId, parentConversationId, resolve(workspace)) : createResearchCheckpoint(parentConversationId, resolve(workspace), input.goal) : void 0;
|
|
104
|
+
if (input.resumeId && !research) throw new Error("Research checkpoint not found in this conversation and workspace");
|
|
105
|
+
if (research && research.goal !== input.goal) throw new Error("Resuming research must preserve the original goal");
|
|
106
|
+
if (research?.status === "completed") return {
|
|
107
|
+
content: [{
|
|
108
|
+
type: "text",
|
|
109
|
+
text: research.summary + "\n" + JSON.stringify(research.checkpoint)
|
|
110
|
+
}],
|
|
111
|
+
details: {
|
|
112
|
+
status: "success",
|
|
113
|
+
stopReason: "completed",
|
|
114
|
+
resumeId: research.id,
|
|
115
|
+
checkpoint: research.checkpoint
|
|
116
|
+
}
|
|
117
|
+
};
|
|
67
118
|
if (!tools.length) return {
|
|
68
119
|
content: [{
|
|
69
120
|
type: "text",
|
|
@@ -77,130 +128,174 @@ function createDelegateTool(deps) {
|
|
|
77
128
|
stopReason: "parent_policy",
|
|
78
129
|
mode,
|
|
79
130
|
grantedTools: tools,
|
|
80
|
-
rejectedTools: access.rejected
|
|
131
|
+
rejectedTools: access.rejected,
|
|
132
|
+
...research ? {
|
|
133
|
+
resumeId: research.id,
|
|
134
|
+
checkpoint: research.checkpoint
|
|
135
|
+
} : {}
|
|
81
136
|
}
|
|
82
137
|
};
|
|
83
|
-
const parentConversationId = deps.getCurrentContext?.()?.conversationId;
|
|
84
138
|
const model = deps.getSubagentModel();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
const attemptLimit = research ? Math.min(3, Math.max(1, input.maxAttempts ?? 2)) : 1;
|
|
140
|
+
let attempt = 0;
|
|
141
|
+
const attemptBudgets = [];
|
|
142
|
+
let result;
|
|
143
|
+
do {
|
|
144
|
+
signal?.throwIfAborted();
|
|
145
|
+
attempt++;
|
|
146
|
+
if (research) research = claimResearchCheckpoint(research, DELEGATION_BUDGETS[input.budgetTier ?? "standard"].timeoutMs + 1e4);
|
|
147
|
+
const claimedResearch = research;
|
|
148
|
+
const checkpointSink = claimedResearch ? {
|
|
149
|
+
read: () => getResearchCheckpoint(claimedResearch.id, claimedResearch.conversationId, claimedResearch.workspace).checkpoint,
|
|
150
|
+
save: (update) => saveResearchCheckpoint(claimedResearch, update),
|
|
151
|
+
recordEvidence: (evidence) => recordResearchEvidence(claimedResearch, evidence),
|
|
152
|
+
recordSearch: (entry) => recordResearchSearch(claimedResearch, entry)
|
|
153
|
+
} : void 0;
|
|
154
|
+
let child;
|
|
155
|
+
const abort = () => child?.abort(resolveAgentAbortReason(signal?.reason));
|
|
156
|
+
try {
|
|
157
|
+
child = createDelegateChildHandle({
|
|
158
|
+
workspace,
|
|
159
|
+
goal: mode === "review" ? `Independently review the actual changes. Inspect review_workspace and relevant source/tests. Report actionable defects with file and line evidence, severity and a concrete failure example. If there are no findings, state the checks and remaining uncertainty. Do not treat the parent's completion claim as evidence.\n\n${input.goal}` : input.goal,
|
|
160
|
+
context: [input.context, research ? researchResumeContext(research.checkpoint) : void 0].filter(Boolean).join("\n\n") || void 0,
|
|
161
|
+
researchCheckpoint: checkpointSink,
|
|
162
|
+
requesterConversationId: parentConversationId,
|
|
163
|
+
allowedToolNames: tools,
|
|
164
|
+
budgetTier: input.budgetTier,
|
|
165
|
+
maxIterations: input.maxIterations ?? DELEGATION_BUDGETS[input.budgetTier ?? "standard"].maxToolCalls,
|
|
166
|
+
model,
|
|
167
|
+
bus: deps.bus,
|
|
168
|
+
getConfig: deps.getConfig,
|
|
169
|
+
toolExecutorConfig: deps.toolExecutorConfig,
|
|
170
|
+
authorizeToolCall,
|
|
171
|
+
buildChildTools: (opts) => {
|
|
172
|
+
const local = mode === "implement" ? new Map(deps.buildChildTools(opts).map((tool) => [tool.name, tool])) : void 0;
|
|
173
|
+
const rebound = new Set([
|
|
174
|
+
"data_batch",
|
|
175
|
+
"read_file",
|
|
176
|
+
"grep",
|
|
177
|
+
"find",
|
|
178
|
+
"list_dir",
|
|
179
|
+
"review_workspace",
|
|
180
|
+
"write_file",
|
|
181
|
+
"apply_patch",
|
|
182
|
+
"exec_command",
|
|
183
|
+
"language_diagnostics"
|
|
184
|
+
]);
|
|
185
|
+
return parentTools.flatMap((tool) => {
|
|
186
|
+
const candidate = local && rebound.has(tool.name) ? local.get(tool.name) : tool;
|
|
187
|
+
return candidate ? [protectDelegatedTool(candidate)] : [];
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
verifyChanges: mode === "implement"
|
|
128
191
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"--binary",
|
|
144
|
-
"HEAD"
|
|
145
|
-
]).catch(() => "") : void 0;
|
|
146
|
-
return {
|
|
147
|
-
content: [{
|
|
148
|
-
type: "text",
|
|
149
|
-
text: [
|
|
150
|
-
result.summary,
|
|
151
|
-
`Budget (${result.budget.tier}): ${JSON.stringify({
|
|
152
|
-
stopReason: result.stopReason,
|
|
153
|
-
usage: result.budget.usage,
|
|
154
|
-
limits: result.budget.limits,
|
|
155
|
-
handoffRequested: result.handoff.requested
|
|
156
|
-
})}`,
|
|
157
|
-
stale ? "Workspace changed or could not be fingerprinted; review findings require revalidation." : "",
|
|
158
|
-
access.rejected.length ? `Rejected tools: ${JSON.stringify(access.rejected)}` : "",
|
|
159
|
-
environmentId ? `Changes retained in ${workspace} (environment ${environmentId}). Review and integrate from this workspace, then verify the parent workspace again.` : "",
|
|
160
|
-
patch ? `Patch preview:\n${patch.slice(0, 3e4)}` : ""
|
|
161
|
-
].filter(Boolean).join("\n\n")
|
|
162
|
-
}],
|
|
163
|
-
details: {
|
|
164
|
-
status: stale && result.status === "success" ? "partial" : result.status,
|
|
165
|
-
mode,
|
|
166
|
-
summary: result.summary,
|
|
167
|
-
grantedTools: tools,
|
|
168
|
-
rejectedTools: access.rejected,
|
|
169
|
-
iterations: result.toolIterations,
|
|
170
|
-
revision: currentRevision,
|
|
171
|
-
reviewedRevision: revision,
|
|
172
|
-
stopReason: result.stopReason,
|
|
173
|
-
budget: result.budget,
|
|
174
|
-
handoff: result.handoff,
|
|
175
|
-
...result.verification ? { childVerification: result.verification } : {},
|
|
176
|
-
...environmentId ? {
|
|
177
|
-
environmentId,
|
|
178
|
-
workspace,
|
|
179
|
-
patchTruncated: (patch?.length ?? 0) > 3e4
|
|
180
|
-
} : {}
|
|
192
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
193
|
+
if (signal?.aborted) abort();
|
|
194
|
+
result = await child.run();
|
|
195
|
+
attemptBudgets.push(result.budget);
|
|
196
|
+
if (research && checkpointSink) {
|
|
197
|
+
const checkpoint = checkpointSink.read();
|
|
198
|
+
if (result.status === "success" && (!checkpoint.findings.length || checkpoint.nextSteps.length || checkpoint.findings.some((finding) => finding.status === "unverified"))) result = {
|
|
199
|
+
...result,
|
|
200
|
+
status: "partial",
|
|
201
|
+
stopReason: "verification",
|
|
202
|
+
summary: result.summary + "\nResearch checkpoint still has unfinished work; do not claim completion."
|
|
203
|
+
};
|
|
204
|
+
finishResearchCheckpoint(research, result.status === "success" ? "completed" : result.status, result.stopReason, result.summary);
|
|
205
|
+
research = getResearchCheckpoint(research.id, research.conversationId, research.workspace);
|
|
181
206
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}],
|
|
189
|
-
details: {
|
|
190
|
-
status: signal?.aborted ? "cancelled" : "failed",
|
|
191
|
-
stopReason: signal?.aborted ? "cancelled" : "runtime_error",
|
|
192
|
-
mode,
|
|
193
|
-
grantedTools: tools,
|
|
194
|
-
rejectedTools: access.rejected,
|
|
195
|
-
...environmentId ? {
|
|
196
|
-
environmentId,
|
|
197
|
-
workspace
|
|
198
|
-
} : {}
|
|
207
|
+
} catch (error) {
|
|
208
|
+
const stopReason = signal?.aborted ? resolveAgentAbortReason(signal.reason) : "runtime_error";
|
|
209
|
+
const status = stopReason === "deadline_exceeded" ? "partial" : signal?.aborted ? "cancelled" : "failed";
|
|
210
|
+
if (research) {
|
|
211
|
+
if (getResearchCheckpoint(research.id, research.conversationId, research.workspace)?.leaseToken === research.leaseToken) finishResearchCheckpoint(research, status, stopReason, String(error));
|
|
212
|
+
research = getResearchCheckpoint(research.id, research.conversationId, research.workspace) ?? research;
|
|
199
213
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
return {
|
|
215
|
+
content: [{
|
|
216
|
+
type: "text",
|
|
217
|
+
text: `Delegation failed: ${String(error)}${environmentId ? `; work retained in ${workspace} (${environmentId})` : ""}`
|
|
218
|
+
}],
|
|
219
|
+
details: {
|
|
220
|
+
status,
|
|
221
|
+
stopReason,
|
|
222
|
+
mode,
|
|
223
|
+
grantedTools: tools,
|
|
224
|
+
rejectedTools: access.rejected,
|
|
225
|
+
...research ? {
|
|
226
|
+
resumeId: research.id,
|
|
227
|
+
checkpoint: research.checkpoint
|
|
228
|
+
} : {},
|
|
229
|
+
...environmentId ? {
|
|
230
|
+
environmentId,
|
|
231
|
+
workspace
|
|
232
|
+
} : {}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
} finally {
|
|
236
|
+
signal?.removeEventListener("abort", abort);
|
|
237
|
+
}
|
|
238
|
+
} while (research && attempt < attemptLimit && !signal?.aborted && result.status === "partial" && [
|
|
239
|
+
"tool_calls",
|
|
240
|
+
"total_tokens",
|
|
241
|
+
"model_turns",
|
|
242
|
+
"timeout",
|
|
243
|
+
"deadline_exceeded"
|
|
244
|
+
].includes(result.stopReason) && research.checkpoint.nextSteps.length > 0);
|
|
245
|
+
const currentRevision = mode === "review" ? await readWorkspaceRevision(workspace) : void 0;
|
|
246
|
+
const stale = mode === "review" && (!revision || revision !== currentRevision);
|
|
247
|
+
const patch = mode === "implement" ? await runGit(workspace, [
|
|
248
|
+
"diff",
|
|
249
|
+
"--no-ext-diff",
|
|
250
|
+
"--no-textconv",
|
|
251
|
+
"--binary",
|
|
252
|
+
"HEAD"
|
|
253
|
+
]).catch(() => "") : void 0;
|
|
254
|
+
return {
|
|
255
|
+
content: [{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: [
|
|
258
|
+
result.summary,
|
|
259
|
+
research ? `Research checkpoint ${research.id}: ${JSON.stringify(research.checkpoint)}. Resume unfinished work with resumeId and the same goal.` : "",
|
|
260
|
+
`Budget (${result.budget.tier}): ${JSON.stringify({
|
|
261
|
+
stopReason: result.stopReason,
|
|
262
|
+
usage: result.budget.usage,
|
|
263
|
+
limits: result.budget.limits,
|
|
264
|
+
handoffRequested: result.handoff.requested
|
|
265
|
+
})}`,
|
|
266
|
+
stale ? "Workspace changed or could not be fingerprinted; review findings require revalidation." : "",
|
|
267
|
+
access.rejected.length ? `Rejected tools: ${JSON.stringify(access.rejected)}` : "",
|
|
268
|
+
environmentId ? `Changes retained in ${workspace} (environment ${environmentId}). Review and integrate from this workspace, then verify the parent workspace again.` : "",
|
|
269
|
+
patch ? `Patch preview:\n${patch.slice(0, 3e4)}` : ""
|
|
270
|
+
].filter(Boolean).join("\n\n")
|
|
271
|
+
}],
|
|
272
|
+
details: {
|
|
273
|
+
status: stale && result.status === "success" ? "partial" : result.status,
|
|
274
|
+
mode,
|
|
275
|
+
summary: result.summary,
|
|
276
|
+
grantedTools: tools,
|
|
277
|
+
rejectedTools: access.rejected,
|
|
278
|
+
iterations: attemptBudgets.reduce((total, budget) => total + (budget.usage.toolCalls ?? 0), 0),
|
|
279
|
+
revision: currentRevision,
|
|
280
|
+
reviewedRevision: revision,
|
|
281
|
+
stopReason: result.stopReason,
|
|
282
|
+
budget: result.budget,
|
|
283
|
+
handoff: result.handoff,
|
|
284
|
+
...research ? {
|
|
285
|
+
resumeId: research.id,
|
|
286
|
+
checkpoint: research.checkpoint,
|
|
287
|
+
attempts: attempt,
|
|
288
|
+
totalAttempts: research.attempts,
|
|
289
|
+
attemptBudgets
|
|
290
|
+
} : {},
|
|
291
|
+
...result.verification ? { childVerification: result.verification } : {},
|
|
292
|
+
...environmentId ? {
|
|
293
|
+
environmentId,
|
|
294
|
+
workspace,
|
|
295
|
+
patchTruncated: (patch?.length ?? 0) > 3e4
|
|
296
|
+
} : {}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
204
299
|
}
|
|
205
300
|
};
|
|
206
301
|
}
|
|
@@ -11,6 +11,7 @@ const DELEGATION_CAPABILITIES = [
|
|
|
11
11
|
];
|
|
12
12
|
/** Host-owned classifications. New tools fail closed until classified. */
|
|
13
13
|
const DELEGATION_TOOL_CAPABILITIES = {
|
|
14
|
+
data_batch: "local_read",
|
|
14
15
|
read_file: "local_read",
|
|
15
16
|
grep: "local_read",
|
|
16
17
|
find: "local_read",
|
|
@@ -43,6 +44,16 @@ const DELEGATION_TOOL_CAPABILITIES = {
|
|
|
43
44
|
language_diagnostics: "command",
|
|
44
45
|
browser_use: "browser"
|
|
45
46
|
};
|
|
47
|
+
const BATCH_SOURCES = new Set([
|
|
48
|
+
"read_file",
|
|
49
|
+
"grep",
|
|
50
|
+
"exec_command",
|
|
51
|
+
"knowledge_search",
|
|
52
|
+
"knowledge_get",
|
|
53
|
+
"web_search",
|
|
54
|
+
"web_fetch",
|
|
55
|
+
"xopc_tool_execute"
|
|
56
|
+
]);
|
|
46
57
|
const RESEARCH = [
|
|
47
58
|
"local_read",
|
|
48
59
|
"web_read",
|
|
@@ -67,7 +78,8 @@ function resolveDelegationTools(parentNames, mode, requested, capabilities) {
|
|
|
67
78
|
const rejected = [];
|
|
68
79
|
for (const tool of new Set((requested ?? parentNames).map((name) => name.trim()).filter(Boolean))) {
|
|
69
80
|
const capability = DELEGATION_TOOL_CAPABILITIES[tool];
|
|
70
|
-
const
|
|
81
|
+
const capabilityAllowed = tool === "data_batch" ? parentNames.some((name) => BATCH_SOURCES.has(name) && allowed.has(DELEGATION_TOOL_CAPABILITIES[name])) : capability !== void 0 && allowed.has(capability);
|
|
82
|
+
const reason = !parent.has(tool) ? "Unavailable to the parent agent" : !capability ? "Tool has no delegable capability" : !capabilityAllowed ? `Capability ${capability} is outside this delegation` : void 0;
|
|
71
83
|
if (reason) {
|
|
72
84
|
if (requested) rejected.push({
|
|
73
85
|
tool,
|
|
@@ -40,6 +40,7 @@ import { createWebFetchTool, createWebSearchTool } from "./web.js";
|
|
|
40
40
|
import { createWebExtractTool } from "./web-extract.js";
|
|
41
41
|
import { createMessageTool } from "./communication.js";
|
|
42
42
|
import { createSendMediaTool } from "./send-media.js";
|
|
43
|
+
import { createTaskResultTool } from "./task-result-tool.js";
|
|
43
44
|
import { createReadMediaTool } from "./media-read-tool.js";
|
|
44
45
|
import { createCreateShareTool, isShareToolAvailable } from "./create-share-tool.js";
|
|
45
46
|
import { createTodoTool } from "./todo-tool.js";
|
|
@@ -69,6 +70,7 @@ import { createManagedJobTool } from "./managed-job-tool.js";
|
|
|
69
70
|
import { createImageTool } from "./image-tool.js";
|
|
70
71
|
import { createImageGenerateTool } from "./image-generate-tool.js";
|
|
71
72
|
import { createPersonalReadTool } from "./personal-read-tool.js";
|
|
73
|
+
import { createTaskCollaborationTool } from "./task-collaboration-tool.js";
|
|
72
74
|
import "./index.js";
|
|
73
75
|
import { createPersonalTaskTool } from "./personal-task-tool.js";
|
|
74
76
|
import { createPersonalRequestTools } from "./personal-request-tool.js";
|
|
@@ -272,6 +274,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
272
274
|
allowed = new Set(PERSONAL_REQUEST_TOOL_IDS.slice(0, 3).filter((name) => !allowed || allowed.has(name)));
|
|
273
275
|
allowed.add("personal_request_result");
|
|
274
276
|
allowed.add("personal_request_connection");
|
|
277
|
+
allowed.add("task_collaboration");
|
|
275
278
|
}
|
|
276
279
|
const deliveryContext = () => {
|
|
277
280
|
if (currentConversationId() && getSessionMetadata(currentConversationId())?.sessionType === "heartbeat") throw new Error("Heartbeat notifications must be returned in the final response for policy-controlled delivery.");
|
|
@@ -425,6 +428,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
425
428
|
})] : [],
|
|
426
429
|
createSendMediaTool(workspace, bus, deliveryContext),
|
|
427
430
|
createPublishArtifactsTool(workspace),
|
|
431
|
+
createTaskResultTool(currentConversationId),
|
|
428
432
|
createReadMediaTool(personalToolsConfigured ? {
|
|
429
433
|
textOnly: true,
|
|
430
434
|
maxChars: LOCAL_READ_MAX_CHARS,
|
|
@@ -612,7 +616,14 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
612
616
|
}
|
|
613
617
|
})] : [],
|
|
614
618
|
...optionalTools,
|
|
615
|
-
...personalExecution ? [
|
|
619
|
+
...personalExecution ? [
|
|
620
|
+
createPersonalRequestResultTool(currentConversationId),
|
|
621
|
+
createPersonalRequestConnectionTool(currentConversationId),
|
|
622
|
+
createTaskCollaborationTool({
|
|
623
|
+
...productToolDeps,
|
|
624
|
+
getCurrentConversationId: currentConversationId
|
|
625
|
+
})
|
|
626
|
+
] : []
|
|
616
627
|
];
|
|
617
628
|
if ([
|
|
618
629
|
"read_file",
|
|
@@ -17,6 +17,7 @@ export { createWebExtractTool, stripHtmlBoilerplate, DEFAULT_WEB_EXTRACT_MAX_LEN
|
|
|
17
17
|
export { createMessageTool } from './communication.js';
|
|
18
18
|
export { createSendMediaTool } from './send-media.js';
|
|
19
19
|
export { createPublishArtifactsTool } from './publish-artifacts.js';
|
|
20
|
+
export { createTaskResultTool } from './task-result-tool.js';
|
|
20
21
|
export { createReadMediaTool } from './media-read-tool.js';
|
|
21
22
|
export { createCreateShareTool, isShareToolAvailable, type CreateShareToolDeps, } from './create-share-tool.js';
|
|
22
23
|
export { createTodoTool, TodoStore, type TodoItem, type TodoStatus } from './todo-tool.js';
|
|
@@ -43,3 +44,4 @@ export { createImageGenerateTool, resolveImageGenerationModelConfigForTool } fro
|
|
|
43
44
|
export { truncateHead, truncateTail, truncateLine, formatSize, type TruncationResult, type TruncationOptions, DEFAULT_MAX_LINES, DEFAULT_MAX_BYTES, GREP_MAX_LINE_LENGTH, } from './truncate.js';
|
|
44
45
|
export { normalizeToLF, restoreLineEndings, normalizeForFuzzyMatch, fuzzyFindText, stripBom, generateDiffString, type FuzzyMatchResult, } from './edit-diff.js';
|
|
45
46
|
export { createPersonalReadTool } from './personal-read-tool.js';
|
|
47
|
+
export { createTaskCollaborationTool } from './task-collaboration-tool.js';
|
|
@@ -19,6 +19,7 @@ import { createWebFetchTool, createWebSearchTool } from "./web.js";
|
|
|
19
19
|
import { DEFAULT_WEB_EXTRACT_MAX_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT, createWebExtractTool, stripHtmlBoilerplate } from "./web-extract.js";
|
|
20
20
|
import { createMessageTool } from "./communication.js";
|
|
21
21
|
import { createSendMediaTool } from "./send-media.js";
|
|
22
|
+
import { createTaskResultTool } from "./task-result-tool.js";
|
|
22
23
|
import { createReadMediaTool } from "./media-read-tool.js";
|
|
23
24
|
import { createCreateShareTool, isShareToolAvailable } from "./create-share-tool.js";
|
|
24
25
|
import { TodoStore, createTodoTool } from "./todo-tool.js";
|
|
@@ -46,4 +47,5 @@ import { createManagedJobTool } from "./managed-job-tool.js";
|
|
|
46
47
|
import { createImageTool } from "./image-tool.js";
|
|
47
48
|
import { createImageGenerateTool, resolveImageGenerationModelConfigForTool } from "./image-generate-tool.js";
|
|
48
49
|
import { createPersonalReadTool } from "./personal-read-tool.js";
|
|
49
|
-
|
|
50
|
+
import { createTaskCollaborationTool } from "./task-collaboration-tool.js";
|
|
51
|
+
export { BrowserRuntime, DEFAULT_DELEGATE_TOOLS, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, DEFAULT_TOOL_METADATA, DEFAULT_WEB_EXTRACT_MAX_LENGTH, DELEGATE_BLOCKED_TOOLS, GREP_MAX_LINE_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT, TodoStore, ToolConcurrencyController, assertBrowserUrlAllowed, createApplyPatchTool, createAutomationTool, createBrowserAutomationTool, createClarifyTool, createCreateShareTool, createDataBatchTool, createDelegateTool, createDesktopPetTool, createExecCommandTool, createFindTool, createGrepTool, createImageGenerateTool, createImageTool, createKnowledgeGetTool, createKnowledgeReadTool, createKnowledgeSearchTool, createKnowledgeWriteTool, createListDirTool, createManagedJobTool, createMemoryMaintenanceTool, createMessageTool, createPersonalReadTool, createPublishArtifactsTool, createReadFileTool, createReadMediaTool, createSendMediaTool, createSessionRecallTool, createSessionSearchTool, createSessionStatusTool, createSkillInstallTool, createSkillManageTool, createSkillViewTool, createSkillsListTool, createSkillsMarketplaceSearchTool, createTaskCollaborationTool, createTaskResultTool, createTodoTool, createToolManualTool, createUpdatePlanTool, createUserContextGetTool, createUserContextReadTool, createUserContextSearchTool, createUserContextUpdateTool, createWebExtractTool, createWebFetchTool, createWebSearchTool, createWorkflowManageTool, createWorkflowTool, createWriteFileTool, createXopcUseTool, findTool, formatSize, fuzzyFindText, generateDiffString, getToolMetadata, grepTool, isShareToolAvailable, listDirTool, normalizeForFuzzyMatch, normalizeToLF, resolveImageGenerationModelConfigForTool, resolveImageModelConfigForTool, resolveToolLockMode, restoreLineEndings, stripBom, stripHtmlBoilerplate, truncateHead, truncateLine, truncateTail, writeFileTool };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createExecCommandTool } from "./exec-command.js";
|
|
2
2
|
import { relative, resolve, sep } from "node:path";
|
|
3
|
-
import { access } from "node:fs/promises";
|
|
4
3
|
import { Type } from "@sinclair/typebox";
|
|
4
|
+
import { access } from "node:fs/promises";
|
|
5
5
|
//#region src/agent/tools/language-diagnostics.ts
|
|
6
6
|
function parseTypeScriptDiagnostics(output) {
|
|
7
7
|
return [...output.matchAll(/^(.+)\((\d+),(\d+)\): error (TS\d+): (.+)$/gm)].slice(0, 200).map((match) => ({
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
2
|
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
3
3
|
import { init_request_repository, personalRequestForExecution } from "../../personal-agent/request-repository.js";
|
|
4
|
+
import { assertPersonalRequestAccountAccess } from "../../personal-agent/request-access.js";
|
|
5
|
+
import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
|
|
6
|
+
import { selectionRequestHash } from "../../agent-matching/selection-repository.js";
|
|
4
7
|
import { PersonalRequestResultSchema } from "../../personal-agent/request-result.js";
|
|
5
8
|
import { Type } from "@sinclair/typebox";
|
|
6
9
|
//#region src/agent/tools/personal-request-result-tool.ts
|
|
@@ -47,8 +50,22 @@ function createPersonalRequestResultTool(conversationId) {
|
|
|
47
50
|
if (result.coverage && Date.parse(result.coverage.from) >= Date.parse(result.coverage.to)) throw new Error("Invalid coverage range");
|
|
48
51
|
if (result.coverage && request.parameters.timeRange && (Date.parse(result.coverage.from) > Date.parse(request.parameters.timeRange.from) || Date.parse(result.coverage.to) < Date.parse(request.parameters.timeRange.to))) result.coverage.partial = true;
|
|
49
52
|
const run = request.taskId ? new TaskRunRepository().getActiveRoot(request.taskId) : void 0;
|
|
50
|
-
if (!run || run.conversationId !== id) throw new Error("Task execution changed");
|
|
51
|
-
|
|
53
|
+
if (!run || run.conversationId !== id || !["running", "verifying"].includes(run.status)) throw new Error("Task execution changed");
|
|
54
|
+
assertPersonalRequestAccountAccess(request);
|
|
55
|
+
runSqliteWriteTransaction(() => {
|
|
56
|
+
const board = new TaskCollaborationRepository();
|
|
57
|
+
const direction = board.coordination(run.taskId).filter((entry) => ["main_agent", "user"].includes(entry.authorKind) && ["answer", "instruction"].includes(entry.kind)).at(-1)?.sequence ?? 0;
|
|
58
|
+
board.append({
|
|
59
|
+
taskId: run.taskId,
|
|
60
|
+
taskRunId: run.id,
|
|
61
|
+
authorKind: "worker_agent",
|
|
62
|
+
authorId: request.executorAgentId,
|
|
63
|
+
kind: "result",
|
|
64
|
+
body: result.summary,
|
|
65
|
+
idempotencyKey: `personal-request-result:${request.requestId}:${run.id}:${direction}:${selectionRequestHash(result)}`
|
|
66
|
+
});
|
|
67
|
+
getSqliteDatabase().prepare("UPDATE personal_requests SET result_json = ?, result_run_id = ?, updated_at = ? WHERE request_id = ?").run(JSON.stringify(result), run.id, Date.now(), request.requestId);
|
|
68
|
+
});
|
|
52
69
|
return {
|
|
53
70
|
content: [{
|
|
54
71
|
type: "text",
|