@sharpee/parser-en-us 1.0.0 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/direction-mappings.d.ts +1 -1
- package/direction-mappings.d.ts.map +1 -1
- package/direction-mappings.js +1 -1
- package/english-grammar-engine.d.ts +2 -2
- package/english-grammar-engine.d.ts.map +1 -1
- package/english-grammar-engine.js +2 -2
- package/english-parser.d.ts +4 -4
- package/english-parser.d.ts.map +1 -1
- package/english-parser.js +2 -2
- package/english-pattern-compiler.d.ts +1 -1
- package/english-pattern-compiler.d.ts.map +1 -1
- package/english-pattern-compiler.js +1 -1
- package/grammar-scope-resolver.d.ts +2 -2
- package/grammar-scope-resolver.d.ts.map +1 -1
- package/grammar.d.ts +1 -1
- package/grammar.d.ts.map +1 -1
- package/grammar.js +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/parse-failure.d.ts +1 -1
- package/parse-failure.d.ts.map +1 -1
- package/parser-types.d.ts +1 -1
- package/parser-types.d.ts.map +1 -1
- package/pronoun-context.d.ts +1 -1
- package/pronoun-context.d.ts.map +1 -1
- package/pronoun-context.js +2 -2
- package/slot-consumers/entity-slot-consumer.d.ts +1 -1
- package/slot-consumers/entity-slot-consumer.d.ts.map +1 -1
- package/slot-consumers/entity-slot-consumer.js +1 -1
- package/slot-consumers/index.d.ts +1 -1
- package/slot-consumers/index.d.ts.map +1 -1
- package/slot-consumers/slot-consumer.d.ts +2 -2
- package/slot-consumers/slot-consumer.d.ts.map +1 -1
- package/slot-consumers/text-slot-consumer.d.ts +1 -1
- package/slot-consumers/text-slot-consumer.d.ts.map +1 -1
- package/slot-consumers/text-slot-consumer.js +1 -1
- package/slot-consumers/typed-slot-consumer.d.ts +1 -1
- package/slot-consumers/typed-slot-consumer.d.ts.map +1 -1
- package/slot-consumers/typed-slot-consumer.js +2 -2
- package/slot-consumers/vocabulary-slot-consumer.d.ts +1 -1
- package/slot-consumers/vocabulary-slot-consumer.d.ts.map +1 -1
- package/slot-consumers/vocabulary-slot-consumer.js +1 -1
- package/scope-evaluator.d.ts +0 -58
- package/scope-evaluator.d.ts.map +0 -1
- package/scope-evaluator.js +0 -205
- package/scope-evaluator.js.map +0 -1
package/direction-mappings.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Maps English words and abbreviations to language-agnostic Direction constants.
|
|
5
5
|
* These are static compass-direction mappings owned by the parser locale.
|
|
6
6
|
*/
|
|
7
|
-
import { DirectionType } from
|
|
7
|
+
import { DirectionType } from '@sharpee/world-model';
|
|
8
8
|
/**
|
|
9
9
|
* Full English words → Direction constant mappings.
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction-mappings.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"direction-mappings.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/direction-mappings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAa,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAexD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAWhE,CAAC;AAoBF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAgBlE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAEjE"}
|
package/direction-mappings.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.DirectionAbbreviations = exports.DirectionWords = void 0;
|
|
10
10
|
exports.parseDirection = parseDirection;
|
|
11
11
|
exports.getDirectionWord = getDirectionWord;
|
|
12
|
-
const world_model_1 = require("
|
|
12
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
13
13
|
/**
|
|
14
14
|
* Full English words → Direction constant mappings.
|
|
15
15
|
*/
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file English Grammar Engine
|
|
3
3
|
* @description English-specific implementation of grammar matching
|
|
4
4
|
*/
|
|
5
|
-
import { GrammarEngine, GrammarContext, PatternMatch, GrammarMatchOptions, SlotMatch } from
|
|
6
|
-
import { Token } from
|
|
5
|
+
import { GrammarEngine, GrammarContext, PatternMatch, GrammarMatchOptions, SlotMatch } from '@sharpee/if-domain';
|
|
6
|
+
import { Token } from '@sharpee/if-domain';
|
|
7
7
|
import { SlotConsumerRegistry } from './slot-consumers';
|
|
8
8
|
import type { PartialMatchFailure } from './parse-failure';
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"english-grammar-engine.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"english-grammar-engine.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/english-grammar-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,mBAAmB,EAInB,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAA8C,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,iBAAiB,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GACtC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAA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
-
const if_domain_1 = require("
|
|
8
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
9
9
|
const english_pattern_compiler_1 = require("./english-pattern-compiler");
|
|
10
|
-
const lang_en_us_1 = require("
|
|
10
|
+
const lang_en_us_1 = require("@sharpee/lang-en-us");
|
|
11
11
|
const slot_consumers_1 = require("./slot-consumers");
|
|
12
12
|
/**
|
|
13
13
|
* English-specific grammar matching engine
|
package/english-parser.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* This parser handles English-specific grammar patterns and preserves all information
|
|
5
5
|
* in rich structured commands.
|
|
6
6
|
*/
|
|
7
|
-
import { Parser, ParserOptions, Token as InternalToken, InternalParseResult, ParserLanguageProvider, VerbVocabulary, VocabularyEntry, Constraint } from
|
|
8
|
-
import type { IParsedCommand, IValidatedCommand, IParseError as CoreParseError } from
|
|
9
|
-
import type { ISystemEvent, Result } from
|
|
10
|
-
import { GrammarBuilder } from
|
|
7
|
+
import { Parser, ParserOptions, Token as InternalToken, InternalParseResult, ParserLanguageProvider, VerbVocabulary, VocabularyEntry, Constraint } from '@sharpee/if-domain';
|
|
8
|
+
import type { IParsedCommand, IValidatedCommand, IParseError as CoreParseError } from '@sharpee/world-model';
|
|
9
|
+
import type { ISystemEvent, Result } from '@sharpee/core';
|
|
10
|
+
import { GrammarBuilder } from '@sharpee/if-domain';
|
|
11
11
|
import { PronounContextManager } from './pronoun-context';
|
|
12
12
|
type CommandResult<T, E> = Result<T, E>;
|
|
13
13
|
/**
|
package/english-parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"english-parser.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"english-parser.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/english-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,MAAM,EACN,aAAa,EACb,KAAK,IAAI,aAAa,EAGtB,mBAAmB,EA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AAG,IAAI;IAkBhC;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA8BlC;;OAEG;IACH,OAAO,CAAC,eAAe;IA8DvB;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAM1E;;;;;;OAMG;IACH,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAM/E;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;;OAGG;IACH,cAAc,IAAI,cAAc,GAAG,IAAI;IAIvC;;OAEG;IACH,wBAAwB,IAAI,qBAAqB;CAGlD"}
|
package/english-parser.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.EnglishParser = void 0;
|
|
10
|
-
const if_domain_1 = require("
|
|
11
|
-
const world_model_1 = require("
|
|
10
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
11
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
12
12
|
const english_grammar_engine_1 = require("./english-grammar-engine");
|
|
13
13
|
const grammar_1 = require("./grammar");
|
|
14
14
|
const direction_mappings_1 = require("./direction-mappings");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file English Pattern Compiler
|
|
3
3
|
* @description English-specific implementation of pattern compilation
|
|
4
4
|
*/
|
|
5
|
-
import { PatternCompiler, CompiledPattern } from
|
|
5
|
+
import { PatternCompiler, CompiledPattern } from '@sharpee/if-domain';
|
|
6
6
|
/**
|
|
7
7
|
* English-specific pattern compiler
|
|
8
8
|
* Handles patterns like: "put :item in|into|inside :container"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"english-pattern-compiler.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"english-pattern-compiler.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/english-pattern-compiler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAiJzC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IA0ClC;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;CAkBxC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.EnglishPatternCompiler = void 0;
|
|
8
|
-
const if_domain_1 = require("
|
|
8
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
9
9
|
/**
|
|
10
10
|
* English-specific pattern compiler
|
|
11
11
|
* Handles patterns like: "put :item in|into|inside :container"
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* vocabulary) or the stdlib's StandardScopeResolver (validation-phase entity
|
|
12
12
|
* resolution with disambiguation).
|
|
13
13
|
*/
|
|
14
|
-
import { ScopeConstraint, GrammarContext } from
|
|
15
|
-
import { IEntity } from
|
|
14
|
+
import { ScopeConstraint, GrammarContext } from '@sharpee/if-domain';
|
|
15
|
+
import { IEntity } from '@sharpee/core';
|
|
16
16
|
/**
|
|
17
17
|
* Evaluates scope constraints to find matching entities
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar-scope-resolver.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"grammar-scope-resolver.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/grammar-scope-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,eAAe,EAGf,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAYxC;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,EAAE;IA0DZ;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO;IAKV;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAiB7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IA+B7B;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,EAAE;CAwBb"}
|
package/grammar.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Semantic rules should come first to match before fallback patterns.
|
|
12
12
|
*/
|
|
13
|
-
import { GrammarBuilder } from
|
|
13
|
+
import { GrammarBuilder } from '@sharpee/if-domain';
|
|
14
14
|
/**
|
|
15
15
|
* Define English grammar rules
|
|
16
16
|
* @param grammar The grammar builder to use
|
package/grammar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAywB3D"}
|
package/grammar.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.defineGrammar = defineGrammar;
|
|
16
|
-
const world_model_1 = require("
|
|
16
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
17
17
|
/**
|
|
18
18
|
* Define English grammar rules
|
|
19
19
|
* @param grammar The grammar builder to use
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { EnglishParser } from './english-parser';
|
|
8
8
|
export { EnglishParser as Parser } from './english-parser';
|
|
9
|
-
export type { Parser as ParserInterface } from
|
|
9
|
+
export type { Parser as ParserInterface } from '@sharpee/if-domain';
|
|
10
10
|
export type { PartialMatchFailure, SlotFailure, MatchFailureReason } from './parse-failure';
|
|
11
11
|
export { analyzeBestFailure } from './parse-failure';
|
|
12
12
|
export type { EntityReference, PronounContext, RecognizedPronoun } from './pronoun-context';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG3D,YAAY,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;CAkBpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/parser-en-us",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "English (US) parser for Sharpee Interactive Fiction Platform",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/core": "^1.0.
|
|
16
|
-
"@sharpee/if-domain": "^1.0.
|
|
17
|
-
"@sharpee/lang-en-us": "^1.0.
|
|
18
|
-
"@sharpee/world-model": "^1.0.
|
|
15
|
+
"@sharpee/core": "^1.0.8",
|
|
16
|
+
"@sharpee/if-domain": "^1.0.8",
|
|
17
|
+
"@sharpee/lang-en-us": "^1.0.8",
|
|
18
|
+
"@sharpee/world-model": "^1.0.8"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"interactive-fiction",
|
package/parse-failure.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Types and utilities for tracking partial match failures
|
|
4
4
|
* to provide better error messages (Phase 1.2 of parser recommendations)
|
|
5
5
|
*/
|
|
6
|
-
import type { ParseErrorCode } from
|
|
6
|
+
import type { ParseErrorCode } from '@sharpee/world-model';
|
|
7
7
|
/**
|
|
8
8
|
* Reason why a pattern match failed
|
|
9
9
|
*/
|
package/parse-failure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-failure.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"parse-failure.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/parse-failure.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,eAAe,GACf,kBAAkB,GAClB,aAAa,GACb,iBAAiB,GACjB,mBAAmB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB,0BAA0B;IAC1B,MAAM,EAAE,UAAU,GAAG,iBAAiB,GAAG,WAAW,CAAC;IAErD,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,2DAA2D;IAC3D,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAEhB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IAEf,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IAEjB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IAEvB,2BAA2B;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAE3B,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAgI3E"}
|
package/parser-types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Parser-specific types
|
|
3
3
|
* These were previously in @sharpee/if-domain but are now local to the parser
|
|
4
4
|
*/
|
|
5
|
-
import type { IParsedCommand, IParseError as CoreParseError } from
|
|
5
|
+
import type { IParsedCommand, IParseError as CoreParseError } from '@sharpee/world-model';
|
|
6
6
|
/**
|
|
7
7
|
* Parser interface
|
|
8
8
|
*/
|
package/parser-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"parser-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/parser-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACpE,gBAAgB,CAAC,CAAC,QAAQ,EAAE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AAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAe5G;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAaxG"}
|
package/pronoun-context.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - "talk to Alice. give her the key" → "her" = Alice
|
|
8
8
|
* - "take all. drop them" → "them" = all items taken
|
|
9
9
|
*/
|
|
10
|
-
import type { IParsedCommand, IValidatedCommand, PronounSet } from
|
|
10
|
+
import type { IParsedCommand, IValidatedCommand, PronounSet } from '@sharpee/world-model';
|
|
11
11
|
/**
|
|
12
12
|
* Reference to an entity mentioned in a command
|
|
13
13
|
*/
|
package/pronoun-context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pronoun-context.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"pronoun-context.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/pronoun-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,iBAAiB,EAA6B,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlI;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAE3B;;;OAGG;IACH,IAAI,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAE/B;;;;;OAKG;IACH,gBAAgB,EA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ronoun-context.js
CHANGED
|
@@ -13,8 +13,8 @@ exports.PronounContextManager = exports.INANIMATE_THEM = exports.INANIMATE_IT =
|
|
|
13
13
|
exports.isRecognizedPronoun = isRecognizedPronoun;
|
|
14
14
|
exports.setPronounContextManager = setPronounContextManager;
|
|
15
15
|
exports.getPronounContextManager = getPronounContextManager;
|
|
16
|
-
const world_model_1 = require("
|
|
17
|
-
const world_model_2 = require("
|
|
16
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
17
|
+
const world_model_2 = require("@sharpee/world-model");
|
|
18
18
|
/**
|
|
19
19
|
* Standard pronouns that the parser should recognize
|
|
20
20
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Handles entity resolution slots including multi-object parsing (ADR-088)
|
|
4
4
|
* and pronoun resolution (ADR-089)
|
|
5
5
|
*/
|
|
6
|
-
import { SlotType, SlotMatch } from
|
|
6
|
+
import { SlotType, SlotMatch } from '@sharpee/if-domain';
|
|
7
7
|
import { SlotConsumer, SlotConsumerContext } from './slot-consumer';
|
|
8
8
|
/**
|
|
9
9
|
* Consumer for entity slots (ENTITY, INSTRUMENT)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-slot-consumer.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"entity-slot-consumer.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/entity-slot-consumer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,QAAQ,EACR,SAAS,EAKV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAA2C,MAAM,iBAAiB,CAAC;AAI7G;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,QAAQ,CAAC,SAAS,aAA0C;IAE5D,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAsCnD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA8DzB;;OAEG;IACH,OAAO,CAAC,cAAc;IA2CtB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAiE/B;;OAEG;IACH,OAAO,CAAC,8BAA8B;IA0KtC;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAyEhC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.EntitySlotConsumer = void 0;
|
|
9
|
-
const if_domain_1 = require("
|
|
9
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
10
10
|
const slot_consumer_1 = require("./slot-consumer");
|
|
11
11
|
const grammar_scope_resolver_1 = require("../grammar-scope-resolver");
|
|
12
12
|
const pronoun_context_1 = require("../pronoun-context");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Slot Consumer Registry
|
|
3
3
|
* @description Registry for slot consumption strategies (ADR-088)
|
|
4
4
|
*/
|
|
5
|
-
import { SlotType, SlotMatch } from
|
|
5
|
+
import { SlotType, SlotMatch } from '@sharpee/if-domain';
|
|
6
6
|
import { SlotConsumer, SlotConsumerContext } from './slot-consumer';
|
|
7
7
|
export { SlotConsumer, SlotConsumerContext, getNextPatternToken, isPatternDelimiter } from './slot-consumer';
|
|
8
8
|
export { EntitySlotConsumer } from './entity-slot-consumer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAMpE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,SAAS,CAA0C;IAE3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAMtC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAIxC;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAQnD;;OAEG;IACH,kBAAkB,IAAI,QAAQ,EAAE;CAGjC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,oBAAoB,CAQ5D"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file Slot Consumer Interface
|
|
3
3
|
* @description Interface for slot consumption strategies (ADR-088)
|
|
4
4
|
*/
|
|
5
|
-
import { SlotType, SlotMatch, CompiledPattern, GrammarContext, SlotConstraint, PatternToken } from
|
|
6
|
-
import { Token } from
|
|
5
|
+
import { SlotType, SlotMatch, CompiledPattern, GrammarContext, SlotConstraint, PatternToken } from '@sharpee/if-domain';
|
|
6
|
+
import { Token } from '@sharpee/if-domain';
|
|
7
7
|
/**
|
|
8
8
|
* Context passed to slot consumers containing all information needed for consumption
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-consumer.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"slot-consumer.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/slot-consumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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 -2,7 +2,7 @@
|
|
|
2
2
|
* @file Text Slot Consumer
|
|
3
3
|
* @description Handles text capture slots (ADR-088)
|
|
4
4
|
*/
|
|
5
|
-
import { SlotType, SlotMatch } from
|
|
5
|
+
import { SlotType, SlotMatch } from '@sharpee/if-domain';
|
|
6
6
|
import { SlotConsumer, SlotConsumerContext } from './slot-consumer';
|
|
7
7
|
/**
|
|
8
8
|
* Consumer for text slots (TEXT, TEXT_GREEDY, QUOTED_TEXT, TOPIC)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-slot-consumer.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"text-slot-consumer.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/text-slot-consumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAA2C,MAAM,iBAAiB,CAAC;AAE7G;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,SAAS,aAKhB;IAEF,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAiBnD;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAmDzB;;;OAGG;IACH,OAAO,CAAC,YAAY;CAkCrB"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.TextSlotConsumer = void 0;
|
|
8
|
-
const if_domain_1 = require("
|
|
8
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
9
9
|
const slot_consumer_1 = require("./slot-consumer");
|
|
10
10
|
/**
|
|
11
11
|
* Consumer for text slots (TEXT, TEXT_GREEDY, QUOTED_TEXT, TOPIC)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Typed Slot Consumer
|
|
3
3
|
* @description Handles typed value slots (ADR-088, ADR-082)
|
|
4
4
|
*/
|
|
5
|
-
import { SlotType, SlotMatch } from
|
|
5
|
+
import { SlotType, SlotMatch } from '@sharpee/if-domain';
|
|
6
6
|
import { SlotConsumer, SlotConsumerContext } from './slot-consumer';
|
|
7
7
|
/**
|
|
8
8
|
* Consumer for typed value slots (NUMBER, ORDINAL, TIME, DIRECTION)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-slot-consumer.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"typed-slot-consumer.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/typed-slot-consumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IACpD,QAAQ,CAAC,SAAS,aAKhB;IAEF,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAiBnD;;;OAGG;IACH,OAAO,CAAC,aAAa;IAiCrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAkCtB;;;OAGG;IACH,OAAO,CAAC,WAAW;IA8BnB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CAsBzB"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.TypedSlotConsumer = void 0;
|
|
8
|
-
const if_domain_1 = require("
|
|
9
|
-
const lang_en_us_1 = require("
|
|
8
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
9
|
+
const lang_en_us_1 = require("@sharpee/lang-en-us");
|
|
10
10
|
/**
|
|
11
11
|
* Consumer for typed value slots (NUMBER, ORDINAL, TIME, DIRECTION)
|
|
12
12
|
* Validates input matches expected format/vocabulary
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Vocabulary Slot Consumer
|
|
3
3
|
* @description Handles vocabulary-constrained slots (ADR-088, ADR-082)
|
|
4
4
|
*/
|
|
5
|
-
import { SlotType, SlotMatch } from
|
|
5
|
+
import { SlotType, SlotMatch } from '@sharpee/if-domain';
|
|
6
6
|
import { SlotConsumer, SlotConsumerContext } from './slot-consumer';
|
|
7
7
|
/**
|
|
8
8
|
* Consumer for vocabulary-constrained slots (ADJECTIVE, NOUN, VOCABULARY, MANNER)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary-slot-consumer.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"vocabulary-slot-consumer.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/parser-en-us/src/slot-consumers/vocabulary-slot-consumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAapE;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,YAAY;IACzD,QAAQ,CAAC,SAAS,aAKhB;IAEF,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAiBnD;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAyBnB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAmCzB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAuCrB;;;OAGG;IACH,OAAO,CAAC,aAAa;CAqBtB"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.VocabularySlotConsumer = void 0;
|
|
8
|
-
const if_domain_1 = require("
|
|
8
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
9
9
|
/**
|
|
10
10
|
* Built-in manner adverbs that modify how actions are performed.
|
|
11
11
|
* Stories can extend this via vocab.extend('manner', [...])
|
package/scope-evaluator.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Scope Evaluator
|
|
3
|
-
* @description Evaluates scope constraints against the world model
|
|
4
|
-
*/
|
|
5
|
-
import { ScopeConstraint, GrammarContext } from "../if-domain/index";
|
|
6
|
-
import { IEntity } from "../core/index";
|
|
7
|
-
/**
|
|
8
|
-
* Evaluates scope constraints to find matching entities
|
|
9
|
-
*/
|
|
10
|
-
export declare class ScopeEvaluator {
|
|
11
|
-
/**
|
|
12
|
-
* Get entities that match a scope constraint
|
|
13
|
-
*/
|
|
14
|
-
static getEntitiesInScope(constraint: ScopeConstraint, context: GrammarContext): IEntity[];
|
|
15
|
-
/**
|
|
16
|
-
* Check if a single entity matches a scope constraint
|
|
17
|
-
*/
|
|
18
|
-
static entityMatchesScope(entity: IEntity, constraint: ScopeConstraint, context: GrammarContext): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Get all entities in the world
|
|
21
|
-
*/
|
|
22
|
-
private static getAllEntities;
|
|
23
|
-
/**
|
|
24
|
-
* Get visible entities from current location
|
|
25
|
-
*/
|
|
26
|
-
private static getVisibleEntities;
|
|
27
|
-
/**
|
|
28
|
-
* Get touchable entities from current location
|
|
29
|
-
*/
|
|
30
|
-
private static getTouchableEntities;
|
|
31
|
-
/**
|
|
32
|
-
* Get entities carried by the actor
|
|
33
|
-
*/
|
|
34
|
-
private static getCarriedEntities;
|
|
35
|
-
/**
|
|
36
|
-
* Get nearby entities (visible + adjacent locations)
|
|
37
|
-
*/
|
|
38
|
-
private static getNearbyEntities;
|
|
39
|
-
/**
|
|
40
|
-
* Check if entity matches a filter
|
|
41
|
-
*/
|
|
42
|
-
private static matchesFilter;
|
|
43
|
-
/**
|
|
44
|
-
* Check if entity has a specific trait
|
|
45
|
-
* Supports both entity.has() method and entity.get() method patterns
|
|
46
|
-
*/
|
|
47
|
-
private static entityHasTrait;
|
|
48
|
-
/**
|
|
49
|
-
* Get entity names and aliases for matching
|
|
50
|
-
* Supports both legacy attributes.name and IdentityTrait patterns
|
|
51
|
-
*/
|
|
52
|
-
private static getEntityNames;
|
|
53
|
-
/**
|
|
54
|
-
* Find entities by name in a given scope
|
|
55
|
-
*/
|
|
56
|
-
static findEntitiesByName(name: string, constraint: ScopeConstraint, context: GrammarContext): IEntity[];
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=scope-evaluator.d.ts.map
|
package/scope-evaluator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope-evaluator.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/parser-en-us/src/scope-evaluator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EAGf,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,EAAE;IA0DZ;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO;IAKV;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAoB5B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAe7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IA8B7B;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,EAAE;CAwBb"}
|
package/scope-evaluator.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @file Scope Evaluator
|
|
4
|
-
* @description Evaluates scope constraints against the world model
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ScopeEvaluator = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Evaluates scope constraints to find matching entities
|
|
10
|
-
*/
|
|
11
|
-
class ScopeEvaluator {
|
|
12
|
-
/**
|
|
13
|
-
* Get entities that match a scope constraint
|
|
14
|
-
*/
|
|
15
|
-
static getEntitiesInScope(constraint, context) {
|
|
16
|
-
// If no world model, return empty array
|
|
17
|
-
if (!context.world) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
// Start with base scope
|
|
21
|
-
let entities = [];
|
|
22
|
-
switch (constraint.base) {
|
|
23
|
-
case 'all':
|
|
24
|
-
entities = this.getAllEntities(context);
|
|
25
|
-
break;
|
|
26
|
-
case 'visible':
|
|
27
|
-
entities = this.getVisibleEntities(context);
|
|
28
|
-
break;
|
|
29
|
-
case 'touchable':
|
|
30
|
-
entities = this.getTouchableEntities(context);
|
|
31
|
-
break;
|
|
32
|
-
case 'carried':
|
|
33
|
-
entities = this.getCarriedEntities(context);
|
|
34
|
-
break;
|
|
35
|
-
case 'nearby':
|
|
36
|
-
entities = this.getNearbyEntities(context);
|
|
37
|
-
break;
|
|
38
|
-
default:
|
|
39
|
-
entities = [];
|
|
40
|
-
}
|
|
41
|
-
// Apply filters
|
|
42
|
-
for (const filter of constraint.filters) {
|
|
43
|
-
entities = entities.filter(entity => this.matchesFilter(entity, filter, context));
|
|
44
|
-
}
|
|
45
|
-
// Apply trait filters
|
|
46
|
-
if (constraint.traitFilters && constraint.traitFilters.length > 0) {
|
|
47
|
-
entities = entities.filter(entity => constraint.traitFilters.every(traitType => this.entityHasTrait(entity, traitType)));
|
|
48
|
-
}
|
|
49
|
-
// Add explicit entities
|
|
50
|
-
if (constraint.explicitEntities.length > 0) {
|
|
51
|
-
const additionalEntities = constraint.explicitEntities
|
|
52
|
-
.map(id => context.world.getEntity(id))
|
|
53
|
-
.filter(Boolean);
|
|
54
|
-
entities = [...entities, ...additionalEntities];
|
|
55
|
-
}
|
|
56
|
-
// Remove duplicates
|
|
57
|
-
const uniqueIds = new Set(entities.map(e => e.id));
|
|
58
|
-
return entities.filter((e, i, arr) => arr.findIndex(e2 => e2.id === e.id) === i);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Check if a single entity matches a scope constraint
|
|
62
|
-
*/
|
|
63
|
-
static entityMatchesScope(entity, constraint, context) {
|
|
64
|
-
const matchingEntities = this.getEntitiesInScope(constraint, context);
|
|
65
|
-
return matchingEntities.some(e => e.id === entity.id);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get all entities in the world
|
|
69
|
-
*/
|
|
70
|
-
static getAllEntities(context) {
|
|
71
|
-
if (!context.world?.getAllEntities) {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
return context.world.getAllEntities();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get visible entities from current location
|
|
78
|
-
*/
|
|
79
|
-
static getVisibleEntities(context) {
|
|
80
|
-
if (!context.world?.getVisibleEntities) {
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
return context.world.getVisibleEntities(context.actorId, context.currentLocation);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Get touchable entities from current location
|
|
87
|
-
*/
|
|
88
|
-
static getTouchableEntities(context) {
|
|
89
|
-
if (!context.world?.getTouchableEntities) {
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
return context.world.getTouchableEntities(context.actorId, context.currentLocation);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get entities carried by the actor
|
|
96
|
-
*/
|
|
97
|
-
static getCarriedEntities(context) {
|
|
98
|
-
if (!context.world?.getCarriedEntities) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
return context.world.getCarriedEntities(context.actorId);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get nearby entities (visible + adjacent locations)
|
|
105
|
-
*/
|
|
106
|
-
static getNearbyEntities(context) {
|
|
107
|
-
if (!context.world?.getNearbyEntities) {
|
|
108
|
-
// Fallback to visible if nearby not implemented
|
|
109
|
-
return this.getVisibleEntities(context);
|
|
110
|
-
}
|
|
111
|
-
return context.world.getNearbyEntities(context.actorId, context.currentLocation);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Check if entity matches a filter
|
|
115
|
-
*/
|
|
116
|
-
static matchesFilter(entity, filter, context) {
|
|
117
|
-
if (typeof filter === 'function') {
|
|
118
|
-
// Function constraint
|
|
119
|
-
return filter(entity, context);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
// Property constraint
|
|
123
|
-
for (const [key, value] of Object.entries(filter)) {
|
|
124
|
-
const entityValue = entity[key];
|
|
125
|
-
if (entityValue !== value) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Check if entity has a specific trait
|
|
134
|
-
* Supports both entity.has() method and entity.get() method patterns
|
|
135
|
-
*/
|
|
136
|
-
static entityHasTrait(entity, traitType) {
|
|
137
|
-
// Check for .has() method (trait system standard)
|
|
138
|
-
if (typeof entity.has === 'function') {
|
|
139
|
-
return entity.has(traitType);
|
|
140
|
-
}
|
|
141
|
-
// Check for .get() method returning truthy value (alternate pattern)
|
|
142
|
-
if (typeof entity.get === 'function') {
|
|
143
|
-
const trait = entity.get(traitType);
|
|
144
|
-
return trait !== undefined && trait !== null;
|
|
145
|
-
}
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get entity names and aliases for matching
|
|
150
|
-
* Supports both legacy attributes.name and IdentityTrait patterns
|
|
151
|
-
*/
|
|
152
|
-
static getEntityNames(entity) {
|
|
153
|
-
const names = [];
|
|
154
|
-
// Check attributes (legacy pattern)
|
|
155
|
-
if (entity.attributes) {
|
|
156
|
-
if (entity.attributes.displayName) {
|
|
157
|
-
names.push(String(entity.attributes.displayName));
|
|
158
|
-
}
|
|
159
|
-
if (entity.attributes.name) {
|
|
160
|
-
names.push(String(entity.attributes.name));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// Check IdentityTrait (via .get() method)
|
|
164
|
-
if (typeof entity.get === 'function') {
|
|
165
|
-
const identity = entity.get('identity');
|
|
166
|
-
if (identity && typeof identity === 'object') {
|
|
167
|
-
if (identity.name) {
|
|
168
|
-
names.push(String(identity.name));
|
|
169
|
-
}
|
|
170
|
-
// Also check aliases
|
|
171
|
-
if (Array.isArray(identity.aliases)) {
|
|
172
|
-
names.push(...identity.aliases.map(String));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return names;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Find entities by name in a given scope
|
|
180
|
-
*/
|
|
181
|
-
static findEntitiesByName(name, constraint, context) {
|
|
182
|
-
const entitiesInScope = this.getEntitiesInScope(constraint, context);
|
|
183
|
-
const searchName = name.toLowerCase();
|
|
184
|
-
// Try exact match first (name or any alias)
|
|
185
|
-
const exactMatches = entitiesInScope.filter(e => {
|
|
186
|
-
if (!e)
|
|
187
|
-
return false;
|
|
188
|
-
const names = this.getEntityNames(e);
|
|
189
|
-
return names.some(n => n.toLowerCase() === searchName);
|
|
190
|
-
});
|
|
191
|
-
if (exactMatches.length > 0) {
|
|
192
|
-
return exactMatches;
|
|
193
|
-
}
|
|
194
|
-
// Try partial match
|
|
195
|
-
const partialMatches = entitiesInScope.filter(e => {
|
|
196
|
-
if (!e)
|
|
197
|
-
return false;
|
|
198
|
-
const names = this.getEntityNames(e);
|
|
199
|
-
return names.some(n => n.toLowerCase().includes(searchName));
|
|
200
|
-
});
|
|
201
|
-
return partialMatches;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
exports.ScopeEvaluator = ScopeEvaluator;
|
|
205
|
-
//# sourceMappingURL=scope-evaluator.js.map
|
package/scope-evaluator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope-evaluator.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/parser-en-us/src/scope-evaluator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH;;GAEG;AACH,MAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAA2B,EAC3B,OAAuB;QAEvB,wCAAwC;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,IAAI,QAAQ,GAAc,EAAE,CAAC;QAE7B,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,KAAK;gBACR,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM;YACR,KAAK,SAAS;gBACZ,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBAC5C,MAAM;YACR,KA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