likec4 1.56.0 → 1.58.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 (207) hide show
  1. package/__app__/codegen/react.mjs +7 -8
  2. package/__app__/codegen/webcomponent.mjs +77 -736
  3. package/__app__/src/aichat/index.mjs +8 -0
  4. package/__app__/src/chunks/AIChat.mjs +959 -0
  5. package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
  6. package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
  7. package/__app__/src/chunks/Markdown.mjs +146 -0
  8. package/__app__/src/chunks/NavigationPanel.mjs +61 -0
  9. package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
  10. package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
  11. package/__app__/src/chunks/es.mjs +439 -0
  12. package/__app__/src/chunks/hooks.mjs +145 -0
  13. package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
  14. package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
  15. package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
  16. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
  17. package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
  18. package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
  19. package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
  20. package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
  21. package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
  22. package/__app__/src/chunks/libs/d3.mjs +2842 -0
  23. package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
  24. package/__app__/src/chunks/libs/framer.mjs +5872 -0
  25. package/__app__/src/chunks/libs/remeda.mjs +642 -0
  26. package/__app__/src/chunks/libs/zod.mjs +3170 -0
  27. package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
  28. package/__app__/src/chunks/styled-system.mjs +1040 -0
  29. package/__app__/src/fonts.css +1 -1
  30. package/__app__/src/main.mjs +14847 -1
  31. package/__app__/src/style.css +1 -1
  32. package/config/schema.json +14 -41
  33. package/dist/chunks/enableServer.mjs +1 -0
  34. package/dist/chunks/filenames.mjs +2 -2
  35. package/dist/chunks/index2.d.mts +2057 -722
  36. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
  37. package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
  38. package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
  39. package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
  40. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
  41. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  42. package/dist/chunks/libs/chevrotain.mjs +26 -26
  43. package/dist/chunks/libs/langium.d.mts +5 -5
  44. package/dist/chunks/libs/langium.mjs +10 -10
  45. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  46. package/dist/chunks/libs/pako.mjs +3 -1
  47. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  48. package/dist/chunks/libs/remeda.mjs +1 -1
  49. package/dist/chunks/libs/ufo.mjs +1 -1
  50. package/dist/chunks/libs/unstorage.mjs +1 -1
  51. package/dist/chunks/libs/which.mjs +1 -1
  52. package/dist/chunks/libs/zod.d.mts +60 -25
  53. package/dist/chunks/libs/zod.mjs +65 -0
  54. package/dist/chunks/node.mjs +84 -56
  55. package/dist/chunks/sequence-view.mjs +1 -1
  56. package/dist/chunks/vite-plugin.mjs +593 -0
  57. package/dist/cli/index.mjs +184 -141
  58. package/dist/index.d.mts +2 -131
  59. package/dist/index.mjs +1 -1
  60. package/dist/model/index.d.mts +2 -2
  61. package/dist/vite-plugin/index.d.mts +53 -2
  62. package/dist/vite-plugin/index.mjs +1 -1
  63. package/dist/vite-plugin/internal/index.d.mts +327 -4
  64. package/dist/vite-plugin/internal/index.mjs +946 -1
  65. package/package.json +85 -72
  66. package/react/index.d.mts +174 -73
  67. package/react/index.mjs +42468 -38926
  68. package/vite-plugin-modules.d.ts +4 -0
  69. package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
  70. package/__app__/chunks/DiagramActorProvider.mjs +0 -10
  71. package/__app__/chunks/Fallback.mjs +0 -1
  72. package/__app__/chunks/Header.mjs +0 -13
  73. package/__app__/chunks/IconRenderer.mjs +0 -1
  74. package/__app__/chunks/LikeC4Diagram.mjs +0 -19
  75. package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
  76. package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
  77. package/__app__/chunks/LikeC4Styles.mjs +0 -48
  78. package/__app__/chunks/NavigationPanel.mjs +0 -1
  79. package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
  80. package/__app__/chunks/ViewReact.mjs +0 -1
  81. package/__app__/chunks/__root.mjs +0 -1
  82. package/__app__/chunks/adhoc-editor.mjs +0 -1
  83. package/__app__/chunks/hooks.mjs +0 -1
  84. package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
  85. package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
  86. package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
  87. package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
  88. package/__app__/chunks/libs/@mantine/core.mjs +0 -41
  89. package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
  90. package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
  91. package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
  92. package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -15
  93. package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
  94. package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
  95. package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
  96. package/__app__/chunks/libs/@xstate/react.mjs +0 -1
  97. package/__app__/chunks/libs/@xstate/store.mjs +0 -1
  98. package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
  99. package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
  100. package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
  101. package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
  102. package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
  103. package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
  104. package/__app__/chunks/libs/bezier-js.mjs +0 -1
  105. package/__app__/chunks/libs/d3-path.mjs +0 -1
  106. package/__app__/chunks/libs/d3-shape.mjs +0 -1
  107. package/__app__/chunks/libs/fast-equals.mjs +0 -1
  108. package/__app__/chunks/libs/framer-motion.mjs +0 -9
  109. package/__app__/chunks/libs/html-to-image.mjs +0 -2
  110. package/__app__/chunks/libs/motion-dom.mjs +0 -1
  111. package/__app__/chunks/libs/motion.mjs +0 -1
  112. package/__app__/chunks/libs/nanostores.mjs +0 -1
  113. package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
  114. package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
  115. package/__app__/chunks/libs/remeda.mjs +0 -1
  116. package/__app__/chunks/libs/xstate.mjs +0 -1
  117. package/__app__/chunks/libs/zod.mjs +0 -39
  118. package/__app__/chunks/rolldown-runtime.mjs +0 -1
  119. package/__app__/chunks/safeCtx.mjs +0 -1
  120. package/__app__/chunks/searchParams.mjs +0 -1
  121. package/__app__/chunks/single-index.mjs +0 -1
  122. package/__app__/chunks/styled-system.mjs +0 -1
  123. package/__app__/chunks/styles.css.mjs +0 -1
  124. package/__app__/chunks/useLikeC4Project.mjs +0 -1
  125. package/__app__/chunks/useUpdateEffect.mjs +0 -1
  126. package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
  127. package/__app__/src/pages/EmbedPage.mjs +0 -1
  128. package/__app__/src/pages/ExportPage.mjs +0 -1
  129. package/__app__/src/pages/ProjectsOverview.mjs +0 -1
  130. package/__app__/src/pages/ViewAsD2.mjs +0 -1
  131. package/__app__/src/pages/ViewAsDot.mjs +0 -1
  132. package/__app__/src/pages/ViewAsMmd.mjs +0 -1
  133. package/__app__/src/pages/ViewAsPuml.mjs +0 -1
  134. package/__app__/src/pages/ViewEditor.mjs +0 -1
  135. package/__app__/src/pages/ViewReact.mjs +0 -1
  136. package/__app__/src/routeTree.gen.mjs +0 -1
  137. package/__app__/src/routes/__root.mjs +0 -1
  138. package/__app__/src/routes/_single/adhoc.mjs +0 -1
  139. package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
  140. package/__app__/src/routes/_single/export._viewId.mjs +0 -1
  141. package/__app__/src/routes/_single/route.mjs +0 -1
  142. package/__app__/src/routes/_single/single-index.mjs +0 -1
  143. package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
  144. package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
  145. package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
  146. package/__app__/src/routes/_single/view._viewId.mjs +0 -1
  147. package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
  148. package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
  149. package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
  150. package/__app__/src/routes/index.mjs +0 -1
  151. package/__app__/src/routes/project._projectId/-components.mjs +0 -1
  152. package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
  153. package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
  154. package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
  155. package/__app__/src/routes/project._projectId/index.mjs +0 -1
  156. package/__app__/src/routes/project._projectId/route.mjs +0 -1
  157. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
  158. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
  159. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
  160. package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
  161. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
  162. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
  163. package/__app__/src/routes/projects.mjs +0 -1
  164. package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
  165. package/dist/chunks/libs/@hono/mcp.mjs +0 -45
  166. package/dist/chunks/libs/@hono/node-server.mjs +0 -1
  167. package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
  168. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  169. package/dist/chunks/libs/ajv.mjs +0 -1
  170. package/dist/chunks/libs/ansi-align.mjs +0 -2
  171. package/dist/chunks/libs/ansi-regex.mjs +0 -1
  172. package/dist/chunks/libs/ansi-styles.mjs +0 -1
  173. package/dist/chunks/libs/atomically.mjs +0 -1
  174. package/dist/chunks/libs/boxen.mjs +0 -22
  175. package/dist/chunks/libs/conf.mjs +0 -1
  176. package/dist/chunks/libs/defu.mjs +0 -1
  177. package/dist/chunks/libs/destr.mjs +0 -1
  178. package/dist/chunks/libs/find-up-simple.mjs +0 -1
  179. package/dist/chunks/libs/get-port.mjs +0 -1
  180. package/dist/chunks/libs/hono.mjs +0 -1
  181. package/dist/chunks/libs/is-docker.mjs +0 -1
  182. package/dist/chunks/libs/is-error-instance.mjs +0 -1
  183. package/dist/chunks/libs/is-inside-container.mjs +0 -1
  184. package/dist/chunks/libs/is-plain-obj.mjs +0 -1
  185. package/dist/chunks/libs/isexe.mjs +0 -1
  186. package/dist/chunks/libs/ky.mjs +0 -3
  187. package/dist/chunks/libs/p-debounce.mjs +0 -1
  188. package/dist/chunks/libs/p-limit.mjs +0 -1
  189. package/dist/chunks/libs/p-timeout.mjs +0 -1
  190. package/dist/chunks/libs/package-up.mjs +0 -1
  191. package/dist/chunks/libs/parse-ms.mjs +0 -1
  192. package/dist/chunks/libs/safe-stringify.mjs +0 -1
  193. package/dist/chunks/libs/strip-indent.mjs +0 -1
  194. package/dist/chunks/libs/tinyrainbow.mjs +0 -1
  195. package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
  196. package/dist/chunks/libs/ts-graphviz.mjs +0 -4
  197. package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
  198. package/dist/chunks/libs/word-wrap.mjs +0 -12
  199. package/dist/chunks/plugin.mjs +0 -400
  200. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
  201. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
  202. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
  203. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
  204. package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
  205. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
  206. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
  207. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
