@sharpee/if-domain 5.4.0 → 5.5.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 (60) hide show
  1. package/channels/index.d.ts +3 -1
  2. package/channels/index.d.ts.map +1 -1
  3. package/channels/index.js +2 -0
  4. package/channels/index.js.map +1 -1
  5. package/channels/types.d.ts +80 -2
  6. package/channels/types.d.ts.map +1 -1
  7. package/channels/types.js.map +1 -1
  8. package/endings.d.ts +8 -19
  9. package/endings.d.ts.map +1 -1
  10. package/endings.js +9 -20
  11. package/endings.js.map +1 -1
  12. package/grammar/grammar-builder.d.ts +162 -156
  13. package/grammar/grammar-builder.d.ts.map +1 -1
  14. package/grammar/grammar-builder.js +1 -1
  15. package/grammar/grammar-builder.js.map +1 -1
  16. package/grammar/grammar-engine.d.ts +8 -10
  17. package/grammar/grammar-engine.d.ts.map +1 -1
  18. package/grammar/grammar-engine.js +129 -182
  19. package/grammar/grammar-engine.js.map +1 -1
  20. package/grammar/index.d.ts +1 -0
  21. package/grammar/index.d.ts.map +1 -1
  22. package/grammar/index.js +1 -0
  23. package/grammar/index.js.map +1 -1
  24. package/grammar/pattern-compiler.d.ts +20 -16
  25. package/grammar/pattern-compiler.d.ts.map +1 -1
  26. package/grammar/pattern-compiler.js +6 -1
  27. package/grammar/pattern-compiler.js.map +1 -1
  28. package/grammar/rule-order.d.ts +53 -0
  29. package/grammar/rule-order.d.ts.map +1 -0
  30. package/grammar/rule-order.js +47 -0
  31. package/grammar/rule-order.js.map +1 -0
  32. package/grammar/scope-builder.d.ts +10 -3
  33. package/grammar/scope-builder.d.ts.map +1 -1
  34. package/grammar/scope-builder.js +12 -13
  35. package/grammar/scope-builder.js.map +1 -1
  36. package/language-provider.d.ts +10 -1
  37. package/language-provider.d.ts.map +1 -1
  38. package/package.json +3 -3
  39. package/parser-contracts/parser-internals.d.ts +0 -12
  40. package/parser-contracts/parser-internals.d.ts.map +1 -1
  41. package/parser-contracts/parser-internals.js.map +1 -1
  42. package/parser-contracts/parser-types.d.ts +0 -12
  43. package/parser-contracts/parser-types.d.ts.map +1 -1
  44. package/parser-language-provider.d.ts +28 -35
  45. package/parser-language-provider.d.ts.map +1 -1
  46. package/sound/types.d.ts +21 -0
  47. package/sound/types.d.ts.map +1 -1
  48. package/sound/types.js +21 -1
  49. package/sound/types.js.map +1 -1
  50. package/vocabulary-contracts/vocabulary-adapters.d.ts +6 -2
  51. package/vocabulary-contracts/vocabulary-adapters.d.ts.map +1 -1
  52. package/vocabulary-contracts/vocabulary-adapters.js +8 -33
  53. package/vocabulary-contracts/vocabulary-adapters.js.map +1 -1
  54. package/vocabulary-contracts/vocabulary-registry.d.ts +9 -23
  55. package/vocabulary-contracts/vocabulary-registry.d.ts.map +1 -1
  56. package/vocabulary-contracts/vocabulary-registry.js +10 -66
  57. package/vocabulary-contracts/vocabulary-registry.js.map +1 -1
  58. package/vocabulary-contracts/vocabulary-types.d.ts +22 -25
  59. package/vocabulary-contracts/vocabulary-types.d.ts.map +1 -1
  60. package/vocabulary-contracts/vocabulary-types.js.map +1 -1
@@ -3,6 +3,7 @@
3
3
  * @description Language-agnostic interfaces for defining grammar rules
4
4
  */
5
5
  import { type IEntity } from '@sharpee/core';
6
+ import type { NounRank } from './rule-order.js';
6
7
  /**
7
8
  * Slot types for grammar patterns
8
9
  * Controls how the parser handles slot matching
@@ -12,7 +13,7 @@ export declare enum SlotType {
12
13
  ENTITY = "entity",
13
14
  /** Capture raw text without entity resolution (single token) */
