@lokascript/framework 4.7.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +76 -1
  2. package/dist/api/create-dsl.d.ts +14 -12
  3. package/dist/api/create-dsl.d.ts.map +1 -1
  4. package/dist/api/index.js +888 -1683
  5. package/dist/api/index.js.map +1 -1
  6. package/dist/core/index.d.ts +0 -1
  7. package/dist/core/index.d.ts.map +1 -1
  8. package/dist/core/index.js +560 -1133
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/core/matching/index.d.ts +2 -0
  11. package/dist/core/matching/index.d.ts.map +1 -1
  12. package/dist/core/matching/possessive-keywords.d.ts.map +1 -0
  13. package/dist/core/matching/stock-confidence.d.ts +3 -4
  14. package/dist/core/matching/stock-confidence.d.ts.map +1 -1
  15. package/dist/core/matching/stock-reader.d.ts +8 -1
  16. package/dist/core/matching/stock-reader.d.ts.map +1 -1
  17. package/dist/core/matching/stock-reading.d.ts +4 -4
  18. package/dist/core/{pattern-matching/utils → matching}/type-validation.d.ts +1 -1
  19. package/dist/core/matching/type-validation.d.ts.map +1 -0
  20. package/dist/core/types.d.ts +5 -0
  21. package/dist/core/types.d.ts.map +1 -1
  22. package/dist/core/types.js.map +1 -1
  23. package/dist/generation/index.d.ts +1 -1
  24. package/dist/generation/index.d.ts.map +1 -1
  25. package/dist/generation/index.js +32 -171
  26. package/dist/generation/index.js.map +1 -1
  27. package/dist/generation/profile.d.ts +30 -0
  28. package/dist/generation/profile.d.ts.map +1 -0
  29. package/dist/generation/renderer.d.ts +1 -1
  30. package/dist/generation/renderer.d.ts.map +1 -1
  31. package/dist/generation/schema-patterns.d.ts +3 -3
  32. package/dist/index.cjs +969 -1674
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +969 -1668
  35. package/dist/index.js.map +1 -1
  36. package/dist/ir/index.js.map +1 -1
  37. package/dist/multilingual/builders.d.ts +3 -3
  38. package/dist/multilingual/builders.d.ts.map +1 -1
  39. package/dist/multilingual/index.js.map +1 -1
  40. package/dist/parsing/index.d.ts +0 -1
  41. package/dist/parsing/index.d.ts.map +1 -1
  42. package/dist/parsing/index.js +0 -1145
  43. package/dist/parsing/index.js.map +1 -1
  44. package/dist/testing/gate/index.js +44 -12
  45. package/dist/testing/gate/index.js.map +1 -1
  46. package/dist/testing/gate/lint/types.d.ts +1 -1
  47. package/dist/testing/gate/lint/types.d.ts.map +1 -1
  48. package/dist/testing/gate/round-trip.d.ts +24 -3
  49. package/dist/testing/gate/round-trip.d.ts.map +1 -1
  50. package/package.json +2 -7
  51. package/src/__test__/test-utils.ts +1 -1
  52. package/src/api/create-dsl-engine.test.ts +123 -34
  53. package/src/api/create-dsl.test.ts +7 -0
  54. package/src/api/create-dsl.ts +56 -39
  55. package/src/core/index.ts +0 -1
  56. package/src/core/matching/index.ts +2 -0
  57. package/src/core/matching/stock-confidence.ts +3 -4
  58. package/src/core/matching/stock-reader.test.ts +87 -3
  59. package/src/core/matching/stock-reader.ts +20 -1
  60. package/src/core/matching/stock-reading.ts +6 -6
  61. package/src/core/{pattern-matching/utils → matching}/type-validation.test.ts +2 -2
  62. package/src/core/{pattern-matching/utils → matching}/type-validation.ts +1 -1
  63. package/src/core/types.ts +5 -0
  64. package/src/generation/domain-renderer.test.ts +1 -1
  65. package/src/generation/index.ts +1 -1
  66. package/src/generation/profile.ts +41 -0
  67. package/src/generation/renderer.test.ts +1 -1
  68. package/src/generation/renderer.ts +1 -1
  69. package/src/generation/schema-patterns.test.ts +41 -1
  70. package/src/generation/schema-patterns.ts +15 -3
  71. package/src/multilingual/bridge.test.ts +31 -23
  72. package/src/multilingual/builders.ts +3 -3
  73. package/src/parsing/index.ts +0 -1
  74. package/src/testing/gate/lint/types.ts +1 -1
  75. package/src/testing/gate/round-trip.test.ts +99 -9
  76. package/src/testing/gate/round-trip.ts +76 -11
  77. package/dist/core/pattern-matching/index.d.ts +0 -6
  78. package/dist/core/pattern-matching/index.d.ts.map +0 -1
  79. package/dist/core/pattern-matching/index.js +0 -1211
  80. package/dist/core/pattern-matching/index.js.map +0 -1
  81. package/dist/core/pattern-matching/pattern-matcher.d.ts +0 -122
  82. package/dist/core/pattern-matching/pattern-matcher.d.ts.map +0 -1
  83. package/dist/core/pattern-matching/utils/index.d.ts +0 -6
  84. package/dist/core/pattern-matching/utils/index.d.ts.map +0 -1
  85. package/dist/core/pattern-matching/utils/possessive-keywords.d.ts.map +0 -1
  86. package/dist/core/pattern-matching/utils/type-validation.d.ts.map +0 -1
  87. package/dist/generation/pattern-generator.d.ts +0 -55
  88. package/dist/generation/pattern-generator.d.ts.map +0 -1
  89. package/src/core/pattern-matching/index.ts +0 -6
  90. package/src/core/pattern-matching/pattern-matcher.test.ts +0 -1031
  91. package/src/core/pattern-matching/pattern-matcher.ts +0 -765
  92. package/src/core/pattern-matching/utils/index.ts +0 -6
  93. package/src/generation/pattern-generator.test.ts +0 -532
  94. package/src/generation/pattern-generator.ts +0 -327
  95. /package/dist/core/{pattern-matching/utils → matching}/possessive-keywords.d.ts +0 -0
  96. /package/src/core/{pattern-matching/utils → matching}/possessive-keywords.ts +0 -0