@@ -92,7 +92,6 @@
92
92
  "required": [
93
93
  "name"
94
94
  ],
95
- "id": "LikeC4ProjectConfig",
96
95
  "description": "LikeC4 Project Configuration",
97
96
  "$defs": {
98
97
  "ThemeCustomization": {
@@ -120,7 +119,6 @@
120
119
  }
121
120
  },
122
121
  "additionalProperties": false,
123
- "id": "ThemeCustomization",
124
122
  "description": "Customize theme colors and sizes"
125
123
  },
126
124
  "ThemeColorName": {
@@ -137,14 +135,10 @@
137
135
  "red",
138
136
  "secondary",
139
137
  "sky"
140
- ],
141
- "id": "ThemeColorName"
142
- },
143
- "CustomColorName": {
144
- "id": "CustomColorName"
138
+ ]
145
139
  },
140
+ "CustomColorName": {},
146
141
  "ColorName": {
147
- "id": "ColorName",
148
142
  "anyOf": [
149
143
  {
150
144
  "$ref": "#/$defs/ThemeColorName"
@@ -155,7 +149,6 @@
155
149
  ]
156
150
  },
157
151
  "ThemeColorValues": {
158
- "id": "ThemeColorValues",
159
152
  "description": "Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values",
160
153
  "anyOf": [
161
154
  {
@@ -167,7 +160,6 @@
167
160
  ]
168
161
  },
169
162
  "StrictThemeColorValues": {
170
- "id": "StrictThemeColorValues",
171
163
  "description": "Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value",
172
164
  "type": "object",
173
165
  "properties": {
@@ -226,13 +218,11 @@
226
218
  "hiContrast",
227
219
  "loContrast"
228
220
  ],
229
- "additionalProperties": false,
230
- "id": "ElementColorValues"
221
+ "additionalProperties": false
231
222
  },
232
223
  "ColorLiteral": {
233
224
  "type": "string",
234
- "minLength": 1,
235
- "id": "ColorLiteral"
225
+ "minLength": 1
236
226
  },
237
227
  "RelationshipColorValues": {
238
228
  "type": "object",
@@ -255,8 +245,7 @@
255
245
  "line",
256
246
  "label"
257
247
  ],
258
- "additionalProperties": false,
259
- "id": "RelationshipColorValues"
248
+ "additionalProperties": false
260
249
  },
261
250
  "ElementSize": {
262
251
  "type": "string",
@@ -266,8 +255,7 @@
266
255
  "md",
267
256
  "lg",
268
257
  "xl"
269
- ],
270
- "id": "ElementSize"
258
+ ]
271
259
  },