14
15
  TEXT = "text",
15
- /** Capture raw text until next pattern element or end (greedy) */
16
+ /** Capture raw text; the consumer admits every extent to the end of the input and the engine's search chooses (greedy, ADR-386 D1) */
16
17
  TEXT_GREEDY = "text_greedy",
17
18
  /** Resolve entity but mark as instrument for the action */
18
19
  INSTRUMENT = "instrument",
@@ -69,9 +70,7 @@ export interface ScopeBuilder {
69
70
  carried(): ScopeBuilder;
70
71
  nearby(): ScopeBuilder;
71
72
  matching(constraint: PropertyConstraint | FunctionConstraint): ScopeBuilder;
72
- kind(kind: string): ScopeBuilder;
73
73
  orExplicitly(entityIds: string[]): ScopeBuilder;
74
- orRule(ruleId: string): ScopeBuilder;
75
74
  /**
76
75
  * Require the entity to have a specific trait
77
76
  * @param traitType The trait type constant (e.g., TraitType.PORTABLE)
@@ -88,7 +87,6 @@ export interface ScopeConstraint {
88
87
  /** Required trait types the entity must have */
89
88
  traitFilters: string[];
90
89
  explicitEntities: string[];
91
- includeRules: string[];
92
90
  }
93
91
  /**
94
92
  * ADR-082: Typed slot value for non-entity slots
@@ -156,31 +154,30 @@ export interface PatternBuilder {
156
154
  * @param slot The slot name from the pattern
157
155
  */
158
156
  instrument(slot: string): PatternBuilder;
157
+ /**
158
+ * Declare an entity slot's seat (ADR-383 D2), for a line written
159
+ * indirect-first: `define('hand :recipient :item').seat('item', 'direct')`.
160
+ * Undeclared entity slots take the seats left free, in pattern order.
161
+ * @param slot The slot name from the pattern
162
+ * @param seat Where the slot's noun goes in the parsed command
163
+ */
164
+ seat(slot: string, seat: Seat): PatternBuilder;
159
165
  /**
160
166
  * Map this pattern to an action
161
167
  * @param action The action identifier
162
168
  */
163
169
  mapsTo(action: string): PatternBuilder;
164
- /**
165
- * Add semantic mappings for verbs
166
- * @param verbs Map of verb text to semantic properties
167
- */
168
- withSemanticVerbs(verbs: Record<string, Partial<SemanticProperties>>): PatternBuilder;
169
- /**
170
- * Add semantic mappings for prepositions
171
- * @param prepositions Map of preposition text to spatial relations
172
- */
173
- withSemanticPrepositions(prepositions: Record<string, string>): PatternBuilder;
174
- /**
175
- * Add semantic mappings for directions
176
- * @param directions Map of direction text to normalized directions
177
- */
178
- withSemanticDirections(directions: Record<string, string>): PatternBuilder;
179
170
  /**
180
171
  * Set default semantic properties
181
172
  * @param defaults Default semantic properties
182
173
  */
183
174
  withDefaultSemantics(defaults: Partial<SemanticProperties>): PatternBuilder;
175
+ /**
176
+ * Gate this rule on the live world (ADR-378 D5): skipped while the
177
+ * predicate answers false, as though the rule did not exist.
178
+ * @param predicate Read against the GrammarContext at match time
179
+ */
180
+ when(predicate: GrammarGate): PatternBuilder;
184
181
  /**
185
182
  * Mark a slot as a number (integer)
186
183
  * Matches digits (1, 29, 100) or words (one, twenty)
@@ -273,21 +270,15 @@ export interface GrammarBuilder {
273
270
  */
274
271
  define(pattern: string): PatternBuilder;
275
272
  /**
276
- * ADR-087: Define grammar patterns for an action with verb aliases
277
- * @param actionId The action identifier to map patterns to
278
- * @returns An ActionGrammarBuilder for fluent configuration
279
- *
280
- * @example
281
- * ```typescript
282
- * grammar
283
- * .forAction('if.action.pushing')
284
- * .verbs(['push', 'press', 'shove', 'move'])
285
- * .pattern(':target')
286
- * .where('target', scope => scope.touchable())
287
- * .build();
288
- * ```
273
+ * Register one rule from structured parts (ADR-382 D2), at this
274
+ * builder's tier. The Chord loader's and the generated standard
275
+ * grammar's entry: no text is parsed.
276
+ * @param spec The rule's action, parts, display text and per-slot configuration
277
+ * @throws PatternSyntaxError when the parts are malformed; Error when a
278
+ * slot configuration names a slot the parts lack, or types a greedy slot
279
+ * as anything but TEXT_GREEDY
289
280
  */
