























@@ -71,6 +71,14 @@ import {
7171startAcpSpawnParentStreamRelay,
7272} from "./acp-spawn-parent-stream.js";
7373import { resolveAgentConfig, resolveDefaultAgentId } from "./agent-scope.js";
74+import {
75+findAcpUnsupportedInheritedToolAllow,
76+findAcpUnsupportedInheritedToolDeny,
77+formatAcpInheritedToolAllowError,
78+formatAcpInheritedToolDenyError,
79+inheritedToolAllowPatch,
80+inheritedToolDenyPatch,
81+} from "./inherited-tool-deny.js";
7482import { AGENT_LANE_SUBAGENT } from "./lanes.js";
7583import { resolveSandboxRuntimeStatus } from "./sandbox/runtime-status.js";
7684import { resolveRequesterOriginForChild } from "./spawn-requester-origin.js";
@@ -123,6 +131,8 @@ export type SpawnAcpContext = {
123131/** Trusted provider role ids for the requester in this group turn. */
124132agentMemberRoleIds?: string[];
125133sandboxed?: boolean;
134+inheritedToolAllowlist?: string[];
135+inheritedToolDenylist?: string[];
126136};
127137128138export const ACP_SPAWN_ERROR_CODES = [
@@ -1157,6 +1167,26 @@ export async function spawnAcpDirect(
11571167error: runtimePolicyError,
11581168});
11591169}
1170+const acpUnsupportedInheritedTool = findAcpUnsupportedInheritedToolDeny(
1171+ctx.inheritedToolDenylist,
1172+);
1173+if (acpUnsupportedInheritedTool) {
1174+return createAcpSpawnFailure({
1175+status: "forbidden",
1176+errorCode: "runtime_policy",
1177+error: formatAcpInheritedToolDenyError(acpUnsupportedInheritedTool),
1178+});
1179+}
1180+const acpUnsupportedInheritedAllow = findAcpUnsupportedInheritedToolAllow(
1181+ctx.inheritedToolAllowlist,
1182+);
1183+if (acpUnsupportedInheritedAllow) {
1184+return createAcpSpawnFailure({
1185+status: "forbidden",
1186+errorCode: "runtime_policy",
1187+error: formatAcpInheritedToolAllowError(acpUnsupportedInheritedAllow),
1188+});
1189+}
1160119011611191const spawnMode = resolveSpawnMode({
11621192requestedMode: params.mode,
@@ -1291,6 +1321,8 @@ export async function spawnAcpDirect(
12911321key: sessionKey,
12921322spawnedBy: requesterInternalKey,
12931323 ...subagentEnvelopeState.childSessionPatch,
1324+ ...inheritedToolAllowPatch(ctx.inheritedToolAllowlist),
1325+ ...inheritedToolDenyPatch(ctx.inheritedToolDenylist),
12941326 ...(params.label ? { label: params.label } : {}),
12951327},
12961328timeoutMs: 10_000,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。