Skip to content

refactor(ai): tighten openai-chat typing without base extraction#93

Merged
NaNomicon merged 2 commits intomainfrom
refactor/openai-chat-type-safety
Apr 10, 2026
Merged

refactor(ai): tighten openai-chat typing without base extraction#93
NaNomicon merged 2 commits intomainfrom
refactor/openai-chat-type-safety

Conversation

@NaNomicon
Copy link
Copy Markdown
Collaborator

Summary

Cherry-picked from #92 — type-safety improvements only, without the unrelated plugin id change.

  • Tightens typing in OpenAIChatCompletionProvider: typed interfaces (APIMessage, RequestBody, AssistantSessionMessage, ToolCallResponse), type guards (isErrorResponseBody, hasNonEmptyChoices), ProviderConfig instead of any in constructor, proper content: string | null handling
  • Uses resolved local variables (maxIterations, iterationTimeout) in error messages instead of potentially-undefined config values
  • Adds filterIncompleteToolCallSequences with proper AIMessage[] typing
  • Adds 442-line provider-focused test suite
  • Updates config template to clarify openai-chat works for any OpenAI-compatible endpoint (DeepSeek, Groq, etc.)

Original work by @regulusleow. Split from #92 to keep the plugin id change separate.

machen added 2 commits April 10, 2026 11:18
Apply typed request/response guards directly in openai-chat-completion and remove any usage in the provider implementation. Add provider-focused tests and clarify config comments for OpenAI-compatible endpoints.
@NaNomicon NaNomicon merged commit 7d43059 into main Apr 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant