@orcalang/orca-lang 0.1.18 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/compiler/dt-compiler.d.ts +26 -0
  2. package/dist/compiler/dt-compiler.d.ts.map +1 -0
  3. package/dist/compiler/dt-compiler.js +387 -0
  4. package/dist/compiler/dt-compiler.js.map +1 -0
  5. package/dist/health-check.d.ts +3 -0
  6. package/dist/health-check.d.ts.map +1 -0
  7. package/dist/health-check.js +235 -0
  8. package/dist/health-check.js.map +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +5 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/parser/ast-to-markdown.d.ts.map +1 -1
  13. package/dist/parser/ast-to-markdown.js +3 -1
  14. package/dist/parser/ast-to-markdown.js.map +1 -1
  15. package/dist/parser/ast.d.ts +3 -0
  16. package/dist/parser/ast.d.ts.map +1 -1
  17. package/dist/parser/dt-ast.d.ts +43 -0
  18. package/dist/parser/dt-ast.d.ts.map +1 -0
  19. package/dist/parser/dt-ast.js +3 -0
  20. package/dist/parser/dt-ast.js.map +1 -0
  21. package/dist/parser/dt-parser.d.ts +40 -0
  22. package/dist/parser/dt-parser.d.ts.map +1 -0
  23. package/dist/parser/dt-parser.js +240 -0
  24. package/dist/parser/dt-parser.js.map +1 -0
  25. package/dist/parser/markdown-parser.d.ts.map +1 -1
  26. package/dist/parser/markdown-parser.js +43 -8
  27. package/dist/parser/markdown-parser.js.map +1 -1
  28. package/dist/skills.d.ts +50 -1
  29. package/dist/skills.d.ts.map +1 -1
  30. package/dist/skills.js +508 -21
  31. package/dist/skills.js.map +1 -1
  32. package/dist/tools.d.ts.map +1 -1
  33. package/dist/tools.js +49 -0
  34. package/dist/tools.js.map +1 -1
  35. package/dist/verifier/dt-verifier.d.ts +32 -0
  36. package/dist/verifier/dt-verifier.d.ts.map +1 -0
  37. package/dist/verifier/dt-verifier.js +830 -0
  38. package/dist/verifier/dt-verifier.js.map +1 -0
  39. package/dist/verifier/properties.d.ts +4 -0
  40. package/dist/verifier/properties.d.ts.map +1 -1
  41. package/dist/verifier/properties.js +56 -20
  42. package/dist/verifier/properties.js.map +1 -1
  43. package/dist/verifier/structural.d.ts.map +1 -1
  44. package/dist/verifier/structural.js +6 -1
  45. package/dist/verifier/structural.js.map +1 -1
  46. package/dist/verifier/types.d.ts +4 -0
  47. package/dist/verifier/types.d.ts.map +1 -1
  48. package/package.json +3 -2
  49. package/src/compiler/dt-compiler.ts +454 -0
  50. package/src/health-check.ts +273 -0
  51. package/src/index.ts +5 -1
  52. package/src/parser/ast-to-markdown.ts +2 -1
  53. package/src/parser/ast.ts +4 -0
  54. package/src/parser/dt-ast.ts +40 -0
  55. package/src/parser/dt-parser.ts +289 -0
  56. package/src/parser/markdown-parser.ts +43 -8
  57. package/src/skills.ts +591 -22
  58. package/src/tools.ts +53 -0
  59. package/src/verifier/dt-verifier.ts +928 -0
  60. package/src/verifier/properties.ts +78 -23
  61. package/src/verifier/structural.ts +5 -1
  62. package/src/verifier/types.ts +4 -0
@@ -10,6 +10,8 @@ import {
10
10
  ReachabilityProperty, PassesThroughProperty, RespondsProperty,
11
11
  InvariantProperty, InvokeDef,
12
12
  } from './ast.js';
13
+ import { DecisionTableDef } from './dt-ast.js';
14
+ import { parseDecisionTable } from './dt-parser.js';
13
15
 
14
16
  // ============================================================
15
17
  // Phase 1: Structural Markdown Parsing
@@ -389,6 +391,7 @@ interface StateEntry {
389
391
  invoke?: InvokeDef;
390
392
  _pendingOnError?: string; // temp: on_error parsed before invoke
391
393
  ignoredEvents?: string[];
394
+ ignoredAll?: boolean;
392
395
  line: number;
393
396
  }
394
397
 
@@ -429,9 +432,14 @@ function parseStateBullet(entry: StateEntry, text: string): void {
429
432
  entry.timeout = { duration: rest.slice(0, arrowIdx).trim(), target: rest.slice(arrowIdx + 2).trim() };
430
433
  }
