@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.
- package/channels/index.d.ts +3 -1
- package/channels/index.d.ts.map +1 -1
- package/channels/index.js +2 -0
- package/channels/index.js.map +1 -1
- package/channels/types.d.ts +80 -2
- package/channels/types.d.ts.map +1 -1
- package/channels/types.js.map +1 -1
- package/endings.d.ts +8 -19
- package/endings.d.ts.map +1 -1
- package/endings.js +9 -20
- package/endings.js.map +1 -1
- package/grammar/grammar-builder.d.ts +162 -156
- package/grammar/grammar-builder.d.ts.map +1 -1
- package/grammar/grammar-builder.js +1 -1
- package/grammar/grammar-builder.js.map +1 -1
- package/grammar/grammar-engine.d.ts +8 -10
- package/grammar/grammar-engine.d.ts.map +1 -1
- package/grammar/grammar-engine.js +129 -182
- package/grammar/grammar-engine.js.map +1 -1
- package/grammar/index.d.ts +1 -0
- package/grammar/index.d.ts.map +1 -1
- package/grammar/index.js +1 -0
- package/grammar/index.js.map +1 -1
- package/grammar/pattern-compiler.d.ts +20 -16
- package/grammar/pattern-compiler.d.ts.map +1 -1
- package/grammar/pattern-compiler.js +6 -1
- package/grammar/pattern-compiler.js.map +1 -1
- package/grammar/rule-order.d.ts +53 -0
- package/grammar/rule-order.d.ts.map +1 -0
- package/grammar/rule-order.js +47 -0
- package/grammar/rule-order.js.map +1 -0
- package/grammar/scope-builder.d.ts +10 -3
- package/grammar/scope-builder.d.ts.map +1 -1
- package/grammar/scope-builder.js +12 -13
- package/grammar/scope-builder.js.map +1 -1
- package/language-provider.d.ts +10 -1
- package/language-provider.d.ts.map +1 -1
- package/package.json +3 -3
- package/parser-contracts/parser-internals.d.ts +0 -12
- package/parser-contracts/parser-internals.d.ts.map +1 -1
- package/parser-contracts/parser-internals.js.map +1 -1
- package/parser-contracts/parser-types.d.ts +0 -12
- package/parser-contracts/parser-types.d.ts.map +1 -1
- package/parser-language-provider.d.ts +28 -35
- package/parser-language-provider.d.ts.map +1 -1
- package/sound/types.d.ts +21 -0
- package/sound/types.d.ts.map +1 -1
- package/sound/types.js +21 -1
- package/sound/types.js.map +1 -1
- package/vocabulary-contracts/vocabulary-adapters.d.ts +6 -2
- package/vocabulary-contracts/vocabulary-adapters.d.ts.map +1 -1
- package/vocabulary-contracts/vocabulary-adapters.js +8 -33
- package/vocabulary-contracts/vocabulary-adapters.js.map +1 -1
- package/vocabulary-contracts/vocabulary-registry.d.ts +9 -23
- package/vocabulary-contracts/vocabulary-registry.d.ts.map +1 -1
- package/vocabulary-contracts/vocabulary-registry.js +10 -66
- package/vocabulary-contracts/vocabulary-registry.js.map +1 -1
- package/vocabulary-contracts/vocabulary-types.d.ts +22 -25
- package/vocabulary-contracts/vocabulary-types.d.ts.map +1 -1
- package/vocabulary-contracts/vocabulary-types.js.map +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Grammar rank comparator — the one ordering of grammar readings
|
|
4
|
+
* @description Orders the readings of grammar rules, and the failures the
|
|
5
|
+
* parser classifies, by their nouns and their rule: items naming nothing
|
|
6
|
+
* (fewer first), then literal specificity (more first), then tier (story
|
|
7
|
+
* before standard), then definition order (earlier first), then names (more
|
|
8
|
+
* first) and exact names (more first). Every reader that ranks readings
|
|
9
|
+
* calls this; no other ordering of grammar rules exists.
|
|
10
|
+
*
|
|
11
|
+
* Public interface: NounRank, GrammarRank, compareGrammarRank.
|
|
12
|
+
* Owner context: if-domain grammar contract (the English grammar engine and
|
|
13
|
+
* the parser's failure classifier are the callers).
|
|
14
|
+
*
|
|
15
|
+
* References: ADR-386 D4, D5 (the noun rank), ADR-384 D2 (supersedes
|
|
16
|
+
* ADR-268 D2; the rule keys), ADR-231 D2b (literal specificity).
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.compareGrammarRank = compareGrammarRank;
|
|
20
|
+
/**
|
|
21
|
+
* Compare two ranks for sorting, best first. Only `unnamed` stands above the
|
|
22
|
+
* rule's own keys, so a literal line still beats a slot reading of the same
|
|
23
|
+
* words; `named` and `exact` decide between the readings of one rule.
|
|
24
|
+
* @param a The first rank
|
|
25
|
+
* @param b The second rank
|
|
26
|
+
* @returns Negative when `a` ranks first, positive when `b` does, zero only
|
|
27
|
+
* for the same noun rank, specificity, tier and definition index
|
|
28
|
+
*/
|
|
29
|
+
function compareGrammarRank(a, b) {
|
|
30
|
+
if (a.nounRank.unnamed !== b.nounRank.unnamed) {
|
|
31
|
+
return a.nounRank.unnamed - b.nounRank.unnamed;
|
|
32
|
+
}
|
|
33
|
+
if (a.literalSpecificity !== b.literalSpecificity) {
|
|
34
|
+
return b.literalSpecificity - a.literalSpecificity;
|
|
35
|
+
}
|
|
36
|
+
if (a.tier !== b.tier) {
|
|
37
|
+
return a.tier === 'story' ? -1 : 1;
|
|
38
|
+
}
|
|
39
|
+
if (a.definitionIndex !== b.definitionIndex) {
|
|
40
|
+
return a.definitionIndex - b.definitionIndex;
|
|
41
|
+
}
|
|
42
|
+
if (a.nounRank.named !== b.nounRank.named) {
|
|
43
|
+
return b.nounRank.named - a.nounRank.named;
|
|
44
|
+
}
|
|
45
|
+
return b.nounRank.exact - a.nounRank.exact;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=rule-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-order.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/rule-order.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAwCH,gDAiBC;AA1BD;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,CAAc,EAAE,CAAc;IAC/D,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;IACjD,CAAC;IACD,IAAI,CAAC,CAAC,kBAAkB,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAClD,OAAO,CAAC,CAAC,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC;IACrD,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,CAAC,CAAC,eAAe,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC;QAC5C,OAAO,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7C,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC7C,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Scope Builder Implementation
|
|
3
|
-
* @description Concrete implementation of the scope builder interface
|
|
3
|
+
* @description Concrete implementation of the scope builder interface. A
|
|
4
|
+
* constraint is a base (visible, touchable, carried, nearby, all), property
|
|
5
|
+
* or function filters, required traits, and explicit entity ids — exactly
|
|
6
|
+
* what the scope resolver reads, and nothing it does not.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: `scope()`, `ScopeBuilderImpl`.
|
|
9
|
+
* Owner context: if-domain grammar contracts.
|
|
10
|
+
*
|
|
11
|
+
* References: ADR-385 D9 (the rule-inclusion list nothing read, and the
|
|
12
|
+
* alias of `matching({ kind })`, are gone).
|
|
4
13
|
*/
|
|
5
14
|
import { ScopeBuilder, ScopeConstraint, PropertyConstraint, FunctionConstraint } from './grammar-builder.js';
|
|
6
15
|
/**
|
|
@@ -13,9 +22,7 @@ export declare class ScopeBuilderImpl implements ScopeBuilder {
|
|
|
13
22
|
carried(): ScopeBuilder;
|
|
14
23
|
nearby(): ScopeBuilder;
|
|
15
24
|
matching(constraint: PropertyConstraint | FunctionConstraint): ScopeBuilder;
|
|
16
|
-
kind(kind: string): ScopeBuilder;
|
|
17
25
|
orExplicitly(entityIds: string[]): ScopeBuilder;
|
|
18
|
-
orRule(ruleId: string): ScopeBuilder;
|
|
19
26
|
hasTrait(traitType: string): ScopeBuilder;
|
|
20
27
|
build(): ScopeConstraint;
|
|
21
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-builder.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/scope-builder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scope-builder.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/scope-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,UAAU,CAKhB;IAEF,OAAO,IAAI,YAAY;IAKvB,SAAS,IAAI,YAAY;IAKzB,OAAO,IAAI,YAAY;IAKvB,MAAM,IAAI,YAAY;IAKtB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,YAAY;IAK3E,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY;IAK/C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY;IAKzC,KAAK,IAAI,eAAe;CAQzB;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,YAAY,CAEpC"}
|
package/grammar/scope-builder.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @file Scope Builder Implementation
|
|
4
|
-
* @description Concrete implementation of the scope builder interface
|
|
4
|
+
* @description Concrete implementation of the scope builder interface. A
|
|
5
|
+
* constraint is a base (visible, touchable, carried, nearby, all), property
|
|
6
|
+
* or function filters, required traits, and explicit entity ids — exactly
|
|
7
|
+
* what the scope resolver reads, and nothing it does not.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: `scope()`, `ScopeBuilderImpl`.
|
|
10
|
+
* Owner context: if-domain grammar contracts.
|
|
11
|
+
*
|
|
12
|
+
* References: ADR-385 D9 (the rule-inclusion list nothing read, and the
|
|
13
|
+
* alias of `matching({ kind })`, are gone).
|
|
5
14
|
*/
|
|
6
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
16
|
exports.ScopeBuilderImpl = void 0;
|
|
@@ -14,8 +23,7 @@ class ScopeBuilderImpl {
|
|
|
14
23
|
base: 'all',
|
|
15
24
|
filters: [],
|
|
16
25
|
traitFilters: [],
|
|
17
|
-
explicitEntities: []
|
|
18
|
-
includeRules: []
|
|
26
|
+
explicitEntities: []
|
|
19
27
|
};
|
|
20
28
|
visible() {
|
|
21
29
|
this.constraint.base = 'visible';
|
|
@@ -37,18 +45,10 @@ class ScopeBuilderImpl {
|
|
|
37
45
|
this.constraint.filters.push(constraint);
|
|
38
46
|
return this;
|
|
39
47
|
}
|
|
40
|
-
kind(kind) {
|
|
41
|
-
this.constraint.filters.push({ kind });
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
48
|
orExplicitly(entityIds) {
|
|
45
49
|
this.constraint.explicitEntities.push(...entityIds);
|
|
46
50
|
return this;
|
|
47
51
|
}
|
|
48
|
-
orRule(ruleId) {
|
|
49
|
-
this.constraint.includeRules.push(ruleId);
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
52
|
hasTrait(traitType) {
|
|
53
53
|
this.constraint.traitFilters.push(traitType);
|
|
54
54
|
return this;
|
|
@@ -58,8 +58,7 @@ class ScopeBuilderImpl {
|
|
|
58
58
|
...this.constraint,
|
|
59
59
|
filters: [...this.constraint.filters],
|
|
60
60
|
traitFilters: [...this.constraint.traitFilters],
|
|
61
|
-
explicitEntities: [...this.constraint.explicitEntities]
|
|
62
|
-
includeRules: [...this.constraint.includeRules]
|
|
61
|
+
explicitEntities: [...this.constraint.explicitEntities]
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-builder.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/scope-builder.ts"],"names":[],"mappings":";AAAA;;;
|
|
1
|
+
{"version":3,"file":"scope-builder.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/grammar/scope-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAoEH,sBAEC;AA7DD;;GAEG;AACH,MAAa,gBAAgB;IACnB,UAAU,GAAoB;QACpC,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,EAAE;QAChB,gBAAgB,EAAE,EAAE;KACrB,CAAC;IAEF,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,UAAmD;QAC1D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,SAAmB;QAC9B,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,SAAiB;QACxB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO;YACL,GAAG,IAAI,CAAC,UAAU;YAClB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACrC,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YAC/C,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;SACxD,CAAC;IACJ,CAAC;CACF;AAnDD,4CAmDC;AAED;;GAEG;AACH,SAAgB,KAAK;IACnB,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC"}
|
package/language-provider.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { ITextBlock } from '@sharpee/text-blocks';
|
|
13
13
|
import type { LocaleSettings, RenderContext } from './phrase.js';
|
|
14
|
+
import type { LanguageWords } from './vocabulary-contracts/vocabulary-types.js';
|
|
14
15
|
/**
|
|
15
16
|
* Structured help information for an action
|
|
16
17
|
*/
|
|
@@ -83,7 +84,15 @@ export interface LanguageProvider {
|
|
|
83
84
|
*
|
|
84
85
|
* @returns 'first' | 'second' | 'third'
|
|
85
86
|
*/
|
|
86
|
-
getNarrativePerson
|
|
87
|
+
getNarrativePerson(): 'first' | 'second' | 'third';
|
|
88
|
+
/**
|
|
89
|
+
* The words a world needs from this language (ADR-387 D2): the self words
|
|
90
|
+
* and the name stopwords. The engine assigns them to the world at install;
|
|
91
|
+
* world-model never imports a language package.
|
|
92
|
+
*
|
|
93
|
+
* @returns the language's words for the world
|
|
94
|
+
*/
|
|
95
|
+
getLanguageWords(): LanguageWords;
|
|
87
96
|
/**
|
|
88
97
|
* Render a message to text blocks through the phrase pipeline (ADR-192 §6).
|
|
89
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-provider.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/language-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"language-provider.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/language-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,YAAY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,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE3C;;;;OAIG;IACH,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAExD;;;;OAIG;IACH,UAAU,IAAI,gBAAgB,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,qBAAqB,IAAI,MAAM,EAAE,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/if-domain",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Core domain model and contracts for Sharpee Interactive Fiction Platform",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/core": "^5.
|
|
16
|
-
"@sharpee/text-blocks": "^5.
|
|
15
|
+
"@sharpee/core": "^5.5.0",
|
|
16
|
+
"@sharpee/text-blocks": "^5.5.0"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"interactive-fiction",
|
|
@@ -22,10 +22,6 @@ export interface CandidateCommand {
|
|
|
22
22
|
* Raw text for the primary noun
|
|
23
23
|
*/
|
|
24
24
|
nounText?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Possible interpretations of the noun
|
|
27
|
-
*/
|
|
28
|
-
nounCandidates?: string[];
|
|
29
25
|
/**
|
|
30
26
|
* Preposition between nouns
|
|
31
27
|
*/
|
|
@@ -34,10 +30,6 @@ export interface CandidateCommand {
|
|
|
34
30
|
* Raw text for the secondary noun
|
|
35
31
|
*/
|
|
36
32
|
secondNounText?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Possible interpretations of the second noun
|
|
39
|
-
*/
|
|
40
|
-
secondNounCandidates?: string[];
|
|
41
33
|
/**
|
|
42
34
|
* Original input text
|
|
43
35
|
*/
|
|
@@ -50,10 +42,6 @@ export interface CandidateCommand {
|
|
|
50
42
|
* Grammar pattern that was matched
|
|
51
43
|
*/
|
|
52
44
|
pattern?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Parser confidence (0-1)
|
|
55
|
-
*/
|
|
56
|
-
confidence?: number;
|
|
57
45
|
/**
|
|
58
46
|
* Any special flags (ALL, EXCEPT, etc.)
|
|
59
47
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-internals.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-internals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"parser-internals.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-internals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAE/B;;OAEG;IACH,MAAM,EAAE,UAAU,EAAE,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;GAIG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,gBAAgB,qBAAqB;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-internals.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-internals.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;
|
|
1
|
+
{"version":3,"file":"parser-internals.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-internals.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA8GH;;;;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"}
|
|
@@ -71,18 +71,6 @@ export interface ParserOptions {
|
|
|
71
71
|
* Whether to allow partial matches
|
|
72
72
|
*/
|
|
73
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
74
|
}
|
|
87
75
|
/**
|
|
88
76
|
* Parser interface - extends the BaseParser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-types.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC5G,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;
|
|
1
|
+
{"version":3,"file":"parser-types.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-contracts/parser-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC5G,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;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"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* and parser vocabulary/grammar rules.
|
|
7
7
|
*/
|
|
8
8
|
import { LanguageProvider } from './language-provider.js';
|
|
9
|
-
import { VerbVocabulary, DirectionVocabulary, SpecialVocabulary } from './vocabulary-contracts/vocabulary-types.js';
|
|
9
|
+
import { VerbVocabulary, DirectionVocabulary, SpecialVocabulary, DeterminerVocabulary } from './vocabulary-contracts/vocabulary-types.js';
|
|
10
10
|
/**
|
|
11
11
|
* Language-specific grammar pattern definition
|
|
12
12
|
* Different from the vocabulary-types GrammarPattern
|
|
@@ -46,10 +46,34 @@ export interface ParserLanguageProvider extends LanguageProvider {
|
|
|
46
46
|
*/
|
|
47
47
|
getPrepositions(): string[];
|
|
48
48
|
/**
|
|
49
|
-
* Get determiners for the language
|
|
50
|
-
*
|
|
49
|
+
* Get determiners for the language, each with whose it is when it is a
|
|
50
|
+
* possessive (ADR-387 D6)
|
|
51
|
+
* @returns Array of determiner entries
|
|
51
52
|
*/
|
|
52
|
-
getDeterminers():
|
|
53
|
+
getDeterminers(): DeterminerVocabulary[];
|
|
54
|
+
/**
|
|
55
|
+
* The words that separate list items in typed input (ADR-386 D6, ADR-387 D6):
|
|
56
|
+
* English "and" and the comma.
|
|
57
|
+
* @returns Array of separator words
|
|
58
|
+
*/
|
|
59
|
+
getListSeparators(): string[];
|
|
60
|
+
/**
|
|
61
|
+
* The manner adverbs a MANNER slot accepts (ADR-387 D6).
|
|
62
|
+
* @returns Array of adverbs
|
|
63
|
+
*/
|
|
64
|
+
getMannerAdverbs(): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Read a cardinal number from typed words (ADR-386 D8): digits, one number
|
|
67
|
+
* word, or a compound the language writes as two words or hyphenated.
|
|
68
|
+
* @param words The typed words, in order
|
|
69
|
+
* @returns The number, or null when the words are not one number
|
|
70
|
+
*/
|
|
71
|
+
parseCardinal(words: readonly string[]): number | null;
|
|
72
|
+
/**
|
|
73
|
+
* The ordinal words of the language, each with its value.
|
|
74
|
+
* @returns word → ordinal value
|
|
75
|
+
*/
|
|
76
|
+
getOrdinalNumbers(): Readonly<Record<string, number>>;
|
|
53
77
|
/**
|
|
54
78
|
* Get conjunctions for the language
|
|
55
79
|
* @returns Array of conjunction strings
|
|
@@ -71,12 +95,6 @@ export interface ParserLanguageProvider extends LanguageProvider {
|
|
|
71
95
|
* @returns The base form of the word
|
|
72
96
|
*/
|
|
73
97
|
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
98
|
/**
|
|
81
99
|
* Format a list of items with proper conjunction
|
|
82
100
|
* @param items Array of strings to format
|
|
@@ -129,30 +147,5 @@ export interface ParserLanguageProvider extends LanguageProvider {
|
|
|
129
147
|
* @returns The pattern string or undefined
|
|
130
148
|
*/
|
|
131
149
|
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
150
|
}
|
|
158
151
|
//# sourceMappingURL=parser-language-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-language-provider.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/parser-language-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"parser-language-provider.d.ts","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AAG,MAAM,CAAC;IAEhC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;IAE/D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3C;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;;OAGG;IACH,mBAAmB,IAAI,MAAM,EAAE,CAAC;IAEhC;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE,CAAC;IAE3B;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC;IAGnC;;;OAGG;IACH,eAAe,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAE7C;;;;OAIG;IACH,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACvD"}
|
package/sound/types.d.ts
CHANGED
|
@@ -113,6 +113,27 @@ export interface ISound {
|
|
|
113
113
|
readonly volumeTier: VolumeTier;
|
|
114
114
|
readonly content?: ISoundContent;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Semantic-event types of the sound subsystem — one home for the engine
|
|
118
|
+
* (which fires them) and stdlib (which routes them), since both depend on
|
|
119
|
+
* this package and neither may depend on the other.
|
|
120
|
+
*/
|
|
121
|
+
export declare const SOUND_EVENT_TYPES: {
|
|
122
|
+
/**
|
|
123
|
+
* A sound was made in the world (ADR-374 D6). Event `data` is an `ISound`;
|
|
124
|
+
* the engine's sound stage gathers every such event of the turn into the
|
|
125
|
+
* sound buffer, beside the sounds actions emit through `context.emitSound`.
|
|
126
|
+
*/
|
|
127
|
+
readonly EMITTED: "sound.emitted";
|
|
128
|
+
/**
|
|
129
|
+
* A listener perceived a propagated sound. Event `data` is an
|
|
130
|
+
* `IAudibilityEvent` (per-listener tier, source-room, optional
|
|
131
|
+
* crossing wall, content if content-bearing). The sound stage applies
|
|
132
|
+
* these through the world's event handlers, so a listener can react.
|
|
133
|
+
*/
|
|
134
|
+
readonly AUDIBILITY_HEARD: "sound.audibility.heard";
|
|
135
|
+
};
|
|
136
|
+
export type SoundEventType = typeof SOUND_EVENT_TYPES[keyof typeof SOUND_EVENT_TYPES];
|
|
116
137
|
/**
|
|
117
138
|
* The per-listener event the propagation function produces and the sound
|
|
118
139
|
* channel routes. Carries enough context for both prose rendering and
|
package/sound/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/sound/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAM9C;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAElF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAMnE,CAAC;AAMH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAM3F;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC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YAAY,EAAE,QAAQ,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;;OAIG;;IAEH;;;;;OAKG;;CAEK,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAMtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAC3D,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
|
package/sound/types.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @see ADR-173 — Wall Adjacency Primitive (substrate this rides on)
|
|
27
27
|
*/
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.VOLUME_TIER_BUDGETS = void 0;
|
|
29
|
+
exports.SOUND_EVENT_TYPES = exports.VOLUME_TIER_BUDGETS = void 0;
|
|
30
30
|
/**
|
|
31
31
|
* Platform-default propagation budgets per volume tier (ADR-172). Stories
|
|
32
32
|
* that want a different acoustic register (a horror story with sound that
|
|
@@ -43,4 +43,24 @@ exports.VOLUME_TIER_BUDGETS = Object.freeze({
|
|
|
43
43
|
raised: 7,
|
|
44
44
|
shouting: 9,
|
|
45
45
|
});
|
|
46
|
+
/**
|
|
47
|
+
* Semantic-event types of the sound subsystem — one home for the engine
|
|
48
|
+
* (which fires them) and stdlib (which routes them), since both depend on
|
|
49
|
+
* this package and neither may depend on the other.
|
|
50
|
+
*/
|
|
51
|
+
exports.SOUND_EVENT_TYPES = {
|
|
52
|
+
/**
|
|
53
|
+
* A sound was made in the world (ADR-374 D6). Event `data` is an `ISound`;
|
|
54
|
+
* the engine's sound stage gathers every such event of the turn into the
|
|
55
|
+
* sound buffer, beside the sounds actions emit through `context.emitSound`.
|
|
56
|
+
*/
|
|
57
|
+
EMITTED: 'sound.emitted',
|
|
58
|
+
/**
|
|
59
|
+
* A listener perceived a propagated sound. Event `data` is an
|
|
60
|
+
* `IAudibilityEvent` (per-listener tier, source-room, optional
|
|
61
|
+
* crossing wall, content if content-bearing). The sound stage applies
|
|
62
|
+
* these through the world's event handlers, so a listener can react.
|
|
63
|
+
*/
|
|
64
|
+
AUDIBILITY_HEARD: 'sound.audibility.heard',
|
|
65
|
+
};
|
|
46
66
|
//# sourceMappingURL=types.js.map
|
package/sound/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/sound/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAoBH;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAyC,MAAM,CAAC,MAAM,CAAC;IACrF,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;CACZ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/sound/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAoBH;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAyC,MAAM,CAAC,MAAM,CAAC;IACrF,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;CACZ,CAAC,CAAC;AAiFH;;;;GAIG;AACU,QAAA,iBAAiB,GAAG;IAC/B;;;;OAIG;IACH,OAAO,EAAE,eAAe;IACxB;;;;;OAKG;IACH,gBAAgB,EAAE,wBAAwB;CAClC,CAAC"}
|
|
@@ -9,11 +9,15 @@ import { ParserLanguageProvider } from '../parser-language-provider.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function adaptVerbVocabulary(languageProvider: ParserLanguageProvider): VerbVocabulary[];
|
|
11
11
|
/**
|
|
12
|
-
* Adapt direction vocabulary from language provider
|
|
12
|
+
* Adapt direction vocabulary from the language provider. The provider's
|
|
13
|
+
* table is the one direction table (ADR-387 D5); nothing is built from
|
|
14
|
+
* a fallback.
|
|
13
15
|
*/
|
|
14
16
|
export declare function adaptDirectionVocabulary(languageProvider: ParserLanguageProvider): DirectionVocabulary[];
|
|
15
17
|
/**
|
|
16
|
-
* Adapt special vocabulary from language provider
|
|
18
|
+
* Adapt special vocabulary from the language provider. The provider's table
|
|
19
|
+
* is the one home of the articles, pronouns, all and except words (ADR-387
|
|
20
|
+
* D1); no English fallback stands in for a provider that lacks them.
|
|
17
21
|
*/
|
|
18
22
|
export declare function adaptSpecialVocabulary(languageProvider: ParserLanguageProvider): SpecialVocabulary;
|
|
19
23
|
//# sourceMappingURL=vocabulary-adapters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary-adapters.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/vocabulary-contracts/vocabulary-adapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,cAAc,EAAE,CAqB9F;AAED
|
|
1
|
+
{"version":3,"file":"vocabulary-adapters.d.ts","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/vocabulary-contracts/vocabulary-adapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,cAAc,EAAE,CAqB9F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,mBAAmB,EAAE,CAExG;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,iBAAiB,CAElG"}
|
|
@@ -30,44 +30,19 @@ function adaptVerbVocabulary(languageProvider) {
|
|
|
30
30
|
return verbs;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Adapt direction vocabulary from language provider
|
|
33
|
+
* Adapt direction vocabulary from the language provider. The provider's
|
|
34
|
+
* table is the one direction table (ADR-387 D5); nothing is built from
|
|
35
|
+
* a fallback.
|
|
34
36
|
*/
|
|
35
37
|
function adaptDirectionVocabulary(languageProvider) {
|
|
36
|
-
|
|
37
|
-
if (languageProvider.getDirections) {
|
|
38
|
-
return languageProvider.getDirections();
|
|
39
|
-
}
|
|
40
|
-
// Otherwise try to build from mappings
|
|
41
|
-
const directions = [];
|
|
42
|
-
const directionMappings = languageProvider.getDirectionMappings?.() || {};
|
|
43
|
-
for (const [direction, words] of Object.entries(directionMappings)) {
|
|
44
|
-
if (Array.isArray(words)) {
|
|
45
|
-
// Separate full words from abbreviations (1-2 character words)
|
|
46
|
-
const fullWords = words.filter(w => w.length > 2);
|
|
47
|
-
const abbreviations = words.filter(w => w.length <= 2);
|
|
48
|
-
directions.push({
|
|
49
|
-
direction,
|
|
50
|
-
words: fullWords.length > 0 ? fullWords : words,
|
|
51
|
-
abbreviations: abbreviations.length > 0 ? abbreviations : undefined
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return directions;
|
|
38
|
+
return languageProvider.getDirections();
|
|
56
39
|
}
|
|
57
40
|
/**
|
|
58
|
-
* Adapt special vocabulary from language provider
|
|
41
|
+
* Adapt special vocabulary from the language provider. The provider's table
|
|
42
|
+
* is the one home of the articles, pronouns, all and except words (ADR-387
|
|
43
|
+
* D1); no English fallback stands in for a provider that lacks them.
|
|
59
44
|
*/
|
|
60
45
|
function adaptSpecialVocabulary(languageProvider) {
|
|
61
|
-
|
|
62
|
-
if (languageProvider.getSpecialVocabulary) {
|
|
63
|
-
return languageProvider.getSpecialVocabulary();
|
|
64
|
-
}
|
|
65
|
-
// Otherwise build from individual methods
|
|
66
|
-
return {
|
|
67
|
-
pronouns: languageProvider.getPronouns?.() || ['it', 'them'],
|
|
68
|
-
allWords: languageProvider.getAllWords?.() || ['all', 'everything'],
|
|
69
|
-
exceptWords: languageProvider.getExceptWords?.() || ['except', 'but'],
|
|
70
|
-
articles: languageProvider.getArticles?.() || ['a', 'an', 'the']
|
|
71
|
-
};
|
|
46
|
+
return languageProvider.getSpecialVocabulary();
|
|
72
47
|
}
|
|
73
48
|
//# sourceMappingURL=vocabulary-adapters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary-adapters.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/vocabulary-contracts/vocabulary-adapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAaH,kDAqBC;
|
|
1
|
+
{"version":3,"file":"vocabulary-adapters.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/if-domain/src/vocabulary-contracts/vocabulary-adapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAaH,kDAqBC;AAOD,4DAEC;AAOD,wDAEC;AA1CD;;GAEG;AACH,SAAgB,mBAAmB,CAAC,gBAAwC;IAC1E,iDAAiD;IACjD,IAAI,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAED,uCAAuC;IACvC,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC;IAEhE,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC;gBACT,QAAQ;gBACR,KAAK,EAAE,QAAQ;gBACf,OAAO,EAAE,gBAAgB,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC;aACrD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,gBAAwC;IAC/E,OAAO,gBAAgB,CAAC,aAAa,EAAE,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,gBAAwC;IAC7E,OAAO,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vocabulary Registry -
|
|
2
|
+
* Vocabulary Registry - the words one parser's typed input may carry
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* One registry per parser instance (ADR-387 D4): the parser constructs its
|
|
5
|
+
* own and registers the language's words and the story's verbs into it. There
|
|
6
|
+
* is no shared instance. Entity names are not vocabulary: the noun matcher
|
|
7
|
+
* resolves them over the world (ADR-385).
|
|
8
|
+
*
|
|
9
|
+
* Sources:
|
|
5
10
|
* - Base vocabulary from language packages
|
|
6
11
|
* - Extension vocabulary
|
|
7
12
|
* - Story-specific vocabulary
|
|
8
|
-
* - Dynamic entity vocabulary
|
|
9
13
|
*/
|
|
10
|
-
import { VocabularyEntry, VocabularySet, VocabularyProvider, PartOfSpeech,
|
|
14
|
+
import { VocabularyEntry, VocabularySet, VocabularyProvider, PartOfSpeech, VerbVocabulary, DirectionVocabulary, SpecialVocabulary, DeterminerVocabulary } from './vocabulary-types.js';
|
|
11
15
|
/**
|
|
12
16
|
* Central vocabulary registry
|
|
13
17
|
*/
|
|
14
18
|
export declare class VocabularyRegistry {
|
|
15
19
|
private providers;
|
|
16
|
-
private entityVocabulary;
|
|
17
20
|
private cachedVocabulary;
|
|
18
21
|
private dirtyCache;
|
|
19
22
|
/**
|
|
@@ -24,18 +27,6 @@ export declare class VocabularyRegistry {
|
|
|
24
27
|
* Unregister a vocabulary provider
|
|
25
28
|
*/
|
|
26
29
|
unregisterProvider(providerId: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Register vocabulary for an entity
|
|
29
|
-
*/
|
|
30
|
-
registerEntity(vocab: EntityVocabulary): void;
|
|
31
|
-
/**
|
|
32
|
-
* Unregister vocabulary for an entity
|
|
33
|
-
*/
|
|
34
|
-
unregisterEntity(entityId: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* Update entity scope status
|
|
37
|
-
*/
|
|
38
|
-
updateEntityScope(entityId: string, inScope: boolean): void;
|
|
39
30
|
/**
|
|
40
31
|
* Get all vocabulary
|
|
41
32
|
*/
|
|
@@ -52,10 +43,6 @@ export declare class VocabularyRegistry {
|
|
|
52
43
|
* Check if a word exists in vocabulary
|
|
53
44
|
*/
|
|
54
45
|
hasWord(word: string, partOfSpeech?: PartOfSpeech): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Get vocabulary for entities in scope
|
|
57
|
-
*/
|
|
58
|
-
getInScopeEntities(): EntityVocabulary[];
|
|
59
46
|
/**
|
|
60
47
|
* Clear all vocabulary
|
|
61
48
|
*/
|
|
@@ -80,7 +67,7 @@ export declare class VocabularyRegistry {
|
|
|
80
67
|
/**
|
|
81
68
|
* Register determiners (beyond articles)
|
|
82
69
|
*/
|
|
83
|
-
registerDeterminers(determiners:
|
|
70
|
+
registerDeterminers(determiners: readonly DeterminerVocabulary[]): void;
|
|
84
71
|
/**
|
|
85
72
|
* Register conjunctions
|
|
86
73
|
*/
|
|
@@ -94,5 +81,4 @@ export declare class VocabularyRegistry {
|
|
|
94
81
|
*/
|
|
95
82
|
registerSpecial(special: SpecialVocabulary): void;
|
|
96
83
|
}
|
|
97
|
-
export declare const vocabularyRegistry: VocabularyRegistry;
|
|
98
84
|
//# sourceMappingURL=vocabulary-registry.d.ts.map
|