codex-copilot-dx 1.4.14 → 1.4.15
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/docs/ARCHITECTURE.md +4 -0
- package/docs/REFERENCE.md +1 -1
- package/package.json +1 -1
- package/src/antigravity-models.mjs +32 -1
- package/src/antigravity-runtime.mjs +5 -8
- package/src/dashboard/index.html +5 -4
- package/src/dashboard/language.js +2 -0
- package/src/dashboard/status.js +38 -20
- package/src/dashboard/tool-activity-machines.js +841 -319
- package/src/dashboard/tool-activity.js +6 -6
- package/src/dashboard/ui.css +37 -11
- package/src/dashboard/ui.js +3 -3
- package/src/providers/api.mjs +4 -1
- package/src/source-admission.mjs +33 -8
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const root = document.getElementById("tool-activity");if (!root) return;
|
|
3
3
|
const el = id => document.getElementById(id), canvas = el("tool-canvas"), ctx = canvas.getContext?.("2d");
|
|
4
|
-
const styles = new Set(["assembly", "sorter", "gantry", "rotary", "off"]), storageKey = "ccdx.dashboard.toolMotionStyle";
|
|
4
|
+
const styles = new Set(["production", "clock", "assembly", "sorter", "gantry", "rotary", "off"]), storageKey = "ccdx.dashboard.toolMotionStyle";
|
|
5
5
|
const pending = state => ["preparing", "waiting"].includes(state);
|
|
6
6
|
const phrase = (key, values = {}) => globalThis.ccdxLanguage.format(key, values);
|
|
7
7
|
const text = (id, key, values) => globalThis.ccdxLanguage.set(el(id), key, values);
|
|
8
|
-
const state = { scene: "idle", style: "
|
|
8
|
+
const state = { scene: "idle", style: "production" };
|
|
9
9
|
const drawMachine = ctx && globalThis.ccdxToolMachines(ctx);
|
|
10
10
|
try { const saved = localStorage.getItem(storageKey);if (styles.has(saved)) state.style = saved; } catch {}
|
|
11
11
|
const motion = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)") || { matches: false, addEventListener() {} };
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
if (canvas.width !== w || canvas.height !== h) { canvas.width = w;canvas.height = h; }
|
|
28
28
|
ctx.setTransform(1, 0, 0, 1, 0, 0);ctx.clearRect(0, 0, w, h);
|
|
29
29
|
if (animating() && !motion.matches) drawnTime = (now - start) / 1000;
|
|
30
|
-
drawMachine(state.style, { time:
|
|
30
|
+
drawMachine(state.style, { time: motion.matches ? 0 : drawnTime ?? 0, width, height, dpr, ink: color, surface });
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function animate(now) {
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
el("tool-technical").replaceChildren();
|
|
101
101
|
for (const row of rows) {
|
|
102
102
|
const line = document.createElement("tr");
|
|
103
|
-
for (const value of [appName(row.application), sourceName(row.provider), row.model,
|
|
104
|
-
row.name || phrase("tool_action_generic"), phrase(`tool_row_${row.state}`)]) {
|
|
105
|
-
const cell = document.createElement("td");cell.textContent = value;line.append(cell);
|
|
103
|
+
for (const [label, value] of [["client", appName(row.application)], ["source", sourceName(row.provider)], ["model", row.model],
|
|
104
|
+
["tool_name", row.name || phrase("tool_action_generic")], ["outcome", phrase(`tool_row_${row.state}`)]]) {
|
|
105
|
+
const cell = document.createElement("td");cell.textContent = value;cell.dataset.label = phrase(label);line.append(cell);
|
|
106
106
|
}
|
|
107
107
|
el("tool-technical").append(line);
|
|
108
108
|
}
|
package/src/dashboard/ui.css
CHANGED
|
@@ -269,9 +269,18 @@ main { align-self: start; }
|
|
|
269
269
|
.chart-heading { flex-wrap: wrap; align-items: end; }
|
|
270
270
|
.chart-heading .analytics-controls { margin: 0; }
|
|
271
271
|
.chart-heading label { display: grid; gap: 6px; color: var(--muted); }
|
|
272
|
-
.request-
|
|
273
|
-
.request-
|
|
274
|
-
.request-
|
|
272
|
+
.request-detail-cell { padding: 9px 12px 12px; background: var(--surface); }
|
|
273
|
+
.request-detail-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr)); gap:5px 20px; margin:0; }
|
|
274
|
+
.request-detail-fields > div { display:grid; grid-template-columns:minmax(0,max-content) minmax(0,1fr); align-items:baseline; gap:6px 10px; min-width:0; }
|
|
275
|
+
.request-detail-fields .request-detail-wide { grid-column:1 / -1; }
|
|
276
|
+
.request-detail-fields dt { color:var(--muted); }
|
|
277
|
+
.request-detail-fields dd { margin:0; overflow-wrap:anywhere; min-width:0; }
|
|
278
|
+
.request-disclosure { min-height:0; padding:4px 8px; white-space:nowrap; }
|
|
279
|
+
.recent-requests-table th.recent-request-time { width:13ch; }
|
|
280
|
+
.recent-requests-table th.recent-request-duration { width:15ch; }
|
|
281
|
+
.recent-requests-table th.recent-request-app { width:17%; }
|
|
282
|
+
.recent-requests-table th.recent-request-result { width:17%; }
|
|
283
|
+
.recent-requests-table th:last-child { width:10ch; }
|
|
275
284
|
.snapshot-meta { justify-content: flex-start; margin-top: 14px; line-height: 1.7; }
|
|
276
285
|
.overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
277
286
|
.client-overview { grid-template-columns: 1fr; }
|
|
@@ -693,28 +702,40 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
693
702
|
|
|
694
703
|
.tool-style { display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);white-space:nowrap; }
|
|
695
704
|
.tool-style select { max-width:160px; }
|
|
696
|
-
.tool-stage { display:grid;grid-template-columns:minmax(
|
|
705
|
+
.tool-stage { display:grid;grid-template-columns:minmax(0,2fr) minmax(180px,1fr);align-items:start;gap:18px; }
|
|
697
706
|
.tool-visual,.tool-content { min-width:0; }
|
|
698
|
-
.tool-orbit { width:100%;height:
|
|
707
|
+
.tool-orbit { width:100%;height:clamp(260px,29vw,360px);position:relative; }
|
|
699
708
|
.tool-orbit canvas { display:block;width:100%;height:100%; }
|
|
700
709
|
.tool-stage[data-style="off"] { grid-template-columns:1fr;min-height:110px; }
|
|
701
710
|
.tool-stage[data-style="off"] .tool-orbit { display:none; }
|
|
702
711
|
.tool-stage[data-style="off"] .tool-narration { text-align:left; }
|
|
703
712
|
.tool-narration { margin:0;min-height:24px;text-align:center;color:var(--text);font-size:12px;line-height:1.7; }
|
|
704
|
-
.tool-context { color:var(--muted);font-size:11px;line-height:1.6;margin:0 0
|
|
705
|
-
.tool-entry { display:grid;grid-template-columns:
|
|
713
|
+
.tool-context { color:var(--muted);font-size:11px;line-height:1.6;margin:0 0 8px;overflow-wrap:anywhere; }
|
|
714
|
+
.tool-entry { display:grid;grid-template-columns:12px minmax(0,1fr) minmax(0,max-content);gap:7px;align-items:center;min-height:34px;padding-block:4px;border-bottom:1px solid var(--border); }
|
|
706
715
|
.tool-entry:last-child { border-bottom:0; }
|
|
707
716
|
.tool-name { font-size:12px; }
|
|
708
|
-
.tool-entry > span:last-child { color:var(--muted);font-size:11px;
|
|
717
|
+
.tool-entry > span:last-child { color:var(--muted);font-size:11px;text-align:right;overflow-wrap:anywhere; }
|
|
709
718
|
.tool-mark { display:inline-block;width:7px;height:7px;border:1px solid var(--accent);border-radius:50%; }
|
|
710
719
|
.tool-entry[data-state="preparing"] .tool-mark { background:var(--accent); }
|
|
711
720
|
.tool-entry[data-state="returned"] .tool-mark { width:9px;height:5px;border-top:0;border-right:0;border-radius:0;transform:rotate(-45deg); }
|
|
712
721
|
.tool-technical { margin:12px 0 0;color:var(--muted);font-size:11px; }
|
|
713
722
|
.tool-technical p { overflow-wrap:anywhere;line-height:1.7;margin:6px 0; }
|
|
723
|
+
.tool-technical th:nth-child(3), .tool-technical th:nth-child(4) { width:26%; }
|
|
714
724
|
#tool-cursor { display:inline-block;animation:tool-cursor 1s steps(1) infinite; }
|
|
715
725
|
#tool-activity[data-paused="true"] #tool-cursor { animation:none; }
|
|
716
726
|
@keyframes tool-cursor { 50% { opacity:0; } }
|
|
717
|
-
@media(max-width:
|
|
727
|
+
@media(max-width:760px) {
|
|
728
|
+
.tool-stage { grid-template-columns:1fr;gap:8px; }
|
|
729
|
+
.tool-orbit { height:clamp(200px,52vw,320px); }
|
|
730
|
+
.tool-context { margin-bottom:4px; }
|
|
731
|
+
}
|
|
732
|
+
@media(max-width:620px) {
|
|
733
|
+
.tool-technical :is(table,tbody,tr) { display:block; }
|
|
734
|
+
.tool-technical thead { position:absolute; clip-path:inset(50%); width:1px; height:1px; overflow:hidden; }
|
|
735
|
+
.tool-technical tbody tr { padding-block:6px; border-bottom:1px solid var(--border); }
|
|
736
|
+
.tool-technical tbody td { display:grid; grid-template-columns:70px minmax(0,1fr); gap:8px; padding:2px 0; border:0; }
|
|
737
|
+
.tool-technical tbody td::before { content:attr(data-label); color:var(--muted); }
|
|
738
|
+
}
|
|
718
739
|
@media(prefers-reduced-motion:reduce) { #tool-cursor { animation:none; } }
|
|
719
740
|
|
|
720
741
|
/* Compact request statistics in the existing diagnostics panel. */
|
|
@@ -759,8 +780,13 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
759
780
|
.usage-table :is(th,td):not(:first-child):not(:nth-child(7)):not([colspan]) { display: none; }
|
|
760
781
|
.usage-table th:first-child { width: 70%; }
|
|
761
782
|
.usage-row-details { display: block; }
|
|
762
|
-
.recent-requests-table
|
|
763
|
-
.recent-requests-table th:
|
|
783
|
+
.recent-requests-table { table-layout:auto; }
|
|
784
|
+
.recent-requests-table :is(th,td):is(.recent-request-time,.recent-request-app) { display:none; }
|
|
785
|
+
.recent-requests-table th.recent-request-duration { width:11ch; }
|
|
786
|
+
.recent-requests-table th.recent-request-result { width:1%; }
|
|
787
|
+
.recent-requests-table th:last-child { width:1%; }
|
|
788
|
+
.recent-requests-table .recent-request-duration { white-space:nowrap; }
|
|
789
|
+
.recent-requests-table .recent-request-result { overflow-wrap:normal; }
|
|
764
790
|
.failure-table th:last-child { width: 40%; }
|
|
765
791
|
}
|
|
766
792
|
#action-confirm-apply { background:var(--accent); color:var(--page); border-color:var(--accent); }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -405,13 +405,13 @@ const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
|
405
405
|
variant: () => {
|
|
406
406
|
const mode = (element("usage-analytics").open || Boolean(usageView.selectedDate)) ? "analytics" : "summary";
|
|
407
407
|
const provider = element("usage-provider")?.value || "";
|
|
408
|
-
return JSON.stringify({ mode, provider, model: element("analytics-model").value || "", days: element("analytics-range").value || "all", date: usageView.selectedDate });
|
|
408
|
+
return JSON.stringify({ mode, provider, model: element("analytics-model").value || "", days: element("analytics-range").value || "all", date: usageView.selectedDate, purpose: element("usage-purpose")?.value || "" });
|
|
409
409
|
},
|
|
410
410
|
load: async ({ variant, signal }) => {
|
|
411
|
-
const { mode, provider, model, days, date } = JSON.parse(variant), query = new URLSearchParams();
|
|
411
|
+
const { mode, provider, model, days, date, purpose } = JSON.parse(variant), query = new URLSearchParams();
|
|
412
412
|
if (mode === "analytics") { query.set("analytics", "1");query.set("time_zone", Intl.DateTimeFormat().resolvedOptions().timeZone); }
|
|
413
413
|
if (provider) query.set("provider", provider);
|
|
414
|
-
if (
|
|
414
|
+
if (purpose) query.set("purpose", purpose);
|
|
415
415
|
if (model) query.set("model", model);
|
|
416
416
|
if (date?.startsWith("<")) query.set("to", new Date(Date.parse(date.slice(1)) - 86400000).toISOString().slice(0, 10));
|
|
417
417
|
else if (date) { query.set("from", date);query.set("to", date); }
|
package/src/providers/api.mjs
CHANGED
|
@@ -46,6 +46,8 @@ export function createApiProvider({ config, secrets, env = process.env, platform
|
|
|
46
46
|
endpoint: config.endpoints[protocol] ? new URL(config.endpoints[protocol]).href : null, key: config.secret_ref || fingerprint, auth: protocol === "messages" ? config.auth_header : protocol === "gemini" ? "x-goog-api-key" : "bearer",
|
|
47
47
|
})).digest("hex").slice(0, 24)}`]));
|
|
48
48
|
const profile = profiles.responses;
|
|
49
|
+
const admissionAccount = `api:${config.id}:${config.secret_ref || fingerprint}`;
|
|
50
|
+
const admissionRevision = createHash("sha256").update(JSON.stringify(profiles)).digest("hex");
|
|
49
51
|
const modelsUrl = config.base_url.replace(/\/+$/, "") + "/models", geminiModelsUrl = config.endpoints.gemini && new URL(config.endpoints.gemini).href;
|
|
50
52
|
const targets = [...Object.values(config.endpoints), modelsUrl];
|
|
51
53
|
if (config.endpoints.messages) targets.push(config.endpoints.messages.replace(/\/+$/, "") + "/count_tokens");
|
|
@@ -235,7 +237,8 @@ export function createApiProvider({ config, secrets, env = process.env, platform
|
|
|
235
237
|
},
|
|
236
238
|
};
|
|
237
239
|
return {
|
|
238
|
-
id: config.id, name: config.name, client, registry, configuredModels: true, defaultReviewEffort: null,
|
|
240
|
+
id: config.id, name: config.name, client, registry, configuredModels: true, defaultReviewEffort: null,
|
|
241
|
+
admissionAccount, admissionRevision, profileId: (protocol = "responses") => profiles[protocol] || profile,
|
|
239
242
|
models: family => catalog.filter(model => model.supported_endpoints.includes(family === "claude" ? paths.messages : family === "gemini" ? paths.gemini : paths.responses))
|
|
240
243
|
.map(model => ({ ...model, ...modelDisplay(model.id), capability: model.protocol_capabilities[family === "claude" ? "messages" : family === "gemini" ? "gemini" : "responses"] })),
|
|
241
244
|
catalog: () => catalog,
|
package/src/source-admission.mjs
CHANGED
|
@@ -27,7 +27,13 @@ export function observeSourceStreamFailure(response, error) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export function admittedSource(source, scheduler) {
|
|
30
|
-
|
|
30
|
+
if (!source?.client || !scheduler) return source;
|
|
31
|
+
if (!source.admissionRevision) {
|
|
32
|
+
return { ...source, client: scheduler.wrap(source.client, () => ({ source: source.id, account: source.profileId() })) };
|
|
33
|
+
}
|
|
34
|
+
const descriptor = { source: source.id, account: source.admissionAccount, revision: source.admissionRevision };
|
|
35
|
+
scheduler.registerDeployment(descriptor);
|
|
36
|
+
return { ...source, client: scheduler.wrap(source.client, () => descriptor) };
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
export function sourceLimitFeedback(status, headers, body, now = Date.now()) {
|
|
@@ -65,8 +71,9 @@ export function sourceLimitFeedback(status, headers, body, now = Date.now()) {
|
|
|
65
71
|
export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT, maxQueued = 16,
|
|
66
72
|
maxQueuedBytes = MAX_QUEUE_BYTES, waitTimeoutMs = 30000, stableMs = 60000, onStable = () => {}, learned = {} } = {}) {
|
|
67
73
|
const groups = new Map(), limits = new Map(), clients = new WeakMap();
|
|
74
|
+
const deployments = new Map();
|
|
68
75
|
let closed = false, queuedBytes = 0;
|
|
69
|
-
const groupFor = ({ source, account = source }) => {
|
|
76
|
+
const groupFor = ({ source, account = source, revision }) => {
|
|
70
77
|
const identity = source + "\0" + account;
|
|
71
78
|
let group = groups.get(identity);
|
|
72
79
|
if (!group) {
|
|
@@ -75,8 +82,11 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
75
82
|
if (!idle) throw failure("ccdx_source_capacity", "Source scheduler is busy. Retry shortly.");
|
|
76
83
|
clearTimeout(idle[1].timer);groups.delete(idle[0]);
|
|
77
84
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
85
|
+
const deployment = revision && deployments.get(source);
|
|
86
|
+
const activeRevision = deployment?.account === account ? deployment.revision : revision;
|
|
87
|
+
const key = fingerprint(activeRevision ? identity + "\0" + activeRevision : identity);
|
|
88
|
+
const saved = learned[key], restored = validLimit(saved?.limit) && saved?.limit !== null && now() >= saved.at && now() - saved.at < 86400000;
|
|
89
|
+
group = { source, key, revision: activeRevision, limit: restored ? saved.limit : initialLimit, active: 0, queue: [], models: new Map(), lastClient: null,
|
|
80
90
|
epoch: 0, stableAt: now(), successes: 0, readyToGrow: false, lastStableNotice: now(), pausedUntil: 0, reason: null, timer: null, completed: 0, rejected: 0 };
|
|
81
91
|
groups.set(identity, group);
|
|
82
92
|
}
|
|
@@ -116,7 +126,7 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
116
126
|
arm(group);
|
|
117
127
|
}
|
|
118
128
|
function feedback(group, entry, value) {
|
|
119
|
-
if (!value) return;
|
|
129
|
+
if (!value || entry.revision !== group.revision) return;
|
|
120
130
|
const until = now() + Math.min(7 * 86400000, value.delay);
|
|
121
131
|
const model = modelState(group, entry.model);
|
|
122
132
|
if (value.scope === "source") { group.pausedUntil = Math.max(group.pausedUntil, until);group.reason = value.kind; }
|
|
@@ -137,11 +147,12 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
137
147
|
arm(group);
|
|
138
148
|
}
|
|
139
149
|
class Lease {
|
|
140
|
-
constructor(group, model, client) { this.group = group;this.model = model;this.client = client;this.epoch = group.epoch;this.bytes = 0;this.released = false;this.observed = false; }
|
|
150
|
+
constructor(group, model, client, revision) { this.group = group;this.model = model;this.client = client;this.revision = revision;this.epoch = group.epoch;this.bytes = 0;this.released = false;this.observed = false; }
|
|
141
151
|
limit(value) { this.observed = true;feedback(this.group, this, value); }
|
|
142
152
|
streamFailure(error, headers) { const value = sourceLimitFeedback(429, headers, { error }, now());if (value?.kind !== "unknown") this.limit(value); }
|
|
143
153
|
observe(status, headers, body) {
|
|
144
154
|
const group = this.group, entry = this;
|
|
155
|
+
if (entry.revision !== group.revision) return;
|
|
145
156
|
if (!this.headersObserved) {
|
|
146
157
|
this.headersObserved = true;
|
|
147
158
|
const declared = headers?.get?.("x-ratelimit-concurrency-limit");
|
|
@@ -159,7 +170,7 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
159
170
|
release(success = false) {
|
|
160
171
|
if (this.released) return;this.released = true;
|
|
161
172
|
const group = this.group, entry = this, model = this.modelState;group.active--;if (model) model.active--;group.completed++;
|
|
162
|
-
if (success && !this.observed) {
|
|
173
|
+
if (success && !this.observed && entry.revision === group.revision) {
|
|
163
174
|
group.successes = Math.min(8, group.successes + 1);
|
|
164
175
|
const mature = group.successes >= 8 && now() - group.stableAt >= stableMs;
|
|
165
176
|
group.readyToGrow ||= mature;
|
|
@@ -192,7 +203,7 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
192
203
|
function acquire(descriptor, { signal, model = "unknown", client = "other", bytes, bodyText } = {}) {
|
|
193
204
|
if (closed) throw failure("ccdx_source_closed", "The source scheduler is stopping.");
|
|
194
205
|
if (signal?.aborted) throw abortError(signal);
|
|
195
|
-
const group = groupFor(descriptor), entry = new Lease(group, model, client);
|
|
206
|
+
const group = groupFor(descriptor), entry = new Lease(group, model, client, descriptor.revision);
|
|
196
207
|
if (!group.queue.length && fits(group, entry)) { entry.resolve = immediate;return activate(group, entry); }
|
|
197
208
|
const delay = Math.max(0, readyAt(group, entry) - now());
|
|
198
209
|
if (delay >= waitTimeoutMs) throw failure("ccdx_source_limited", "The source is limited. Retry after its recovery time.", delay, 429);
|
|
@@ -279,6 +290,20 @@ export function createSourceAdmission({ now = Date.now, initialLimit = MAX_LIMIT
|
|
|
279
290
|
}
|
|
280
291
|
return {
|
|
281
292
|
run,
|
|
293
|
+
registerDeployment(descriptor) {
|
|
294
|
+
const { source, account, revision } = descriptor;
|
|
295
|
+
if (!deployments.has(source) && deployments.size >= 64) deployments.delete(deployments.keys().next().value);
|
|
296
|
+
deployments.set(source, descriptor);
|
|
297
|
+
const identity = source + "\0" + account, group = groups.get(identity);
|
|
298
|
+
if (!group || group.revision === revision) return;
|
|
299
|
+
// Keep leases in the account pool while discarding evidence from the replaced endpoints.
|
|
300
|
+
const time = now();
|
|
301
|
+
Object.assign(group, { key: fingerprint(identity + "\0" + revision), revision, limit: initialLimit,
|
|
302
|
+
epoch: 0, stableAt: time, successes: 0, readyToGrow: false, lastStableNotice: time,
|
|
303
|
+
pausedUntil: 0, reason: null, advertised: undefined, advertisedUntil: 0 });
|
|
304
|
+
group.models.clear();
|
|
305
|
+
drain(group);
|
|
306
|
+
},
|
|
282
307
|
wrap(client, descriptor) {
|
|
283
308
|
if (!client || clients.has(client) || client[SOURCE_ADMISSION]?.scheduler === this) return clients.get(client) || client;
|
|
284
309
|
const wrapped = { ...client };
|