@ai-rpg-engine/modules 1.0.0
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/dist/belief-provenance.d.ts +41 -0
- package/dist/belief-provenance.d.ts.map +1 -0
- package/dist/belief-provenance.js +254 -0
- package/dist/belief-provenance.js.map +1 -0
- package/dist/belief-provenance.test.d.ts +2 -0
- package/dist/belief-provenance.test.d.ts.map +1 -0
- package/dist/belief-provenance.test.js +139 -0
- package/dist/belief-provenance.test.js.map +1 -0
- package/dist/cognition-core.d.ts +89 -0
- package/dist/cognition-core.d.ts.map +1 -0
- package/dist/cognition-core.js +370 -0
- package/dist/cognition-core.js.map +1 -0
- package/dist/cognition-core.test.d.ts +2 -0
- package/dist/cognition-core.test.d.ts.map +1 -0
- package/dist/cognition-core.test.js +215 -0
- package/dist/cognition-core.test.js.map +1 -0
- package/dist/combat-core.d.ts +11 -0
- package/dist/combat-core.d.ts.map +1 -0
- package/dist/combat-core.js +152 -0
- package/dist/combat-core.js.map +1 -0
- package/dist/dialogue-core.d.ts +10 -0
- package/dist/dialogue-core.d.ts.map +1 -0
- package/dist/dialogue-core.js +172 -0
- package/dist/dialogue-core.js.map +1 -0
- package/dist/district-core.d.ts +59 -0
- package/dist/district-core.d.ts.map +1 -0
- package/dist/district-core.js +224 -0
- package/dist/district-core.js.map +1 -0
- package/dist/district-core.test.d.ts +2 -0
- package/dist/district-core.test.d.ts.map +1 -0
- package/dist/district-core.test.js +157 -0
- package/dist/district-core.test.js.map +1 -0
- package/dist/environment-core.d.ts +78 -0
- package/dist/environment-core.d.ts.map +1 -0
- package/dist/environment-core.js +229 -0
- package/dist/environment-core.js.map +1 -0
- package/dist/environment-core.test.d.ts +2 -0
- package/dist/environment-core.test.d.ts.map +1 -0
- package/dist/environment-core.test.js +252 -0
- package/dist/environment-core.test.js.map +1 -0
- package/dist/faction-cognition.d.ts +39 -0
- package/dist/faction-cognition.d.ts.map +1 -0
- package/dist/faction-cognition.js +139 -0
- package/dist/faction-cognition.js.map +1 -0
- package/dist/faction-cognition.test.d.ts +2 -0
- package/dist/faction-cognition.test.d.ts.map +1 -0
- package/dist/faction-cognition.test.js +166 -0
- package/dist/faction-cognition.test.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory-core.d.ts +10 -0
- package/dist/inventory-core.d.ts.map +1 -0
- package/dist/inventory-core.js +69 -0
- package/dist/inventory-core.js.map +1 -0
- package/dist/knowledge-decay.test.d.ts +2 -0
- package/dist/knowledge-decay.test.d.ts.map +1 -0
- package/dist/knowledge-decay.test.js +143 -0
- package/dist/knowledge-decay.test.js.map +1 -0
- package/dist/narrative-authority.d.ts +40 -0
- package/dist/narrative-authority.d.ts.map +1 -0
- package/dist/narrative-authority.js +89 -0
- package/dist/narrative-authority.js.map +1 -0
- package/dist/narrative-authority.test.d.ts +2 -0
- package/dist/narrative-authority.test.d.ts.map +1 -0
- package/dist/narrative-authority.test.js +237 -0
- package/dist/narrative-authority.test.js.map +1 -0
- package/dist/observer-presentation.d.ts +74 -0
- package/dist/observer-presentation.d.ts.map +1 -0
- package/dist/observer-presentation.js +277 -0
- package/dist/observer-presentation.js.map +1 -0
- package/dist/observer-presentation.test.d.ts +2 -0
- package/dist/observer-presentation.test.d.ts.map +1 -0
- package/dist/observer-presentation.test.js +156 -0
- package/dist/observer-presentation.test.js.map +1 -0
- package/dist/perception-filter.d.ts +46 -0
- package/dist/perception-filter.d.ts.map +1 -0
- package/dist/perception-filter.js +281 -0
- package/dist/perception-filter.js.map +1 -0
- package/dist/perception-filter.test.d.ts +2 -0
- package/dist/perception-filter.test.d.ts.map +1 -0
- package/dist/perception-filter.test.js +308 -0
- package/dist/perception-filter.test.js.map +1 -0
- package/dist/progression-core.d.ts +63 -0
- package/dist/progression-core.d.ts.map +1 -0
- package/dist/progression-core.js +232 -0
- package/dist/progression-core.js.map +1 -0
- package/dist/progression-core.test.d.ts +2 -0
- package/dist/progression-core.test.d.ts.map +1 -0
- package/dist/progression-core.test.js +328 -0
- package/dist/progression-core.test.js.map +1 -0
- package/dist/rumor-propagation.d.ts +31 -0
- package/dist/rumor-propagation.d.ts.map +1 -0
- package/dist/rumor-propagation.js +180 -0
- package/dist/rumor-propagation.js.map +1 -0
- package/dist/rumor-propagation.test.d.ts +2 -0
- package/dist/rumor-propagation.test.d.ts.map +1 -0
- package/dist/rumor-propagation.test.js +176 -0
- package/dist/rumor-propagation.test.js.map +1 -0
- package/dist/simulation-inspector.d.ts +78 -0
- package/dist/simulation-inspector.d.ts.map +1 -0
- package/dist/simulation-inspector.js +263 -0
- package/dist/simulation-inspector.js.map +1 -0
- package/dist/simulation-inspector.test.d.ts +2 -0
- package/dist/simulation-inspector.test.d.ts.map +1 -0
- package/dist/simulation-inspector.test.js +152 -0
- package/dist/simulation-inspector.test.js.map +1 -0
- package/dist/status-core.d.ts +17 -0
- package/dist/status-core.d.ts.map +1 -0
- package/dist/status-core.js +106 -0
- package/dist/status-core.js.map +1 -0
- package/dist/traversal-core.d.ts +3 -0
- package/dist/traversal-core.d.ts.map +1 -0
- package/dist/traversal-core.js +93 -0
- package/dist/traversal-core.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { PresentationChannels, createTestEngine, } from '@ai-rpg-engine/core';
|
|
3
|
+
import { createNarrativeAuthority, recordPresentation, revealTruth, getHiddenTruths, getRevealedTruths, } from './narrative-authority.js';
|
|
4
|
+
import { traversalCore } from './traversal-core.js';
|
|
5
|
+
describe('PresentationChannels', () => {
|
|
6
|
+
it('passes events through without filters', () => {
|
|
7
|
+
const channels = new PresentationChannels();
|
|
8
|
+
const event = {
|
|
9
|
+
id: 'e1',
|
|
10
|
+
tick: 1,
|
|
11
|
+
type: 'test',
|
|
12
|
+
payload: { value: 42 },
|
|
13
|
+
presentation: { channels: ['objective'] },
|
|
14
|
+
};
|
|
15
|
+
const results = channels.present(event);
|
|
16
|
+
expect(results).toHaveLength(1);
|
|
17
|
+
expect(results[0]._channel).toBe('objective');
|
|
18
|
+
expect(results[0]._filtered).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
it('filters can suppress events', () => {
|
|
21
|
+
const channels = new PresentationChannels();
|
|
22
|
+
channels.addFilter('narrator', () => null);
|
|
23
|
+
const event = {
|
|
24
|
+
id: 'e1',
|
|
25
|
+
tick: 1,
|
|
26
|
+
type: 'secret.revealed',
|
|
27
|
+
payload: {},
|
|
28
|
+
presentation: { channels: ['narrator'] },
|
|
29
|
+
};
|
|
30
|
+
const results = channels.present(event);
|
|
31
|
+
expect(results).toHaveLength(0);
|
|
32
|
+
});
|
|
33
|
+
it('filters can modify events', () => {
|
|
34
|
+
const channels = new PresentationChannels();
|
|
35
|
+
channels.addFilter('narrator', (event) => ({
|
|
36
|
+
...event,
|
|
37
|
+
payload: { ...event.payload, damage: 999, _lie: true },
|
|
38
|
+
}));
|
|
39
|
+
const event = {
|
|
40
|
+
id: 'e1',
|
|
41
|
+
tick: 1,
|
|
42
|
+
type: 'combat.damage.applied',
|
|
43
|
+
payload: { damage: 5 },
|
|
44
|
+
presentation: { channels: ['narrator'] },
|
|
45
|
+
};
|
|
46
|
+
const results = channels.present(event);
|
|
47
|
+
expect(results).toHaveLength(1);
|
|
48
|
+
expect(results[0].payload.damage).toBe(999);
|
|
49
|
+
expect(results[0].payload._lie).toBe(true);
|
|
50
|
+
expect(results[0]._filtered).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('multi-channel event routes through each independently', () => {
|
|
53
|
+
const channels = new PresentationChannels();
|
|
54
|
+
channels.addFilter('narrator', (event) => ({
|
|
55
|
+
...event,
|
|
56
|
+
payload: { ...event.payload, narratorSays: 'nothing happened' },
|
|
57
|
+
}));
|
|
58
|
+
const event = {
|
|
59
|
+
id: 'e1',
|
|
60
|
+
tick: 1,
|
|
61
|
+
type: 'combat.contact.hit',
|
|
62
|
+
payload: { damage: 10 },
|
|
63
|
+
presentation: { channels: ['objective', 'narrator'] },
|
|
64
|
+
};
|
|
65
|
+
const results = channels.present(event);
|
|
66
|
+
expect(results).toHaveLength(2);
|
|
67
|
+
const objective = results.find((r) => r._channel === 'objective');
|
|
68
|
+
const narrator = results.find((r) => r._channel === 'narrator');
|
|
69
|
+
expect(objective.payload.damage).toBe(10); // truth
|
|
70
|
+
expect(narrator.payload.narratorSays).toBe('nothing happened'); // lie
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe('narrative-authority module', () => {
|
|
74
|
+
it('conceals specified event types', () => {
|
|
75
|
+
const channels = new PresentationChannels();
|
|
76
|
+
const mod = createNarrativeAuthority(channels, {
|
|
77
|
+
voice: 'unreliable',
|
|
78
|
+
distortion: 0.5,
|
|
79
|
+
conceals: ['secret.revealed'],
|
|
80
|
+
});
|
|
81
|
+
const engine = createTestEngine({
|
|
82
|
+
modules: [traversalCore, mod],
|
|
83
|
+
entities: [
|
|
84
|
+
{ id: 'player', blueprintId: 'player', type: 'player', name: 'Hero', tags: [], stats: {}, resources: {}, statuses: [], zoneId: 'a' },
|
|
85
|
+
],
|
|
86
|
+
zones: [
|
|
87
|
+
{ id: 'a', roomId: 'test', name: 'A', tags: [], neighbors: ['b'] },
|
|
88
|
+
{ id: 'b', roomId: 'test', name: 'B', tags: [], neighbors: ['a'] },
|
|
89
|
+
],
|
|
90
|
+
});
|
|
91
|
+
const secretEvent = {
|
|
92
|
+
id: 'secret-1',
|
|
93
|
+
tick: 1,
|
|
94
|
+
type: 'secret.revealed',
|
|
95
|
+
payload: { truth: 'the NPC is the villain' },
|
|
96
|
+
presentation: { channels: ['narrator'] },
|
|
97
|
+
};
|
|
98
|
+
const presented = channels.present(secretEvent);
|
|
99
|
+
expect(presented).toHaveLength(0); // narrator concealed it
|
|
100
|
+
});
|
|
101
|
+
it('distorts specified event types', () => {
|
|
102
|
+
const channels = new PresentationChannels();
|
|
103
|
+
const mod = createNarrativeAuthority(channels, {
|
|
104
|
+
voice: 'trickster',
|
|
105
|
+
distortion: 0.8,
|
|
106
|
+
distorts: ['combat.damage.applied'],
|
|
107
|
+
});
|
|
108
|
+
createTestEngine({
|
|
109
|
+
modules: [mod],
|
|
110
|
+
entities: [
|
|
111
|
+
{ id: 'player', blueprintId: 'player', type: 'player', name: 'Hero', tags: [], stats: {}, resources: {}, statuses: [] },
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
const combatEvent = {
|
|
115
|
+
id: 'dmg-1',
|
|
116
|
+
tick: 1,
|
|
117
|
+
type: 'combat.damage.applied',
|
|
118
|
+
payload: { damage: 10 },
|
|
119
|
+
presentation: { channels: ['narrator'] },
|
|
120
|
+
};
|
|
121
|
+
const presented = channels.present(combatEvent);
|
|
122
|
+
expect(presented).toHaveLength(1);
|
|
123
|
+
expect(presented[0].payload._narratorDistorted).toBe(true);
|
|
124
|
+
expect(presented[0].tags).toContain('narrator-distorted');
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe('contradiction tracking + truth reveal', () => {
|
|
128
|
+
it('records contradictions when narrator distorts', () => {
|
|
129
|
+
const channels = new PresentationChannels();
|
|
130
|
+
// Narrator lies about damage
|
|
131
|
+
channels.addFilter('narrator', (event) => {
|
|
132
|
+
if (event.type !== 'combat.damage.applied')
|
|
133
|
+
return event;
|
|
134
|
+
return {
|
|
135
|
+
...event,
|
|
136
|
+
payload: { ...event.payload, damage: 0, narratorSays: 'The blow glances harmlessly off!' },
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
const state = {
|
|
140
|
+
objectiveLog: [],
|
|
141
|
+
presentedLog: [],
|
|
142
|
+
contradictions: [],
|
|
143
|
+
revealedTruths: [],
|
|
144
|
+
};
|
|
145
|
+
const truthEvent = {
|
|
146
|
+
id: 'dmg-real',
|
|
147
|
+
tick: 5,
|
|
148
|
+
type: 'combat.damage.applied',
|
|
149
|
+
payload: { damage: 15, targetId: 'merchant' },
|
|
150
|
+
presentation: { channels: ['objective', 'narrator'] },
|
|
151
|
+
};
|
|
152
|
+
const presented = channels.present(truthEvent);
|
|
153
|
+
recordPresentation(state, truthEvent, presented);
|
|
154
|
+
// Objective truth is in the log
|
|
155
|
+
expect(state.presentedLog.length).toBe(2);
|
|
156
|
+
// There should be a contradiction
|
|
157
|
+
expect(state.contradictions).toHaveLength(1);
|
|
158
|
+
expect(state.contradictions[0].eventId).toBe('dmg-real');
|
|
159
|
+
expect(state.contradictions[0].discovered).toBe(false);
|
|
160
|
+
});
|
|
161
|
+
it('reveals truth and marks contradiction discovered', () => {
|
|
162
|
+
const state = {
|
|
163
|
+
objectiveLog: [],
|
|
164
|
+
presentedLog: [],
|
|
165
|
+
contradictions: [
|
|
166
|
+
{
|
|
167
|
+
eventId: 'dmg-real',
|
|
168
|
+
objectiveType: 'combat.damage.applied',
|
|
169
|
+
presentedType: 'combat.damage.applied',
|
|
170
|
+
objectiveValue: { damage: 15 },
|
|
171
|
+
presentedValue: { damage: 0 },
|
|
172
|
+
discovered: false,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
revealedTruths: [],
|
|
176
|
+
};
|
|
177
|
+
expect(getHiddenTruths(state)).toHaveLength(1);
|
|
178
|
+
expect(getRevealedTruths(state)).toHaveLength(0);
|
|
179
|
+
const revealed = revealTruth(state, 'dmg-real', 10);
|
|
180
|
+
expect(revealed).toBeDefined();
|
|
181
|
+
expect(revealed.discovered).toBe(true);
|
|
182
|
+
expect(revealed.discoveredAtTick).toBe(10);
|
|
183
|
+
expect(getHiddenTruths(state)).toHaveLength(0);
|
|
184
|
+
expect(getRevealedTruths(state)).toHaveLength(1);
|
|
185
|
+
expect(state.revealedTruths).toContain('dmg-real');
|
|
186
|
+
});
|
|
187
|
+
it('full contradiction demo: narrator lies, player discovers truth', () => {
|
|
188
|
+
const channels = new PresentationChannels();
|
|
189
|
+
// The narrator claims the merchant is trustworthy
|
|
190
|
+
channels.addFilter('narrator', (event) => {
|
|
191
|
+
if (event.type !== 'npc.alignment.revealed')
|
|
192
|
+
return event;
|
|
193
|
+
return {
|
|
194
|
+
...event,
|
|
195
|
+
payload: {
|
|
196
|
+
...event.payload,
|
|
197
|
+
alignment: 'friendly',
|
|
198
|
+
narratorSays: 'The merchant smiles warmly. A trustworthy soul.',
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
const state = {
|
|
203
|
+
objectiveLog: [],
|
|
204
|
+
presentedLog: [],
|
|
205
|
+
contradictions: [],
|
|
206
|
+
revealedTruths: [],
|
|
207
|
+
};
|
|
208
|
+
// The objective truth: the merchant is hostile
|
|
209
|
+
const truthEvent = {
|
|
210
|
+
id: 'reveal-merchant',
|
|
211
|
+
tick: 3,
|
|
212
|
+
type: 'npc.alignment.revealed',
|
|
213
|
+
payload: { npcId: 'merchant', alignment: 'hostile', intent: 'ambush' },
|
|
214
|
+
presentation: { channels: ['objective', 'narrator'] },
|
|
215
|
+
};
|
|
216
|
+
// Present through channels
|
|
217
|
+
const presented = channels.present(truthEvent);
|
|
218
|
+
recordPresentation(state, truthEvent, presented);
|
|
219
|
+
// Player sees: "The merchant smiles warmly"
|
|
220
|
+
const narratorVersion = presented.find((p) => p._channel === 'narrator');
|
|
221
|
+
expect(narratorVersion.payload.alignment).toBe('friendly');
|
|
222
|
+
// Objective truth stored
|
|
223
|
+
const objectiveVersion = presented.find((p) => p._channel === 'objective');
|
|
224
|
+
expect(objectiveVersion.payload.alignment).toBe('hostile');
|
|
225
|
+
// Contradiction recorded
|
|
226
|
+
expect(state.contradictions).toHaveLength(1);
|
|
227
|
+
expect(state.contradictions[0].discovered).toBe(false);
|
|
228
|
+
// Later: player finds evidence (inspect a note, talk to another NPC, etc.)
|
|
229
|
+
const revealed = revealTruth(state, 'reveal-merchant', 8);
|
|
230
|
+
expect(revealed).toBeDefined();
|
|
231
|
+
expect(revealed.discovered).toBe(true);
|
|
232
|
+
// Now the player knows the narrator lied
|
|
233
|
+
expect(getHiddenTruths(state)).toHaveLength(0);
|
|
234
|
+
expect(getRevealedTruths(state)).toHaveLength(1);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
//# sourceMappingURL=narrative-authority.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"narrative-authority.test.js","sourceRoot":"","sources":["../src/narrative-authority.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAkB;YAC3B,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YACtB,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;SAC1C,CAAC;QAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,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,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { EngineModule, WorldState, EntityState, ResolvedEvent } from '@ai-rpg-engine/core';
|
|
2
|
+
import type { FactionCognitionState } from './faction-cognition.js';
|
|
3
|
+
/** Context available to presentation rules */
|
|
4
|
+
export type ObserverContext = {
|
|
5
|
+
/** Observer entity */
|
|
6
|
+
observer: EntityState;
|
|
7
|
+
/** Perception clarity for this event (0-1, or undefined if not perceived) */
|
|
8
|
+
clarity: number | undefined;
|
|
9
|
+
/** Observer's faction ID */
|
|
10
|
+
factionId: string | undefined;
|
|
11
|
+
/** Faction cognition state (if any) */
|
|
12
|
+
factionState: FactionCognitionState | undefined;
|
|
13
|
+
/** Is the observer's faction hostile to the event actor? */
|
|
14
|
+
isActorHostile: boolean;
|
|
15
|
+
/** Environmental stability of the observer's zone */
|
|
16
|
+
zoneStability: number;
|
|
17
|
+
/** Observer's current suspicion level */
|
|
18
|
+
suspicion: number;
|
|
19
|
+
};
|
|
20
|
+
/** A rule that transforms event presentation based on observer context */
|
|
21
|
+
export type PresentationRule = {
|
|
22
|
+
id: string;
|
|
23
|
+
/** Event type patterns this rule applies to */
|
|
24
|
+
eventPatterns: string[];
|
|
25
|
+
/** Priority: higher priority rules apply first (default: 0) */
|
|
26
|
+
priority?: number;
|
|
27
|
+
/** Condition: should this rule apply? */
|
|
28
|
+
condition: (event: ResolvedEvent, ctx: ObserverContext) => boolean;
|
|
29
|
+
/** Transform: modify the event's presentation for this observer */
|
|
30
|
+
transform: (event: ResolvedEvent, ctx: ObserverContext) => ResolvedEvent;
|
|
31
|
+
};
|
|
32
|
+
/** Result of observer-scoped presentation */
|
|
33
|
+
export type ObserverPresentedEvent = ResolvedEvent & {
|
|
34
|
+
/** Which observer this version is for */
|
|
35
|
+
_observerId: string;
|
|
36
|
+
/** Observer's perception clarity */
|
|
37
|
+
_clarity: number | undefined;
|
|
38
|
+
/** Which rules were applied */
|
|
39
|
+
_appliedRules: string[];
|
|
40
|
+
};
|
|
41
|
+
export type ObserverPresentationConfig = {
|
|
42
|
+
/** Custom presentation rules (added to built-ins) */
|
|
43
|
+
rules?: PresentationRule[];
|
|
44
|
+
};
|
|
45
|
+
export type DivergenceRecord = {
|
|
46
|
+
eventId: string;
|
|
47
|
+
tick: number;
|
|
48
|
+
observerId: string;
|
|
49
|
+
objectiveType: string;
|
|
50
|
+
subjectiveDescription: string;
|
|
51
|
+
appliedRules: string[];
|
|
52
|
+
clarity: number | undefined;
|
|
53
|
+
};
|
|
54
|
+
export declare function createObserverPresentation(config?: ObserverPresentationConfig): EngineModule;
|
|
55
|
+
/**
|
|
56
|
+
* Present an event from a specific observer's perspective.
|
|
57
|
+
* Returns the event as the observer would experience it,
|
|
58
|
+
* shaped by their perception clarity, faction allegiance, and cognitive bias.
|
|
59
|
+
*/
|
|
60
|
+
export declare function presentForObserver(event: ResolvedEvent, observerId: string, world: WorldState, rules?: PresentationRule[]): ObserverPresentedEvent;
|
|
61
|
+
/**
|
|
62
|
+
* Present an event from all observers' perspectives.
|
|
63
|
+
* Returns one version per observer that perceived or was affected by the event.
|
|
64
|
+
*/
|
|
65
|
+
export declare function presentForAllObservers(event: ResolvedEvent, world: WorldState): ObserverPresentedEvent[];
|
|
66
|
+
/**
|
|
67
|
+
* Get all recorded divergences — events where observers saw different versions.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDivergences(world: WorldState): DivergenceRecord[];
|
|
70
|
+
/**
|
|
71
|
+
* Get divergences for a specific event — shows how each observer saw it.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getEventDivergences(world: WorldState, eventId: string): DivergenceRecord[];
|
|
74
|
+
//# sourceMappingURL=observer-presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,qDAAqD;IACrD,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AASF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAiBF,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,0BAA0B,GAAG,YAAY,CA4B5F;AAYD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,UAAU,EACjB,KAAK,CAAC,EAAE,gBAAgB,EAAE,GACzB,sBAAsB,CA0CxB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,UAAU,GAChB,sBAAsB,EAAE,CAY1B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAEpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAE1F"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// observer-presentation — subjective event presentation per observer
|
|
2
|
+
// The same event can be described differently depending on who observes it.
|
|
3
|
+
// Perception clarity, faction allegiance, and cognitive bias shape how
|
|
4
|
+
// events are presented to each observer. One truth, many experiences.
|
|
5
|
+
import { getCognition, getBelief } from './cognition-core.js';
|
|
6
|
+
import { getEntityFaction, getFactionCognition } from './faction-cognition.js';
|
|
7
|
+
import { getPerceptionLog } from './perception-filter.js';
|
|
8
|
+
import { getZoneProperty } from './environment-core.js';
|
|
9
|
+
// --- Rule Registry ---
|
|
10
|
+
// Rules contain functions (condition, transform) which can't survive structuredClone.
|
|
11
|
+
// We store them in a module-level registry keyed by a serializable ID,
|
|
12
|
+
// and persist only the ID in the world state.
|
|
13
|
+
const ruleRegistry = new Map();
|
|
14
|
+
/** Deterministic registry key from rule IDs — same rules always produce the same key */
|
|
15
|
+
function makeRegistryId(customRules) {
|
|
16
|
+
if (customRules.length === 0)
|
|
17
|
+
return 'op:builtin';
|
|
18
|
+
return `op:${customRules.map((r) => r.id).join(',')}`;
|
|
19
|
+
}
|
|
20
|
+
// --- Module ---
|
|
21
|
+
export function createObserverPresentation(config) {
|
|
22
|
+
const customRules = config?.rules ?? [];
|
|
23
|
+
const allRules = [
|
|
24
|
+
...getBuiltinRules(),
|
|
25
|
+
...customRules,
|
|
26
|
+
].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
27
|
+
const registryId = makeRegistryId(customRules);
|
|
28
|
+
ruleRegistry.set(registryId, allRules);
|
|
29
|
+
return {
|
|
30
|
+
id: 'observer-presentation',
|
|
31
|
+
version: '0.1.0',
|
|
32
|
+
dependsOn: ['cognition-core', 'perception-filter'],
|
|
33
|
+
register(ctx) {
|
|
34
|
+
ctx.persistence.registerNamespace('observer-presentation', {
|
|
35
|
+
divergences: [],
|
|
36
|
+
_registryId: registryId,
|
|
37
|
+
});
|
|
38
|
+
ctx.debug.registerInspector({
|
|
39
|
+
id: 'presentation-divergences',
|
|
40
|
+
label: 'Presentation Divergences',
|
|
41
|
+
inspect: (world) => getModuleState(world).divergences,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// --- State Access ---
|
|
47
|
+
function getModuleState(world) {
|
|
48
|
+
return (world.modules['observer-presentation'] ?? {
|
|
49
|
+
divergences: [],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// --- Presentation API ---
|
|
53
|
+
/**
|
|
54
|
+
* Present an event from a specific observer's perspective.
|
|
55
|
+
* Returns the event as the observer would experience it,
|
|
56
|
+
* shaped by their perception clarity, faction allegiance, and cognitive bias.
|
|
57
|
+
*/
|
|
58
|
+
export function presentForObserver(event, observerId, world, rules) {
|
|
59
|
+
const observer = world.entities[observerId];
|
|
60
|
+
if (!observer) {
|
|
61
|
+
return { ...event, _observerId: observerId, _clarity: undefined, _appliedRules: [] };
|
|
62
|
+
}
|
|
63
|
+
const ctx = buildObserverContext(observer, event, world);
|
|
64
|
+
const activeRules = rules ?? getAllRules(world);
|
|
65
|
+
let transformed = { ...event };
|
|
66
|
+
const appliedRules = [];
|
|
67
|
+
for (const rule of activeRules) {
|
|
68
|
+
if (!matchesEventPattern(event.type, rule.eventPatterns))
|
|
69
|
+
continue;
|
|
70
|
+
if (!rule.condition(event, ctx))
|
|
71
|
+
continue;
|
|
72
|
+
transformed = rule.transform(transformed, ctx);
|
|
73
|
+
appliedRules.push(rule.id);
|
|
74
|
+
}
|
|
75
|
+
// Record divergence if any rules were applied
|
|
76
|
+
if (appliedRules.length > 0) {
|
|
77
|
+
const state = getModuleState(world);
|
|
78
|
+
const description = transformed.payload._subjectiveDescription
|
|
79
|
+
?? transformed.type;
|
|
80
|
+
state.divergences.push({
|
|
81
|
+
eventId: event.id,
|
|
82
|
+
tick: event.tick,
|
|
83
|
+
observerId,
|
|
84
|
+
objectiveType: event.type,
|
|
85
|
+
subjectiveDescription: description,
|
|
86
|
+
appliedRules,
|
|
87
|
+
clarity: ctx.clarity,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...transformed,
|
|
92
|
+
_observerId: observerId,
|
|
93
|
+
_clarity: ctx.clarity,
|
|
94
|
+
_appliedRules: appliedRules,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Present an event from all observers' perspectives.
|
|
99
|
+
* Returns one version per observer that perceived or was affected by the event.
|
|
100
|
+
*/
|
|
101
|
+
export function presentForAllObservers(event, world) {
|
|
102
|
+
const results = [];
|
|
103
|
+
for (const entity of Object.values(world.entities)) {
|
|
104
|
+
if (!entity.ai)
|
|
105
|
+
continue;
|
|
106
|
+
if (entity.id === event.actorId)
|
|
107
|
+
continue; // actors know what they did
|
|
108
|
+
const presented = presentForObserver(event, entity.id, world);
|
|
109
|
+
results.push(presented);
|
|
110
|
+
}
|
|
111
|
+
return results;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get all recorded divergences — events where observers saw different versions.
|
|
115
|
+
*/
|
|
116
|
+
export function getDivergences(world) {
|
|
117
|
+
return getModuleState(world).divergences;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get divergences for a specific event — shows how each observer saw it.
|
|
121
|
+
*/
|
|
122
|
+
export function getEventDivergences(world, eventId) {
|
|
123
|
+
return getModuleState(world).divergences.filter((d) => d.eventId === eventId);
|
|
124
|
+
}
|
|
125
|
+
// --- Built-in Rules ---
|
|
126
|
+
function getBuiltinRules() {
|
|
127
|
+
return [
|
|
128
|
+
// Low clarity: obscure actor identity
|
|
129
|
+
{
|
|
130
|
+
id: 'low-clarity-identity',
|
|
131
|
+
eventPatterns: ['world.zone.entered', 'combat.*'],
|
|
132
|
+
priority: 10,
|
|
133
|
+
condition: (_event, ctx) => (ctx.clarity ?? 1) < 0.4,
|
|
134
|
+
transform: (event, ctx) => ({
|
|
135
|
+
...event,
|
|
136
|
+
payload: {
|
|
137
|
+
...event.payload,
|
|
138
|
+
_subjectiveDescription: 'a shadowed figure moves nearby',
|
|
139
|
+
_actorDescription: 'an indistinct shape',
|
|
140
|
+
_clarityLevel: 'obscured',
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
// Medium clarity: partial information
|
|
145
|
+
{
|
|
146
|
+
id: 'medium-clarity-partial',
|
|
147
|
+
eventPatterns: ['world.zone.entered', 'combat.*'],
|
|
148
|
+
priority: 5,
|
|
149
|
+
condition: (_event, ctx) => {
|
|
150
|
+
const clarity = ctx.clarity ?? 1;
|
|
151
|
+
return clarity >= 0.4 && clarity < 0.7;
|
|
152
|
+
},
|
|
153
|
+
transform: (event, ctx) => ({
|
|
154
|
+
...event,
|
|
155
|
+
payload: {
|
|
156
|
+
...event.payload,
|
|
157
|
+
_subjectiveDescription: 'someone moves in the dim light',
|
|
158
|
+
_actorDescription: 'a partially visible figure',
|
|
159
|
+
_clarityLevel: 'partial',
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
// Hostile faction: biased framing
|
|
164
|
+
{
|
|
165
|
+
id: 'hostile-faction-bias',
|
|
166
|
+
eventPatterns: ['world.zone.entered'],
|
|
167
|
+
priority: 3,
|
|
168
|
+
condition: (_event, ctx) => ctx.isActorHostile,
|
|
169
|
+
transform: (event, _ctx) => ({
|
|
170
|
+
...event,
|
|
171
|
+
payload: {
|
|
172
|
+
...event.payload,
|
|
173
|
+
_subjectiveDescription: 'a hostile intruder advances',
|
|
174
|
+
_actorDescription: 'an enemy combatant',
|
|
175
|
+
_hostileBias: true,
|
|
176
|
+
},
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
179
|
+
// High suspicion: paranoid interpretation
|
|
180
|
+
{
|
|
181
|
+
id: 'high-suspicion-paranoia',
|
|
182
|
+
eventPatterns: ['world.zone.entered'],
|
|
183
|
+
priority: 2,
|
|
184
|
+
condition: (_event, ctx) => ctx.suspicion > 60,
|
|
185
|
+
transform: (event, _ctx) => ({
|
|
186
|
+
...event,
|
|
187
|
+
payload: {
|
|
188
|
+
...event.payload,
|
|
189
|
+
_subjectiveDescription: 'a suspicious figure lurks at the threshold',
|
|
190
|
+
_paranoidInterpretation: true,
|
|
191
|
+
},
|
|
192
|
+
}),
|
|
193
|
+
},
|
|
194
|
+
// Unstable environment: glitched perception
|
|
195
|
+
{
|
|
196
|
+
id: 'unstable-environment-glitch',
|
|
197
|
+
eventPatterns: ['*'],
|
|
198
|
+
priority: 1,
|
|
199
|
+
condition: (_event, ctx) => ctx.zoneStability < 2,
|
|
200
|
+
transform: (event, _ctx) => ({
|
|
201
|
+
...event,
|
|
202
|
+
payload: {
|
|
203
|
+
...event.payload,
|
|
204
|
+
_environmentalDistortion: true,
|
|
205
|
+
_clarityLevel: 'glitched',
|
|
206
|
+
},
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
// --- Internal ---
|
|
212
|
+
function getAllRules(world) {
|
|
213
|
+
// Look up rules from registry using the ID stored in module state
|
|
214
|
+
const state = getModuleState(world);
|
|
215
|
+
if (state._registryId && ruleRegistry.has(state._registryId)) {
|
|
216
|
+
return ruleRegistry.get(state._registryId);
|
|
217
|
+
}
|
|
218
|
+
// Fallback: built-in only (when module not registered)
|
|
219
|
+
return getBuiltinRules().sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
220
|
+
}
|
|
221
|
+
function buildObserverContext(observer, event, world) {
|
|
222
|
+
// Find perception clarity for this event
|
|
223
|
+
let clarity;
|
|
224
|
+
if (world.modules['perception-filter']) {
|
|
225
|
+
const perceptionLog = getPerceptionLog(world, observer.id);
|
|
226
|
+
const perception = perceptionLog.find((p) => p.eventId === event.id);
|
|
227
|
+
clarity = perception?.clarity;
|
|
228
|
+
}
|
|
229
|
+
// Faction info
|
|
230
|
+
const factionId = world.modules['faction-cognition']
|
|
231
|
+
? getEntityFaction(world, observer.id)
|
|
232
|
+
: undefined;
|
|
233
|
+
const factionState = factionId
|
|
234
|
+
? getFactionCognition(world, factionId)
|
|
235
|
+
: undefined;
|
|
236
|
+
// Is the event actor hostile to the observer's faction?
|
|
237
|
+
let isActorHostile = false;
|
|
238
|
+
if (factionId && event.actorId) {
|
|
239
|
+
const actorFaction = getEntityFaction(world, event.actorId);
|
|
240
|
+
// Different faction = potentially hostile
|
|
241
|
+
if (actorFaction && actorFaction !== factionId) {
|
|
242
|
+
isActorHostile = true;
|
|
243
|
+
}
|
|
244
|
+
// Or check if the observer believes the actor is hostile
|
|
245
|
+
const cognition = getCognition(world, observer.id);
|
|
246
|
+
const hostileBelief = getBelief(cognition, event.actorId, 'hostile');
|
|
247
|
+
if (hostileBelief?.value === true && hostileBelief.confidence > 0.5) {
|
|
248
|
+
isActorHostile = true;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Zone stability
|
|
252
|
+
const zoneStability = observer.zoneId
|
|
253
|
+
? getZoneProperty(world, observer.zoneId, 'stability') || 5
|
|
254
|
+
: 5;
|
|
255
|
+
// Suspicion
|
|
256
|
+
const cognition = getCognition(world, observer.id);
|
|
257
|
+
return {
|
|
258
|
+
observer,
|
|
259
|
+
clarity,
|
|
260
|
+
factionId,
|
|
261
|
+
factionState,
|
|
262
|
+
isActorHostile,
|
|
263
|
+
zoneStability,
|
|
264
|
+
suspicion: cognition.suspicion,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function matchesEventPattern(eventType, patterns) {
|
|
268
|
+
return patterns.some((pattern) => {
|
|
269
|
+
if (pattern === '*')
|
|
270
|
+
return true;
|
|
271
|
+
if (pattern.endsWith('.*')) {
|
|
272
|
+
return eventType.startsWith(pattern.slice(0, -2) + '.');
|
|
273
|
+
}
|
|
274
|
+
return eventType === pattern;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=observer-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer-presentation.js","sourceRoot":"","sources":["../src/observer-presentation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,4EAA4E;AAC5E,uEAAuE;AACvE,sEAAsE;AAStE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM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