@mmmnt/cli 0.6.1 → 0.7.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.
package/dist/moment.mjs CHANGED
@@ -55234,6 +55234,7 @@ var Classification = {
55234
55234
  };
55235
55235
  var CommandDeclaration = {
55236
55236
  $type: "CommandDeclaration",
55237
+ causes: "causes",
55237
55238
  emits: "emits",
55238
55239
  inputs: "inputs",
55239
55240
  name: "name",
@@ -55367,6 +55368,7 @@ var MomentDeclaration = {
55367
55368
  isBranch: "isBranch",
55368
55369
  label: "label",
55369
55370
  nodes: "nodes",
55371
+ notes: "notes",
55370
55372
  whenBlocks: "whenBlocks"
55371
55373
  };
55372
55374
  function isMomentDeclaration(item) {
@@ -55389,6 +55391,7 @@ var NodeModifier = {
55389
55391
  };
55390
55392
  var NodePlacement = {
55391
55393
  $type: "NodePlacement",
55394
+ cause: "cause",
55392
55395
  connections: "connections",
55393
55396
  crossing: "crossing",
55394
55397
  laneId: "laneId",
@@ -55396,8 +55399,14 @@ var NodePlacement = {
55396
55399
  multiplicity: "multiplicity",
55397
55400
  nodeName: "nodeName"
55398
55401
  };
55402
+ var NoteStatement = {
55403
+ $type: "NoteStatement",
55404
+ laneId: "laneId",
55405
+ text: "text"
55406
+ };
55399
55407
  var OrchestrationCommand = {
55400
55408
  $type: "OrchestrationCommand",
55409
+ causes: "causes",
55401
55410
  emits: "emits",
55402
55411
  inputs: "inputs",
55403
55412
  name: "name",
@@ -55416,6 +55425,7 @@ function isPolicyDeclaration(item) {
55416
55425
  }
55417
55426
  var Precondition = {
55418
55427
  $type: "Precondition",
55428
+ causes: "causes",
55419
55429
  description: "description",
55420
55430
  name: "name"
55421
55431
  };
@@ -55461,6 +55471,7 @@ var SagaDeclaration = {
55461
55471
  $type: "SagaDeclaration",
55462
55472
  commands: "commands",
55463
55473
  compensations: "compensations",
55474
+ events: "events",
55464
55475
  gateways: "gateways",
55465
55476
  initialState: "initialState",
55466
55477
  invokedBy: "invokedBy",
@@ -55604,6 +55615,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
55604
55615
  CommandDeclaration: {
55605
55616
  name: CommandDeclaration.$type,
55606
55617
  properties: {
55618
+ causes: {
55619
+ name: CommandDeclaration.causes,
55620
+ defaultValue: [],
55621
+ optional: true
55622
+ },
55607
55623
  emits: {
55608
55624
  name: CommandDeclaration.emits
55609
55625
  },
@@ -55927,6 +55943,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
55927
55943
  defaultValue: [],
55928
55944
  optional: true
55929
55945
  },
55946
+ notes: {
55947
+ name: MomentDeclaration.notes,
55948
+ defaultValue: [],
55949
+ optional: true
55950
+ },
55930
55951
  whenBlocks: {
55931
55952
  name: MomentDeclaration.whenBlocks,
55932
55953
  defaultValue: [],
@@ -55982,6 +56003,10 @@ var MomentAstReflection = class extends AbstractAstReflection {
55982
56003
  NodePlacement: {
55983
56004
  name: NodePlacement.$type,
55984
56005
  properties: {
56006
+ cause: {
56007
+ name: NodePlacement.cause,
56008
+ optional: true
56009
+ },
55985
56010
  connections: {
55986
56011
  name: NodePlacement.connections,
55987
56012
  defaultValue: [],
@@ -56008,9 +56033,27 @@ var MomentAstReflection = class extends AbstractAstReflection {
56008
56033
  },
56009
56034
  superTypes: []
56010
56035
  },
56036
+ NoteStatement: {
56037
+ name: NoteStatement.$type,
56038
+ properties: {
56039
+ laneId: {
56040
+ name: NoteStatement.laneId,
56041
+ optional: true
56042
+ },
56043
+ text: {
56044
+ name: NoteStatement.text
56045
+ }
56046
+ },
56047
+ superTypes: []
56048
+ },
56011
56049
  OrchestrationCommand: {
56012
56050
  name: OrchestrationCommand.$type,
56013
56051
  properties: {
56052
+ causes: {
56053
+ name: OrchestrationCommand.causes,
56054
+ defaultValue: [],
56055
+ optional: true
56056
+ },
56014
56057
  emits: {
56015
56058
  name: OrchestrationCommand.emits,
56016
56059
  optional: true
@@ -56057,6 +56100,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
56057
56100
  Precondition: {
56058
56101
  name: Precondition.$type,
56059
56102
  properties: {
56103
+ causes: {
56104
+ name: Precondition.causes,
56105
+ defaultValue: [],
56106
+ optional: true
56107
+ },
56060
56108
  description: {
56061
56109
  name: Precondition.description
56062
56110
  },
@@ -56156,6 +56204,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
56156
56204
  name: SagaDeclaration.compensations,
56157
56205
  defaultValue: []
56158
56206
  },
56207
+ events: {
56208
+ name: SagaDeclaration.events,
56209
+ defaultValue: [],
56210
+ optional: true
56211
+ },
56159
56212
  gateways: {
56160
56213
  name: SagaDeclaration.gateways,
56161
56214
  defaultValue: [],
@@ -56368,7 +56421,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56368
56421
  "terminal": {
56369
56422
  "$type": "RuleCall",
56370
56423
  "rule": {
56371
- "$ref": "#/rules@52"
56424
+ "$ref": "#/rules@54"
56372
56425
  },
56373
56426
  "arguments": []
56374
56427
  }
@@ -56380,7 +56433,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56380
56433
  "terminal": {
56381
56434
  "$type": "RuleCall",
56382
56435
  "rule": {
56383
- "$ref": "#/rules@53"
56436
+ "$ref": "#/rules@55"
56384
56437
  },
56385
56438
  "arguments": []
56386
56439
  }
@@ -56421,7 +56474,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56421
56474
  "terminal": {
56422
56475
  "$type": "RuleCall",
56423
56476
  "rule": {
56424
- "$ref": "#/rules@52"
56477
+ "$ref": "#/rules@54"
56425
56478
  },
56426
56479
  "arguments": []
56427
56480
  }
@@ -56437,7 +56490,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56437
56490
  "terminal": {
56438
56491
  "$type": "RuleCall",
56439
56492
  "rule": {
56440
- "$ref": "#/rules@52"
56493
+ "$ref": "#/rules@54"
56441
56494
  },
56442
56495
  "arguments": []
56443
56496
  }
@@ -56453,7 +56506,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56453
56506
  "terminal": {
56454
56507
  "$type": "RuleCall",
56455
56508
  "rule": {
56456
- "$ref": "#/rules@52"
56509
+ "$ref": "#/rules@54"
56457
56510
  },
56458
56511
  "arguments": []
56459
56512
  }
@@ -56472,7 +56525,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56472
56525
  "terminal": {
56473
56526
  "$type": "RuleCall",
56474
56527
  "rule": {
56475
- "$ref": "#/rules@53"
56528
+ "$ref": "#/rules@55"
56476
56529
  },
56477
56530
  "arguments": []
56478
56531
  }
@@ -56503,7 +56556,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56503
56556
  "terminal": {
56504
56557
  "$type": "RuleCall",
56505
56558
  "rule": {
56506
- "$ref": "#/rules@53"
56559
+ "$ref": "#/rules@55"
56507
56560
  },
56508
56561
  "arguments": []
56509
56562
  }
@@ -56515,7 +56568,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56515
56568
  "terminal": {
56516
56569
  "$type": "RuleCall",
56517
56570
  "rule": {
56518
- "$ref": "#/rules@49"
56571
+ "$ref": "#/rules@51"
56519
56572
  },
56520
56573
  "arguments": []
56521
56574
  },
@@ -56535,7 +56588,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56535
56588
  "terminal": {
56536
56589
  "$type": "RuleCall",
56537
56590
  "rule": {
56538
- "$ref": "#/rules@53"
56591
+ "$ref": "#/rules@55"
56539
56592
  },
56540
56593
  "arguments": []
56541
56594
  }
@@ -56668,7 +56721,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56668
56721
  "terminal": {
56669
56722
  "$type": "RuleCall",
56670
56723
  "rule": {
56671
- "$ref": "#/rules@52"
56724
+ "$ref": "#/rules@54"
56672
56725
  },
56673
56726
  "arguments": []
56674
56727
  }
@@ -56684,7 +56737,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56684
56737
  "terminal": {
56685
56738
  "$type": "RuleCall",
56686
56739
  "rule": {
56687
- "$ref": "#/rules@52"
56740
+ "$ref": "#/rules@54"
56688
56741
  },
56689
56742
  "arguments": []
56690
56743
  }
@@ -56703,7 +56756,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56703
56756
  "terminal": {
56704
56757
  "$type": "RuleCall",
56705
56758
  "rule": {
56706
- "$ref": "#/rules@52"
56759
+ "$ref": "#/rules@54"
56707
56760
  },
56708
56761
  "arguments": []
56709
56762
  }
@@ -56725,7 +56778,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56725
56778
  "terminal": {
56726
56779
  "$type": "RuleCall",
56727
56780
  "rule": {
56728
- "$ref": "#/rules@53"
56781
+ "$ref": "#/rules@55"
56729
56782
  },
56730
56783
  "arguments": []
56731
56784
  }
@@ -56747,7 +56800,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56747
56800
  "terminal": {
56748
56801
  "$type": "RuleCall",
56749
56802
  "rule": {
56750
- "$ref": "#/rules@43"
56803
+ "$ref": "#/rules@45"
56751
56804
  },
56752
56805
  "arguments": []
56753
56806
  }
@@ -56791,7 +56844,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56791
56844
  "terminal": {
56792
56845
  "$type": "RuleCall",
56793
56846
  "rule": {
56794
- "$ref": "#/rules@52"
56847
+ "$ref": "#/rules@54"
56795
56848
  },
56796
56849
  "arguments": []
56797
56850
  }
@@ -56803,7 +56856,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56803
56856
  "terminal": {
56804
56857
  "$type": "RuleCall",
56805
56858
  "rule": {
56806
- "$ref": "#/rules@53"
56859
+ "$ref": "#/rules@55"
56807
56860
  },
56808
56861
  "arguments": []
56809
56862
  }
@@ -56822,7 +56875,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56822
56875
  "terminal": {
56823
56876
  "$type": "RuleCall",
56824
56877
  "rule": {
56825
- "$ref": "#/rules@52"
56878
+ "$ref": "#/rules@54"
56826
56879
  },
56827
56880
  "arguments": []
56828
56881
  }
@@ -56834,7 +56887,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56834
56887
  "terminal": {
56835
56888
  "$type": "RuleCall",
56836
56889
  "rule": {
56837
- "$ref": "#/rules@53"
56890
+ "$ref": "#/rules@55"
56838
56891
  },
56839
56892
  "arguments": []
56840
56893
  }
@@ -56864,7 +56917,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56864
56917
  "terminal": {
56865
56918
  "$type": "RuleCall",
56866
56919
  "rule": {
56867
- "$ref": "#/rules@53"
56920
+ "$ref": "#/rules@55"
56868
56921
  },
56869
56922
  "arguments": []
56870
56923
  }
@@ -56876,7 +56929,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56876
56929
  "terminal": {
56877
56930
  "$type": "RuleCall",
56878
56931
  "rule": {
56879
- "$ref": "#/rules@53"
56932
+ "$ref": "#/rules@55"
56880
56933
  },
56881
56934
  "arguments": []
56882
56935
  }
@@ -56904,7 +56957,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56904
56957
  "terminal": {
56905
56958
  "$type": "RuleCall",
56906
56959
  "rule": {
56907
- "$ref": "#/rules@52"
56960
+ "$ref": "#/rules@54"
56908
56961
  },
56909
56962
  "arguments": []
56910
56963
  }
@@ -56920,7 +56973,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56920
56973
  "terminal": {
56921
56974
  "$type": "RuleCall",
56922
56975
  "rule": {
56923
- "$ref": "#/rules@52"
56976
+ "$ref": "#/rules@54"
56924
56977
  },
56925
56978
  "arguments": []
56926
56979
  }
@@ -56939,7 +56992,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56939
56992
  "terminal": {
56940
56993
  "$type": "RuleCall",
56941
56994
  "rule": {
56942
- "$ref": "#/rules@52"
56995
+ "$ref": "#/rules@54"
56943
56996
  },
56944
56997
  "arguments": []
56945
56998
  }
@@ -57005,7 +57058,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57005
57058
  "terminal": {
57006
57059
  "$type": "RuleCall",
57007
57060
  "rule": {
57008
- "$ref": "#/rules@53"
57061
+ "$ref": "#/rules@55"
57009
57062
  },
57010
57063
  "arguments": []
57011
57064
  }
@@ -57036,7 +57089,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57036
57089
  "terminal": {
57037
57090
  "$type": "RuleCall",
57038
57091
  "rule": {
57039
- "$ref": "#/rules@52"
57092
+ "$ref": "#/rules@54"
57040
57093
  },
57041
57094
  "arguments": []
57042
57095
  }
@@ -57077,14 +57130,14 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57077
57130
  {
57078
57131
  "$type": "RuleCall",
57079
57132
  "rule": {
57080
- "$ref": "#/rules@52"
57133
+ "$ref": "#/rules@54"
57081
57134
  },
57082
57135
  "arguments": []
57083
57136
  },
57084
57137
  {
57085
57138
  "$type": "RuleCall",
57086
57139
  "rule": {
57087
- "$ref": "#/rules@53"
57140
+ "$ref": "#/rules@55"
57088
57141
  },
57089
57142
  "arguments": []
57090
57143
  }
@@ -57111,7 +57164,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57111
57164
  "terminal": {
57112
57165
  "$type": "RuleCall",
57113
57166
  "rule": {
57114
- "$ref": "#/rules@53"
57167
+ "$ref": "#/rules@55"
57115
57168
  },
57116
57169
  "arguments": []
57117
57170
  }
@@ -57127,7 +57180,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57127
57180
  "terminal": {
57128
57181
  "$type": "RuleCall",
57129
57182
  "rule": {
57130
- "$ref": "#/rules@43"
57183
+ "$ref": "#/rules@45"
57131
57184
  },
57132
57185
  "arguments": []
57133
57186
  }
@@ -57243,7 +57296,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57243
57296
  "terminal": {
57244
57297
  "$type": "RuleCall",
57245
57298
  "rule": {
57246
- "$ref": "#/rules@52"
57299
+ "$ref": "#/rules@54"
57247
57300
  },
57248
57301
  "arguments": []
57249
57302
  }
@@ -57260,7 +57313,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57260
57313
  "terminal": {
57261
57314
  "$type": "RuleCall",
57262
57315
  "rule": {
57263
- "$ref": "#/rules@52"
57316
+ "$ref": "#/rules@54"
57264
57317
  },
57265
57318
  "arguments": []
57266
57319
  }
@@ -57276,7 +57329,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57276
57329
  "terminal": {
57277
57330
  "$type": "RuleCall",
57278
57331
  "rule": {
57279
- "$ref": "#/rules@52"
57332
+ "$ref": "#/rules@54"
57280
57333
  },
57281
57334
  "arguments": []
57282
57335
  }
@@ -57292,7 +57345,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57292
57345
  "terminal": {
57293
57346
  "$type": "RuleCall",
57294
57347
  "rule": {
57295
- "$ref": "#/rules@52"
57348
+ "$ref": "#/rules@54"
57296
57349
  },
57297
57350
  "arguments": []
57298
57351
  }
@@ -57324,7 +57377,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57324
57377
  "terminal": {
57325
57378
  "$type": "RuleCall",
57326
57379
  "rule": {
57327
- "$ref": "#/rules@52"
57380
+ "$ref": "#/rules@54"
57328
57381
  },
57329
57382
  "arguments": []
57330
57383
  }
@@ -57373,6 +57426,50 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57373
57426
  ],
57374
57427
  "cardinality": "?"
57375
57428
  },
57429
+ {
57430
+ "$type": "Group",
57431
+ "elements": [
57432
+ {
57433
+ "$type": "Keyword",
57434
+ "value": "causes"
57435
+ },
57436
+ {
57437
+ "$type": "Assignment",
57438
+ "feature": "causes",
57439
+ "operator": "+=",
57440
+ "terminal": {
57441
+ "$type": "RuleCall",
57442
+ "rule": {
57443
+ "$ref": "#/rules@54"
57444
+ },
57445
+ "arguments": []
57446
+ }
57447
+ },
57448
+ {
57449
+ "$type": "Group",
57450
+ "elements": [
57451
+ {
57452
+ "$type": "Keyword",
57453
+ "value": ","
57454
+ },
57455
+ {
57456
+ "$type": "Assignment",
57457
+ "feature": "causes",
57458
+ "operator": "+=",
57459
+ "terminal": {
57460
+ "$type": "RuleCall",
57461
+ "rule": {
57462
+ "$ref": "#/rules@54"
57463
+ },
57464
+ "arguments": []
57465
+ }
57466
+ }
57467
+ ],
57468
+ "cardinality": "*"
57469
+ }
57470
+ ],
57471
+ "cardinality": "?"
57472
+ },
57376
57473
  {
57377
57474
  "$type": "Assignment",
57378
57475
  "feature": "preconditions",
@@ -57397,7 +57494,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57397
57494
  "terminal": {
57398
57495
  "$type": "RuleCall",
57399
57496
  "rule": {
57400
- "$ref": "#/rules@52"
57497
+ "$ref": "#/rules@54"
57401
57498
  },
57402
57499
  "arguments": []
57403
57500
  }
@@ -57421,7 +57518,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57421
57518
  "terminal": {
57422
57519
  "$type": "RuleCall",
57423
57520
  "rule": {
57424
- "$ref": "#/rules@45"
57521
+ "$ref": "#/rules@47"
57425
57522
  },
57426
57523
  "arguments": []
57427
57524
  }
@@ -57437,7 +57534,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57437
57534
  "terminal": {
57438
57535
  "$type": "RuleCall",
57439
57536
  "rule": {
57440
- "$ref": "#/rules@47"
57537
+ "$ref": "#/rules@49"
57441
57538
  },
57442
57539
  "arguments": []
57443
57540
  }
@@ -57449,7 +57546,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57449
57546
  "terminal": {
57450
57547
  "$type": "RuleCall",
57451
57548
  "rule": {
57452
- "$ref": "#/rules@44"
57549
+ "$ref": "#/rules@46"
57453
57550
  },
57454
57551
  "arguments": []
57455
57552
  },
@@ -57478,11 +57575,55 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57478
57575
  "terminal": {
57479
57576
  "$type": "RuleCall",
57480
57577
  "rule": {
57481
- "$ref": "#/rules@52"
57578
+ "$ref": "#/rules@54"
57482
57579
  },
57483
57580
  "arguments": []
57484
57581
  }
57485
57582
  },
57583
+ {
57584
+ "$type": "Group",
57585
+ "elements": [
57586
+ {
57587
+ "$type": "Keyword",
57588
+ "value": "cause"
57589
+ },
57590
+ {
57591
+ "$type": "Assignment",
57592
+ "feature": "causes",
57593
+ "operator": "+=",
57594
+ "terminal": {
57595
+ "$type": "RuleCall",
57596
+ "rule": {
57597
+ "$ref": "#/rules@54"
57598
+ },
57599
+ "arguments": []
57600
+ }
57601
+ },
57602
+ {
57603
+ "$type": "Group",
57604
+ "elements": [
57605
+ {
57606
+ "$type": "Keyword",
57607
+ "value": ","
57608
+ },
57609
+ {
57610
+ "$type": "Assignment",
57611
+ "feature": "causes",
57612
+ "operator": "+=",
57613
+ "terminal": {
57614
+ "$type": "RuleCall",
57615
+ "rule": {
57616
+ "$ref": "#/rules@54"
57617
+ },
57618
+ "arguments": []
57619
+ }
57620
+ }
57621
+ ],
57622
+ "cardinality": "*"
57623
+ }
57624
+ ],
57625
+ "cardinality": "?"
57626
+ },
57486
57627
  {
57487
57628
  "$type": "Keyword",
57488
57629
  "value": ":"
@@ -57494,7 +57635,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57494
57635
  "terminal": {
57495
57636
  "$type": "RuleCall",
57496
57637
  "rule": {
57497
- "$ref": "#/rules@53"
57638
+ "$ref": "#/rules@55"
57498
57639
  },
57499
57640
  "arguments": []
57500
57641
  }
@@ -57522,7 +57663,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57522
57663
  "terminal": {
57523
57664
  "$type": "RuleCall",
57524
57665
  "rule": {
57525
- "$ref": "#/rules@52"
57666
+ "$ref": "#/rules@54"
57526
57667
  },
57527
57668
  "arguments": []
57528
57669
  }
@@ -57534,7 +57675,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57534
57675
  "terminal": {
57535
57676
  "$type": "RuleCall",
57536
57677
  "rule": {
57537
- "$ref": "#/rules@43"
57678
+ "$ref": "#/rules@45"
57538
57679
  },
57539
57680
  "arguments": []
57540
57681
  },
@@ -57563,7 +57704,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57563
57704
  "terminal": {
57564
57705
  "$type": "RuleCall",
57565
57706
  "rule": {
57566
- "$ref": "#/rules@52"
57707
+ "$ref": "#/rules@54"
57567
57708
  },
57568
57709
  "arguments": []
57569
57710
  }
@@ -57575,7 +57716,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57575
57716
  "terminal": {
57576
57717
  "$type": "RuleCall",
57577
57718
  "rule": {
57578
- "$ref": "#/rules@43"
57719
+ "$ref": "#/rules@45"
57579
57720
  },
57580
57721
  "arguments": []
57581
57722
  },
@@ -57604,7 +57745,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57604
57745
  "terminal": {
57605
57746
  "$type": "RuleCall",
57606
57747
  "rule": {
57607
- "$ref": "#/rules@52"
57748
+ "$ref": "#/rules@54"
57608
57749
  },
57609
57750
  "arguments": []
57610
57751
  }
@@ -57616,7 +57757,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57616
57757
  "terminal": {
57617
57758
  "$type": "RuleCall",
57618
57759
  "rule": {
57619
- "$ref": "#/rules@53"
57760
+ "$ref": "#/rules@55"
57620
57761
  },
57621
57762
  "arguments": []
57622
57763
  }
@@ -57632,7 +57773,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57632
57773
  "terminal": {
57633
57774
  "$type": "RuleCall",
57634
57775
  "rule": {
57635
- "$ref": "#/rules@52"
57776
+ "$ref": "#/rules@54"
57636
57777
  },
57637
57778
  "arguments": []
57638
57779
  }
@@ -57660,7 +57801,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57660
57801
  "terminal": {
57661
57802
  "$type": "RuleCall",
57662
57803
  "rule": {
57663
- "$ref": "#/rules@52"
57804
+ "$ref": "#/rules@54"
57664
57805
  },
57665
57806
  "arguments": []
57666
57807
  }
@@ -57676,7 +57817,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57676
57817
  "terminal": {
57677
57818
  "$type": "RuleCall",
57678
57819
  "rule": {
57679
- "$ref": "#/rules@52"
57820
+ "$ref": "#/rules@54"
57680
57821
  },
57681
57822
  "arguments": []
57682
57823
  }
@@ -57692,7 +57833,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57692
57833
  "terminal": {
57693
57834
  "$type": "RuleCall",
57694
57835
  "rule": {
57695
- "$ref": "#/rules@52"
57836
+ "$ref": "#/rules@54"
57696
57837
  },
57697
57838
  "arguments": []
57698
57839
  }
@@ -57708,7 +57849,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57708
57849
  "terminal": {
57709
57850
  "$type": "RuleCall",
57710
57851
  "rule": {
57711
- "$ref": "#/rules@53"
57852
+ "$ref": "#/rules@55"
57712
57853
  },
57713
57854
  "arguments": []
57714
57855
  }
@@ -57736,7 +57877,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57736
57877
  "terminal": {
57737
57878
  "$type": "RuleCall",
57738
57879
  "rule": {
57739
- "$ref": "#/rules@52"
57880
+ "$ref": "#/rules@54"
57740
57881
  },
57741
57882
  "arguments": []
57742
57883
  }
@@ -57752,7 +57893,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57752
57893
  "terminal": {
57753
57894
  "$type": "RuleCall",
57754
57895
  "rule": {
57755
- "$ref": "#/rules@52"
57896
+ "$ref": "#/rules@54"
57756
57897
  },
57757
57898
  "arguments": []
57758
57899
  }
@@ -57768,7 +57909,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57768
57909
  "terminal": {
57769
57910
  "$type": "RuleCall",
57770
57911
  "rule": {
57771
- "$ref": "#/rules@53"
57912
+ "$ref": "#/rules@55"
57772
57913
  },
57773
57914
  "arguments": []
57774
57915
  }
@@ -57784,7 +57925,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57784
57925
  "terminal": {
57785
57926
  "$type": "RuleCall",
57786
57927
  "rule": {
57787
- "$ref": "#/rules@52"
57928
+ "$ref": "#/rules@54"
57788
57929
  },
57789
57930
  "arguments": []
57790
57931
  }
@@ -57839,7 +57980,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57839
57980
  "terminal": {
57840
57981
  "$type": "RuleCall",
57841
57982
  "rule": {
57842
- "$ref": "#/rules@52"
57983
+ "$ref": "#/rules@54"
57843
57984
  },
57844
57985
  "arguments": []
57845
57986
  }
@@ -57857,6 +57998,19 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57857
57998
  },
57858
57999
  "cardinality": "*"
57859
58000
  },
58001
+ {
58002
+ "$type": "Assignment",
58003
+ "feature": "events",
58004
+ "operator": "+=",
58005
+ "terminal": {
58006
+ "$type": "RuleCall",
58007
+ "rule": {
58008
+ "$ref": "#/rules@17"
58009
+ },
58010
+ "arguments": []
58011
+ },
58012
+ "cardinality": "*"
58013
+ },
57860
58014
  {
57861
58015
  "$type": "Keyword",
57862
58016
  "value": "invoked-by"
@@ -57868,7 +58022,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57868
58022
  "terminal": {
57869
58023
  "$type": "RuleCall",
57870
58024
  "rule": {
57871
- "$ref": "#/rules@52"
58025
+ "$ref": "#/rules@54"
57872
58026
  },
57873
58027
  "arguments": []
57874
58028
  }
@@ -57922,7 +58076,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57922
58076
  "terminal": {
57923
58077
  "$type": "RuleCall",
57924
58078
  "rule": {
57925
- "$ref": "#/rules@52"
58079
+ "$ref": "#/rules@54"
57926
58080
  },
57927
58081
  "arguments": []
57928
58082
  }
@@ -58005,7 +58159,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58005
58159
  "terminal": {
58006
58160
  "$type": "RuleCall",
58007
58161
  "rule": {
58008
- "$ref": "#/rules@52"
58162
+ "$ref": "#/rules@54"
58009
58163
  },
58010
58164
  "arguments": []
58011
58165
  }
@@ -58054,6 +58208,50 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58054
58208
  ],
58055
58209
  "cardinality": "?"
58056
58210
  },
58211
+ {
58212
+ "$type": "Group",
58213
+ "elements": [
58214
+ {
58215
+ "$type": "Keyword",
58216
+ "value": "causes"
58217
+ },
58218
+ {
58219
+ "$type": "Assignment",
58220
+ "feature": "causes",
58221
+ "operator": "+=",
58222
+ "terminal": {
58223
+ "$type": "RuleCall",
58224
+ "rule": {
58225
+ "$ref": "#/rules@54"
58226
+ },
58227
+ "arguments": []
58228
+ }
58229
+ },
58230
+ {
58231
+ "$type": "Group",
58232
+ "elements": [
58233
+ {
58234
+ "$type": "Keyword",
58235
+ "value": ","
58236
+ },
58237
+ {
58238
+ "$type": "Assignment",
58239
+ "feature": "causes",
58240
+ "operator": "+=",
58241
+ "terminal": {
58242
+ "$type": "RuleCall",
58243
+ "rule": {
58244
+ "$ref": "#/rules@54"
58245
+ },
58246
+ "arguments": []
58247
+ }
58248
+ }
58249
+ ],
58250
+ "cardinality": "*"
58251
+ }
58252
+ ],
58253
+ "cardinality": "?"
58254
+ },
58057
58255
  {
58058
58256
  "$type": "Assignment",
58059
58257
  "feature": "preconditions",
@@ -58081,7 +58279,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58081
58279
  "terminal": {
58082
58280
  "$type": "RuleCall",
58083
58281
  "rule": {
58084
- "$ref": "#/rules@52"
58282
+ "$ref": "#/rules@54"
58085
58283
  },
58086
58284
  "arguments": []
58087
58285
  }
@@ -58108,7 +58306,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58108
58306
  "terminal": {
58109
58307
  "$type": "RuleCall",
58110
58308
  "rule": {
58111
- "$ref": "#/rules@52"
58309
+ "$ref": "#/rules@54"
58112
58310
  },
58113
58311
  "arguments": []
58114
58312
  }
@@ -58127,7 +58325,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58127
58325
  "terminal": {
58128
58326
  "$type": "RuleCall",
58129
58327
  "rule": {
58130
- "$ref": "#/rules@52"
58328
+ "$ref": "#/rules@54"
58131
58329
  },
58132
58330
  "arguments": []
58133
58331
  }
@@ -58158,7 +58356,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58158
58356
  "terminal": {
58159
58357
  "$type": "RuleCall",
58160
58358
  "rule": {
58161
- "$ref": "#/rules@52"
58359
+ "$ref": "#/rules@54"
58162
58360
  },
58163
58361
  "arguments": []
58164
58362
  }
@@ -58177,7 +58375,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58177
58375
  "terminal": {
58178
58376
  "$type": "RuleCall",
58179
58377
  "rule": {
58180
- "$ref": "#/rules@52"
58378
+ "$ref": "#/rules@54"
58181
58379
  },
58182
58380
  "arguments": []
58183
58381
  }
@@ -58227,7 +58425,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58227
58425
  "terminal": {
58228
58426
  "$type": "RuleCall",
58229
58427
  "rule": {
58230
- "$ref": "#/rules@52"
58428
+ "$ref": "#/rules@54"
58231
58429
  },
58232
58430
  "arguments": []
58233
58431
  }
@@ -58293,7 +58491,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58293
58491
  "terminal": {
58294
58492
  "$type": "RuleCall",
58295
58493
  "rule": {
58296
- "$ref": "#/rules@52"
58494
+ "$ref": "#/rules@54"
58297
58495
  },
58298
58496
  "arguments": []
58299
58497
  }
@@ -58330,7 +58528,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58330
58528
  "terminal": {
58331
58529
  "$type": "RuleCall",
58332
58530
  "rule": {
58333
- "$ref": "#/rules@52"
58531
+ "$ref": "#/rules@54"
58334
58532
  },
58335
58533
  "arguments": []
58336
58534
  }
@@ -58346,7 +58544,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58346
58544
  "terminal": {
58347
58545
  "$type": "RuleCall",
58348
58546
  "rule": {
58349
- "$ref": "#/rules@52"
58547
+ "$ref": "#/rules@54"
58350
58548
  },
58351
58549
  "arguments": []
58352
58550
  }
@@ -58362,7 +58560,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58362
58560
  "terminal": {
58363
58561
  "$type": "RuleCall",
58364
58562
  "rule": {
58365
- "$ref": "#/rules@51"
58563
+ "$ref": "#/rules@53"
58366
58564
  },
58367
58565
  "arguments": []
58368
58566
  }
@@ -58378,7 +58576,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58378
58576
  "terminal": {
58379
58577
  "$type": "RuleCall",
58380
58578
  "rule": {
58381
- "$ref": "#/rules@53"
58579
+ "$ref": "#/rules@55"
58382
58580
  },
58383
58581
  "arguments": []
58384
58582
  }
@@ -58406,7 +58604,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58406
58604
  "terminal": {
58407
58605
  "$type": "RuleCall",
58408
58606
  "rule": {
58409
- "$ref": "#/rules@53"
58607
+ "$ref": "#/rules@55"
58410
58608
  },
58411
58609
  "arguments": []
58412
58610
  }
@@ -58425,7 +58623,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58425
58623
  "terminal": {
58426
58624
  "$type": "RuleCall",
58427
58625
  "rule": {
58428
- "$ref": "#/rules@53"
58626
+ "$ref": "#/rules@55"
58429
58627
  },
58430
58628
  "arguments": []
58431
58629
  }
@@ -58496,7 +58694,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58496
58694
  "terminal": {
58497
58695
  "$type": "RuleCall",
58498
58696
  "rule": {
58499
- "$ref": "#/rules@52"
58697
+ "$ref": "#/rules@35"
58500
58698
  },
58501
58699
  "arguments": []
58502
58700
  }
@@ -58508,7 +58706,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58508
58706
  "terminal": {
58509
58707
  "$type": "RuleCall",
58510
58708
  "rule": {
58511
- "$ref": "#/rules@53"
58709
+ "$ref": "#/rules@55"
58512
58710
  },
58513
58711
  "arguments": []
58514
58712
  }
@@ -58520,7 +58718,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58520
58718
  "terminal": {
58521
58719
  "$type": "RuleCall",
58522
58720
  "rule": {
58523
- "$ref": "#/rules@49"
58721
+ "$ref": "#/rules@51"
58524
58722
  },
58525
58723
  "arguments": []
58526
58724
  },
@@ -58549,7 +58747,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58549
58747
  "terminal": {
58550
58748
  "$type": "RuleCall",
58551
58749
  "rule": {
58552
- "$ref": "#/rules@53"
58750
+ "$ref": "#/rules@55"
58553
58751
  },
58554
58752
  "arguments": []
58555
58753
  }
@@ -58574,7 +58772,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58574
58772
  "terminal": {
58575
58773
  "$type": "RuleCall",
58576
58774
  "rule": {
58577
- "$ref": "#/rules@33"
58775
+ "$ref": "#/rules@34"
58578
58776
  },
58579
58777
  "arguments": []
58580
58778
  }
@@ -58583,6 +58781,18 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58583
58781
  "$type": "Assignment",
58584
58782
  "feature": "whenBlocks",
58585
58783
  "operator": "+=",
58784
+ "terminal": {
58785
+ "$type": "RuleCall",
58786
+ "rule": {
58787
+ "$ref": "#/rules@33"
58788
+ },
58789
+ "arguments": []
58790
+ }
58791
+ },
58792
+ {
58793
+ "$type": "Assignment",
58794
+ "feature": "notes",
58795
+ "operator": "+=",
58586
58796
  "terminal": {
58587
58797
  "$type": "RuleCall",
58588
58798
  "rule": {
@@ -58600,6 +58810,56 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58600
58810
  "fragment": false,
58601
58811
  "parameters": []
58602
58812
  },
58813
+ {
58814
+ "$type": "ParserRule",
58815
+ "name": "NoteStatement",
58816
+ "definition": {
58817
+ "$type": "Group",
58818
+ "elements": [
58819
+ {
58820
+ "$type": "Keyword",
58821
+ "value": "note"
58822
+ },
58823
+ {
58824
+ "$type": "Group",
58825
+ "elements": [
58826
+ {
58827
+ "$type": "Assignment",
58828
+ "feature": "laneId",
58829
+ "operator": "=",
58830
+ "terminal": {
58831
+ "$type": "RuleCall",
58832
+ "rule": {
58833
+ "$ref": "#/rules@35"
58834
+ },
58835
+ "arguments": []
58836
+ }
58837
+ },
58838
+ {
58839
+ "$type": "Keyword",
58840
+ "value": ":"
58841
+ }
58842
+ ],
58843
+ "cardinality": "?"
58844
+ },
58845
+ {
58846
+ "$type": "Assignment",
58847
+ "feature": "text",
58848
+ "operator": "=",
58849
+ "terminal": {
58850
+ "$type": "RuleCall",
58851
+ "rule": {
58852
+ "$ref": "#/rules@55"
58853
+ },
58854
+ "arguments": []
58855
+ }
58856
+ }
58857
+ ]
58858
+ },
58859
+ "entry": false,
58860
+ "fragment": false,
58861
+ "parameters": []
58862
+ },
58603
58863
  {
58604
58864
  "$type": "ParserRule",
58605
58865
  "name": "WhenBlock",
@@ -58617,7 +58877,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58617
58877
  "terminal": {
58618
58878
  "$type": "RuleCall",
58619
58879
  "rule": {
58620
- "$ref": "#/rules@52"
58880
+ "$ref": "#/rules@54"
58621
58881
  },
58622
58882
  "arguments": []
58623
58883
  }
@@ -58636,7 +58896,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58636
58896
  "terminal": {
58637
58897
  "$type": "RuleCall",
58638
58898
  "rule": {
58639
- "$ref": "#/rules@52"
58899
+ "$ref": "#/rules@35"
58640
58900
  },
58641
58901
  "arguments": []
58642
58902
  }
@@ -58655,7 +58915,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58655
58915
  "terminal": {
58656
58916
  "$type": "RuleCall",
58657
58917
  "rule": {
58658
- "$ref": "#/rules@33"
58918
+ "$ref": "#/rules@34"
58659
58919
  },
58660
58920
  "arguments": []
58661
58921
  },
@@ -58680,7 +58940,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58680
58940
  "terminal": {
58681
58941
  "$type": "RuleCall",
58682
58942
  "rule": {
58683
- "$ref": "#/rules@52"
58943
+ "$ref": "#/rules@35"
58684
58944
  },
58685
58945
  "arguments": []
58686
58946
  }
@@ -58696,7 +58956,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58696
58956
  "terminal": {
58697
58957
  "$type": "RuleCall",
58698
58958
  "rule": {
58699
- "$ref": "#/rules@52"
58959
+ "$ref": "#/rules@54"
58700
58960
  },
58701
58961
  "arguments": []
58702
58962
  }
@@ -58708,7 +58968,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58708
58968
  "terminal": {
58709
58969
  "$type": "RuleCall",
58710
58970
  "rule": {
58711
- "$ref": "#/rules@34"
58971
+ "$ref": "#/rules@36"
58712
58972
  },
58713
58973
  "arguments": []
58714
58974
  },
@@ -58721,12 +58981,34 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58721
58981
  "terminal": {
58722
58982
  "$type": "RuleCall",
58723
58983
  "rule": {
58724
- "$ref": "#/rules@35"
58984
+ "$ref": "#/rules@37"
58725
58985
  },
58726
58986
  "arguments": []
58727
58987
  },
58728
58988
  "cardinality": "?"
58729
58989
  },
58990
+ {
58991
+ "$type": "Group",
58992
+ "elements": [
58993
+ {
58994
+ "$type": "Keyword",
58995
+ "value": "cause"
58996
+ },
58997
+ {
58998
+ "$type": "Assignment",
58999
+ "feature": "cause",
59000
+ "operator": "=",
59001
+ "terminal": {
59002
+ "$type": "RuleCall",
59003
+ "rule": {
59004
+ "$ref": "#/rules@54"
59005
+ },
59006
+ "arguments": []
59007
+ }
59008
+ }
59009
+ ],
59010
+ "cardinality": "?"
59011
+ },
58730
59012
  {
58731
59013
  "$type": "Assignment",
58732
59014
  "feature": "crossing",
@@ -58734,7 +59016,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58734
59016
  "terminal": {
58735
59017
  "$type": "RuleCall",
58736
59018
  "rule": {
58737
- "$ref": "#/rules@38"
59019
+ "$ref": "#/rules@40"
58738
59020
  },
58739
59021
  "arguments": []
58740
59022
  },
@@ -58747,7 +59029,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58747
59029
  "terminal": {
58748
59030
  "$type": "RuleCall",
58749
59031
  "rule": {
58750
- "$ref": "#/rules@37"
59032
+ "$ref": "#/rules@39"
58751
59033
  },
58752
59034
  "arguments": []
58753
59035
  },
@@ -58759,6 +59041,38 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58759
59041
  "fragment": false,
58760
59042
  "parameters": []
58761
59043
  },
59044
+ {
59045
+ "$type": "ParserRule",
59046
+ "name": "LaneName",
59047
+ "dataType": "string",
59048
+ "definition": {
59049
+ "$type": "Alternatives",
59050
+ "elements": [
59051
+ {
59052
+ "$type": "RuleCall",
59053
+ "rule": {
59054
+ "$ref": "#/rules@54"
59055
+ },
59056
+ "arguments": []
59057
+ },
59058
+ {
59059
+ "$type": "Keyword",
59060
+ "value": "cause"
59061
+ },
59062
+ {
59063
+ "$type": "Keyword",
59064
+ "value": "causes"
59065
+ },
59066
+ {
59067
+ "$type": "Keyword",
59068
+ "value": "note"
59069
+ }
59070
+ ]
59071
+ },
59072
+ "entry": false,
59073
+ "fragment": false,
59074
+ "parameters": []
59075
+ },
58762
59076
  {
58763
59077
  "$type": "ParserRule",
58764
59078
  "name": "Multiplicity",
@@ -58783,7 +59097,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58783
59097
  "terminal": {
58784
59098
  "$type": "RuleCall",
58785
59099
  "rule": {
58786
- "$ref": "#/rules@54"
59100
+ "$ref": "#/rules@56"
58787
59101
  },
58788
59102
  "arguments": []
58789
59103
  }
@@ -58795,7 +59109,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58795
59109
  "terminal": {
58796
59110
  "$type": "RuleCall",
58797
59111
  "rule": {
58798
- "$ref": "#/rules@52"
59112
+ "$ref": "#/rules@54"
58799
59113
  },
58800
59114
  "arguments": []
58801
59115
  }
@@ -58829,7 +59143,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58829
59143
  "terminal": {
58830
59144
  "$type": "RuleCall",
58831
59145
  "rule": {
58832
- "$ref": "#/rules@36"
59146
+ "$ref": "#/rules@38"
58833
59147
  },
58834
59148
  "arguments": []
58835
59149
  }
@@ -58874,21 +59188,21 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58874
59188
  {
58875
59189
  "$type": "RuleCall",
58876
59190
  "rule": {
58877
- "$ref": "#/rules@40"
59191
+ "$ref": "#/rules@42"
58878
59192
  },
58879
59193
  "arguments": []
58880
59194
  },
58881
59195
  {
58882
59196
  "$type": "RuleCall",
58883
59197
  "rule": {
58884
- "$ref": "#/rules@41"
59198
+ "$ref": "#/rules@43"
58885
59199
  },
58886
59200
  "arguments": []
58887
59201
  },
58888
59202
  {
58889
59203
  "$type": "RuleCall",
58890
59204
  "rule": {
58891
- "$ref": "#/rules@42"
59205
+ "$ref": "#/rules@44"
58892
59206
  },
58893
59207
  "arguments": []
58894
59208
  }
@@ -58915,7 +59229,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58915
59229
  "terminal": {
58916
59230
  "$type": "RuleCall",
58917
59231
  "rule": {
58918
- "$ref": "#/rules@52"
59232
+ "$ref": "#/rules@35"
58919
59233
  },
58920
59234
  "arguments": []
58921
59235
  }
@@ -58931,7 +59245,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58931
59245
  "terminal": {
58932
59246
  "$type": "RuleCall",
58933
59247
  "rule": {
58934
- "$ref": "#/rules@51"
59248
+ "$ref": "#/rules@53"
58935
59249
  },
58936
59250
  "arguments": []
58937
59251
  }
@@ -58947,7 +59261,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58947
59261
  "terminal": {
58948
59262
  "$type": "RuleCall",
58949
59263
  "rule": {
58950
- "$ref": "#/rules@39"
59264
+ "$ref": "#/rules@41"
58951
59265
  },
58952
59266
  "arguments": []
58953
59267
  },
@@ -58972,7 +59286,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58972
59286
  "terminal": {
58973
59287
  "$type": "RuleCall",
58974
59288
  "rule": {
58975
- "$ref": "#/rules@52"
59289
+ "$ref": "#/rules@54"
58976
59290
  },
58977
59291
  "arguments": []
58978
59292
  }
@@ -58988,7 +59302,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58988
59302
  "terminal": {
58989
59303
  "$type": "RuleCall",
58990
59304
  "rule": {
58991
- "$ref": "#/rules@47"
59305
+ "$ref": "#/rules@49"
58992
59306
  },
58993
59307
  "arguments": []
58994
59308
  }
@@ -59026,7 +59340,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59026
59340
  "terminal": {
59027
59341
  "$type": "RuleCall",
59028
59342
  "rule": {
59029
- "$ref": "#/rules@52"
59343
+ "$ref": "#/rules@54"
59030
59344
  },
59031
59345
  "arguments": []
59032
59346
  }
@@ -59054,7 +59368,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59054
59368
  "terminal": {
59055
59369
  "$type": "RuleCall",
59056
59370
  "rule": {
59057
- "$ref": "#/rules@52"
59371
+ "$ref": "#/rules@54"
59058
59372
  },
59059
59373
  "arguments": []
59060
59374
  }
@@ -59082,7 +59396,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59082
59396
  "terminal": {
59083
59397
  "$type": "RuleCall",
59084
59398
  "rule": {
59085
- "$ref": "#/rules@53"
59399
+ "$ref": "#/rules@55"
59086
59400
  },
59087
59401
  "arguments": []
59088
59402
  }
@@ -59106,7 +59420,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59106
59420
  "terminal": {
59107
59421
  "$type": "RuleCall",
59108
59422
  "rule": {
59109
- "$ref": "#/rules@46"
59423
+ "$ref": "#/rules@48"
59110
59424
  },
59111
59425
  "arguments": []
59112
59426
  }
@@ -59122,7 +59436,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59122
59436
  "terminal": {
59123
59437
  "$type": "RuleCall",
59124
59438
  "rule": {
59125
- "$ref": "#/rules@47"
59439
+ "$ref": "#/rules@49"
59126
59440
  },
59127
59441
  "arguments": []
59128
59442
  }
@@ -59134,7 +59448,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59134
59448
  "terminal": {
59135
59449
  "$type": "RuleCall",
59136
59450
  "rule": {
59137
- "$ref": "#/rules@44"
59451
+ "$ref": "#/rules@46"
59138
59452
  },
59139
59453
  "arguments": []
59140
59454
  },
@@ -59167,7 +59481,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59167
59481
  "terminal": {
59168
59482
  "$type": "RuleCall",
59169
59483
  "rule": {
59170
- "$ref": "#/rules@53"
59484
+ "$ref": "#/rules@55"
59171
59485
  },
59172
59486
  "arguments": []
59173
59487
  }
@@ -59183,7 +59497,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59183
59497
  "terminal": {
59184
59498
  "$type": "RuleCall",
59185
59499
  "rule": {
59186
- "$ref": "#/rules@53"
59500
+ "$ref": "#/rules@55"
59187
59501
  },
59188
59502
  "arguments": []
59189
59503
  }
@@ -59208,7 +59522,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59208
59522
  {
59209
59523
  "$type": "RuleCall",
59210
59524
  "rule": {
59211
- "$ref": "#/rules@46"
59525
+ "$ref": "#/rules@48"
59212
59526
  },
59213
59527
  "arguments": []
59214
59528
  },
@@ -59244,7 +59558,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59244
59558
  {
59245
59559
  "$type": "RuleCall",
59246
59560
  "rule": {
59247
- "$ref": "#/rules@52"
59561
+ "$ref": "#/rules@54"
59248
59562
  },
59249
59563
  "arguments": []
59250
59564
  },
@@ -59287,6 +59601,18 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59287
59601
  {
59288
59602
  "$type": "Keyword",
59289
59603
  "value": "invoked-by"
59604
+ },
59605
+ {
59606
+ "$type": "Keyword",
59607
+ "value": "cause"
59608
+ },
59609
+ {
59610
+ "$type": "Keyword",
59611
+ "value": "causes"
59612
+ },
59613
+ {
59614
+ "$type": "Keyword",
59615
+ "value": "note"
59290
59616
  }
59291
59617
  ]
59292
59618
  },
@@ -59307,7 +59633,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59307
59633
  "terminal": {
59308
59634
  "$type": "RuleCall",
59309
59635
  "rule": {
59310
- "$ref": "#/rules@48"
59636
+ "$ref": "#/rules@50"
59311
59637
  },
59312
59638
  "arguments": []
59313
59639
  }
@@ -59366,7 +59692,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59366
59692
  {
59367
59693
  "$type": "RuleCall",
59368
59694
  "rule": {
59369
- "$ref": "#/rules@52"
59695
+ "$ref": "#/rules@54"
59370
59696
  },
59371
59697
  "arguments": []
59372
59698
  }
@@ -59393,7 +59719,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59393
59719
  "terminal": {
59394
59720
  "$type": "RuleCall",
59395
59721
  "rule": {
59396
- "$ref": "#/rules@50"
59722
+ "$ref": "#/rules@52"
59397
59723
  },
59398
59724
  "arguments": []
59399
59725
  }
@@ -59479,7 +59805,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59479
59805
  {
59480
59806
  "$type": "RuleCall",
59481
59807
  "rule": {
59482
- "$ref": "#/rules@52"
59808
+ "$ref": "#/rules@54"
59483
59809
  },
59484
59810
  "arguments": []
59485
59811
  }
@@ -59505,7 +59831,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59505
59831
  "name": "STRING",
59506
59832
  "definition": {
59507
59833
  "$type": "RegexToken",
59508
- "regex": "/\\"[^\\"]*\\"/",
59834
+ "regex": "/\\"(\\\\\\\\.|[^\\"\\\\\\\\])*\\"/",
59509
59835
  "parenthesized": false
59510
59836
  },
59511
59837
  "fragment": false,
@@ -59590,6 +59916,9 @@ function buildMomentSequence(moment) {
59590
59916
  moment.whenBlocks.forEach((block2, index) => {
59591
59917
  positioned.push({ item: { kind: "branch", index }, offset: block2.$cstNode?.offset });
59592
59918
  });
59919
+ (moment.notes ?? []).forEach((note, index) => {
59920
+ positioned.push({ item: { kind: "note", index }, offset: note.$cstNode?.offset });
59921
+ });
59593
59922
  const fromCst = positioned.every((p) => p.offset !== void 0);
59594
59923
  if (!fromCst) {
59595
59924
  return { sequence: positioned.map((p) => p.item), fromCst: false };
@@ -59599,9 +59928,6 @@ function buildMomentSequence(moment) {
59599
59928
  }
59600
59929
 
59601
59930
  // ../core/dist/validation/moment-validator.js
59602
- function unquote(s) {
59603
- return s.startsWith('"') && s.endsWith('"') ? s.slice(1, -1) : s;
59604
- }
59605
59931
  function aggregateBlocks(agg, events) {
59606
59932
  const blocks = [];
59607
59933
  for (const aggMember of agg.members) {
@@ -59616,6 +59942,15 @@ function aggregateBlocks(agg, events) {
59616
59942
  }
59617
59943
  return blocks;
59618
59944
  }
59945
+ function sagaBlocks(saga, events) {
59946
+ return [
59947
+ ...saga.commands.map((c) => ({ name: c.name, kind: "command" })),
59948
+ ...saga.events.map((e) => {
59949
+ events.push(e.name);
59950
+ return { name: e.name, kind: "event" };
59951
+ })
59952
+ ];
59953
+ }
59619
59954
  function contextMemberBlock(member) {
59620
59955
  if (isPolicyDeclaration(member))
59621
59956
  return { name: member.name, kind: "policy" };
@@ -59635,7 +59970,7 @@ function buildCrossFileContext(file) {
59635
59970
  const declaredBuildingBlocks = /* @__PURE__ */ new Map();
59636
59971
  const declaredSagas = [];
59637
59972
  for (const ctx of file.contexts) {
59638
- const contextName = unquote(ctx.name);
59973
+ const contextName = ctx.name;
59639
59974
  declaredContextNames.push(contextName);
59640
59975
  const events = [];
59641
59976
  const blocks = [];
@@ -59649,6 +59984,8 @@ function buildCrossFileContext(file) {
59649
59984
  blocks.push(block2);
59650
59985
  if (block2?.kind === "saga")
59651
59986
  declaredSagas.push(block2.name);
59987
+ if (isSagaDeclaration(member))
59988
+ blocks.push(...sagaBlocks(member, events));
59652
59989
  }
59653
59990
  declaredEvents.set(contextName, events);
59654
59991
  declaredBuildingBlocks.set(contextName, blocks);
@@ -59665,6 +60002,7 @@ function registerMomentValidationChecks(services) {
59665
60002
  AnnotationDeclaration: validator.checkAnnotationName,
59666
60003
  ContextDeclaration: validator.checkTrailingAnnotation,
59667
60004
  AggregateDeclaration: validator.checkTrailingAnnotation,
60005
+ NoteStatement: validator.checkNoteLane,
59668
60006
  NodePlacement: [
59669
60007
  validator.checkNodePlacement,
59670
60008
  validator.checkOptionalWithCrossing,
@@ -59704,7 +60042,7 @@ function collectSiblingNames(field) {
59704
60042
  function laneDeclaresEvent(lane, eventName, ctx) {
59705
60043
  if (!lane)
59706
60044
  return false;
59707
- const events = ctx.declaredEvents.get(unquote(lane.label)) ?? [];
60045
+ const events = ctx.declaredEvents.get(lane.label) ?? [];
59708
60046
  return events.includes(eventName);
59709
60047
  }
59710
60048
  function getMomentFromNode(node) {
@@ -59729,9 +60067,9 @@ var MomentValidator = class {
59729
60067
  // V12: Deprecated field replacement must exist as sibling field
59730
60068
  // =========================================================================
59731
60069
  checkDeprecatedReplacement(field, accept) {
59732
- if (!field.deprecation)
60070
+ if (field.deprecation?.replacement === void 0)
59733
60071
  return;
59734
- const replacement = field.deprecation.replacement.replace(/^"|"$/g, "");
60072
+ const replacement = field.deprecation.replacement;
59735
60073
  const siblings = collectSiblingNames(field);
59736
60074
  if (siblings === void 0)
59737
60075
  return;
@@ -59840,11 +60178,25 @@ var MomentValidator = class {
59840
60178
  }
59841
60179
  }
59842
60180
  // =========================================================================
59843
- // V10: Moment with zero nodes AND zero whenBlocks -> error
60181
+ // V13 for notes: a lane named by `note <lane>: "text"` must be a declared lane (ADR-040 D3)
60182
+ // =========================================================================
60183
+ checkNoteLane(note, accept) {
60184
+ const flow = getFlowFromNode(note);
60185
+ if (note.laneId === void 0 || !flow)
60186
+ return;
60187
+ if (!flow.lanes.some((l) => l.id === note.laneId)) {
60188
+ accept("error", "V13: Lane ID does not match any declared lane.", {
60189
+ node: note,
60190
+ property: "laneId"
60191
+ });
60192
+ }
60193
+ }
60194
+ // =========================================================================
60195
+ // V10: Moment with zero nodes, zero whenBlocks AND zero notes -> error (ADR-040 D3)
59844
60196
  // =========================================================================
59845
60197
  checkMoment(moment, accept) {
59846
- if (moment.nodes.length === 0 && moment.whenBlocks.length === 0) {
59847
- accept("error", "V10: Moment must contain at least one node or when block.", {
60198
+ if (moment.nodes.length === 0 && moment.whenBlocks.length === 0 && (moment.notes ?? []).length === 0) {
60199
+ accept("error", "V10: Moment must contain at least one node, when block or note.", {
59848
60200
  node: moment,
59849
60201
  property: "label"
59850
60202
  });
@@ -59977,7 +60329,7 @@ var MomentValidator = class {
59977
60329
  for (const lane of flow.lanes) {
59978
60330
  if (lane.isBranch || lane.classification?.value === "External")
59979
60331
  continue;
59980
- if (!ctx.declaredContextNames.includes(lane.label.replace(/^"|"$/g, ""))) {
60332
+ if (!ctx.declaredContextNames.includes(lane.label)) {
59981
60333
  accept("error", "SP-01: Lane label does not match any declared context name.", {
59982
60334
  node: lane,
59983
60335
  property: "label"
@@ -60019,7 +60371,7 @@ var MomentValidator = class {
60019
60371
  const lane = flow.lanes.find((l) => l.id === node.laneId);
60020
60372
  if (!lane || lane.isBranch)
60021
60373
  return;
60022
- const contextName = lane.label.replace(/^"|"$/g, "");
60374
+ const contextName = lane.label;
60023
60375
  const blocks = ctx.declaredBuildingBlocks.get(contextName) ?? [];
60024
60376
  const blockNames = blocks.map((b) => b.name);
60025
60377
  if (!blockNames.includes(node.nodeName)) {
@@ -60029,23 +60381,10 @@ var MomentValidator = class {
60029
60381
  });
60030
60382
  }
60031
60383
  }
60032
- // V5: triggered-by must reference a node that appeared earlier in the flow
60384
+ // V5: triggered-by must reference a node that appears earlier in the flow in source order:
60385
+ // in a prior moment, or earlier in the same moment (ADR-040 D4). V43 checks a same-moment hop.
60033
60386
  checkV5(node, accept) {
60034
- const flow = getFlowFromNode(node);
60035
- const moment = getMomentFromNode(node);
60036
- if (!flow || !moment)
60037
- return;
60038
- for (const conn of node.connections) {
60039
- if (!isTriggeredBy(conn))
60040
- continue;
60041
- const priorNames = this.collectPriorNodeNames(flow, moment);
60042
- if (!priorNames.has(conn.nodeName)) {
60043
- accept("error", "V5: triggered-by must reference a node from a prior frame.", {
60044
- node: conn,
60045
- property: "nodeName"
60046
- });
60047
- }
60048
- }
60387
+ this.checkTriggeredByPrior(node, accept);
60049
60388
  }
60050
60389
  // V9: crosses-to only valid on event kinds
60051
60390
  checkV9(node, accept, ctx) {
@@ -60057,7 +60396,7 @@ var MomentValidator = class {
60057
60396
  const lane = flow.lanes.find((l) => l.id === node.laneId);
60058
60397
  if (!lane || lane.isBranch)
60059
60398
  return;
60060
- const contextName = lane.label.replace(/^"|"$/g, "");
60399
+ const contextName = lane.label;
60061
60400
  const blocks = ctx.declaredBuildingBlocks.get(contextName) ?? [];
60062
60401
  const block2 = blocks.find((b) => b.name === node.nodeName);
60063
60402
  if (block2 && block2.kind !== "event") {
@@ -60077,7 +60416,7 @@ var MomentValidator = class {
60077
60416
  const lane = flow.lanes.find((l) => l.id === node.laneId);
60078
60417
  if (!lane || lane.isBranch)
60079
60418
  return;
60080
- const contextName = lane.label.replace(/^"|"$/g, "");
60419
+ const contextName = lane.label;
60081
60420
  const blocks = ctx.declaredBuildingBlocks.get(contextName) ?? [];
60082
60421
  const block2 = blocks.find((b) => b.name === node.nodeName);
60083
60422
  if (block2 && block2.kind !== "event") {
@@ -60138,15 +60477,24 @@ var MomentValidator = class {
60138
60477
  for (const conn of node.connections) {
60139
60478
  if (!isTriggeredBy(conn))
60140
60479
  continue;
60141
- const priorNames = this.collectPriorNodeNames(flow, moment);
60142
- if (!priorNames.has(conn.nodeName)) {
60143
- accept("error", "V5: triggered-by must reference a node from a prior frame.", {
60144
- node: conn,
60145
- property: "nodeName"
60146
- });
60480
+ const earlierNames = this.collectPriorNodeNames(flow, moment);
60481
+ for (const n of this.nodesBefore(moment, node))
60482
+ earlierNames.add(n.nodeName);
60483
+ if (!earlierNames.has(conn.nodeName)) {
60484
+ accept("error", "V5: triggered-by must reference a node placed earlier in the flow, in a prior moment or earlier in the same moment.", { node: conn, property: "nodeName" });
60147
60485
  }
60148
60486
  }
60149
60487
  }
60488
+ /**
60489
+ * The nodes of `moment` (its own and its `when` blocks') that come before `node` in source order.
60490
+ * CST offsets give the order; a hand-built AST without them falls back to own nodes then `when` nodes.
60491
+ */
60492
+ nodesBefore(moment, node) {
60493
+ const all = [...moment.nodes, ...moment.whenBlocks.flatMap((wb) => wb.nodes)];
60494
+ const hasCst = all.every((n) => n.$cstNode !== void 0);
60495
+ const inOrder = hasCst ? all.slice().sort((a, b) => a.$cstNode.offset - b.$cstNode.offset) : all;
60496
+ return inOrder.slice(0, inOrder.indexOf(node));
60497
+ }
60150
60498
  checkCrossFileNodeRules(node, accept) {
60151
60499
  if (!this.crossFileContext)
60152
60500
  return;
@@ -60426,11 +60774,12 @@ function orchestrationFindings(saga, known) {
60426
60774
  if (saga.commands === void 0)
60427
60775
  return [];
60428
60776
  const own = new Set(saga.commands.map((c) => c.name));
60777
+ const ownEvents = new Set((saga.events ?? []).map((e) => e.name));
60429
60778
  const compensations = saga.compensations ?? [];
60430
60779
  return [
60431
- ...saga.commands.filter((c) => c.emitsEvent !== void 0).map((c) => ({
60780
+ ...saga.commands.filter((c) => c.emitsEvent !== void 0 && !ownEvents.has(c.emitsEvent)).map((c) => ({
60432
60781
  ruleId: "V31",
60433
- message: `Orchestration '${saga.name}' command '${c.name}' emits '${c.emitsEvent ?? ""}'; an orchestration generates no domain event.`
60782
+ message: `Orchestration '${saga.name}' command '${c.name}' emits '${c.emitsEvent ?? ""}', which the orchestration does not declare; it emits only its own events.`
60434
60783
  })),
60435
60784
  ...own.has(saga.trigger) ? [] : [
60436
60785
  {
@@ -60526,15 +60875,109 @@ function v37(ctx, known) {
60526
60875
  ...ctx.sagas.flatMap((s) => gatewayFindings(`orchestration '${s.name}'`, s.gateways ?? [], known))
60527
60876
  ];
60528
60877
  }
60878
+ function v40(ctx) {
60879
+ const owners = /* @__PURE__ */ new Map();
60880
+ const add2 = (event, owner) => {
60881
+ owners.set(event, [...owners.get(event) ?? [], owner]);
60882
+ };
60883
+ for (const agg of ctx.aggregates)
60884
+ for (const e of agg.events ?? [])
60885
+ add2(e.name, `aggregate '${agg.name}'`);
60886
+ const processNames = /* @__PURE__ */ new Set();
60887
+ for (const saga of ctx.sagas)
60888
+ for (const e of saga.events ?? []) {
60889
+ add2(e.name, `orchestration '${saga.name}'`);
60890
+ processNames.add(e.name);
60891
+ }
60892
+ return [...owners].filter(([name, who]) => processNames.has(name) && who.length > 1).map(([name, who]) => ({
60893
+ ruleId: "V40",
60894
+ message: `Event '${name}' is declared by ${who.join(" and ")}; an event has one owner.`
60895
+ }));
60896
+ }
60897
+ function allCommands(ir) {
60898
+ return ir.contexts.flatMap((c) => [...c.commands, ...c.sagas.flatMap((s) => s.commands ?? [])]);
60899
+ }
60900
+ function v41Declarations(commands) {
60901
+ return commands.flatMap((cmd) => (cmd.preconditions ?? []).flatMap((pre) => (pre.causes ?? []).filter((cause) => !(cmd.causes ?? []).includes(cause)).map((cause) => ({
60902
+ ruleId: "V41",
60903
+ message: `Precondition '${pre.name}' of command '${cmd.name}' names cause '${cause}', which the command does not declare.`
60904
+ }))));
60905
+ }
60906
+ function placementCauseFindings(flowName, entry, cmd) {
60907
+ if (entry.cause !== void 0) {
60908
+ return (cmd.causes ?? []).includes(entry.cause) ? [] : [
60909
+ {
60910
+ ruleId: "V41",
60911
+ message: `Flow '${flowName}' places '${cmd.name}' for cause '${entry.cause}', which the command does not declare.`
60912
+ }
60913
+ ];
60914
+ }
60915
+ const scoped = (cmd.preconditions ?? []).some((p) => (p.causes ?? []).length > 0);
60916
+ return (cmd.causes ?? []).length > 0 && scoped ? [
60917
+ {
60918
+ ruleId: "V42",
60919
+ message: `Flow '${flowName}' places '${cmd.name}' without a cause, but the command has cause-scoped preconditions.`
60920
+ }
60921
+ ] : [];
60922
+ }
60923
+ function v41v42Placements(ir, commands) {
60924
+ const byName = new Map(commands.map((c) => [c.name, c]));
60925
+ return (ir.flows ?? []).flatMap((flow) => flow.moments.flatMap((moment) => [...moment.contextEntries, ...(moment.branches ?? []).flatMap((b) => b.entries)].flatMap((entry) => {
60926
+ const cmd = byName.get(entry.nodeName);
60927
+ return cmd === void 0 ? [] : placementCauseFindings(flow.name, entry, cmd);
60928
+ })));
60929
+ }
60930
+ function sameMomentTrigger(conn, sameMoment, known) {
60931
+ const { sourceNodeName: cause, targetNodeName: node } = conn;
60932
+ if (conn.connectionType !== "triggered-by" || cause === void 0 || node === void 0)
60933
+ return [];
60934
+ if (!known.has(node) || !sameMoment.get(conn.sourceMomentId)?.has(cause))
60935
+ return [];
60936
+ return [{ cause, node, momentId: conn.sourceMomentId }];
60937
+ }
60938
+ function v43(ir) {
60939
+ const policies = ir.contexts.flatMap((c) => c.policies);
60940
+ const known = /* @__PURE__ */ new Set([
60941
+ ...policies.map((p) => p.name),
60942
+ ...ir.contexts.flatMap((c) => [
60943
+ ...c.commands.map((m) => m.name),
60944
+ ...c.events.map((e) => e.name),
60945
+ ...c.sagas.flatMap((s) => (s.commands ?? []).map((m) => m.name))
60946
+ ])
60947
+ ]);
60948
+ const declared = (t) => policies.some((p) => p.name === t.node && p.trigger === t.cause || p.name === t.cause && p.chainsTo === t.node || p.trigger === t.cause && p.chainsTo === t.node);
60949
+ return (ir.flows ?? []).flatMap((flow) => {
60950
+ const earlier = /* @__PURE__ */ new Set();
60951
+ const sameMoment = /* @__PURE__ */ new Map();
60952
+ for (const moment of flow.moments) {
60953
+ const names = [
60954
+ ...moment.contextEntries,
60955
+ ...(moment.branches ?? []).flatMap((b) => b.entries)
60956
+ ].map((e) => e.nodeName);
60957
+ sameMoment.set(moment.id, new Set(names.filter((n) => !earlier.has(n))));
60958
+ names.forEach((n) => earlier.add(n));
60959
+ }
60960
+ const momentNames = new Map(flow.moments.map((m) => [m.id, m.name]));
60961
+ return flow.connections.flatMap((conn) => sameMomentTrigger(conn, sameMoment, known)).filter((t) => !declared(t)).map((t) => ({
60962
+ ruleId: "V43",
60963
+ message: `Flow '${flow.name}' moment '${momentNames.get(t.momentId)}': '${t.node}' is triggered-by '${t.cause}' in the same moment, but no policy declares that hop.`
60964
+ }));
60965
+ });
60966
+ }
60529
60967
  function validatePaletteConformance(ir) {
60530
60968
  const known = namesOf2(ir);
60969
+ const commands = allCommands(ir);
60531
60970
  return [
60532
60971
  ...ir.contexts.flatMap((ctx) => [
60533
60972
  ...v29v30(ctx, known),
60534
60973
  ...ctx.sagas.flatMap((saga) => orchestrationFindings(saga, known)),
60535
60974
  ...v36(ctx),
60536
- ...v37(ctx, known)
60975
+ ...v37(ctx, known),
60976
+ ...v40(ctx)
60537
60977
  ]),
60978
+ ...v41Declarations(commands),
60979
+ ...v41v42Placements(ir, commands),
60980
+ ...v43(ir),
60538
60981
  ...(ir.externals ?? []).flatMap((e) => gatewayFindings(`external '${e.name}'`, e.gateways ?? [], known))
60539
60982
  ];
60540
60983
  }
@@ -60562,12 +61005,6 @@ function bindRelayEvents(contexts) {
60562
61005
  }
60563
61006
 
60564
61007
  // ../core/dist/parser/ast-to-ir.js
60565
- function unquote2(s) {
60566
- if (s.startsWith('"') && s.endsWith('"')) {
60567
- return s.slice(1, -1);
60568
- }
60569
- return s;
60570
- }
60571
61008
  function astToIr(file, metadata) {
60572
61009
  const contexts = bindRelayEvents(file.contexts.map(transformContext));
60573
61010
  const nodeKindMap = buildNodeKindMap(contexts);
@@ -60575,7 +61012,7 @@ function astToIr(file, metadata) {
60575
61012
  const externals = (file.externals ?? []).map((e) => ({
60576
61013
  id: `ext-${e.name}`,
60577
61014
  name: e.name,
60578
- description: unquote2(e.description),
61015
+ description: e.description,
60579
61016
  ...gatewaysOf(e.gateways ?? [])
60580
61017
  }));
60581
61018
  const externalNames = new Set(externals.map((e) => e.name));
@@ -60621,7 +61058,9 @@ function collectContextMember(member, annotations, out) {
60621
61058
  } else if (isPolicyDeclaration(member)) {
60622
61059
  out.policies.push(transformPolicy(member, annotations));
60623
61060
  } else if (isSagaDeclaration(member)) {
60624
- out.sagas.push(transformSaga(member, annotations));
61061
+ const sagaDef = transformSaga(member, annotations);
61062
+ out.sagas.push(sagaDef);
61063
+ out.events.push(...sagaDef.events ?? []);
60625
61064
  } else if (isProjectionDeclaration(member)) {
60626
61065
  out.projections.push(transformProjection(member));
60627
61066
  } else if (isQueryDeclaration(member)) {
@@ -60633,7 +61072,7 @@ function collectContextMember(member, annotations, out) {
60633
61072
  }
60634
61073
  }
60635
61074
  function transformContext(ctx) {
60636
- const name = unquote2(ctx.name);
61075
+ const name = ctx.name;
60637
61076
  const members = emptyContextMembers();
60638
61077
  let pendingAnnotations = [];
60639
61078
  for (const member of ctx.members) {
@@ -60648,7 +61087,7 @@ function transformContext(ctx) {
60648
61087
  id: `ctx-${name}`,
60649
61088
  name,
60650
61089
  classification: ctx.classification?.value,
60651
- description: ctx.description ? unquote2(ctx.description) : void 0,
61090
+ description: ctx.description ? ctx.description : void 0,
60652
61091
  aggregates: members.aggregates,
60653
61092
  domainServices: members.domainServices,
60654
61093
  commands: members.commands,
@@ -60667,7 +61106,7 @@ function transformProjection(proj) {
60667
61106
  id: `proj-${proj.name}`,
60668
61107
  name: proj.name,
60669
61108
  sources: [...proj.sources],
60670
- ...proj.description ? { description: unquote2(proj.description) } : {},
61109
+ ...proj.description ? { description: proj.description } : {},
60671
61110
  fields: proj.fields.map(transformFieldDeclaration),
60672
61111
  ...gatewaysOf(proj.gateways)
60673
61112
  };
@@ -60678,7 +61117,7 @@ function transformGateway(gw) {
60678
61117
  name: gw.name,
60679
61118
  consumes: gw.consumes,
60680
61119
  produces: gw.produces,
60681
- ...gw.description ? { description: unquote2(gw.description) } : {}
61120
+ ...gw.description ? { description: gw.description } : {}
60682
61121
  };
60683
61122
  }
60684
61123
  function gatewaysOf(gateways) {
@@ -60690,35 +61129,34 @@ function transformQuery(query) {
60690
61129
  name: query.name,
60691
61130
  reads: [...query.reads],
60692
61131
  inputs: query.inputs.map(transformFieldDeclaration),
60693
- ...query.description ? { description: unquote2(query.description) } : {}
61132
+ ...query.description ? { description: query.description } : {}
60694
61133
  };
60695
61134
  }
60696
61135
  function transformRule(rule) {
60697
61136
  return rule.enforcer ? {
60698
61137
  id: rule.id,
60699
- description: unquote2(rule.description),
61138
+ description: rule.description,
60700
61139
  enforcedBy: rule.enforcer,
60701
61140
  enforcerKind: "declared"
60702
61141
  } : {
60703
61142
  id: rule.id,
60704
- description: unquote2(rule.description),
60705
- enforcedBy: unquote2(rule.enforcerText ?? ""),
61143
+ description: rule.description,
61144
+ enforcedBy: rule.enforcerText ?? "",
60706
61145
  enforcerKind: "external"
60707
61146
  };
60708
61147
  }
60709
61148
  function extractGlossary(ctx) {
60710
- const context = unquote2(ctx.name);
60711
- return ctx.members.filter(isTermDeclaration).map((t) => ({ term: unquote2(t.term), definition: unquote2(t.definition), context }));
61149
+ const context = ctx.name;
61150
+ return ctx.members.filter(isTermDeclaration).map((t) => ({ term: t.term, definition: t.definition, context }));
60712
61151
  }
60713
61152
  function transformAnnotation(ann) {
60714
- const raw = ann.value;
60715
61153
  return {
60716
61154
  name: ann.name,
60717
- value: raw.startsWith('"') ? unquote2(raw) : raw
61155
+ value: ann.value
60718
61156
  };
60719
61157
  }
60720
61158
  function transformAggregate(agg, annotations) {
60721
- const name = unquote2(agg.name);
61159
+ const name = agg.name;
60722
61160
  const commands = [];
60723
61161
  const events = [];
60724
61162
  const valueObjects = [];
@@ -60734,7 +61172,7 @@ function transformAggregate(agg, annotations) {
60734
61172
  if (isCommandDeclaration(member)) {
60735
61173
  commands.push(transformCommand(member, memberAnnotations));
60736
61174
  } else if (isDomainEventDeclaration(member)) {
60737
- events.push(transformEvent(member, memberAnnotations));
61175
+ events.push(transformEvent(member, memberAnnotations, { kind: "aggregate", name }));
60738
61176
  } else if (isValueObjectDeclaration(member)) {
60739
61177
  valueObjects.push(transformValueObject(member, memberAnnotations));
60740
61178
  } else if (isInvariantDeclaration(member)) {
@@ -60770,6 +61208,7 @@ function transformCommand(cmd, annotations) {
60770
61208
  name: cmd.name,
60771
61209
  ...annotations ? { annotations } : {},
60772
61210
  inputs: cmd.inputs.map(transformFieldDeclaration),
61211
+ ...cmd.causes.length > 0 ? { causes: [...cmd.causes] } : {},
60773
61212
  preconditions: cmd.preconditions.map(transformPrecondition),
60774
61213
  emitsEvent: cmd.emits
60775
61214
  };
@@ -60777,13 +61216,15 @@ function transformCommand(cmd, annotations) {
60777
61216
  function transformPrecondition(pre) {
60778
61217
  return {
60779
61218
  name: pre.name,
60780
- description: unquote2(pre.description)
61219
+ description: pre.description,
61220
+ ...pre.causes.length > 0 ? { causes: [...pre.causes] } : {}
60781
61221
  };
60782
61222
  }
60783
- function transformEvent(evt, annotations) {
61223
+ function transformEvent(evt, annotations, owner) {
60784
61224
  return {
60785
61225
  id: `evt-${evt.name}`,
60786
61226
  name: evt.name,
61227
+ owner,
60787
61228
  ...annotations ? { annotations } : {},
60788
61229
  fields: evt.fields.map(transformFieldDeclaration)
60789
61230
  };
@@ -60805,8 +61246,8 @@ function transformFieldDeclaration(field) {
60805
61246
  };
60806
61247
  if ("deprecation" in field && field.deprecation) {
60807
61248
  result.deprecated = {
60808
- reason: unquote2(field.deprecation.reason),
60809
- replacement: unquote2(field.deprecation.replacement)
61249
+ reason: field.deprecation.reason,
61250
+ replacement: field.deprecation.replacement
60810
61251
  };
60811
61252
  }
60812
61253
  return result;
@@ -60814,7 +61255,7 @@ function transformFieldDeclaration(field) {
60814
61255
  function transformInvariant(inv, annotations) {
60815
61256
  return {
60816
61257
  id: inv.id,
60817
- description: unquote2(inv.description),
61258
+ description: inv.description,
60818
61259
  scope: inv.scope,
60819
61260
  ...annotations ? { annotations } : {}
60820
61261
  };
@@ -60826,7 +61267,7 @@ function transformService(svc, annotations) {
60826
61267
  ...annotations ? { annotations } : {},
60827
61268
  consumes: svc.consumes,
60828
61269
  produces: svc.produces,
60829
- description: unquote2(svc.description)
61270
+ description: svc.description
60830
61271
  };
60831
61272
  }
60832
61273
  function transformPolicy(pol, annotations) {
@@ -60835,7 +61276,7 @@ function transformPolicy(pol, annotations) {
60835
61276
  name: pol.name,
60836
61277
  ...annotations ? { annotations } : {},
60837
61278
  trigger: pol.trigger,
60838
- action: unquote2(pol.action),
61279
+ action: pol.action,
60839
61280
  chainsTo: pol.chainsTo,
60840
61281
  ...gatewaysOf(pol.gateways)
60841
61282
  };
@@ -60849,6 +61290,7 @@ function transformOrchestrationCommand(cmd) {
60849
61290
  id: `cmd-${cmd.name}`,
60850
61291
  name: cmd.name,
60851
61292
  inputs: cmd.inputs.map(transformFieldDeclaration),
61293
+ ...cmd.causes.length > 0 ? { causes: [...cmd.causes] } : {},
60852
61294
  preconditions: cmd.preconditions.map(transformPrecondition),
60853
61295
  ...cmd.emits ? { emitsEvent: cmd.emits } : {}
60854
61296
  };
@@ -60880,6 +61322,9 @@ function transformSaga(saga, annotations) {
60880
61322
  compensation: compensationText(compensations),
60881
61323
  timeout,
60882
61324
  commands: saga.commands.map(transformOrchestrationCommand),
61325
+ ...saga.events.length > 0 ? {
61326
+ events: saga.events.map((e) => transformEvent(e, void 0, { kind: "orchestration", name: saga.name }))
61327
+ } : {},
60883
61328
  issues: saga.issues.map(transformIssued),
60884
61329
  compensations,
60885
61330
  ...gatewaysOf(saga.gateways)
@@ -60888,7 +61333,7 @@ function transformSaga(saga, annotations) {
60888
61333
  function buildLaneContextMap(flow) {
60889
61334
  const map2 = /* @__PURE__ */ new Map();
60890
61335
  for (const lane of flow.lanes) {
60891
- map2.set(lane.id, `ctx-${unquote2(lane.label)}`);
61336
+ map2.set(lane.id, `ctx-${lane.label}`);
60892
61337
  }
60893
61338
  return map2;
60894
61339
  }
@@ -60933,11 +61378,11 @@ function buildNodeLaneMap(flow) {
60933
61378
  return map2;
60934
61379
  }
60935
61380
  function transformFlow(flow, nodeKindMap) {
60936
- const name = unquote2(flow.name);
61381
+ const name = flow.name;
60937
61382
  const laneContextMap = buildLaneContextMap(flow);
60938
61383
  const lanes = flow.lanes.map((lane) => ({
60939
61384
  id: lane.id,
60940
- label: unquote2(lane.label),
61385
+ label: lane.label,
60941
61386
  contextId: laneContextMap.get(lane.id) ?? lane.id,
60942
61387
  classification: lane.classification?.value,
60943
61388
  isBranch: lane.isBranch ?? false
@@ -60945,14 +61390,14 @@ function transformFlow(flow, nodeKindMap) {
60945
61390
  return {
60946
61391
  id: `flow-${name}`,
60947
61392
  name,
60948
- description: flow.description ? unquote2(flow.description) : void 0,
61393
+ description: flow.description ? flow.description : void 0,
60949
61394
  lanes,
60950
61395
  moments: flow.moments.map((moment, idx) => transformMoment(moment, idx, laneContextMap, nodeKindMap)),
60951
61396
  connections: extractConnections(flow, laneContextMap)
60952
61397
  };
60953
61398
  }
60954
61399
  function transformMoment(moment, index, laneContextMap, nodeKindMap) {
60955
- const name = unquote2(moment.label);
61400
+ const name = moment.label;
60956
61401
  const contextEntries = moment.nodes.map((n) => transformNodeToEntry(n, laneContextMap, nodeKindMap));
60957
61402
  const branches = moment.whenBlocks.length > 0 ? moment.whenBlocks.map((wb) => transformWhenBlock(wb, laneContextMap, nodeKindMap)) : void 0;
60958
61403
  const hasTerminal = contextEntries.some((e) => e.terminal === true) || (branches?.some((b) => b.entries.some((e) => e.terminal === true)) ?? false);
@@ -60963,11 +61408,19 @@ function transformMoment(moment, index, laneContextMap, nodeKindMap) {
60963
61408
  branches,
60964
61409
  terminal: hasTerminal || void 0,
60965
61410
  isBranch: moment.isBranch || void 0,
61411
+ ...momentNotes(moment),
60966
61412
  // Textual order of entries/branches from CST offsets (M-P13); falls back
60967
61413
  // to entries-then-branches when the AST carries no CST.
60968
61414
  sequence: buildMomentSequence(moment).sequence
60969
61415
  };
60970
61416
  }
61417
+ function momentNotes(moment) {
61418
+ const notes = (moment.notes ?? []).map((n) => ({
61419
+ text: n.text,
61420
+ ...n.laneId !== void 0 ? { laneId: n.laneId } : {}
61421
+ }));
61422
+ return notes.length > 0 ? { notes } : {};
61423
+ }
60971
61424
  function transformWhenBlock(when, laneContextMap, nodeKindMap) {
60972
61425
  return {
60973
61426
  condition: when.condition,
@@ -60993,6 +61446,9 @@ function transformNodeToEntry(node, laneContextMap, nodeKindMap) {
60993
61446
  if (multiplicity !== void 0) {
60994
61447
  entry.multiplicity = multiplicity;
60995
61448
  }
61449
+ if (node.cause !== void 0) {
61450
+ entry.cause = node.cause;
61451
+ }
60996
61452
  const modifierType = node.modifier?.type;
60997
61453
  if (modifierType === "optional") {
60998
61454
  entry.optional = true;
@@ -61012,12 +61468,12 @@ function extractConnections(flow, laneContextMap) {
61012
61468
  };
61013
61469
  const momentLabelToId = /* @__PURE__ */ new Map();
61014
61470
  for (let momentIdx = 0; momentIdx < flow.moments.length; momentIdx++) {
61015
- const label = unquote2(flow.moments[momentIdx].label);
61471
+ const label = flow.moments[momentIdx].label;
61016
61472
  momentLabelToId.set(label, `moment-${momentIdx}-${label.replace(/\s+/g, "-")}`);
61017
61473
  }
61018
61474
  for (let momentIdx = 0; momentIdx < flow.moments.length; momentIdx++) {
61019
61475
  const moment = flow.moments[momentIdx];
61020
- const momentId = `moment-${momentIdx}-${unquote2(moment.label).replace(/\s+/g, "-")}`;
61476
+ const momentId = `moment-${momentIdx}-${moment.label.replace(/\s+/g, "-")}`;
61021
61477
  const processNode = (node, branchCondition) => {
61022
61478
  const branchFields = branchCondition ? { branchCondition } : {};
61023
61479
  if (node.crossing) {
@@ -61057,7 +61513,7 @@ function extractConnections(flow, laneContextMap) {
61057
61513
  ...branchFields
61058
61514
  });
61059
61515
  } else if (isReturnsTo(conn)) {
61060
- const targetLabel = unquote2(conn.frameLabel);
61516
+ const targetLabel = conn.frameLabel;
61061
61517
  connections.push({
61062
61518
  id: `conn-${connectionCounter++}`,
61063
61519
  sourceMomentId: momentId,
@@ -61109,7 +61565,7 @@ function extractRelationships(ctx, externalNames = /* @__PURE__ */ new Set()) {
61109
61565
  sourceContextId: endId(rel.source, externalNames),
61110
61566
  targetContextId: endId(rel.target, externalNames),
61111
61567
  relationshipType: rel.type,
61112
- contract: unquote2(rel.contract)
61568
+ contract: rel.contract
61113
61569
  });
61114
61570
  }
61115
61571
  }
@@ -63095,7 +63551,7 @@ var SiftSpecificationImporter = class {
63095
63551
  generateContextFile(block2) {
63096
63552
  const lines = [];
63097
63553
  const classification = block2.classification ? ` [${block2.classification}]` : "";
63098
- lines.push(`context "${block2.contextName}"${classification}`);
63554
+ lines.push(`context "${escapeMomentString(block2.contextName)}"${classification}`);
63099
63555
  lines.push("");
63100
63556
  for (const agg of block2.aggregates) {
63101
63557
  this.renderAggregate(lines, agg);
@@ -63103,7 +63559,7 @@ var SiftSpecificationImporter = class {
63103
63559
  return lines.join("\n");
63104
63560
  }
63105
63561
  renderAggregate(lines, agg) {
63106
- lines.push(` aggregate "${agg.name}"`);
63562
+ lines.push(` aggregate "${escapeMomentString(agg.name)}"`);
63107
63563
  lines.push(` identity ${agg.identityField.name}: ${agg.identityField.type}`);
63108
63564
  lines.push("");
63109
63565
  for (const cmd of agg.commands) {
@@ -63132,18 +63588,18 @@ var SiftSpecificationImporter = class {
63132
63588
  }
63133
63589
  generateFlowFile(event) {
63134
63590
  const lines = [];
63135
- lines.push(`flow "${event.flowName}"`);
63591
+ lines.push(`flow "${escapeMomentString(event.flowName)}"`);
63136
63592
  if (event.description) {
63137
- lines.push(` description "${event.description}"`);
63593
+ lines.push(` description "${escapeMomentString(event.description)}"`);
63138
63594
  }
63139
63595
  lines.push("");
63140
63596
  for (const lane of event.lanes) {
63141
63597
  const classification = lane.classification ? ` [${lane.classification}]` : "";
63142
- lines.push(` lane ${lane.id} "${lane.label}"${classification}`);
63598
+ lines.push(` lane ${lane.id} "${escapeMomentString(lane.label)}"${classification}`);
63143
63599
  }
63144
63600
  lines.push("");
63145
63601
  for (const frame of event.frames) {
63146
- lines.push(` moment "${frame.label}"`);
63602
+ lines.push(` moment "${escapeMomentString(frame.label)}"`);
63147
63603
  for (const node of frame.nodes) {
63148
63604
  let nodeLine = ` ${node.laneId}: ${node.nodeName}`;
63149
63605
  if (node.crossing) {
@@ -63200,7 +63656,10 @@ function resolveAcrossFiles(ir) {
63200
63656
  ...(ctx.commands ?? []).map((c) => [c.name, "command"]),
63201
63657
  ...(ctx.events ?? []).map((e) => [e.name, "event"]),
63202
63658
  ...(ctx.policies ?? []).map((p) => [p.name, "policy"]),
63203
- ...(ctx.sagas ?? []).map((g) => [g.name, "saga"]),
63659
+ ...(ctx.sagas ?? []).flatMap((g) => [
63660
+ [g.name, "saga"],
63661
+ ...(g.commands ?? []).map((c) => [c.name, "command"])
63662
+ ]),
63204
63663
  ...(ctx.projections ?? []).map((p) => [p.name, "projection"]),
63205
63664
  ...(ctx.queries ?? []).map((q) => [q.name, "query"])
63206
63665
  ]));
@@ -63410,7 +63869,7 @@ function validateCrossFileReferences(ir) {
63410
63869
  }
63411
63870
 
63412
63871
  // ../core/dist/project/project-loader.js
63413
- var isCompletenessRule = (d) => /^V(2[2-9]|3[0-9])$/.test(d.ruleId ?? "");
63872
+ var isCompletenessRule = (d) => /^V(2[2-9]|3[0-9]|4[0-3])$/.test(d.ruleId ?? "");
63414
63873
  var ProjectLoader = class {
63415
63874
  parser;
63416
63875
  constructor(parser) {
@@ -63949,8 +64408,9 @@ function orderedMomentChildren(moment, fallback) {
63949
64408
  const entries = moment.contextEntries;
63950
64409
  const branches = moment.branches ?? [];
63951
64410
  const seq = moment.sequence;
63952
- if (seq && isUsableSequence(seq, entries.length, branches.length)) {
63953
- return seq.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index], entryIndex: item.index } : { kind: "branch", branch: branches[item.index], branchIndex: item.index });
64411
+ const walked = seq?.filter((item) => item.kind !== "note");
64412
+ if (walked && isUsableSequence(walked, entries.length, branches.length)) {
64413
+ return walked.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index], entryIndex: item.index } : { kind: "branch", branch: branches[item.index], branchIndex: item.index });
63954
64414
  }
63955
64415
  const entryChildren = entries.map((entry, i) => ({
63956
64416
  kind: "entry",
@@ -64237,7 +64697,8 @@ function entryToNode(entry, moment, momentIndex, laneIndex, scope, outcome) {
64237
64697
  momentName: moment.name,
64238
64698
  momentId: moment.id,
64239
64699
  momentIndex,
64240
- ...outcome !== void 0 ? { outcome } : {}
64700
+ ...outcome !== void 0 ? { outcome } : {},
64701
+ ...entry.cause !== void 0 ? { cause: entry.cause } : {}
64241
64702
  };
64242
64703
  }
64243
64704
  function generateEvents(nodes, flow, contextMap, sessionId, correlationId, baseTime) {
@@ -64449,7 +64910,7 @@ function findPreconditions(node, contextMap) {
64449
64910
  if (!ctx)
64450
64911
  return [];
64451
64912
  const cmd = findCommand(ctx, node.nodeName);
64452
- return cmd?.preconditions ?? [];
64913
+ return (cmd?.preconditions ?? []).filter((pre) => pre.causes === void 0 || pre.causes.length === 0 || node.cause !== void 0 && pre.causes.includes(node.cause));
64453
64914
  }
64454
64915
  function buildNegativeScenario(ir, flow, walk, failIndex, precondition, contextMap, opts, scenarioId) {
64455
64916
  const allNodes = walk.nodes;
@@ -64482,7 +64943,7 @@ function buildNegativeScenario(ir, flow, walk, failIndex, precondition, contextM
64482
64943
  kind: "negative",
64483
64944
  description: `Negative scenario: ${precondition.description} precondition violation at ${failNode.nodeName}`,
64484
64945
  given: `A ${(flow.moments[0]?.name ?? "").toLowerCase()} scenario is initiated`,
64485
- when: `${failNode.nodeName} is invoked without satisfying ${precondition.name}`,
64946
+ when: `${failNode.nodeName} is invoked${failNode.cause !== void 0 ? ` for ${failNode.cause}` : ""} without satisfying ${precondition.name}`,
64486
64947
  then: `The command ${failNode.nodeName} is rejected`,
64487
64948
  expectedPath: precedingNodes.map((n) => n.nodeId),
64488
64949
  activeBranches,
@@ -64504,7 +64965,8 @@ function buildFailureEvent(failNode, precondition, precedingEvents, opts) {
64504
64965
  payload: {
64505
64966
  nodeId: failNode.nodeId,
64506
64967
  failedPrecondition: precondition.name,
64507
- description: precondition.description
64968
+ description: precondition.description,
64969
+ ...failNode.cause !== void 0 ? { cause: failNode.cause } : {}
64508
64970
  }
64509
64971
  };
64510
64972
  }
@@ -64632,6 +65094,11 @@ function findCommand(ctx, name) {
64632
65094
  if (cmd)
64633
65095
  return cmd;
64634
65096
  }
65097
+ for (const saga of ctx.sagas) {
65098
+ const cmd = (saga.commands ?? []).find((c) => c.name === name);
65099
+ if (cmd)
65100
+ return cmd;
65101
+ }
64635
65102
  return void 0;
64636
65103
  }
64637
65104
  function findEvent(ctx, name) {
@@ -64708,6 +65175,13 @@ function generateEventCatalog(ir) {
64708
65175
  }
64709
65176
  }
64710
65177
  }
65178
+ for (const context of ir.contexts) {
65179
+ for (const saga of context.sagas) {
65180
+ for (const event of saga.events ?? []) {
65181
+ entries.push(buildProcessCatalogEntry(event, saga, context, ir));
65182
+ }
65183
+ }
65184
+ }
64711
65185
  addFlowFallbackEntries(ir, entries);
64712
65186
  return {
64713
65187
  events: entries,
@@ -64818,6 +65292,29 @@ function buildCatalogEntry(event, aggregate, context, ir) {
64818
65292
  temporalLocation
64819
65293
  };
64820
65294
  }
65295
+ function buildProcessCatalogEntry(event, saga, context, ir) {
65296
+ const command2 = (saga.commands ?? []).find((c) => c.emitsEvent === event.name);
65297
+ return {
65298
+ eventName: event.name,
65299
+ kind: "event",
65300
+ schema: {
65301
+ fields: event.fields.map((f) => ({
65302
+ name: f.name,
65303
+ type: f.type,
65304
+ isArray: f.isArray,
65305
+ deprecated: f.deprecated
65306
+ }))
65307
+ },
65308
+ producer: {
65309
+ context: context.name,
65310
+ aggregate: "",
65311
+ process: saga.name,
65312
+ command: command2?.name ?? ""
65313
+ },
65314
+ consumers: findConsumers(event, ir),
65315
+ temporalLocation: findTemporalLocation(event, ir)
65316
+ };
65317
+ }
64821
65318
  function findProducerCommand(event, aggregate, context) {
64822
65319
  const command2 = aggregate.commands.find((c) => c.emitsEvent === event.name);
64823
65320
  return {
@@ -64890,7 +65387,8 @@ function generateImpactAnalysis(ir) {
64890
65387
  name: n.name,
64891
65388
  context: n.context,
64892
65389
  dependsOn: [...n.dependsOn],
64893
- triggers: [...n.triggers]
65390
+ triggers: [...n.triggers],
65391
+ ...n.owner !== void 0 ? { owner: n.owner } : {}
64894
65392
  }));
64895
65393
  return {
64896
65394
  nodes,
@@ -64920,6 +65418,16 @@ function addCommandNodes(context, nodeMap) {
64920
65418
  }
64921
65419
  }
64922
65420
  }
65421
+ for (const saga of context.sagas) {
65422
+ for (const cmd of saga.commands ?? []) {
65423
+ if (!cmd.emitsEvent)
65424
+ continue;
65425
+ const cmdNode = getOrCreate(nodeMap, "command", cmd.name, context.name);
65426
+ const evtNode = getOrCreate(nodeMap, "event", cmd.emitsEvent, context.name);
65427
+ cmdNode.triggers.push(nodeKey("event", cmd.emitsEvent, context.name));
65428
+ evtNode.dependsOn.push(nodeKey("command", cmd.name, context.name));
65429
+ }
65430
+ }
64923
65431
  }
64924
65432
  function addEventNodes(context, nodeMap) {
64925
65433
  for (const agg of context.aggregates) {
@@ -64927,6 +65435,11 @@ function addEventNodes(context, nodeMap) {
64927
65435
  getOrCreate(nodeMap, "event", event.name, context.name);
64928
65436
  }
64929
65437
  }
65438
+ for (const saga of context.sagas) {
65439
+ for (const event of saga.events ?? []) {
65440
+ getOrCreate(nodeMap, "event", event.name, context.name).owner = saga.name;
65441
+ }
65442
+ }
64930
65443
  }
64931
65444
  function findDeclaringContextForEvent(eventName, ir) {
64932
65445
  for (const ctx of ir.contexts) {
@@ -65240,7 +65753,13 @@ function buildFrames(flow, ctxMap, laneIndex) {
65240
65753
  id: moment.id,
65241
65754
  moment: moment.name,
65242
65755
  isBranch: (moment.branches ?? []).length > 0,
65243
- nodes: buildFrameNodes(moment, ctxMap, laneIndex)
65756
+ nodes: buildFrameNodes(moment, ctxMap, laneIndex),
65757
+ ...(moment.notes ?? []).length > 0 ? {
65758
+ notes: (moment.notes ?? []).map((n) => ({
65759
+ text: n.text,
65760
+ ...n.laneId !== void 0 ? { lane: n.laneId } : {}
65761
+ }))
65762
+ } : {}
65244
65763
  }));
65245
65764
  }
65246
65765
  function buildFrameNodes(moment, ctxMap, laneIndex) {
@@ -65268,6 +65787,8 @@ function entryToNode2(entry, moment, ctxMap, laneIndex, scope) {
65268
65787
  label: entry.nodeName,
65269
65788
  type: nodeKind,
65270
65789
  aggregate: aggregate ?? void 0,
65790
+ process: aggregate === null ? findProcess(entry.nodeName, ctx) ?? void 0 : void 0,
65791
+ cause: entry.cause,
65271
65792
  optional: entry.optional ?? void 0,
65272
65793
  terminal: entry.terminal ?? void 0,
65273
65794
  multiplicity: entry.multiplicity != null ? String(entry.multiplicity) : void 0,
@@ -65277,7 +65798,7 @@ function entryToNode2(entry, moment, ctxMap, laneIndex, scope) {
65277
65798
  function resolveNodeKind2(entry, ctx) {
65278
65799
  if (!ctx)
65279
65800
  return entry.nodeKind;
65280
- const isCmd = ctx.commands.some((c) => c.name === entry.nodeName) || ctx.aggregates.some((a) => a.commands.some((c) => c.name === entry.nodeName));
65801
+ const isCmd = ctx.commands.some((c) => c.name === entry.nodeName) || ctx.aggregates.some((a) => a.commands.some((c) => c.name === entry.nodeName)) || (ctx.sagas ?? []).some((g) => (g.commands ?? []).some((c) => c.name === entry.nodeName));
65281
65802
  if (isCmd)
65282
65803
  return "command";
65283
65804
  const isEvt = ctx.events.some((e) => e.name === entry.nodeName) || ctx.aggregates.some((a) => a.events.some((e) => e.name === entry.nodeName));
@@ -65296,6 +65817,15 @@ function findAggregate(nodeName, ctx) {
65296
65817
  }
65297
65818
  return null;
65298
65819
  }
65820
+ function findProcess(nodeName, ctx) {
65821
+ for (const saga of ctx?.sagas ?? []) {
65822
+ if ((saga.events ?? []).some((e) => e.name === nodeName))
65823
+ return saga.name;
65824
+ if ((saga.commands ?? []).some((c) => c.name === nodeName))
65825
+ return saga.name;
65826
+ }
65827
+ return null;
65828
+ }
65299
65829
  function buildConnections(flow) {
65300
65830
  return flow.connections.map((conn) => {
65301
65831
  const eventType = conn.eventId.replace(/^evt-/, "");
@@ -65375,6 +65905,11 @@ function buildEventRouting(flow, ctxMap, laneIndex) {
65375
65905
  existing.add(nodeId);
65376
65906
  routing[entry.nodeName] = existing;
65377
65907
  }
65908
+ if (kind === "policy") {
65909
+ const existing = routing[entry.nodeName] ?? /* @__PURE__ */ new Set();
65910
+ existing.add(nodeId);
65911
+ routing[entry.nodeName] = existing;
65912
+ }
65378
65913
  if (kind === "command") {
65379
65914
  const key = `SimProcess.${entry.nodeName}`;
65380
65915
  const existing = routing[key] ?? /* @__PURE__ */ new Set();
@@ -65516,24 +66051,32 @@ function renderMomentsByContext(lines, flow, ir, ctxMap) {
65516
66051
  const sharedPreconditions = extractSharedPreconditions(moments, ctxMap);
65517
66052
  renderBackgroundBlock(lines, sharedPreconditions);
65518
66053
  for (const moment of moments) {
65519
- if (moment.branches && moment.branches.length > 0) {
65520
- for (const branch of moment.branches) {
65521
- renderBranchScenario(lines, moment, branch.condition, branch.entries, flow, ctxMap, ir, sharedPreconditions);
65522
- }
65523
- } else {
65524
- renderScenario(lines, moment, moment.contextEntries, flow, ctxMap, ir, void 0, sharedPreconditions);
65525
- }
66054
+ renderMoment(lines, moment, flow, ctxMap, ir, sharedPreconditions);
65526
66055
  }
65527
66056
  renderSagaScenarios(lines, ctxId, ir, ownedSagaIds);
65528
66057
  }
65529
66058
  renderOrphanOwnedSagas(lines, ir, contextGroups, ownedSagaIds);
65530
66059
  }
66060
+ function renderMoment(lines, moment, flow, ctxMap, ir, sharedPreconditions) {
66061
+ if (isNoteOnly(moment)) {
66062
+ renderNoteOnlyMoment(lines, moment, flow);
66063
+ return;
66064
+ }
66065
+ if (moment.branches && moment.branches.length > 0) {
66066
+ for (const branch of moment.branches) {
66067
+ renderBranchScenario(lines, moment, branch.condition, branch.entries, flow, ctxMap, ir, sharedPreconditions);
66068
+ }
66069
+ return;
66070
+ }
66071
+ renderScenario(lines, moment, moment.contextEntries, flow, ctxMap, ir, void 0, sharedPreconditions);
66072
+ }
65531
66073
  function renderScenario(lines, moment, entries, flow, ctxMap, ir, variant, sharedPreconditions = /* @__PURE__ */ new Set()) {
65532
66074
  const label = variant ? `${moment.name} [${variant}]` : moment.name;
65533
66075
  const tags = buildScenarioTags(entries, moment, void 0, flow, ctxMap, ir);
65534
66076
  if (tags.length > 0)
65535
66077
  lines.push(` ${tags.join(" ")}`);
65536
66078
  lines.push(` Scenario: ${label}`);
66079
+ lines.push(...noteComments(moment, flow, " "));
65537
66080
  const steps = [];
65538
66081
  const usedConnections = /* @__PURE__ */ new Set();
65539
66082
  for (const entry of orderedMainEntries(moment)) {
@@ -65557,6 +66100,7 @@ function renderBranchScenario(lines, moment, condition, branchEntries, flow, ctx
65557
66100
  if (tags.length > 0)
65558
66101
  lines.push(` ${tags.join(" ")}`);
65559
66102
  lines.push(` Scenario: ${moment.name} [${condition}]`);
66103
+ lines.push(...noteComments(moment, flow, " "));
65560
66104
  const steps = buildBranchScenarioSteps(moment, condition, branchEntries, flow, ctxMap, sharedPreconditions);
65561
66105
  if (returnsTo) {
65562
66106
  const targetLabel = resolveReturnsToLabel(returnsTo, flow);
@@ -65581,10 +66125,25 @@ function buildBranchScenarioSteps(moment, condition, branchEntries, flow, ctxMap
65581
66125
  }
65582
66126
  return steps;
65583
66127
  }
66128
+ function isNoteOnly(moment) {
66129
+ return moment.contextEntries.length === 0 && (moment.branches ?? []).length === 0 && (moment.notes ?? []).length > 0;
66130
+ }
66131
+ function noteComments(moment, flow, indent) {
66132
+ return (moment.notes ?? []).map((note) => {
66133
+ const label = flow.lanes.find((l) => l.id === note.laneId)?.label ?? note.laneId;
66134
+ return `${indent}# note${label !== void 0 ? ` (${label})` : ""}: ${note.text}`;
66135
+ });
66136
+ }
66137
+ function renderNoteOnlyMoment(lines, moment, flow) {
66138
+ lines.push(` # moment: ${moment.name}`);
66139
+ lines.push(...noteComments(moment, flow, " "));
66140
+ lines.push("");
66141
+ }
65584
66142
  function renderTerminalBranchScenario(lines, moment, condition, branchEntries, flow, ctxMap, ir) {
65585
66143
  const tags = ["@terminal", "@failure-path"];
65586
66144
  lines.push(` ${tags.join(" ")}`);
65587
66145
  lines.push(` Scenario: ${moment.name} [${condition}]`);
66146
+ lines.push(...noteComments(moment, flow, " "));
65588
66147
  const failedPrecondition = findFailedPrecondition(moment, ctxMap);
65589
66148
  lines.push(` Given the ${moment.name.toLowerCase()} is evaluated`);
65590
66149
  if (failedPrecondition) {
@@ -65879,8 +66438,9 @@ function orderedMomentChildren2(moment) {
65879
66438
  const entries = moment.contextEntries;
65880
66439
  const branches = moment.branches ?? [];
65881
66440
  const seq = moment.sequence;
65882
- if (seq && isUsableSequence2(seq, entries.length, branches.length)) {
65883
- return seq.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index] } : { kind: "branch", branch: branches[item.index] });
66441
+ const walked = seq?.filter((item) => item.kind !== "note");
66442
+ if (walked && isUsableSequence2(walked, entries.length, branches.length)) {
66443
+ return walked.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index] } : { kind: "branch", branch: branches[item.index] });
65884
66444
  }
65885
66445
  return [
65886
66446
  ...entries.map((entry) => ({ kind: "entry", entry })),
@@ -65998,10 +66558,20 @@ function collectFlowContextIds(flow) {
65998
66558
  }
65999
66559
  return [...ids];
66000
66560
  }
66561
+ function primaryContextOf(moment, flow, previous) {
66562
+ const firstNode = moment.contextEntries[0] ?? moment.branches?.[0]?.entries[0];
66563
+ return firstNode?.contextId ?? noteLaneContext(moment, flow) ?? previous ?? "unknown";
66564
+ }
66565
+ function noteLaneContext(moment, flow) {
66566
+ const laneId = (moment.notes ?? []).find((n) => n.laneId !== void 0)?.laneId;
66567
+ return flow.lanes.find((l) => l.id === laneId)?.contextId;
66568
+ }
66001
66569
  function groupMomentsByContext(flow) {
66002
66570
  const groups = /* @__PURE__ */ new Map();
66571
+ let previous;
66003
66572
  for (const moment of flow.moments) {
66004
- const primaryCtx = moment.contextEntries[0]?.contextId ?? moment.branches?.[0]?.entries?.[0]?.contextId ?? "unknown";
66573
+ const primaryCtx = primaryContextOf(moment, flow, previous);
66574
+ previous = primaryCtx;
66005
66575
  const existing = groups.get(primaryCtx) ?? [];
66006
66576
  existing.push(moment);
66007
66577
  groups.set(primaryCtx, existing);
@@ -66159,10 +66729,18 @@ var SpecificationDocumentGenerator = class {
66159
66729
  for (const entry of moment.contextEntries) {
66160
66730
  this.renderEntryNarrative(lines, entry, moment, void 0, flow, ir, " ", usedConnections);
66161
66731
  }
66732
+ this.renderMomentNotes(lines, moment, flow);
66162
66733
  this.renderMomentBranches(lines, moment, flow, ir);
66163
66734
  this.renderMomentPoliciesAndRules(lines, moment, ir);
66164
66735
  lines.push("");
66165
66736
  }
66737
+ /** Notes (ADR-040 D3) are narrated as steps of their moment; they are not nodes. */
66738
+ renderMomentNotes(lines, moment, flow) {
66739
+ for (const note of moment.notes ?? []) {
66740
+ const label = flow.lanes.find((l) => l.id === note.laneId)?.label ?? note.laneId;
66741
+ lines.push(` - *note${label !== void 0 ? ` (${label})` : ""}:* ${note.text}`);
66742
+ }
66743
+ }
66166
66744
  renderMomentHeader(lines, moment, step, flow, ir) {
66167
66745
  const ctxLabel = this.buildContextLabel(moment, ir);
66168
66746
  const sagaLabel = this.findSagaStateForMoment(moment, step, flow, ir);
@@ -67175,6 +67753,19 @@ function generateAggregateFile(aggregate) {
67175
67753
  parts.push("");
67176
67754
  return parts.join("\n");
67177
67755
  }
67756
+ function processSagas(context) {
67757
+ return context.sagas.filter((s) => (s.events ?? []).length > 0);
67758
+ }
67759
+ function generateProcessTypesFile(saga) {
67760
+ const parts = [
67761
+ generateJsDoc(`Events the ${saga.name} process records.`, "").trimEnd(),
67762
+ ""
67763
+ ];
67764
+ for (const event of saga.events ?? []) {
67765
+ parts.push(generateEventInterface(event));
67766
+ }
67767
+ return parts.join("\n");
67768
+ }
67178
67769
  function generateEventUnionType(context) {
67179
67770
  const eventNames = [];
67180
67771
  for (const aggregate of context.aggregates) {
@@ -67182,6 +67773,11 @@ function generateEventUnionType(context) {
67182
67773
  eventNames.push(toPascalCase(event.name));
67183
67774
  }
67184
67775
  }
67776
+ for (const saga of processSagas(context)) {
67777
+ for (const event of saga.events ?? []) {
67778
+ eventNames.push(toPascalCase(event.name));
67779
+ }
67780
+ }
67185
67781
  if (eventNames.length === 0) {
67186
67782
  return "";
67187
67783
  }
@@ -67232,6 +67828,9 @@ function generateContextIndexFile(context) {
67232
67828
  parts.push(`export * from './${kebabName}.types.js';`);
67233
67829
  parts.push(`export * from './${kebabName}.aggregate.js';`);
67234
67830
  }
67831
+ for (const saga of processSagas(context)) {
67832
+ parts.push(`export * from './${toKebabCase2(saga.name)}.process.types.js';`);
67833
+ }
67235
67834
  if (eventImports.length > 0) {
67236
67835
  parts.push("");
67237
67836
  for (const imp of eventImports) {
@@ -67253,6 +67852,10 @@ function collectEventImports(context) {
67253
67852
  imports.push({ module: `${toKebabCase2(aggregate.name)}.types.js`, names });
67254
67853
  }
67255
67854
  }
67855
+ for (const saga of processSagas(context)) {
67856
+ const names = (saga.events ?? []).map((e) => toPascalCase(e.name));
67857
+ imports.push({ module: `${toKebabCase2(saga.name)}.process.types.js`, names });
67858
+ }
67256
67859
  return imports;
67257
67860
  }
67258
67861
  function shouldIncludeContext(context, scope) {
@@ -67289,9 +67892,13 @@ function emitContext(context, scope, files, filesWritten) {
67289
67892
  const readSide = scope.level !== "aggregate" && hasReadSide(context);
67290
67893
  if (readSide)
67291
67894
  write(`${contextDir}/read-model.types.ts`, generateReadModelFile(context));
67292
- if (aggregates.length === 0 && !readSide)
67895
+ const sagas = scope.level !== "aggregate" ? processSagas(context) : [];
67896
+ for (const saga of sagas) {
67897
+ write(`${contextDir}/${toKebabCase2(saga.name)}.process.types.ts`, generateProcessTypesFile(saga));
67898
+ }
67899
+ if (aggregates.length === 0 && !readSide && sagas.length === 0)
67293
67900
  return void 0;
67294
- write(`${contextDir}/index.ts`, generateContextIndexFile({ ...context, aggregates }));
67901
+ write(`${contextDir}/index.ts`, generateContextIndexFile({ ...context, aggregates, sagas }));
67295
67902
  return dir;
67296
67903
  }
67297
67904
  var TypeScriptEmitter = class {
@@ -68146,7 +68753,7 @@ function parseServeArgs(argv) {
68146
68753
  positionals[0]
68147
68754
  );
68148
68755
  if ("success" in target) return target;
68149
- const rawPort = values.port ?? "4321";
68756
+ const rawPort = values.port === void 0 ? "4321" : String(values.port);
68150
68757
  const port = parseInt(rawPort, 10);
68151
68758
  if (!Number.isInteger(port) || port < 1 || port > 65535) {
68152
68759
  return { success: false, message: `Error: Invalid port "${rawPort}". Expected 1-65535.` };
@@ -68668,23 +69275,56 @@ function renderTimeline(ir) {
68668
69275
  dimensions: computeDimensions(entries, lanes)
68669
69276
  };
68670
69277
  }
69278
+ function laneOfMoment(moment, flow, laneIndex, previous) {
69279
+ const first2 = moment.contextEntries[0];
69280
+ if (first2)
69281
+ return laneIndex.get(first2.contextId);
69282
+ const noteLaneId = (moment.notes ?? []).find((n) => n.laneId !== void 0)?.laneId;
69283
+ const noteLane = flow.lanes.find((l) => l.id === noteLaneId);
69284
+ return (noteLane ? laneIndex.get(noteLane.contextId) : void 0) ?? previous;
69285
+ }
69286
+ function namesOfMoment(moment) {
69287
+ return [
69288
+ ...moment.contextEntries.map((e) => e.nodeName),
69289
+ ...(moment.branches ?? []).flatMap((b) => b.entries.map((e) => e.nodeName))
69290
+ ];
69291
+ }
69292
+ function momentDetails(moment, flow, earlier) {
69293
+ const here = new Set(namesOfMoment(moment).filter((n) => !earlier.has(n)));
69294
+ const hops = flow.connections.filter((c) => c.connectionType === "triggered-by" && c.sourceMomentId === moment.id && c.sourceNodeName !== void 0 && c.targetNodeName !== void 0 && here.has(c.sourceNodeName)).map((c) => ({ from: c.sourceNodeName ?? "", to: c.targetNodeName ?? "" }));
69295
+ const causes = [
69296
+ ...moment.contextEntries,
69297
+ ...(moment.branches ?? []).flatMap((b) => b.entries)
69298
+ ].flatMap((e) => e.cause !== void 0 ? [{ nodeName: e.nodeName, cause: e.cause }] : []);
69299
+ const notes = (moment.notes ?? []).map((n) => ({
69300
+ text: n.text,
69301
+ ...n.laneId !== void 0 ? { laneId: n.laneId } : {}
69302
+ }));
69303
+ return {
69304
+ ...notes.length > 0 ? { notes } : {},
69305
+ ...hops.length > 0 ? { hops } : {},
69306
+ ...causes.length > 0 ? { causes } : {}
69307
+ };
69308
+ }
68671
69309
  function processFlow(flow, ir, laneIndex, entries, connections, xOffset) {
69310
+ const earlier = /* @__PURE__ */ new Set();
69311
+ let previous;
68672
69312
  for (const moment of flow.moments) {
68673
- const firstEntry = moment.contextEntries[0];
68674
- if (firstEntry) {
68675
- const lane = laneIndex.get(firstEntry.contextId);
68676
- if (lane) {
68677
- entries.push({
68678
- momentId: moment.id,
68679
- momentName: moment.name,
68680
- contextId: firstEntry.contextId,
68681
- x: xOffset,
68682
- y: lane.y + LANE_PADDING,
68683
- width: ENTRY_WIDTH,
68684
- height: ENTRY_HEIGHT
68685
- });
68686
- }
69313
+ const lane = laneOfMoment(moment, flow, laneIndex, previous);
69314
+ if (lane) {
69315
+ previous = lane;
69316
+ entries.push({
69317
+ momentId: moment.id,
69318
+ momentName: moment.name,
69319
+ contextId: lane.contextId,
69320
+ x: xOffset,
69321
+ y: lane.y + LANE_PADDING,
69322
+ width: ENTRY_WIDTH,
69323
+ height: ENTRY_HEIGHT,
69324
+ ...momentDetails(moment, flow, earlier)
69325
+ });
68687
69326
  }
69327
+ namesOfMoment(moment).forEach((n) => earlier.add(n));
68688
69328
  xOffset += ENTRY_SPACING;
68689
69329
  }
68690
69330
  for (const conn of flow.connections) {
@@ -71585,7 +72225,12 @@ async function runImportFromSift(argv) {
71585
72225
  if (!domainDir) return fail13("Usage: moment import --from-sift <.domain/ directory>");
71586
72226
  const resolvedDir = resolve22(domainDir);
71587
72227
  if (!existsSync22(resolvedDir)) return fail13(`Error: Directory not found: ${resolvedDir}`);
71588
- return executeImport(resolvedDir, values["output-dir"], values.json === true);
72228
+ const outputDir = values["output-dir"];
72229
+ return executeImport(
72230
+ resolvedDir,
72231
+ typeof outputDir === "string" ? outputDir : void 0,
72232
+ values.json === true
72233
+ );
71589
72234
  }
71590
72235
  function executeImport(domainDir, outputDir, asJson) {
71591
72236
  const reader = new SiftEventStreamReader();
@@ -71746,7 +72391,11 @@ async function runStatus(argv) {
71746
72391
  }
71747
72392
  sections.push(buildUpstreamSection(resolvedPath));
71748
72393
  const hasDrift = sections.some((s) => s.state === "drift" || s.state === "error");
71749
- return formatOutput(sections, hasDrift, values);
72394
+ return formatOutput(sections, hasDrift, {
72395
+ verbose: Boolean(values.verbose),
72396
+ quiet: Boolean(values.quiet),
72397
+ json: Boolean(values.json)
72398
+ });
71750
72399
  }
71751
72400
  function buildParseSection(parseResult) {
71752
72401
  if (parseResult.success) {
@@ -71885,14 +72534,15 @@ async function runReconcile(argv) {
71885
72534
  allowPositionals: true,
71886
72535
  strict: false
71887
72536
  });
71888
- const validation = validateArgs(values, positionals);
72537
+ const event = typeof values.event === "string" ? values.event : void 0;
72538
+ const validation = validateArgs({ local: Boolean(values.local), event }, positionals);
71889
72539
  if (validation) return validation;
71890
72540
  const resolvedPath = resolve24(positionals[0]);
71891
72541
  const parsed = await parseSpec(resolvedPath);
71892
72542
  if (!("ir" in parsed)) return parsed;
71893
72543
  const asJson = values.json === true;
71894
- if (values.event) {
71895
- return reconcileFromEvent(parsed.ir, resolvedPath, values.event, asJson);
72544
+ if (event) {
72545
+ return reconcileFromEvent(parsed.ir, resolvedPath, event, asJson);
71896
72546
  }
71897
72547
  return reconcileLocal(parsed.ir, resolvedPath, asJson);
71898
72548
  }