cladogram 0.5.5-beta.9 → 0.6.0-beta.10

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.
Files changed (56) hide show
  1. package/README.md +106 -80
  2. package/bin/clado.js +35 -3
  3. package/docs/agent-context.md +63 -0
  4. package/docs/agent-reference.md +219 -0
  5. package/docs/release.md +123 -0
  6. package/package.json +5 -3
  7. package/plugins/agent/index.js +2485 -2982
  8. package/plugins/agent/settings.js +3592 -0
  9. package/plugins/agent/style.css +1441 -1315
  10. package/plugins/brand/index.js +84 -466
  11. package/plugins/brand/style.css +39 -172
  12. package/plugins/directory/index.js +10 -10
  13. package/plugins/view-controls/index.js +6 -1
  14. package/plugins/view-controls/style.css +41 -30
  15. package/skills/clado/SKILL.md +4 -2
  16. package/src/agent/automations.js +454 -0
  17. package/src/agent/clado-tools.js +792 -0
  18. package/src/agent/pi-bridge.js +2559 -0
  19. package/src/agent/pi-config.js +2411 -0
  20. package/src/agent/pi-hooks-perms.js +621 -0
  21. package/src/html/app-css.js +69 -1
  22. package/src/html/canvas-chain.js +32 -6
  23. package/src/html/canvas-focus.js +19 -13
  24. package/src/html/canvas-live-diff.js +1373 -0
  25. package/src/html/canvas-ui.css +503 -2
  26. package/src/html/canvas-wires.js +5 -1
  27. package/src/html/page.js +4 -2
  28. package/src/html/plugin-assets.js +5 -1
  29. package/src/html/plugin-ui.css +159 -134
  30. package/src/html/plugin-ui.js +3 -2
  31. package/src/html/runtime-api.js +152 -10
  32. package/src/html/runtime.js +546 -37
  33. package/src/server/agent.js +862 -1566
  34. package/src/server/assets/library-canvas.js +256 -9
  35. package/src/server/assets/library.css +951 -11
  36. package/src/server/assets/library.html +39 -4
  37. package/src/server/assets/library.js +1445 -224
  38. package/src/server/code-inspect.js +183 -0
  39. package/src/server/mcp.js +90 -22
  40. package/src/server/plugin-registry.js +671 -9
  41. package/src/server/plugins.js +1 -1
  42. package/src/server/workspace-hub.js +50 -0
  43. package/src/server/workspace.js +554 -39
  44. package/src/workspace/graph-snapshot.js +695 -0
  45. package/src/workspace/service.js +201 -9
  46. package/src/agent/commands.js +0 -204
  47. package/src/agent/context.js +0 -445
  48. package/src/agent/executors.js +0 -213
  49. package/src/agent/mcp-client.js +0 -308
  50. package/src/agent/probe.js +0 -234
  51. package/src/agent/providers/anthropic.js +0 -220
  52. package/src/agent/providers/index.js +0 -235
  53. package/src/agent/providers/openai.js +0 -146
  54. package/src/agent/runtime.js +0 -995
  55. package/src/agent/sessions.js +0 -336
  56. package/src/agent/skills.js +0 -190
@@ -1,75 +1,98 @@
1
1
  :root {
2
- --clado-ui-text: #14171f;
3
- --clado-ui-muted: #5a6273;
4
- --clado-ui-subtle: #8790a2;
5
- --clado-ui-accent: #181a20;
6
- --clado-ui-brand: #2563eb;
7
- --clado-ui-brand-soft: rgb(37 99 235 / .11);
8
- --clado-ui-surface: rgb(255 255 255 / .30);
9
- --clado-ui-panel-surface: rgb(255 255 255 / .30);
10
- --clado-ui-well: rgb(255 255 255 / .18);
11
- --clado-ui-well-border: rgb(255 255 255 / .58);
12
- --clado-ui-well-focus: rgb(255 255 255 / .38);
13
- --clado-ui-track: rgb(255 255 255 / .14);
14
- --clado-ui-hover: rgb(255 255 255 / .26);
15
- --clado-ui-hover-border: rgb(255 255 255 / .64);
16
- --clado-ui-active: rgb(255 255 255 / .40);
17
- --clado-ui-active-shadow: 0 2px 10px rgb(15 23 42 / .08), 0 .5px 1px rgb(15 23 42 / .05), inset 0 1px 0 rgb(255 255 255 / .92);
18
- --clado-ui-popover: rgb(255 255 255 / .84);
19
- --clado-ui-solid: #f8f9fc;
20
- --clado-ui-edge: rgb(15 23 42 / .09);
21
- --clado-ui-highlight: rgb(255 255 255 / .94);
22
- --clado-ui-rim: rgb(255 255 255 / .46);
23
- --clado-ui-shadow: 0 10px 30px rgb(15 23 42 / .10), 0 2px 6px rgb(15 23 42 / .05);
24
- --clado-ui-glass-outline: rgb(255 255 255 / .78);
25
- --clado-ui-glass-outer: rgb(15 23 42 / .08);
26
- --clado-ui-glass-shadow: 0 18px 48px rgb(15 23 42 / .12), 0 3px 12px rgb(15 23 42 / .05), 0 0 0 .5px var(--clado-ui-glass-outer), inset 0 1px 0 var(--clado-ui-highlight), inset 0 0 20px rgb(255 255 255 / .18);
27
- --clado-ui-control-blur: 18px;
28
- --clado-ui-panel-blur: 18px;
29
- --clado-ui-radius: 16px;
2
+ --clado-ui-canvas-bg: #f6f8fc;
3
+ --clado-ui-dot-color: rgba(148, 163, 184, 0.30);
4
+ --clado-ui-text: #161b26;
5
+ --clado-ui-text-soft: #334155;
6
+ --clado-ui-muted: #64748b;
7
+ --clado-ui-subtle: #94a3b8;
8
+ --clado-ui-accent: #1e3a5f;
9
+ --clado-ui-brand: #0284c7;
10
+ --clado-ui-brand-soft: rgba(56, 189, 248, 0.14);
11
+ --clado-ui-surface: linear-gradient(155deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.36) 52%, rgba(244, 248, 255, 0.48) 100%);
12
+ --clado-ui-panel-surface: linear-gradient(155deg, rgba(255, 255, 255, 0.76) 0%, rgba(255, 255, 255, 0.42) 55%, rgba(244, 248, 255, 0.54) 100%);
13
+ --clado-ui-well: rgba(255, 255, 255, 0.34);
14
+ --clado-ui-well-border: rgba(255, 255, 255, 0.82);
15
+ --clado-ui-well-focus: rgba(255, 255, 255, 0.58);
16
+ --clado-ui-track: rgba(255, 255, 255, 0.24);
17
+ --clado-ui-hover: linear-gradient(135deg, rgba(224, 242, 254, 0.72), rgba(209, 250, 229, 0.52));
18
+ --clado-ui-hover-border: rgba(125, 211, 252, 0.82);
19
+ --clado-ui-active: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 255, 0.78));
20
+ --clado-ui-active-shadow: 0 3px 12px rgba(30, 41, 59, 0.09), 0 0 0 0.5px rgba(15, 23, 42, 0.05), inset 0 1px 0 #ffffff;
21
+ --clado-ui-prism-bg: linear-gradient(135deg, rgba(224, 242, 254, 0.86) 0%, rgba(232, 236, 255, 0.84) 55%, rgba(243, 232, 255, 0.78) 100%);
22
+ --clado-ui-prism-border: rgba(147, 197, 253, 0.90);
23
+ --clado-ui-prism-text: #1e3a5f;
24
+ --clado-ui-prism-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.16), 0 2px 5px -1px rgba(56, 189, 248, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.96);
25
+ --clado-ui-decision-bg: linear-gradient(155deg, rgba(255, 251, 235, 0.84), rgba(254, 243, 199, 0.46));
26
+ --clado-ui-decision-border: rgba(245, 158, 11, 0.44);
27
+ --clado-ui-decision-shadow: 0 12px 32px -10px rgba(245, 158, 11, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.88);
28
+ --clado-ui-popover: linear-gradient(160deg, rgba(255, 255, 255, 0.88) 0%, rgba(248, 250, 255, 0.76) 100%);
29
+ --clado-ui-solid: #f6f8fc;
30
+ --clado-ui-edge: rgba(15, 23, 42, 0.075);
31
+ --clado-ui-highlight: rgba(255, 255, 255, 0.96);
32
+ --clado-ui-rim: rgba(255, 255, 255, 0.52);
33
+ --clado-ui-shadow: 0 10px 28px -8px rgba(30, 41, 59, 0.10), 0 2px 6px -1px rgba(30, 41, 59, 0.04);
34
+ --clado-ui-glass-outline: rgba(255, 255, 255, 0.88);
35
+ --clado-ui-glass-outer: rgba(15, 23, 42, 0.065);
36
+ --clado-ui-glass-shadow: 0 20px 48px -14px rgba(30, 41, 59, 0.11), 0 4px 12px -2px rgba(30, 41, 59, 0.045), 0 0 0 0.5px var(--clado-ui-glass-outer), inset 0 1px 0.5px var(--clado-ui-highlight), inset 0 0 22px rgba(255, 255, 255, 0.32);
37
+ --clado-ui-control-blur: 22px;
38
+ --clado-ui-panel-blur: 24px;
39
+ --clado-ui-radius: 18px;
30
40
  --clado-ui-gap: 8px;
31
41
  }
32
42
  :root[data-theme="dark"] {
33
43
  color-scheme: dark;
34
- --clado-ui-text: #f3f6fb;
35
- --clado-ui-muted: #a4aec2;
36
- --clado-ui-subtle: #78839a;
37
- --clado-ui-accent: #f3f6fb;
38
- --clado-ui-brand: #60a5fa;
39
- --clado-ui-brand-soft: rgb(96 165 250 / .16);
40
- --clado-ui-surface: rgb(18 22 32 / .34);
41
- --clado-ui-panel-surface: rgb(18 22 32 / .34);
42
- --clado-ui-well: rgb(255 255 255 / .06);
43
- --clado-ui-well-border: rgb(255 255 255 / .14);
44
- --clado-ui-well-focus: rgb(255 255 255 / .11);
45
- --clado-ui-track: rgb(255 255 255 / .05);
46
- --clado-ui-hover: rgb(255 255 255 / .085);
47
- --clado-ui-hover-border: rgb(255 255 255 / .15);
48
- --clado-ui-active: rgb(255 255 255 / .14);
49
- --clado-ui-active-shadow: 0 2px 10px rgb(0 0 0 / .28), inset 0 1px 0 rgb(255 255 255 / .24);
50
- --clado-ui-popover: rgb(22 27 40 / .88);
51
- --clado-ui-solid: #181c26;
52
- --clado-ui-edge: rgb(255 255 255 / .10);
53
- --clado-ui-highlight: rgb(255 255 255 / .24);
54
- --clado-ui-rim: rgb(255 255 255 / .12);
55
- --clado-ui-shadow: 0 12px 34px rgb(0 0 0 / .44), 0 2px 8px rgb(0 0 0 / .24);
56
- --clado-ui-glass-outline: rgb(255 255 255 / .18);
57
- --clado-ui-glass-outer: rgb(0 0 0 / .46);
58
- --clado-ui-glass-shadow: 0 22px 56px rgb(0 0 0 / .56), 0 4px 14px rgb(0 0 0 / .30), 0 0 0 .5px var(--clado-ui-glass-outer), inset 0 1px 0 var(--clado-ui-highlight), inset 0 0 20px rgb(255 255 255 / .04);
59
- --clado-ui-control-blur: 18px;
60
- --clado-ui-panel-blur: 18px;
44
+ --clado-ui-canvas-bg: #0b0f18;
45
+ --clado-ui-dot-color: rgba(148, 163, 184, 0.14);
46
+ --clado-ui-text: #f1f5f9;
47
+ --clado-ui-text-soft: #cbd5e1;
48
+ --clado-ui-muted: #94a3b8;
49
+ --clado-ui-subtle: #64748b;
50
+ --clado-ui-accent: #eef6ff;
51
+ --clado-ui-brand: #38bdf8;
52
+ --clado-ui-brand-soft: rgba(56, 189, 248, 0.18);
53
+ --clado-ui-surface: linear-gradient(155deg, rgba(30, 38, 56, 0.56) 0%, rgba(17, 22, 34, 0.40) 55%, rgba(22, 28, 44, 0.48) 100%);
54
+ --clado-ui-panel-surface: linear-gradient(155deg, rgba(32, 41, 60, 0.66) 0%, rgba(17, 22, 34, 0.50) 100%);
55
+ --clado-ui-well: rgba(255, 255, 255, 0.045);
56
+ --clado-ui-well-border: rgba(255, 255, 255, 0.13);
57
+ --clado-ui-well-focus: rgba(255, 255, 255, 0.10);
58
+ --clado-ui-track: rgba(255, 255, 255, 0.05);
59
+ --clado-ui-hover: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(52, 211, 153, 0.14));
60
+ --clado-ui-hover-border: rgba(125, 211, 252, 0.45);
61
+ --clado-ui-active: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
62
+ --clado-ui-active-shadow: 0 3px 12px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.26);
63
+ --clado-ui-prism-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.26) 0%, rgba(129, 140, 248, 0.28) 55%, rgba(192, 132, 252, 0.24) 100%);
64
+ --clado-ui-prism-border: rgba(165, 180, 252, 0.48);
65
+ --clado-ui-prism-text: #eef6ff;
66
+ --clado-ui-prism-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.32);
67
+ --clado-ui-decision-bg: linear-gradient(155deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08));
68
+ --clado-ui-decision-border: rgba(251, 191, 36, 0.38);
69
+ --clado-ui-decision-shadow: 0 14px 36px -10px rgba(245, 158, 11, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
70
+ --clado-ui-popover: linear-gradient(160deg, rgba(24, 30, 46, 0.88) 0%, rgba(16, 21, 33, 0.80) 100%);
71
+ --clado-ui-solid: #0b0f18;
72
+ --clado-ui-edge: rgba(255, 255, 255, 0.09);
73
+ --clado-ui-highlight: rgba(255, 255, 255, 0.24);
74
+ --clado-ui-rim: rgba(255, 255, 255, 0.12);
75
+ --clado-ui-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.50), 0 2px 8px rgba(0, 0, 0, 0.26);
76
+ --clado-ui-glass-outline: rgba(255, 255, 255, 0.17);
77
+ --clado-ui-glass-outer: rgba(0, 0, 0, 0.50);
78
+ --clado-ui-glass-shadow: 0 24px 56px -14px rgba(0, 0, 0, 0.62), 0 4px 14px -2px rgba(0, 0, 0, 0.32), 0 0 0 0.5px var(--clado-ui-glass-outer), inset 0 1px 0.5px var(--clado-ui-highlight), inset 0 0 22px rgba(255, 255, 255, 0.035);
79
+ --clado-ui-control-blur: 22px;
80
+ --clado-ui-panel-blur: 24px;
61
81
  }
62
82
  .clado-plugin-slot {
63
83
  position: fixed;
64
84
  display: flex;
65
85
  gap: var(--clado-ui-gap);
66
- z-index: 18;
67
- font: 13px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
86
+ z-index: 28;
87
+ font: 13px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
68
88
  pointer-events: none;
69
89
  opacity: 1;
70
90
  transform: none;
71
91
  transition: opacity 160ms ease, transform 160ms ease;
72
92
  }
93
+ #clado-stage > .clado-plugin-slot {
94
+ position: absolute;
95
+ }
73
96
  .clado-plugin-slot.clado-slot-hidden {
74
97
  opacity: 0;
75
98
  transform: translateY(-4px) scale(.985);
@@ -81,27 +104,11 @@
81
104
  }
82
105
  .clado-plugin-slot[hidden], .clado-plugin-slot [hidden] { display: none !important; }
83
106
  .clado-plugin-slot > * { pointer-events: auto; }
84
- .clado-plugin-slot[data-slot="top-left"] { top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); max-width: calc(100vw - 250px); flex-direction: column; align-items: start; }
85
- .clado-plugin-slot[data-slot="top-right"] { top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); flex-direction: column; align-items: end; }
86
- .clado-plugin-slot[data-slot="bottom-left"] { bottom: max(16px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); align-items: end; }
87
- .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(14px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); flex-direction: column-reverse; align-items: end; z-index: 26; max-width: calc(100vw - 20px); }
88
- .clado-plugin-slot[data-slot="bottom-center"] { left: 10px; right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); justify-content: center; align-items: end; z-index: 26; }
89
- @media (max-width: 760px) {
90
- .clado-plugin-slot[data-slot="bottom-right"] {
91
- left: 10px;
92
- right: 10px;
93
- bottom: max(12px, env(safe-area-inset-bottom));
94
- max-width: calc(100vw - 20px);
95
- }
96
- body[data-agent-dock="open"] .clado-plugin-slot[data-slot="bottom-left"] {
97
- opacity: 0;
98
- transform: translateY(8px) scale(.96);
99
- pointer-events: none;
100
- }
101
- body[data-agent-dock="open"] .clado-plugin-slot[data-slot="bottom-left"] > * {
102
- pointer-events: none;
103
- }
104
- }
107
+ .clado-plugin-slot[data-slot="top-left"] { top: 14px; left: 16px; flex-direction: column; align-items: start; }
108
+ .clado-plugin-slot[data-slot="top-right"] { top: 14px; right: 16px; flex-direction: column; align-items: end; }
109
+ .clado-plugin-slot[data-slot="bottom-left"] { bottom: 16px; left: 16px; align-items: end; }
110
+ .clado-plugin-slot[data-slot="bottom-right"] { bottom: 16px; right: 16px; flex-direction: column-reverse; align-items: end; z-index: 34; }
111
+ .clado-plugin-slot[data-slot="bottom-center"] { left: 16px; right: 16px; bottom: 16px; justify-content: center; align-items: end; z-index: 32; }
105
112
  :where(.clado-ui-glass) {
106
113
  position: relative;
107
114
  z-index: 0;
@@ -110,28 +117,34 @@
110
117
  --clado-ui-glass-fill: var(--clado-ui-surface);
111
118
  --clado-ui-glass-blur: var(--clado-ui-control-blur);
112
119
  color: var(--clado-ui-text);
113
- background: var(--clado-ui-solid);
114
- border: 1px solid var(--clado-ui-edge);
120
+ background: var(--clado-ui-surface);
121
+ backdrop-filter: blur(var(--clado-ui-glass-blur)) saturate(190%) brightness(1.03);
122
+ -webkit-backdrop-filter: blur(var(--clado-ui-glass-blur)) saturate(190%) brightness(1.03);
123
+ border: 1px solid var(--clado-ui-glass-outline);
115
124
  border-radius: var(--clado-ui-radius);
116
- box-shadow: var(--clado-ui-shadow);
125
+ box-shadow: var(--clado-ui-glass-shadow);
117
126
  }
118
127
  .clado-ui-glass.clado-ui-glass-panel {
119
128
  --clado-ui-glass-fill: var(--clado-ui-panel-surface);
120
129
  --clado-ui-glass-blur: var(--clado-ui-panel-blur);
121
- border-radius: 20px;
130
+ border-radius: 22px;
122
131
  }
123
132
  .clado-ui-button {
124
133
  appearance: none;
125
134
  border: 1px solid transparent;
126
135
  background: transparent;
127
136
  color: var(--clado-ui-muted);
128
- border-radius: 10px;
137
+ border-radius: 999px;
129
138
  font: inherit;
130
139
  line-height: 1.15;
131
140
  min-height: 32px;
132
- padding: 5px 10px;
141
+ padding: 5px 11px;
133
142
  cursor: pointer;
134
143
  white-space: nowrap;
144
+ display: inline-flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ gap: 6px;
135
148
  transition: background 150ms cubic-bezier(.22,.75,.24,1), border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
136
149
  }
137
150
  .clado-ui-button:hover:where(:not(:disabled)) {
@@ -146,17 +159,18 @@
146
159
  box-shadow: var(--clado-ui-active-shadow);
147
160
  }
148
161
  .clado-ui-button.clado-ui-button-primary {
149
- background: var(--clado-ui-accent);
150
- border-color: transparent;
151
- color: var(--clado-ui-solid);
152
- font-weight: 600;
153
- box-shadow: 0 2px 10px rgb(15 23 42 / .14);
162
+ background: var(--clado-ui-prism-bg);
163
+ border: 1px solid var(--clado-ui-prism-border);
164
+ color: var(--clado-ui-prism-text);
165
+ font-weight: 590;
166
+ box-shadow: var(--clado-ui-prism-shadow);
154
167
  }
155
168
  .clado-ui-button.clado-ui-button-primary:hover:where(:not(:disabled)) {
156
- opacity: .9;
157
- background: var(--clado-ui-accent);
158
- color: var(--clado-ui-solid);
159
- border-color: transparent;
169
+ filter: brightness(1.03);
170
+ background: var(--clado-ui-prism-bg);
171
+ border-color: var(--clado-ui-prism-border);
172
+ color: var(--clado-ui-prism-text);
173
+ box-shadow: 0 10px 26px -6px rgba(99, 102, 241, 0.30), inset 0 1px 0 var(--clado-ui-highlight);
160
174
  }