@@ -9,4 +9,6 @@ export type { ConfidenceBreakdown, ConfidenceContext, ConfidenceModel } from './
9
9
  export { StockValueReader, createStockReader, greedyStopMarkers, readGreedy } from './stock-reader';
10
10
  export { readRoleValue, type ReadingProfile } from './stock-reading';
11
11
  export { stockConfidenceModel } from './stock-confidence';
12
+ export * from './type-validation';
13
+ export * from './possessive-keywords';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/matching/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/matching/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"possessive-keywords.d.ts","sourceRoot":"","sources":["../../../src/core/matching/possessive-keywords.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5C,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,OAAO,EAAE,MAAM,GACd,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACrC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB"}
@@ -1,8 +1,7 @@
1
1
  /**
2
- * The stock confidence model: how framework's old matcher scored a domain
3
- * pattern's match (`core/pattern-matching/`), moved here as a `ConfidenceModel`
4
- * for the matcher's skeleton (domains rethink Phase 4.7); the old matcher calls
5
- * it too until Phase 6.
2
+ * The stock confidence model: how framework's first matcher scored a domain
3
+ * pattern's match, moved here as a `ConfidenceModel` for the matcher's
4
+ * skeleton (domains rethink Phase 4.7).
6
5
  *
7
6
  * Role coverage (a required slot 1, an optional one 0.8, an absent optional one
8
7
  * with a default 60% of that), a stem-match penalty (up to 15%, floor 0.5), and
@@ -1 +1 @@
1
- {"version":3,"file":"stock-confidence.d.ts","sourceRoot":"","sources":["../../../src/core/matching/stock-confidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAA0C,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA4NlG,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC"}
1
+ {"version":3,"file":"stock-confidence.d.ts","sourceRoot":"","sources":["../../../src/core/matching/stock-confidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAA0C,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA4NlG,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC"}
@@ -7,13 +7,18 @@
7
7
  * - A **greedy** slot (`RoleSpec.greedy`: a SQL condition, a column list) reads
8
8
  * every token up to the next marker the pattern still owes, or the end, as
9
9
  * one expression (`readGreedy`).
10
+ * - A slot with a **word list** (`RoleSpec.words`: behaviorspec's interaction,
11
+ * voice's thing to close) reads only one of its words, compared lower-cased
12
+ * by value or normalized form; any other word leaves the slot unread.
10
13
  * - Any other slot reads one value (`readRoleValue`, the old matcher's reading):
11
14
  * a selector, a quoted string, a number, a boolean, a duration, a URL, an
12
15
  * identifier, or one of the multi-token forms it knows (`user.name`,
13
16
  * `#dialog.showModal()`), checked against the slot's expected types.
14
17
  * - A **required** slot reads nothing where the stream is at the marker the
15
18
  * pattern wants next (the old matcher's guard against an SOV marker taken as
16
- * a value). Where a required slot finds nothing to read, and the optional,
19
+ * a value). An **optional** one reads nothing at any marker the rest of the
20
+ * pattern owes, through its optional groups (behaviorspec `when user types
21
+ * into #search`, whose typed text is optional and has no marker). Where a required slot finds nothing to read, and the optional,
17
22
  * marker-less slot just before it read a value with nothing read since, that
18
23
  * value is given back and the required slot reads again (the old matcher's
19
24
  * backtrack: behaviorspec `when clicks`, where the optional actor took
@@ -37,6 +42,8 @@ export declare function greedyStopMarkers(rest: readonly PatternToken[]): Set<st
37
42
  */
38
43
  export declare function readGreedy(tokens: TokenStream, stopMarkers: ReadonlySet<string>): SemanticValue | null;
39
44
  /** The stock reader, for a matcher whose profiles it may consult (possessive words). */
