@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,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Propagation builder API (ADR-144 layer 5)
|
|
4
|
+
*
|
|
5
|
+
* Extends CharacterBuilder with a fluent .propagation() method that
|
|
6
|
+
* accepts PropagationProfile options. The compiled profile is stored
|
|
7
|
+
* in CompiledCharacter for applyCharacter to consume.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: propagation() method added to CharacterBuilder.
|
|
10
|
+
* Owner context: @sharpee/character / propagation
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.buildPropagationProfile = buildPropagationProfile;
|
|
14
|
+
/**
|
|
15
|
+
* Convert builder options to a PropagationProfile.
|
|
16
|
+
*
|
|
17
|
+
* @param opts - Builder options
|
|
18
|
+
* @returns A PropagationProfile with all specified fields
|
|
19
|
+
*/
|
|
20
|
+
function buildPropagationProfile(opts) {
|
|
21
|
+
const profile = {
|
|
22
|
+
tendency: opts.tendency,
|
|
23
|
+
};
|
|
24
|
+
if (opts.audience !== undefined)
|
|
25
|
+
profile.audience = opts.audience;
|
|
26
|
+
if (opts.excludes !== undefined)
|
|
27
|
+
profile.excludes = [...opts.excludes];
|
|
28
|
+
if (opts.withholds !== undefined)
|
|
29
|
+
profile.withholds = [...opts.withholds];
|
|
30
|
+
if (opts.spreads !== undefined)
|
|
31
|
+
profile.spreads = [...opts.spreads];
|
|
32
|
+
if (opts.overrides !== undefined)
|
|
33
|
+
profile.overrides = { ...opts.overrides };
|
|
34
|
+
if (opts.pace !== undefined)
|
|
35
|
+
profile.pace = opts.pace;
|
|
36
|
+
if (opts.schedule !== undefined)
|
|
37
|
+
profile.schedule = { ...opts.schedule };
|
|
38
|
+
if (opts.coloring !== undefined)
|
|
39
|
+
profile.coloring = opts.coloring;
|
|
40
|
+
if (opts.playerCanLeverage !== undefined)
|
|
41
|
+
profile.playerCanLeverage = opts.playerCanLeverage;
|
|
42
|
+
if (opts.receives !== undefined)
|
|
43
|
+
profile.receives = opts.receives;
|
|
44
|
+
return profile;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["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KAAK,SAAS;QAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAElE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fact transfer and provenance tracking (ADR-144)
|
|
3
|
+
*
|
|
4
|
+
* Applies propagation transfers by creating facts in the listener's
|
|
5
|
+
* knowledge base with full provenance chain. Records transfers in
|
|
6
|
+
* the already-told record.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: transferFact, TransferResult.
|
|
9
|
+
* Owner context: @sharpee/character / propagation
|
|
10
|
+
*/
|
|
11
|
+
import { CharacterModelTrait } from "../../world-model/index";
|
|
12
|
+
import { PropagationTransfer, AlreadyToldRecord, ReceivesAs } from './propagation-types';
|
|
13
|
+
/** The result of applying a fact transfer. */
|
|
14
|
+
export interface TransferResult {
|
|
15
|
+
/** The transfer that was applied. */
|
|
16
|
+
transfer: PropagationTransfer;
|
|
17
|
+
/** The source string recorded on the listener's fact. */
|
|
18
|
+
source: string;
|
|
19
|
+
/** Whether the listener already knew this topic (no-op transfer). */
|
|
20
|
+
alreadyKnew: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Apply a single propagation transfer.
|
|
24
|
+
*
|
|
25
|
+
* Creates a fact in the listener's knowledge with provenance,
|
|
26
|
+
* records the transfer in the already-told record.
|
|
27
|
+
*
|
|
28
|
+
* @param transfer - The transfer to apply
|
|
29
|
+
* @param listenerTrait - The listener's CharacterModelTrait
|
|
30
|
+
* @param alreadyTold - The shared already-told record
|
|
31
|
+
* @param turn - Current turn number
|
|
32
|
+
* @param receivesAs - How the listener treats received info (default: 'as fact')
|
|
33
|
+
* @returns The transfer result
|
|
34
|
+
*/
|
|
35
|
+
export declare function transferFact(transfer: PropagationTransfer, listenerTrait: CharacterModelTrait, alreadyTold: AlreadyToldRecord, turn: number, receivesAs?: ReceivesAs): TransferResult;
|
|
36
|
+
/**
|
|
37
|
+
* Apply multiple propagation transfers in sequence.
|
|
38
|
+
*
|
|
39
|
+
* @param transfers - The transfers to apply
|
|
40
|
+
* @param getListenerTrait - Function to get a listener's CharacterModelTrait by ID
|
|
41
|
+
* @param alreadyTold - The shared already-told record
|
|
42
|
+
* @param turn - Current turn number
|
|
43
|
+
* @param getReceivesAs - Function to get how a listener receives info
|
|
44
|
+
* @returns Array of transfer results
|
|
45
|
+
*/
|
|
46
|
+
export declare function applyTransfers(transfers: PropagationTransfer[], getListenerTrait: (id: string) => CharacterModelTrait | undefined, alreadyTold: AlreadyToldRecord, turn: number, getReceivesAs?: (listenerId: string) => ReceivesAs): TransferResult[];
|
|
47
|
+
//# sourceMappingURL=fact-transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-transfer.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/propagation/fact-transfer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAM7B,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IAEf,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;CACtB;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,UAAsB,GACjC,cAAc,CAkChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,mBAAmB,EAAE,EAChC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,mBAAmB,GAAG,SAAS,EACjE,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,UAAU,GACjD,cAAc,EAAE,CAalB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fact transfer and provenance tracking (ADR-144)
|
|
4
|
+
*
|
|
5
|
+
* Applies propagation transfers by creating facts in the listener's
|
|
6
|
+
* knowledge base with full provenance chain. Records transfers in
|
|
7
|
+
* the already-told record.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: transferFact, TransferResult.
|
|
10
|
+
* Owner context: @sharpee/character / propagation
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.transferFact = transferFact;
|
|
14
|
+
exports.applyTransfers = applyTransfers;
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Fact transfer
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* Apply a single propagation transfer.
|
|
20
|
+
*
|
|
21
|
+
* Creates a fact in the listener's knowledge with provenance,
|
|
22
|
+
* records the transfer in the already-told record.
|
|
23
|
+
*
|
|
24
|
+
* @param transfer - The transfer to apply
|
|
25
|
+
* @param listenerTrait - The listener's CharacterModelTrait
|
|
26
|
+
* @param alreadyTold - The shared already-told record
|
|
27
|
+
* @param turn - Current turn number
|
|
28
|
+
* @param receivesAs - How the listener treats received info (default: 'as fact')
|
|
29
|
+
* @returns The transfer result
|
|
30
|
+
*/
|
|
31
|
+
function transferFact(transfer, listenerTrait, alreadyTold, turn, receivesAs = 'as fact') {
|
|
32
|
+
const source = `told by ${transfer.speakerId}`;
|
|
33
|
+
// Check if listener already knows this topic
|
|
34
|
+
const alreadyKnew = listenerTrait.knows(transfer.topic);
|
|
35
|
+
if (!alreadyKnew) {
|
|
36
|
+
if (receivesAs === 'as fact') {
|
|
37
|
+
// Add as knowledge fact
|
|
38
|
+
listenerTrait.addFact(transfer.topic, 'told', 'believes', turn);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Add as belief (skeptical NPC)
|
|
42
|
+
listenerTrait.addBelief(transfer.topic, 'suspects', 'none');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Record in already-told (even if listener already knew,
|
|
46
|
+
// this prevents the speaker from trying again)
|
|
47
|
+
alreadyTold.record(transfer.speakerId, transfer.listenerId, transfer.topic);
|
|
48
|
+
return {
|
|
49
|
+
transfer,
|
|
50
|
+
source,
|
|
51
|
+
alreadyKnew,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Apply multiple propagation transfers in sequence.
|
|
56
|
+
*
|
|
57
|
+
* @param transfers - The transfers to apply
|
|
58
|
+
* @param getListenerTrait - Function to get a listener's CharacterModelTrait by ID
|
|
59
|
+
* @param alreadyTold - The shared already-told record
|
|
60
|
+
* @param turn - Current turn number
|
|
61
|
+
* @param getReceivesAs - Function to get how a listener receives info
|
|
62
|
+
* @returns Array of transfer results
|
|
63
|
+
*/
|
|
64
|
+
function applyTransfers(transfers, getListenerTrait, alreadyTold, turn, getReceivesAs) {
|
|
65
|
+
const results = [];
|
|
66
|
+
for (const transfer of transfers) {
|
|
67
|
+
const listenerTrait = getListenerTrait(transfer.listenerId);
|
|
68
|
+
if (!listenerTrait)
|
|
69
|
+
continue;
|
|
70
|
+
const receivesAs = getReceivesAs?.(transfer.listenerId) ?? 'as fact';
|
|
71
|
+
const result = transferFact(transfer, listenerTrait, alreadyTold, turn, receivesAs);
|
|
72
|
+
results.push(result);
|
|
73
|
+
}
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=fact-transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-transfer.js","sourceRoot":"","sources":["../../../../../../../repos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AAI,CAAC,aAAa;YAAE,SAAS;QAE7B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC;QACrE,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACpF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information propagation exports (ADR-144)
|
|
3
|
+
*
|
|
4
|
+
* Propagation profiles, evaluation engine, and fact transfer
|
|
5
|
+
* for NPC-to-NPC information flow.
|
|
6
|
+
*
|
|
7
|
+
* Public interface: All re-exported types and functions.
|
|
8
|
+
* Owner context: @sharpee/character / propagation
|
|
9
|
+
*/
|
|
10
|
+
export { type PropagationTendency, type PropagationAudience, type PropagationPace, type PropagationColoring, type ReceivesAs, type SpreadsVersion, type FactOverride, type PropagationSchedule, type PropagationProfile, type PropagationTransfer, AlreadyToldRecord, } from './propagation-types';
|
|
11
|
+
export { type RoomOccupant, type PropagationContext, evaluatePropagation, } from './propagation-evaluator';
|
|
12
|
+
export { type TransferResult, transferFact, applyTransfers, } from './fact-transfer';
|
|
13
|
+
export { type PlayerPresence, type PropagationVisibilityResult, PROPAGATION_WITNESSED_DEFAULTS, getVisibilityResult, getVisibilityResults, } from './visibility';
|
|
14
|
+
export { type PropagationOptions, buildPropagationProfile, } from './builder';
|
|
15
|
+
export { PropagationMessages, type PropagationMessageId, } from './propagation-messages';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/propagation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,8BAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,kBAAkB,EACvB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Information propagation exports (ADR-144)
|
|
4
|
+
*
|
|
5
|
+
* Propagation profiles, evaluation engine, and fact transfer
|
|
6
|
+
* for NPC-to-NPC information flow.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: All re-exported types and functions.
|
|
9
|
+
* Owner context: @sharpee/character / propagation
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PropagationMessages = exports.buildPropagationProfile = exports.getVisibilityResults = exports.getVisibilityResult = exports.PROPAGATION_WITNESSED_DEFAULTS = exports.applyTransfers = exports.transferFact = exports.evaluatePropagation = exports.AlreadyToldRecord = void 0;
|
|
13
|
+
var propagation_types_1 = require("./propagation-types");
|
|
14
|
+
Object.defineProperty(exports, "AlreadyToldRecord", { enumerable: true, get: function () { return propagation_types_1.AlreadyToldRecord; } });
|
|
15
|
+
var propagation_evaluator_1 = require("./propagation-evaluator");
|
|
16
|
+
Object.defineProperty(exports, "evaluatePropagation", { enumerable: true, get: function () { return propagation_evaluator_1.evaluatePropagation; } });
|
|
17
|
+
var fact_transfer_1 = require("./fact-transfer");
|
|
18
|
+
Object.defineProperty(exports, "transferFact", { enumerable: true, get: function () { return fact_transfer_1.transferFact; } });
|
|
19
|
+
Object.defineProperty(exports, "applyTransfers", { enumerable: true, get: function () { return fact_transfer_1.applyTransfers; } });
|
|
20
|
+
var visibility_1 = require("./visibility");
|
|
21
|
+
Object.defineProperty(exports, "PROPAGATION_WITNESSED_DEFAULTS", { enumerable: true, get: function () { return visibility_1.PROPAGATION_WITNESSED_DEFAULTS; } });
|
|
22
|
+
Object.defineProperty(exports, "getVisibilityResult", { enumerable: true, get: function () { return visibility_1.getVisibilityResult; } });
|
|
23
|
+
Object.defineProperty(exports, "getVisibilityResults", { enumerable: true, get: function () { return visibility_1.getVisibilityResults; } });
|
|
24
|
+
var builder_1 = require("./builder");
|
|
25
|
+
Object.defineProperty(exports, "buildPropagationProfile", { enumerable: true, get: function () { return builder_1.buildPropagationProfile; } });
|
|
26
|
+
var propagation_messages_1 = require("./propagation-messages");
|
|
27
|
+
Object.defineProperty(exports, "PropagationMessages", { enumerable: true, get: function () { return propagation_messages_1.PropagationMessages; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/propagation/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,yDAY6B;AAD3B,sHAAA,iBAAiB,OAAA;AAGnB,iEAIiC;AAD/B,4HAAA,mBAAmB,OAAA;AAGrB,iDAIyB;AAFvB,6GAAA,YAAY,OAAA;AACZ,+GAAA,cAAc,OAAA;AAGhB,2CAMsB;AAHpB,4HAAA,8BAA8B,OAAA;AAC9B,iHAAA,mBAAmB,OAAA;AACnB,kHAAA,oBAAoB,OAAA;AAGtB,qCAGmB;AADjB,kHAAA,uBAAuB,OAAA;AAGzB,+DAGgC;AAF9B,2HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Propagation evaluation engine (ADR-144)
|
|
3
|
+
*
|
|
4
|
+
* Per-turn evaluator that determines which facts each NPC shares,
|
|
5
|
+
* with whom, and in what order. Pure evaluation logic — does not
|
|
6
|
+
* mutate world state. Returns PropagationTransfer objects that
|
|
7
|
+
* the caller applies via fact-transfer.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: evaluatePropagation, PropagationContext.
|
|
10
|
+
* Owner context: @sharpee/character / propagation
|
|
11
|
+
*/
|
|
12
|
+
import { CharacterModelTrait } from "../../world-model/index";
|
|
13
|
+
import { PropagationProfile, PropagationTransfer, AlreadyToldRecord } from './propagation-types';
|
|
14
|
+
/** Information about an NPC in the room for propagation evaluation. */
|
|
15
|
+
export interface RoomOccupant {
|
|
16
|
+
/** Entity ID. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The NPC's CharacterModelTrait (for disposition checks). */
|
|
19
|
+
trait: CharacterModelTrait;
|
|
20
|
+
/** The NPC's propagation profile, if any. */
|
|
21
|
+
profile?: PropagationProfile;
|
|
22
|
+
}
|
|
23
|
+
/** Context for evaluating one NPC's propagation. */
|
|
24
|
+
export interface PropagationContext {
|
|
25
|
+
/** The speaking NPC. */
|
|
26
|
+
speaker: RoomOccupant;
|
|
27
|
+
/** All other NPCs in the same room. */
|
|
28
|
+
listeners: RoomOccupant[];
|
|
29
|
+
/** Whether the player is present in the room. */
|
|
30
|
+
playerPresent: boolean;
|
|
31
|
+
/** The already-told record (shared across all NPCs). */
|
|
32
|
+
alreadyTold: AlreadyToldRecord;
|
|
33
|
+
/** Current turn number. */
|
|
34
|
+
turn: number;
|
|
35
|
+
/** Number of turns the speaker has been in this room with listeners. */
|
|
36
|
+
turnsColocated?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Evaluate propagation for a single NPC.
|
|
40
|
+
*
|
|
41
|
+
* Algorithm:
|
|
42
|
+
* 1. Mute check — skip entirely
|
|
43
|
+
* 2. Schedule condition check — skip if not met
|
|
44
|
+
* 3. Find eligible listeners (audience + exclusions)
|
|
45
|
+
* 4. Find eligible facts (tendency whitelist/blacklist + already-told)
|
|
46
|
+
* 5. Apply pace (eager = all, gradual = one, reluctant = wait)
|
|
47
|
+
* 6. Return transfer objects
|
|
48
|
+
*
|
|
49
|
+
* @param ctx - The propagation context
|
|
50
|
+
* @returns Array of transfers to execute
|
|
51
|
+
*/
|
|
52
|
+
export declare function evaluatePropagation(ctx: PropagationContext): PropagationTransfer[];
|
|
53
|
+
//# sourceMappingURL=propagation-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation-evaluator.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/propagation/propagation-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EAGlB,MAAM,qBAAqB,CAAC;AAM7B,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IAEX,8DAA8D;IAC9D,KAAK,EAAE,mBAAmB,CAAC;IAE3B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,OAAO,EAAE,YAAY,CAAC;IAEtB,uCAAuC;IACvC,SAAS,EAAE,YAAY,EAAE,CAAC;IAE1B,iDAAiD;IACjD,aAAa,EAAE,OAAO,CAAC;IAEvB,wDAAwD;IACxD,WAAW,EAAE,iBAAiB,CAAC;IAE/B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IAEb,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,GAAG,mBAAmB,EAAE,CAgDlF"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Propagation evaluation engine (ADR-144)
|
|
4
|
+
*
|
|
5
|
+
* Per-turn evaluator that determines which facts each NPC shares,
|
|
6
|
+
* with whom, and in what order. Pure evaluation logic — does not
|
|
7
|
+
* mutate world state. Returns PropagationTransfer objects that
|
|
8
|
+
* the caller applies via fact-transfer.
|
|
9
|
+
*
|
|
10
|
+
* Public interface: evaluatePropagation, PropagationContext.
|
|
11
|
+
* Owner context: @sharpee/character / propagation
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.evaluatePropagation = evaluatePropagation;
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Evaluation
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* Evaluate propagation for a single NPC.
|
|
20
|
+
*
|
|
21
|
+
* Algorithm:
|
|
22
|
+
* 1. Mute check — skip entirely
|
|
23
|
+
* 2. Schedule condition check — skip if not met
|
|
24
|
+
* 3. Find eligible listeners (audience + exclusions)
|
|
25
|
+
* 4. Find eligible facts (tendency whitelist/blacklist + already-told)
|
|
26
|
+
* 5. Apply pace (eager = all, gradual = one, reluctant = wait)
|
|
27
|
+
* 6. Return transfer objects
|
|
28
|
+
*
|
|
29
|
+
* @param ctx - The propagation context
|
|
30
|
+
* @returns Array of transfers to execute
|
|
31
|
+
*/
|
|
32
|
+
function evaluatePropagation(ctx) {
|
|
33
|
+
const { speaker } = ctx;
|
|
34
|
+
const profile = speaker.profile;
|
|
35
|
+
// No profile or mute → no propagation
|
|
36
|
+
if (!profile || profile.tendency === 'mute') {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
// Schedule check
|
|
40
|
+
if (profile.schedule) {
|
|
41
|
+
const scheduleMet = profile.schedule.when.every(cond => speaker.trait.evaluate(cond));
|
|
42
|
+
if (!scheduleMet)
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
// Find eligible listeners
|
|
46
|
+
const eligibleListeners = findEligibleListeners(ctx);
|
|
47
|
+
if (eligibleListeners.length === 0)
|
|
48
|
+
return [];
|
|
49
|
+
// Find eligible facts for each listener
|
|
50
|
+
const transfers = [];
|
|
51
|
+
for (const listener of eligibleListeners) {
|
|
52
|
+
const facts = findEligibleFacts(ctx, listener);
|
|
53
|
+
if (facts.length === 0)
|
|
54
|
+
continue;
|
|
55
|
+
// Apply pace
|
|
56
|
+
const factsToShare = applyPace(facts, profile, ctx);
|
|
57
|
+
for (const topic of factsToShare) {
|
|
58
|
+
const override = profile.overrides?.[topic];
|
|
59
|
+
const version = override?.spreadsVersion ?? 'truth';
|
|
60
|
+
const coloring = profile.coloring ?? 'neutral';
|
|
61
|
+
transfers.push({
|
|
62
|
+
speakerId: speaker.id,
|
|
63
|
+
listenerId: listener.id,
|
|
64
|
+
topic,
|
|
65
|
+
version,
|
|
66
|
+
coloring,
|
|
67
|
+
witnessedOverride: override?.witnessed,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return transfers;
|
|
72
|
+
}
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Eligible listeners
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* Find NPCs in the room that the speaker will share with.
|
|
78
|
+
* Filters by audience type and exclusion list.
|
|
79
|
+
*/
|
|
80
|
+
function findEligibleListeners(ctx) {
|
|
81
|
+
const { speaker, listeners } = ctx;
|
|
82
|
+
const profile = speaker.profile;
|
|
83
|
+
const audience = profile.audience ?? 'trusted';
|
|
84
|
+
const excludes = new Set(profile.excludes ?? []);
|
|
85
|
+
return listeners.filter(listener => {
|
|
86
|
+
// Excluded by name
|
|
87
|
+
if (excludes.has(listener.id))
|
|
88
|
+
return false;
|
|
89
|
+
// Audience check
|
|
90
|
+
switch (audience) {
|
|
91
|
+
case 'anyone':
|
|
92
|
+
return true;
|
|
93
|
+
case 'trusted':
|
|
94
|
+
// Speaker has positive disposition toward listener
|
|
95
|
+
return speaker.trait.getDispositionValue(listener.id) > 0;
|
|
96
|
+
case 'allied':
|
|
97
|
+
// Both share a loyalty — check if any disposition targets overlap
|
|
98
|
+
// with positive values on both sides
|
|
99
|
+
return hasSharedAlliance(speaker.trait, listener.trait);
|
|
100
|
+
default:
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if two NPCs share a loyalty (both have positive disposition
|
|
107
|
+
* toward at least one common entity).
|
|
108
|
+
*/
|
|
109
|
+
function hasSharedAlliance(traitA, traitB) {
|
|
110
|
+
for (const [entityId, valueA] of Object.entries(traitA.dispositions)) {
|
|
111
|
+
if (valueA > 50 && (traitB.dispositions[entityId] ?? 0) > 50) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// Eligible facts
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Find facts the speaker is willing and able to share with a specific listener.
|
|
122
|
+
* Filters by tendency (chatty/selective), already-told, and player-leverage.
|
|
123
|
+
*/
|
|
124
|
+
function findEligibleFacts(ctx, listener) {
|
|
125
|
+
const { speaker, alreadyTold } = ctx;
|
|
126
|
+
const profile = speaker.profile;
|
|
127
|
+
const knowledge = speaker.trait.knowledge;
|
|
128
|
+
const withholds = new Set(profile.withholds ?? []);
|
|
129
|
+
const spreadsSet = new Set(profile.spreads ?? []);
|
|
130
|
+
const eligible = [];
|
|
131
|
+
for (const topic of Object.keys(knowledge)) {
|
|
132
|
+
if (alreadyTold.hasTold(speaker.id, listener.id, topic))
|
|
133
|
+
continue;
|
|
134
|
+
if (!meetsAudienceRule(topic, profile, speaker.trait, listener))
|
|
135
|
+
continue;
|
|
136
|
+
if (!meetsTendencyFilter(topic, profile, withholds, spreadsSet))
|
|
137
|
+
continue;
|
|
138
|
+
if (!meetsLeverageRule(topic, profile, knowledge))
|
|
139
|
+
continue;
|
|
140
|
+
eligible.push(topic);
|
|
141
|
+
}
|
|
142
|
+
return eligible;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Check whether a per-fact audience override allows sharing with this listener.
|
|
146
|
+
* Returns true if there is no override or the override audience matches.
|
|
147
|
+
*
|
|
148
|
+
* @param topic - The knowledge topic to check
|
|
149
|
+
* @param profile - Speaker's propagation profile
|
|
150
|
+
* @param speakerTrait - Speaker's character model trait
|
|
151
|
+
* @param listener - The potential listener
|
|
152
|
+
* @returns Whether the topic passes the audience rule
|
|
153
|
+
*/
|
|
154
|
+
function meetsAudienceRule(topic, profile, speakerTrait, listener) {
|
|
155
|
+
const override = profile.overrides?.[topic];
|
|
156
|
+
if (!override?.to)
|
|
157
|
+
return true;
|
|
158
|
+
return checkAudienceForListener(override.to, speakerTrait, listener);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Check whether a topic passes the speaker's tendency filter.
|
|
162
|
+
* Chatty speakers share everything except withheld topics; selective
|
|
163
|
+
* speakers share only explicitly listed topics.
|
|
164
|
+
*
|
|
165
|
+
* @param topic - The knowledge topic to check
|
|
166
|
+
* @param profile - Speaker's propagation profile
|
|
167
|
+
* @param withholds - Pre-computed set of withheld topics
|
|
168
|
+
* @param spreadsSet - Pre-computed set of explicitly shared topics
|
|
169
|
+
* @returns Whether the topic passes the tendency filter
|
|
170
|
+
*/
|
|
171
|
+
function meetsTendencyFilter(topic, profile, withholds, spreadsSet) {
|
|
172
|
+
switch (profile.tendency) {
|
|
173
|
+
case 'chatty':
|
|
174
|
+
return !withholds.has(topic);
|
|
175
|
+
case 'selective':
|
|
176
|
+
return spreadsSet.has(topic);
|
|
177
|
+
default:
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Check whether a topic passes the player-leverage filter.
|
|
183
|
+
* When playerCanLeverage is false, facts sourced from the player are blocked.
|
|
184
|
+
*
|
|
185
|
+
* @param topic - The knowledge topic to check
|
|
186
|
+
* @param profile - Speaker's propagation profile
|
|
187
|
+
* @param knowledge - Speaker's knowledge map
|
|
188
|
+
* @returns Whether the topic passes the leverage rule
|
|
189
|
+
*/
|
|
190
|
+
function meetsLeverageRule(topic, profile, knowledge) {
|
|
191
|
+
if (profile.playerCanLeverage)
|
|
192
|
+
return true;
|
|
193
|
+
const fact = knowledge[topic];
|
|
194
|
+
if (fact && (fact.source === 'told' || fact.source === 'told by player')) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Check if a listener matches a specific audience type for a per-fact override.
|
|
201
|
+
*/
|
|
202
|
+
function checkAudienceForListener(audience, speakerTrait, listener) {
|
|
203
|
+
switch (audience) {
|
|
204
|
+
case 'anyone': return true;
|
|
205
|
+
case 'trusted': return speakerTrait.getDispositionValue(listener.id) > 0;
|
|
206
|
+
case 'allied': return hasSharedAlliance(speakerTrait, listener.trait);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
// Pace application
|
|
211
|
+
// ---------------------------------------------------------------------------
|
|
212
|
+
/**
|
|
213
|
+
* Apply pace to limit how many facts are shared per turn.
|
|
214
|
+
*/
|
|
215
|
+
function applyPace(eligibleFacts, profile, ctx) {
|
|
216
|
+
const pace = profile.pace ?? 'eager';
|
|
217
|
+
switch (pace) {
|
|
218
|
+
case 'eager':
|
|
219
|
+
// Share all eligible facts at once
|
|
220
|
+
return eligibleFacts;
|
|
221
|
+
case 'gradual':
|
|
222
|
+
// One fact per turn
|
|
223
|
+
return eligibleFacts.slice(0, 1);
|
|
224
|
+
case 'reluctant':
|
|
225
|
+
// Requires multiple turns colocated before sharing
|
|
226
|
+
if ((ctx.turnsColocated ?? 0) < 3)
|
|
227
|
+
return [];
|
|
228
|
+
return eligibleFacts.slice(0, 1);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=propagation-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation-evaluator.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/propagation/propagation-evaluator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAkEH,kDAgDC;AAlED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,SAAgB,mBAAmB,CAAC,GAAuB;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IACxB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAEhC,sCAAsC;IACtC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC5C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,iBAAiB;IACjB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CACrD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC7B,CAAC;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;IAED,0BAA0B;IAC1B,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACrD,IA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C,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,oBAAoB;YACpB,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEnC,KAAK,WAAW;YACd,mDAAmD;YACnD,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC;gBAAE,OAAO,EAAE,CAAC;YAC7C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Propagation message IDs (ADR-144)
|
|
3
|
+
*
|
|
4
|
+
* Semantic message IDs for NPC-to-NPC information propagation events.
|
|
5
|
+
* Actual text is provided by the language layer (lang-en-us).
|
|
6
|
+
*
|
|
7
|
+
* Public interface: PropagationMessages.
|
|
8
|
+
* Owner context: @sharpee/character / propagation
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Platform default message IDs for propagation visibility.
|
|
12
|
+
* Keyed by coloring; authors override per-fact via FactOverride.witnessed.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PropagationMessages: {
|
|
15
|
+
/** Neutral telling: "{speaker} mentions {topic} to {listener}." */
|
|
16
|
+
readonly WITNESSED_NEUTRAL: "character.propagation.witnessed.neutral";
|
|
17
|
+
/** Dramatic telling: "{speaker} excitedly tells {listener} about {topic}." */
|
|
18
|
+
readonly WITNESSED_DRAMATIC: "character.propagation.witnessed.dramatic";
|
|
19
|
+
/** Vague telling: "{speaker} vaguely alludes to {topic} near {listener}." */
|
|
20
|
+
readonly WITNESSED_VAGUE: "character.propagation.witnessed.vague";
|
|
21
|
+
/** Fearful telling: "{speaker} nervously whispers about {topic} to {listener}." */
|
|
22
|
+
readonly WITNESSED_FEARFUL: "character.propagation.witnessed.fearful";
|
|
23
|
+
/** Conspiratorial telling: "{speaker} leans close to {listener}, muttering about {topic}." */
|
|
24
|
+
readonly WITNESSED_CONSPIRATORIAL: "character.propagation.witnessed.conspiratorial";
|
|
25
|
+
/** Player overhears NPC-to-NPC exchange. */
|
|
26
|
+
readonly EAVESDROPPED: "character.propagation.eavesdropped";
|
|
27
|
+
};
|
|
28
|
+
/** Type for propagation message IDs. */
|
|
29
|
+
export type PropagationMessageId = (typeof PropagationMessages)[keyof typeof PropagationMessages];
|
|
30
|
+
//# sourceMappingURL=propagation-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation-messages.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/character/src/propagation/propagation-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAK9B,mEAAmE;;IAEnE,8EAA8E;;IAE9E,6EAA6E;;IAE7E,mFAAmF;;IAEnF,8FAA8F;;IAO9F,4CAA4C;;CAEpC,CAAC;AAEX,wCAAwC;AACxC,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Propagation message IDs (ADR-144)
|
|
4
|
+
*
|
|
5
|
+
* Semantic message IDs for NPC-to-NPC information propagation events.
|
|
6
|
+
* Actual text is provided by the language layer (lang-en-us).
|
|
7
|
+
*
|
|
8
|
+
* Public interface: PropagationMessages.
|
|
9
|
+
* Owner context: @sharpee/character / propagation
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PropagationMessages = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Platform default message IDs for propagation visibility.
|
|
15
|
+
* Keyed by coloring; authors override per-fact via FactOverride.witnessed.
|
|
16
|
+
*/
|
|
17
|
+
exports.PropagationMessages = {
|
|
18
|
+
// -------------------------------------------------------------------------
|
|
19
|
+
// Witnessed messages — player sees NPC-to-NPC information exchange
|
|
20
|
+
// -------------------------------------------------------------------------
|
|
21
|
+
/** Neutral telling: "{speaker} mentions {topic} to {listener}." */
|
|
22
|
+
WITNESSED_NEUTRAL: 'character.propagation.witnessed.neutral',
|
|
23
|
+
/** Dramatic telling: "{speaker} excitedly tells {listener} about {topic}." */
|
|
24
|
+
WITNESSED_DRAMATIC: 'character.propagation.witnessed.dramatic',
|
|
25
|
+
/** Vague telling: "{speaker} vaguely alludes to {topic} near {listener}." */
|
|
26
|
+
WITNESSED_VAGUE: 'character.propagation.witnessed.vague',
|
|
27
|
+
/** Fearful telling: "{speaker} nervously whispers about {topic} to {listener}." */
|
|
28
|
+
WITNESSED_FEARFUL: 'character.propagation.witnessed.fearful',
|
|
29
|
+
/** Conspiratorial telling: "{speaker} leans close to {listener}, muttering about {topic}." */
|
|
30
|
+
WITNESSED_CONSPIRATORIAL: 'character.propagation.witnessed.conspiratorial',
|
|
31
|
+
// -------------------------------------------------------------------------
|
|
32
|
+
// Eavesdropped — player overhears a full exchange
|
|
33
|
+
// -------------------------------------------------------------------------
|
|
34
|
+
/** Player overhears NPC-to-NPC exchange. */
|
|
35
|
+
EAVESDROPPED: 'character.propagation.eavesdropped',
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=propagation-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation-messages.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/character/src/propagation/propagation-messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IACjC,4EAA4E;IAC5E,mEAAmE;IACnE,4EAA4E;IAE5E,mEAAmE;IACnE,iBAAiB,EAAE,yCAAyC;IAC5D,8EAA8E;IAC9E,kBAAkB,EAAE,0CAA0C;IAC9D,6EAA6E;IAC7E,eAAe,EAAE,uCAAuC;IACxD,mFAAmF;IACnF,iBAAiB,EAAE,yCAAyC;IAC5D,8FAA8F;IAC9F,wBAAwB,EAAE,gDAAgD;IAE1E,4EAA4E;IAC5E,kDAAkD;IAClD,4EAA4E;IAE5E,4CAA4C;IAC5C,YAAY,EAAE,oCAAoC;CAC1C,CAAC"}
|