Repository navigation
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
Adds a new Microsoft 365 Copilot (BizChat) “web-session” provider (copilot-m365-web) to OmniRoute’s provider registry and routing stack, including a dedicated WebSocket/SignalR executor plus defaults needed to stream assistant text back as OpenAI-compatible SSE.
Changes:
- Introduces
CopilotM365WebExecutorand registers it in the executor factory + provider registry. - Adds M365 BizChat connection/framing defaults (variants + optionSets) and filters Progress/EarlyProgress updates from streamed output.
- Wires provider UI metadata + web-session credential requirements, and updates unit tests for the new defaults.
Review notes (custom):
- Commands run: none (not available in this review environment)
- Changed test files:
tests/unit/m365-connection-4042.test.ts,tests/unit/m365-bizchat-frames-4042.test.ts - Coverage result (custom): not provided / not verified here (required gate:
npm run test:coverage, min 60% for statements/lines/functions/branches)
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/m365-connection-4042.test.ts | Updates WS URL expectations to include default variants. |
| tests/unit/m365-bizchat-frames-4042.test.ts | Adds Progress text fixture + asserts default optionsSets include rich_responses. |
| src/shared/providers/webSessionCredentials.ts | Adds copilot-m365-web web-session credential requirement + placeholder. |
| src/shared/constants/providers/web-cookie.ts | Adds provider UI metadata entry for Microsoft 365 Copilot (BizChat). |
| open-sse/executors/index.ts | Registers the new executor in the executor factory. |
| open-sse/executors/copilot-m365-web.ts | New specialized WebSocket/SignalR transport executor emitting OpenAI-style SSE. |
| open-sse/executors/copilot-m365-frames.ts | Adds default optionsSets and filters Progress/EarlyProgress messages. |
| open-sse/executors/copilot-m365-connection.ts | Adds default variants and includes them in the generated WS URL. |
| open-sse/config/providers/registry/copilot-m365-web/index.ts | New registry entry for the provider. |
| open-sse/config/providers/index.ts | Adds the provider registry entry to the global REGISTRY map. |
| }; | ||
| } | ||
| const host = (typeof psd.host === "string" && psd.host) || M365_INDIVIDUAL_DEFAULTS.host; | ||
| return { host, chathubPath, accessToken }; | ||
| const variants = typeof psd.variants === "string" && psd.variants ? psd.variants : undefined; | ||
| return { host, chathubPath, accessToken, variants }; |
| const abort = (reason: string) => { | ||
| if (settled) return; | ||
| settled = true; | ||
| cleanup(); | ||
| controller.enqueue(encoder.encode(`data: ${JSON.stringify({ error: { message: reason } })}\n\n`)); | ||
| controller.close(); | ||
| }; |
| const reader = wsStream.getReader(); | ||
| const decoder = new TextDecoder(); | ||
| let fullText = ""; | ||
| while (true) { | ||
| const { done, value } = await reader.read(); | ||
| if (done) break; | ||
| for (const line of decoder.decode(value, { stream: true }).split("\n")) { | ||
| if (!line.startsWith("data: ")) continue; | ||
| const data = line.slice(6).trim(); | ||
| if (!data || data === "[DONE]") continue; | ||
| try { | ||
| const parsed = JSON.parse(data); | ||
| const content = parsed.choices?.[0]?.delta?.content; | ||
| if (typeof content === "string") fullText += content; | ||
| } catch { | ||
| /* skip malformed SSE lines */ | ||
| } | ||
| } | ||
| } |
| "copilot-m365-web": { | ||
| id: "copilot-m365-web", | ||
| alias: "m365copilot", | ||
| name: "Microsoft 365 Copilot (BizChat)", | ||
| icon: "business_center", |
Sanitized validation log for individual M365 CopilotAll credentials, user/tenant identifiers, account identifiers, session identifiers, request identifiers, and location-specific values are marked as Browser round-tripFresh non-browser replayImplementation notes from the sanitized logFocused tests |
|
Thanks for this, @skyzea1 — and welcome! 🎉 The M365 Copilot provider integration is well-scoped and follows the provider-adding pattern (registry + executor map +
Once those three are in, this is merge-ready — ping me and I'll review again. Happy to help if anything's unclear on the test mock. |
|
Thanks for this, @skyzea1 — and welcome! 🎉 A live-validated Microsoft 365 Copilot provider is genuinely wanted, and the M365 connection/frames groundwork you contributed earlier is already in the release, so you're building on solid ground. The blocker is purely scope, not the idea. As it stands this branch is 80 commits / ~242 files against a base from June 25, and the 3-dot diff (i.e. excluding base drift) still changes ~99 source files (+5,587/-408) — far beyond the new provider. It bundles several unrelated things into one PR, e.g.:
I can't merge or cleanly salvage it as one unit — it conflicts with the current release and the hot-path changes each need their own review. Could you open a fresh, focused PR onto
Keeping this PR open for reference — just link the new scoped one here when it's up and I'll review it promptly. Really appreciate the contribution! 🙏 |
…seam - Rule cheaper-inference#12: route the three wsChat abort() sinks (handshake error, ws error, connect failure) through sanitizeErrorMessage() so a raw err.message/stack never reaches the SSE data:{error:{message}} frame. - Add an injectable WebSocket test seam (__setWebSocketImplForTests) and a regression test that drives the wsChat error path with a fake ws and asserts the emitted SSE error frame is sanitized (Rule cheaper-inference#18). Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
a58d60e to
4607ae0
Compare
|
Opened the fresh focused PR as requested: #5302 It is based on This PR can stay as reference or be closed, whichever you prefer. |
|
Superseded by your own #5302, which you opened as a focused replacement for this PR. Thanks for reworking it — #5302 is the better landing vehicle: it's branched directly on Closing this one as superseded so we don't land the M365 Copilot provider twice. Your contribution credit lands on #5302. 🙏 |
Summary
copilot-m365-webprovider registry entry and specialized executor for Microsoft 365 Copilot BizChat.variants/optionsSetsdefaults required for live text responses, while redacting all credentials and account-specific values.Validation
m365.cloud.microsoft/chatcompleted on 2026-06-29.REDACTED.wss://substrate.office.com/m365Copilot/Chathub/REDACTED?...access_token=REDACTED.type:4chat invocation producedtype:1updates,type:2final item, andtype:3completion.Reply with exactly one word: pong; response:pong.variantsandoptionsSetswere included. Empty option flags completed without assistant text.Tests
npm exec -- tsx --import ./open-sse/utils/setupPolyfill.ts --test tests/unit/m365-connection-4042.test.ts tests/unit/m365-bizchat-frames-4042.test.tsFollow-up to #4400 / #4042.