@andorra-labs/code 0.1.14 → 0.1.16
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/dist/src/acp-agent.d.ts +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-definitions.js +29 -6
- package/dist/src/agent-execution.js +8 -2
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +3 -1
- package/dist/src/agent-mcp.js +97 -11
- package/dist/src/andorra/entry.js +21 -3
- package/dist/src/andorra/hosted.d.ts +3 -0
- package/dist/src/andorra/hosted.js +5 -1
- package/dist/src/andorra/notices.d.ts +10 -1
- package/dist/src/andorra/notices.js +25 -2
- package/dist/src/andorra/terminal.d.ts +2 -0
- package/dist/src/andorra/terminal.js +2 -2
- package/dist/src/app-server/protocol.d.ts +9 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +141 -10
- package/dist/src/app-server.d.ts +115 -0
- package/dist/src/app-server.js +980 -63
- package/dist/src/auth/AuthManager.js +4 -4
- package/dist/src/auth/deployment.js +2 -2
- package/dist/src/browser-bridge.d.ts +1 -0
- package/dist/src/browser-bridge.js +5 -2
- package/dist/src/browser-external-app.d.ts +27 -0
- package/dist/src/browser-external-app.js +60 -0
- package/dist/src/browser-panel-tool.d.ts +6 -0
- package/dist/src/browser-panel-tool.js +36 -0
- package/dist/src/browser-runner.js +1 -0
- package/dist/src/browser-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-ui/style.css +3 -3
- package/dist/src/browser-ui/tokens.css +27 -16
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +60 -2
- package/dist/src/bug-report.d.ts +81 -0
- package/dist/src/bug-report.js +235 -0
- package/dist/src/claude-provider.d.ts +2 -1
- package/dist/src/claude-provider.js +13 -9
- package/dist/src/cli-sign-in.d.ts +3 -1
- package/dist/src/cli-sign-in.js +4 -1
- package/dist/src/cli.js +184 -40
- package/dist/src/codex-errors.js +4 -1
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +9 -2
- package/dist/src/command-screens.js +166 -97
- package/dist/src/commands.d.ts +3 -2
- package/dist/src/commands.js +1 -0
- package/dist/src/compaction-phrases.d.ts +4 -0
- package/dist/src/compaction-phrases.js +20 -0
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.js +48 -0
- package/dist/src/context-compaction.js +2 -1
- package/dist/src/decision/DecisionManager.js +3 -2
- package/dist/src/decision/requestPhrases.d.ts +4 -0
- package/dist/src/decision/requestPhrases.js +23 -0
- package/dist/src/github-inbox.d.ts +55 -0
- package/dist/src/github-inbox.js +153 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.js +8 -4
- package/dist/src/graph-manager-chat.js +6 -1
- package/dist/src/graph-provider-portability.js +32 -10
- package/dist/src/graph-quota.d.ts +29 -2
- package/dist/src/graph-quota.js +68 -10
- package/dist/src/graph-runner.js +24 -7
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +9 -7
- package/dist/src/graph-sync.d.ts +1 -0
- package/dist/src/graph-sync.js +93 -34
- package/dist/src/graph-tool.d.ts +2 -0
- package/dist/src/graph-tool.js +2 -2
- package/dist/src/graph-ui/app.js +177 -41
- package/dist/src/graph-ui/controls.css +1 -0
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-ui/embed.js +2 -2
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/manager.css +1 -1
- package/dist/src/graph-ui/manager.js +2 -2
- package/dist/src/graph-ui/sidebar.js +30 -0
- package/dist/src/graph-ui/studio-canvas.js +26 -13
- package/dist/src/graph-ui/studio.css +15 -7
- package/dist/src/graph-ui/studio.js +11 -4
- package/dist/src/graph-ui/style.css +77 -45
- package/dist/src/graph-ui/theme.js +3 -36
- package/dist/src/graph-ui/tokens.css +27 -19
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- package/dist/src/graphs.js +4 -3
- package/dist/src/live-model.d.ts +24 -0
- package/dist/src/live-model.js +37 -0
- package/dist/src/managed-sign-in.d.ts +1 -0
- package/dist/src/managed-sign-in.js +13 -0
- package/dist/src/membership-errors.d.ts +2 -0
- package/dist/src/membership-errors.js +5 -1
- package/dist/src/membership.d.ts +23 -1
- package/dist/src/membership.js +48 -6
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +1 -1
- package/dist/src/model-metadata.js +12 -3
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/plan-pass.d.ts +59 -0
- package/dist/src/plan-pass.js +165 -0
- package/dist/src/provider-connection.js +17 -0
- package/dist/src/provider-engine.d.ts +5 -0
- package/dist/src/provider-engine.js +6 -3
- package/dist/src/provider-import.js +3 -1
- package/dist/src/provider-settings.js +14 -2
- package/dist/src/providers.d.ts +33 -2
- package/dist/src/providers.js +101 -28
- package/dist/src/pull-request-checks.d.ts +26 -0
- package/dist/src/pull-request-checks.js +56 -0
- package/dist/src/pull-request-conversation.d.ts +134 -0
- package/dist/src/pull-request-conversation.js +221 -0
- package/dist/src/pull-request-create.d.ts +175 -0
- package/dist/src/pull-request-create.js +392 -0
- package/dist/src/pull-request-details.d.ts +242 -0
- package/dist/src/pull-request-details.js +614 -0
- package/dist/src/pull-request-edit.d.ts +23 -0
- package/dist/src/pull-request-edit.js +91 -0
- package/dist/src/pull-request-logs.d.ts +76 -0
- package/dist/src/pull-request-logs.js +172 -0
- package/dist/src/pull-request-merge.d.ts +112 -0
- package/dist/src/pull-request-merge.js +258 -0
- package/dist/src/pull-request-review.d.ts +137 -0
- package/dist/src/pull-request-review.js +401 -0
- package/dist/src/pull-requests.d.ts +43 -2
- package/dist/src/pull-requests.js +112 -21
- package/dist/src/react-runtime.js +58 -9
- package/dist/src/read-document-tool.d.ts +2 -0
- package/dist/src/read-document-tool.js +6 -6
- package/dist/src/remote/engine-pool.js +42 -6
- package/dist/src/run-control.d.ts +10 -0
- package/dist/src/run-control.js +24 -0
- package/dist/src/run-progress.d.ts +10 -0
- package/dist/src/run-progress.js +122 -0
- package/dist/src/run-records.d.ts +2 -2
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +14 -2
- package/dist/src/save-lock.js +14 -7
- package/dist/src/session-title.d.ts +3 -0
- package/dist/src/session-title.js +5 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +10 -3
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/errors.md +1 -0
- package/dist/src/skills/bundled/provenance.json +7 -2
- package/dist/src/skills/runtime-skills.js +1 -0
- package/dist/src/subagent-run.js +1 -0
- package/dist/src/telemetry/capture-core.d.ts +17 -0
- package/dist/src/telemetry/capture-core.js +59 -1
- package/dist/src/telemetry/classify.d.ts +3 -1
- package/dist/src/telemetry/classify.js +37 -0
- package/dist/src/telemetry/emitter.d.ts +2 -0
- package/dist/src/telemetry/emitter.js +42 -5
- package/dist/src/telemetry/schema.d.ts +22 -0
- package/dist/src/telemetry/schema.js +68 -1
- package/dist/src/telemetry/surface.d.ts +1 -0
- package/dist/src/telemetry/uploader.d.ts +12 -1
- package/dist/src/telemetry/uploader.js +30 -2
- package/dist/src/terminal-links.d.ts +16 -0
- package/dist/src/terminal-links.js +113 -0
- package/dist/src/terminal-ui.d.ts +8 -1
- package/dist/src/terminal-ui.js +40 -14
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/trajectory.js +6 -1
- package/dist/src/transcript.d.ts +2 -0
- package/dist/src/transcript.js +10 -3
- package/dist/src/types.d.ts +9 -0
- package/dist/src/usage-analytics.js +18 -10
- package/package.json +2 -1
|
@@ -3,41 +3,49 @@ globalThis.AndorraEdgeRouter = (() => {
|
|
|
3
3
|
const clear = (a, b, boxes) => !boxes.some(r => a.x === b.x
|
|
4
4
|
? a.x > r.x && a.x < r.x + r.width && Math.max(a.y,b.y) > r.y && Math.min(a.y,b.y) < r.y+r.height
|
|
5
5
|
: a.y > r.y && a.y < r.y+r.height && Math.max(a.x,b.x) > r.x && Math.min(a.x,b.x) < r.x+r.width);
|
|
6
|
-
const GAP =
|
|
7
|
-
const NUDGE =
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
function lineIndex(occupied) {
|
|
15
|
-
const rows = new Map(), columns = new Map();
|
|
16
|
-
for (const route of occupied) for (let i = 1; i < route.length; i++) {
|
|
6
|
+
const GAP = 16;
|
|
7
|
+
const NUDGE = 16, NUDGES = 5, ROWS = 12;
|
|
8
|
+
function addLines(index, route) {
|
|
9
|
+
const { rows, columns } = index;
|
|
10
|
+
index.empty = false;
|
|
11
|
+
for (let i = 1; i < route.length; i++) {
|
|
17
12
|
const a = route[i-1], b = route[i];
|
|
18
13
|
if (a.x === b.x && a.y === b.y) continue;
|
|
19
|
-
const
|
|
14
|
+
const flat = a.y === b.y, table = flat ? rows : columns, line = flat ? a.y : a.x, bucket = Math.floor(line / GAP);
|
|
20
15
|
if (!table.has(bucket)) table.set(bucket, []);
|
|
21
|
-
table.get(bucket).push({ a, b, final: i === route.length - 1, end: route.at(-1) });
|
|
16
|
+
table.get(bucket).push({ line, low: flat ? Math.min(a.x,b.x) : Math.min(a.y,b.y), high: flat ? Math.max(a.x,b.x) : Math.max(a.y,b.y), final: i === route.length - 1, end: route.at(-1) });
|
|
22
17
|
}
|
|
23
|
-
|
|
18
|
+
}
|
|
19
|
+
function lineIndex(occupied) {
|
|
20
|
+
const index = { rows: new Map(), columns: new Map(), empty: true };
|
|
21
|
+
for (const route of occupied) addLines(index, route);
|
|
22
|
+
return index;
|
|
24
23
|
}
|
|
25
24
|
function along(index, a, b, final = false, end = undefined) {
|
|
26
|
-
if (index.empty || (a.x === b.x && a.y === b.y)) return
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if (index.empty || (a.x === b.x && a.y === b.y)) return 0;
|
|
26
|
+
const flat = a.y === b.y, table = flat ? index.rows : index.columns, line = flat ? a.y : a.x, bucket = Math.floor(line / GAP);
|
|
27
|
+
const low = flat ? Math.min(a.x,b.x) : Math.min(a.y,b.y), high = flat ? Math.max(a.x,b.x) : Math.max(a.y,b.y);
|
|
28
|
+
let total = 0;
|
|
29
|
+
for (let near = bucket - 1; near <= bucket + 1; near++) {
|
|
30
|
+
const others = table.get(near);
|
|
31
|
+
if (others) for (const other of others) {
|
|
32
|
+
const apart = Math.abs(line - other.line);
|
|
33
|
+
if (apart >= GAP) continue;
|
|
34
|
+
const run = Math.min(high, other.high) - Math.max(low, other.low);
|
|
35
|
+
if (run <= 0 || (final && other.final && end && other.end.x === end.x && other.end.y === end.y)) continue;
|
|
36
|
+
total += run * (GAP - apart);
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
|
-
return
|
|
39
|
+
return total;
|
|
33
40
|
}
|
|
34
|
-
function crowdsIndex(points, index) {
|
|
35
|
-
if (index.empty) return
|
|
41
|
+
function crowdsIndex(points, index, limit = Infinity) {
|
|
42
|
+
if (index.empty) return 0;
|
|
36
43
|
const end = points.at(-1);
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
let total = 0;
|
|
45
|
+
for (let i = 1; i < points.length && total < limit; i++) total += along(index, points[i-1], points[i], i === points.length - 1, end);
|
|
46
|
+
return total;
|
|
39
47
|
}
|
|
40
|
-
const crowds = (points, occupied) => crowdsIndex(points, lineIndex(occupied));
|
|
48
|
+
const crowds = (points, occupied) => crowdsIndex(points, lineIndex(occupied)) > 0;
|
|
41
49
|
function routeEdge(source, target, rectangles, lane = 0, padding = 12, occupied = []) {
|
|
42
50
|
const escape = padding + 2, start = {x:source.x+escape,y:source.y}, end = {x:target.x-escape,y:target.y};
|
|
43
51
|
const boxes = rectangles.map(r => ({x:r.x-padding,y:r.y-padding,width:r.width+padding*2,height:r.height+padding*2}));
|
|
@@ -50,45 +58,59 @@ globalThis.AndorraEdgeRouter = (() => {
|
|
|
50
58
|
};
|
|
51
59
|
const finish = points => simplify([source,...points,target]);
|
|
52
60
|
const clearOfCards = points => points.every((p,i)=>!i||clear(points[i-1],p,boxes));
|
|
53
|
-
const index = lineIndex(occupied);
|
|
54
|
-
const verdict = points => !clearOfCards(points) ? 'blocked' : crowdsIndex(finish(points), index) ? 'crowded' : 'ok';
|
|
61
|
+
const index = Array.isArray(occupied) ? lineIndex(occupied) : occupied;
|
|
55
62
|
const rowNudges = (y, k) => (y <= Math.min(start.y,end.y) ? [-1] : y >= Math.max(start.y,end.y) ? [1] : [1,-1]).map(way=>y+way*NUDGE*k);
|
|
56
|
-
let
|
|
63
|
+
let leastCrowded;
|
|
64
|
+
const attempt = (points, nudged = false) => {
|
|
65
|
+
if (!nudged && !clearOfCards(points)) return 'blocked';
|
|
66
|
+
const route = finish(points), score = crowdsIndex(route, index, leastCrowded?.score);
|
|
67
|
+
if (nudged && ((leastCrowded && score >= leastCrowded.score) || !clearOfCards(points))) return 'blocked';
|
|
68
|
+
if (!score) return route;
|
|
69
|
+
if (!leastCrowded || score < leastCrowded.score) leastCrowded = { route, score };
|
|
70
|
+
return 'crowded';
|
|
71
|
+
};
|
|
57
72
|
const corridor = (build, row) => {
|
|
58
|
-
const
|
|
59
|
-
if (first === 'ok') return finish(base);
|
|
73
|
+
const first = attempt(build(row, 0));
|
|
60
74
|
if (first === 'blocked') return undefined;
|
|
75
|
+
if (first !== 'crowded') return first;
|
|
61
76
|
for (let k = 1; k <= NUDGES; k++) {
|
|
62
77
|
for (const points of [...rowNudges(row,k).map(y=>build(y,0)), build(row,NUDGE*k), ...rowNudges(row,k).map(y=>build(y,NUDGE*k))]) {
|
|
63
|
-
|
|
78
|
+
const found = attempt(points, true);
|
|
79
|
+
if (typeof found !== 'string') return found;
|
|
64
80
|
}
|
|
65
81
|
}
|
|
66
|
-
crowdedFallback ??= finish(base);
|
|
67
82
|
return undefined;
|
|
68
83
|
};
|
|
69
84
|
const middleX=(start.x+end.x)/2, middleY=(start.y+end.y)/2;
|
|
70
85
|
const rowsByDistance=[...new Set([middleY,...ys])].sort((a,b)=>Math.abs(a-start.y)+Math.abs(a-end.y)-Math.abs(b-start.y)-Math.abs(b-end.y));
|
|
71
|
-
const rowCandidates=rowsByDistance.slice(0,12);
|
|
72
|
-
if (target.x <= source.x) {
|
|
73
|
-
const offset=(lane+1)*8;
|
|
74
|
-
for (const y of rowCandidates) {
|
|
75
|
-
const found=corridor((row,dx)=>{const sx=start.x+offset+dx,tx=end.x-offset-dx;return [start,{x:sx,y:start.y},{x:sx,y:row},{x:tx,y:row},{x:tx,y:end.y},end];},y);
|
|
76
|
-
if(found)return found;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
for(const [build,row] of [
|
|
80
|
-
[(_,dx)=>[start,{x:middleX+dx,y:start.y},{x:middleX+dx,y:end.y},end],middleY],
|
|
81
|
-
[(row)=>[start,{x:start.x,y:row},{x:end.x,y:row},end],middleY],
|
|
82
|
-
...rowCandidates.map(y=>[(row)=>[start,{x:start.x,y:row},{x:end.x,y:row},end],y]),
|
|
83
|
-
]){const found=corridor(build,row);if(found)return found;}
|
|
84
86
|
const right=xs.filter(x=>x>=start.x&&clear(start,{x,y:start.y},boxes)).sort((a,b)=>a-b);
|
|
85
87
|
const left=xs.filter(x=>x<=end.x&&clear({x,y:end.y},end,boxes)).sort((a,b)=>b-a);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const search = (rows, direct) => {
|
|
89
|
+
if (target.x <= source.x) {
|
|
90
|
+
const offset=(lane+1)*8;
|
|
91
|
+
for (const y of rows) {
|
|
92
|
+
const found=corridor((row,dx)=>{const sx=start.x+offset+dx,tx=end.x-offset-dx;return [start,{x:sx,y:start.y},{x:sx,y:row},{x:tx,y:row},{x:tx,y:end.y},end];},y);
|
|
93
|
+
if(found)return found;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for(const [build,row] of [
|
|
97
|
+
...(direct?[[(_,dx)=>[start,{x:middleX+dx,y:start.y},{x:middleX+dx,y:end.y},end],middleY],
|
|
98
|
+
[(row)=>[start,{x:start.x,y:row},{x:end.x,y:row},end],middleY]]:[]),
|
|
99
|
+
...rows.map(y=>[(row)=>[start,{x:start.x,y:row},{x:end.x,y:row},end],y]),
|
|
100
|
+
]){const found=corridor(build,row);if(found)return found;}
|
|
101
|
+
for(const y of rows){
|
|
102
|
+
const sx=right.find(x=>clear({x,y:start.y},{x,y},boxes));
|
|
103
|
+
const tx=left.find(x=>clear({x,y:end.y},{x,y},boxes));
|
|
104
|
+
if(sx!==undefined&&tx!==undefined){const found=corridor((row,dx)=>[start,{x:sx+dx,y:start.y},{x:sx+dx,y:row},{x:tx-dx,y:row},{x:tx-dx,y:end.y},end],y);if(found)return found;}
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
};
|
|
108
|
+
const near=search(rowsByDistance.slice(0,ROWS),true);
|
|
109
|
+
if(near)return near;
|
|
110
|
+
if(leastCrowded){
|
|
111
|
+
const wider=search(rowsByDistance.slice(ROWS,ROWS*2),false);
|
|
112
|
+
return wider||leastCrowded.route;
|
|
90
113
|
}
|
|
91
|
-
if(crowdedFallback)return crowdedFallback;
|
|
92
114
|
const key=(x,y,dir)=>`${x},${y},${dir}`, heuristic=(x,y)=>Math.abs(xs[x]-end.x)+Math.abs(ys[y]-end.y);
|
|
93
115
|
const heap=[];
|
|
94
116
|
function push(item){heap.push(item);let i=heap.length-1;while(i){const p=(i-1)>>1;if(heap[p].score<=item.score)break;heap[i]=heap[p];i=p;}heap[i]=item;}
|
|
@@ -117,11 +139,11 @@ globalThis.AndorraEdgeRouter = (() => {
|
|
|
117
139
|
return simplify(points);
|
|
118
140
|
}
|
|
119
141
|
function routeEdges(entries, rectangles) {
|
|
120
|
-
const occupied=[];
|
|
142
|
+
const occupied=lineIndex([]);
|
|
121
143
|
return entries.map((entry,index)=>{
|
|
122
144
|
if(!entry)return null;
|
|
123
145
|
const points=routeEdge(entry.source,entry.target,rectangles,index,undefined,occupied);
|
|
124
|
-
occupied
|
|
146
|
+
addLines(occupied,points);
|
|
125
147
|
return points;
|
|
126
148
|
});
|
|
127
149
|
}
|
|
@@ -152,5 +174,51 @@ globalThis.AndorraEdgeRouter = (() => {
|
|
|
152
174
|
}
|
|
153
175
|
return best||{x:(points[0].x+points.at(-1).x)/2,y:(points[0].y+points.at(-1).y)/2};
|
|
154
176
|
}
|
|
155
|
-
|
|
177
|
+
const LABEL_MARGIN = 4, LABEL_STOPS = [0.5, 0.3, 0.7, 0.15, 0.85];
|
|
178
|
+
function placeLabels(routes, widths, height, rectangles = []) {
|
|
179
|
+
const placed = [], touches = (a, b, margin) => a.x - margin < b.x + b.width && b.x - margin < a.x + a.width && a.y - margin < b.y + b.height && b.y - margin < a.y + a.height;
|
|
180
|
+
const segments = routes.map(points => {
|
|
181
|
+
const list = [];
|
|
182
|
+
if (points) for (let i = 1; i < points.length; i++) {
|
|
183
|
+
const a = points[i-1], b = points[i];
|
|
184
|
+
list.push({ x: Math.min(a.x,b.x), y: Math.min(a.y,b.y), width: Math.abs(b.x-a.x), height: Math.abs(b.y-a.y) });
|
|
185
|
+
}
|
|
186
|
+
return list;
|
|
187
|
+
});
|
|
188
|
+
return routes.map((points, index) => {
|
|
189
|
+
const width = widths[index];
|
|
190
|
+
if (!points || !width) return null;
|
|
191
|
+
const candidates = [], first = labelPoint(points);
|
|
192
|
+
const runs = [];
|
|
193
|
+
for (let i = 1; i < points.length; i++) {
|
|
194
|
+
const a = points[i-1], b = points[i], flat = a.y === b.y, length = flat ? Math.abs(b.x-a.x) : Math.abs(b.y-a.y);
|
|
195
|
+
if (length) runs.push({ a, b, flat, length, room: length - (flat ? width : height) - LABEL_MARGIN * 2 });
|
|
196
|
+
}
|
|
197
|
+
runs.sort((p, q) => Number(q.flat) - Number(p.flat) || q.length - p.length);
|
|
198
|
+
runs.forEach((run, rank) => {
|
|
199
|
+
for (const [order, stop] of (run.room > 0 ? LABEL_STOPS : [0.5]).entries()) {
|
|
200
|
+
const half = (run.flat ? width : height) / 2 + LABEL_MARGIN, low = Math.min(run.flat ? run.a.x : run.a.y, run.flat ? run.b.x : run.b.y);
|
|
201
|
+
const along = run.room > 0 ? Math.min(Math.max(low + run.length * stop, low + half), low + run.length - half) : low + run.length / 2;
|
|
202
|
+
const at = run.flat ? { x: along, y: run.a.y } : { x: run.a.x, y: along };
|
|
203
|
+
candidates.push({ at, cost: rank * 3 + order + (run.flat ? 0 : 4) + (run.room > 0 ? 0 : 6) });
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
if (!candidates.length) candidates.push({ at: first, cost: 0 });
|
|
207
|
+
let best;
|
|
208
|
+
for (const candidate of candidates) {
|
|
209
|
+
const box = { x: candidate.at.x - width / 2, y: candidate.at.y - height / 2, width, height };
|
|
210
|
+
let cost = candidate.cost;
|
|
211
|
+
for (const other of placed) if (touches(box, other, LABEL_MARGIN)) cost += 1000;
|
|
212
|
+
for (const card of rectangles) if (touches(box, card, 2)) cost += 1000;
|
|
213
|
+
if (!best || cost < best.cost) {
|
|
214
|
+
for (let other = 0; other < segments.length && cost < (best?.cost ?? Infinity); other++) if (other !== index) for (const segment of segments[other]) if (touches(box, segment, 2)) cost += 40;
|
|
215
|
+
if (!best || cost < best.cost) best = { cost, at: candidate.at, box };
|
|
216
|
+
}
|
|
217
|
+
if (best.cost === candidate.cost && best.at === candidate.at) break;
|
|
218
|
+
}
|
|
219
|
+
placed.push(best.box);
|
|
220
|
+
return best.at;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return {routeEdge,routeEdges,crowds,path,roundedPath,labelPoint,placeLabels,clear};
|
|
156
224
|
})();
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
.then(result => { status(result.error, true); return result; });
|
|
219
219
|
}
|
|
220
220
|
return requestExport({ type: 'andorra.graph.export', graphId }).then(result => {
|
|
221
|
-
if (result.ok && result.path) status(`Exported to ${result.path}
|
|
221
|
+
if (result.ok && result.path) status(`Exported to ${result.path}`, 'notice');
|
|
222
222
|
else status(result.error || 'The export failed.', true);
|
|
223
223
|
return result;
|
|
224
224
|
});
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
.then(result => { status(result.error, true); return result; });
|
|
230
230
|
}
|
|
231
231
|
return requestExport({ type: 'andorra.graph.agent.export', agentId }).then(result => {
|
|
232
|
-
if (result.ok && result.path) status(`Agent shared to ${result.path}
|
|
232
|
+
if (result.ok && result.path) status(`Agent shared to ${result.path}`, 'notice');
|
|
233
233
|
else status(result.error || 'The Agent could not be shared.', true);
|
|
234
234
|
return result;
|
|
235
235
|
});
|
|
@@ -30,6 +30,7 @@ globalThis.AndorraIcons = (() => {
|
|
|
30
30
|
magnet: '<path d="m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15"/><path d="m5 8 4 4"/><path d="m12 15 4 4"/>',
|
|
31
31
|
more: '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
|
|
32
32
|
'panel-right': '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/>',
|
|
33
|
+
'panel-left': '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',
|
|
33
34
|
flask: '<path d="M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"/><path d="M8.5 2h7"/><path d="M7 16h10"/>',
|
|
34
35
|
activity: '<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>',
|
|
35
36
|
copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Graph Editor · Andorra Code</title><link rel="icon" type="image/png" href="/andorra-logo.png"><link rel="stylesheet" href="/tokens.css"><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/library.css"><link rel="stylesheet" href="/studio.css"><link rel="stylesheet" href="/controls.css"><link rel="stylesheet" href="/manager.css"><script src="/theme.js"></script></head>
|
|
4
4
|
<body>
|
|
5
5
|
<aside class="rail" id="library-rail"><div id="rail-resize" role="separator" aria-label="Resize library sidebar" aria-orientation="vertical" aria-controls="library-rail" tabindex="0"></div><div class="rail-caption" aria-hidden="true"></div><div class="rail-body" tabindex="0" aria-label="Graph and step library"><div class="section-label">Your graphs <button id="new-graph" aria-label="Create graph" title="Create graph" data-icon="plus"></button></div><div class="rail-search"><input id="search" type="search" placeholder="Find a graph" aria-label="Find a graph"></div><nav id="graphs" aria-label="Graphs" tabindex="0"></nav><div class="section-label library-label">Step library</div><div class="rail-search"><input id="node-search" type="search" placeholder="Search steps…" aria-label="Search steps"></div><nav id="node-library" aria-label="Step library"></nav><p class="hint">Drag a step onto the canvas, or select it and press Enter to add it. Connect each outcome to one or more destinations.</p></div><footer class="rail-footer">Your account <span id="sync-status" role="status">Saved locally; cloud sync pending</span></footer></aside>
|
|
6
|
-
<main><header class="chrome"><div id="host-chrome" class="host-chrome" hidden></div><div class="graph-heading"><strong id="graph-title">Graph Editor</strong><span id="revision">Loading graphs…</span><span id="host-notice" class="chip chip-accent" role="status" hidden></span></div><div class="chrome-actions" id="chrome-actions"><button id="
|
|
6
|
+
<main><header class="chrome"><div id="host-chrome" class="host-chrome" hidden></div><button id="toggle-library" class="icon-button" type="button" aria-expanded="true" aria-controls="library-rail" aria-label="Library" title="Show or hide the library" data-icon="panel-left"></button><div class="graph-heading"><strong id="graph-title">Graph Editor</strong><span id="revision">Loading graphs…</span><span id="host-notice" class="chip chip-accent" role="status" hidden></span></div><div class="chrome-actions" id="chrome-actions"><div class="manager-anchor" hidden><button id="graph-manager" class="btn-small studio-secondary" type="button" aria-label="Graph Manager" aria-expanded="false" aria-controls="manager-panel" title="Build or change this graph with Graph Manager" data-icon="bot" hidden><span>Graph Manager</span></button><div id="manager-tip" class="manager-tip" role="note" hidden><span>Let Graph Manager build this graph with you.</span><button id="manager-tip-close" type="button" class="icon-button" aria-label="Dismiss" title="Dismiss" data-icon="x"></button></div></div><div class="menu" id="more-wrap"><button id="more" class="icon-button" aria-haspopup="menu" aria-expanded="false" aria-controls="more-menu" aria-label="More actions" title="More actions" data-icon="more"></button><div id="more-menu" class="menu-list" role="menu" aria-label="More actions" hidden><button id="duplicate" type="button" role="menuitem" data-icon="copy">Duplicate</button><button id="export" type="button" role="menuitem" data-icon="download">Export JSON</button></div></div><button id="toggle-inspector" class="icon-button" aria-expanded="true" aria-label="Inspector" title="Show or hide the inspector" data-icon="panel-right"></button><span id="save-state" class="save-state" hidden>Saved</span><button id="save" class="primary btn-small" hidden>Save</button></div></header><div class="workspace"><section id="canvas" aria-label="Graph canvas"><div id="scene"><svg id="edges" aria-label="Graph connections"></svg><div id="nodes"></div></div><div id="empty"><div class="empty-state"><span class="empty-state-icon" data-icon="graph"></span><p class="empty-state-title">No graph open</p><p class="empty-state-line">Create a graph to get started.</p><div class="empty-state-action"><button id="empty-create" type="button" class="primary btn-small">Create Graph</button></div></div></div><div id="canvas-hint" class="canvas-hint" role="note"><span id="canvas-hint-text">Drag or scroll to pan · Pinch or Ctrl/Cmd+scroll to zoom</span><button id="canvas-hint-close" type="button" class="icon-button" aria-label="Dismiss canvas tips" title="Dismiss" data-icon="x"></button></div><div class="canvas-toolbar" role="toolbar" aria-label="Canvas controls"><button id="undo" aria-label="Undo" title="Undo (Ctrl/Cmd+Z)" data-icon="undo"></button><button id="redo" aria-label="Redo" title="Redo (Ctrl/Cmd+Y)" data-icon="redo"></button><span class="toolbar-divider" aria-hidden="true"></span><button id="zoom-out" aria-label="Zoom out" title="Zoom out" data-icon="zoom-out"></button><output id="zoom" aria-label="Zoom level">100%</output><button id="zoom-in" aria-label="Zoom in" title="Zoom in" data-icon="zoom-in"></button><button id="fit" aria-label="Fit graph" title="Fit graph" data-icon="fit"></button><button id="layout" aria-label="Arrange" title="Arrange steps" data-icon="arrange"></button></div></section><aside id="inspector"><div id="resize" role="separator" aria-label="Resize inspector" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong id="inspector-title">Graph settings</strong><button id="graph-settings" class="btn-small" title="Show the graph's own settings">Graph Settings</button></header><div id="inspector-body"></div></aside><aside id="manager-panel" aria-label="Graph Manager" hidden><div id="manager-resize" role="separator" aria-label="Resize Graph Manager" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong>Graph Manager</strong><span class="manager-header-actions"><button id="manager-new-chat" type="button" class="btn-small" title="Start a new conversation. The current one stays in your history.">New Chat</button><button id="manager-close" type="button" class="icon-button" aria-label="Close Graph Manager" title="Close" data-icon="x"></button></span></header><div class="manager-models" id="manager-models"></div><div id="manager-notices"></div><div id="manager-transcript" role="log" aria-label="Graph Manager conversation" tabindex="0"></div><footer class="manager-composer"><textarea id="manager-input" rows="3" placeholder="Ask Graph Manager to build or change this graph" aria-label="Message Graph Manager"></textarea><div class="manager-composer-actions"><span id="manager-run-state" role="status"></span><button id="manager-stop" type="button" class="btn-small" hidden>Stop</button><button id="manager-send" type="button" class="primary btn-small">Send</button></div></footer></aside></div><span id="status" class="visually-hidden" role="status" aria-live="polite">Connecting to your workspace…</span><div id="toasts" class="toasts" aria-live="off"></div></main>
|
|
7
7
|
<script src="/compat.js" defer></script><script src="/icons.js" defer></script><script src="/controls.js" defer></script><script src="/skill-picker.js" defer></script><script src="/model-picker.js" defer></script><script src="/edge-router.js" defer></script><script src="/drafts.js" defer></script><script src="/app.js" defer></script><script src="/manager-markdown.js" defer></script><script src="/manager-state.js" defer></script><script src="/manager.js" defer></script><script src="/embed.js" defer></script><script src="/sidebar.js" defer></script><script src="/studio.js" defer></script><script src="/studio-canvas.js" defer></script></body></html>
|
|
@@ -132,7 +132,7 @@ button.manager-fold-head::after {
|
|
|
132
132
|
.manager-composer-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
|
|
133
133
|
#manager-run-state { flex: 1; min-width: 0; font-size: var(--type-xs); color: var(--text-3); }
|
|
134
134
|
|
|
135
|
-
@media (max-width:
|
|
135
|
+
@media (max-width: 1100px) {
|
|
136
136
|
#manager-panel { width: min(var(--manager-panel, 380px), 60%); }
|
|
137
137
|
.workspace.manager-open #inspector { right: min(var(--manager-panel, 380px), 60%); width: min(var(--panel), calc(40% - 24px)); }
|
|
138
138
|
}
|
|
@@ -412,7 +412,7 @@ globalThis.AndorraManager = (() => {
|
|
|
412
412
|
if (event.edit.kind === 'edge.remove') agentEdges.set(event.edit.edgeId, 'null');
|
|
413
413
|
if (event.edit.kind === 'graph') for (const [key, value] of Object.entries(event.edit.patch)) agentFields[key] = JSON.stringify(value);
|
|
414
414
|
if (!edit) {
|
|
415
|
-
if (kept.length) { sentCanvas = null; status('Graph Manager changed something you also edited; your own edits were kept.'); }
|
|
415
|
+
if (kept.length) { sentCanvas = null; status('Graph Manager changed something you also edited; your own edits were kept.', 'notice'); }
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
418
|
const trial = JSON.parse(JSON.stringify(graph));
|
|
@@ -446,7 +446,7 @@ globalThis.AndorraManager = (() => {
|
|
|
446
446
|
if (createdOffer?.id === event.graphId) createdOffer = null;
|
|
447
447
|
if (state.graph?.id !== event.graphId) return;
|
|
448
448
|
offeredRevision = null;
|
|
449
|
-
status('Graph Manager deleted this graph.');
|
|
449
|
+
status('Graph Manager deleted this graph.', 'notice');
|
|
450
450
|
}
|
|
451
451
|
async function openCreated(offer) {
|
|
452
452
|
if (!await openGraph(offer.id) || state.graph?.id !== offer.id) { renderNotices(); return; }
|
|
@@ -57,4 +57,34 @@
|
|
|
57
57
|
region.addEventListener('scroll', reveal, {passive:true});
|
|
58
58
|
region.addEventListener('wheel', reveal, {passive:true});
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
// Under 1100px the library collapses to the header's toggle and opens over the canvas until dismissed.
|
|
62
|
+
const toggle = document.getElementById('toggle-library');
|
|
63
|
+
const narrow = typeof matchMedia === 'function' ? matchMedia('(max-width: 1100px)') : undefined;
|
|
64
|
+
const body = document.body;
|
|
65
|
+
if (!toggle || !narrow || !body) return;
|
|
66
|
+
const embedded = !!window.parent && window.parent !== window;
|
|
67
|
+
let open = false;
|
|
68
|
+
const sync = () => {
|
|
69
|
+
const shown = !narrow.matches || open;
|
|
70
|
+
body.classList.toggle('library-collapsed', !shown);
|
|
71
|
+
body.classList.toggle('library-overlay', narrow.matches && open);
|
|
72
|
+
toggle.setAttribute('aria-expanded', String(shown));
|
|
73
|
+
};
|
|
74
|
+
const setOpen = next => { open = next; sync(); };
|
|
75
|
+
toggle.addEventListener('click', () => setOpen(!open));
|
|
76
|
+
if (typeof narrow.addEventListener === 'function') narrow.addEventListener('change', () => setOpen(false));
|
|
77
|
+
else narrow.addListener?.(() => setOpen(false));
|
|
78
|
+
document.addEventListener('pointerdown', event => {
|
|
79
|
+
if (open && narrow.matches && !rail.contains(event.target) && !toggle.contains(event.target) && !event.target?.closest?.('.graph-context, dialog')) setOpen(false);
|
|
80
|
+
}, true);
|
|
81
|
+
rail.addEventListener('click', event => { if (open && narrow.matches && event.target?.closest?.('.graph-row:not(.locked), .library-item:not(:disabled)')) setOpen(false); });
|
|
82
|
+
window.addEventListener('keydown', event => {
|
|
83
|
+
if (!narrow.matches || event.defaultPrevented) return;
|
|
84
|
+
if (event.key === 'Escape' && open && !document.querySelector?.('dialog[open]')) { setOpen(false); toggle.focus(); return; }
|
|
85
|
+
// Framed in the desktop app, Ctrl/Cmd+B belongs to the app's own sidebar (embed.js forwards it).
|
|
86
|
+
const typing = event.target?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])');
|
|
87
|
+
if (!embedded && !typing && (event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey && event.key?.toLowerCase() === 'b') { event.preventDefault(); setOpen(!open); }
|
|
88
|
+
});
|
|
89
|
+
sync();
|
|
60
90
|
})();
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
12
|
const svg = tag => document.createElementNS('http://www.w3.org/2000/svg', tag);
|
|
13
|
+
// The card footprint app.js uses, with its defaults where the canvas runs without it.
|
|
14
|
+
const CARD_WIDTH = typeof NODE_WIDTH === 'number' ? NODE_WIDTH : 210;
|
|
15
|
+
const cardHeight = node => (typeof nodeHeight === 'function' ? nodeHeight(node) : 68);
|
|
16
|
+
const MAP_WIDTH = 120, MAP_HEIGHT = 80;
|
|
17
|
+
// An SVG element has no hidden property; the attribute is what the stylesheet's [hidden] rule reads.
|
|
18
|
+
const showMap = (map, shown) => { if (map.hasAttribute?.('hidden') === shown) { if (shown) map.removeAttribute('hidden'); else map.setAttribute('hidden', ''); } };
|
|
13
19
|
let copied = null, pasteOffset = 0, viewport;
|
|
14
20
|
let snapButton;
|
|
15
21
|
try { state.studioSnap = localStorage.getItem('andorra-studio-snap') === 'true'; }
|
|
@@ -32,8 +38,8 @@
|
|
|
32
38
|
const positions = nodes.map(node => position(node, Object.keys(state.graph.nodes).indexOf(node.id)));
|
|
33
39
|
const x = Math.min(...positions.map(p => p.x)) - 20;
|
|
34
40
|
const y = Math.min(...positions.map(p => p.y)) - 37;
|
|
35
|
-
const w = Math.max(...positions.map(p => p.x +
|
|
36
|
-
const h = Math.max(...nodes.map((node, i) => positions[i].y +
|
|
41
|
+
const w = Math.max(...positions.map(p => p.x + CARD_WIDTH)) - x + 20;
|
|
42
|
+
const h = Math.max(...nodes.map((node, i) => positions[i].y + cardHeight(node))) - y + 20;
|
|
37
43
|
const box = make('div', undefined, 'studio-group');
|
|
38
44
|
Object.assign(box.style, { left: x + 'px', top: y + 'px', width: w + 'px', height: h + 'px' });
|
|
39
45
|
const title = make('button', group.name, 'studio-group-title');
|
|
@@ -61,19 +67,19 @@
|
|
|
61
67
|
if (!map) return;
|
|
62
68
|
map.replaceChildren();
|
|
63
69
|
const nodes = Object.values(state.graph?.nodes || {});
|
|
64
|
-
if (!nodes.length) return;
|
|
65
|
-
const points = nodes.map((n, i) => ({ ...position(n, i), h:
|
|
66
|
-
const minX = Math.min(...points.map(p => p.x)) - 100, maxX = Math.max(...points.map(p => p.x +
|
|
70
|
+
if (!nodes.length) { showMap(map, false); studio.viewport = undefined; viewport = undefined; return; }
|
|
71
|
+
const points = nodes.map((n, i) => ({ ...position(n, i), h: cardHeight(n) }));
|
|
72
|
+
const minX = Math.min(...points.map(p => p.x)) - 100, maxX = Math.max(...points.map(p => p.x + CARD_WIDTH)) + 100;
|
|
67
73
|
const minY = Math.min(...points.map(p => p.y)) - 100, maxY = Math.max(...points.map(p => p.y + p.h)) + 100;
|
|
68
74
|
const width = Math.max(1, maxX - minX), height = Math.max(1, maxY - minY);
|
|
69
|
-
const scale = Math.min(
|
|
70
|
-
const startX = (
|
|
75
|
+
const scale = Math.min(MAP_WIDTH / width, MAP_HEIGHT / height);
|
|
76
|
+
const startX = (MAP_WIDTH - width * scale) / 2, startY = (MAP_HEIGHT - height * scale) / 2;
|
|
71
77
|
const toMap = (x, y) => ({ x: startX + (x - minX) * scale, y: startY + (y - minY) * scale });
|
|
72
78
|
for (const [i, node] of nodes.entries()) {
|
|
73
79
|
const p = toMap(points[i].x, points[i].y);
|
|
74
80
|
const rect = svg('rect');
|
|
75
81
|
for (const [key, value] of Object.entries({
|
|
76
|
-
x: p.x, y: p.y, width: Math.max(4,
|
|
82
|
+
x: p.x, y: p.y, width: Math.max(4, CARD_WIDTH * scale),
|
|
77
83
|
height: Math.max(3, points[i].h * scale), rx: 2,
|
|
78
84
|
})) rect.setAttribute(key, String(value));
|
|
79
85
|
rect.setAttribute('class', node.type === 'end' ? 'studio-minimap-end' : 'studio-minimap-node');
|
|
@@ -85,6 +91,10 @@
|
|
|
85
91
|
studio.viewport = () => {
|
|
86
92
|
if (!viewport) return;
|
|
87
93
|
const canvas = byId('canvas');
|
|
94
|
+
// The minimap earns its place only while the graph runs past the visible canvas.
|
|
95
|
+
const inside = (minX + 100) * state.zoom + state.x >= 0 && (maxX - 100) * state.zoom + state.x <= canvas.clientWidth
|
|
96
|
+
&& (minY + 100) * state.zoom + state.y >= 0 && (maxY - 100) * state.zoom + state.y <= canvas.clientHeight;
|
|
97
|
+
showMap(map, !inside);
|
|
88
98
|
const left = -state.x / state.zoom, top = -state.y / state.zoom;
|
|
89
99
|
const start = toMap(left, top);
|
|
90
100
|
for (const [key, value] of Object.entries({
|
|
@@ -97,8 +107,8 @@
|
|
|
97
107
|
map.onclick = event => {
|
|
98
108
|
event.preventDefault(); event.stopPropagation();
|
|
99
109
|
const rect = map.getBoundingClientRect();
|
|
100
|
-
const centerX = minX + ((event.clientX - rect.left) * (
|
|
101
|
-
const centerY = minY + ((event.clientY - rect.top) * (
|
|
110
|
+
const centerX = minX + ((event.clientX - rect.left) * (MAP_WIDTH / rect.width) - startX) / scale;
|
|
111
|
+
const centerY = minY + ((event.clientY - rect.top) * (MAP_HEIGHT / rect.height) - startY) / scale;
|
|
102
112
|
state.x = byId('canvas').clientWidth / 2 - centerX * state.zoom;
|
|
103
113
|
state.y = byId('canvas').clientHeight / 2 - centerY * state.zoom;
|
|
104
114
|
transform();
|
|
@@ -174,7 +184,7 @@
|
|
|
174
184
|
}
|
|
175
185
|
if (!state.graph?.nodes[sourceId] || !outcomes(state.graph.nodes[sourceId]).includes(outcome)) return;
|
|
176
186
|
if (state.graph.edges.some(edge => edge.source === sourceId && edge.target === targetId && (edge.outcome || 'completed') === outcome)) {
|
|
177
|
-
status('This connection already exists. Click its line to edit it.'); return;
|
|
187
|
+
status('This connection already exists. Click its line to edit it.', 'notice'); return;
|
|
178
188
|
}
|
|
179
189
|
mutate(() => {
|
|
180
190
|
const edge = { id: 'edge-' + crypto.randomUUID().slice(0, 8), source: sourceId, target: targetId, outcome };
|
|
@@ -232,7 +242,7 @@
|
|
|
232
242
|
if (Math.abs(last.x - start.x) < 5 && Math.abs(last.y - start.y) < 5) return;
|
|
233
243
|
const picked = Object.values(state.graph?.nodes || {}).filter(node => {
|
|
234
244
|
const p = position(node, Object.keys(state.graph.nodes).indexOf(node.id));
|
|
235
|
-
return p.x < right && p.x +
|
|
245
|
+
return p.x < right && p.x + CARD_WIDTH > left && p.y < bottom && p.y + cardHeight(node) > top;
|
|
236
246
|
});
|
|
237
247
|
clearSelection();
|
|
238
248
|
state.selectedIds = picked.map(node => node.id); state.selected = state.selectedIds.at(-1) || null;
|
|
@@ -401,7 +411,7 @@
|
|
|
401
411
|
refreshSnap();
|
|
402
412
|
const canvas = byId('canvas');
|
|
403
413
|
const map = svg('svg');
|
|
404
|
-
map.id = 'studio-minimap'; map.setAttribute('viewBox',
|
|
414
|
+
map.id = 'studio-minimap'; map.setAttribute('viewBox', `0 0 ${MAP_WIDTH} ${MAP_HEIGHT}`); showMap(map, false);
|
|
405
415
|
map.setAttribute('role', 'img'); map.setAttribute('aria-label', 'Graph minimap. Click to center on an area.');
|
|
406
416
|
canvas.append(map);
|
|
407
417
|
}
|
|
@@ -418,4 +428,7 @@
|
|
|
418
428
|
marquee();
|
|
419
429
|
installKeyboard();
|
|
420
430
|
studio.canvas();
|
|
431
|
+
// Opening the inspector or the Graph Manager, or resizing the window, changes what fits: re-decide the minimap.
|
|
432
|
+
const canvasElement = byId('canvas');
|
|
433
|
+
if (canvasElement && typeof ResizeObserver === 'function') new ResizeObserver(() => studio.viewport?.()).observe(canvasElement);
|
|
421
434
|
})();
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/* Test, Runs and Graph Manager are quiet ghost actions; Save is the header's only filled button. */
|
|
2
|
+
.chrome-actions .studio-secondary {
|
|
3
|
+
gap: 6px; padding: 0 var(--space-2); background: transparent; color: var(--text-2);
|
|
4
|
+
font-size: var(--type-xs); font-weight: var(--weight-strong);
|
|
5
|
+
}
|
|
6
|
+
.chrome-actions .studio-secondary:hover:not(:disabled) { background: var(--hover); color: var(--text); }
|
|
7
|
+
.chrome-actions .studio-secondary:active:not(:disabled) { background: var(--pressed); }
|
|
8
|
+
.chrome-actions .studio-secondary > svg.icon { color: inherit; }
|
|
9
|
+
.studio-secondary:is([aria-pressed="true"], [aria-expanded="true"]) { background: var(--selected); color: var(--text); }
|
|
2
10
|
|
|
3
11
|
.studio-dialog {
|
|
4
12
|
width: min(620px, calc(100vw - 40px)); max-height: min(84dvh, 860px);
|
|
@@ -64,13 +72,13 @@
|
|
|
64
72
|
#canvas .studio-wire-preview { position: absolute; top: 0; left: 0; pointer-events: none; z-index: var(--z-raised); }
|
|
65
73
|
#canvas .studio-marquee { position: absolute; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-xs); pointer-events: none; z-index: var(--z-raised); }
|
|
66
74
|
|
|
75
|
+
/* Shown only while the graph runs past the canvas (studio-canvas.js); flat, like the canvas it maps. */
|
|
67
76
|
#studio-minimap {
|
|
68
|
-
position: absolute; bottom: var(--space-4); right: var(--space-4); width:
|
|
69
|
-
border: 1px solid var(--border); background: var(--bg-
|
|
70
|
-
|
|
77
|
+
position: absolute; bottom: var(--space-4); right: var(--space-4); width: 120px; height: 80px;
|
|
78
|
+
border: 1px solid var(--border); background: var(--bg-card-solid); border-radius: var(--radius-md);
|
|
79
|
+
z-index: var(--z-raised); cursor: crosshair; overflow: hidden;
|
|
71
80
|
}
|
|
72
|
-
#studio-minimap .studio-minimap-node { fill: var(--
|
|
73
|
-
#studio-minimap .studio-minimap-end { fill: var(--text-3); stroke: none; rx: 2px; opacity: .6; }
|
|
81
|
+
#studio-minimap :is(.studio-minimap-node, .studio-minimap-end) { fill: var(--text-3); stroke: none; rx: 2px; opacity: .4; }
|
|
74
82
|
#studio-minimap .studio-minimap-viewport { fill: transparent; fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--border-strong); stroke-width: 1; rx: 3px; vector-effect: non-scaling-stroke; pointer-events: none; }
|
|
75
83
|
|
|
76
84
|
.node.studio-node-preview { box-shadow: var(--lift-2), 0 0 0 2px var(--warn); }
|
|
@@ -88,7 +96,7 @@
|
|
|
88
96
|
.studio-run-head strong { display: none; }
|
|
89
97
|
}
|
|
90
98
|
@media (max-width: 760px) {
|
|
91
|
-
#studio-minimap { width:
|
|
99
|
+
#studio-minimap { width: 96px; height: 64px; right: 8px; bottom: 8px; }
|
|
92
100
|
.studio-run-panel { flex-basis: 180px; height: 180px; }
|
|
93
101
|
.studio-dialog-body { padding: var(--space-3); }
|
|
94
102
|
}
|
|
@@ -636,7 +636,9 @@
|
|
|
636
636
|
function initialize() {
|
|
637
637
|
const chrome = document.querySelector('.chrome');
|
|
638
638
|
if (!chrome) return;
|
|
639
|
-
|
|
639
|
+
// Test and Runs lead the quiet group of ghost actions, ahead of Graph Manager, "…" and the panel toggle.
|
|
640
|
+
const actions = $studio('chrome-actions'), menu = $studio('more-menu');
|
|
641
|
+
const lead = actions?.querySelector?.('.manager-anchor') || $studio('more-wrap') || $studio('toggle-inspector');
|
|
640
642
|
for (const [name, icon, handler, title] of [
|
|
641
643
|
['Test', 'flask', openTest, 'Preview routes with mock outcomes. Nothing runs.'],
|
|
642
644
|
['Runs', 'activity', async () => { await toggleDebugger(); refreshRunsButton(); }, 'Show or hide the run timeline'],
|
|
@@ -646,13 +648,18 @@
|
|
|
646
648
|
button.replaceChildren(element('span', name));
|
|
647
649
|
const mark = glyph(icon); if (mark) button.prepend(mark);
|
|
648
650
|
if (name === 'Runs') { runsButton = button; refreshRunsButton(); }
|
|
649
|
-
if (actions &&
|
|
651
|
+
if (actions && lead) actions.insertBefore(button, lead); else chrome.append(button);
|
|
650
652
|
}
|
|
651
653
|
if (menu) {
|
|
654
|
+
// Duplicate, Templates, Import, Export JSON, History: Export JSON is static markup so app.js can wire it first.
|
|
655
|
+
const exportItem = $studio('export');
|
|
652
656
|
for (const [name, icon, handler] of [
|
|
653
657
|
['Templates', 'template', openTemplates], ['Import', 'upload', openImport],
|
|
654
658
|
['History', 'history', openHistory],
|
|
655
|
-
])
|
|
659
|
+
]) {
|
|
660
|
+
const item = menuItem(name, icon, handler);
|
|
661
|
+
if (name !== 'History' && exportItem?.parentElement === menu) menu.insertBefore(item, exportItem); else menu.append(item);
|
|
662
|
+
}
|
|
656
663
|
installMenu();
|
|
657
664
|
}
|
|
658
665
|
|
|
@@ -671,7 +678,7 @@
|
|
|
671
678
|
head.append(select, action('Refresh', refreshRunList, 'btn-small'), action('Close', async () => { await toggleDebugger(); refreshRunsButton(); }, 'btn-small'), info);
|
|
672
679
|
const log = element('div', undefined, 'studio-run-log'); log.id = 'studio-run-log';
|
|
673
680
|
panel.append(head, log);
|
|
674
|
-
main.insertBefore(panel, main.querySelector('
|
|
681
|
+
main.insertBefore(panel, main.querySelector('#status'));
|
|
675
682
|
}
|
|
676
683
|
function heading() {
|
|
677
684
|
if (currentId() !== lastGraph) {
|