@joekytc/dsh-swarm 0.1.2 → 0.3.0

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 (603) hide show
  1. package/README.md +177 -140
  2. package/README.zh-CN.md +173 -126
  3. package/client/BoardCard.tsx +24 -2
  4. package/client/ConfigSection.tsx +162 -0
  5. package/client/ConfigSelect.tsx +71 -0
  6. package/client/KanbanBoard.tsx +3 -0
  7. package/client/KanbanTab.tsx +4 -3
  8. package/client/TaskDrawer.tsx +4 -26
  9. package/client/WorkflowRail.tsx +3 -1
  10. package/client/config-store.ts +92 -0
  11. package/client/config.css +110 -0
  12. package/client/index.ts +39 -4
  13. package/client/kanban.css +88 -2
  14. package/client/session-bridge.ts +39 -0
  15. package/client/timeline-model.ts +12 -1
  16. package/client/workflow-model.ts +3 -1
  17. package/lib/client.js +519 -56
  18. package/lib/config.d.ts +26 -2
  19. package/lib/config.js +20 -1
  20. package/lib/dispatcher/agent-runner.d.ts +37 -7
  21. package/lib/dispatcher/agent-runner.js +239 -86
  22. package/lib/dispatcher/chain-auditor.d.ts +4 -4
  23. package/lib/dispatcher/chain-auditor.js +14 -9
  24. package/lib/dispatcher/dispatcher.d.ts +69 -10
  25. package/lib/dispatcher/dispatcher.js +281 -42
  26. package/lib/dispatcher/event-waker.d.ts +1 -1
  27. package/lib/dispatcher/event-waker.js +2 -2
  28. package/lib/dispatcher/git-credentials.d.ts +2 -2
  29. package/lib/dispatcher/git-credentials.js +2 -2
  30. package/lib/dispatcher/model-candidates.d.ts +1 -1
  31. package/lib/dispatcher/model-candidates.js +1 -1
  32. package/lib/dispatcher/session-events.d.ts +12 -16
  33. package/lib/dispatcher/session-events.js +18 -6
  34. package/lib/dispatcher/target-repo.d.ts +2 -2
  35. package/lib/dispatcher/target-repo.js +3 -3
  36. package/lib/dispatcher/v-orchestrator.d.ts +44 -11
  37. package/lib/dispatcher/v-orchestrator.js +257 -49
  38. package/lib/dispatcher/watchdog.d.ts +1 -1
  39. package/lib/dispatcher/watchdog.js +2 -2
  40. package/lib/domain/config-override.d.ts +52 -0
  41. package/lib/domain/config-override.js +138 -0
  42. package/lib/domain/delivery-contract.d.ts +4 -3
  43. package/lib/domain/delivery-contract.js +30 -18
  44. package/lib/domain/delivery-evidence.d.ts +1 -1
  45. package/lib/domain/delivery-evidence.js +1 -1
  46. package/lib/domain/event-store.js +1 -1
  47. package/lib/domain/gate-policy.d.ts +26 -0
  48. package/lib/domain/gate-policy.js +44 -0
  49. package/lib/domain/im-message.d.ts +15 -0
  50. package/lib/domain/im-message.js +149 -0
  51. package/lib/domain/kanban-service.d.ts +28 -12
  52. package/lib/domain/kanban-service.js +73 -30
  53. package/lib/domain/memory.js +1 -1
  54. package/lib/domain/ocr-review.d.ts +47 -0
  55. package/lib/domain/ocr-review.js +105 -0
  56. package/lib/domain/permissions.js +6 -6
  57. package/lib/domain/planning-checklist.d.ts +5 -0
  58. package/lib/domain/planning-checklist.js +80 -6
  59. package/lib/domain/projection.js +8 -7
  60. package/lib/domain/review-evidence.js +1 -1
  61. package/lib/domain/state-machine.js +3 -2
  62. package/lib/domain/task-parents.js +1 -1
  63. package/lib/domain/types.d.ts +5 -5
  64. package/lib/index.js +28 -25
  65. package/lib/roles/clean-fs-tools.d.ts +22 -0
  66. package/lib/roles/clean-fs-tools.js +117 -0
  67. package/lib/roles/preset-installer.js +3 -3
  68. package/lib/roles/skill-installer.d.ts +6 -0
  69. package/lib/roles/skill-installer.js +32 -0
  70. package/lib/roles/toolsets.d.ts +71 -15
  71. package/lib/roles/toolsets.js +418 -68
  72. package/lib/roles/wiki-worker.d.ts +1 -0
  73. package/lib/roles/wiki-worker.js +12 -4
  74. package/lib/routes/kanban-http.d.ts +28 -2
  75. package/lib/routes/kanban-http.js +199 -6
  76. package/lib/routes/kanban-sse.d.ts +1 -1
  77. package/lib/routes/kanban-sse.js +1 -1
  78. package/lib/routes/planning-driver.d.ts +6 -2
  79. package/lib/routes/planning-driver.js +15 -7
  80. package/lib/routes/prefix-router.d.ts +19 -3
  81. package/lib/routes/prefix-router.js +40 -3
  82. package/lib/services/config-provider.d.ts +38 -0
  83. package/lib/services/config-provider.js +92 -0
  84. package/lib/services/gate-runner.d.ts +24 -0
  85. package/lib/services/gate-runner.js +87 -0
  86. package/lib/services/im-delivery.d.ts +94 -0
  87. package/lib/services/im-delivery.js +263 -0
  88. package/lib/services/kanban-provider.d.ts +6 -2
  89. package/lib/services/kanban-provider.js +41 -3
  90. package/lib/services/llm-catalog.d.ts +35 -0
  91. package/lib/services/llm-catalog.js +19 -0
  92. package/lib/services/ocr-cli.d.ts +35 -0
  93. package/lib/services/ocr-cli.js +128 -0
  94. package/lib/tools/kanban-tools.d.ts +2 -2
  95. package/lib/tools/kanban-tools.js +2 -1
  96. package/lib/tools/main-session-tools.d.ts +22 -3
  97. package/lib/tools/main-session-tools.js +135 -30
  98. package/lib/tools/ocr-review-tools.d.ts +11 -0
  99. package/lib/tools/ocr-review-tools.js +63 -0
  100. package/lib/tools/planning-tools.d.ts +8 -1
  101. package/lib/tools/planning-tools.js +44 -15
  102. package/lib/tools/prefetch-tools.js +1 -0
  103. package/lib/tools/spec-card-tools.js +1 -0
  104. package/lib/tools/wiki-tools.js +6 -5
  105. package/lib/wiki/kb-linkage.d.ts +9 -2
  106. package/lib/wiki/kb-linkage.js +3 -3
  107. package/lib/wiki/local-kb-client.d.ts +14 -0
  108. package/lib/wiki/local-kb-client.js +101 -0
  109. package/lib/wiki/local-kb.d.ts +6 -0
  110. package/lib/wiki/local-kb.js +25 -0
  111. package/lib/wiki/memory-recall.d.ts +14 -6
  112. package/lib/wiki/memory-recall.js +17 -13
  113. package/lib/wiki/page-path.d.ts +9 -3
  114. package/lib/wiki/page-path.js +33 -12
  115. package/lib/wiki/wiki-vault-client.d.ts +3 -3
  116. package/lib/wiki/wiki-vault-client.js +6 -6
  117. package/package.json +16 -11
  118. package/personas/kanban-d/agent.cordis.yml +5 -5
  119. package/personas/kanban-d/preset.yml +1 -1
  120. package/personas/kanban-dt/agent.cordis.yml +25 -7
  121. package/personas/kanban-dt/preset.yml +1 -1
  122. package/personas/kanban-p/agent.cordis.yml +19 -3
  123. package/personas/kanban-p/preset.yml +1 -1
  124. package/personas/kanban-pt/agent.cordis.yml +39 -9
  125. package/personas/kanban-pt/preset.yml +1 -1
  126. package/personas/kanban-v/agent.cordis.yml +3 -3
  127. package/personas/kanban-w/agent.cordis.yml +37 -18
  128. package/personas/kanban-w/preset.yml +1 -1
  129. package/personas/persona-d.md +1 -1
  130. package/personas/persona-dt.md +13 -5
  131. package/personas/persona-p.md +5 -2
  132. package/personas/persona-pt.md +13 -6
  133. package/personas/persona-v.md +2 -2
  134. package/personas/persona-w.md +11 -9
  135. package/personas/swarm/agent.cordis.yml +43 -0
  136. package/personas/swarm/preset.yml +5 -0
  137. package/skills/grill-me/SKILL.md +71 -0
  138. package/skills/llm-wiki-skill/.mise.toml +2 -0
  139. package/skills/llm-wiki-skill/.nvmrc +1 -0
  140. package/skills/llm-wiki-skill/AGENTS.md +173 -0
  141. package/skills/llm-wiki-skill/CHANGELOG.md +548 -0
  142. package/skills/llm-wiki-skill/CLAUDE.md +152 -0
  143. package/skills/llm-wiki-skill/HERMES.md +44 -0
  144. package/skills/llm-wiki-skill/README.en.md +261 -0
  145. package/skills/llm-wiki-skill/README.md +291 -0
  146. package/skills/llm-wiki-skill/SKILL.md +1133 -0
  147. package/skills/llm-wiki-skill/assets/graph-demo.gif +0 -0
  148. package/skills/llm-wiki-skill/assets/graph-preview.png +0 -0
  149. package/skills/llm-wiki-skill/deps/LICENSE-d3.txt +13 -0
  150. package/skills/llm-wiki-skill/deps/LICENSE-marked.txt +44 -0
  151. package/skills/llm-wiki-skill/deps/LICENSE-purify.txt +568 -0
  152. package/skills/llm-wiki-skill/deps/LICENSE-roughjs.txt +21 -0
  153. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/SKILL.md +261 -0
  154. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/references/config/first-time-setup.md +106 -0
  155. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/cdp.ts +179 -0
  156. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/constants.ts +13 -0
  157. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/defuddle-converter.ts +58 -0
  158. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/html-to-markdown.ts +135 -0
  159. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/legacy-converter.ts +629 -0
  160. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/main.ts +314 -0
  161. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/markdown-conversion-shared.ts +305 -0
  162. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/media-localizer.ts +317 -0
  163. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/package.json +14 -0
  164. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/paths.ts +29 -0
  165. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/vendor/baoyu-chrome-cdp/package.json +9 -0
  166. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/vendor/baoyu-chrome-cdp/src/index.test.ts +307 -0
  167. package/skills/llm-wiki-skill/deps/baoyu-url-to-markdown/scripts/vendor/baoyu-chrome-cdp/src/index.ts +523 -0
  168. package/skills/llm-wiki-skill/deps/d3.min.js +2 -0
  169. package/skills/llm-wiki-skill/deps/marked.min.js +6 -0
  170. package/skills/llm-wiki-skill/deps/purify.min.js +3 -0
  171. package/skills/llm-wiki-skill/deps/rough.min.js +7 -0
  172. package/skills/llm-wiki-skill/deps/youtube-transcript/SKILL.md +47 -0
  173. package/skills/llm-wiki-skill/deps/youtube-transcript/scripts/get_transcript.py +72 -0
  174. package/skills/llm-wiki-skill/designs/graph-edge-legibility/graph-edge-treatments.html +480 -0
  175. package/skills/llm-wiki-skill/docs/design/oriental-atlas/DESIGN.md +183 -0
  176. package/skills/llm-wiki-skill/docs/design/oriental-atlas/README.md +10 -0
  177. package/skills/llm-wiki-skill/docs/design/oriental-atlas/design-brief.md +170 -0
  178. package/skills/llm-wiki-skill/docs/design/oriental-atlas/oriental-editorial-atlas.html +1908 -0
  179. package/skills/llm-wiki-skill/docs/design/oriental-atlas/reviews/result-review.md +68 -0
  180. package/skills/llm-wiki-skill/docs/graph/2026-06-16-interaction-risk-audit.md +88 -0
  181. package/skills/llm-wiki-skill/docs/graph/2026-06-16-interaction-test-coverage-map.md +212 -0
  182. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-18-phase-0-2-baseline.md +86 -0
  183. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-18-phase-1-3-dom-svg-large-baseline.md +85 -0
  184. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-18-phase-1-4-disposable-validation-gate.md +97 -0
  185. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-18-phase-2-4-global-renderer-trial-matrix.md +168 -0
  186. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-19-phase-6-1-sigma-graphology-trial.md +71 -0
  187. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-19-phase-6-2-vis-network-trial.md +78 -0
  188. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-19-phase-6-3-aggregation-fallback-trial.md +72 -0
  189. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-19-phase-6-4-global-renderer-route-decision.md +94 -0
  190. package/skills/llm-wiki-skill/docs/graph/performance/2026-06-19-sigma-global-production-integration-result.md +102 -0
  191. package/skills/llm-wiki-skill/docs/graph/performance/artifacts/2026-06-18-phase-0-2/stage-4.5-offline-dense-wheel.json +9 -0
  192. package/skills/llm-wiki-skill/docs/graph/performance/artifacts/2026-06-18-phase-0-2/stage-4.5-offline-dense-wheel.png +0 -0
  193. package/skills/llm-wiki-skill/docs/graph/performance/artifacts/2026-06-18-phase-0-2/stage-4.5-offline-navigation.png +0 -0
  194. package/skills/llm-wiki-skill/docs/spark/2026-06-15-omp-tool-status-events-design.md +174 -0
  195. package/skills/llm-wiki-skill/docs/spark/2026-06-16-graph-interaction-geometry-design.md +832 -0
  196. package/skills/llm-wiki-skill/docs/spark/2026-06-16-graph-six-layer-architecture-design.md +577 -0
  197. package/skills/llm-wiki-skill/docs/spark/2026-06-17-static-renderer-coordination-split-design.md +172 -0
  198. package/skills/llm-wiki-skill/docs/spark/2026-06-18-large-graph-global-community-design.md +909 -0
  199. package/skills/llm-wiki-skill/docs/spark/2026-06-19-sigma-global-graph-renderer-design.md +360 -0
  200. package/skills/llm-wiki-skill/docs/spark/2026-06-20-paper-ui-port-design.md +162 -0
  201. package/skills/llm-wiki-skill/docs/spark/2026-06-20-paper-ui-v2-shell-alignment-design.md +384 -0
  202. package/skills/llm-wiki-skill/docs/spark/2026-06-21-graph-experience-completion-design.md +534 -0
  203. package/skills/llm-wiki-skill/docs/spark/2026-06-22-chat-auto-scroll-design.md +185 -0
  204. package/skills/llm-wiki-skill/docs/spark/2026-06-22-graph-community-node-visual-design.md +266 -0
  205. package/skills/llm-wiki-skill/docs/spark/2026-06-25-sigma-overlay-refactor-perf-design.md +170 -0
  206. package/skills/llm-wiki-skill/docs/spark/2026-06-26-global-sigma-community-spotlight-design.md +393 -0
  207. package/skills/llm-wiki-skill/docs/spark/mockups/2026-06-18-large-graph-global-community-flow.html +746 -0
  208. package/skills/llm-wiki-skill/install.ps1 +87 -0
  209. package/skills/llm-wiki-skill/install.sh +722 -0
  210. package/skills/llm-wiki-skill/package-lock.json +11171 -0
  211. package/skills/llm-wiki-skill/package.json +24 -0
  212. package/skills/llm-wiki-skill/packages/graph-engine/package.json +37 -0
  213. package/skills/llm-wiki-skill/packages/graph-engine/src/anim/.gitkeep +1 -0
  214. package/skills/llm-wiki-skill/packages/graph-engine/src/anim/index.ts +179 -0
  215. package/skills/llm-wiki-skill/packages/graph-engine/src/architecture.ts +79 -0
  216. package/skills/llm-wiki-skill/packages/graph-engine/src/diff.ts +121 -0
  217. package/skills/llm-wiki-skill/packages/graph-engine/src/facade.ts +1406 -0
  218. package/skills/llm-wiki-skill/packages/graph-engine/src/graph-node.ts +37 -0
  219. package/skills/llm-wiki-skill/packages/graph-engine/src/index.ts +25 -0
  220. package/skills/llm-wiki-skill/packages/graph-engine/src/layout/edge-geometry.ts +17 -0
  221. package/skills/llm-wiki-skill/packages/graph-engine/src/layout/index.ts +16 -0
  222. package/skills/llm-wiki-skill/packages/graph-engine/src/layout/spatial-index.ts +509 -0
  223. package/skills/llm-wiki-skill/packages/graph-engine/src/model/atlas.ts +18 -0
  224. package/skills/llm-wiki-skill/packages/graph-engine/src/model/index.ts +10 -0
  225. package/skills/llm-wiki-skill/packages/graph-engine/src/model/labels.ts +11 -0
  226. package/skills/llm-wiki-skill/packages/graph-engine/src/model/layout.ts +81 -0
  227. package/skills/llm-wiki-skill/packages/graph-engine/src/model/learning.ts +8 -0
  228. package/skills/llm-wiki-skill/packages/graph-engine/src/model/legacy-helpers.ts +1379 -0
  229. package/skills/llm-wiki-skill/packages/graph-engine/src/model/queue.ts +7 -0
  230. package/skills/llm-wiki-skill/packages/graph-engine/src/model/storage.ts +4 -0
  231. package/skills/llm-wiki-skill/packages/graph-engine/src/model/visibility.ts +9 -0
  232. package/skills/llm-wiki-skill/packages/graph-engine/src/render/.gitkeep +1 -0
  233. package/skills/llm-wiki-skill/packages/graph-engine/src/render/adapter.ts +443 -0
  234. package/skills/llm-wiki-skill/packages/graph-engine/src/render/aggregation-containers.ts +64 -0
  235. package/skills/llm-wiki-skill/packages/graph-engine/src/render/community-cloud-geometry.ts +178 -0
  236. package/skills/llm-wiki-skill/packages/graph-engine/src/render/community-wash.ts +238 -0
  237. package/skills/llm-wiki-skill/packages/graph-engine/src/render/community-washes.ts +19 -0
  238. package/skills/llm-wiki-skill/packages/graph-engine/src/render/compat-contract.ts +14 -0
  239. package/skills/llm-wiki-skill/packages/graph-engine/src/render/controller.ts +705 -0
  240. package/skills/llm-wiki-skill/packages/graph-engine/src/render/controls.ts +288 -0
  241. package/skills/llm-wiki-skill/packages/graph-engine/src/render/dom-svg-renderer.ts +180 -0
  242. package/skills/llm-wiki-skill/packages/graph-engine/src/render/edges.ts +51 -0
  243. package/skills/llm-wiki-skill/packages/graph-engine/src/render/geometry.ts +380 -0
  244. package/skills/llm-wiki-skill/packages/graph-engine/src/render/gestures.ts +673 -0
  245. package/skills/llm-wiki-skill/packages/graph-engine/src/render/graph-renderer-root.ts +387 -0
  246. package/skills/llm-wiki-skill/packages/graph-engine/src/render/hit-testing.ts +56 -0
  247. package/skills/llm-wiki-skill/packages/graph-engine/src/render/host-dom.ts +14 -0
  248. package/skills/llm-wiki-skill/packages/graph-engine/src/render/hover-card.ts +37 -0
  249. package/skills/llm-wiki-skill/packages/graph-engine/src/render/index.ts +213 -0
  250. package/skills/llm-wiki-skill/packages/graph-engine/src/render/keyboard.ts +48 -0
  251. package/skills/llm-wiki-skill/packages/graph-engine/src/render/legend.ts +25 -0
  252. package/skills/llm-wiki-skill/packages/graph-engine/src/render/minimap.ts +45 -0
  253. package/skills/llm-wiki-skill/packages/graph-engine/src/render/model.ts +1339 -0
  254. package/skills/llm-wiki-skill/packages/graph-engine/src/render/node-drag-lifecycle.ts +94 -0
  255. package/skills/llm-wiki-skill/packages/graph-engine/src/render/nodes.ts +103 -0
  256. package/skills/llm-wiki-skill/packages/graph-engine/src/render/offline-reader.ts +209 -0
  257. package/skills/llm-wiki-skill/packages/graph-engine/src/render/overlays-presenter.ts +192 -0
  258. package/skills/llm-wiki-skill/packages/graph-engine/src/render/overlays.ts +73 -0
  259. package/skills/llm-wiki-skill/packages/graph-engine/src/render/pin-position.ts +51 -0
  260. package/skills/llm-wiki-skill/packages/graph-engine/src/render/preview.ts +65 -0
  261. package/skills/llm-wiki-skill/packages/graph-engine/src/render/relation-focus.ts +91 -0
  262. package/skills/llm-wiki-skill/packages/graph-engine/src/render/render-context.ts +85 -0
  263. package/skills/llm-wiki-skill/packages/graph-engine/src/render/render-pipeline.ts +871 -0
  264. package/skills/llm-wiki-skill/packages/graph-engine/src/render/render-styles.ts +1405 -0
  265. package/skills/llm-wiki-skill/packages/graph-engine/src/render/renderer-surface.ts +75 -0
  266. package/skills/llm-wiki-skill/packages/graph-engine/src/render/search.ts +57 -0
  267. package/skills/llm-wiki-skill/packages/graph-engine/src/render/sigma-coordinates.ts +44 -0
  268. package/skills/llm-wiki-skill/packages/graph-engine/src/render/sigma-global-drag.ts +246 -0
  269. package/skills/llm-wiki-skill/packages/graph-engine/src/render/sigma-global-renderer.ts +1425 -0
  270. package/skills/llm-wiki-skill/packages/graph-engine/src/render/sigma-overlay-svg.ts +121 -0
  271. package/skills/llm-wiki-skill/packages/graph-engine/src/render/simulation-bridge.ts +59 -0
  272. package/skills/llm-wiki-skill/packages/graph-engine/src/render/state.ts +262 -0
  273. package/skills/llm-wiki-skill/packages/graph-engine/src/render/toolbar.ts +40 -0
  274. package/skills/llm-wiki-skill/packages/graph-engine/src/render/viewport.ts +336 -0
  275. package/skills/llm-wiki-skill/packages/graph-engine/src/select/.gitkeep +1 -0
  276. package/skills/llm-wiki-skill/packages/graph-engine/src/select/index.ts +189 -0
  277. package/skills/llm-wiki-skill/packages/graph-engine/src/sim/index.ts +372 -0
  278. package/skills/llm-wiki-skill/packages/graph-engine/src/sim/pins.ts +84 -0
  279. package/skills/llm-wiki-skill/packages/graph-engine/src/summary/index.ts +447 -0
  280. package/skills/llm-wiki-skill/packages/graph-engine/src/themes/.gitkeep +1 -0
  281. package/skills/llm-wiki-skill/packages/graph-engine/src/themes/index.ts +8 -0
  282. package/skills/llm-wiki-skill/packages/graph-engine/src/themes/tokens.ts +117 -0
  283. package/skills/llm-wiki-skill/packages/graph-engine/src/types/d3-quadtree.d.ts +22 -0
  284. package/skills/llm-wiki-skill/packages/graph-engine/src/types.ts +531 -0
  285. package/skills/llm-wiki-skill/packages/graph-engine/test/aggregation-fallback-trial-adapter.test.ts +115 -0
  286. package/skills/llm-wiki-skill/packages/graph-engine/test/aggregation-fallback-trial-adapter.ts +222 -0
  287. package/skills/llm-wiki-skill/packages/graph-engine/test/anim.test.ts +121 -0
  288. package/skills/llm-wiki-skill/packages/graph-engine/test/architecture.test.ts +63 -0
  289. package/skills/llm-wiki-skill/packages/graph-engine/test/community-cloud-geometry.test.ts +86 -0
  290. package/skills/llm-wiki-skill/packages/graph-engine/test/community-wash.test.ts +97 -0
  291. package/skills/llm-wiki-skill/packages/graph-engine/test/diff.test.ts +133 -0
  292. package/skills/llm-wiki-skill/packages/graph-engine/test/facade.test.ts +1369 -0
  293. package/skills/llm-wiki-skill/packages/graph-engine/test/geometry.test.ts +147 -0
  294. package/skills/llm-wiki-skill/packages/graph-engine/test/gestures.test.ts +768 -0
  295. package/skills/llm-wiki-skill/packages/graph-engine/test/graph-layout.test.ts +110 -0
  296. package/skills/llm-wiki-skill/packages/graph-engine/test/helpers.test.ts +287 -0
  297. package/skills/llm-wiki-skill/packages/graph-engine/test/interaction-contract.test.ts +106 -0
  298. package/skills/llm-wiki-skill/packages/graph-engine/test/keyboard.test.ts +59 -0
  299. package/skills/llm-wiki-skill/packages/graph-engine/test/large-fixtures.test.ts +47 -0
  300. package/skills/llm-wiki-skill/packages/graph-engine/test/large-graph-fixtures.ts +420 -0
  301. package/skills/llm-wiki-skill/packages/graph-engine/test/learning.test.ts +259 -0
  302. package/skills/llm-wiki-skill/packages/graph-engine/test/node-drag-lifecycle.test.ts +166 -0
  303. package/skills/llm-wiki-skill/packages/graph-engine/test/overlays.test.ts +115 -0
  304. package/skills/llm-wiki-skill/packages/graph-engine/test/preview.test.ts +56 -0
  305. package/skills/llm-wiki-skill/packages/graph-engine/test/queue.test.ts +114 -0
  306. package/skills/llm-wiki-skill/packages/graph-engine/test/relation-focus.test.ts +115 -0
  307. package/skills/llm-wiki-skill/packages/graph-engine/test/render-model.test.ts +1030 -0
  308. package/skills/llm-wiki-skill/packages/graph-engine/test/renderer-adapter-contract.test.ts +271 -0
  309. package/skills/llm-wiki-skill/packages/graph-engine/test/renderer-boundary.test.ts +618 -0
  310. package/skills/llm-wiki-skill/packages/graph-engine/test/renderer-lifecycle.test.ts +1711 -0
  311. package/skills/llm-wiki-skill/packages/graph-engine/test/route-continuity.test.ts +284 -0
  312. package/skills/llm-wiki-skill/packages/graph-engine/test/runtime-state.test.ts +281 -0
  313. package/skills/llm-wiki-skill/packages/graph-engine/test/search-and-legend.test.ts +124 -0
  314. package/skills/llm-wiki-skill/packages/graph-engine/test/select.test.ts +168 -0
  315. package/skills/llm-wiki-skill/packages/graph-engine/test/sigma-coordinates.test.ts +50 -0
  316. package/skills/llm-wiki-skill/packages/graph-engine/test/sigma-global-renderer.test.ts +2210 -0
  317. package/skills/llm-wiki-skill/packages/graph-engine/test/sigma-trial-adapter.test.ts +82 -0
  318. package/skills/llm-wiki-skill/packages/graph-engine/test/sigma-trial-adapter.ts +271 -0
  319. package/skills/llm-wiki-skill/packages/graph-engine/test/sim.test.ts +207 -0
  320. package/skills/llm-wiki-skill/packages/graph-engine/test/simulation-bridge.test.ts +96 -0
  321. package/skills/llm-wiki-skill/packages/graph-engine/test/spatial-index.test.ts +222 -0
  322. package/skills/llm-wiki-skill/packages/graph-engine/test/state.test.ts +189 -0
  323. package/skills/llm-wiki-skill/packages/graph-engine/test/summary-contract.test.ts +422 -0
  324. package/skills/llm-wiki-skill/packages/graph-engine/test/themes.test.ts +62 -0
  325. package/skills/llm-wiki-skill/packages/graph-engine/test/toolbar.test.ts +64 -0
  326. package/skills/llm-wiki-skill/packages/graph-engine/test/viewport.test.ts +213 -0
  327. package/skills/llm-wiki-skill/packages/graph-engine/test/vis-network-trial-adapter.test.ts +82 -0
  328. package/skills/llm-wiki-skill/packages/graph-engine/test/vis-network-trial-adapter.ts +186 -0
  329. package/skills/llm-wiki-skill/packages/graph-engine/tsconfig.json +17 -0
  330. package/skills/llm-wiki-skill/packages/graph-engine/vite.config.ts +15 -0
  331. package/skills/llm-wiki-skill/platforms/claude/CLAUDE.md +37 -0
  332. package/skills/llm-wiki-skill/platforms/claude/companions/llm-wiki-upgrade/SKILL.md +95 -0
  333. package/skills/llm-wiki-skill/platforms/codex/AGENTS.md +23 -0
  334. package/skills/llm-wiki-skill/platforms/hermes/README.md +31 -0
  335. package/skills/llm-wiki-skill/platforms/openclaw/README.md +31 -0
  336. package/skills/llm-wiki-skill/scripts/adapter-state.sh +424 -0
  337. package/skills/llm-wiki-skill/scripts/build-graph-data.sh +395 -0
  338. package/skills/llm-wiki-skill/scripts/build-graph-html.sh +459 -0
  339. package/skills/llm-wiki-skill/scripts/cache.sh +352 -0
  340. package/skills/llm-wiki-skill/scripts/create-source-page.sh +100 -0
  341. package/skills/llm-wiki-skill/scripts/delete-helper.sh +68 -0
  342. package/skills/llm-wiki-skill/scripts/graph-analysis.js +732 -0
  343. package/skills/llm-wiki-skill/scripts/hook-session-start.sh +46 -0
  344. package/skills/llm-wiki-skill/scripts/init-wiki.sh +95 -0
  345. package/skills/llm-wiki-skill/scripts/lib/source-signal-eligibility.js +158 -0
  346. package/skills/llm-wiki-skill/scripts/lint-fix.sh +114 -0
  347. package/skills/llm-wiki-skill/scripts/lint-runner.sh +217 -0
  348. package/skills/llm-wiki-skill/scripts/runtime-context.sh +77 -0
  349. package/skills/llm-wiki-skill/scripts/shared-config.sh +83 -0
  350. package/skills/llm-wiki-skill/scripts/source-record-contract.tsv +10 -0
  351. package/skills/llm-wiki-skill/scripts/source-registry.sh +349 -0
  352. package/skills/llm-wiki-skill/scripts/source-registry.tsv +10 -0
  353. package/skills/llm-wiki-skill/scripts/source-signal-coverage.js +83 -0
  354. package/skills/llm-wiki-skill/scripts/validate-step1.sh +144 -0
  355. package/skills/llm-wiki-skill/scripts/wiki-compat.sh +267 -0
  356. package/skills/llm-wiki-skill/setup.sh +8 -0
  357. package/skills/llm-wiki-skill/templates/entity-template.md +30 -0
  358. package/skills/llm-wiki-skill/templates/graph-styles/wash/footer.html +27 -0
  359. package/skills/llm-wiki-skill/templates/graph-styles/wash/graph-wash-helpers.js +1326 -0
  360. package/skills/llm-wiki-skill/templates/graph-styles/wash/graph-wash.js +1009 -0
  361. package/skills/llm-wiki-skill/templates/graph-styles/wash/header.html +2002 -0
  362. package/skills/llm-wiki-skill/templates/index-en-template.md +51 -0
  363. package/skills/llm-wiki-skill/templates/index-template.md +51 -0
  364. package/skills/llm-wiki-skill/templates/log-en-template.md +11 -0
  365. package/skills/llm-wiki-skill/templates/log-template.md +11 -0
  366. package/skills/llm-wiki-skill/templates/overview-en-template.md +41 -0
  367. package/skills/llm-wiki-skill/templates/overview-template.md +41 -0
  368. package/skills/llm-wiki-skill/templates/purpose-en-template.md +16 -0
  369. package/skills/llm-wiki-skill/templates/purpose-template.md +16 -0
  370. package/skills/llm-wiki-skill/templates/query-template.md +19 -0
  371. package/skills/llm-wiki-skill/templates/schema-template.md +185 -0
  372. package/skills/llm-wiki-skill/templates/source-template.md +51 -0
  373. package/skills/llm-wiki-skill/templates/synthesis-template.md +25 -0
  374. package/skills/llm-wiki-skill/templates/topic-template.md +35 -0
  375. package/skills/llm-wiki-skill/tests/adapter-state.sh +338 -0
  376. package/skills/llm-wiki-skill/tests/browser/graph-aggregation-fallback-trial.ts +737 -0
  377. package/skills/llm-wiki-skill/tests/browser/graph-community-node-map.mjs +255 -0
  378. package/skills/llm-wiki-skill/tests/browser/graph-community-wash-interactions.mjs +170 -0
  379. package/skills/llm-wiki-skill/tests/browser/graph-default-behavior.mjs +630 -0
  380. package/skills/llm-wiki-skill/tests/browser/graph-density-preview.mjs +53 -0
  381. package/skills/llm-wiki-skill/tests/browser/graph-html-insights.mjs +41 -0
  382. package/skills/llm-wiki-skill/tests/browser/graph-large-performance.ts +689 -0
  383. package/skills/llm-wiki-skill/tests/browser/graph-node-slim.mjs +75 -0
  384. package/skills/llm-wiki-skill/tests/browser/graph-offline-phase-6.mjs +660 -0
  385. package/skills/llm-wiki-skill/tests/browser/graph-renderer-trial-shared.ts +291 -0
  386. package/skills/llm-wiki-skill/tests/browser/graph-sigma-global-production.ts +1437 -0
  387. package/skills/llm-wiki-skill/tests/browser/graph-sigma-graphology-trial.ts +949 -0
  388. package/skills/llm-wiki-skill/tests/browser/graph-stage-4-5.mjs +815 -0
  389. package/skills/llm-wiki-skill/tests/browser/graph-vis-network-trial.ts +762 -0
  390. package/skills/llm-wiki-skill/tests/browser/graph-workbench-interactions.mjs +730 -0
  391. package/skills/llm-wiki-skill/tests/browser/validate-graph-trial-result.mjs +149 -0
  392. package/skills/llm-wiki-skill/tests/expected/graph-data-empty.json +60 -0
  393. package/skills/llm-wiki-skill/tests/expected/graph-data-sample.json +396 -0
  394. package/skills/llm-wiki-skill/tests/expected/graph-interactive-basic.html +1736 -0
  395. package/skills/llm-wiki-skill/tests/expected/lint-output.txt +44 -0
  396. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/index.md +1 -0
  397. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/entities/Alpha.md +10 -0
  398. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/entities/Beta.md +7 -0
  399. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/entities/Delta.md +8 -0
  400. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/entities/Gamma.md +8 -0
  401. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/queries/20260422-abc.md +10 -0
  402. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/synthesis/Crystal.md +8 -0
  403. package/skills/llm-wiki-skill/tests/fixtures/coverage-sample-wiki/wiki/topics/Overview.md +9 -0
  404. package/skills/llm-wiki-skill/tests/fixtures/graph-data-empty-wiki/wiki/entities/.gitkeep +0 -0
  405. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/purpose.md +3 -0
  406. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/entities/Attention.md +7 -0
  407. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/entities/Decoder.md +7 -0
  408. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/entities/Encoder.md +7 -0
  409. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/entities/GPT.md +7 -0
  410. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/entities/Transformer.md +13 -0
  411. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/sources/paper.md +9 -0
  412. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/topics/arch.md +12 -0
  413. package/skills/llm-wiki-skill/tests/fixtures/graph-data-sample-wiki/wiki/topics/finetune.md +9 -0
  414. package/skills/llm-wiki-skill/tests/fixtures/graph-interactive-basic/wiki/graph-data.json +40 -0
  415. package/skills/llm-wiki-skill/tests/fixtures/graph-interactive-dense/wiki/graph-data.json +3965 -0
  416. package/skills/llm-wiki-skill/tests/fixtures/graph-interactive-multicomm/wiki/graph-data.json +212 -0
  417. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/index.md +14 -0
  418. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/entities/C++.md +6 -0
  419. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/entities/Lonely.md +4 -0
  420. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/entities/Other.md +8 -0
  421. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/entities/Real.md +7 -0
  422. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/sources/2026-01-01-test-source.md +15 -0
  423. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/sources/2026-02-01-inline-img.md +12 -0
  424. package/skills/llm-wiki-skill/tests/fixtures/lint-sample-wiki/wiki/topics/AIbasic.md +3 -0
  425. package/skills/llm-wiki-skill/tests/graph-aggregation-fallback-trial.regression-1.sh +46 -0
  426. package/skills/llm-wiki-skill/tests/graph-analysis-helper.regression-1.sh +237 -0
  427. package/skills/llm-wiki-skill/tests/graph-browser-large-performance.regression-1.sh +39 -0
  428. package/skills/llm-wiki-skill/tests/graph-browser-stage-4-5.regression-1.sh +163 -0
  429. package/skills/llm-wiki-skill/tests/graph-build-failures.regression-1.sh +91 -0
  430. package/skills/llm-wiki-skill/tests/graph-community-node-map.regression-1.sh +107 -0
  431. package/skills/llm-wiki-skill/tests/graph-community-wash-interactions.regression-1.sh +35 -0
  432. package/skills/llm-wiki-skill/tests/graph-data-confidence-merge.regression-1.sh +309 -0
  433. package/skills/llm-wiki-skill/tests/graph-data-source-paths.regression-1.sh +49 -0
  434. package/skills/llm-wiki-skill/tests/graph-default-behavior.regression-1.sh +35 -0
  435. package/skills/llm-wiki-skill/tests/graph-html-a11y.regression-1.sh +50 -0
  436. package/skills/llm-wiki-skill/tests/graph-html-brand-link.regression-1.sh +47 -0
  437. package/skills/llm-wiki-skill/tests/graph-html-density.regression-1.sh +228 -0
  438. package/skills/llm-wiki-skill/tests/graph-html-drawer-neighbors.regression-1.sh +47 -0
  439. package/skills/llm-wiki-skill/tests/graph-html-insights.regression-1.sh +80 -0
  440. package/skills/llm-wiki-skill/tests/graph-html-long-label.regression-1.sh +92 -0
  441. package/skills/llm-wiki-skill/tests/graph-html-minimap.regression-1.sh +51 -0
  442. package/skills/llm-wiki-skill/tests/graph-html-mobile.regression-1.sh +48 -0
  443. package/skills/llm-wiki-skill/tests/graph-html-oriental-atlas-contract.regression-1.sh +94 -0
  444. package/skills/llm-wiki-skill/tests/graph-html-oriental-design-contract.regression-1.sh +82 -0
  445. package/skills/llm-wiki-skill/tests/graph-html-search.regression-1.sh +52 -0
  446. package/skills/llm-wiki-skill/tests/graph-html-styles.regression-1.sh +66 -0
  447. package/skills/llm-wiki-skill/tests/graph-html-toolbar.regression-1.sh +62 -0
  448. package/skills/llm-wiki-skill/tests/graph-offline-phase-6.regression-1.sh +51 -0
  449. package/skills/llm-wiki-skill/tests/graph-sigma-global-production.regression-1.sh +64 -0
  450. package/skills/llm-wiki-skill/tests/graph-sigma-graphology-trial.regression-1.sh +46 -0
  451. package/skills/llm-wiki-skill/tests/graph-vis-network-trial.regression-1.sh +46 -0
  452. package/skills/llm-wiki-skill/tests/graph-workbench-interactions.regression-1.sh +151 -0
  453. package/skills/llm-wiki-skill/tests/js/graph-wash-bootstrap.test.js +110 -0
  454. package/skills/llm-wiki-skill/tests/js/graph-wash-helpers.test.js +296 -0
  455. package/skills/llm-wiki-skill/tests/js/graph-wash-learning.test.js +260 -0
  456. package/skills/llm-wiki-skill/tests/js/graph-wash-queue.test.js +115 -0
  457. package/skills/llm-wiki-skill/tests/js/graph-wash-runtime-state.test.js +282 -0
  458. package/skills/llm-wiki-skill/tests/js/source-signal-coverage.test.js +48 -0
  459. package/skills/llm-wiki-skill/tests/js/source-signal-eligibility.test.js +202 -0
  460. package/skills/llm-wiki-skill/tests/lib/graph-html-engine-helpers.sh +110 -0
  461. package/skills/llm-wiki-skill/tests/lint-output.regression-1.sh +32 -0
  462. package/skills/llm-wiki-skill/tests/regression.sh +1754 -0
  463. package/skills/llm-wiki-skill/workbench/AGENTS.md +110 -0
  464. package/skills/llm-wiki-skill/workbench/CLAUDE.md +55 -0
  465. package/skills/llm-wiki-skill/workbench/LICENSE +21 -0
  466. package/skills/llm-wiki-skill/workbench/PRODUCT.md +1353 -0
  467. package/skills/llm-wiki-skill/workbench/README.md +30 -0
  468. package/skills/llm-wiki-skill/workbench/docs/current-kb-retrieval-design.md +587 -0
  469. package/skills/llm-wiki-skill/workbench/docs/graph-evolution-1-design.md +210 -0
  470. package/skills/llm-wiki-skill/workbench/docs/stage-2-design.md +1139 -0
  471. package/skills/llm-wiki-skill/workbench/docs/stage-3-design.md +1269 -0
  472. package/skills/llm-wiki-skill/workbench/docs/stage-3.5-design.md +1164 -0
  473. package/skills/llm-wiki-skill/workbench/docs/stage-4-design.md +504 -0
  474. package/skills/llm-wiki-skill/workbench/docs/stage-4.5-design.md +195 -0
  475. package/skills/llm-wiki-skill/workbench/docs/superpowers/specs/2026-05-28-resizable-preview-layout-design.md +165 -0
  476. package/skills/llm-wiki-skill/workbench/docs/superpowers/specs/2026-05-28-settings-panel-scroll-fix.md +50 -0
  477. package/skills/llm-wiki-skill/workbench/server/package.json +31 -0
  478. package/skills/llm-wiki-skill/workbench/server/src/agent.ts +457 -0
  479. package/skills/llm-wiki-skill/workbench/server/src/artifacts.ts +248 -0
  480. package/skills/llm-wiki-skill/workbench/server/src/auth.ts +164 -0
  481. package/skills/llm-wiki-skill/workbench/server/src/config.ts +130 -0
  482. package/skills/llm-wiki-skill/workbench/server/src/conversations.test.ts +159 -0
  483. package/skills/llm-wiki-skill/workbench/server/src/conversations.ts +270 -0
  484. package/skills/llm-wiki-skill/workbench/server/src/digest/batch.ts +189 -0
  485. package/skills/llm-wiki-skill/workbench/server/src/digest/concurrency.test.ts +36 -0
  486. package/skills/llm-wiki-skill/workbench/server/src/digest/concurrency.ts +31 -0
  487. package/skills/llm-wiki-skill/workbench/server/src/digest/subagent.ts +91 -0
  488. package/skills/llm-wiki-skill/workbench/server/src/extensions/artifacts.ts +81 -0
  489. package/skills/llm-wiki-skill/workbench/server/src/extensions/knowledge-base.ts +263 -0
  490. package/skills/llm-wiki-skill/workbench/server/src/extensions/new-wiki.ts +42 -0
  491. package/skills/llm-wiki-skill/workbench/server/src/extensions/synthesis.ts +172 -0
  492. package/skills/llm-wiki-skill/workbench/server/src/graph-watcher.test.ts +196 -0
  493. package/skills/llm-wiki-skill/workbench/server/src/graph.test.ts +113 -0
  494. package/skills/llm-wiki-skill/workbench/server/src/graph.ts +351 -0
  495. package/skills/llm-wiki-skill/workbench/server/src/index.ts +1148 -0
  496. package/skills/llm-wiki-skill/workbench/server/src/knowledge-bases.test.ts +30 -0
  497. package/skills/llm-wiki-skill/workbench/server/src/knowledge-bases.ts +321 -0
  498. package/skills/llm-wiki-skill/workbench/server/src/pages.test.ts +41 -0
  499. package/skills/llm-wiki-skill/workbench/server/src/pages.ts +160 -0
  500. package/skills/llm-wiki-skill/workbench/server/src/retrieval.test.ts +151 -0
  501. package/skills/llm-wiki-skill/workbench/server/src/retrieval.ts +427 -0
  502. package/skills/llm-wiki-skill/workbench/server/src/tool-status-events.test.ts +363 -0
  503. package/skills/llm-wiki-skill/workbench/server/src/tool-status-events.ts +616 -0
  504. package/skills/llm-wiki-skill/workbench/server/src/wiki-init.test.ts +19 -0
  505. package/skills/llm-wiki-skill/workbench/server/src/wiki-init.ts +188 -0
  506. package/skills/llm-wiki-skill/workbench/server/tsconfig.json +10 -0
  507. package/skills/llm-wiki-skill/workbench/tsconfig.json +20 -0
  508. package/skills/llm-wiki-skill/workbench/web/README.md +73 -0
  509. package/skills/llm-wiki-skill/workbench/web/components.json +21 -0
  510. package/skills/llm-wiki-skill/workbench/web/eslint.config.js +22 -0
  511. package/skills/llm-wiki-skill/workbench/web/index.html +16 -0
  512. package/skills/llm-wiki-skill/workbench/web/package.json +54 -0
  513. package/skills/llm-wiki-skill/workbench/web/src/App.tsx +1195 -0
  514. package/skills/llm-wiki-skill/workbench/web/src/components/AddExternalDialog.tsx +375 -0
  515. package/skills/llm-wiki-skill/workbench/web/src/components/AppearancePanel.tsx +158 -0
  516. package/skills/llm-wiki-skill/workbench/web/src/components/ArtifactView.tsx +15 -0
  517. package/skills/llm-wiki-skill/workbench/web/src/components/BatchDigestPanel.tsx +117 -0
  518. package/skills/llm-wiki-skill/workbench/web/src/components/ChatPanel.tsx +890 -0
  519. package/skills/llm-wiki-skill/workbench/web/src/components/CommandMenu.tsx +75 -0
  520. package/skills/llm-wiki-skill/workbench/web/src/components/ExportButtons.tsx +58 -0
  521. package/skills/llm-wiki-skill/workbench/web/src/components/GraphPanel.tsx +800 -0
  522. package/skills/llm-wiki-skill/workbench/web/src/components/GraphReader.tsx +52 -0
  523. package/skills/llm-wiki-skill/workbench/web/src/components/GraphSelection.tsx +100 -0
  524. package/skills/llm-wiki-skill/workbench/web/src/components/GraphSummaryDrawer.tsx +269 -0
  525. package/skills/llm-wiki-skill/workbench/web/src/components/MainViewTabs.tsx +69 -0
  526. package/skills/llm-wiki-skill/workbench/web/src/components/MarkdownView.tsx +106 -0
  527. package/skills/llm-wiki-skill/workbench/web/src/components/NewWikiDialog.tsx +103 -0
  528. package/skills/llm-wiki-skill/workbench/web/src/components/RefMenu.tsx +44 -0
  529. package/skills/llm-wiki-skill/workbench/web/src/components/RightDrawer.tsx +298 -0
  530. package/skills/llm-wiki-skill/workbench/web/src/components/SearchPanel.tsx +165 -0
  531. package/skills/llm-wiki-skill/workbench/web/src/components/SettingsPanel.tsx +320 -0
  532. package/skills/llm-wiki-skill/workbench/web/src/components/Sidebar.tsx +354 -0
  533. package/skills/llm-wiki-skill/workbench/web/src/components/ToolHistorySummary.tsx +111 -0
  534. package/skills/llm-wiki-skill/workbench/web/src/components/ToolStatusRunway.tsx +70 -0
  535. package/skills/llm-wiki-skill/workbench/web/src/components/TopBar.tsx +348 -0
  536. package/skills/llm-wiki-skill/workbench/web/src/components/renderers/DownloadOnlyRenderer.tsx +88 -0
  537. package/skills/llm-wiki-skill/workbench/web/src/components/renderers/HtmlRenderer.tsx +92 -0
  538. package/skills/llm-wiki-skill/workbench/web/src/components/ui/button.tsx +52 -0
  539. package/skills/llm-wiki-skill/workbench/web/src/components/ui/command.tsx +50 -0
  540. package/skills/llm-wiki-skill/workbench/web/src/components/ui/dialog.tsx +156 -0
  541. package/skills/llm-wiki-skill/workbench/web/src/components/ui/input.tsx +21 -0
  542. package/skills/llm-wiki-skill/workbench/web/src/components/ui/tooltip.tsx +57 -0
  543. package/skills/llm-wiki-skill/workbench/web/src/index.css +4204 -0
  544. package/skills/llm-wiki-skill/workbench/web/src/lib/api.ts +648 -0
  545. package/skills/llm-wiki-skill/workbench/web/src/lib/appearance.ts +114 -0
  546. package/skills/llm-wiki-skill/workbench/web/src/lib/drawer-layout.ts +41 -0
  547. package/skills/llm-wiki-skill/workbench/web/src/lib/drawer-state.ts +168 -0
  548. package/skills/llm-wiki-skill/workbench/web/src/lib/graph-reader.ts +25 -0
  549. package/skills/llm-wiki-skill/workbench/web/src/lib/graph-selection-drawer.ts +35 -0
  550. package/skills/llm-wiki-skill/workbench/web/src/lib/graph-selection.ts +96 -0
  551. package/skills/llm-wiki-skill/workbench/web/src/lib/graph-summary-actions.ts +184 -0
  552. package/skills/llm-wiki-skill/workbench/web/src/lib/legacy-tool-status.ts +113 -0
  553. package/skills/llm-wiki-skill/workbench/web/src/lib/model-roles.ts +20 -0
  554. package/skills/llm-wiki-skill/workbench/web/src/lib/search-filter.ts +104 -0
  555. package/skills/llm-wiki-skill/workbench/web/src/lib/sse.ts +72 -0
  556. package/skills/llm-wiki-skill/workbench/web/src/lib/tool-status-format.ts +170 -0
  557. package/skills/llm-wiki-skill/workbench/web/src/lib/tool-status-model.ts +392 -0
  558. package/skills/llm-wiki-skill/workbench/web/src/lib/utils.ts +10 -0
  559. package/skills/llm-wiki-skill/workbench/web/src/lib/view-status.ts +16 -0
  560. package/skills/llm-wiki-skill/workbench/web/src/lib/wiki-links.ts +32 -0
  561. package/skills/llm-wiki-skill/workbench/web/src/main.tsx +10 -0
  562. package/skills/llm-wiki-skill/workbench/web/test/api.test.ts +61 -0
  563. package/skills/llm-wiki-skill/workbench/web/test/app-shell-drawer-layout.test.tsx +48 -0
  564. package/skills/llm-wiki-skill/workbench/web/test/appearance-panel.test.tsx +121 -0
  565. package/skills/llm-wiki-skill/workbench/web/test/appearance.test.ts +262 -0
  566. package/skills/llm-wiki-skill/workbench/web/test/chat-host-source.test.tsx +22 -0
  567. package/skills/llm-wiki-skill/workbench/web/test/chat-panel-auto-scroll.test.tsx +311 -0
  568. package/skills/llm-wiki-skill/workbench/web/test/chat-panel-bubbles.test.tsx +48 -0
  569. package/skills/llm-wiki-skill/workbench/web/test/chat-panel-composer.test.tsx +86 -0
  570. package/skills/llm-wiki-skill/workbench/web/test/chat-panel-tool-status.test.tsx +26 -0
  571. package/skills/llm-wiki-skill/workbench/web/test/export-batch-paper.test.tsx +101 -0
  572. package/skills/llm-wiki-skill/workbench/web/test/graph-drawer-state.test.ts +257 -0
  573. package/skills/llm-wiki-skill/workbench/web/test/graph-panel-paper.test.tsx +200 -0
  574. package/skills/llm-wiki-skill/workbench/web/test/graph-reader-request.test.ts +32 -0
  575. package/skills/llm-wiki-skill/workbench/web/test/graph-reader.test.ts +62 -0
  576. package/skills/llm-wiki-skill/workbench/web/test/graph-selection-drawer.test.ts +56 -0
  577. package/skills/llm-wiki-skill/workbench/web/test/graph-selection.test.ts +83 -0
  578. package/skills/llm-wiki-skill/workbench/web/test/graph-summary-actions.test.ts +188 -0
  579. package/skills/llm-wiki-skill/workbench/web/test/main-view-tabs.test.tsx +34 -0
  580. package/skills/llm-wiki-skill/workbench/web/test/markdown-view.test.tsx +34 -0
  581. package/skills/llm-wiki-skill/workbench/web/test/popup-menus.test.tsx +85 -0
  582. package/skills/llm-wiki-skill/workbench/web/test/render.test.tsx +30 -0
  583. package/skills/llm-wiki-skill/workbench/web/test/render.tsx +38 -0
  584. package/skills/llm-wiki-skill/workbench/web/test/right-drawer-graph-summary.test.tsx +287 -0
  585. package/skills/llm-wiki-skill/workbench/web/test/right-drawer-interactions.test.tsx +182 -0
  586. package/skills/llm-wiki-skill/workbench/web/test/search-filter.test.ts +65 -0
  587. package/skills/llm-wiki-skill/workbench/web/test/search-panel.test.tsx +155 -0
  588. package/skills/llm-wiki-skill/workbench/web/test/setup-dom.ts +66 -0
  589. package/skills/llm-wiki-skill/workbench/web/test/sidebar-v2-source.test.ts +17 -0
  590. package/skills/llm-wiki-skill/workbench/web/test/sidebar.test.tsx +110 -0
  591. package/skills/llm-wiki-skill/workbench/web/test/tool-history-summary.test.tsx +150 -0
  592. package/skills/llm-wiki-skill/workbench/web/test/tool-status-format.test.ts +107 -0
  593. package/skills/llm-wiki-skill/workbench/web/test/tool-status-model.test.ts +324 -0
  594. package/skills/llm-wiki-skill/workbench/web/test/tool-status-runway.test.ts +159 -0
  595. package/skills/llm-wiki-skill/workbench/web/test/topbar.test.tsx +248 -0
  596. package/skills/llm-wiki-skill/workbench/web/test/visual/paper-ui.ts +898 -0
  597. package/skills/llm-wiki-skill/workbench/web/test/wiki-links.test.ts +23 -0
  598. package/skills/llm-wiki-skill/workbench/web/test-results/paper-ui/actual/.gitkeep +1 -0
  599. package/skills/llm-wiki-skill/workbench/web/test-results/paper-ui/baseline/.gitkeep +1 -0
  600. package/skills/llm-wiki-skill/workbench/web/tsconfig.app.json +30 -0
  601. package/skills/llm-wiki-skill/workbench/web/tsconfig.json +7 -0
  602. package/skills/llm-wiki-skill/workbench/web/tsconfig.node.json +24 -0
  603. package/skills/llm-wiki-skill/workbench/web/vite.config.ts +28 -0