290
- forAction(actionId: string): ActionGrammarBuilder;
281
+ rule(spec: GrammarRuleSpec): void;
291
282
  /**
292
283
  * Get all defined rules
293
284
  */
@@ -297,104 +288,21 @@ export interface GrammarBuilder {
297
288
  */
298
289
  clear(): void;
299
290
  /**
300
- * ADR-270 D3: remove registered rules by shape — (action id, pattern
301
- * string, tier). Diagnostic-free: returns the count removed (0 = no rule
302
- * matched); the caller owns any miss diagnostic. `tier` defaults to
303
- * 'standard' — the alteration model removes platform rules, never story
304
- * rules, unless explicitly asked.
291
+ * ADR-270 D3: remove registered rules by shape — (action id, shape,
292
+ * tier), the shape test supplied by the caller over each rule (ADR-382 D6;
293
+ * Chord's is `samePatternShape` on `rule.parts`). Diagnostic-free:
294
+ * returns the count removed (0 = no rule matched); the caller owns any
295
+ * miss diagnostic. `tier` defaults to 'standard' — the alteration model
296
+ * removes platform rules, never story rules, unless explicitly asked.
305
297
  */
306
- removeRules(action: string, pattern: string, tier?: GrammarTier): number;
298
+ removeRules(action: string, shapeMatches: (rule: GrammarRule) => boolean, tier?: GrammarTier): number;
307
299
  }
308
300
  /**
309
- * ADR-087: Action-centric grammar builder
310
- * Allows defining multiple patterns for an action with verb aliases
311
- */
312
- export interface ActionGrammarBuilder {
313
- /**
314
- * Define verb aliases for this action
315
- * Each verb will generate a separate pattern
316
- * @param verbs Array of verb strings (e.g., ['push', 'press', 'shove'])
317
- */
318
- verbs(verbs: string[]): ActionGrammarBuilder;
319
- /**
320
- * Define a pattern template (without verb)
321
- * Will be combined with each verb to create full patterns
322
- * @param pattern Pattern template (e.g., ':target' becomes 'push :target', 'press :target', etc.)
323
- */
324
- pattern(pattern: string): ActionGrammarBuilder;
325
- /**
326
- * Define multiple pattern templates
327
- * Each pattern will be combined with each verb
328
- * @param patterns Array of pattern templates
329
- *
330
- * @example
331
- * ```typescript
332
- * grammar
333
- * .forAction('if.action.pushing')
334
- * .verbs(['push', 'press'])
335
- * .patterns([':target', ':target :direction'])
336
- * .build();
337
- * // Generates: push :target, press :target, push :target :direction, press :target :direction
338
- * ```
339
- */
340
- patterns(patterns: string[]): ActionGrammarBuilder;
341
- /**
342
- * ADR-271 D3: Define a complete pattern line, verb included
343
- * (e.g. 'pet :animal'). Emitted as its own rule with the action's shared
344
- * configuration applied — NOT crossed with verbs(). Slot-scoped
345
- * configuration (.where(), slotType()) attaches only to lines that carry
346
- * the slot. This is the Chord compiler's emission path, where grammar
347
- * lines arrive whole rather than as verb + template.
348
- * @param pattern Complete pattern line including its verb (non-empty)
349
- */
350
- fullPattern(pattern: string): ActionGrammarBuilder;
351
- /**
352
- * Define direction patterns with aliases
353
- * Creates standalone direction patterns (no verb prefix)
354
- * @param directionMap Map of canonical direction to aliases
355
- *
356
- * @example
357
- * ```typescript
358
- * grammar
359
- * .forAction('if.action.going')
360
- * .directions({
361
- * 'north': ['north', 'n'],
362
- * 'south': ['south', 's'],
363
- * })
364
- * .build();
365
- * // Generates patterns 'north', 'n', 'south', 's' each with direction semantics
366
- * ```
367
- */
368
- directions(directionMap: Record<string, string[]>): ActionGrammarBuilder;
369
- /**
370
- * Define a scope constraint for a slot (applies to all generated patterns).
371
- * `.where()` scope constraints are the one parse-time gating mechanism;
372
- * trait-based refusal lives in each action's validate().
373
- * @param slot The slot name from the pattern
374
- * @param constraint A scope-builder callback, e.g. `scope => scope.touchable()`
375
- */
376
- where(slot: string, constraint: ScopeConstraintBuilder): ActionGrammarBuilder;
377
- /**
378
- * Set default semantic properties for all generated patterns
379
- * @param defaults Default semantic properties
380
- */
381
- withDefaultSemantics(defaults: Partial<SemanticProperties>): ActionGrammarBuilder;
382
- /**
383
- * Mark a slot as a specific type (applies to all generated patterns)
384
- * @param slot The slot name
385
- * @param slotType The slot type
386
- */
387
- slotType(slot: string, slotType: SlotType): ActionGrammarBuilder;
388
- /**
389
- * Build all patterns and add them to the grammar
390
- * Generates patterns from: verbs × patterns combinations
391
- */
392
- build(): void;
393
- }
394
- /**
395
- * Grammar tier (ADR-268 D2): which layer defined the rule. Story-tier rules
396
- * outrank standard-tier rules unconditionally (before specificity is
397
- * consulted) — "story overrides platform". Set at the registration entry
301
+ * Grammar tier: which layer defined the rule. At equal literal specificity a
302
+ * story-tier rule outranks a standard-tier one; a more specific standard rule
303
+ * still wins, and a story replaces one by removing it (ADR-384 D2,
304
+ * `compareGrammarRank`; a reading with an item naming nothing ranks below
305
+ * both, ADR-386 D5). Set at the registration entry
398
306
  * point: the standard grammar's builder registers 'standard'; the story
399
307
  * grammar surface (getStoryGrammar()) and the Chord loader register 'story'.
400
308
  */
