@xopcai/xopc 0.0.308 → 0.0.311
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/_locales/en/messages.json +8 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
- package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +537 -96
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-wgSB2HYK.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dUotwUO6.js → agent-avatar-dicebear-zKINl7UH.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2ePZKdY.js +1 -0
- package/dist/gateway/static/root/assets/{agents-VPDIGRSS.js → agents-BiD9STyv.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BKHmTb0w.js → api-_aHQA8bd.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BiBXVEvp.js → app-link-wamYbNUl.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-zPz0rOND.js → app-management-settings-panel-C94LAxyt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DhvhR43G.js → appearance-settings-CP01zHvC.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B7DmSJQj.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BQVZMreT.js → archive-plugin-SwWFt5MT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CPE-TMPf.js → attachment-load-DdTFml9l.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C4IAy_zF.js → automations-page-Kmr5WVFp.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-bkijiu-Y.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DgTl7diZ.js → binary-plugins-47UTtDNq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CcOVA-Gw.js → block-editor-DvzZkMG8.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page--zKAgj1k.js → browser-automations-page-DrUKNL9X.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Dhf_MWCf.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BCubrDf8.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-e4T1DEfN.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BfLd2rIJ.js → chat-terminal-dock-Bg_m7HUE.js} +2 -2
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-CosCmVsT.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-BlC1OXX4.js → connector-service-page-BL-hSR7_.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-C0WWxnxJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DqYFVasF.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-CF_zYzxX.js → dependency-picker-DCyyFLKp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDwtLR7Z.js → desktop-pet-CFnnpRA_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-U5wWRH4c.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-BhHxvFO1.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CX5OXxEU.js → extension-debug-page-DA8WJ3-E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BytR1PaY.js → extension-page-C2BIB88m.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkaMJA5F.js → extension-settings-page-kpYo979N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.js → gateway-realtime-CGOW0-b4.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CE9t1yTa.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DRzGnEV-.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-C7Ezx8Du.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Ck_pyDom.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DrtbjL8O.js → imports-page-NPk698vI.js} +1 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
- package/dist/gateway/static/root/assets/index-DxYitLp8.js +79 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BlZh41Xq.js → keyboard-shortcuts-settings-BhreF0_O.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPmynb3x.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DbP7wWuh.js → local-apps-page-DOZZBdqj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C0n66FiO.js → logs-page-M8kz26yo.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-i6GhxpGV.js → management-settings-JLqHYQvY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.js → markdown-view-BDpcjR_Z.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-CnWChQ3Y.js → media-plugins-B75SWUJd.js} +1 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-B_Ft0M32.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C32mxSD-.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BWitjb3e.js → page-tabs-CMlQUzT6.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-cZ2hszQT.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-gmi5LLwM.js → product-open-page-CPoSbglF.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DYttWua0.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D46drWbl.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BSWtko7U.js → registry-api-C0DCx3wv.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9n9Nuhi.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CtOjKGWg.js → runtime-tools-settings-panel-bMLWRApp.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-Dw3hmHAr.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DkyyDcl2.js → schema-form-UVJV_7AS.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C8P6ff91.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-whpUsAy3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C0JDGN_V.js → settings-form-section-BqzOqonM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQ9RJ8-b.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-D3Spald3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8u601m8.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Bt1K657Y.js → share-preview-page-BcgYzA7y.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Bv-2rZ8e.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-LM-cgWUS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ggmb7rCW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-vq5Ujm03.js → skills-page.utils-ADABzrtk.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-DfkcW_Za.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DC4yqDFd.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-1SZ-HFHX.js → theme-store-CegIlB8d.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CTuwTdMm.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-5ZDd9XKh.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-BFKFhdZ0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-B2pZCcxY.js → voice-api-key-field-D3urfd-n.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bptv7bEY.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BijCrNc4.js → workflow-run-setup-panel-Bn2CtRdB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BiCmt98A.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
- package/dist/gateway/static/root/index.html +17 -20
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +12 -11
- package/dist/packages/gateway-contract/src/proactive.js +6 -6
- package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
- package/dist/packages/gateway-contract/src/project-operating.js +1 -4
- package/dist/packages/gateway-contract/src/sessions.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +31 -5
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +18 -4
- package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
- package/dist/src/agent/coding/repository-instructions.js +46 -2
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/data-acquisition/git.d.ts +17 -0
- package/dist/src/agent/data-acquisition/git.js +100 -0
- package/dist/src/agent/data-acquisition/render.d.ts +7 -0
- package/dist/src/agent/data-acquisition/render.js +79 -0
- package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
- package/dist/src/agent/data-acquisition/scheduler.js +53 -0
- package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
- package/dist/src/agent/data-acquisition/schema.js +206 -0
- package/dist/src/agent/data-acquisition/service.d.ts +10 -0
- package/dist/src/agent/data-acquisition/service.js +292 -0
- package/dist/src/agent/data-acquisition/types.d.ts +37 -0
- package/dist/src/agent/data-acquisition/types.js +5 -0
- package/dist/src/agent/embedded/run-turn.js +16 -4
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +3 -0
- package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
- package/dist/src/agent/external-tools/cliProvider.js +317 -0
- package/dist/src/agent/external-tools/composio-provider.js +15 -4
- package/dist/src/agent/external-tools/gateway-tools.js +10 -3
- package/dist/src/agent/external-tools/index.js +14 -1
- package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
- package/dist/src/agent/external-tools/read-policy.js +21 -0
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +4 -1
- package/dist/src/agent/external-tools/types.d.ts +3 -1
- package/dist/src/agent/external-tools/types.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/turn-provenance.js +2 -1
- package/dist/src/agent/orchestration/agent-turn-policy.js +25 -10
- package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
- package/dist/src/agent/orchestration/delegation-scope.js +11 -0
- package/dist/src/agent/prompt/sections/tooling.js +3 -1
- package/dist/src/agent/prompt/subagent-context.js +4 -2
- package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
- package/dist/src/agent/sandbox/fileAccess.js +31 -2
- package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tools/dataBatch.d.ts +4 -0
- package/dist/src/agent/tools/dataBatch.js +50 -0
- package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
- package/dist/src/agent/tools/delegate-tool.js +65 -48
- package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
- package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
- package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
- package/dist/src/agent/tools/delegation-policy.js +93 -0
- package/dist/src/agent/tools/factory.d.ts +4 -0
- package/dist/src/agent/tools/factory.js +45 -5
- package/dist/src/agent/tools/fetch-text.d.ts +7 -0
- package/dist/src/agent/tools/fetch-text.js +86 -0
- package/dist/src/agent/tools/find.js +1 -1
- package/dist/src/agent/tools/grep.js +11 -23
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +10 -2
- package/dist/src/agent/tools/read.js +7 -5
- package/dist/src/agent/tools/repository-search.d.ts +12 -2
- package/dist/src/agent/tools/repository-search.js +127 -74
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
- package/dist/src/agent/tools/search/registry.d.ts +4 -2
- package/dist/src/agent/tools/search/registry.js +5 -3
- package/dist/src/agent/tools/web.js +19 -28
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +46 -43
- package/dist/src/agent/workflow/subagent-runner.js +25 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-config/schema.d.ts +7 -0
- package/dist/src/agent-config/schema.js +2 -0
- package/dist/src/automations/service/automation-service.d.ts +0 -4
- package/dist/src/automations/service/automation-service.js +0 -31
- package/dist/src/capabilities/store-connector.js +46 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/config/schema.d.ts +8 -4
- package/dist/src/config/schema.js +2 -12
- package/dist/src/config/web-patch.js +0 -5
- package/dist/src/connectors/account-selection.d.ts +14 -0
- package/dist/src/connectors/account-selection.js +26 -0
- package/dist/src/connectors/china-catalog.js +93 -226
- package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
- package/dist/src/connectors/cli/adapterRegistry.js +26 -0
- package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/lark.js +143 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
- package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wecom.js +97 -0
- package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
- package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wps365.js +115 -0
- package/dist/src/connectors/cli/assets.d.ts +3 -0
- package/dist/src/connectors/cli/assets.js +44 -0
- package/dist/src/connectors/cli/authorization.d.ts +16 -0
- package/dist/src/connectors/cli/authorization.js +184 -0
- package/dist/src/connectors/cli/distributions.d.ts +4 -0
- package/dist/src/connectors/cli/distributions.js +69 -0
- package/dist/src/connectors/cli/installer.d.ts +5 -0
- package/dist/src/connectors/cli/installer.js +102 -0
- package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
- package/dist/src/connectors/cli/lifecycle.js +19 -0
- package/dist/src/connectors/cli/process.d.ts +18 -0
- package/dist/src/connectors/cli/process.js +100 -0
- package/dist/src/connectors/cli/protocol.d.ts +10 -0
- package/dist/src/connectors/cli/protocol.js +63 -0
- package/dist/src/connectors/cli/runtime.d.ts +10 -0
- package/dist/src/connectors/cli/runtime.js +93 -0
- package/dist/src/connectors/cli/store.d.ts +35 -0
- package/dist/src/connectors/cli/store.js +121 -0
- package/dist/src/connectors/cli/types.d.ts +73 -0
- package/dist/src/connectors/composio-backends.js +1 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +8 -3
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connection-candidates.js +22 -3
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +53 -8
- package/dist/src/connectors/health.js +52 -0
- package/dist/src/connectors/instances.js +5 -1
- package/dist/src/connectors/lifecycle.js +2 -0
- package/dist/src/connectors/principal.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +31 -0
- package/dist/src/connectors/types.d.ts +13 -1
- package/dist/src/connectors/usage.js +1 -1
- package/dist/src/connectors/workflow-preflight.js +8 -4
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/app.d.ts +2 -0
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -15
- package/dist/src/gateway/hono/lib/config-payload.js +0 -11
- package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
- package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
- package/dist/src/gateway/hono/routes/config.js +0 -16
- package/dist/src/gateway/hono/routes/connectors.js +21 -22
- package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
- package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/scenes.js +142 -0
- package/dist/src/gateway/hono/routes/sessions.js +141 -13
- package/dist/src/gateway/hono/routes/tasks.js +0 -46
- package/dist/src/gateway/hono/routes/user-model.js +54 -1
- package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
- package/dist/src/gateway/scenes/browserNotifications.js +54 -0
- package/dist/src/gateway/scenes/host.d.ts +34 -0
- package/dist/src/gateway/scenes/host.js +129 -0
- package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
- package/dist/src/gateway/scenes/mailContext.js +235 -0
- package/dist/src/gateway/security/gateway-scopes.js +0 -4
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
- package/dist/src/gateway/service/config-coordinator.js +0 -16
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -25
- package/dist/src/gateway/service.js +44 -99
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/infra/unhandled-rejections.js +1 -1
- package/dist/src/migrations/runner.js +1 -4
- package/dist/src/notifications/browser-endpoint.d.ts +2 -0
- package/dist/src/notifications/browser-endpoint.js +13 -0
- package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
- package/dist/src/notifications/browserSubscriptions.js +59 -0
- package/dist/src/notifications/browserTransport.d.ts +9 -0
- package/dist/src/notifications/browserTransport.js +64 -0
- package/dist/src/notifications/dispatch.d.ts +46 -0
- package/dist/src/notifications/dispatch.js +109 -0
- package/dist/src/notifications/domain-delivery.d.ts +21 -0
- package/dist/src/notifications/planner.js +0 -36
- package/dist/src/notifications/quietHours.d.ts +6 -0
- package/dist/src/notifications/quietHours.js +23 -0
- package/dist/src/notifications/resultOutbox.d.ts +23 -0
- package/dist/src/notifications/resultOutbox.js +49 -0
- package/dist/src/notifications/service.d.ts +18 -4
- package/dist/src/notifications/service.js +42 -61
- package/dist/src/notifications/store.d.ts +2 -1
- package/dist/src/notifications/store.js +7 -8
- package/dist/src/projects/project-service.d.ts +1 -4
- package/dist/src/projects/project-service.js +2 -30
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +19 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +17 -0
- package/dist/src/providers/xopc-cloud-model-source.js +27 -0
- package/dist/src/scenes/agentExecutor.d.ts +8 -0
- package/dist/src/scenes/agentExecutor.js +63 -0
- package/dist/src/scenes/contracts.d.ts +118 -0
- package/dist/src/scenes/contracts.js +145 -0
- package/dist/src/scenes/execution.d.ts +56 -0
- package/dist/src/scenes/execution.js +168 -0
- package/dist/src/scenes/httpServices.d.ts +34 -0
- package/dist/src/scenes/inbox.d.ts +16 -0
- package/dist/src/scenes/inbox.js +68 -0
- package/dist/src/scenes/mailContext.d.ts +20 -0
- package/dist/src/scenes/mailContext.js +106 -0
- package/dist/src/scenes/mailObservations.d.ts +20 -0
- package/dist/src/scenes/mailObservations.js +107 -0
- package/dist/src/scenes/maintenance.d.ts +3 -0
- package/dist/src/scenes/maintenance.js +24 -0
- package/dist/src/scenes/metrics.d.ts +35 -0
- package/dist/src/scenes/metrics.js +94 -0
- package/dist/src/scenes/notificationEligibility.d.ts +17 -0
- package/dist/src/scenes/notificationEligibility.js +72 -0
- package/dist/src/scenes/notificationPublication.d.ts +7 -0
- package/dist/src/scenes/notificationPublication.js +43 -0
- package/dist/src/scenes/preferences.d.ts +40 -0
- package/dist/src/scenes/preferences.js +108 -0
- package/dist/src/scenes/readiness.d.ts +7 -0
- package/dist/src/scenes/readiness.js +20 -0
- package/dist/src/scenes/repository.d.ts +174 -0
- package/dist/src/scenes/repository.js +740 -0
- package/dist/src/scenes/resultNotifications.d.ts +17 -0
- package/dist/src/scenes/resultNotifications.js +204 -0
- package/dist/src/scenes/runtime.d.ts +25 -0
- package/dist/src/scenes/runtime.js +101 -0
- package/dist/src/scenes/schedule.d.ts +9 -0
- package/dist/src/scenes/schedule.js +45 -0
- package/dist/src/scenes/service.d.ts +29 -0
- package/dist/src/scenes/service.js +116 -0
- package/dist/src/scenes/templates.d.ts +64 -0
- package/dist/src/scenes/templates.js +76 -0
- package/dist/src/scenes/userNotes.d.ts +10 -0
- package/dist/src/scenes/userNotes.js +34 -0
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/share/share-config.js +0 -5
- package/dist/src/share/site-share-config.js +0 -5
- package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
- package/dist/src/storage/sqlite/conversation-repository.js +2 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +4 -2
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +20 -44
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
- package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
- package/dist/src/storage/sqlite/scenes-schema.js +61 -0
- package/dist/src/storage/sqlite/schema.js +4 -10
- package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
- package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
- package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-read-repository.js +35 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +2 -25
- package/dist/src/storage/sqlite/sidebar-layout-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
- package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
- package/dist/src/storage/sqlite/sql-assets.js +18 -0
- package/dist/src/storage/sqlite/transaction.d.ts +2 -0
- package/dist/src/storage/sqlite/transaction.js +20 -1
- package/dist/src/tasks/home-query-service.d.ts +0 -2
- package/dist/src/tasks/home-query-service.js +13 -43
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +4 -5
- package/dist/src/tasks/project-operating-view-service.js +1 -4
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-model/goals.d.ts +10 -0
- package/dist/src/user-model/goals.js +29 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6LflMXr.js +0 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Pmslbzzr.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Fx5VUJRu.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DBms6d35.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-epdDWIZy.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-B0bsDtmP.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-B2JwuTjG.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-Ckgc0Py-.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-By33-bF1.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-CqNE-nf6.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BS9ZjzYJ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C0djIc1J.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CDKj9LQj.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-_YU-1p0z.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CVIvvm4x.js +0 -1
- package/dist/gateway/static/root/assets/home-page-COCHelcL.js +0 -1
- package/dist/gateway/static/root/assets/index-CDfcPiPb.js +0 -79
- package/dist/gateway/static/root/assets/index-CRu1p38D.css +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D7_Raxjw.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C59d8vDW.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C1GBPrVI.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-UaCWCxZv.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-CtSFJxoM.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-ILTmQ1YN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-snl4rOQZ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BbaAcEN3.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DrWL71O8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DiIyMQ52.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-EPazhoZO.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-g2MdRXSZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Wd0uYSPG.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Cz1P-HDH.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BG3A5gPZ.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DQGoFuZO.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DVDlBb95.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-qM5UiTGx.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DRy1RAYH.js +0 -6
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
- package/dist/src/connectors/source-change-publisher.d.ts +0 -17
- package/dist/src/connectors/source-change-publisher.js +0 -151
- package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
- package/dist/src/gateway/heartbeat/check-store.js +0 -74
- package/dist/src/gateway/heartbeat/index.d.ts +0 -1
- package/dist/src/gateway/heartbeat/index.js +0 -2
- package/dist/src/gateway/heartbeat/service.d.ts +0 -55
- package/dist/src/gateway/heartbeat/service.js +0 -228
- package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
- package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
- package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
- package/dist/src/gateway/hono/routes/proactive.js +0 -164
- package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
- package/dist/src/gateway/hono/routes/workspace.js +0 -62
- package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
- package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
- package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
- package/dist/src/migrations/conversation-routing-config.js +0 -42
- package/dist/src/notifications/proactive-channel.d.ts +0 -8
- package/dist/src/notifications/proactive-channel.js +0 -60
- package/dist/src/notifications/proactive-policy.d.ts +0 -3
- package/dist/src/notifications/proactive-policy.js +0 -35
- package/dist/src/notifications/web-push.d.ts +0 -19
- package/dist/src/notifications/web-push.js +0 -185
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +0 -82
- package/dist/src/proactive/events/envelope.d.ts +0 -2
- package/dist/src/proactive/events/envelope.js +0 -54
- package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
- package/dist/src/proactive/events/product-event-bridge.js +0 -87
- package/dist/src/proactive/events/publisher.d.ts +0 -4
- package/dist/src/proactive/events/repository.d.ts +0 -9
- package/dist/src/proactive/events/repository.js +0 -63
- package/dist/src/proactive/events/types.d.ts +0 -44
- package/dist/src/proactive/events/types.js +0 -15
- package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
- package/dist/src/proactive/execution/agent-executor.js +0 -125
- package/dist/src/proactive/execution/authorization.d.ts +0 -7
- package/dist/src/proactive/execution/authorization.js +0 -71
- package/dist/src/proactive/execution/context.d.ts +0 -49
- package/dist/src/proactive/execution/context.js +0 -408
- package/dist/src/proactive/execution/insight.d.ts +0 -14
- package/dist/src/proactive/execution/insight.js +0 -132
- package/dist/src/proactive/execution/repository.d.ts +0 -28
- package/dist/src/proactive/execution/repository.js +0 -211
- package/dist/src/proactive/execution/types.d.ts +0 -80
- package/dist/src/proactive/execution/worker.d.ts +0 -15
- package/dist/src/proactive/execution/worker.js +0 -146
- package/dist/src/proactive/experience.d.ts +0 -89
- package/dist/src/proactive/experience.js +0 -195
- package/dist/src/proactive/follow-ups.d.ts +0 -128
- package/dist/src/proactive/follow-ups.js +0 -182
- package/dist/src/proactive/inbox/cards.d.ts +0 -21
- package/dist/src/proactive/inbox/cards.js +0 -276
- package/dist/src/proactive/inbox/delivery.d.ts +0 -6
- package/dist/src/proactive/inbox/delivery.js +0 -54
- package/dist/src/proactive/inbox/digest.d.ts +0 -8
- package/dist/src/proactive/inbox/digest.js +0 -123
- package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
- package/dist/src/proactive/inbox/lifecycle.js +0 -62
- package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
- package/dist/src/proactive/inbox/notification-policy.js +0 -25
- package/dist/src/proactive/inbox/repository.d.ts +0 -25
- package/dist/src/proactive/inbox/repository.js +0 -244
- package/dist/src/proactive/inbox/service.d.ts +0 -23
- package/dist/src/proactive/inbox/service.js +0 -46
- package/dist/src/proactive/inbox/types.d.ts +0 -64
- package/dist/src/proactive/inbox/worker.d.ts +0 -13
- package/dist/src/proactive/inbox/worker.js +0 -71
- package/dist/src/proactive/index.d.ts +0 -20
- package/dist/src/proactive/index.js +0 -14
- package/dist/src/proactive/mail-thread.d.ts +0 -13
- package/dist/src/proactive/mail-thread.js +0 -55
- package/dist/src/proactive/maintenance.d.ts +0 -4
- package/dist/src/proactive/maintenance.js +0 -28
- package/dist/src/proactive/metrics.d.ts +0 -10
- package/dist/src/proactive/metrics.js +0 -28
- package/dist/src/proactive/policy/presence.d.ts +0 -2
- package/dist/src/proactive/policy/presence.js +0 -30
- package/dist/src/proactive/policy/service.d.ts +0 -54
- package/dist/src/proactive/policy/service.js +0 -123
- package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
- package/dist/src/proactive/routing/batch-repository.js +0 -57
- package/dist/src/proactive/routing/matcher.d.ts +0 -5
- package/dist/src/proactive/routing/matcher.js +0 -57
- package/dist/src/proactive/routing/types.d.ts +0 -44
- package/dist/src/proactive/routing/types.js +0 -1
- package/dist/src/proactive/scenarios/control.d.ts +0 -52
- package/dist/src/proactive/scenarios/control.js +0 -75
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
- package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
- package/dist/src/proactive/scenarios/repository.d.ts +0 -23
- package/dist/src/proactive/scenarios/repository.js +0 -174
- package/dist/src/proactive/scenarios/service.d.ts +0 -15
- package/dist/src/proactive/scenarios/service.js +0 -26
- package/dist/src/proactive/scenarios/types.d.ts +0 -43
- package/dist/src/proactive/scenarios/types.js +0 -1
- package/dist/src/proactive/service.d.ts +0 -25
- package/dist/src/proactive/service.js +0 -78
- package/dist/src/proactive/source-freshness.d.ts +0 -8
- package/dist/src/proactive/source-freshness.js +0 -28
- package/dist/src/proactive/status.d.ts +0 -2
- package/dist/src/proactive/status.js +0 -22
- package/dist/src/proactive/temporal/schedule.d.ts +0 -3
- package/dist/src/proactive/temporal/schedule.js +0 -68
- package/dist/src/proactive/temporal/worker.d.ts +0 -17
- package/dist/src/proactive/temporal/worker.js +0 -129
- package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
- package/dist/src/tasks/project-monitoring-service.js +0 -118
- /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
- /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
- /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
|
@@ -27,7 +27,8 @@ function descriptorRevision(descriptor) {
|
|
|
27
27
|
return crypto.createHash("sha256").update(JSON.stringify({
|
|
28
28
|
toolRef: descriptor.toolRef,
|
|
29
29
|
description: descriptor.description,
|
|
30
|
-
inputSchema: descriptor.inputSchema
|
|
30
|
+
inputSchema: descriptor.inputSchema,
|
|
31
|
+
batchRead: descriptor.batchRead === true
|
|
31
32
|
})).digest("hex").slice(0, 16);
|
|
32
33
|
}
|
|
33
34
|
function versionDescriptor(descriptor) {
|
|
@@ -116,8 +117,10 @@ var ExternalToolService = class {
|
|
|
116
117
|
const descriptor = await provider.describe(params.toolRef);
|
|
117
118
|
if (!descriptor) throw new Error(`External tool is unavailable: ${params.toolRef}`);
|
|
118
119
|
const current = versionDescriptor(descriptor);
|
|
120
|
+
if (params.readOnly && current.batchRead !== true) throw new Error("This external operation is not approved for batch reads");
|
|
119
121
|
if (current.revision !== params.revision) throw new Error(`Tool contract changed. Describe ${params.toolRef} again before executing it.`);
|
|
120
122
|
const args = params.arguments ?? {};
|
|
123
|
+
if (params.readOnly && (provider.source === "composio" || provider.source === "cli") && (typeof args.xopcAccountId !== "string" || !args.xopcAccountId)) throw new Error("Batch connector reads require an explicit xopcAccountId");
|
|
121
124
|
let validate;
|
|
122
125
|
try {
|
|
123
126
|
validate = this.ajv.compile(current.inputSchema);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult, AgentToolUpdateCallback } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
3
|
-
export declare const EXTERNAL_TOOL_SOURCES: readonly ["mcp", "composio", "extension", "memory", "endpoint"];
|
|
3
|
+
export declare const EXTERNAL_TOOL_SOURCES: readonly ["cli", "mcp", "composio", "extension", "memory", "endpoint"];
|
|
4
4
|
export type ExternalToolSource = (typeof EXTERNAL_TOOL_SOURCES)[number];
|
|
5
5
|
export interface ExternalToolSearchHit {
|
|
6
6
|
toolRef: string;
|
|
@@ -12,6 +12,8 @@ export interface ExternalToolSearchHit {
|
|
|
12
12
|
export interface ExternalToolDescriptor extends ExternalToolSearchHit {
|
|
13
13
|
description: string;
|
|
14
14
|
inputSchema: Record<string, unknown>;
|
|
15
|
+
/** Host-curated contract; never copied from remote readOnlyHint annotations. */
|
|
16
|
+
batchRead?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export interface VersionedExternalToolDescriptor extends ExternalToolDescriptor {
|
|
17
19
|
revision: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
2
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
4
4
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
5
5
|
import { resolveConnectorSecretReferences } from "../../connectors/secret-store.js";
|
|
6
6
|
import { redactSensitiveUrlLikeString } from "../../utils/redact-sensitive-url.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_global_singleton, resolveGlobalSingleton } from "../../../utils/global-singleton.js";
|
|
2
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
3
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
+
import { init_global_singleton, resolveGlobalSingleton } from "../../../utils/global-singleton.js";
|
|
4
4
|
import { resolveConnectorSecretReferences } from "../../../connectors/secret-store.js";
|
|
5
5
|
import { redactSensitiveUrlLikeString } from "../../../utils/redact-sensitive-url.js";
|
|
6
6
|
import { resolveMcpTransportConfig } from "../mcp-transport-config.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getSessionMetadata
|
|
1
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
2
|
+
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
2
3
|
import { getConversationRouting } from "../../storage/sqlite/conversation-repository.js";
|
|
3
4
|
import { init_session_key } from "../../routing/session-key.js";
|
|
4
5
|
//#region src/agent/memory/turn-provenance.ts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dataOperationCalls } from "../data-acquisition/schema.js";
|
|
1
2
|
//#region src/agent/orchestration/agent-turn-policy.ts
|
|
2
3
|
/** One user-visible run policy. A fresh instance is created for every embedded run. */
|
|
3
4
|
function createAgentTurnPolicy(options) {
|
|
@@ -11,17 +12,31 @@ function createAgentTurnPolicy(options) {
|
|
|
11
12
|
assistantTurns = 0;
|
|
12
13
|
},
|
|
13
14
|
async beforeToolCall(context, signal) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
15
|
+
const contexts = context.toolCall.name === "data_batch" ? [context, ...dataOperationCalls(context.args).map((call, index) => ({
|
|
16
|
+
...context,
|
|
17
|
+
args: call.args,
|
|
18
|
+
toolCall: {
|
|
19
|
+
...context.toolCall,
|
|
20
|
+
id: `${context.toolCall.id}:${index}`,
|
|
21
|
+
name: call.name,
|
|
22
|
+
arguments: call.args
|
|
23
|
+
}
|
|
24
|
+
}))] : [context];
|
|
25
|
+
for (const item of contexts) {
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
const limit = options.resolveToolLimit?.(item.toolCall.name, item.args);
|
|
28
|
+
if (limit) {
|
|
29
|
+
const count = (toolCalls.get(limit.id) ?? 0) + 1;
|
|
30
|
+
toolCalls.set(limit.id, count);
|
|
31
|
+
if (count > limit.maxCalls) return {
|
|
32
|
+
block: true,
|
|
33
|
+
terminate: true,
|
|
34
|
+
reason: `${limit.id} exceeded its per-turn call limit.`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const decision = await options.authorizeToolCall?.(item, signal);
|
|
38
|
+
if (decision?.block) return decision;
|
|
23
39
|
}
|
|
24
|
-
return options.authorizeToolCall?.(context, signal);
|
|
25
40
|
},
|
|
26
41
|
async afterToolCall(context) {
|
|
27
42
|
if (context.isError) toolFailures += 1;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import type { AgentTurnPolicyOptions } from './agent-turn-policy.js';
|
|
3
|
+
interface DelegationScope {
|
|
4
|
+
tools: AgentTool<any, any>[];
|
|
5
|
+
authorizeToolCall?: AgentTurnPolicyOptions['authorizeToolCall'];
|
|
6
|
+
}
|
|
7
|
+
export declare function withDelegationScope<T>(scope: DelegationScope, run: () => T): T;
|
|
8
|
+
export declare function getDelegationScope(): DelegationScope | undefined;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
//#region src/agent/orchestration/delegation-scope.ts
|
|
3
|
+
const storage = new AsyncLocalStorage();
|
|
4
|
+
function withDelegationScope(scope, run) {
|
|
5
|
+
return storage.run(scope, run);
|
|
6
|
+
}
|
|
7
|
+
function getDelegationScope() {
|
|
8
|
+
return storage.getStore();
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getDelegationScope, withDelegationScope };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/agent/prompt/sections/tooling.ts
|
|
2
2
|
const CORE_TOOL_ORDER = [
|
|
3
3
|
"read_file",
|
|
4
|
+
"data_batch",
|
|
4
5
|
"write_file",
|
|
5
6
|
"apply_patch",
|
|
6
7
|
"grep",
|
|
@@ -42,6 +43,7 @@ const CORE_TOOL_ORDER = [
|
|
|
42
43
|
];
|
|
43
44
|
const CORE_TOOL_SUMMARIES = {
|
|
44
45
|
read_file: "Read targeted file contents before editing",
|
|
46
|
+
data_batch: "Read or search independent data items together; keep dependent queries separate and check partial results",
|
|
45
47
|
write_file: "Create new files or intentional complete rewrites; prefer apply_patch for code changes",
|
|
46
48
|
apply_patch: "Apply source edits with patches that begin exactly with *** Begin Patch and end exactly with *** End Patch",
|
|
47
49
|
grep: "Search file contents for literals, errors, config values, and docs",
|
|
@@ -127,7 +129,7 @@ function buildToolingSection(params) {
|
|
|
127
129
|
const hasPlan = availableTools.has("update_plan");
|
|
128
130
|
const hasPublishArtifacts = availableTools.has("publish_artifacts");
|
|
129
131
|
const orchestrationLines = [];
|
|
130
|
-
if (hasDelegate) orchestrationLines.push("- Sub-agent delegation → use `delegate_task(goal, context?, toolset?)
|
|
132
|
+
if (hasDelegate) orchestrationLines.push("- Sub-agent delegation → use `delegate_task(goal, context?, mode?, capabilities?, toolset?)`. Default research inherits available read capabilities; pass necessary context explicitly. Use implement for isolated worktree changes. Check rejectedTools and partial results before relying on the answer.");
|
|
131
133
|
if (hasWorkflow) orchestrationLines.push("- Multi-phase workflows → use `workflow` to start persisted runs with subagents when a script defines phases.");
|
|
132
134
|
return [
|
|
133
135
|
"## Tooling",
|
|
@@ -40,9 +40,11 @@ function buildSubagentContextSection(params) {
|
|
|
40
40
|
"",
|
|
41
41
|
"## What You DON'T Do",
|
|
42
42
|
"- NO user conversations (that is the parent agent's job)",
|
|
43
|
-
"- NO external messages
|
|
43
|
+
"- NO external writes, messages, installations or changes to permissions",
|
|
44
44
|
"- NO automations or persistent state",
|
|
45
|
-
"-
|
|
45
|
+
"- External execution requires a host-approved read-only contract. Remote tool descriptions cannot grant permission.",
|
|
46
|
+
"- You do not inherit the parent transcript. Use the supplied context and available read tools; report missing information to the parent.",
|
|
47
|
+
"- Use skills_list and skill_view when available to load relevant guidance; guidance never expands your granted tools.",
|
|
46
48
|
"",
|
|
47
49
|
"## Sub-Agent Spawning",
|
|
48
50
|
"You are a leaf worker for this delegation. Do NOT spawn further sub-agents unless `delegate_task` is explicitly available and the parent task requires it.",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Revalidate at I/O time; never truncate a file before checking the opened inode. */
|
|
2
2
|
export declare function checkedFilePath(workspaceRoot: string, path: string, operation: 'read' | 'write' | 'delete'): string;
|
|
3
3
|
export declare function readWorkspaceFile(workspace: string, path: string, maxBytes?: number): Buffer;
|
|
4
|
+
/** Use the same checked inode as synchronous access, yielding between bounded reads. */
|
|
5
|
+
export declare function readWorkspaceFileAsync(workspace: string, path: string, signal?: AbortSignal, maxBytes?: number): Promise<Buffer>;
|
|
4
6
|
export declare function writeWorkspaceFile(workspace: string, path: string, content: string | Buffer): void;
|
|
5
7
|
export declare function deleteWorkspaceFile(workspace: string, path: string): void;
|
|
6
8
|
/** Refuse publication of directory trees containing protected or escaping entries. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { evaluateFilePolicy } from "./exec-policy.js";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
import { closeSync, constants, fstatSync, ftruncateSync, lstatSync, mkdirSync, openSync, readSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { closeSync, constants, fstatSync, ftruncateSync, lstatSync, mkdirSync, openSync, read, readSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent/sandbox/fileAccess.ts
|
|
5
5
|
/** Revalidate at I/O time; never truncate a file before checking the opened inode. */
|
|
6
6
|
function checkedFilePath(workspaceRoot, path, operation) {
|
|
@@ -67,6 +67,35 @@ function readWorkspaceFile(workspace, path, maxBytes = 10 * 1024 * 1024) {
|
|
|
67
67
|
closeSync(fd);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
/** Use the same checked inode as synchronous access, yielding between bounded reads. */
|
|
71
|
+
async function readWorkspaceFileAsync(workspace, path, signal, maxBytes = 10 * 1024 * 1024) {
|
|
72
|
+
signal?.throwIfAborted();
|
|
73
|
+
const fd = openChecked(workspace, path, false);
|
|
74
|
+
try {
|
|
75
|
+
const before = fstatSync(fd);
|
|
76
|
+
if (before.size > maxBytes) throw new Error(`File too large: maximum ${maxBytes} bytes`);
|
|
77
|
+
const chunks = [];
|
|
78
|
+
let total = 0;
|
|
79
|
+
for (;;) {
|
|
80
|
+
signal?.throwIfAborted();
|
|
81
|
+
const chunk = Buffer.alloc(Math.min(64 * 1024, maxBytes - total + 1));
|
|
82
|
+
const count = await new Promise((resolveRead, reject) => {
|
|
83
|
+
read(fd, chunk, 0, chunk.length, null, (error, bytes) => error ? reject(error) : resolveRead(bytes));
|
|
84
|
+
});
|
|
85
|
+
signal?.throwIfAborted();
|
|
86
|
+
if (count === 0) break;
|
|
87
|
+
total += count;
|
|
88
|
+
if (total > maxBytes) throw new Error(`File too large: maximum ${maxBytes} bytes`);
|
|
89
|
+
chunks.push(chunk.subarray(0, count));
|
|
90
|
+
}
|
|
91
|
+
const after = fstatSync(fd);
|
|
92
|
+
const current = statSync(checkedFilePath(workspace, path, "read"));
|
|
93
|
+
if (before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || current.ino !== after.ino || current.dev !== after.dev) throw new Error("File changed during read; retry");
|
|
94
|
+
return Buffer.concat(chunks);
|
|
95
|
+
} finally {
|
|
96
|
+
closeSync(fd);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
70
99
|
function writeWorkspaceFile(workspace, path, content) {
|
|
71
100
|
const fd = openChecked(workspace, path, true);
|
|
72
101
|
try {
|
|
@@ -97,4 +126,4 @@ function assertWorkspaceTreeReadable(workspace, path) {
|
|
|
97
126
|
visit(path);
|
|
98
127
|
}
|
|
99
128
|
//#endregion
|
|
100
|
-
export { assertWorkspaceTreeReadable, checkedFilePath, deleteWorkspaceFile, readWorkspaceFile, writeWorkspaceFile };
|
|
129
|
+
export { assertWorkspaceTreeReadable, checkedFilePath, deleteWorkspaceFile, readWorkspaceFile, readWorkspaceFileAsync, writeWorkspaceFile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
1
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
2
2
|
import "../../storage/sqlite/index.js";
|
|
3
3
|
import { INTERNAL_OUTBOUND_DROP_CHANNEL } from "../../channels/internal-outbound.js";
|
|
4
4
|
//#region src/agent/service/parse-outbound-session-key.ts
|
|
@@ -233,6 +233,7 @@ var AgentService = class {
|
|
|
233
233
|
verboseLevel: config.verboseLevel,
|
|
234
234
|
gatewayClarify: config.gatewayClarify,
|
|
235
235
|
getAutomationService: config.getAutomationService,
|
|
236
|
+
getSceneAccess: config.getSceneAccess,
|
|
236
237
|
getBrowserAutomationService: config.getBrowserAutomationService,
|
|
237
238
|
emitBrowserEvent: config.emitBrowserEvent,
|
|
238
239
|
getNotesService: config.getNotesService,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SceneAccess } from '../scenes/httpServices.js';
|
|
1
2
|
import type { ThinkingLevel } from '@earendil-works/pi-agent-core';
|
|
2
3
|
import type { Config } from '../config/schema.js';
|
|
3
4
|
import type { SessionStore } from '../session/store.js';
|
|
@@ -28,6 +29,7 @@ export interface AgentServiceConfig {
|
|
|
28
29
|
requestClarification: GatewayClarifyRequestFn;
|
|
29
30
|
};
|
|
30
31
|
getAutomationService?: () => AutomationService | undefined;
|
|
32
|
+
getSceneAccess?: () => SceneAccess | undefined;
|
|
31
33
|
getBrowserAutomationService?: () => import('../browser/automations/index.js').BrowserAutomationService | undefined;
|
|
32
34
|
emitBrowserEvent?: (type: string, payload: unknown) => void;
|
|
33
35
|
/** Gateway: exposes first-class xopc product objects for the `xopc_use` tool. */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import { type DataSourceOptions } from '../data-acquisition/service.js';
|
|
3
|
+
export declare function withDataToolPermissions<T>(names: ReadonlySet<string>, run: () => T): T;
|
|
4
|
+
export declare function createDataBatchTool(workspace: string, getAllowedTools: () => ReadonlySet<string>, options?: DataSourceOptions): AgentTool;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { DataBatchSchema } from "../data-acquisition/schema.js";
|
|
4
|
+
import { acquireData } from "../data-acquisition/service.js";
|
|
5
|
+
import { renderDataBatch } from "../data-acquisition/render.js";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
|
+
//#region src/agent/tools/dataBatch.ts
|
|
8
|
+
init_logger();
|
|
9
|
+
const executionTools = new AsyncLocalStorage();
|
|
10
|
+
const log = createLogger("DataAcquisition");
|
|
11
|
+
function withDataToolPermissions(names, run) {
|
|
12
|
+
return executionTools.run(names, run);
|
|
13
|
+
}
|
|
14
|
+
function createDataBatchTool(workspace, getAllowedTools, options = {}) {
|
|
15
|
+
return {
|
|
16
|
+
name: "data_batch",
|
|
17
|
+
label: "Read and search data",
|
|
18
|
+
parameters: DataBatchSchema,
|
|
19
|
+
description: "Acquire up to eight independent file, Git, knowledge, web or host-approved external reads using existing permissions. external_read requires a described batchRead contract, exact revision and explicit account. Items retain status and source. File search patterns use OR. Use original tools for single items; submit dependent queries later. Partial results are not a complete inventory.",
|
|
20
|
+
supportsParallel: true,
|
|
21
|
+
idempotent: false,
|
|
22
|
+
async execute(_id, args, signal) {
|
|
23
|
+
const started = Date.now();
|
|
24
|
+
const active = executionTools.getStore();
|
|
25
|
+
const { text, result } = renderDataBatch(await acquireData(workspace, args, new Set([...getAllowedTools()].filter((name) => !active || active.has(name))), signal, options));
|
|
26
|
+
log.debug({
|
|
27
|
+
toolCallId: _id,
|
|
28
|
+
durationMs: Date.now() - started,
|
|
29
|
+
operations: result.operations.length,
|
|
30
|
+
sourceRequests: result.sourceRequests,
|
|
31
|
+
outputChars: text.length,
|
|
32
|
+
partialCount: result.operations.filter((op) => op.status !== "ok").length
|
|
33
|
+
}, "Batch data acquisition completed");
|
|
34
|
+
return {
|
|
35
|
+
content: [{
|
|
36
|
+
type: "text",
|
|
37
|
+
text
|
|
38
|
+
}],
|
|
39
|
+
details: {
|
|
40
|
+
status: result.operations.every((op) => op.status === "cancelled") ? "cancelled" : result.operations.every((op) => op.status === "error" || op.status === "denied" || op.status === "cancelled") ? "failed" : "completed",
|
|
41
|
+
operationCount: result.operations.length,
|
|
42
|
+
sourceRequests: result.sourceRequests,
|
|
43
|
+
partialCount: result.operations.filter((op) => op.status !== "ok").length
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { createDataBatchTool, withDataToolPermissions };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import { type BuildChildToolsOptions } from '../child-agent-factory.js';
|
|
3
|
-
|
|
3
|
+
import { type DelegationMode } from './delegation-policy.js';
|
|
4
|
+
import type { AgentTurnPolicy } from '../orchestration/agent-turn-policy.js';
|
|
5
|
+
export declare const DEFAULT_DELEGATE_TOOLS: string[];
|
|
4
6
|
/** Tools never passed to a delegated sub-agent (even if requested). */
|
|
5
7
|
export declare const DELEGATE_BLOCKED_TOOLS: Set<string>;
|
|
6
8
|
export interface DelegateToolDeps {
|
|
9
|
+
getParentTools: () => AgentTool<any, any>[];
|
|
10
|
+
createParentPolicy?: () => AgentTurnPolicy;
|
|
7
11
|
workspace: string;
|
|
8
12
|
getSubagentModel: () => import('@earendil-works/pi-ai').Model<import('@earendil-works/pi-ai').Api>;
|
|
9
13
|
bus: import('../../infra/bus/index.js').MessageBus;
|
|
@@ -23,6 +27,5 @@ export interface DelegateToolDeps {
|
|
|
23
27
|
*/
|
|
24
28
|
buildChildTools: (opts: BuildChildToolsOptions) => AgentTool<any, any>[];
|
|
25
29
|
}
|
|
26
|
-
export declare
|
|
27
|
-
export declare function delegateToolNames(mode: 'inspect' | 'review' | 'implement', requested?: string[]): string[];
|
|
30
|
+
export declare function delegateToolNames(mode: DelegationMode, requested?: string[]): string[];
|
|
28
31
|
export declare function createDelegateTool(deps: DelegateToolDeps): AgentTool;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
2
2
|
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
3
3
|
import "../external-tools/index.js";
|
|
4
|
+
import { getDelegationScope } from "../orchestration/delegation-scope.js";
|
|
4
5
|
import { createDelegateChildHandle } from "../child-agent-factory.js";
|
|
5
6
|
import { runGit } from "../../execution-environments/git.js";
|
|
6
7
|
import { LocalWorktreeManager } from "../../execution-environments/local-worktree-manager.js";
|
|
7
8
|
import { SessionEnvironmentService } from "../../execution-environments/session-environment-service.js";
|
|
9
|
+
import { DELEGATION_CAPABILITIES, DELEGATION_TOOL_CAPABILITIES, protectDelegatedTool, resolveDelegationTools } from "./delegation-policy.js";
|
|
8
10
|
import { Type } from "@sinclair/typebox";
|
|
9
11
|
//#region src/agent/tools/delegate-tool.ts
|
|
10
|
-
const DEFAULT_DELEGATE_TOOLS =
|
|
11
|
-
"exec_command",
|
|
12
|
-
"read_file",
|
|
13
|
-
"write_file",
|
|
14
|
-
"apply_patch",
|
|
15
|
-
"grep",
|
|
16
|
-
"find",
|
|
17
|
-
"list_dir",
|
|
18
|
-
"web_search",
|
|
19
|
-
"web_fetch"
|
|
20
|
-
];
|
|
12
|
+
const DEFAULT_DELEGATE_TOOLS = resolveDelegationTools(Object.keys(DELEGATION_TOOL_CAPABILITIES), "research").granted;
|
|
21
13
|
/** Tools never passed to a delegated sub-agent (even if requested). */
|
|
22
14
|
const DELEGATE_BLOCKED_TOOLS = new Set([
|
|
23
15
|
"delegate_task",
|
|
@@ -25,39 +17,27 @@ const DELEGATE_BLOCKED_TOOLS = new Set([
|
|
|
25
17
|
"send_message",
|
|
26
18
|
"send_media",
|
|
27
19
|
"todo",
|
|
28
|
-
"session_search",
|
|
29
|
-
"user_context_search",
|
|
30
|
-
"user_context_get",
|
|
31
20
|
"user_context_update",
|
|
32
|
-
"knowledge_search",
|
|
33
|
-
"knowledge_get",
|
|
34
21
|
"knowledge_write",
|
|
35
22
|
"automation",
|
|
36
|
-
"skills_list",
|
|
37
|
-
"skill_view",
|
|
38
23
|
"skill_manage",
|
|
39
|
-
"skills_marketplace_search",
|
|
40
24
|
"skill_install",
|
|
41
|
-
EXTERNAL_TOOL_NAMES.
|
|
42
|
-
EXTERNAL_TOOL_NAMES.
|
|
43
|
-
EXTERNAL_TOOL_NAMES.execute,
|
|
25
|
+
EXTERNAL_TOOL_NAMES.requireConnection,
|
|
26
|
+
EXTERNAL_TOOL_NAMES.updateConnectionObjective,
|
|
44
27
|
"managed_job"
|
|
45
28
|
]);
|
|
46
|
-
const INSPECTION_TOOLS = new Set([
|
|
47
|
-
"read_file",
|
|
48
|
-
"grep",
|
|
49
|
-
"find",
|
|
50
|
-
"list_dir",
|
|
51
|
-
"review_workspace"
|
|
52
|
-
]);
|
|
53
29
|
const DelegateTaskSchema = Type.Object({
|
|
54
30
|
goal: Type.String({ minLength: 1 }),
|
|
55
31
|
context: Type.Optional(Type.String()),
|
|
56
32
|
mode: Type.Optional(Type.Union([
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
33
|
+
"inspect",
|
|
34
|
+
"read",
|
|
35
|
+
"research",
|
|
36
|
+
"review",
|
|
37
|
+
"implement",
|
|
38
|
+
"custom"
|
|
39
|
+
].map((mode) => Type.Literal(mode)))),
|
|
40
|
+
capabilities: Type.Optional(Type.Array(Type.Union(DELEGATION_CAPABILITIES.map((capability) => Type.Literal(capability))), { description: "Optional capability subset. custom requires explicit capabilities; browser is always opt-in. Writes and commands require implement." })),
|
|
61
41
|
toolset: Type.Optional(Type.Array(Type.String())),
|
|
62
42
|
maxIterations: Type.Optional(Type.Integer({
|
|
63
43
|
minimum: 1,
|
|
@@ -65,26 +45,38 @@ const DelegateTaskSchema = Type.Object({
|
|
|
65
45
|
}))
|
|
66
46
|
});
|
|
67
47
|
function delegateToolNames(mode, requested) {
|
|
68
|
-
|
|
69
|
-
...DEFAULT_DELEGATE_TOOLS,
|
|
70
|
-
"review_workspace",
|
|
71
|
-
"language_diagnostics"
|
|
72
|
-
]) : INSPECTION_TOOLS;
|
|
73
|
-
return [...new Set(requested ?? [...available])].filter((name) => available.has(name) && !DELEGATE_BLOCKED_TOOLS.has(name));
|
|
48
|
+
return resolveDelegationTools(Object.keys(DELEGATION_TOOL_CAPABILITIES), mode, requested).granted;
|
|
74
49
|
}
|
|
75
50
|
function createDelegateTool(deps) {
|
|
76
51
|
return {
|
|
77
52
|
name: "delegate_task",
|
|
78
53
|
label: "Delegate task",
|
|
79
54
|
parameters: DelegateTaskSchema,
|
|
80
|
-
description: "
|
|
55
|
+
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. Up to 60 tool calls, 100k tokens and five minutes. Reports rejected tools and their reasons.",
|
|
81
56
|
supportsParallel: false,
|
|
82
57
|
idempotent: false,
|
|
83
58
|
async execute(_id, input, signal) {
|
|
84
59
|
signal?.throwIfAborted();
|
|
85
|
-
const mode = input.mode ?? "
|
|
86
|
-
const
|
|
87
|
-
|
|
60
|
+
const mode = input.mode ?? "research";
|
|
61
|
+
const scope = getDelegationScope();
|
|
62
|
+
const parentTools = scope?.tools ?? deps.getParentTools();
|
|
63
|
+
const access = resolveDelegationTools(parentTools.map((tool) => tool.name), mode, input.toolset, input.capabilities);
|
|
64
|
+
const tools = access.granted;
|
|
65
|
+
if (!tools.length) return {
|
|
66
|
+
content: [{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: JSON.stringify({
|
|
69
|
+
error: "No permitted tools in the requested delegation",
|
|
70
|
+
...access
|
|
71
|
+
})
|
|
72
|
+
}],
|
|
73
|
+
details: {
|
|
74
|
+
status: "failed",
|
|
75
|
+
mode,
|
|
76
|
+
grantedTools: tools,
|
|
77
|
+
rejectedTools: access.rejected
|
|
78
|
+
}
|
|
79
|
+
};
|
|
88
80
|
const parentConversationId = deps.getCurrentContext?.()?.conversationId;
|
|
89
81
|
const model = deps.getSubagentModel();
|
|
90
82
|
let workspace = deps.workspace, environmentId;
|
|
@@ -99,7 +91,8 @@ function createDelegateTool(deps) {
|
|
|
99
91
|
workspace = environment.rootPath;
|
|
100
92
|
environmentId = environment.id;
|
|
101
93
|
}
|
|
102
|
-
const revision = await readWorkspaceRevision(workspace);
|
|
94
|
+
const revision = mode === "review" ? await readWorkspaceRevision(workspace) : void 0;
|
|
95
|
+
const authorizeToolCall = scope?.authorizeToolCall ?? deps.createParentPolicy?.().beforeToolCall;
|
|
103
96
|
const child = createDelegateChildHandle({
|
|
104
97
|
workspace,
|
|
105
98
|
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,
|
|
@@ -111,7 +104,25 @@ function createDelegateTool(deps) {
|
|
|
111
104
|
bus: deps.bus,
|
|
112
105
|
getConfig: deps.getConfig,
|
|
113
106
|
toolExecutorConfig: deps.toolExecutorConfig,
|
|
114
|
-
|
|
107
|
+
authorizeToolCall,
|
|
108
|
+
buildChildTools: (opts) => {
|
|
109
|
+
const local = mode === "implement" ? new Map(deps.buildChildTools(opts).map((tool) => [tool.name, tool])) : void 0;
|
|
110
|
+
const rebound = new Set([
|
|
111
|
+
"read_file",
|
|
112
|
+
"grep",
|
|
113
|
+
"find",
|
|
114
|
+
"list_dir",
|
|
115
|
+
"review_workspace",
|
|
116
|
+
"write_file",
|
|
117
|
+
"apply_patch",
|
|
118
|
+
"exec_command",
|
|
119
|
+
"language_diagnostics"
|
|
120
|
+
]);
|
|
121
|
+
return parentTools.flatMap((tool) => {
|
|
122
|
+
const candidate = local && rebound.has(tool.name) ? local.get(tool.name) : tool;
|
|
123
|
+
return candidate ? [protectDelegatedTool(candidate)] : [];
|
|
124
|
+
});
|
|
125
|
+
},
|
|
115
126
|
verifyChanges: mode === "implement"
|
|
116
127
|
});
|
|
117
128
|
const abort = () => child.abort();
|
|
@@ -119,8 +130,8 @@ function createDelegateTool(deps) {
|
|
|
119
130
|
if (signal?.aborted) abort();
|
|
120
131
|
try {
|
|
121
132
|
const result = await child.run();
|
|
122
|
-
const currentRevision = await readWorkspaceRevision(workspace);
|
|
123
|
-
const stale = mode
|
|
133
|
+
const currentRevision = mode === "review" ? await readWorkspaceRevision(workspace) : void 0;
|
|
134
|
+
const stale = mode === "review" && (!revision || revision !== currentRevision);
|
|
124
135
|
const patch = mode === "implement" ? await runGit(workspace, [
|
|
125
136
|
"diff",
|
|
126
137
|
"--no-ext-diff",
|
|
@@ -134,6 +145,7 @@ function createDelegateTool(deps) {
|
|
|
134
145
|
text: [
|
|
135
146
|
result.summary,
|
|
136
147
|
stale ? "Workspace changed or could not be fingerprinted; review findings require revalidation." : "",
|
|
148
|
+
access.rejected.length ? `Rejected tools: ${JSON.stringify(access.rejected)}` : "",
|
|
137
149
|
environmentId ? `Changes retained in ${workspace} (environment ${environmentId}). Review and integrate from this workspace, then verify the parent workspace again.` : "",
|
|
138
150
|
patch ? `Patch preview:\n${patch.slice(0, 3e4)}` : ""
|
|
139
151
|
].filter(Boolean).join("\n\n")
|
|
@@ -142,6 +154,8 @@ function createDelegateTool(deps) {
|
|
|
142
154
|
status: stale && result.status === "success" ? "partial" : result.status,
|
|
143
155
|
mode,
|
|
144
156
|
summary: result.summary,
|
|
157
|
+
grantedTools: tools,
|
|
158
|
+
rejectedTools: access.rejected,
|
|
145
159
|
iterations: result.toolIterations,
|
|
146
160
|
revision: currentRevision,
|
|
147
161
|
reviewedRevision: revision,
|
|
@@ -161,6 +175,9 @@ function createDelegateTool(deps) {
|
|
|
161
175
|
}],
|
|
162
176
|
details: {
|
|
163
177
|
status: signal?.aborted ? "cancelled" : "failed",
|
|
178
|
+
mode,
|
|
179
|
+
grantedTools: tools,
|
|
180
|
+
rejectedTools: access.rejected,
|
|
164
181
|
...environmentId ? {
|
|
165
182
|
environmentId,
|
|
166
183
|
workspace
|
|
@@ -174,4 +191,4 @@ function createDelegateTool(deps) {
|
|
|
174
191
|
};
|
|
175
192
|
}
|
|
176
193
|
//#endregion
|
|
177
|
-
export { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS,
|
|
194
|
+
export { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, createDelegateTool, delegateToolNames };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
/** Noninteractive callers cannot silently turn an ask policy into an allow. */
|
|
3
|
+
export declare function createDelegationParentPolicy(options: {
|
|
4
|
+
getConfig: () => Config | undefined;
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
agentId?: string;
|
|
7
|
+
}): import("../orchestration/agent-turn-policy.js").AgentTurnPolicy;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
2
|
+
import { parseExternalToolRef } from "../external-tools/refs.js";
|
|
3
|
+
import { mcpToolPolicyId } from "../mcp/bundle-mcp-policy.js";
|
|
4
|
+
import { createAgentTurnPolicy } from "../orchestration/agent-turn-policy.js";
|
|
5
|
+
//#region src/agent/tools/delegation-parent-policy.ts
|
|
6
|
+
/** Noninteractive callers cannot silently turn an ask policy into an allow. */
|
|
7
|
+
function createDelegationParentPolicy(options) {
|
|
8
|
+
const policies = (name, args) => {
|
|
9
|
+
const config = options.getConfig();
|
|
10
|
+
if (!config) return [];
|
|
11
|
+
const resolved = options.conversationId ? resolveEffectiveAgentConfigForSession(config, options.conversationId) : options.agentId ? resolveEffectiveAgentConfigForAgent(config, options.agentId) : resolveEffectiveAgentConfigForSession(config, void 0);
|
|
12
|
+
const names = [name];
|
|
13
|
+
if (name === "xopc_tool_execute") {
|
|
14
|
+
const parsed = parseExternalToolRef(String(args?.toolRef ?? ""), "mcp");
|
|
15
|
+
const ref = String(args?.toolRef ?? "");
|
|
16
|
+
names.push(parsed ? mcpToolPolicyId(parsed.namespace, parsed.toolName) : ref);
|
|
17
|
+
}
|
|
18
|
+
return names.flatMap((id) => resolved.config.tools[id] ? [{
|
|
19
|
+
id,
|
|
20
|
+
...resolved.config.tools[id]
|
|
21
|
+
}] : []);
|
|
22
|
+
};
|
|
23
|
+
return createAgentTurnPolicy({
|
|
24
|
+
authorizeToolCall: async (context) => {
|
|
25
|
+
const blocked = policies(context.toolCall.name, context.args).find((policy) => policy.mode !== "allow");
|
|
26
|
+
return blocked ? {
|
|
27
|
+
block: true,
|
|
28
|
+
reason: `${blocked.id} requires parent authorization (${blocked.mode}).`
|
|
29
|
+
} : void 0;
|
|
30
|
+
},
|
|
31
|
+
resolveToolLimit: (name, args) => {
|
|
32
|
+
const limited = policies(name, args).filter((policy) => policy.maxCallsPerTurn).sort((a, b) => a.maxCallsPerTurn - b.maxCallsPerTurn)[0];
|
|
33
|
+
return limited ? {
|
|
34
|
+
id: limited.id,
|
|
35
|
+
maxCalls: limited.maxCallsPerTurn
|
|
36
|
+
} : void 0;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createDelegationParentPolicy };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
export declare const DELEGATION_CAPABILITIES: readonly ["local_read", "web_read", "knowledge_read", "skills_read", "external_read", "local_write", "command", "browser"];
|
|
3
|
+
export type DelegationCapability = typeof DELEGATION_CAPABILITIES[number];
|
|
4
|
+
export type DelegationMode = 'inspect' | 'read' | 'research' | 'review' | 'implement' | 'custom';
|
|
5
|
+
/** Host-owned classifications. New tools fail closed until classified. */
|
|
6
|
+
export declare const DELEGATION_TOOL_CAPABILITIES: Readonly<Record<string, DelegationCapability>>;
|
|
7
|
+
export declare function delegationCapabilities(mode: DelegationMode, requested?: DelegationCapability[]): Set<DelegationCapability>;
|
|
8
|
+
export declare function resolveDelegationTools(parentNames: readonly string[], mode: DelegationMode, requested?: string[], capabilities?: DelegationCapability[]): {
|
|
9
|
+
granted: string[];
|
|
10
|
+
rejected: {
|
|
11
|
+
tool: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
/** Always enforce the external read contract, even when the child explicitly sends readOnly:false. */
|
|
16
|
+
export declare function protectDelegatedTool(tool: AgentTool<any, any>): AgentTool<any, any>;
|