mirror of
https://github.com/larsbaunwall/vscode-copilot-bridge.git
synced 2025-10-05 22:22:59 +00:00
feat(vscode-bridge): Copilot Chat bridge (OpenAI facade + JSON-RPC tools)
- Implements VS Code extension per AGENTS.md specification
- OpenAI-style HTTP facade: POST /v1/chat/completions (SSE), GET /v1/models, GET /healthz
- JSON-RPC WebSocket server with methods: mcp.fs.read/list, mcp.search.code, mcp.symbols.list, mcp.edit.applyPatch, mcp.format.apply, mcp.imports.organize
- Copilot Chat integration via vscode.chat.requestChatAccess('copilot')
- Commands: bridge.enable/disable/status with status bar indicator
- Security: localhost-only binding, optional bearer token, read-only by default
- Policy enforcement via optional .agent-policy.yaml
- Ephemeral port management with globalState persistence
Co-Authored-By: Lars Baunwall <larslb@thinkability.dk>
This commit is contained in:
parent
112475def8
commit
b1105e5869
588 changed files with 548248 additions and 0 deletions
87
vscode-bridge/node_modules/yaml/dist/stringify/stringifyDocument.js
generated
vendored
Normal file
87
vscode-bridge/node_modules/yaml/dist/stringify/stringifyDocument.js
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
'use strict';
|
||||
|
||||
var identity = require('../nodes/identity.js');
|
||||
var stringify = require('./stringify.js');
|
||||
var stringifyComment = require('./stringifyComment.js');
|
||||
|
||||
function stringifyDocument(doc, options) {
|
||||
const lines = [];
|
||||
let hasDirectives = options.directives === true;
|
||||
if (options.directives !== false && doc.directives) {
|
||||
const dir = doc.directives.toString(doc);
|
||||
if (dir) {
|
||||
lines.push(dir);
|
||||
hasDirectives = true;
|
||||
}
|
||||
else if (doc.directives.docStart)
|
||||
hasDirectives = true;
|
||||
}
|
||||
if (hasDirectives)
|
||||
lines.push('---');
|
||||
const ctx = stringify.createStringifyContext(doc, options);
|
||||
const { commentString } = ctx.options;
|
||||
if (doc.commentBefore) {
|
||||
if (lines.length !== 1)
|
||||
lines.unshift('');
|
||||
const cs = commentString(doc.commentBefore);
|
||||
lines.unshift(stringifyComment.indentComment(cs, ''));
|
||||
}
|
||||
let chompKeep = false;
|
||||
let contentComment = null;
|
||||
if (doc.contents) {
|
||||
if (identity.isNode(doc.contents)) {
|
||||
if (doc.contents.spaceBefore && hasDirectives)
|
||||
lines.push('');
|
||||
if (doc.contents.commentBefore) {
|
||||
const cs = commentString(doc.contents.commentBefore);
|
||||
lines.push(stringifyComment.indentComment(cs, ''));
|
||||
}
|
||||
// top-level block scalars need to be indented if followed by a comment
|
||||
ctx.forceBlockIndent = !!doc.comment;
|
||||
contentComment = doc.contents.comment;
|
||||
}
|
||||
const onChompKeep = contentComment ? undefined : () => (chompKeep = true);
|
||||
let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);
|
||||
if (contentComment)
|
||||
body += stringifyComment.lineComment(body, '', commentString(contentComment));
|
||||
if ((body[0] === '|' || body[0] === '>') &&
|
||||
lines[lines.length - 1] === '---') {
|
||||
// Top-level block scalars with a preceding doc marker ought to use the
|
||||
// same line for their header.
|
||||
lines[lines.length - 1] = `--- ${body}`;
|
||||
}
|
||||
else
|
||||
lines.push(body);
|
||||
}
|
||||
else {
|
||||
lines.push(stringify.stringify(doc.contents, ctx));
|
||||
}
|
||||
if (doc.directives?.docEnd) {
|
||||
if (doc.comment) {
|
||||
const cs = commentString(doc.comment);
|
||||
if (cs.includes('\n')) {
|
||||
lines.push('...');
|
||||
lines.push(stringifyComment.indentComment(cs, ''));
|
||||
}
|
||||
else {
|
||||
lines.push(`... ${cs}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lines.push('...');
|
||||
}
|
||||
}
|
||||
else {
|
||||
let dc = doc.comment;
|
||||
if (dc && chompKeep)
|
||||
dc = dc.replace(/^\n+/, '');
|
||||
if (dc) {
|
||||
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')
|
||||
lines.push('');
|
||||
lines.push(stringifyComment.indentComment(commentString(dc), ''));
|
||||
}
|
||||
}
|
||||
return lines.join('\n') + '\n';
|
||||
}
|
||||
|
||||
exports.stringifyDocument = stringifyDocument;
|
||||
Loading…
Add table
Add a link
Reference in a new issue