feat: add Pi subagent scheduler and child runtime
This commit is contained in:
@@ -52,6 +52,7 @@ export type PiWorkerProcessOptions = {
|
||||
cwd: string;
|
||||
configDir: string;
|
||||
sessionDir: string;
|
||||
tools?: readonly string[];
|
||||
additionalArgs?: readonly string[];
|
||||
env?: NodeJS.ProcessEnv;
|
||||
sensitiveValues?: readonly string[];
|
||||
@@ -64,6 +65,7 @@ export type PiWorkerProcessOptions = {
|
||||
export function buildPiRpcArgs(
|
||||
sessionDir: string,
|
||||
additionalArgs: readonly string[] = [],
|
||||
tools: readonly string[] = ['read', 'bash', 'edit', 'write', 'grep', 'find', 'ls', 'ask_user'],
|
||||
): string[] {
|
||||
return [
|
||||
'--mode', 'rpc',
|
||||
@@ -75,7 +77,7 @@ export function buildPiRpcArgs(
|
||||
'--no-themes',
|
||||
'--no-context-files',
|
||||
'--no-approve',
|
||||
'--tools', 'read,bash,edit,write,grep,find,ls,ask_user',
|
||||
'--tools', tools.join(','),
|
||||
...additionalArgs,
|
||||
];
|
||||
}
|
||||
@@ -217,7 +219,11 @@ export class PiWorkerProcess {
|
||||
async start(): Promise<this> {
|
||||
if (this.child) throw new Error('Pi worker process already started');
|
||||
const generation = this.generationValue;
|
||||
const args = buildPiRpcArgs(this.options.sessionDir, this.options.additionalArgs);
|
||||
const args = buildPiRpcArgs(
|
||||
this.options.sessionDir,
|
||||
this.options.additionalArgs,
|
||||
this.options.tools,
|
||||
);
|
||||
assertSensitiveValuesAbsentFromArgs(args, this.options.sensitiveValues);
|
||||
const child = spawn(
|
||||
this.options.executablePath,
|
||||
|
||||
Reference in New Issue
Block a user