mirror of
https://github.com/github/awesome-copilot.git
synced 2026-05-28 01:21:46 +00:00
fix(copilot-sdk-nodejs): correct assistant message delta event name (#1712)
The accessibility-report recipe and its companion doc used "assistant.message.delta" (dotted), which never matches the SDK event. The canonical name is "assistant.message_delta" (underscore), as documented in instructions/copilot-sdk-nodejs.instructions.md and used by the Python cookbook. Without this fix the streaming branch was dead and no incremental output was printed. (cherry picked from commit e050d7bfc96c55924b0bf534c8b3e57359463ba9) Signed-off-by: syalioune <sy_alioune@yahoo.fr>
This commit is contained in:
@@ -90,7 +90,7 @@ async function main() {
|
|||||||
let idleResolve: (() => void) | null = null;
|
let idleResolve: (() => void) | null = null;
|
||||||
|
|
||||||
session.on((event) => {
|
session.on((event) => {
|
||||||
if (event.type === "assistant.message.delta") {
|
if (event.type === "assistant.message_delta") {
|
||||||
process.stdout.write(event.data.deltaContent ?? "");
|
process.stdout.write(event.data.deltaContent ?? "");
|
||||||
} else if (event.type === "session.idle") {
|
} else if (event.type === "session.idle") {
|
||||||
idleResolve?.();
|
idleResolve?.();
|
||||||
@@ -179,7 +179,7 @@ main().catch(console.error);
|
|||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
1. **Playwright MCP server**: Configures a local MCP server running `@playwright/mcp` to provide browser automation tools
|
1. **Playwright MCP server**: Configures a local MCP server running `@playwright/mcp` to provide browser automation tools
|
||||||
2. **Streaming output**: Uses `streaming: true` and `assistant.message.delta` events for real-time token-by-token output
|
2. **Streaming output**: Uses `streaming: true` and `assistant.message_delta` events for real-time token-by-token output
|
||||||
3. **Accessibility snapshot**: Playwright's `browser_snapshot` tool captures the full accessibility tree of the page
|
3. **Accessibility snapshot**: Playwright's `browser_snapshot` tool captures the full accessibility tree of the page
|
||||||
4. **Structured report**: The prompt engineers a consistent WCAG-aligned report format with emoji severity indicators
|
4. **Structured report**: The prompt engineers a consistent WCAG-aligned report format with emoji severity indicators
|
||||||
5. **Test generation**: Optionally detects the project language and generates Playwright accessibility tests
|
5. **Test generation**: Optionally detects the project language and generates Playwright accessibility tests
|
||||||
@@ -212,7 +212,7 @@ Unlike `sendAndWait`, this recipe uses streaming for real-time output:
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
session.on((event) => {
|
session.on((event) => {
|
||||||
if (event.type === "assistant.message.delta") {
|
if (event.type === "assistant.message_delta") {
|
||||||
process.stdout.write(event.data.deltaContent ?? "");
|
process.stdout.write(event.data.deltaContent ?? "");
|
||||||
} else if (event.type === "session.idle") {
|
} else if (event.type === "session.idle") {
|
||||||
idleResolve?.();
|
idleResolve?.();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ async function main() {
|
|||||||
let idleResolve: (() => void) | null = null;
|
let idleResolve: (() => void) | null = null;
|
||||||
|
|
||||||
session.on((event) => {
|
session.on((event) => {
|
||||||
if (event.type === "assistant.message.delta") {
|
if (event.type === "assistant.message_delta") {
|
||||||
process.stdout.write(event.data.deltaContent ?? "");
|
process.stdout.write(event.data.deltaContent ?? "");
|
||||||
} else if (event.type === "session.idle") {
|
} else if (event.type === "session.idle") {
|
||||||
idleResolve?.();
|
idleResolve?.();
|
||||||
|
|||||||
Reference in New Issue
Block a user