feat: capture actual model from Claude SDK init message

Update handleSystemMessage() in claude-agent.ts to read the actual model
from the SDK's init message (message.model) instead of just echoing back
the configured model. This gives us the real runtime model that the SDK
selected.

Also invalidates cached runtime info when the model is updated to ensure
getRuntimeInfo() returns the new value.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2025-12-21 16:36:43 +00:00
co-authored by Claude Opus 4.5
parent 845a2120ee
commit e1631fcab6
2 changed files with 8 additions and 1 deletions
@@ -873,6 +873,12 @@ class ClaudeAgentSession implements AgentSession {
this.availableModes = DEFAULT_MODES;
this.currentMode = message.permissionMode;
this.persistence = null;
// Capture actual model from SDK init message (not just the configured model)
if (message.model) {
this.lastOptionsModel = message.model;
// Invalidate cached runtime info so it picks up the new model
this.cachedRuntimeInfo = null;
}
}
private convertUsage(message: SDKResultMessage): AgentUsage | undefined {