project-graph-mcp 2.2.6 → 2.3.1

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 (155) hide show
  1. package/ARCHITECTURE.md +81 -0
  2. package/CHANGELOG.md +57 -0
  3. package/README.md +9 -4
  4. package/package.json +4 -13
  5. package/project-graph-mcp-2.3.0.tgz +0 -0
  6. package/src/compact/expand.js +1 -1
  7. package/src/core/graph-builder.js +2 -2
  8. package/src/core/parser.js +2 -2
  9. package/src/network/server.js +1 -2
  10. package/src/network/web-server.js +1 -1
  11. package/vendor/symbiote-node/CHANGELOG.md +31 -0
  12. package/vendor/symbiote-node/LICENSE +21 -0
  13. package/vendor/symbiote-node/README.md +206 -0
  14. package/vendor/symbiote-node/canvas/AutoLayout.js +725 -0
  15. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.css.js +73 -0
  16. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.js +93 -0
  17. package/vendor/symbiote-node/canvas/Breadcrumb/Breadcrumb.tpl.js +9 -0
  18. package/vendor/symbiote-node/canvas/CanvasConnectionRenderer.js +962 -0
  19. package/vendor/symbiote-node/canvas/ConnectionRenderer.js +1468 -0
  20. package/vendor/symbiote-node/canvas/FlowSimulator.js +323 -0
  21. package/vendor/symbiote-node/canvas/ForceLayout.js +189 -0
  22. package/vendor/symbiote-node/canvas/ForceWorker.js +1325 -0
  23. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.css.js +97 -0
  24. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.js +176 -0
  25. package/vendor/symbiote-node/canvas/GraphTabs/GraphTabs.tpl.js +12 -0
  26. package/vendor/symbiote-node/canvas/LODManager.js +88 -0
  27. package/vendor/symbiote-node/canvas/Minimap/Minimap.css.js +71 -0
  28. package/vendor/symbiote-node/canvas/Minimap/Minimap.js +207 -0
  29. package/vendor/symbiote-node/canvas/Minimap/Minimap.tpl.js +9 -0
  30. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.css.js +261 -0
  31. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.js +1840 -0
  32. package/vendor/symbiote-node/canvas/NodeCanvas/NodeCanvas.tpl.js +22 -0
  33. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.css.js +97 -0
  34. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.js +132 -0
  35. package/vendor/symbiote-node/canvas/NodeSearch/NodeSearch.tpl.js +21 -0
  36. package/vendor/symbiote-node/canvas/NodeViewManager.js +584 -0
  37. package/vendor/symbiote-node/canvas/PinExpansion.js +131 -0
  38. package/vendor/symbiote-node/canvas/PseudoConnection.js +80 -0
  39. package/vendor/symbiote-node/canvas/SubgraphManager.js +201 -0
  40. package/vendor/symbiote-node/canvas/SubgraphRouter.js +443 -0
  41. package/vendor/symbiote-node/canvas/ViewportActions.js +446 -0
  42. package/vendor/symbiote-node/core/Connection.js +45 -0
  43. package/vendor/symbiote-node/core/Editor.js +451 -0
  44. package/vendor/symbiote-node/core/Frame.js +31 -0
  45. package/vendor/symbiote-node/core/GraphMermaid.js +348 -0
  46. package/vendor/symbiote-node/core/GraphText.js +210 -0
  47. package/vendor/symbiote-node/core/Node.js +143 -0
  48. package/vendor/symbiote-node/core/Portal.js +104 -0
  49. package/vendor/symbiote-node/core/Socket.js +185 -0
  50. package/vendor/symbiote-node/core/SubgraphNode.js +125 -0
  51. package/vendor/symbiote-node/index.js +103 -0
  52. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.css.js +361 -0
  53. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.js +332 -0
  54. package/vendor/symbiote-node/inspector/InspectorPanel/InspectorPanel.tpl.js +96 -0
  55. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.css.js +104 -0
  56. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.js +133 -0
  57. package/vendor/symbiote-node/inspector/TemplatePreview/TemplatePreview.tpl.js +33 -0
  58. package/vendor/symbiote-node/interactions/ConnectFlow.js +307 -0
  59. package/vendor/symbiote-node/interactions/Drag.js +102 -0
  60. package/vendor/symbiote-node/interactions/Selector.js +132 -0
  61. package/vendor/symbiote-node/interactions/SnapGrid.js +65 -0
  62. package/vendor/symbiote-node/interactions/Zoom.js +140 -0
  63. package/vendor/symbiote-node/layout/ActionZone/ActionZone.css.js +88 -0
  64. package/vendor/symbiote-node/layout/ActionZone/ActionZone.js +254 -0
  65. package/vendor/symbiote-node/layout/ActionZone/ActionZone.tpl.js +11 -0
  66. package/vendor/symbiote-node/layout/Layout/Layout.css.js +88 -0
  67. package/vendor/symbiote-node/layout/Layout/Layout.js +622 -0
  68. package/vendor/symbiote-node/layout/Layout/Layout.tpl.js +25 -0
  69. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.css.js +293 -0
  70. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.js +467 -0
  71. package/vendor/symbiote-node/layout/LayoutNode/LayoutNode.tpl.js +33 -0
  72. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.css.js +46 -0
  73. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.js +102 -0
  74. package/vendor/symbiote-node/layout/LayoutPreview/LayoutPreview.tpl.js +6 -0
  75. package/vendor/symbiote-node/layout/LayoutRouter/LayoutRouter.js +156 -0
  76. package/vendor/symbiote-node/layout/LayoutRouter/routerSync.js +250 -0
  77. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.css.js +379 -0
  78. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.js +263 -0
  79. package/vendor/symbiote-node/layout/LayoutSidebar/LayoutSidebar.tpl.js +20 -0
  80. package/vendor/symbiote-node/layout/LayoutSidebar/SidebarSection.js +183 -0
  81. package/vendor/symbiote-node/layout/LayoutTree.js +246 -0
  82. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.css.js +43 -0
  83. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.js +89 -0
  84. package/vendor/symbiote-node/layout/PanelMenu/PanelMenu.tpl.js +14 -0
  85. package/vendor/symbiote-node/layout/index.js +16 -0
  86. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.css.js +61 -0
  87. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.js +79 -0
  88. package/vendor/symbiote-node/menu/ContextMenu/ContextMenu.tpl.js +19 -0
  89. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.css.js +41 -0
  90. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.js +24 -0
  91. package/vendor/symbiote-node/node/CtrlItem/CtrlItem.tpl.js +16 -0
  92. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.css.js +65 -0
  93. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.js +29 -0
  94. package/vendor/symbiote-node/node/GraphFrame/GraphFrame.tpl.js +13 -0
  95. package/vendor/symbiote-node/node/GraphNode/GraphNode.css.js +683 -0
  96. package/vendor/symbiote-node/node/GraphNode/GraphNode.js +92 -0
  97. package/vendor/symbiote-node/node/GraphNode/GraphNode.tpl.js +17 -0
  98. package/vendor/symbiote-node/node/NodeSocket/NodeSocket.js +25 -0
  99. package/vendor/symbiote-node/node/NodeSocket/NodeSocket.tpl.js +7 -0
  100. package/vendor/symbiote-node/node/PortItem/PortItem.css.js +90 -0
  101. package/vendor/symbiote-node/node/PortItem/PortItem.js +87 -0
  102. package/vendor/symbiote-node/node/PortItem/PortItem.tpl.js +10 -0
  103. package/vendor/symbiote-node/package.json +59 -0
  104. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.css.js +143 -0
  105. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.js +131 -0
  106. package/vendor/symbiote-node/palette/PaletteBrowser/PaletteBrowser.tpl.js +16 -0
  107. package/vendor/symbiote-node/plugins/History.js +384 -0
  108. package/vendor/symbiote-node/plugins/Readonly.js +59 -0
  109. package/vendor/symbiote-node/shapes/CircleShape.js +80 -0
  110. package/vendor/symbiote-node/shapes/CommentShape.js +35 -0
  111. package/vendor/symbiote-node/shapes/DiamondShape.js +115 -0
  112. package/vendor/symbiote-node/shapes/NodeShape.js +80 -0
  113. package/vendor/symbiote-node/shapes/PillShape.js +91 -0
  114. package/vendor/symbiote-node/shapes/RectShape.js +72 -0
  115. package/vendor/symbiote-node/shapes/SVGShape.js +494 -0
  116. package/vendor/symbiote-node/shapes/index.js +53 -0
  117. package/vendor/symbiote-node/themes/Palette.js +32 -0
  118. package/vendor/symbiote-node/themes/Skin.js +113 -0
  119. package/vendor/symbiote-node/themes/Theme.js +84 -0
  120. package/vendor/symbiote-node/themes/carbon.js +137 -0
  121. package/vendor/symbiote-node/themes/dark.js +137 -0
  122. package/vendor/symbiote-node/themes/ebook.js +138 -0
  123. package/vendor/symbiote-node/themes/grey.js +137 -0
  124. package/vendor/symbiote-node/themes/light.js +137 -0
  125. package/vendor/symbiote-node/themes/neon.js +138 -0
  126. package/vendor/symbiote-node/themes/pcb.js +273 -0
  127. package/vendor/symbiote-node/themes/synthwave.js +137 -0
  128. package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.css.js +86 -0
  129. package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.js +128 -0
  130. package/vendor/symbiote-node/toolbar/QuickToolbar/QuickToolbar.tpl.js +29 -0
  131. package/web/app.js +9 -5
  132. package/web/components/canvas-graph.js +1705 -0
  133. package/web/components/code-block.js +1 -1
  134. package/web/components/event-feed/CodeWidget.js +32 -0
  135. package/web/components/event-feed/EventWidget.js +97 -0
  136. package/web/components/event-feed/ListWidget.js +57 -0
  137. package/web/components/event-feed/MiniGraphWidget.js +159 -0
  138. package/web/components/follow-ribbon.js +134 -0
  139. package/web/dashboard.js +1 -1
  140. package/web/follow-controller.js +241 -0
  141. package/web/index.html +4 -0
  142. package/web/panels/ActionBoard/ActionBoard.js +1 -1
  143. package/web/panels/SettingsPanel/SettingsPanel.tpl.js +1 -1
  144. package/web/panels/code-viewer.js +50 -15
  145. package/web/panels/dep-graph.js +2691 -7
  146. package/web/panels/file-tree.js +5 -2
  147. package/web/panels/live-monitor.js +75 -3
  148. package/web/style.css +39 -0
  149. package/docs/img/explorer-compact.jpg +0 -0
  150. package/docs/img/explorer-expanded.jpg +0 -0
  151. package/src/.contextignore +0 -22
  152. package/src/.project-graph-cache.json +0 -1
  153. package/src/compact/.project-graph-cache.json +0 -1
  154. package/web/.project-graph-cache.json +0 -1
  155. package/web/panels/SettingsPanel/.project-graph-cache.json +0 -1
