@sharpee/lang-en-us 5.4.1 → 5.5.1
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/actions/asking-for.d.ts +24 -0
- package/actions/asking-for.d.ts.map +1 -0
- package/actions/asking-for.js +32 -0
- package/actions/asking-for.js.map +1 -0
- package/actions/burning.d.ts +25 -0
- package/actions/burning.d.ts.map +1 -0
- package/actions/burning.js +35 -0
- package/actions/burning.js.map +1 -0
- package/actions/buying.d.ts +22 -0
- package/actions/buying.d.ts.map +1 -0
- package/actions/buying.js +31 -0
- package/actions/buying.js.map +1 -0
- package/actions/climbing.js +1 -1
- package/actions/climbing.js.map +1 -1
- package/actions/consulting.d.ts +21 -0
- package/actions/consulting.d.ts.map +1 -0
- package/actions/consulting.js +30 -0
- package/actions/consulting.js.map +1 -0
- package/actions/dropping.d.ts +3 -0
- package/actions/dropping.d.ts.map +1 -1
- package/actions/dropping.js +7 -1
- package/actions/dropping.js.map +1 -1
- package/actions/emptying.d.ts +26 -0
- package/actions/emptying.d.ts.map +1 -0
- package/actions/emptying.js +36 -0
- package/actions/emptying.js.map +1 -0
- package/actions/entering.d.ts +2 -0
- package/actions/entering.d.ts.map +1 -1
- package/actions/entering.js +5 -1
- package/actions/entering.js.map +1 -1
- package/actions/examining.d.ts +1 -0
- package/actions/examining.d.ts.map +1 -1
- package/actions/examining.js +3 -1
- package/actions/examining.js.map +1 -1
- package/actions/exiting.d.ts +2 -0
- package/actions/exiting.d.ts.map +1 -1
- package/actions/exiting.js +5 -1
- package/actions/exiting.js.map +1 -1
- package/actions/extinguishing.d.ts +21 -0
- package/actions/extinguishing.d.ts.map +1 -0
- package/actions/extinguishing.js +32 -0
- package/actions/extinguishing.js.map +1 -0
- package/actions/going.d.ts +15 -0
- package/actions/going.d.ts.map +1 -1
- package/actions/going.js +32 -5
- package/actions/going.js.map +1 -1
- package/actions/help.d.ts +0 -2
- package/actions/help.d.ts.map +1 -1
- package/actions/help.js +0 -3
- package/actions/help.js.map +1 -1
- package/actions/index.d.ts +353 -7
- package/actions/index.d.ts.map +1 -1
- package/actions/index.js +72 -0
- package/actions/index.js.map +1 -1
- package/actions/inserting.d.ts +1 -0
- package/actions/inserting.d.ts.map +1 -1
- package/actions/inserting.js +2 -1
- package/actions/inserting.js.map +1 -1
- package/actions/jumping.d.ts +17 -0
- package/actions/jumping.d.ts.map +1 -0
- package/actions/jumping.js +25 -0
- package/actions/jumping.js.map +1 -0
- package/actions/kissing.d.ts +19 -0
- package/actions/kissing.d.ts.map +1 -0
- package/actions/kissing.js +28 -0
- package/actions/kissing.js.map +1 -0
- package/actions/lighting.d.ts +27 -0
- package/actions/lighting.d.ts.map +1 -0
- package/actions/lighting.js +35 -0
- package/actions/lighting.js.map +1 -0
- package/actions/looking-under.d.ts +19 -0
- package/actions/looking-under.d.ts.map +1 -0
- package/actions/looking-under.js +27 -0
- package/actions/looking-under.js.map +1 -0
- package/actions/looking.d.ts +4 -2
- package/actions/looking.d.ts.map +1 -1
- package/actions/looking.js +9 -7
- package/actions/looking.js.map +1 -1
- package/actions/pulling.d.ts +2 -0
- package/actions/pulling.d.ts.map +1 -1
- package/actions/pulling.js +3 -1
- package/actions/pulling.js.map +1 -1
- package/actions/pushing.d.ts +2 -2
- package/actions/pushing.d.ts.map +1 -1
- package/actions/pushing.js +7 -4
- package/actions/pushing.js.map +1 -1
- package/actions/removing.d.ts +1 -0
- package/actions/removing.d.ts.map +1 -1
- package/actions/removing.js +2 -1
- package/actions/removing.js.map +1 -1
- package/actions/saying-no.d.ts +17 -0
- package/actions/saying-no.d.ts.map +1 -0
- package/actions/saying-no.js +23 -0
- package/actions/saying-no.js.map +1 -0
- package/actions/saying-sorry.d.ts +16 -0
- package/actions/saying-sorry.d.ts.map +1 -0
- package/actions/saying-sorry.js +23 -0
- package/actions/saying-sorry.js.map +1 -0
- package/actions/saying-yes.d.ts +17 -0
- package/actions/saying-yes.d.ts.map +1 -0
- package/actions/saying-yes.js +23 -0
- package/actions/saying-yes.js.map +1 -0
- package/actions/searching.d.ts +2 -0
- package/actions/searching.d.ts.map +1 -1
- package/actions/searching.js +4 -1
- package/actions/searching.js.map +1 -1
- package/actions/setting-course.d.ts +26 -0
- package/actions/setting-course.d.ts.map +1 -0
- package/actions/setting-course.js +35 -0
- package/actions/setting-course.js.map +1 -0
- package/actions/setting.d.ts +21 -0
- package/actions/setting.d.ts.map +1 -0
- package/actions/setting.js +30 -0
- package/actions/setting.js.map +1 -0
- package/actions/sleeping.d.ts +1 -0
- package/actions/sleeping.d.ts.map +1 -1
- package/actions/sleeping.js +10 -5
- package/actions/sleeping.js.map +1 -1
- package/actions/steering.d.ts +34 -0
- package/actions/steering.d.ts.map +1 -0
- package/actions/steering.js +45 -0
- package/actions/steering.js.map +1 -0
- package/actions/taking.d.ts +2 -0
- package/actions/taking.d.ts.map +1 -1
- package/actions/taking.js +3 -0
- package/actions/taking.js.map +1 -1
- package/actions/throwing.d.ts +3 -1
- package/actions/throwing.d.ts.map +1 -1
- package/actions/throwing.js +8 -5
- package/actions/throwing.js.map +1 -1
- package/actions/tying.d.ts +22 -0
- package/actions/tying.d.ts.map +1 -0
- package/actions/tying.js +32 -0
- package/actions/tying.js.map +1 -0
- package/actions/untying.d.ts +19 -0
- package/actions/untying.d.ts.map +1 -0
- package/actions/untying.js +28 -0
- package/actions/untying.js.map +1 -0
- package/actions/waking.d.ts +16 -0
- package/actions/waking.d.ts.map +1 -0
- package/actions/waking.js +24 -0
- package/actions/waking.js.map +1 -0
- package/actions/waving.d.ts +19 -0
- package/actions/waving.d.ts.map +1 -0
- package/actions/waving.js +28 -0
- package/actions/waving.js.map +1 -0
- package/assembler/english-assembler.d.ts.map +1 -1
- package/assembler/english-assembler.js +30 -7
- package/assembler/english-assembler.js.map +1 -1
- package/assembler/index.d.ts +1 -0
- package/assembler/index.d.ts.map +1 -1
- package/assembler/index.js +4 -1
- package/assembler/index.js.map +1 -1
- package/assembler/location-heading.d.ts +42 -0
- package/assembler/location-heading.d.ts.map +1 -0
- package/assembler/location-heading.js +103 -0
- package/assembler/location-heading.js.map +1 -0
- package/data/verbs.d.ts +20 -1
- package/data/verbs.d.ts.map +1 -1
- package/data/verbs.js +139 -5
- package/data/verbs.js.map +1 -1
- package/data/words.d.ts +54 -15
- package/data/words.d.ts.map +1 -1
- package/data/words.js +92 -57
- package/data/words.js.map +1 -1
- package/grammar.d.ts.map +1 -1
- package/grammar.js +2 -2
- package/grammar.js.map +1 -1
- package/index.d.ts +1 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -7
- package/index.js.map +1 -1
- package/language-provider.d.ts +18 -3
- package/language-provider.d.ts.map +1 -1
- package/language-provider.js +69 -22
- package/language-provider.js.map +1 -1
- package/package.json +3 -3
- package/parser/parse-phrase-template.d.ts +4 -0
- package/parser/parse-phrase-template.d.ts.map +1 -1
- package/parser/parse-phrase-template.js +31 -0
- package/parser/parse-phrase-template.js.map +1 -1
- package/platform-messages.d.ts +1 -0
- package/platform-messages.d.ts.map +1 -1
- package/platform-messages.js +5 -0
- package/platform-messages.js.map +1 -1
- package/data/messages.d.ts +0 -28
- package/data/messages.d.ts.map +0 -1
- package/data/messages.js +0 -87
- package/data/messages.js.map +0 -1
package/data/messages.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* English parser error messages: the text the player reads when a command
|
|
4
|
-
* fails to parse, keyed by the parse error's message id.
|
|
5
|
-
*
|
|
6
|
-
* Public interface: `parserErrors` (the template table) and
|
|
7
|
-
* `getParserErrorMessage(messageId, context)` (template resolution).
|
|
8
|
-
*
|
|
9
|
-
* Owner context: `@sharpee/lang-en-us`, the English language layer.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.parserErrors = void 0;
|
|
13
|
-
exports.getParserErrorMessage = getParserErrorMessage;
|
|
14
|
-
/**
|
|
15
|
-
* Parser error messages
|
|
16
|
-
* Keys match the messageId from ParseErrorCode analysis
|
|
17
|
-
*
|
|
18
|
-
* Template variables:
|
|
19
|
-
* - {verb} - The recognized verb
|
|
20
|
-
* - {noun} - The word that failed to resolve
|
|
21
|
-
* - {slot} - The slot name (target, container, etc.)
|
|
22
|
-
* - {options} - Comma-separated list of disambiguation options
|
|
23
|
-
*/
|
|
24
|
-
exports.parserErrors = {
|
|
25
|
-
// No input
|
|
26
|
-
'parser.error.noInput': "I beg your pardon?",
|
|
27
|
-
// Unknown verb
|
|
28
|
-
'parser.error.unknownVerb': (ctx) => ctx.verb
|
|
29
|
-
? `I don't know the word "${ctx.verb}".`
|
|
30
|
-
: "I don't understand that sentence.",
|
|
31
|
-
// Missing direct object
|
|
32
|
-
'parser.error.missingObject': (ctx) => ctx.verb
|
|
33
|
-
? `What do you want to ${ctx.verb}?`
|
|
34
|
-
: "What do you want to do that to?",
|
|
35
|
-
// Missing indirect object
|
|
36
|
-
'parser.error.missingIndirect': (ctx) => {
|
|
37
|
-
if (ctx.verb && ctx.slot) {
|
|
38
|
-
// Create natural phrasing based on slot
|
|
39
|
-
const where = ['container', 'location', 'destination'].includes(ctx.slot);
|
|
40
|
-
return where
|
|
41
|
-
? `Where do you want to ${ctx.verb} it?`
|
|
42
|
-
: `What do you want to ${ctx.verb} it ${ctx.slot}?`;
|
|
43
|
-
}
|
|
44
|
-
return "I need more information to understand that.";
|
|
45
|
-
},
|
|
46
|
-
// Entity not found
|
|
47
|
-
'parser.error.entityNotFound': (ctx) => ctx.noun
|
|
48
|
-
? `You can't see any "${ctx.noun}" here.`
|
|
49
|
-
: "You can't see any such thing.",
|
|
50
|
-
// Scope violation
|
|
51
|
-
'parser.error.scopeViolation': (ctx) => ctx.noun
|
|
52
|
-
? `You can't reach the ${ctx.noun}.`
|
|
53
|
-
: "You can't reach that.",
|
|
54
|
-
// Ambiguous input
|
|
55
|
-
'parser.error.ambiguous': (ctx) => {
|
|
56
|
-
if (ctx.candidates && ctx.candidates.length > 0) {
|
|
57
|
-
const options = ctx.candidates.join(', ');
|
|
58
|
-
return `Which do you mean: ${options}?`;
|
|
59
|
-
}
|
|
60
|
-
return ctx.noun
|
|
61
|
-
? `Which ${ctx.noun} do you mean?`
|
|
62
|
-
: "Which do you mean?";
|
|
63
|
-
},
|
|
64
|
-
// Generic syntax error
|
|
65
|
-
'parser.error.invalidSyntax': (ctx) => ctx.extraWords
|
|
66
|
-
? `I understood you as far as "${ctx.verb}" but got confused by "${ctx.extraWords}".`
|
|
67
|
-
: "I don't understand that sentence."
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Get a parser error message by ID
|
|
71
|
-
* @param messageId The message ID (e.g., 'parser.error.unknownVerb')
|
|
72
|
-
* @param context Template variables to substitute
|
|
73
|
-
* @returns The formatted error message
|
|
74
|
-
*/
|
|
75
|
-
function getParserErrorMessage(messageId, context = {}) {
|
|
76
|
-
const template = exports.parserErrors[messageId];
|
|
77
|
-
if (!template) {
|
|
78
|
-
// Fallback to generic message
|
|
79
|
-
return "I don't understand that.";
|
|
80
|
-
}
|
|
81
|
-
if (typeof template === 'function') {
|
|
82
|
-
return template(context);
|
|
83
|
-
}
|
|
84
|
-
// Simple string template - replace {key} placeholders
|
|
85
|
-
return template.replace(/\{(\w+)\}/g, (_, key) => context[key] || '');
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=messages.js.map
|
package/data/messages.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../../../work/sharpee/sharpee/packages/lang-en-us/src/data/messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA4EH,sDAgBC;AA1FD;;;;;;;;;GASG;AACU,QAAA,YAAY,GAAoE;IAC3F,WAAW;IACX,sBAAsB,EAAE,oBAAoB;IAE5C,eAAe;IACf,0BAA0B,EAAE,CAAC,GAAG,EAAE,EAAE,CAClC,GAAG,CAAC,IAAI;QACN,CAAC,CAAC,0B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