codex-copilot-dx 0.7.6 → 0.7.8
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 +33 -3
- package/bin/cli.mjs +31 -2
- package/package.json +1 -1
- package/src/adapter.mjs +12 -0
- package/src/cli-image.mjs +199 -0
- package/src/cli-options.mjs +18 -0
- package/src/cli-status.mjs +12 -0
- package/src/config.mjs +88 -6
- package/src/copilot-responses-compat.mjs +28 -18
- package/src/image-mcp.mjs +169 -0
- package/src/image-provider-config.mjs +190 -0
- package/src/image-provider.mjs +268 -0
- package/src/observability.mjs +2 -0
- package/src/response-failures.mjs +100 -0
- package/src/responses-handler.mjs +2 -0
- package/src/responses-proxy.mjs +181 -35
- package/src/responses-request.mjs +23 -0
- package/src/terminal-animation.mjs +94 -6
- package/src/user-settings.mjs +2 -1
|
@@ -84,6 +84,7 @@ function isEncryptedContentPart(value) {
|
|
|
84
84
|
const OMIT_ENCRYPTED_CONTENT = Symbol("omit-encrypted-content");
|
|
85
85
|
const ENCRYPTED_HISTORY_REBASE = Symbol("encrypted-history-rebase");
|
|
86
86
|
const RELEASE_HISTORY_INPUT = Symbol("release-history-input");
|
|
87
|
+
const RELEASED_MATERIALIZED_HISTORY = Symbol("released-materialized-history");
|
|
87
88
|
const HISTORY_PRESSURE_ROOT = Symbol("history-pressure-root");
|
|
88
89
|
const ENCRYPTED_TOOL_OUTPUT_MARKER = "[CCDX: encrypted tool output omitted because upstream could not decrypt it.]";
|
|
89
90
|
|
|
@@ -187,6 +188,10 @@ function responseValueHasOpaqueState(value) {
|
|
|
187
188
|
return Object.values(value).some(responseValueHasOpaqueState);
|
|
188
189
|
}
|
|
189
190
|
|
|
191
|
+
export function hasEncryptedResponseState(value) {
|
|
192
|
+
return responseValueHasOpaqueState(value);
|
|
193
|
+
}
|
|
194
|
+
|
|
190
195
|
export function sanitizeEncryptedReasoningRequest(reqContext, { historicalOnly = false } = {}) {
|
|
191
196
|
const state = { changed: false };
|
|
192
197
|
let body = cloneJson(reqContext.body);
|
|
@@ -379,10 +384,28 @@ export function dropMaterializedResponseHistory(reqContext) {
|
|
|
379
384
|
reqContext.body = { ...reqContext.body, input: releaseInput };
|
|
380
385
|
reqContext.inputItems = releaseInput;
|
|
381
386
|
delete reqContext[RELEASE_HISTORY_INPUT];
|
|
387
|
+
reqContext[RELEASED_MATERIALIZED_HISTORY] = true;
|
|
382
388
|
reqContext.currentInputStart = 0;
|
|
383
389
|
return true;
|
|
384
390
|
}
|
|
385
391
|
|
|
392
|
+
export function restoreMaterializedResponseHistoryForRetry(reqContext, { assertActive } = {}) {
|
|
393
|
+
if (!reqContext?.[RELEASED_MATERIALIZED_HISTORY] || !reqContext.historyParentId) return reqContext;
|
|
394
|
+
const body = cloneJson(reqContext.body);
|
|
395
|
+
body.previous_response_id = reqContext.historyParentId;
|
|
396
|
+
body.input = cloneJson(reqContext.historyInputItems || reqContext.body.input);
|
|
397
|
+
let restored = prepareResponsesRequest(body, {
|
|
398
|
+
assertActive,
|
|
399
|
+
copilotBoundary: false,
|
|
400
|
+
mutate: true,
|
|
401
|
+
});
|
|
402
|
+
restored.surface = reqContext.surface;
|
|
403
|
+
if (reqContext.routePlan) {
|
|
404
|
+
restored = applyResponseHistoryRoutePlan(restored, reqContext.routePlan);
|
|
405
|
+
}
|
|
406
|
+
return restored;
|
|
407
|
+
}
|
|
408
|
+
|
|
386
409
|
export function rememberResponseHistory(reqContext, responseJson) {
|
|
387
410
|
if (!responseJson?.id || !Array.isArray(reqContext?.historyInputItems || reqContext?.inputItems)) return;
|
|
388
411
|
const compacted = isSuccessfulCompactionResponse(responseJson);
|
|
@@ -5,7 +5,7 @@ export const DEFAULT_TERMINAL_ANIMATION_THEME = "comet";
|
|
|
5
5
|
|
|
6
6
|
const TAIL_LENGTH = 7;
|
|
7
7
|
const TAIL_COLORS = Object.freeze([159, 123, 87, 51, 45, 39, 33]);
|
|
8
|
-
const
|
|
8
|
+
const RELAY_ROUTE = Object.freeze([2, 9, 16, 9, 2]);
|
|
9
9
|
|
|
10
10
|
function colorCell(glyph, color) {
|
|
11
11
|
return `${ESC}[${color}m${glyph}${ESC}[0m`;
|
|
@@ -39,6 +39,25 @@ function pingPongState(index) {
|
|
|
39
39
|
: { position: period - offset, direction: -1 };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function setGlowCell(cells, index, level) {
|
|
43
|
+
const color = level === 0 ? "97" : `38;5;${TAIL_COLORS[Math.min(level - 1, TAIL_LENGTH - 1)]}`;
|
|
44
|
+
setCell(cells, index, ":", color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function stackState(index) {
|
|
48
|
+
// Three incoming packets each leave three cells parked on the left.
|
|
49
|
+
for (let parked = 0; parked < 9; parked += 3) {
|
|
50
|
+
const travelFrames = TERMINAL_ANIMATION_TRACK_WIDTH - parked;
|
|
51
|
+
if (index < travelFrames) {
|
|
52
|
+
return { parked, head: TERMINAL_ANIMATION_TRACK_WIDTH - 1 - index, delayMs: 55 };
|
|
53
|
+
}
|
|
54
|
+
if (index === travelFrames) return { parked: parked + 3, delayMs: 180 };
|
|
55
|
+
index -= travelFrames + 1;
|
|
56
|
+
}
|
|
57
|
+
// Release the accumulated bundle, then leave a blank frame before restarting.
|
|
58
|
+
return { shift: index, delayMs: index === 0 ? 130 : index === 21 ? 180 : 50 };
|
|
59
|
+
}
|
|
60
|
+
|
|
42
61
|
const THEME_DEFINITIONS = Object.freeze([
|
|
43
62
|
Object.freeze({
|
|
44
63
|
id: "comet",
|
|
@@ -137,15 +156,84 @@ const THEME_DEFINITIONS = Object.freeze([
|
|
|
137
156
|
},
|
|
138
157
|
}),
|
|
139
158
|
Object.freeze({
|
|
140
|
-
id: "
|
|
141
|
-
label: "
|
|
142
|
-
frameCount:
|
|
143
|
-
frameDelayMs:
|
|
159
|
+
id: "stack",
|
|
160
|
+
label: "Stack",
|
|
161
|
+
frameCount: 76,
|
|
162
|
+
frameDelayMs: 55,
|
|
163
|
+
loopPauseMs: 0,
|
|
164
|
+
startFrame: 0,
|
|
165
|
+
frameDelay(index) {
|
|
166
|
+
return stackState(index).delayMs;
|
|
167
|
+
},
|
|
168
|
+
render(index) {
|
|
169
|
+
const cells = blankTrack();
|
|
170
|
+
const state = stackState(index);
|
|
171
|
+
if (state.shift !== undefined) {
|
|
172
|
+
for (let column = 0; column < 9; column += 1) {
|
|
173
|
+
setGlowCell(cells, state.shift + column, 8 - column);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
for (let column = 0; column < state.parked; column += 1) setGlowCell(cells, column, 5);
|
|
177
|
+
if (state.head !== undefined) drawComet(cells, state.head, -1, 2);
|
|
178
|
+
}
|
|
179
|
+
return wrapTrack(cells);
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
Object.freeze({
|
|
183
|
+
id: "relay",
|
|
184
|
+
label: "Relay",
|
|
185
|
+
frameCount: 40,
|
|
186
|
+
frameDelayMs: 85,
|
|
144
187
|
loopPauseMs: 0,
|
|
145
188
|
startFrame: 0,
|
|
189
|
+
frameDelay(index) {
|
|
190
|
+
const phase = index % 10;
|
|
191
|
+
return phase === 0 ? 220 : phase < 7 ? 85 : 70;
|
|
192
|
+
},
|
|
146
193
|
render(index) {
|
|
147
194
|
const cells = blankTrack();
|
|
148
|
-
|
|
195
|
+
const leg = Math.floor(index / 10);
|
|
196
|
+
const from = RELAY_ROUTE[leg];
|
|
197
|
+
const to = RELAY_ROUTE[leg + 1];
|
|
198
|
+
const phase = index % 10;
|
|
199
|
+
const active = phase === 0 ? from : phase >= 7 ? to : -1;
|
|
200
|
+
const level = phase >= 7 ? [0, 1, 3][phase - 7] : 0;
|
|
201
|
+
for (let center = 2; center <= 16; center += 7) {
|
|
202
|
+
for (let offset = -1; offset <= 1; offset += 1) {
|
|
203
|
+
setGlowCell(cells, center + offset, center === active ? level + Math.abs(offset) * 2 : 7);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (phase > 0 && phase < 7) {
|
|
207
|
+
const direction = Math.sign(to - from);
|
|
208
|
+
drawComet(cells, from + direction * phase, direction, 2);
|
|
209
|
+
}
|
|
210
|
+
return wrapTrack(cells);
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
Object.freeze({
|
|
214
|
+
id: "split",
|
|
215
|
+
label: "Split",
|
|
216
|
+
frameCount: 29,
|
|
217
|
+
frameDelayMs: 65,
|
|
218
|
+
loopPauseMs: 0,
|
|
219
|
+
startFrame: 0,
|
|
220
|
+
frameDelay(index) {
|
|
221
|
+
return index < 10 ? 70 : index < 13 ? 80 : index < 28 ? 65 : 220;
|
|
222
|
+
},
|
|
223
|
+
render(index) {
|
|
224
|
+
const cells = blankTrack();
|
|
225
|
+
if (index < 10) {
|
|
226
|
+
drawComet(cells, index, 1, 4);
|
|
227
|
+
} else if (index < 13) {
|
|
228
|
+
const level = [2, 0, 1][index - 10];
|
|
229
|
+
for (let offset = -2; offset <= 2; offset += 1) {
|
|
230
|
+
setGlowCell(cells, 9 + offset, level + Math.abs(offset));
|
|
231
|
+
}
|
|
232
|
+
} else if (index < 28) {
|
|
233
|
+
const distance = index - 13;
|
|
234
|
+
drawComet(cells, 9 - distance, -1, 4);
|
|
235
|
+
drawComet(cells, 10 + distance, 1, 4);
|
|
236
|
+
}
|
|
149
237
|
return wrapTrack(cells);
|
|
150
238
|
},
|
|
151
239
|
}),
|
package/src/user-settings.mjs
CHANGED
|
@@ -37,7 +37,8 @@ export function readUserSettings({ env = process.env, home = os.homedir(), stric
|
|
|
37
37
|
}
|
|
38
38
|
if (Object.hasOwn(parsed, TERMINAL_ANIMATION_KEY)) {
|
|
39
39
|
const value = parsed[TERMINAL_ANIMATION_KEY];
|
|
40
|
-
|
|
40
|
+
// Accept the retired value on read so upgrades can fall back and select a replacement.
|
|
41
|
+
if (value !== "braille" && !isTerminalAnimationTheme(value)) {
|
|
41
42
|
const choices = TERMINAL_ANIMATION_THEMES.map(({ id }) => id).join(", ");
|
|
42
43
|
if (strict) {
|
|
43
44
|
throw invalidSettings(filePath, `${TERMINAL_ANIMATION_KEY} must be one of: ${choices}`);
|