aifastdb-devplan 1.5.0 → 1.6.2

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 (121) hide show
  1. package/dist/autopilot.d.ts +58 -0
  2. package/dist/autopilot.d.ts.map +1 -0
  3. package/dist/autopilot.js +250 -0
  4. package/dist/autopilot.js.map +1 -0
  5. package/dist/dev-plan-document-store.d.ts +15 -1
  6. package/dist/dev-plan-document-store.d.ts.map +1 -1
  7. package/dist/dev-plan-document-store.js +122 -0
  8. package/dist/dev-plan-document-store.js.map +1 -1
  9. package/dist/dev-plan-factory.d.ts +69 -3
  10. package/dist/dev-plan-factory.d.ts.map +1 -1
  11. package/dist/dev-plan-factory.js +113 -19
  12. package/dist/dev-plan-factory.js.map +1 -1
  13. package/dist/dev-plan-graph-store.d.ts +79 -1
  14. package/dist/dev-plan-graph-store.d.ts.map +1 -1
  15. package/dist/dev-plan-graph-store.js +420 -3
  16. package/dist/dev-plan-graph-store.js.map +1 -1
  17. package/dist/dev-plan-interface.d.ts +24 -1
  18. package/dist/dev-plan-interface.d.ts.map +1 -1
  19. package/dist/dev-plan-migrate.d.ts +1 -0
  20. package/dist/dev-plan-migrate.d.ts.map +1 -1
  21. package/dist/dev-plan-migrate.js +28 -2
  22. package/dist/dev-plan-migrate.js.map +1 -1
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +14 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/mcp-server/index.d.ts +3 -0
  28. package/dist/mcp-server/index.d.ts.map +1 -1
  29. package/dist/mcp-server/index.js +397 -4
  30. package/dist/mcp-server/index.js.map +1 -1
  31. package/dist/types.d.ts +160 -1
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/types.js +9 -1
  34. package/dist/types.js.map +1 -1
  35. package/dist/visualize/graph-canvas/api-compat.d.ts +20 -0
  36. package/dist/visualize/graph-canvas/api-compat.d.ts.map +1 -0
  37. package/dist/visualize/graph-canvas/api-compat.js +344 -0
  38. package/dist/visualize/graph-canvas/api-compat.js.map +1 -0
  39. package/dist/visualize/graph-canvas/clusterer.d.ts +16 -0
  40. package/dist/visualize/graph-canvas/clusterer.d.ts.map +1 -0
  41. package/dist/visualize/graph-canvas/clusterer.js +460 -0
  42. package/dist/visualize/graph-canvas/clusterer.js.map +1 -0
  43. package/dist/visualize/graph-canvas/core.d.ts +11 -0
  44. package/dist/visualize/graph-canvas/core.d.ts.map +1 -0
  45. package/dist/visualize/graph-canvas/core.js +1136 -0
  46. package/dist/visualize/graph-canvas/core.js.map +1 -0
  47. package/dist/visualize/graph-canvas/index.d.ts +22 -0
  48. package/dist/visualize/graph-canvas/index.d.ts.map +1 -0
  49. package/dist/visualize/graph-canvas/index.js +69 -0
  50. package/dist/visualize/graph-canvas/index.js.map +1 -0
  51. package/dist/visualize/graph-canvas/interaction.d.ts +13 -0
  52. package/dist/visualize/graph-canvas/interaction.d.ts.map +1 -0
  53. package/dist/visualize/graph-canvas/interaction.js +457 -0
  54. package/dist/visualize/graph-canvas/interaction.js.map +1 -0
  55. package/dist/visualize/graph-canvas/layout-worker.d.ts +17 -0
  56. package/dist/visualize/graph-canvas/layout-worker.d.ts.map +1 -0
  57. package/dist/visualize/graph-canvas/layout-worker.js +577 -0
  58. package/dist/visualize/graph-canvas/layout-worker.js.map +1 -0
  59. package/dist/visualize/graph-canvas/lod.d.ts +10 -0
  60. package/dist/visualize/graph-canvas/lod.d.ts.map +1 -0
  61. package/dist/visualize/graph-canvas/lod.js +111 -0
  62. package/dist/visualize/graph-canvas/lod.js.map +1 -0
  63. package/dist/visualize/graph-canvas/renderer.d.ts +12 -0
  64. package/dist/visualize/graph-canvas/renderer.d.ts.map +1 -0
  65. package/dist/visualize/graph-canvas/renderer.js +813 -0
  66. package/dist/visualize/graph-canvas/renderer.js.map +1 -0
  67. package/dist/visualize/graph-canvas/spatial-index.d.ts +13 -0
  68. package/dist/visualize/graph-canvas/spatial-index.d.ts.map +1 -0
  69. package/dist/visualize/graph-canvas/spatial-index.js +482 -0
  70. package/dist/visualize/graph-canvas/spatial-index.js.map +1 -0
  71. package/dist/visualize/graph-canvas/styles.d.ts +11 -0
  72. package/dist/visualize/graph-canvas/styles.d.ts.map +1 -0
  73. package/dist/visualize/graph-canvas/styles.js +152 -0
  74. package/dist/visualize/graph-canvas/styles.js.map +1 -0
  75. package/dist/visualize/graph-canvas/viewport.d.ts +17 -0
  76. package/dist/visualize/graph-canvas/viewport.d.ts.map +1 -0
  77. package/dist/visualize/graph-canvas/viewport.js +385 -0
  78. package/dist/visualize/graph-canvas/viewport.js.map +1 -0
  79. package/dist/visualize/server.js +737 -7
  80. package/dist/visualize/server.js.map +1 -1
  81. package/dist/visualize/template-core.d.ts +9 -0
  82. package/dist/visualize/template-core.d.ts.map +1 -0
  83. package/dist/visualize/template-core.js +714 -0
  84. package/dist/visualize/template-core.js.map +1 -0
  85. package/dist/visualize/template-data-loading.d.ts +7 -0
  86. package/dist/visualize/template-data-loading.d.ts.map +1 -0
  87. package/dist/visualize/template-data-loading.js +677 -0
  88. package/dist/visualize/template-data-loading.js.map +1 -0
  89. package/dist/visualize/template-detail-panel.d.ts +14 -0
  90. package/dist/visualize/template-detail-panel.d.ts.map +1 -0
  91. package/dist/visualize/template-detail-panel.js +553 -0
  92. package/dist/visualize/template-detail-panel.js.map +1 -0
  93. package/dist/visualize/template-graph-3d.d.ts +7 -0
  94. package/dist/visualize/template-graph-3d.d.ts.map +1 -0
  95. package/dist/visualize/template-graph-3d.js +1112 -0
  96. package/dist/visualize/template-graph-3d.js.map +1 -0
  97. package/dist/visualize/template-graph-vis.d.ts +8 -0
  98. package/dist/visualize/template-graph-vis.d.ts.map +1 -0
  99. package/dist/visualize/template-graph-vis.js +1204 -0
  100. package/dist/visualize/template-graph-vis.js.map +1 -0
  101. package/dist/visualize/template-html.d.ts +9 -0
  102. package/dist/visualize/template-html.d.ts.map +1 -0
  103. package/dist/visualize/template-html.js +484 -0
  104. package/dist/visualize/template-html.js.map +1 -0
  105. package/dist/visualize/template-pages.d.ts +7 -0
  106. package/dist/visualize/template-pages.d.ts.map +1 -0
  107. package/dist/visualize/template-pages.js +806 -0
  108. package/dist/visualize/template-pages.js.map +1 -0
  109. package/dist/visualize/template-stats-modal.d.ts +7 -0
  110. package/dist/visualize/template-stats-modal.d.ts.map +1 -0
  111. package/dist/visualize/template-stats-modal.js +406 -0
  112. package/dist/visualize/template-stats-modal.js.map +1 -0
  113. package/dist/visualize/template-styles.d.ts +9 -0
  114. package/dist/visualize/template-styles.d.ts.map +1 -0
  115. package/dist/visualize/template-styles.js +487 -0
  116. package/dist/visualize/template-styles.js.map +1 -0
  117. package/dist/visualize/template.d.ts +14 -3
  118. package/dist/visualize/template.d.ts.map +1 -1
  119. package/dist/visualize/template.js +38 -2889
  120. package/dist/visualize/template.js.map +1 -1
  121. package/package.json +1 -1
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ /**
3
+ * DevPlanGraph — vis-network API 兼容层
4
+ *
5
+ * 提供与 vis-network 兼容的 API 接口,使 template.ts 可以
6
+ * 无缝切换到 GraphCanvas 引擎,最小化集成工作。
7
+ *
8
+ * 主要兼容方法:
9
+ * - constructor(container, data, options) — 初始化
10
+ * - on(event, callback) — 事件绑定
11
+ * - fit(options) — 自适应视口
12
+ * - getPositions(nodeIds) — 获取节点位置
13
+ * - moveNode(id, x, y) — 移动节点
14
+ * - getConnectedEdges(id) — 获取关联边
15
+ * - getConnectedNodes(id) — 获取关联节点
16
+ * - canvasToDOM(pos) — 坐标转换
17
+ * - redraw() — 强制重绘
18
+ * - destroy() — 销毁
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.getApiCompatScript = getApiCompatScript;
22
+ function getApiCompatScript() {
23
+ return `
24
+ // ============================================================================
25
+ // DevPlanGraph — vis-network API Compatibility Layer
26
+ // ============================================================================
27
+
28
+ /**
29
+ * DevPlanGraph — Drop-in replacement for vis.Network.
30
+ *
31
+ * @param {HTMLElement} container
32
+ * @param {{ nodes: Array, edges: Array }} data
33
+ * @param {Object} options — vis-network style options (adapted)
34
+ */
35
+ function DevPlanGraph(container, data, options) {
36
+ var opts = options || {};
37
+
38
+ // Parse vis-network options into GraphCanvas options
39
+ var gcOptions = {
40
+ backgroundColor: '#111827',
41
+ debugMode: opts.debugMode || false,
42
+ };
43
+
44
+ // Create the underlying GraphCanvas engine
45
+ this._gc = new GraphCanvas(container, gcOptions);
46
+ this._container = container;
47
+ this._stabilized = false;
48
+
49
+ // ── Store references for compatibility ──
50
+ this._nodesDataSet = data.nodes || [];
51
+ this._edgesDataSet = data.edges || [];
52
+
53
+ // Convert DataSet-style arrays to plain arrays if needed
54
+ var nodesArray = Array.isArray(this._nodesDataSet) ? this._nodesDataSet :
55
+ (this._nodesDataSet.get ? this._nodesDataSet.get() : []);
56
+ var edgesArray = Array.isArray(this._edgesDataSet) ? this._edgesDataSet :
57
+ (this._edgesDataSet.get ? this._edgesDataSet.get() : []);
58
+
59
+ // Load data
60
+ this._gc.setData({ nodes: nodesArray, edges: edgesArray });
61
+
62
+ // ── Start layout ──
63
+ this._gc._layoutEngine = new LayoutEngine(this._gc);
64
+ var self = this;
65
+ this._gc._layoutEngine._onStabilized = function() {
66
+ self._stabilized = true;
67
+ self._gc._emit('stabilizationIterationsDone', {});
68
+ };
69
+
70
+ // Extract physics params from vis-network-style options
71
+ var fa2 = (opts.physics && opts.physics.forceAtlas2Based) || {};
72
+ var stab = (opts.physics && opts.physics.stabilization) || {};
73
+
74
+ // GraphCanvas runs layout in a Web Worker (non-blocking), so we can
75
+ // afford 3x more iterations than vis-network for better convergence.
76
+ var visIterations = stab.iterations || 200;
77
+ var gcIterations = Math.max(visIterations * 3, 500);
78
+
79
+ // Stronger gravity for GraphCanvas to keep the graph compact
80
+ var baseGravity = fa2.centralGravity || 0.015;
81
+ var gcGravity = baseGravity * 1.5;
82
+
83
+ this._gc._layoutEngine.start({
84
+ gravity: gcGravity,
85
+ repulsion: fa2.gravitationalConstant || -80,
86
+ springLength: fa2.springLength || 150,
87
+ springConstant: fa2.springConstant || 0.05,
88
+ damping: fa2.damping || 0.4,
89
+ maxIterations: gcIterations,
90
+ avoidOverlap: fa2.avoidOverlap || 0.8,
91
+ batchSize: 15, // More iterations per batch for faster convergence
92
+ });
93
+ }
94
+
95
+ // ── Event binding (vis-network compatible) ────────────────────────────────
96
+
97
+ DevPlanGraph.prototype.on = function(event, callback) {
98
+ // Map vis-network event names to GraphCanvas event names
99
+ var self = this;
100
+
101
+ if (event === 'stabilizationIterationsDone') {
102
+ this._gc.on('stabilizationDone', callback);
103
+ return this;
104
+ }
105
+
106
+ if (event === 'afterDrawing') {
107
+ // afterDrawing provides canvas context — we emit this after each render
108
+ this._gc.on('afterRender', function(data) {
109
+ // Provide ctx in world-coordinate space (after viewport transform)
110
+ callback(self._gc._ctx);
111
+ });
112
+ return this;
113
+ }
114
+
115
+ // Map click events to include vis-network-compatible params
116
+ if (event === 'click') {
117
+ this._gc.on('click', function(data) {
118
+ callback({
119
+ nodes: data.nodes || [],
120
+ edges: [],
121
+ pointer: data.pointer || { screen: { x: 0, y: 0 }, canvas: { x: 0, y: 0 } },
122
+ event: data,
123
+ });
124
+ });
125
+ return this;
126
+ }
127
+
128
+ // Map drag events to include vis-network-compatible params.nodes
129
+ if (event === 'dragStart') {
130
+ this._gc.on('dragStart', function(data) {
131
+ callback({
132
+ nodes: data.nodeId ? [data.nodeId] : [],
133
+ pointer: { canvas: { x: data.node ? data.node.x : 0, y: data.node ? data.node.y : 0 } },
134
+ });
135
+ });
136
+ return this;
137
+ }
138
+
139
+ if (event === 'dragging') {
140
+ this._gc.on('dragging', function(data) {
141
+ callback({
142
+ nodes: data.nodeId ? [data.nodeId] : [],
143
+ pointer: { canvas: { x: data.x, y: data.y } },
144
+ });
145
+ });
146
+ return this;
147
+ }
148
+
149
+ if (event === 'dragEnd') {
150
+ this._gc.on('dragEnd', function(data) {
151
+ callback({
152
+ nodes: data.nodeId ? [data.nodeId] : [],
153
+ });
154
+ });
155
+ return this;
156
+ }
157
+
158
+ // Default: pass through
159
+ this._gc.on(event, callback);
160
+ return this;
161
+ };
162
+
163
+ // ── Viewport operations ──────────────────────────────────────────────────
164
+
165
+ DevPlanGraph.prototype.fit = function(options) {
166
+ this._gc.fit(options);
167
+ };
168
+
169
+ DevPlanGraph.prototype.redraw = function() {
170
+ this._gc.redraw();
171
+ };
172
+
173
+ // ── Node/Edge queries ────────────────────────────────────────────────────
174
+
175
+ DevPlanGraph.prototype.getPositions = function(nodeIds) {
176
+ return this._gc.getPositions(nodeIds);
177
+ };
178
+
179
+ DevPlanGraph.prototype.moveNode = function(nodeId, x, y) {
180
+ this._gc.moveNode(nodeId, x, y);
181
+ };
182
+
183
+ DevPlanGraph.prototype.getConnectedEdges = function(nodeId) {
184
+ return this._gc.getConnectedEdges(nodeId);
185
+ };
186
+
187
+ DevPlanGraph.prototype.getConnectedNodes = function(nodeId) {
188
+ return this._gc.getConnectedNodes(nodeId);
189
+ };
190
+
191
+ /**
192
+ * Get bounding box of a node (vis-network compatible).
193
+ */
194
+ DevPlanGraph.prototype.getBoundingBox = function(nodeId) {
195
+ var node = this._gc._nodeMap[nodeId];
196
+ if (!node) return null;
197
+ var r = node._radius || 10;
198
+ return {
199
+ top: node.y - r,
200
+ bottom: node.y + r,
201
+ left: node.x - r,
202
+ right: node.x + r,
203
+ };
204
+ };
205
+
206
+ // ── Coordinate conversion ────────────────────────────────────────────────
207
+
208
+ /**
209
+ * Convert canvas/world coordinates to DOM/screen coordinates (vis-network compat).
210
+ */
211
+ DevPlanGraph.prototype.canvasToDOM = function(pos) {
212
+ return this._gc.worldToScreen(pos.x, pos.y);
213
+ };
214
+
215
+ /**
216
+ * Convert DOM/screen coordinates to canvas/world coordinates (vis-network compat).
217
+ */
218
+ DevPlanGraph.prototype.DOMtoCanvas = function(pos) {
219
+ return this._gc.screenToWorld(pos.x, pos.y);
220
+ };
221
+
222
+ // ── Physics control ──────────────────────────────────────────────────────
223
+
224
+ /**
225
+ * Set options (vis-network compatible).
226
+ * Mainly used for: network.setOptions({ physics: { enabled: false } })
227
+ */
228
+ DevPlanGraph.prototype.setOptions = function(opts) {
229
+ if (opts && opts.physics && opts.physics.enabled === false) {
230
+ if (this._gc._layoutEngine) {
231
+ this._gc._layoutEngine.stop();
232
+ }
233
+ }
234
+ };
235
+
236
+ // ── Destroy ──────────────────────────────────────────────────────────────
237
+
238
+ DevPlanGraph.prototype.destroy = function() {
239
+ this._gc.destroy();
240
+ };
241
+
242
+ // ── Selection (vis-network compat) ───────────────────────────────────────
243
+
244
+ DevPlanGraph.prototype.getSelectedNodes = function() {
245
+ return this._gc._interaction._selectedNodes.map(function(n) { return n.id; });
246
+ };
247
+
248
+ DevPlanGraph.prototype.selectNodes = function(nodeIds) {
249
+ // Basic implementation
250
+ this._gc._interaction._deselectAll();
251
+ for (var i = 0; i < nodeIds.length; i++) {
252
+ var node = this._gc._nodeMap[nodeIds[i]];
253
+ if (node) {
254
+ node._selected = true;
255
+ this._gc._interaction._selectedNodes.push(node);
256
+ }
257
+ }
258
+ this._gc.markDirty();
259
+ };
260
+
261
+ /**
262
+ * Get the underlying GraphCanvas engine.
263
+ */
264
+ DevPlanGraph.prototype.getEngine = function() {
265
+ return this._gc;
266
+ };
267
+
268
+ /**
269
+ * Get performance metrics.
270
+ */
271
+ DevPlanGraph.prototype.getMetrics = function() {
272
+ return this._gc.getMetrics();
273
+ };
274
+
275
+ // ── Cluster control (Phase-8B) ───────────────────────────────────────────
276
+
277
+ /**
278
+ * Enable/disable clustering.
279
+ */
280
+ DevPlanGraph.prototype.setClusterEnabled = function(enabled) {
281
+ var gc = this._gc;
282
+ if (!gc._clusterer) {
283
+ gc._clusterer = new Clusterer(gc);
284
+ }
285
+ gc._clusterer.setEnabled(enabled);
286
+ gc.markDirty();
287
+ };
288
+
289
+ /**
290
+ * Set cluster threshold (scale below which clustering activates).
291
+ */
292
+ DevPlanGraph.prototype.setClusterThreshold = function(threshold) {
293
+ if (this._gc._clusterer) {
294
+ this._gc._clusterer.setThreshold(threshold);
295
+ }
296
+ };
297
+
298
+ /**
299
+ * Get cluster information.
300
+ */
301
+ DevPlanGraph.prototype.getClusters = function() {
302
+ if (this._gc._clusterer) {
303
+ return this._gc._clusterer.getClusters();
304
+ }
305
+ return [];
306
+ };
307
+
308
+ /**
309
+ * Expand a specific cluster.
310
+ */
311
+ DevPlanGraph.prototype.expandCluster = function(clusterId, options) {
312
+ if (this._gc._clusterer) {
313
+ this._gc._clusterer.expandCluster(clusterId, options);
314
+ }
315
+ };
316
+
317
+ // ── Incremental Data API (Phase-8C) ──────────────────────────────────────
318
+
319
+ /**
320
+ * Incrementally add nodes without full rebuild.
321
+ * @param {Array} nodes — array of node objects
322
+ */
323
+ DevPlanGraph.prototype.addNodes = function(nodes) {
324
+ this._gc.addNodes(nodes);
325
+ };
326
+
327
+ /**
328
+ * Incrementally add edges without full rebuild.
329
+ * @param {Array} edges — array of edge objects
330
+ */
331
+ DevPlanGraph.prototype.addEdges = function(edges) {
332
+ this._gc.addEdges(edges);
333
+ };
334
+
335
+ /**
336
+ * Get the position TypedArray (for zero-copy Worker exchange).
337
+ * @returns {Float32Array}
338
+ */
339
+ DevPlanGraph.prototype.getPositionBuffer = function() {
340
+ return this._gc.getPositionBuffer();
341
+ };
342
+ `;
343
+ }
344
+ //# sourceMappingURL=api-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-compat.js","sourceRoot":"","sources":["../../../src/visualize/graph-canvas/api-compat.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,gDAiUC;AAjUD,SAAgB,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+TR,CAAC;AACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Clusterer — 节点聚合器 (完整实现)
3
+ *
4
+ * 在极低缩放级别时,将空间邻近的节点聚合为 cluster 节点。
5
+ * 使用网格聚合 (grid-based clustering) 算法:
6
+ * 1. 将世界空间划分为网格
7
+ * 2. 每个网格内的多个节点聚合为一个 cluster
8
+ * 3. cluster 显示计数标签、主类型颜色、状态饼图
9
+ * 4. 缩放到阈值以上时自动展开
10
+ * 5. Spring 展开/收起过渡动画
11
+ * 6. 多级递归聚合
12
+ *
13
+ * Phase 8B 完整实现
14
+ */
15
+ export declare function getClustererScript(): string;
16
+ //# sourceMappingURL=clusterer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clusterer.d.ts","sourceRoot":"","sources":["../../../src/visualize/graph-canvas/clusterer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,kBAAkB,IAAI,MAAM,CAyb3C"}