@@ -402,17 +310,29 @@ export type GrammarTier = 'standard' | 'story';
402
310
  /**
403
311
  * A compiled grammar rule
404
312
  */
313
+ /**
314
+ * A rule-level gate (ADR-378 D5, GH #317): read against the live world
315
+ * before matching. A rule whose gate answers false is skipped — neither a
316
+ * match nor a failure — so the input parses as though the rule did not
317
+ * exist. Story-tier only in practice: a Chord `define action … while
318
+ * <condition>` head, or a passage's command words gated to the room that
319
+ * declares the passage.
320
+ */
321
+ export type GrammarGate = (context: GrammarContext) => boolean;
405
322
  export interface GrammarRule {
406
323
  id: string;
324
+ /** Display text for diagnostics and failure messages; nothing parses it (ADR-382 D2). */
407
325
  pattern: string;
326
+ /** The rule's structure — the only source of its words and slots. */
327
+ parts: readonly PatternElement[];
408
328
  compiledPattern?: CompiledPattern;
409
329
  slots: Map<string, SlotConstraint>;
410
330
  action: string;
411
331
  /** ADR-268 D2: resolution layer — story outranks standard */
412
332
  tier: GrammarTier;
413
- semantics?: SemanticMapping;
333
+ /** ADR-378 D5: skip the rule while this answers false (absent = always on) */
334
+ when?: GrammarGate;
414
335
  defaultSemantics?: Partial<SemanticProperties>;
415
- experimentalConfidence?: number;
416
336
  }
417
337
  /**
418
338
  * Semantic properties that can be derived from grammar
@@ -422,8 +342,16 @@ export interface SemanticProperties {
422
342
  manner?: 'normal' | 'careful' | 'careless' | 'forceful' | 'stealthy' | 'quick';
423
343
  /** Spatial relationship for placement actions */
424
344
  spatialRelation?: 'in' | 'on' | 'under' | 'behind' | 'beside' | 'above' | 'below';
