@principal-ai/subsystems-core 0.29.0 → 0.30.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 (553) hide show
  1. package/README.md +15 -110
  2. package/dist/index.d.ts +7 -75
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +21 -205
  5. package/dist/index.js.map +1 -1
  6. package/dist/node.d.ts +7 -62
  7. package/dist/node.d.ts.map +1 -1
  8. package/dist/node.js +11 -146
  9. package/dist/node.js.map +1 -1
  10. package/dist/types/index.d.ts +3 -348
  11. package/dist/types/index.d.ts.map +1 -1
  12. package/dist/types/index.js +3 -19
  13. package/dist/types/index.js.map +1 -1
  14. package/package.json +7 -24
  15. package/src/index.ts +7 -580
  16. package/src/node.ts +21 -262
  17. package/src/types/index.ts +3 -456
  18. package/dist/ConfigurationLoader.d.ts +0 -76
  19. package/dist/ConfigurationLoader.d.ts.map +0 -1
  20. package/dist/ConfigurationLoader.js +0 -148
  21. package/dist/ConfigurationLoader.js.map +0 -1
  22. package/dist/ConfigurationValidator.d.ts +0 -31
  23. package/dist/ConfigurationValidator.d.ts.map +0 -1
  24. package/dist/ConfigurationValidator.js +0 -239
  25. package/dist/ConfigurationValidator.js.map +0 -1
  26. package/dist/EventProcessor.d.ts +0 -49
  27. package/dist/EventProcessor.d.ts.map +0 -1
  28. package/dist/EventProcessor.js +0 -220
  29. package/dist/EventProcessor.js.map +0 -1
  30. package/dist/EventRecorderService.d.ts +0 -305
  31. package/dist/EventRecorderService.d.ts.map +0 -1
  32. package/dist/EventRecorderService.js +0 -467
  33. package/dist/EventRecorderService.js.map +0 -1
  34. package/dist/LibraryLoader.d.ts +0 -65
  35. package/dist/LibraryLoader.d.ts.map +0 -1
  36. package/dist/LibraryLoader.js +0 -197
  37. package/dist/LibraryLoader.js.map +0 -1
  38. package/dist/PathBasedEventProcessor.d.ts +0 -77
  39. package/dist/PathBasedEventProcessor.d.ts.map +0 -1
  40. package/dist/PathBasedEventProcessor.js +0 -136
  41. package/dist/PathBasedEventProcessor.js.map +0 -1
  42. package/dist/SessionManager.d.ts +0 -194
  43. package/dist/SessionManager.d.ts.map +0 -1
  44. package/dist/SessionManager.js +0 -302
  45. package/dist/SessionManager.js.map +0 -1
  46. package/dist/ValidationEngine.d.ts +0 -31
  47. package/dist/ValidationEngine.d.ts.map +0 -1
  48. package/dist/ValidationEngine.js +0 -162
  49. package/dist/ValidationEngine.js.map +0 -1
  50. package/dist/auxiliary/AuxiliaryManifestValidator.d.ts +0 -41
  51. package/dist/auxiliary/AuxiliaryManifestValidator.d.ts.map +0 -1
  52. package/dist/auxiliary/AuxiliaryManifestValidator.js +0 -100
  53. package/dist/auxiliary/AuxiliaryManifestValidator.js.map +0 -1
  54. package/dist/auxiliary/index.d.ts +0 -9
  55. package/dist/auxiliary/index.d.ts.map +0 -1
  56. package/dist/auxiliary/index.js +0 -14
  57. package/dist/auxiliary/index.js.map +0 -1
  58. package/dist/auxiliary/validateAreaScopeDisjoint.d.ts +0 -24
  59. package/dist/auxiliary/validateAreaScopeDisjoint.d.ts.map +0 -1
  60. package/dist/auxiliary/validateAreaScopeDisjoint.js +0 -61
  61. package/dist/auxiliary/validateAreaScopeDisjoint.js.map +0 -1
  62. package/dist/cli/codegen.d.ts +0 -41
  63. package/dist/cli/codegen.d.ts.map +0 -1
  64. package/dist/cli/codegen.js +0 -257
  65. package/dist/cli/codegen.js.map +0 -1
  66. package/dist/codegen/type-generator.d.ts +0 -123
  67. package/dist/codegen/type-generator.d.ts.map +0 -1
  68. package/dist/codegen/type-generator.js +0 -433
  69. package/dist/codegen/type-generator.js.map +0 -1
  70. package/dist/codegen/usage-example.d.ts +0 -103
  71. package/dist/codegen/usage-example.d.ts.map +0 -1
  72. package/dist/codegen/usage-example.js +0 -258
  73. package/dist/codegen/usage-example.js.map +0 -1
  74. package/dist/dashboard/DashboardValidator.d.ts +0 -85
  75. package/dist/dashboard/DashboardValidator.d.ts.map +0 -1
  76. package/dist/dashboard/DashboardValidator.js +0 -775
  77. package/dist/dashboard/DashboardValidator.js.map +0 -1
  78. package/dist/dashboard/index.d.ts +0 -6
  79. package/dist/dashboard/index.d.ts.map +0 -1
  80. package/dist/dashboard/index.js +0 -10
  81. package/dist/dashboard/index.js.map +0 -1
  82. package/dist/discovery/CanvasDiscovery.d.ts +0 -160
  83. package/dist/discovery/CanvasDiscovery.d.ts.map +0 -1
  84. package/dist/discovery/CanvasDiscovery.js +0 -865
  85. package/dist/discovery/CanvasDiscovery.js.map +0 -1
  86. package/dist/discovery/CanvasFileManifest.d.ts +0 -86
  87. package/dist/discovery/CanvasFileManifest.d.ts.map +0 -1
  88. package/dist/discovery/CanvasFileManifest.js +0 -338
  89. package/dist/discovery/CanvasFileManifest.js.map +0 -1
  90. package/dist/discovery/LibraryDiscovery.d.ts +0 -108
  91. package/dist/discovery/LibraryDiscovery.d.ts.map +0 -1
  92. package/dist/discovery/LibraryDiscovery.js +0 -263
  93. package/dist/discovery/LibraryDiscovery.js.map +0 -1
  94. package/dist/discovery/types.d.ts +0 -403
  95. package/dist/discovery/types.d.ts.map +0 -1
  96. package/dist/discovery/types.js +0 -6
  97. package/dist/discovery/types.js.map +0 -1
  98. package/dist/events/EventsCanvasValidator.d.ts +0 -139
  99. package/dist/events/EventsCanvasValidator.d.ts.map +0 -1
  100. package/dist/events/EventsCanvasValidator.js +0 -281
  101. package/dist/events/EventsCanvasValidator.js.map +0 -1
  102. package/dist/events/NamespacePathIndex.d.ts +0 -61
  103. package/dist/events/NamespacePathIndex.d.ts.map +0 -1
  104. package/dist/events/NamespacePathIndex.js +0 -74
  105. package/dist/events/NamespacePathIndex.js.map +0 -1
  106. package/dist/events/OtelEventPathsValidator.d.ts +0 -75
  107. package/dist/events/OtelEventPathsValidator.d.ts.map +0 -1
  108. package/dist/events/OtelEventPathsValidator.js +0 -126
  109. package/dist/events/OtelEventPathsValidator.js.map +0 -1
  110. package/dist/events/ScopeEventsValidator.d.ts +0 -68
  111. package/dist/events/ScopeEventsValidator.d.ts.map +0 -1
  112. package/dist/events/ScopeEventsValidator.js +0 -91
  113. package/dist/events/ScopeEventsValidator.js.map +0 -1
  114. package/dist/events/index.d.ts +0 -9
  115. package/dist/events/index.d.ts.map +0 -1
  116. package/dist/events/index.js +0 -12
  117. package/dist/events/index.js.map +0 -1
  118. package/dist/events/path-helpers.d.ts +0 -33
  119. package/dist/events/path-helpers.d.ts.map +0 -1
  120. package/dist/events/path-helpers.js +0 -59
  121. package/dist/events/path-helpers.js.map +0 -1
  122. package/dist/execution/ExecutionLoader.d.ts +0 -135
  123. package/dist/execution/ExecutionLoader.d.ts.map +0 -1
  124. package/dist/execution/ExecutionLoader.js +0 -266
  125. package/dist/execution/ExecutionLoader.js.map +0 -1
  126. package/dist/execution/ExecutionValidator.d.ts +0 -94
  127. package/dist/execution/ExecutionValidator.d.ts.map +0 -1
  128. package/dist/execution/ExecutionValidator.js +0 -503
  129. package/dist/execution/ExecutionValidator.js.map +0 -1
  130. package/dist/generated/graph-converter-execution.types.d.ts +0 -177
  131. package/dist/generated/graph-converter-execution.types.d.ts.map +0 -1
  132. package/dist/generated/graph-converter-execution.types.js +0 -12
  133. package/dist/generated/graph-converter-execution.types.js.map +0 -1
  134. package/dist/helpers/GraphInstrumentationHelper.d.ts +0 -93
  135. package/dist/helpers/GraphInstrumentationHelper.d.ts.map +0 -1
  136. package/dist/helpers/GraphInstrumentationHelper.js +0 -252
  137. package/dist/helpers/GraphInstrumentationHelper.js.map +0 -1
  138. package/dist/matchers/SpanMatcher.d.ts +0 -107
  139. package/dist/matchers/SpanMatcher.d.ts.map +0 -1
  140. package/dist/matchers/SpanMatcher.js +0 -274
  141. package/dist/matchers/SpanMatcher.js.map +0 -1
  142. package/dist/orchestration/TraceOrchestrator.d.ts +0 -71
  143. package/dist/orchestration/TraceOrchestrator.d.ts.map +0 -1
  144. package/dist/orchestration/TraceOrchestrator.js +0 -416
  145. package/dist/orchestration/TraceOrchestrator.js.map +0 -1
  146. package/dist/parsers/OtlpTraceParser.d.ts +0 -131
  147. package/dist/parsers/OtlpTraceParser.d.ts.map +0 -1
  148. package/dist/parsers/OtlpTraceParser.js +0 -310
  149. package/dist/parsers/OtlpTraceParser.js.map +0 -1
  150. package/dist/registry/CompositeRegistry.d.ts +0 -71
  151. package/dist/registry/CompositeRegistry.d.ts.map +0 -1
  152. package/dist/registry/CompositeRegistry.js +0 -113
  153. package/dist/registry/CompositeRegistry.js.map +0 -1
  154. package/dist/registry/EventRegistry.d.ts +0 -79
  155. package/dist/registry/EventRegistry.d.ts.map +0 -1
  156. package/dist/registry/EventRegistry.js +0 -165
  157. package/dist/registry/EventRegistry.js.map +0 -1
  158. package/dist/registry/LocalRegistry.d.ts +0 -111
  159. package/dist/registry/LocalRegistry.d.ts.map +0 -1
  160. package/dist/registry/LocalRegistry.js +0 -335
  161. package/dist/registry/LocalRegistry.js.map +0 -1
  162. package/dist/registry/RemoteRegistry.d.ts +0 -122
  163. package/dist/registry/RemoteRegistry.d.ts.map +0 -1
  164. package/dist/registry/RemoteRegistry.js +0 -399
  165. package/dist/registry/RemoteRegistry.js.map +0 -1
  166. package/dist/registry/VersionRegistry.d.ts +0 -51
  167. package/dist/registry/VersionRegistry.d.ts.map +0 -1
  168. package/dist/registry/VersionRegistry.js +0 -105
  169. package/dist/registry/VersionRegistry.js.map +0 -1
  170. package/dist/rules/config.d.ts +0 -57
  171. package/dist/rules/config.d.ts.map +0 -1
  172. package/dist/rules/config.js +0 -382
  173. package/dist/rules/config.js.map +0 -1
  174. package/dist/rules/engine.d.ts +0 -70
  175. package/dist/rules/engine.d.ts.map +0 -1
  176. package/dist/rules/engine.js +0 -373
  177. package/dist/rules/engine.js.map +0 -1
  178. package/dist/rules/implementations/connection-type-references.d.ts +0 -7
  179. package/dist/rules/implementations/connection-type-references.d.ts.map +0 -1
  180. package/dist/rules/implementations/connection-type-references.js +0 -107
  181. package/dist/rules/implementations/connection-type-references.js.map +0 -1
  182. package/dist/rules/implementations/dead-end-states.d.ts +0 -17
  183. package/dist/rules/implementations/dead-end-states.d.ts.map +0 -1
  184. package/dist/rules/implementations/dead-end-states.js +0 -75
  185. package/dist/rules/implementations/dead-end-states.js.map +0 -1
  186. package/dist/rules/implementations/index.d.ts +0 -23
  187. package/dist/rules/implementations/index.d.ts.map +0 -1
  188. package/dist/rules/implementations/index.js +0 -73
  189. package/dist/rules/implementations/index.js.map +0 -1
  190. package/dist/rules/implementations/minimum-node-sources.d.ts +0 -24
  191. package/dist/rules/implementations/minimum-node-sources.d.ts.map +0 -1
  192. package/dist/rules/implementations/minimum-node-sources.js +0 -59
  193. package/dist/rules/implementations/minimum-node-sources.js.map +0 -1
  194. package/dist/rules/implementations/no-unknown-fields.d.ts +0 -7
  195. package/dist/rules/implementations/no-unknown-fields.d.ts.map +0 -1
  196. package/dist/rules/implementations/no-unknown-fields.js +0 -216
  197. package/dist/rules/implementations/no-unknown-fields.js.map +0 -1
  198. package/dist/rules/implementations/orphaned-edge-types.d.ts +0 -7
  199. package/dist/rules/implementations/orphaned-edge-types.d.ts.map +0 -1
  200. package/dist/rules/implementations/orphaned-edge-types.js +0 -50
  201. package/dist/rules/implementations/orphaned-edge-types.js.map +0 -1
  202. package/dist/rules/implementations/orphaned-node-types.d.ts +0 -7
  203. package/dist/rules/implementations/orphaned-node-types.d.ts.map +0 -1
  204. package/dist/rules/implementations/orphaned-node-types.js +0 -53
  205. package/dist/rules/implementations/orphaned-node-types.js.map +0 -1
  206. package/dist/rules/implementations/required-metadata.d.ts +0 -7
  207. package/dist/rules/implementations/required-metadata.d.ts.map +0 -1
  208. package/dist/rules/implementations/required-metadata.js +0 -48
  209. package/dist/rules/implementations/required-metadata.js.map +0 -1
  210. package/dist/rules/implementations/state-transition-references.d.ts +0 -7
  211. package/dist/rules/implementations/state-transition-references.d.ts.map +0 -1
  212. package/dist/rules/implementations/state-transition-references.js +0 -138
  213. package/dist/rules/implementations/state-transition-references.js.map +0 -1
  214. package/dist/rules/implementations/unreachable-states.d.ts +0 -7
  215. package/dist/rules/implementations/unreachable-states.d.ts.map +0 -1
  216. package/dist/rules/implementations/unreachable-states.js +0 -83
  217. package/dist/rules/implementations/unreachable-states.js.map +0 -1
  218. package/dist/rules/implementations/valid-action-patterns.d.ts +0 -17
  219. package/dist/rules/implementations/valid-action-patterns.d.ts.map +0 -1
  220. package/dist/rules/implementations/valid-action-patterns.js +0 -112
  221. package/dist/rules/implementations/valid-action-patterns.js.map +0 -1
  222. package/dist/rules/implementations/valid-color-format.d.ts +0 -7
  223. package/dist/rules/implementations/valid-color-format.d.ts.map +0 -1
  224. package/dist/rules/implementations/valid-color-format.js +0 -94
  225. package/dist/rules/implementations/valid-color-format.js.map +0 -1
  226. package/dist/rules/implementations/valid-edge-types.d.ts +0 -7
  227. package/dist/rules/implementations/valid-edge-types.d.ts.map +0 -1
  228. package/dist/rules/implementations/valid-edge-types.js +0 -248
  229. package/dist/rules/implementations/valid-edge-types.js.map +0 -1
  230. package/dist/rules/implementations/valid-node-types.d.ts +0 -7
  231. package/dist/rules/implementations/valid-node-types.d.ts.map +0 -1
  232. package/dist/rules/implementations/valid-node-types.js +0 -187
  233. package/dist/rules/implementations/valid-node-types.js.map +0 -1
  234. package/dist/rules/index.d.ts +0 -28
  235. package/dist/rules/index.d.ts.map +0 -1
  236. package/dist/rules/index.js +0 -70
  237. package/dist/rules/index.js.map +0 -1
  238. package/dist/rules/types.d.ts +0 -309
  239. package/dist/rules/types.d.ts.map +0 -1
  240. package/dist/rules/types.js +0 -40
  241. package/dist/rules/types.js.map +0 -1
  242. package/dist/scopes/ScopePathIndex.d.ts +0 -56
  243. package/dist/scopes/ScopePathIndex.d.ts.map +0 -1
  244. package/dist/scopes/ScopePathIndex.js +0 -67
  245. package/dist/scopes/ScopePathIndex.js.map +0 -1
  246. package/dist/scopes/ScopesCanvasValidator.d.ts +0 -76
  247. package/dist/scopes/ScopesCanvasValidator.d.ts.map +0 -1
  248. package/dist/scopes/ScopesCanvasValidator.js +0 -221
  249. package/dist/scopes/ScopesCanvasValidator.js.map +0 -1
  250. package/dist/scopes/index.d.ts +0 -12
  251. package/dist/scopes/index.d.ts.map +0 -1
  252. package/dist/scopes/index.js +0 -30
  253. package/dist/scopes/index.js.map +0 -1
  254. package/dist/scopes/utils.d.ts +0 -85
  255. package/dist/scopes/utils.d.ts.map +0 -1
  256. package/dist/scopes/utils.js +0 -143
  257. package/dist/scopes/utils.js.map +0 -1
  258. package/dist/scopes/validateScopeNamespaceNesting.d.ts +0 -38
  259. package/dist/scopes/validateScopeNamespaceNesting.d.ts.map +0 -1
  260. package/dist/scopes/validateScopeNamespaceNesting.js +0 -69
  261. package/dist/scopes/validateScopeNamespaceNesting.js.map +0 -1
  262. package/dist/spans/index.d.ts +0 -12
  263. package/dist/spans/index.d.ts.map +0 -1
  264. package/dist/spans/index.js +0 -25
  265. package/dist/spans/index.js.map +0 -1
  266. package/dist/spans/utils.d.ts +0 -70
  267. package/dist/spans/utils.d.ts.map +0 -1
  268. package/dist/spans/utils.js +0 -205
  269. package/dist/spans/utils.js.map +0 -1
  270. package/dist/storyboard/builder.d.ts +0 -135
  271. package/dist/storyboard/builder.d.ts.map +0 -1
  272. package/dist/storyboard/builder.js +0 -235
  273. package/dist/storyboard/builder.js.map +0 -1
  274. package/dist/storyboard/index.d.ts +0 -9
  275. package/dist/storyboard/index.d.ts.map +0 -1
  276. package/dist/storyboard/index.js +0 -18
  277. package/dist/storyboard/index.js.map +0 -1
  278. package/dist/storyboard/types.d.ts +0 -101
  279. package/dist/storyboard/types.d.ts.map +0 -1
  280. package/dist/storyboard/types.js +0 -10
  281. package/dist/storyboard/types.js.map +0 -1
  282. package/dist/telemetry/coverage.d.ts +0 -92
  283. package/dist/telemetry/coverage.d.ts.map +0 -1
  284. package/dist/telemetry/coverage.js +0 -335
  285. package/dist/telemetry/coverage.js.map +0 -1
  286. package/dist/telemetry/event-validator.d.ts +0 -86
  287. package/dist/telemetry/event-validator.d.ts.map +0 -1
  288. package/dist/telemetry/event-validator.js +0 -257
  289. package/dist/telemetry/event-validator.js.map +0 -1
  290. package/dist/types/audit.d.ts +0 -236
  291. package/dist/types/audit.d.ts.map +0 -1
  292. package/dist/types/audit.js +0 -53
  293. package/dist/types/audit.js.map +0 -1
  294. package/dist/types/auxiliary.d.ts +0 -54
  295. package/dist/types/auxiliary.d.ts.map +0 -1
  296. package/dist/types/auxiliary.js +0 -27
  297. package/dist/types/auxiliary.js.map +0 -1
  298. package/dist/types/canvas-scope.d.ts +0 -156
  299. package/dist/types/canvas-scope.d.ts.map +0 -1
  300. package/dist/types/canvas-scope.js +0 -62
  301. package/dist/types/canvas-scope.js.map +0 -1
  302. package/dist/types/canvas.d.ts +0 -1138
  303. package/dist/types/canvas.d.ts.map +0 -1
  304. package/dist/types/canvas.js +0 -178
  305. package/dist/types/canvas.js.map +0 -1
  306. package/dist/types/dashboard.d.ts +0 -170
  307. package/dist/types/dashboard.d.ts.map +0 -1
  308. package/dist/types/dashboard.js +0 -14
  309. package/dist/types/dashboard.js.map +0 -1
  310. package/dist/types/library.d.ts +0 -227
  311. package/dist/types/library.d.ts.map +0 -1
  312. package/dist/types/library.js +0 -16
  313. package/dist/types/library.js.map +0 -1
  314. package/dist/types/otel.d.ts +0 -465
  315. package/dist/types/otel.d.ts.map +0 -1
  316. package/dist/types/otel.js +0 -163
  317. package/dist/types/otel.js.map +0 -1
  318. package/dist/types/path-based-config.d.ts +0 -235
  319. package/dist/types/path-based-config.d.ts.map +0 -1
  320. package/dist/types/path-based-config.js +0 -11
  321. package/dist/types/path-based-config.js.map +0 -1
  322. package/dist/types/registered-trace.d.ts +0 -337
  323. package/dist/types/registered-trace.d.ts.map +0 -1
  324. package/dist/types/registered-trace.js +0 -16
  325. package/dist/types/registered-trace.js.map +0 -1
  326. package/dist/types/resource-match.d.ts +0 -207
  327. package/dist/types/resource-match.d.ts.map +0 -1
  328. package/dist/types/resource-match.js +0 -74
  329. package/dist/types/resource-match.js.map +0 -1
  330. package/dist/types/version-registry.d.ts +0 -137
  331. package/dist/types/version-registry.d.ts.map +0 -1
  332. package/dist/types/version-registry.js +0 -10
  333. package/dist/types/version-registry.js.map +0 -1
  334. package/dist/utils/CanvasConverter.d.ts +0 -148
  335. package/dist/utils/CanvasConverter.d.ts.map +0 -1
  336. package/dist/utils/CanvasConverter.js +0 -530
  337. package/dist/utils/CanvasConverter.js.map +0 -1
  338. package/dist/utils/GraphConverter.d.ts +0 -18
  339. package/dist/utils/GraphConverter.d.ts.map +0 -1
  340. package/dist/utils/GraphConverter.js +0 -80
  341. package/dist/utils/GraphConverter.js.map +0 -1
  342. package/dist/utils/PathMatcher.d.ts +0 -55
  343. package/dist/utils/PathMatcher.d.ts.map +0 -1
  344. package/dist/utils/PathMatcher.js +0 -178
  345. package/dist/utils/PathMatcher.js.map +0 -1
  346. package/dist/utils/TraceToCanvas.d.ts +0 -83
  347. package/dist/utils/TraceToCanvas.d.ts.map +0 -1
  348. package/dist/utils/TraceToCanvas.js +0 -336
  349. package/dist/utils/TraceToCanvas.js.map +0 -1
  350. package/dist/utils/YamlParser.d.ts +0 -36
  351. package/dist/utils/YamlParser.d.ts.map +0 -1
  352. package/dist/utils/YamlParser.js +0 -92
  353. package/dist/utils/YamlParser.js.map +0 -1
  354. package/dist/utils/registeredTraceHelpers.d.ts +0 -76
  355. package/dist/utils/registeredTraceHelpers.d.ts.map +0 -1
  356. package/dist/utils/registeredTraceHelpers.js +0 -203
  357. package/dist/utils/registeredTraceHelpers.js.map +0 -1
  358. package/dist/utils/traceAggregation.d.ts +0 -25
  359. package/dist/utils/traceAggregation.d.ts.map +0 -1
  360. package/dist/utils/traceAggregation.js +0 -140
  361. package/dist/utils/traceAggregation.js.map +0 -1
  362. package/dist/validation/OtelCanvasValidator.d.ts +0 -40
  363. package/dist/validation/OtelCanvasValidator.d.ts.map +0 -1
  364. package/dist/validation/OtelCanvasValidator.js +0 -59
  365. package/dist/validation/OtelCanvasValidator.js.map +0 -1
  366. package/dist/validation/index.d.ts +0 -8
  367. package/dist/validation/index.d.ts.map +0 -1
  368. package/dist/validation/index.js +0 -13
  369. package/dist/validation/index.js.map +0 -1
  370. package/dist/validation/libraryValidation.d.ts +0 -53
  371. package/dist/validation/libraryValidation.d.ts.map +0 -1
  372. package/dist/validation/libraryValidation.js +0 -115
  373. package/dist/validation/libraryValidation.js.map +0 -1
  374. package/dist/workflow/edge-derivation.d.ts +0 -111
  375. package/dist/workflow/edge-derivation.d.ts.map +0 -1
  376. package/dist/workflow/edge-derivation.js +0 -174
  377. package/dist/workflow/edge-derivation.js.map +0 -1
  378. package/dist/workflow/edge-validation.d.ts +0 -170
  379. package/dist/workflow/edge-validation.d.ts.map +0 -1
  380. package/dist/workflow/edge-validation.js +0 -332
  381. package/dist/workflow/edge-validation.js.map +0 -1
  382. package/dist/workflow/example.d.ts +0 -11
  383. package/dist/workflow/example.d.ts.map +0 -1
  384. package/dist/workflow/example.js +0 -310
  385. package/dist/workflow/example.js.map +0 -1
  386. package/dist/workflow/index.d.ts +0 -20
  387. package/dist/workflow/index.d.ts.map +0 -1
  388. package/dist/workflow/index.js +0 -49
  389. package/dist/workflow/index.js.map +0 -1
  390. package/dist/workflow/scenario-matcher.d.ts +0 -63
  391. package/dist/workflow/scenario-matcher.d.ts.map +0 -1
  392. package/dist/workflow/scenario-matcher.js +0 -215
  393. package/dist/workflow/scenario-matcher.js.map +0 -1
  394. package/dist/workflow/template-parser.d.ts +0 -73
  395. package/dist/workflow/template-parser.d.ts.map +0 -1
  396. package/dist/workflow/template-parser.js +0 -280
  397. package/dist/workflow/template-parser.js.map +0 -1
  398. package/dist/workflow/template-renderer.d.ts +0 -45
  399. package/dist/workflow/template-renderer.d.ts.map +0 -1
  400. package/dist/workflow/template-renderer.js +0 -401
  401. package/dist/workflow/template-renderer.js.map +0 -1
  402. package/dist/workflow/types.d.ts +0 -393
  403. package/dist/workflow/types.d.ts.map +0 -1
  404. package/dist/workflow/types.js +0 -40
  405. package/dist/workflow/types.js.map +0 -1
  406. package/dist/workflow/validator.d.ts +0 -363
  407. package/dist/workflow/validator.d.ts.map +0 -1
  408. package/dist/workflow/validator.js +0 -2283
  409. package/dist/workflow/validator.js.map +0 -1
  410. package/schemas/auxiliary.manifest.schema.json +0 -56
  411. package/src/ConfigurationLoader.test.ts +0 -466
  412. package/src/ConfigurationLoader.ts +0 -184
  413. package/src/ConfigurationValidator.test.ts +0 -200
  414. package/src/ConfigurationValidator.ts +0 -273
  415. package/src/EventProcessor.test.ts +0 -405
  416. package/src/EventProcessor.ts +0 -256
  417. package/src/EventRecorderService.test.ts +0 -543
  418. package/src/EventRecorderService.ts +0 -741
  419. package/src/LibraryLoader.ts +0 -194
  420. package/src/PathBasedEventProcessor.test.ts +0 -336
  421. package/src/PathBasedEventProcessor.ts +0 -196
  422. package/src/SessionManager.test.ts +0 -424
  423. package/src/SessionManager.ts +0 -471
  424. package/src/ValidationEngine.test.ts +0 -520
  425. package/src/ValidationEngine.ts +0 -200
  426. package/src/auxiliary/AuxiliaryManifestValidator.test.ts +0 -93
  427. package/src/auxiliary/AuxiliaryManifestValidator.ts +0 -132
  428. package/src/auxiliary/index.ts +0 -18
  429. package/src/auxiliary/validateAreaScopeDisjoint.test.ts +0 -85
  430. package/src/auxiliary/validateAreaScopeDisjoint.ts +0 -72
  431. package/src/cli/codegen.ts +0 -286
  432. package/src/codegen/type-generator.test.ts +0 -219
  433. package/src/codegen/type-generator.ts +0 -560
  434. package/src/codegen/usage-example.ts +0 -357
  435. package/src/dashboard/DashboardValidator.ts +0 -904
  436. package/src/dashboard/index.ts +0 -14
  437. package/src/discovery/CanvasDiscovery.test.ts +0 -691
  438. package/src/discovery/CanvasDiscovery.ts +0 -1114
  439. package/src/discovery/CanvasFileManifest.test.ts +0 -521
  440. package/src/discovery/CanvasFileManifest.ts +0 -419
  441. package/src/discovery/LibraryDiscovery.test.ts +0 -329
  442. package/src/discovery/LibraryDiscovery.ts +0 -386
  443. package/src/discovery/types.ts +0 -453
  444. package/src/events/EventsCanvasValidator.test.ts +0 -191
  445. package/src/events/EventsCanvasValidator.ts +0 -428
  446. package/src/events/NamespacePathIndex.test.ts +0 -97
  447. package/src/events/NamespacePathIndex.ts +0 -100
  448. package/src/events/OtelEventPathsValidator.test.ts +0 -243
  449. package/src/events/OtelEventPathsValidator.ts +0 -191
  450. package/src/events/ScopeEventsValidator.test.ts +0 -173
  451. package/src/events/ScopeEventsValidator.ts +0 -158
  452. package/src/events/index.ts +0 -27
  453. package/src/events/path-helpers.ts +0 -53
  454. package/src/execution/ExecutionLoader.test.ts +0 -378
  455. package/src/execution/ExecutionLoader.ts +0 -331
  456. package/src/execution/ExecutionValidator.test.ts +0 -503
  457. package/src/execution/ExecutionValidator.ts +0 -617
  458. package/src/generated/graph-converter-execution.types.ts +0 -193
  459. package/src/helpers/GraphInstrumentationHelper.test.ts +0 -364
  460. package/src/helpers/GraphInstrumentationHelper.ts +0 -323
  461. package/src/matchers/SpanMatcher.test.ts +0 -1105
  462. package/src/matchers/SpanMatcher.ts +0 -381
  463. package/src/orchestration/TraceOrchestrator.ts +0 -560
  464. package/src/orchestration/__tests__/TraceOrchestrator.test.ts +0 -1098
  465. package/src/parsers/OtlpTraceParser.ts +0 -401
  466. package/src/parsers/__tests__/OtlpTraceParser.test.ts +0 -197
  467. package/src/registry/CompositeRegistry.ts +0 -140
  468. package/src/registry/EventRegistry.test.ts +0 -387
  469. package/src/registry/EventRegistry.ts +0 -191
  470. package/src/registry/LocalRegistry.ts +0 -416
  471. package/src/registry/RemoteRegistry.ts +0 -499
  472. package/src/registry/VersionRegistry.test.ts +0 -223
  473. package/src/registry/VersionRegistry.ts +0 -121
  474. package/src/rules/config.test.ts +0 -277
  475. package/src/rules/config.ts +0 -450
  476. package/src/rules/engine.test.ts +0 -331
  477. package/src/rules/engine.ts +0 -448
  478. package/src/rules/implementations/connection-type-references.ts +0 -117
  479. package/src/rules/implementations/dead-end-states.ts +0 -101
  480. package/src/rules/implementations/index.ts +0 -66
  481. package/src/rules/implementations/minimum-node-sources.ts +0 -84
  482. package/src/rules/implementations/no-unknown-fields.ts +0 -372
  483. package/src/rules/implementations/orphaned-edge-types.ts +0 -55
  484. package/src/rules/implementations/orphaned-node-types.ts +0 -58
  485. package/src/rules/implementations/required-metadata.ts +0 -52
  486. package/src/rules/implementations/state-transition-references.ts +0 -155
  487. package/src/rules/implementations/unreachable-states.ts +0 -94
  488. package/src/rules/implementations/valid-action-patterns.ts +0 -140
  489. package/src/rules/implementations/valid-color-format.ts +0 -152
  490. package/src/rules/implementations/valid-edge-types.ts +0 -273
  491. package/src/rules/implementations/valid-node-types.ts +0 -200
  492. package/src/rules/index.ts +0 -92
  493. package/src/rules/types.ts +0 -426
  494. package/src/scopes/ScopePathIndex.test.ts +0 -94
  495. package/src/scopes/ScopePathIndex.ts +0 -89
  496. package/src/scopes/ScopesCanvasValidator.test.ts +0 -127
  497. package/src/scopes/ScopesCanvasValidator.ts +0 -305
  498. package/src/scopes/__tests__/utils.test.ts +0 -383
  499. package/src/scopes/index.ts +0 -42
  500. package/src/scopes/utils.ts +0 -182
  501. package/src/scopes/validateScopeNamespaceNesting.test.ts +0 -127
  502. package/src/scopes/validateScopeNamespaceNesting.ts +0 -88
  503. package/src/spans/index.ts +0 -24
  504. package/src/spans/utils.ts +0 -249
  505. package/src/storyboard/builder.ts +0 -308
  506. package/src/storyboard/index.ts +0 -26
  507. package/src/storyboard/types.ts +0 -117
  508. package/src/telemetry/coverage.ts +0 -480
  509. package/src/telemetry/event-validator.ts +0 -312
  510. package/src/types/audit.ts +0 -314
  511. package/src/types/auxiliary.ts +0 -63
  512. package/src/types/canvas-scope.ts +0 -190
  513. package/src/types/canvas.test.ts +0 -199
  514. package/src/types/canvas.ts +0 -1395
  515. package/src/types/dashboard.ts +0 -257
  516. package/src/types/library.ts +0 -283
  517. package/src/types/otel.test.ts +0 -219
  518. package/src/types/otel.ts +0 -620
  519. package/src/types/path-based-config.ts +0 -285
  520. package/src/types/registered-trace.ts +0 -432
  521. package/src/types/resource-match.ts +0 -263
  522. package/src/types/version-registry.ts +0 -150
  523. package/src/utils/CanvasConverter.ts +0 -670
  524. package/src/utils/GraphConverter.test.ts +0 -322
  525. package/src/utils/GraphConverter.ts +0 -84
  526. package/src/utils/PathMatcher.test.ts +0 -139
  527. package/src/utils/PathMatcher.ts +0 -185
  528. package/src/utils/TraceToCanvas.test.ts +0 -310
  529. package/src/utils/TraceToCanvas.ts +0 -510
  530. package/src/utils/YamlParser.ts +0 -77
  531. package/src/utils/registeredTraceHelpers.ts +0 -251
  532. package/src/utils/traceAggregation.test.ts +0 -385
  533. package/src/utils/traceAggregation.ts +0 -173
  534. package/src/validation/OtelCanvasValidator.ts +0 -86
  535. package/src/validation/index.ts +0 -17
  536. package/src/validation/libraryValidation.ts +0 -206
  537. package/src/workflow/README.md +0 -408
  538. package/src/workflow/__tests__/edge-derivation.test.ts +0 -449
  539. package/src/workflow/__tests__/edge-validation.test.ts +0 -417
  540. package/src/workflow/__tests__/scenario-matcher.test.ts +0 -225
  541. package/src/workflow/__tests__/template-parser.test.ts +0 -276
  542. package/src/workflow/__tests__/template-renderer.test.ts +0 -509
  543. package/src/workflow/__tests__/types.test.ts +0 -187
  544. package/src/workflow/__tests__/validator.test.ts +0 -3225
  545. package/src/workflow/edge-derivation.ts +0 -265
  546. package/src/workflow/edge-validation.ts +0 -503
  547. package/src/workflow/example.ts +0 -330
  548. package/src/workflow/index.ts +0 -86
  549. package/src/workflow/scenario-matcher.ts +0 -253
  550. package/src/workflow/template-parser.ts +0 -350
  551. package/src/workflow/template-renderer.ts +0 -453
  552. package/src/workflow/types.ts +0 -511
  553. package/src/workflow/validator.ts +0 -2737
