@xopcai/xopc 0.0.385 → 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-Cb9eaXxR.js → agent-avatar-dicebear-D-86VOlb.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DEV-xtgm.js → agent-defaults-settings-panel-SmeUVHY8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DXKc3Luj.js → agent-plugin-dialog-BVT3wXq5.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DcNxwpJQ.js → agents-D7rLQFhX.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-X5i0Tz7_.js → app-management-settings-panel-CUR7n5iP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CmHHzquT.js → appearance-settings-BCotSGep.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-ChFA4Zp0.js → apps-page-hk0bo9LT.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BFqsIqOI.js → automations-page-CqxuUwox.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-Blfak-fT.js → automations-workspace-11_Z69pr.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CpOLG3Co.js → block-editor-eldB84Mj.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BSbTJ9j2.js → browser-automations-page-D4TaUPYT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BUlILJrB.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-CeRdkwRf.js → capabilities-page-CyYlueEd.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-S-cKsGja.js → capabilities-settings-panel-uVEgfvo0.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-6w8pQhnn.js → capability-header-actions-BXv0xu56.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DfNTGBmp.js → channels-fNb3SOzm.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DnoQHpDc.js → chat-terminal-dock-CnLtparQ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-7yliE7sG.js → computer-settings-page-xM0AnOlP.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DOLAUFSW.js → connector-service-page-CdG2WUb6.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DAsn97XG.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-DNDqr4Fk.js → date-picker-DIBbE-O8.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-B5oG7RgE.js → dependency-picker-DDD8zokD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-K7kUCX1O.js → desktop-pet-KlF390Xn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-KgOAuqSh.js → desktop-pet-settings-CgqQMKDC.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DvqniZDm.js → device-pairing-wizard-BR6isfG2.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BmOguLDl.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-DSSuMQxp.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-DSd__mNd.js → extension-settings-page-D7-5v0V4.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-D7bjbiwZ.js → fallback-models-DnYn7qOV.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-hSXGWumL.js → gateway-settings-Bwe3JWX-.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-C7xJwE61.js → highlighted-body-KQOG7T2V-DefTxF3q.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DJNmlMfH.js → home-page-BtSy2hRV.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BufZPzGE.js → imports-page-CTdBYZib.js} +1 -1
- package/dist/gateway/static/root/assets/{index-K8SXDtxr.js → index-B08iR7fT.js} +9 -9
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8pPP5RF.js → keyboard-shortcuts-settings-CXKp57O_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-zEtvE7pJ.js → local-app-workbench-page-DzD_OzGY.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Bli7e_eg.js → local-apps-page-B0E0vttg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BimZk3R4.js → logs-page-eL4fYcMl.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-5Y4COyU9.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-KLDPLVg7.js → note-detail-panel-CsY5tQp5.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-DST0oPXD.js → notes-page-D09LjNoj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Bmed83-6.js → page-context-capture-button-DO-aP3D9.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BG4Ystrm.js → personal-page-E8F2aGNB.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CXkYP9xE.js → product-open-page-aUoA-uPw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DjmupQSq.js → product-preview-content-B-cz-pIV.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CzBmV0P6.js → project-detail-page-WhefAh8E.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DByqe5Em.js → projects-page-CyqAs0tO.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DTjj-odF.js → remote-access-hub-BwhRGL6m.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B_ptn3T8.js → runtime-tools-settings-panel-o26dmPNq.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-wkua4l5y.js → scenes-page-D_e19kv_.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-VvOSM84Y.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-D06XwYAT.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-C-6BJdb1.js → settings-page-Bc_zxxRu.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-L0JSG0K-.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-BbgAUM3v.js → shares-settings-CInxjxgJ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BFU1tPyw.js → skill-api-Bjd8WAA4.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DZw6el4o.js → skills-page-8CKS3Oo2.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DshSGWNg.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-DFDXwWnU.js → tunnel-api-CY7MoDGf.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-2RJLg54s.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-y1gjGYPI.js → user-model-page-CyWrEtHY.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ch-KfpCF.js → work-discovery-overlay-DmZXLs1v.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CTu297Hc.js → workflow-run-setup-panel-BdLOzHm4.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-CRZXG_rm.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-hEfjVjnc.js → xopc-cloud-account-card-D8B136vW.js} +1 -1
- package/dist/gateway/static/root/index.html +11 -11
- 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 +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/external-tools/gateway-tools.js +7 -3
- 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/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/factory.js +2 -0
- 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-request-tool.js +8 -13
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -2
- package/dist/src/agent/tools/personal-task-tool.js +9 -8
- 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-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 +2 -2
- 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/doctor/checks/database-schema.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 +3 -1
- package/dist/src/connectors/connection-recovery-service.js +66 -5
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -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 +12 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
- package/dist/src/gateway/service/session-input-coordinator.js +213 -26
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +9 -7
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/personal-agent/prompts.js +4 -1
- package/dist/src/personal-agent/reply-composer.d.ts +1 -0
- package/dist/src/personal-agent/reply-composer.js +70 -12
- 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-repository.d.ts +2 -0
- package/dist/src/personal-agent/request-service.d.ts +4 -0
- package/dist/src/personal-agent/request-service.js +90 -19
- 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/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 +13 -3
- 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/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/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 +2 -2
- package/dist/src/tasks/task-context-assembler.js +6 -1
- 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-planner.d.ts +1 -0
- package/dist/src/tasks/task-contract-planner.js +22 -15
- 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-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.js +69 -15
- package/dist/src/tasks/task-run-dispatcher.js +1 -0
- package/dist/src/tasks/task-run-repository.d.ts +5 -0
- package/dist/src/tasks/task-run-repository.js +88 -1
- package/package.json +9 -5
- package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DBRj4-1-.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,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";
|
|
@@ -427,6 +428,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
427
428
|
})] : [],
|
|
428
429
|
createSendMediaTool(workspace, bus, deliveryContext),
|
|
429
430
|
createPublishArtifactsTool(workspace),
|
|
431
|
+
createTaskResultTool(currentConversationId),
|
|
430
432
|
createReadMediaTool(personalToolsConfigured ? {
|
|
431
433
|
textOnly: true,
|
|
432
434
|
maxChars: LOCAL_READ_MAX_CHARS,
|
|
@@ -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';
|
|
@@ -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";
|
|
@@ -47,4 +48,4 @@ 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";
|
|
50
|
-
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, 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 };
|
|
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) => ({
|
|
@@ -9,10 +9,9 @@ import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
|
9
9
|
import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
|
|
10
10
|
import { boundedPersonalResult } from "./personal-result-budget.js";
|
|
11
11
|
import { selectionRequestHash } from "../../agent-matching/selection-repository.js";
|
|
12
|
-
import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
|
|
13
12
|
import { createPersonalTaskTool } from "./personal-task-tool.js";
|
|
14
13
|
import { personalCapabilities } from "../../personal-agent/capability-service.js";
|
|
15
|
-
import { assertPersonalRequestTimeRange, cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest, submitPersonalRequest } from "../../personal-agent/request-service.js";
|
|
14
|
+
import { assertPersonalRequestTimeRange, cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest, stopPersonalRequestExecution, submitPersonalRequest } from "../../personal-agent/request-service.js";
|
|
16
15
|
import { Type } from "@sinclair/typebox";
|
|
17
16
|
//#region src/agent/tools/personal-request-tool.ts
|
|
18
17
|
init_session_input_repository();
|
|
@@ -163,14 +162,14 @@ function createPersonalRequestTools(deps) {
|
|
|
163
162
|
name: "personal_request",
|
|
164
163
|
label: "Connected app request",
|
|
165
164
|
parameters: RequestSchema,
|
|
166
|
-
description: "Submit a read-only connected-app request with a short objective and complete description using the exact connectorId from personal_capability. The background Task Router chooses an executor after account authorization. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default;
|
|
165
|
+
description: "Submit a read-only connected-app request with a short objective and complete description using the exact connectorId from personal_capability. The background Task Router chooses an executor after account authorization. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default; state that range and proceed without asking for confirmation. get includes complete Task coordination state; collaboration/entry read the same board and full questions. answer forwards the exact questionId; instruct forwards new requirements to the existing Task. Answers and instructions cannot change the connector/account, grant access or allow writes; reconnection stays in the existing connection UI. Saved, delivered, executor-confirmed and verified are distinct states. Use get/list for status without polling; preserve idempotencyKey on uncertain retries; cancel only when the user requests it.",
|
|
167
166
|
async execute(toolCallId, input) {
|
|
168
167
|
const conversationId = conversation();
|
|
169
168
|
if (input.command === "list") {
|
|
170
169
|
const offset = input.offset ?? 0;
|
|
171
170
|
const items = listPersonalRequests(conversationId, input.limit ?? 10, offset).map((request) => {
|
|
172
171
|
const { result: _result, parameters, ...summary } = snapshot(request);
|
|
173
|
-
const { brief: _brief, ...queryParameters } = parameters;
|
|
172
|
+
const { brief: _brief, taskRunId: _taskRunId, cancellationCleanupCompleted: _cleanup, ...queryParameters } = parameters;
|
|
174
173
|
return {
|
|
175
174
|
...summary,
|
|
176
175
|
parameters: queryParameters
|
|
@@ -203,21 +202,17 @@ function createPersonalRequestTools(deps) {
|
|
|
203
202
|
});
|
|
204
203
|
publishPersonalRequest(request);
|
|
205
204
|
deps.dispatchTaskRuns?.();
|
|
206
|
-
return result(
|
|
205
|
+
return result({
|
|
206
|
+
...compactSnapshot(request),
|
|
207
|
+
guidance: request.state === "waiting_connection" ? "The objective is saved. The host presents the required connection or account selection and continues automatically afterward. Stop this turn; do not ask the user to confirm the read or reply continue." : "The request was accepted. No further user confirmation is needed. Report the returned state accurately, do not submit a duplicate, and wait for delivery without polling."
|
|
208
|
+
});
|
|
207
209
|
}
|
|
208
210
|
const request = input.requestId ? getPersonalRequest(input.requestId) : void 0;
|
|
209
211
|
if (!request || request.conversationId !== conversationId) throw new Error("Request does not belong to this conversation");
|
|
210
212
|
if (input.command === "cancel") {
|
|
211
213
|
if (["completed", "failed"].includes(personalRequestSnapshot(request).state)) return result(compactSnapshot(request));
|
|
212
|
-
if (request.state === "cancelled") {
|
|
213
|
-
const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
|
|
214
|
-
return result({
|
|
215
|
-
...compactSnapshot(request),
|
|
216
|
-
executionStopConfirmed: stop.executionStopConfirmed
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
|
|
220
214
|
const cancelled = cancelPersonalRequest(request);
|
|
215
|
+
const stop = stopPersonalRequestExecution(cancelled);
|
|
221
216
|
publishPersonalRequest(cancelled);
|
|
222
217
|
return result({
|
|
223
218
|
...compactSnapshot(cancelled),
|
|
@@ -14,18 +14,17 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
|
|
|
14
14
|
}>>;
|
|
15
15
|
command: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"get" | "answer" | "retry_allocation" | "selection" | "list" | "cancel" | "entry" | "submit" | "instruct" | "collaboration">[]>;
|
|
16
16
|
requestId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
|
+
instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
18
|
title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
18
19
|
taskId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
19
20
|
requiredSkills: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
20
21
|
idempotencyKey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
22
|
objective: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
23
|
expectedOutputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
23
|
-
acceptanceCriteria: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
24
24
|
constraints: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
25
25
|
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
26
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
27
27
|
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
28
|
-
instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
29
28
|
section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<string>[]>>;
|
|
30
29
|
entryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
31
30
|
afterSequence: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
@@ -12,12 +12,12 @@ import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
|
12
12
|
import { boundedPersonalResult } from "./personal-result-budget.js";
|
|
13
13
|
import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
|
|
14
14
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
15
|
+
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
15
16
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
16
17
|
import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
|
|
17
18
|
import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
|
|
18
19
|
import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
|
|
19
20
|
import { assertSpecialistEligible, createSelectedTask } from "../../agent-matching/delegation-service.js";
|
|
20
|
-
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
21
21
|
import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
|
|
22
22
|
import { randomUUID } from "node:crypto";
|
|
23
23
|
import { Type } from "@sinclair/typebox";
|
|
@@ -122,7 +122,8 @@ const PersonalTaskModelSchema = Type.Object({
|
|
|
122
122
|
"previousSelectionId",
|
|
123
123
|
"matchId",
|
|
124
124
|
"cursor",
|
|
125
|
-
"requiredTools"
|
|
125
|
+
"requiredTools",
|
|
126
|
+
"acceptanceCriteria"
|
|
126
127
|
]).properties,
|
|
127
128
|
requirements: Type.Optional(Type.Omit(PersonalTaskSchema.properties.requirements, ["requiredTools", "requiredSkills"], { additionalProperties: false })),
|
|
128
129
|
command: Type.Union([
|
|
@@ -314,9 +315,9 @@ function createPersonalTaskTool(deps) {
|
|
|
314
315
|
createMode: "allocate",
|
|
315
316
|
requirements,
|
|
316
317
|
includeConversationContext: false,
|
|
317
|
-
expectedOutputs: input.expectedOutputs
|
|
318
|
-
acceptanceCriteria: input.acceptanceCriteria
|
|
319
|
-
constraints: input.constraints
|
|
318
|
+
expectedOutputs: input.expectedOutputs,
|
|
319
|
+
acceptanceCriteria: input.acceptanceCriteria,
|
|
320
|
+
constraints: input.constraints,
|
|
320
321
|
idempotencyKey: `personal-submit:${conversationId}:${selectionRequestHash(submissionKey)}`
|
|
321
322
|
};
|
|
322
323
|
if (requirements.requiredSkills?.length) args.body = `${brief.body}\n\nRequired Skills: ${requirements.requiredSkills.join(", ")}. Read and follow these Skills before execution.`;
|
|
@@ -397,9 +398,9 @@ function createPersonalTaskTool(deps) {
|
|
|
397
398
|
agentId,
|
|
398
399
|
createMode: "start",
|
|
399
400
|
includeConversationContext: false,
|
|
400
|
-
expectedOutputs: input.expectedOutputs
|
|
401
|
-
acceptanceCriteria: input.acceptanceCriteria
|
|
402
|
-
constraints: input.constraints
|
|
401
|
+
expectedOutputs: input.expectedOutputs,
|
|
402
|
+
acceptanceCriteria: input.acceptanceCriteria,
|
|
403
|
+
constraints: input.constraints,
|
|
403
404
|
idempotencyKey: key
|
|
404
405
|
};
|
|
405
406
|
} else if (command === "list") {
|
|
@@ -6,8 +6,8 @@ import { resolvePathUnderWorkspace } from "./tool-paths.js";
|
|
|
6
6
|
import { fileResourceId, fileSpaceId } from "../../files/file-service.js";
|
|
7
7
|
import { persistToolMedia } from "./tool-media.js";
|
|
8
8
|
import { basename, isAbsolute, relative, sep } from "node:path";
|
|
9
|
-
import { realpath } from "node:fs/promises";
|
|
10
9
|
import { Type } from "@sinclair/typebox";
|
|
10
|
+
import { realpath } from "node:fs/promises";
|
|
11
11
|
//#region src/agent/tools/publish-artifacts.ts
|
|
12
12
|
init_src();
|
|
13
13
|
const PublishArtifactsSchema = Type.Object({ paths: Type.Array(Type.String({ minLength: 1 }), {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import { ResearchCheckpointUpdateSchema, type ResearchCheckpointSink } from '../orchestration/research-checkpoint.js';
|
|
3
|
+
export declare function createResearchCheckpointTool(sink: ResearchCheckpointSink): AgentTool<typeof ResearchCheckpointUpdateSchema>;
|