425
- /** Direction for movement */
426
- direction?: 'north' | 'south' | 'east' | 'west' | 'up' | 'down' | 'northeast' | 'northwest' | 'southeast' | 'southwest' | 'in' | 'out';
345
+ /**
346
+ * The direction a movement rule carries, as the action's own vocabulary
347
+ * names it: a compass word (`world-model`'s `DirectionType`, `in` and
348
+ * `out` included), a passage key (`passage:<name>`, ADR-378 D1 — a way
349
+ * answered by a custom command rather than a compass word), or a ship
350
+ * direction under `use sailing` (`port`, `starboard`, `ahead`, ADR-375).
351
+ * The word is per action, so the contract does not close the set; the
352
+ * consumer that reads it resolves it against the ways it knows.
353
+ */
354
+ direction?: string;
427
355
  /** Whether the preposition was implicit */
428
356
  implicitPreposition?: boolean;
429
357
  /** Whether a direction was implicit */
@@ -431,19 +359,6 @@ export interface SemanticProperties {
431
359
  /** Custom properties for specific actions */
432
360
  [key: string]: any;
433
361
  }
434
- /**
435
- * Mapping from text variations to semantic properties
436
- */
437
- export interface SemanticMapping {
438
- /** Map verb variations to properties */
439
- verbs?: Record<string, Partial<SemanticProperties>>;
440
- /** Map preposition variations to spatial relations */
441
- prepositions?: Record<string, string>;
442
- /** Map direction variations to normalized directions */
443
- directions?: Record<string, string>;
444
- /** Function to compute dynamic semantics based on match */
445
- compute?: (match: any) => Partial<SemanticProperties>;
446
- }
447
362
  /**
448
363
  * Slot constraint definition
449
364
  */
@@ -454,6 +369,8 @@ export interface SlotConstraint {
454
369
  slotType?: SlotType;
455
370
  /** For VOCABULARY slots: the category name to match against */
456
371
  vocabularyCategory?: string;
372
+ /** Declared seat of an entity slot (ADR-383 D1) */
373
+ seat?: Seat;
457
374
  }
458
375
  /**
459
376
  * Token in a pattern
@@ -467,14 +384,84 @@ export interface PatternToken {
467
384
  greedy?: boolean;
468
385
  vocabularyCategory?: string;
469
386
  }
387
+ /**
388
+ * One element of a grammar pattern, as a rule is registered (ADR-382 D1).
389
+ * A rule crosses into the engine as these parts, never as text to re-split:
390
+ * a word, an alternation of words, or a named slot, each optionally
391
+ * optional. No element fixes where a slot ends: each slot admits every
392
+ * extent it can read and the engine searches them (ADR-386 D1, D2); a
393
+ * greedy slot is a text slot whose extents run to the end of the input.
394
+ */
395
+ export type PatternElement = {
396
+ kind: 'word';
397
+ word: string;
398
+ optional?: boolean;
399
+ } | {
400
+ kind: 'alt';
401
+ words: readonly string[];
402
+ optional?: boolean;
403
+ } | {
404
+ kind: 'slot';
405
+ name: string;
406
+ optional?: boolean;
407
+ greedy?: boolean;
408
+ };
409
+ /**
410
+ * Where an entity slot's noun goes in the parsed command (ADR-383 D1).
411
+ * Every other slot type is seated by its type (instrument, topic, text,
412
+ * vocabulary, manner, direction).
413
+ */
414
+ export type Seat = 'direct' | 'indirect';
415
+ /**
416
+ * Per-slot configuration on a rule spec: the slot's type, its scope
417
+ * constraints and, for an entity slot, its declared seat. Keyed by slot
418
+ * name; a name no part carries is a build error.
419
+ */
420
+ export interface GrammarRuleSlotSpec {
421
+ type?: SlotType;
422
+ constraints?: readonly ScopeConstraintBuilder[];
423
+ /** For VOCABULARY slots: the category name to match against */
424
+ vocabularyCategory?: string;
425
+ /** The entity slot's seat; undeclared seats take the positional default (ADR-383 D2). */
426
+ seat?: Seat;
427
+ }
428
+ /**
429
+ * A grammar rule, as data (ADR-382 D2) — what `GrammarBuilder.rule()` takes.
430
+ */
431
+ export interface GrammarRuleSpec {
432
+ action: string;
433
+ parts: readonly PatternElement[];
434
+ /** How the rule displays in diagnostics and failure messages; never parsed. */
435
+ pattern: string;
436
+ defaults?: Partial<SemanticProperties>;
437
+ slots?: Readonly<Record<string, GrammarRuleSlotSpec>>;
438
+ when?: GrammarGate;
439
+ }
440
+ /**
441
+ * One slot of a compiled pattern (ADR-382 D4): the single source of a
442
+ * slot's name, position, optionality, greediness and resolved type.
443
+ */
444
+ export interface CompiledSlot {
445
+ name: string;
446
+ /** Index of the slot's token in `CompiledPattern.tokens`. */
447
+ tokenIndex: number;
448
+ optional: boolean;
449
+ greedy: boolean;
450
+ /** The configured type, `TEXT_GREEDY` for a greedy slot, else `ENTITY`. */
451
+ slotType: SlotType;
452
+ /** Set on every ENTITY slot at build (ADR-383 D1, D2); absent on every other slot type. */
453
+ seat?: Seat;
454
+ }
470
455
  /**
471
456
  * Compiled pattern for efficient matching
472
457
  */