431
434
  } else if (text.startsWith('ignore:')) {
432
- const names = text.slice(7).trim().split(',').map(e => e.trim()).filter(Boolean);
433
- if (!entry.ignoredEvents) entry.ignoredEvents = [];
434
- entry.ignoredEvents.push(...names);
435
+ const val = text.slice(7).trim();
436
+ if (val === '*') {
437
+ entry.ignoredAll = true;
438
+ } else {
439
+ const names = val.split(',').map(e => e.trim()).filter(Boolean);
440
+ if (!entry.ignoredEvents) entry.ignoredEvents = [];
441
+ entry.ignoredEvents.push(...names);
442
+ }
435
443
  } else if (text.startsWith('on_done:')) {
436
444
  let val = text.slice(8).trim();
437
445
  if (val.startsWith('->')) val = val.slice(2).trim();
@@ -628,6 +636,7 @@ function buildStatesAtLevel(
628
636
  if (entry.onDone) state.onDone = entry.onDone;
629
637
  if (entry.timeout) state.timeout = entry.timeout;
630
638
  if (entry.ignoredEvents?.length) state.ignoredEvents = entry.ignoredEvents;
639
+ if (entry.ignoredAll) state.ignoredAll = true;
631
640
  if (entry.invoke) state.invoke = entry.invoke;
632
641
 
633
642
  i++;
@@ -676,6 +685,7 @@ function buildParallelRegions(
676
685
  if (e.onDone) s.onDone = e.onDone;
677
686
  if (e.timeout) s.timeout = e.timeout;
678
687
  if (e.ignoredEvents?.length) s.ignoredEvents = e.ignoredEvents;
688
+ if (e.ignoredAll) s.ignoredAll = true;
679
689
  if (e.invoke) s.invoke = e.invoke;
680
690
  regionStates.push(s);
681
691
  i++;
@@ -790,7 +800,7 @@ function parseMachineFromElements(elements: MdElement[]): MachineDef {
790
800
  return machine;
791
801
  }
792
802
 
793
- function parseMarkdownSemantic(elements: MdElement[]): MachineDef[] {
803
+ function parseMarkdownSemantic(elements: MdElement[]): { machines: MachineDef[]; decisionTables: DecisionTableDef[] } {
794
804
  // Split elements by --- separators for multi-machine files
795
805
  const chunks: MdElement[][] = [];
796
806
  let currentChunk: MdElement[] = [];
@@ -809,8 +819,33 @@ function parseMarkdownSemantic(elements: MdElement[]): MachineDef[] {
809
819
  chunks.push(currentChunk);
810
820
  }
811
821
 
812
- // Parse each chunk as a separate machine
813
- return chunks.map(chunk => parseMachineFromElements(chunk));
822
+ // Parse each chunk based on its H1 heading type
823
+ const machines: MachineDef[] = [];
824
+ const decisionTables: DecisionTableDef[] = [];
825
+
826
+ for (const chunk of chunks) {
827
+ // Find ALL H1 headings in the chunk to determine what it contains
828
+ const headings = chunk.filter(el => el.kind === 'heading' && el.level === 1) as MdHeading[];
829
+
830
+ // Check if chunk contains a decision_table (must be first H1 to be recognized as DT chunk)
831
+ const firstHeading = headings[0];
832
+ if (firstHeading?.text.startsWith('decision_table ')) {
833
+ const { decisionTable } = parseDecisionTable(chunk);
834
+ decisionTables.push(decisionTable);
835
+ } else if (firstHeading?.text.startsWith('machine ')) {
836
+ // First heading is machine - parse entire chunk as machine
837
+ machines.push(parseMachineFromElements(chunk));
838
+ } else {
839
+ // First heading is not machine or decision_table - scan for machine heading
840
+ const machineHeading = headings.find(h => h.text.startsWith('machine '));
841
+ if (machineHeading) {
842
+ machines.push(parseMachineFromElements(chunk));
843
+ }
844
+ // Skip chunks without a recognized machine or decision_table heading
845
+ }
846
+ }
847
+
848
+ return { machines, decisionTables };
814
849
  }
815
850
 
816
851
  function parseEffectsTable(table: MdTable): EffectDef[] {
@@ -834,8 +869,8 @@ function parsePropertiesList(list: MdBulletList): Property[] {
834
869
 
835
870
  export function parseMarkdown(source: string): ParseResult {
836
871
  const elements = parseMarkdownStructure(source);
837
- const machines = parseMarkdownSemantic(elements);
838
- return { file: { machines }, tokens: [] };
872
+ const { machines, decisionTables } = parseMarkdownSemantic(elements);
873
+ return { file: { machines, decisionTables }, tokens: [] };
839
874
  }
840
875
 
841
876
  /**