45
+ /** Whether `token` is one of a slot's `words`, by value or normalized form, lower-cased. */
46
+ export declare function isListedWord(token: LanguageToken | null, words: readonly string[]): boolean;
40
47
  export declare class StockValueReader implements ValueReader {
41
48
  private readonly view;
42
49
  private readonly profiles;
@@ -1 +1 @@
1
- {"version":3,"file":"stock-reader.d.ts","sourceRoot":"","sources":["../../../src/core/matching/stock-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAEV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE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AAC,EAC1C,IAAI,EAAE,YAAY,GAAG,SAAS,GAC7B,OAAO;IAwBV,6FAA6F;IAC7F,OAAO,CAAC,QAAQ;IA+BhB,WAAW,CACT,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,aAAa,GAAG,IAAI,EAC3B,IAAI,EAAE,YAAY,GAAG,SAAS,GAC7B,OAAO;IAWV,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;CAG1C;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAC/B,QAAQ,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAM,GACtD,CAAC,IAAI,EAAE,SAAS,KAAK,WAAW,CAElC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Reading a domain value at a role slot: the value reading framework's old
3
- * matcher (`core/pattern-matching/`) did, moved here so the stock reader on the
4
- * matcher's skeleton (`stock-reader.ts`, domains rethink Phase 4.7) and the old
5
- * matcher run the same code until Phase 6 deletes the old one.
2
+ * Reading a domain value at a role slot: the value reading framework's first
3
+ * matcher did, moved here for the stock reader on the matcher's skeleton
4
+ * (`stock-reader.ts`, domains rethink Phase 4.7). The first matcher was
5
+ * deleted in 5.0 (Phase 6).
6
6
  *
7
7
  * In order: an English noise word before a selector (`the`), then the
8
8
  * multi-token forms (a possessive, `my value`; a method call,
@@ -4,7 +4,7 @@
4
4
  * Shared utilities for validating semantic value types against expected types.
5
5
  * Used by pattern-matcher to validate captured role values.
6
6
  */
7
- import type { SemanticValue } from '../../types';
7
+ import type { SemanticValue } from '../types';
8
8
  /**
9
9
  * Semantic value type strings.
10
10
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-validation.d.ts","sourceRoot":"","sources":["../../../src/core/matching/type-validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,iBAAiB,GAAG,MAAM,EACtC,aAAa,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GAC5C,OAAO,CAsBT;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,aAAa,CAAC,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GAC7C,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAUrD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGrD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGzD"}
@@ -88,6 +88,11 @@ export interface RolePatternToken {
88
88
  readonly optional?: boolean;
89
89
  readonly expectedTypes?: Array<ExpectedType>;
90
90
  readonly greedy?: boolean;
91
+ /**
92
+ * The words the slot reads, from the schema's `RoleSpec.words` for the pattern's language (its
93
+ * `'*'` list and the language's own): the stock reader reads the slot only from one of them.
94
+ */
95
+ readonly words?: readonly string[];
91
96
  /**
92
97
  * Mirrors the schema's `RoleSpec.valueShape`: the slot's surface form is
93
98
  * unambiguous on its own. Carried onto the pattern token because the value
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,aAAa,GACb,gBAAgB,GAChB,YAAY,GACZ,UAAU,GACV,aAAa,GACb,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,C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AO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,aAAa,GACb,gBAAgB,GAChB,YAAY,GACZ,UAAU,GACV,aAAa,GACb,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAA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AC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACxD;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACrD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/types.ts"],"sourcesContent":["/**\n * Core Types — re-exported from @lokascript/intent + framework-specific extensions\n *\n * The universal semantic types (SemanticNode, SemanticValue, etc.) now live in\n * @lokascript/intent and are re-exported here for backward compatibility.\n *\n * Framework-specific types (tokenization, pattern matching) are defined below.\n */\n\n// =============================================================================\n// Re-export everything from @lokascript/intent\n// =============================================================================\n\nexport type {\n ActionType,\n SemanticRole,\n SemanticValue,\n ExpectedType,\n LiteralValue,\n SelectorValue,\n ReferenceValue,\n PropertyPathValue,\n ExpressionValue,\n FlagValue,\n Annotation,\n ProtocolDiagnostic,\n AsyncVariant,\n MatchArm,\n SemanticNode,\n SemanticMetadata,\n SourcePosition,\n CommandSemanticNode,\n EventHandlerSemanticNode,\n EventModifiers,\n ConditionalSemanticNode,\n CompoundSemanticNode,\n LoopVariant,\n LoopSemanticNode,\n LSEEnvelope,\n} from '@lokascript/intent';\n\nexport {\n createLiteral,\n createSelector,\n createReference,\n createPropertyPath,\n createExpression,\n createFlag,\n createCommandNode,\n createEventHandlerNode,\n createConditionalNode,\n createCompoundNode,\n createLoopNode,\n createTryNode,\n createAsyncNode,\n createMatchNode,\n extractValue,\n extractRoleValue,\n getRoleValue,\n} from '@lokascript/intent';\n\n// =============================================================================\n// Framework-specific types (multilingual DSL infrastructure)\n// =============================================================================\n\nimport type {\n ActionType,\n SemanticRole,\n SemanticValue,\n SelectorValue,\n ExpectedType,\n SourcePosition,\n} from '@lokascript/intent';\n\n/**\n * Token kind - categorizes what type of token this is.\n */\nexport type TokenKind =\n | 'keyword' // Command or modifier keyword\n | 'selector' // CSS selector or identifier (#id, .class, table-name)\n | 'literal' // String or number literal\n | 'particle' // Grammatical particle (を, に, من)\n | 'conjunction' // Grammatical conjunction\n | 'event-modifier' // Event modifier (.once, .debounce(300))\n | 'identifier' // Generic identifier\n | 'operator' // Operators (., +, -, etc.)\n | 'punctuation' // Punctuation (parentheses, etc.)\n | 'url'; // URL or path\n\n/**\n * A language token - the result of tokenization.\n */\nexport interface LanguageToken {\n readonly value: string;\n readonly kind: TokenKind;\n readonly position: SourcePosition;\n readonly normalized?: string;\n readonly stem?: string;\n readonly stemConfidence?: number;\n readonly metadata?: Record<string, unknown>;\n}\n\n/**\n * Token stream - provides sequential access to tokens with backtracking.\n */\nexport interface TokenStream {\n readonly tokens: readonly LanguageToken[];\n readonly language: string;\n peek(offset?: number): LanguageToken | null;\n advance(): LanguageToken;\n isAtEnd(): boolean;\n mark(): StreamMark;\n reset(mark: StreamMark): void;\n position(): number;\n}\n\nexport interface StreamMark {\n readonly position: number;\n}\n\n/**\n * Language tokenizer interface - converts text to tokens.\n */\nexport interface LanguageTokenizer {\n readonly language: string;\n readonly direction: 'ltr' | 'rtl';\n tokenize(input: string): TokenStream;\n classifyToken(token: string): TokenKind;\n}\n\n// =============================================================================\n// Pattern Matching Types\n// =============================================================================\n\nexport interface LanguagePattern {\n readonly id: string;\n readonly language: string;\n readonly command: ActionType;\n readonly priority: number;\n readonly template: PatternTemplate;\n readonly extraction: ExtractionRules;\n readonly constraints?: PatternConstraints;\n /**\n * The pattern reads a form the renderer does not write by choosing it\n * (hyperscript's wait `esperar evento {event}`: the renderer writes the event\n * word itself, before a name no table knows). The renderer skips it.\n */\n readonly parseOnly?: boolean;\n}\n\nexport interface PatternTemplate {\n readonly format: string;\n readonly tokens: PatternToken[];\n}\n\nexport type PatternToken = LiteralPatternToken | RolePatternToken | GroupPatternToken;\n\nexport interface LiteralPatternToken {\n readonly type: 'literal';\n readonly value: string;\n readonly alternatives?: string[];\n /**\n * Parse-only marker: the matcher still consumes this literal, but the\n * renderer skips it. Set when a role declares `renderOverride: { <lang>: '' }`\n * (hyperscript's fetch `from`: required to PARSE `fetch from /api`, absent from\n * the render, since `fetch from \"/api\"` is not canonical _hyperscript).\n */\n readonly renderSuppress?: boolean;\n}\n\nexport interface RolePatternToken {\n readonly type: 'role';\n readonly role: SemanticRole;\n readonly optional?: boolean;\n readonly expectedTypes?: Array<ExpectedType>;\n readonly greedy?: boolean;\n /**\n * Mirrors the schema's `RoleSpec.valueShape`: the slot's surface form is\n * unambiguous on its own. Carried onto the pattern token because the value\n * reader needs it too, not just the confidence model (hyperscript's\n * `'keyword'` slots hold a fixed keyword phrase and are exempt from the\n * trailing-slot verb guard).\n */\n readonly valueShape?: 'time' | 'reference' | 'keyword' | 'object' | 'clause' | 'list';\n}\n\nexport interface GroupPatternToken {\n readonly type: 'group';\n readonly tokens: PatternToken[];\n readonly optional?: boolean;\n /**\n * The group is optional for PARSING but belongs in canonical output: the\n * marker-only groups a profile's optional case markers produce (Turkish case\n * suffixes may be dropped colloquially, so the parse accepts both forms).\n * The matcher's skeleton also requires such a group's marker after a role it\n * captures (`MatchSkeleton`).\n */\n readonly renderRequired?: boolean;\n}\n\nexport interface ExtractionRules {\n readonly [role: string]: ExtractionRule;\n}\n\nexport interface ExtractionRule {\n readonly position?: number;\n readonly marker?: string;\n readonly markerAlternatives?: string[];\n readonly transform?: (raw: string) => SemanticValue;\n readonly default?: SemanticValue;\n readonly value?: string;\n /**\n * The static `value` is an expression, as the English parse types the word\n * (hyperscript's `go back` destination), not a literal.\n */\n readonly valueIsExpression?: true;\n readonly fromRole?: string;\n}\n\nexport interface PatternConstraints {\n readonly requiredRoles?: SemanticRole[];\n readonly forbiddenRoles?: SemanticRole[];\n readonly validPatientTypes?: Array<SelectorValue['selectorKind']>;\n readonly conflictsWith?: string[];\n}\n\nexport interface PatternMatchResult {\n readonly pattern: LanguagePattern;\n readonly captured: ReadonlyMap<SemanticRole, SemanticValue>;\n readonly consumedTokens: number;\n readonly confidence: number;\n /**\n * Stream index at which each captured role's value STARTED, for callers that\n * need to re-read a slot's own span rather than the tail after it. Populated\n * on the same success path as `captured` (`MatchSkeleton`), so a role left\n * behind by a rolled-back group survives in both maps or in neither.\n */\n readonly roleStarts?: ReadonlyMap<SemanticRole, number>;\n /**\n * A source phrase hyperscript's reader found in an event HEAD (`from #btn`\n * right after the event) rather than in a pattern slot: kept out of\n * `captured`, so a fused pattern's own source group can neither overwrite it\n * nor be overwritten (`ValueReader.resultFields`).\n */\n readonly eventSource?: SemanticValue;\n}\n\nexport interface PatternMatchError {\n readonly message: string;\n readonly position: SourcePosition;\n readonly expectedPatterns?: string[];\n readonly partialMatch?: Partial<PatternMatchResult>;\n}\n"],"mappings":";AAyCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../src/core/types.ts"],"sourcesContent":["/**\n * Core Types — re-exported from @lokascript/intent + framework-specific extensions\n *\n * The universal semantic types (SemanticNode, SemanticValue, etc.) now live in\n * @lokascript/intent and are re-exported here for backward compatibility.\n *\n * Framework-specific types (tokenization, pattern matching) are defined below.\n */\n\n// =============================================================================\n// Re-export everything from @lokascript/intent\n// =============================================================================\n\nexport type {\n ActionType,\n SemanticRole,\n SemanticValue,\n ExpectedType,\n LiteralValue,\n SelectorValue,\n ReferenceValue,\n PropertyPathValue,\n ExpressionValue,\n FlagValue,\n Annotation,\n ProtocolDiagnostic,\n AsyncVariant,\n MatchArm,\n SemanticNode,\n SemanticMetadata,\n SourcePosition,\n CommandSemanticNode,\n EventHandlerSemanticNode,\n EventModifiers,\n ConditionalSemanticNode,\n CompoundSemanticNode,\n LoopVariant,\n LoopSemanticNode,\n LSEEnvelope,\n} from '@lokascript/intent';\n\nexport {\n createLiteral,\n createSelector,\n createReference,\n createPropertyPath,\n createExpression,\n createFlag,\n createCommandNode,\n createEventHandlerNode,\n createConditionalNode,\n createCompoundNode,\n createLoopNode,\n createTryNode,\n createAsyncNode,\n createMatchNode,\n extractValue,\n extractRoleValue,\n getRoleValue,\n} from '@lokascript/intent';\n\n// =============================================================================\n// Framework-specific types (multilingual DSL infrastructure)\n// =============================================================================\n\nimport type {\n ActionType,\n SemanticRole,\n SemanticValue,\n SelectorValue,\n ExpectedType,\n SourcePosition,\n} from '@lokascript/intent';\n\n/**\n * Token kind - categorizes what type of token this is.\n */\nexport type TokenKind =\n | 'keyword' // Command or modifier keyword\n | 'selector' // CSS selector or identifier (#id, .class, table-name)\n | 'literal' // String or number literal\n | 'particle' // Grammatical particle (を, に, من)\n | 'conjunction' // Grammatical conjunction\n | 'event-modifier' // Event modifier (.once, .debounce(300))\n | 'identifier' // Generic identifier\n | 'operator' // Operators (., +, -, etc.)\n | 'punctuation' // Punctuation (parentheses, etc.)\n | 'url'; // URL or path\n\n/**\n * A language token - the result of tokenization.\n */\nexport interface LanguageToken {\n readonly value: string;\n readonly kind: TokenKind;\n readonly position: SourcePosition;\n readonly normalized?: string;\n readonly stem?: string;\n readonly stemConfidence?: number;\n readonly metadata?: Record<string, unknown>;\n}\n\n/**\n * Token stream - provides sequential access to tokens with backtracking.\n */\nexport interface TokenStream {\n readonly tokens: readonly LanguageToken[];\n readonly language: string;\n peek(offset?: number): LanguageToken | null;\n advance(): LanguageToken;\n isAtEnd(): boolean;\n mark(): StreamMark;\n reset(mark: StreamMark): void;\n position(): number;\n}\n\nexport interface StreamMark {\n readonly position: number;\n}\n\n/**\n * Language tokenizer interface - converts text to tokens.\n */\nexport interface LanguageTokenizer {\n readonly language: string;\n readonly direction: 'ltr' | 'rtl';\n tokenize(input: string): TokenStream;\n classifyToken(token: string): TokenKind;\n}\n\n// =============================================================================\n// Pattern Matching Types\n// =============================================================================\n\nexport interface LanguagePattern {\n readonly id: string;\n readonly language: string;\n readonly command: ActionType;\n readonly priority: number;\n readonly template: PatternTemplate;\n readonly extraction: ExtractionRules;\n readonly constraints?: PatternConstraints;\n /**\n * The pattern reads a form the renderer does not write by choosing it\n * (hyperscript's wait `esperar evento {event}`: the renderer writes the event\n * word itself, before a name no table knows). The renderer skips it.\n */\n readonly parseOnly?: boolean;\n}\n\nexport interface PatternTemplate {\n readonly format: string;\n readonly tokens: PatternToken[];\n}\n\nexport type PatternToken = LiteralPatternToken | RolePatternToken | GroupPatternToken;\n\nexport interface LiteralPatternToken {\n readonly type: 'literal';\n readonly value: string;\n readonly alternatives?: string[];\n /**\n * Parse-only marker: the matcher still consumes this literal, but the\n * renderer skips it. Set when a role declares `renderOverride: { <lang>: '' }`\n * (hyperscript's fetch `from`: required to PARSE `fetch from /api`, absent from\n * the render, since `fetch from \"/api\"` is not canonical _hyperscript).\n */\n readonly renderSuppress?: boolean;\n}\n\nexport interface RolePatternToken {\n readonly type: 'role';\n readonly role: SemanticRole;\n readonly optional?: boolean;\n readonly expectedTypes?: Array<ExpectedType>;\n readonly greedy?: boolean;\n /**\n * The words the slot reads, from the schema's `RoleSpec.words` for the pattern's language (its\n * `'*'` list and the language's own): the stock reader reads the slot only from one of them.\n */\n readonly words?: readonly string[];\n /**\n * Mirrors the schema's `RoleSpec.valueShape`: the slot's surface form is\n * unambiguous on its own. Carried onto the pattern token because the value\n * reader needs it too, not just the confidence model (hyperscript's\n * `'keyword'` slots hold a fixed keyword phrase and are exempt from the\n * trailing-slot verb guard).\n */\n readonly valueShape?: 'time' | 'reference' | 'keyword' | 'object' | 'clause' | 'list';\n}\n\nexport interface GroupPatternToken {\n readonly type: 'group';\n readonly tokens: PatternToken[];\n readonly optional?: boolean;\n /**\n * The group is optional for PARSING but belongs in canonical output: the\n * marker-only groups a profile's optional case markers produce (Turkish case\n * suffixes may be dropped colloquially, so the parse accepts both forms).\n * The matcher's skeleton also requires such a group's marker after a role it\n * captures (`MatchSkeleton`).\n */\n readonly renderRequired?: boolean;\n}\n\nexport interface ExtractionRules {\n readonly [role: string]: ExtractionRule;\n}\n\nexport interface ExtractionRule {\n readonly position?: number;\n readonly marker?: string;\n readonly markerAlternatives?: string[];\n readonly transform?: (raw: string) => SemanticValue;\n readonly default?: SemanticValue;\n readonly value?: string;\n /**\n * The static `value` is an expression, as the English parse types the word\n * (hyperscript's `go back` destination), not a literal.\n */\n readonly valueIsExpression?: true;\n readonly fromRole?: string;\n}\n\nexport interface PatternConstraints {\n readonly requiredRoles?: SemanticRole[];\n readonly forbiddenRoles?: SemanticRole[];\n readonly validPatientTypes?: Array<SelectorValue['selectorKind']>;\n readonly conflictsWith?: string[];\n}\n\nexport interface PatternMatchResult {\n readonly pattern: LanguagePattern;\n readonly captured: ReadonlyMap<SemanticRole, SemanticValue>;\n readonly consumedTokens: number;\n readonly confidence: number;\n /**\n * Stream index at which each captured role's value STARTED, for callers that\n * need to re-read a slot's own span rather than the tail after it. Populated\n * on the same success path as `captured` (`MatchSkeleton`), so a role left\n * behind by a rolled-back group survives in both maps or in neither.\n */\n readonly roleStarts?: ReadonlyMap<SemanticRole, number>;\n /**\n * A source phrase hyperscript's reader found in an event HEAD (`from #btn`\n * right after the event) rather than in a pattern slot: kept out of\n * `captured`, so a fused pattern's own source group can neither overwrite it\n * nor be overwritten (`ValueReader.resultFields`).\n */\n readonly eventSource?: SemanticValue;\n}\n\nexport interface PatternMatchError {\n readonly message: string;\n readonly position: SourcePosition;\n readonly expectedPatterns?: string[];\n readonly partialMatch?: Partial<PatternMatchResult>;\n}\n"],"mappings":";AAyCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pattern generation, rendering, and diagnostics
3
3
  */
4
- export * from './pattern-generator';
4
+ export * from './profile';
5
5
  export * from './renderer';
6
6
  export * from './diagnostics';
7
7
  export * from './schema-patterns';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -1,110 +1,4 @@
1
- // src/generation/pattern-generator.ts
2
- var defaultConfig = {
3
- basePriority: 100,
4
- includeOptionalVariants: true
5
- };
6
- function generatePattern(schema, profile, config = defaultConfig) {
7
- const id = `${schema.action}-${profile.code}-generated`;
8
- const priority = config.basePriority ?? 100;
9
- const keyword = profile.keywords[schema.action];
10
- if (!keyword) {
11
- throw new Error(`No keyword translation for '${schema.action}' in ${profile.code}`);
12
- }
13
- const tokens = buildTokens(schema, profile, keyword.primary, keyword.alternatives);
14
- const extraction = buildExtractionRules(schema, profile);
15
- const format = buildFormatString(schema, profile, keyword.primary);
16
- return {
17
- id,
18
- language: profile.code,
19
- command: schema.action,
20
- priority,
21
- template: {
22
- format,
23
- tokens
24
- },
25
- extraction
26
- };
27
- }
28
- function buildTokens(schema, profile, keyword, alternatives) {
29
- const tokens = [];
30
- const keywordToken = {
31
- type: "literal",
32
- value: keyword,
33
- ...alternatives?.length && { alternatives }
34
- };
35
- const sortedRoles = sortRolesByWordOrder(schema.roles, profile.wordOrder);
36
- if (profile.wordOrder === "SVO") {
37
- tokens.push(keywordToken);
38
- for (const role of sortedRoles) {
39
- addRoleWithMarker(tokens, role, profile);
40
- }
41
- } else if (profile.wordOrder === "SOV") {
42
- const preVerb = [];
43
- const postVerb = [];
44
- for (const role of sortedRoles) {
45
- addRoleWithMarker(role.sovSlot === "postVerb" ? postVerb : preVerb, role, profile);
46
- }
47
- tokens.push(...preVerb, keywordToken, ...postVerb);
48
- } else if (profile.wordOrder === "VSO") {
49
- tokens.push(keywordToken);
50
- for (const role of sortedRoles) {
51
- addRoleWithMarker(tokens, role, profile);
52
- }
53
- } else {
54
- tokens.push(keywordToken);
55
- for (const role of sortedRoles) {
56
- addRoleWithMarker(tokens, role, profile);
57
- }
58
- }
59
- return tokens;
60
- }
61
- function addRoleWithMarker(tokens, roleSpec, profile) {
62
- const marker = getMarkerForRole(roleSpec, profile);
63
- const isOptional = !roleSpec.required;
64
- const roleToken = {
65
- type: "role",
66
- role: roleSpec.role,
67
- optional: isOptional,
68
- expectedTypes: roleSpec.expectedTypes,
69
- ...roleSpec.greedy && { greedy: true }
70
- };
71
- if (marker) {
72
- const markerInfo = profile.roleMarkers?.[roleSpec.role];
73
- const defaultPosition = profile.wordOrder === "SOV" ? "after" : "before";
74
- const position = roleSpec.markerPosition ?? markerInfo?.position ?? defaultPosition;
75
- if (isOptional) {
76
- if (position === "before") {
77
- tokens.push({
78
- type: "group",
79
- optional: true,
80
- tokens: [{ type: "literal", value: marker }, roleToken]
81
- });
82
- } else {
83
- tokens.push({
84
- type: "group",
85
- optional: true,
86
- tokens: [roleToken, { type: "literal", value: marker }]
87
- });
88
- }
89
- } else {
90
- if (position === "before") {
91
- tokens.push({ type: "literal", value: marker });
92
- tokens.push(roleToken);
93
- } else {
94
- tokens.push(roleToken);
95
- tokens.push({ type: "literal", value: marker });
96
- }
97
- }
98
- } else {
99
- tokens.push(roleToken);
100
- }
101
- }
102
- function getMarkerForRole(roleSpec, profile) {
103
- if (roleSpec.markerOverride?.[profile.code]) {
104
- return roleSpec.markerOverride[profile.code];
105
- }
106
- return profile.roleMarkers?.[roleSpec.role]?.primary;
107
- }
1
+ // src/generation/profile.ts
108
2
  function sortRolesByWordOrder(roles, wordOrder) {
109
3
  const sorted = [...roles];
110
4
  if (wordOrder === "SVO") {
@@ -114,47 +8,6 @@ function sortRolesByWordOrder(roles, wordOrder) {
114
8
  }
115
9
  return sorted;
116
10
  }
117
- function buildExtractionRules(schema, profile) {
118
- const rules = {};
119
- for (const roleSpec of schema.roles) {
120
- const marker = getMarkerForRole(roleSpec, profile);
121
- const rule = {
122
- ...roleSpec.default !== void 0 && { default: roleSpec.default },
123
- ...marker && { marker }
124
- };
125
- rules[roleSpec.role] = rule;
126
- }
127
- return rules;
128
- }
129
- function buildFormatString(schema, profile, keyword) {
130
- const isSOV = profile.wordOrder === "SOV";
131
- const preVerb = [];
132
- const postVerb = [];
133
- const sortedRoles = sortRolesByWordOrder(schema.roles, profile.wordOrder);
134
- for (const role of sortedRoles) {
135
- const marker = getMarkerForRole(role, profile);
136
- const roleName = `{${role.role}}`;
137
- const bucket = isSOV && role.sovSlot === "postVerb" ? postVerb : preVerb;
138
- if (marker) {
139
- const markerInfo = profile.roleMarkers?.[role.role];
140
- if (markerInfo?.position === "after") {
141
- bucket.push(`${roleName} ${marker}`);
142
- } else {
143
- bucket.push(`${marker} ${roleName}`);
144
- }
145
- } else {
146
- bucket.push(roleName);
147
- }
148
- }
149
- return (isSOV ? [...preVerb, keyword, ...postVerb] : [keyword, ...preVerb, ...postVerb]).join(
150
- " "
151
- );
152
- }
153
- function generatePatternVariants(schema, profile, config = defaultConfig) {
154
- const patterns = [];
155
- patterns.push(generatePattern(schema, profile, config));
156
- return patterns;
157
- }
158
11
 
159
12
  // src/core/types.ts
160
13
  import {
@@ -296,10 +149,10 @@ import { createDiagnosticCollector, fromError, filterBySeverity } from "@lokascr
296
149
  // src/generation/schema-patterns.ts
297
150
  function createSchemaPatternGenerator(grammar) {
298
151
  return {
299
- generatePattern: (schema, profile, config) => generatePattern2(grammar, schema, profile, config),
152
+ generatePattern: (schema, profile, config) => generatePattern(grammar, schema, profile, config),
300
153
  generateSimplePattern: (schema, profile, config) => generateSimplePattern(grammar, schema, profile, config),
301
154
  generateVerbFirstPattern: (schema, profile, config) => generateVerbFirstPattern(schema, profile, config),
302
- generatePatternVariants: (schema, profile, config) => generatePatternVariants2(grammar, schema, profile, config),
155
+ generatePatternVariants: (schema, profile, config) => generatePatternVariants(grammar, schema, profile, config),
303
156
  buildRoleToken
304
157
  };
305
158
  }
@@ -349,21 +202,21 @@ function schemaMarkerAlternatives(roleSpec, languageCode, marker) {
349
202
  const alternatives = [.../* @__PURE__ */ new Set([...legacy, ...variants])].filter((a) => a && a !== marker);
350
203
  return alternatives.length ? alternatives : void 0;
351
204
  }
352
- var defaultConfig2 = {
205
+ var defaultConfig = {
353
206
  basePriority: 100,
354
207
  generateSimpleVariants: true,
355
208
  generateAlternatives: true
356
209
  };
357
- function generatePattern2(grammar, schema, profile, config = defaultConfig2) {
210
+ function generatePattern(grammar, schema, profile, config = defaultConfig) {
358
211
  const id = `${schema.action}-${profile.code}-generated`;
359
212
  const priority = config.basePriority ?? 100;
360
213
  const keyword = profile.keywords[schema.action];
361
214
  if (!keyword) {
362
215
  throw new Error(`No keyword translation for '${schema.action}' in ${profile.code}`);
363
216
  }
364
- const tokens = buildTokens2(grammar, schema, profile, keyword);
217
+ const tokens = buildTokens(grammar, schema, profile, keyword);
365
218
  const extraction = buildExtractionRulesWithDefaults(schema, profile);
366
- const format = buildFormatString2(grammar, schema, profile, keyword);
219
+ const format = buildFormatString(grammar, schema, profile, keyword);
367
220
  return {
368
221
  id,
369
222
  language: profile.code,
@@ -376,7 +229,7 @@ function generatePattern2(grammar, schema, profile, config = defaultConfig2) {
376
229
  extraction
377
230
  };
378
231
  }
379
- function generateSimplePattern(grammar, schema, profile, config = defaultConfig2) {
232
+ function generateSimplePattern(grammar, schema, profile, config = defaultConfig) {
380
233
  const optionalRoles = schema.roles.filter((r) => !r.required);
381
234
  if (optionalRoles.length === 0) {
382
235
  return null;
@@ -386,7 +239,7 @@ function generateSimplePattern(grammar, schema, profile, config = defaultConfig2
386
239
  ...schema,
387
240
  roles: requiredRoles
388
241
  };
389
- const pattern = generatePattern2(grammar, simpleSchema, profile, config);
242
+ const pattern = generatePattern(grammar, simpleSchema, profile, config);
390
243
  return {
391
244
  ...pattern,
392
245
  id: `${schema.action}-${profile.code}-generated-simple`,
@@ -395,7 +248,7 @@ function generateSimplePattern(grammar, schema, profile, config = defaultConfig2
395
248
  extraction: buildExtractionRulesWithDefaults(schema, profile)
396
249
  };
397
250
  }
398
- function generateVerbFirstPattern(schema, profile, config = defaultConfig2) {
251
+ function generateVerbFirstPattern(schema, profile, config = defaultConfig) {
399
252
  if (profile.wordOrder !== "SOV") return null;
400
253
  const requiredRoles = schema.roles.filter((r) => r.required);
401
254
  if (requiredRoles.length !== 1) return null;
@@ -404,11 +257,13 @@ function generateVerbFirstPattern(schema, profile, config = defaultConfig2) {
404
257
  const verbToken = keyword.alternatives ? { type: "literal", value: keyword.primary, alternatives: keyword.alternatives } : { type: "literal", value: keyword.primary };
405
258
  const roleTokens = requiredRoles.flatMap((r) => {
406
259
  const prefix = r.valuePrefixLiteral?.[profile.code];
260
+ const words = wordsFor(r, profile.code);
407
261
  const roleToken = {
408
262
  type: "role",
409
263
  role: r.role,
410
264
  optional: false,
411
- expectedTypes: r.expectedTypes
265
+ expectedTypes: r.expectedTypes,
266
+ ...words ? { words } : {}
412
267
  };
413
268
  return prefix ? [{ type: "literal", value: prefix }, roleToken] : [roleToken];
414
269
  });
@@ -426,11 +281,11 @@ function generateVerbFirstPattern(schema, profile, config = defaultConfig2) {
426
281
  extraction: buildExtractionRulesWithDefaults(schema, profile)
427
282
  };
428
283
  }
429
- function generatePatternVariants2(grammar, schema, profile, config = defaultConfig2) {
284
+ function generatePatternVariants(grammar, schema, profile, config = defaultConfig) {
430
285
  const patterns = [];
431
286
  const full = schema;
432
287
  schema = withoutVariantOnlyRoles(schema);
433
- patterns.push(generatePattern2(grammar, schema, profile, config));
288
+ patterns.push(generatePattern(grammar, schema, profile, config));
434
289
  if (config.generateSimpleVariants) {
435
290
  const simple = generateSimplePattern(grammar, schema, profile, config);
436
291
  if (simple) {
@@ -442,7 +297,7 @@ function generatePatternVariants2(grammar, schema, profile, config = defaultConf
442
297
  ...schema,
443
298
  roles: schema.roles.filter((r) => r.role !== omitted)
444
299
  };
445
- const variant = generatePattern2(grammar, variantSchema, profile, config);
300
+ const variant = generatePattern(grammar, variantSchema, profile, config);
446
301
  patterns.push({
447
302
  ...variant,
448
303
  id: `${schema.action}-${profile.code}-generated-no-${omitted}`,
@@ -457,7 +312,7 @@ function generatePatternVariants2(grammar, schema, profile, config = defaultConf
457
312
  (r) => r.role === widen.role ? { ...r, expectedTypes: [...widen.types] } : r
458
313
  )
459
314
  };
460
- const main = generatePattern2(grammar, cloneSchema, profile, config);
315
+ const main = generatePattern(grammar, cloneSchema, profile, config);
461
316
  patterns.push({
462
317
  ...main,
463
318
  id: `${schema.action}-${profile.code}-generated-${widen.idSuffix}`,
@@ -472,7 +327,7 @@ function generatePatternVariants2(grammar, schema, profile, config = defaultConf
472
327
  return r.role === v.widen?.role ? { ...required, expectedTypes: [...v.widen.types] } : required;
473
328
  })
474
329
  };
475
- const variant = generatePattern2(grammar, variantSchema, profile, config);
330
+ const variant = generatePattern(grammar, variantSchema, profile, config);
476
331
  patterns.push({
477
332
  ...variant,
478
333
  id: `${schema.action}-${profile.code}-generated-${v.idSuffix}`,
@@ -497,7 +352,7 @@ function generatePatternVariants2(grammar, schema, profile, config = defaultConf
497
352
  };
498
353
  const delta = v.priorityDelta ?? 5;
499
354
  const carrier = v.methodCarrier ? { [v.methodCarrier]: { value: literal } } : {};
500
- const main = generatePattern2(grammar, cloneSchema, profile, config);
355
+ const main = generatePattern(grammar, cloneSchema, profile, config);
501
356
  patterns.push({
502
357
  ...main,
503
358
  id: `${schema.action}-${profile.code}-generated-${v.idSuffix}`,
@@ -518,7 +373,7 @@ function generatePatternVariants2(grammar, schema, profile, config = defaultConf
518
373
  }
519
374
  return patterns;
520
375
  }
521
- function buildTokens2(grammar, schema, profile, keyword) {
376
+ function buildTokens(grammar, schema, profile, keyword) {
522
377
  const tokens = [];
523
378
  const verbToken = keyword.alternatives ? { type: "literal", value: keyword.primary, alternatives: keyword.alternatives } : { type: "literal", value: keyword.primary };
524
379
  const postVerbRoles = profile.wordOrder === "SOV" ? schema.roles.filter((r) => r.sovSlot === "postVerb") : [];
@@ -578,11 +433,17 @@ function buildRoleTokens(grammar, schema, profile) {
578
433
  }
579
434
  return tokens;
580
435
  }
436
+ function wordsFor(roleSpec, language) {
437
+ if (!roleSpec.words) return void 0;
438
+ const words = [...roleSpec.words["*"] ?? [], ...roleSpec.words[language] ?? []];
439
+ return words.length > 0 ? words : void 0;
440
+ }
581
441
  function buildRoleToken(roleSpec, profile) {
582
442
  const tokens = [];
583
443
  const overrideMarker = roleSpec.markerOverride?.[profile.code];
584
444
  const defaultMarker = profile.roleMarkers[roleSpec.role];
585
445
  const suppressMarker = roleSpec.renderOverride?.[profile.code] === "";
446
+ const words = wordsFor(roleSpec, profile.code);
586
447
  const roleValueToken = {
587
448
  type: "role",
588
449
  role: roleSpec.role,
@@ -594,7 +455,9 @@ function buildRoleToken(roleSpec, profile) {
594
455
  ...roleSpec.valueShape !== void 0 ? { valueShape: roleSpec.valueShape } : {},
595
456
  // A greedy role reads up to the next marker the pattern owes (a domain's
596
457
  // SQL condition); its value reader does the reading.
597
- ...roleSpec.greedy ? { greedy: true } : {}
458
+ ...roleSpec.greedy ? { greedy: true } : {},
459
+ // A role with a word list reads only one of its words.
460
+ ...words ? { words } : {}
598
461
  };
599
462
  const prefixLiteral = roleSpec.valuePrefixLiteral?.[profile.code];
600
463
  const pushPrefixed = () => {
@@ -664,7 +527,7 @@ function buildRoleToken(roleSpec, profile) {
664
527
  }
665
528
  return tokens;
666
529
  }
667
- function buildExtractionRules2(schema, profile) {
530
+ function buildExtractionRules(schema, profile) {
668
531
  const rules = {};
669
532
  for (const roleSpec of schema.roles) {
670
533
  const overrideMarker = roleSpec.markerOverride?.[profile.code];
@@ -694,7 +557,7 @@ function buildExtractionRules2(schema, profile) {
694
557
  return rules;
695
558
  }
696
559
  function buildExtractionRulesWithDefaults(schema, profile) {
697
- const baseRules = buildExtractionRules2(schema, profile);
560
+ const baseRules = buildExtractionRules(schema, profile);
698
561
  const rules = {};
699
562
  for (const roleSpec of schema.roles) {
700
563
  const baseRule = baseRules[roleSpec.role] || {};
@@ -706,7 +569,7 @@ function buildExtractionRulesWithDefaults(schema, profile) {
706
569
  }
707
570
  return rules;
708
571
  }
709
- function buildFormatString2(grammar, schema, profile, keyword) {
572
+ function buildFormatString(grammar, schema, profile, keyword) {
710
573
  const parts = [];
711
574
  const sortedRoles = sortRolesByPosition(schema.roles, profile.wordOrder, grammar.positionOrder);
712
575
  const roleParts = sortedRoles.map((roleSpec) => {
@@ -877,8 +740,6 @@ export {
877
740
  detectWordOrders,
878
741
  filterBySeverity,
879
742
  fromError,
880
- generatePattern,
881
- generatePatternVariants,
882
743
  legacyMarkerAlternatives,
883
744
  lookupKeyword,
884
745
  lookupMarker,