@memoarchitect/tools 0.16.1 → 0.16.4

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 (320) hide show
  1. package/README.md +1 -1
  2. package/corpus/README.md +3 -2
  3. package/corpus/sysml-v2-release/sysml.library/Domain Libraries/Quantities and Units/SI.sysml +378 -0
  4. package/corpus/sysml-v2-release/sysml.library/Domain Libraries/Quantities and Units/SIPrefixes.sysml +48 -0
  5. package/package.json +5 -2
  6. package/packages/tools/lib/analysis/calc/calc-ast.d.ts +61 -0
  7. package/packages/tools/lib/analysis/calc/calc-ast.d.ts.map +1 -0
  8. package/packages/tools/lib/analysis/calc/calc-ast.js +116 -0
  9. package/packages/tools/lib/analysis/calc/calc-ast.js.map +1 -0
  10. package/packages/tools/lib/analysis/calc/calc-eval.d.ts +45 -0
  11. package/packages/tools/lib/analysis/calc/calc-eval.d.ts.map +1 -0
  12. package/packages/tools/lib/analysis/calc/calc-eval.js +256 -0
  13. package/packages/tools/lib/analysis/calc/calc-eval.js.map +1 -0
  14. package/packages/tools/lib/analysis/calc/calc-run.d.ts +30 -0
  15. package/packages/tools/lib/analysis/calc/calc-run.d.ts.map +1 -0
  16. package/packages/tools/lib/analysis/calc/calc-run.js +114 -0
  17. package/packages/tools/lib/analysis/calc/calc-run.js.map +1 -0
  18. package/packages/tools/lib/analysis/calc/generated/si-units.d.ts +13 -0
  19. package/packages/tools/lib/analysis/calc/generated/si-units.d.ts.map +1 -0
  20. package/packages/tools/lib/analysis/calc/generated/si-units.js +394 -0
  21. package/packages/tools/lib/analysis/calc/generated/si-units.js.map +1 -0
  22. package/packages/tools/lib/analysis/calc/units.d.ts +15 -0
  23. package/packages/tools/lib/analysis/calc/units.d.ts.map +1 -0
  24. package/packages/tools/lib/analysis/calc/units.js +108 -0
  25. package/packages/tools/lib/analysis/calc/units.js.map +1 -0
  26. package/packages/tools/lib/anatomy/anatomy-generator.d.ts +60 -0
  27. package/packages/tools/lib/anatomy/anatomy-generator.d.ts.map +1 -0
  28. package/packages/tools/lib/anatomy/anatomy-generator.js +245 -0
  29. package/packages/tools/lib/anatomy/anatomy-generator.js.map +1 -0
  30. package/packages/tools/lib/authoring/outline-source.d.ts +11 -0
  31. package/packages/tools/lib/authoring/outline-source.d.ts.map +1 -1
  32. package/packages/tools/lib/authoring/outline-source.js +15 -1
  33. package/packages/tools/lib/authoring/outline-source.js.map +1 -1
  34. package/packages/tools/lib/bin/memo.js +10 -40
  35. package/packages/tools/lib/bin/memo.js.map +1 -1
  36. package/packages/tools/lib/browser/index.d.ts +5 -0
  37. package/packages/tools/lib/browser/index.d.ts.map +1 -1
  38. package/packages/tools/lib/browser/index.js +5 -0
  39. package/packages/tools/lib/browser/index.js.map +1 -1
  40. package/packages/tools/lib/cli/project-commands.d.ts +7 -1
  41. package/packages/tools/lib/cli/project-commands.d.ts.map +1 -1
  42. package/packages/tools/lib/cli/project-commands.js +25 -17
  43. package/packages/tools/lib/cli/project-commands.js.map +1 -1
  44. package/packages/tools/lib/commands/anatomy.d.ts +16 -0
  45. package/packages/tools/lib/commands/anatomy.d.ts.map +1 -0
  46. package/packages/tools/lib/commands/anatomy.js +201 -0
  47. package/packages/tools/lib/commands/anatomy.js.map +1 -0
  48. package/packages/tools/lib/commands/dev.d.ts.map +1 -1
  49. package/packages/tools/lib/commands/dev.js +29 -48
  50. package/packages/tools/lib/commands/dev.js.map +1 -1
  51. package/packages/tools/lib/commands/dhf-draft.js +1 -1
  52. package/packages/tools/lib/commands/dhf-draft.js.map +1 -1
  53. package/packages/tools/lib/commands/dhf-lint.d.ts.map +1 -1
  54. package/packages/tools/lib/commands/dhf-lint.js +9 -0
  55. package/packages/tools/lib/commands/dhf-lint.js.map +1 -1
  56. package/packages/tools/lib/commands/dhf.d.ts +7 -1
  57. package/packages/tools/lib/commands/dhf.d.ts.map +1 -1
  58. package/packages/tools/lib/commands/dhf.js +16 -7
  59. package/packages/tools/lib/commands/dhf.js.map +1 -1
  60. package/packages/tools/lib/commands/evaluate.d.ts +2 -0
  61. package/packages/tools/lib/commands/evaluate.d.ts.map +1 -0
  62. package/packages/tools/lib/commands/evaluate.js +44 -0
  63. package/packages/tools/lib/commands/evaluate.js.map +1 -0
  64. package/packages/tools/lib/commands/init.d.ts.map +1 -1
  65. package/packages/tools/lib/commands/init.js +0 -17
  66. package/packages/tools/lib/commands/init.js.map +1 -1
  67. package/packages/tools/lib/commands/standards.d.ts.map +1 -1
  68. package/packages/tools/lib/commands/standards.js +3 -9
  69. package/packages/tools/lib/commands/standards.js.map +1 -1
  70. package/packages/tools/lib/commands/toolchain.d.ts +2 -0
  71. package/packages/tools/lib/commands/toolchain.d.ts.map +1 -1
  72. package/packages/tools/lib/commands/toolchain.js +25 -1
  73. package/packages/tools/lib/commands/toolchain.js.map +1 -1
  74. package/packages/tools/lib/commands/upgrade.d.ts +5 -2
  75. package/packages/tools/lib/commands/upgrade.d.ts.map +1 -1
  76. package/packages/tools/lib/commands/upgrade.js +14 -11
  77. package/packages/tools/lib/commands/upgrade.js.map +1 -1
  78. package/packages/tools/lib/commands/validate.d.ts.map +1 -1
  79. package/packages/tools/lib/commands/validate.js +1 -14
  80. package/packages/tools/lib/commands/validate.js.map +1 -1
  81. package/packages/tools/lib/dhf/device-dhf.d.ts +23 -0
  82. package/packages/tools/lib/dhf/device-dhf.d.ts.map +1 -1
  83. package/packages/tools/lib/dhf/device-dhf.js +66 -19
  84. package/packages/tools/lib/dhf/device-dhf.js.map +1 -1
  85. package/packages/tools/lib/dhf/diagram-images.d.ts +50 -0
  86. package/packages/tools/lib/dhf/diagram-images.d.ts.map +1 -0
  87. package/packages/tools/lib/dhf/diagram-images.js +72 -0
  88. package/packages/tools/lib/dhf/diagram-images.js.map +1 -0
  89. package/packages/tools/lib/dhf/document-compiler.d.ts +6 -0
  90. package/packages/tools/lib/dhf/document-compiler.d.ts.map +1 -1
  91. package/packages/tools/lib/dhf/document-compiler.js +18 -1
  92. package/packages/tools/lib/dhf/document-compiler.js.map +1 -1
  93. package/packages/tools/lib/dhf/document-ir.d.ts +14 -1
  94. package/packages/tools/lib/dhf/document-ir.d.ts.map +1 -1
  95. package/packages/tools/lib/dhf/document-ir.js.map +1 -1
  96. package/packages/tools/lib/dhf/document-registry.d.ts.map +1 -1
  97. package/packages/tools/lib/dhf/document-registry.js +8 -4
  98. package/packages/tools/lib/dhf/document-registry.js.map +1 -1
  99. package/packages/tools/lib/dhf/exporters/docx-document.d.ts +18 -0
  100. package/packages/tools/lib/dhf/exporters/docx-document.d.ts.map +1 -0
  101. package/packages/tools/lib/dhf/exporters/docx-document.js +175 -0
  102. package/packages/tools/lib/dhf/exporters/docx-document.js.map +1 -0
  103. package/packages/tools/lib/dhf/exporters/docx-exporter.d.ts +0 -6
  104. package/packages/tools/lib/dhf/exporters/docx-exporter.d.ts.map +1 -1
  105. package/packages/tools/lib/dhf/exporters/docx-exporter.js +6 -145
  106. package/packages/tools/lib/dhf/exporters/docx-exporter.js.map +1 -1
  107. package/packages/tools/lib/dhf/exporters/html-exporter.js +4 -0
  108. package/packages/tools/lib/dhf/exporters/html-exporter.js.map +1 -1
  109. package/packages/tools/lib/dhf/exporters/markdown-exporter.js +1 -0
  110. package/packages/tools/lib/dhf/exporters/markdown-exporter.js.map +1 -1
  111. package/packages/tools/lib/dhf/index.d.ts +1 -0
  112. package/packages/tools/lib/dhf/index.d.ts.map +1 -1
  113. package/packages/tools/lib/dhf/index.js +1 -0
  114. package/packages/tools/lib/dhf/index.js.map +1 -1
  115. package/packages/tools/lib/dhf/markdown-to-ir.d.ts.map +1 -1
  116. package/packages/tools/lib/dhf/markdown-to-ir.js +8 -0
  117. package/packages/tools/lib/dhf/markdown-to-ir.js.map +1 -1
  118. package/packages/tools/lib/dhf/query-executor.d.ts.map +1 -1
  119. package/packages/tools/lib/dhf/query-executor.js +44 -5
  120. package/packages/tools/lib/dhf/query-executor.js.map +1 -1
  121. package/packages/tools/lib/dhf/standards-library.d.ts.map +1 -1
  122. package/packages/tools/lib/dhf/standards-library.js +16 -13
  123. package/packages/tools/lib/dhf/standards-library.js.map +1 -1
  124. package/packages/tools/lib/dhf/standards-report.d.ts +2 -4
  125. package/packages/tools/lib/dhf/standards-report.d.ts.map +1 -1
  126. package/packages/tools/lib/dhf/standards-report.js +2 -7
  127. package/packages/tools/lib/dhf/standards-report.js.map +1 -1
  128. package/packages/tools/lib/dhf/template-resolver.d.ts.map +1 -1
  129. package/packages/tools/lib/dhf/template-resolver.js +10 -8
  130. package/packages/tools/lib/dhf/template-resolver.js.map +1 -1
  131. package/packages/tools/lib/index.d.ts +1 -1
  132. package/packages/tools/lib/index.d.ts.map +1 -1
  133. package/packages/tools/lib/index.js.map +1 -1
  134. package/packages/tools/lib/lock.d.ts +1 -1
  135. package/packages/tools/lib/lock.js +1 -1
  136. package/packages/tools/lib/mcp/model-loader.js +1 -1
  137. package/packages/tools/lib/mcp/model-loader.js.map +1 -1
  138. package/packages/tools/lib/methodology/guide-service.js +1 -1
  139. package/packages/tools/lib/methodology/guide-service.js.map +1 -1
  140. package/packages/tools/lib/methodology/guide.d.ts +15 -4
  141. package/packages/tools/lib/methodology/guide.d.ts.map +1 -1
  142. package/packages/tools/lib/methodology/guide.js +59 -28
  143. package/packages/tools/lib/methodology/guide.js.map +1 -1
  144. package/packages/tools/lib/model/complete-model.d.ts +9 -1
  145. package/packages/tools/lib/model/complete-model.d.ts.map +1 -1
  146. package/packages/tools/lib/model/complete-model.js +58 -39
  147. package/packages/tools/lib/model/complete-model.js.map +1 -1
  148. package/packages/tools/lib/model/config-loader.js +6 -6
  149. package/packages/tools/lib/model/config-loader.js.map +1 -1
  150. package/packages/tools/lib/model/effective-scope.d.ts.map +1 -1
  151. package/packages/tools/lib/model/effective-scope.js +6 -1
  152. package/packages/tools/lib/model/effective-scope.js.map +1 -1
  153. package/packages/tools/lib/model/kind-registry.d.ts +2 -0
  154. package/packages/tools/lib/model/kind-registry.d.ts.map +1 -1
  155. package/packages/tools/lib/model/kind-registry.js +4 -2
  156. package/packages/tools/lib/model/kind-registry.js.map +1 -1
  157. package/packages/tools/lib/model/native-project.d.ts.map +1 -1
  158. package/packages/tools/lib/model/native-project.js +7 -16
  159. package/packages/tools/lib/model/native-project.js.map +1 -1
  160. package/packages/tools/lib/model/paths.d.ts +9 -1
  161. package/packages/tools/lib/model/paths.d.ts.map +1 -1
  162. package/packages/tools/lib/model/paths.js +18 -1
  163. package/packages/tools/lib/model/paths.js.map +1 -1
  164. package/packages/tools/lib/model/pinned.d.ts +19 -0
  165. package/packages/tools/lib/model/pinned.d.ts.map +1 -1
  166. package/packages/tools/lib/model/pinned.js +87 -9
  167. package/packages/tools/lib/model/pinned.js.map +1 -1
  168. package/packages/tools/lib/model/project-conversion.d.ts +12 -3
  169. package/packages/tools/lib/model/project-conversion.d.ts.map +1 -1
  170. package/packages/tools/lib/model/project-conversion.js +71 -20
  171. package/packages/tools/lib/model/project-conversion.js.map +1 -1
  172. package/packages/tools/lib/model/quantity-core.d.ts +54 -0
  173. package/packages/tools/lib/model/quantity-core.d.ts.map +1 -0
  174. package/packages/tools/lib/model/quantity-core.js +298 -0
  175. package/packages/tools/lib/model/quantity-core.js.map +1 -0
  176. package/packages/tools/lib/model/quantity-format.d.ts +14 -0
  177. package/packages/tools/lib/model/quantity-format.d.ts.map +1 -0
  178. package/packages/tools/lib/model/quantity-format.js +31 -0
  179. package/packages/tools/lib/model/quantity-format.js.map +1 -0
  180. package/packages/tools/lib/model/quantity.d.ts +12 -0
  181. package/packages/tools/lib/model/quantity.d.ts.map +1 -0
  182. package/packages/tools/lib/model/quantity.js +49 -0
  183. package/packages/tools/lib/model/quantity.js.map +1 -0
  184. package/packages/tools/lib/model/relationship-legality.d.ts +34 -0
  185. package/packages/tools/lib/model/relationship-legality.d.ts.map +1 -1
  186. package/packages/tools/lib/model/relationship-legality.js +16 -10
  187. package/packages/tools/lib/model/relationship-legality.js.map +1 -1
  188. package/packages/tools/lib/model/relationship-registry.d.ts +11 -1
  189. package/packages/tools/lib/model/relationship-registry.d.ts.map +1 -1
  190. package/packages/tools/lib/model/relationship-registry.js +20 -1
  191. package/packages/tools/lib/model/relationship-registry.js.map +1 -1
  192. package/packages/tools/lib/model/semantic.d.ts +7 -1
  193. package/packages/tools/lib/model/semantic.d.ts.map +1 -1
  194. package/packages/tools/lib/model/semantic.js +4 -0
  195. package/packages/tools/lib/model/semantic.js.map +1 -1
  196. package/packages/tools/lib/model/user-settings.d.ts +2 -0
  197. package/packages/tools/lib/model/user-settings.d.ts.map +1 -1
  198. package/packages/tools/lib/model/user-settings.js +6 -2
  199. package/packages/tools/lib/model/user-settings.js.map +1 -1
  200. package/packages/tools/lib/model/view-deriver.js +1 -1
  201. package/packages/tools/lib/model/view-deriver.js.map +1 -1
  202. package/packages/tools/lib/model/view-layout-block.d.ts +3 -0
  203. package/packages/tools/lib/model/view-layout-block.d.ts.map +1 -1
  204. package/packages/tools/lib/model/view-layout-block.js +60 -1
  205. package/packages/tools/lib/model/view-layout-block.js.map +1 -1
  206. package/packages/tools/lib/operations/ai-authoring.js +1 -1
  207. package/packages/tools/lib/operations/ai-authoring.js.map +1 -1
  208. package/packages/tools/lib/operations/index.d.ts +2 -1
  209. package/packages/tools/lib/operations/index.d.ts.map +1 -1
  210. package/packages/tools/lib/operations/index.js +2 -1
  211. package/packages/tools/lib/operations/index.js.map +1 -1
  212. package/packages/tools/lib/operations/project-snapshot.d.ts +9 -1
  213. package/packages/tools/lib/operations/project-snapshot.d.ts.map +1 -1
  214. package/packages/tools/lib/operations/project-snapshot.js +12 -13
  215. package/packages/tools/lib/operations/project-snapshot.js.map +1 -1
  216. package/packages/tools/lib/pin-check.d.ts +18 -0
  217. package/packages/tools/lib/pin-check.d.ts.map +1 -1
  218. package/packages/tools/lib/pin-check.js +70 -4
  219. package/packages/tools/lib/pin-check.js.map +1 -1
  220. package/packages/tools/lib/protocol/messages.d.ts +17 -2
  221. package/packages/tools/lib/protocol/messages.d.ts.map +1 -1
  222. package/packages/tools/lib/serializer/sysml-generator.d.ts.map +1 -1
  223. package/packages/tools/lib/serializer/sysml-generator.js +7 -1
  224. package/packages/tools/lib/serializer/sysml-generator.js.map +1 -1
  225. package/packages/tools/lib/server/dev-server.d.ts +2 -6
  226. package/packages/tools/lib/server/dev-server.d.ts.map +1 -1
  227. package/packages/tools/lib/server/dev-server.js +23 -25
  228. package/packages/tools/lib/server/dev-server.js.map +1 -1
  229. package/packages/tools/lib/server/persistor.d.ts +29 -8
  230. package/packages/tools/lib/server/persistor.d.ts.map +1 -1
  231. package/packages/tools/lib/server/persistor.js +94 -25
  232. package/packages/tools/lib/server/persistor.js.map +1 -1
  233. package/packages/tools/lib/server/relationship-writer.d.ts.map +1 -1
  234. package/packages/tools/lib/server/relationship-writer.js +48 -12
  235. package/packages/tools/lib/server/relationship-writer.js.map +1 -1
  236. package/packages/tools/lib/server/runtime-budget.d.ts +12 -3
  237. package/packages/tools/lib/server/runtime-budget.d.ts.map +1 -1
  238. package/packages/tools/lib/server/runtime-budget.js +12 -3
  239. package/packages/tools/lib/server/runtime-budget.js.map +1 -1
  240. package/packages/tools/lib/server/sysml-notation.d.ts +7 -5
  241. package/packages/tools/lib/server/sysml-notation.d.ts.map +1 -1
  242. package/packages/tools/lib/server/sysml-notation.js +25 -6
  243. package/packages/tools/lib/server/sysml-notation.js.map +1 -1
  244. package/packages/tools/lib/server/view-layout-store.d.ts +9 -0
  245. package/packages/tools/lib/server/view-layout-store.d.ts.map +1 -1
  246. package/packages/tools/lib/server/view-layout-store.js +15 -1
  247. package/packages/tools/lib/server/view-layout-store.js.map +1 -1
  248. package/packages/tools/lib/stage2/api-model.d.ts +10 -0
  249. package/packages/tools/lib/stage2/api-model.d.ts.map +1 -1
  250. package/packages/tools/lib/stage2/api-model.js +35 -0
  251. package/packages/tools/lib/stage2/api-model.js.map +1 -1
  252. package/packages/tools/lib/stage2/build-from-api.d.ts.map +1 -1
  253. package/packages/tools/lib/stage2/build-from-api.js +186 -10
  254. package/packages/tools/lib/stage2/build-from-api.js.map +1 -1
  255. package/packages/tools/lib/stage2/guide-from-api.d.ts +3 -1
  256. package/packages/tools/lib/stage2/guide-from-api.d.ts.map +1 -1
  257. package/packages/tools/lib/stage2/guide-from-api.js +17 -14
  258. package/packages/tools/lib/stage2/guide-from-api.js.map +1 -1
  259. package/packages/tools/lib/stage2/registries-from-api.d.ts +9 -1
  260. package/packages/tools/lib/stage2/registries-from-api.d.ts.map +1 -1
  261. package/packages/tools/lib/stage2/registries-from-api.js +27 -2
  262. package/packages/tools/lib/stage2/registries-from-api.js.map +1 -1
  263. package/packages/tools/lib/toolchain/effective.d.ts +7 -6
  264. package/packages/tools/lib/toolchain/effective.d.ts.map +1 -1
  265. package/packages/tools/lib/toolchain/effective.js +13 -4
  266. package/packages/tools/lib/toolchain/effective.js.map +1 -1
  267. package/packages/tools/lib/toolchain/operations.d.ts +1 -1
  268. package/packages/tools/lib/toolchain/operations.d.ts.map +1 -1
  269. package/packages/tools/lib/toolchain/ownership.js +1 -1
  270. package/packages/tools/lib/toolchain/ownership.js.map +1 -1
  271. package/packages/tools/lib/toolchain/providers/default-compiler.d.ts +2 -0
  272. package/packages/tools/lib/toolchain/providers/default-compiler.d.ts.map +1 -0
  273. package/packages/tools/lib/toolchain/providers/default-compiler.js +10 -0
  274. package/packages/tools/lib/toolchain/providers/default-compiler.js.map +1 -0
  275. package/packages/tools/lib/toolchain/providers/opensysml-check.d.ts +18 -0
  276. package/packages/tools/lib/toolchain/providers/opensysml-check.d.ts.map +1 -1
  277. package/packages/tools/lib/toolchain/providers/opensysml-check.js +49 -1
  278. package/packages/tools/lib/toolchain/providers/opensysml-check.js.map +1 -1
  279. package/packages/tools/lib/toolchain/providers/opensysml.d.ts +19 -0
  280. package/packages/tools/lib/toolchain/providers/opensysml.d.ts.map +1 -1
  281. package/packages/tools/lib/toolchain/providers/opensysml.js.map +1 -1
  282. package/packages/tools/lib/toolchain/user-settings-status.d.ts +1 -1
  283. package/packages/tools/lib/toolchain/user-settings-status.js +1 -1
  284. package/packages/tools/lib/toolchain/user-settings-status.js.map +1 -1
  285. package/packages/tools/lib/validator/architecture-validator.d.ts +5 -1
  286. package/packages/tools/lib/validator/architecture-validator.d.ts.map +1 -1
  287. package/packages/tools/lib/validator/architecture-validator.js +58 -7
  288. package/packages/tools/lib/validator/architecture-validator.js.map +1 -1
  289. package/packages/tools/lib/validator/constraint-eval.d.ts +5 -0
  290. package/packages/tools/lib/validator/constraint-eval.d.ts.map +1 -1
  291. package/packages/tools/lib/validator/constraint-eval.js +20 -19
  292. package/packages/tools/lib/validator/constraint-eval.js.map +1 -1
  293. package/packages/tools/lib/validator/model-constraints.d.ts +10 -0
  294. package/packages/tools/lib/validator/model-constraints.d.ts.map +1 -0
  295. package/packages/tools/lib/validator/model-constraints.js +94 -0
  296. package/packages/tools/lib/validator/model-constraints.js.map +1 -0
  297. package/packages/tools/lib/validator/rule-engine.d.ts +3 -1
  298. package/packages/tools/lib/validator/rule-engine.d.ts.map +1 -1
  299. package/packages/tools/lib/validator/rule-engine.js +15 -20
  300. package/packages/tools/lib/validator/rule-engine.js.map +1 -1
  301. package/packages/tools/lib/commands/retired.d.ts +0 -10
  302. package/packages/tools/lib/commands/retired.d.ts.map +0 -1
  303. package/packages/tools/lib/commands/retired.js +0 -35
  304. package/packages/tools/lib/commands/retired.js.map +0 -1
  305. package/packages/tools/lib/commands/validate-client.d.ts +0 -11
  306. package/packages/tools/lib/commands/validate-client.d.ts.map +0 -1
  307. package/packages/tools/lib/commands/validate-client.js +0 -54
  308. package/packages/tools/lib/commands/validate-client.js.map +0 -1
  309. package/packages/tools/lib/server/dev-validate.d.ts +0 -30
  310. package/packages/tools/lib/server/dev-validate.d.ts.map +0 -1
  311. package/packages/tools/lib/server/dev-validate.js +0 -82
  312. package/packages/tools/lib/server/dev-validate.js.map +0 -1
  313. package/packages/tools/lib/toolchain/source-fingerprint.d.ts +0 -2
  314. package/packages/tools/lib/toolchain/source-fingerprint.d.ts.map +0 -1
  315. package/packages/tools/lib/toolchain/source-fingerprint.js +0 -30
  316. package/packages/tools/lib/toolchain/source-fingerprint.js.map +0 -1
  317. package/packages/tools/lib/validator/workspace-boundary-validator.d.ts +0 -9
  318. package/packages/tools/lib/validator/workspace-boundary-validator.d.ts.map +0 -1
  319. package/packages/tools/lib/validator/workspace-boundary-validator.js +0 -28
  320. package/packages/tools/lib/validator/workspace-boundary-validator.js.map +0 -1
