codex-copilot-dx 1.4.22 → 1.4.24

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.
@@ -4,12 +4,13 @@ import path from "node:path";
4
4
  import { atomicWriteFile } from "./atomic-file.mjs";
5
5
  import { readBoundedFile } from "./bounded-file.mjs";
6
6
  import { userSettingsPath } from "./user-settings.mjs";
7
+ import { macAntigravityBundles } from "./macos-antigravity-app.mjs";
7
8
 
8
9
  const MAX_METADATA_BYTES = 64 * 1024;
9
- const MAX_APPS = 9;
10
+ const MAX_APPS = 12;
10
11
  export const clientVersionName = client => ({ codex: "Codex App", claude: "Claude App", antigravity: "Antigravity" })[client] || client;
11
12
  const validId = value => /^(?:codex|claude)_(?:system|user|windows)_(?:chatgpt|codex|claude)$/.test(value)
12
- || /^antigravity_(?:system|user)_gemini$/.test(value);
13
+ || /^antigravity_(?:system|user)_(?:gemini|antigravity)$/.test(value) || value === "antigravity_windows_antigravity";
13
14
  const validVersion = value => typeof value === "string" && /^[0-9][0-9A-Za-z.+_-]{0,63}$/.test(value);
14
15
  const optionalVersion = value => value == null || validVersion(value);
15
16
  const validDate = value => value == null || typeof value === "string" && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(value);