@@ -29,6 +29,6 @@ this.$.highlighted=hl;
29
29
  const e=o.split("\n").length,t=[];for(let o=1;o<=e;o++)t.push(o);this.$.lineNums=t.join("\n");
30
30
  }
31
31
  }),this.sub("isMarkdown",v=>{this.toggleAttribute("mode-markdown",v)}),this.sub("isImage",v=>{this.toggleAttribute("mode-image",v)})
32
- }setBasePath(p){this._basePath=p}}
32
+ }setBasePath(p){this._basePath=p}scrollToLine(line){const pre=this.querySelector('.cb-pre');const scroll=this.querySelector('.cb-scroll');if(!pre||!scroll)return;const lineHeight=parseFloat(window.getComputedStyle(pre).lineHeight)||19.2;scroll.scrollTo({top:Math.max(0,(line-1)*lineHeight-scroll.clientHeight/2+lineHeight/2),behavior:'smooth'})}}
33
33
  CodeBlock.template='\n <div class="cb-scroll">\n <pre class="cb-gutter" bind="textContent: lineNums"></pre>\n <pre class="cb-pre"><code bind="innerHTML: highlighted"></code></pre>\n <div class="cb-md" bind="innerHTML: highlighted"></div>\n <div class="cb-img-wrap"><img class="cb-img" bind="src: imageSrc"></div>\n </div>\n';
