@sharpee/if-services 0.9.66-beta → 0.9.69-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/index.d.ts +8 -0
- package/index.d.ts.map +1 -0
- package/index.js +25 -0
- package/index.js.map +1 -0
- package/package.json +1 -10
- package/perception-service.d.ts +68 -0
- package/perception-service.d.ts.map +1 -0
- package/perception-service.js +13 -0
- package/perception-service.js.map +1 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sharpee/if-services - Runtime service interfaces for Sharpee Interactive Fiction Platform
|
|
3
|
+
*
|
|
4
|
+
* This package contains interfaces for runtime services that need access to
|
|
5
|
+
* the world model, separating them from the pure domain package.
|
|
6
|
+
*/
|
|
7
|
+
export * from './perception-service';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../mnt/c/repotemp/sharpee/packages/if-services/src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,sBAAsB,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @sharpee/if-services - Runtime service interfaces for Sharpee Interactive Fiction Platform
|
|
4
|
+
*
|
|
5
|
+
* This package contains interfaces for runtime services that need access to
|
|
6
|
+
* the world model, separating them from the pure domain package.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
// Perception service interfaces
|
|
24
|
+
__exportStar(require("./perception-service"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../mnt/c/repotemp/sharpee/packages/if-services/src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gCAAgC;AAChC,uDAAqC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/if-services",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.69-beta",
|
|
4
4
|
"description": "Runtime service interfaces for Sharpee Interactive Fiction Platform",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"clean": "rimraf dist",
|
|
10
|
-
"test": "jest",
|
|
11
|
-
"build:npm": "tsc --outDir dist-npm"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"dist-npm"
|
|
15
|
-
],
|
|
16
7
|
"keywords": [
|
|
17
8
|
"sharpee",
|
|
18
9
|
"interactive-fiction",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perception service interface for Interactive Fiction
|
|
3
|
+
*
|
|
4
|
+
* Perception services filter events based on what the player can perceive.
|
|
5
|
+
* They sit between action execution and the text service, transforming
|
|
6
|
+
* events that describe things the player cannot perceive (due to darkness,
|
|
7
|
+
* blindness, etc.) into appropriate alternative events.
|
|
8
|
+
*
|
|
9
|
+
* @see ADR-069 Perception-Based Event Filtering
|
|
10
|
+
*/
|
|
11
|
+
import type { ISemanticEvent } from "./src/index";
|
|
12
|
+
import type { IFEntity, IWorldModel } from "./src/index";
|
|
13
|
+
/**
|
|
14
|
+
* Sense types for perception checks
|
|
15
|
+
*/
|
|
16
|
+
export type Sense = 'sight' | 'hearing' | 'smell' | 'touch';
|
|
17
|
+
/**
|
|
18
|
+
* Reasons why perception might be blocked
|
|
19
|
+
*/
|
|
20
|
+
export type PerceptionBlockReason = 'darkness' | 'blindness' | 'blindfolded' | 'unknown';
|
|
21
|
+
/**
|
|
22
|
+
* Data for a perception-blocked event
|
|
23
|
+
*/
|
|
24
|
+
export interface PerceptionBlockedData {
|
|
25
|
+
/** The original event type that was blocked */
|
|
26
|
+
originalType: string;
|
|
27
|
+
/** Why perception was blocked */
|
|
28
|
+
reason: PerceptionBlockReason;
|
|
29
|
+
/** Which sense was blocked */
|
|
30
|
+
sense: Sense;
|
|
31
|
+
/** Original event data (for debugging/logging) */
|
|
32
|
+
originalData?: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Service interface for filtering events based on player perception.
|
|
36
|
+
*
|
|
37
|
+
* The perception service determines what the player can perceive based on:
|
|
38
|
+
* - Environmental factors (darkness, noise, etc.)
|
|
39
|
+
* - Actor state (blindness, deafness, etc.)
|
|
40
|
+
* - Equipment (blindfold, earplugs, etc.)
|
|
41
|
+
*
|
|
42
|
+
* Events that describe things the player cannot perceive are transformed
|
|
43
|
+
* or removed before being sent to the text service.
|
|
44
|
+
*
|
|
45
|
+
* @see ADR-069 Perception-Based Event Filtering
|
|
46
|
+
*/
|
|
47
|
+
export interface IPerceptionService {
|
|
48
|
+
/**
|
|
49
|
+
* Filter events based on what the actor can perceive.
|
|
50
|
+
*
|
|
51
|
+
* @param events - Raw events from action execution
|
|
52
|
+
* @param actor - The perceiving actor (usually the player)
|
|
53
|
+
* @param world - The world model for checking environment state
|
|
54
|
+
* @returns Filtered/transformed events based on perception
|
|
55
|
+
*/
|
|
56
|
+
filterEvents(events: ISemanticEvent[], actor: IFEntity, world: IWorldModel): ISemanticEvent[];
|
|
57
|
+
/**
|
|
58
|
+
* Check if an actor can perceive using a specific sense.
|
|
59
|
+
*
|
|
60
|
+
* @param actor - The perceiving actor
|
|
61
|
+
* @param location - The location being perceived
|
|
62
|
+
* @param world - The world model
|
|
63
|
+
* @param sense - Which sense to check (defaults to 'sight')
|
|
64
|
+
* @returns true if the actor can perceive, false otherwise
|
|
65
|
+
*/
|
|
66
|
+
canPerceive(actor: IFEntity, location: IFEntity, world: IWorldModel, sense: Sense): boolean;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=perception-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perception-service.d.ts","sourceRoot":"","sources":["../../../../../mnt/c/repotemp/sharpee/packages/if-services/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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Perception service interface for Interactive Fiction
|
|
4
|
+
*
|
|
5
|
+
* Perception services filter events based on what the player can perceive.
|
|
6
|
+
* They sit between action execution and the text service, transforming
|
|
7
|
+
* events that describe things the player cannot perceive (due to darkness,
|
|
8
|
+
* blindness, etc.) into appropriate alternative events.
|
|
9
|
+
*
|
|
10
|
+
* @see ADR-069 Perception-Based Event Filtering
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
//# sourceMappingURL=perception-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perception-service.js","sourceRoot":"","sources":["../../../../../../../../mnt/c/repotemp/sharpee/packages/if-services/src/perception-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
|