codex-copilot-dx 1.4.4 → 1.4.5
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 +2 -1
- package/bin/cli.mjs +5 -4
- package/docs/ARCHITECTURE.md +16 -0
- package/docs/REFERENCE.md +34 -8
- package/package.json +1 -1
- package/src/access-settings.mjs +3 -1
- package/src/adapter.mjs +9 -1
- package/src/antigravity-chat-bridge.mjs +4 -2
- package/src/antigravity-handler.mjs +28 -16
- package/src/antigravity-images.mjs +3 -2
- package/src/antigravity-runtime.mjs +13 -3
- package/src/application-configuration.mjs +43 -0
- package/src/application-control.mjs +114 -0
- package/src/application-evidence.mjs +42 -0
- package/src/application-process.mjs +114 -0
- package/src/claude-gateway.mjs +24 -15
- package/src/cli-command-spec.mjs +7 -4
- package/src/cli-management.mjs +27 -2
- package/src/codex-image-host-launch.mjs +1 -2
- package/src/codex-launch-control.mjs +7 -7
- package/src/connection-management.mjs +18 -3
- package/src/connection-policy.mjs +3 -1
- package/src/connection-routing.mjs +7 -2
- package/src/connection-runtime.mjs +21 -5
- package/src/connection-view.mjs +9 -3
- package/src/context-compaction-wire.mjs +7 -6
- package/src/context-compaction.mjs +6 -4
- package/src/copilot-client.mjs +17 -13
- package/src/copilot-responses-compat.mjs +1 -0
- package/src/copilot-web.mjs +6 -2
- package/src/dashboard/applications.js +83 -0
- package/src/dashboard/connections.js +52 -14
- package/src/dashboard/console.js +19 -9
- package/src/dashboard/gemini.js +8 -5
- package/src/dashboard/index.html +16 -0
- package/src/dashboard/language.js +41 -0
- package/src/dashboard/ui.css +9 -0
- package/src/dashboard-api.mjs +6 -1
- package/src/dashboard.mjs +1 -0
- package/src/gemini-app.mjs +3 -2
- package/src/http-transport.mjs +5 -2
- package/src/launcher.mjs +6 -5
- package/src/native-images.mjs +1 -1
- package/src/provider-runtime.mjs +14 -9
- package/src/providers/api.mjs +18 -12
- package/src/providers/m365.mjs +9 -5
- package/src/request-admission.mjs +6 -0
- package/src/responses-bridge.mjs +5 -2
- package/src/responses-handler.mjs +2 -0
- package/src/responses-proxy.mjs +9 -4
- package/src/safe-upstream-error.mjs +9 -11
- package/src/service-control.mjs +29 -5
- package/src/settings-preferences.mjs +3 -3
- package/src/source-admission-state.mjs +29 -0
- package/src/source-admission.mjs +310 -0
- package/src/source-discovery-probe.mjs +35 -0
- package/src/source-discovery.mjs +112 -0
- package/src/source-response.mjs +134 -0
- package/src/source-transport.mjs +19 -0
- package/src/stream-contract.mjs +3 -1
- package/src/stream-performance.mjs +3 -1
- package/src/stream.mjs +6 -4
- package/src/upstream-body.mjs +9 -8
- package/src/user-settings.mjs +2 -2
|
@@ -13,7 +13,7 @@ const TERMINAL_OUTCOMES = Object.freeze(["completed", "incomplete", "failed", "c
|
|
|
13
13
|
const INCOMPLETE_REASONS = new Set(["max_output_tokens", "max_messages", "content_filter", "steered"]);
|
|
14
14
|
const TERMINAL_ORIGINS = new Set([
|
|
15
15
|
"upstream_response", "upstream_event", "chat_completion", "client_validation",
|
|
16
|
-
"upstream_http", "transport", "privacy", "client_disconnect", "unclassified",
|
|
16
|
+
"upstream_http", "transport", "privacy", "source_admission", "client_disconnect", "unclassified",
|
|
17
17
|
]);
|
|
18
18
|
const MAX_MODEL_OUTCOME_LABELS = 32;
|
|
19
19
|
const MAX_RECENT_REQUESTS = 20;
|
|
@@ -357,6 +357,8 @@ export function createStreamPerformanceMetrics({ now = () => performance.now(),
|
|
|
357
357
|
attemptTimings() { return attemptTimings.map(attempt => ({ ...attempt })); },
|
|
358
358
|
observeContext(values) {
|
|
359
359
|
if (finished || !values || typeof values !== "object") return;
|
|
360
|
+
if (Number.isSafeInteger(values.source_queue_ms) && values.source_queue_ms >= 0) context.source_queue_ms = values.source_queue_ms;
|
|
361
|
+
if (values.delivery_cancelled === 1) context.delivery_cancelled = 1;
|
|
360
362
|
if (Number.isSafeInteger(values.cached_input_tokens) && values.cached_input_tokens >= 0) cachedInput = values.cached_input_tokens;
|
|
361
363
|
for (const key of [...Object.keys(context), "compaction", "requested_model", "reasoning_effort_requested", "reasoning_effort_sent", "usage_state", "capability_revision", "capability_constraints", "privacy_count", "privacy_ms", "privacy_state", "privacy_pending_bytes", "privacy_new_bytes", "privacy_pending_windows", "privacy_wait_budget_ms", "privacy_error", "privacy_event_type", "privacy_channel_type", "privacy_buffered_bytes", "privacy_terminal_seen", "client_tool_errors_received"]) {
|
|
362
364
|
const value = values[key];
|
package/src/stream.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Yield fetch Response body lines while preserving SSE semantics for callers.
|
|
2
2
|
// Handle LF, CRLF and CR endings, and release the reader if iteration stops early.
|
|
3
3
|
import { loadRuntimeConfig } from "./runtime-config.mjs";
|
|
4
|
+
import { sourceResponseReader, observeSourceRead, failSourceRead, cancelSourceReader, releaseSourceReader } from "./source-response.mjs";
|
|
4
5
|
|
|
5
6
|
const MAX_SSE_BUFFER_BYTES = loadRuntimeConfig().maxSseBufferBytes;
|
|
6
7
|
|
|
@@ -15,14 +16,15 @@ function appendLineFragment(parts, fragment, currentBytes, maxBufferBytes) {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export async function* webStreamLines(response, { onChunk, maxBufferBytes = MAX_SSE_BUFFER_BYTES } = {}) {
|
|
18
|
-
const reader = response
|
|
19
|
+
const reader = sourceResponseReader(response);
|
|
19
20
|
const decoder = new TextDecoder();
|
|
20
21
|
let lineParts = [];
|
|
21
22
|
let lineBytes = 0;
|
|
22
23
|
let skipLF = false, bareCR = false;
|
|
23
24
|
try {
|
|
24
25
|
while (true) {
|
|
25
|
-
|
|
26
|
+
let next;try { next = await reader.read(); } catch (error) { failSourceRead(reader);throw error; }
|
|
27
|
+
observeSourceRead(reader, next);const { done, value } = next;
|
|
26
28
|
if (done) break;
|
|
27
29
|
onChunk?.(value);
|
|
28
30
|
const decoded = decoder.decode(value, { stream: true });
|
|
@@ -83,7 +85,7 @@ export async function* webStreamLines(response, { onChunk, maxBufferBytes = MAX_
|
|
|
83
85
|
yield !bareCR && line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
84
86
|
}
|
|
85
87
|
} finally {
|
|
86
|
-
await reader
|
|
87
|
-
reader
|
|
88
|
+
await cancelSourceReader(reader).catch(() => {});
|
|
89
|
+
releaseSourceReader(reader);
|
|
88
90
|
}
|
|
89
91
|
}
|
package/src/upstream-body.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { httpError } from "./http-errors.mjs";
|
|
2
|
+
import { sourceResponseReader, observeSourceRead, failSourceRead, cancelSourceReader, releaseSourceReader, cancelSourceResponse, hasSourceReader } from "./source-response.mjs";
|
|
2
3
|
|
|
3
4
|
export const MAX_UPSTREAM_ERROR_BODY_BYTES = 1024 * 1024;
|
|
4
5
|
export const MAX_UPSTREAM_MODEL_CATALOG_BYTES = 8 * 1024 * 1024;
|
|
@@ -31,7 +32,7 @@ function unreadableUpstreamBody(label) {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
async function cancelResponseBody(response) {
|
|
34
|
-
try { await response
|
|
35
|
+
try { await cancelSourceResponse(response); } catch {}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
function responseAbortError(signal) {
|
|
@@ -42,7 +43,7 @@ function responseAbortError(signal) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export function readResponseChunk(reader, signal) {
|
|
45
|
-
if (!signal) return reader.read();
|
|
46
|
+
if (!signal) return hasSourceReader(reader) ? reader.read().then(value => { observeSourceRead(reader, value);return value; }, error => { failSourceRead(reader);throw error; }) : reader.read();
|
|
46
47
|
if (signal.aborted) return Promise.reject(responseAbortError(signal));
|
|
47
48
|
return new Promise((resolve, reject) => {
|
|
48
49
|
let settled = false;
|
|
@@ -54,13 +55,13 @@ export function readResponseChunk(reader, signal) {
|
|
|
54
55
|
};
|
|
55
56
|
const onAbort = () => {
|
|
56
57
|
const error = responseAbortError(signal);
|
|
57
|
-
try {
|
|
58
|
+
try { void cancelSourceReader(reader, error).catch(() => {}); } catch {}
|
|
58
59
|
finish(reject, error);
|
|
59
60
|
};
|
|
60
61
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
61
62
|
reader.read().then(
|
|
62
|
-
(value) => finish(resolve, value),
|
|
63
|
-
(error) => finish(reject, error),
|
|
63
|
+
(value) => { observeSourceRead(reader, value);finish(resolve, value); },
|
|
64
|
+
(error) => { failSourceRead(reader);finish(reject, error); },
|
|
64
65
|
);
|
|
65
66
|
});
|
|
66
67
|
}
|
|
@@ -96,7 +97,7 @@ export async function readBoundedResponseBuffer(response, {
|
|
|
96
97
|
if ((responseContentLength(response) || 0) > 0) throw unreadableUpstreamBody(label);
|
|
97
98
|
return Buffer.alloc(0);
|
|
98
99
|
}
|
|
99
|
-
const reader = response
|
|
100
|
+
const reader = sourceResponseReader(response);
|
|
100
101
|
if (!reader) throw unreadableUpstreamBody(label);
|
|
101
102
|
const chunks = [];
|
|
102
103
|
let total = 0;
|
|
@@ -107,7 +108,7 @@ export async function readBoundedResponseBuffer(response, {
|
|
|
107
108
|
const chunk = Buffer.from(value);
|
|
108
109
|
total += chunk.length;
|
|
109
110
|
if (total > limit) {
|
|
110
|
-
await reader
|
|
111
|
+
await cancelSourceReader(reader).catch(() => {});
|
|
111
112
|
throw upstreamBodyTooLarge(label, limit);
|
|
112
113
|
}
|
|
113
114
|
chunks.push(chunk);
|
|
@@ -115,7 +116,7 @@ export async function readBoundedResponseBuffer(response, {
|
|
|
115
116
|
return Buffer.concat(chunks, total);
|
|
116
117
|
} finally {
|
|
117
118
|
try {
|
|
118
|
-
reader
|
|
119
|
+
releaseSourceReader(reader);
|
|
119
120
|
} catch (error) {
|
|
120
121
|
if (!signal?.aborted) throw error;
|
|
121
122
|
}
|
package/src/user-settings.mjs
CHANGED
|
@@ -23,7 +23,7 @@ const AUTO_REVIEW_REASONING_KEY = "auto_review_reasoning";
|
|
|
23
23
|
const TERMINAL_ANIMATION_KEY = "terminal_animation";
|
|
24
24
|
const RESPONSE_HISTORY_MAX_MIB_KEY = "response_history_max_mib";
|
|
25
25
|
const DECODED_BODY_LIMIT_MIB_KEY = "decoded_body_limit_mib";
|
|
26
|
-
const SERVICE_FLAGS = ["terminal_animation_enabled", "open_webui", "image_enabled", "prediction_enabled", "context_compaction_enabled"];
|
|
26
|
+
const SERVICE_FLAGS = ["terminal_animation_enabled", "open_webui", "image_enabled", "prediction_enabled", "context_compaction_enabled", "codex_auto_launch"];
|
|
27
27
|
export const DECODED_BODY_LIMIT_MIN_MIB = RUNTIME_DEFAULTS.maxDecodedBodyBytes / MIB;
|
|
28
28
|
export const DECODED_BODY_LIMIT_MAX_MIB = 512;
|
|
29
29
|
export { RESPONSE_HISTORY_MAX_MIB, RESPONSE_HISTORY_MIN_MIB };
|
|
@@ -138,7 +138,7 @@ export function writeNightlyUpdatePreference(enabled, options = {}) {
|
|
|
138
138
|
return enabled;
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
const serviceFlags = settings => Object.fromEntries(SERVICE_FLAGS.map(key => [key, settings[key] !== false]));
|
|
141
|
+
const serviceFlags = settings => Object.fromEntries(SERVICE_FLAGS.map(key => [key, key === "codex_auto_launch" ? settings[key] === true : settings[key] !== false]));
|
|
142
142
|
|
|
143
143
|
// One strict read gives each status update a coherent view; no stale cache.
|
|
144
144
|
export function serviceSettingsSnapshot(options = {}) {
|