473
458
  export interface CompiledPattern {
474
459
  tokens: PatternToken[];
475
- slots: Map<string, number>;
460
+ /** Every slot, in pattern order. */
461
+ slots: CompiledSlot[];
462
+ /** The same slot records, by name. */
463
+ slotsByName: ReadonlyMap<string, CompiledSlot>;
476
464
  minTokens: number;
477
- maxTokens: number;
478
465
  }
479
466
  /**
480
467
  * Slot match data with multi-object support
@@ -483,7 +470,10 @@ export interface SlotMatch {
483
470
  tokens: number[];
484
471
  text: string;
485
472
  slotType?: SlotType;
486
- confidence?: number;
473
+ articles?: string[];
474
+ determiners?: string[];
475
+ ownedByActor?: boolean;
476
+ scope?: string[];
487
477
  isAll?: boolean;
488
478
  isList?: boolean;
489
479
  items?: SlotMatch[];
@@ -500,22 +490,38 @@ export interface SlotMatch {
500
490
  */
501
491
  export interface PatternMatch {
502
492
  rule: GrammarRule;
503
- confidence: number;
504
493
  slots: Map<string, SlotMatch>;
505
494
  consumed: number;
506
495
  /**
507
496
  * Literal specificity (ADR-231 D2b): count of input words consumed by the
508
497
  * pattern's literal/alternate tokens (as opposed to slots). A rule whose
509
498
  * literals consume words outranks a rule whose unconstrained slot swallows
510
- * the same words. Resolution order (ADR-268 D2): confidence desc → tier
511
- * (story over standard) → literalSpecificity desc → definition order.
499
+ * the same words. Resolution order (ADR-386 D5, ADR-384 D2,
500
+ * `compareGrammarRank`): items naming nothing asc → literalSpecificity
501
+ * desc → tier (story over standard) → definition order → names desc →
502
+ * exact names desc.
512
503
  */
513
504
  literalSpecificity?: number;
505
+ /**
506
+ * How the reading's entity items resolve through the one noun matcher
507
+ * (ADR-386 D4): items naming nothing, distinct entities named, items named
508
+ * exactly. The engine computes it for every complete reading and ranks by
509
+ * it; the parser compares it with the best failure's (D5).
510
+ */
511
+ nounRank: NounRank;
514
512
  semantics?: SemanticProperties;
515
- matchedTokens?: {
516
- verb?: string;
517
- preposition?: string;
518
- direction?: string;
519
- };
513
+ /**
514
+ * Every literal (word or alternation) element, in pattern order, with the
515
+ * input tokens it consumed (ADR-383 D7) — where the verb phrase and the
516
+ * preposition are read from.
517
+ */
518
+ literals: readonly MatchedElement[];
519
+ }
520
+ /** One pattern element as it matched the input (ADR-383 D7). */
521
+ export interface MatchedElement {
522
+ /** Index of the element in `rule.compiledPattern.tokens`. */
523
+ tokenIndex: number;
524
+ /** Input token indices it consumed; empty for a skipped optional or article. */
525
+ inputTokens: readonly number[];
520
526
  }
521
527
  //# sourceMappingURL=grammar-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grammar-builder.d.ts","sourceRoot":"","sources":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AE,MAAM,CAAC;IACnB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,aAAa,CAAC,EAAE;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
