mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 02:01:29 +00:00
Change getAllTools() to return ToolInfo[] instead of string[]
Breaking change: pi.getAllTools() now returns Array<{ name, description }>
instead of string[]. Extensions needing just names can use .map(t => t.name).
Removes redundant getToolInfo() method added in original PR.
Fixes #647
This commit is contained in:
parent
34ecca352e
commit
1367a76ee8
12 changed files with 34 additions and 19 deletions
|
|
@ -459,10 +459,13 @@ export class AgentSession {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all configured tool names (built-in via --tools or default, plus custom tools).
|
||||
* Get all configured tools with name and description.
|
||||
*/
|
||||
getAllToolNames(): string[] {
|
||||
return Array.from(this._toolRegistry.keys());
|
||||
getAllTools(): Array<{ name: string; description: string }> {
|
||||
return Array.from(this._toolRegistry.values()).map((t) => ({
|
||||
name: t.name,
|
||||
description: t.description,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ export type {
|
|||
ToolCallEventResult,
|
||||
// Tools
|
||||
ToolDefinition,
|
||||
ToolInfo,
|
||||
ToolRenderResultOptions,
|
||||
ToolResultEvent,
|
||||
ToolResultEventResult,
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ function createExtensionAPI(
|
|||
return runtime.getActiveTools();
|
||||
},
|
||||
|
||||
getAllTools(): string[] {
|
||||
getAllTools() {
|
||||
return runtime.getAllTools();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -743,8 +743,8 @@ export interface ExtensionAPI {
|
|||
/** Get the list of currently active tool names. */
|
||||
getActiveTools(): string[];
|
||||
|
||||
/** Get all configured tools (built-in + extension tools). */
|
||||
getAllTools(): string[];
|
||||
/** Get all configured tools with name and description. */
|
||||
getAllTools(): ToolInfo[];
|
||||
|
||||
/** Set the active tools by name. */
|
||||
setActiveTools(toolNames: string[]): void;
|
||||
|
|
@ -813,7 +813,10 @@ export type GetSessionNameHandler = () => string | undefined;
|
|||
|
||||
export type GetActiveToolsHandler = () => string[];
|
||||
|
||||
export type GetAllToolsHandler = () => string[];
|
||||
/** Tool info with name and description */
|
||||
export type ToolInfo = Pick<ToolDefinition, "name" | "description">;
|
||||
|
||||
export type GetAllToolsHandler = () => ToolInfo[];
|
||||
|
||||
export type SetActiveToolsHandler = (toolNames: string[]) => void;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue