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.
- package/README.md +106 -80
- package/bin/clado.js +35 -3
- package/docs/agent-context.md +63 -0
- package/docs/agent-reference.md +219 -0
- package/docs/release.md +123 -0
- package/package.json +5 -3
- package/plugins/agent/index.js +2485 -2982
- package/plugins/agent/settings.js +3592 -0
- package/plugins/agent/style.css +1441 -1315
- package/plugins/brand/index.js +84 -466
- package/plugins/brand/style.css +39 -172
- package/plugins/directory/index.js +10 -10
- package/plugins/view-controls/index.js +6 -1
- package/plugins/view-controls/style.css +41 -30
- package/skills/clado/SKILL.md +4 -2
- package/src/agent/automations.js +454 -0
- package/src/agent/clado-tools.js +792 -0
- package/src/agent/pi-bridge.js +2559 -0
- package/src/agent/pi-config.js +2411 -0
- package/src/agent/pi-hooks-perms.js +621 -0
- package/src/html/app-css.js +69 -1
- package/src/html/canvas-chain.js +32 -6
- package/src/html/canvas-focus.js +19 -13
- package/src/html/canvas-live-diff.js +1373 -0
- package/src/html/canvas-ui.css +503 -2
- package/src/html/canvas-wires.js +5 -1
- package/src/html/page.js +4 -2
- package/src/html/plugin-assets.js +5 -1
- package/src/html/plugin-ui.css +159 -134
- package/src/html/plugin-ui.js +3 -2
- package/src/html/runtime-api.js +152 -10
- package/src/html/runtime.js +546 -37
- package/src/server/agent.js +862 -1566
- package/src/server/assets/library-canvas.js +256 -9
- package/src/server/assets/library.css +951 -11
- package/src/server/assets/library.html +39 -4
- package/src/server/assets/library.js +1445 -224
- package/src/server/code-inspect.js +183 -0
- package/src/server/mcp.js +90 -22
- package/src/server/plugin-registry.js +671 -9
- package/src/server/plugins.js +1 -1
- package/src/server/workspace-hub.js +50 -0
- package/src/server/workspace.js +554 -39
- package/src/workspace/graph-snapshot.js +695 -0
- package/src/workspace/service.js +201 -9
- package/src/agent/commands.js +0 -204
- package/src/agent/context.js +0 -445
- package/src/agent/executors.js +0 -213
- package/src/agent/mcp-client.js +0 -308
- package/src/agent/probe.js +0 -234
- package/src/agent/providers/anthropic.js +0 -220
- package/src/agent/providers/index.js +0 -235
- package/src/agent/providers/openai.js +0 -146
- package/src/agent/runtime.js +0 -995
- package/src/agent/sessions.js +0 -336
- package/src/agent/skills.js +0 -190
package/src/html/app-css.js
CHANGED
|
@@ -296,9 +296,77 @@ body.dragging, body.dragging *{user-select:none; -webkit-user-select:none}
|
|
|
296
296
|
.zoomable foreignObject{overflow:visible; text-align:center}
|
|
297
297
|
.zoomable foreignObject > div{text-align:center}
|
|
298
298
|
/* 代码块也点得开 —— 代码可能写得很长,塞在卡片里只能看个开头 */
|
|
299
|
-
.zoomable.zcode{padding:0; border:0; background:transparent; overflow:visible}
|
|
299
|
+
.zoomable.zcode{position:relative; padding:0; border:0; background:transparent; overflow:visible}
|
|
300
300
|
.zoomable.zcode pre{margin:0 !important}
|
|
301
301
|
.zoomable.zcode:hover pre{border-color:var(--accent)}
|
|
302
|
+
.zcode-preview-btn{
|
|
303
|
+
position:absolute; top:6px; right:6px; z-index:3;
|
|
304
|
+
appearance:none; border:1px solid var(--line-2); border-radius:6px;
|
|
305
|
+
background:color-mix(in srgb, var(--panel) 88%, transparent);
|
|
306
|
+
color:var(--fg-2); font:inherit; font-size:10.5px; font-weight:560;
|
|
307
|
+
padding:2px 7px; cursor:pointer; opacity:.82;
|
|
308
|
+
transition:opacity .12s, color .12s, border-color .12s, background-color .12s;
|
|
309
|
+
}
|
|
310
|
+
.zcode-preview-btn:hover{opacity:1; color:var(--accent); border-color:var(--accent); background:var(--panel)}
|
|
311
|
+
|
|
312
|
+
/* 富媒体块统一工具栏(SVG 矢量/动画、UI 原型沙盒、视频/音频交付件) */
|
|
313
|
+
.zblock-bar{
|
|
314
|
+
display:flex; align-items:center; justify-content:space-between; gap:8px;
|
|
315
|
+
padding:5px 8px; border-bottom:1px solid var(--line-2);
|
|
316
|
+
background:color-mix(in srgb, var(--panel) 84%, var(--bg));
|
|
317
|
+
font-size:10.5px; color:var(--fg-2); user-select:none;
|
|
318
|
+
}
|
|
319
|
+
.zblock-title{font-weight:600; letter-spacing:.01em; display:inline-flex; align-items:center; gap:5px}
|
|
320
|
+
.zblock-actions{display:inline-flex; align-items:center; gap:4px}
|
|
321
|
+
.zblock-btn{
|
|
322
|
+
appearance:none; border:1px solid transparent; border-radius:5px;
|
|
323
|
+
background:transparent; color:var(--fg-2); font:inherit; font-size:10.5px; font-weight:540;
|
|
324
|
+
padding:2px 6px; cursor:pointer; line-height:1.35;
|
|
325
|
+
transition:background-color .12s, color .12s, border-color .12s;
|
|
326
|
+
}
|
|
327
|
+
.zblock-btn:hover{background:var(--panel); color:var(--fg); border-color:var(--line-2)}
|
|
328
|
+
.zblock-btn.active{background:var(--accent-soft); color:var(--accent); border-color:color-mix(in srgb, var(--accent) 32%, transparent)}
|
|
329
|
+
|
|
330
|
+
.zoomable.zsvg{padding:0; background:var(--bg); cursor:default}
|
|
331
|
+
.zoomable.zsvg .zsvg-stage{padding:10px; cursor:zoom-in; background:var(--panel)}
|
|
332
|
+
.zoomable.zsvg .zsvg-stage svg{display:block; width:100%; height:auto; max-width:100%; margin:0 auto}
|
|
333
|
+
.zoomable.zsvg .zsvg-code{display:none; margin:0 !important; border:0 !important; border-radius:0 !important}
|
|
334
|
+
.zoomable.zsvg.is-code .zsvg-stage{display:none}
|
|
335
|
+
.zoomable.zsvg.is-code .zsvg-code{display:block}
|
|
336
|
+
|
|
337
|
+
.zoomable.zui{padding:0; background:var(--bg); cursor:default}
|
|
338
|
+
.zui-stage{padding:8px; background:var(--bg); display:flex; justify-content:center}
|
|
339
|
+
.zui-frame{
|
|
340
|
+
display:block; width:100%; height:260px; border:1px solid var(--line-2);
|
|
341
|
+
border-radius:7px; background:#fff; transition:width .18s ease, height .16s ease;
|
|
342
|
+
}
|
|
343
|
+
[data-theme="dark"] .zui-frame{background:#0f172a}
|
|
344
|
+
.zoomable.zui.is-mobile .zui-frame{width:375px; max-width:100%}
|
|
345
|
+
.zoomable.zui .zui-code{display:none; margin:0 !important; border:0 !important; border-radius:0 !important}
|
|
346
|
+
.zoomable.zui.is-code .zui-stage{display:none}
|
|
347
|
+
.zoomable.zui.is-code .zui-code{display:block}
|
|
348
|
+
#lensInner .zui-lens-frame{
|
|
349
|
+
display:block; width:min(960px, 84vw); height:min(640px, 76vh);
|
|
350
|
+
border:1px solid var(--line); border-radius:10px; background:#fff;
|
|
351
|
+
}
|
|
352
|
+
[data-theme="dark"] #lensInner .zui-lens-frame{background:#0f172a}
|
|
353
|
+
|
|
354
|
+
.zoomable.zimg{padding:0; background:var(--panel); cursor:zoom-in}
|
|
355
|
+
.zoomable.zimg img{display:block; width:100%; height:auto; max-width:100%; margin:0 auto}
|
|
356
|
+
.zoomable.zimg:hover{border-color:var(--accent)}
|
|
357
|
+
|
|
358
|
+
.zvideo,.zaudio{
|
|
359
|
+
margin-top:8px; border:1px solid var(--line-2); border-radius:8px;
|
|
360
|
+
overflow:hidden; background:var(--bg);
|
|
361
|
+
}
|
|
362
|
+
.zvideo video{display:block; width:100%; max-height:360px; background:#000}
|
|
363
|
+
.zaudio{padding:8px 10px}
|
|
364
|
+
.zaudio audio{display:block; width:100%; height:34px}
|
|
365
|
+
.zmedia-cap{
|
|
366
|
+
padding:5px 9px; font-size:11px; color:var(--fg-2);
|
|
367
|
+
border-top:1px solid var(--line-2); background:var(--panel);
|
|
368
|
+
}
|
|
369
|
+
.zaudio .zmedia-cap{border-top:0; padding:0 0 6px; background:transparent}
|
|
302
370
|
#lensInner .markdown-body{background:transparent}
|
|
303
371
|
#lensInner .markdown-body pre{
|
|
304
372
|
margin:0 !important; padding:2px 4px !important;
|
package/src/html/canvas-chain.js
CHANGED
|
@@ -63,7 +63,8 @@ function canvasChainDocument(subset, selected) {
|
|
|
63
63
|
var data = child.createElement('script');
|
|
64
64
|
var values = { __CLADO__: subset, __CLADO_CHAIN__: { id: selected, mode: mode }, __CLADO_LIVE__: true,
|
|
65
65
|
__CLADO_DIAGNOSTICS__: [], __CLADO_FILE__: window.__CLADO_FILE__ || '',
|
|
66
|
-
__CLADO_FILE_PATH__: window.__CLADO_FILE_PATH__ || '',
|
|
66
|
+
__CLADO_FILE_PATH__: window.__CLADO_FILE_PATH__ || '', __CLADO_WORKSPACE_ID__: window.__CLADO_WORKSPACE_ID__ || '',
|
|
67
|
+
__CLADO_RESOURCES__: window.__CLADO_RESOURCES__ || {}, __CLADO_OFFLINE__: !!window.__CLADO_OFFLINE__ };
|
|
67
68
|
data.textContent = Object.keys(values).map(function (key) { return 'window.' + key + '=' + JSON.stringify(values[key]).replace(/</g, '\\u003c').replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029') + ';'; }).join('\n');
|
|
68
69
|
child.body.appendChild(data);
|
|
69
70
|
[runtime, ui].forEach(function (source) { var script = child.createElement('script'); script.id = source.id; script.textContent = source.textContent; child.body.appendChild(script); });
|
|
@@ -114,8 +115,24 @@ function canvasChainPrepareTitles() {
|
|
|
114
115
|
title.title = window.__CLADO_CHAIN__ ? '双击或 Enter 聚焦' : '双击或 Enter 聚焦,长按或 Shift+Enter 查看独立链路';
|
|
115
116
|
});
|
|
116
117
|
}
|
|
118
|
+
function canvasChainHasContentMutation(records) {
|
|
119
|
+
for (var i = 0; i < records.length; i++) {
|
|
120
|
+
var t = records[i].target;
|
|
121
|
+
if (!t || !t.closest) continue;
|
|
122
|
+
if (t.id === 'wires' || t.id === 'mwires' || t.closest('#wires,#mwires,.port,.clado-obj')) continue;
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
var canvasChainPrepRaf = 0;
|
|
117
128
|
canvasChainPrepareTitles();
|
|
118
|
-
new MutationObserver(
|
|
129
|
+
new MutationObserver(function (records) {
|
|
130
|
+
if (!canvasChainHasContentMutation(records) || canvasChainPrepRaf) return;
|
|
131
|
+
canvasChainPrepRaf = requestAnimationFrame(function () {
|
|
132
|
+
canvasChainPrepRaf = 0;
|
|
133
|
+
canvasChainPrepareTitles();
|
|
134
|
+
});
|
|
135
|
+
}).observe($('#world'), { childList: true, subtree: true });
|
|
119
136
|
document.addEventListener('pointerdown', function (event) {
|
|
120
137
|
if (!event.isPrimary) { canvasChainCancelGesture(true); return; }
|
|
121
138
|
if (window.__CLADO_CHAIN__ || canvasChainIsOpen() || event.button !== 0) return;
|
|
@@ -185,6 +202,7 @@ if (window.__CLADO_CHAIN__) {
|
|
|
185
202
|
if (canvasRecords[id]) { flash(canvasRecords[id].card); canvasChainCenter(id); if (link.dataset.mediaPoint) canvasRevealMediaTarget(link, id); }
|
|
186
203
|
return;
|
|
187
204
|
}
|
|
205
|
+
if (event.target.closest('.zblock-btn:not([data-svg-zoom]):not([data-ui-zoom]),.zcode-preview-btn')) return;
|
|
188
206
|
if (event.target.closest('.zoomable,a')) { event.preventDefault(); event.stopImmediatePropagation(); }
|
|
189
207
|
}, true);
|
|
190
208
|
function chainCenter() { canvasSetFocus(canvasChainInitialId); canvasChainCenter(canvasChainInitialId); }
|
|
@@ -204,18 +222,26 @@ if (window.__CLADO_CHAIN__) {
|
|
|
204
222
|
tx = mx - (mx - tx) * next / scale; ty = my - (my - ty) * next / scale; scale = next; apply(); if (document.body.dataset.mode === 'mindmap') drawMindWires(); else drawWires();
|
|
205
223
|
}
|
|
206
224
|
function chainResources() {
|
|
207
|
-
$$('img[src]:not([data-chain-resource])').forEach(function (
|
|
208
|
-
var href =
|
|
225
|
+
$$('img[src]:not([data-chain-resource]),video[src]:not([data-chain-resource]),audio[src]:not([data-chain-resource])').forEach(function (el) {
|
|
226
|
+
var href = el.getAttribute('src'); if (!href || /^(?:[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(href) || !window.__CLADO_FILE_PATH__) return;
|
|
209
227
|
try {
|
|
210
228
|
var url = new URL(href, 'https://clado.local/documents/' + window.__CLADO_FILE_PATH__);
|
|
211
229
|
if (!url.pathname.startsWith('/documents/')) return;
|
|
212
230
|
var path = decodeURIComponent(url.pathname.slice('/documents/'.length)), resource = (window.__CLADO_RESOURCES__ || {})[path];
|
|
213
231
|
var workspace = window.__CLADO_WORKSPACE_ID__ ? '&workspace=' + encodeURIComponent(window.__CLADO_WORKSPACE_ID__) : '';
|
|
214
|
-
if (resource || !window.__CLADO_OFFLINE__) {
|
|
232
|
+
if (resource || !window.__CLADO_OFFLINE__) { el.src = resource || '/library/resource?file=' + encodeURIComponent(path) + workspace; el.dataset.chainResource = '1'; }
|
|
215
233
|
} catch (_) {}
|
|
216
234
|
});
|
|
217
235
|
}
|
|
218
|
-
|
|
236
|
+
var chainResRaf = 0;
|
|
237
|
+
chainResources();
|
|
238
|
+
new MutationObserver(function (records) {
|
|
239
|
+
if (!canvasChainHasContentMutation(records) || chainResRaf) return;
|
|
240
|
+
chainResRaf = requestAnimationFrame(function () {
|
|
241
|
+
chainResRaf = 0;
|
|
242
|
+
chainResources();
|
|
243
|
+
});
|
|
244
|
+
}).observe($('#world'), { childList: true, subtree: true });
|
|
219
245
|
// 弹窗对提取出的卡片重新排布。
|
|
220
246
|
if (document.body.dataset.mode === 'cards') {
|
|
221
247
|
openEdge = {}; DOC.edges.forEach(function (edge) { openEdge[edgeKey(edge[0], edge[1])] = 1; });
|
package/src/html/canvas-focus.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// 三视图共用内容 ID、聚焦范围与标题手势。
|
|
2
2
|
var canvasRecords = {}, canvasDocPaths = {}, canvasMindPaths = {}, canvasFocusId = null;
|
|
3
|
-
|
|
3
|
+
var canvasOut = {}, canvasIn = {};
|
|
4
|
+
function canvasRebuildFocusIndex() {
|
|
5
|
+
canvasRecords = {};
|
|
6
|
+
canvasDocPaths = {};
|
|
7
|
+
canvasMindPaths = {};
|
|
8
|
+
canvasOut = {};
|
|
9
|
+
canvasIn = {};
|
|
4
10
|
function add(n, docPath, parent, card) {
|
|
5
11
|
var r = { id: n.id, title: n.title, markdown: n.md, parent: parent, card: card, docPath: docPath, mindPath: '0.' + docPath, kids: [] };
|
|
6
12
|
r.titlePath = parent ? canvasRecords[parent].titlePath.concat(n.title) : [n.title];
|
|
@@ -9,19 +15,19 @@ var canvasRecords = {}, canvasDocPaths = {}, canvasMindPaths = {}, canvasFocusId
|
|
|
9
15
|
(n.nodes || n.kids || []).forEach(function (child, i) { r.kids.push(child.id); add(child, docPath + '.' + i, r.id, card); });
|
|
10
16
|
}
|
|
11
17
|
DOC.cards.forEach(function (card, i) { add(card, String(i), null, card.id); });
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
$$('
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(canvasIn[target.id] || (canvasIn[target.id] = new Set())).add(source.id);
|
|
18
|
+
$$('#article .slice[data-path]').forEach(function (section) {
|
|
19
|
+
var source = canvasDocPaths[section.dataset.path]; if (!source) return;
|
|
20
|
+
$$('a.edge', section).forEach(function (link) {
|
|
21
|
+
var target = canvasRecords[link.dataset.edge]; if (!target) return;
|
|
22
|
+
if (link.dataset.anchorId) target = canvasRecords[link.dataset.anchorId] || target;
|
|
23
|
+
else if (link.dataset.anchor) target = Object.values(canvasRecords).find(function (r) { return r.card === target.card && r.title === link.dataset.anchor; }) || target;
|
|
24
|
+
if (source.id === target.id) return;
|
|
25
|
+
(canvasOut[source.id] || (canvasOut[source.id] = new Set())).add(target.id);
|
|
26
|
+
(canvasIn[target.id] || (canvasIn[target.id] = new Set())).add(source.id);
|
|
27
|
+
});
|
|
23
28
|
});
|
|
24
|
-
}
|
|
29
|
+
}
|
|
30
|
+
canvasRebuildFocusIndex();
|
|
25
31
|
function canvasFocusSet(selected) {
|
|
26
32
|
if (!selected) return null;
|
|
27
33
|
if (selected === '__document') return new Set(Object.keys(canvasRecords));
|