codex-copilot-dx 1.4.11 → 1.4.13
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/bin/cli.mjs +2 -0
- package/docs/ARCHITECTURE.md +6 -0
- package/docs/REFERENCE.md +21 -10
- package/package.json +1 -1
- package/src/access-settings.mjs +4 -1
- package/src/adapter.mjs +14 -5
- package/src/antigravity-chat-bridge.mjs +38 -8
- package/src/antigravity-handler.mjs +141 -26
- package/src/antigravity-models.mjs +3 -2
- package/src/antigravity-runtime.mjs +129 -36
- package/src/antigravity-usage.mjs +3 -3
- package/src/api-target.mjs +12 -1
- package/src/application-configuration.mjs +2 -1
- package/src/application-control.mjs +6 -3
- package/src/cli-command-spec.mjs +1 -1
- package/src/cli-management.mjs +9 -4
- package/src/connection-management.mjs +6 -2
- package/src/connection-policy.mjs +3 -3
- package/src/connection-routing.mjs +37 -10
- package/src/connection-runtime.mjs +4 -0
- package/src/connection-view.mjs +12 -0
- package/src/context-compaction-wire.mjs +6 -6
- package/src/copilot-client.mjs +3 -2
- package/src/copilot.mjs +13 -2
- package/src/dashboard/connections.js +18 -8
- package/src/dashboard/console.js +9 -4
- package/src/dashboard/context.js +15 -5
- package/src/dashboard/features.js +2 -2
- package/src/dashboard/flow.js +1 -0
- package/src/dashboard/gemini.js +40 -10
- package/src/dashboard/index.html +47 -40
- package/src/dashboard/language.js +44 -16
- package/src/dashboard/status.js +35 -30
- package/src/dashboard/tool-activity-machines.js +362 -0
- package/src/dashboard/tool-activity.js +24 -115
- package/src/dashboard/tools.js +3 -4
- package/src/dashboard/ui.css +44 -14
- package/src/dashboard/ui.js +14 -0
- package/src/dashboard/usage.js +9 -1
- package/src/dashboard.mjs +1 -0
- package/src/failure-history.mjs +97 -0
- package/src/model-capabilities.mjs +1 -1
- package/src/privacy-transform.mjs +22 -4
- package/src/provider-metadata.mjs +1 -1
- package/src/providers/api-network.mjs +4 -3
- package/src/providers/api.mjs +79 -15
- package/src/response-failures.mjs +10 -4
- package/src/runtime-config.mjs +1 -0
- package/src/safe-upstream-error.mjs +2 -2
- package/src/source-admission.mjs +1 -1
- package/src/stream-performance.mjs +1 -1
- package/src/terminal-state.mjs +8 -2
- package/src/windows-http-network.mjs +4 -3
- package/src/windows-prediction-network.cs +11 -0
package/src/dashboard/status.js
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
const gemini=data.gemini || globalThis.ccdxGeminiStatus;
|
|
77
77
|
const setup=gemini.enabled&&gemini.source_enabled!==false?"configured":gemini.configured?"access_paused":"not_configured";
|
|
78
78
|
const service=gemini.configured===true?"running":gemini.configured===false?"unavailable":"unknown";
|
|
79
|
-
const row=tableRow(["Antigravity",gemini.enabled&&gemini.source_enabled!==false?"Google + GitHub Copilot":"Google",setup,service,"—"],{labels:[2,3]});
|
|
79
|
+
const row=tableRow(["Antigravity",gemini.model_source||(gemini.enabled&&gemini.source_enabled!==false?"Google + GitHub Copilot":"Google"),setup,service,"—"],{labels:[2,3]});
|
|
80
80
|
if(globalThis.ccdxIcons){
|
|
81
81
|
globalThis.ccdxIcons.set(row.children[2],setup,globalThis.ccdxIcons.kind(setup==="access_paused"?"paused":setup));
|
|
82
82
|
globalThis.ccdxIcons.set(row.children[3],service,globalThis.ccdxIcons.kind(service));
|
|
@@ -139,15 +139,11 @@
|
|
|
139
139
|
failures.reverse();
|
|
140
140
|
text("failure-count", "count_retained_requests_events", { count: failures.length });
|
|
141
141
|
if (!failures.length) {
|
|
142
|
-
|
|
143
|
-
item.className = "empty";
|
|
144
|
-
localize(item, "no_recent_request_failures_recorded");
|
|
145
|
-
list.append(item);
|
|
142
|
+
emptyTable("failures", 4, "no_recent_request_failures_recorded");
|
|
146
143
|
return;
|
|
147
144
|
}
|
|
148
145
|
for (const failure of failures) {
|
|
149
146
|
const notModelRequest = ["not_found", "image_mcp", "models", "claude_models"].includes(failure.route);
|
|
150
|
-
const item = document.createElement("li");
|
|
151
147
|
const details = document.createElement("details");
|
|
152
148
|
details.dataset.key = `${failure.at}/${failure.request_id || failure.response_id}/${failure.code}`;
|
|
153
149
|
details.open = expanded.has(details.dataset.key);
|
|
@@ -167,25 +163,16 @@
|
|
|
167
163
|
: failure.http_status === 504 && failure.code === "upstream_timeout"
|
|
168
164
|
? Number.isFinite(attempt?.body_sent_ms) && attempt.headers_ms === null ? "issue_after_send_timeout" : "issue_upstream_timeout"
|
|
169
165
|
: failure.http_status === 401 || failure.http_status === 403 ? "issue_access_denied" : "issue_request_failed";
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
localize(title,
|
|
179
|
-
if (failure.occurrences > 1) {
|
|
180
|
-
summary.detail = phrase("repeated_issue", { detail: summary.detail, count: failure.occurrences });
|
|
181
|
-
localize(title, "detail_retry", summary);
|
|
182
|
-
}
|
|
166
|
+
const at = failure.at ? time(failure.at, { date: true }) : phrase("unknown_time");
|
|
167
|
+
const app = failure.application || timeline?.application;
|
|
168
|
+
const row = tableRow([at, "", notModelRequest ? "" : failure.model || "", ""]);
|
|
169
|
+
localize(row.children[1], app ? `flow_app_${app}` : "unknown");
|
|
170
|
+
if (notModelRequest || !failure.model) localize(row.children[2], notModelRequest ? "not_applicable" : "unknown_model");
|
|
171
|
+
const retryWait = seconds && cause === "issue_source_rate";
|
|
172
|
+
const causeKey = retryWait ? "issue_source_rate_wait" : cause, causeArgs = retryWait ? { seconds: number(seconds) } : {};
|
|
173
|
+
if (failure.occurrences > 1) localize(title, "repeated_issue", { detail: phrase(causeKey, causeArgs), count: failure.occurrences });
|
|
174
|
+
else localize(title, causeKey, causeArgs);
|
|
183
175
|
const provider = failure.provider || timeline?.provider;
|
|
184
|
-
if (provider) {
|
|
185
|
-
const source = sourceLabel(provider);
|
|
186
|
-
const original = phrase("detail_retry", summary);
|
|
187
|
-
localize(title, "source_failure_summary", { source, detail: original });
|
|
188
|
-
}
|
|
189
176
|
const timings = timeline?.timings_ms || {};
|
|
190
177
|
const timingText = ["admission", "body", "history", "images", "serialization", "upstream_start", "upstream_headers", "first_output", "last_activity", "terminal", "finished"]
|
|
191
178
|
.filter((key) => finite(timings[key])).map((key) => `${key}=${Number(timings[key]).toFixed(1)}`).join(" / ");
|
|
@@ -204,7 +191,7 @@
|
|
|
204
191
|
request_options: failure.request_options ? JSON.stringify(failure.request_options) : undefined,
|
|
205
192
|
transport: failure.transport ? JSON.stringify(failure.transport) : undefined,
|
|
206
193
|
output_requested: timeline?.context?.max_output_tokens_requested, output_sent: timeline?.context?.max_output_tokens_sent,
|
|
207
|
-
output_used: timeline?.context?.output_tokens, stop_reason: timeline?.stop_reason, requested_model: failure.requested_model, request_kind: failure.request_kind === "unknown" ? undefined : failure.request_kind, provider
|
|
194
|
+
output_used: timeline?.context?.output_tokens, stop_reason: timeline?.stop_reason, requested_model: failure.requested_model, request_kind: failure.request_kind === "unknown" ? undefined : failure.request_kind, provider,
|
|
208
195
|
attempt_timings: failure.attempt_timings || timeline?.attempts ? JSON.stringify(failure.attempt_timings || timeline.attempts) : undefined,
|
|
209
196
|
timings_ms: timingText };
|
|
210
197
|
const diagnostic = document.createElement("dl");
|
|
@@ -215,7 +202,7 @@
|
|
|
215
202
|
const label = document.createElement("dt");
|
|
216
203
|
const content = document.createElement("dd");
|
|
217
204
|
localize(label, key);
|
|
218
|
-
const rawValue = String(value).slice(0, 500);
|
|
205
|
+
const rawValue = (typeof value?.key === "string" ? globalThis.ccdxLanguage.format(value.key, value.values) : String(value)).slice(0, 500);
|
|
219
206
|
if (key === "retry" || (key === "message" && failure.local_message)) localize(content, rawValue);
|
|
220
207
|
else content.textContent = rawValue;
|
|
221
208
|
diagnostic.append(label, content);
|
|
@@ -232,9 +219,10 @@
|
|
|
232
219
|
});
|
|
233
220
|
const privacy = document.createElement("p");privacy.className = "hint";
|
|
234
221
|
localize(privacy, "upstream_messages_may_contain_sensitive_text");
|
|
235
|
-
details.append(title, diagnostic
|
|
236
|
-
|
|
237
|
-
|
|
222
|
+
details.append(title, diagnostic);
|
|
223
|
+
if (failure.diagnostic_message) details.append(privacy);
|
|
224
|
+
details.append(copy);
|
|
225
|
+
row.children[3].append(details);list.append(row);
|
|
238
226
|
}
|
|
239
227
|
}
|
|
240
228
|
|
|
@@ -351,6 +339,19 @@
|
|
|
351
339
|
issueRequests = recentRequests;
|
|
352
340
|
const kind = element("failure-kind")?.value || "issues";
|
|
353
341
|
renderFailures(issueGroups[kind] || [], kind === "issues" ? recentRequests : []);
|
|
342
|
+
const history = data.http_errors?.history, historyPanel = element("failure-history");
|
|
343
|
+
if (historyPanel) {
|
|
344
|
+
historyPanel.hidden = !history?.total;
|
|
345
|
+
if (history?.total) {
|
|
346
|
+
text("failure-history-title", "failure_history_count", { count: number(history.total) });
|
|
347
|
+
element("failure-history-body").replaceChildren(...history.groups.map(group => {
|
|
348
|
+
const row = tableRow([phrase(`flow_app_${group.application}`), group.model, phrase(group.phase === "unknown" ? "unknown" : `failure_phase_${group.phase}`),
|
|
349
|
+
number(group.count), time(group.last.at, { date: true }), group.last.request_id || "—"]);
|
|
350
|
+
if (group.last.client_request_id) row.lastElementChild.title = group.last.client_request_id;
|
|
351
|
+
return row;
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
354
355
|
renderContext({ ...data.stream_performance, recent_requests: recentRequests });
|
|
355
356
|
}
|
|
356
357
|
function renderActivity(data) {
|
|
@@ -444,7 +445,9 @@
|
|
|
444
445
|
const attempt = request.attempts?.at(-1);
|
|
445
446
|
for (const [key, value] of [["request_id", request.request_id || "—"], ["http_status", number(request.http_status)], ["attempts", number(request.upstream_attempts)], ["model_outcome", globalThis.ccdxLanguage?.format(outcome.toLowerCase()) || outcome],
|
|
446
447
|
["time", Number.isFinite(at) ? time(at, { date: true }) : "—"],
|
|
447
|
-
["
|
|
448
|
+
["client", request.application ? phrase(`flow_app_${request.application}`) : phrase("unknown")],
|
|
449
|
+
...(Number.isFinite(request.timings_ms?.finished) ? [["request_total_time", requestTime(request.timings_ms.finished)]] : []),
|
|
450
|
+
["source", String(sourceLabel(request.provider) || "—")], ["input_tokens", number(context.input_tokens)],
|
|
448
451
|
...(Number.isSafeInteger(queue?.wait_ms) && queue.wait_ms > 0 ? [["body_queue_wait", phrase("body_queue_detail", {
|
|
449
452
|
ms: number(queue.wait_ms), result: phrase(queueResult), reason: phrase(queueReason),
|
|
450
453
|
reserved: mib(queue.requested_bytes), occupied: mib(queue.active_bytes), limit: mib(queue.limit_bytes),
|
|
@@ -461,6 +464,8 @@
|
|
|
461
464
|
["wire_mib", finite(context.payload_bytes) ? `${(Number(context.payload_bytes) / 1048576).toFixed(2)} MiB` : "—"],
|
|
462
465
|
["images", number(context.images)], ["model_window", number(context.context_window_tokens)], ["input_window", ratio],
|
|
463
466
|
["output_requested", number(context.max_output_tokens_requested)], ["output_sent", number(context.max_output_tokens_sent)], ["output_used", number(context.output_tokens)], ["stop_reason", request.stop_reason || "—"],
|
|
467
|
+
...(["conversation_model", "background_default", "background_available"].includes(context.routing_reason)
|
|
468
|
+
? [["routing_reason", phrase(`routing_${context.routing_reason}`)]] : []),
|
|
464
469
|
...(context.requested_model && context.requested_model !== request.model ? [["requested_model", context.requested_model]] : []),
|
|
465
470
|
...(["reported", "partial", "missing", "unavailable"].includes(context.usage_state) ? [["request_usage_state", globalThis.ccdxLanguage?.format("request_usage_" + context.usage_state) || context.usage_state]] : []),
|
|
466
471
|
...(context.client_tool_errors_received > 0 ? [["client_tool_errors_received", number(context.client_tool_errors_received)]] : [])]) {
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const fract = x => x - Math.floor(x);
|
|
3
|
+
const clamp = x => Math.max(0, Math.min(1, x));
|
|
4
|
+
const ease = x => { x = clamp(x); return x * x * (3 - 2 * x); };
|
|
5
|
+
const mix = (a,b,t) => a+(b-a)*t;
|
|
6
|
+
const project = (x,y,z=0) => [x+y*.52,152+y*.36-z];
|
|
7
|
+
const palette = (inkColor, paperColor) => {
|
|
8
|
+
const sampler = document.createElement("canvas");sampler.width=1;sampler.height=1;
|
|
9
|
+
const sample = sampler.getContext("2d",{willReadFrequently:true});
|
|
10
|
+
const rgb = value => {
|
|
11
|
+
sample.clearRect(0,0,1,1);sample.fillStyle=value;sample.fillRect(0,0,1,1);
|
|
12
|
+
return [...sample.getImageData(0,0,1,1).data.slice(0,3)];
|
|
13
|
+
};
|
|
14
|
+
const ink = rgb(inkColor), paper = rgb(paperColor), colors = new Map();
|
|
15
|
+
const tone = strength => {
|
|
16
|
+
if (!colors.has(strength)) colors.set(strength, "rgb(" + paper.map((x,i) => Math.round(mix(x,ink[i],strength))).join(",") + ")");
|
|
17
|
+
return colors.get(strength);
|
|
18
|
+
};
|
|
19
|
+
return { ink:inkColor,paper:paperColor,face:tone(.04),signal:inkColor,tone,
|
|
20
|
+
stroke:tone(.66),shadow:tone(.10),base:tone(.32),top:tone(.13),side:tone(.25),end:tone(.39),edge:tone(.48) };
|
|
21
|
+
};
|
|
22
|
+
function poly(c,points,fill,stroke,width=1) {
|
|
23
|
+
c.beginPath();c.moveTo(...points[0]);for(let i=1;i<points.length;i++)c.lineTo(...points[i]);
|
|
24
|
+
if(fill){c.closePath();c.fillStyle=fill;c.fill();}
|
|
25
|
+
if(stroke){c.lineWidth=width;c.strokeStyle=stroke;c.stroke();}
|
|
26
|
+
}
|
|
27
|
+
function ellipse(c,x,y,rx,ry,fill,stroke,width=1) {
|
|
28
|
+
c.beginPath();c.ellipse(x,y,rx,ry,0,0,Math.PI*2);
|
|
29
|
+
if(fill){c.fillStyle=fill;c.fill();}
|
|
30
|
+
if(stroke){c.lineWidth=width;c.strokeStyle=stroke;c.stroke();}
|
|
31
|
+
}
|
|
32
|
+
function beam(c,a,b,width,color) {
|
|
33
|
+
c.lineCap="round";poly(c,[a,b],null,color,width);c.lineCap="butt";
|
|
34
|
+
}
|
|
35
|
+
function block(c,p,x,y,z,w,d,h,skin=p) {
|
|
36
|
+
const a=project(x,y,z),f=project(x,y+d,z),g=project(x+w,y+d,z);
|
|
37
|
+
const A=project(x,y,z+h),B=project(x+w,y,z+h),F=project(x,y+d,z+h),G=project(x+w,y+d,z+h);
|
|
38
|
+
// The camera is above, in front of +Y and on the -X side.
|
|
39
|
+
poly(c,[A,F,f,a],skin.end,p.stroke,.82);
|
|
40
|
+
poly(c,[F,G,g,f],skin.side,p.stroke,.82);
|
|
41
|
+
poly(c,[A,B,G,F],skin.top,p.stroke,.82);
|
|
42
|
+
poly(c,[F,G],null,p.tone(.37),.72);
|
|
43
|
+
}
|
|
44
|
+
function plinth(c,p,x,y,w,d,h=4) {
|
|
45
|
+
poly(c,[project(x-5,y+5),project(x+w+5,y+5),project(x+w+5,y+d+8),project(x-5,y+d+8)],p.shadow);
|
|
46
|
+
block(c,p,x,y,0,w,d,h,{top:p.face,side:p.side,end:p.base});
|
|
47
|
+
}
|
|
48
|
+
function signal(c,p,x,y,z,live) {
|
|
49
|
+
const [a,b]=project(x,y,z);
|
|
50
|
+
ellipse(c,a,b,3.8,2.4,p.tone(.4));
|
|
51
|
+
ellipse(c,a,b-.5,2.2,1.6,live?p.signal:p.tone(.60));
|
|
52
|
+
}
|
|
53
|
+
function roller(c,p,x,y,z,w,d) {
|
|
54
|
+
block(c,p,x,y,z,w,d,8);
|
|
55
|
+
const X=x+2,W=w-4;
|
|
56
|
+
c.save();poly(c,[project(X,y,8+z),project(X+W,y,8+z),project(X+W,y+d,8+z),project(X,y+d,8+z)],p.tone(.19));c.clip();
|
|
57
|
+
for(let a=x+5;a<x+w-3;a+=9){
|
|
58
|
+
poly(c,[project(a,y+2,z+8),project(a,y+d-2,z+8)],null,p.tone(.45),2.7);
|
|
59
|
+
poly(c,[project(a-.75,y+2,z+8),project(a-.75,y+d-2,z+8)],null,p.tone(.06),.85);
|
|
60
|
+
}
|
|
61
|
+
c.restore();
|
|
62
|
+
for(const dy of [0,d-2])block(c,p,x,y+dy,z+8,w,2,2);
|
|
63
|
+
for(const dx of [5,w-5]) {const [a,b]=project(x+dx,y+d,z+4);ellipse(c,a,b,1.8,1.8,p.ink,p.tone(.53),.5);}
|
|
64
|
+
}
|
|
65
|
+
// The rear plate goes behind the lane. The front plate and cap occlude
|
|
66
|
+
// the lane, leaving a continuous aperture on the visible end.
|
|
67
|
+
function beltGuard(c,p,x,y,length,depth,floor,ceiling,front) {
|
|
68
|
+
if(!front){
|
|
69
|
+
block(c,p,x,y,floor,length,3,ceiling-floor);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const edge=y+depth;
|
|
73
|
+
block(c,p,x,edge-3,floor,length,3,ceiling-floor);
|
|
74
|
+
block(c,p,x,y,ceiling,length,depth,3);
|
|
75
|
+
const [a,b]=project(x+length*.54,edge,ceiling-5);
|
|
76
|
+
ellipse(c,a,b,1.2,1.2,p.tone(.62));
|
|
77
|
+
}
|
|
78
|
+
const sweep = (q,start,end) => ease((q-start)/(end-start));
|
|
79
|
+
function planeCircle(c,x,y,z,r,fill,stroke,width=1) {
|
|
80
|
+
const [sx,sy]=project(x,y,z);
|
|
81
|
+
c.save();c.transform(1,0,.52,.36,sx,sy);
|
|
82
|
+
ellipse(c,0,0,r,r,fill,stroke,width);
|
|
83
|
+
c.restore();
|
|
84
|
+
}
|
|
85
|
+
function cylinder(c,p,x,y,z,r,h,skin=p) {
|
|
86
|
+
const near=Math.atan(.52);
|
|
87
|
+
const rim=Array.from({length:13},(_,i)=>{
|
|
88
|
+
const angle=near+i*Math.PI/12;
|
|
89
|
+
return [x+r*Math.cos(angle),y+r*Math.sin(angle)];
|
|
90
|
+
});
|
|
91
|
+
const face=rim.map(([u,v])=>project(u,v,z+h));
|
|
92
|
+
poly(c,[...face,...rim.reverse().map(([u,v])=>project(u,v,z))],skin.side,p.stroke,.8);
|
|
93
|
+
planeCircle(c,x,y,z+h,r,skin.top,p.stroke,1.1);
|
|
94
|
+
}
|
|
95
|
+
function flange(c,p,x,y,z,width=24,shadow=true) {
|
|
96
|
+
const half=width/2, depth=width*.32, h=6.5;
|
|
97
|
+
const outline=[[-half,-depth+3],[-half+3,-depth],[half-3,-depth],[half,-depth+3],
|
|
98
|
+
[half,depth-3],[half-3,depth],[-half+3,depth],[-half,depth-3]];
|
|
99
|
+
const base=outline.map(([dx,dy])=>project(x+dx,y+dy,z));
|
|
100
|
+
const top=outline.map(([dx,dy])=>project(x+dx,y+dy,z+h));
|
|
101
|
+
const [sx,sy]=project(x,y,z);
|
|
102
|
+
if(shadow)ellipse(c,sx+2,sy+1,half+3,depth*.48,p.shadow);
|
|
103
|
+
for(const i of [7,6,5,4]){
|
|
104
|
+
const j=(i+1)%outline.length;
|
|
105
|
+
poly(c,[top[i],top[j],base[j],base[i]],p.tone(i===5?.56:.41),p.stroke,.65);
|
|
106
|
+
}
|
|
107
|
+
poly(c,top,p.tone(.07),p.tone(.77),.95);
|
|
108
|
+
poly(c,[top[0],top[1],top[2],top[3]],null,p.paper,.85);
|
|
109
|
+
poly(c,[top[7],top[6],top[5],top[4]],null,p.tone(.25),.8);
|
|
110
|
+
const [cx,cy]=project(x,y,z+h);
|
|
111
|
+
c.save();c.transform(1,0,.52,.36,cx,cy);
|
|
112
|
+
ellipse(c,0,0,5,5,p.tone(.22),p.tone(.64),.8);
|
|
113
|
+
ellipse(c,0,0,3.9,3.9,p.ink);
|
|
114
|
+
for(const side of [-1,1]) {
|
|
115
|
+
ellipse(c,side*(half-4),0,1.25,1.25,p.ink);
|
|
116
|
+
}
|
|
117
|
+
c.restore();
|
|
118
|
+
}
|
|
119
|
+
function assembly(c,p,t,running,reduced,layer) {
|
|
120
|
+
const moving=running&&!reduced;
|
|
121
|
+
const q=moving?fract(t/1.53):.93;
|
|
122
|
+
const travel=sweep(q,.02,.37), step=108, pressX=174, lane=48, deck=29;
|
|
123
|
+
const insertion=sweep(q,.56,.63);
|
|
124
|
+
const pressTip=mix(72,40.5,sweep(q,.42,.56))-3*insertion
|
|
125
|
+
+35*sweep(q,.68,.85);
|
|
126
|
+
layer("base",c=>{
|
|
127
|
+
plinth(c,p,11,4,353,82,5);
|
|
128
|
+
for(const x of [51,110,239,305]){
|
|
129
|
+
for(const y of [34,56])block(c,p,x,y,5,8,7,16);
|
|
130
|
+
}
|
|
131
|
+
for(const x of [16,329])beltGuard(c,p,x,27,28,44,5,44,false);
|
|
132
|
+
roller(c,p,23,31,21,121,34);
|
|
133
|
+
roller(c,p,204,31,21,144,34);
|
|
134
|
+
// The lower die and the transfer guides share the conveyor deck height.
|
|
135
|
+
block(c,p,140,31,13,68,34,16);
|
|
136
|
+
for(const y of [31,63])block(c,p,141,y,29,67,2,2);
|
|
137
|
+
block(c,p,145,34,5,59,27,8,{top:p.top,side:p.base,end:p.end});
|
|
138
|
+
|
|
139
|
+
block(c,p,147,10,5,9,13,103);
|
|
140
|
+
block(c,p,192,10,5,9,13,103);
|
|
141
|
+
block(c,p,143,6,5,18,22,6);
|
|
142
|
+
block(c,p,187,6,5,18,22,6);
|
|
143
|
+
block(c,p,146,17,95,55,50,12);
|
|
144
|
+
block(c,p,155,30,107,38,33,12,{top:p.face,side:p.base,end:p.end});
|
|
145
|
+
block(c,p,167,42,69,14,12,26);
|
|
146
|
+
for(const x of [155,193]){
|
|
147
|
+
block(c,p,x,35,72,3,7,23);
|
|
148
|
+
block(c,p,x,53,72,3,7,23);
|
|
149
|
+
}
|
|
150
|
+
poly(c,[project(192,24,111),project(198,24,111),project(202,31,105),
|
|
151
|
+
project(202,45,104)],null,p.tone(.58),2.5);
|
|
152
|
+
const hatch=Array.from({length:6},(_,i)=>151+i*8);
|
|
153
|
+
for(const x of hatch)poly(c,[project(x,67,96),project(x+4,67,104)],null,p.tone(.48),1.1);
|
|
154
|
+
});
|
|
155
|
+
signal(c,p,187,53,119,moving&&q>.42&&q<.69);
|
|
156
|
+
|
|
157
|
+
for(const i of [-1,0,1,2]){
|
|
158
|
+
const x=pressX+(i+travel-1)*step;
|
|
159
|
+
if(x<31||x>343)continue;
|
|
160
|
+
flange(c,p,x,lane,deck,26);
|
|
161
|
+
const lip=i>0?2:i===0?5-3*insertion:5;
|
|
162
|
+
cylinder(c,p,x,lane,deck+6.5,5.5,lip,{top:p.tone(.07),side:p.edge,end:p.edge});
|
|
163
|
+
planeCircle(c,x,lane,deck+6.5+lip,2.7,p.ink);
|
|
164
|
+
}
|
|
165
|
+
block(c,p,171,45,pressTip+3,6,6,78-(pressTip+3));
|
|
166
|
+
block(c,p,164,40,pressTip,20,16,3,{top:p.top,side:p.end,end:p.base});
|
|
167
|
+
layer("guard",c=>{
|
|
168
|
+
for(const x of [16,329])beltGuard(c,p,x,27,28,44,5,44,true);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function sorter(c,p,t,running,reduced,layer) {
|
|
172
|
+
const moving=running&&!reduced, phase=moving?t*1.03:0;
|
|
173
|
+
const pathY=x=>29+39*ease((x-152)/70);
|
|
174
|
+
layer("base",c=>{
|
|
175
|
+
plinth(c,p,16,5,334,84);
|
|
176
|
+
for(const x of [37,138,248,310]){
|
|
177
|
+
for(const y of [17,35])block(c,p,x,y,4,7,6,16);
|
|
178
|
+
}
|
|
179
|
+
for(const x of [224,269,310]){
|
|
180
|
+
for(const y of [56,74])block(c,p,x,y,4,7,6,16);
|
|
181
|
+
}
|
|
182
|
+
for(const [x,y] of [[169,37],[195,54]])block(c,p,x,y,4,7,6,16);
|
|
183
|
+
roller(c,p,23,15,20,309,28);
|
|
184
|
+
// The transfer deck follows the polished guide path.
|
|
185
|
+
const bars=Array.from({length:10},(_,i)=>151+8*i);
|
|
186
|
+
const back=bars.map(x=>project(x,pathY(x)-12,28));
|
|
187
|
+
const front=bars.map(x=>project(x,pathY(x)+12,28));
|
|
188
|
+
const skirt=bars.map(x=>project(x,pathY(x)+12,20));
|
|
189
|
+
poly(c,[...front,...skirt.reverse()],p.side,p.stroke,.85);
|
|
190
|
+
poly(c,[...back,...front.slice().reverse()],p.tone(.21),p.stroke,.85);
|
|
191
|
+
for(const x of bars){
|
|
192
|
+
const y=pathY(x);
|
|
193
|
+
poly(c,[project(x,y-10,28),project(x,y+10,28)],null,p.edge,2);
|
|
194
|
+
poly(c,[project(x+.7,y-10,28),project(x+.7,y+10,28)],null,p.top,.75);
|
|
195
|
+
}
|
|
196
|
+
roller(c,p,211,54,20,121,28);
|
|
197
|
+
block(c,p,118,9,4,6,9,71);
|
|
198
|
+
block(c,p,118,46,4,6,9,71);
|
|
199
|
+
block(c,p,114,10,75,15,45,7);
|
|
200
|
+
block(c,p,119,21,66,8,24,9);
|
|
201
|
+
});
|
|
202
|
+
const idle=[.06,.23,.49,.65,.79,.92];
|
|
203
|
+
const parts=idle.map((rest,i)=>{
|
|
204
|
+
const q=moving?fract(phase+i/6):rest;
|
|
205
|
+
const x=27+297*q;
|
|
206
|
+
const y=i%2?pathY(x):29;
|
|
207
|
+
return {x,y,q};
|
|
208
|
+
});
|
|
209
|
+
const scanned=parts.some(part=>Math.abs(part.x-122)<13);
|
|
210
|
+
const divert=parts.reduce((s,part,i)=>i%2?Math.max(s,
|
|
211
|
+
ease((part.x-143)/13)*ease((206-part.x)/15)):s,0);
|
|
212
|
+
const pivot=project(152,41,38),tip=project(152+29*divert,41-16*divert,38);
|
|
213
|
+
block(c,p,149,38,22,6,6,16);
|
|
214
|
+
beam(c,pivot,tip,4,p.tone(.36));beam(c,pivot,tip,1,p.tone(.77));
|
|
215
|
+
parts.sort((a,b)=>a.y-b.y||a.x-b.x).forEach(({x,y,q})=>{
|
|
216
|
+
c.globalAlpha=moving?Math.min(ease(q/.047),ease((1-q)/.054)):1;
|
|
217
|
+
flange(c,p,x,y,28);
|
|
218
|
+
});
|
|
219
|
+
c.globalAlpha=1;
|
|
220
|
+
signal(c,p,123,33,82,running&&scanned);
|
|
221
|
+
if(moving&&scanned)poly(c,[project(122,18,35),project(122,39,35)],null,p.signal,1.05);
|
|
222
|
+
for(const y of [15,54]){
|
|
223
|
+
block(c,p,324,y+25,20,7,3,13);
|
|
224
|
+
signal(c,p,327,y+26.5,33,moving&&parts.some(part=>part.x>303&&Math.abs(part.y-y-14)<9));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function gantry(c,p,t,running,reduced,layer) {
|
|
228
|
+
const moving=running&&!reduced;
|
|
229
|
+
const q=moving?fract(t/1.53):.01;
|
|
230
|
+
const from=94,to=267,lane=51,deck=29;
|
|
231
|
+
const clear=79,pick=43;
|
|
232
|
+
const carriageX=from+(to-from)*(sweep(q,.34,.60)-sweep(q,.86,1));
|
|
233
|
+
const carriageZ=clear-(clear-pick)*(sweep(q,.025,.18)-sweep(q,.23,.34)
|
|
234
|
+
+sweep(q,.60,.71)-sweep(q,.77,.86));
|
|
235
|
+
const grasp=sweep(q,.18,.23)-sweep(q,.72,.77);
|
|
236
|
+
const held=q>=.23&&q<.72;
|
|
237
|
+
const partZ=carriageZ-(pick-deck), feed=sweep(q,.33,.92), sent=sweep(q,.79,1);
|
|
238
|
+
layer("base",c=>{
|
|
239
|
+
plinth(c,p,11,4,351,84,5);
|
|
240
|
+
for(const x of [54,303]) {
|
|
241
|
+
block(c,p,x-6,9,5,25,24,6);
|
|
242
|
+
block(c,p,x,13,11,13,16,93);
|
|
243
|
+
poly(c,[project(x+1,29,32),project(x+21,29,11),project(x+1,29,11)],p.side,p.stroke,.8);
|
|
244
|
+
}
|
|
245
|
+
for(const x of [45,98,257,312]){
|
|
246
|
+
for(const y of [38,59])block(c,p,x,y,5,8,6,16);
|
|
247
|
+
}
|
|
248
|
+
for(const x of [17,329])beltGuard(c,p,x,32,25,40,5,39,false);
|
|
249
|
+
roller(c,p,27,35,21,93,32);
|
|
250
|
+
roller(c,p,241,35,21,107,32);
|
|
251
|
+
});
|
|
252
|
+
if(held) {
|
|
253
|
+
// The load casts its shadow onto the bed or onto the lower machine base.
|
|
254
|
+
const surface=carriageX<119||carriageX>245?deck:5;
|
|
255
|
+
const [x,y]=project(carriageX,lane,surface);
|
|
256
|
+
ellipse(c,x+2,y,13,3.8,p.shadow);
|
|
257
|
+
}
|
|
258
|
+
if(q<.23)flange(c,p,from,lane,deck,21);
|
|
259
|
+
for(const x of [from-41+41*feed,from-82+41*feed]){
|
|
260
|
+
if(x>=30)flange(c,p,x,lane,deck,21);
|
|
261
|
+
}
|
|
262
|
+
if(q>=.72&&to+91*sent<342)flange(c,p,to+91*sent,lane,deck,21);
|
|
263
|
+
|
|
264
|
+
layer("beam",c=>{
|
|
265
|
+
block(c,p,48,20,100,273,34,13);
|
|
266
|
+
for(const z of [103,109]) {
|
|
267
|
+
poly(c,[project(52,54,z),project(317,54,z)],null,p.tone(.60),1.5);
|
|
268
|
+
}
|
|
269
|
+
for(let x=66;x<316;x+=19){
|
|
270
|
+
const [a,b]=project(x,54,106);
|
|
271
|
+
ellipse(c,a,b,1.3,1.3,p.tone(.68));
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const cable=[project(315,38,116),project(carriageX+20,38,116),
|
|
275
|
+
project(carriageX+14,38,113),project(carriageX+10,38,108)];
|
|
276
|
+
poly(c,cable,null,p.tone(.43),3.4);
|
|
277
|
+
poly(c,cable,null,p.tone(.69),.85);
|
|
278
|
+
block(c,p,carriageX-10,32,90,20,25,19,{top:p.face,side:p.base,end:p.end});
|
|
279
|
+
block(c,p,carriageX-3,47,carriageZ+3,6,8,90-carriageZ-3);
|
|
280
|
+
block(c,p,carriageX-11,44,carriageZ,22,14,4);
|
|
281
|
+
if(held)flange(c,p,carriageX,lane,partZ,21,false);
|
|
282
|
+
for(const sign of [-1,1]){
|
|
283
|
+
const jawX=carriageX+sign*mix(14.5,11.8,grasp);
|
|
284
|
+
block(c,p,jawX-1.3,46,carriageZ-12,2.6,10,12);
|
|
285
|
+
}
|
|
286
|
+
layer("guard",c=>{
|
|
287
|
+
for(const x of [17,329])beltGuard(c,p,x,32,25,40,5,39,true);
|
|
288
|
+
});
|
|
289
|
+
signal(c,p,306,39,113,held&&moving);
|
|
290
|
+
}
|
|
291
|
+
function rotary(c,p,t,running,reduced,layer) {
|
|
292
|
+
const moving=running&&!reduced;
|
|
293
|
+
const phase=moving?t/1.04:.32;
|
|
294
|
+
const u=fract(phase), stationAngle=Math.PI/3;
|
|
295
|
+
const angle=(Math.floor(phase)+sweep(u,.015,.29))*stationAngle;
|
|
296
|
+
const centerX=180,centerY=53,orbit=53,tableTop=33;
|
|
297
|
+
const position=a=>[centerX+orbit*Math.cos(a),centerY+orbit*Math.sin(a)];
|
|
298
|
+
const heads=[4,5].map(i=>position(i*stationAngle));
|
|
299
|
+
layer("base",c=>{
|
|
300
|
+
plinth(c,p,76,-40,213,171,5);
|
|
301
|
+
for(const [x,y] of heads){
|
|
302
|
+
block(c,p,x-14,y-46,5,28,18,6);
|
|
303
|
+
block(c,p,x-9,y-41,11,18,12,84);
|
|
304
|
+
block(c,p,x-11,y-41,83,22,51,11);
|
|
305
|
+
poly(c,[project(x+7,y-41,90),project(x+12,y-41,100),
|
|
306
|
+
project(x+12,y+4,100),project(x+9,y+8,93)],null,p.tone(.55),2);
|
|
307
|
+
}
|
|
308
|
+
cylinder(c,p,centerX,centerY,5,44,14,{top:p.top,side:p.base,end:p.base});
|
|
309
|
+
cylinder(c,p,centerX,centerY,19,74,14,{top:p.tone(.14),side:p.end,end:p.end});
|
|
310
|
+
planeCircle(c,centerX,centerY,tableTop,67,null,p.tone(.45),.8);
|
|
311
|
+
});
|
|
312
|
+
// Each workpiece and its fixture share the same angle and height.
|
|
313
|
+
const sockets=Array.from({length:6},(_,i)=>position(angle+i*stationAngle));
|
|
314
|
+
sockets.sort((a,b)=>a[1]-b[1]);
|
|
315
|
+
for(const [x,y] of sockets){
|
|
316
|
+
cylinder(c,p,x,y,tableTop,14,4,{top:p.tone(.27),side:p.end,end:p.end});
|
|
317
|
+
cylinder(c,p,x,y,tableTop+4,10,6,{top:p.tone(.07),side:p.edge,end:p.edge});
|
|
318
|
+
planeCircle(c,x,y,tableTop+10,6.6,p.tone(.25),p.tone(.54),.65);
|
|
319
|
+
planeCircle(c,x,y,tableTop+10,4.7,p.ink);
|
|
320
|
+
}
|
|
321
|
+
cylinder(c,p,centerX,centerY,tableTop,15,5,{top:p.top,side:p.edge,end:p.edge});
|
|
322
|
+
const indicator=angle+Math.PI*.14;
|
|
323
|
+
for(const [lo,hi] of [[17,41],[65,72]]){
|
|
324
|
+
const at=r=>project(centerX+r*Math.cos(indicator),centerY+r*Math.sin(indicator),tableTop+.1);
|
|
325
|
+
poly(c,[at(lo),at(hi)],null,p.stroke,1.1);
|
|
326
|
+
}
|
|
327
|
+
heads.forEach(([x,y],i)=>{
|
|
328
|
+
const offset=i*.07;
|
|
329
|
+
const stroke=sweep(u,.39+offset,.54+offset)-sweep(u,.67+offset,.82+offset);
|
|
330
|
+
const tip=mix(65,tableTop+10,stroke);
|
|
331
|
+
block(c,p,x-6,y-6,67,12,12,18,{top:p.face,side:p.base,end:p.end});
|
|
332
|
+
cylinder(c,p,x,y,tip+3,2.5,69-tip,{top:p.face,side:p.edge,end:p.edge});
|
|
333
|
+
cylinder(c,p,x,y,tip,6,3,{top:p.top,side:p.end,end:p.end});
|
|
334
|
+
signal(c,p,x+5,y+5,85,moving&&stroke>.85);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
const scenes={assembly,sorter,gantry,rotary};
|
|
338
|
+
globalThis.ccdxToolMachines = context => {
|
|
339
|
+
const layers = new Map();
|
|
340
|
+
let identity, colors;
|
|
341
|
+
return (style, { time, running, reduced, width, height, dpr, ink, surface }) => {
|
|
342
|
+
const scale = Math.min(width / 420, height / 202);
|
|
343
|
+
const transform = [scale * dpr, 0, 0, scale * dpr, (width - 420 * scale) * dpr / 2, (height - 202 * scale) * dpr / 2];
|
|
344
|
+
const next = [style, width, height, dpr, ink, surface].join("|");
|
|
345
|
+
if (identity !== next) {
|
|
346
|
+
identity = next;layers.clear();colors = palette(ink, surface);
|
|
347
|
+
}
|
|
348
|
+
context.setTransform(...transform);
|
|
349
|
+
const layer = (key, paint) => {
|
|
350
|
+
let bitmap = layers.get(key);
|
|
351
|
+
if (!bitmap) {
|
|
352
|
+
bitmap = document.createElement("canvas");
|
|
353
|
+
bitmap.width = context.canvas.width;bitmap.height = context.canvas.height;
|
|
354
|
+
const buffer = bitmap.getContext("2d");buffer.setTransform(...transform);paint(buffer);
|
|
355
|
+
layers.set(key, bitmap);
|
|
356
|
+
}
|
|
357
|
+
context.save();context.setTransform(1, 0, 0, 1, 0, 0);context.drawImage(bitmap, 0, 0);context.restore();
|
|
358
|
+
};
|
|
359
|
+
scenes[style](context, colors, time, running, reduced, layer);
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
})();
|