codex-copilot-dx 1.4.12 → 1.4.14
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/docs/ARCHITECTURE.md +8 -0
- package/docs/REFERENCE.md +17 -15
- package/package.json +1 -1
- package/src/access-settings.mjs +1 -0
- package/src/adapter.mjs +2 -0
- package/src/antigravity-bindings.mjs +83 -0
- package/src/antigravity-chat-bridge.mjs +38 -8
- package/src/antigravity-handler.mjs +70 -37
- package/src/antigravity-runtime.mjs +44 -35
- package/src/cli-command-spec.mjs +1 -1
- package/src/cli-management-app.mjs +169 -0
- package/src/cli-management.mjs +7 -164
- package/src/connection-management.mjs +2 -0
- package/src/connection-routing.mjs +14 -5
- package/src/context-compaction-wire.mjs +6 -6
- package/src/dashboard/connections.js +13 -3
- package/src/dashboard/features.js +2 -2
- package/src/dashboard/index.html +41 -37
- package/src/dashboard/language.js +32 -17
- package/src/dashboard/status.js +20 -28
- 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 +24 -3
- package/src/dashboard/ui.js +14 -0
- package/src/dashboard/usage.js +9 -1
- package/src/dashboard.mjs +1 -0
- package/src/local-privacy.mjs +3 -3
- package/src/management-routes.mjs +3 -3
- package/src/observability.mjs +9 -4
- package/src/privacy-transform.mjs +21 -6
- package/src/response-failures.mjs +7 -3
- package/src/safe-upstream-error.mjs +2 -2
- package/src/status-summary.mjs +13 -0
- package/src/stream-performance.mjs +1 -1
- package/src/terminal-state.mjs +8 -2
|
@@ -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
|
+
})();
|
|
@@ -1,14 +1,16 @@
|
|
|
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(["
|
|
4
|
+
const styles = new Set(["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: "assembly"
|
|
8
|
+
const state = { scene: "idle", style: "assembly" };
|
|
9
|
+
const drawMachine = ctx && globalThis.ccdxToolMachines(ctx);
|
|
9
10
|
try { const saved = localStorage.getItem(storageKey);if (styles.has(saved)) state.style = saved; } catch {}
|
|
10
11
|
const motion = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)") || { matches: false, addEventListener() {} };
|
|
11
12
|
let records = [], fresh = false, supported = false, visible = true, raf = 0, last = 0, start = performance.now(), expiry = null;
|
|
13
|
+
let drawnTime = null;
|
|
12
14
|
let signature = "", box = { width: 0, height: 0 }, color = "", surface = "", omitted = 0, requests = [], requestDeadline = 0;
|
|
13
15
|
const animating = () => ["calling", "parallel", "waiting", "processing", "responding"].includes(state.scene);
|
|
14
16
|
const shown = () => document.visibilityState === "visible" && !root.closest("[hidden]") && visible;
|
|
@@ -18,120 +20,27 @@
|
|
|
18
20
|
color = theme.getPropertyValue("--accent").trim();surface = theme.getPropertyValue("--surface").trim();
|
|
19
21
|
refreshAnimation();
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const workX=returned?132+91*travel(Math.min(1,t/.85)):
|
|
30
|
-
phase<.34?29+103*travel(phase/.34):phase<.66?132:132+91*travel((phase-.66)/.34);
|
|
31
|
-
const shift=running||returned?(workX-29)%14:0;
|
|
32
|
-
const assembled=returned||phase>=.5;
|
|
33
|
-
function path(points,closed=false){
|
|
34
|
-
ctx.beginPath();ctx.moveTo(points[0],points[1]);
|
|
35
|
-
for(let i=2;i<points.length;i+=2)ctx.lineTo(points[i],points[i+1]);
|
|
36
|
-
if(closed)ctx.closePath();
|
|
37
|
-
}
|
|
38
|
-
// Floor, braced stands and the rear uprights of the press.
|
|
39
|
-
ctx.lineWidth=1.2;ctx.globalAlpha=.22;
|
|
40
|
-
path([18,108,246,108]);ctx.stroke();
|
|
41
|
-
ctx.globalAlpha=.52;
|
|
42
|
-
path([35,88,35,108,55,108,55,88,35,106,55,90]);ctx.stroke();
|
|
43
|
-
path([209,88,209,108,229,108,229,88,209,106,229,90]);ctx.stroke();
|
|
44
|
-
ctx.fillRect(99,22,5,45);ctx.fillRect(160,22,5,45);
|
|
45
|
-
ctx.strokeRect(93,11,78,13);
|
|
46
|
-
ctx.globalAlpha=.23;
|
|
47
|
-
ctx.fillRect(93,11,78,13);
|
|
48
|
-
ctx.globalAlpha=.65;
|
|
49
|
-
ctx.beginPath();
|
|
50
|
-
for(let i=98;i<168;i+=8){ctx.moveTo(i,21);ctx.lineTo(i+4,14);}
|
|
51
|
-
ctx.stroke();
|
|
52
|
-
// Belt deck and rollers, with the drive drums in the front housing.
|
|
53
|
-
ctx.globalAlpha=.18;path([13,77,239,77,252,65,26,65],true);ctx.fill();
|
|
54
|
-
ctx.globalAlpha=.64;ctx.stroke();
|
|
55
|
-
ctx.beginPath();
|
|
56
|
-
for(let i=30;i<235;i+=14){ctx.moveTo(i+shift,75);ctx.lineTo(i+shift+9,67);}
|
|
57
|
-
ctx.stroke();
|
|
58
|
-
ctx.globalAlpha=.16;ctx.fillRect(13,77,226,13);
|
|
59
|
-
ctx.globalAlpha=.72;ctx.strokeRect(13,77,226,13);
|
|
60
|
-
for(const x of [22,230]){ctx.beginPath();ctx.arc(x,83.5,3.8,0,Math.PI*2);ctx.stroke();}
|
|
61
|
-
// Cylinder, piston and platen travel together.
|
|
62
|
-
const piston=press*9;
|
|
63
|
-
ctx.globalAlpha=.82;ctx.strokeRect(123,24,18,13);ctx.fillRect(130,37,4,5+piston);
|
|
64
|
-
ctx.fillRect(120,42+piston,24,3);
|
|
65
|
-
if(running||returned){
|
|
66
|
-
const x=workX-11,y=assembled?57:60;
|
|
67
|
-
ctx.globalAlpha=1;ctx.fillStyle=surface;
|
|
68
|
-
path([x,75,x,y,x+6,y-5,x+27,y-5,x+27,70,x+21,75],true);ctx.fill();
|
|
69
|
-
ctx.fillStyle=color;ctx.globalAlpha=.24;ctx.fill();
|
|
70
|
-
ctx.globalAlpha=.86;ctx.stroke();
|
|
71
|
-
path([x,y,x+21,y,x+27,y-5]);ctx.stroke();
|
|
72
|
-
path([x+21,y,x+21,75]);ctx.stroke();
|
|
73
|
-
if(assembled){ctx.globalAlpha=.62;ctx.fillRect(x+6,y+5,9,3);}
|
|
74
|
-
}
|
|
75
|
-
ctx.globalAlpha=1;
|
|
23
|
+
function draw(now = performance.now()) {
|
|
24
|
+
if (!drawMachine || !box.width || !box.height) return;
|
|
25
|
+
const dpr = Math.min(devicePixelRatio || 1, 1.5), width = box.width, height = box.height;
|
|
26
|
+
const w = Math.round(width * dpr), h = Math.round(height * dpr);
|
|
27
|
+
if (canvas.width !== w || canvas.height !== h) { canvas.width = w;canvas.height = h; }
|
|
28
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);ctx.clearRect(0, 0, w, h);
|
|
29
|
+
if (animating() && !motion.matches) drawnTime = (now - start) / 1000;
|
|
30
|
+
drawMachine(state.style, { time: drawnTime ?? 0, running: drawnTime !== null, reduced: motion.matches, width, height, dpr, ink: color, surface });
|
|
76
31
|
}
|
|
77
|
-
function draw(now=performance.now()){
|
|
78
|
-
if(!ctx||!box.width||!box.height)return;
|
|
79
|
-
const dpr=Math.min(devicePixelRatio||1,1.5),w=box.width,h=box.height;
|
|
80
|
-
if(canvas.width!==Math.round(w*dpr)||canvas.height!==Math.round(h*dpr)){canvas.width=Math.round(w*dpr);canvas.height=Math.round(h*dpr);}
|
|
81
|
-
ctx.setTransform(dpr,0,0,dpr,0,0);ctx.clearRect(0,0,w,h);
|
|
82
|
-
const cx=w/2,cy=h/2,r=Math.min(w,h)*.31;
|
|
83
|
-
const reduced=motion.matches||state.reduce,t=reduced?0:(now-start)/1000,active=['calling','parallel','processing','responding'].includes(state.scene),waiting=state.scene==='waiting',returned=state.scene==='returned';
|
|
84
|
-
const quiet=!active&&!waiting&&!returned,power=quiet?.12:waiting?.5:returned?.5:state.intensity;
|
|
85
|
-
ctx.strokeStyle=color;ctx.fillStyle=color;ctx.lineWidth=.8;
|
|
86
|
-
function arc(radius,a,b,alpha){ctx.globalAlpha=alpha;ctx.beginPath();ctx.arc(cx,cy,radius,a,b);ctx.stroke();}
|
|
87
|
-
if(state.style==='grid'){
|
|
88
|
-
const cols=12,rows=3,gap=5,size=Math.min(13,(w-32)/cols-gap),left=cx-(cols*size+(cols-1)*gap)/2,top=cy-(rows*size+(rows-1)*gap)/2;
|
|
89
|
-
const head=active||waiting?(t*(waiting?11:19))%(cols*rows):-8;
|
|
90
|
-
for(let row=0;row<rows;row++)for(let col=0;col<cols;col++){
|
|
91
|
-
const index=row*cols+(row%2?cols-col-1:col),distance=(head-index+cols*rows)%(cols*rows),wave=Math.max(0,1-distance/8);
|
|
92
|
-
ctx.globalAlpha=quiet?.1:returned?.16+Math.max(0,1-(now-start)/900)*.42:.1+wave*power;
|
|
93
|
-
ctx.fillRect(left+col*(size+gap),top+row*(size+gap),size,size);
|
|
94
|
-
}
|
|
95
|
-
ctx.globalAlpha=1;return;
|
|
96
|
-
}
|
|
97
|
-
if(state.style==='assembly'){
|
|
98
|
-
drawAssembly(dpr,w,h,t,active,waiting,returned,reduced);return;
|
|
99
|
-
}
|
|
100
|
-
arc(r,0,Math.PI*2,.25);arc(r*.85,0,Math.PI*2,.13);arc(r*1.12,0,Math.PI*2,.1);
|
|
101
|
-
const spin=active?t*1.6:waiting?t*.9:0;
|
|
102
|
-
if(state.style==='halo'){
|
|
103
|
-
for(let i=0;i<64;i++){
|
|
104
|
-
const a=i/64*Math.PI*2+spin,pulse=active||waiting?(Math.sin(t*7+i*.7)*.5+.5):returned?.6:.05;
|
|
105
|
-
const length=3+(i%4===0?8:3)+pulse*(active?20:waiting?9:2)*state.intensity;
|
|
106
|
-
ctx.globalAlpha=(.16+pulse*.55)*power;ctx.lineWidth=i%8===0?1.4:.75;
|
|
107
|
-
ctx.beginPath();ctx.moveTo(cx+Math.cos(a)*r*1.17,cy+Math.sin(a)*r*1.17);ctx.lineTo(cx+Math.cos(a)*(r*1.17+length),cy+Math.sin(a)*(r*1.17+length));ctx.stroke();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if(state.style==='halo'){
|
|
111
|
-
ctx.lineWidth=.65;const strands=28;
|
|
112
|
-
for(let i=0;i<strands;i++){
|
|
113
|
-
const a=i/strands*Math.PI*2+spin*.6,b=a+2.35+Math.sin(i*.68+t*1.7)*.48,inner=r*.68;
|
|
114
|
-
ctx.globalAlpha=(.1+power*.2)*(quiet?.45:1);ctx.beginPath();ctx.moveTo(cx+Math.cos(a)*inner,cy+Math.sin(a)*inner);ctx.quadraticCurveTo(cx+Math.sin(t*1.3+i)*r*.35,cy+Math.cos(i*.5+t*.7)*r*.3,cx+Math.cos(b)*inner,cy+Math.sin(b)*inner);ctx.stroke();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
for(let i=0;i<3;i++){
|
|
118
|
-
const a=spin*(i%2?-1:1)+i*2.08,track=r*(.89+i*.06);
|
|
119
|
-
ctx.lineWidth=1.3;arc(track,a,a+(active?1.25:waiting?.75:.18),quiet?.15:.75);
|
|
120
|
-
}
|
|
121
|
-
if(active||waiting){for(let i=0;i<3;i++){const q=(t*.85+i/3)%1;arc(r*(.55+q*.5),0,Math.PI*2,(1-q)*.12*power);}}
|
|
122
|
-
if(returned&&!reduced){const q=Math.min((now-start)/850,1);arc(r*(1+q*.32),0,Math.PI*2,(1-q)*.5);}
|
|
123
|
-
ctx.globalAlpha=1;
|
|
124
|
-
}
|
|
125
32
|
|
|
126
33
|
function animate(now) {
|
|
127
34
|
raf = 0;
|
|
128
|
-
if (!shown() || motion.matches || state.style === "off" || !animating()
|
|
129
|
-
if (now - last >= 1000 / 30) { last = now;draw(now); }
|
|
35
|
+
if (!shown() || motion.matches || state.style === "off" || !animating()) return;
|
|
36
|
+
if (now - last >= 1000 / 30) { last = now;draw(now); }
|
|
37
|
+
raf = requestAnimationFrame(animate);
|
|
130
38
|
}
|
|
131
39
|
function refreshAnimation() {
|
|
132
|
-
cancelAnimationFrame(raf);raf = 0;
|
|
40
|
+
cancelAnimationFrame(raf);raf = 0;
|
|
41
|
+
root.dataset.paused = String(!shown() || motion.matches || !animating() || state.style === "off");
|
|
133
42
|
if (!shown() || state.style === "off") return;
|
|
134
|
-
draw();if (!motion.matches &&
|
|
43
|
+
draw();if (!motion.matches && animating()) raf = requestAnimationFrame(animate);
|
|
135
44
|
}
|
|
136
45
|
function category(name) {
|
|
137
46
|
const value = String(name || "").toLowerCase().split(/__|\./).at(-1);
|
|
@@ -163,7 +72,8 @@
|
|
|
163
72
|
const scene = !fresh ? "idle" : active.length ? preparing ? active.length > 1 ? "parallel" : "calling" : "waiting"
|
|
164
73
|
: agents.length ? responding ? "responding" : "processing"
|
|
165
74
|
: rows.some(row => row.state === "returned") && !rows.some(row => ["failed", "cancelled", "unknown"].includes(row.state)) ? "returned" : "idle";
|
|
166
|
-
|
|
75
|
+
const wasAnimating = animating();state.scene = scene;
|
|
76
|
+
if (animating() && !wasAnimating) { start = performance.now();drawnTime = null; }
|
|
167
77
|
const key = !supported || !fresh ? "flow_status_unknown" : active.length ? preparing ? active.length > 1 ? "tool_preparing_many" : "tool_preparing" : "tool_waiting"
|
|
168
78
|
: agents.length ? agents.length > 1 ? "tool_requests_many" : responding ? "tool_responding" : "tool_processing"
|
|
169
79
|
: rows.some(row => row.state === "failed") ? "tool_failed" : rows.some(row => row.state === "cancelled") ? "tool_cancelled"
|
|
@@ -189,11 +99,10 @@
|
|
|
189
99
|
el("tool-details").hidden = !rows.length;
|
|
190
100
|
el("tool-technical").replaceChildren();
|
|
191
101
|
for (const row of rows) {
|
|
192
|
-
const line = document.createElement("
|
|
193
|
-
for (const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
term.textContent = phrase(label);detail.textContent = value;line.append(term, detail);
|
|
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);
|
|
197
106
|
}
|
|
198
107
|
el("tool-technical").append(line);
|
|
199
108
|
}
|
package/src/dashboard/tools.js
CHANGED
|
@@ -132,9 +132,9 @@
|
|
|
132
132
|
el("github-check").addEventListener("click", () => void accountAction({ action: "check" }));
|
|
133
133
|
el("github-cancel").addEventListener("click", () => { if (account?.operation) void accountAction({ action: "cancel", id: account.operation.id }); });
|
|
134
134
|
el("github-copy-code").addEventListener("click", () => void copyCode());
|
|
135
|
-
el("github-authorize").addEventListener("click", event => { if (pending || !userCode())
|
|
135
|
+
el("github-authorize").addEventListener("click", event => { if (pending || !userCode()) event.preventDefault(); });
|
|
136
136
|
window.addEventListener("pagehide", finishCodeCopy);
|
|
137
|
-
el("github-logout").addEventListener("click", () => { if (
|
|
137
|
+
el("github-logout").addEventListener("click", async () => { if (await globalThis.ccdxConfirmAction("tools_logout", "tools_logout_confirm")) void accountAction({ action: "logout", confirmed: true }); });
|
|
138
138
|
async function loadAccount() { const generation = accountGeneration;try { const data = await api("account");if (generation === accountGeneration && !pending) renderAccount(data); } catch { if (generation === accountGeneration) text("github-account-note", "tools_read_failed"); } }
|
|
139
139
|
function renderChecks(data) {
|
|
140
140
|
if (Object.hasOwn(data, "client_versions")) globalThis.ccdxClientVersions?.render(data.client_versions);
|
|
@@ -184,10 +184,9 @@
|
|
|
184
184
|
for (const [id, action] of [["check-local", "check"], ["check-network", "network"], ["export-report", "report"], ["preview-config-repair", "preview"]]) {
|
|
185
185
|
el(id).addEventListener("click", () => void localAction({ action }, el(id)));
|
|
186
186
|
}
|
|
187
|
-
el("check-compatibility")?.addEventListener("click", () => { if (
|
|
187
|
+
el("check-compatibility")?.addEventListener("click", async () => { if (await globalThis.ccdxConfirmAction("compatibility_test", "compatibility_scope")) void localAction({ action: "compatibility", confirmed: true }, el("check-compatibility")); });
|
|
188
188
|
el("apply-config-repair").addEventListener("click", () => { if (repairPreview) void localAction({ action: "repair", revision: repairPreview.revision }, el("apply-config-repair")); });
|
|
189
189
|
el("cancel-config-repair").addEventListener("click", () => { repairPreview = null;el("config-repair-preview").hidden = true; });
|
|
190
|
-
el("check-account-link").addEventListener("click", () => { chooseProvider("github");location.hash = "models"; });
|
|
191
190
|
async function navigate() {
|
|
192
191
|
syncSource();
|
|
193
192
|
if (location.hash === "#models") await loadAccount();
|
package/src/dashboard/ui.css
CHANGED
|
@@ -489,7 +489,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
489
489
|
.checks-table th:first-child { width:23%; }
|
|
490
490
|
.checks-table th:nth-child(2) { width:21%; }
|
|
491
491
|
.checks-table details p { margin:8px 0; }
|
|
492
|
-
@media(max-width:640px) { .account-fields { grid-template-columns:100px minmax(0,1fr); gap:10px; }
|
|
492
|
+
@media(max-width:640px) { .account-fields { grid-template-columns:100px minmax(0,1fr); gap:10px; } }
|
|
493
493
|
|
|
494
494
|
.account-summary { margin: 20px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
|
|
495
495
|
.account-summary div { min-width: 0; }
|
|
@@ -666,7 +666,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
666
666
|
.context-tabs { display:flex;gap:8px;margin-bottom:18px; }
|
|
667
667
|
.context-tabs button { min-width:80px;text-align:center; }
|
|
668
668
|
.context-tabs button[aria-selected="true"], .context-session[aria-pressed="true"] { color:var(--surface);background:var(--accent);border-color:var(--accent); }
|
|
669
|
-
.context-sessions { table-layout:fixed;
|
|
669
|
+
.context-sessions { table-layout:fixed; }
|
|
670
670
|
.context-sessions th:first-child { width:27%; }
|
|
671
671
|
.context-sessions th:nth-child(2) { width:23%; }
|
|
672
672
|
.context-sessions th:nth-child(3) { width:32%; }
|
|
@@ -697,7 +697,6 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
697
697
|
.tool-visual,.tool-content { min-width:0; }
|
|
698
698
|
.tool-orbit { width:100%;height:190px;position:relative; }
|
|
699
699
|
.tool-orbit canvas { display:block;width:100%;height:100%; }
|
|
700
|
-
.tool-stage[data-style="grid"] .tool-orbit { max-height:140px; }
|
|
701
700
|
.tool-stage[data-style="off"] { grid-template-columns:1fr;min-height:110px; }
|
|
702
701
|
.tool-stage[data-style="off"] .tool-orbit { display:none; }
|
|
703
702
|
.tool-stage[data-style="off"] .tool-narration { text-align:left; }
|
|
@@ -743,3 +742,25 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
743
742
|
[data-view="system"] .setting-row { gap: 10px; padding-block: 8px; }
|
|
744
743
|
[data-view="overview"] .card { min-height: 0; padding-block: 12px; }
|
|
745
744
|
[data-view="overview"] .card strong { margin-top: 6px; }
|
|
745
|
+
|
|
746
|
+
/* Fit long identifiers without widening the dashboard. */
|
|
747
|
+
.dense-table { table-layout: fixed; }
|
|
748
|
+
.dense-table :is(th,td) { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
|
|
749
|
+
.usage-table th:first-child { width: 26%; }
|
|
750
|
+
.failure-table th:last-child { width: 38%; }
|
|
751
|
+
.failure-table td :is(dt,dd) { overflow-wrap: anywhere; }
|
|
752
|
+
.failure-table details > :is(dl,p) { contain: none; }
|
|
753
|
+
.failure-table .failure-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
|
|
754
|
+
.usage-row-details { display: none; margin-block-start: 4px; }
|
|
755
|
+
.usage-row-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; margin: 6px 0; }
|
|
756
|
+
.usage-row-stats dt { color: var(--muted); }
|
|
757
|
+
.usage-row-stats dd { margin: 0; }
|
|
758
|
+
@media (max-width: 700px) {
|
|
759
|
+
.usage-table :is(th,td):not(:first-child):not(:nth-child(7)):not([colspan]) { display: none; }
|
|
760
|
+
.usage-table th:first-child { width: 70%; }
|
|
761
|
+
.usage-row-details { display: block; }
|
|
762
|
+
.recent-requests-table :is(th,td):is(:nth-child(1),:nth-child(2),:nth-child(5)):not([colspan]) { display: none; }
|
|
763
|
+
.recent-requests-table th:nth-child(3) { width: 40%; }
|
|
764
|
+
.failure-table th:last-child { width: 40%; }
|
|
765
|
+
}
|
|
766
|
+
#action-confirm-apply { background:var(--accent); color:var(--page); border-color:var(--accent); }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
const element = (id) => document.getElementById(id);
|
|
2
|
+
globalThis.ccdxConfirmAction = (title, detail) => {
|
|
3
|
+
const dialog = element("action-confirm");
|
|
4
|
+
if (!dialog?.showModal) return Promise.resolve(window.confirm(globalThis.ccdxLanguage?.format(detail) || english(detail)));
|
|
5
|
+
if (dialog.open) return Promise.resolve(false);
|
|
6
|
+
localize(element("action-confirm-title"), title);
|
|
7
|
+
localize(element("action-confirm-detail"), detail);
|
|
8
|
+
localize(element("action-confirm-apply"), title);
|
|
9
|
+
dialog.returnValue = "";
|
|
10
|
+
return new Promise(resolve => {
|
|
11
|
+
dialog.addEventListener("close", () => resolve(dialog.returnValue === "confirm"), { once: true });
|
|
12
|
+
dialog.showModal();
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
2
16
|
const phrase = (key, values = {}) => ({ key, values });
|
|
3
17
|
const english = (key, values = {}) => String(key).replace(/\{(\w+)\}/g, (match, name) => {
|
|
4
18
|
if (!Object.hasOwn(values, name)) return match;
|
package/src/dashboard/usage.js
CHANGED
|
@@ -112,7 +112,15 @@
|
|
|
112
112
|
body.replaceChildren();
|
|
113
113
|
if (total.requests > 0) {
|
|
114
114
|
for (const [index, row] of [total, ...rows].entries()) {
|
|
115
|
-
const
|
|
115
|
+
const values = usageValues(row), entry = tableRow(values, { total: index === 0 });
|
|
116
|
+
const mobile = document.createElement("details"), summary = document.createElement("summary"), stats = document.createElement("dl");
|
|
117
|
+
mobile.className = "usage-row-details";stats.className = "usage-row-stats";
|
|
118
|
+
localize(summary, "tools_details");
|
|
119
|
+
for (const [column, key] of [[1, "usage_records"], [2, "input"], [3, "cache_read"], [4, "cache_write"], [5, "output"], [7, "cache_hit"]]) {
|
|
120
|
+
const field = document.createElement("div"), name = document.createElement("dt"), value = document.createElement("dd");
|
|
121
|
+
localize(name, key);value.textContent = values[column];field.append(name, value);stats.append(field);
|
|
122
|
+
}
|
|
123
|
+
mobile.append(summary, stats);entry.children[0].append(mobile);
|
|
116
124
|
localize(entry.children[7], "usage_cache_coverage", { known: number(row.cache_hit_known_requests), unknown: number(row.cache_hit_unknown_requests) }, "title");body.append(entry);
|
|
117
125
|
}
|
|
118
126
|
} else { emptyTable("usage-body", 8, usageData.filters ? "usage_empty_selection" : "no_usage_records"); }
|