@@ -33,9 +34,14 @@ async function stableRead(file) {
33
34
 
34
35
  async function macBundle(root, scope, name, client) {
35
36
  const bundle = path.join(root, name), infoPath = path.join(bundle, "Contents", "Info.plist"), info = await stableRead(infoPath), plist = info.data;
36
- const expected = client === "codex" ? "com.openai.codex" : client === "claude" ? "com.anthropic.claudefordesktop" : "com.google.GeminiMacOS";
37
+ const antigravity = client === "antigravity" ? macAntigravityBundles[name] : null;
38
+ const expected = antigravity?.identifier ?? (client === "codex" ? "com.openai.codex" : "com.anthropic.claudefordesktop");
37
39
  const version = tag(plist, "CFBundleShortVersionString"), build = tag(plist, "CFBundleVersion");
38
40
  if (tag(plist, "CFBundleIdentifier") !== expected || !validVersion(version) || !optionalVersion(build)) return null;
41
+ if (name === "Antigravity.app") {
42
+ if (tag(plist, "CFBundleExecutable") !== antigravity.executable) return null;
43
+ await fs.access(path.join(bundle, antigravity.helper));
44
+ }
39
45
  let cliVersion = null;
40
46
  if (client === "codex") try {
41
47
  const metadata = JSON.parse((await stableRead(path.join(bundle, "Contents", "Resources", "codex-cli", "codex-package.json"))).data);
@@ -46,18 +52,23 @@ async function macBundle(root, scope, name, client) {
46
52
  }
47
53
 
48
54
  export async function inspectInstalledClientVersions({ home = os.homedir(), env = process.env, platform = process.platform,
49
- systemApplications = "/Applications", windowsCodexVersion } = {}) {
55
+ systemApplications = "/Applications", windowsCodexVersion, windowsAntigravityVersion } = {}) {
50
56
  if (platform === "darwin") {
51
57
  const roots = [["system", systemApplications], ["user", path.join(home, "Applications")]], jobs = [];
52
- for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"], ["Gemini.app", "antigravity"]]) {
58
+ for (const [scope, root] of roots) for (const [name, client] of [["ChatGPT.app", "codex"], ["Codex.app", "codex"], ["Claude.app", "claude"],
59
+ ...Object.keys(macAntigravityBundles).map(name => [name, "antigravity"])]) {
53
60
  jobs.push(macBundle(root, scope, name, client).catch(() => null));
54
61
  }
55
62
  return (await Promise.all(jobs)).filter(Boolean);
56
63
  }
57
64
  if (platform === "win32") {
58
65
  const inspect = windowsCodexVersion || (await import("./native-prediction-windows.mjs")).inspectWindowsCodexVersion;
59
- const version = await inspect({ env }).catch(() => null);
60
- return validVersion(version) ? [{ id: "codex_windows_codex", name: "Codex", client: "codex", scope: "windows", version, build: null, cli_version: null }] : [];
66
+ const antigravity = windowsAntigravityVersion || (await import("./windows-antigravity-app.mjs")).inspectWindowsAntigravity;
67
+ const [version, app] = await Promise.all([inspect({ env }).catch(() => null), antigravity({ env }).catch(() => null)]);
68
+ return [
69
+ ...(validVersion(version) ? [{ id: "codex_windows_codex", name: "Codex", client: "codex", scope: "windows", version, build: null, cli_version: null }] : []),
70
+ ...(validVersion(app?.version) ? [{ id: "antigravity_windows_antigravity", name: "Antigravity", client: "antigravity", scope: "windows", version: app.version, build: null, cli_version: null }] : []),
71
+ ];
61
72
  }
62
73
  return [];
63
74
  }
@@ -0,0 +1,36 @@
1
+ (() => {
2
+ const routeNeedsEditor = () => ["#models", "#codex", "#claude"].includes(location.hash);
3
+ const asset = new URL(document.currentScript.src);
4
+ asset.pathname = "/connections.js";
5
+ let pending, latestMemory;
6
+ const bootstrap = {
7
+ load() {
8
+ if (!routeNeedsEditor() || pending) return pending;
9
+ pending = new Promise(resolve => {
10
+ const script = document.createElement("script");
11
+ script.src = asset.href;
12
+ script.addEventListener("load", () => {
13
+ const feature = globalThis.ccdxConnections;
14
+ if (feature === bootstrap) {
15
+ pending = null;
16
+ script.remove();
17
+ resolve();
18
+ return;
19
+ }
20
+ Promise.resolve(feature.ready).then(() => feature.updateMemory(latestMemory)).finally(resolve);
21
+ }, { once: true });
22
+ script.addEventListener("error", () => {
23
+ pending = null;
24
+ script.remove();
25
+ resolve();
26
+ }, { once: true });
27
+ document.head.append(script);
28
+ });
29
+ return pending;
30
+ },
31
+ updateMemory(snapshot) { latestMemory = snapshot; },
32
+ };
33
+ globalThis.ccdxConnections = bootstrap;
34
+ window.addEventListener("hashchange", () => { if (globalThis.ccdxConnections === bootstrap) void bootstrap.load(); });
35
+ void bootstrap.load();
36
+ })();
@@ -612,8 +612,7 @@
612
612
  window.addEventListener("ccdx:source-view", () => { if (data) list(); });
613
613
  window.addEventListener("ccdx:providers", () => { if (desiredSource && providerEntries.some(p => p.id === desiredSource)) { const id = desiredSource;desiredSource = null;chooseProvider(id); }if (data) list(); });
614
614
  new MutationObserver(() => { if (data) list(); }).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
615
- globalThis.ccdxConnections = { load,
615
+ globalThis.ccdxConnections = { load, ready: load(),
616
616
  updateMemory(snapshot) { const c = snapshot?.clients?.find(c => c.id === "codex");if (data && c?.memory_model) { client("codex").memory_model = c.memory_model;memoryRender(); } }, editClient: id => { if (data && client(id)) { editClient(client(id)); } } };
617
617
  for (const button of document.querySelectorAll("[data-client-access]")) button.addEventListener("click", () => globalThis.ccdxConnections.editClient(button.dataset.clientAccess));
618
- void load();
619
618
  })();
@@ -5,14 +5,15 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <meta name="color-scheme" content="dark light">
7
7
  <link id="favicon" rel="icon" type="image/svg+xml" href="data:,">
8
- <script src="/language.js"></script>
9
8
  <script src="/theme.js"></script>
9
+ <script src="/language.js" defer></script>
10
10
  <link rel="stylesheet" href="/ui.css">
11
11
  <script src="/dashboard.js" defer></script>
12
12
  <title data-i18n="ccdx_local_dashboard">CCDX Dashboard</title>
13
13
  </head>
14
14
  <body>
15
15
  <div class="shell">
16
+ <div id="sidebar-tooltip" class="sidebar-tooltip" aria-hidden="true" hidden></div>
16
17
  <aside class="sidebar">
17
18
  <div class="sidebar-header">
18
19
  <a class="sidebar-brand" href="#overview"><svg id="status-icon" class="status-icon" viewBox="0 0 64 64" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><ellipse cx="32" cy="32" rx="26" ry="10"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(60 32 32)"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(120 32 32)"/></g><circle cx="32" cy="32" r="4.5" fill="currentColor"/></svg><span class="brand-name">CCDX</span></a>
@@ -411,7 +412,7 @@
411
412
  <div class="flow-caption"><span id="flow-caption" data-i18n="flow_status_unknown">Status unavailable</span><button id="flow-clear" type="button" data-i18n="flow_show_all" hidden>Show all</button><button id="flow-more" type="button" hidden>More models</button></div>
412
413
  </section>
413
414
  <section id="tool-activity" class="panel dashboard-section" aria-labelledby="tool-title" data-paused="true">
414
- <div class="panel-heading"><h2 id="tool-title" data-i18n="tool_heading">TOOL AND AGENT ACTIVITY</h2><label class="tool-style" for="tool-style"><span data-i18n="tool_style">Style</span><select id="tool-style"><option value="production" data-i18n="tool_style_production">Production line</option><option value="clock" data-i18n="tool_style_clock">Gear clock</option><option value="assembly" data-i18n="tool_style_assembly">Assembly line</option><option value="sorter" data-i18n="tool_style_sorter">Dual-lane sorter</option><option value="gantry" data-i18n="tool_style_gantry">Gantry transfer</option><option value="rotary" data-i18n="tool_style_rotary">Indexing table</option><option value="arm" data-i18n="tool_style_arm">Articulated robot arm</option><option value="off" data-i18n="tool_style_off">Off</option></select></label></div>
415
+ <div class="panel-heading"><h2 id="tool-title" data-i18n="tool_heading">TOOL AND AGENT ACTIVITY</h2><label class="tool-style" for="tool-style"><span data-i18n="tool_style">Style</span><select id="tool-style"><option value="production" data-i18n="tool_style_production">Production line</option><option value="clock" data-i18n="tool_style_clock">Gear clock</option><option value="assembly" data-i18n="tool_style_assembly">Assembly line</option><option value="sorter" data-i18n="tool_style_sorter">Dual-lane sorter</option><option value="gantry" data-i18n="tool_style_gantry">Gantry transfer</option><option value="rotary" data-i18n="tool_style_rotary">Indexing table</option><option value="arm" data-i18n="tool_style_arm">Articulated robot arm</option><option value="warehouse" data-i18n="tool_style_warehouse">Warehouse pallet robots</option><option value="off" data-i18n="tool_style_off">Off</option></select></label></div>
415
416
  <div id="tool-stage" class="tool-stage" data-style="production">
416
417
  <div class="tool-visual"><div class="tool-orbit"><canvas id="tool-canvas" role="img" data-i18n-label="tool_heading" aria-label="Tool and agent activity"></canvas></div><p class="tool-narration"><span id="tool-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Waiting for a fresh status</span><span id="tool-cursor" aria-hidden="true" hidden> …</span></p></div>
417
418
  <div class="tool-content"><p id="tool-context" class="tool-context" hidden></p><div id="tool-list"></div><p id="tool-more" class="hint" hidden></p></div>
@@ -30,6 +30,7 @@
30
30
  "tool_style_gantry": ["Gantry transfer","龙门移载"],
31
31
  "tool_style_rotary": ["Indexing table","分度转盘"],
32
32
  "tool_style_arm": ["Articulated robot arm","多节机械臂"],
33
+ "tool_style_warehouse": ["Warehouse pallet robots","仓库托盘机器人"],
33
34
  "tool_style_production": ["Production line", "工业生产线"],
34
35
  "tool_style_clock": ["Gear clock", "齿轮钟表"],
35
36
  "tool_style_assembly": ["Assembly line","装配线"],
@@ -249,7 +249,11 @@
249
249
  text("updated", "snapshot_time", { time: time(Date.now()) });
250
250
  return;
251
251
  }
