@sharpee/if-domain 0.9.60-beta

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 (86) hide show
  1. package/README.md +71 -0
  2. package/dist/changes.d.ts +8 -0
  3. package/dist/changes.d.ts.map +1 -0
  4. package/dist/changes.js +6 -0
  5. package/dist/changes.js.map +1 -0
  6. package/dist/contracts.d.ts +270 -0
  7. package/dist/contracts.d.ts.map +1 -0
  8. package/dist/contracts.js +6 -0
  9. package/dist/contracts.js.map +1 -0
  10. package/dist/events.d.ts +124 -0
  11. package/dist/events.d.ts.map +1 -0
  12. package/dist/events.js +123 -0
  13. package/dist/events.js.map +1 -0
  14. package/dist/grammar/grammar-builder.d.ts +507 -0
  15. package/dist/grammar/grammar-builder.d.ts.map +1 -0
  16. package/dist/grammar/grammar-builder.js +47 -0
  17. package/dist/grammar/grammar-builder.js.map +1 -0
  18. package/dist/grammar/grammar-engine.d.ts +65 -0
  19. package/dist/grammar/grammar-engine.d.ts.map +1 -0
  20. package/dist/grammar/grammar-engine.js +370 -0
  21. package/dist/grammar/grammar-engine.js.map +1 -0
  22. package/dist/grammar/index.d.ts +10 -0
  23. package/dist/grammar/index.d.ts.map +1 -0
  24. package/dist/grammar/index.js +26 -0
  25. package/dist/grammar/index.js.map +1 -0
  26. package/dist/grammar/pattern-compiler.d.ts +38 -0
  27. package/dist/grammar/pattern-compiler.d.ts.map +1 -0
  28. package/dist/grammar/pattern-compiler.js +22 -0
  29. package/dist/grammar/pattern-compiler.js.map +1 -0
  30. package/dist/grammar/scope-builder.d.ts +26 -0
  31. package/dist/grammar/scope-builder.d.ts.map +1 -0
  32. package/dist/grammar/scope-builder.js +67 -0
  33. package/dist/grammar/scope-builder.js.map +1 -0
  34. package/dist/grammar/vocabulary-provider.d.ts +163 -0
  35. package/dist/grammar/vocabulary-provider.d.ts.map +1 -0
  36. package/dist/grammar/vocabulary-provider.js +89 -0
  37. package/dist/grammar/vocabulary-provider.js.map +1 -0
  38. package/dist/index.d.ts +16 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +40 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/language-provider.d.ts +106 -0
  43. package/dist/language-provider.d.ts.map +1 -0
  44. package/dist/language-provider.js +14 -0
  45. package/dist/language-provider.js.map +1 -0
  46. package/dist/parser-contracts/index.d.ts +10 -0
  47. package/dist/parser-contracts/index.d.ts.map +1 -0
  48. package/dist/parser-contracts/index.js +26 -0
  49. package/dist/parser-contracts/index.js.map +1 -0
  50. package/dist/parser-contracts/parser-factory.d.ts +46 -0
  51. package/dist/parser-contracts/parser-factory.d.ts.map +1 -0
  52. package/dist/parser-contracts/parser-factory.js +78 -0
  53. package/dist/parser-contracts/parser-factory.js.map +1 -0
  54. package/dist/parser-contracts/parser-internals.d.ts +125 -0
  55. package/dist/parser-contracts/parser-internals.d.ts.map +1 -0
  56. package/dist/parser-contracts/parser-internals.js +26 -0
  57. package/dist/parser-contracts/parser-internals.js.map +1 -0
  58. package/dist/parser-contracts/parser-types.d.ts +128 -0
  59. package/dist/parser-contracts/parser-types.d.ts.map +1 -0
  60. package/dist/parser-contracts/parser-types.js +9 -0
  61. package/dist/parser-contracts/parser-types.js.map +1 -0
  62. package/dist/parser-language-provider.d.ts +158 -0
  63. package/dist/parser-language-provider.d.ts.map +1 -0
  64. package/dist/parser-language-provider.js +10 -0
  65. package/dist/parser-language-provider.js.map +1 -0
  66. package/dist/sequencing.d.ts +53 -0
  67. package/dist/sequencing.d.ts.map +1 -0
  68. package/dist/sequencing.js +6 -0
  69. package/dist/sequencing.js.map +1 -0
  70. package/dist/vocabulary-contracts/index.d.ts +7 -0
  71. package/dist/vocabulary-contracts/index.d.ts.map +1 -0
  72. package/dist/vocabulary-contracts/index.js +23 -0
  73. package/dist/vocabulary-contracts/index.js.map +1 -0
  74. package/dist/vocabulary-contracts/vocabulary-adapters.d.ts +19 -0
  75. package/dist/vocabulary-contracts/vocabulary-adapters.d.ts.map +1 -0
  76. package/dist/vocabulary-contracts/vocabulary-adapters.js +73 -0
  77. package/dist/vocabulary-contracts/vocabulary-adapters.js.map +1 -0
  78. package/dist/vocabulary-contracts/vocabulary-registry.d.ts +98 -0
  79. package/dist/vocabulary-contracts/vocabulary-registry.d.ts.map +1 -0
  80. package/dist/vocabulary-contracts/vocabulary-registry.js +383 -0
  81. package/dist/vocabulary-contracts/vocabulary-registry.js.map +1 -0
  82. package/dist/vocabulary-contracts/vocabulary-types.d.ts +240 -0
  83. package/dist/vocabulary-contracts/vocabulary-types.d.ts.map +1 -0
  84. package/dist/vocabulary-contracts/vocabulary-types.js +64 -0
  85. package/dist/vocabulary-contracts/vocabulary-types.js.map +1 -0
  86. package/package.json +56 -0
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Internal parser types
3
+ *
4
+ * These types are used internally by the parser implementation
5
+ * and should not be exported as part of the public API.
6
+ *
7
+ * @internal
8
+ */
9
+ import { Token } from './parser-types';
10
+ /**
11
+ * A candidate command from the parser
12
+ * This is world-agnostic - just the grammatical structure
13
+ *
14
+ * @internal
15
+ */
16
+ export interface CandidateCommand {
17
+ /**
18
+ * The action to perform (verb)
19
+ */
20
+ action: string;
21
+ /**
22
+ * Raw text for the primary noun
23
+ */
24
+ nounText?: string;
25
+ /**
26
+ * Possible interpretations of the noun
27
+ */
28
+ nounCandidates?: string[];
29
+ /**
30
+ * Preposition between nouns
31
+ */
32
+ preposition?: string;
33
+ /**
34
+ * Raw text for the secondary noun
35
+ */
36
+ secondNounText?: string;
37
+ /**
38
+ * Possible interpretations of the second noun
39
+ */
40
+ secondNounCandidates?: string[];
41
+ /**
42
+ * Original input text
43
+ */
44
+ originalInput: string;
45
+ /**
46
+ * Tokens that were parsed
47
+ */
48
+ tokens: Token[];
49
+ /**
50
+ * Grammar pattern that was matched
51
+ */
52
+ pattern?: string;
53
+ /**
54
+ * Parser confidence (0-1)
55
+ */
56
+ confidence?: number;
57
+ /**
58
+ * Any special flags (ALL, EXCEPT, etc.)
59
+ */
60
+ flags?: {
61
+ all?: boolean;
62
+ except?: boolean;
63
+ pronoun?: boolean;
64
+ };
65
+ }
66
+ /**
67
+ * Result of parsing with error handling (internal)
68
+ *
69
+ * @internal
70
+ */
71
+ export interface InternalParseResult {
72
+ /**
73
+ * Successful candidate commands
74
+ */
75
+ candidates: CandidateCommand[];
76
+ /**
77
+ * Errors encountered
78
+ */
79
+ errors: ParseError[];
80
+ /**
81
+ * Whether parsing was partially successful
82
+ */
83
+ partial: boolean;
84
+ }
85
+ /**
86
+ * Internal parse error type
87
+ *
88
+ * @internal
89
+ */
90
+ export interface ParseError {
91
+ /**
92
+ * Type of error
93
+ */
94
+ type: ParseErrorType;
95
+ /**
96
+ * Human-readable message
97
+ */
98
+ message: string;
99
+ /**
100
+ * The problematic word(s)
101
+ */
102
+ words?: string[];
103
+ /**
104
+ * Position in input where error occurred
105
+ */
106
+ position?: number;
107
+ /**
108
+ * Suggestions for fixing
109
+ */
110
+ suggestions?: string[];
111
+ }
112
+ /**
113
+ * Error types for parsing
114
+ *
115
+ * @internal
116
+ */
117
+ export declare enum ParseErrorType {
118
+ NO_VERB = "NO_VERB",
119
+ UNKNOWN_VERB = "UNKNOWN_VERB",
120
+ UNKNOWN_WORD = "UNKNOWN_WORD",
121
+ AMBIGUOUS = "AMBIGUOUS",
122
+ INCOMPLETE = "INCOMPLETE",
123
+ PATTERN_MISMATCH = "PATTERN_MISMATCH"
124
+ }
125
+ //# sourceMappingURL=parser-internals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-internals.d.ts","sourceRoot":"","sources":["../../src/parser-contracts/parser-internals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM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";
2
+ /**
3
+ * Internal parser types
4
+ *
5
+ * These types are used internally by the parser implementation
6
+ * and should not be exported as part of the public API.
7
+ *
8
+ * @internal
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ParseErrorType = void 0;
12
+ /**
13
+ * Error types for parsing
14
+ *
15
+ * @internal
16
+ */
17
+ var ParseErrorType;
18
+ (function (ParseErrorType) {
19
+ ParseErrorType["NO_VERB"] = "NO_VERB";
20
+ ParseErrorType["UNKNOWN_VERB"] = "UNKNOWN_VERB";
21
+ ParseErrorType["UNKNOWN_WORD"] = "UNKNOWN_WORD";
22
+ ParseErrorType["AMBIGUOUS"] = "AMBIGUOUS";
23
+ ParseErrorType["INCOMPLETE"] = "INCOMPLETE";
24
+ ParseErrorType["PATTERN_MISMATCH"] = "PATTERN_MISMATCH";
25
+ })(ParseErrorType || (exports.ParseErrorType = ParseErrorType = {}));
26
+ //# sourceMappingURL=parser-internals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-internals.js","sourceRoot":"","sources":["../../src/parser-contracts/parser-internals.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA6HH;;;;GAIG;AACH,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+CAA6B,CAAA;IAC7B,+CAA6B,CAAA;IAC7B,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;AACvC,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Parser types and interfaces
3
+ *
4
+ * The parser is world-agnostic and produces parsed commands
5
+ * that must be resolved against the world model.
6
+ */
7
+ import { PartOfSpeech, VerbVocabulary, VocabularyEntry } from '../vocabulary-contracts/vocabulary-types';
8
+ import type { ISystemEvent } from '@sharpee/core';
9
+ /**
10
+ * Base parser interface that can be extended
11
+ */
12
+ export interface BaseParser {
13
+ /**
14
+ * Parse input text into structured command
15
+ * @param input Raw text input
16
+ * @returns Parsed command or parse error
17
+ */
18
+ parse(input: string): any;
19
+ }
20
+ /**
21
+ * A token from the lexer
22
+ */
23
+ export interface Token {
24
+ /**
25
+ * The original word
26
+ */
27
+ word: string;
28
+ /**
29
+ * Normalized form (lowercase, etc.)
30
+ */
31
+ normalized: string;
32
+ /**
33
+ * Position in the input
34
+ */
35
+ position: number;
36
+ /**
37
+ * Possible parts of speech for this token
38
+ */
39
+ candidates: TokenCandidate[];
40
+ }
41
+ /**
42
+ * A candidate interpretation of a token
43
+ */
44
+ export interface TokenCandidate {
45
+ /**
46
+ * Part of speech
47
+ */
48
+ partOfSpeech: PartOfSpeech;
49
+ /**
50
+ * What this token maps to
51
+ */
52
+ mapsTo: string;
53
+ /**
54
+ * Priority for disambiguation
55
+ */
56
+ priority: number;
57
+ /**
58
+ * Source of this interpretation
59
+ */
60
+ source?: string;
61
+ /**
62
+ * Additional metadata
63
+ */
64
+ metadata?: Record<string, unknown>;
65
+ }
66
+ /**
67
+ * Parser options
68
+ */
69
+ export interface ParserOptions {
70
+ /**
71
+ * Whether to allow partial matches
72
+ */
73
+ allowPartial?: boolean;
74
+ /**
75
+ * Whether to expand abbreviations
76
+ */
77
+ expandAbbreviations?: boolean;
78
+ /**
79
+ * Whether to ignore articles
80
+ */
81
+ ignoreArticles?: boolean;
82
+ /**
83
+ * Minimum confidence threshold
84
+ */
85
+ minConfidence?: number;
86
+ }
87
+ /**
88
+ * Parser interface - extends the BaseParser
89
+ */
90
+ export interface Parser extends BaseParser {
91
+ /**
92
+ * Tokenize input without parsing
93
+ * Useful for debugging and testing
94
+ */
95
+ tokenize(input: string): Token[];
96
+ /**
97
+ * Set debug event callback for emitting parser debug events
98
+ * @deprecated Use setPlatformEventEmitter instead
99
+ */
100
+ setDebugCallback?(callback: (event: ISystemEvent) => void): void;
101
+ /**
102
+ * Set platform event emitter for parser debugging
103
+ * The emitter should accept SemanticEvent objects
104
+ */
105
+ setPlatformEventEmitter?(emitter: (event: any) => void): void;
106
+ /**
107
+ * Set the world context for scope constraint evaluation
108
+ * @param world The world model
109
+ * @param actorId The current actor performing the command
110
+ * @param currentLocation The actor's current location
111
+ */
112
+ setWorldContext?(world: any, actorId: string, currentLocation: string): void;
113
+ /**
114
+ * Register additional verbs after parser creation
115
+ * Used for story-specific vocabulary
116
+ */
117
+ registerVerbs?(verbs: VerbVocabulary[]): void;
118
+ /**
119
+ * Register additional vocabulary entries after parser creation
120
+ * More generic than registerVerbs - can handle any part of speech
121
+ */
122
+ registerVocabulary?(entries: VocabularyEntry[]): void;
123
+ /**
124
+ * Enable or disable a specific verb by action ID
125
+ */
126
+ setVerbEnabled?(actionId: string, enabled: boolean): void;
127
+ }
128
+ //# sourceMappingURL=parser-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-types.d.ts","sourceRoot":"","sources":["../../src/parser-contracts/parser-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,UAAU;IACxC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;IAEjE;;;OAGG;IACH,uBAAuB,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAE9D;;;;;OAKG;IACH,eAAe,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7E;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAE9C;;;OAGG;IACH,kBAAkB,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3D"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Parser types and interfaces
4
+ *
5
+ * The parser is world-agnostic and produces parsed commands
6
+ * that must be resolved against the world model.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=parser-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-types.js","sourceRoot":"","sources":["../../src/parser-contracts/parser-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Parser Language Provider Interface
3
+ *
4
+ * Extends the base LanguageProvider with parser-specific functionality.
5
+ * Language implementations must provide both text/messaging capabilities
6
+ * and parser vocabulary/grammar rules.
7
+ */
8
+ import { LanguageProvider } from './language-provider';
9
+ import { VerbVocabulary, DirectionVocabulary, SpecialVocabulary } from './vocabulary-contracts/vocabulary-types';
10
+ /**
11
+ * Language-specific grammar pattern definition
12
+ * Different from the vocabulary-types GrammarPattern
13
+ */
14
+ export interface LanguageGrammarPattern {
15
+ name: string;
16
+ pattern: string;
17
+ example: string;
18
+ priority: number;
19
+ }
20
+ /**
21
+ * Parser-specific language provider interface
22
+ *
23
+ * Extends the base LanguageProvider with methods needed for parsing
24
+ * natural language commands. Each language implementation must provide
25
+ * vocabulary data and grammar rules specific to that language.
26
+ */
27
+ export interface ParserLanguageProvider extends LanguageProvider {
28
+ /**
29
+ * Get verb vocabulary for the language
30
+ * @returns Array of verb vocabulary entries
31
+ */
32
+ getVerbs(): VerbVocabulary[];
33
+ /**
34
+ * Get directional vocabulary for the language
35
+ * @returns Array of direction vocabulary entries
36
+ */
37
+ getDirections(): DirectionVocabulary[];
38
+ /**
39
+ * Get special vocabulary (articles, pronouns, etc.)
40
+ * @returns Special vocabulary object
41
+ */
42
+ getSpecialVocabulary(): SpecialVocabulary;
43
+ /**
44
+ * Get prepositions for the language
45
+ * @returns Array of preposition strings
46
+ */
47
+ getPrepositions(): string[];
48
+ /**
49
+ * Get determiners for the language
50
+ * @returns Array of determiner strings
51
+ */
52
+ getDeterminers(): string[];
53
+ /**
54
+ * Get conjunctions for the language
55
+ * @returns Array of conjunction strings
56
+ */
57
+ getConjunctions(): string[];
58
+ /**
59
+ * Get number words for the language
60
+ * @returns Array of number strings (both words and digits)
61
+ */
62
+ getNumbers(): string[];
63
+ /**
64
+ * Get grammar patterns for the language
65
+ * @returns Array of grammar pattern definitions
66
+ */
67
+ getGrammarPatterns(): LanguageGrammarPattern[];
68
+ /**
69
+ * Lemmatize a word (reduce to base form)
70
+ * @param word The word to lemmatize
71
+ * @returns The base form of the word
72
+ */
73
+ lemmatize(word: string): string;
74
+ /**
75
+ * Expand an abbreviation
76
+ * @param abbreviation The abbreviation to expand
77
+ * @returns The expanded form or null if not recognized
78
+ */
79
+ expandAbbreviation(abbreviation: string): string | null;
80
+ /**
81
+ * Format a list of items with proper conjunction
82
+ * @param items Array of strings to format
83
+ * @param conjunction 'and' or 'or'
84
+ * @returns Formatted string (e.g., "a, b, and c")
85
+ */
86
+ formatList(items: string[], conjunction: 'and' | 'or'): string;
87
+ /**
88
+ * Get the appropriate indefinite article for a noun
89
+ * @param noun The noun to get article for
90
+ * @returns 'a' or 'an'
91
+ */
92
+ getIndefiniteArticle(noun: string): string;
93
+ /**
94
+ * Pluralize a noun
95
+ * @param noun The noun to pluralize
96
+ * @returns The plural form
97
+ */
98
+ pluralize(noun: string): string;
99
+ /**
100
+ * Check if a word should be ignored in parsing
101
+ * @param word The word to check
102
+ * @returns True if the word should be ignored
103
+ */
104
+ isIgnoreWord(word: string): boolean;
105
+ /**
106
+ * Get common adjectives for the language
107
+ * @returns Array of common adjective strings
108
+ */
109
+ getCommonAdjectives(): string[];
110
+ /**
111
+ * Get common nouns for the language
112
+ * @returns Array of common noun strings
113
+ */
114
+ getCommonNouns(): string[];
115
+ /**
116
+ * Get entity name/description
117
+ * @param entity Entity object or ID
118
+ * @returns Entity name or fallback
119
+ */
120
+ getEntityName(entity: any): string;
121
+ /**
122
+ * Get verb mappings (alternative to getVerbs)
123
+ * @returns Record mapping action IDs to verb arrays
124
+ */
125
+ getVerbMappings?(): Record<string, string[]>;
126
+ /**
127
+ * Get verb pattern for a specific action
128
+ * @param actionId The action ID
129
+ * @returns The pattern string or undefined
130
+ */
131
+ getVerbPattern?(actionId: string): string | undefined;
132
+ /**
133
+ * Get direction mappings (alternative to getDirections)
134
+ * @returns Record mapping directions to word arrays
135
+ */
136
+ getDirectionMappings?(): Record<string, string[]>;
137
+ /**
138
+ * Get pronouns (alternative to getSpecialVocabulary)
139
+ * @returns Array of pronoun strings
140
+ */
141
+ getPronouns?(): string[];
142
+ /**
143
+ * Get all words (alternative to getSpecialVocabulary)
144
+ * @returns Array of words meaning "all"
145
+ */
146
+ getAllWords?(): string[];
147
+ /**
148
+ * Get except words (alternative to getSpecialVocabulary)
149
+ * @returns Array of words meaning "except"
150
+ */
151
+ getExceptWords?(): string[];
152
+ /**
153
+ * Get articles (alternative to getSpecialVocabulary)
154
+ * @returns Array of article strings
155
+ */
156
+ getArticles?(): string[];
157
+ }
158
+ //# sourceMappingURL=parser-language-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-language-provider.d.ts","sourceRoot":"","sources":["../src/parser-language-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,yCAAyC,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;;OAGG;IACH,QAAQ,IAAI,cAAc,EAAE,CAAC;IAE7B;;;OAGG;IACH,aAAa,IAAI,mBAAmB,EAAE,CAAC;IAEvC;;;OAGG;IACH,oBAAoB,IAAI,iBAAiB,CAAC;IAE1C;;;OAGG;IACH,eAAe,IAAI,MAAM,EAAE,CAAC;IAE5B;;;OA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OAGG;IACH,cAAc,CAAC,IAAI,MAAM,EAAE,CAAC;IAE5B;;;OAGG;IACH,WAAW,CAAC,IAAI,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Parser Language Provider Interface
4
+ *
5
+ * Extends the base LanguageProvider with parser-specific functionality.
6
+ * Language implementations must provide both text/messaging capabilities
7
+ * and parser vocabulary/grammar rules.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=parser-language-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-language-provider.js","sourceRoot":"","sources":["../src/parser-language-provider.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Domain types for event sequencing and turn management
3
+ */
4
+ import { ISemanticEvent } from '@sharpee/core';
5
+ /**
6
+ * Turn phases for event organization
7
+ */
8
+ export type TurnPhase = 'pre' | 'main' | 'post' | 'reactions' | 'cleanup';
9
+ /**
10
+ * Sequence information for an event
11
+ */
12
+ export interface EventSequence {
13
+ /**
14
+ * Turn number (increments each command)
15
+ */
16
+ turn: number;
17
+ /**
18
+ * Order within the turn (1, 2, 3...)
19
+ */
20
+ order: number;
21
+ /**
22
+ * Sub-order for nested events (1.1, 1.2, etc.)
23
+ */
24
+ subOrder?: number;
25
+ /**
26
+ * Phase of turn execution
27
+ */
28
+ phase?: TurnPhase;
29
+ }
30
+ /**
31
+ * Event with sequencing information
32
+ */
33
+ export interface SequencedEvent extends ISemanticEvent {
34
+ sequence: EventSequence;
35
+ }
36
+ /**
37
+ * Interface for event sequencing
38
+ */
39
+ export interface EventSequencer {
40
+ /**
41
+ * Sequence events for a turn
42
+ */
43
+ sequence(events: ISemanticEvent[], turn: number, startOrder?: number): SequencedEvent[];
44
+ /**
45
+ * Get next order number
46
+ */
47
+ getNextOrder(turn: number): number;
48
+ /**
49
+ * Reset sequencing for a new turn
50
+ */
51
+ resetTurn(turn: number): void;
52
+ }
53
+ //# sourceMappingURL=sequencing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequencing.d.ts","sourceRoot":"","sources":["../src/sequencing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;IAExF;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Domain types for event sequencing and turn management
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=sequencing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequencing.js","sourceRoot":"","sources":["../src/sequencing.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Vocabulary contracts module exports
3
+ */
4
+ export * from './vocabulary-types';
5
+ export * from './vocabulary-registry';
6
+ export * from './vocabulary-adapters';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vocabulary-contracts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * Vocabulary contracts module exports
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./vocabulary-types"), exports);
21
+ __exportStar(require("./vocabulary-registry"), exports);
22
+ __exportStar(require("./vocabulary-adapters"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vocabulary-contracts/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,qDAAmC;AACnC,wDAAsC;AACtC,wDAAsC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Vocabulary adapters for converting language-specific vocabulary
3
+ * to the standard vocabulary types used by the parser
4
+ */
5
+ import { VerbVocabulary, DirectionVocabulary, SpecialVocabulary } from './vocabulary-types';
6
+ import { ParserLanguageProvider } from '../parser-language-provider';
7
+ /**
8
+ * Adapt verb vocabulary from language provider format
9
+ */
10
+ export declare function adaptVerbVocabulary(languageProvider: ParserLanguageProvider): VerbVocabulary[];
11
+ /**
12
+ * Adapt direction vocabulary from language provider format
13
+ */
14
+ export declare function adaptDirectionVocabulary(languageProvider: ParserLanguageProvider): DirectionVocabulary[];
15
+ /**
16
+ * Adapt special vocabulary from language provider format
17
+ */
18
+ export declare function adaptSpecialVocabulary(languageProvider: ParserLanguageProvider): SpecialVocabulary;
19
+ //# sourceMappingURL=vocabulary-adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary-adapters.d.ts","sourceRoot":"","sources":["../../src/vocabulary-contracts/vocabulary-adapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,cAAc,EAAE,CAqB9F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,mBAAmB,EAAE,CAyBxG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,iBAAiB,CAalG"}