272
260
  "Dimensions": {
273
261
  "type": "object",
@@ -286,7 +274,6 @@
286
274
  "height"
287
275
  ],
288
276
  "additionalProperties": false,
289
- "id": "Dimensions",
290
277
  "description": "Defines dimensions for theme size"
291
278
  },
292
279
  "DefaultStyleValues": {
@@ -324,14 +311,12 @@
324
311
  "$ref": "#/$defs/RelationshipDefaultStyleValues"
325
312
  }
326
313
  },
327
- "additionalProperties": false,
328
- "id": "DefaultStyleValues"
314
+ "additionalProperties": false
329
315
  },
330
316
  "Opacity": {
331
317
  "type": "integer",
332
318
  "minimum": 0,
333
319
  "maximum": 100,
334
- "id": "Opacity",
335
320
  "description": "Opacity 0-100%"
336
321
  },
337
322
  "BorderStyle": {
@@ -341,8 +326,7 @@
341
326
  "dashed",
342
327
  "dotted",
343
328
  "none"
344
- ],
345
- "id": "BorderStyle"
329
+ ]
346
330
  },
347
331
  "ElementShape": {
348
332
  "type": "string",
@@ -357,8 +341,7 @@
357
341
  "bucket",
358
342
  "document",
359
343
  "component"
360
- ],
361
- "id": "ElementShape"
344
+ ]
362
345
  },