161
175
  .clado-ui-button:focus-visible { outline: 2px solid var(--clado-ui-brand); outline-offset: 2px; }
162
176
  .clado-ui-button:disabled { opacity: .48; cursor: default; }
@@ -216,65 +230,52 @@
216
230
  }
217
231
  }
218
232
  }
219
- @media (max-width: 680px) {
220
- .clado-plugin-slot[data-slot="top-left"] { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); max-width: calc(100vw - 210px); }
221
- .clado-plugin-slot[data-slot="top-right"] { top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
222
- .clado-plugin-slot[data-slot="bottom-left"] { bottom: max(12px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); }
223
- .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
224
- }
233
+ body:not(:has(#clado-stage)) .clado-plugin-slot[data-slot="top-left"] { max-width: calc(100vw - 220px); }
225
234
 
226
- /* ============ 顶部悬浮多选汇总条(移动端严格视口居中收缩,零换行越界) ============ */
235
+ /* ============ 顶部悬浮多选汇总条(通透液态玻璃 + 棱镜主按钮) ============ */
227
236
  .clado-selection-bar {
228
- position: fixed;
229
- top: calc(max(12px, env(safe-area-inset-top)) + 52px);
230
- left: 10px;
231
- right: 10px;
237
+ position: absolute;
238
+ top: 64px;
239
+ left: 50%;
240
+ transform: translateX(-50%) translateY(-8px) scale(0.96);
232
241
  width: fit-content;
233
- max-width: min(480px, calc(100vw - 20px));
234
- margin: 0 auto;
242
+ max-width: min(640px, calc(100% - 32px));
235
243
  z-index: 32;
236
244
  min-height: 36px;
237
245
  border-radius: 999px;
238
- padding: 4px 6px 4px 12px;
246
+ padding: 5px 7px 5px 14px;
239
247
  display: flex;
240
248
  align-items: center;
241
- gap: 8px;
242
- font: 12px/1.3 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
249
+ gap: 7px;
250
+ font: 12px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
243
251
  color: var(--clado-ui-text);
244
- background: rgba(255, 255, 255, 0.36);
245
- backdrop-filter: blur(20px) saturate(185%) brightness(1.06);
246
- -webkit-backdrop-filter: blur(20px) saturate(185%) brightness(1.06);
247
- border: 1px solid rgba(255, 255, 255, 0.84);
248
- box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05), 0 0 0 0.5px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96);
252
+ background: var(--clado-ui-surface);
253
+ backdrop-filter: blur(22px) saturate(190%) brightness(1.04);
254
+ -webkit-backdrop-filter: blur(22px) saturate(190%) brightness(1.04);
255
+ border: 1px solid var(--clado-ui-glass-outline);
256
+ box-shadow: var(--clado-ui-glass-shadow);
249
257
  opacity: 0;
250
258
  pointer-events: none;
251
- transform: translateY(-8px) scale(0.96);
252
- transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
259
+ transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
253
260
  box-sizing: border-box;
254
261
  }
255
- :root[data-theme="dark"] .clado-selection-bar {
256
- background: rgba(20, 25, 36, 0.38);
257
- backdrop-filter: blur(20px) saturate(195%);
258
- -webkit-backdrop-filter: blur(20px) saturate(195%);
259
- border-color: rgba(255, 255, 255, 0.18);
260
- box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42), 0 0 0 0.5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
261
- }
262
262
  .clado-selection-bar.show {
263
263
  opacity: 1;
264
264
  pointer-events: auto;
265
- transform: translateY(0) scale(1);
265
+ transform: translateX(-50%) translateY(0) scale(1);
266
266
  }
267
267
  .clado-selection-dot {
268
268
  flex: 0 0 auto;
269
- width: 7px;
270
- height: 7px;
269
+ width: 6.5px;
270
+ height: 6.5px;
271
271
  border-radius: 999px;
272
- background: var(--clado-ui-brand);
272
+ background: #38bdf8;
273
+ box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
273
274
  }