@@ -22,6 +22,7 @@ import { completeModel } from '../model/complete-model.js';
22
22
  import { toModelType } from '../model/naming.js';
23
23
  import { LANGUAGE_NATIVE_RELATIONS, REFINEMENT_METADATA, pascalToCamelCase } from '../model/relationship-registry.js';
24
24
  import { ElementIndex, qualifiedId } from '../model/element-index.js';
25
+ import { RULE_MARKER, specializesByName } from './registries-from-api.js';
25
26
  import { resolveLayerFromPath } from '../model/layer-resolver.js';
26
27
  import { textualName } from './sysml-names.js';
27
28
  /** The definition metaclasses whose project declarations become elements, and their construct. */
@@ -53,7 +54,10 @@ const USAGE_CONSTRUCTS = {
53
54
  const METADATA_KEY_ALIASES = {
54
55
  Rationale: { text: 'rationale' },
55
56
  };
56
- const lastSegment = (qualifiedName) => qualifiedName.slice(qualifiedName.lastIndexOf('::') + 2);
57
+ const lastSegment = (qualifiedName) => {
58
+ const at = qualifiedName.lastIndexOf('::');
59
+ return at < 0 ? qualifiedName : qualifiedName.slice(at + 2);
60
+ };
57
61
  /**
58
62
  * The finished MEMO model from a stage 1 handoff: what `buildMemoModel` returns
59
63
  * from MEMO's own parse, finished by the same `completeModel`.
@@ -117,6 +121,8 @@ class ElementBuilder {
117
121
  relationships = [];
118
122
  diagnostics = [];
119
123
  counter = 0;
124
+ /** Actions a part declares in its own body, which it composes; a `perform` in place is not one. */
125
+ partOwnedActions = new Set();
120
126
  /** The line each relationship is declared on, for end-kind findings. */
121
127
  relationshipLines = new Map();
122
128
  /** API element → the MEMO element it became, including anonymous ones (a `terminate`). */
@@ -129,6 +135,7 @@ class ElementBuilder {
129
135
  run() {
130
136
  for (const root of this.projectRootPackages())
131
137
  this.visitPackage(root, '', undefined);
138
+ this.constraints();
132
139
  this.inheritKindsFromLocalDefinitions();
133
140
  }
134
141
  /** Top-level packages the project declares. */
@@ -184,7 +191,8 @@ class ElementBuilder {
184
191
  this.itemDefinition(member, packageName);
185
192
  continue;
186
193
  }
187
- if (type === 'ActionUsage' || type === 'CalculationUsage') {
194
+ // An analysis case (a `TradeStudy`) is an action whose subject is what it analyses.
195
+ if (type === 'ActionUsage' || type === 'CalculationUsage' || type === 'AnalysisCaseUsage') {
188
196
  this.action(member, packageName, undefined);
189
197
  continue;
190
198
  }
@@ -198,6 +206,12 @@ class ElementBuilder {
198
206
  }
199
207
  if (type === 'InterfaceUsage' && this.connectorEnds(member).length >= 2)
200
208
  continue; // an edge: next slice
209
+ // A unit declared at package level (`attribute <EUR> euro : CurrencyUnit;`) is a declaration a rule
210
+ // may need to count, as ISQ and SI declare theirs. Other attribute usages stay values of their owner.
211
+ if (type === 'AttributeUsage' && !isLibrary && this.isUnitDeclaration(member)) {
212
+ this.usage(member, 'attribute', packageName, undefined);
213
+ continue;
214
+ }
201
215
  const construct = type === 'InterfaceUsage' ? 'interface' : USAGE_CONSTRUCTS[type];
202
216
  if (construct) {
203
217
  const id = this.usage(member, construct, packageName, undefined);
@@ -208,6 +222,22 @@ class ElementBuilder {
208
222
  }
209
223
  }
210
224
  }
225
+ /**
226
+ * Whether a usage is typed by a definition that specializes the standard library's `MeasurementUnit`.
227
+ * The library's own definitions are not in the handoff, so the walk stops at the three it names:
228
+ * `MeasurementUnit` and its two direct subtypes, `SimpleUnit` and `DerivedUnit`
229
+ * (MeasurementReferences.sysml), which every unit definition in ISQ, SI and a project reaches.
230
+ */
231
+ isUnitDeclaration(usage) {
232
+ const seen = new Set();
233
+ const reaches = (type) => {
234
+ if (seen.has(type['@id']))
235
+ return false;
236
+ seen.add(type['@id']);
237
+ return ['MeasurementUnit', 'SimpleUnit', 'DerivedUnit'].includes(this.api.name(type['@id']) ?? '') || this.api.superclassifiers(type['@id']).some(reaches);
238
+ };
239
+ return this.api.types(usage['@id']).some(reaches);
240
+ }
211
241
  /** A folder's label: an explicit `Matrix folder:` doc line, else the package name tidied. */
212
242
  folderLabel(pkg, name) {
213
243
  const doc = this.doc(pkg);
@@ -228,7 +258,19 @@ class ElementBuilder {
228
258
  /** The type a usage names, spelled as MEMO stores it: the type's own name. */
229
259
  typeName(element) {
230
260
  const type = this.api.types(element['@id'])[0] ?? this.api.conjugatedOriginal(element['@id']);
231
- return type ? this.api.name(type['@id']) : undefined;
261
+ if (type)
262
+ return this.api.name(type['@id']);
263
+ // A variant declared without a type is typed by its variation (SysML: a variant usage specializes
264
+ // the variation point it is in), so it is an element of the variation's kind.
265
+ const variation = this.variationOf(element);
266
+ return variation ? this.typeName(variation) : undefined;
267
+ }
268
+ /** The variation a `variant part` is declared in, when it is declared without a type of its own. */
269
+ variationOf(member) {
270
+ if (member['@type'] !== 'PartUsage')
271
+ return undefined;
272
+ const owner = this.api.owner(member['@id']);
273
+ return owner && owner.isVariation === true ? owner : undefined;
232
274
  }
233
275
  superTypeName(element) {
234
276
  const general = this.api.superclassifiers(element['@id'])[0];
@@ -253,6 +295,8 @@ class ElementBuilder {
253
295
  this.ports(def, packageName, id);
254
296
  this.nestedParts(def, packageName, id);
255
297
  }
298
+ if (construct === 'part')
299
+ this.nestedStates(def, packageName, id);
256
300
  }
257
301
  itemDefinition(def, packageName) {
258
302
  const shortName = this.api.name(def['@id']);
@@ -330,8 +374,37 @@ class ElementBuilder {
330
374
  this.usage(member, 'state', packageName, id);
331
375
  }
332
376
  }
377
+ if (construct === 'part')
378
+ this.nestedStates(usage, packageName, id);
379
+ if (construct === 'part')
380
+ this.ownedActions(usage, packageName, id);
333
381
  return id;
334
382
  }
383
+ /**
384
+ * The actions a part declares in its body: what it owns as behaviour, and for an operational workflow, the
385
+ * analysis of a body of work, its scenarios. A part body takes any OccurrenceUsageElement, ActionUsage among
386
+ * its behaviour usages (SysML-textual-bnf.kebnf:241, :358, :378-379), and the part is the action's owner, not
387
+ * its `parentAction`. A `perform` is a
388
+ * PerformActionUsage, built as a trace; a parameter or a redefinition declares no step of its own.
389
+ */
390
+ ownedActions(owner, packageName, ownerId) {
391
+ for (const member of this.api.ownedMembers(owner['@id'])) {
392
+ if (member['@type'] !== 'ActionUsage' || !this.api.declaredName(member['@id']) || this.direction(member))
393
+ continue;
394
+ this.action(member, packageName, undefined, ownerId);
395
+ this.partOwnedActions.add(qualifiedId(this.api.name(member['@id']), packageName, ownerId));
396
+ }
397
+ }
398
+ /**
399
+ * The states a part declares. A state is a behaviour of its part, and what it performs is what is
400
+ * available in that mode, so it has to be an element for `do fnX;` to say which state does.
401
+ */
402
+ nestedStates(owner, packageName, ownerId) {
403
+ for (const member of this.api.ownedMembers(owner['@id'])) {
404
+ if (member['@type'] === 'StateUsage' && this.api.name(member['@id']))
405
+ this.usage(member, 'state', packageName, ownerId);
406
+ }
407
+ }
335
408
  viewpoint(usage, packageName, ownerId) {
336
409
  const id = this.usage(usage, 'viewpoint', packageName, ownerId);
337
410
  for (const member of this.api.ownedMembers(usage['@id'])) {
@@ -496,7 +569,7 @@ class ElementBuilder {
496
569
  if (member.isEnd === true)
497
570
  continue;
498
571
  // Only a TYPED nested usage is containment; an untyped one is view metadata.
499
- if (!this.api.name(member['@id']) || this.api.types(member['@id']).length === 0)
572
+ if (!this.api.name(member['@id']) || (this.api.types(member['@id']).length === 0 && !this.variationOf(member)))
500
573
  continue;
501
574
  // A typed part that subsets a feature (`part mapEngine : LogicalComponent :> component`)
502
575
  // is still a part usage the owner contains: `PartUsage` takes a `UsageDeclaration`, whose
@@ -693,6 +766,7 @@ class ElementBuilder {
693
766
  case 'string': return value.value;
694
767
  case 'number': return renderNumber(value.value, value.rational);
695
768
  case 'boolean': return String(value.value);
769
+ case 'quantity': return `${renderNumber(value.amount, false)} [${value.unit}]`;
696
770
  case 'sequence': return value.items.map(item => this.render(item)).filter(s => s.length > 0).join(', ');
697
771
  case 'reference': {
698
772
  // An enumeration literal is `Kind::member`, the one spelling MEMO
@@ -704,10 +778,20 @@ class ElementBuilder {
704
778
  }
705
779
  return lastSegment(value.qualifiedName);
706
780
  }
707
- case 'chain': return value.steps.map(lastSegment).join('.');
781
+ // A step that redefines (`:>> wcetMs`) declares no name of its own; OpenSysML's qualified name for
782
+ // it is a position (`@4`), where it is the name of what it redefines that reads.
783
+ case 'chain': return value.steps.map(step => this.stepName(step)).join('.');
708
784
  default: return '';
709
785
  }
710
786
  }
787
+ /** The name a chain step is read by: its last segment, or the name it borrows when that segment is a position. */
788
+ stepName(qualifiedName) {
789
+ const last = lastSegment(qualifiedName);
790
+ if (!last.startsWith('@'))
791
+ return last;
792
+ const step = this.api.resolve(qualifiedName);
793
+ return (step ? this.api.name(step['@id']) : undefined) ?? last;
794
+ }
711
795
  /** The flat attribute map of any element, for readers outside the builder. */
712
796
  attributesOf(owner) { return this.attributes(owner); }
713
797
  /** The doc comment of any element, for readers outside the builder. */
@@ -1109,8 +1193,9 @@ class ElementBuilder {
1109
1193
  return undefined;
1110
1194
  switch (expression['@type']) {
1111
1195
  case 'LiteralBoolean': return String(expression.value);
1112
- case 'LiteralInteger':
1113
- case 'LiteralRational': return String(expression.value);
1196
+ case 'LiteralInteger': return String(expression.value);
1197
+ // A rational keeps its point (`1.0`), as a feature value renders it.
1198
+ case 'LiteralRational': return typeof expression.value === 'number' ? renderNumber(expression.value, true) : String(expression.value);
1114
1199
  case 'LiteralString': return `"${expression.value}"`;
1115
1200
  case 'FeatureReferenceExpression':
1116
1201
  case 'FeatureChainExpression': {
@@ -1128,6 +1213,9 @@ class ElementBuilder {
1128
1213
  if (operands.some(o => o === undefined))
1129
1214
  return undefined;
1130
1215
  const operator = String(expression.operator);
1216
+ // `0 [kg]` is the `[` operator applied to a number and a unit, not a binary operator.
1217
+ if (operator === '[' && operands.length === 2)
1218
+ return `${operands[0]} [${operands[1]}]`;
1131
1219
  return operands.length === 1 ? `${operator} ${operands[0]}` : operands.join(` ${operator} `);
1132
1220
  }
1133
1221
  default: return undefined;
@@ -1262,6 +1350,10 @@ class ElementBuilder {
1262
1350
  const target = endpointOf(this.steps(this.api.subsetted(node['@id'])[0]), node);
1263
1351
  if (owner && target)
1264
1352
  this.native('performs', owner, target, file);
1353
+ // And the step itself subsets it: a rule about a step reaches the function through this edge.
1354
+ const step = this.api.qualifiedName(node['@id']);
1355
+ if (step && target && this.elements.has(step))
1356
+ this.native('subsets', step, target, file);
1265
1357
  }
1266
1358
  else if (type === 'SubjectMembership') {
1267
1359
  const ownerNode = this.api.owner(node['@id']);
@@ -1281,7 +1373,7 @@ class ElementBuilder {
1281
1373
  // carried out with, which `verifiedBy` would claim was verified.
1282
1374
  const aboutSubject = [
1283
1375
  'RequirementUsage', 'RequirementDefinition',
1284
- 'UseCaseUsage', 'UseCaseDefinition', 'IncludeUseCaseUsage',
1376
+ 'UseCaseUsage', 'UseCaseDefinition', 'IncludeUseCaseUsage', 'AnalysisCaseUsage', 'AnalysisCaseDefinition',
1285
1377
  ].includes(ownerNode['@type']);
1286
1378
  // A subject declared by TYPE (`subject :>> supportingSystem : NavigationSystem;`)
1287
1379
  // is about that definition: it is how a system's use case names its system. Only a
@@ -1386,7 +1478,8 @@ class ElementBuilder {
1386
1478
  }
1387
1479
  return undefined;
1388
1480
  }
1389
- /** `composes` edges from native nesting: parts, items and states by owner; actions by parent action. */
1481
+ /** `composes` edges from native nesting: parts, items and states by owner; actions by parent action, or by
1482
+ * the part whose own body declares them. */
1390
1483
  composition() {
1391
1484
  const containing = new Set(['part', 'item', 'state']);
1392
1485
  for (const element of this.elements.values()) {
@@ -1398,6 +1491,13 @@ class ElementBuilder {
1398
1491
  this.relationships.push({ id: this.nextId(), type: 'composes', sourceId: element.owner, sourceEnd: 'parent',
1399
1492
  targetId: element.id, targetEnd: 'child', file: element.file, named: false });
1400
1493
  }
1494
+ for (const id of this.partOwnedActions) {
1495
+ const element = this.elements.get(id);
1496
+ if (!element?.owner || !this.elements.get(element.owner))
1497
+ continue;
1498
+ this.relationships.push({ id: this.nextId(), type: 'composes', sourceId: element.owner, sourceEnd: 'parent',
1499
+ targetId: element.id, targetEnd: 'child', file: element.file, named: false });
1500
+ }
1401
1501
  for (const element of this.elements.values()) {
1402
1502
  if (element.construct !== 'action' || !element.parentAction)
1403
1503
  continue;
@@ -1409,6 +1509,79 @@ class ElementBuilder {
1409
1509
  }
1410
1510
  }
1411
1511
  // ─── After extraction ───────────────────────────────────────────────────
1512
+ // ─── Native constraints ────────────────────────────────────────
1513
+ /**
1514
+ * The project's native constraints as elements: a `constraint def`, a `constraint` or `assert
1515
+ * constraint` usage, and the `assume` / `require constraint` of a requirement. Each is owned by the
1516
+ * nearest element that holds it and carries its expression as readable text, so "every constraint of
1517
+ * the system" is a query over elements, not a search of the source.
1518
+ *
1519
+ * A constraint that specializes `MemoConsistencyRule` is a MEMO rule and is left to the rule loader.
1520
+ * A library's or a dependency's constraints are not the project's. One without a name takes
1521
+ * `constraint<N>` in its owner's declaration order, which is positional: reordering an owner's
1522
+ * constraints renumbers them.
1523
+ */
1524
+ constraints() {
1525
+ const counters = new Map();
1526
+ const nodes = ['ConstraintDefinition', 'ConstraintUsage', 'AssertConstraintUsage']
1527
+ .flatMap(metaclass => this.api.ofType(metaclass).map(node => ({ node, metaclass })))
1528
+ .filter(({ node, metaclass }) => !this.api.isDependency(node['@id'])
1529
+ && !(this.projectFiles && !this.projectFiles.has(this.file(node)))
1530
+ && !(metaclass === 'ConstraintDefinition' && specializesByName(this.api, node, RULE_MARKER)));
1531
+ // Declaration order, so an owner's anonymous constraints are numbered the way they read in the file.
1532
+ const position = (node) => this.api.source(node['@id'])?.startByte ?? 0;
1533
+ nodes.sort((a, b) => this.file(a.node).localeCompare(this.file(b.node)) || position(a.node) - position(b.node));
1534
+ for (const { node, metaclass } of nodes)
1535
+ this.constraint(node, metaclass, counters);
1536
+ }
1537
+ constraint(node, metaclass, counters) {
1538
+ // `assume X;` and `require X;` name a requirement that already exists: that is the `assumes` / `requires`
1539
+ // edge, not a second constraint, and the requirement it names is the element.
1540
+ if (this.api.related(node['@id'], ['ReferenceSubsetting'], 'referencedFeature').length > 0)
1541
+ return;
1542
+ const ownerId = this.nearestElement(node);
1543
+ const packageName = ownerId ? this.elements.get(ownerId)?.package : this.packageNameOf(node);
1544
+ if (!ownerId && packageName === undefined)
1545
+ return;
1546
+ const declared = this.api.name(node['@id']);
1547
+ let shortName = declared;
1548
+ if (!shortName) {
1549
+ const key = ownerId ?? packageName ?? '';
1550
+ const next = (counters.get(key) ?? 0) + 1;
1551
+ counters.set(key, next);
1552
+ shortName = `constraint${next}`;
1553
+ }
1554
+ const id = qualifiedId(shortName, packageName, ownerId);
1555
+ if (this.elements.has(id))
1556
+ return;
1557
+ const membership = node.owningRelationship?.['@id'];
1558
+ const via = membership ? this.api.element(membership) : undefined;
1559
+ const role = metaclass === 'AssertConstraintUsage' ? 'assert'
1560
+ : via?.['@type'] === 'RequirementConstraintMembership' ? String(via.kind === 'assumption' ? 'assume' : 'require')
1561
+ : 'constraint';
1562
+ const result = this.api.ownedRelationships(node['@id']).find(r => r['@type'] === 'ResultExpressionMembership');
1563
+ const expression = this.expressionText((result?.ownedRelatedElement ?? [])[0]?.['@id']);
1564
+ const attributes = { constraintRole: role };
1565
+ if (expression !== undefined)
1566
+ attributes.expression = expression;
1567
+ if (!declared)
1568
+ attributes.positional = 'true';
1569
+ const owner = ownerId ? this.elements.get(ownerId) : undefined;
1570
+ this.define({
1571
+ id, shortName, name: shortName, kind: metaclass, construct: 'constraint',
1572
+ layer: owner?.layer ?? resolveLayerFromPath(this.file(node)),
1573
+ file: this.file(node), package: packageName || undefined, attributes, doc: this.doc(node),
1574
+ isDefinition: metaclass === 'ConstraintDefinition' ? true : undefined, owner: ownerId,
1575
+ }, node);
1576
+ }
1577
+ /** The qualified name of the package that encloses a top-level declaration. */
1578
+ packageNameOf(node) {
1579
+ for (let current = this.api.owner(node['@id']); current; current = this.api.owner(current['@id'])) {
1580
+ if (current['@type'] === 'Package' || current['@type'] === 'LibraryPackage')
1581
+ return this.api.qualifiedName(current['@id']);
1582
+ }
1583
+ return undefined;
1584
+ }
1412
1585
  /** A usage typed by a local definition takes the ontology kind that definition resolved to. */
1413
1586
  inheritKindsFromLocalDefinitions() {
1414
1587
  const registry = this.registries?.kindRegistry;
@@ -1429,7 +1602,10 @@ class ElementBuilder {
1429
1602
  if (!element.kind || registry.getKind(element.kind))
1430
1603
  continue;
1431
1604
  const def = byName.get(lastSegment(element.kind));
1432
- if (def && def !== element && def.kind && def.kind !== element.kind) {
1605
+ // Only a MEMO kind is passed down. A definition that specializes none is a
1606
+ // `RequirementDefinition` or a `PartDefinition`, which says what the definition is,
1607
+ // not what its usage is; the usage keeps the name of the type it is typed by.
1608
+ if (def && def !== element && def.kind && def.kind !== element.kind && registry.getKind(def.kind)) {
1433
1609
  element.kind = def.kind;
1434
1610
  if (def.layer && (!element.layer || element.layer === 'unknown'))
1435
1611
  element.layer = def.layer;