363
346
  "IconPosition": {
364
347
  "type": "string",
@@ -367,8 +350,7 @@
367
350
  "right",
368
351
  "top",
369
352
  "bottom"
370
- ],
371
- "id": "IconPosition"
353
+ ]
372
354
  },
373
355
  "GroupDefaultStyleValues": {
374
356
  "type": "object",
@@ -386,8 +368,7 @@
386
368
  "$ref": "#/$defs/BorderStyle"
387
369
  }
388
370
  },
389
- "additionalProperties": false,
390
- "id": "GroupDefaultStyleValues"
371
+ "additionalProperties": false
391
372
  },
392
373
  "RelationshipDefaultStyleValues": {
393
374
  "type": "object",
@@ -406,7 +387,6 @@
406
387
  }
407
388
  },
408
389
  "additionalProperties": false,
409
- "id": "RelationshipDefaultStyleValues",
410
390
  "description": "Override default values for relationship style properties\nThese values will be used if such property is not defined"
411
391
  },
412
392
  "LineType": {
@@ -415,8 +395,7 @@
415
395
  "dashed",
416
396
  "solid",
417
397
  "dotted"
418
- ],
419
- "id": "LineType"
398
+ ]
420
399
  },
421
400
  "ArrowType": {
422
401
  "type": "string",
@@ -431,8 +410,7 @@
431
410
  "crow",
432
411
  "open",
433
412
  "vee"
434
- ],
435
- "id": "ArrowType"
413
+ ]
436
414
  },
437
415
  "CustomStylesheets": {
438
416
  "anyOf": [
@@ -447,8 +425,7 @@
447
425
  "minLength": 1
448
426
  }
449
427
  }
