feat(pi): materialize effective plugin worker tools

This commit is contained in:
2026-08-27 17:24:16 +08:00
parent c4dd8923a0
commit fd891ff3bb
12 changed files with 617 additions and 212 deletions

View File

@@ -4,7 +4,6 @@ import {
type ChildProcessWithoutNullStreams,
} from 'node:child_process';
import { platform } from 'node:os';
import { DATA_SERVICE_PI_TOOL_NAMES } from '../../../shared/data-service';
import { logger } from '../../utils/logger';
import type { CodingRuntimeDisposeReason } from '../contracts';
import { PiProcessError, type PiProcessErrorCode } from './process-errors';
@@ -122,15 +121,17 @@ export type PiWorkerProcessOptions = {
onLifecycleEvent?(event: PiWorkerLifecycleEvent): void;
};
/** Tools available to every managed parent worker before plugin materialization. */
export const PI_CORE_TOOL_NAMES = Object.freeze([
'read', 'bash', 'edit', 'write', 'grep', 'find', 'ls', 'ask_user', 'subagent',
'agent_browser', 'game_asset_browser', 'game_asset_review',
'task_state', 'changed_file', 'runtime_context',
] as const);
export function buildPiRpcArgs(
sessionDir: string,
additionalArgs: readonly string[] = [],
tools: readonly string[] = [
'read', 'bash', 'edit', 'write', 'grep', 'find', 'ls', 'ask_user', 'subagent',
'agent_browser', 'game_asset_browser', 'game_asset_review',
'task_state', 'changed_file', 'runtime_context',
...DATA_SERVICE_PI_TOOL_NAMES,
],
tools: readonly string[] = PI_CORE_TOOL_NAMES,
): string[] {
return [
'--mode', 'rpc',