Fix Claude config narrowing

This commit is contained in:
Mohamed Boudra
2025-12-25 12:32:29 +07:00
parent c771fd986d
commit 16bce1c3c5
2 changed files with 10 additions and 2 deletions

View File

@@ -340,7 +340,7 @@ export class ClaudeAgentClient implements AgentClient {
if (config.provider !== "claude") {
throw new Error(`ClaudeAgentClient received config for provider '${config.provider}'`);
}
return config;
return { ...config, provider: "claude" };
}
}

10
plan.md
View File

@@ -632,12 +632,20 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- Run `npm run typecheck --workspace=@paseo/server` to verify fix
- **Done (2025-12-25 12:30)**: WHAT: constrained `sanitizeOptionalJson` to return only JSON primitives or undefined in `packages/server/src/server/agent/agent-projections.ts:198`. RESULT: TS2322 for `agent-projections.ts:198` no longer appears in typecheck output; remaining failures are in `claude-agent.ts` and `codex-mcp-agent.ts`. EVIDENCE: `npm run typecheck --workspace=@paseo/server` (errors listed for `src/server/agent/providers/claude-agent.ts:343:5` and multiple `codex-mcp-agent.ts` lines only).
- [ ] **Fix**: Typecheck error in `claude-agent.ts:343` - AgentSessionConfig not assignable to ClaudeAgentConfig.
- [x] **Fix**: Typecheck error in `claude-agent.ts:343` - AgentSessionConfig not assignable to ClaudeAgentConfig.
- Error: TS2322 at `src/server/agent/providers/claude-agent.ts:343:5`
- Issue: `AgentSessionConfig` is not assignable to `ClaudeAgentConfig`
- Either narrow the type or update the interface to be compatible
- Run `npm run typecheck --workspace=@paseo/server` to verify fix
- **Done (2025-12-25 14:11)**: WHAT: returned a Claude-specific config object by forcing `provider: "claude"` in `packages/server/src/server/agent/providers/claude-agent.ts:343`. RESULT: TS2322 for `claude-agent.ts:343` no longer appears; typecheck now fails only in `codex-mcp-agent.ts` (TS2339/TS2366). EVIDENCE: `npm run typecheck --workspace=@paseo/server` (errors reported only in `src/server/agent/providers/codex-mcp-agent.ts`).
- [ ] **Fix**: Typecheck errors in `codex-mcp-agent.ts:3370-3395` - discriminated union not narrowed.
- 15+ TS2339 errors: Property 'query'/'results'/'output'/'items'/'message' does not exist
- The switch on `type` is not narrowing the union properly
- Fix: use `as const` on type literals or proper type guards
- Run `npm run typecheck --workspace=@paseo/server` → zero errors
- [ ] **Fix**: Test hang in `codex-mcp-agent.test.ts` - stuck at 3/13 tests.