34
34
  CodeBlock.rootStyles="\n code-block {\n display: block;\n height: 100%;\n overflow: hidden;\n }\n code-block .cb-scroll {\n display: flex;\n height: 100%;\n overflow: auto;\n align-items: stretch;\n }\n code-block .cb-gutter {\n position: sticky;\n left: 0;\n z-index: 1;\n margin: 0;\n padding: 12px 8px 12px 12px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n font-size: 12px;\n line-height: 1.6;\n text-align: right;\n color: var(--sn-text-dim, hsl(30, 10%, 55%));\n opacity: 0.45;\n background: var(--sn-bg, hsl(37, 30%, 96%));\n border-right: 1px solid var(--sn-node-border, hsl(35, 18%, 88%));\n user-select: none;\n white-space: pre;\n min-width: 32px;\n flex-shrink: 0;\n }\n code-block .cb-pre {\n margin: 0;\n padding: 12px;\n flex: 1;\n min-width: 0;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n font-size: 12px;\n line-height: 1.6;\n color: var(--sn-text, hsl(30, 15%, 18%));\n tab-size: 2;\n white-space: pre;\n box-sizing: border-box;\n }\n /* Markdown container — hidden by default */\n code-block .cb-md {\n display: none;\n padding: 20px 28px;\n flex: 1;\n min-width: 0;\n overflow-wrap: break-word;\n word-wrap: break-word;\n line-height: 1.7;\n color: var(--sn-text, hsl(30, 15%, 18%));\n font-family: var(--sn-font, 'Inter', -apple-system, sans-serif);\n font-size: 14px;\n }\n /* Image container — hidden by default */\n code-block .cb-img-wrap {\n display: none;\n flex: 1;\n padding: 20px;\n justify-content: center;\n align-items: center;\n background: repeating-conic-gradient(hsl(30, 10%, 88%) 0% 25%, hsl(30, 10%, 94%) 0% 50%) 0 0 / 16px 16px;\n }\n code-block .cb-img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border-radius: 4px;\n box-shadow: 0 2px 12px rgba(0,0,0,0.12);\n }\n /* In markdown mode: hide code, show md */\n code-block[mode-markdown] .cb-gutter { display: none; }\n code-block[mode-markdown] .cb-pre { display: none; }\n code-block[mode-markdown] .cb-md { display: block; }\n /* In image mode: hide code, show image */\n code-block[mode-image] .cb-gutter { display: none; }\n code-block[mode-image] .cb-pre { display: none; }\n code-block[mode-image] .cb-img-wrap { display: flex; }\n\n /* Markdown styles */\n code-block .md-h { margin: 20px 0 8px; color: var(--sn-text, #222); font-weight: 700; }\n code-block h1.md-h { font-size: 24px; border-bottom: 2px solid var(--sn-node-border, #ddd); padding-bottom: 8px; }\n code-block h2.md-h { font-size: 20px; border-bottom: 1px solid var(--sn-node-border, #ddd); padding-bottom: 6px; }\n code-block h3.md-h { font-size: 16px; }\n code-block h4.md-h { font-size: 14px; }\n code-block .md-p { margin: 8px 0; }\n code-block .md-quote {\n margin: 8px 0;\n padding: 8px 16px;\n border-left: 4px solid var(--sn-cat-server, hsl(210, 45%, 55%));\n background: hsla(210, 40%, 55%, 0.08);\n border-radius: 0 4px 4px 0;\n font-style: italic;\n }\n code-block .md-list {\n margin: 8px 0;\n padding-left: 24px;\n }\n code-block .md-list li {\n margin: 3px 0;\n }\n code-block .md-code-block {\n margin: 12px 0;\n padding: 12px 16px;\n background: var(--sn-bg, hsl(37, 30%, 94%));\n border: 1px solid var(--sn-node-border, hsl(35, 18%, 85%));\n border-radius: 6px;\n font-family: 'SF Mono', 'Fira Code', monospace;\n font-size: 12px;\n line-height: 1.6;\n overflow-x: auto;\n white-space: pre;\n }\n code-block .md-inline-code {\n padding: 1px 5px;\n background: hsla(30, 20%, 50%, 0.12);\n border-radius: 3px;\n font-family: 'SF Mono', 'Fira Code', monospace;\n font-size: 0.9em;\n }\n code-block .md-link {\n color: var(--sn-cat-server, hsl(210, 55%, 50%));\n text-decoration: underline;\n text-decoration-style: dotted;\n }\n code-block .md-link:hover { text-decoration-style: solid; }\n code-block .md-img {\n max-width: 100%;\n height: auto;\n border-radius: 6px;\n margin: 8px 0;\n border: 1px solid var(--sn-node-border, hsl(35, 18%, 85%));\n box-shadow: 0 2px 8px rgba(0,0,0,0.08);\n }\n code-block .md-hr {\n border: none;\n border-top: 1px solid var(--sn-node-border, hsl(35, 18%, 85%));\n margin: 16px 0;\n }\n code-block .md-table {\n width: 100%;\n border-collapse: collapse;\n margin: 12px 0;\n font-size: 13px;\n }\n code-block .md-table th,\n code-block .md-table td {\n padding: 6px 12px;\n border: 1px solid var(--sn-node-border, hsl(35, 18%, 85%));\n text-align: left;\n }\n code-block .md-table th {\n background: hsla(30, 15%, 50%, 0.08);\n font-weight: 600;\n }\n code-block .md-table tr:hover td {\n background: hsla(30, 15%, 50%, 0.04);\n }\n /* Token colors */\n code-block .t-kw { color: rgb(254, 165, 176); }\n code-block .t-str { color: rgb(251, 182, 79); }\n code-block .t-cm { color: rgb(149, 149, 149); font-style: italic; }\n code-block .t-fn { color: rgb(180, 243, 255); }\n code-block .t-num { color: rgb(251, 182, 79); }\n code-block .t-bi { color: rgb(180, 243, 255); }\n code-block .t-prop { color: rgb(238, 131, 252); }\n code-block .t-lit { color: rgb(254, 165, 176); }\n /* JSDoc */\n code-block .t-jd { color: rgb(130, 155, 130); font-style: italic; }\n code-block .t-jd-tag { color: rgb(180, 220, 140); font-style: normal; font-weight: 500; }\n code-block .t-jd-type { color: rgb(130, 210, 240); font-style: normal; }\n",CodeBlock.reg("code-block");
