@sharpee/if-domain 5.3.2 → 5.4.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/endings.d.ts +39 -14
- package/endings.d.ts.map +1 -1
- package/endings.js +9 -15
- package/endings.js.map +1 -1
- package/package.json +3 -3
- package/prompt.d.ts +10 -1
- package/prompt.d.ts.map +1 -1
- package/prompt.js +11 -2
- package/prompt.js.map +1 -1
package/endings.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Story ending contract (ADR-210 Platform Prerequisite 3).
|
|
3
3
|
*
|
|
4
|
-
* Purpose: bless the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Purpose: bless the story-ending convention as a stable wire contract — the
|
|
5
|
+
* event types stories/loaders emit when a story ends, and the shape of the
|
|
6
|
+
* Ending the world carries (ADR-347 D2a). No behavior lives here; emitters
|
|
7
|
+
* build the events with existing primitives.
|
|
8
8
|
*
|
|
9
|
-
* Public interface: `StoryEndingEvents`, `
|
|
10
|
-
* `
|
|
9
|
+
* Public interface: `StoryEndingEvents`, `StoryEndingKind`,
|
|
10
|
+
* `IStoryEndingData`, `IStoryEnding`.
|
|
11
11
|
*
|
|
12
12
|
* Owner context: `@sharpee/if-domain` — shared by the story-loader (emits on
|
|
13
13
|
* `win`/`lose`), the engine/clients (react to endings), and transcript tests
|
|
14
14
|
* (assert on the event types), so per the co-located wire-type rule it lives
|
|
15
|
-
* here. INVARIANT: values are frozen contract — changing them
|
|
16
|
-
*
|
|
15
|
+
* here. INVARIANT: the event-type values are frozen contract — changing them
|
|
16
|
+
* breaks golden transcripts; additions only.
|
|
17
17
|
*/
|
|
18
18
|
/** Semantic event types emitted when a story ends. */
|
|
19
19
|
export declare const StoryEndingEvents: {
|
|
@@ -24,16 +24,41 @@ export declare const StoryEndingEvents: {
|
|
|
24
24
|
};
|
|
25
25
|
/** How a story ended. */
|
|
26
26
|
export type StoryEndingKind = 'victory' | 'defeat';
|
|
27
|
-
/**
|
|
28
|
-
* World-state key holding the ending once one is reached (a
|
|
29
|
-
* `StoryEndingKind`), or unset while play continues. The generic
|
|
30
|
-
* `isComplete()` reads this key; stories never implement completion logic.
|
|
31
|
-
*/
|
|
32
|
-
export declare const STORY_ENDING_FLAG = "story.ending";
|
|
33
27
|
/** Payload carried by a `StoryEndingEvents` event. */
|
|
34
28
|
export interface IStoryEndingData {
|
|
35
29
|
ending: StoryEndingKind;
|
|
36
30
|
/** Message ID of the ending phrase, when the author supplied one. */
|
|
37
31
|
messageId?: string;
|
|
38
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* The ending a story reached, or absent while play continues (ADR-347 D1, D2d).
|
|
35
|
+
*
|
|
36
|
+
* A story that has not ended carries no Ending — which is a different
|
|
37
|
+
* statement from "carries an Ending that says nothing". Once written it is
|
|
38
|
+
* final: the first ending wins (`endStory`'s rejection rule), so a reader
|
|
39
|
+
* may treat `turn` as the turn the conclusion actually happened on.
|
|
40
|
+
*/
|
|
41
|
+
export interface IStoryEnding {
|
|
42
|
+
/** Victory or defeat. */
|
|
43
|
+
readonly kind: StoryEndingKind;
|
|
44
|
+
/**
|
|
45
|
+
* The turn the story ended on.
|
|
46
|
+
*
|
|
47
|
+
* Required, so a client can always say *when* and a save can always say
|
|
48
|
+
* whether the ending it carries is the one it was written at. The world
|
|
49
|
+
* holds no turn counter, so the declaring site supplies it — Chord's
|
|
50
|
+
* runtime has `turnNow`, the engine's stages have `context.turn`. A
|
|
51
|
+
* headless Chord run with no engine turn provider wired records `0`,
|
|
52
|
+
* which is `turnNow`'s existing fallback and the same answer timers get.
|
|
53
|
+
*/
|
|
54
|
+
readonly turn: number;
|
|
55
|
+
/**
|
|
56
|
+
* Message ID of the ending phrase, when the author supplied one. It
|
|
57
|
+
* identifies the phrase; it does not render it (GH #274) — same rule as
|
|
58
|
+
* {@link IStoryEndingData.messageId}.
|
|
59
|
+
*/
|
|
60
|
+
readonly messageId?: string;
|
|
61
|
+
/** Free-form cause, e.g. the `cause` a player death carried. */
|
|
62
|
+
readonly cause?: string;
|
|
63
|
+
}
|
|
39
64
|
//# sourceMappingURL=endings.d.ts.map
|
package/endings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endings.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,iBAAiB;IAC5B,0EAA0E;;IAE1E,2EAA2E;;CAEnE,CAAC;AAEX,yBAAyB;AACzB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"endings.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,iBAAiB;IAC5B,0EAA0E;;IAE1E,2EAA2E;;CAEnE,CAAC;AAEX,yBAAyB;AACzB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/endings.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @file Story ending contract (ADR-210 Platform Prerequisite 3).
|
|
4
4
|
*
|
|
5
|
-
* Purpose: bless the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Purpose: bless the story-ending convention as a stable wire contract — the
|
|
6
|
+
* event types stories/loaders emit when a story ends, and the shape of the
|
|
7
|
+
* Ending the world carries (ADR-347 D2a). No behavior lives here; emitters
|
|
8
|
+
* build the events with existing primitives.
|
|
9
9
|
*
|
|
10
|
-
* Public interface: `StoryEndingEvents`, `
|
|
11
|
-
* `
|
|
10
|
+
* Public interface: `StoryEndingEvents`, `StoryEndingKind`,
|
|
11
|
+
* `IStoryEndingData`, `IStoryEnding`.
|
|
12
12
|
*
|
|
13
13
|
* Owner context: `@sharpee/if-domain` — shared by the story-loader (emits on
|
|
14
14
|
* `win`/`lose`), the engine/clients (react to endings), and transcript tests
|
|
15
15
|
* (assert on the event types), so per the co-located wire-type rule it lives
|
|
16
|
-
* here. INVARIANT: values are frozen contract — changing them
|
|
17
|
-
*
|
|
16
|
+
* here. INVARIANT: the event-type values are frozen contract — changing them
|
|
17
|
+
* breaks golden transcripts; additions only.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.StoryEndingEvents = void 0;
|
|
21
21
|
/** Semantic event types emitted when a story ends. */
|
|
22
22
|
exports.StoryEndingEvents = {
|
|
23
23
|
/** The player has won (`win` in Chord; `story.victory` by convention). */
|
|
@@ -25,10 +25,4 @@ exports.StoryEndingEvents = {
|
|
|
25
25
|
/** The player has lost (`lose` in Chord; `story.defeat` by convention). */
|
|
26
26
|
DEFEAT: 'story.defeat',
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
29
|
-
* World-state key holding the ending once one is reached (a
|
|
30
|
-
* `StoryEndingKind`), or unset while play continues. The generic
|
|
31
|
-
* `isComplete()` reads this key; stories never implement completion logic.
|
|
32
|
-
*/
|
|
33
|
-
exports.STORY_ENDING_FLAG = 'story.ending';
|
|
34
28
|
//# sourceMappingURL=endings.js.map
|
package/endings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endings.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAAsD;AACzC,QAAA,iBAAiB,GAAG;IAC/B,0EAA0E;IAC1E,OAAO,EAAE,eAAe;IACxB,2EAA2E;IAC3E,MAAM,EAAE,cAAc;CACd,CAAC
|
|
1
|
+
{"version":3,"file":"endings.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAAsD;AACzC,QAAA,iBAAiB,GAAG;IAC/B,0EAA0E;IAC1E,OAAO,EAAE,eAAe;IACxB,2EAA2E;IAC3E,MAAM,EAAE,cAAc;CACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/if-domain",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
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.4.1",
|
|
16
|
+
"@sharpee/text-blocks": "^5.4.1"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"interactive-fiction",
|
package/prompt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The prompt is a channel primitive (FyreVM heritage). Each prompt is a named
|
|
5
5
|
* constant with a messageId resolved through the language provider.
|
|
6
6
|
*
|
|
7
|
-
* @public GamePrompt, DefaultPrompt, PROMPT_STATE_KEY
|
|
7
|
+
* @public GamePrompt, DefaultPrompt, EndGamePrompt, PROMPT_STATE_KEY
|
|
8
8
|
* @context if-domain (platform-level type)
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
@@ -26,6 +26,15 @@ export interface GamePrompt {
|
|
|
26
26
|
* Resolves to '> ' via lang-en-us registration of 'if.platform.prompt'.
|
|
27
27
|
*/
|
|
28
28
|
export declare const DefaultPrompt: GamePrompt;
|
|
29
|
+
/**
|
|
30
|
+
* The prompt shown once the story has ended (ADR-347 D3a).
|
|
31
|
+
*
|
|
32
|
+
* Derived from the world's Ending rather than stored, so it overrides
|
|
33
|
+
* whatever prompt the story last set: at an end-game prompt the story's
|
|
34
|
+
* own prompt is the wrong one. Resolves to the end-game prompt text via
|
|
35
|
+
* lang-en-us's registration of `if.platform.prompt.ended`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const EndGamePrompt: GamePrompt;
|
|
29
38
|
/**
|
|
30
39
|
* World state key for storing the active prompt.
|
|
31
40
|
*/
|
package/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAgD,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAgD,CAAC;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,UAAsD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
|
package/prompt.js
CHANGED
|
@@ -5,16 +5,25 @@
|
|
|
5
5
|
* The prompt is a channel primitive (FyreVM heritage). Each prompt is a named
|
|
6
6
|
* constant with a messageId resolved through the language provider.
|
|
7
7
|
*
|
|
8
|
-
* @public GamePrompt, DefaultPrompt, PROMPT_STATE_KEY
|
|
8
|
+
* @public GamePrompt, DefaultPrompt, EndGamePrompt, PROMPT_STATE_KEY
|
|
9
9
|
* @context if-domain (platform-level type)
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PROMPT_STATE_KEY = exports.DefaultPrompt = void 0;
|
|
12
|
+
exports.PROMPT_STATE_KEY = exports.EndGamePrompt = exports.DefaultPrompt = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* Platform default prompt.
|
|
15
15
|
* Resolves to '> ' via lang-en-us registration of 'if.platform.prompt'.
|
|
16
16
|
*/
|
|
17
17
|
exports.DefaultPrompt = { messageId: 'if.platform.prompt' };
|
|
18
|
+
/**
|
|
19
|
+
* The prompt shown once the story has ended (ADR-347 D3a).
|
|
20
|
+
*
|
|
21
|
+
* Derived from the world's Ending rather than stored, so it overrides
|
|
22
|
+
* whatever prompt the story last set: at an end-game prompt the story's
|
|
23
|
+
* own prompt is the wrong one. Resolves to the end-game prompt text via
|
|
24
|
+
* lang-en-us's registration of `if.platform.prompt.ended`.
|
|
25
|
+
*/
|
|
26
|
+
exports.EndGamePrompt = { messageId: 'if.platform.prompt.ended' };
|
|
18
27
|
/**
|
|
19
28
|
* World state key for storing the active prompt.
|
|
20
29
|
*/
|
package/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAiBH;;;GAGG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAE7E;;GAEG;AACU,QAAA,gBAAgB,GAAG,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAiBH;;;GAGG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAE7E;;;;;;;GAOG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;AAEnF;;GAEG;AACU,QAAA,gBAAgB,GAAG,WAAW,CAAC"}
|