


























@@ -167,7 +167,12 @@ import {
167167createSystemPromptOverride,
168168} from "../system-prompt.js";
169169import { dropThinkingBlocks } from "../thinking.js";
170-import { collectAllowedToolNames } from "../tool-name-allowlist.js";
170+import {
171+collectAllowedToolNames,
172+collectRegisteredToolNames,
173+PI_RESERVED_TOOL_NAMES,
174+toSessionToolAllowlist,
175+} from "../tool-name-allowlist.js";
171176import {
172177installContextEngineLoopHook,
173178installToolResultContextGuard,
@@ -1062,7 +1067,7 @@ export async function runEmbeddedAttempt(
10621067// Get hook runner early so it's available when creating tools
10631068const hookRunner = getGlobalHookRunner();
106410691065-const { builtInTools, customTools } = splitSdkTools({
1070+const { customTools } = splitSdkTools({
10661071tools: effectiveTools,
10671072sandboxEnabled: !!sandbox?.enabled,
10681073});
@@ -1099,7 +1104,7 @@ export async function runEmbeddedAttempt(
10991104);
11001105const clientToolNameConflicts = findClientToolNameConflicts({
11011106tools: clientTools ?? [],
1102-existingToolNames: coreBuiltinToolNames,
1107+existingToolNames: [...coreBuiltinToolNames, ...PI_RESERVED_TOOL_NAMES],
11031108});
11041109if (clientToolNameConflicts.length > 0) {
11051110throw createClientToolNameConflictError(clientToolNameConflicts);
@@ -1121,8 +1126,14 @@ export async function runEmbeddedAttempt(
11211126 : [];
1122112711231128const allCustomTools = [...customTools, ...clientToolDefs];
1124-// OpenClaw registers filtered tools through `customTools`; keep Pi's
1125-// built-in tool list empty so the SDK does not re-enable defaults.
1129+// Pi 0.68.1 uses `tools` as a global allowlist across built-in and
1130+// custom tools. Keep the built-in tool list empty, but still pass the
1131+// exact registered custom-tool names so our OpenClaw-managed
1132+// registrations remain active without widening the session boundary to
1133+// raw client-provided names.
1134+const sessionToolAllowlist = toSessionToolAllowlist(
1135+collectRegisteredToolNames(allCustomTools),
1136+);
1126113711271138({ session } = await createEmbeddedAgentSessionWithResourceLoader({
11281139createAgentSession: async (options) =>
@@ -1134,7 +1145,7 @@ export async function runEmbeddedAttempt(
11341145modelRegistry: params.modelRegistry,
11351146model: params.model,
11361147thinkingLevel: mapThinkingLevel(params.thinkLevel),
1137-tools: builtInTools,
1148+tools: sessionToolAllowlist,
11381149customTools: allCustomTools,
11391150 sessionManager,
11401151 settingsManager,
@@ -1315,10 +1326,9 @@ export async function runEmbeddedAttempt(
13151326}
1316132713171328const cacheObservabilityEnabled = Boolean(cacheTrace) || log.isEnabled("debug");
1318-const promptCacheToolNames = collectPromptCacheToolNames([
1319- ...builtInTools,
1320- ...allCustomTools,
1321-] as Array<{ name?: string }>);
1329+const promptCacheToolNames = collectPromptCacheToolNames(
1330+allCustomTools as Array<{ name?: string }>,
1331+);
13221332let promptCacheChangesForTurn: PromptCacheChange[] | null = null;
1323133313241334if (cacheTrace) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。