feat: add tool descriptor planner

This commit is contained in:
Shakker
2026-05-02 07:10:52 +01:00
committed by Shakker
parent 8080c9cf03
commit c5224a341e
8 changed files with 412 additions and 0 deletions

22
src/tools/protocol.ts Normal file
View File

@@ -0,0 +1,22 @@
import type { JsonObject, ToolPlanEntry } from "./types.js";
export type ToolProtocolDescriptor = {
readonly name: string;
readonly description: string;
readonly inputSchema: JsonObject;
};
// Shared descriptor shape only. Model/provider adapters still own schema normalization.
export function toToolProtocolDescriptor(entry: ToolPlanEntry): ToolProtocolDescriptor {
return {
name: entry.descriptor.name,
description: entry.descriptor.description,
inputSchema: entry.descriptor.inputSchema,
};
}
export function toToolProtocolDescriptors(
entries: readonly ToolPlanEntry[],
): readonly ToolProtocolDescriptor[] {
return entries.map(toToolProtocolDescriptor);
}