codex-copilot-dx 0.9.33 → 0.9.35
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 +5 -5
- package/bin/cli.mjs +39 -29
- package/docs/ARCHITECTURE.md +28 -1
- package/docs/REFERENCE.md +86 -6
- package/package.json +1 -1
- package/src/adapter.mjs +8 -1
- package/src/cli-status.mjs +1 -0
- package/src/client-integration.mjs +10 -3
- package/src/config.mjs +3 -2
- package/src/copilot.mjs +1 -1
- package/src/dashboard/index.html +1 -1
- package/src/dashboard/language.js +1 -0
- package/src/dashboard/status.js +1 -1
- package/src/dashboard/ui.css +1 -1
- package/src/launcher.mjs +26 -16
- package/src/local-compaction-recovery.mjs +56 -12
- package/src/native-prediction-recovery.mjs +39 -0
- package/src/native-prediction-route.mjs +94 -0
- package/src/native-prediction-state.mjs +7 -1
- package/src/native-prediction-transport.mjs +6 -0
- package/src/native-prediction.mjs +42 -4
- package/src/package-update.mjs +20 -1
- package/src/profile-model-runtime.mjs +1 -1
- package/src/responses-bridge.mjs +22 -7
- package/src/responses-chat-payload.mjs +6 -5
- package/src/responses-handler.mjs +2 -0
- package/src/startup-ui.mjs +54 -0
- package/src/status.mjs +2 -1
- package/src/stream-performance.mjs +6 -0
- package/src/windows-prediction-network.mjs +1 -1
|
@@ -335,6 +335,8 @@ export function createResponsesHandler(options) {
|
|
|
335
335
|
let { chatReq, bodyText } = await prepareResponsesChatPayload(prepared, {
|
|
336
336
|
assertActive: assertPrepareActive,
|
|
337
337
|
payloadOptions: responsesPayloadOptions,
|
|
338
|
+
reasoningEfforts: (Array.isArray(modelRegistry?.models) ? modelRegistry.models : modelRegistry?.models?.data)
|
|
339
|
+
?.find(model => model?.id === upstreamModel)?.capabilities?.supports?.reasoning_effort,
|
|
338
340
|
signal: abort.signal,
|
|
339
341
|
stream: streaming,
|
|
340
342
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { status } from "./status.mjs";
|
|
2
|
+
import { terminalCell } from "./terminal-text.mjs";
|
|
3
|
+
|
|
4
|
+
// The favicon's three ellipses, rasterized as terminal half-blocks. No runtime
|
|
5
|
+
// graphics library or terminal cursor control is needed.
|
|
6
|
+
const ATOM = [
|
|
7
|
+
" ▄█▀█▄▄ ▄▄█▀█▄ ",
|
|
8
|
+
" █ ███ █ ",
|
|
9
|
+
" █ ▄▄▄█▄█▄▄▄ █ ",
|
|
10
|
+
" ▄▄▀▀█▀█▀ ▀█▀█▀▀▄▄ ",
|
|
11
|
+
" █▀ ▀█ ▄█▄ █▀ ▀█ ",
|
|
12
|
+
" ▀█▄ █▀▄ ▀ ▄▀█ ▄█▀ ",
|
|
13
|
+
" ▀█▀███▄▄▄███▀█▀ ",
|
|
14
|
+
" █ █▄█ █ ",
|
|
15
|
+
" █▄ ▄▄█▀█▄▄ ▄█ ",
|
|
16
|
+
" ▀▀▀ ▀▀▀ ",
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export function startupBanner({ commandName = "ccdx", version, stream = process.stdout, env = process.env } = {}) {
|
|
20
|
+
const title = `${terminalCell(commandName)} v${terminalCell(version)} by Dale Xiao`;
|
|
21
|
+
const color = stream.isTTY === true && !Object.hasOwn(env, "NO_COLOR") && env.TERM !== "dumb";
|
|
22
|
+
if (!color || Number(stream.columns || 80) < 72) return `${title}\nUse Codex App with GitHub Copilot`;
|
|
23
|
+
const labels = new Map([[3, `${terminalCell(commandName).toUpperCase()} v${terminalCell(version)}`], [4, "by Dale Xiao"], [6, "Codex App + GitHub Copilot"]]);
|
|
24
|
+
return ATOM.map((line, i) => `\x1b[38;2;166;245;168m${line}\x1b[0m${labels.has(i) ? ` ${labels.get(i)}` : ""}`).join("\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function startupCheck(kind, name, detail) {
|
|
28
|
+
const prefix = status(kind, "").trimEnd();
|
|
29
|
+
return `${prefix.padEnd(8)}${terminalCell(name).padEnd(12)}${terminalCell(detail)}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function startupReady({ baseUrl, commandName = "ccdx", reused = false } = {}) {
|
|
33
|
+
return ["", startupCheck("ok", "Ready", reused ? "Using the existing CCDX adapter" : "Core service available"), "",
|
|
34
|
+
`Web UI ${baseUrl}`, `Help ${commandName} help`, ...(!reused ? ["Stop Ctrl+C"] : []), ""].join("\n");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function startupLogger(name, output = console.log) {
|
|
38
|
+
return value => {
|
|
39
|
+
for (const line of String(value).split("\n")) {
|
|
40
|
+
const match = /^\[(OK|INFO|WARN|ERR|WAIT|DEBUG)\]\s+(.*)$/.exec(line);
|
|
41
|
+
output(match ? startupCheck(match[1].toLowerCase(), name, match[2]) : line);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function predictionStartupCheck(prediction) {
|
|
47
|
+
if (!prediction?.configured) return startupCheck("info", "Prediction", "Off");
|
|
48
|
+
if (prediction.bridge !== "running") return startupCheck("warn", "Prediction", prediction.reason || "Bridge unavailable; core service is available");
|
|
49
|
+
const route = prediction.launch_route;
|
|
50
|
+
const summary = startupCheck(route === "unverified" ? "warn" : "info", "Prediction", route === "verified"
|
|
51
|
+
? "Bridge running; App route verified; suggestion not checked"
|
|
52
|
+
: "Bridge running; App route not verified; suggestion not checked");
|
|
53
|
+
return prediction.recovery ? `${summary}\n${startupCheck("info", "Recovery", `${prediction.recovery.attempts}/3 attempts used; persistent route ${prediction.persistence || "unknown"}`)}` : summary;
|
|
54
|
+
}
|
package/src/status.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { currentRequestContext } from "./request-context.mjs";
|
|
2
|
+
import { terminalCell } from "./terminal-text.mjs";
|
|
2
3
|
|
|
3
4
|
const LABELS = {
|
|
4
5
|
info: "[INFO]",
|
|
@@ -13,5 +14,5 @@ export function status(kind, message) {
|
|
|
13
14
|
const requestContext = currentRequestContext();
|
|
14
15
|
const requestId = requestContext?.showRequestId ? requestContext.requestId : "";
|
|
15
16
|
const context = requestId ? ` request_id=${requestId}` : "";
|
|
16
|
-
return `${LABELS[kind] || LABELS.info}${context} ${message}`;
|
|
17
|
+
return `${(LABELS[kind] || LABELS.info).padEnd(8)}${context ? `${terminalCell(context.trimStart())} ` : ""}${terminalCell(message, { fallback: "" })}`;
|
|
17
18
|
}
|
|
@@ -139,6 +139,7 @@ function createRoutePerformance() {
|
|
|
139
139
|
success_with_output: 0,
|
|
140
140
|
errors_with_output: 0,
|
|
141
141
|
zero_output_errors: 0,
|
|
142
|
+
empty_stream_completions: 0,
|
|
142
143
|
neutral: 0,
|
|
143
144
|
terminalTotals: emptyOutcomes(),
|
|
144
145
|
incompleteReasons: Object.create(null),
|
|
@@ -152,6 +153,7 @@ function routeSnapshot(route) {
|
|
|
152
153
|
success_with_output: route.success_with_output,
|
|
153
154
|
errors_with_output: route.errors_with_output,
|
|
154
155
|
zero_output_errors: route.zero_output_errors,
|
|
156
|
+
empty_stream_completions: route.empty_stream_completions,
|
|
155
157
|
neutral: route.neutral,
|
|
156
158
|
terminal_outcomes: {
|
|
157
159
|
totals: { ...route.terminalTotals },
|
|
@@ -274,6 +276,9 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
274
276
|
finished = true;
|
|
275
277
|
failed ||= finishFailed;
|
|
276
278
|
const outcome = terminalOutcome || (aborted ? "cancelled" : "unknown");
|
|
279
|
+
const emptyStreamCompletion = outcome === "completed" && upstreamStartedAt !== null
|
|
280
|
+
&& firstOutputAt === null && outputTokens === 0;
|
|
281
|
+
if (emptyStreamCompletion) route.empty_stream_completions += 1;
|
|
277
282
|
const origin = terminalOrigin || errorOrigin || (aborted ? "client_disconnect" : "unclassified");
|
|
278
283
|
route.terminalTotals[outcome] += 1;
|
|
279
284
|
if (incompleteReason) route.incompleteReasons[incompleteReason] = (route.incompleteReasons[incompleteReason] || 0) + 1;
|
|
@@ -288,6 +293,7 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
288
293
|
recentRequests.push({
|
|
289
294
|
request_id: typeof requestId === "string" && /^[a-zA-Z0-9_-]{1,80}$/.test(requestId) ? requestId : null,
|
|
290
295
|
at, route: routeName, model, outcome, origin, phase,
|
|
296
|
+
empty_stream_completion: emptyStreamCompletion,
|
|
291
297
|
failed: failed || aborted || (terminalOutcome !== null && terminalOutcome !== "completed"),
|
|
292
298
|
http_status: Number.isInteger(statusCode) && statusCode >= 100 && statusCode <= 599 ? statusCode : null,
|
|
293
299
|
upstream_attempts: attempts,
|
|
@@ -119,5 +119,5 @@ export async function startWindowsPredictionNetwork({ settings, env = process.en
|
|
|
119
119
|
if(stopped)queueMicrotask(()=>req.destroy(failure("proxy_worker_closed")));
|
|
120
120
|
return req;
|
|
121
121
|
};
|
|
122
|
-
return {script,requestImpl,pac:port=>companyPredictionPac(script,port),close(){closing=true;stop(failure("proxy_worker_closed"));}};
|
|
122
|
+
return {script,requestImpl,pac:port=>companyPredictionPac(script,port),healthy:()=>!stopped,close(){closing=true;stop(failure("proxy_worker_closed"));}};
|
|
123
123
|
}
|