1
+ {"version":3,"file":"grammar-builder.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/grammar-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,oBAAY,QAAQ;IAClB,oEAAoE;IACpE,MAAM,WAAW;IACjB,gEAAgE;IAChE,IAAI,SAAS;IACb,sIAAsI;IACtI,WAAW,gBAAgB;IAC3B,2DAA2D;IAC3D,UAAU,eAAe;IAGzB,wEAAwE;IACxE,SAAS,cAAc;IACvB,0DAA0D;IAC1D,MAAM,WAAW;IACjB,oDAAoD;IACpD,OAAO,YAAY;IACnB,0CAA0C;IAC1C,IAAI,SAAS;IACb,oFAAoF;IACpF,MAAM,WAAW;IAGjB,2CAA2C;IAC3C,WAAW,gBAAgB;IAC3B,mDAAmD;IACnD,KAAK,UAAU;IAGf,0DAA0D;IAC1D,UAAU,eAAe;IAGzB,gEAAgE;IAChE,SAAS,cAAc;IACvB,gEAAgE;IAChE,IAAI,SAAS;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,CAA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AO,CAAC;IAIvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IAEvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CACrC;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC"}
@@ -15,7 +15,7 @@ var SlotType;
15
15
  SlotType["ENTITY"] = "entity";
16
16
  /** Capture raw text without entity resolution (single token) */
17
17
  SlotType["TEXT"] = "text";
18
- /** Capture raw text until next pattern element or end (greedy) */
18
+ /** Capture raw text; the consumer admits every extent to the end of the input and the engine's search chooses (greedy, ADR-386 D1) */
19
19
  SlotType["TEXT_GREEDY"] = "text_greedy";
20
20
  /** Resolve entity but mark as instrument for the action */
21
21
  SlotType["INSTRUMENT"] = "instrument";
@@ -1 +1 @@
1
- {"version":3,"file":"grammar-builder.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/grammar-builder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACH,IAAY,QAqCX;AArCD,WAAY,QAAQ;IAClB,oEAAoE;IACpE,6BAAiB,CAAA;IACjB,gEAAgE;IAChE,yBAAa,CAAA;IACb,kEAAkE;IAClE,uCAA2B,CAAA;IAC3B,2DAA2D;IAC3D,qCAAyB,CAAA;IAEzB,sCAAsC;IACtC,wEAAwE;IACxE,mCAAuB,CAAA;IACvB,0DAA0D;IAC1D,6BAAiB,CAAA;IACjB,oDAAoD;IACpD,+BAAmB,CAAA;IACnB,0CAA0C;IAC1C,yBAAa,CAAA;IACb,oFAAoF;IACpF,6BAAiB,CAAA;IAEjB,8BAA8B;IAC9B,2CAA2C;IAC3C,uCAA2B,CAAA;IAC3B,mDAAmD;IACnD,2BAAe,CAAA;IAEf,2CAA2C;IAC3C,0DAA0D;IAC1D,qCAAyB,CAAA;IAEzB,2DAA2D;IAC3D,gEAAgE;IAChE,mCAAuB,CAAA;IACvB,gEAAgE;IAChE,yBAAa,CAAA;AACf,CAAC,EArCW,QAAQ,wBAAR,QAAQ,QAqCnB"}
1
+ {"version":3,"file":"grammar-builder.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/grammar-builder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;GAGG;AACH,IAAY,QAqCX;AArCD,WAAY,QAAQ;IAClB,oEAAoE;IACpE,6BAAiB,CAAA;IACjB,gEAAgE;IAChE,yBAAa,CAAA;IACb,sIAAsI;IACtI,uCAA2B,CAAA;IAC3B,2DAA2D;IAC3D,qCAAyB,CAAA;IAEzB,sCAAsC;IACtC,wEAAwE;IACxE,mCAAuB,CAAA;IACvB,0DAA0D;IAC1D,6BAAiB,CAAA;IACjB,oDAAoD;IACpD,+BAAmB,CAAA;IACnB,0CAA0C;IAC1C,yBAAa,CAAA;IACb,oFAAoF;IACpF,6BAAiB,CAAA;IAEjB,8BAA8B;IAC9B,2CAA2C;IAC3C,uCAA2B,CAAA;IAC3B,mDAAmD;IACnD,2BAAe,CAAA;IAEf,2CAA2C;IAC3C,0DAA0D;IAC1D,qCAAyB,CAAA;IAEzB,2DAA2D;IAC3D,gEAAgE;IAChE,mCAAuB,CAAA;IACvB,gEAAgE;IAChE,yBAAa,CAAA;AACf,CAAC,EArCW,QAAQ,wBAAR,QAAQ,QAqCnB"}
@@ -9,10 +9,6 @@ import { PatternCompiler } from './pattern-compiler.js';
9
9
  * Grammar matching options