274
275
  .clado-selection-text {
275
276
  flex: 1 1 auto;
276
277
  min-width: 0;
277
- font-weight: 600;
278
+ font-weight: 560;
278
279
  white-space: nowrap;
279
280
  overflow: hidden;
280
281
  text-overflow: ellipsis;
@@ -282,17 +283,41 @@
282
283
  .clado-selection-send {
283
284
  appearance: none;
284
285
  flex: 0 0 auto;
285
- height: 26px;
286
- border: 0;
287
- background: var(--clado-ui-brand);
288
- color: #fff;
286
+ height: 27px;
287
+ border: 1px solid var(--clado-ui-prism-border);
288
+ background: var(--clado-ui-prism-bg);
289
+ color: var(--clado-ui-prism-text);
290
+ box-shadow: var(--clado-ui-prism-shadow);
289
291
  font: inherit;
290
292
  font-size: 11.5px;
291
- font-weight: 600;
292
- padding: 0 10px;
293
+ font-weight: 590;
294
+ padding: 0 12px;
293
295
  border-radius: 999px;
294
296
  white-space: nowrap;
295
297
  cursor: pointer;
298
+ transition: filter 140ms ease, transform 120ms ease;
299
+ }
300
+ .clado-selection-send:hover { filter: brightness(1.03); }
301
+ .clado-selection-send:active { transform: scale(0.97); }
302
+ .clado-selection-secondary {
303
+ appearance: none;
304
+ flex: 0 0 auto;
305
+ height: 27px;
306
+ border: 1px solid var(--clado-ui-well-border);
307
+ background: var(--clado-ui-well);
308
+ color: var(--clado-ui-text-soft);
309
+ font: inherit;
310
+ font-size: 11.5px;
311
+ font-weight: 540;
312
+ padding: 0 11px;
313
+ border-radius: 999px;
314
+ white-space: nowrap;
315
+ cursor: pointer;
316
+ }
317
+ .clado-selection-secondary:hover {
318
+ background: var(--clado-ui-hover);
319
+ border-color: var(--clado-ui-hover-border);
320
+ color: var(--clado-ui-text);
296
321
  }
297
322
  .clado-selection-clear {
298
323
  appearance: none;
@@ -1,7 +1,8 @@
1
1
  (() => {
2
- function createHost(bridge, isEnabled = () => true) {
2
+ function createHost(bridge, isEnabled = () => true, mountRoot = null) {
3
3
  const slots = new Map();
4
4
  let hidden = false;
5
+ const hostRoot = () => mountRoot || document.getElementById?.('clado-stage') || document.body;
5
6
  return {
6
7
  capabilities(pluginId, mountId) {
7
8
  if (!bridge || !isEnabled(pluginId)) return undefined;
@@ -22,7 +23,7 @@
22
23
  region.setAttribute('aria-hidden', String(hidden));
23
24
  region.inert = hidden;
24
25
  slots.set(slot, region);
25
- document.body.append(region);
26
+ hostRoot().append(region);
26
27
  }
27
28
  const region = slots.get(slot);
28
29
  element.dataset.pluginId = pluginId;
@@ -59,7 +59,10 @@
59
59
  },
60
60
  captureView: function () {
61
61
  return { mode: document.body.dataset.mode, scale: scale, tx: tx, ty: ty,
62
- edges: Object.assign({}, openEdge), focusId: canvasFocusId,
62
+ edges: Object.assign({}, openEdge),
63
+ knownEdges: (DOC.edges || []).map(function (e) { return edgeKey(e[0], e[1]); }),
64
+ closedEdges: Object.assign({}, typeof userClosedEdge !== 'undefined' ? userClosedEdge : {}),
65
+ focusId: canvasFocusId,
63
66
  mindCards: Object.assign({}, MIND_CARD_STATE),
64
67
  cardPlacements: Object.assign({},CARD_PLACEMENTS),
65
68
  cards: Object.fromEntries(Object.keys(render.card).map(function(id){var el=render.card[id];return [id,{x:pos[id] && pos[id].x,y:pos[id] && pos[id].y,width:el.style.width,height:el.style.height}];})),
@@ -67,7 +70,31 @@
67
70
  },
68
71
  restoreView: function (view) {
69
72
  if (!view || view.mode !== document.body.dataset.mode) return;
70
- openEdge = Object.assign({}, view.edges);
73
+ var savedEdges = view.edges || {};
74
+ var closedMap = Object.assign({}, view.closedEdges || {});
75
+ var knownMap = null;
76
+ if (Array.isArray(view.knownEdges)) {
77
+ knownMap = {};
78
+ view.knownEdges.forEach(function (k) { knownMap[k] = 1; });
79
+ if (!view.closedEdges) {
80
+ view.knownEdges.forEach(function (k) {
81
+ if (!savedEdges[k]) closedMap[k] = 1;
82
+ });
83
+ }
84
+ }
85
+ openEdge = {};
86
+ if (typeof userClosedEdge !== 'undefined') userClosedEdge = {};
87
+ (DOC.edges || []).forEach(function (e) {
88
+ if (!Array.isArray(e) || e.length < 2) return;
89
+ var k = edgeKey(e[0], e[1]);
90
+ if (closedMap[k]) {
91
+ if (typeof userClosedEdge !== 'undefined') userClosedEdge[k] = 1;
92
+ return;
93
+ }
94
+ if (window.__CLADO_WORKSPACE_CHROME__ || savedEdges[k] || (knownMap && !knownMap[k])) {
95
+ openEdge[k] = 1;
96
+ }
97
+ });
71
98
  MIND_CARD_STATE = Object.assign({}, view.mindCards);
72
99
  CARD_PLACEMENTS = Object.assign({},view.cardPlacements);
73
100
  Object.keys(view.cards || {}).forEach(function(id){
@@ -88,7 +115,12 @@
88
115
  views: function () { return CladoViewRegistry.list(); },
89
116
  allEdges: function (open) {
90
117
  openEdge = {};
91
- if (open) DOC.edges.forEach(function (e) { openEdge[edgeKey(e[0], e[1])] = 1; });
118
+ if (typeof userClosedEdge !== 'undefined') userClosedEdge = {};
119
+ if (open) {
120
+ DOC.edges.forEach(function (e) { openEdge[edgeKey(e[0], e[1])] = 1; });
121
+ } else if (typeof userClosedEdge !== 'undefined') {
122
+ DOC.edges.forEach(function (e) { userClosedEdge[edgeKey(e[0], e[1])] = 1; });
123
+ }
92
124
  lastAnchor = null; lastPrev = null;
93
125
  applyVisibility(); layout(); fit(); repinPorts();
94
126
  return renderMermaid().then(afterMedia);
@@ -96,7 +128,25 @@
96
128
  whenMedia: function () { return renderMermaid().then(afterMedia); },
97
129
  highlightActivity: function (activity) {
98
130
  if (!activity) return;
99
- var cls = activity.kind === 'read' ? 'clado-ai-reading' : activity.kind === 'waiting' ? 'clado-ai-waiting' : 'clado-ai-touched';
131
+ if (window.__cladoAiHighlightTimer) clearTimeout(window.__cladoAiHighlightTimer);
132
+ $$('.clado-ai-touched, .clado-ai-reading, .clado-ai-waiting, .clado-ai-editing, .clado-ai-implementing').forEach(function (el) {
133
+ el.classList.remove('clado-ai-touched', 'clado-ai-reading', 'clado-ai-waiting', 'clado-ai-editing', 'clado-ai-implementing');
134
+ });
135
+ $$('.clado-card-edit-badge').forEach(function (el) { el.remove(); });
136
+ if (activity.kind === 'clear') {
137
+ var clearToast = document.getElementById('cladoAiToast');
138
+ if (clearToast) clearToast.classList.remove('open');
139
+ return;
140
+ }
141
+ var cls = activity.kind === 'editing'
142
+ ? 'clado-ai-editing'
143
+ : activity.kind === 'implementing'
144
+ ? 'clado-ai-implementing'
145
+ : activity.kind === 'read'
146
+ ? 'clado-ai-reading'
147
+ : activity.kind === 'waiting'
148
+ ? 'clado-ai-waiting'
149
+ : 'clado-ai-touched';
100
150
  var paths = Array.isArray(activity.nodes) ? activity.nodes : [];
101
151
  var records = Object.values(canvasRecords);
102
152
  var matched = [];
@@ -117,9 +167,11 @@
117
167
  });
118
168
  var mode = document.body.dataset.mode;
119
169
  var targets = [];
170
+ var editCards = new Set();
120
171
  matched.forEach(function (rec) {
121
172
  if (mode === 'cards') {
122
173
  var cardId = rec.card || rec.id;
174
+ if (render.card[cardId]) editCards.add(render.card[cardId]);
123
175
  if (rec.parent) {
124
176
  var sliceEl = $('#world .slice[data-id="' + rec.id + '"]');
125
177
  if (sliceEl) targets.push(sliceEl);
@@ -135,14 +187,23 @@
135
187
  if (sec) targets.push(sec);
136
188
  }
137
189
  });
138
- if (window.__cladoAiHighlightTimer) clearTimeout(window.__cladoAiHighlightTimer);
139
- $$('.clado-ai-touched, .clado-ai-reading, .clado-ai-waiting').forEach(function (el) {
140
- el.classList.remove('clado-ai-touched', 'clado-ai-reading', 'clado-ai-waiting');
141
- });
142
190
  targets.forEach(function (el) {
143
191
  void el.offsetWidth;
144
192
  el.classList.add(cls);
145
193
  });
194
+ if (activity.kind === 'editing' || activity.kind === 'implementing') {
195
+ var isImpl = activity.kind === 'implementing';
196
+ editCards.forEach(function (cardEl) {
197
+ cardEl.classList.add(isImpl ? 'clado-ai-implementing' : 'clado-ai-editing');
198
+ var bar = $('.bar', cardEl);
199
+ if (bar && !bar.querySelector('.clado-card-edit-badge')) {
200
+ var badge = document.createElement('span');
201
+ badge.className = 'clado-card-edit-badge' + (isImpl ? ' is-impl' : '');
202
+ badge.innerHTML = '<i class="dot" aria-hidden="true"></i>' + (isImpl ? '代码落地中…' : 'AI 编辑中…');
203
+ bar.appendChild(badge);
204
+ }
205
+ });
206
+ }
146
207
  function smoothPanTo(record) {
147
208
  if (!record) return;
148
209
  var curMode = document.body.dataset.mode;
@@ -202,6 +263,7 @@
202
263
  document.body.appendChild(toast);
203
264
  }
204
265
  toast.classList.toggle('waiting', activity.kind === 'waiting');
266
+ toast.classList.toggle('editing', activity.kind === 'editing' || activity.kind === 'implementing');
205
267
  toast.innerHTML = '<span class="dot" aria-hidden="true"></span><span>' + esc(String(activity.label)) + '</span>';
206
268
  toast.onclick = function () {
207
269
  if (matched[0]) smoothPanTo(matched[0]);
@@ -209,15 +271,95 @@
209
271
  };
210
272
  requestAnimationFrame(function () { toast.classList.add('open'); });
211
273
  }
212
- var ttl = activity.kind === 'waiting' ? 12000 : activity.kind === 'read' ? 2200 : 3200;
274
+ var ttl = activity.kind === 'editing' ? 15000 : activity.kind === 'implementing' ? 8000 : activity.kind === 'waiting' ? 12000 : activity.kind === 'read' ? 2200 : 3400;
213
275
  window.__cladoAiHighlightTimer = setTimeout(function () {
214
- targets.forEach(function (el) { el.classList.remove('clado-ai-touched', 'clado-ai-reading', 'clado-ai-waiting'); });
276
+ targets.forEach(function (el) { el.classList.remove('clado-ai-touched', 'clado-ai-reading', 'clado-ai-waiting', 'clado-ai-editing', 'clado-ai-implementing'); });
277
+ editCards.forEach(function (cardEl) {
278
+ cardEl.classList.remove('clado-ai-editing', 'clado-ai-implementing');
279
+ cardEl.querySelectorAll('.clado-card-edit-badge').forEach(function (b) { b.remove(); });
280
+ });
215
281
  var toast = document.getElementById('cladoAiToast');
216
282
  if (toast) toast.classList.remove('open');
217
283
  }, ttl);
218
284
  },
285
+ playLiveDiff: function (prevDoc, touch, follow) {
286
+ return typeof playCanvasLiveDiff === 'function' ? playCanvasLiveDiff(prevDoc, touch, follow) : { changedCount: 0 };
287
+ },
288
+ hotPatchDoc: function (nextDoc, diagnostics, nextVersion, touch, follow) {
289
+ return typeof hotPatchCanvasDoc === 'function' ? hotPatchCanvasDoc(nextDoc, diagnostics, nextVersion, touch, follow) : false;
290
+ },
291
+ setDraftCard: function (draft) {
292
+ if (typeof renderCanvasDraftGhost === 'function') renderCanvasDraftGhost(draft);
293
+ },
294
+ setCardPresence: function (ev) {
295
+ if (typeof cladoSetCardPresence === 'function') cladoSetCardPresence(ev);
296
+ },
297
+ syncCardPresence: function (entries) {
298
+ if (typeof cladoSyncCardPresenceSnapshot === 'function') cladoSyncCardPresenceSnapshot(entries);
299
+ },
300
+ armPresenceAfterglow: function () {
301
+ if (typeof cladoArmCanvasAfterglow === 'function') cladoArmCanvasAfterglow(false);
302
+ },
303
+ setPresenceConfig: function (cfg) {
304
+ if (typeof cladoSetPresenceConfig === 'function') cladoSetPresenceConfig(cfg);
305
+ },
306
+ startLinkPick: function (sourceSpec) {
307
+ if (typeof startCanvasLinkPick === 'function') startCanvasLinkPick(sourceSpec);
308
+ },
309
+ cancelLinkPick: function () {
310
+ if (typeof cancelCanvasLinkPick === 'function') cancelCanvasLinkPick();
311
+ },
312
+ focusTag: function (tagId) {
313
+ var clean = String(tagId || '').replace(/^#/, '').trim();
314
+ if (!clean) return false;
315
+ var tagEl = $('.clado-tag[data-tag-id="' + clean.replace(/"/g, '') + '"]');
316
+ if (!tagEl) return false;
317
+ var cardEl = tagEl.closest('.card');
318
+ var rec = cardEl && canvasRecords[cardEl.dataset.id];
319
+ if (rec) {
320
+ if (document.body.dataset.mode === 'cards' && !VIS[rec.card]) {
321
+ (DOC.edges || []).forEach(function (e) { openEdge[edgeKey(e[0], e[1])] = 1; });
322
+ applyVisibility();
323
+ layout();
324
+ repinPorts();
325
+ drawWires();
326
+ }
327
+ window.CladoRuntime.highlightActivity({ nodes: [rec.titlePath], kind: 'read', label: '定位锚点 #' + clean, forcePan: true });
328
+ }
329
+ tagEl.classList.add('clado-tag-pulse');
330
+ setTimeout(function () { tagEl.classList.remove('clado-tag-pulse'); }, 1500);
331
+ return true;
332
+ },
333
+ getCanvasEntities: function () {
334
+ var cards = [];
335
+ var sections = [];
336
+ Object.values(canvasRecords || {}).forEach(function (r) {
337
+ if (r.parent) sections.push({ title: r.title, path: r.titlePath.slice() });
338
+ else cards.push({ id: r.id, title: r.title, path: r.titlePath.slice() });
339
+ });
340
+ var tags = [];
341
+ $$('#world .clado-tag[data-tag-id]').forEach(function (t) {
342
+ if (t.dataset.tagId) tags.push({ id: t.dataset.tagId, text: (t.textContent || '').trim() });
343
+ });
344
+ return { cards: cards, sections: sections, tags: tags };
345
+ },
346
+ captureDocSnapshot: function () {
347
+ return typeof cladoCaptureDocSnapshot === 'function' ? cladoCaptureDocSnapshot(DOC) : null;
348
+ },
219
349
  focusNodePath: function (path, label) {
220
350
  if (!path || (Array.isArray(path) && !path.length)) return;
351
+ if (document.body.dataset.mode === 'cards') {
352
+ var recs = Object.values(canvasRecords || {});
353
+ var arr = Array.isArray(path) ? path : [path];
354
+ var match = recs.find(function (r) { return r.title === arr[0] || r.fullPath === arr.join('.'); });
355
+ if (match && !VIS[match.card]) {
356
+ (DOC.edges || []).forEach(function (e) { openEdge[edgeKey(e[0], e[1])] = 1; });
357
+ applyVisibility();
358
+ layout();
359
+ repinPorts();
360
+ drawWires();
361
+ }
362
+ }
221
363
  window.CladoRuntime.highlightActivity({
222
364
  nodes: [path],
223
365
  kind: 'read',