450
- ],
451
- "id": "CustomStylesheets"
428
+ ]
452
429
  },
453
430
  "ImageAliases": {
454
431
  "type": "object",
@@ -462,7 +439,6 @@
462
439
  "minLength": 1,
463
440
  "pattern": "^(?!\\/|[A-Za-z]:[\\\\\\/])(?!.*:\\/\\/).*$"
464
441
  },
465
- "id": "ImageAliases",
466
442
  "description": "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)."
467
443
  },
468
444
  "include-config": {
@@ -496,7 +472,6 @@
496
472
  "paths"
497
473
  ],
498
474
  "additionalProperties": false,
499
- "id": "include-config",
500
475
  "description": "Configuration for including additional LikeC4 source files from other directories.\nExample: { \"paths\": [\"../shared\", \"../common/specs\"], \"maxDepth\": 5, \"fileThreshold\": 50 }"
501
476
  },
502
477
  "ManualLayoutsConfig": {
@@ -509,7 +484,6 @@
509
484
  }
510
485
  },
511
486
  "additionalProperties": false,
512
- "id": "ManualLayoutsConfig",
513
487
  "description": "Configuration for manual layouts"
514
488
  },
515
489
  "LandingPageConfig": {
@@ -562,7 +536,6 @@
562
536
  "additionalProperties": false
563
537
  }
564
538
  ],
565
- "id": "LandingPageConfig",
566
539
  "description": "Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid."
567
540
  }
568
541
  }
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime.mjs";import{S as e,_ as t,a as n,c as r,d as i,g as a,l as o,m as s}from"./libs/zod.mjs";import{u as c}from"./vite-plugin.mjs";import{ElementShapes as l}from"@likec4/core/styles";import{invariant as u}from"@likec4/core";import{Readable as d}from"node:stream";import{chat as f,convertMessagesToModelMessages as p,toServerSentEventsResponse as m,toolDefinition as h}from"@tanstack/ai";const g=t({id:e().meta({description:`Node ID`}),title:e(),shape:n(l),color:e().meta({description:`Node color, from theme or custom`}),icon:e().nullish(),parentId:e().nullish().meta({description:`Parent node ID (if node is nested)`}),children:r(e()).nullish().meta({description:`Nested node IDs (if node is compound)`}),x:a(),y:a(),width:a(),height:a(),modelFqn:e().nullish().meta({description:`Model element FQN (if node has reference)`})}),_=h({name:`read_ui`,description:`Read current UI state. Use arguments to include additional data.`,needsApproval:!1,inputSchema:t({selectedNode:o().default(!1).meta({description:`Include selected node (if any)`}),nodes:o().default(!1).meta({description:`Include all nodes from the view`})}),outputSchema:t({projectId:e(),editMode:o().meta({description:`Whether the UI is in edit mode`}),view:t({id:e(),title:e(),type:n([`element`,`deployment`,`dynamic`]).meta({description:`Type of the current view`})}).meta({description:`Current view`}),nodes:r(g).nullish(),selectedNode:g.nullish()})}),v=h({name:`update_ui`,description:`Update UI state by executing a command.`,needsApproval:!1,inputSchema:t({command:i(`type`,[t({type:s(`focus`),elementId:e().meta({description:`Element ID (FQN)`})}).meta({description:`Focus UI on an element by its FQN`}),t({type:s(`fitview`)}).meta({description:`Zoom out to fit all elements in the viewport, and clear any selection/focus`})])}),outputSchema:t({})}),y=h({name:`navigate_to`,description:`Navigates UI to another view`,needsApproval:!1,inputSchema:t({viewId:e().meta({description:`View ID`})}),outputSchema:t({})});async function readJsonBody(e){let t=[];c.info(`Reading request`);for await(let n of e){let e=Buffer.from(n).toString();process.stdout.write(e),t.push(e)}return JSON.parse(t.join(``))}function enableAIServer(e){let{ai:t,server:n,logger:r}=e;u(t,`AI is not configured`),n.middlewares.use(`/__likec4_ai`,async(e,n,i)=>{if(e.method!==`POST`){i();return}try{let i=await readJsonBody(d.toWeb(e)),a=p(i.messages??[]),o=m(f({...t,messages:a,debug:!0,conversationId:i.data.conversationId,systemPrompts:[`You are a helpful assistant that can answer questions about LikeC4 model and update UI.`],tools:[y,v,_]}));if(o.headers.forEach((e,t)=>{n.setHeader(t,e)}),n.writeHead(o.status,o.statusText),!o.body){n.end();return}d.fromWeb(o.body).on(`error`,e=>{r.error(`AI stream error`,{error:e}),n.writableEnded||n.end()}).pipe(n,{end:!0})}catch(e){r.error(`AI request failed`,{error:e}),n.headersSent?n.end():(n.writeHead(500,{"Content-Type":`application/json`}),n.end(JSON.stringify({error:e instanceof Error?e.message:String(e)})))}})}export{enableAIServer};
@@ -1,4 +1,4 @@
1
- import"./rolldown-runtime.mjs";import{t as e}from"./libs/json5.mjs";import{Y as t}from"./libs/@hono/mcp.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
1
+ import"./rolldown-runtime.mjs";import{t as e}from"./libs/json5.mjs";import{t}from"./libs/zod.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
2
2
  `)}),maxDepth:t.number().int().min(1).max(20).default(3).meta({description:[`Maximum directory depth to scan when searching for .c4 files in include paths.`,`Prevents excessive scanning of deeply nested directories.`,`Default: 3`].join(`
