@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,13 +1,23 @@
|
|
|
1
|
-
import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import {
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { init_session_instance_repository, readCurrentTranscriptId } from "../../storage/sqlite/session-instance-repository.js";
|
|
3
|
+
import { getSessionInputState, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
|
|
4
|
+
import { getPersonalRequest, init_request_repository, listPersonalRequests, updatePersonalRequest } from "../../personal-agent/request-repository.js";
|
|
5
|
+
import { getActiveConnectionWait, init_connection_wait_repository, reviseCurrentConnectionObjective, updateConnectionWait } from "../../storage/sqlite/connection-wait-repository.js";
|
|
6
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
7
|
+
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
3
8
|
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
4
9
|
import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
|
|
5
10
|
import { boundedPersonalResult } from "./personal-result-budget.js";
|
|
6
|
-
import {
|
|
11
|
+
import { selectionRequestHash } from "../../agent-matching/selection-repository.js";
|
|
12
|
+
import { createPersonalTaskTool } from "./personal-task-tool.js";
|
|
7
13
|
import { personalCapabilities } from "../../personal-agent/capability-service.js";
|
|
8
|
-
import { cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest, submitPersonalRequest } from "../../personal-agent/request-service.js";
|
|
14
|
+
import { assertPersonalRequestTimeRange, cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest, stopPersonalRequestExecution, submitPersonalRequest } from "../../personal-agent/request-service.js";
|
|
9
15
|
import { Type } from "@sinclair/typebox";
|
|
10
16
|
//#region src/agent/tools/personal-request-tool.ts
|
|
17
|
+
init_session_input_repository();
|
|
18
|
+
init_session_repository();
|
|
19
|
+
init_session_instance_repository();
|
|
20
|
+
init_connection_wait_repository();
|
|
11
21
|
init_request_repository();
|
|
12
22
|
init_transaction();
|
|
13
23
|
const CapabilitySchema = Type.Object({
|
|
@@ -22,8 +32,20 @@ const RequestSchema = Type.Object({
|
|
|
22
32
|
"submit",
|
|
23
33
|
"get",
|
|
24
34
|
"list",
|
|
25
|
-
"cancel"
|
|
35
|
+
"cancel",
|
|
36
|
+
"answer",
|
|
37
|
+
"instruct",
|
|
38
|
+
"collaboration",
|
|
39
|
+
"entry"
|
|
26
40
|
].map((command) => Type.Literal(command))),
|
|
41
|
+
instruction: Type.Optional(Type.String({
|
|
42
|
+
minLength: 1,
|
|
43
|
+
maxLength: 8e3
|
|
44
|
+
})),
|
|
45
|
+
questionId: Type.Optional(Type.String({ minLength: 1 })),
|
|
46
|
+
entryId: Type.Optional(Type.String({ minLength: 1 })),
|
|
47
|
+
afterSequence: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
48
|
+
bodyOffset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
27
49
|
requestId: Type.Optional(Type.String()),
|
|
28
50
|
offset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
29
51
|
limit: Type.Optional(Type.Integer({
|
|
@@ -32,6 +54,11 @@ const RequestSchema = Type.Object({
|
|
|
32
54
|
})),
|
|
33
55
|
connectorId: Type.Optional(Type.String()),
|
|
34
56
|
accountId: Type.Optional(Type.String()),
|
|
57
|
+
description: Type.Optional(Type.String({
|
|
58
|
+
minLength: 1,
|
|
59
|
+
maxLength: 16e3,
|
|
60
|
+
description: "Complete task brief preserving all user requirements, stages, inputs, outputs and constraints. Do not replace exact specifications with a short objective or a reference to an unspecified process."
|
|
61
|
+
})),
|
|
35
62
|
objective: Type.Optional(Type.String({
|
|
36
63
|
minLength: 1,
|
|
37
64
|
maxLength: 4e3
|
|
@@ -51,12 +78,36 @@ const RequestSchema = Type.Object({
|
|
|
51
78
|
anyOf: [
|
|
52
79
|
{
|
|
53
80
|
properties: { command: { const: "submit" } },
|
|
54
|
-
required: [
|
|
81
|
+
required: [
|
|
82
|
+
"objective",
|
|
83
|
+
"connectorId",
|
|
84
|
+
"description"
|
|
85
|
+
]
|
|
55
86
|
},
|
|
56
87
|
{ properties: { command: { const: "list" } } },
|
|
57
88
|
{
|
|
58
|
-
properties: { command: { enum: [
|
|
89
|
+
properties: { command: { enum: [
|
|
90
|
+
"get",
|
|
91
|
+
"cancel",
|
|
92
|
+
"collaboration"
|
|
93
|
+
] } },
|
|
59
94
|
required: ["requestId"]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
properties: { command: { const: "entry" } },
|
|
98
|
+
required: ["requestId", "entryId"]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
properties: { command: { const: "instruct" } },
|
|
102
|
+
required: ["requestId", "instruction"]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
properties: { command: { const: "answer" } },
|
|
106
|
+
required: [
|
|
107
|
+
"requestId",
|
|
108
|
+
"questionId",
|
|
109
|
+
"instruction"
|
|
110
|
+
]
|
|
60
111
|
}
|
|
61
112
|
]
|
|
62
113
|
});
|
|
@@ -74,6 +125,20 @@ function createPersonalRequestTools(deps) {
|
|
|
74
125
|
...value.taskId ? { allocation: new TaskAllocationRepository().summary(value.taskId) } : {}
|
|
75
126
|
};
|
|
76
127
|
};
|
|
128
|
+
const compactSnapshot = (request) => {
|
|
129
|
+
const value = snapshot(request);
|
|
130
|
+
return {
|
|
131
|
+
requestId: value.requestId,
|
|
132
|
+
taskId: value.taskId,
|
|
133
|
+
state: value.state,
|
|
134
|
+
version: value.version,
|
|
135
|
+
connectorId: value.connectorId,
|
|
136
|
+
accountId: value.accountId,
|
|
137
|
+
executorAgentId: value.executorAgentId,
|
|
138
|
+
..."allocation" in value ? { allocation: value.allocation } : {},
|
|
139
|
+
parameters: { timeRange: value.parameters.timeRange }
|
|
140
|
+
};
|
|
141
|
+
};
|
|
77
142
|
const result = (value) => ({
|
|
78
143
|
content: [{
|
|
79
144
|
type: "text",
|
|
@@ -97,14 +162,18 @@ function createPersonalRequestTools(deps) {
|
|
|
97
162
|
name: "personal_request",
|
|
98
163
|
label: "Connected app request",
|
|
99
164
|
parameters: RequestSchema,
|
|
100
|
-
description: "Submit a read-only connected-app request 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.",
|
|
101
166
|
async execute(toolCallId, input) {
|
|
102
167
|
const conversationId = conversation();
|
|
103
168
|
if (input.command === "list") {
|
|
104
169
|
const offset = input.offset ?? 0;
|
|
105
170
|
const items = listPersonalRequests(conversationId, input.limit ?? 10, offset).map((request) => {
|
|
106
|
-
const { result: _result, ...summary } = snapshot(request);
|
|
107
|
-
|
|
171
|
+
const { result: _result, parameters, ...summary } = snapshot(request);
|
|
172
|
+
const { brief: _brief, taskRunId: _taskRunId, cancellationCleanupCompleted: _cleanup, ...queryParameters } = parameters;
|
|
173
|
+
return {
|
|
174
|
+
...summary,
|
|
175
|
+
parameters: queryParameters
|
|
176
|
+
};
|
|
108
177
|
});
|
|
109
178
|
const total = getSqliteDatabase().prepare("SELECT count(*) AS count FROM personal_requests WHERE conversation_id = ?").get(conversationId).count;
|
|
110
179
|
return result(boundedPersonalResult({
|
|
@@ -120,33 +189,106 @@ function createPersonalRequestTools(deps) {
|
|
|
120
189
|
connectorId: input.connectorId,
|
|
121
190
|
accountId: input.accountId,
|
|
122
191
|
objective: input.objective.trim(),
|
|
192
|
+
description: input.description?.trim(),
|
|
123
193
|
timeRange: input.timeRange,
|
|
124
|
-
idempotencyKey: input.idempotencyKey ??
|
|
194
|
+
idempotencyKey: input.idempotencyKey ?? `personal-request-submit:${selectionRequestHash({
|
|
195
|
+
inputId: getSessionInputState(conversationId).activeInputId ?? toolCallId,
|
|
196
|
+
objective: input.objective.trim(),
|
|
197
|
+
description: input.description?.trim(),
|
|
198
|
+
connectorId: input.connectorId,
|
|
199
|
+
accountId: input.accountId,
|
|
200
|
+
timeRange: input.timeRange
|
|
201
|
+
})}`
|
|
125
202
|
});
|
|
126
203
|
publishPersonalRequest(request);
|
|
127
204
|
deps.dispatchTaskRuns?.();
|
|
128
|
-
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
|
+
});
|
|
129
209
|
}
|
|
130
210
|
const request = input.requestId ? getPersonalRequest(input.requestId) : void 0;
|
|
131
211
|
if (!request || request.conversationId !== conversationId) throw new Error("Request does not belong to this conversation");
|
|
132
212
|
if (input.command === "cancel") {
|
|
133
|
-
if (["completed", "failed"].includes(personalRequestSnapshot(request).state)) return result(
|
|
134
|
-
if (request.state === "cancelled") {
|
|
135
|
-
const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
|
|
136
|
-
return result({
|
|
137
|
-
...snapshot(request),
|
|
138
|
-
executionStopConfirmed: stop.executionStopConfirmed
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
|
|
213
|
+
if (["completed", "failed"].includes(personalRequestSnapshot(request).state)) return result(compactSnapshot(request));
|
|
142
214
|
const cancelled = cancelPersonalRequest(request);
|
|
215
|
+
const stop = stopPersonalRequestExecution(cancelled);
|
|
143
216
|
publishPersonalRequest(cancelled);
|
|
144
217
|
return result({
|
|
145
|
-
...cancelled,
|
|
218
|
+
...compactSnapshot(cancelled),
|
|
146
219
|
executionStopConfirmed: stop.executionStopConfirmed
|
|
147
220
|
});
|
|
148
221
|
}
|
|
149
|
-
|
|
222
|
+
const taskTool = createPersonalTaskTool({
|
|
223
|
+
...deps,
|
|
224
|
+
getCurrentAgentId: () => deps.getCurrentAgentId?.() ?? getSessionMetadata(conversationId)?.agentId
|
|
225
|
+
});
|
|
226
|
+
if (input.command === "instruct" && input.timeRange) assertPersonalRequestTimeRange(input.timeRange);
|
|
227
|
+
const instruction = input.command === "instruct" && input.timeRange ? `${input.instruction}\n\nUpdated absolute query range: ${JSON.stringify(input.timeRange)}` : input.instruction;
|
|
228
|
+
if (input.command === "answer" || input.command === "instruct") {
|
|
229
|
+
if ([
|
|
230
|
+
"completed",
|
|
231
|
+
"failed",
|
|
232
|
+
"cancelled"
|
|
233
|
+
].includes(personalRequestSnapshot(request).state)) throw new Error("Request is no longer active");
|
|
234
|
+
if (readCurrentTranscriptId(getSqliteDatabase(), conversationId) !== request.transcriptId) throw new Error("SESSION_CHANGED");
|
|
235
|
+
if (!request.taskId && input.command === "instruct" && request.state === "waiting_connection") {
|
|
236
|
+
const addition = `\n\nSupplemental requirement:\n${instruction.trim()}`;
|
|
237
|
+
if (!request.objective.endsWith(addition)) runSqliteWriteTransaction(() => {
|
|
238
|
+
if (getActiveConnectionWait(conversationId)?.id !== request.connectionWaitId) throw new Error("Connection objective changed");
|
|
239
|
+
reviseCurrentConnectionObjective(conversationId, request.objective + addition);
|
|
240
|
+
const revised = getActiveConnectionWait(conversationId);
|
|
241
|
+
updateConnectionWait({
|
|
242
|
+
...revised,
|
|
243
|
+
checkpoint: {
|
|
244
|
+
...revised.checkpoint,
|
|
245
|
+
timeRange: input.timeRange ?? request.parameters.timeRange
|
|
246
|
+
}
|
|
247
|
+
}, revised.version);
|
|
248
|
+
updatePersonalRequest(request, {
|
|
249
|
+
objective: request.objective + addition,
|
|
250
|
+
parameters: {
|
|
251
|
+
...request.parameters,
|
|
252
|
+
...input.timeRange ? { timeRange: input.timeRange } : {}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
return result({
|
|
257
|
+
...snapshot(getPersonalRequest(request.requestId)),
|
|
258
|
+
instructionStatus: "saved",
|
|
259
|
+
guidance: "Account authorization is still required. The existing Request will create its Task with this requirement after authorization."
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (input.command !== "get" || request.taskId) {
|
|
264
|
+
if (!request.taskId) throw new Error("No Task yet; complete account authorization in the main connection UI");
|
|
265
|
+
const coordinated = await taskTool.execute(toolCallId, {
|
|
266
|
+
...input,
|
|
267
|
+
instruction,
|
|
268
|
+
taskId: request.taskId
|
|
269
|
+
});
|
|
270
|
+
if (input.command === "instruct" && input.timeRange && JSON.parse(coordinated.content[0].text).ok === true) runSqliteWriteTransaction(() => {
|
|
271
|
+
const current = getPersonalRequest(request.requestId);
|
|
272
|
+
updatePersonalRequest(current, { parameters: {
|
|
273
|
+
...current.parameters,
|
|
274
|
+
timeRange: input.timeRange
|
|
275
|
+
} });
|
|
276
|
+
const wait = getActiveConnectionWait(conversationId);
|
|
277
|
+
if (wait && wait.id === current.connectionWaitId) updateConnectionWait({
|
|
278
|
+
...wait,
|
|
279
|
+
checkpoint: {
|
|
280
|
+
...wait.checkpoint,
|
|
281
|
+
timeRange: input.timeRange
|
|
282
|
+
}
|
|
283
|
+
}, wait.version);
|
|
284
|
+
});
|
|
285
|
+
if (input.command !== "get") return coordinated;
|
|
286
|
+
return result({
|
|
287
|
+
...snapshot(request),
|
|
288
|
+
coordination: JSON.parse(coordinated.content[0].text)
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
return result(snapshot(request));
|
|
150
292
|
}
|
|
151
293
|
}];
|
|
152
294
|
}
|
|
@@ -12,20 +12,23 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
|
|
|
12
12
|
taskType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
13
|
requestedAgentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
14
14
|
}>>;
|
|
15
|
-
command: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"get" | "answer" | "retry_allocation" | "selection" | "list" | "cancel" | "submit" | "instruct">[]>;
|
|
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
|
-
|
|
28
|
+
section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<string>[]>>;
|
|
29
|
+
entryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
+
afterSequence: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
31
|
+
bodyOffset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
29
32
|
questionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
33
|
}>;
|
|
31
34
|
export interface PersonalTaskToolDeps extends XopcUseToolDeps {
|
|
@@ -10,13 +10,14 @@ import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
|
10
10
|
import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
|
|
11
11
|
import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
12
12
|
import { boundedPersonalResult } from "./personal-result-budget.js";
|
|
13
|
+
import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
|
|
13
14
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
15
|
+
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
14
16
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
15
17
|
import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
|
|
16
18
|
import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
|
|
17
19
|
import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
|
|
18
20
|
import { assertSpecialistEligible, createSelectedTask } from "../../agent-matching/delegation-service.js";
|
|
19
|
-
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
20
21
|
import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
|
|
21
22
|
import { randomUUID } from "node:crypto";
|
|
22
23
|
import { Type } from "@sinclair/typebox";
|
|
@@ -36,6 +37,8 @@ const PersonalTaskSchema = Type.Object({
|
|
|
36
37
|
Type.Literal("create"),
|
|
37
38
|
Type.Literal("list"),
|
|
38
39
|
Type.Literal("get"),
|
|
40
|
+
Type.Literal("collaboration"),
|
|
41
|
+
Type.Literal("entry"),
|
|
39
42
|
Type.Literal("instruct"),
|
|
40
43
|
Type.Literal("answer"),
|
|
41
44
|
Type.Literal("cancel")
|
|
@@ -81,6 +84,25 @@ const PersonalTaskSchema = Type.Object({
|
|
|
81
84
|
agentId: Type.Optional(Type.String({ description: "Specialist Agent ID. Never use your own ID." })),
|
|
82
85
|
taskId: Type.Optional(Type.String()),
|
|
83
86
|
instruction: Type.Optional(Type.String({ description: "The user’s new direction for this delegated Task." })),
|
|
87
|
+
entryId: Type.Optional(Type.String({ description: "Read one complete collaboration entry, including its question or instruction body." })),
|
|
88
|
+
afterSequence: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
89
|
+
bodyOffset: Type.Optional(Type.Integer({
|
|
90
|
+
minimum: 0,
|
|
91
|
+
description: "Character offset for an entry body; follow nextBodyOffset until absent."
|
|
92
|
+
})),
|
|
93
|
+
section: Type.Optional(Type.Union([
|
|
94
|
+
"task",
|
|
95
|
+
"waits",
|
|
96
|
+
"runs",
|
|
97
|
+
"receipts",
|
|
98
|
+
"context",
|
|
99
|
+
"conversation",
|
|
100
|
+
"sessions",
|
|
101
|
+
"authorityGrants",
|
|
102
|
+
"dependencies",
|
|
103
|
+
"dependents",
|
|
104
|
+
"criterionReviews"
|
|
105
|
+
].map((value) => Type.Literal(value)))),
|
|
84
106
|
questionId: Type.Optional(Type.String({ description: "Collaboration question ID to answer." })),
|
|
85
107
|
expectedOutputs: Type.Optional(Type.Array(Type.String())),
|
|
86
108
|
acceptanceCriteria: Type.Optional(Type.Array(Type.String())),
|
|
@@ -100,13 +122,16 @@ const PersonalTaskModelSchema = Type.Object({
|
|
|
100
122
|
"previousSelectionId",
|
|
101
123
|
"matchId",
|
|
102
124
|
"cursor",
|
|
103
|
-
"requiredTools"
|
|
125
|
+
"requiredTools",
|
|
126
|
+
"acceptanceCriteria"
|
|
104
127
|
]).properties,
|
|
105
128
|
requirements: Type.Optional(Type.Omit(PersonalTaskSchema.properties.requirements, ["requiredTools", "requiredSkills"], { additionalProperties: false })),
|
|
106
129
|
command: Type.Union([
|
|
107
130
|
"submit",
|
|
108
131
|
"list",
|
|
109
132
|
"get",
|
|
133
|
+
"collaboration",
|
|
134
|
+
"entry",
|
|
110
135
|
"instruct",
|
|
111
136
|
"answer",
|
|
112
137
|
"retry_allocation",
|
|
@@ -124,11 +149,16 @@ const PersonalTaskModelSchema = Type.Object({
|
|
|
124
149
|
{
|
|
125
150
|
properties: { command: { enum: [
|
|
126
151
|
"get",
|
|
152
|
+
"collaboration",
|
|
127
153
|
"retry_allocation",
|
|
128
154
|
"cancel"
|
|
129
155
|
] } },
|
|
130
156
|
required: ["taskId"]
|
|
131
157
|
},
|
|
158
|
+
{
|
|
159
|
+
properties: { command: { const: "entry" } },
|
|
160
|
+
required: ["taskId", "entryId"]
|
|
161
|
+
},
|
|
132
162
|
{
|
|
133
163
|
properties: { command: { const: "instruct" } },
|
|
134
164
|
required: ["taskId", "instruction"]
|
|
@@ -164,7 +194,7 @@ function createPersonalTaskTool(deps) {
|
|
|
164
194
|
return {
|
|
165
195
|
name: "personal_task",
|
|
166
196
|
label: "Personal Task",
|
|
167
|
-
description: "Submit objective and a concise complete description, then return after local persistence. Preserve the user request and source references without inventing an execution plan or extra requirements. Omit optional structured fields when they merely repeat the description. Describe required capabilities in the brief; the background Task Router selects one executor and checks its tools. Do not read input files, select Agents or invent tool names before submit. Set requirements.requestedAgentId only for an executor explicitly named by the user, using their ID or display name; preserve explicitly requested requiredSkills. get/list inspect existing Tasks with limit/offset; cancel stops a Task on explicit user instruction and reports execution stop confirmation; instruct/answer send context; retry_allocation retries selection before execution; selection explains assignment. Status and results return automatically. Preserve idempotencyKey on uncertain retries. Report only confirmed states.",
|
|
197
|
+
description: "Submit objective and a concise complete description, then return after local persistence. Preserve the user request and source references without inventing an execution plan or extra requirements. Omit optional structured fields when they merely repeat the description. Describe required capabilities in the brief; the background Task Router selects one executor and checks its tools. Do not read input files, select Agents or invent tool names before submit. Set requirements.requestedAgentId only for an executor explicitly named by the user, using their ID or display name; preserve explicitly requested requiredSkills. get reads Task state, waits, runs, receipts and context; use section and limit/offset for complete paginated details. collaboration reads ordered message previews with afterSequence; entry reads exact message bodies using entryId and nextBodyOffset. Read full questions before answering. Delivery pending means saved, delivered means sent, confirmed means the executor acknowledged it; confirmation alone is not verified completion. get/list inspect existing Tasks with limit/offset; cancel stops a Task on explicit user instruction and reports execution stop confirmation; instruct/answer send context; retry_allocation retries selection before execution; selection explains assignment. Status and results return automatically. Preserve idempotencyKey on uncertain retries. Report only confirmed states.",
|
|
168
198
|
parameters: PersonalTaskModelSchema,
|
|
169
199
|
mutatesWorkspace: true,
|
|
170
200
|
mutationScope: "external",
|
|
@@ -285,9 +315,9 @@ function createPersonalTaskTool(deps) {
|
|
|
285
315
|
createMode: "allocate",
|
|
286
316
|
requirements,
|
|
287
317
|
includeConversationContext: false,
|
|
288
|
-
expectedOutputs: input.expectedOutputs
|
|
289
|
-
acceptanceCriteria: input.acceptanceCriteria
|
|
290
|
-
constraints: input.constraints
|
|
318
|
+
expectedOutputs: input.expectedOutputs,
|
|
319
|
+
acceptanceCriteria: input.acceptanceCriteria,
|
|
320
|
+
constraints: input.constraints,
|
|
291
321
|
idempotencyKey: `personal-submit:${conversationId}:${selectionRequestHash(submissionKey)}`
|
|
292
322
|
};
|
|
293
323
|
if (requirements.requiredSkills?.length) args.body = `${brief.body}\n\nRequired Skills: ${requirements.requiredSkills.join(", ")}. Read and follow these Skills before execution.`;
|
|
@@ -368,9 +398,9 @@ function createPersonalTaskTool(deps) {
|
|
|
368
398
|
agentId,
|
|
369
399
|
createMode: "start",
|
|
370
400
|
includeConversationContext: false,
|
|
371
|
-
expectedOutputs: input.expectedOutputs
|
|
372
|
-
acceptanceCriteria: input.acceptanceCriteria
|
|
373
|
-
constraints: input.constraints
|
|
401
|
+
expectedOutputs: input.expectedOutputs,
|
|
402
|
+
acceptanceCriteria: input.acceptanceCriteria,
|
|
403
|
+
constraints: input.constraints,
|
|
374
404
|
idempotencyKey: key
|
|
375
405
|
};
|
|
376
406
|
} else if (command === "list") {
|
|
@@ -383,6 +413,54 @@ function createPersonalTaskTool(deps) {
|
|
|
383
413
|
const taskId = input.taskId?.trim();
|
|
384
414
|
if (!taskId) throw new Error("taskId is required");
|
|
385
415
|
if (!new TaskOriginRepository().owns(taskId, conversationId)) throw new Error("Task does not belong to this personal conversation");
|
|
416
|
+
if (command === "collaboration" || command === "entry") {
|
|
417
|
+
const board = new TaskCollaborationRepository();
|
|
418
|
+
if (command === "entry") {
|
|
419
|
+
const entry = input.entryId ? board.get(input.entryId) : void 0;
|
|
420
|
+
if (!entry || entry.taskId !== taskId) throw new Error("Entry does not belong to this Task");
|
|
421
|
+
const offset = input.bodyOffset ?? 0;
|
|
422
|
+
const body = entry.body.slice(offset, offset + 4e3);
|
|
423
|
+
const payload = {
|
|
424
|
+
ok: true,
|
|
425
|
+
entry: {
|
|
426
|
+
...entry,
|
|
427
|
+
body
|
|
428
|
+
},
|
|
429
|
+
bodyOffset: offset,
|
|
430
|
+
bodyLength: entry.body.length,
|
|
431
|
+
...offset + body.length < entry.body.length ? { nextBodyOffset: offset + body.length } : {}
|
|
432
|
+
};
|
|
433
|
+
return {
|
|
434
|
+
content: [{
|
|
435
|
+
type: "text",
|
|
436
|
+
text: JSON.stringify(payload)
|
|
437
|
+
}],
|
|
438
|
+
details: {}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
const limit = input.limit ?? 10;
|
|
442
|
+
const entries = board.list(taskId, input.afterSequence ?? 0, limit + 1);
|
|
443
|
+
const items = entries.slice(0, limit).map((entry) => ({
|
|
444
|
+
...entry,
|
|
445
|
+
body: entry.body.slice(0, 600),
|
|
446
|
+
bodyLength: entry.body.length,
|
|
447
|
+
...entry.body.length > 600 ? {
|
|
448
|
+
excerpt: true,
|
|
449
|
+
readEntryId: entry.id
|
|
450
|
+
} : {}
|
|
451
|
+
}));
|
|
452
|
+
return {
|
|
453
|
+
content: [{
|
|
454
|
+
type: "text",
|
|
455
|
+
text: JSON.stringify({
|
|
456
|
+
ok: true,
|
|
457
|
+
items,
|
|
458
|
+
...entries.length > limit ? { nextAfterSequence: items.at(-1)?.sequence } : {}
|
|
459
|
+
})
|
|
460
|
+
}],
|
|
461
|
+
details: {}
|
|
462
|
+
};
|
|
463
|
+
}
|
|
386
464
|
if (command === "cancel") {
|
|
387
465
|
const result = await cancelPersonalTask(taskId, conversationId, input.idempotencyKey ?? toolCallId);
|
|
388
466
|
deps.dispatchTaskRuns?.();
|
|
@@ -410,6 +488,13 @@ function createPersonalTaskTool(deps) {
|
|
|
410
488
|
taskId,
|
|
411
489
|
kind: input.command === "answer" ? "answer" : "instruction",
|
|
412
490
|
body,
|
|
491
|
+
idempotencyKey: input.idempotencyKey?.trim() || `personal-collaboration:${selectionRequestHash({
|
|
492
|
+
inputId: getSessionInputState(conversationId).activeInputId ?? toolCallId,
|
|
493
|
+
taskId,
|
|
494
|
+
kind: input.command,
|
|
495
|
+
body,
|
|
496
|
+
questionId: input.questionId
|
|
497
|
+
})}`,
|
|
413
498
|
...input.command === "answer" ? { causationId: input.questionId.trim() } : {}
|
|
414
499
|
};
|
|
415
500
|
} else args = { taskId };
|
|
@@ -459,20 +544,58 @@ function createPersonalTaskTool(deps) {
|
|
|
459
544
|
details: {}
|
|
460
545
|
};
|
|
461
546
|
}
|
|
462
|
-
if (payload && input.command === "get")
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
547
|
+
if (payload && input.command === "get") {
|
|
548
|
+
const offset = input.offset ?? 0;
|
|
549
|
+
const limit = input.limit ?? 10;
|
|
550
|
+
const read = input.section ? {
|
|
551
|
+
ok: payload.ok,
|
|
552
|
+
[input.section]: payload[input.section]
|
|
553
|
+
} : { ...payload };
|
|
554
|
+
const pagination = {};
|
|
555
|
+
for (const key of [
|
|
556
|
+
"waits",
|
|
557
|
+
"runs",
|
|
558
|
+
"receipts",
|
|
559
|
+
"context",
|
|
560
|
+
"sessions",
|
|
561
|
+
"authorityGrants",
|
|
562
|
+
"dependencies",
|
|
563
|
+
"dependents",
|
|
564
|
+
"criterionReviews"
|
|
565
|
+
]) {
|
|
566
|
+
const value = read[key];
|
|
567
|
+
if (!Array.isArray(value)) continue;
|
|
568
|
+
read[key] = value.slice(offset, offset + limit);
|
|
569
|
+
pagination[key] = {
|
|
570
|
+
total: value.length,
|
|
571
|
+
offset,
|
|
572
|
+
...offset + limit < value.length ? { nextOffset: offset + limit } : {}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
if (!input.section) {
|
|
576
|
+
read.collaboration = new TaskCollaborationRepository().recent(input.taskId, void 0, 10).map((entry) => ({
|
|
577
|
+
...entry,
|
|
578
|
+
body: entry.body.slice(0, 600),
|
|
579
|
+
bodyLength: entry.body.length,
|
|
580
|
+
...entry.body.length > 600 ? {
|
|
581
|
+
excerpt: true,
|
|
582
|
+
readEntryId: entry.id
|
|
583
|
+
} : {}
|
|
584
|
+
}));
|
|
585
|
+
read.allocation = new TaskAllocationRepository().summary(input.taskId);
|
|
586
|
+
read.guidance = "Read entry for complete question/instruction bodies; collaboration with afterSequence pages the whole board. get(section, offset) pages state details. pending is saved, delivered is sent, confirmed is acknowledged; verification and Task acceptance are separate.";
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
content: [{
|
|
590
|
+
type: "text",
|
|
591
|
+
text: JSON.stringify({
|
|
592
|
+
...read,
|
|
593
|
+
pagination
|
|
594
|
+
})
|
|
595
|
+
}],
|
|
596
|
+
details: {}
|
|
597
|
+
};
|
|
598
|
+
}
|
|
476
599
|
if (payload && input.command === "list") return {
|
|
477
600
|
content: [{
|
|
478
601
|
type: "text",
|
|
@@ -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>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ResearchCheckpointUpdateSchema, init_research_checkpoint } from "../orchestration/research-checkpoint.js";
|
|
2
|
+
//#region src/agent/tools/research-checkpoint-tool.ts
|
|
3
|
+
init_research_checkpoint();
|
|
4
|
+
function createResearchCheckpointTool(sink) {
|
|
5
|
+
return {
|
|
6
|
+
name: "research_checkpoint",
|
|
7
|
+
label: "Save research checkpoint",
|
|
8
|
+
description: "Persist findings immediately after verifying each source. Use stable finding ids to update fields; omitted findings are retained. Include public source URLs for confirmed claims. not_disclosed is a valid result; never invent missing prices or limits. nextSteps replaces the unfinished-work list; set it to [] only when all requested fields are addressed, including explicitly undisclosed fields. This writes only this delegated research checkpoint.",
|
|
9
|
+
parameters: ResearchCheckpointUpdateSchema,
|
|
10
|
+
async execute(_id, update, signal) {
|
|
11
|
+
signal?.throwIfAborted();
|
|
12
|
+
const checkpoint = sink.save(update);
|
|
13
|
+
return {
|
|
14
|
+
content: [{
|
|
15
|
+
type: "text",
|
|
16
|
+
text: JSON.stringify({
|
|
17
|
+
saved: true,
|
|
18
|
+
findingCount: checkpoint.findings.length,
|
|
19
|
+
nextSteps: checkpoint.nextSteps
|
|
20
|
+
})
|
|
21
|
+
}],
|
|
22
|
+
details: {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { createResearchCheckpointTool };
|
|
@@ -5,8 +5,8 @@ import { checkedFilePath, readWorkspaceFile } from "../sandbox/fileAccess.js";
|
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
|
-
import { lstat, readlink, realpath } from "node:fs/promises";
|
|
9
8
|
import { Type } from "@sinclair/typebox";
|
|
9
|
+
import { lstat, readlink, realpath } from "node:fs/promises";
|
|
10
10
|
//#region src/agent/tools/review-workspace.ts
|
|
11
11
|
const exec = promisify(execFile);
|
|
12
12
|
function createReviewWorkspaceTool(workspace) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SearchResult } from './types.js';
|
|
2
|
+
export declare const SEARCH_CACHE_TTL_MS: number;
|
|
3
|
+
export interface SearchCacheEntry {
|
|
4
|
+
key: string;
|
|
5
|
+
query: string;
|
|
6
|
+
count: number;
|
|
7
|
+
results: SearchResult[];
|
|
8
|
+
provider: string;
|
|
9
|
+
capturedAt: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SearchCache {
|
|
12
|
+
get(key: string): SearchCacheEntry | undefined;
|
|
13
|
+
set(entry: SearchCacheEntry): void;
|
|
14
|
+
}
|
|
15
|
+
/** Research owns this scope. No account-wide or cross-conversation cache exists. */
|
|
16
|
+
export declare function withSearchCache<T>(cache: SearchCache, run: () => T): T;
|
|
17
|
+
export declare function currentSearchCache(): SearchCache | undefined;
|
|
18
|
+
export declare class SearchCacheWriteError extends Error {
|
|
19
|
+
constructor(cause: unknown);
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
//#region src/agent/tools/search/cache.ts
|
|
3
|
+
const SEARCH_CACHE_TTL_MS = 10 * 6e4;
|
|
4
|
+
const searchCache = new AsyncLocalStorage();
|
|
5
|
+
/** Research owns this scope. No account-wide or cross-conversation cache exists. */
|
|
6
|
+
function withSearchCache(cache, run) {
|
|
7
|
+
return searchCache.run(cache, run);
|
|
8
|
+
}
|
|
9
|
+
function currentSearchCache() {
|
|
10
|
+
return searchCache.getStore();
|
|
11
|
+
}
|
|
12
|
+
var SearchCacheWriteError = class extends Error {
|
|
13
|
+
constructor(cause) {
|
|
14
|
+
super("Search completed but its checkpoint could not be saved", { cause });
|
|
15
|
+
this.name = "SearchCacheWriteError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { SEARCH_CACHE_TTL_MS, SearchCacheWriteError, currentSearchCache, withSearchCache };
|