From 4112d4511e85a2a0bb76a7300abb42b9147c4071 Mon Sep 17 00:00:00 2001 From: Jiang Bohan Date: Tue, 3 Feb 2026 18:58:45 +0800 Subject: [PATCH] fix(agent): resolve TypeScript errors with exactOptionalPropertyTypes - Fix originalToolsConfig assignment to handle undefined properly - Fix devNull type cast for WritableStream compatibility Co-Authored-By: Claude Opus 4.5 --- src/agent/async-agent.ts | 2 +- src/agent/runner.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/agent/async-agent.ts b/src/agent/async-agent.ts index 68e6f601..86ae5d90 100644 --- a/src/agent/async-agent.ts +++ b/src/agent/async-agent.ts @@ -4,7 +4,7 @@ import { Agent } from "./runner.js"; import { Channel } from "./channel.js"; import type { AgentOptions, Message } from "./types.js"; -const devNull = { write: () => true } as NodeJS.WritableStream; +const devNull = { write: () => true } as unknown as NodeJS.WritableStream; /** Discriminated union of legacy Message (error fallback) and raw AgentEvent */ export type ChannelItem = Message | AgentEvent; diff --git a/src/agent/runner.ts b/src/agent/runner.ts index b658c9d4..bdc9e203 100644 --- a/src/agent/runner.ts +++ b/src/agent/runner.ts @@ -268,7 +268,9 @@ export class Agent { this.agent.setModel(model); // Save original tools config from options (for later merging during reload) - this.originalToolsConfig = options.tools; + if (options.tools) { + this.originalToolsConfig = options.tools; + } // Merge Profile tools config with options.tools (options takes precedence) const profileToolsConfig = this.profile?.getToolsConfig();