copilot-relay 0.1.0 → 0.2.0
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/README.md +3 -3
- package/config.default.yaml +3 -3
- package/dist/main.js +6 -20
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Routing:
|
|
|
37
37
|
| Requested model | Upstream model |
|
|
38
38
|
| --- | --- |
|
|
39
39
|
| contains `opus` | `claude-opus-4.8` |
|
|
40
|
-
| anything else | `gpt-5.
|
|
40
|
+
| anything else | `gpt-5.6-sol` |
|
|
41
41
|
|
|
42
42
|
## Install & run
|
|
43
43
|
|
|
@@ -61,7 +61,7 @@ copilotBaseUrl: https://api.githubcopilot.com
|
|
|
61
61
|
claudeSetup: true
|
|
62
62
|
logLevel: info
|
|
63
63
|
logRetentionDays: 3
|
|
64
|
-
thinkEffort:
|
|
64
|
+
thinkEffort: max
|
|
65
65
|
upstreamTimeoutSeconds: 180
|
|
66
66
|
webSearchBackend:
|
|
67
67
|
```
|
|
@@ -76,7 +76,7 @@ webSearchBackend:
|
|
|
76
76
|
|
|
77
77
|
Any other `logLevel` value is invalid and stops startup.
|
|
78
78
|
|
|
79
|
-
Valid `thinkEffort`: `none`, `low`, `medium`, `high`, `xhigh`.
|
|
79
|
+
Valid `thinkEffort`: `none`, `low`, `medium`, `high`, `xhigh`, `max`.
|
|
80
80
|
|
|
81
81
|
`upstreamTimeoutSeconds` controls the maximum time a single Claude request can
|
|
82
82
|
spend waiting on upstream Copilot calls, including chat, Responses, preflight,
|
package/config.default.yaml
CHANGED
|
@@ -32,8 +32,8 @@ logLevel: info
|
|
|
32
32
|
logRetentionDays: 3
|
|
33
33
|
|
|
34
34
|
# Default upstream thinking/reasoning effort sent to Copilot.
|
|
35
|
-
# Valid values: none, low, medium, high, xhigh.
|
|
36
|
-
thinkEffort:
|
|
35
|
+
# Valid values: none, low, medium, high, xhigh, max.
|
|
36
|
+
thinkEffort: max
|
|
37
37
|
|
|
38
38
|
# Max seconds to wait for one Claude request's upstream Copilot calls.
|
|
39
39
|
upstreamTimeoutSeconds: 180
|
|
@@ -45,7 +45,7 @@ webSearchBackend:
|
|
|
45
45
|
# Model routing: requests containing "opus" use opusModel; all others use gptModel.
|
|
46
46
|
#
|
|
47
47
|
# Upstream Copilot model used for non-Opus requests.
|
|
48
|
-
gptModel: gpt-5.
|
|
48
|
+
gptModel: gpt-5.6-sol
|
|
49
49
|
|
|
50
50
|
# Upstream Copilot model used for requests containing "opus".
|
|
51
51
|
opusModel: claude-opus-4.8
|
package/dist/main.js
CHANGED
|
@@ -343,12 +343,12 @@ const runtimeState = {};
|
|
|
343
343
|
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region src/lib/models.ts
|
|
346
|
-
const defaultReasoningEffort = "
|
|
346
|
+
const defaultReasoningEffort = "max";
|
|
347
347
|
const defaultModelRouting = {
|
|
348
|
-
gptModel: "gpt-5.
|
|
348
|
+
gptModel: "gpt-5.6-sol",
|
|
349
349
|
opusModel: "claude-opus-4.8"
|
|
350
350
|
};
|
|
351
|
-
const isReasoningEffort = (value) => value === "none" || value === "low" || value === "medium" || value === "high" || value === "xhigh";
|
|
351
|
+
const isReasoningEffort = (value) => value === "none" || value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "max";
|
|
352
352
|
const getModelRouting = () => runtimeState.modelRouting ?? defaultModelRouting;
|
|
353
353
|
const getExposedModelIds = () => {
|
|
354
354
|
const routing = getModelRouting();
|
|
@@ -369,7 +369,7 @@ const logLevels = [
|
|
|
369
369
|
const defaultConfig = {
|
|
370
370
|
claudeSetup: true,
|
|
371
371
|
copilotBaseUrl: "https://api.githubcopilot.com",
|
|
372
|
-
gptModel: "gpt-5.
|
|
372
|
+
gptModel: "gpt-5.6-sol",
|
|
373
373
|
host: "127.0.0.1",
|
|
374
374
|
logLevel: "info",
|
|
375
375
|
logRetentionDays: 3,
|
|
@@ -534,7 +534,7 @@ const serializeConfig = (config) => [
|
|
|
534
534
|
"# Number of days to keep files in ~/.copilot-relay/logs.",
|
|
535
535
|
`logRetentionDays: ${config.logRetentionDays}`,
|
|
536
536
|
"",
|
|
537
|
-
"# Default upstream thinking/reasoning effort: none, low, medium, high, xhigh.",
|
|
537
|
+
"# Default upstream thinking/reasoning effort: none, low, medium, high, xhigh, max.",
|
|
538
538
|
`thinkEffort: ${config.thinkEffort}`,
|
|
539
539
|
"",
|
|
540
540
|
"# Max seconds to wait for a single Claude request's upstream Copilot calls.",
|
|
@@ -982,7 +982,7 @@ const fetchCopilot = async (provider, path$1, init, options = {}) => {
|
|
|
982
982
|
|
|
983
983
|
//#endregion
|
|
984
984
|
//#region src/copilot/responses.ts
|
|
985
|
-
const responsesOnlyModelPattern = /^(?:gpt-5\.5)(?:-|$)/i;
|
|
985
|
+
const responsesOnlyModelPattern = /^(?:gpt-5\.5|gpt-5\.6)(?:-|$)/i;
|
|
986
986
|
function shouldUseResponsesApiForModel(model) {
|
|
987
987
|
return responsesOnlyModelPattern.test(model);
|
|
988
988
|
}
|
|
@@ -2477,7 +2477,6 @@ const getTokenCount = async (payload, model) => {
|
|
|
2477
2477
|
//#endregion
|
|
2478
2478
|
//#region src/routes/claude.ts
|
|
2479
2479
|
const claudeRoutes = new Hono();
|
|
2480
|
-
const streamKeepAliveIntervalMs = 15e3;
|
|
2481
2480
|
const createTokenCountModel = (modelId) => ({
|
|
2482
2481
|
capabilities: { tokenizer: "o200k_base" },
|
|
2483
2482
|
id: modelId
|
|
@@ -2555,17 +2554,6 @@ const createQueuedClaudeStreamWriter = (write) => {
|
|
|
2555
2554
|
return pending;
|
|
2556
2555
|
};
|
|
2557
2556
|
};
|
|
2558
|
-
const startClaudeStreamKeepAlive = (writeEvent) => {
|
|
2559
|
-
const writePing = () => {
|
|
2560
|
-
writeEvent({ type: "ping" }).catch(() => void 0);
|
|
2561
|
-
};
|
|
2562
|
-
writePing();
|
|
2563
|
-
const timer = setInterval(writePing, streamKeepAliveIntervalMs);
|
|
2564
|
-
if (typeof timer.unref === "function") timer.unref();
|
|
2565
|
-
return () => {
|
|
2566
|
-
clearInterval(timer);
|
|
2567
|
-
};
|
|
2568
|
-
};
|
|
2569
2557
|
const writeClaudeStreamEvents = async (events$1, writeEvent) => {
|
|
2570
2558
|
for (const event of events$1) await writeEvent(event);
|
|
2571
2559
|
};
|
|
@@ -2667,14 +2655,12 @@ claudeRoutes.post("/messages", async (c) => {
|
|
|
2667
2655
|
event: event.type,
|
|
2668
2656
|
data: JSON.stringify(event)
|
|
2669
2657
|
}));
|
|
2670
|
-
const stopKeepAlive = startClaudeStreamKeepAlive(writeEvent);
|
|
2671
2658
|
try {
|
|
2672
2659
|
await handleClaudeMessageRequest(config, claudePayload, requestSignal, requestId, writeEvent);
|
|
2673
2660
|
} catch (error) {
|
|
2674
2661
|
log.error("Error during Claude stream request:", error);
|
|
2675
2662
|
await writeEvent(translateErrorToClaudeErrorEvent());
|
|
2676
2663
|
} finally {
|
|
2677
|
-
stopKeepAlive();
|
|
2678
2664
|
log.info(`request_id=${requestId} stream completed ${Math.round(performance.now() - streamStarted)}ms`);
|
|
2679
2665
|
}
|
|
2680
2666
|
});
|