10
10
  */
11
11
  export interface GrammarMatchOptions {
12
- /** Minimum confidence threshold */
13
- minConfidence?: number;
14
- /** Maximum number of matches to return */
15
- maxMatches?: number;
16
12
  /** Whether to allow partial matches */
17
13
  allowPartial?: boolean;
18
14
  }
@@ -29,8 +25,9 @@ export declare abstract class GrammarEngine {
29
25
  * Add a grammar rule.
30
26
  *
31
27
  * ADR-268: insertion is deliberately unsorted — registration order IS
32
- * definition order, the final tiebreak of the resolution order
33
- * (confidence → tier → literal specificity → definition order). Do not
28
+ * definition order, the last of the rule keys of the resolution order
29
+ * (items naming nothing → literal specificity → tier → definition order →
30
+ * names → exact names, `compareGrammarRank`, ADR-386 D5). Do not
34
31
  * reintroduce a sort here; it would erase the semantics of file order.
35
32
  */
36
33
  addRule(rule: GrammarRule): void;
@@ -52,20 +49,21 @@ export declare abstract class GrammarEngine {
52
49
  clear(): void;
53
50
  /**
54
51
  * ADR-270 D3: remove registered rules by shape — the alteration model's
55
- * removal primitive. Identity is (action id, pattern string, tier); rule
56
- * ids are nondeterministic and never part of identity.
52
+ * removal primitive. Identity is (action id, shape, tier); the shape test
53
+ * is the caller's (ADR-382 D6: Chord passes `samePatternShape` over the
54
+ * rule's parts). Rule ids are nondeterministic and never part of identity.
57
55
  *
58
56
  * Diagnostic-free by contract: returns the number of rules removed and
59
57
  * never throws — the CALLER owns the miss diagnostic (the Chord loader
60
58
  * raises its LoadError on 0; a TS story checks the return itself).
61
59
  *
62
60
  * @param action The action id whose rule is removed (e.g. 'if.action.taking').
63
- * @param pattern The exact registered pattern string (e.g. 'get :item').
61
+ * @param shapeMatches Whether a rule of that action and tier has the shape to remove.
64
62
  * @param tier The tier to remove from — 'standard' (default) targets the
65
63
  * platform grammar; story-tier rules are never touched unless asked.
66
64
  * @returns The number of rules removed (0 = no rule matched the shape).
67
65
  */
68
- removeRules(action: string, pattern: string, tier?: GrammarTier): number;
66
+ removeRules(action: string, shapeMatches: (rule: GrammarRule) => boolean, tier?: GrammarTier): number;
69
67
  /**
70
68
  * Get all rules
71
69
  */
@@ -1 +1 @@
1
- {"version":3,"file":"grammar-engine.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/grammar-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EAEd,cAAc,EAMf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,CAAM;IACpC,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAa;IAChE,SAAS,CAAC,QAAQ,EAAE,eAAe,CAAC;gBAExB,QAAQ,EAAE,eAAe;IAIrC;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAchC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI;IAIpC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAClB,MAAM,EAAE,KAAK,EAAE,EACf,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,EAAE;IAEjB;;OAEG;IACH,YAAY,CACV,MAAM,EAAE,KAAK,EAAE,EACf,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,GAAG,IAAI;IAKtB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,WAAwB,GAAG,MAAM;IAgBpF;;OAEG;IACH,QAAQ,IAAI,WAAW,EAAE;IAIzB;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IAIhD;;;;;;;OAOG;IACH,aAAa,CAAC,IAAI,GAAE,WAAwB,GAAG,cAAc;CA6V9D"}
1
+ {"version":3,"file":"grammar-engine.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/grammar-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EACL,WAAW,EAEX,WAAW,EACX,YAAY,EACZ,cAAc,EAEd,cAAc,EAQf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,8BAAsB,aAAa;IACjC,SA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