@sharpee/if-services 0.9.62-beta → 0.9.65-beta
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/README.md +0 -0
- package/dist-npm/index.d.ts +0 -0
- package/dist-npm/index.d.ts.map +1 -1
- package/dist-npm/index.js +0 -0
- package/dist-npm/index.js.map +1 -1
- package/dist-npm/perception-service.d.ts +2 -2
- package/dist-npm/perception-service.d.ts.map +1 -1
- package/dist-npm/perception-service.js +0 -0
- package/dist-npm/perception-service.js.map +1 -1
- package/dist-npm/text-service.d.ts +137 -0
- package/dist-npm/text-service.d.ts.map +1 -0
- package/dist-npm/text-service.js +10 -0
- package/dist-npm/text-service.js.map +1 -0
- package/package.json +13 -14
- package/LICENSE +0 -21
package/README.md
CHANGED
|
File without changes
|
package/dist-npm/index.d.ts
CHANGED
|
File without changes
|
package/dist-npm/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":["../../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,sBAAsB,CAAC"}
|
package/dist-npm/index.js
CHANGED
|
File without changes
|
package/dist-npm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gCAAgC;AAChC,uDAAqC"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @see ADR-069 Perception-Based Event Filtering
|
|
10
10
|
*/
|
|
11
|
-
import type { ISemanticEvent } from
|
|
12
|
-
import type { IFEntity, IWorldModel } from
|
|
11
|
+
import type { ISemanticEvent } from "../../core/dist-npm/src/index";
|
|
12
|
+
import type { IFEntity, IWorldModel } from "../../world-model/dist-npm/src/index";
|
|
13
13
|
/**
|
|
14
14
|
* Sense types for perception checks
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perception-service.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"perception-service.d.ts","sourceRoot":"","sources":["../../../../src/perception-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,WAAW,GACX,aAAa,GACb,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,8BAA8B;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,YAAY,CACV,MAAM,EAAE,cAAc,EAAE,EACxB,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,WAAW,GACjB,cAAc,EAAE,CAAC;IAEpB;;;;;;;;OAQG;IACH,WAAW,CACT,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC;CACZ"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perception-service.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"perception-service.js","sourceRoot":"","sources":["../../../../src/perception-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text service interface for Interactive Fiction
|
|
3
|
+
*
|
|
4
|
+
* Text services are responsible for generating output after each turn.
|
|
5
|
+
* They have access to the game context and can query events, entities,
|
|
6
|
+
* and spatial relationships to build appropriate output.
|
|
7
|
+
*/
|
|
8
|
+
import type { ISemanticEvent } from "../../core/dist-npm/src/index";
|
|
9
|
+
import type { LanguageProvider } from "../../if-domain/dist-npm/src/index";
|
|
10
|
+
import type { WorldModel, IFEntity } from "../../world-model/dist-npm/src/index";
|
|
11
|
+
/**
|
|
12
|
+
* Game context provided to text service
|
|
13
|
+
*/
|
|
14
|
+
export interface TextServiceContext {
|
|
15
|
+
/**
|
|
16
|
+
* Current turn number
|
|
17
|
+
*/
|
|
18
|
+
currentTurn: number;
|
|
19
|
+
/**
|
|
20
|
+
* Get events for the current turn
|
|
21
|
+
*/
|
|
22
|
+
getCurrentTurnEvents(): ISemanticEvent[];
|
|
23
|
+
/**
|
|
24
|
+
* Get events by type for the current turn
|
|
25
|
+
*/
|
|
26
|
+
getEventsByType(type: string): ISemanticEvent[];
|
|
27
|
+
/**
|
|
28
|
+
* Get all events (full history)
|
|
29
|
+
*/
|
|
30
|
+
getAllEvents(): ISemanticEvent[];
|
|
31
|
+
/**
|
|
32
|
+
* Access to world model for entity queries
|
|
33
|
+
*/
|
|
34
|
+
world: WorldModel;
|
|
35
|
+
/**
|
|
36
|
+
* Get the player entity
|
|
37
|
+
*/
|
|
38
|
+
getPlayer(): IFEntity;
|
|
39
|
+
/**
|
|
40
|
+
* Get entities in a location
|
|
41
|
+
*/
|
|
42
|
+
getContents(locationId: string): IFEntity[];
|
|
43
|
+
/**
|
|
44
|
+
* Get location of an entity
|
|
45
|
+
*/
|
|
46
|
+
getLocation(entityId: string): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Get platform events for the current turn (optional)
|
|
49
|
+
* These are debug/system events from parser, world model, etc.
|
|
50
|
+
*/
|
|
51
|
+
getPlatformEvents?(): ISemanticEvent[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Output format for different client types
|
|
55
|
+
*/
|
|
56
|
+
export type TextOutput = string | TextOutputJSON | TextOutputChanneled;
|
|
57
|
+
/**
|
|
58
|
+
* JSON output for web/rich clients
|
|
59
|
+
*/
|
|
60
|
+
export interface TextOutputJSON {
|
|
61
|
+
type: 'json';
|
|
62
|
+
main: string;
|
|
63
|
+
metadata?: {
|
|
64
|
+
turn: number;
|
|
65
|
+
location?: string;
|
|
66
|
+
score?: number;
|
|
67
|
+
moves?: number;
|
|
68
|
+
};
|
|
69
|
+
sections?: {
|
|
70
|
+
room?: string;
|
|
71
|
+
inventory?: string[];
|
|
72
|
+
exits?: string[];
|
|
73
|
+
objects?: string[];
|
|
74
|
+
};
|
|
75
|
+
styling?: {
|
|
76
|
+
roomName?: string;
|
|
77
|
+
important?: string[];
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Multi-channel output
|
|
82
|
+
*/
|
|
83
|
+
export interface TextOutputChanneled {
|
|
84
|
+
type: 'channeled';
|
|
85
|
+
channels: Map<string, string>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Text service interface
|
|
89
|
+
*/
|
|
90
|
+
export interface TextService {
|
|
91
|
+
/**
|
|
92
|
+
* Initialize with context
|
|
93
|
+
*/
|
|
94
|
+
initialize(context: TextServiceContext): void;
|
|
95
|
+
/**
|
|
96
|
+
* Process the current turn and generate output
|
|
97
|
+
* @returns The formatted output
|
|
98
|
+
*/
|
|
99
|
+
processTurn(): TextOutput;
|
|
100
|
+
/**
|
|
101
|
+
* Set the language provider for template resolution
|
|
102
|
+
* @param provider The language provider
|
|
103
|
+
*/
|
|
104
|
+
setLanguageProvider(provider: LanguageProvider): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get the current language provider
|
|
107
|
+
* @returns The language provider or null if not set
|
|
108
|
+
*/
|
|
109
|
+
getLanguageProvider(): LanguageProvider | null;
|
|
110
|
+
/**
|
|
111
|
+
* Set output format preference
|
|
112
|
+
* @param format The desired output format
|
|
113
|
+
*/
|
|
114
|
+
setOutputFormat?(format: 'text' | 'json' | 'channeled'): void;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Text service configuration
|
|
118
|
+
*/
|
|
119
|
+
export interface TextServiceConfig {
|
|
120
|
+
/**
|
|
121
|
+
* Output format (defaults to 'text')
|
|
122
|
+
*/
|
|
123
|
+
outputFormat?: 'text' | 'json' | 'channeled';
|
|
124
|
+
/**
|
|
125
|
+
* Whether to include debug information in output
|
|
126
|
+
*/
|
|
127
|
+
debug?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Custom event processors by event type
|
|
130
|
+
*/
|
|
131
|
+
processors?: Record<string, (event: ISemanticEvent, context: TextServiceContext) => string | null>;
|
|
132
|
+
/**
|
|
133
|
+
* Channels to use for channeled output
|
|
134
|
+
*/
|
|
135
|
+
channels?: string[];
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=text-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-service.d.ts","sourceRoot":"","sources":["../src/text-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,oBAAoB,IAAI,cAAc,EAAE,CAAC;IAEzC;;OAE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AM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE9C;;;OAGG;IACH,WAAW,IAAI,UAAU,CAAC;IAE1B;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEtD;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAE/C;;;OAGG;IACH,eAAe,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,kBAAkB,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC;IAEnG;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Text service interface for Interactive Fiction
|
|
4
|
+
*
|
|
5
|
+
* Text services are responsible for generating output after each turn.
|
|
6
|
+
* They have access to the game context and can query events, entities,
|
|
7
|
+
* and spatial relationships to build appropriate output.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=text-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-service.js","sourceRoot":"","sources":["../src/text-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/if-services",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.65-beta",
|
|
4
4
|
"description": "Runtime service interfaces for Sharpee Interactive Fiction Platform",
|
|
5
|
-
"main": "dist-npm/index.js",
|
|
6
|
-
"types": "dist-npm/index.d.ts",
|
|
5
|
+
"main": "./dist-npm/index.js",
|
|
6
|
+
"types": "./dist-npm/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"clean": "rimraf dist",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"build:npm": "tsc --outDir dist-npm"
|
|
12
|
+
},
|
|
7
13
|
"dependencies": {
|
|
8
|
-
"@sharpee/core": "
|
|
9
|
-
"@sharpee/
|
|
10
|
-
"@sharpee/
|
|
14
|
+
"@sharpee/core": "workspace:*",
|
|
15
|
+
"@sharpee/if-domain": "workspace:*",
|
|
16
|
+
"@sharpee/world-model": "workspace:*"
|
|
11
17
|
},
|
|
12
18
|
"devDependencies": {
|
|
13
19
|
"@types/node": "^20.11.19",
|
|
@@ -32,14 +38,7 @@
|
|
|
32
38
|
"exports": {
|
|
33
39
|
".": {
|
|
34
40
|
"types": "./dist-npm/index.d.ts",
|
|
35
|
-
"import": "./dist-npm/index.js",
|
|
36
41
|
"require": "./dist-npm/index.js"
|
|
37
42
|
}
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "tsc",
|
|
41
|
-
"clean": "rimraf dist",
|
|
42
|
-
"test": "jest",
|
|
43
|
-
"build:npm": "tsc --outDir dist-npm"
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 David Cornelson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|