@@ -0,0 +1,32 @@
1
+ import Symbiote from "@symbiotejs/symbiote";
2
+
3
+ export class CodeWidget extends Symbiote {
4
+ init$ = {
5
+ '@source': '',
6
+ truncatedSource: '',
7
+ expanded: false,
8
+ hasMore: false
9
+ };
10
+
11
+ renderCallback() {
12
+ this.sub('@source', (src) => {
13
+ if (!src) return;
14
+ const lines = src.split('\n');
15
+ if (lines.length > 10) {
16
+ this.$.hasMore = true;
17
+ this.$.truncatedSource = lines.slice(0, 10).join('\n') + '\n...';
18
+ } else {
19
+ this.$.hasMore = false;
20
+ this.$.truncatedSource = src;
21
+ }
22
+ });
23
+ }
24
+ }
25
+
26
+ CodeWidget.template = `
27
+ <div class="code-widget">
28
+ <pre class="code-block" ${{ textContent: 'truncatedSource' }}></pre>
29
+ </div>
30
+ `;
31
+
32
+ CodeWidget.reg('pg-code-widget');
@@ -0,0 +1,97 @@
1
+ import Symbiote from "@symbiotejs/symbiote";
2
+
3
+ export class EventWidget extends Symbiote {
4
+ init$ = {
5
+ '@eventData': null,
6
+ isCall: true,
7
+ tool: '',
8
+ argsJSON: '',
9
+ timeStr: '',
10
+ duration: '',
11
+ success: true,
12
+ widgetHTML: '',
13
+ };
14
+
15
+ renderCallback() {
16
+ this.sub('@eventData', (evStr) => {
17
+ if (!evStr) return;
18
+ let ev;
19
+ try {
20
+ ev = JSON.parse(evStr);
21
+ } catch {
22
+ return;
23
+ }
24
+
25
+ this.$.isCall = ev.type === 'tool_call';
26
+ this.$.tool = ev.tool;
27
+ this.$.timeStr = this._formatTime(ev.ts);
28
+
29
+ if (this.$.isCall) {
30
+ this.$.argsJSON = JSON.stringify(ev.args || {});
31
+ } else {
32
+ this.$.duration = `${ev.duration_ms}ms`;
33
+ this.$.success = ev.success !== false;
34
+ }
35
+
36
+ this._renderWidget(ev);
37
+ });
38
+ }
39
+
40
+ _renderWidget(ev) {
41
+ if (ev.type === 'tool_call') {
42
+ this.$.widgetHTML = '';
43
+ return;
44
+ }
45
+
46
+ const { tool, output, success } = ev;
47
+ if (!success || !output) {
48
+ this.$.widgetHTML = `<div class="error-msg">${this._esc(output || 'Error')}</div>`;
49
+ return;
50
+ }
51
+
52
+ let data;
53
+ try {
54
+ data = JSON.parse(output);
55
+ } catch {
56
+ data = output;
57
+ }
58
+
59
+ if (tool === 'default_api:view_file' || tool === 'default_api:replace_file_content' || tool === 'default_api:multi_replace_file_content' || tool === 'default_api:write_to_file') {
60
+ this.$.widgetHTML = `<pg-code-widget source='${this._esc(output)}'></pg-code-widget>`;
61
+ } else if (tool === 'default_api:mcp_project-graph_navigate' || tool === 'default_api:mcp_project-graph_get_skeleton') {
62
+ this.$.widgetHTML = `<pg-mini-graph data='${this._esc(JSON.stringify(data))}'></pg-mini-graph>`;
63
+ } else if (tool === 'default_api:list_dir' || tool === 'default_api:grep_search') {
64
+ this.$.widgetHTML = `<pg-list-widget data='${this._esc(output)}'></pg-list-widget>`;
65
+ } else {
66
+ this.$.widgetHTML = `<pre class="raw-output">${this._esc(output).substring(0, 500)}${output.length > 500 ? '...' : ''}</pre>`;
67
+ }
68
+ }
69
+
70
+ _esc(s) {
71
+ if (typeof s !== 'string') return '';
72
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;");
73
+ }
74
+
75
+ _formatTime(ts) {
76
+ return ts ? new Date(ts).toLocaleTimeString('en', { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' }) : '';
77
+ }
78
+ }
79
+
80
+ EventWidget.template = `
81
+ <div class="pg-mon-event" \${{ 'data-is-call': 'isCall' }}>
82
+ <div class="event-header">
83
+ <span class="pg-mon-arrow" \${{ textContent: 'isCall ? "→" : "←"' }}></span>
84
+ <span class="pg-mon-tool" \${{ textContent: 'tool' }}></span>
85
+ <span class="pg-mon-time" \${{ textContent: 'timeStr' }}></span>
86
+ <span class="pg-mon-duration" \${{ textContent: 'duration' }}></span>
87
+ </div>
88
+ <div class="event-body" \${{ hidden: '!isCall' }}>
89
+ <span class="pg-mon-args" \${{ textContent: 'argsJSON' }}></span>
90
+ </div>
91
+ <div class="event-body result-body" \${{ hidden: 'isCall' }}>
92
+ <div bind="innerHTML: widgetHTML"></div>
93
+ </div>
94
+ </div>
95
+ `;
96
+
97
+ EventWidget.reg('pg-event-widget');
@@ -0,0 +1,57 @@
1
+ import Symbiote from "@symbiotejs/symbiote";
2
+
3
+ export class ListWidget extends Symbiote {
4
+ init$ = {
5
+ '@data': '',
6
+ listHTML: ''
7
+ };
8
+
9
+ renderCallback() {
10
+ this.sub('@data', (dataStr) => {
11
+ if (!dataStr) return;
12
+
13
+ let items = [];
14
+ try {
15
+ const parsed = JSON.parse(dataStr);
16
+ if (Array.isArray(parsed)) items = parsed;
17
+ else if (typeof parsed === 'object') items = Object.entries(parsed).map(([k, v]) => `${k}: ${v}`);
18
+ } catch {
19
+ // If not JSON, split by lines
20
+ items = dataStr.split('\n').filter(Boolean);
21
+ }
22
+
23
+ if (items.length === 0) {
24
+ this.$.listHTML = '<div class="pg-placeholder">Empty list</div>';
25
+ return;
26
+ }
27
+
28
+ // Truncate to 50 items
29
+ const hasMore = items.length > 50;
30
+ const displayItems = items.slice(0, 50);
31
+
32
+ let html = '<ul class="list-widget-ul">';
33
+ displayItems.forEach(item => {
34
+ let text = typeof item === 'string' ? item : JSON.stringify(item);
35
+ html += `<li>${this._esc(text)}</li>`;
36
+ });
37
+ html += '</ul>';
38
+
39
+ if (hasMore) {
40
+ html += `<div class="list-widget-more">...and ${items.length - 50} more items</div>`;
41
+ }
42
+
43
+ this.$.listHTML = html;
44
+ });
45
+ }
46
+
47
+ _esc(s) {
48
+ if (typeof s !== 'string') return '';
49
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;");
50
+ }
51
+ }
52
+
53
+ ListWidget.template = `
54
+ <div class="list-widget" bind="innerHTML: listHTML"></div>
55
+ `;
56
+
57
+ ListWidget.reg('pg-list-widget');
@@ -0,0 +1,159 @@
1
+ import Symbiote from "@symbiotejs/symbiote";
2
+
3
+ export class MiniGraphWidget extends Symbiote {
4
+ init$ = {
5
+ '@data': '',
6
+ svgContent: ''
7
+ };
8
+
9
+ renderCallback() {
10
+ this.sub('@data', (dataStr) => {
11
+ if (!dataStr) return;
12
+ let data;
13
+ try {
14
+ data = JSON.parse(dataStr);
15
+ } catch {
16
+ return;
17
+ }
18
+ this._renderSVG(data);
19
+ });
20
+ }
21
+
22
+ _renderSVG(data) {
23
+ const nodes = data.nodes || (data.n ? Object.keys(data.n).map(id => ({ id, ...data.n[id] })) : []);
24
+ const rawLinks = data.links || data.e || [];
25
+
26
+ // Some formats use {from, to}, some use {source, target}
27
+ const links = rawLinks.map(l => ({
28
+ from: l.from || l.source,
29
+ to: l.to || l.target
30
+ }));
31
+
32
+ if (!nodes.length) {
33
+ this.$.svgContent = '<text x="10" y="20" fill="var(--sn-text-dim)">No graph data</text>';
34
+ return;
35
+ }
36
+
37
+ const width = 300;
38
+ const height = 150;
39
+
40
+ // Initial deterministic positions (circle)
41
+ nodes.forEach((n, i) => {
42
+ const angle = (i / nodes.length) * Math.PI * 2;
43
+ n.x = width / 2 + Math.cos(angle) * (Math.min(width, height) / 4);
44
+ n.y = height / 2 + Math.sin(angle) * (Math.min(width, height) / 4);
45
+ n.vx = 0; n.vy = 0;
46
+ });
47
+
48
+ const K = 0.05; // Spring
49
+ const L = 40; // Ideal length
50
+ const REP = 300; // Repulsion
51
+ const DAMP = 0.8;
52
+
53
+ // Run 100 iterations
54
+ for (let i = 0; i < 100; i++) {
55
+ for (let j = 0; j < nodes.length; j++) {
56
+ for (let k = j + 1; k < nodes.length; k++) {
57
+ const a = nodes[j], b = nodes[k];
58
+ let dx = a.x - b.x, dy = a.y - b.y;
59
+ let dist = Math.sqrt(dx*dx + dy*dy) || 0.1;
60
+ let f = REP / (dist * dist);
61
+ const fx = (dx / dist) * f;
62
+ const fy = (dy / dist) * f;
63
+ a.vx += fx; a.vy += fy;
64
+ b.vx -= fx; b.vy -= fy;
65
+ }
66
+ }
67
+ links.forEach(link => {
68
+ const a = nodes.find(n => n.id === link.from);
69
+ const b = nodes.find(n => n.id === link.to);
70
+ if (!a || !b) return;
71
+ let dx = b.x - a.x, dy = b.y - a.y;
72
+ let dist = Math.sqrt(dx*dx + dy*dy) || 0.1;
73
+ let f = (dist - L) * K;
74
+ const fx = (dx / dist) * f;
75
+ const fy = (dy / dist) * f;
76
+ a.vx += fx; a.vy += fy;
77
+ b.vx -= fx; b.vy -= fy;
78
+ });
79
+ nodes.forEach(n => {
80
+ n.vx += (width/2 - n.x) * 0.015;
81
+ n.vy += (height/2 - n.y) * 0.015;
82
+ n.vx *= DAMP; n.vy *= DAMP;
83
+ n.x += n.vx; n.y += n.vy;
84
+ });
85
+ }
86
+
87
+ // Now build SVG
88
+ let svg = '';
89
+
90
+ // Bounds and scaling to fit within 300x150
91
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
92
+ nodes.forEach(n => {
93
+ minX = Math.min(minX, n.x);
94
+ minY = Math.min(minY, n.y);
95
+ maxX = Math.max(maxX, n.x);
96
+ maxY = Math.max(maxY, n.y);
97
+ });
98
+
99
+ const pad = 20;
100
+ const gW = Math.max(1, maxX - minX);
101
+ const gH = Math.max(1, maxY - minY);
102
+ const scale = Math.min((width - pad*2) / gW, (height - pad*2) / gH, 1.2);
103
+ const cx = (minX + maxX) / 2;
104
+ const cy = (minY + maxY) / 2;
105
+ const offX = width / 2 - cx * scale;
106
+ const offY = height / 2 - cy * scale;
107
+
108
+ // Draw Links
109
+ svg += '<g stroke="var(--sn-edge, #666)" stroke-width="1.5" opacity="0.5">';
110
+ links.forEach(link => {
111
+ const a = nodes.find(n => n.id === link.from);
112
+ const b = nodes.find(n => n.id === link.to);
113
+ if (!a || !b) return;
114
+ const x1 = a.x * scale + offX;
115
+ const y1 = a.y * scale + offY;
116
+ const x2 = b.x * scale + offX;
117
+ const y2 = b.y * scale + offY;
118
+
119
+ // Curved paths
120
+ const dx = x2 - x1, dy = y2 - y1;
121
+ const cx1 = x1 + dx * 0.3 - dy * 0.1;
122
+ const cy1 = y1 + dy * 0.3 + dx * 0.1;
123
+ const cx2 = x1 + dx * 0.7 - dy * 0.1;
124
+ const cy2 = y1 + dy * 0.7 + dx * 0.1;
125
+
126
+ svg += `<path d="M${x1},${y1} C${cx1},${cy1} ${cx2},${cy2} ${x2},${y2}" fill="none" />`;
127
+ });
128
+ svg += '</g>';
129
+
130
+ // Draw Nodes
131
+ svg += '<g>';
132
+ nodes.forEach(n => {
133
+ const x = n.x * scale + offX;
134
+ const y = n.y * scale + offY;
135
+ const tc = n.type === 'action' ? '#ff968c' :
136
+ n.type === 'output' ? '#78d2aa' :
137
+ n.type === 'config' ? '#ffc878' : '#78b4ff';
138
+
139
+ svg += `<circle cx="${x}" cy="${y}" r="4" fill="${tc}"></circle>`;
140
+ svg += `<text x="${x + 6}" y="${y + 3}" fill="var(--sn-text)" font-size="10">${this._esc(n.id || n.name || 'node')}</text>`;
141
+ });
142
+ svg += '</g>';
143
+
144
+ this.$.svgContent = svg;
145
+ }
146
+
147
+ _esc(s) {
148
+ if (typeof s !== 'string') return '';
149
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;");
150
+ }
151
+ }
152
+
153
+ MiniGraphWidget.template = `
154
+ <div class="mini-graph-widget">
155
+ <svg width="100%" height="150" viewBox="0 0 300 150" bind="innerHTML: svgContent"></svg>
156
+ </div>
157
+ `;
158
+
159
+ MiniGraphWidget.reg('pg-mini-graph');
@@ -0,0 +1,134 @@
1
+ // @ctx .context/web/components/follow-ribbon.ctx
2
+ /**
3
+ * FollowRibbon — Floating status bar that shows current agent action.
4
+ * Appears at the bottom of the screen during Follow Mode.
5
+ * Auto-fades after 4 seconds of inactivity.
6
+ */
7
+ import Symbiote from '@symbiotejs/symbiote';
8
+ import { events } from '../app.js';
9
+
10
+ export class FollowRibbon extends Symbiote {
11
+ init$ = {
12
+ statusText: '',
13
+ visible: false,
14
+ };
15
+
16
+ _fadeTimer = null;
17
+
18
+ initCallback() {
19
+ // Event subscriptions are in renderCallback (after template mount)
20
+ }
21
+
22
+ renderCallback() {
23
+ this.sub('visible', (v) => {
24
+ this.toggleAttribute('visible', v);
25
+ });
26
+
27
+ events.addEventListener('follow-status-changed', (e) => {
28
+ const text = e.detail?.text || '';
29
+ if (!text) {
30
+ this.$.visible = false;
31
+ return;
32
+ }
33
+ this.$.statusText = text;
34
+ this.$.visible = true;
35
+
36
+ // Auto-fade after 4 seconds
37
+ if (this._fadeTimer) clearTimeout(this._fadeTimer);
38
+ this._fadeTimer = setTimeout(() => {
39
+ this.$.visible = false;
40
+ }, 4000);
41
+ });
42
+
43
+ events.addEventListener('follow-state-changed', (e) => {
44
+ if (!e.detail?.enabled) {
45
+ this.$.visible = false;
46
+ this.$.statusText = '';
47
+ if (this._fadeTimer) {
48
+ clearTimeout(this._fadeTimer);
49
+ this._fadeTimer = null;
50
+ }
51
+ }
52
+ });
53
+ }
54
+ }
55
+
56
+ FollowRibbon.template = `
57
+ <div class="fr-inner">
58
+ <span class="fr-icon">smart_toy</span>
59
+ <span class="fr-text" bind="textContent: statusText"></span>
60
+ <span class="fr-dots"></span>
61
+ </div>
62
+ `;
63
+
64
+ FollowRibbon.rootStyles = `
65
+ follow-ribbon {
66
+ position: fixed;
67
+ bottom: 20px;
68
+ left: 50%;
69
+ transform: translateX(-50%) translateY(20px);
70
+ z-index: 9999;
71
+ pointer-events: none;
72
+ opacity: 0;
73
+ transition: opacity 0.4s ease, transform 0.4s ease;
74
+ }
75
+
76
+ follow-ribbon[visible] {
77
+ opacity: 1;
78
+ transform: translateX(-50%) translateY(0);
79
+ }
80
+
81
+ .fr-inner {
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 10px;
85
+ padding: 8px 20px;
86
+ border-radius: 24px;
87
+ background: rgba(20, 20, 25, 0.85);
88
+ backdrop-filter: blur(16px);
89
+ -webkit-backdrop-filter: blur(16px);
90
+ border: 1px solid rgba(76, 139, 245, 0.25);
91
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 16px rgba(76, 139, 245, 0.1);
92
+ font-family: 'Inter', -apple-system, sans-serif;
93
+ font-size: 12px;
94
+ font-weight: 500;
95
+ color: rgba(255, 255, 255, 0.9);
96
+ white-space: nowrap;
97
+ max-width: 500px;
98
+ }
99
+
100
+ .fr-icon {
101
+ font-family: 'Material Symbols Outlined';
102
+ font-size: 16px;
103
+ color: #4c8bf5;
104
+ animation: fr-pulse 2s ease-in-out infinite;
105
+ }
106
+
107
+ .fr-text {
108
+ overflow: hidden;
109
+ text-overflow: ellipsis;
110
+ }
111
+
112
+ .fr-dots::after {
113
+ content: '...';
114
+ animation: fr-dots 1.5s steps(3) infinite;
115
+ display: inline-block;
116
+ width: 16px;
117
+ text-align: left;
118
+ color: rgba(255, 255, 255, 0.4);
119
+ }
120
+
121
+ @keyframes fr-pulse {
122
+ 0%, 100% { opacity: 1; }
123
+ 50% { opacity: 0.5; }
124
+ }
125
+
126
+ @keyframes fr-dots {
127
+ 0% { content: ''; }
128
+ 33% { content: '.'; }
129
+ 66% { content: '..'; }
130
+ 100% { content: '...'; }
131
+ }
132
+ `;
133
+
134
+ FollowRibbon.reg('follow-ribbon');
package/web/dashboard.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @ctx .context/web/dashboard.ctx
2
- import{Layout as e,LayoutTree as t,applyTheme as o}from"symbiote-node";import{CARBON as r}from"./vendor/symbiote-node/themes/carbon.js";import"./panels/ProjectList/ProjectList.js";import"./panels/ActionBoard/ActionBoard.js";import"./panels/SettingsPanel/SettingsPanel.js";import{state as a,events as n,emit as s}from"./dashboard-state.js";async function c(){const e=await fetch("/api/gateway-info");if(!e.ok){const t=await e.text();throw console.error("[dashboard] fetchGatewayInfo failed:",e.status,t),new Error(`Gateway info failed: ${e.status}`)}return e.json()}
2
+ import{Layout as e,LayoutTree as t,applyTheme as o,CARBON as r}from"symbiote-node";import"./panels/ProjectList/ProjectList.js";import"./panels/ActionBoard/ActionBoard.js";import"./panels/SettingsPanel/SettingsPanel.js";import{state as a,events as n,emit as s}from"./dashboard-state.js";async function c(){const e=await fetch("/api/gateway-info");if(!e.ok){const t=await e.text();throw console.error("[dashboard] fetchGatewayInfo failed:",e.status,t),new Error(`Gateway info failed: ${e.status}`)}return e.json()}
3
3
  function p(e){if(!e.length)return void console.warn("[dashboard] No projects to connect WebSockets for");
4
4
  const t="https:"===location.protocol?"wss://":"ws://",o=location.host;for(const r of e)i(r,t,o)}
5
5
  function i(e,t,o,_att=0){const r=`${t}${o}${e.prefix}/ws/monitor`,n=new WebSocket(r);n.onopen=()=>{_att=0;console.log("[dashboard] WS connected:",e.projectName)},n.onmessage=t=>{let o;try{o=JSON.parse(t.data)}catch{return}if("snapshot"===o.method&&o.params?.state){const t=o.params.state,r=a.projects.find(t=>t.prefix===e.prefix);return void(r&&t.project&&(Object.assign(r,{projectName:t.project.name,projectPath:t.project.path,color:t.project.color,agents:t.project.agents,pid:t.project.pid,connected:!0}),s("projects-updated",a.projects)))}if("patch"===o.method&&o.params){const t=a.projects.find(t=>t.prefix===e.prefix);return void(t&&"project.agents"===o.params.path&&(t.agents=o.params.value,s("projects-updated",a.projects)))}if("event"===o.method&&o.params){const t=o.params;return t._projectPrefix=e.prefix,t._projectName=e.projectName,a.events.push(t),a.events.length>1e3&&a.events.shift(),void s("global-tool-event",t)}o.type&&(o._projectPrefix=e.prefix,o._projectName=e.projectName,a.events.push(o),a.events.length>1e3&&a.events.shift(),s("global-tool-event",o))},n.onerror=()=>{console.error("[dashboard] WS error:",e.projectName)},n.onclose=r=>{console.warn("[dashboard] WS closed:",e.projectName,r.code);