@akira-tl/forgerelay 0.8.8 → 0.8.10
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/CHANGELOG.md +32 -0
- package/README.md +10 -18
- package/capabilities/code-intelligence/GUIDE.md +7 -3
- package/capabilities/host-integration/GUIDE.md +2 -2
- package/capabilities/subagents/GUIDE.md +9 -0
- package/capabilities/{workspace-tasks → workspace/workspace-tasks}/GUIDE.md +6 -0
- package/dist/activity/{audit-store.js → history/audit-store.js} +129 -21
- package/dist/activity/history/bash-output-store.js +250 -0
- package/dist/activity/{host-turn-store.js → history/host-turn-store.js} +4 -1
- package/dist/activity/{query-service.js → history/query-service.js} +13 -7
- package/dist/activity/{lifecycle.js → runtime/lifecycle.js} +1 -1
- package/dist/activity/{mcp-query-tools.js → runtime/mcp-query-tools.js} +3 -3
- package/dist/activity/storage/history.js +12 -0
- package/dist/activity/storage/paths.js +56 -0
- package/dist/activity/storage/segmented-log.js +149 -0
- package/dist/cli/init.js +180 -0
- package/dist/cli/setup-support.js +181 -0
- package/dist/cli.js +23 -216
- package/dist/lsp/code-intelligence.js +18 -4
- package/dist/lsp/runtime/diagnostic-snapshots.js +52 -1
- package/dist/lsp/runtime/managed-language-servers.js +172 -0
- package/dist/lsp/runtime/manager.js +37 -2
- package/dist/lsp/runtime/process-launch.js +3 -0
- package/dist/lsp/test-support/server-fixture.js +14 -11
- package/dist/mcp/filesystem/filesystem-tools.js +245 -0
- package/dist/mcp/hooks/command-runner.js +79 -0
- package/dist/{hook-cli.js → mcp/hooks/hook-cli.js} +1 -1
- package/dist/{hooks.js → mcp/hooks/hooks.js} +3 -80
- package/dist/{oauth-provider.js → mcp/oauth/oauth-provider.js} +1 -1
- package/dist/{oauth-store.js → mcp/oauth/oauth-store.js} +5 -4
- package/dist/{operations → mcp/operations}/native-bulk-mutations.js +2 -2
- package/dist/mcp/panel/app.js +143 -0
- package/dist/{mcp-app-template.js → mcp/panel/mcp-app-template.js} +2 -38
- package/dist/{process-platform.js → mcp/process/process-platform.js} +21 -9
- package/dist/{process-sessions.js → mcp/process/process-sessions.js} +3 -3
- package/dist/mcp/process/runtime.js +257 -0
- package/dist/mcp/process/tools.js +346 -0
- package/dist/mcp/server/core/activity-support.js +70 -0
- package/dist/{capabilities.js → mcp/server/core/capabilities.js} +5 -3
- package/dist/{capability-registry.js → mcp/server/core/capability-registry.js} +9 -4
- package/dist/mcp/server/core/capability-support.js +90 -0
- package/dist/mcp/server/core/schemas.js +216 -0
- package/dist/mcp/server/core/tool-support.js +210 -0
- package/dist/mcp/server/core/version.js +9 -0
- package/dist/mcp/server/operations/runtime/filesystem-tools.js +455 -0
- package/dist/mcp/server/operations/runtime/mutation-diagnostics.js +54 -0
- package/dist/mcp/server/operations/runtime/operation-runtime.js +524 -0
- package/dist/mcp/server/transport/http-server.js +301 -0
- package/dist/mcp/server/transport/http-support.js +43 -0
- package/dist/mcp/server/workspace/runtime/workspace-open-presentation.js +242 -0
- package/dist/mcp/server/workspace/runtime/workspace-open-schema.js +187 -0
- package/dist/mcp/server/workspace/runtime/workspace-open.js +555 -0
- package/dist/mcp/server/workspace/runtime/workspace-tools.js +601 -0
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/{config.js → runtime/config/config.js} +4 -3
- package/dist/{user-config.js → runtime/config/user-config.js} +14 -63
- package/dist/{db → runtime/state/db}/client.js +1 -1
- package/dist/{db → runtime/state/db}/migrations.js +34 -3
- package/dist/runtime/state/lock/file-lock.js +130 -0
- package/dist/runtime/testing/server-fixture.js +190 -0
- package/dist/server.js +133 -4189
- package/dist/subagents/providers/adapters/claude.js +86 -52
- package/dist/subagents/providers/adapters/codex.js +103 -39
- package/dist/subagents/providers/adapters/opencode.js +114 -84
- package/dist/subagents/providers/adapters/pi.js +59 -8
- package/dist/subagents/providers/availability.js +15 -30
- package/dist/subagents/providers/runtime/external-command.js +56 -0
- package/dist/subagents/sessions/capability.js +1 -1
- package/dist/subagents/sessions/execution.js +1 -1
- package/dist/subagents/sessions/mcp/activity-audit-test-support.js +30 -0
- package/dist/subagents/sessions/store.js +1 -1
- package/dist/ui/.vite/manifest.json +342 -410
- package/dist/ui/activity-panel-app.html +2 -4
- package/dist/ui/assets/activity-panel-app-7Xe0alhm.css +1 -0
- package/dist/ui/assets/activity-panel-app-Sl1Jro8v.js +115 -0
- package/dist/ui/assets/angular-html-B_yn91wW.js +1 -0
- package/dist/ui/assets/{angular-ts-Bxh4-O1-.js → angular-ts-DSgtloKz.js} +1 -1
- package/dist/ui/assets/{apl-BmYHKQ6m.js → apl-NatWtF8X.js} +1 -1
- package/dist/ui/assets/{astro-C51vqDKq.js → astro-BYFEVBuN.js} +1 -1
- package/dist/ui/assets/{blade-CdhVsmwq.js → blade-DoO7yvMR.js} +1 -1
- package/dist/ui/assets/c-Rl2hMCcg.js +1 -0
- package/dist/ui/assets/{cobol-Cf6azoN_.js → cobol-ByC5mWiB.js} +1 -1
- package/dist/ui/assets/{coffee-vVdGzlmt.js → coffee-Dez77Qov.js} +1 -1
- package/dist/ui/assets/cpp-DtaAQT9h.js +1 -0
- package/dist/ui/assets/{crystal-5UZy6KIX.js → crystal-Bgmbf8ec.js} +1 -1
- package/dist/ui/assets/css-C1tjBtVN.js +1 -0
- package/dist/ui/assets/{edge-CESgo4ia.js → edge-DeH6u8Wg.js} +1 -1
- package/dist/ui/assets/{elixir-9FKfw4cJ.js → elixir-_H3KnmWT.js} +1 -1
- package/dist/ui/assets/{elm-Dv7A0aLa.js → elm-CsCe3U28.js} +1 -1
- package/dist/ui/assets/{erb-DHFmDvM0.js → erb-CbM-L2g8.js} +1 -1
- package/dist/ui/assets/{git-rebase-utbU6CzV.js → git-rebase-D0s5pDh9.js} +1 -1
- package/dist/ui/assets/{glimmer-js-t2kiCkyB.js → glimmer-js-BfOToq_A.js} +1 -1
- package/dist/ui/assets/{glimmer-ts-F0Jv5okV.js → glimmer-ts-CCUOkL2K.js} +1 -1
- package/dist/ui/assets/glsl-DH4ec9dE.js +1 -0
- package/dist/ui/assets/graphql-DilAMBoI.js +1 -0
- package/dist/ui/assets/{hack-8yjdbaSA.js → hack-BDkNDZlF.js} +1 -1
- package/dist/ui/assets/haml-D_QBp6K7.js +1 -0
- package/dist/ui/assets/{handlebars-BBFEg4Lo.js → handlebars-DePUrTpC.js} +1 -1
- package/dist/ui/assets/heavy-payload-DOwZpO6n.js +290 -0
- package/dist/ui/assets/html-By4dNnM4.js +1 -0
- package/dist/ui/assets/{html-derivative-DJAQcZyc.js → html-derivative-DDw9Ef4Q.js} +1 -1
- package/dist/ui/assets/{http-Dg5LSYRK.js → http-B0QxWc9M.js} +1 -1
- package/dist/ui/assets/{hurl-Y5uYzMZR.js → hurl-vMQ4lda1.js} +1 -1
- package/dist/ui/assets/java-DYRe2lWG.js +1 -0
- package/dist/ui/assets/javascript-CxyGqwcL.js +1 -0
- package/dist/ui/assets/{jinja-Bt30h8Ik.js → jinja-JUwV-fZt.js} +1 -1
- package/dist/ui/assets/{jison-D5uZ1Nyo.js → jison-7ZqCEvS8.js} +1 -1
- package/dist/ui/assets/json-dbltgiiA.js +1 -0
- package/dist/ui/assets/jsx-oDopT7YQ.js +1 -0
- package/dist/ui/assets/{julia-76hRaaGz.js → julia-CkKiNSav.js} +1 -1
- package/dist/ui/assets/{just-CDE7W0vW.js → just-DuqCAKJ3.js} +1 -1
- package/dist/ui/assets/{latex-CVO2Byab.js → latex-sudcRDSn.js} +1 -1
- package/dist/ui/assets/{liquid-CA-AS3EX.js → liquid-Di-08Js7.js} +1 -1
- package/dist/ui/assets/lua-YlqdMoV0.js +1 -0
- package/dist/ui/assets/{marko-_BWrPfny.js → marko-CJRNyJDb.js} +1 -1
- package/dist/ui/assets/{mdc-PyJv85eS.js → mdc-t12CzZHs.js} +1 -1
- package/dist/ui/assets/{nginx-DAWVw8yu.js → nginx-57-b4XwT.js} +1 -1
- package/dist/ui/assets/{nim-CKE1dzpU.js → nim-BzrswYQa.js} +1 -1
- package/dist/ui/assets/{perl-BBhWva19.js → perl-D9JR_iIh.js} +1 -1
- package/dist/ui/assets/{php-ChIeaAoF.js → php-Py2gFHil.js} +1 -1
- package/dist/ui/assets/{pug-CMgI5afi.js → pug-PzLLy0h1.js} +1 -1
- package/dist/ui/assets/{qml-CjxTkcFH.js → qml-By8fwgV4.js} +1 -1
- package/dist/ui/assets/r-CcezTbLq.js +1 -0
- package/dist/ui/assets/{razor-i4DbHr8p.js → razor-dG-vdhL_.js} +1 -1
- package/dist/ui/assets/regexp-BlsQ-N_8.js +1 -0
- package/dist/ui/assets/{rst-oy_97Kl4.js → rst-C2awDCat.js} +1 -1
- package/dist/ui/assets/{ruby-C5zYZIyl.js → ruby-zA2W_49d.js} +1 -1
- package/dist/ui/assets/{sas-BnMEh2S3.js → sas-D49bhyaN.js} +1 -1
- package/dist/ui/assets/scss-BQb-cp01.js +1 -0
- package/dist/ui/assets/shellscript-Dga4H_Ni.js +1 -0
- package/dist/ui/assets/{shellsession-BpE5o7_3.js → shellsession-n3-5CqcF.js} +1 -1
- package/dist/ui/assets/{soy-COesmhTY.js → soy-XYBOf_BA.js} +1 -1
- package/dist/ui/assets/sql-ET4u5Cpl.js +1 -0
- package/dist/ui/assets/{stata-CGQEuSZq.js → stata-CLHcJHO_.js} +1 -1
- package/dist/ui/assets/{surrealql-Bz4JbU-9.js → surrealql-BdjQ60T4.js} +1 -1
- package/dist/ui/assets/{svelte-1jM2ejXj.js → svelte-B2RPtKJe.js} +1 -1
- package/dist/ui/assets/{templ-C-VwELcp.js → templ-CrByPW_W.js} +1 -1
- package/dist/ui/assets/{tex-t1rUiQCm.js → tex-DZBkg363.js} +1 -1
- package/dist/ui/assets/{ts-tags-Bewoa6pS.js → ts-tags-DJR3Gphb.js} +1 -1
- package/dist/ui/assets/tsx-CajzROyy.js +1 -0
- package/dist/ui/assets/{twig-DVg-vELl.js → twig-BZjk5Zda.js} +1 -1
- package/dist/ui/assets/typescript-B-EWToLj.js +1 -0
- package/dist/ui/assets/{vue-wPQ7UlMy.js → vue-D_rHCCr8.js} +1 -1
- package/dist/ui/assets/{vue-html-BHtJ8geX.js → vue-html-CC4WlvVt.js} +1 -1
- package/dist/ui/assets/{vue-vine-CNSGAWwc.js → vue-vine-BgNMVgpk.js} +1 -1
- package/dist/ui/assets/xml-BI86-WbH.js +1 -0
- package/dist/ui/assets/{xsl-3_vJ27aE.js → xsl-DXeLZV4J.js} +1 -1
- package/dist/ui/assets/yaml-60_PFlWa.js +1 -0
- package/dist/workspaces/bootstrap.js +72 -0
- package/dist/workspaces/context.js +337 -0
- package/dist/workspaces/conversation-test-support.js +86 -0
- package/dist/{git-worktrees.js → workspaces/git/git-worktrees.js} +1 -1
- package/dist/workspaces/inventory.js +131 -0
- package/dist/workspaces/paths.js +55 -0
- package/dist/{remote-auth.js → workspaces/relay/auth/remote-auth.js} +2 -2
- package/dist/workspaces/relay/result-support.js +111 -0
- package/dist/workspaces/relay/tests/test-support.js +203 -0
- package/dist/{remote-mcp-connection-pool.js → workspaces/relay/transport/remote-mcp-connection-pool.js} +1 -1
- package/dist/{remote-transport.js → workspaces/relay/transport/remote-transport.js} +30 -3
- package/dist/workspaces/relay/types.js +1 -0
- package/dist/{remote-workspace-relay.js → workspaces/relay/workspace-relay.js} +23 -172
- package/dist/workspaces/resources/resource-monitor.js +377 -0
- package/dist/workspaces/resources/skills.js +283 -0
- package/dist/{review-checkpoints.js → workspaces/review/review-checkpoints.js} +2 -2
- package/dist/workspaces/sessions.js +460 -0
- package/dist/{workspace-store.js → workspaces/state/workspace-store.js} +2 -2
- package/dist/workspaces.js +77 -993
- package/docs/chatgpt-coding-workflow.md +7 -14
- package/docs/configuration.md +26 -34
- package/docs/gotchas.md +0 -30
- package/docs/roadmap.md +6 -10
- package/docs/security.md +1 -5
- package/docs/setup.md +0 -11
- package/package.json +6 -9
- package/scripts/ci/architecture.mjs +109 -0
- package/scripts/ci/verify.mjs +5 -0
- package/scripts/debug/accept/bootstrap.mjs +326 -0
- package/scripts/debug/accept/harness.mjs +76 -0
- package/scripts/debug/accept/support.mjs +432 -0
- package/scripts/debug/accept.mjs +43 -806
- package/scripts/debug/relay-accept/support.mjs +135 -0
- package/scripts/debug/relay-accept.mjs +26 -115
- package/scripts/debug/traffic/support.mjs +167 -0
- package/scripts/debug/traffic/traffic-audit.mjs +4 -161
- package/scripts/{lsp-interop-support.test.mjs → lsp/interop-support.test.mjs} +1 -1
- package/scripts/{lsp-interop.mjs → lsp/interop.mjs} +3 -3
- package/scripts/release/publish.mjs +12 -9
- package/scripts/release/release-gate.test.mjs +3 -1
- package/scripts/release/release-version.test.mjs +13 -1
- package/scripts/release-parity.mjs +1 -1
- package/scripts/release-proof.mjs +15 -0
- package/scripts/release-proof.test.mjs +27 -1
- package/scripts/release-version.mjs +16 -1
- package/scripts/wiki/sync.mjs +21 -10
- package/dist/activity/bash-output-store.js +0 -127
- package/dist/pi-tools.js +0 -110
- package/dist/skills.js +0 -127
- package/dist/ui/assets/activity-panel-app-7AckaxIR.js +0 -2
- package/dist/ui/assets/angular-html-BkgDQl-G.js +0 -1
- package/dist/ui/assets/c-IBzBpxAO.js +0 -1
- package/dist/ui/assets/chunk-EyZ2wyi3.js +0 -1
- package/dist/ui/assets/cpp-CVHeO-Jk.js +0 -1
- package/dist/ui/assets/css-DEfus9J5.js +0 -1
- package/dist/ui/assets/glsl-_ooCjaeB.js +0 -1
- package/dist/ui/assets/graphql-B9LqP-cY.js +0 -1
- package/dist/ui/assets/haml-BU5EoZBn.js +0 -1
- package/dist/ui/assets/heavy-payload-Bol1_mcs.js +0 -4
- package/dist/ui/assets/html-D-C6YZk4.js +0 -1
- package/dist/ui/assets/java-ppHvycj5.js +0 -1
- package/dist/ui/assets/javascript-DDTjKLlQ.js +0 -1
- package/dist/ui/assets/json-Cw91r8h1.js +0 -1
- package/dist/ui/assets/jsx-04X2FT_1.js +0 -1
- package/dist/ui/assets/lua-CiyBp52Y.js +0 -1
- package/dist/ui/assets/r-DfFga4si.js +0 -1
- package/dist/ui/assets/regexp-iC9_nbSI.js +0 -1
- package/dist/ui/assets/review-payload-BqJp0c5e.js +0 -1
- package/dist/ui/assets/scrollbar-CvE-I-jG.js +0 -287
- package/dist/ui/assets/scss-BfZXsAWQ.js +0 -1
- package/dist/ui/assets/shellscript-BC2srNaB.js +0 -1
- package/dist/ui/assets/sql-Ccv_yeUm.js +0 -1
- package/dist/ui/assets/tsx-CTXzrBkN.js +0 -1
- package/dist/ui/assets/typescript--ElHoFkw.js +0 -1
- package/dist/ui/assets/workspace-app-BLW7p6IZ.js +0 -114
- package/dist/ui/assets/workspace-app-BjNqR0en.js +0 -1
- package/dist/ui/assets/workspace-app-CmaYU4DW.js +0 -3
- package/dist/ui/assets/workspace-app-D2bJ5fjt.css +0 -1
- package/dist/ui/assets/workspace-lifecycle-app-BVbI2Ilf.js +0 -1
- package/dist/ui/assets/xml-JnmX6vyS.js +0 -1
- package/dist/ui/assets/yaml-OAcZkP-w.js +0 -1
- package/dist/ui/workspace-app.html +0 -18
- package/dist/ui/workspace-lifecycle-app.html +0 -18
- package/docs/agent-profile-schema.md +0 -114
- package/docs/artifact-exchange.md +0 -65
- package/docs/versioning.md +0 -205
- package/skills/subagent-delegation/SKILL.md +0 -132
- /package/capabilities/{managed-worktrees → workspace/managed-worktrees}/GUIDE.md +0 -0
- /package/dist/activity/{process-output-audit.js → runtime/process-output-audit.js} +0 -0
- /package/dist/{artifact-error.js → mcp/artifacts/artifact-error.js} +0 -0
- /package/dist/{artifact-tools.js → mcp/artifacts/artifact-tools.js} +0 -0
- /package/dist/{incoming-artifacts.js → mcp/artifacts/incoming-artifacts.js} +0 -0
- /package/dist/{advertised-files.js → mcp/filesystem/advertised-files.js} +0 -0
- /package/dist/{apply-patch.js → mcp/filesystem/apply-patch.js} +0 -0
- /package/dist/{file-mutations.js → mcp/filesystem/file-mutations.js} +0 -0
- /package/dist/{roots.js → mcp/filesystem/roots.js} +0 -0
- /package/dist/{oauth → mcp/oauth}/public-url.js +0 -0
- /package/dist/{oauth → mcp/oauth}/router.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/executor.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/scheduler.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/types.js +0 -0
- /package/dist/{operations → mcp/operations}/bulk-mutation.js +0 -0
- /package/dist/{operations → mcp/operations}/bulk-read.js +0 -0
- /package/dist/{operations → mcp/operations}/core-operation-executor.js +0 -0
- /package/dist/{request-meta.js → mcp/request-meta.js} +0 -0
- /package/dist/{mcp-sessions.js → mcp/server/transport/mcp-sessions.js} +0 -0
- /package/dist/{server-shutdown.js → mcp/server/transport/server-shutdown.js} +0 -0
- /package/dist/{logger.js → runtime/logging/logger.js} +0 -0
- /package/dist/{db → runtime/state/db}/schema.js +0 -0
- /package/dist/{composite-activity.js → workspaces/composite/composite-activity.js} +0 -0
- /package/dist/{composite-workspaces.js → workspaces/composite/composite-workspaces.js} +0 -0
- /package/dist/{git.js → workspaces/git/git.js} +0 -0
- /package/dist/{workspace-presentation.js → workspaces/presentation/workspace-presentation.js} +0 -0
- /package/dist/{workspace-task-reminders.js → workspaces/tasks/workspace-task-reminders.js} +0 -0
- /package/dist/{workspace-tasks.js → workspaces/tasks/workspace-tasks.js} +0 -0
- /package/scripts/{lsp-interop-support.mjs → lsp/interop-support.mjs} +0 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { CapabilityError } from "../../core/capability-registry.js";
|
|
2
|
+
import { deletePath, renamePath } from "../../../filesystem/file-mutations.js";
|
|
3
|
+
import { editFileTool, readFileTool, writeFileTool } from "../../../filesystem/filesystem-tools.js";
|
|
4
|
+
import { runToolWithHooks } from "../../../hooks/hooks.js";
|
|
5
|
+
import { toolNames } from "../../../server-instructions.js";
|
|
6
|
+
import { BatchExecutor } from "../../../operations/batch/executor.js";
|
|
7
|
+
import { NativeBulkMutationExecutor } from "../../../operations/native-bulk-mutations.js";
|
|
8
|
+
import { createCoreOperationExecutor, } from "../../../operations/core-operation-executor.js";
|
|
9
|
+
import { formatAgentsPath } from "../../../../workspaces.js";
|
|
10
|
+
import { markReturnedOutput, processActivityOutcome, processToolResponse, } from "../../../process/runtime.js";
|
|
11
|
+
import { capabilityActivityAuditRequest, capabilityActivityAuditResult } from "../../../../subagents/sessions/mcp/audit.js";
|
|
12
|
+
import { activityRelationFor, activityRequestFor, runActivityTool, runActivityToolWithHooks, standardActivityOutcome, } from "../../core/activity-support.js";
|
|
13
|
+
import { capabilityContextFor, workspaceHookInvocation } from "../../core/capability-support.js";
|
|
14
|
+
import { assertWorkspaceInstructionsLoadedBeforeSideEffect, contentLineCount, contentText, countDiffStats, formatDiscoveredWorkspaceInstructions, logFailedToolResponse, logToolCall, newFilePatch, textBlock, textSummary, toolResultContent, toolResultIsError, toolResultText, workspaceLogContext, } from "../../core/tool-support.js";
|
|
15
|
+
import { appendAutomaticMutationDiagnostics } from "./mutation-diagnostics.js";
|
|
16
|
+
export function createOperationRuntime(options) {
|
|
17
|
+
const { config, workspaces, activityLifecycle, hooks, processSessions, bashOutputStore, capabilityRegistry, codeIntelligence, hostScopeIdFor, } = options;
|
|
18
|
+
const coreOperations = createCoreOperationExecutor({
|
|
19
|
+
read: async (input, context) => {
|
|
20
|
+
const { workspaceId, ...readInput } = input;
|
|
21
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
22
|
+
return runActivityToolWithHooks(activityLifecycle, hooks, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), activityRequestFor(input, context), {
|
|
23
|
+
signal: context.signal,
|
|
24
|
+
tool: toolNames.read,
|
|
25
|
+
invocation: workspaceHookInvocation(workspace),
|
|
26
|
+
payload: { path: readInput.path, offset: readInput.offset, limit: readInput.limit },
|
|
27
|
+
isFailure: toolResultIsError,
|
|
28
|
+
operation: async () => {
|
|
29
|
+
const startedAt = performance.now();
|
|
30
|
+
const readPath = workspaces.resolveReadPath(workspace, readInput.path);
|
|
31
|
+
const discoveredInstructions = (await workspaces.discoverPathInstructions(workspace, readPath.absolutePath)).filter((file) => file.path !== readPath.absolutePath);
|
|
32
|
+
const response = await readFileTool({ ...readInput, path: readPath.absolutePath }, {
|
|
33
|
+
cwd: workspace.root,
|
|
34
|
+
root: workspace.root,
|
|
35
|
+
readRoots: readPath.readRoots,
|
|
36
|
+
});
|
|
37
|
+
if (response.isError) {
|
|
38
|
+
logFailedToolResponse(config, {
|
|
39
|
+
tool: toolNames.read,
|
|
40
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
41
|
+
path: readInput.path,
|
|
42
|
+
}, response.content, startedAt);
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
workspaces.markReadPathLoaded(workspace, readPath);
|
|
46
|
+
const discoveredInstructionContent = discoveredInstructions.length > 0
|
|
47
|
+
? textBlock(formatDiscoveredWorkspaceInstructions(discoveredInstructions, workspace.root))
|
|
48
|
+
: undefined;
|
|
49
|
+
const content = discoveredInstructionContent
|
|
50
|
+
? [discoveredInstructionContent, ...response.content]
|
|
51
|
+
: response.content;
|
|
52
|
+
const summary = {
|
|
53
|
+
...textSummary(response.content),
|
|
54
|
+
offset: readInput.offset ?? 1,
|
|
55
|
+
limited: readInput.limit !== undefined,
|
|
56
|
+
};
|
|
57
|
+
logToolCall(config, {
|
|
58
|
+
tool: toolNames.read,
|
|
59
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
60
|
+
path: readInput.path,
|
|
61
|
+
success: true,
|
|
62
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
...response,
|
|
66
|
+
content,
|
|
67
|
+
_meta: {
|
|
68
|
+
tool: toolNames.read,
|
|
69
|
+
card: {
|
|
70
|
+
workspaceId,
|
|
71
|
+
path: readInput.path,
|
|
72
|
+
summary,
|
|
73
|
+
payload: { content: response.content },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
structuredContent: {
|
|
77
|
+
result: contentText(content),
|
|
78
|
+
...(discoveredInstructions.length > 0
|
|
79
|
+
? {
|
|
80
|
+
agentsFiles: discoveredInstructions.map((file) => ({
|
|
81
|
+
path: formatAgentsPath(file.path, workspace.root),
|
|
82
|
+
content: file.content,
|
|
83
|
+
})),
|
|
84
|
+
}
|
|
85
|
+
: {}),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
}, activityRelationFor(context));
|
|
90
|
+
},
|
|
91
|
+
write: async (input, context) => {
|
|
92
|
+
const { workspaceId, ...writeInput } = input;
|
|
93
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
94
|
+
return runActivityToolWithHooks(activityLifecycle, hooks, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), activityRequestFor(input, context), {
|
|
95
|
+
signal: context.signal,
|
|
96
|
+
tool: toolNames.write,
|
|
97
|
+
invocation: workspaceHookInvocation(workspace),
|
|
98
|
+
payload: { path: writeInput.path },
|
|
99
|
+
isFailure: toolResultIsError,
|
|
100
|
+
changedPaths: (result) => toolResultIsError(result) ? [] : [writeInput.path],
|
|
101
|
+
operation: async () => {
|
|
102
|
+
const startedAt = performance.now();
|
|
103
|
+
await assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, [writeInput.path]);
|
|
104
|
+
const response = await writeFileTool(writeInput, {
|
|
105
|
+
cwd: workspace.root,
|
|
106
|
+
root: workspace.root,
|
|
107
|
+
fileRoots: workspaces.fileToolRoots(workspace),
|
|
108
|
+
});
|
|
109
|
+
if (response.isError) {
|
|
110
|
+
logFailedToolResponse(config, {
|
|
111
|
+
tool: toolNames.write,
|
|
112
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
113
|
+
path: writeInput.path,
|
|
114
|
+
}, response.content, startedAt);
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
const patch = newFilePatch(writeInput.path, writeInput.content);
|
|
118
|
+
const stats = countDiffStats(patch);
|
|
119
|
+
const summary = {
|
|
120
|
+
...stats,
|
|
121
|
+
lines: contentLineCount(writeInput.content),
|
|
122
|
+
characters: writeInput.content.length,
|
|
123
|
+
};
|
|
124
|
+
logToolCall(config, {
|
|
125
|
+
tool: toolNames.write,
|
|
126
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
127
|
+
path: writeInput.path,
|
|
128
|
+
success: true,
|
|
129
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
130
|
+
});
|
|
131
|
+
return appendAutomaticMutationDiagnostics({
|
|
132
|
+
...response,
|
|
133
|
+
_meta: {
|
|
134
|
+
tool: toolNames.write,
|
|
135
|
+
card: {
|
|
136
|
+
workspaceId,
|
|
137
|
+
path: writeInput.path,
|
|
138
|
+
summary,
|
|
139
|
+
payload: {
|
|
140
|
+
content: response.content,
|
|
141
|
+
patch,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
structuredContent: {
|
|
146
|
+
result: contentText(response.content),
|
|
147
|
+
},
|
|
148
|
+
}, codeIntelligence, workspace.root, [writeInput.path], context.signal);
|
|
149
|
+
},
|
|
150
|
+
}, activityRelationFor(context));
|
|
151
|
+
},
|
|
152
|
+
edit: async (input, context) => {
|
|
153
|
+
const { workspaceId, ...editInput } = input;
|
|
154
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
155
|
+
return runActivityToolWithHooks(activityLifecycle, hooks, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), activityRequestFor(input, context), {
|
|
156
|
+
signal: context.signal,
|
|
157
|
+
tool: toolNames.edit,
|
|
158
|
+
invocation: workspaceHookInvocation(workspace),
|
|
159
|
+
payload: { path: editInput.path, editCount: editInput.edits.length },
|
|
160
|
+
isFailure: toolResultIsError,
|
|
161
|
+
changedPaths: (result) => toolResultIsError(result) ? [] : [editInput.path],
|
|
162
|
+
operation: async () => {
|
|
163
|
+
const startedAt = performance.now();
|
|
164
|
+
await assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, [editInput.path]);
|
|
165
|
+
const response = await editFileTool(editInput, {
|
|
166
|
+
cwd: workspace.root,
|
|
167
|
+
root: workspace.root,
|
|
168
|
+
fileRoots: workspaces.fileToolRoots(workspace),
|
|
169
|
+
});
|
|
170
|
+
if (response.isError) {
|
|
171
|
+
logFailedToolResponse(config, {
|
|
172
|
+
tool: toolNames.edit,
|
|
173
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
174
|
+
path: editInput.path,
|
|
175
|
+
}, response.content, startedAt);
|
|
176
|
+
return response;
|
|
177
|
+
}
|
|
178
|
+
const stats = countDiffStats(response.details?.patch ?? response.details?.diff);
|
|
179
|
+
const summary = {
|
|
180
|
+
...stats,
|
|
181
|
+
editCount: editInput.edits.length,
|
|
182
|
+
};
|
|
183
|
+
const editResultText = `Edited ${editInput.path} (+${stats.additions} -${stats.removals}).`;
|
|
184
|
+
const editContent = [textBlock(editResultText)];
|
|
185
|
+
logToolCall(config, {
|
|
186
|
+
tool: toolNames.edit,
|
|
187
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
188
|
+
path: editInput.path,
|
|
189
|
+
success: true,
|
|
190
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
191
|
+
});
|
|
192
|
+
return appendAutomaticMutationDiagnostics({
|
|
193
|
+
content: editContent,
|
|
194
|
+
_meta: {
|
|
195
|
+
tool: toolNames.edit,
|
|
196
|
+
card: {
|
|
197
|
+
workspaceId,
|
|
198
|
+
path: editInput.path,
|
|
199
|
+
summary,
|
|
200
|
+
payload: {
|
|
201
|
+
diff: response.details?.diff,
|
|
202
|
+
patch: response.details?.patch,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
structuredContent: {
|
|
207
|
+
status: "applied",
|
|
208
|
+
result: contentText(editContent),
|
|
209
|
+
},
|
|
210
|
+
}, codeIntelligence, workspace.root, [editInput.path], context.signal);
|
|
211
|
+
},
|
|
212
|
+
}, activityRelationFor(context));
|
|
213
|
+
},
|
|
214
|
+
rename: async (input, context) => {
|
|
215
|
+
const { workspaceId, path, newPath } = input;
|
|
216
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
217
|
+
return runActivityToolWithHooks(activityLifecycle, hooks, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), activityRequestFor(input, context), {
|
|
218
|
+
signal: context.signal,
|
|
219
|
+
tool: toolNames.rename,
|
|
220
|
+
invocation: workspaceHookInvocation(workspace),
|
|
221
|
+
payload: { path, newPath, paths: [path, newPath] },
|
|
222
|
+
changedPaths: () => [path, newPath],
|
|
223
|
+
operation: async () => {
|
|
224
|
+
const startedAt = performance.now();
|
|
225
|
+
try {
|
|
226
|
+
await assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, [path, newPath]);
|
|
227
|
+
await renamePath({ path, newPath }, {
|
|
228
|
+
cwd: workspace.root,
|
|
229
|
+
allowedRoots: workspaces.fileToolRoots(workspace),
|
|
230
|
+
});
|
|
231
|
+
const result = `Renamed ${path} to ${newPath}.`;
|
|
232
|
+
const content = [textBlock(result)];
|
|
233
|
+
logToolCall(config, {
|
|
234
|
+
tool: toolNames.rename,
|
|
235
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
236
|
+
path: `${path} -> ${newPath}`,
|
|
237
|
+
success: true,
|
|
238
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
239
|
+
});
|
|
240
|
+
return appendAutomaticMutationDiagnostics({
|
|
241
|
+
content,
|
|
242
|
+
_meta: {
|
|
243
|
+
tool: toolNames.rename,
|
|
244
|
+
card: {
|
|
245
|
+
workspaceId,
|
|
246
|
+
path: newPath,
|
|
247
|
+
summary: { previousPath: path },
|
|
248
|
+
payload: { content },
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
structuredContent: {
|
|
252
|
+
result,
|
|
253
|
+
status: "renamed",
|
|
254
|
+
path,
|
|
255
|
+
newPath,
|
|
256
|
+
},
|
|
257
|
+
}, codeIntelligence, workspace.root, [newPath], context.signal);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
logToolCall(config, {
|
|
261
|
+
tool: toolNames.rename,
|
|
262
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
263
|
+
path: `${path} -> ${newPath}`,
|
|
264
|
+
success: false,
|
|
265
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
266
|
+
error: error instanceof Error ? error.message : String(error),
|
|
267
|
+
});
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
}, activityRelationFor(context));
|
|
272
|
+
},
|
|
273
|
+
delete: async (input, context) => {
|
|
274
|
+
const { workspaceId, path, recursive } = input;
|
|
275
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
276
|
+
return runActivityToolWithHooks(activityLifecycle, hooks, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), activityRequestFor(input, context), {
|
|
277
|
+
signal: context.signal,
|
|
278
|
+
tool: toolNames.delete,
|
|
279
|
+
invocation: workspaceHookInvocation(workspace),
|
|
280
|
+
payload: { path, recursive: recursive ?? false },
|
|
281
|
+
changedPaths: () => [path],
|
|
282
|
+
operation: async () => {
|
|
283
|
+
const startedAt = performance.now();
|
|
284
|
+
try {
|
|
285
|
+
await assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, [path]);
|
|
286
|
+
const deleted = await deletePath({ path, recursive }, {
|
|
287
|
+
cwd: workspace.root,
|
|
288
|
+
allowedRoots: workspaces.fileToolRoots(workspace),
|
|
289
|
+
});
|
|
290
|
+
const result = `Deleted ${path}${deleted.recursive ? " recursively" : ""}.`;
|
|
291
|
+
const content = [textBlock(result)];
|
|
292
|
+
logToolCall(config, {
|
|
293
|
+
tool: toolNames.delete,
|
|
294
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
295
|
+
path,
|
|
296
|
+
success: true,
|
|
297
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
content,
|
|
301
|
+
_meta: {
|
|
302
|
+
tool: toolNames.delete,
|
|
303
|
+
card: {
|
|
304
|
+
workspaceId,
|
|
305
|
+
path,
|
|
306
|
+
summary: { recursive: deleted.recursive },
|
|
307
|
+
payload: { content },
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
structuredContent: {
|
|
311
|
+
result,
|
|
312
|
+
status: "deleted",
|
|
313
|
+
path,
|
|
314
|
+
recursive: deleted.recursive,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
logToolCall(config, {
|
|
320
|
+
tool: toolNames.delete,
|
|
321
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
322
|
+
path,
|
|
323
|
+
success: false,
|
|
324
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
325
|
+
error: error instanceof Error ? error.message : String(error),
|
|
326
|
+
});
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
}, activityRelationFor(context));
|
|
331
|
+
},
|
|
332
|
+
shellRun: async (input, context) => {
|
|
333
|
+
const { workspaceId, command, surface, tty, columns, rows, workingDirectory, yieldTimeMs, timeoutMs, maxOutputTokens, } = input;
|
|
334
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
335
|
+
const activityRequest = surface === "exec_command"
|
|
336
|
+
? {
|
|
337
|
+
workspaceId,
|
|
338
|
+
cmd: command,
|
|
339
|
+
tty,
|
|
340
|
+
columns,
|
|
341
|
+
rows,
|
|
342
|
+
workingDirectory,
|
|
343
|
+
yieldTimeMs,
|
|
344
|
+
timeoutMs,
|
|
345
|
+
maxOutputTokens,
|
|
346
|
+
}
|
|
347
|
+
: {
|
|
348
|
+
workspaceId,
|
|
349
|
+
action: "run",
|
|
350
|
+
command,
|
|
351
|
+
tty,
|
|
352
|
+
columns,
|
|
353
|
+
rows,
|
|
354
|
+
workingDirectory,
|
|
355
|
+
yieldTimeMs,
|
|
356
|
+
timeoutMs,
|
|
357
|
+
maxOutputTokens,
|
|
358
|
+
};
|
|
359
|
+
let undeliveredProcessId;
|
|
360
|
+
const activityResult = await runActivityTool(activityLifecycle, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), surface, activityRequestFor(activityRequest, context), async (activityContext) => {
|
|
361
|
+
try {
|
|
362
|
+
const result = await runToolWithHooks(hooks, {
|
|
363
|
+
signal: context.signal,
|
|
364
|
+
tool: surface,
|
|
365
|
+
invocation: workspaceHookInvocation(workspace),
|
|
366
|
+
payload: surface === "exec_command"
|
|
367
|
+
? { command, workingDirectory: workingDirectory ?? "." }
|
|
368
|
+
: { action: "run", command, workingDirectory: workingDirectory ?? "." },
|
|
369
|
+
...(surface === "bash" ? { isFailure: toolResultIsError } : {}),
|
|
370
|
+
operation: async () => {
|
|
371
|
+
const startedAt = performance.now();
|
|
372
|
+
const cwd = workspaces.resolveWorkingDirectory(workspace, workingDirectory);
|
|
373
|
+
await assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, [cwd]);
|
|
374
|
+
const snapshot = await processSessions.start({
|
|
375
|
+
workspaceId,
|
|
376
|
+
command,
|
|
377
|
+
cwd,
|
|
378
|
+
workspaceRoot: workspace.root,
|
|
379
|
+
tty,
|
|
380
|
+
columns,
|
|
381
|
+
rows,
|
|
382
|
+
yieldTimeMs,
|
|
383
|
+
timeoutMs,
|
|
384
|
+
maxOutputTokens,
|
|
385
|
+
...(surface === "exec_command" ? { codexCi: true } : {}),
|
|
386
|
+
signal: context.signal,
|
|
387
|
+
audit: activityContext,
|
|
388
|
+
});
|
|
389
|
+
undeliveredProcessId = snapshot.running ? snapshot.processId : undefined;
|
|
390
|
+
logToolCall(config, {
|
|
391
|
+
tool: surface,
|
|
392
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
393
|
+
workingDirectory: workingDirectory ?? ".",
|
|
394
|
+
command,
|
|
395
|
+
commandLength: command.length,
|
|
396
|
+
exitCode: snapshot.exitCode,
|
|
397
|
+
running: snapshot.running,
|
|
398
|
+
processId: snapshot.processId,
|
|
399
|
+
success: surface === "exec_command"
|
|
400
|
+
? snapshot.running || snapshot.exitCode === 0
|
|
401
|
+
: snapshot.running || (snapshot.exitCode === 0 && !snapshot.signal),
|
|
402
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
403
|
+
});
|
|
404
|
+
const response = processToolResponse(surface, workspaceId, snapshot, {
|
|
405
|
+
...(surface === "bash" ? { action: "run" } : {}),
|
|
406
|
+
command,
|
|
407
|
+
workingDirectory: workingDirectory ?? ".",
|
|
408
|
+
running: snapshot.running,
|
|
409
|
+
exitCode: snapshot.exitCode,
|
|
410
|
+
wallTimeMs: snapshot.wallTimeMs,
|
|
411
|
+
});
|
|
412
|
+
return surface === "bash" && !snapshot.running && (snapshot.signal || snapshot.exitCode !== 0)
|
|
413
|
+
? { ...response, isError: true }
|
|
414
|
+
: response;
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
context.signal?.throwIfAborted();
|
|
418
|
+
return result;
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
if (undeliveredProcessId !== undefined) {
|
|
422
|
+
processSessions.discardUndelivered(workspaceId, undeliveredProcessId);
|
|
423
|
+
}
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
426
|
+
}, processActivityOutcome, activityRelationFor(context));
|
|
427
|
+
markReturnedOutput(bashOutputStore, activityResult);
|
|
428
|
+
return activityResult;
|
|
429
|
+
},
|
|
430
|
+
capabilityRun: async (input, context) => {
|
|
431
|
+
const { workspaceId, name, arguments: capabilityArguments, file } = input;
|
|
432
|
+
const workspace = workspaces.getWorkspace(workspaceId);
|
|
433
|
+
let changedPaths = [];
|
|
434
|
+
return runActivityTool(activityLifecycle, workspace, hostScopeIdFor(context.requestMeta, context.sessionId), toolNames.capability, activityRequestFor(capabilityActivityAuditRequest(input), context), (activityContext) => runToolWithHooks(hooks, {
|
|
435
|
+
signal: context.signal,
|
|
436
|
+
tool: toolNames.capability,
|
|
437
|
+
invocation: workspaceHookInvocation(workspace),
|
|
438
|
+
payload: { name, action: "run" },
|
|
439
|
+
isFailure: toolResultIsError,
|
|
440
|
+
changedPaths: () => changedPaths,
|
|
441
|
+
operation: async () => {
|
|
442
|
+
const startedAt = performance.now();
|
|
443
|
+
try {
|
|
444
|
+
const execution = await capabilityRegistry.run(name, capabilityArguments ?? {}, capabilityContextFor(workspace), {
|
|
445
|
+
nativeFile: file,
|
|
446
|
+
signal: context.signal,
|
|
447
|
+
requestMeta: context.requestMeta,
|
|
448
|
+
sessionId: context.sessionId,
|
|
449
|
+
batch: context.batch,
|
|
450
|
+
activityId: activityContext.activityId,
|
|
451
|
+
});
|
|
452
|
+
changedPaths = execution.changedPaths ?? [];
|
|
453
|
+
const result = {
|
|
454
|
+
content: [textBlock(`Capability ${name} completed.\n${JSON.stringify(execution.value, null, 2)}`)],
|
|
455
|
+
...(execution.card
|
|
456
|
+
? {
|
|
457
|
+
_meta: {
|
|
458
|
+
tool: toolNames.capability,
|
|
459
|
+
card: {
|
|
460
|
+
workspaceId,
|
|
461
|
+
capabilityName: name,
|
|
462
|
+
summary: execution.card.summary ?? {},
|
|
463
|
+
files: execution.card.files,
|
|
464
|
+
payload: execution.card.payload ?? {},
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
}
|
|
468
|
+
: {}),
|
|
469
|
+
structuredContent: { name, action: "run", result: execution.value },
|
|
470
|
+
};
|
|
471
|
+
logToolCall(config, {
|
|
472
|
+
tool: toolNames.capability,
|
|
473
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
474
|
+
capability: name,
|
|
475
|
+
action: "run",
|
|
476
|
+
success: true,
|
|
477
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
478
|
+
});
|
|
479
|
+
return result;
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
const capabilityError = error instanceof CapabilityError
|
|
483
|
+
? error
|
|
484
|
+
: new CapabilityError("execution_failed", error instanceof Error ? error.message : String(error));
|
|
485
|
+
const result = {
|
|
486
|
+
content: [textBlock(`${capabilityError.code}: ${capabilityError.message}`)],
|
|
487
|
+
structuredContent: {
|
|
488
|
+
name,
|
|
489
|
+
action: "run",
|
|
490
|
+
error: { code: capabilityError.code, message: capabilityError.message },
|
|
491
|
+
},
|
|
492
|
+
isError: true,
|
|
493
|
+
};
|
|
494
|
+
logFailedToolResponse(config, {
|
|
495
|
+
tool: toolNames.capability,
|
|
496
|
+
...workspaceLogContext(workspace, context.sessionId),
|
|
497
|
+
capability: name,
|
|
498
|
+
action: "run",
|
|
499
|
+
}, result.content, startedAt);
|
|
500
|
+
return result;
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
}), standardActivityOutcome, activityRelationFor(context), (result) => capabilityActivityAuditResult(name, result));
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
const batchExecutor = new BatchExecutor({
|
|
507
|
+
lifecycle: activityLifecycle,
|
|
508
|
+
workspaces,
|
|
509
|
+
coreOperations,
|
|
510
|
+
resultIsError: toolResultIsError,
|
|
511
|
+
capabilityBatchPolicy: (name) => capabilityRegistry.batchPolicy(name),
|
|
512
|
+
shellSurface: "bash",
|
|
513
|
+
});
|
|
514
|
+
const nativeBulkMutations = new NativeBulkMutationExecutor({
|
|
515
|
+
lifecycle: activityLifecycle,
|
|
516
|
+
workspaces,
|
|
517
|
+
coreOperations,
|
|
518
|
+
preflightInstructions: (workspace, paths) => assertWorkspaceInstructionsLoadedBeforeSideEffect(workspaces, workspace, paths),
|
|
519
|
+
resultIsError: toolResultIsError,
|
|
520
|
+
resultText: toolResultText,
|
|
521
|
+
resultContent: toolResultContent,
|
|
522
|
+
});
|
|
523
|
+
return { coreOperations, batchExecutor, nativeBulkMutations };
|
|
524
|
+
}
|