@@ -0,0 +1,673 @@
1
+ import type { CommunityId, NodeId } from "../types";
2
+ import type { GraphSpatialHitTarget } from "../layout";
3
+ import { rootClientPointToScreenPoint } from "./geometry";
4
+
5
+ export type GraphGestureTargetKind =
6
+ | "graph-blank"
7
+ | "node"
8
+ | "community-wash"
9
+ | "aggregation-container"
10
+ | "edge"
11
+ | "minimap"
12
+ | "toolbar"
13
+ | "search"
14
+ | "legend"
15
+ | "drawer"
16
+ | "text-control"
17
+ | "unknown";
18
+
19
+ export type GraphOwnedTargetKind = "graph-blank" | "node" | "community-wash" | "aggregation-container" | "edge";
20
+ export type GraphGestureBlockerTargetKind = Exclude<GraphGestureTargetKind, GraphOwnedTargetKind>;
21
+ export type GraphGestureTargetOwnership = "graph-owned" | "graph-blocker";
22
+
23
+ export interface GraphGestureTargetLike {
24
+ closest?: (selector: string) => GraphGestureTargetLike | null;
25
+ dataset?: Record<string, string | undefined>;
26
+ tagName?: string;
27
+ type?: string;
28
+ isContentEditable?: boolean;
29
+ }
30
+
31
+ export type GraphGestureTarget =
32
+ | { kind: "graph-blank" }
33
+ | { kind: "node"; id: NodeId | null }
34
+ | { kind: "community-wash"; id: CommunityId | null }
35
+ | { kind: "aggregation-container"; id: string | null; communityId: CommunityId | null }
36
+ | { kind: "edge"; id: string | null }
37
+ | { kind: "minimap" }
38
+ | { kind: "toolbar" }
39
+ | { kind: "search" }
40
+ | { kind: "legend" }
41
+ | { kind: "drawer" }
42
+ | { kind: "text-control" }
43
+ | { kind: "unknown" };
44
+
45
+ export const GRAPH_OWNED_TARGET_KINDS = [
46
+ "graph-blank",
47
+ "node",
48
+ "community-wash",
49
+ "aggregation-container",
50
+ "edge"
51
+ ] as const satisfies readonly GraphOwnedTargetKind[];
52
+ export const GRAPH_GESTURE_BLOCKER_TARGET_KINDS = [
53
+ "minimap",
54
+ "toolbar",
55
+ "search",
56
+ "legend",
57
+ "drawer",
58
+ "text-control",
59
+ "unknown"
60
+ ] as const satisfies readonly GraphGestureBlockerTargetKind[];
61
+
62
+ export const GRAPH_GESTURE_SELECTORS = {
63
+ textControl: "textarea, select, [contenteditable=\"true\"], [data-graph-text-control=\"true\"]",
64
+ search: ".graph-search",
65
+ toolbar: ".graph-toolbar",
66
+ legend: ".community-legend",
67
+ drawer: ".graph-reader, .graph-selection-panel, [data-graph-drawer=\"true\"]",
68
+ minimap: ".mini-map",
69
+ node: ".node",
70
+ aggregationContainer: ".aggregation-container",
71
+ communityWash: ".community-wash",
72
+ edge: ".edge",
73
+ blank: "[data-graph-blank=\"true\"]"
74
+ } as const;
75
+
76
+ export type GraphWheelTargetDecision =
77
+ | { intent: "zoom"; target: GraphGestureTarget }
78
+ | { intent: "blocked"; target: GraphGestureTarget };
79
+
80
+ export type GraphPointerDownTargetDecision =
81
+ | { intent: "node-drag-candidate"; target: Extract<GraphGestureTarget, { kind: "node" }> }
82
+ | { intent: "community-click-candidate"; target: Extract<GraphGestureTarget, { kind: "community-wash" }> }
83
+ | { intent: "blank-pan-candidate"; target: Extract<GraphGestureTarget, { kind: "graph-blank" | "edge" }> }
84
+ | { intent: "blocked"; target: Exclude<GraphGestureTarget, { kind: "node" | "community-wash" | "graph-blank" | "edge" }> };
85
+
86
+ export interface GraphWheelEventLike {
87
+ ctrlKey?: boolean;
88
+ metaKey?: boolean;
89
+ }
90
+
91
+ export interface GraphPointerEventLike {
92
+ pointerId: number;
93
+ screenPoint: { x: number; y: number };
94
+ shiftKey?: boolean;
95
+ }
96
+
97
+ export interface GraphGestureStateMachineOptions {
98
+ dragThreshold?: number;
99
+ }
100
+
101
+ export interface GraphGestureControllerOptions {
102
+ stateMachine?: GraphGestureStateMachine;
103
+ targetFromEventTarget?: (target: EventTarget | null) => GraphGestureTargetLike | null;
104
+ graphTargetFromScreenPoint?: (screenPoint: { x: number; y: number }) => GraphGestureTarget;
105
+ onWheelZoom: (event: WheelEvent, decision: Extract<GraphWheelTargetDecision, { intent: "zoom" }>, screenPoint: { x: number; y: number }) => void;
106
+ onPointerDown?: (event: PointerEvent, decision: Exclude<GraphPointerDownTargetDecision, { intent: "blocked" }>) => void;
107
+ onGestureIntents: (intents: GraphGestureIntent[], event: PointerEvent | null) => void;
108
+ onActiveStateChange?: (active: GraphGestureActiveState) => void;
109
+ onBlankDoubleClick?: (event: MouseEvent) => void;
110
+ }
111
+
112
+ export type GraphGestureActiveState =
113
+ | {
114
+ kind: "node";
115
+ pointerId: number;
116
+ nodeId: NodeId | null;
117
+ startScreenPoint: { x: number; y: number };
118
+ lastScreenPoint: { x: number; y: number };
119
+ additive: boolean;
120
+ locked: boolean;
121
+ }
122
+ | {
123
+ kind: "community-wash";
124
+ pointerId: number;
125
+ communityId: CommunityId | null;
126
+ startScreenPoint: { x: number; y: number };
127
+ lastScreenPoint: { x: number; y: number };
128
+ locked: boolean;
129
+ cancelled: boolean;
130
+ }
131
+ | {
132
+ kind: "blank-pan";
133
+ pointerId: number;
134
+ startScreenPoint: { x: number; y: number };
135
+ lastScreenPoint: { x: number; y: number };
136
+ locked: boolean;
137
+ }
138
+ | null;
139
+
140
+ export type GraphGestureIntent =
141
+ | { kind: "node-click"; nodeId: NodeId | null; additive: boolean; pointerId: number }
142
+ | { kind: "node-drag-start"; nodeId: NodeId | null; pointerId: number; screenPoint: { x: number; y: number } }
143
+ | {
144
+ kind: "node-drag-move";
145
+ nodeId: NodeId | null;
146
+ pointerId: number;
147
+ screenPoint: { x: number; y: number };
148
+ delta: { x: number; y: number };
149
+ }
150
+ | { kind: "node-drag-end"; nodeId: NodeId | null; pointerId: number; screenPoint: { x: number; y: number } }
151
+ | { kind: "node-drag-cancel"; nodeId: NodeId | null; pointerId: number; reason: "pointercancel" | "lostpointercapture" | "escape" }
152
+ | { kind: "community-click"; communityId: CommunityId | null; pointerId: number }
153
+ | { kind: "community-click-cancelled"; communityId: CommunityId | null; pointerId: number; reason: "moved" | "pointercancel" | "lostpointercapture" | "escape" }
154
+ | { kind: "blank-click"; pointerId: number }
155
+ | { kind: "blank-pan-start"; pointerId: number; screenPoint: { x: number; y: number } }
156
+ | { kind: "blank-pan-move"; pointerId: number; screenPoint: { x: number; y: number }; delta: { x: number; y: number } }
157
+ | { kind: "blank-pan-end"; pointerId: number; screenPoint: { x: number; y: number } }
158
+ | { kind: "blank-pan-cancel"; pointerId: number; reason: "pointercancel" | "lostpointercapture" | "escape" };
159
+
160
+ export function classifyGraphEventTarget(target: GraphGestureTargetLike | null | undefined): GraphGestureTarget {
161
+ if (!target) return { kind: "unknown" };
162
+ if (isTextEditingTarget(target) || closest(target, GRAPH_GESTURE_SELECTORS.textControl)) return { kind: "text-control" };
163
+ if (closest(target, GRAPH_GESTURE_SELECTORS.search)) return { kind: "search" };
164
+ if (closest(target, GRAPH_GESTURE_SELECTORS.legend)) return { kind: "legend" };
165
+ if (closest(target, GRAPH_GESTURE_SELECTORS.toolbar)) return { kind: "toolbar" };
166
+ if (closest(target, GRAPH_GESTURE_SELECTORS.drawer)) return { kind: "drawer" };
167
+ if (closest(target, GRAPH_GESTURE_SELECTORS.minimap)) return { kind: "minimap" };
168
+
169
+ const node = closest(target, GRAPH_GESTURE_SELECTORS.node);
170
+ if (node) return { kind: "node", id: dataValue(node, "id", "nodeId") };
171
+
172
+ const aggregationContainer = closest(target, GRAPH_GESTURE_SELECTORS.aggregationContainer);
173
+ if (aggregationContainer) return {
174
+ kind: "aggregation-container",
175
+ id: dataValue(aggregationContainer, "aggregationId", "id"),
176
+ communityId: dataValue(aggregationContainer, "communityId")
177
+ };
178
+
179
+ const communityWash = closest(target, GRAPH_GESTURE_SELECTORS.communityWash);
180
+ if (communityWash) return { kind: "community-wash", id: dataValue(communityWash, "communityId", "id") };
181
+
182
+ const edge = closest(target, GRAPH_GESTURE_SELECTORS.edge);
183
+ if (edge) return { kind: "edge", id: dataValue(edge, "edgeId", "id") };
184
+
185
+ if (closest(target, GRAPH_GESTURE_SELECTORS.blank)) return { kind: "graph-blank" };
186
+
187
+ return { kind: "graph-blank" };
188
+ }
189
+
190
+ export function graphGestureTargetOwnership(target: GraphGestureTarget): GraphGestureTargetOwnership {
191
+ return isGraphOwnedGestureTarget(target) ? "graph-owned" : "graph-blocker";
192
+ }
193
+
194
+ export function isGraphOwnedGestureTarget(target: GraphGestureTarget): target is Extract<GraphGestureTarget, { kind: GraphOwnedTargetKind }> {
195
+ return (GRAPH_OWNED_TARGET_KINDS as readonly GraphGestureTargetKind[]).includes(target.kind);
196
+ }
197
+
198
+ export function isGraphGestureBlockerTarget(target: GraphGestureTarget): target is Extract<GraphGestureTarget, { kind: GraphGestureBlockerTargetKind }> {
199
+ return !isGraphOwnedGestureTarget(target);
200
+ }
201
+
202
+ export function classifyGraphWheelTarget(target: GraphGestureTargetLike | null | undefined, event: GraphWheelEventLike = {}): GraphWheelTargetDecision {
203
+ return classifyGraphWheelTargetFromGraphTarget(classifyGraphEventTarget(target), event);
204
+ }
205
+
206
+ export function classifyGraphWheelTargetFromGraphTarget(graphTarget: GraphGestureTarget, event: GraphWheelEventLike = {}): GraphWheelTargetDecision {
207
+ return isGraphOwnedGestureTarget(graphTarget)
208
+ ? { intent: "zoom", target: graphTarget }
209
+ : { intent: "blocked", target: graphTarget };
210
+ }
211
+
212
+ export function classifyGraphPointerDownTarget(target: GraphGestureTargetLike | null | undefined): GraphPointerDownTargetDecision {
213
+ return classifyGraphPointerDownTargetFromGraphTarget(classifyGraphEventTarget(target));
214
+ }
215
+
216
+ export function graphSpatialHitToGestureTarget(hit: GraphSpatialHitTarget | null | undefined): GraphGestureTarget {
217
+ if (!hit) return { kind: "unknown" };
218
+ switch (hit.kind) {
219
+ case "node":
220
+ return { kind: "node", id: hit.id };
221
+ case "edge":
222
+ return { kind: "edge", id: hit.id };
223
+ case "community-wash":
224
+ return { kind: "community-wash", id: hit.id };
225
+ case "aggregation-container":
226
+ return { kind: "aggregation-container", id: hit.id, communityId: hit.communityId };
227
+ case "graph-blank":
228
+ return { kind: "graph-blank" };
229
+ default:
230
+ return { kind: "unknown" };
231
+ }
232
+ }
233
+
234
+ export function classifyGraphPointerDownTargetFromGraphTarget(graphTarget: GraphGestureTarget): GraphPointerDownTargetDecision {
235
+ switch (graphTarget.kind) {
236
+ case "node":
237
+ return { intent: "node-drag-candidate", target: graphTarget };
238
+ case "community-wash":
239
+ return { intent: "community-click-candidate", target: graphTarget };
240
+ case "aggregation-container":
241
+ return { intent: "community-click-candidate", target: { kind: "community-wash", id: graphTarget.communityId } };
242
+ case "edge":
243
+ return { intent: "blank-pan-candidate", target: graphTarget };
244
+ case "graph-blank":
245
+ return { intent: "blank-pan-candidate", target: graphTarget };
246
+ default:
247
+ return { intent: "blocked", target: graphTarget };
248
+ }
249
+ }
250
+
251
+ export class GraphGestureStateMachine {
252
+ private readonly dragThreshold: number;
253
+ private active: GraphGestureActiveState = null;
254
+
255
+ constructor(options: GraphGestureStateMachineOptions = {}) {
256
+ this.dragThreshold = finitePositiveNumber(options.dragThreshold, 4);
257
+ }
258
+
259
+ snapshot(): GraphGestureActiveState {
260
+ return cloneActiveState(this.active);
261
+ }
262
+
263
+ pointerDown(decision: GraphPointerDownTargetDecision, event: GraphPointerEventLike): GraphGestureIntent[] {
264
+ this.active = null;
265
+ if (decision.intent === "node-drag-candidate") {
266
+ this.active = {
267
+ kind: "node",
268
+ pointerId: event.pointerId,
269
+ nodeId: decision.target.id,
270
+ startScreenPoint: cloneScreenPoint(event.screenPoint),
271
+ lastScreenPoint: cloneScreenPoint(event.screenPoint),
272
+ additive: Boolean(event.shiftKey),
273
+ locked: false
274
+ };
275
+ return [];
276
+ }
277
+ if (decision.intent === "community-click-candidate") {
278
+ this.active = {
279
+ kind: "community-wash",
280
+ pointerId: event.pointerId,
281
+ communityId: decision.target.id,
282
+ startScreenPoint: cloneScreenPoint(event.screenPoint),
283
+ lastScreenPoint: cloneScreenPoint(event.screenPoint),
284
+ locked: false,
285
+ cancelled: false
286
+ };
287
+ return [];
288
+ }
289
+ if (decision.intent === "blank-pan-candidate") {
290
+ this.active = {
291
+ kind: "blank-pan",
292
+ pointerId: event.pointerId,
293
+ startScreenPoint: cloneScreenPoint(event.screenPoint),
294
+ lastScreenPoint: cloneScreenPoint(event.screenPoint),
295
+ locked: false
296
+ };
297
+ }
298
+ return [];
299
+ }
300
+
301
+ pointerMove(event: GraphPointerEventLike): GraphGestureIntent[] {
302
+ if (!this.active || this.active.pointerId !== event.pointerId) return [];
303
+ const active = this.active;
304
+ const distance = screenDistance(active.startScreenPoint, event.screenPoint);
305
+ const delta = screenDelta(active.lastScreenPoint, event.screenPoint);
306
+ active.lastScreenPoint = cloneScreenPoint(event.screenPoint);
307
+
308
+ if (active.kind === "node") {
309
+ const intents: GraphGestureIntent[] = [];
310
+ if (!active.locked && distance > this.dragThreshold) {
311
+ active.locked = true;
312
+ intents.push({
313
+ kind: "node-drag-start",
314
+ nodeId: active.nodeId,
315
+ pointerId: active.pointerId,
316
+ screenPoint: cloneScreenPoint(event.screenPoint)
317
+ });
318
+ }
319
+ if (active.locked) {
320
+ intents.push({
321
+ kind: "node-drag-move",
322
+ nodeId: active.nodeId,
323
+ pointerId: active.pointerId,
324
+ screenPoint: cloneScreenPoint(event.screenPoint),
325
+ delta
326
+ });
327
+ }
328
+ return intents;
329
+ }
330
+
331
+ if (active.kind === "community-wash") {
332
+ if (!active.locked && distance > this.dragThreshold) {
333
+ active.locked = true;
334
+ active.cancelled = true;
335
+ return [{
336
+ kind: "community-click-cancelled",
337
+ communityId: active.communityId,
338
+ pointerId: active.pointerId,
339
+ reason: "moved"
340
+ }];
341
+ }
342
+ return [];
343
+ }
344
+
345
+ const intents: GraphGestureIntent[] = [];
346
+ if (!active.locked && distance > this.dragThreshold) {
347
+ active.locked = true;
348
+ intents.push({
349
+ kind: "blank-pan-start",
350
+ pointerId: active.pointerId,
351
+ screenPoint: cloneScreenPoint(event.screenPoint)
352
+ });
353
+ }
354
+ if (active.locked) {
355
+ intents.push({
356
+ kind: "blank-pan-move",
357
+ pointerId: active.pointerId,
358
+ screenPoint: cloneScreenPoint(event.screenPoint),
359
+ delta
360
+ });
361
+ }
362
+ return intents;
363
+ }
364
+
365
+ pointerUp(event: GraphPointerEventLike): GraphGestureIntent[] {
366
+ if (!this.active || this.active.pointerId !== event.pointerId) return [];
367
+ const active = this.active;
368
+ this.active = null;
369
+
370
+ if (active.kind === "node") {
371
+ if (active.locked) {
372
+ return [{
373
+ kind: "node-drag-end",
374
+ nodeId: active.nodeId,
375
+ pointerId: active.pointerId,
376
+ screenPoint: cloneScreenPoint(event.screenPoint)
377
+ }];
378
+ }
379
+ return [{
380
+ kind: "node-click",
381
+ nodeId: active.nodeId,
382
+ additive: active.additive,
383
+ pointerId: active.pointerId
384
+ }];
385
+ }
386
+
387
+ if (active.kind === "community-wash") {
388
+ if (active.cancelled || active.locked) return [];
389
+ return [{
390
+ kind: "community-click",
391
+ communityId: active.communityId,
392
+ pointerId: active.pointerId
393
+ }];
394
+ }
395
+
396
+ if (active.locked) {
397
+ return [{
398
+ kind: "blank-pan-end",
399
+ pointerId: active.pointerId,
400
+ screenPoint: cloneScreenPoint(event.screenPoint)
401
+ }];
402
+ }
403
+ return [{ kind: "blank-click", pointerId: active.pointerId }];
404
+ }
405
+
406
+ pointerCancel(event: Pick<GraphPointerEventLike, "pointerId">): GraphGestureIntent[] {
407
+ return this.cancel(event.pointerId, "pointercancel");
408
+ }
409
+
410
+ lostPointerCapture(event: Pick<GraphPointerEventLike, "pointerId">): GraphGestureIntent[] {
411
+ return this.cancel(event.pointerId, "lostpointercapture");
412
+ }
413
+
414
+ escape(): GraphGestureIntent[] {
415
+ return this.active ? this.cancel(this.active.pointerId, "escape") : [];
416
+ }
417
+
418
+ private cancel(pointerId: number, reason: "pointercancel" | "lostpointercapture" | "escape"): GraphGestureIntent[] {
419
+ if (!this.active || this.active.pointerId !== pointerId) return [];
420
+ const active = this.active;
421
+ this.active = null;
422
+ if (active.kind === "node") {
423
+ return active.locked
424
+ ? [{ kind: "node-drag-cancel", nodeId: active.nodeId, pointerId, reason }]
425
+ : [];
426
+ }
427
+ if (active.kind === "community-wash") {
428
+ return active.cancelled
429
+ ? []
430
+ : [{ kind: "community-click-cancelled", communityId: active.communityId, pointerId, reason }];
431
+ }
432
+ return active.locked ? [{ kind: "blank-pan-cancel", pointerId, reason }] : [];
433
+ }
434
+ }
435
+
436
+ export class GraphGestureController {
437
+ private readonly root: HTMLElement;
438
+ private readonly options: GraphGestureControllerOptions;
439
+ private readonly stateMachine: GraphGestureStateMachine;
440
+ private lastBlankDoubleClick: { x: number; y: number; timeStamp: number } | null = null;
441
+ private readonly recentPointerDownTargets: Array<{ x: number; y: number; timeStamp: number; target: GraphGestureTarget }> = [];
442
+ private destroyed = false;
443
+
444
+ constructor(root: HTMLElement, options: GraphGestureControllerOptions) {
445
+ this.root = root;
446
+ this.options = options;
447
+ this.stateMachine = options.stateMachine || new GraphGestureStateMachine();
448
+ this.root.addEventListener("wheel", this.handleWheel, { passive: false });
449
+ this.root.addEventListener("pointerdown", this.handlePointerDown);
450
+ this.root.addEventListener("pointermove", this.handlePointerMove);
451
+ this.root.addEventListener("pointerup", this.handlePointerUp);
452
+ this.root.addEventListener("pointercancel", this.handlePointerCancel);
453
+ this.root.addEventListener("lostpointercapture", this.handleLostPointerCapture);
454
+ this.root.addEventListener("click", this.handleClick);
455
+ this.root.addEventListener("dblclick", this.handleDoubleClick);
456
+ }
457
+
458
+ destroy(): void {
459
+ if (this.destroyed) return;
460
+ this.destroyed = true;
461
+ this.root.removeEventListener("wheel", this.handleWheel);
462
+ this.root.removeEventListener("pointerdown", this.handlePointerDown);
463
+ this.root.removeEventListener("pointermove", this.handlePointerMove);
464
+ this.root.removeEventListener("pointerup", this.handlePointerUp);
465
+ this.root.removeEventListener("pointercancel", this.handlePointerCancel);
466
+ this.root.removeEventListener("lostpointercapture", this.handleLostPointerCapture);
467
+ this.root.removeEventListener("click", this.handleClick);
468
+ this.root.removeEventListener("dblclick", this.handleDoubleClick);
469
+ }
470
+
471
+ snapshot(): GraphGestureActiveState {
472
+ return this.stateMachine.snapshot();
473
+ }
474
+
475
+ escape(): GraphGestureIntent[] {
476
+ const intents = this.stateMachine.escape();
477
+ this.emitActiveState();
478
+ return intents;
479
+ }
480
+
481
+ private readonly handleWheel = (event: WheelEvent): void => {
482
+ const screenPoint = this.screenPointFromMouseEvent(event);
483
+ const decision = classifyGraphWheelTargetFromGraphTarget(this.graphTargetForEvent(event.target, screenPoint), event);
484
+ if (decision.intent !== "zoom") return;
485
+ event.preventDefault();
486
+ this.options.onWheelZoom(event, decision, screenPoint);
487
+ };
488
+
489
+ private readonly handlePointerDown = (event: PointerEvent): void => {
490
+ if (event.button !== 0) return;
491
+ const screenPoint = this.screenPointFromMouseEvent(event);
492
+ const decision = classifyGraphPointerDownTargetFromGraphTarget(
493
+ this.graphTargetForEvent(event.target, screenPoint)
494
+ );
495
+ if (decision.intent === "blocked") return;
496
+ this.recordPointerDown(decision.target, screenPoint, event.timeStamp);
497
+ event.preventDefault();
498
+ this.options.onPointerDown?.(event, decision);
499
+ this.stateMachine.pointerDown(decision, this.pointerEventFromPointerEvent(event));
500
+ this.emitActiveState();
501
+ this.root.setPointerCapture(event.pointerId);
502
+ };
503
+
504
+ private readonly handlePointerMove = (event: PointerEvent): void => {
505
+ if (this.stateMachine.snapshot()) event.preventDefault();
506
+ this.applyIntents(this.stateMachine.pointerMove(this.pointerEventFromPointerEvent(event)), event);
507
+ };
508
+
509
+ private readonly handlePointerUp = (event: PointerEvent): void => {
510
+ if (this.stateMachine.snapshot()) event.preventDefault();
511
+ this.applyIntents(this.stateMachine.pointerUp(this.pointerEventFromPointerEvent(event)), event);
512
+ if (this.root.hasPointerCapture(event.pointerId)) this.root.releasePointerCapture(event.pointerId);
513
+ };
514
+
515
+ private readonly handlePointerCancel = (event: PointerEvent): void => {
516
+ if (this.stateMachine.snapshot()) event.preventDefault();
517
+ this.applyIntents(this.stateMachine.pointerCancel({ pointerId: event.pointerId }), event);
518
+ if (this.root.hasPointerCapture(event.pointerId)) this.root.releasePointerCapture(event.pointerId);
519
+ };
520
+
521
+ private readonly handleLostPointerCapture = (event: PointerEvent): void => {
522
+ const pointerId = Number(event.pointerId);
523
+ if (!Number.isFinite(pointerId)) return;
524
+ this.applyIntents(this.stateMachine.lostPointerCapture({ pointerId }), null);
525
+ };
526
+
527
+ private readonly handleClick = (event: MouseEvent): void => {
528
+ if (event.detail < 2) return;
529
+ this.triggerBlankDoubleClick(event);
530
+ };
531
+
532
+ private readonly handleDoubleClick = (event: MouseEvent): void => {
533
+ if (this.isDuplicateBlankDoubleClick(event)) return;
534
+ this.triggerBlankDoubleClick(event);
535
+ };
536
+
537
+ private triggerBlankDoubleClick(event: MouseEvent): void {
538
+ if (!this.isTrueBlankDoubleClick(event)) return;
539
+ event.preventDefault();
540
+ event.stopPropagation();
541
+ this.lastBlankDoubleClick = {
542
+ x: event.clientX,
543
+ y: event.clientY,
544
+ timeStamp: event.timeStamp
545
+ };
546
+ this.options.onBlankDoubleClick?.(event);
547
+ }
548
+
549
+ private isDuplicateBlankDoubleClick(event: MouseEvent): boolean {
550
+ if (!this.lastBlankDoubleClick) return false;
551
+ return Math.abs(this.lastBlankDoubleClick.x - event.clientX) < 1
552
+ && Math.abs(this.lastBlankDoubleClick.y - event.clientY) < 1
553
+ && event.timeStamp - this.lastBlankDoubleClick.timeStamp < 500;
554
+ }
555
+
556
+ private isTrueBlankDoubleClick(event: MouseEvent): boolean {
557
+ const recentTargets = this.recentPointerDownTargets.filter((entry) => event.timeStamp - entry.timeStamp < 500);
558
+ if (recentTargets.length) return recentTargets.every((entry) => entry.target.kind === "graph-blank");
559
+ return classifyGraphEventTarget(this.eventTarget(event.target)).kind === "graph-blank";
560
+ }
561
+
562
+ private recordPointerDown(target: GraphGestureTarget, screenPoint: { x: number; y: number }, timeStamp: number): void {
563
+ this.recentPointerDownTargets.push({ target, x: screenPoint.x, y: screenPoint.y, timeStamp });
564
+ if (this.recentPointerDownTargets.length > 8) this.recentPointerDownTargets.shift();
565
+ }
566
+
567
+ private applyIntents(intents: GraphGestureIntent[], event: PointerEvent | null): void {
568
+ this.options.onGestureIntents(intents, event);
569
+ this.emitActiveState();
570
+ }
571
+
572
+ private emitActiveState(): void {
573
+ this.options.onActiveStateChange?.(this.stateMachine.snapshot());
574
+ }
575
+
576
+ private eventTarget(target: EventTarget | null): GraphGestureTargetLike | null {
577
+ return this.options.targetFromEventTarget ? this.options.targetFromEventTarget(target) : target as GraphGestureTargetLike | null;
578
+ }
579
+
580
+ private graphTargetForEvent(target: EventTarget | null, screenPoint: { x: number; y: number }): GraphGestureTarget {
581
+ const domTarget = classifyGraphEventTarget(this.eventTarget(target));
582
+ if (isGraphGestureBlockerTarget(domTarget)) return domTarget;
583
+ if (domTarget.kind === "aggregation-container") return domTarget;
584
+ return this.options.graphTargetFromScreenPoint?.(screenPoint) || domTarget;
585
+ }
586
+
587
+ private pointerEventFromPointerEvent(event: PointerEvent): GraphPointerEventLike {
588
+ return {
589
+ pointerId: event.pointerId,
590
+ screenPoint: this.screenPointFromMouseEvent(event),
591
+ shiftKey: event.shiftKey
592
+ };
593
+ }
594
+
595
+ private screenPointFromMouseEvent(event: MouseEvent): { x: number; y: number } {
596
+ return rootClientPointToScreenPoint(
597
+ { x: event.clientX, y: event.clientY },
598
+ this.root.getBoundingClientRect()
599
+ );
600
+ }
601
+ }
602
+
603
+ function closest(target: GraphGestureTargetLike, selector: string): GraphGestureTargetLike | null {
604
+ return typeof target.closest === "function" ? target.closest(selector) : null;
605
+ }
606
+
607
+ function dataValue(target: GraphGestureTargetLike, ...keys: string[]): string | null {
608
+ for (const key of keys) {
609
+ const value = target.dataset?.[key];
610
+ if (value) return value;
611
+ }
612
+ return null;
613
+ }
614
+
615
+ function isTextEditingTarget(target: GraphGestureTargetLike): boolean {
616
+ if (target.isContentEditable) return true;
617
+ const tagName = target.tagName?.toLowerCase();
618
+ if (!tagName) return false;
619
+ if (tagName === "textarea" || tagName === "select") return true;
620
+ if (tagName !== "input") return false;
621
+ const type = String(target.type || "text").toLowerCase();
622
+ return !["button", "checkbox", "radio", "range", "submit", "reset"].includes(type);
623
+ }
624
+
625
+ function cloneActiveState(active: GraphGestureActiveState): GraphGestureActiveState {
626
+ if (!active) return null;
627
+ if (active.kind === "node") {
628
+ return {
629
+ ...active,
630
+ startScreenPoint: cloneScreenPoint(active.startScreenPoint),
631
+ lastScreenPoint: cloneScreenPoint(active.lastScreenPoint)
632
+ };
633
+ }
634
+ if (active.kind === "community-wash") {
635
+ return {
636
+ ...active,
637
+ startScreenPoint: cloneScreenPoint(active.startScreenPoint),
638
+ lastScreenPoint: cloneScreenPoint(active.lastScreenPoint)
639
+ };
640
+ }
641
+ return {
642
+ ...active,
643
+ startScreenPoint: cloneScreenPoint(active.startScreenPoint),
644
+ lastScreenPoint: cloneScreenPoint(active.lastScreenPoint)
645
+ };
646
+ }
647
+
648
+ function cloneScreenPoint(point: { x: number; y: number }): { x: number; y: number } {
649
+ return {
650
+ x: finiteNumber(point.x, 0),
651
+ y: finiteNumber(point.y, 0)
652
+ };
653
+ }
654
+
655
+ function screenDelta(previous: { x: number; y: number }, next: { x: number; y: number }): { x: number; y: number } {
656
+ return {
657
+ x: finiteNumber(next.x, 0) - finiteNumber(previous.x, 0),
658
+ y: finiteNumber(next.y, 0) - finiteNumber(previous.y, 0)
659
+ };
660
+ }
661
+
662
+ function screenDistance(left: { x: number; y: number }, right: { x: number; y: number }): number {
663
+ return Math.hypot(finiteNumber(right.x, 0) - finiteNumber(left.x, 0), finiteNumber(right.y, 0) - finiteNumber(left.y, 0));
664
+ }
665
+
666
+ function finitePositiveNumber(value: unknown, fallback: number): number {
667
+ const numeric = finiteNumber(value, fallback);
668
+ return numeric > 0 ? numeric : fallback;
669
+ }
670
+
671
+ function finiteNumber(value: unknown, fallback: number): number {
672
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
673
+ }