feat: add AI provider support (manifest type "ai", onAiChat handler) - #22
feat: add AI provider support (manifest type "ai", onAiChat handler)#22Pierre-Gilles wants to merge 1 commit into
Conversation
Mirror of the Gladys core contract B.19 (GladysAssistant/Gladys#2744): integrations can now declare manifest type "ai" and serve as the AI backend of Gladys in place of Gladys Plus. - New `external-integration.ai.chat` WebSocket message type - New `onAiChat(cb)` handler: receives the OpenAI-compatible chat completion request relayed by the core, resolves an OpenAI-compatible completion acked back as the command-result data (120 s ack window) - The SDK validates the resolved completion (object choices[0].message, same check as the core) and acks the command as failed otherwise - TypeScript typings (AiChatRequest, AiChatCompletion, onAiChat), README section and tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018mwqzunU7Hj5yXKoAwR1hi
|
Warning Review limit reached
Next review available in: 59 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SDK counterpart of GladysAssistant/Gladys#2744 (generic AI provider external integration, contract B.19): integrations can now declare manifest
type: "ai"and serve as the AI backend of Gladys in place of Gladys Plus.What's in
external-integration.ai.chatinWEBSOCKET_MESSAGE_TYPES.EXTERNAL_INTEGRATION.AI_CHAT.onAiChat(cb)handler: receives the OpenAI-compatible chat completion request relayed by the core ({ messages, tools?, tool_choice?, purpose?, categories? }— themodelfield is stripped core-side, picking one is the provider's job) and resolves an OpenAI-compatible completion, acked back as thecommand-resultdata. The core awaits the ack under 120 s (AI_CHAT_TIMEOUT_MS), not the standard 5 s.choices[0].message— anything else (includingundefined) acks the command as failed with an explicit error, instead of letting a malformed completion travel to Gladys and die at the contract boundary (ExternalIntegrationUnavailableError).AiChatRequest,AiChatRequestMessage,AiChatCompletion,AiChatCompletionChoice,AiChatCompletionMessage, theonAiChatmethod and theAI_CHATmessage type.test/ai.test.jsagainst the fake Gladys server (success withdata, tool_calls-only completion, handler throw, malformed completions, "not implemented"), plus compile-time coverage intest/types/api.test-d.ts.Checks
npm test: 185/185 passnpm run coverage: thresholds green (100% stmts/funcs/lines)npm run lint,npm run prettier-check,npm run check-types: clean🤖 Generated with Claude Code
https://claude.ai/code/session_018mwqzunU7Hj5yXKoAwR1hi
Generated by Claude Code