@hex4c59/pi-ext-copilot-auto 0.0.0-stage → 0.1.1
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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +316 -3
- package/docs/PROTOCOL.md +860 -0
- package/extensions/copilot-auto.ts +341 -0
- package/lib/account.ts +157 -0
- package/lib/auth.ts +156 -0
- package/lib/catalog.ts +299 -0
- package/lib/client.ts +516 -0
- package/lib/debug.ts +39 -0
- package/lib/protocol.ts +243 -0
- package/lib/sessions.ts +182 -0
- package/lib/stream.ts +306 -0
- package/lib/token.ts +83 -0
- package/package.json +46 -6
package/lib/stream.ts
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto 通道的流式实现。
|
|
3
|
+
*
|
|
4
|
+
* 关键机制(由实测确认,2026-11-11):
|
|
5
|
+
* 1. 用户选 `auto` → POST /auto(版本头 2026-08-01)由服务端选模型;
|
|
6
|
+
* 2. 用户选具体模型 → 优先 POST /models/session,它的令牌明确公布覆盖清单;
|
|
7
|
+
* 3. 两者都拿不到覆盖该模型的令牌时,明确报错而不是静默换成别的模型;
|
|
8
|
+
* 4. 把 session_token 作为 `Copilot-Session-Token` 头发给 /responses。
|
|
9
|
+
*
|
|
10
|
+
* 令牌作用域是实测出来的硬约束:`/auto` 的令牌只对它选中的那个模型有效,
|
|
11
|
+
* 换模型会返回 `Requested model not available for session`;
|
|
12
|
+
* `/models/session` 的令牌覆盖其 `available_models`。
|
|
13
|
+
*
|
|
14
|
+
* 压缩请求不参与 Auto 路由:pi 会把整段历史序列化成一条 user 消息,
|
|
15
|
+
* 若把它当路由提示词发给 `/auto`,会一次发送数十万 token,服务端长处理后
|
|
16
|
+
* 断开连接(`Auto-compaction failed: Summarization failed: terminated`)。
|
|
17
|
+
* 这里检测到 pi 的摘要系统提示后直接走普通通道,不协商、不注入会话令牌。
|
|
18
|
+
*
|
|
19
|
+
* SSE 解析、消息转换、工具调用与用量核算全部交给 pi-ai 的
|
|
20
|
+
* openai-responses 实现,本模块只负责协商会话与注入请求头。
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
type Api,
|
|
25
|
+
type AssistantMessageEventStream,
|
|
26
|
+
type Model,
|
|
27
|
+
type SimpleStreamOptions,
|
|
28
|
+
type TranscriptContext,
|
|
29
|
+
createAssistantMessageEventStream,
|
|
30
|
+
getCurrentSystemPrompt,
|
|
31
|
+
openAIResponsesApi,
|
|
32
|
+
} from '@earendil-works/pi-ai/compat'
|
|
33
|
+
import { sessionUsable, type RequestTarget } from './client.ts'
|
|
34
|
+
import type { CatalogEntry } from './protocol.ts'
|
|
35
|
+
import { payloadInspector, trace } from './debug.ts'
|
|
36
|
+
import { API_VERSION } from './protocol.ts'
|
|
37
|
+
import { autoSessions } from './sessions.ts'
|
|
38
|
+
import { tokenFromEnv } from './token.ts'
|
|
39
|
+
|
|
40
|
+
/** 携带 Auto 会话令牌的请求头字段名。 */
|
|
41
|
+
export const SESSION_TOKEN_HEADER = 'Copilot-Session-Token'
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 目录来源。
|
|
45
|
+
*
|
|
46
|
+
* 由扩展工厂在每次目录刷新后设置,供协商失败时挑选降级模型。
|
|
47
|
+
* 用回调而不是直接传数组,保证读到的是最新目录。
|
|
48
|
+
*/
|
|
49
|
+
let catalogProvider: (() => readonly CatalogEntry[]) | undefined
|
|
50
|
+
|
|
51
|
+
/** 注册目录来源。扩展工厂在每次目录刷新后调用。 */
|
|
52
|
+
export function setCatalogProvider(provider: () => readonly CatalogEntry[]): void {
|
|
53
|
+
catalogProvider = provider
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 取当前目录(可能为空,表示尚未加载)。 */
|
|
57
|
+
function currentCatalog(): readonly CatalogEntry[] {
|
|
58
|
+
return catalogProvider?.() ?? []
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 推断本次请求是用户发起还是代理发起。
|
|
63
|
+
*
|
|
64
|
+
* 与 pi-ai 的 `inferCopilotInitiator` 一致:最后一条消息不是 user 时视为
|
|
65
|
+
* 代理发起(如工具结果后的继续),Copilot 据此区分请求来源。
|
|
66
|
+
*/
|
|
67
|
+
function inferInitiator(context: TranscriptContext): string {
|
|
68
|
+
const messages = context.messages
|
|
69
|
+
const last = messages[messages.length - 1]
|
|
70
|
+
return last !== undefined && last.role !== 'user' ? 'agent' : 'user'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 是否为 pi 的上下文压缩摘要请求。
|
|
75
|
+
*
|
|
76
|
+
* pi 在压缩时把整段历史序列化成一条 user 消息,并设置专用的系统提示。
|
|
77
|
+
* 这类请求不应走 Auto 路由:把 277k 的 `<conversation>` 当 prompt 发给
|
|
78
|
+
* `/auto` 会让服务端长时间处理后断开连接,导致压缩失败。
|
|
79
|
+
*/
|
|
80
|
+
export function isSummarizationRequest(context: TranscriptContext): boolean {
|
|
81
|
+
const system = getCurrentSystemPrompt(context.messages)
|
|
82
|
+
return system.includes('context summarization assistant')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 提取用于路由的提示词。
|
|
87
|
+
*
|
|
88
|
+
* 取最近一条用户文本。服务端路由只关心当前意图,系统提示与工具声明不参与,
|
|
89
|
+
* 混入会让无关请求产生相同的路由输入。
|
|
90
|
+
*/
|
|
91
|
+
export function routingPrompt(context: TranscriptContext): string {
|
|
92
|
+
const messages = context.messages
|
|
93
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
94
|
+
const message = messages[index]
|
|
95
|
+
if (message === undefined) continue
|
|
96
|
+
if (message.role !== 'user') continue
|
|
97
|
+
if (typeof message.content === 'string') return message.content
|
|
98
|
+
const parts: string[] = []
|
|
99
|
+
for (const block of message.content) {
|
|
100
|
+
if (block.type === 'text') parts.push(block.text)
|
|
101
|
+
}
|
|
102
|
+
if (parts.length > 0) return parts.join('\n')
|
|
103
|
+
}
|
|
104
|
+
return getCurrentSystemPrompt(messages) ?? ''
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 判断本次请求是否包含图片。
|
|
109
|
+
*
|
|
110
|
+
* Auto 路由需要知道是否必须选择支持 vision 的模型;这个信息与
|
|
111
|
+
* VS Code 的 `hasImage` 参数对应,在 `/auto` 里以 `has_image` 发送。
|
|
112
|
+
*/
|
|
113
|
+
export function hasImageInput(context: TranscriptContext): boolean {
|
|
114
|
+
for (const message of context.messages) {
|
|
115
|
+
if (message.role !== 'user' && message.role !== 'toolResult') continue
|
|
116
|
+
if (typeof message.content === 'string') continue
|
|
117
|
+
for (const block of message.content) {
|
|
118
|
+
if (block.type === 'image') return true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** 解析本次请求使用的访问令牌。 */
|
|
125
|
+
function resolveAccessToken(options?: SimpleStreamOptions): string {
|
|
126
|
+
const fromOptions = options?.apiKey
|
|
127
|
+
if (typeof fromOptions === 'string' && fromOptions !== '') return fromOptions
|
|
128
|
+
const fromEnv = tokenFromEnv()
|
|
129
|
+
if (fromEnv !== undefined) return fromEnv
|
|
130
|
+
throw new Error(
|
|
131
|
+
'未找到 GitHub Copilot 凭据。请运行 /login 选择 "GitHub Copilot",或设置 COPILOT_GITHUB_TOKEN。',
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 会话标识。
|
|
137
|
+
*
|
|
138
|
+
* pi 的 streamSimple 不直接暴露会话 id,因此用模型的 provider/baseUrl 加上
|
|
139
|
+
* 首个用户消息的稳定摘要作为代理键:同一会话的多轮请求会得到相同结果,
|
|
140
|
+
* 不同对话彼此隔离。这比全局单例更接近 VS Code 的按会话缓存语义。
|
|
141
|
+
*/
|
|
142
|
+
export function conversationKey(context: TranscriptContext, baseUrl: string): string {
|
|
143
|
+
const messages = context.messages
|
|
144
|
+
let seed = ''
|
|
145
|
+
for (const message of messages) {
|
|
146
|
+
if (message.role !== 'user') continue
|
|
147
|
+
if (typeof message.content === 'string') {
|
|
148
|
+
seed = message.content
|
|
149
|
+
} else {
|
|
150
|
+
const parts: string[] = []
|
|
151
|
+
for (const block of message.content) {
|
|
152
|
+
if (block.type === 'text') parts.push(block.text)
|
|
153
|
+
}
|
|
154
|
+
seed = parts.join('\n')
|
|
155
|
+
}
|
|
156
|
+
break
|
|
157
|
+
}
|
|
158
|
+
let hash = 2166136261
|
|
159
|
+
for (let index = 0; index < seed.length; index++) {
|
|
160
|
+
hash ^= seed.charCodeAt(index)
|
|
161
|
+
hash = Math.imul(hash, 16777619)
|
|
162
|
+
}
|
|
163
|
+
return `${baseUrl}\u0001${(hash >>> 0).toString(36)}`
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** pi 压缩摘要请求使用的短路由提示词。 */
|
|
167
|
+
export const SUMMARY_ROUTING_PROMPT = 'summarize conversation context for compaction'
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 构造 Auto 通道的流式函数。
|
|
171
|
+
*
|
|
172
|
+
* 签名与 pi 的 streamSimple 一致,可直接交给 provider 注册。
|
|
173
|
+
*/
|
|
174
|
+
export function streamAuto(
|
|
175
|
+
model: Model<Api>,
|
|
176
|
+
context: TranscriptContext,
|
|
177
|
+
options?: SimpleStreamOptions,
|
|
178
|
+
): AssistantMessageEventStream {
|
|
179
|
+
const stream = createAssistantMessageEventStream()
|
|
180
|
+
|
|
181
|
+
void (async () => {
|
|
182
|
+
try {
|
|
183
|
+
const token = resolveAccessToken(options)
|
|
184
|
+
const baseUrl = model.baseUrl
|
|
185
|
+
/**
|
|
186
|
+
* 压缩摘要:保留 Auto 路由(否则 `auto-routed` 不是服务端认识的 model id),
|
|
187
|
+
* 但把路由提示词换成短文本,并为压缩单独建缓存键。
|
|
188
|
+
*
|
|
189
|
+
* pi 压缩时把整段历史序列化成一条 user 消息;若取它当 prompt,
|
|
190
|
+
* `/auto` 会一次收到数十万 token,服务端长时间处理后断开连接。
|
|
191
|
+
*/
|
|
192
|
+
const summarizing = isSummarizationRequest(context)
|
|
193
|
+
const prompt = summarizing ? SUMMARY_ROUTING_PROMPT : routingPrompt(context)
|
|
194
|
+
const needsVision = summarizing ? false : hasImageInput(context)
|
|
195
|
+
|
|
196
|
+
const target: RequestTarget = {
|
|
197
|
+
token,
|
|
198
|
+
baseUrl,
|
|
199
|
+
...(options?.signal === undefined ? {} : { signal: options.signal }),
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const conversationId = summarizing
|
|
203
|
+
? `compaction:${Date.now()}`
|
|
204
|
+
: conversationKey(context, baseUrl)
|
|
205
|
+
const acquireOptions = {
|
|
206
|
+
conversationId,
|
|
207
|
+
needsVision,
|
|
208
|
+
model: model.id,
|
|
209
|
+
catalog: currentCatalog(),
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let result = await autoSessions.acquire(target, prompt, acquireOptions)
|
|
213
|
+
|
|
214
|
+
// 缓存中的条目可能刚过期;重新协商一次。
|
|
215
|
+
if (!sessionUsable(result.session)) {
|
|
216
|
+
autoSessions.expire(conversationId, baseUrl)
|
|
217
|
+
result = await autoSessions.acquire(target, prompt, acquireOptions)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const { session } = result
|
|
221
|
+
|
|
222
|
+
// 无法取得覆盖该模型的令牌时明确失败,不静默换成别的模型:
|
|
223
|
+
// 悄悄换模型会让用户以为在用 M,实际请求的是 N。
|
|
224
|
+
if (result.unsupported) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`模型 "${model.id}" 无法通过 Auto 通道授权。`
|
|
227
|
+
+ '该模型在当前账号下需要服务端路由时才可用,请改用 /model 选择 "auto-routed"(显示名 Auto)。',
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const effectiveModelId = result.effectiveModel === '' ? session.selectedModel : result.effectiveModel
|
|
232
|
+
const effectiveModel: Model<Api> = effectiveModelId === model.id
|
|
233
|
+
? model
|
|
234
|
+
: { ...model, id: effectiveModelId, name: effectiveModelId }
|
|
235
|
+
|
|
236
|
+
if (process.env['COPILOT_AUTO_DEBUG'] === '1') {
|
|
237
|
+
trace(
|
|
238
|
+
`channel=${session.channel ?? 'unknown'} `
|
|
239
|
+
+ `requested=${model.id} `
|
|
240
|
+
+ `effective=${effectiveModelId} `
|
|
241
|
+
+ `authorized=${session.availableModels.join(',') || '(unrestricted)'} `
|
|
242
|
+
+ `degraded=${session.degraded === true}`,
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 请求头注入点。session token 只用于本次 HTTP 请求,不写入 pi 的会话记录。
|
|
247
|
+
//
|
|
248
|
+
// 必须同时补上 Copilot 的动态头:pi-ai 只在 model.provider === "github-copilot"
|
|
249
|
+
// 时才注入 `X-Initiator`、`Openai-Intent` 与 `Copilot-Vision-Request`,
|
|
250
|
+
// 本扩展使用自定义 provider id,不补会得到 400。
|
|
251
|
+
//
|
|
252
|
+
// `X-GitHub-Api-Version` 尤为关键:缺少它时 Copilot 对 Auto 专属模型
|
|
253
|
+
// 返回 `model_not_supported`,容易被误判为权限问题(已实测确认)。
|
|
254
|
+
const headers: Record<string, string> = {
|
|
255
|
+
...(options?.headers ?? {}),
|
|
256
|
+
'X-GitHub-Api-Version': API_VERSION,
|
|
257
|
+
'X-Initiator': inferInitiator(context),
|
|
258
|
+
'Openai-Intent': 'conversation-edits',
|
|
259
|
+
...(needsVision ? { 'Copilot-Vision-Request': 'true' } : {}),
|
|
260
|
+
}
|
|
261
|
+
// 降级会话没有令牌,不带该头即走普通通道。
|
|
262
|
+
if (session.token !== '') headers[SESSION_TOKEN_HEADER] = session.token
|
|
263
|
+
|
|
264
|
+
const inspector = payloadInspector()
|
|
265
|
+
const innerOptions: SimpleStreamOptions = {
|
|
266
|
+
...options,
|
|
267
|
+
headers,
|
|
268
|
+
...(inspector === undefined ? {} : { onPayload: inspector }),
|
|
269
|
+
}
|
|
270
|
+
const innerStream = openAIResponsesApi().streamSimple(
|
|
271
|
+
effectiveModel as Model<'openai-responses'>,
|
|
272
|
+
context,
|
|
273
|
+
innerOptions,
|
|
274
|
+
)
|
|
275
|
+
for await (const event of innerStream) stream.push(event)
|
|
276
|
+
stream.end()
|
|
277
|
+
} catch (error) {
|
|
278
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
279
|
+
stream.push({
|
|
280
|
+
type: 'error',
|
|
281
|
+
reason: 'error',
|
|
282
|
+
error: {
|
|
283
|
+
role: 'assistant',
|
|
284
|
+
content: [],
|
|
285
|
+
api: model.api,
|
|
286
|
+
provider: model.provider,
|
|
287
|
+
model: model.id,
|
|
288
|
+
usage: {
|
|
289
|
+
input: 0,
|
|
290
|
+
output: 0,
|
|
291
|
+
cacheRead: 0,
|
|
292
|
+
cacheWrite: 0,
|
|
293
|
+
totalTokens: 0,
|
|
294
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
295
|
+
},
|
|
296
|
+
stopReason: 'error',
|
|
297
|
+
errorMessage: message,
|
|
298
|
+
timestamp: Date.now(),
|
|
299
|
+
},
|
|
300
|
+
})
|
|
301
|
+
stream.end()
|
|
302
|
+
}
|
|
303
|
+
})()
|
|
304
|
+
|
|
305
|
+
return stream
|
|
306
|
+
}
|
package/lib/token.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot token 的解析工具。
|
|
3
|
+
*
|
|
4
|
+
* Copilot 的访问令牌是 `键=值` 以分号分隔的字符串,并非 JWT:
|
|
5
|
+
* tid=...;exp=...;sku=...;proxy-ep=proxy.individual.githubcopilot.com;st=dotcom
|
|
6
|
+
* 其中 `proxy-ep` 决定实际的 API 主机。内置 provider 也使用同一规则。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** 从 Copilot 令牌中解析键值对。无法解析的片段被忽略。 */
|
|
10
|
+
export function parseCopilotToken(token: string): Record<string, string> {
|
|
11
|
+
const result: Record<string, string> = {}
|
|
12
|
+
for (const part of token.split(';')) {
|
|
13
|
+
const index = part.indexOf('=')
|
|
14
|
+
if (index <= 0) continue
|
|
15
|
+
const key = part.slice(0, index).trim()
|
|
16
|
+
const value = part.slice(index + 1).trim()
|
|
17
|
+
if (key !== '') result[key] = value
|
|
18
|
+
}
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 由令牌的 `proxy-ep` 推导 API 根地址。
|
|
24
|
+
*
|
|
25
|
+
* `proxy.individual.githubcopilot.com` → `https://api.individual.githubcopilot.com`。
|
|
26
|
+
* 无法推导时返回 undefined,由调用方回退到默认地址。
|
|
27
|
+
*/
|
|
28
|
+
export function proxyEndpointFromToken(token: string): string | undefined {
|
|
29
|
+
const parsed = parseCopilotToken(token)
|
|
30
|
+
const proxy = parsed['proxy-ep']
|
|
31
|
+
if (proxy === undefined || proxy === '') return undefined
|
|
32
|
+
// 仅接受裸主机名,避免把异常令牌内容当作 URL 使用。
|
|
33
|
+
if (!/^[a-z0-9.-]+$/i.test(proxy)) return undefined
|
|
34
|
+
const apiHost = proxy.replace(/^proxy\./, 'api.')
|
|
35
|
+
return `https://${apiHost}`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 令牌中的过期时间(毫秒)。缺失或非数字时返回 undefined。 */
|
|
39
|
+
export function tokenExpiry(token: string): number | undefined {
|
|
40
|
+
const parsed = parseCopilotToken(token)
|
|
41
|
+
const raw = parsed['exp']
|
|
42
|
+
if (raw === undefined) return undefined
|
|
43
|
+
const seconds = Number.parseInt(raw, 10)
|
|
44
|
+
if (!Number.isFinite(seconds) || seconds <= 0) return undefined
|
|
45
|
+
return seconds * 1000
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 令牌的套餐标识,例如 `free_educational_quota`。仅用于展示。 */
|
|
49
|
+
export function tokenSku(token: string): string | undefined {
|
|
50
|
+
const value = parseCopilotToken(token)['sku']
|
|
51
|
+
return value === undefined || value === '' ? undefined : value
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 解析 session token 的 JWT 载荷。
|
|
56
|
+
*
|
|
57
|
+
* 这里只读取过期时间与模型清单,不做签名校验:令牌由 Copilot 在 TLS 连接上
|
|
58
|
+
* 直接下发,本地只用于缓存与展示。解析失败返回 undefined。
|
|
59
|
+
*/
|
|
60
|
+
export function decodeSessionToken(token: string): Record<string, unknown> | undefined {
|
|
61
|
+
const parts = token.split('.')
|
|
62
|
+
if (parts.length < 2) return undefined
|
|
63
|
+
const payload = parts[1]
|
|
64
|
+
if (payload === undefined || payload === '') return undefined
|
|
65
|
+
try {
|
|
66
|
+
const normalized = payload.replace(/-/g, '+').replace(/_/g, '/')
|
|
67
|
+
const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)
|
|
68
|
+
const json = Buffer.from(padded, 'base64').toString('utf8')
|
|
69
|
+
const parsed: unknown = JSON.parse(json)
|
|
70
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return undefined
|
|
71
|
+
return parsed as Record<string, unknown>
|
|
72
|
+
} catch {
|
|
73
|
+
return undefined
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 从环境变量读取 Copilot 令牌;供无 OAuth 凭据时回退使用。 */
|
|
78
|
+
export function tokenFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {
|
|
79
|
+
const value = env['COPILOT_GITHUB_TOKEN']
|
|
80
|
+
if (value === undefined) return undefined
|
|
81
|
+
const trimmed = value.trim()
|
|
82
|
+
return trimmed === '' ? undefined : trimmed
|
|
83
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hex4c59/pi-ext-copilot-auto",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@hex4c59/pi-ext-copilot-auto",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "GitHub Copilot Auto routing for pi: an `auto` virtual model routed via /auto plus authorized models via /models/session, each with its own session-token scope",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Hex4C59/my-pi-extensions",
|
|
9
|
+
"directory": "copilot-auto"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.19.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
21
|
+
"@earendil-works/pi-ai": "*"
|
|
22
|
+
},
|
|
23
|
+
"pi": {
|
|
24
|
+
"extensions": [
|
|
25
|
+
"./extensions/copilot-auto.ts"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
30
|
+
"@earendil-works/pi-ai": "1.5.0",
|
|
31
|
+
"@types/node": "^22.19.0",
|
|
32
|
+
"typescript": "^6.0.3"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"test": "node --experimental-strip-types tests/offline.ts"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"extensions",
|
|
40
|
+
"lib",
|
|
41
|
+
"docs",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"CHANGELOG.md"
|
|
45
|
+
]
|
|
46
|
+
}
|