3
3
  `)}),fileThreshold:t.number().int().min(1).max(1e4).default(30).meta({description:[`Maximum number of files to load from include paths before warning.`,`Helps identify performance issues from accidentally including large directories.`,`Default: 30`].join(`
4
4
  `)})}).meta({id:`include-config`,description:[`Configuration for including additional LikeC4 source files from other directories.`,`Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }`].join(`
@@ -10,7 +10,7 @@ These values will be used if such property is not defined`}),L=t.strictObject({c
10
10
  These values will be used if such property is not defined`}),relationship:I.optional().meta({description:`Override default values for relationship style properties
11
11
  These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),R=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),z=t.strictObject({theme:P.optional().meta({description:`Project theme customization`}),defaults:L.optional().meta({description:`Override default values for style properties
12
12
  These values will be used if such property is not defined`}),customCss:R.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:normalizeDefaults(t),customCss:normalizeStylesheets(n),theme:e}));function normalizeDefaults(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function normalizeStylesheets(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const B=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
13
- `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),V=t.union([t.strictObject({redirect:t.literal(!0)}),t.strictObject({include:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`include list cannot be empty`)}),t.strictObject({exclude:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`exclude list cannot be empty`)})]).meta({id:`LandingPageConfig`,description:`Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid.`}),H=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:z.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:B.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
13
+ `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),V=t.union([t.strictObject({redirect:t.literal(!0)}),t.strictObject({include:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`include list cannot be empty`)}),t.strictObject({exclude:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`exclude list cannot be empty`)})]).meta({id:`LandingPageConfig`,description:`Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid.`}),H=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!=="default",{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:z.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:B.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
14
14
  `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`}),landingPage:V.optional()}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),U=t.instanceof(Function),W=t.record(t.string(),U),G=H.extend({generators:W.optional()});function validateProjectConfig(e){let n=e.landingPage,r=null;if(n!=null){let e=V.safeParse(n);if(!e.success)throw Error(`Config validation failed:
15
15
  `+t.prettifyError(e.error));r=e.data}let i=H.safeParse(e);if(!i.success)throw Error(`Config validation failed:
16
16
  `+t.prettifyError(i.error));let a=i.data;r!==null&&(a={...a,landingPage:r});let o=e.generators;if(typeof o==`object`&&o&&!Array.isArray(o)){let e=W.safeParse(o);if(!e.success)throw Error(`Config validation failed (generators):