fix(coding-agent): adjusted strict validation settings across coding-agent tools
- Updated `CustomToolAdapter` to read `strict` from the wrapped tool instead of hard-coding it. - Disabled strict validation for `LspTool` and `ResolveTool` by setting their `strict` flags to false. - Updated `YieldTool` to set `strict` false in its fallback path and remove the local strict accumulator.
This commit is contained in:
@@ -14,13 +14,14 @@ export class CustomToolAdapter<TParams extends TSchema = TSchema, TDetails = any
|
||||
declare label: string;
|
||||
declare description: string;
|
||||
declare parameters: TParams;
|
||||
readonly strict = true;
|
||||
readonly strict: boolean | undefined;
|
||||
|
||||
constructor(
|
||||
private tool: CustomTool<TParams, TDetails>,
|
||||
private getContext: () => CustomToolContext,
|
||||
) {
|
||||
applyToolProxy(tool, this);
|
||||
this.strict = tool.strict;
|
||||
}
|
||||
|
||||
execute(
|
||||
|
||||
@@ -1115,11 +1115,11 @@ export class LspTool implements AgentTool<typeof lspSchema, LspToolDetails, Them
|
||||
readonly label = "LSP";
|
||||
readonly description: string;
|
||||
readonly parameters = lspSchema;
|
||||
readonly strict = true;
|
||||
readonly renderCall = renderCall;
|
||||
readonly renderResult = renderResult;
|
||||
readonly mergeCallAndResult = true;
|
||||
readonly inline = true;
|
||||
readonly strict = false;
|
||||
|
||||
constructor(private readonly session: ToolSession) {
|
||||
this.description = prompt.render(lspDescription);
|
||||
|
||||
@@ -109,7 +109,7 @@ export class ResolveTool implements AgentTool<typeof resolveSchema, ResolveToolD
|
||||
readonly hidden = true;
|
||||
readonly description: string;
|
||||
readonly parameters = resolveSchema;
|
||||
readonly strict = true;
|
||||
readonly strict = false;
|
||||
|
||||
constructor(private readonly session: ToolSession) {
|
||||
this.description = prompt.render(resolveDescription);
|
||||
|
||||
@@ -74,7 +74,6 @@ export class YieldTool implements AgentTool<TSchema, YieldDetails> {
|
||||
let validate: ValidateFunction | undefined;
|
||||
let dataSchema: TSchema;
|
||||
let parameters: TSchema;
|
||||
let strict = true;
|
||||
|
||||
try {
|
||||
const schemaResult = normalizeSchema(session.outputSchema);
|
||||
@@ -131,12 +130,11 @@ export class YieldTool implements AgentTool<TSchema, YieldDetails> {
|
||||
});
|
||||
parameters = createParameters(dataSchema);
|
||||
validate = undefined;
|
||||
strict = false;
|
||||
this.strict = false;
|
||||
}
|
||||
|
||||
this.#validate = validate;
|
||||
this.parameters = parameters;
|
||||
this.strict = strict;
|
||||
}
|
||||
|
||||
async execute(
|
||||
|
||||
Reference in New Issue
Block a user