@@ -47,11 +47,19 @@ export interface CreateAgentSessionOptions {
|
||||
/** Models available for cycling (Ctrl+P in interactive mode) */
|
||||
scopedModels?: Array<{ model: Model<any>; thinkingLevel?: ThinkingLevel }>;
|
||||
|
||||
/**
|
||||
* Optional default tool suppression mode when no explicit allowlist is provided.
|
||||
*
|
||||
* - "all": start with no tools enabled
|
||||
* - "builtin": disable the default built-in tools (read, bash, edit, write)
|
||||
* but keep extension/custom tools enabled
|
||||
*/
|
||||
noTools?: "all" | "builtin";
|
||||
/**
|
||||
* Optional allowlist of tool names.
|
||||
*
|
||||
* When omitted, pi enables the default built-in tools (read, bash, edit, write)
|
||||
* and leaves extension/custom tools enabled.
|
||||
* and leaves extension/custom tools enabled unless `noTools` changes that default.
|
||||
* When provided, only the listed tool names are enabled.
|
||||
*/
|
||||
tools?: string[];
|
||||
@@ -245,7 +253,12 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||
}
|
||||
|
||||
const defaultActiveToolNames: ToolName[] = ["read", "bash", "edit", "write"];
|
||||
const initialActiveToolNames: string[] = options.tools ? [...options.tools] : defaultActiveToolNames;
|
||||
const allowedToolNames = options.tools ?? (options.noTools === "all" ? [] : undefined);
|
||||
const initialActiveToolNames: string[] = options.tools
|
||||
? [...options.tools]
|
||||
: options.noTools
|
||||
? []
|
||||
: defaultActiveToolNames;
|
||||
|
||||
let agent: Agent;
|
||||
|
||||
@@ -366,7 +379,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||
customTools: options.customTools,
|
||||
modelRegistry,
|
||||
initialActiveToolNames,
|
||||
allowedToolNames: options.tools,
|
||||
allowedToolNames,
|
||||
extensionRunnerRef,
|
||||
sessionStartEvent: options.sessionStartEvent,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user