@sharpee/character 0.9.106 → 0.9.107
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/apply.d.ts +29 -7
- package/apply.d.ts.map +1 -1
- package/apply.js +15 -7
- package/apply.js.map +1 -1
- package/character-builder.d.ts +67 -4
- package/character-builder.d.ts.map +1 -1
- package/character-builder.js +116 -7
- package/character-builder.js.map +1 -1
- package/conversation/acl.d.ts +62 -0
- package/conversation/acl.d.ts.map +1 -0
- package/conversation/acl.js +117 -0
- package/conversation/acl.js.map +1 -0
- package/conversation/builder.d.ts +247 -0
- package/conversation/builder.d.ts.map +1 -0
- package/conversation/builder.js +324 -0
- package/conversation/builder.js.map +1 -0
- package/conversation/constraint-evaluator.d.ts +147 -0
- package/conversation/constraint-evaluator.d.ts.map +1 -0
- package/conversation/constraint-evaluator.js +247 -0
- package/conversation/constraint-evaluator.js.map +1 -0
- package/conversation/conversation-messages.d.ts +56 -0
- package/conversation/conversation-messages.d.ts.map +1 -0
- package/conversation/conversation-messages.js +69 -0
- package/conversation/conversation-messages.js.map +1 -0
- package/conversation/dialogue-extension.d.ts +87 -0
- package/conversation/dialogue-extension.d.ts.map +1 -0
- package/conversation/dialogue-extension.js +302 -0
- package/conversation/dialogue-extension.js.map +1 -0
- package/conversation/dialogue-types.d.ts +71 -0
- package/conversation/dialogue-types.d.ts.map +1 -0
- package/conversation/dialogue-types.js +13 -0
- package/conversation/dialogue-types.js.map +1 -0
- package/conversation/index.d.ts +19 -0
- package/conversation/index.d.ts.map +1 -0
- package/conversation/index.js +37 -0
- package/conversation/index.js.map +1 -0
- package/conversation/lifecycle.d.ts +212 -0
- package/conversation/lifecycle.d.ts.map +1 -0
- package/conversation/lifecycle.js +348 -0
- package/conversation/lifecycle.js.map +1 -0
- package/conversation/response-types.d.ts +98 -0
- package/conversation/response-types.d.ts.map +1 -0
- package/conversation/response-types.js +30 -0
- package/conversation/response-types.js.map +1 -0
- package/conversation/topic-registry.d.ts +130 -0
- package/conversation/topic-registry.d.ts.map +1 -0
- package/conversation/topic-registry.js +187 -0
- package/conversation/topic-registry.js.map +1 -0
- package/goals/builder.d.ts +135 -0
- package/goals/builder.d.ts.map +1 -0
- package/goals/builder.js +193 -0
- package/goals/builder.js.map +1 -0
- package/goals/goal-activation.d.ts +99 -0
- package/goals/goal-activation.d.ts.map +1 -0
- package/goals/goal-activation.js +212 -0
- package/goals/goal-activation.js.map +1 -0
- package/goals/goal-types.d.ts +138 -0
- package/goals/goal-types.d.ts.map +1 -0
- package/goals/goal-types.js +20 -0
- package/goals/goal-types.js.map +1 -0
- package/goals/index.d.ts +15 -0
- package/goals/index.d.ts.map +1 -0
- package/goals/index.js +24 -0
- package/goals/index.js.map +1 -0
- package/goals/pathfinding.d.ts +67 -0
- package/goals/pathfinding.d.ts.map +1 -0
- package/goals/pathfinding.js +134 -0
- package/goals/pathfinding.js.map +1 -0
- package/goals/step-evaluator.d.ts +52 -0
- package/goals/step-evaluator.d.ts.map +1 -0
- package/goals/step-evaluator.js +153 -0
- package/goals/step-evaluator.js.map +1 -0
- package/index.d.ts +6 -1
- package/index.d.ts.map +1 -1
- package/index.js +60 -1
- package/index.js.map +1 -1
- package/influence/builder.d.ts +136 -0
- package/influence/builder.d.ts.map +1 -0
- package/influence/builder.js +198 -0
- package/influence/builder.js.map +1 -0
- package/influence/index.d.ts +16 -0
- package/influence/index.d.ts.map +1 -0
- package/influence/index.js +25 -0
- package/influence/index.js.map +1 -0
- package/influence/influence-duration.d.ts +82 -0
- package/influence/influence-duration.d.ts.map +1 -0
- package/influence/influence-duration.js +148 -0
- package/influence/influence-duration.js.map +1 -0
- package/influence/influence-evaluator.d.ts +55 -0
- package/influence/influence-evaluator.d.ts.map +1 -0
- package/influence/influence-evaluator.js +183 -0
- package/influence/influence-evaluator.js.map +1 -0
- package/influence/influence-messages.d.ts +30 -0
- package/influence/influence-messages.d.ts.map +1 -0
- package/influence/influence-messages.js +40 -0
- package/influence/influence-messages.js.map +1 -0
- package/influence/influence-types.d.ts +123 -0
- package/influence/influence-types.d.ts.map +1 -0
- package/influence/influence-types.js +12 -0
- package/influence/influence-types.js.map +1 -0
- package/influence/pc-influence.d.ts +38 -0
- package/influence/pc-influence.d.ts.map +1 -0
- package/influence/pc-influence.js +56 -0
- package/influence/pc-influence.js.map +1 -0
- package/package.json +4 -3
- package/propagation/builder.d.ts +47 -0
- package/propagation/builder.d.ts.map +1 -0
- package/propagation/builder.js +46 -0
- package/propagation/builder.js.map +1 -0
- package/propagation/fact-transfer.d.ts +47 -0
- package/propagation/fact-transfer.d.ts.map +1 -0
- package/propagation/fact-transfer.js +76 -0
- package/propagation/fact-transfer.js.map +1 -0
- package/propagation/index.d.ts +16 -0
- package/propagation/index.d.ts.map +1 -0
- package/propagation/index.js +28 -0
- package/propagation/index.js.map +1 -0
- package/propagation/propagation-evaluator.d.ts +53 -0
- package/propagation/propagation-evaluator.d.ts.map +1 -0
- package/propagation/propagation-evaluator.js +231 -0
- package/propagation/propagation-evaluator.js.map +1 -0
- package/propagation/propagation-messages.d.ts +30 -0
- package/propagation/propagation-messages.d.ts.map +1 -0
- package/propagation/propagation-messages.js +37 -0
- package/propagation/propagation-messages.js.map +1 -0
- package/propagation/propagation-types.d.ts +100 -0
- package/propagation/propagation-types.d.ts.map +1 -0
- package/propagation/propagation-types.js +68 -0
- package/propagation/propagation-types.js.map +1 -0
- package/propagation/visibility.d.ts +46 -0
- package/propagation/visibility.d.ts.map +1 -0
- package/propagation/visibility.js +79 -0
- package/propagation/visibility.js.map +1 -0
- package/tick-phases.d.ts +93 -0
- package/tick-phases.d.ts.map +1 -0
- package/tick-phases.js +433 -0
- package/tick-phases.js.map +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Influence evaluation engine (ADR-146 layer 3)
|
|
3
|
+
*
|
|
4
|
+
* Evaluates passive and active influences: checks range, schedule,
|
|
5
|
+
* and resistance, then produces InfluenceResult describing whether
|
|
6
|
+
* the effect was applied or resisted.
|
|
7
|
+
*
|
|
8
|
+
* Pure evaluation — does not mutate state directly. Callers apply
|
|
9
|
+
* the returned effects to CharacterModelTrait state.
|
|
10
|
+
*
|
|
11
|
+
* Public interface: evaluatePassiveInfluences, evaluateActiveInfluence,
|
|
12
|
+
* checkResistance.
|
|
13
|
+
* Owner context: @sharpee/character / influence
|
|
14
|
+
*/
|
|
15
|
+
import { InfluenceDef, ResistanceDef, InfluenceResult } from './influence-types';
|
|
16
|
+
/** An entity in a room with its influence and resistance data. */
|
|
17
|
+
export interface InfluenceRoomEntity {
|
|
18
|
+
/** Entity ID. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Influences this entity exerts (may be empty). */
|
|
21
|
+
influences: InfluenceDef[];
|
|
22
|
+
/** Resistances this entity has (may be empty). */
|
|
23
|
+
resistances: ResistanceDef[];
|
|
24
|
+
/** Evaluate a predicate against this entity's state. Returns true if satisfied. */
|
|
25
|
+
evaluatePredicate: (predicate: string) => boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check whether a target resists an influence.
|
|
29
|
+
*
|
|
30
|
+
* @param target - The target entity with its resistances
|
|
31
|
+
* @param influenceName - The influence to check
|
|
32
|
+
* @returns true if the target resists (no effect should be applied)
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkResistance(target: InfluenceRoomEntity, influenceName: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Evaluate all passive influences for entities in a room.
|
|
37
|
+
*
|
|
38
|
+
* For each entity with passive influences, checks range, schedule,
|
|
39
|
+
* and each potential target's resistance. Returns results describing
|
|
40
|
+
* which effects were applied and which were resisted.
|
|
41
|
+
*
|
|
42
|
+
* @param entities - All entities in the room
|
|
43
|
+
* @returns Array of influence results
|
|
44
|
+
*/
|
|
45
|
+
export declare function evaluatePassiveInfluences(entities: InfluenceRoomEntity[]): InfluenceResult[];
|
|
46
|
+
/**
|
|
47
|
+
* Evaluate a single active influence against a specific target.
|
|
48
|
+
*
|
|
49
|
+
* @param influencer - The entity exerting the influence
|
|
50
|
+
* @param influenceName - The name of the influence to exert
|
|
51
|
+
* @param target - The target entity
|
|
52
|
+
* @returns The influence result
|
|
53
|
+
*/
|
|
54
|
+
export declare function evaluateActiveInfluence(influencer: InfluenceRoomEntity, influenceName: string, target: InfluenceRoomEntity): InfluenceResult;
|
|
55
|
+
//# sourceMappingURL=influence-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-evaluator.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/influence/influence-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAM3B,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IAEX,oDAAoD;IACpD,UAAU,EAAE,YAAY,EAAE,CAAC;IAE3B,kDAAkD;IAClD,WAAW,EAAE,aAAa,EAAE,CAAC;IAE7B,mFAAmF;IACnF,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,mBAAmB,EAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAcT;AA2BD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,mBAAmB,EAAE,GAC9B,eAAe,EAAE,CA0BnB;AA8CD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAC/B,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,mBAAmB,GAC1B,eAAe,CAwBjB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Influence evaluation engine (ADR-146 layer 3)
|
|
4
|
+
*
|
|
5
|
+
* Evaluates passive and active influences: checks range, schedule,
|
|
6
|
+
* and resistance, then produces InfluenceResult describing whether
|
|
7
|
+
* the effect was applied or resisted.
|
|
8
|
+
*
|
|
9
|
+
* Pure evaluation — does not mutate state directly. Callers apply
|
|
10
|
+
* the returned effects to CharacterModelTrait state.
|
|
11
|
+
*
|
|
12
|
+
* Public interface: evaluatePassiveInfluences, evaluateActiveInfluence,
|
|
13
|
+
* checkResistance.
|
|
14
|
+
* Owner context: @sharpee/character / influence
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.checkResistance = checkResistance;
|
|
18
|
+
exports.evaluatePassiveInfluences = evaluatePassiveInfluences;
|
|
19
|
+
exports.evaluateActiveInfluence = evaluateActiveInfluence;
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Resistance check
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a target resists an influence.
|
|
25
|
+
*
|
|
26
|
+
* @param target - The target entity with its resistances
|
|
27
|
+
* @param influenceName - The influence to check
|
|
28
|
+
* @returns true if the target resists (no effect should be applied)
|
|
29
|
+
*/
|
|
30
|
+
function checkResistance(target, influenceName) {
|
|
31
|
+
const resistance = target.resistances.find(r => r.influenceName === influenceName);
|
|
32
|
+
if (!resistance)
|
|
33
|
+
return false; // No resistance — influence succeeds
|
|
34
|
+
// Has resistance — check except conditions
|
|
35
|
+
if (resistance.except && resistance.except.length > 0) {
|
|
36
|
+
// If any except condition is met, resistance fails (target is vulnerable)
|
|
37
|
+
const anyExceptMet = resistance.except.some(cond => target.evaluatePredicate(cond));
|
|
38
|
+
return !anyExceptMet; // Resists unless an except condition is true
|
|
39
|
+
}
|
|
40
|
+
return true; // Resists unconditionally
|
|
41
|
+
}
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Schedule check
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
/**
|
|
46
|
+
* Check whether an influence's schedule conditions are met.
|
|
47
|
+
*
|
|
48
|
+
* @param influence - The influence definition
|
|
49
|
+
* @param influencer - The influencing entity (for predicate evaluation)
|
|
50
|
+
* @returns true if the influence should be exerted this turn
|
|
51
|
+
*/
|
|
52
|
+
function checkSchedule(influence, influencer) {
|
|
53
|
+
if (!influence.schedule)
|
|
54
|
+
return true;
|
|
55
|
+
return influence.schedule.when.every(cond => influencer.evaluatePredicate(cond));
|
|
56
|
+
}
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Passive influence evaluation
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Evaluate all passive influences for entities in a room.
|
|
62
|
+
*
|
|
63
|
+
* For each entity with passive influences, checks range, schedule,
|
|
64
|
+
* and each potential target's resistance. Returns results describing
|
|
65
|
+
* which effects were applied and which were resisted.
|
|
66
|
+
*
|
|
67
|
+
* @param entities - All entities in the room
|
|
68
|
+
* @returns Array of influence results
|
|
69
|
+
*/
|
|
70
|
+
function evaluatePassiveInfluences(entities) {
|
|
71
|
+
const results = [];
|
|
72
|
+
for (const influencer of entities) {
|
|
73
|
+
for (const influence of influencer.influences) {
|
|
74
|
+
if (influence.mode !== 'passive')
|
|
75
|
+
continue;
|
|
76
|
+
// Check schedule
|
|
77
|
+
if (!checkSchedule(influence, influencer)) {
|
|
78
|
+
results.push({
|
|
79
|
+
status: 'skipped',
|
|
80
|
+
reason: `schedule not met for ${influence.name}`,
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
// Determine targets based on range
|
|
85
|
+
const targets = getTargets(influence, influencer, entities);
|
|
86
|
+
for (const target of targets) {
|
|
87
|
+
results.push(evaluateInfluenceOnTarget(influence, influencer, target));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return results;
|
|
92
|
+
}
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Single-target evaluation helper
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
/**
|
|
97
|
+
* Evaluate a single influence against a single target entity.
|
|
98
|
+
*
|
|
99
|
+
* Checks resistance and returns either an 'applied' or 'resisted' result.
|
|
100
|
+
* Used by both passive and active influence evaluation paths.
|
|
101
|
+
*
|
|
102
|
+
* @param influence - The influence being exerted
|
|
103
|
+
* @param influencer - The entity exerting the influence
|
|
104
|
+
* @param target - The target entity
|
|
105
|
+
* @returns An InfluenceResult describing the outcome
|
|
106
|
+
*/
|
|
107
|
+
function evaluateInfluenceOnTarget(influence, influencer, target) {
|
|
108
|
+
if (checkResistance(target, influence.name)) {
|
|
109
|
+
return {
|
|
110
|
+
status: 'resisted',
|
|
111
|
+
influenceName: influence.name,
|
|
112
|
+
influencerId: influencer.id,
|
|
113
|
+
targetId: target.id,
|
|
114
|
+
resisted: influence.resisted,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
status: 'applied',
|
|
119
|
+
influenceName: influence.name,
|
|
120
|
+
influencerId: influencer.id,
|
|
121
|
+
targetId: target.id,
|
|
122
|
+
effect: { ...influence.effect },
|
|
123
|
+
witnessed: influence.witnessed,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Active influence evaluation
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* Evaluate a single active influence against a specific target.
|
|
131
|
+
*
|
|
132
|
+
* @param influencer - The entity exerting the influence
|
|
133
|
+
* @param influenceName - The name of the influence to exert
|
|
134
|
+
* @param target - The target entity
|
|
135
|
+
* @returns The influence result
|
|
136
|
+
*/
|
|
137
|
+
function evaluateActiveInfluence(influencer, influenceName, target) {
|
|
138
|
+
const influence = influencer.influences.find(i => i.name === influenceName);
|
|
139
|
+
if (!influence) {
|
|
140
|
+
return { status: 'skipped', reason: `${influencer.id} has no influence '${influenceName}'` };
|
|
141
|
+
}
|
|
142
|
+
if (checkResistance(target, influence.name)) {
|
|
143
|
+
return {
|
|
144
|
+
status: 'resisted',
|
|
145
|
+
influenceName: influence.name,
|
|
146
|
+
influencerId: influencer.id,
|
|
147
|
+
targetId: target.id,
|
|
148
|
+
resisted: influence.resisted,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
status: 'applied',
|
|
153
|
+
influenceName: influence.name,
|
|
154
|
+
influencerId: influencer.id,
|
|
155
|
+
targetId: target.id,
|
|
156
|
+
effect: { ...influence.effect },
|
|
157
|
+
witnessed: influence.witnessed,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Target selection
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
/**
|
|
164
|
+
* Get eligible targets for an influence based on its range.
|
|
165
|
+
*
|
|
166
|
+
* @param influence - The influence definition
|
|
167
|
+
* @param influencer - The influencing entity
|
|
168
|
+
* @param entities - All entities in the room
|
|
169
|
+
* @returns Array of target entities (excludes the influencer)
|
|
170
|
+
*/
|
|
171
|
+
function getTargets(influence, influencer, entities) {
|
|
172
|
+
const others = entities.filter(e => e.id !== influencer.id);
|
|
173
|
+
switch (influence.range) {
|
|
174
|
+
case 'room':
|
|
175
|
+
case 'proximity':
|
|
176
|
+
case 'targeted':
|
|
177
|
+
// All range types resolve to room-wide for passive evaluation.
|
|
178
|
+
// 'proximity' is equivalent to 'room' when entities share a room.
|
|
179
|
+
// 'targeted' is only meaningful for active influences; passive treats it as room-wide.
|
|
180
|
+
return others;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=influence-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-evaluator.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/influence/influence-evaluator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AA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AC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE,CAAC,CAAC;IAE5D,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;QACxB,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QACjB,KAAK,UAAU;YACb,+DAA+D;YAC/D,kEAAkE;YAClE,uFAAuF;YACvF,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Influence message IDs (ADR-146)
|
|
3
|
+
*
|
|
4
|
+
* Semantic message IDs for influence system events.
|
|
5
|
+
* Actual text is provided by the language layer (lang-en-us).
|
|
6
|
+
*
|
|
7
|
+
* Public interface: InfluenceMessages.
|
|
8
|
+
* Owner context: @sharpee/character / influence
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Platform default message IDs for influence events.
|
|
12
|
+
* Authors override per-influence via InfluenceDef.witnessed / .resisted.
|
|
13
|
+
*/
|
|
14
|
+
export declare const InfluenceMessages: {
|
|
15
|
+
/** Default witnessed message when target is affected. */
|
|
16
|
+
readonly WITNESSED_DEFAULT: "character.influence.witnessed.default";
|
|
17
|
+
/** Default resisted message when target resists. */
|
|
18
|
+
readonly RESISTED_DEFAULT: "character.influence.resisted.default";
|
|
19
|
+
/** Player's focus is clouded (conversation context cleared). */
|
|
20
|
+
readonly PC_FOCUS_CLOUDED: "character.influence.pc.focus_clouded";
|
|
21
|
+
/** Player's action is intercepted by influence. */
|
|
22
|
+
readonly PC_ACTION_INTERCEPTED: "character.influence.pc.action_intercepted";
|
|
23
|
+
/** Influence effect wears off (momentary or lingering expired). */
|
|
24
|
+
readonly EFFECT_EXPIRED: "character.influence.effect.expired";
|
|
25
|
+
/** Influence effect cleared because influencer departed. */
|
|
26
|
+
readonly EFFECT_DEPARTED: "character.influence.effect.departed";
|
|
27
|
+
};
|
|
28
|
+
/** Type for influence message IDs. */
|
|
29
|
+
export type InfluenceMessageId = (typeof InfluenceMessages)[keyof typeof InfluenceMessages];
|
|
30
|
+
//# sourceMappingURL=influence-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-messages.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/influence/influence-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAK5B,yDAAyD;;IAEzD,oDAAoD;;IAOpD,gEAAgE;;IAEhE,mDAAmD;;IAOnD,mEAAmE;;IAEnE,4DAA4D;;CAEpD,CAAC;AAEX,sCAAsC;AACtC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Influence message IDs (ADR-146)
|
|
4
|
+
*
|
|
5
|
+
* Semantic message IDs for influence system events.
|
|
6
|
+
* Actual text is provided by the language layer (lang-en-us).
|
|
7
|
+
*
|
|
8
|
+
* Public interface: InfluenceMessages.
|
|
9
|
+
* Owner context: @sharpee/character / influence
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InfluenceMessages = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Platform default message IDs for influence events.
|
|
15
|
+
* Authors override per-influence via InfluenceDef.witnessed / .resisted.
|
|
16
|
+
*/
|
|
17
|
+
exports.InfluenceMessages = {
|
|
18
|
+
// -------------------------------------------------------------------------
|
|
19
|
+
// Witnessed — player sees influence being exerted
|
|
20
|
+
// -------------------------------------------------------------------------
|
|
21
|
+
/** Default witnessed message when target is affected. */
|
|
22
|
+
WITNESSED_DEFAULT: 'character.influence.witnessed.default',
|
|
23
|
+
/** Default resisted message when target resists. */
|
|
24
|
+
RESISTED_DEFAULT: 'character.influence.resisted.default',
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// PC influence — player is the target
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
/** Player's focus is clouded (conversation context cleared). */
|
|
29
|
+
PC_FOCUS_CLOUDED: 'character.influence.pc.focus_clouded',
|
|
30
|
+
/** Player's action is intercepted by influence. */
|
|
31
|
+
PC_ACTION_INTERCEPTED: 'character.influence.pc.action_intercepted',
|
|
32
|
+
// -------------------------------------------------------------------------
|
|
33
|
+
// Duration events
|
|
34
|
+
// -------------------------------------------------------------------------
|
|
35
|
+
/** Influence effect wears off (momentary or lingering expired). */
|
|
36
|
+
EFFECT_EXPIRED: 'character.influence.effect.expired',
|
|
37
|
+
/** Influence effect cleared because influencer departed. */
|
|
38
|
+
EFFECT_DEPARTED: 'character.influence.effect.departed',
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=influence-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-messages.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/influence/influence-messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B,4EAA4E;IAC5E,kDAAkD;IAClD,4EAA4E;IAE5E,yDAAyD;IACzD,iBAAiB,EAAE,uCAAuC;IAC1D,oDAAoD;IACpD,gBAAgB,EAAE,sCAAsC;IAExD,4EAA4E;IAC5E,sCAAsC;IACtC,4EAA4E;IAE5E,gEAAgE;IAChE,gBAAgB,EAAE,sCAAsC;IACxD,mDAAmD;IACnD,qBAAqB,EAAE,2CAA2C;IAElE,4EAA4E;IAC5E,kBAAkB;IAClB,4EAA4E;IAE5E,mEAAmE;IACnE,cAAc,EAAE,oCAAoC;IACpD,4DAA4D;IAC5D,eAAe,EAAE,qCAAqC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPC influence types (ADR-146)
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the influence system: influence definitions,
|
|
5
|
+
* resistance definitions, effect tracking, and evaluation results.
|
|
6
|
+
*
|
|
7
|
+
* Public interface: All exported types.
|
|
8
|
+
* Owner context: @sharpee/character / influence
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* How the influence is exerted.
|
|
12
|
+
* - passive: automatically when conditions are met (proximity, same room)
|
|
13
|
+
* - active: deliberately as part of NPC behavior or goal pursuit
|
|
14
|
+
*/
|
|
15
|
+
export type InfluenceMode = 'passive' | 'active';
|
|
16
|
+
/**
|
|
17
|
+
* Who the influence affects.
|
|
18
|
+
* - proximity: target must be in the same room
|
|
19
|
+
* - targeted: influencer selects a specific target (used with active mode)
|
|
20
|
+
* - room: affects all entities in the room (aura)
|
|
21
|
+
*/
|
|
22
|
+
export type InfluenceRange = 'proximity' | 'targeted' | 'room';
|
|
23
|
+
/**
|
|
24
|
+
* How long the effect lasts.
|
|
25
|
+
* - 'while present': clears when influencer leaves the room (default for passive)
|
|
26
|
+
* - 'momentary': lasts one turn (default for active)
|
|
27
|
+
* - 'lingering': persists for author-defined turns or until a condition clears it
|
|
28
|
+
*/
|
|
29
|
+
export type InfluenceDuration = 'while present' | 'momentary' | 'lingering';
|
|
30
|
+
/**
|
|
31
|
+
* Character state mutations caused by influence.
|
|
32
|
+
* Keys map to ADR-141 vocabulary: mood, threat, focus, propagation, disposition.
|
|
33
|
+
*/
|
|
34
|
+
export interface InfluenceEffect {
|
|
35
|
+
/** ADR-141 mood state. */
|
|
36
|
+
mood?: string;
|
|
37
|
+
/** ADR-141 threat level. */
|
|
38
|
+
threat?: string;
|
|
39
|
+
/** PC or NPC ability to pursue current activity. */
|
|
40
|
+
focus?: string;
|
|
41
|
+
/** ADR-144 propagation tendency override. */
|
|
42
|
+
propagation?: string;
|
|
43
|
+
/** ADR-141 disposition toward a specific entity. */
|
|
44
|
+
disposition?: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
/** Conditions for when a passive influence is exerted. */
|
|
47
|
+
export interface InfluenceSchedule {
|
|
48
|
+
/** Predicate conditions that must be satisfied. */
|
|
49
|
+
when: string[];
|
|
50
|
+
}
|
|
51
|
+
/** Author-defined influence on the exerting NPC. */
|
|
52
|
+
export interface InfluenceDef {
|
|
53
|
+
/** Author-invented influence name (e.g., 'seduction', 'intimidation'). */
|
|
54
|
+
name: string;
|
|
55
|
+
/** How the influence is exerted. */
|
|
56
|
+
mode: InfluenceMode;
|
|
57
|
+
/** Who the influence affects. */
|
|
58
|
+
range: InfluenceRange;
|
|
59
|
+
/** State mutations applied to affected targets. */
|
|
60
|
+
effect: InfluenceEffect;
|
|
61
|
+
/** How long the effect lasts. */
|
|
62
|
+
duration: InfluenceDuration;
|
|
63
|
+
/** Message ID when the target is affected (player witnesses). */
|
|
64
|
+
witnessed?: string;
|
|
65
|
+
/** Message ID when the target resists. */
|
|
66
|
+
resisted?: string;
|
|
67
|
+
/** Optional scheduling conditions (for passive mode). */
|
|
68
|
+
schedule?: InfluenceSchedule;
|
|
69
|
+
/** Message ID when PC tries to act while under this influence. */
|
|
70
|
+
onPlayerAction?: string;
|
|
71
|
+
/** Number of turns for lingering duration. */
|
|
72
|
+
lingeringTurns?: number;
|
|
73
|
+
/** Predicate condition to clear lingering effect. */
|
|
74
|
+
lingeringClearCondition?: string;
|
|
75
|
+
}
|
|
76
|
+
/** Author-defined resistance on the target NPC. */
|
|
77
|
+
export interface ResistanceDef {
|
|
78
|
+
/** The influence name this entity resists. */
|
|
79
|
+
influenceName: string;
|
|
80
|
+
/**
|
|
81
|
+
* Conditions under which resistance fails (target becomes vulnerable).
|
|
82
|
+
* Uses the same predicate system as ADR-141/142.
|
|
83
|
+
*/
|
|
84
|
+
except?: string[];
|
|
85
|
+
}
|
|
86
|
+
/** Runtime tracking of an applied influence effect. */
|
|
87
|
+
export interface ActiveInfluenceEffect {
|
|
88
|
+
/** The influence name. */
|
|
89
|
+
influenceName: string;
|
|
90
|
+
/** The influencer's entity ID. */
|
|
91
|
+
influencerId: string;
|
|
92
|
+
/** The target's entity ID. */
|
|
93
|
+
targetId: string;
|
|
94
|
+
/** The applied effect mutations. */
|
|
95
|
+
effect: InfluenceEffect;
|
|
96
|
+
/** Duration type. */
|
|
97
|
+
duration: InfluenceDuration;
|
|
98
|
+
/** Turn when the effect was applied. */
|
|
99
|
+
appliedAtTurn: number;
|
|
100
|
+
/** For lingering: turn when the effect expires. */
|
|
101
|
+
expiresAtTurn?: number;
|
|
102
|
+
/** For lingering: predicate condition that clears the effect. */
|
|
103
|
+
clearCondition?: string;
|
|
104
|
+
}
|
|
105
|
+
/** Result of evaluating one influence against one target. */
|
|
106
|
+
export type InfluenceResult = {
|
|
107
|
+
status: 'applied';
|
|
108
|
+
influenceName: string;
|
|
109
|
+
influencerId: string;
|
|
110
|
+
targetId: string;
|
|
111
|
+
effect: InfluenceEffect;
|
|
112
|
+
witnessed?: string;
|
|
113
|
+
} | {
|
|
114
|
+
status: 'resisted';
|
|
115
|
+
influenceName: string;
|
|
116
|
+
influencerId: string;
|
|
117
|
+
targetId: string;
|
|
118
|
+
resisted?: string;
|
|
119
|
+
} | {
|
|
120
|
+
status: 'skipped';
|
|
121
|
+
reason: string;
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=influence-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/influence/influence-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,CAAC;AAM5E;;;GAGG;AACH,MAAM,WAAW,eAA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AAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IAErB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IAEjB,oCAAoC;IACpC,MAAM,EAAE,eAAe,CAAC;IAExB,qBAAqB;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD,6DAA6D;AAC7D,MAAM,MAAM,eAAe,GACvB;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACD;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* NPC influence types (ADR-146)
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for the influence system: influence definitions,
|
|
6
|
+
* resistance definitions, effect tracking, and evaluation results.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: All exported types.
|
|
9
|
+
* Owner context: @sharpee/character / influence
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
//# sourceMappingURL=influence-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influence-types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/influence/influence-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PC influence handling (ADR-146 layer 4)
|
|
3
|
+
*
|
|
4
|
+
* Handles the effect of influences on the player character:
|
|
5
|
+
* checks for active influence effects on the PC and determines
|
|
6
|
+
* whether player actions should be intercepted.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: evaluatePcInfluence, PcInfluenceResult.
|
|
9
|
+
* Owner context: @sharpee/character / influence
|
|
10
|
+
*/
|
|
11
|
+
import { InfluenceTracker } from './influence-duration';
|
|
12
|
+
import { ActiveInfluenceEffect, InfluenceDef } from './influence-types';
|
|
13
|
+
/** Result of checking PC influence before a player action. */
|
|
14
|
+
export type PcInfluenceResult = {
|
|
15
|
+
status: 'clear';
|
|
16
|
+
} | {
|
|
17
|
+
status: 'intercepted';
|
|
18
|
+
influenceName: string;
|
|
19
|
+
influencerId: string;
|
|
20
|
+
effect: ActiveInfluenceEffect;
|
|
21
|
+
onPlayerAction?: string;
|
|
22
|
+
clearConversationContext: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Check if the player is under any influence that would intercept their action.
|
|
26
|
+
*
|
|
27
|
+
* Returns the highest-impact influence affecting the PC, if any.
|
|
28
|
+
* An influence intercepts the PC when:
|
|
29
|
+
* - The effect includes `focus: 'clouded'` — clears conversation context
|
|
30
|
+
* - The influence has an `onPlayerAction` message — fires narrative message
|
|
31
|
+
*
|
|
32
|
+
* @param playerId - The player entity ID
|
|
33
|
+
* @param tracker - The influence tracker with active effects
|
|
34
|
+
* @param influenceDefs - Map of influencer ID to their influence definitions
|
|
35
|
+
* @returns PC influence result
|
|
36
|
+
*/
|
|
37
|
+
export declare function evaluatePcInfluence(playerId: string, tracker: InfluenceTracker, influenceDefs: Map<string, InfluenceDef[]>): PcInfluenceResult;
|
|
38
|
+
//# sourceMappingURL=pc-influence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pc-influence.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/influence/pc-influence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMxE,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,EAAE,OAAO,CAAC;CACjB,GACD;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AAMN;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GACzC,iBAAiB,CA6BnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PC influence handling (ADR-146 layer 4)
|
|
4
|
+
*
|
|
5
|
+
* Handles the effect of influences on the player character:
|
|
6
|
+
* checks for active influence effects on the PC and determines
|
|
7
|
+
* whether player actions should be intercepted.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: evaluatePcInfluence, PcInfluenceResult.
|
|
10
|
+
* Owner context: @sharpee/character / influence
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.evaluatePcInfluence = evaluatePcInfluence;
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// PC influence evaluation
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/**
|
|
18
|
+
* Check if the player is under any influence that would intercept their action.
|
|
19
|
+
*
|
|
20
|
+
* Returns the highest-impact influence affecting the PC, if any.
|
|
21
|
+
* An influence intercepts the PC when:
|
|
22
|
+
* - The effect includes `focus: 'clouded'` — clears conversation context
|
|
23
|
+
* - The influence has an `onPlayerAction` message — fires narrative message
|
|
24
|
+
*
|
|
25
|
+
* @param playerId - The player entity ID
|
|
26
|
+
* @param tracker - The influence tracker with active effects
|
|
27
|
+
* @param influenceDefs - Map of influencer ID to their influence definitions
|
|
28
|
+
* @returns PC influence result
|
|
29
|
+
*/
|
|
30
|
+
function evaluatePcInfluence(playerId, tracker, influenceDefs) {
|
|
31
|
+
const pcEffects = tracker.getEffectsOn(playerId);
|
|
32
|
+
if (pcEffects.length === 0) {
|
|
33
|
+
return { status: 'clear' };
|
|
34
|
+
}
|
|
35
|
+
// Find the first effect that would intercept the PC
|
|
36
|
+
for (const effect of pcEffects) {
|
|
37
|
+
// Look up the original influence definition for onPlayerAction message
|
|
38
|
+
const defs = influenceDefs.get(effect.influencerId);
|
|
39
|
+
const def = defs?.find(d => d.name === effect.influenceName);
|
|
40
|
+
const hasFocusClouded = effect.effect.focus === 'clouded';
|
|
41
|
+
const hasOnPlayerAction = def?.onPlayerAction !== undefined;
|
|
42
|
+
if (hasFocusClouded || hasOnPlayerAction) {
|
|
43
|
+
return {
|
|
44
|
+
status: 'intercepted',
|
|
45
|
+
influenceName: effect.influenceName,
|
|
46
|
+
influencerId: effect.influencerId,
|
|
47
|
+
effect,
|
|
48
|
+
onPlayerAction: def?.onPlayerAction,
|
|
49
|
+
clearConversationContext: hasFocusClouded,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// PC is under influence but none intercept actions
|
|
54
|
+
return { status: 'clear' };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=pc-influence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pc-influence.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/influence/pc-influence.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwCH,kDAiCC;AAlDD,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CACjC,QAAgB,EAChB,OAAyB,EACzB,aAA0C;IAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,oDAAoD;IACpD,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAC/B,uEAAuE;QACvE,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,aAAa,CAAC,CAAC;QAE7D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,iBAAiB,GAAG,GAAG,EAAE,cAAc,KAAK,SAAS,CAAC;QAE5D,IAAI,eAAe,IAAI,iBAAiB,EAAE,CAAC;YACzC,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,MAAM;gBACN,cAAc,EAAE,GAAG,EAAE,cAAc;gBACnC,wBAAwB,EAAE,eAAe;aAC1C,CAAC;QACJ,CAAC;IACH,CAAC;IAED,mDAAmD;IACnD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/character",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.107",
|
|
4
4
|
"description": "Character model builder for Sharpee Interactive Fiction Platform (ADR-141)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/
|
|
16
|
-
"@sharpee/
|
|
15
|
+
"@sharpee/core": "^0.9.107",
|
|
16
|
+
"@sharpee/world-model": "^0.9.107",
|
|
17
|
+
"@sharpee/stdlib": "^0.9.107"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
19
20
|
"interactive-fiction",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Propagation builder API (ADR-144 layer 5)
|
|
3
|
+
*
|
|
4
|
+
* Extends CharacterBuilder with a fluent .propagation() method that
|
|
5
|
+
* accepts PropagationProfile options. The compiled profile is stored
|
|
6
|
+
* in CompiledCharacter for applyCharacter to consume.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: propagation() method added to CharacterBuilder.
|
|
9
|
+
* Owner context: @sharpee/character / propagation
|
|
10
|
+
*/
|
|
11
|
+
import { PropagationTendency, PropagationAudience, PropagationPace, PropagationColoring, ReceivesAs, FactOverride, PropagationSchedule, PropagationProfile } from './propagation-types';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the .propagation() builder method.
|
|
14
|
+
* All fields map directly to PropagationProfile.
|
|
15
|
+
*/
|
|
16
|
+
export interface PropagationOptions {
|
|
17
|
+
/** How freely the NPC shares information. */
|
|
18
|
+
tendency: PropagationTendency;
|
|
19
|
+
/** Who the NPC shares with (default: 'trusted'). */
|
|
20
|
+
audience?: PropagationAudience;
|
|
21
|
+
/** NPC IDs explicitly excluded from sharing. */
|
|
22
|
+
excludes?: string[];
|
|
23
|
+
/** Topics the chatty NPC withholds (blacklist for chatty tendency). */
|
|
24
|
+
withholds?: string[];
|
|
25
|
+
/** Topics the selective NPC will share (whitelist for selective tendency). */
|
|
26
|
+
spreads?: string[];
|
|
27
|
+
/** Per-fact overrides. */
|
|
28
|
+
overrides?: Record<string, FactOverride>;
|
|
29
|
+
/** How quickly facts are shared (default: 'eager'). */
|
|
30
|
+
pace?: PropagationPace;
|
|
31
|
+
/** Optional scheduling conditions. */
|
|
32
|
+
schedule?: PropagationSchedule;
|
|
33
|
+
/** Tone of the telling (default: 'neutral'). */
|
|
34
|
+
coloring?: PropagationColoring;
|
|
35
|
+
/** Whether the player can use this NPC as a messenger (default: false). */
|
|
36
|
+
playerCanLeverage?: boolean;
|
|
37
|
+
/** How the NPC treats received information (default: 'as fact'). */
|
|
38
|
+
receives?: ReceivesAs;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert builder options to a PropagationProfile.
|
|
42
|
+
*
|
|
43
|
+
* @param opts - Builder options
|
|
44
|
+
* @returns A PropagationProfile with all specified fields
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildPropagationProfile(opts: PropagationOptions): PropagationProfile;
|
|
47
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/propagation/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAE/B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAEzC,uDAAuD;IACvD,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAE/B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAE/B,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAiBpF"}
|