Extract duplicated patterns from openai-completions.ts, openai-responses.ts, and azure-openai-responses.ts into a new openai-shared.ts module: - getOpenAIClass: unified lazy SDK loading (was duplicated in both) - createOpenAIClient: shared client creation with Copilot headers, options header merging, and lazy loading (was ~30 lines each) - buildInitialOutput: AssistantMessage initialization (was ~15 lines x3) - assertStreamSuccess / finalizeStream / handleStreamError: stream lifecycle helpers (was ~10 lines each x3) - clampReasoningForModel: reasoning effort clamping for gpt-5.x models (was duplicated in openai-responses.ts and azure-openai-responses.ts) Net reduction: ~185 lines removed across the three provider files. |
||
|---|---|---|
| .. | ||
| native | ||
| pi-agent-core | ||
| pi-ai | ||
| pi-coding-agent | ||
| pi-tui | ||