throw new Error('CAPI response has no body');
}
yield* this._readSSE(response.body);
}
Frontier kind: Code frontier
unlabeled · c_77fda814b587
25 tests · 20236 LOC · 84 files · introduces 0 tests · 47 LOC · 1 file
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService CopilotApiError contract SSE error frame missing type: defaults to api_error|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Streaming Responses throws on error event with message|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Streaming Responses handles data split across multiple network chunks|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Streaming Responses yields text deltas from content_block_delta events|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService CopilotApiError contract SSE error frame with conforming envelope is preserved verbatim (extra fields propagate)|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService CopilotApiError contract SSE error frame with full envelope: passthrough type and message|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Streaming Responses handles a data line split right at the newline boundary|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Streaming Responses handles many small deltas|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Cancellation cancels the underlying SSE stream after message_stop terminates the generator|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) message_stop is the last yielded event|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) stops after message_stop even if extra SSE data follows|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) tool_use block events round-trip through messages()|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) yields all six protocol event types in order|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) yields input_json_delta events|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) yields message_delta with stop_reason payload|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Raw Event Stream (messages()) yields thinking_delta events (not filtered by messages())|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/shared/copilotApiService.test|title=CopilotApiService Request Format streaming sends stream=true in the body|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/charCode.test|title=CharCode has good values|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/path.test|title=Paths (Node Implementation) path|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI File paths containing apostrophes break URI parsing and cannot be opened #276075|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI URI#file, win-speciale|occurrence=1Every collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 47 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
throw new Error('CAPI response has no body');
}
yield* this._readSSE(response.body);
}
private async *_readSSE(body: ReadableStream<Uint8Array>): AsyncGenerator<Anthropic.MessageStreamEvent> {
const decoder = new TextDecoder();
let buffer = '';
try {
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split('\n');
buffer = lines.pop() ?? '';
for (const line of lines) {
const event = this._parseDataLine(line);
if (event !== undefined) {
yield event;
if (event.type === 'message_stop') {
}
}
// Cancel the underlying stream so the HTTP connection is released
// even when the consumer abandons the generator early (break, throw,
// abort) or the stream ended on `message_stop` with bytes still in
// flight. `releaseLock` alone leaves the body half-read.
try {
await reader.cancel();
} catch {
// ignore — cancellation is best-effort cleanup
}
}
}
/**
*/
private _parseDataLine(line: string): Anthropic.MessageStreamEvent | undefined {
return undefined;
}
const data = line.slice('data: '.length).trim();
let parsed: unknown;
try {
parsed = JSON.parse(data);
} catch {
this._logService.warn('[CopilotApiService] Failed to parse SSE data:', data);
return undefined;
}
if (typeof parsed !== 'object' || parsed === null) {
return undefined;
}
const record = parsed as Record<string, unknown>;
const type = record.type;
if (typeof type !== 'string') {
return undefined;
}
if (type === 'error') {
// Preserve the upstream envelope verbatim when it conforms to the
// Anthropic shape (so any extra fields propagate to Phase 2's
return parsed as Anthropic.MessageStreamEvent;
// #endregion