@@ -1,1395 +0,0 @@
1
- /**
2
- * JSON Canvas Extended Types
3
- *
4
- * This module defines types that extend the JSON Canvas spec (https://jsoncanvas.org/spec/1.0/)
5
- * with Principal View Framework extensions.
6
- *
7
- * Design principle: Extensions use top-level fields where possible (name, markdown, edgeType)
8
- * for simplicity. Node-level extensions use a `pv` field for complex metadata.
9
- *
10
- * DEPRECATION: Canvas-level `pv` field and edge-level `pv` field are deprecated.
11
- * Use top-level `name`, `markdown` fields on canvas, and `edgeType` field on edges.
12
- *
13
- * This allows:
14
- * 1. Authoring layouts visually in Obsidian or other canvas tools
15
- * 2. Rendering with rich animations and states in React Flow
16
- * 3. Round-trip editing without data loss
17
- */
18
-
19
- import type { CanvasScope, CanvasAuditConfig } from './canvas-scope';
20
- import type { ResourceMatch } from './resource-match';
21
- import type { JsonValue } from './index';
22
-
23
- // ============================================================================
24
- // JSON Canvas Spec Types (1.0)
25
- // https://jsoncanvas.org/spec/1.0/
26
- // ============================================================================
27
-
28
- /**
29
- * Canvas color - either a hex string or preset number (1-6)
30
- * Presets: 1=red, 2=orange, 3=yellow, 4=green, 5=cyan, 6=purple
31
- *
32
- * Note: Obsidian Canvas saves numeric presets as strings ("1"-"6"),
33
- * so we accept both number and string formats.
34
- */
35
- export type CanvasColor = string | 1 | 2 | 3 | 4 | 5 | 6;
36
-
37
- /**
38
- * Side of a node for edge connections
39
- */
40
- export type CanvasSide = 'top' | 'right' | 'bottom' | 'left';
41
-
42
- /**
43
- * Edge endpoint shape
44
- */
45
- export type CanvasEndpoint = 'none' | 'arrow';
46
-
47
- /**
48
- * Background style for group nodes
49
- */
50
- export type CanvasBackgroundStyle = 'cover' | 'ratio' | 'repeat';
51
-
52
- /**
53
- * Base node properties (common to all node types)
54
- */
55
- export interface CanvasNodeBase {
56
- /** Unique identifier */
57
- id: string;
58
- /** X position in pixels */
59
- x: number;
60
- /** Y position in pixels */
61
- y: number;
62
- /** Width in pixels */
63
- width: number;
64
- /** Height in pixels */
65
- height: number;
66
- /** Optional color */
67
- color?: CanvasColor;
68
- }
69
-
70
- /**
71
- * Text node - stores plain text or markdown
72
- */
73
- export interface CanvasTextNode extends CanvasNodeBase {
74
- type: 'text';
75
- /** Markdown-formatted text content */
76
- text: string;
77
- }
78
-
79
- /**
80
- * File node - references an external file
81
- */
82
- export interface CanvasFileNode extends CanvasNodeBase {
83
- type: 'file';
84
- /** Path to the file */
85
- file: string;
86
- /** Optional subpath (heading or block link) */
87
- subpath?: string;
88
- }
89
-
90
- /**
91
- * Link node - references a URL
92
- */
93
- export interface CanvasLinkNode extends CanvasNodeBase {
94
- type: 'link';
95
- /** URL to link to */
96
- url: string;
97
- }
98
-
99
- /**
100
- * Group node - visual container for other nodes
101
- */
102
- export interface CanvasGroupNode extends CanvasNodeBase {
103
- type: 'group';
104
- /** Optional label for the group */
105
- label?: string;
106
- /** Optional background image path */
107
- background?: string;
108
- /** Background image style */
109
- backgroundStyle?: CanvasBackgroundStyle;
110
- }
111
-
112
- /**
113
- * Union of all standard canvas node types
114
- */
115
- export type CanvasNode = CanvasTextNode | CanvasFileNode | CanvasLinkNode | CanvasGroupNode;
116
-
117
- /**
118
- * Canvas edge connecting two nodes
119
- */
120
- export interface CanvasEdge {
121
- /** Unique identifier */
122
- id: string;
123
- /** Source node ID */
124
- fromNode: string;
125
- /** Target node ID */
126
- toNode: string;
127
- /** Side of source node */
128
- fromSide?: CanvasSide;
129
- /** Side of target node */
130
- toSide?: CanvasSide;
131
- /** Endpoint shape at source (default: 'none') */
132
- fromEnd?: CanvasEndpoint;
133
- /** Endpoint shape at target (default: 'arrow') */
134
- toEnd?: CanvasEndpoint;
135
- /** Edge color */
136
- color?: CanvasColor;
137
- /** Edge label */
138
- label?: string;
139
- }
140
-
141
- /**
142
- * Standard JSON Canvas document
143
- */
144
- export interface Canvas {
145
- /** Array of nodes (ordered by z-index ascending) */
146
- nodes?: CanvasNode[];
147
- /** Array of edges */
148
- edges?: CanvasEdge[];
149
- }
150
-
151
- // ============================================================================
152
- // Principal View Extensions
153
- // ============================================================================
154
-
155
- /**
156
- * Animation types for edges
157
- */
158
- export type PVAnimationType = 'flow' | 'pulse' | 'particle' | 'glow';
159
-
160
- /**
161
- * Animation direction
162
- */
163
- export type PVAnimationDirection = 'forward' | 'backward' | 'bidirectional';
164
-
165
- /**
166
- * Node shape for rendering
167
- */
168
- export type PVNodeShape = 'circle' | 'rectangle' | 'hexagon' | 'diamond' | 'custom';
169
-
170
- /**
171
- * Edge line style
172
- */
173
- export type PVEdgeStyle = 'solid' | 'dashed' | 'dotted' | 'animated';
174
-
175
- /**
176
- * Log level for path-based association
177
- */
178
- export type PVLogLevel = 'debug' | 'info' | 'warn' | 'error';
179
-
180
- // PVActionPattern removed - see docs/LEGACY_PATH_BASED_PATTERNS.md
181
- // Superseded by OTEL event schemas (pv.events)
182
-
183
- /**
184
- * State definition for a node
185
- */
186
- export interface PVNodeState {
187
- /** Color when in this state */
188
- color?: string;
189
- /** Icon when in this state */
190
- icon?: string;
191
- /** Display label */
192
- label?: string;
193
- }
194
-
195
- // PVEdgeActivation removed - see docs/LEGACY_PATH_BASED_PATTERNS.md
196
- // Edge animations now triggered by OTEL events, not action patterns
197
-
198
- /**
199
- * OTEL node classification
200
- *
201
- * @deprecated Use `pv.nodeType` instead. Will be removed in a future version.
202
- * For example, use `nodeType: "scope"` instead of `otel.kind: "type"`.
203
- */
204
- export type PVOtelKind = 'type' | 'service' | 'instance';
205
-
206
- /**
207
- * OTEL category for type nodes
208
- *
209
- * @deprecated Use `pv.nodeType` instead. Will be removed in a future version.
210
- * For example, use `nodeType: "span-convention"` instead of `otel.category: "span"`.
211
- */
212
- export type PVOtelCategory =
213
- | 'log'
214
- | 'resource'
215
- | 'span'
216
- | 'scope'
217
- | 'match'
218
- | 'audit'
219
- | 'config'
220
- | 'router'
221
- | 'collector';
222
-
223
- /**
224
- * OTel SpanKind values for span conventions
225
- *
226
- * Describes the relationship between a span and its remote parent/children.
227
- * Standard OTel concept - these values are fixed by the OTel spec.
228
- *
229
- * @see https://opentelemetry.io/docs/specs/otel/trace/api/#spankind
230
- */
231
- export type PVOtelSpanKind = 'UNSPECIFIED' | 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
232
-
233
- import type { OtelSpanKind } from './otel';
234
-
235
- /**
236
- * OTEL span matching criteria
237
- *
238
- * Defines rules for matching incoming OTEL spans to this canvas node.
239
- * Multiple criteria are combined with AND logic (all must match).
240
- */
241
- export interface PVOtelSpanMatch {
242
- /**
243
- * Match span name
244
- *
245
- * Supports:
246
- * - Exact string: "validateUser"
247
- * - Array of options: ["GET /api/users", "POST /api/users"]
248
- * - Glob patterns: "GET /api/*", "*.checkout"
249
- *
250
- * @example "validateUser"
251
- * @example ["GET /api/users", "POST /api/users"]
252
- * @example "*.checkout"
253
- */
254
- name?: string | string[];
255
-
256
- /**
257
- * Match span kind
258
- *
259
- * @example "SPAN_KIND_SERVER"
260
- * @example "SPAN_KIND_CLIENT"
261
- */
262
- kind?: OtelSpanKind | OtelSpanKind[];
263
-
264
- /**
265
- * Match span attributes
266
- *
267
- * All specified attributes must match (AND logic).
268
- * Supports exact values and wildcards.
269
- *
270
- * @example
271
- * {
272
- * "http.route": "/api/checkout",
273
- * "http.method": "POST"
274
- * }
275
- *
276
- * @example
277
- * {
278
- * "db.system": "postgresql",
279
- * "db.operation": "*" // Any operation
280
- * }
281
- */
282
- attributes?: Record<string, string | string[]>;
283
-
284
- /**
285
- * Match span events
286
- *
287
- * If specified, span must contain at least one event matching these criteria.
288
- *
289
- * @example
290
- * {
291
- * name: "exception",
292
- * attributes: { "exception.type": "ValidationError" }
293
- * }
294
- */
295
- event?: {
296
- name?: string | string[];
297
- attributes?: Record<string, string | string[]>;
298
- };
299
- }
300
-
301
- /**
302
- * OTEL resource matching criteria
303
- *
304
- * Matches against OTEL resource attributes (service.name, deployment.environment, etc.).
305
- * Multiple attributes are combined with AND logic.
306
- */
307
- export interface PVOtelResourceMatch {
308
- /**
309
- * Resource attribute patterns to match
310
- *
311
- * Supports:
312
- * - Exact match: { "service.name": "checkout-api" }
313
- * - Wildcard: { "service.name": "*-api" }
314
- * - Array of options: { "service.name": ["api-1", "api-2"] }
315
- *
316
- * @example
317
- * {
318
- * "service.name": "checkout-service",
319
- * "deployment.environment": "production"
320
- * }
321
- */
322
- [attributeKey: string]: string | string[];
323
- }
324
-
325
- /**
326
- * OTEL-specific node extension
327
- *
328
- * Used to mark nodes as representing OTEL concepts in architectural diagrams
329
- * and to define runtime span matching criteria.
330
- */
331
- export interface PVOtelExtension {
332
- /**
333
- * Kind of OTEL node
334
- * - `type`: Represents a TypeScript type/interface (e.g., OtelLog, ResourceMatch)
335
- * - `service`: Represents a runtime service (e.g., LogRouter, AuditCollector)
336
- * - `instance`: Represents an actual runtime instance (e.g., a specific pod)
337
- *
338
- * @deprecated Use `pv.nodeType` instead. Will be removed in a future version.
339
- */
340
- kind?: PVOtelKind;
341
-
342
- /**
343
- * Category within OTEL domain
344
- *
345
- * @deprecated Use `pv.nodeType` instead. Will be removed in a future version.
346
- */
347
- category?: PVOtelCategory;
348
-
349
- /**
350
- * Span pattern for span convention nodes
351
- *
352
- * Defines the naming pattern for spans that match this convention.
353
- * Supports wildcards (e.g., "validate.*", "task.create").
354
- *
355
- * Used in architecture.spans.canvas to define the vocabulary of operations.
356
- *
357
- * @example "validate.*"
358
- * @example "task.create"
359
- * @example "http.request"
360
- */
361
- spanPattern?: string;
362
-
363
- /**
364
- * OTel SpanKind for span convention nodes
365
- *
366
- * Specifies what kind of span this convention represents.
367
- * Implementers should use this when creating spans.
368
- *
369
- * @example "SERVER" - for entry points handling incoming requests
370
- * @example "INTERNAL" - for internal operations
371
- * @example "CLIENT" - for outgoing calls to external services
372
- */
373
- spanKind?: PVOtelSpanKind;
374
-
375
- /**
376
- * Resource matching criteria
377
- *
378
- * When specified, this node will highlight when spans are received
379
- * from resources with matching attributes.
380
- */
381
- resourceMatch?: PVOtelResourceMatch;
382
-
383
- /**
384
- * Span matching criteria
385
- *
386
- * When specified, this node will highlight when spans matching
387
- * these criteria are received.
388
- */
389
- spanMatch?: PVOtelSpanMatch;
390
-
391
- /**
392
- * Files where this event is instrumented
393
- *
394
- * Specifies the exact file paths where this OTEL event should be emitted.
395
- * Used by coverage tools to validate that events are properly instrumented.
396
- *
397
- * @example ["src/app/api/auth/callback/route.ts"]
398
- */
399
- files?: string[];
400
-
401
- /**
402
- * Instrumentation scope that emits this event
403
- *
404
- * Identifies which tracer/instrumentation library creates this span or event.
405
- * Maps to `getTracer('scope-name')` in the instrumented code.
406
- *
407
- * Required when the parent node's status is 'approved' or 'implemented'.
408
- * Should match an entry in the library.yaml `owned-scopes` list.
409
- *
410
- * @example "terminal-activity"
411
- * @example "auth"
412
- * @example "quality-panel"
413
- */
414
- scope?: string;
415
-
416
- /** Allow additional properties */
417
- [key: string]: JsonValue | PVOtelResourceMatch | PVOtelSpanMatch | string[] | undefined;
418
- }
419
-
420
- /**
421
- * Event field schema definition
422
- */
423
- export interface PVEventFieldSchema {
424
- /** Field data type */
425
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
426
- /** Whether this field is required */
427
- required?: boolean;
428
- /** Description of what this field represents */
429
- description?: string;
430
- /**
431
- * Whether this attribute is intended for template display.
432
- * Set to false for telemetry/analytics-only attributes.
433
- * Defaults to true.
434
- */
435
- display?: boolean;
436
- }
437
-
438
- /**
439
- * Event schema definition for a specific event type
440
- */
441
- export interface PVEventSchema {
442
- /** Event name (e.g., 'conversion.started', 'user.login') */
443
- name: string;
444
- /** Description of what this event represents */
445
- description: string;
446
- /** Expected attributes/fields for this event */
447
- attributes: Record<string, PVEventFieldSchema>;
448
- }
449
-
450
- /**
451
- * Node implementation status
452
- *
453
- * Tracks the lifecycle of a node from design to implementation.
454
- */
455
- export type PVNodeStatus = 'draft' | 'approved' | 'implemented';
456
-
457
- /**
458
- * Direction of boundary interaction
459
- */
460
- export type PVBoundaryDirection = 'outbound' | 'inbound';
461
-
462
- /**
463
- * Node query criteria for boundary resolution
464
- *
465
- * Defines what the corresponding node looks like in the external system's traces.
466
- * Used for cross-repo resolution and live trace correlation.
467
- */
468
- export interface PVBoundaryNodeQuery {
469
- /** Event name to match in external system */
470
- 'pv.event.name'?: string;
471
- /** Event namespace to match */
472
- 'pv.event.namespace'?: string;
473
- /** Additional attribute matches */
474
- [key: string]: string | undefined;
475
- }
476
-
477
- /**
478
- * Boundary extension for nodes representing external system interfaces
479
- *
480
- * Boundaries define interaction points where control crosses system edges.
481
- * The `node` field specifies what the corresponding node looks like in the
482
- * external system, enabling cross-repo resolution and trace correlation.
483
- *
484
- * @example Outbound host callback
485
- * ```typescript
486
- * boundary: {
487
- * direction: 'outbound',
488
- * node: {
489
- * 'pv.event.name': 'host.batch-layout-initialized',
490
- * 'pv.event.namespace': 'collection-host'
491
- * }
492
- * }
493
- * ```
494
- *
495
- * @example Inbound webhook
496
- * ```typescript
497
- * boundary: {
498
- * direction: 'inbound',
499
- * node: {
500
- * 'pv.event.name': 'webhook.repository-created',
501
- * 'pv.event.namespace': 'github'
502
- * }
503
- * }
504
- * ```
505
- */
506
- export interface PVBoundaryExtension {
507
- /**
508
- * Direction of the boundary interaction
509
- *
510
- * - `outbound`: This system calls out to external system
511
- * - `inbound`: External system calls into this system
512
- */
513
- direction: PVBoundaryDirection;
514
-
515
- /**
516
- * Node query for resolving the corresponding node in external system
517
- *
518
- * Specifies the expected shape of the matching node for registry lookup
519
- * and live trace correlation.
520
- */
521
- node: PVBoundaryNodeQuery;
522
- }
523
-
524
- /**
525
- * Principal View node extensions
526
- */
527
- export interface PVNodeExtension {
528
- /** Custom node type identifier */
529
- nodeType: string;
530
-
531
- /**
532
- * Display name for this node
533
- *
534
- * Preferred over parsing the `text` field. Use this for the node label.
535
- */
536
- name?: string;
537
-
538
- /**
539
- * Description of what this node represents
540
- *
541
- * Shown in tooltips or detail panels.
542
- */
543
- description?: string;
544
-
545
- /**
546
- * Implementation status of this node
547
- *
548
- * - `draft`: Design/proposal phase (requires pv.otel.files if known, otherwise pv.references)
549
- * - `approved`: Design finalized, ready for implementation (requires pv.otel.files)
550
- * - `implemented`: Code exists with instrumentation (requires pv.otel.files and events in code)
551
- *
552
- * Used by coverage tools to determine validation requirements and coverage tracking.
553
- */
554
- status?: PVNodeStatus;
555
-
556
- /**
557
- * OTEL-specific metadata
558
- *
559
- * Used when this node represents an OTEL concept (type, service, or instance).
560
- */
561
- otel?: PVOtelExtension;
562
-
563
- /** Visual shape */
564
- shape?: PVNodeShape;
565
- /** Icon identifier (Lucide icons) */
566
- icon?: string;
567
- /** Fill color (hex string) - takes priority over node.color */
568
- fill?: string;
569
- /** Stroke/border color (hex string) */
570
- stroke?: string;
571
- /** State definitions */
572
- states?: Record<string, PVNodeState>;
573
-
574
- /**
575
- * Origin of the code this node represents
576
- *
577
- * - `internal` (default): Code exists in this repository, file paths in `pv.otel.files` will be validated
578
- * - `external`: Code exists in external packages/libraries, file existence validation is skipped
579
- *
580
- * Use `external` for:
581
- * - npm dependencies (e.g., `@logfire/pydantic-ai`)
582
- * - Auto-instrumented events from observability libraries
583
- * - Third-party APIs or services
584
- * - Cross-repository references
585
- *
586
- * When `origin: "external"`, the `references` field is required to document
587
- * what external package or service this node represents.
588
- *
589
- * @example "external"
590
- */
591
- origin?: 'internal' | 'external';
592
-
593
- /**
594
- * Auxiliary references and related documentation
595
- *
596
- * Use for documenting related packages, external dependencies, or supplementary notes.
597
- * Required when `origin: "external"` to document what external package/service this represents.
598
- *
599
- * @example ["@logfire/pydantic-ai"] // external package reference
600
- * @example ["https://docs.pydantic.dev/logfire/"] // documentation link
601
- */
602
- references?: string[];
603
-
604
- /**
605
- * @deprecated Use `references` instead. Will be removed in a future version.
606
- */
607
- sources?: string[];
608
-
609
- /**
610
- * Resource-based matching for OTEL logs
611
- *
612
- * When specified, logs with matching OTEL resource attributes
613
- * will be routed to this node. Takes priority over sources.
614
- *
615
- * @example
616
- * ```typescript
617
- * resourceMatch: {
618
- * 'service.name': 'checkout-api',
619
- * 'deployment.environment': 'production'
620
- * }
621
- * ```
622
- */
623
- resourceMatch?: ResourceMatch;
624
-
625
- // actions removed - see docs/LEGACY_PATH_BASED_PATTERNS.md
626
- // Use pv.event for structured event schema instead
627
-
628
- /**
629
- * Event schema for type-safe telemetry validation (inline definition)
630
- *
631
- * Defines the single event that this node emits during execution.
632
- * Used for compile-time and runtime validation of telemetry events.
633
- * Each node should emit exactly one event type.
634
- *
635
- * Use this for one-off events specific to this node.
636
- * For reusable events, use `eventRef` to reference library event schemas.
637
- *
638
- * @example
639
- * ```typescript
640
- * event: {
641
- * name: 'conversion.started',
642
- * description: 'Graph conversion begins',
643
- * attributes: {
644
- * 'config.nodeTypes': { type: 'number', required: true },
645
- * 'config.edgeTypes': { type: 'number', required: true }
646
- * }
647
- * }
648
- * ```
649
- */
650
- event?: PVEventSchema;
651
-
652
- /**
653
- * Reference to a library event schema
654
- *
655
- * References an event schema defined in library.yaml's `eventSchemas` section.
656
- * This promotes reusability and consistency across canvases.
657
- *
658
- * NOTE: A node cannot have both `event` and `eventRef` - choose one.
659
- * Validators will flag nodes that have both as an error.
660
- *
661
- * @example
662
- * ```typescript
663
- * eventRef: 'auth.callback.started'
664
- * ```
665
- */
666
- eventRef?: string;
667
-
668
- /** Data schema for typed fields */
669
- dataSchema?: Record<
670
- string,
671
- {
672
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
673
- required?: boolean;
674
- displayInLabel?: boolean;
675
- /**
676
- * Human-readable description of what this field represents.
677
- * Required in .otel.canvas files (enforced by validator).
678
- */
679
- description?: string;
680
- /**
681
- * Example value for UI previews, mock traces, and testing.
682
- * Required in .otel.canvas files (enforced by validator).
683
- */
684
- placeholder?: unknown;
685
- }
686
- >;
687
- /** Layout hints */
688
- layout?: {
689
- layer?: number;
690
- cluster?: string;
691
- };
692
-
693
- /**
694
- * Boundary extension for nodes representing external system interfaces
695
- *
696
- * When `nodeType` is `"boundary"`, this field defines the boundary details.
697
- * Boundary nodes represent interface points where control crosses system edges.
698
- * The `node` field specifies what the corresponding node looks like in the
699
- * external system, enabling cross-repo resolution and trace correlation.
700
- *
701
- * When a node has `nodeType: "boundary"`, it does NOT require `event` or `eventRef`
702
- * fields since the boundary is external and doesn't emit telemetry from our code.
703
- *
704
- * @example
705
- * ```typescript
706
- * {
707
- * nodeType: "boundary",
708
- * boundary: {
709
- * direction: "outbound",
710
- * node: {
711
- * "pv.event.name": "host.batch-layout-initialized",
712
- * "pv.event.namespace": "collection-host"
713
- * }
714
- * }
715
- * }
716
- * ```
717
- */
718
- boundary?: PVBoundaryExtension;
719
- }
720
-
721
- /**
722
- * Principal View edge extensions
723
- */
724
- export interface PVEdgeExtension {
725
- /** Custom edge type identifier */
726
- edgeType: string;
727
- /** Line style */
728
- style?: PVEdgeStyle;
729
- /** Line width in pixels */
730
- width?: number;
731
- /** Default animation */
732
- animation?: {
733
- type: PVAnimationType;
734
- duration?: number;
735
- color?: string;
736
- };
737
- // activatedBy removed - see docs/LEGACY_PATH_BASED_PATTERNS.md
738
- }
739
-
740
- /**
741
- * Path-based configuration options
742
- */
743
- export interface PVPathConfig {
744
- /** Project root for path normalization */
745
- projectRoot?: string;
746
- /** Enable source capture from stack traces */
747
- captureSource?: boolean;
748
- /** Enable action pattern matching */
749
- enableActionPatterns?: boolean;
750
- /** Minimum log level to process */
751
- logLevel?: PVLogLevel;
752
- /** Ignore logs without source info */
753
- ignoreUnsourced?: boolean;
754
- }
755
-
756
- /**
757
- * Display configuration
758
- */
759
- export interface PVDisplayConfig {
760
- /** Layout algorithm (manual uses canvas positions) */
761
- layout?: 'hierarchical' | 'force-directed' | 'circular' | 'manual';
762
- /** Color theme */
763
- theme?: {
764
- primary?: string;
765
- success?: string;
766
- warning?: string;
767
- danger?: string;
768
- info?: string;
769
- };
770
- /** Animation settings */
771
- animations?: {
772
- enabled?: boolean;
773
- speed?: number;
774
- };
775
- }
776
-
777
- /**
778
- * Node type definition (stored at canvas level in pv.nodeTypes)
779
- */
780
- export interface PVNodeTypeDefinition {
781
- /** Display label */
782
- label?: string;
783
- /** Description of this node type (required) */
784
- description: string;
785
- /** Fill color (hex string) */
786
- color?: string;
787
- /** Icon identifier (Lucide icons) */
788
- icon?: string;
789
- /** Visual shape */
790
- shape?: PVNodeShape;
791
- }
792
-
793
- /**
794
- * Edge type definition (stored at canvas level)
795
- */
796
- export interface PVEdgeTypeDefinition {
797
- /** Display label */
798
- label?: string;
799
- /** Line style */
800
- style?: PVEdgeStyle;
801
- /** Line color */
802
- color?: string;
803
- /** Line width */
804
- width?: number;
805
- /** Whether edge is directed */
806
- directed?: boolean;
807
- /** Default animation */
808
- animation?: {
809
- type: PVAnimationType;
810
- duration?: number;
811
- color?: string;
812
- };
813
- /** Label configuration (for dynamic labels) */
814
- labelConfig?: {
815
- field?: string;
816
- position?: 'start' | 'middle' | 'end';
817
- };
818
- // activatedBy removed - see docs/LEGACY_PATH_BASED_PATTERNS.md
819
- }
820
-
821
- /**
822
- * Canvas-level Principal View extensions
823
- *
824
- * @deprecated The `pv` field is fully deprecated. All fields have been moved to top-level.
825
- * This interface will be removed in a future version.
826
- *
827
- * Migration - move all fields to top-level:
828
- * - `pv.name` → `name`
829
- * - `pv.markdown` → `markdown`
830
- * - `pv.description` → `description`
831
- * - `pv.nodeTypes` → `nodeTypes`
832
- * - `pv.edgeTypes` → `edgeTypes`
833
- * - `pv.display` → `display`
834
- * - `pv.pathConfig` → `pathConfig`
835
- * - `pv.scope` → `scope`
836
- * - `pv.audit` → `audit`
837
- * - `pv.version` → removed (not used)
838
- */
839
- export interface PVCanvasExtension {
840
- /** @deprecated Use top-level `name` field instead */
841
- name?: string;
842
- /** @deprecated Use top-level `description` field instead */
843
- description?: string;
844
- /** @deprecated Use top-level `markdown` field instead */
845
- markdown?: string;
846
- /** @deprecated Use top-level `nodeTypes` field instead */
847
- nodeTypes?: Record<string, PVNodeTypeDefinition>;
848
- /** @deprecated Use top-level `edgeTypes` field instead */
849
- edgeTypes?: Record<string, PVEdgeTypeDefinition>;
850
- /** @deprecated Use top-level `pathConfig` field instead */
851
- pathConfig?: PVPathConfig;
852
- /** @deprecated Use top-level `display` field instead */
853
- display?: PVDisplayConfig;
854
- /** @deprecated Use top-level `scope` field instead */
855
- scope?: CanvasScope;
856
- /** @deprecated Use top-level `audit` field instead */
857
- audit?: CanvasAuditConfig;
858
- }
859
-
860
- // ============================================================================
861
- // Extended Canvas Types (Canvas + PV Extensions)
862
- // ============================================================================
863
-
864
- /**
865
- * Extended text node with PV extensions
866
- */
867
- export interface ExtendedCanvasTextNode extends CanvasTextNode {
868
- pv?: PVNodeExtension;
869
- }
870
-
871
- /**
872
- * Extended file node with PV extensions
873
- */
874
- export interface ExtendedCanvasFileNode extends CanvasFileNode {
875
- pv?: PVNodeExtension;
876
- }
877
-
878
- /**
879
- * Extended link node with PV extensions
880
- */
881
- export interface ExtendedCanvasLinkNode extends CanvasLinkNode {
882
- pv?: PVNodeExtension;
883
- }
884
-
885
- /**
886
- * Extended group node with PV extensions
887
- */
888
- export interface ExtendedCanvasGroupNode extends CanvasGroupNode {
889
- pv?: PVNodeExtension;
890
- }
891
-
892
- // ============================================================================
893
- // OTEL Node Types (Custom extensions to JSON Canvas)
894
- // See: docs/NODE_TYPE_MIGRATION.md
895
- // ============================================================================
896
-
897
- /**
898
- * Base interface for all OTEL node types
899
- *
900
- * These are custom node types that extend JSON Canvas for OpenTelemetry concepts.
901
- * Standard canvas tools will not recognize these types.
902
- */
903
- export interface OtelNodeBase extends CanvasNodeBase {
904
- /** Display label shown on canvas node (required) */
905
- label: string;
906
- /** Icon identifier (Lucide icons) */
907
- icon?: string;
908
- /** Fill color (hex string) */
909
- fill?: string;
910
- /** Stroke/border color (hex string) */
911
- stroke?: string;
912
- /** Visual shape */
913
- shape?: PVNodeShape;
914
- }
915
-
916
- /**
917
- * Shared OTEL instrumentation metadata
918
- *
919
- * Common fields for tracking implementation status and code location.
920
- */
921
- export interface OtelMetadata {
922
- /** Implementation status */
923
- status?: PVNodeStatus;
924
- /** Instrumentation scope (maps to getTracer('scope-name')) */
925
- scope?: string;
926
- /** Files where this is instrumented */
927
- files?: string[];
928
- /**
929
- * Origin of the code
930
- * - 'internal': Code exists in this repository (default)
931
- * - 'external': Code exists in external packages/libraries
932
- */
933
- origin?: 'internal' | 'external';
934
- /** References/documentation for external code */
935
- references?: string[];
936
- }
937
-
938
- /**
939
- * OTEL Event Node
940
- *
941
- * Represents a telemetry event emitted during workflow execution.
942
- * The event schema defines the structure of the telemetry data.
943
- */
944
- /**
945
- * OTEL Event Node - represents a telemetry event
946
- *
947
- * @remarks
948
- * IMPORTANT: Event nodes should NOT use fill or color fields.
949
- * Event nodes use scope-based coloring exclusively for consistency.
950
- * Set the scope in otel.scope and define scope colors in library.yaml.
951
- * Using fill or color fields will cause validation errors.
952
- */
953
- export interface OtelEventNode extends OtelNodeBase {
954
- type: 'otel-event';
955
- /** Inline event schema definition */
956
- event?: PVEventSchema;
957
- /** Reference to a library event schema */
958
- eventRef?: string;
959
- /** Data schema for typed fields in templates */
960
- dataSchema?: Record<
961
- string,
962
- {
963
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
964
- required?: boolean;
965
- description?: string;
966
- placeholder?: unknown;
967
- }
968
- >;
969
- /** OTEL instrumentation metadata */
970
- otel?: OtelMetadata;
971
- }
972
-
973
- /**
974
- * Workflow chip displayed on span convention nodes
975
- * Shows which workflow.json scenarios reference this span
976
- */
977
- export interface WorkflowChip {
978
- /** Workflow scenario ID for selection/filtering */
979
- id: string;
980
- /** Display label (may be truncated) */
981
- label: string;
982
- /** Optional color for the chip */
983
- color?: string;
984
- }
985
-
986
- /**
987
- * OTEL Span Convention Node
988
- *
989
- * Defines a span naming convention/pattern for consistent instrumentation.
990
- */
991
- export interface OtelSpanConventionNode extends OtelNodeBase {
992
- type: 'otel-span-convention';
993
- /** Short description of this span convention */
994
- description?: string;
995
- /** OTEL metadata including span-specific fields */
996
- otel: OtelMetadata & {
997
- /** Span naming pattern (e.g., "validate.*", "http.request") */
998
- spanPattern: string;
999
- /** OTel SpanKind */
1000
- spanKind?: PVOtelSpanKind;
1001
- /** Span matching criteria for runtime correlation */
1002
- spanMatch?: PVOtelSpanMatch;
1003
- };
1004
- /** Workflow chips showing which workflow.json scenarios use this span */
1005
- workflowChips?: WorkflowChip[];
1006
- }
1007
-
1008
- /**
1009
- * OTEL Scope Node
1010
- *
1011
- * Represents an instrumentation scope (tracer instance).
1012
- */
1013
- export interface OtelScopeNode extends OtelNodeBase {
1014
- type: 'otel-scope';
1015
- /** Short description of this instrumentation scope */
1016
- description?: string;
1017
- /**
1018
- * Optional source paths that define this scope's code region.
1019
- * Each entry may be a folder (covers all descendants) or a specific file.
1020
- * When present, events under this scope may only originate from files
1021
- * covered by one of these paths, and every `event-namespace` declared in
1022
- * this scope's events canvas must have its own `paths` nested inside this
1023
- * region. Scopes without `paths` remain unenforced — enforcement is opt-in
1024
- * per scope.
1025
- *
1026
- * Semantics are "ownership / partition", distinct from `otel.files` on
1027
- * `otel-event` nodes (which lists specific emission sites). Across scopes,
1028
- * paths must be disjoint except for strict parent-child nesting by
1029
- * dotted-scope name (longest-prefix wins).
1030
- */
1031
- paths?: string[];
1032
- /** OTEL metadata - scope name is required */
1033
- otel: OtelMetadata & {
1034
- /** Scope name (required - maps to getTracer('scope-name')) */
1035
- scope: string;
1036
- };
1037
- }
1038
-
1039
- /**
1040
- * OTEL Resource Node
1041
- *
1042
- * Represents a service or deployment resource identified by OTEL resource attributes.
1043
- */
1044
- export interface OtelResourceNode extends OtelNodeBase {
1045
- type: 'otel-resource';
1046
- /** Short description of this resource */
1047
- description?: string;
1048
- /** OTEL metadata including resource matching criteria */
1049
- otel: OtelMetadata & {
1050
- /** Resource attribute matching criteria */
1051
- resourceMatch: PVOtelResourceMatch;
1052
- };
1053
- }
1054
-
1055
- /**
1056
- * OTEL Boundary Node
1057
- *
1058
- * Represents an interface point with an external system.
1059
- */
1060
- export interface OtelBoundaryNode extends OtelNodeBase {
1061
- type: 'otel-boundary';
1062
- /** Short description of this boundary */
1063
- description?: string;
1064
- /** OTEL instrumentation metadata */
1065
- otel?: OtelMetadata;
1066
- /** Boundary configuration (required) */
1067
- boundary: PVBoundaryExtension;
1068
- }
1069
-
1070
- /**
1071
- * Union of all OTEL node types
1072
- */
1073
- export type OtelNode =
1074
- | OtelEventNode
1075
- | OtelSpanConventionNode
1076
- | OtelScopeNode
1077
- | OtelResourceNode
1078
- | OtelBoundaryNode;
1079
-
1080
- /**
1081
- * Union of all extended node types (JSON Canvas + OTEL extensions)
1082
- */
1083
- export type ExtendedCanvasNode =
1084
- | ExtendedCanvasTextNode
1085
- | ExtendedCanvasFileNode
1086
- | ExtendedCanvasLinkNode
1087
- | ExtendedCanvasGroupNode
1088
- | OtelEventNode
1089
- | OtelSpanConventionNode
1090
- | OtelScopeNode
1091
- | OtelResourceNode
1092
- | OtelBoundaryNode;
1093
-
1094
- /**
1095
- * Extended edge with PV extensions
1096
- */
1097
- export interface ExtendedCanvasEdge extends CanvasEdge {
1098
- /**
1099
- * Custom edge type identifier
1100
- *
1101
- * Used to categorize edges (e.g., "data-flow", "control-flow", "dependency").
1102
- * Replaces the deprecated `pv.edgeType` field.
1103
- *
1104
- * @example "data-flow"
1105
- * @example "control-flow"
1106
- */
1107
- edgeType?: string;
1108
-
1109
- /**
1110
- * @deprecated Use top-level `edgeType` field instead.
1111
- * Validation will error if this field is present.
1112
- *
1113
- * Migration:
1114
- * ```json
1115
- * // Before (deprecated):
1116
- * { "id": "e1", "fromNode": "a", "toNode": "b", "pv": { "edgeType": "data-flow" } }
1117
- *
1118
- * // After:
1119
- * { "id": "e1", "fromNode": "a", "toNode": "b", "edgeType": "data-flow" }
1120
- * ```
1121
- */
1122
- pv?: PVEdgeExtension;
1123
- }
1124
-
1125
- /**
1126
- * Extended Canvas document with Principal View support
1127
- *
1128
- * This is the primary type for .canvas files used with the Principal View Framework.
1129
- * It supports both standard JSON Canvas node types (text, file, link, group) and
1130
- * custom OTEL node types (otel-event, otel-span-convention, etc.).
1131
- *
1132
- * Standard canvas tools will only recognize the JSON Canvas node types.
1133
- */
1134
- export interface ExtendedCanvas {
1135
- /**
1136
- * Canvas display name
1137
- *
1138
- * Human-readable name for this canvas, shown in UIs and listings.
1139
- *
1140
- * @example "Service Resources"
1141
- * @example "Checkout Flow"
1142
- */
1143
- name?: string;
1144
-
1145
- /**
1146
- * Associated markdown documentation file
1147
- *
1148
- * Path to a markdown file that documents this canvas.
1149
- * For .otel.canvas files, this field is required.
1150
- * The path must be relative to the git repository root.
1151
- *
1152
- * Convention: If not specified, defaults to same basename as canvas file.
1153
- * e.g., `resources.canvas` → `resources.md`
1154
- *
1155
- * @example ".principal-views/resources.md"
1156
- * @example "docs/architecture/checkout-flow.md"
1157
- */
1158
- markdown?: string;
1159
-
1160
- /** Canvas description */
1161
- description?: string;
1162
-
1163
- /** Node type definitions (shared across nodes) */
1164
- nodeTypes?: Record<string, PVNodeTypeDefinition>;
1165
-
1166
- /** Edge type definitions (shared across edges) */
1167
- edgeTypes?: Record<string, PVEdgeTypeDefinition>;
1168
-
1169
- /** Path-based configuration */
1170
- pathConfig?: PVPathConfig;
1171
-
1172
- /** Display configuration */
1173
- display?: PVDisplayConfig;
1174
-
1175
- /**
1176
- * Canvas scope for log filtering
1177
- *
1178
- * Only logs matching this scope will be considered for node routing.
1179
- * If not specified, all logs are in scope.
1180
- *
1181
- * @example
1182
- * ```typescript
1183
- * scope: {
1184
- * 'deployment.environment': 'production',
1185
- * 'service.namespace': 'checkout'
1186
- * }
1187
- * ```
1188
- */
1189
- scope?: CanvasScope;
1190
-
1191
- /**
1192
- * Audit configuration for log coverage tracking
1193
- *
1194
- * When enabled, tracks which logs are routed vs orphaned,
1195
- * detects silent nodes, and generates coverage reports.
1196
- */
1197
- audit?: CanvasAuditConfig;
1198
-
1199
- /** Nodes - JSON Canvas types and/or OTEL node types */
1200
- nodes?: ExtendedCanvasNode[];
1201
-
1202
- /** Edges with optional PV extensions */
1203
- edges?: ExtendedCanvasEdge[];
1204
-
1205
- /**
1206
- * @deprecated The `pv` field is fully deprecated. All fields have been moved to top-level.
1207
- * Validation will error if this field is present.
1208
- *
1209
- * Migration:
1210
- * - `pv.name` → `name` (top-level)
1211
- * - `pv.markdown` → `markdown` (top-level)
1212
- * - `pv.description` → `description` (top-level)
1213
- * - `pv.nodeTypes` → `nodeTypes` (top-level)
1214
- * - `pv.edgeTypes` → `edgeTypes` (top-level)
1215
- * - `pv.display` → `display` (top-level)
1216
- * - `pv.pathConfig` → `pathConfig` (top-level)
1217
- * - `pv.scope` → `scope` (top-level)
1218
- * - `pv.audit` → `audit` (top-level)
1219
- * - `pv.version` → removed (not used)
1220
- */
1221
- pv?: PVCanvasExtension;
1222
- }
1223
-
1224
- // ============================================================================
1225
- // Utility Types
1226
- // ============================================================================
1227
-
1228
- /**
1229
- * Type guard for text nodes
1230
- */
1231
- export function isTextNode(
1232
- node: CanvasNode | ExtendedCanvasNode
1233
- ): node is CanvasTextNode | ExtendedCanvasTextNode {
1234
- return node.type === 'text';
1235
- }
1236
-
1237
- /**
1238
- * Type guard for file nodes
1239
- */
1240
- export function isFileNode(
1241
- node: CanvasNode | ExtendedCanvasNode
1242
- ): node is CanvasFileNode | ExtendedCanvasFileNode {
1243
- return node.type === 'file';
1244
- }
1245
-
1246
- /**
1247
- * Type guard for link nodes
1248
- */
1249
- export function isLinkNode(
1250
- node: CanvasNode | ExtendedCanvasNode
1251
- ): node is CanvasLinkNode | ExtendedCanvasLinkNode {
1252
- return node.type === 'link';
1253
- }
1254
-
1255
- /**
1256
- * Type guard for group nodes
1257
- */
1258
- export function isGroupNode(
1259
- node: CanvasNode | ExtendedCanvasNode
1260
- ): node is CanvasGroupNode | ExtendedCanvasGroupNode {
1261
- return node.type === 'group';
1262
- }
1263
-
1264
- /**
1265
- * Type guard for extended nodes (with PV extension)
1266
- */
1267
- export function hasPVExtension(node: CanvasNode | ExtendedCanvasNode): node is ExtendedCanvasNode {
1268
- return 'pv' in node && node.pv !== undefined;
1269
- }
1270
-
1271
- // ============================================================================
1272
- // OTEL Node Type Guards
1273
- // ============================================================================
1274
-
1275
- /**
1276
- * Type guard for OTEL event nodes
1277
- */
1278
- export function isOtelEventNode(node: ExtendedCanvasNode): node is OtelEventNode {
1279
- return node.type === 'otel-event';
1280
- }
1281
-
1282
- /**
1283
- * Type guard for OTEL span convention nodes
1284
- */
1285
- export function isOtelSpanConventionNode(node: ExtendedCanvasNode): node is OtelSpanConventionNode {
1286
- return node.type === 'otel-span-convention';
1287
- }
1288
-
1289
- /**
1290
- * Type guard for OTEL scope nodes
1291
- */
1292
- export function isOtelScopeNode(node: ExtendedCanvasNode): node is OtelScopeNode {
1293
- return node.type === 'otel-scope';
1294
- }
1295
-
1296
- /**
1297
- * Type guard for OTEL resource nodes
1298
- */
1299
- export function isOtelResourceNode(node: ExtendedCanvasNode): node is OtelResourceNode {
1300
- return node.type === 'otel-resource';
1301
- }
1302
-
1303
- /**
1304
- * Type guard for OTEL boundary nodes
1305
- */
1306
- export function isOtelBoundaryNode(node: ExtendedCanvasNode): node is OtelBoundaryNode {
1307
- return node.type === 'otel-boundary';
1308
- }
1309
-
1310
- /**
1311
- * Type guard for any OTEL node type
1312
- */
1313
- export function isOtelNode(node: ExtendedCanvasNode): node is OtelNode {
1314
- return (
1315
- node.type === 'otel-event' ||
1316
- node.type === 'otel-span-convention' ||
1317
- node.type === 'otel-scope' ||
1318
- node.type === 'otel-resource' ||
1319
- node.type === 'otel-boundary'
1320
- );
1321
- }
1322
-
1323
- /**
1324
- * Type guard for standard canvas nodes (that may have pv extensions)
1325
- */
1326
- export function isStandardCanvasNode(
1327
- node: ExtendedCanvasNode
1328
- ): node is ExtendedCanvasTextNode | ExtendedCanvasFileNode | ExtendedCanvasLinkNode | ExtendedCanvasGroupNode {
1329
- return !isOtelNode(node);
1330
- }
1331
-
1332
- /**
1333
- * Get the identifier for an OTEL node (shown below the label)
1334
- */
1335
- export function getOtelNodeIdentifier(node: OtelNode): string | undefined {
1336
- switch (node.type) {
1337
- case 'otel-event':
1338
- return node.event?.name || node.eventRef;
1339
- case 'otel-span-convention':
1340
- return node.otel?.spanPattern;
1341
- case 'otel-scope':
1342
- return node.otel?.scope;
1343
- case 'otel-resource': {
1344
- if (!node.otel?.resourceMatch) return undefined;
1345
- const entries = Object.entries(node.otel.resourceMatch);
1346
- if (entries.length > 0) {
1347
- const [key, value] = entries[0];
1348
- return `${key}: ${Array.isArray(value) ? value[0] : value}`;
1349
- }
1350
- return undefined;
1351
- }
1352
- case 'otel-boundary':
1353
- return node.boundary?.direction;
1354
- default:
1355
- return undefined;
1356
- }
1357
- }
1358
-
1359
- /**
1360
- * Color preset mapping
1361
- */
1362
- export const CANVAS_COLOR_PRESETS: Record<number, string> = {
1363
- 1: '#ef4444', // red
1364
- 2: '#f97316', // orange
1365
- 3: '#eab308', // yellow
1366
- 4: '#22c55e', // green
1367
- 5: '#06b6d4', // cyan
1368
- 6: '#8b5cf6', // purple
1369
- };
1370
-
1371
- /**
1372
- * Resolve a canvas color to a hex string
1373
- *
1374
- * Supports:
1375
- * - Hex strings: "#22c55e" or "#3f6"
1376
- * - Numeric presets: 1-6
1377
- * - Numeric string presets: "1"-"6" (Obsidian Canvas format)
1378
- */
1379
- export function resolveCanvasColor(color: CanvasColor | undefined): string | undefined {
1380
- if (color === undefined) return undefined;
1381
-
1382
- // Handle numeric presets
1383
- if (typeof color === 'number') {
1384
- return CANVAS_COLOR_PRESETS[color];
1385
- }
1386
-
1387
- // Handle numeric string presets (from Obsidian Canvas)
1388
- const numericValue = parseInt(color, 10);
1389
- if (!isNaN(numericValue) && numericValue >= 1 && numericValue <= 6) {
1390
- return CANVAS_COLOR_PRESETS[numericValue];
1391
- }
1392
-
1393
- // Return hex strings as-is
1394
- return color;
1395
- }