252
- for (const source of data.providers?.connections?.providers || []) sourceNames.set(source.id, source.name);
252
+ const connections = data.providers?.connections;
253
+ if (Array.isArray(connections?.providers)) {
254
+ for (const source of connections.providers) sourceNames.set(source.id, source.name);
255
+ globalThis.ccdxConnectionNames = Object.fromEntries(connections.providers.map(({ id, name }) => [id, name]));
256
+ }
253
257
  globalThis.ccdxConnections?.updateMemory?.(data.providers?.connections);
254
258
  globalThis.ccdxDashboardActivity?.update(data.model_activity);
255
259
  globalThis.ccdxDashboardFlow?.update(data);globalThis.ccdxToolActivity?.update(data);
@@ -0,0 +1,352 @@
1
+ (() => {
2
+ "use strict";
3
+ const d=Math.SQRT1_2,tau=2*Math.PI,Z=[0,0,1],X=[1,0,0],Y=[0,1,0],camera=[.5,.5,d];
4
+ const limit=(n,a,b)=>Math.max(a,Math.min(n,b));
5
+ const mix=(a,b,t)=>a+(b-a)*t;
6
+ const project=([x,y,z])=>[(x-y)*d,(x+y)*.5-z*d];
7
+ const depth=([x,y,z])=>(x+y)*.5+z*d;
8
+ const dot=(a,b)=>a[0]*b[0]+a[1]*b[1]+a[2]*b[2];
9
+ const plus=(a,b)=>[a[0]+b[0],a[1]+b[1],a[2]+b[2]];
10
+ const scale=(a,s)=>a.map(n=>n*s);
11
+ const identity=p=>p;
12
+ function placement([x,y],angle,z=0) {
13
+ const c=Math.cos(angle),s=Math.sin(angle);
14
+ return ([u,v,w])=>[x+c*u-s*v,y+s*u+c*v,z+w];
15
+ }
16
+ const floor=4,palletBottom=13.2,lo=11.25,hi=18.6;
17
+ const [aisleX,aisleY]=[162,112];
18
+ const distance=(a,b)=>Math.hypot(a[0]-b[0],a[1]-b[1]);
19
+ const jobs=[
20
+ {kind:"cartons",name:"纸箱托盘",home:[19,aisleY],from:[54,aisleY],stop:[108,aisleY],
21
+ through:[[219,aisleY]],delivery:[[270,aisleY],[270,157]],park:[270,197],start:0,color:"amber"},
22
+ {kind:"totes",name:"周转箱托盘",home:[aisleX,209],from:[aisleX,184],stop:[aisleX,163],
23
+ through:[[aisleX,61]],delivery:[[81,61]],park:[34,61],start:.55,color:"sage"},
24
+ {kind:"crate",name:"木箱托盘",home:[304,61],from:[270,61],stop:[216,61],
25
+ through:[[aisleX,61],[aisleX,176]],delivery:[[64,176]],park:[24,176],start:1.1,color:"edge"},
26
+ ];
27
+ const direction=(a,b)=>Math.atan2(b[1]-a[1],b[0]-a[0]);
28
+ function timedPath(initial,waypoints,start,speed) {
29
+ const legs=[];
30
+ let pose=initial,time=start;
31
+ function addLeg(next,duration) {
32
+ legs.push({from:pose,to:next,start:time,end:time+duration});
33
+ time+=duration;pose=next;
34
+ }
35
+ for(const point of waypoints) {
36
+ const length=distance(pose.point,point);
37
+ if(!length)continue;
38
+ const delta=direction(pose.point,point)-pose.heading;
39
+ const turn=Math.atan2(Math.sin(delta),Math.cos(delta));
40
+ if(Math.abs(turn)>1e-6)addLeg({...pose,heading:pose.heading+turn,rotation:pose.rotation+turn},.88*Math.abs(turn)/(Math.PI/2));
41
+ addLeg({...pose,point,travel:pose.travel+length},.24+length/speed);
42
+ }
43
+ return {initial,legs,final:pose,end:time};
44
+ }
45
+ for(const j of jobs) {
46
+ const parked={point:j.home,heading:direction(j.home,j.from),travel:0,rotation:0};
47
+ j.pickup=timedPath(parked,[j.from],j.start,24);
48
+ j.dock=j.pickup.end;
49
+ j.liftEnd=j.dock+1.05;
50
+ j.leave=j.liftEnd+.40;
51
+ j.approach=timedPath(j.pickup.final,[j.stop],j.leave,27);
52
+ j.waitSince=j.approach.end;
53
+ }
54
+ let available=0;
55
+ for(const j of [...jobs].sort((a,b)=>a.waitSince-b.waitSince)) {
56
+ j.entry=Math.max(j.waitSince,available);
57
+ j.crossing=timedPath(j.approach.final,j.through,j.entry,37);
58
+ j.exit=j.crossing.end;
59
+ available=j.exit+.48;
60
+ j.outbound=timedPath(j.crossing.final,j.delivery,j.exit,25);
61
+ j.arrive=j.outbound.end;
62
+ j.lowerEnd=j.arrive+1.10;
63
+ j.release=j.lowerEnd+.32;
64
+ j.depart=timedPath(j.outbound.final,[j.park],j.release,24);
65
+ j.done=j.depart.end;
66
+ j.route=[j.home,j.from,j.stop,...j.through,...j.delivery,j.park];
67
+ }
68
+ const total=Math.ceil((Math.max(...jobs.map(j=>j.done))+.4)*50)/50;
69
+ let queue=[];
70
+
71
+ function polygon(vertices, fill=null, edge=null, width=.46, bias=0) {
72
+ queue.push({p:vertices,fill,edge,width,depth:vertices.reduce((n,v)=>n+depth(v),0)/vertices.length+bias});
73
+ }
74
+ function line(a,b,ink="fine",width=.45,bias=.2) {polygon([a,b],null,ink,width,bias);}
75
+ const rect=(x,y,w,h)=>[[x,y],[x+w,y],[x+w,y+h],[x,y+h]];
76
+ function slab(points,z0,z1,top="steel",side="joint",tr=identity) {
77
+ const a=points.map(([x,y])=>tr([x,y,z0])),b=points.map(([x,y])=>tr([x,y,z1]));
78
+ for(let i=0;i<a.length;i++){
79
+ const j=(i+1)%a.length,dx=a[j][0]-a[i][0],dy=a[j][1]-a[i][1];
80
+ if(dy-dx>0)polygon([a[i],a[j],b[j],b[i]],side,"edge",.5);
81
+ }
82
+ polygon(b,top,"edge",.58);
83
+ }
84
+ function box(x,y,z,w,h,v,top="steel",side="joint",tr=identity) {
85
+ slab(rect(x,y,w,h),z,z+v,top,side,tr);
86
+ }
87
+ function flat(x,y,z,w,h,color,tr=identity) {polygon(rect(x,y,w,h).map(([x,y])=>tr([x,y,z])),color,null);}
88
+ function ring(origin,u,v,r,n=18,angle=0) {
89
+ return Array.from({length:n},(_,i)=>plus(origin,plus(scale(u,r*Math.cos(angle+i*tau/n)),scale(v,r*Math.sin(angle+i*tau/n)))));
90
+ }
91
+ function disk(origin,u,v,r,fill="steel",ink="edge",bias=.2) {polygon(ring(origin,u,v,r),fill,ink,.43,bias);}
92
+ function cylinder(a,b,u,v,r,fill="steel",n=16){
93
+ const left=ring(a,u,v,r,n),right=ring(b,u,v,r,n);
94
+ for(let i=0;i<n;i++){
95
+ const j=(i+1)%n,angle=(i+.5)*tau/n;
96
+ if(dot(plus(scale(u,Math.cos(angle)),scale(v,Math.sin(angle))),camera)>0)
97
+ polygon([left[i],left[j],right[j],right[i]],i%3===0?"joint":fill,null);
98
+ }
99
+ const facing=depth(b)>depth(a);
100
+ disk(facing?b:a,u,v,r,fill);
101
+ }
102
+ function bolt(x,y,z,r=1.1,tr=identity){
103
+ polygon(ring([x,y,z],X,Y,r,6,Math.PI/6).map(tr),"joint","edge",.37,.4);
104
+ line(tr([x-r*.55,y,z]),tr([x+r*.55,y,z]),"edge",.36,.51);
105
+ }
106
+ function stopLine(job,color="fine",width=.66){
107
+ const tr=placement(job.stop,job.approach.final.heading);
108
+ for(const across of [-14,-6,2,10])
109
+ line(tr([16,across,4.23]),tr([16,across+4,4.23]),color,width);
110
+ }
111
+ function routeDashes(){
112
+ const lanes=new Map();
113
+ for(const job of jobs)for(let i=1;i<job.route.length;i++){
114
+ const a=job.route[i-1],b=job.route[i],along=a[1]===b[1]?0:1;
115
+ const fixed=a[1-along],key=along+":"+fixed;
116
+ if(!lanes.has(key))lanes.set(key,{along,fixed,segments:[]});
117
+ lanes.get(key).segments.push([Math.min(a[along],b[along]),Math.max(a[along],b[along])]);
118
+ }
119
+ for(const {along,fixed,segments} of lanes.values()){
120
+ segments.sort((a,b)=>a[0]-b[0]);
121
+ const joined=[];
122
+ for(const span of segments){
123
+ const previous=joined.at(-1);
124
+ if(previous&&previous[1]>=span[0])previous[1]=Math.max(previous[1],span[1]);
125
+ else joined.push(span.slice());
126
+ }
127
+ const point=n=>along?[fixed,n,4.13]:[n,fixed,4.13];
128
+ for(const [begin,end] of joined){
129
+ for(let n=Math.ceil(begin/10)*10;n+5<=end;n+=10)line(point(n),point(n+5),"fine",.58);
130
+ }
131
+ }
132
+ }
133
+ function platform() {
134
+ const outline=[[7,0],[319,0],[326,7],[326,218],[319,225],[7,225],[0,218],[0,7]];
135
+ slab(outline,0,floor,"floor","joint");
136
+ routeDashes();
137
+ for(const job of jobs)stopLine(job);
138
+ for(const [x,y] of [[9,9],[316,9],[9,215],[316,215]])bolt(x,y,4.12,1.9);
139
+ }
140
+ function shippingBox(x,y,z,w,h,v,material,tr=identity){
141
+ box(x,y,z,w,h,v,material==="crate"?"wood":"kraft",material==="crate"?"kraft":"wood",tr);
142
+ flat(x+w*.43,y+.4,z+v+.08,w*.13,h-.8,"tape",tr);
143
+ line(tr([x+w*.62,y+.5,z+v+.13]),tr([x+w*.62,y+h-.5,z+v+.13]),"fine",.32);
144
+ const yFace=y+h+.07;
145
+ polygon([[x+2.4,yFace,z+v-2.1],[x+8.5,yFace,z+v-2.1],[x+8.5,yFace,z+v-5.4],[x+2.4,yFace,z+v-5.4]].map(tr),"paper-label",null,.3,.22);
146
+ for(let j=0;j<5;j++)line(tr([x+3+j*.93,yFace+.04,z+v-4.65]),tr([x+3+j*.93,yFace+.04,z+v-2.9]),"edge",.27,.24);
147
+ if(material==="crate"){
148
+ for(const r of [1.2,v-1.9]){
149
+ line(tr([x+.5,yFace,z+r]),tr([x+w-.5,yFace,z+r]),"edge",.55,.28);
150
+ line(tr([x+w+.09,y+.4,z+r]),tr([x+w+.09,y+h-.4,z+r]),"edge",.55,.28);
151
+ }
152
+ line(tr([x+1,yFace,z+1.5]),tr([x+w-1,yFace,z+v-1.8]),"fine",.75,.27);
153
+ }
154
+ if(w>12)line(tr([x+w-4,yFace,z+2.1]),tr([x+w-1.7,yFace,z+2.1]),"edge",.37,.3);
155
+ }
156
+ function tote(x,y,z,w,h,v,tr=identity) {
157
+ box(x,y,z,w,h,v,"tote","steel",tr);
158
+ box(x-.75,y-.75,z+v-1.5,w+1.5,h+1.5,1.8,"tote","steel",tr);
159
+ for(let i=2.5;i<w-1;i+=3.4)
160
+ line(tr([x+i,y+h+.08,z+1]),tr([x+i,y+h+.08,z+v-2.1]),"fine",.52,.25);
161
+ for(let i=2.5;i<h-1;i+=3.4)
162
+ line(tr([x+w+.08,y+i,z+1]),tr([x+w+.08,y+i,z+v-2.1]),"fine",.52,.25);
163
+ line(tr([x+w*.36,y+h*.6,z+v+.36]),tr([x+w*.63,y+h*.6,z+v+.36]),"sage",.88,.3);
164
+ }
165
+ function rack(x,y,bays) {
166
+ const gap=37,end=x+bays*gap;
167
+ for(let i=0;i<=bays;i++){
168
+ for(const dy of [0,24]){
169
+ box(x+i*gap-2,y+dy-2,4,4.5,4.5,1.35,"steel","joint");
170
+ box(x+i*gap,y+dy,5,2.4,2.4,49,"steel","joint");
171
+ for(let z=12;z<51;z+=5)line([x+i*gap+.65,y+dy+2.5,z],[x+i*gap+1.7,y+dy+2.5,z],"edge",.37,.22);
172
+ }
173
+ const xx=x+i*gap+1.15;
174
+ for(const [low,high] of [[7,28],[29,51]])
175
+ line([xx,y+1.3,low],[xx,y+25.3,high],"belt",.96);
176
+ }
177
+ for(const z of [8,30,52]){
178
+ for(const dy of [.8,24.2])box(x+2.1,y+dy,z,end-x,1.8,2.2,"steel","joint");
179
+ if(z<52){
180
+ for(let i=0;i<bays;i++)box(x+i*gap+2.1,y+2,z+.3,gap-1,22,1.7,"deck","belt");
181
+ }
182
+ }
183
+ for(let i=0;i<bays;i++){
184
+ const ax=x+i*gap+5;
185
+ if(i%3!==1)shippingBox(ax,y+4,10,16,16,12+i%2*3,"cartons");
186
+ if(i%4!==2)shippingBox(ax+17,y+6,10,12,14,9,"crate");
187
+ if(i%3===0)tote(ax+5,y+6,32,22,15,9);
188
+ else if(i%3===1)shippingBox(ax+4,y+6,32,22,15,13,"cartons");
189
+ else {
190
+ shippingBox(ax,y+4,32,13,14,10,"cartons");
191
+ shippingBox(ax+16,y+6,32,13,14,12,"cartons");
192
+ }
193
+ }
194
+ }
195
+ function fixedScene(){
196
+ rack(22,8,3);
197
+ rack(185,8,3);
198
+ for(const x of [15,308]){
199
+ box(x,8,4,3,33,5,"joint","belt");
200
+ box(x-.8,37,4,4.7,4.7,10,"steel","joint");
201
+ }
202
+ }
203
+ function pallet(point,z,kind,heading) {
204
+ const tr=placement(point,heading);
205
+ const w=31,h=31,px=-w/2,py=-h/2;
206
+ const feet=9.2;
207
+ for(const xx of [1,w-5.6])for(const yy of [1,h-4.65])
208
+ box(px+xx,py+yy,z-feet,4.55,3.6,feet,"wood","belt",tr);
209
+ for(const yy of [0,7.45,14.9,22.35,29.8]){
210
+ box(px,py+yy,z,w,Math.min(4.1,31-yy),2.45,"wood","belt",tr);
211
+ }
212
+ const base=z+2.46;
213
+ if(kind==="cartons"){
214
+ shippingBox(-12.9,-12,base,14,21.8,13,"cartons",tr);
215
+ shippingBox(1.45,-11,base,11.4,21.9,10.1,"cartons",tr);
216
+ shippingBox(-12,-10.6,base+13,11.2,19.4,9.6,"cartons",tr);
217
+ }else if(kind==="totes"){
218
+ tote(-12,-10.6,base,24,21.2,7.4,tr);
219
+ tote(-12,-10.6,base+7.7,24,21.2,7.4,tr);
220
+ }else {
221
+ shippingBox(-13.1,-12.1,base,26.2,24.2,16,"crate",tr);
222
+ const cap=base+16.11;
223
+ for(const xx of [-9,8])
224
+ flat(xx,-11.3,cap,2.6,22.6,"belt",tr);
225
+ for(const xx of [-7.7,9.3])for(const yy of [-8,8])bolt(xx,yy,cap+.08,.76,tr);
226
+ }
227
+ }
228
+ const footprint=[[-15,-6.8],[-12.3,-9],[12.3,-9],[15,-6.8],[15,6.8],[12.3,9],[-12.3,9],[-15,6.8]];
229
+ function cart(job,state) {
230
+ const z=state.deck,tr=placement(state.point,state.heading);
231
+ const forward=[Math.cos(state.heading),Math.sin(state.heading),0], across=[-forward[1],forward[0],0];
232
+ polygon(ring(tr([1,1.5,4.11]),X,Y,12,20),"shadow",null,.3,-.08);
233
+ for(const dx of [-8.8,8.8])for(const side of [-1,1]){
234
+ const center=tr([dx,side*9.2,7.2]);
235
+ const a=plus(center,scale(across,-1.35)),b=plus(center,scale(across,1.35));
236
+ cylinder(a,b,forward,Z,3.18,"heel",14);
237
+ if(dot(across,camera)*side>0){
238
+ const hub=plus(side===1?b:a,scale(across,side*.07));
239
+ disk(hub,forward,Z,2.2,"steel");
240
+ disk(plus(hub,scale(across,side*.04)),forward,Z,.92,"joint","edge",.36);
241
+ const theta=-(state.travel-side*9.2*state.rotation)/3.18;
242
+ for(let i=0;i<4;i++){
243
+ const a=theta+i*tau/4,c=Math.cos(a),s=Math.sin(a);
244
+ const v=plus(scale(forward,c),scale(Z,s));
245
+ line(plus(hub,scale(v,1.03)),plus(hub,scale(v,1.99)),"edge",.42,.5);
246
+ }
247
+ }
248
+ }
249
+ slab(footprint,5.6,9.45,"steel","heel",tr);
250
+ slab(footprint.map(([a,b])=>[a*.975,b*.98]),9.45,10.3,"deck","steel",tr);
251
+ for (const direction of [-1,1]) {
252
+ const a=direction*15;
253
+ line(tr([a,-4.4,8.65]),tr([a,4.4,8.65]),"fine",.6);
254
+ for(const yy of [-4.65,4.65])
255
+ line(tr([direction*14.53,yy-.8,9.36]),tr([direction*14.53,yy+.8,9.36]),job.color,1.3,.35);
256
+ }
257
+ for(const side of [-1,1]){
258
+ const yy=side*5.9;
259
+ line(tr([-5.8,yy,10.5]),tr([5.8,yy,z-.47]),"edge",1.1,.32);
260
+ line(tr([5.8,yy,10.5]),tr([-5.8,yy,z-.47]),"belt",.9,.32);
261
+ }
262
+ box(-9,-6.6,z-.82,18,13.2,.82,"steel","heel",tr);
263
+ for(const a of [-5.8,5.8])line(tr([a,-5.1,z+.05]),tr([a,5.1,z+.05]),"edge",.46);
264
+ for(const a of [-12.4,12.4]){
265
+ disk(tr([a,-3.8,10.55]),X,Y,1.72,"heel","edge",.26);
266
+ disk(tr([a,-3.8,11.05]),X,Y,.91,state.waiting?"amber":state.moving?job.color:"joint",null,.3);
267
+ }
268
+ for(const a of [-10.6,10.6])for(const b of [-6.6,6.6])bolt(a,b,10.43,.64,tr);
269
+ }
270
+
271
+ function trajectory(a,b,time,start,end){
272
+ const u=limit((time-start)/(end-start),0,1);
273
+ const q=.23, peak=1/(1-q);
274
+ const s=u<q?peak*u*u/(2*q):u>1-q?1-peak*(1-u)**2/(2*q):peak*(u-q/2);
275
+ return mix(a,b,s);
276
+ }
277
+ function poseAt(path,time){
278
+ const leg=path.legs.find(leg=>time<leg.end);
279
+ if(!leg)return path.final;
280
+ const {from,to,start,end}=leg;
281
+ const s=trajectory(0,1,time,start,end);
282
+ return {
283
+ point:[mix(from.point[0],to.point[0],s),mix(from.point[1],to.point[1],s)],
284
+ heading:mix(from.heading,to.heading,s),travel:mix(from.travel,to.travel,s),rotation:mix(from.rotation,to.rotation,s),
285
+ };
286
+ }
287
+ function stateAt(j,time){
288
+ const path=time<j.leave?j.pickup:time<j.entry?j.approach:time<j.exit?j.crossing:time<j.release?j.outbound:j.depart;
289
+ const pose=poseAt(path,time);
290
+ const deck=time<=j.arrive?trajectory(lo,hi,time,j.dock+.26,j.liftEnd):trajectory(hi,lo,time,j.arrive+.21,j.lowerEnd);
291
+ const carrying=time>=j.dock && time<j.lowerEnd;
292
+ const cargo=carrying?pose:time>=j.lowerEnd?j.outbound.final:j.pickup.final;
293
+ const cargoHeight=carrying?Math.max(palletBottom,deck):palletBottom;
294
+ const waiting=time>=j.waitSince&&time<j.entry;
295
+ const moving=(time>j.start&&time<j.dock)||(time>j.leave&&time<j.arrive&&!waiting)||(time>j.release&&time<j.done);
296
+ return {...pose,deck,cargo,cargoHeight,moving,waiting};
297
+ }
298
+ function paint(context,items,colors,sort=true){
299
+ context.lineJoin="round";context.lineCap="round";
300
+ if(sort)items.sort((a,b)=>a.depth-b.depth);
301
+ for(const item of items){
302
+ context.beginPath();context.moveTo(...project(item.p[0]));
303
+ for(let i=1;i<item.p.length;i++)context.lineTo(...project(item.p[i]));
304
+ if(item.fill){context.closePath();context.fillStyle=colors[item.fill];context.fill();}
305
+ if(item.edge){context.strokeStyle=colors[item.edge];context.lineWidth=item.width;context.stroke();}
306
+ }
307
+ }
308
+ function palette(ink,surface){
309
+ const pixel=document.createElement("canvas");pixel.width=pixel.height=1;
310
+ const sampler=pixel.getContext("2d",{willReadFrequently:true});
311
+ const rgb=value=>{
312
+ sampler.fillStyle=value;sampler.fillRect(0,0,1,1);
313
+ return Array.from(sampler.getImageData(0,0,1,1).data).slice(0,3);
314
+ };
315
+ const a=rgb(ink),p=rgb(surface);
316
+ const tone=s=>"rgb("+p.map((c,i)=>Math.round(mix(c,a[i],s))).join(",")+")";
317
+ return {ink,edge:tone(.82),fine:tone(.64),floor:tone(.09),joint:tone(.23),shadow:tone(.16),
318
+ deck:tone(.12),steel:tone(.19),heel:tone(.51),kraft:tone(.21),wood:tone(.30),tote:tone(.34),
319
+ tape:tone(.08),sage:ink,amber:tone(.75),"paper-label":surface,belt:tone(.4)};
320
+ }
321
+
322
+ fixedScene();const fixtures=queue;queue=[];
323
+ globalThis.ccdxToolWarehouse = context => {
324
+ let key,colors,ground,zoom,left,top;
325
+ return (_style,{time,width,height,dpr,ink,surface}) => {
326
+ const size=Math.min((width-10)/402,(height-8)/320)*dpr;
327
+ if(!(size>0))return;
328
+ const next=[width,height,dpr,ink,surface].join("|");
329
+ if(next!==key){
330
+ colors=palette(ink,surface);zoom=size;
331
+ left=context.canvas.width/2-35*zoom;top=context.canvas.height/2-123*zoom;
332
+ ground=document.createElement("canvas");
333
+ ground.width=context.canvas.width;ground.height=context.canvas.height;
334
+ const base=ground.getContext("2d");
335
+ base.setTransform(zoom,0,0,zoom,left,top);platform();paint(base,queue,colors,false);
336
+ queue=[];key=next;
337
+ }
338
+ const elapsed=Math.max(0,time);
339
+ const cycle=Math.floor(elapsed/total),phase=elapsed-cycle*total;
340
+ // The next cycle returns the loads along the same collision-tested trajectories.
341
+ const moment=cycle%2?total-phase:phase;
342
+ context.setTransform(1,0,0,1,0,0);context.drawImage(ground,0,0);
343
+ context.setTransform(zoom,0,0,zoom,left,top);
344
+ for(const job of jobs){
345
+ const state=stateAt(job,moment);
346
+ if(state.waiting)stopLine(job,"amber",1.18);
347
+ cart(job,state);pallet(state.cargo.point,state.cargoHeight,job.kind,state.cargo.heading);
348
+ }
349
+ paint(context,fixtures.concat(queue),colors);queue=[];
350
+ };
351
+ };
352
+ })();
@@ -1,14 +1,15 @@
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(["production", "clock", "assembly", "sorter", "gantry", "rotary", "arm", "off"]), storageKey = "ccdx.dashboard.toolMotionStyle";
4
+ const styles = new Set(["production", "clock", "assembly", "sorter", "gantry", "rotary", "arm", "warehouse", "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
8
  const state = { scene: "idle", style: "production" };
9
9
  const dashboardScript = document.currentScript.src;
10
10
  const renderers = new Map();
11
- const rendererName = () => state.style === "arm" ? "arm" : "machines";
11
+ const rendererName = () => ["arm", "warehouse"].includes(state.style) ? state.style : "machines";
12
+ const rendererFactories = { arm: "ccdxToolArm", warehouse: "ccdxToolWarehouse", machines: "ccdxToolMachines" };
12
13
  try { const saved = localStorage.getItem(storageKey);if (styles.has(saved)) state.style = saved; } catch {}
13
14
  const motion = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)") || { matches: false, addEventListener() {} };
14
15
  let records = [], fresh = false, supported = false, visible = true, raf = 0, last = 0, start = performance.now(), expiry = null;
@@ -63,7 +64,7 @@
63
64
  const script = document.createElement("script");
64
65
  script.src = asset.href;
65
66
  script.addEventListener("load", () => {
66
- const create = name === "arm" ? globalThis.ccdxToolArm : globalThis.ccdxToolMachines;
67
+ const create = globalThis[rendererFactories[name]];
67
68
  if (typeof create !== "function") return;
68
69
  renderers.set(name, create(ctx));
69
70
  if (rendererName() === name) refreshAnimation();
@@ -336,6 +336,7 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
336
336
  [data-sidebar-collapsed] .sidebar-chevron { transform: scaleX(-1); transform-origin: 14.5px 12px; }
337
337
  [data-sidebar-collapsed] .sidebar nav a { position: relative; justify-content: center; gap: 0; padding-inline: 0; min-height: 36px; border-inline-end: 2px solid transparent; }
338
338
  [data-sidebar-collapsed] .sidebar nav a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
339
+ .sidebar-tooltip { position: fixed; z-index: 8; pointer-events: none; max-width: calc(100vw - 12px); padding: 5px 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
339
340
  @media (max-width: 640px) {
340
341
  [data-sidebar-collapsed] .sidebar { padding-inline-end: 0; }
341
342
  [data-sidebar-collapsed] .sidebar-header { justify-content: flex-start; }
@@ -61,6 +61,50 @@ document.querySelector(".sidebar-brand").addEventListener("click", animateLogo);
61
61
  const sidebarPreference = "ccdx.dashboard.sidebar";
62
62
  const sidebarToggle = element("sidebar-toggle");
63
63
  const sidebarLinks = element("sidebar-navigation").querySelectorAll("a");
64
+ const sidebarTooltip = element("sidebar-tooltip");
65
+ let hoveredSidebarLink, focusedSidebarLink, lastSidebarLink;
66
+ function updateSidebarTooltip() {
67
+ const link = lastSidebarLink === hoveredSidebarLink || lastSidebarLink === focusedSidebarLink
68
+ ? lastSidebarLink : hoveredSidebarLink || focusedSidebarLink;
69
+ if (!link || document.documentElement.dataset.sidebarCollapsed !== "true") {
70
+ sidebarTooltip.hidden = true;
71
+ return;
72
+ }
73
+ const name = link.querySelector("span");
74
+ localize(sidebarTooltip, name.dataset.i18n || name.textContent);
75
+ sidebarTooltip.hidden = false;
76
+ const anchor = link.getBoundingClientRect(), tip = sidebarTooltip.getBoundingClientRect();
77
+ const viewport = document.documentElement.clientWidth;
78
+ const rail = viewport > 640;
79
+ const x = rail ? anchor.right + 8 : anchor.left + (anchor.width - tip.width) / 2;
80
+ const y = rail ? anchor.top + (anchor.height - tip.height) / 2 : anchor.bottom + 6;
81
+ sidebarTooltip.style.left = `${Math.max(6, Math.min(x, viewport - tip.width - 6))}px`;
82
+ sidebarTooltip.style.top = `${Math.max(6, Math.min(y, window.innerHeight - tip.height - 6))}px`;
83
+ }
84
+ for (const link of sidebarLinks) {
85
+ link.addEventListener("pointerenter", event => {
86
+ if (event.pointerType === "touch") return;
87
+ lastSidebarLink = hoveredSidebarLink = link;
88
+ updateSidebarTooltip();
89
+ });
90
+ link.addEventListener("pointerleave", () => {
91
+ if (hoveredSidebarLink === link) hoveredSidebarLink = null;
92
+ updateSidebarTooltip();
93
+ });
94
+ link.addEventListener("focus", () => { lastSidebarLink = focusedSidebarLink = link;updateSidebarTooltip(); });
95
+ link.addEventListener("blur", () => {
96
+ if (focusedSidebarLink === link) focusedSidebarLink = null;
97
+ updateSidebarTooltip();
98
+ });
99
+ }
100
+ document.addEventListener("keydown", event => {
101
+ if (event.key !== "Escape" || sidebarTooltip.hidden) return;
102
+ hoveredSidebarLink = focusedSidebarLink = null;
103
+ updateSidebarTooltip();
104
+ });
105
+ for (const event of ["resize", "scroll"]) window.addEventListener(event, () => {
106
+ if (!sidebarTooltip.hidden) updateSidebarTooltip();
107
+ }, { passive: true });
64
108
  function setSidebarCollapsed(collapsed) {
65
109
  if (collapsed) document.documentElement.dataset.sidebarCollapsed = "true";
66
110
  else delete document.documentElement.dataset.sidebarCollapsed;
@@ -68,10 +112,7 @@ function setSidebarCollapsed(collapsed) {
68
112
  const label = collapsed ? "sidebar_expand" : "sidebar_collapse";
69
113
  localize(sidebarToggle, label, {}, "aria-label");
70
114
  localize(sidebarToggle, label, {}, "title");
71
- for (const link of sidebarLinks) {
72
- const name = link.querySelector("span");
73
- localize(link, collapsed ? name.dataset.i18n || name.textContent : "", {}, "title");
74
- }
115
+ updateSidebarTooltip();
75
116
  }
76
117
  try { setSidebarCollapsed(localStorage.getItem(sidebarPreference) === "collapsed"); }
77
118
  catch { setSidebarCollapsed(false); }