@shardworks/copilot-apparatus 0.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +528 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sean Boots
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot Session Provider
|
|
3
|
+
*
|
|
4
|
+
* Apparatus plugin that implements AnimatorSessionProvider using the
|
|
5
|
+
* GitHub Models REST API (OpenAI-compatible). The Animator discovers
|
|
6
|
+
* this via guild config:
|
|
7
|
+
*
|
|
8
|
+
* guild.json["animator"]["sessionProvider"] = "copilot"
|
|
9
|
+
*
|
|
10
|
+
* Calls the chat completions endpoint, runs an in-process agentic
|
|
11
|
+
* tool-call loop when tools are supplied, and supports streaming via SSE.
|
|
12
|
+
*
|
|
13
|
+
* Key design choice: calls tool handlers directly in-process (no MCP server).
|
|
14
|
+
* This is simpler than the claude-code approach since we control the API
|
|
15
|
+
* request/response cycle directly.
|
|
16
|
+
*/
|
|
17
|
+
import type { Plugin } from '@shardworks/nexus-core';
|
|
18
|
+
import type { ResolvedTool } from '@shardworks/tools-apparatus';
|
|
19
|
+
/** Plugin configuration stored at guild.json["copilot"]. */
|
|
20
|
+
export interface CopilotConfig {
|
|
21
|
+
/**
|
|
22
|
+
* Chat completions API base endpoint URL.
|
|
23
|
+
* Default: 'https://models.inference.ai.azure.com'
|
|
24
|
+
*/
|
|
25
|
+
apiEndpoint?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Name of the environment variable holding the API bearer token.
|
|
28
|
+
* Default: 'GITHUB_TOKEN'
|
|
29
|
+
*/
|
|
30
|
+
tokenEnvVar?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of tool-call rounds in the agentic loop.
|
|
33
|
+
* When reached, the session completes with the last available response.
|
|
34
|
+
* Default: 50
|
|
35
|
+
*/
|
|
36
|
+
maxToolRounds?: number;
|
|
37
|
+
}
|
|
38
|
+
declare module '@shardworks/nexus-core' {
|
|
39
|
+
interface GuildConfig {
|
|
40
|
+
copilot?: CopilotConfig;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** OpenAI-compatible chat completion message. */
|
|
44
|
+
interface ChatMessage {
|
|
45
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
46
|
+
content: string | null;
|
|
47
|
+
tool_calls?: ToolCall[];
|
|
48
|
+
tool_call_id?: string;
|
|
49
|
+
/** Index signature makes ChatMessage compatible with Record<string, unknown>. */
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
/** OpenAI-compatible tool call from an assistant response. */
|
|
53
|
+
interface ToolCall {
|
|
54
|
+
id: string;
|
|
55
|
+
type: 'function';
|
|
56
|
+
function: {
|
|
57
|
+
name: string;
|
|
58
|
+
arguments: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** OpenAI-compatible function tool definition for the API request. */
|
|
62
|
+
interface ToolDef {
|
|
63
|
+
type: 'function';
|
|
64
|
+
function: {
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
parameters: Record<string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Convert ResolvedTool array to OpenAI function tool format.
|
|
72
|
+
*
|
|
73
|
+
* Uses z.toJSONSchema() to convert Zod params schema to JSON Schema.
|
|
74
|
+
*
|
|
75
|
+
* @internal Exported for testing only.
|
|
76
|
+
*/
|
|
77
|
+
export declare function convertTools(tools: ResolvedTool[]): ToolDef[];
|
|
78
|
+
/**
|
|
79
|
+
* Extract the output text from the last assistant message with no tool_calls.
|
|
80
|
+
*
|
|
81
|
+
* Walks the messages array backwards to find the last assistant message
|
|
82
|
+
* that is a "final" response (no pending tool calls).
|
|
83
|
+
*
|
|
84
|
+
* @internal Exported for testing only.
|
|
85
|
+
*/
|
|
86
|
+
export declare function extractOutput(messages: ChatMessage[]): string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Parse SSE data lines from a buffer, invoking handler for each parsed data value.
|
|
89
|
+
* Returns the remaining incomplete buffer.
|
|
90
|
+
*
|
|
91
|
+
* @internal Exported for testing only.
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseSseLines(buffer: string, handler: (data: string) => void): string;
|
|
94
|
+
/**
|
|
95
|
+
* Create the Copilot session provider apparatus.
|
|
96
|
+
*
|
|
97
|
+
* The apparatus reads CopilotConfig from guild config at start() time
|
|
98
|
+
* and provides an AnimatorSessionProvider backed by the GitHub Models API.
|
|
99
|
+
*/
|
|
100
|
+
export declare function createCopilotProvider(): Plugin;
|
|
101
|
+
declare const _default: Plugin;
|
|
102
|
+
export default _default;
|
|
103
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAOrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAIhE,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAU,WAAW;QACnB,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;CACF;AAID,iDAAiD;AACjD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,8DAA8D;AAC9D,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,sEAAsE;AACtE,UAAU,OAAO;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC;CACH;AAwDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,CAS7D;AAID;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,GAAG,SAAS,CAQzE;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAYrF;AAuWD;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CA0L9C;;AAED,wBAAuC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot Session Provider
|
|
3
|
+
*
|
|
4
|
+
* Apparatus plugin that implements AnimatorSessionProvider using the
|
|
5
|
+
* GitHub Models REST API (OpenAI-compatible). The Animator discovers
|
|
6
|
+
* this via guild config:
|
|
7
|
+
*
|
|
8
|
+
* guild.json["animator"]["sessionProvider"] = "copilot"
|
|
9
|
+
*
|
|
10
|
+
* Calls the chat completions endpoint, runs an in-process agentic
|
|
11
|
+
* tool-call loop when tools are supplied, and supports streaming via SSE.
|
|
12
|
+
*
|
|
13
|
+
* Key design choice: calls tool handlers directly in-process (no MCP server).
|
|
14
|
+
* This is simpler than the claude-code approach since we control the API
|
|
15
|
+
* request/response cycle directly.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { guild } from '@shardworks/nexus-core';
|
|
19
|
+
// ── Tool conversion ─────────────────────────────────────────────────
|
|
20
|
+
/**
|
|
21
|
+
* Convert ResolvedTool array to OpenAI function tool format.
|
|
22
|
+
*
|
|
23
|
+
* Uses z.toJSONSchema() to convert Zod params schema to JSON Schema.
|
|
24
|
+
*
|
|
25
|
+
* @internal Exported for testing only.
|
|
26
|
+
*/
|
|
27
|
+
export function convertTools(tools) {
|
|
28
|
+
return tools.map((rt) => ({
|
|
29
|
+
type: 'function',
|
|
30
|
+
function: {
|
|
31
|
+
name: rt.definition.name,
|
|
32
|
+
description: rt.definition.description,
|
|
33
|
+
parameters: z.toJSONSchema(rt.definition.params),
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
// ── Output extraction ───────────────────────────────────────────────
|
|
38
|
+
/**
|
|
39
|
+
* Extract the output text from the last assistant message with no tool_calls.
|
|
40
|
+
*
|
|
41
|
+
* Walks the messages array backwards to find the last assistant message
|
|
42
|
+
* that is a "final" response (no pending tool calls).
|
|
43
|
+
*
|
|
44
|
+
* @internal Exported for testing only.
|
|
45
|
+
*/
|
|
46
|
+
export function extractOutput(messages) {
|
|
47
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
48
|
+
const msg = messages[i];
|
|
49
|
+
if (msg.role !== 'assistant')
|
|
50
|
+
continue;
|
|
51
|
+
if (msg.tool_calls && msg.tool_calls.length > 0)
|
|
52
|
+
continue;
|
|
53
|
+
if (msg.content)
|
|
54
|
+
return msg.content;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
// ── SSE parsing ─────────────────────────────────────────────────────
|
|
59
|
+
/**
|
|
60
|
+
* Parse SSE data lines from a buffer, invoking handler for each parsed data value.
|
|
61
|
+
* Returns the remaining incomplete buffer.
|
|
62
|
+
*
|
|
63
|
+
* @internal Exported for testing only.
|
|
64
|
+
*/
|
|
65
|
+
export function parseSseLines(buffer, handler) {
|
|
66
|
+
let idx;
|
|
67
|
+
while ((idx = buffer.indexOf('\n')) !== -1) {
|
|
68
|
+
const line = buffer.slice(0, idx).trim();
|
|
69
|
+
buffer = buffer.slice(idx + 1);
|
|
70
|
+
if (line.startsWith('data: ')) {
|
|
71
|
+
const data = line.slice(6);
|
|
72
|
+
if (data === '[DONE]')
|
|
73
|
+
continue;
|
|
74
|
+
handler(data);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return buffer;
|
|
78
|
+
}
|
|
79
|
+
// ── API helpers ─────────────────────────────────────────────────────
|
|
80
|
+
/**
|
|
81
|
+
* Make a non-streaming API call and return the parsed response.
|
|
82
|
+
*
|
|
83
|
+
* @throws When the HTTP response is not ok, with the status and body.
|
|
84
|
+
*/
|
|
85
|
+
async function callApi(apiEndpoint, token, model, messages, apiTools) {
|
|
86
|
+
const response = await fetch(`${apiEndpoint}/chat/completions`, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: {
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
'Authorization': `Bearer ${token}`,
|
|
91
|
+
},
|
|
92
|
+
body: JSON.stringify({
|
|
93
|
+
model,
|
|
94
|
+
messages,
|
|
95
|
+
...(apiTools.length > 0 ? { tools: apiTools } : {}),
|
|
96
|
+
stream: false,
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
const body = await response.text();
|
|
101
|
+
throw new Error(`GitHub Models API error: ${response.status} ${body}`);
|
|
102
|
+
}
|
|
103
|
+
return response.json();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Make a streaming API call, yielding chunks and returning the accumulated assistant message.
|
|
107
|
+
*
|
|
108
|
+
* Parses SSE events, yields SessionChunk objects in real time, and accumulates
|
|
109
|
+
* tool call fragments across delta chunks. Returns the fully assembled assistant
|
|
110
|
+
* message and final usage info.
|
|
111
|
+
*/
|
|
112
|
+
async function* callApiStreaming(apiEndpoint, token, model, messages, apiTools, acc) {
|
|
113
|
+
const response = await fetch(`${apiEndpoint}/chat/completions`, {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
headers: {
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
'Authorization': `Bearer ${token}`,
|
|
118
|
+
},
|
|
119
|
+
body: JSON.stringify({
|
|
120
|
+
model,
|
|
121
|
+
messages,
|
|
122
|
+
...(apiTools.length > 0 ? { tools: apiTools } : {}),
|
|
123
|
+
stream: true,
|
|
124
|
+
stream_options: { include_usage: true },
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
const body = await response.text();
|
|
129
|
+
throw new Error(`GitHub Models API error: ${response.status} ${body}`);
|
|
130
|
+
}
|
|
131
|
+
if (!response.body) {
|
|
132
|
+
throw new Error('GitHub Models API error: no response body for streaming request');
|
|
133
|
+
}
|
|
134
|
+
// Accumulate tool call fragments keyed by index
|
|
135
|
+
const toolCallFragments = new Map();
|
|
136
|
+
let textContent = '';
|
|
137
|
+
let lastId = '';
|
|
138
|
+
let buffer = '';
|
|
139
|
+
const reader = response.body.getReader();
|
|
140
|
+
const decoder = new TextDecoder();
|
|
141
|
+
try {
|
|
142
|
+
while (true) {
|
|
143
|
+
const { done, value } = await reader.read();
|
|
144
|
+
if (done)
|
|
145
|
+
break;
|
|
146
|
+
buffer += decoder.decode(value, { stream: true });
|
|
147
|
+
// Process complete SSE lines
|
|
148
|
+
const chunks = [];
|
|
149
|
+
buffer = parseSseLines(buffer, (data) => {
|
|
150
|
+
try {
|
|
151
|
+
chunks.push(JSON.parse(data));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Skip malformed JSON
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
for (const chunk of chunks) {
|
|
158
|
+
if (chunk.id)
|
|
159
|
+
lastId = chunk.id;
|
|
160
|
+
// Accumulate usage from the final chunk (stream_options.include_usage)
|
|
161
|
+
if (chunk.usage) {
|
|
162
|
+
acc.tokenUsage.inputTokens += chunk.usage.prompt_tokens;
|
|
163
|
+
acc.tokenUsage.outputTokens += chunk.usage.completion_tokens;
|
|
164
|
+
}
|
|
165
|
+
const choice = chunk.choices[0];
|
|
166
|
+
if (!choice)
|
|
167
|
+
continue;
|
|
168
|
+
const delta = choice.delta;
|
|
169
|
+
// Text content delta
|
|
170
|
+
if (delta.content != null && delta.content !== '') {
|
|
171
|
+
textContent += delta.content;
|
|
172
|
+
process.stderr.write(delta.content);
|
|
173
|
+
yield { type: 'text', text: delta.content };
|
|
174
|
+
}
|
|
175
|
+
// Tool call deltas — accumulate by index
|
|
176
|
+
if (delta.tool_calls) {
|
|
177
|
+
for (const tc of delta.tool_calls) {
|
|
178
|
+
const existing = toolCallFragments.get(tc.index);
|
|
179
|
+
if (!existing) {
|
|
180
|
+
// First fragment for this tool call — must have id and name
|
|
181
|
+
const frag = {
|
|
182
|
+
id: tc.id ?? '',
|
|
183
|
+
name: tc.function?.name ?? '',
|
|
184
|
+
arguments: tc.function?.arguments ?? '',
|
|
185
|
+
};
|
|
186
|
+
toolCallFragments.set(tc.index, frag);
|
|
187
|
+
if (frag.name) {
|
|
188
|
+
yield { type: 'tool_use', tool: frag.name };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
// Subsequent fragment — accumulate arguments and fill in missing fields
|
|
193
|
+
if (tc.id && !existing.id)
|
|
194
|
+
existing.id = tc.id;
|
|
195
|
+
if (tc.function?.name && !existing.name) {
|
|
196
|
+
existing.name = tc.function.name;
|
|
197
|
+
yield { type: 'tool_use', tool: existing.name };
|
|
198
|
+
}
|
|
199
|
+
if (tc.function?.arguments)
|
|
200
|
+
existing.arguments += tc.function.arguments;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
reader.releaseLock();
|
|
209
|
+
}
|
|
210
|
+
if (lastId)
|
|
211
|
+
acc.providerSessionId = lastId;
|
|
212
|
+
// Reconstruct the full assistant message from accumulated deltas
|
|
213
|
+
const toolCalls = [];
|
|
214
|
+
for (const [, frag] of toolCallFragments) {
|
|
215
|
+
toolCalls.push({
|
|
216
|
+
id: frag.id,
|
|
217
|
+
type: 'function',
|
|
218
|
+
function: { name: frag.name, arguments: frag.arguments },
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
const assistantMsg = {
|
|
222
|
+
role: 'assistant',
|
|
223
|
+
content: textContent || null,
|
|
224
|
+
...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),
|
|
225
|
+
};
|
|
226
|
+
return assistantMsg;
|
|
227
|
+
}
|
|
228
|
+
// ── Agentic loop (non-streaming) ────────────────────────────────────
|
|
229
|
+
/**
|
|
230
|
+
* Run the full agentic tool-call loop without streaming.
|
|
231
|
+
*
|
|
232
|
+
* Makes API calls, executes tools, sends results back, and repeats until
|
|
233
|
+
* the model returns a response with no tool_calls or the iteration limit.
|
|
234
|
+
*/
|
|
235
|
+
async function runAgenticLoop(apiEndpoint, token, model, messages, apiTools, toolMap, maxRounds, acc) {
|
|
236
|
+
// Make the initial API call
|
|
237
|
+
let apiResponse = await callApi(apiEndpoint, token, model, messages, apiTools);
|
|
238
|
+
acc.tokenUsage.inputTokens += apiResponse.usage?.prompt_tokens ?? 0;
|
|
239
|
+
acc.tokenUsage.outputTokens += apiResponse.usage?.completion_tokens ?? 0;
|
|
240
|
+
acc.providerSessionId = apiResponse.id;
|
|
241
|
+
const firstChoice = apiResponse.choices[0];
|
|
242
|
+
if (!firstChoice)
|
|
243
|
+
return;
|
|
244
|
+
let assistantMsg = {
|
|
245
|
+
role: 'assistant',
|
|
246
|
+
content: firstChoice.message.content,
|
|
247
|
+
...(firstChoice.message.tool_calls && firstChoice.message.tool_calls.length > 0
|
|
248
|
+
? { tool_calls: firstChoice.message.tool_calls }
|
|
249
|
+
: {}),
|
|
250
|
+
};
|
|
251
|
+
messages.push(assistantMsg);
|
|
252
|
+
acc.transcript.push(assistantMsg);
|
|
253
|
+
let round = 0;
|
|
254
|
+
while (assistantMsg.tool_calls &&
|
|
255
|
+
assistantMsg.tool_calls.length > 0 &&
|
|
256
|
+
round < maxRounds) {
|
|
257
|
+
round++;
|
|
258
|
+
// Execute each tool call and collect results
|
|
259
|
+
for (const toolCall of assistantMsg.tool_calls) {
|
|
260
|
+
const toolResult = await executeToolCall(toolCall, toolMap);
|
|
261
|
+
const toolMsg = {
|
|
262
|
+
role: 'tool',
|
|
263
|
+
content: toolResult,
|
|
264
|
+
tool_call_id: toolCall.id,
|
|
265
|
+
};
|
|
266
|
+
messages.push(toolMsg);
|
|
267
|
+
acc.transcript.push(toolMsg);
|
|
268
|
+
}
|
|
269
|
+
// Make the next API call with tool results
|
|
270
|
+
apiResponse = await callApi(apiEndpoint, token, model, messages, apiTools);
|
|
271
|
+
acc.tokenUsage.inputTokens += apiResponse.usage?.prompt_tokens ?? 0;
|
|
272
|
+
acc.tokenUsage.outputTokens += apiResponse.usage?.completion_tokens ?? 0;
|
|
273
|
+
acc.providerSessionId = apiResponse.id;
|
|
274
|
+
const choice = apiResponse.choices[0];
|
|
275
|
+
if (!choice)
|
|
276
|
+
break;
|
|
277
|
+
assistantMsg = {
|
|
278
|
+
role: 'assistant',
|
|
279
|
+
content: choice.message.content,
|
|
280
|
+
...(choice.message.tool_calls && choice.message.tool_calls.length > 0
|
|
281
|
+
? { tool_calls: choice.message.tool_calls }
|
|
282
|
+
: {}),
|
|
283
|
+
};
|
|
284
|
+
messages.push(assistantMsg);
|
|
285
|
+
acc.transcript.push(assistantMsg);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Run the full agentic tool-call loop with streaming.
|
|
290
|
+
*
|
|
291
|
+
* Yields chunks from each API call, executes tools, sends results back.
|
|
292
|
+
*/
|
|
293
|
+
async function* runAgenticLoopStreaming(apiEndpoint, token, model, messages, apiTools, toolMap, maxRounds, acc) {
|
|
294
|
+
// Make the initial streaming API call
|
|
295
|
+
const gen = callApiStreaming(apiEndpoint, token, model, messages, apiTools, acc);
|
|
296
|
+
let assistantMsg;
|
|
297
|
+
// Yield chunks from the generator and capture the return value
|
|
298
|
+
while (true) {
|
|
299
|
+
const result = await gen.next();
|
|
300
|
+
if (result.done) {
|
|
301
|
+
assistantMsg = result.value;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
yield result.value;
|
|
305
|
+
}
|
|
306
|
+
messages.push(assistantMsg);
|
|
307
|
+
acc.transcript.push(assistantMsg);
|
|
308
|
+
let round = 0;
|
|
309
|
+
while (assistantMsg.tool_calls &&
|
|
310
|
+
assistantMsg.tool_calls.length > 0 &&
|
|
311
|
+
round < maxRounds) {
|
|
312
|
+
round++;
|
|
313
|
+
// Execute each tool call and collect results
|
|
314
|
+
for (const toolCall of assistantMsg.tool_calls) {
|
|
315
|
+
const toolResult = await executeToolCall(toolCall, toolMap);
|
|
316
|
+
const toolMsg = {
|
|
317
|
+
role: 'tool',
|
|
318
|
+
content: toolResult,
|
|
319
|
+
tool_call_id: toolCall.id,
|
|
320
|
+
};
|
|
321
|
+
messages.push(toolMsg);
|
|
322
|
+
acc.transcript.push(toolMsg);
|
|
323
|
+
yield { type: 'tool_result', tool: toolCall.id };
|
|
324
|
+
}
|
|
325
|
+
// Make the next streaming API call
|
|
326
|
+
const nextGen = callApiStreaming(apiEndpoint, token, model, messages, apiTools, acc);
|
|
327
|
+
while (true) {
|
|
328
|
+
const result = await nextGen.next();
|
|
329
|
+
if (result.done) {
|
|
330
|
+
assistantMsg = result.value;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
yield result.value;
|
|
334
|
+
}
|
|
335
|
+
messages.push(assistantMsg);
|
|
336
|
+
acc.transcript.push(assistantMsg);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// ── Tool execution ─────────────────────────────────────────────────
|
|
340
|
+
/**
|
|
341
|
+
* Execute a single tool call and return the result string.
|
|
342
|
+
*
|
|
343
|
+
* Catches all errors and returns them as error strings rather than
|
|
344
|
+
* propagating — the model receives the error and may retry or recover.
|
|
345
|
+
*/
|
|
346
|
+
async function executeToolCall(toolCall, toolMap) {
|
|
347
|
+
const tool = toolMap.get(toolCall.function.name);
|
|
348
|
+
if (!tool) {
|
|
349
|
+
return `Error: Unknown tool: ${toolCall.function.name}`;
|
|
350
|
+
}
|
|
351
|
+
try {
|
|
352
|
+
const args = JSON.parse(toolCall.function.arguments);
|
|
353
|
+
const parsed = tool.definition.params.parse(args);
|
|
354
|
+
const rawResult = await tool.definition.handler(parsed);
|
|
355
|
+
if (typeof rawResult === 'string')
|
|
356
|
+
return rawResult;
|
|
357
|
+
return JSON.stringify(rawResult, null, 2);
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
361
|
+
return `Error: ${message}`;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// ── Provider implementation ──────────────────────────────────────────
|
|
365
|
+
/**
|
|
366
|
+
* Create the Copilot session provider apparatus.
|
|
367
|
+
*
|
|
368
|
+
* The apparatus reads CopilotConfig from guild config at start() time
|
|
369
|
+
* and provides an AnimatorSessionProvider backed by the GitHub Models API.
|
|
370
|
+
*/
|
|
371
|
+
export function createCopilotProvider() {
|
|
372
|
+
let config = {};
|
|
373
|
+
const provider = {
|
|
374
|
+
name: 'copilot',
|
|
375
|
+
launch(sessionConfig) {
|
|
376
|
+
// Resolve config values with defaults
|
|
377
|
+
const apiEndpoint = (config.apiEndpoint ?? 'https://models.inference.ai.azure.com').replace(/\/$/, '');
|
|
378
|
+
const tokenEnvVar = config.tokenEnvVar ?? 'GITHUB_TOKEN';
|
|
379
|
+
const maxRounds = config.maxToolRounds ?? 50;
|
|
380
|
+
const acc = {
|
|
381
|
+
transcript: [],
|
|
382
|
+
tokenUsage: { inputTokens: 0, outputTokens: 0 },
|
|
383
|
+
};
|
|
384
|
+
// Build initial messages from config
|
|
385
|
+
const messages = [];
|
|
386
|
+
if (sessionConfig.systemPrompt) {
|
|
387
|
+
const systemMsg = { role: 'system', content: sessionConfig.systemPrompt };
|
|
388
|
+
messages.push(systemMsg);
|
|
389
|
+
acc.transcript.push(systemMsg);
|
|
390
|
+
}
|
|
391
|
+
if (sessionConfig.initialPrompt) {
|
|
392
|
+
const userMsg = { role: 'user', content: sessionConfig.initialPrompt };
|
|
393
|
+
messages.push(userMsg);
|
|
394
|
+
acc.transcript.push(userMsg);
|
|
395
|
+
}
|
|
396
|
+
// Convert tools
|
|
397
|
+
const tools = sessionConfig.tools ?? [];
|
|
398
|
+
const apiTools = convertTools(tools);
|
|
399
|
+
const toolMap = new Map(tools.map((rt) => [rt.definition.name, rt]));
|
|
400
|
+
if (sessionConfig.streaming) {
|
|
401
|
+
// ── Streaming mode ────────────────────────────────────────────
|
|
402
|
+
// Use a push queue + resolve callback to bridge the async generator
|
|
403
|
+
// into a pull-based async iterable.
|
|
404
|
+
const chunkQueue = [];
|
|
405
|
+
let chunkResolve = null;
|
|
406
|
+
let done = false;
|
|
407
|
+
let streamError = null;
|
|
408
|
+
const result = (async () => {
|
|
409
|
+
// Validate token
|
|
410
|
+
const token = process.env[tokenEnvVar];
|
|
411
|
+
if (!token) {
|
|
412
|
+
throw new Error(`Copilot session provider requires a GitHub token. ` +
|
|
413
|
+
`Set the ${tokenEnvVar} environment variable.`);
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
const gen = runAgenticLoopStreaming(apiEndpoint, token, sessionConfig.model, messages, apiTools, toolMap, maxRounds, acc);
|
|
417
|
+
for await (const chunk of gen) {
|
|
418
|
+
chunkQueue.push(chunk);
|
|
419
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
420
|
+
const notify = chunkResolve;
|
|
421
|
+
chunkResolve = null;
|
|
422
|
+
notify?.();
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
status: 'completed',
|
|
426
|
+
exitCode: 0,
|
|
427
|
+
providerSessionId: acc.providerSessionId,
|
|
428
|
+
tokenUsage: acc.tokenUsage,
|
|
429
|
+
costUsd: undefined,
|
|
430
|
+
transcript: acc.transcript,
|
|
431
|
+
output: extractOutput(messages),
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
catch (err) {
|
|
435
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
436
|
+
streamError = err instanceof Error ? err : new Error(message);
|
|
437
|
+
return {
|
|
438
|
+
status: 'failed',
|
|
439
|
+
exitCode: 1,
|
|
440
|
+
error: message,
|
|
441
|
+
transcript: acc.transcript,
|
|
442
|
+
tokenUsage: acc.tokenUsage.inputTokens > 0 ? acc.tokenUsage : undefined,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
finally {
|
|
446
|
+
done = true;
|
|
447
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
448
|
+
const notify = chunkResolve;
|
|
449
|
+
chunkResolve = null;
|
|
450
|
+
notify?.();
|
|
451
|
+
}
|
|
452
|
+
})();
|
|
453
|
+
// Async iterable that drains the chunk queue, pausing between batches
|
|
454
|
+
const chunks = {
|
|
455
|
+
[Symbol.asyncIterator]() {
|
|
456
|
+
return {
|
|
457
|
+
async next() {
|
|
458
|
+
while (true) {
|
|
459
|
+
if (chunkQueue.length > 0) {
|
|
460
|
+
return { value: chunkQueue.shift(), done: false };
|
|
461
|
+
}
|
|
462
|
+
if (done || streamError) {
|
|
463
|
+
return { value: undefined, done: true };
|
|
464
|
+
}
|
|
465
|
+
await new Promise((resolve) => { chunkResolve = resolve; });
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
},
|
|
470
|
+
};
|
|
471
|
+
return { chunks, result };
|
|
472
|
+
}
|
|
473
|
+
// ── Non-streaming mode ─────────────────────────────────────────
|
|
474
|
+
// Chunks iterable is immediately done; all work happens in result.
|
|
475
|
+
const emptyChunks = {
|
|
476
|
+
[Symbol.asyncIterator]() {
|
|
477
|
+
return {
|
|
478
|
+
next() {
|
|
479
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
480
|
+
},
|
|
481
|
+
};
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
const result = (async () => {
|
|
485
|
+
// Validate token
|
|
486
|
+
const token = process.env[tokenEnvVar];
|
|
487
|
+
if (!token) {
|
|
488
|
+
throw new Error(`Copilot session provider requires a GitHub token. ` +
|
|
489
|
+
`Set the ${tokenEnvVar} environment variable.`);
|
|
490
|
+
}
|
|
491
|
+
try {
|
|
492
|
+
await runAgenticLoop(apiEndpoint, token, sessionConfig.model, messages, apiTools, toolMap, maxRounds, acc);
|
|
493
|
+
return {
|
|
494
|
+
status: 'completed',
|
|
495
|
+
exitCode: 0,
|
|
496
|
+
providerSessionId: acc.providerSessionId,
|
|
497
|
+
tokenUsage: acc.tokenUsage,
|
|
498
|
+
costUsd: undefined,
|
|
499
|
+
transcript: acc.transcript,
|
|
500
|
+
output: extractOutput(messages),
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
catch (err) {
|
|
504
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
505
|
+
return {
|
|
506
|
+
status: 'failed',
|
|
507
|
+
exitCode: 1,
|
|
508
|
+
error: message,
|
|
509
|
+
transcript: acc.transcript,
|
|
510
|
+
tokenUsage: acc.tokenUsage.inputTokens > 0 ? acc.tokenUsage : undefined,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
})();
|
|
514
|
+
return { chunks: emptyChunks, result };
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
return {
|
|
518
|
+
apparatus: {
|
|
519
|
+
requires: [],
|
|
520
|
+
provides: provider,
|
|
521
|
+
start(_ctx) {
|
|
522
|
+
config = guild().guildConfig().copilot ?? {};
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
export default createCopilotProvider();
|
|
528
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AA2H/C,uEAAuE;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AAU,EAAE,GAAG,CAAC,UAAU;wBAC1B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;qBAChC,CAAC;gBACJ,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACjE,OAAO;wBACL,MAAM,EAAE,QAAiB;wBACzB,QAAQ,EAAE,CAAC;wBACX,KAAK,EAAE,OAAO;wBACd,UAAU,EAAE,GAAG,CAAC,UAAU;wBAC1B,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;qBACxE,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;YAEL,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;KACF,CAAC;IAEF,OAAO;QACL,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE,QAAQ;YAElB,KAAK,CAAC,IAAoB;gBACxB,MAAM,GAAG,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC;YAC/C,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shardworks/copilot-apparatus",
|
|
3
|
+
"version": "0.1.124",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/shardworks/nexus",
|
|
8
|
+
"directory": "packages/plugins/copilot"
|
|
9
|
+
},
|
|
10
|
+
"description": "Copilot session provider apparatus — launches sessions via the GitHub Models API",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"zod": "4.3.6",
|
|
20
|
+
"@shardworks/animator-apparatus": "0.1.124",
|
|
21
|
+
"@shardworks/nexus-core": "0.1.124",
|
|
22
|
+
"@shardworks/tools-apparatus": "0.1.124"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "25.5.0"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"test": "node --disable-warning=ExperimentalWarning --experimental-transform-types --test 'src/**/*.test.ts'",
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
34
|
+
}
|
|
35
|
+
}
|