@plasius/ai-game 0.1.7 → 0.1.9

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/index.js CHANGED
@@ -1,3 +1,138 @@
1
+ // src/training-state.ts
2
+ import {
3
+ TRAINING_FEATURE_FLAG_ID,
4
+ createTrainingInstitution,
5
+ createTrainingProgressionRecord,
6
+ isMccExpressionTrack,
7
+ isTrainingTrustLevel
8
+ } from "@plasius/training";
9
+ var AI_GAME_TRAINING_STAGE_GATES = [
10
+ "system-first-awakening",
11
+ "field-repetition",
12
+ "first-social-institution",
13
+ "advanced-specialization",
14
+ "dominion-and-divine"
15
+ ];
16
+ var AI_GAME_TRAINING_TRUST_MARKER_SOURCES = [
17
+ "system",
18
+ "mission",
19
+ "institution",
20
+ "sponsor"
21
+ ];
22
+ var AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS = [
23
+ "low",
24
+ "medium",
25
+ "high"
26
+ ];
27
+ var AI_GAME_TRAINING_RECOMMENDATION_READINESS = [
28
+ "ready",
29
+ "needs-prerequisites",
30
+ "institution-gated"
31
+ ];
32
+ function freezeReadonlyArray(items) {
33
+ return Object.freeze([...items]);
34
+ }
35
+ function assertNonEmptyString(value, label) {
36
+ if (value.trim().length === 0) {
37
+ throw new Error(`${label} must be a non-empty string`);
38
+ }
39
+ }
40
+ function assertIsoTimestamp(value, label) {
41
+ assertNonEmptyString(value, label);
42
+ if (Number.isNaN(Date.parse(value))) {
43
+ throw new Error(`${label} must be an ISO-8601 timestamp`);
44
+ }
45
+ }
46
+ function isTrainingInstitutionType(value) {
47
+ return value === "school" || value === "barracks" || value === "academy" || value === "apprenticeship";
48
+ }
49
+ function isAiGameTrainingStageGate(value) {
50
+ return AI_GAME_TRAINING_STAGE_GATES.includes(value);
51
+ }
52
+ function isAiGameTrainingTrustMarkerSource(value) {
53
+ return AI_GAME_TRAINING_TRUST_MARKER_SOURCES.includes(value);
54
+ }
55
+ function isAiGameTrainingRecommendationConfidenceBand(value) {
56
+ return AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS.includes(value);
57
+ }
58
+ function isAiGameTrainingRecommendationReadiness(value) {
59
+ return AI_GAME_TRAINING_RECOMMENDATION_READINESS.includes(value);
60
+ }
61
+ function createAiGameInstitutionEligibility(input) {
62
+ assertNonEmptyString(input.institutionId, "institutionId");
63
+ if (!isTrainingInstitutionType(input.institutionType)) {
64
+ throw new Error("institutionType must be a supported training institution type");
65
+ }
66
+ if (!isMccExpressionTrack(input.track)) {
67
+ throw new Error("track must be a supported MCC expression track");
68
+ }
69
+ if (!isAiGameTrainingStageGate(input.requiredStageGate)) {
70
+ throw new Error("requiredStageGate must be a supported training stage gate");
71
+ }
72
+ if (!isTrainingTrustLevel(input.trustLevel)) {
73
+ throw new Error("trustLevel must be a supported training trust level");
74
+ }
75
+ return Object.freeze({
76
+ ...input,
77
+ unmetPrerequisiteCodes: freezeReadonlyArray(input.unmetPrerequisiteCodes),
78
+ reasonCodes: freezeReadonlyArray(input.reasonCodes)
79
+ });
80
+ }
81
+ function createAiGameTrainingTrustMarker(input) {
82
+ assertNonEmptyString(input.markerId, "markerId");
83
+ assertNonEmptyString(input.institutionId, "institutionId");
84
+ assertIsoTimestamp(input.awardedAtIso, "awardedAtIso");
85
+ if (!isTrainingTrustLevel(input.trustLevel)) {
86
+ throw new Error("trustLevel must be a supported training trust level");
87
+ }
88
+ if (!isAiGameTrainingTrustMarkerSource(input.source)) {
89
+ throw new Error("source must be a supported training trust marker source");
90
+ }
91
+ return Object.freeze({
92
+ ...input,
93
+ reasonCodes: freezeReadonlyArray(input.reasonCodes)
94
+ });
95
+ }
96
+ function createAiGameSpecializationRecommendation(input) {
97
+ assertNonEmptyString(input.recommendationId, "recommendationId");
98
+ assertNonEmptyString(input.institutionId, "institutionId");
99
+ if (!isTrainingInstitutionType(input.institutionType)) {
100
+ throw new Error("institutionType must be a supported training institution type");
101
+ }
102
+ if (!isMccExpressionTrack(input.leaning)) {
103
+ throw new Error("leaning must be a supported MCC expression track");
104
+ }
105
+ if (!isMccExpressionTrack(input.recommendedTrack)) {
106
+ throw new Error("recommendedTrack must be a supported MCC expression track");
107
+ }
108
+ if (!isAiGameTrainingRecommendationConfidenceBand(input.confidenceBand)) {
109
+ throw new Error("confidenceBand must be a supported training recommendation confidence band");
110
+ }
111
+ if (!isAiGameTrainingRecommendationReadiness(input.readiness)) {
112
+ throw new Error("readiness must be a supported training recommendation readiness");
113
+ }
114
+ return Object.freeze({
115
+ ...input,
116
+ unmetPrerequisiteCodes: freezeReadonlyArray(input.unmetPrerequisiteCodes),
117
+ reasonCodes: freezeReadonlyArray(input.reasonCodes)
118
+ });
119
+ }
120
+ function createAiGameTrainingStateSnapshot(input) {
121
+ return Object.freeze({
122
+ progression: createTrainingProgressionRecord(input.progression),
123
+ institution: createTrainingInstitution(input.institution),
124
+ eligibility: freezeReadonlyArray(
125
+ input.eligibility.map(createAiGameInstitutionEligibility)
126
+ ),
127
+ trustMarkers: freezeReadonlyArray(
128
+ input.trustMarkers.map(createAiGameTrainingTrustMarker)
129
+ ),
130
+ recommendations: freezeReadonlyArray(
131
+ input.recommendations.map(createAiGameSpecializationRecommendation)
132
+ )
133
+ });
134
+ }
135
+
1
136
  // src/world-events.ts
2
137
  function isCanonicalWorldEvent(event) {
3
138
  return event.recordType === "canonical";
@@ -843,6 +978,11 @@ export {
843
978
  AI_GAME_TASK_KINDS,
844
979
  AI_GAME_TASK_RESULTS,
845
980
  AI_GAME_TASK_RISK_CLASSES,
981
+ TRAINING_FEATURE_FLAG_ID as AI_GAME_TRAINING_INSTITUTIONS_FEATURE_FLAG_ID,
982
+ AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS,
983
+ AI_GAME_TRAINING_RECOMMENDATION_READINESS,
984
+ AI_GAME_TRAINING_STAGE_GATES,
985
+ AI_GAME_TRAINING_TRUST_MARKER_SOURCES,
846
986
  AI_GAME_TTS_CACHE_POLICIES,
847
987
  QUIET_MEASURE_AXES,
848
988
  QUIET_MEASURE_CONFIDENCE_BANDS,
@@ -857,17 +997,27 @@ export {
857
997
  QUIET_MEASURE_SIGNAL_BANDS,
858
998
  aiGameFeatureFlags,
859
999
  classifyAiGameTask,
1000
+ createAiGameInstitutionEligibility,
1001
+ createAiGameSpecializationRecommendation,
1002
+ createAiGameTrainingStateSnapshot,
1003
+ createAiGameTrainingTrustMarker,
860
1004
  createQuietMeasureJudgmentEligibility,
861
1005
  createQuietMeasureJudgmentResponse,
862
1006
  gameEventFeatureFlags,
1007
+ isAiGameTrainingRecommendationConfidenceBand,
1008
+ isAiGameTrainingRecommendationReadiness,
1009
+ isAiGameTrainingStageGate,
1010
+ isAiGameTrainingTrustMarkerSource,
863
1011
  isCandidateWorldEvent,
864
1012
  isCanonicalWorldEvent,
865
1013
  isGossipTopicActive,
866
1014
  isGossipTopicCorrected,
867
1015
  isIncidentResolved,
1016
+ isMccExpressionTrack,
868
1017
  isQuietMeasureAxis,
869
1018
  isQuietMeasureMissionProbeMode,
870
1019
  isQuietMeasureMissionResolutionShape,
1020
+ isTrainingTrustLevel,
871
1021
  listQuietMeasureMissingEvidence,
872
1022
  normalizeIncidentImpactVector,
873
1023
  packageDescriptor,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/world-events.ts","../src/gossip.ts","../src/quiet-measure.ts","../src/index.ts"],"sourcesContent":["export type Version = string;\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | readonly JsonValue[]\n | { readonly [key: string]: JsonValue };\n\nexport type GameWorldEventType =\n | \"monster.spawned\"\n | \"monster.killed\"\n | \"dungeon.created\"\n | \"dungeon.cleared\"\n | \"war.declared\"\n | \"war.resolved\"\n | \"famine.started\"\n | \"surplus.updated\"\n | \"system.checkpoint\";\n\nexport type GameEventVisibilityClass = \"global\" | \"regional\" | \"local\" | \"faction\" | \"secret\";\nexport type GameEventRecordType = \"candidate\" | \"canonical\";\nexport type GameEventSubmissionChannel = \"player\" | \"system\" | \"admin\" | \"simulation\";\nexport type GameEventActorKind = \"player\" | \"npc\" | \"monster\" | \"system\" | \"faction\" | \"environment\";\nexport type GameEventParticipantRole = \"causer\" | \"target\" | \"witness\" | \"owner\" | \"observer\";\nexport type GameEventSeverity = \"info\" | \"warning\" | \"critical\";\n\nexport interface GameEventActor {\n readonly kind: GameEventActorKind;\n readonly subjectRef: string;\n}\n\nexport interface GameEventParticipant {\n readonly role: GameEventParticipantRole;\n readonly actor: GameEventActor;\n}\n\nexport interface GameEventLocation {\n readonly world: string;\n readonly zone: string;\n readonly x?: number;\n readonly y?: number;\n readonly radiusMeters?: number;\n}\n\nexport interface GameEventCausation {\n readonly rootEventId?: string;\n readonly parentEventIds: readonly string[];\n readonly correlationId?: string;\n}\n\nexport interface GameWorldEventPayloadBase {\n readonly eventKind: GameEventSeverity;\n readonly summary: string;\n}\n\nexport interface MonsterSpawnedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"monster.spawned\";\n readonly monsterType: string;\n readonly monsterRef: string;\n}\n\nexport interface MonsterKilledPayload extends GameWorldEventPayloadBase {\n readonly kind: \"monster.killed\";\n readonly monsterRef: string;\n readonly killerRef?: string;\n readonly encounterResult: \"vanquished\" | \"escaped\" | \"failed\";\n}\n\nexport interface DungeonCreatedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"dungeon.created\";\n readonly dungeonRef: string;\n readonly dungeonType: string;\n readonly difficulty: number;\n}\n\nexport interface DungeonClearedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"dungeon.cleared\";\n readonly dungeonRef: string;\n readonly clearedByPartyRef: string;\n readonly durationSeconds: number;\n}\n\nexport interface WarDeclaredPayload extends GameWorldEventPayloadBase {\n readonly kind: \"war.declared\";\n readonly aggressorFactionRef: string;\n readonly defenderFactionRef: string;\n readonly disputedZone: string;\n}\n\nexport interface WarResolvedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"war.resolved\";\n readonly warEventRef: string;\n readonly outcome: \"ceasefire\" | \"victory\" | \"loss\" | \"draw\";\n readonly winnerFactionRef?: string;\n}\n\nexport interface FamineStartedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"famine.started\";\n readonly zoneRef: string;\n readonly severity: \"low\" | \"moderate\" | \"high\" | \"critical\";\n}\n\nexport interface SurplusUpdatedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"surplus.updated\";\n readonly commodity: string;\n readonly region: string;\n readonly previousBalance: number;\n readonly delta: number;\n}\n\nexport interface SystemCheckpointPayload extends GameWorldEventPayloadBase {\n readonly kind: \"system.checkpoint\";\n readonly sequence: string;\n readonly checkpointState: JsonValue;\n}\n\nexport type GameWorldEventPayload =\n | MonsterSpawnedPayload\n | MonsterKilledPayload\n | DungeonCreatedPayload\n | DungeonClearedPayload\n | WarDeclaredPayload\n | WarResolvedPayload\n | FamineStartedPayload\n | SurplusUpdatedPayload\n | SystemCheckpointPayload;\n\nexport interface GameWorldEventEnvelope {\n readonly eventId: string;\n readonly eventType: GameWorldEventType;\n readonly occurredAtEpochMs: number;\n readonly recordedAtEpochMs: number;\n readonly schemaVersion: string;\n readonly visibility: GameEventVisibilityClass;\n readonly location: GameEventLocation;\n readonly participants: readonly GameEventParticipant[];\n readonly causation: GameEventCausation;\n readonly source: string;\n readonly payload: GameWorldEventPayload;\n readonly tags: readonly string[];\n}\n\nexport interface GameWorldEventCandidate extends GameWorldEventEnvelope {\n readonly recordType: \"candidate\";\n readonly candidateId: string;\n readonly submittedBy?: GameEventActor;\n readonly submittedAtEpochMs: number;\n readonly submissionChannel: GameEventSubmissionChannel;\n}\n\nexport interface GameWorldEventCanonical extends GameWorldEventEnvelope {\n readonly recordType: \"canonical\";\n readonly canonicalEventId: string;\n readonly sourceCandidateId?: string;\n readonly approvedBy: string;\n readonly approvedAtEpochMs: number;\n}\n\nexport type GameWorldEvent = GameWorldEventCandidate | GameWorldEventCanonical;\n\nexport interface GameEventValidationIssue {\n readonly field: string;\n readonly message: string;\n readonly severity: GameEventSeverity;\n}\n\nexport interface GameEventValidationResult {\n readonly valid: boolean;\n readonly issues: readonly GameEventValidationIssue[];\n}\n\nexport interface GameEventSubmissionReceipt {\n readonly accepted: boolean;\n readonly candidateId: string;\n readonly eventId: string;\n readonly notes: readonly string[];\n}\n\nexport interface GameEventCommitReceipt {\n readonly committed: boolean;\n readonly eventId: string;\n readonly sequence: string;\n}\n\nexport interface ProjectionProjectorCheckpoint {\n readonly streamId: string;\n readonly lastAppliedEventOffset: number;\n readonly lastAppliedEventId: string;\n readonly eventVersion: Version;\n readonly updatedAtEpochMs: number;\n}\n\nexport interface ProjectionCheckpointStore {\n getCheckpoint(streamId: string): Promise<ProjectionProjectorCheckpoint | null>;\n setCheckpoint(checkpoint: ProjectionProjectorCheckpoint): Promise<void>;\n}\n\nexport interface WorldEventIngestionPort {\n submitCandidate(candidate: GameWorldEventCandidate): Promise<GameEventSubmissionReceipt>;\n commitCanonical(event: GameWorldEventCanonical): Promise<GameEventCommitReceipt>;\n validateCandidate(candidate: GameWorldEventCandidate): GameEventValidationResult;\n}\n\nexport interface WorldEventProjectorPort {\n readonly streamId: string;\n readonly checkpointStore: ProjectionCheckpointStore;\n project(event: GameWorldEventCanonical): Promise<void>;\n}\n\nexport type WorldIncidentImpactKey = \"security\" | \"economy\" | \"ecology\" | \"politics\" | \"morale\" | \"magic\" | \"population\";\n\nexport type WorldIncidentScope = \"local\" | \"regional\" | \"global\";\n\nexport type WorldIncidentLifecycle = \"active\" | \"resolved\" | \"superseded\" | \"expired\";\n\nexport interface WorldIncidentImpactVector {\n readonly security: number;\n readonly economy: number;\n readonly ecology: number;\n readonly politics: number;\n readonly morale: number;\n readonly magic: number;\n readonly population: number;\n}\n\nexport interface WorldIncidentResolution {\n readonly resolvedAtEpochMs: number;\n readonly closingEventRef: string;\n readonly summary: string;\n}\n\nexport interface WorldIncidentThread {\n readonly incidentId: string;\n readonly scope: WorldIncidentScope;\n readonly lifecycle: WorldIncidentLifecycle;\n readonly causeEventRef: string;\n readonly impact: WorldIncidentImpactVector;\n readonly openedAtEpochMs: number;\n readonly updatedAtEpochMs: number;\n readonly supersededBy?: string;\n readonly resolution?: WorldIncidentResolution;\n readonly affectedEventRefs: readonly string[];\n}\n\nexport interface WorldIncidentRegistry {\n readonly incidents: readonly WorldIncidentThread[];\n readonly activeCount: number;\n}\n\nexport function isCanonicalWorldEvent(event: GameWorldEvent): event is GameWorldEventCanonical {\n return event.recordType === \"canonical\";\n}\n\nexport function isCandidateWorldEvent(event: GameWorldEvent): event is GameWorldEventCandidate {\n return event.recordType === \"candidate\";\n}\n\nconst WORLD_IMPACT_SCALE_LIMIT = 100;\n\nfunction clampImpactValue(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n return Math.max(0, Math.min(WORLD_IMPACT_SCALE_LIMIT, value));\n}\n\nexport function normalizeIncidentImpactVector(\n impact: Partial<WorldIncidentImpactVector> | Record<string, number>,\n): Readonly<WorldIncidentImpactVector> {\n return Object.freeze({\n security: clampImpactValue(Number(impact.security ?? 0)),\n economy: clampImpactValue(Number(impact.economy ?? 0)),\n ecology: clampImpactValue(Number(impact.ecology ?? 0)),\n politics: clampImpactValue(Number(impact.politics ?? 0)),\n morale: clampImpactValue(Number(impact.morale ?? 0)),\n magic: clampImpactValue(Number(impact.magic ?? 0)),\n population: clampImpactValue(Number(impact.population ?? 0)),\n });\n}\n\nexport function isIncidentResolved(incident: WorldIncidentThread): boolean {\n return incident.lifecycle === \"resolved\" || incident.lifecycle === \"expired\";\n}\n","export type GossipSalience = \"low\" | \"medium\" | \"high\" | \"critical\";\nexport type GossipConfidence = \"uncertain\" | \"possible\" | \"strong\" | \"verified\";\nexport type GossipTopicStatus = \"active\" | \"corrected\" | \"resolved\" | \"stale\";\nexport type GossipAudienceSegment = \"player\" | \"npc\" | \"public\";\nexport type GossipProjectionMode = \"segment-level\" | \"npc-level\";\n\nexport interface EventSourceLink {\n readonly sourceType: \"event\" | \"incident\";\n readonly sourceId: string;\n}\n\nexport interface GossipSpeechHint {\n readonly sentenceTone: \"whisper\" | \"formal\" | \"urgent\";\n readonly localizedHintKey: string;\n}\n\nexport interface GossipTopicPayload {\n readonly factSummary: string;\n readonly certainty: number;\n readonly salience: GossipSalience;\n readonly evidenceRefs: readonly EventSourceLink[];\n readonly speechHint: GossipSpeechHint;\n}\n\nexport interface GossipTopic {\n readonly topicId: string;\n readonly status: GossipTopicStatus;\n readonly emittedAtEpochMs: number;\n readonly expiresAtEpochMs: number;\n readonly sourceLink: EventSourceLink;\n readonly sourceEventRef: string;\n readonly lineageOf?: string;\n readonly replacedBy?: string;\n readonly payload: GossipTopicPayload;\n readonly confidenceLevel: GossipConfidence;\n readonly audienceScope: \"faction\" | \"region\" | \"public\";\n}\n\nexport interface WitnessChannel {\n readonly witnessRef: string;\n readonly seenAtEpochMs: number;\n readonly confidenceWeight: number;\n}\n\nexport interface PerspectiveRule {\n readonly locality: readonly string[];\n readonly factions: readonly string[];\n readonly relationshipScore: number;\n}\n\nexport interface KnowledgeSource {\n readonly sourceType: \"segment\" | \"npc\";\n readonly sourceRef: string;\n readonly relationshipToAudience?: number;\n}\n\nexport interface GossipPerspectiveProjection {\n readonly projectionMode: GossipProjectionMode;\n readonly audienceSegment: GossipAudienceSegment;\n readonly requestedByNpcRef?: string;\n readonly locality: string;\n readonly faction: string;\n readonly segmentRules: readonly PerspectiveRule[];\n readonly witnessChannels: readonly WitnessChannel[];\n}\n\nexport interface ProjectedGossipEnvelope {\n readonly topicId: string;\n readonly visible: boolean;\n readonly redactedPayload?: GossipTopicPayload;\n readonly reasons: readonly string[];\n}\n\nexport interface GossipLifecyclePort {\n readonly topicId: string;\n load(): Promise<GossipTopic | null>;\n applyCorrection(next: GossipTopic): Promise<void>;\n markResolved(topicId: string, replacementTopicId?: string): Promise<void>;\n}\n\nexport interface GossipTopicEnvelope {\n readonly topic: GossipTopic;\n readonly topics: readonly EventSourceLink[];\n}\n\nexport function isGossipTopicActive(topic: GossipTopic, nowEpochMs = Date.now()): boolean {\n return topic.status === \"active\" && topic.expiresAtEpochMs > nowEpochMs && topic.payload.certainty >= 0.35;\n}\n\nexport function isGossipTopicCorrected(topic: GossipTopic): boolean {\n return topic.status === \"corrected\";\n}\n\nfunction matchSegmentAudience(\n sourceValue: readonly string[], targetValue: readonly string[], fallback: boolean,\n): boolean {\n if (sourceValue.length === 0 || targetValue.length === 0) {\n return fallback;\n }\n\n return sourceValue.some((value) => targetValue.includes(value));\n}\n\nexport function projectTopicForAudience(\n topic: GossipTopic,\n projection: GossipPerspectiveProjection,\n nowEpochMs = Date.now(),\n): ProjectedGossipEnvelope {\n if (!isGossipTopicActive(topic, nowEpochMs)) {\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"inactive-or-expired-topic\"],\n };\n }\n\n const hasMatchingRule = projection.segmentRules.some((rule) =>\n matchSegmentAudience(rule.locality, [projection.locality], true) &&\n matchSegmentAudience(rule.factions, [projection.faction], false)\n );\n\n if (!hasMatchingRule) {\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"audience-not-authorized\"],\n };\n }\n\n if (projection.projectionMode === \"segment-level\" && topic.audienceScope === \"public\") {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"segment-level-allowed\"],\n };\n }\n\n if (\n projection.projectionMode === \"npc-level\" &&\n projection.requestedByNpcRef &&\n topic.audienceScope === \"public\" &&\n projection.requestedByNpcRef.length > 0\n ) {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"npc-level-allowed\"],\n };\n }\n\n if (\n projection.projectionMode === \"npc-level\" &&\n projection.requestedByNpcRef &&\n topic.audienceScope !== \"public\" &&\n projection.requestedByNpcRef.length > 0\n ) {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"npc-level-allowed\"],\n };\n }\n\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"scope-constraints\"],\n };\n}\n","export const AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID =\n \"isekai.player-system.quiet-measure.enabled\";\n\nexport const QUIET_MEASURE_AXES = [\n \"selflessness\",\n \"give\",\n \"mercy\",\n \"duty\",\n \"principle\",\n \"courtesy\",\n] as const;\n\nexport type QuietMeasureAxis = (typeof QUIET_MEASURE_AXES)[number];\n\nexport const QUIET_MEASURE_CONFIDENCE_BANDS = [\"low\", \"medium\", \"high\"] as const;\n\nexport type QuietMeasureConfidenceBand =\n (typeof QUIET_MEASURE_CONFIDENCE_BANDS)[number];\n\nexport const QUIET_MEASURE_SIGNAL_BANDS = [\n \"suppressed\",\n \"latent\",\n \"present\",\n \"dominant\",\n] as const;\n\nexport type QuietMeasureSignalBand = (typeof QUIET_MEASURE_SIGNAL_BANDS)[number];\n\nexport const QUIET_MEASURE_PERSPECTIVES = [\n \"system-truth\",\n \"observed-reputation\",\n] as const;\n\nexport type QuietMeasurePerspective = (typeof QUIET_MEASURE_PERSPECTIVES)[number];\n\nexport const QUIET_MEASURE_EVIDENCE_CLASSES = [\n \"declared-intent\",\n \"costly-choice\",\n \"private-conduct\",\n \"repair-after-harm\",\n \"weak-party-treatment\",\n \"observed-pattern\",\n \"social-mask\",\n] as const;\n\nexport type QuietMeasureEvidenceClass =\n (typeof QUIET_MEASURE_EVIDENCE_CLASSES)[number];\n\nexport const QUIET_MEASURE_DERIVED_READS = [\n \"nature\",\n \"mask\",\n \"veil-gap\",\n \"restitution\",\n] as const;\n\nexport type QuietMeasureDerivedRead =\n (typeof QUIET_MEASURE_DERIVED_READS)[number];\n\nexport const QUIET_MEASURE_MISSION_PROBE_MODES = [\n \"clarify\",\n \"tempt\",\n \"reinforce\",\n] as const;\n\nexport type QuietMeasureMissionProbeMode =\n (typeof QUIET_MEASURE_MISSION_PROBE_MODES)[number];\n\nexport const QUIET_MEASURE_MISSION_RESOLUTION_SHAPES = [\n \"restorative\",\n \"dominant\",\n \"detached\",\n \"performative\",\n] as const;\n\nexport type QuietMeasureMissionResolutionShape =\n (typeof QUIET_MEASURE_MISSION_RESOLUTION_SHAPES)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_DISCLOSURES = [\n \"title-and-verdict-only\",\n] as const;\n\nexport type QuietMeasureJudgmentDisclosure =\n (typeof QUIET_MEASURE_JUDGMENT_DISCLOSURES)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_REQUESTERS = [\n \"player\",\n \"system\",\n \"operator\",\n] as const;\n\nexport type QuietMeasureJudgmentRequester =\n (typeof QUIET_MEASURE_JUDGMENT_REQUESTERS)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [\n \"repeated-meaningful-evidence\",\n \"private-or-low-witness-evidence\",\n \"costly-pressure-event\",\n] as const;\n\nexport type QuietMeasureJudgmentMissingEvidence =\n (typeof QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE)[number];\n\nexport interface QuietMeasureEvidenceWindow {\n readonly evidenceClass: QuietMeasureEvidenceClass;\n readonly sampleBand: \"sparse\" | \"growing\" | \"settled\";\n readonly includesPrivateConduct: boolean;\n readonly includesCostlyPressureEvent: boolean;\n readonly includesRepairAfterHarm: boolean;\n}\n\nexport interface QuietMeasureAxisSummary {\n readonly axis: QuietMeasureAxis;\n readonly signalBand: QuietMeasureSignalBand;\n readonly confidenceBand: QuietMeasureConfidenceBand;\n readonly evidenceWindow: QuietMeasureEvidenceWindow;\n}\n\nexport interface QuietMeasureDerivedReadSummary {\n readonly read: QuietMeasureDerivedRead;\n readonly perspective: QuietMeasurePerspective;\n readonly signalBand: QuietMeasureSignalBand;\n readonly confidenceBand: QuietMeasureConfidenceBand;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureTitleDescriptor {\n readonly titleId: string;\n readonly title: string;\n readonly verdictLabel: string;\n readonly perspective: QuietMeasurePerspective;\n readonly disclosure: QuietMeasureJudgmentDisclosure;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureMissionProbe {\n readonly probeId: string;\n readonly mode: QuietMeasureMissionProbeMode;\n readonly primaryRead: QuietMeasureDerivedRead;\n readonly supportedResolutionShapes: readonly QuietMeasureMissionResolutionShape[];\n readonly hiddenRuntime: true;\n readonly responsePerspective: QuietMeasurePerspective;\n readonly responseBias:\n | \"virtue-biased\"\n | \"vice-viable\"\n | \"ambiguity-preserving\";\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureMissionResolutionMetadata {\n readonly resolutionShape: QuietMeasureMissionResolutionShape;\n readonly surplusTendency:\n | \"compounding-trust\"\n | \"fear-and-tribute\"\n | \"ambiguity-preserving\";\n readonly worldReactionMode: \"fertile\" | \"brittle\" | \"uncertain\";\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentRequest {\n readonly subjectId: string;\n readonly requestedAtUtc: string;\n readonly requestedBy: QuietMeasureJudgmentRequester;\n readonly disclosure: QuietMeasureJudgmentDisclosure;\n}\n\nexport interface QuietMeasureJudgmentEligibility {\n readonly eligible: boolean;\n readonly repeatedMeaningfulEvidence: boolean;\n readonly includesPrivateOrLowWitnessEvidence: boolean;\n readonly includesCostlyPressureEvent: boolean;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentInsufficientEvidenceResponse {\n readonly kind: \"insufficient-evidence\";\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility & {\n readonly eligible: false;\n };\n readonly missingEvidence: readonly QuietMeasureJudgmentMissingEvidence[];\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentVerdictResponse {\n readonly kind: \"verdict\";\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility & {\n readonly eligible: true;\n };\n readonly title: QuietMeasureTitleDescriptor;\n readonly dominantReads: readonly QuietMeasureDerivedReadSummary[];\n readonly reasonCodes: readonly string[];\n}\n\nexport type QuietMeasureJudgmentResponse =\n | QuietMeasureJudgmentInsufficientEvidenceResponse\n | QuietMeasureJudgmentVerdictResponse;\n\nexport interface QuietMeasureJudgmentEligibilityInput {\n readonly repeatedMeaningfulEvidence?: boolean;\n readonly includesPrivateOrLowWitnessEvidence?: boolean;\n readonly includesCostlyPressureEvent?: boolean;\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface CreateQuietMeasureJudgmentResponseInput {\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility;\n readonly title?: QuietMeasureTitleDescriptor;\n readonly dominantReads?: readonly QuietMeasureDerivedReadSummary[];\n readonly reasonCodes?: readonly string[];\n}\n\nfunction isMember<T extends string>(\n value: string,\n members: readonly T[],\n): value is T {\n return (members as readonly string[]).includes(value);\n}\n\nfunction assertRecord(value: unknown, label: string): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(`${label} must be an object.`);\n }\n\n return value as Record<string, unknown>;\n}\n\nfunction normalizeNonEmptyString(value: unknown, label: string): string {\n if (typeof value !== \"string\") {\n throw new TypeError(`${label} must be a non-empty string.`);\n }\n\n const normalized = value.trim();\n if (normalized.length === 0) {\n throw new TypeError(`${label} must be a non-empty string.`);\n }\n\n return normalized;\n}\n\nfunction normalizeBoolean(value: unknown, label: string): boolean {\n if (typeof value !== \"boolean\") {\n throw new TypeError(`${label} must be a boolean.`);\n }\n\n return value;\n}\n\nfunction normalizeOptionalBoolean(value: unknown, fallback: boolean, label: string): boolean {\n if (value === undefined) {\n return fallback;\n }\n\n return normalizeBoolean(value, label);\n}\n\nfunction normalizeTimestamp(value: unknown, label: string): string {\n const normalized = normalizeNonEmptyString(value, label);\n const parsed = Date.parse(normalized);\n\n if (Number.isNaN(parsed)) {\n throw new TypeError(`${label} must be a valid ISO-8601 timestamp.`);\n }\n\n return normalized;\n}\n\nfunction normalizeMember<T extends string>(\n value: unknown,\n members: readonly T[],\n label: string,\n): T {\n const normalized = normalizeNonEmptyString(value, label);\n\n if (!isMember(normalized, members)) {\n throw new TypeError(`${label} must be one of: ${members.join(\", \")}.`);\n }\n\n return normalized;\n}\n\nfunction normalizeReasonCodes(value: unknown, label: string): readonly string[] {\n if (value === undefined) {\n return Object.freeze([]);\n }\n\n if (!Array.isArray(value)) {\n throw new TypeError(`${label} must be an array of strings.`);\n }\n\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== \"string\") {\n throw new TypeError(`${label}[${index}] must be a string.`);\n }\n }\n\n const normalized = value.map((entry) => entry.trim());\n if (normalized.some((entry) => entry.length === 0)) {\n throw new TypeError(`${label} must not contain blank strings.`);\n }\n\n return Object.freeze(Array.from(new Set(normalized)));\n}\n\nfunction normalizeJudgmentRequest(input: unknown): QuietMeasureJudgmentRequest {\n const request = assertRecord(input, \"Quiet Measure judgment request\");\n\n return Object.freeze({\n subjectId: normalizeNonEmptyString(\n request.subjectId,\n \"Quiet Measure judgment request subjectId\",\n ),\n requestedAtUtc: normalizeTimestamp(\n request.requestedAtUtc,\n \"Quiet Measure judgment request requestedAtUtc\",\n ),\n requestedBy: normalizeMember(\n request.requestedBy,\n QUIET_MEASURE_JUDGMENT_REQUESTERS,\n \"Quiet Measure judgment request requestedBy\",\n ),\n disclosure: normalizeMember(\n request.disclosure,\n QUIET_MEASURE_JUDGMENT_DISCLOSURES,\n \"Quiet Measure judgment request disclosure\",\n ),\n });\n}\n\nfunction normalizeJudgmentEligibility(input: unknown): QuietMeasureJudgmentEligibility {\n const eligibility = assertRecord(input, \"Quiet Measure judgment eligibility\");\n const repeatedMeaningfulEvidence = normalizeBoolean(\n eligibility.repeatedMeaningfulEvidence,\n \"Quiet Measure judgment eligibility repeatedMeaningfulEvidence\",\n );\n const includesPrivateOrLowWitnessEvidence = normalizeBoolean(\n eligibility.includesPrivateOrLowWitnessEvidence,\n \"Quiet Measure judgment eligibility includesPrivateOrLowWitnessEvidence\",\n );\n const includesCostlyPressureEvent = normalizeBoolean(\n eligibility.includesCostlyPressureEvent,\n \"Quiet Measure judgment eligibility includesCostlyPressureEvent\",\n );\n\n return Object.freeze({\n eligible:\n repeatedMeaningfulEvidence\n && includesPrivateOrLowWitnessEvidence\n && includesCostlyPressureEvent,\n repeatedMeaningfulEvidence,\n includesPrivateOrLowWitnessEvidence,\n includesCostlyPressureEvent,\n reasonCodes: normalizeReasonCodes(\n eligibility.reasonCodes,\n \"Quiet Measure eligibility reasonCodes\",\n ),\n });\n}\n\nfunction normalizeTitleDescriptor(input: unknown): QuietMeasureTitleDescriptor {\n const title = assertRecord(input, \"Quiet Measure title\");\n\n return Object.freeze({\n titleId: normalizeNonEmptyString(title.titleId, \"Quiet Measure title titleId\"),\n title: normalizeNonEmptyString(title.title, \"Quiet Measure title title\"),\n verdictLabel: normalizeNonEmptyString(\n title.verdictLabel,\n \"Quiet Measure title verdictLabel\",\n ),\n perspective: normalizeMember(\n title.perspective,\n QUIET_MEASURE_PERSPECTIVES,\n \"Quiet Measure title perspective\",\n ),\n disclosure: normalizeMember(\n title.disclosure,\n QUIET_MEASURE_JUDGMENT_DISCLOSURES,\n \"Quiet Measure title disclosure\",\n ),\n reasonCodes: normalizeReasonCodes(title.reasonCodes, \"Quiet Measure title reasonCodes\"),\n });\n}\n\nfunction normalizeDerivedReadSummary(\n input: unknown,\n index: number,\n): QuietMeasureDerivedReadSummary {\n const prefix = `Quiet Measure dominantReads[${index}]`;\n const dominantRead = assertRecord(input, prefix);\n\n return Object.freeze({\n read: normalizeMember(\n dominantRead.read,\n QUIET_MEASURE_DERIVED_READS,\n `${prefix} read`,\n ),\n perspective: normalizeMember(\n dominantRead.perspective,\n QUIET_MEASURE_PERSPECTIVES,\n `${prefix} perspective`,\n ),\n signalBand: normalizeMember(\n dominantRead.signalBand,\n QUIET_MEASURE_SIGNAL_BANDS,\n `${prefix} signalBand`,\n ),\n confidenceBand: normalizeMember(\n dominantRead.confidenceBand,\n QUIET_MEASURE_CONFIDENCE_BANDS,\n `${prefix} confidenceBand`,\n ),\n reasonCodes: normalizeReasonCodes(\n dominantRead.reasonCodes,\n `${prefix} reasonCodes`,\n ),\n });\n}\n\nfunction normalizeDominantReads(\n value: unknown,\n): readonly QuietMeasureDerivedReadSummary[] {\n if (value === undefined) {\n return Object.freeze([]);\n }\n\n if (!Array.isArray(value)) {\n throw new TypeError(\"Quiet Measure dominantReads must be an array.\");\n }\n\n return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));\n}\n\nexport function isQuietMeasureAxis(value: string): value is QuietMeasureAxis {\n return isMember(value, QUIET_MEASURE_AXES);\n}\n\nexport function isQuietMeasureMissionProbeMode(\n value: string,\n): value is QuietMeasureMissionProbeMode {\n return isMember(value, QUIET_MEASURE_MISSION_PROBE_MODES);\n}\n\nexport function isQuietMeasureMissionResolutionShape(\n value: string,\n): value is QuietMeasureMissionResolutionShape {\n return isMember(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);\n}\n\nexport function createQuietMeasureJudgmentEligibility(\n input: QuietMeasureJudgmentEligibilityInput = {},\n): QuietMeasureJudgmentEligibility {\n const repeatedMeaningfulEvidence = normalizeOptionalBoolean(\n input.repeatedMeaningfulEvidence,\n false,\n \"Quiet Measure eligibility repeatedMeaningfulEvidence\",\n );\n const includesPrivateOrLowWitnessEvidence = normalizeOptionalBoolean(\n input.includesPrivateOrLowWitnessEvidence,\n false,\n \"Quiet Measure eligibility includesPrivateOrLowWitnessEvidence\",\n );\n const includesCostlyPressureEvent = normalizeOptionalBoolean(\n input.includesCostlyPressureEvent,\n false,\n \"Quiet Measure eligibility includesCostlyPressureEvent\",\n );\n\n return Object.freeze({\n eligible:\n repeatedMeaningfulEvidence\n && includesPrivateOrLowWitnessEvidence\n && includesCostlyPressureEvent,\n repeatedMeaningfulEvidence,\n includesPrivateOrLowWitnessEvidence,\n includesCostlyPressureEvent,\n reasonCodes: normalizeReasonCodes(input.reasonCodes, \"Quiet Measure eligibility reasonCodes\"),\n });\n}\n\nexport function listQuietMeasureMissingEvidence(\n eligibility: QuietMeasureJudgmentEligibility,\n): readonly QuietMeasureJudgmentMissingEvidence[] {\n const normalizedEligibility = normalizeJudgmentEligibility(eligibility);\n const missing: QuietMeasureJudgmentMissingEvidence[] = [];\n\n if (!normalizedEligibility.repeatedMeaningfulEvidence) {\n missing.push(\"repeated-meaningful-evidence\");\n }\n\n if (!normalizedEligibility.includesPrivateOrLowWitnessEvidence) {\n missing.push(\"private-or-low-witness-evidence\");\n }\n\n if (!normalizedEligibility.includesCostlyPressureEvent) {\n missing.push(\"costly-pressure-event\");\n }\n\n return Object.freeze(missing);\n}\n\nexport function createQuietMeasureJudgmentResponse(\n input: CreateQuietMeasureJudgmentResponseInput,\n): QuietMeasureJudgmentResponse {\n const request = normalizeJudgmentRequest(input.request);\n const eligibility = normalizeJudgmentEligibility(input.eligibility);\n const missingEvidence = listQuietMeasureMissingEvidence(eligibility);\n const reasonCodes = normalizeReasonCodes(\n input.reasonCodes,\n \"Quiet Measure judgment response reasonCodes\",\n );\n const hasRequiredEvidence = missingEvidence.length === 0;\n\n if (!hasRequiredEvidence) {\n return Object.freeze({\n kind: \"insufficient-evidence\",\n request,\n eligibility: Object.freeze({\n ...eligibility,\n eligible: false,\n }),\n missingEvidence,\n reasonCodes,\n });\n }\n\n if (!input.title) {\n throw new TypeError(\n \"Quiet Measure verdict responses require a title descriptor when eligibility is met.\",\n );\n }\n\n return Object.freeze({\n kind: \"verdict\",\n request,\n eligibility: Object.freeze({\n ...eligibility,\n eligible: true,\n }),\n title: normalizeTitleDescriptor(input.title),\n dominantReads: normalizeDominantReads(input.dominantReads),\n reasonCodes,\n });\n}\n","export interface AiPackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport const AI_GAME_PACKAGE = \"@plasius/ai-game\";\nexport const AI_GAME_ENV_PREFIX = \"AI_GAME\";\nexport const AI_GAME_FEATURE_FLAG_ID = \"ai.game.enabled\";\nexport const AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID = \"ai.game.event-recorder.contracts.enabled\";\nexport const AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID = \"ai.game.event-recorder.ingestion.enabled\";\nexport const AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID = \"ai.game.event-recorder.impact.enabled\";\nexport const AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID = \"ai.game.npc-gossip.topics.enabled\";\nexport const AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID = \"ai.game.npc-gossip.perspective.enabled\";\nexport const AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID = \"ai.game.npc-gossip.lifecycle.enabled\";\n\nexport const AI_GAME_FEATURE_FLAGS = {\n workloads: AI_GAME_FEATURE_FLAG_ID,\n ttsCacheEnabled: \"ai.tts.cache.enabled\",\n ttsNearReuseEnabled: \"ai.tts.near-reuse.enabled\",\n} as const;\n\nexport type AiGameFeatureFlagKey =\n (typeof AI_GAME_FEATURE_FLAGS)[keyof typeof AI_GAME_FEATURE_FLAGS];\n\nexport type AiGameFeatureFlagSnapshot = Partial<Record<AiGameFeatureFlagKey, boolean>>;\n\nexport const AI_GAME_TASK_KINDS = [\n \"player-action-validation\",\n \"npc-action\",\n \"npc-dialogue\",\n \"gossip\",\n \"governance-feedback\",\n \"feedback\",\n \"unknown\",\n] as const;\n\nexport type AiGameTaskKind = (typeof AI_GAME_TASK_KINDS)[number];\n\nexport const AI_GAME_TASK_RISK_CLASSES = [\n \"low\",\n \"medium\",\n \"high\",\n \"critical\",\n] as const;\n\nexport type AiGameTaskRiskClass = (typeof AI_GAME_TASK_RISK_CLASSES)[number];\n\nexport const AI_GAME_TASK_AUTHORITY_BOUNDARIES = [\n \"deterministic\",\n \"human-review\",\n \"operator-review\",\n \"blocked\",\n] as const;\n\nexport type AiGameAuthorityBoundary =\n (typeof AI_GAME_TASK_AUTHORITY_BOUNDARIES)[number];\n\nexport const AI_GAME_TASK_DECISIONS = [\"allow\", \"operator-review\", \"blocked\"] as const;\n\nexport type AiGameTaskDecisionResult =\n (typeof AI_GAME_TASK_DECISIONS)[number];\n\nexport const AI_GAME_TASK_RESULTS = [\"allow\", \"defer\", \"deny\"] as const;\n\nexport type AiGameTaskResult = (typeof AI_GAME_TASK_RESULTS)[number];\n\nexport const AI_GAME_TTS_CACHE_POLICIES = [\n \"exact-cache\",\n \"near-cache\",\n \"no-cache\",\n] as const;\n\nexport type AiGameTtsCachePolicy =\n (typeof AI_GAME_TTS_CACHE_POLICIES)[number];\n\nexport const AI_GAME_ACTOR_ROLES = [\"player\", \"npc\", \"operator\", \"system\"] as const;\n\nexport type AiGameActorRole = (typeof AI_GAME_ACTOR_ROLES)[number];\n\nexport interface AiGameTaskRequest {\n readonly taskId: string;\n readonly taskText: string;\n readonly taskKind?: AiGameTaskKind;\n}\n\nexport interface AiGameTaskDecision {\n readonly taskId: string;\n readonly taskKind: AiGameTaskKind;\n readonly riskClass: AiGameTaskRiskClass;\n readonly authorityBoundary: AiGameAuthorityBoundary;\n readonly decision: AiGameTaskDecisionResult;\n readonly needsOperatorReview: boolean;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface AiGamePolicyAuditBase {\n readonly policyId: string;\n readonly policyVersion: string;\n readonly correlationId: string;\n readonly requestId?: string;\n readonly actorId?: string;\n readonly actorRole: AiGameActorRole;\n readonly evaluatedAtUtc: string;\n}\n\nexport interface ResolveAiGameTaskInput {\n readonly actorRole?: AiGameActorRole;\n readonly actorId?: string;\n readonly requestId?: string;\n readonly correlationId?: string;\n readonly policyId?: string;\n readonly policyVersion?: string;\n readonly featureFlags?: AiGameFeatureFlagSnapshot;\n readonly requests: readonly AiGameTaskRequest[];\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface AiGameTaskResolution {\n readonly requestedTasks: readonly string[];\n readonly taskDecisions: readonly AiGameTaskDecision[];\n readonly allowedTaskIds: readonly string[];\n readonly reviewTaskIds: readonly string[];\n readonly blockedTaskIds: readonly string[];\n readonly needsOperatorReview: boolean;\n readonly featureEnabled: boolean;\n readonly enabledFeatureFlags: readonly AiGameFeatureFlagKey[];\n readonly source: \"policy\" | \"policy-disabled\" | \"policy-empty\";\n readonly audit: AiGamePolicyAuditBase & {\n readonly result: AiGameTaskResult;\n };\n}\n\nexport interface ResolveAiGamePlayerAddressInput {\n readonly playerAddressText: string;\n readonly playerAlias?: string;\n readonly accountAlias?: string;\n readonly actorRole?: AiGameActorRole;\n readonly actorId?: string;\n readonly requestId?: string;\n readonly correlationId?: string;\n readonly policyId?: string;\n readonly policyVersion?: string;\n readonly featureFlags?: AiGameFeatureFlagSnapshot;\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface ResolveAiGamePlayerAddressResult {\n readonly sourceText: string;\n readonly renderText: string;\n readonly ttsCachePolicy: AiGameTtsCachePolicy;\n readonly reasonCodes: readonly string[];\n readonly enabledFeatureFlags: readonly AiGameFeatureFlagKey[];\n readonly source: \"policy\" | \"policy-disabled\" | \"policy-empty\";\n readonly audit: AiGamePolicyAuditBase & {\n readonly cachePolicy: AiGameTtsCachePolicy;\n };\n}\n\ninterface AiGameTaskProfile {\n readonly riskClass: AiGameTaskRiskClass;\n readonly authorityBoundary: AiGameAuthorityBoundary;\n readonly keywords: readonly string[];\n}\n\nconst AI_GAME_TASK_PROFILE_BY_KIND: Record<AiGameTaskKind, AiGameTaskProfile> = {\n \"player-action-validation\": {\n riskClass: \"medium\",\n authorityBoundary: \"human-review\",\n keywords: [\"move\", \"attack\", \"collect\", \"use\", \"open\", \"pick\", \"trade\", \"target\"],\n },\n \"npc-action\": {\n riskClass: \"high\",\n authorityBoundary: \"operator-review\",\n keywords: [\"summon\", \"kill\", \"ban\", \"spawn\", \"eject\", \"resurrect\", \"npc action\", \"npc-action\"],\n },\n \"npc-dialogue\": {\n riskClass: \"low\",\n authorityBoundary: \"deterministic\",\n keywords: [\"say\", \"says\", \"reply\", \"chat\", \"dialogue\", \"greet\", \"warn\", \"request\"],\n },\n gossip: {\n riskClass: \"high\",\n authorityBoundary: \"operator-review\",\n keywords: [\"rumor\", \"rumors\", \"gossip\", \"hearsay\", \"whisper\", \"spread\", \"denounce\"],\n },\n \"governance-feedback\": {\n riskClass: \"critical\",\n authorityBoundary: \"blocked\",\n keywords: [\"punish\", \"expel\", \"revoke\", \"ban\", \"forbid\", \"seize\"],\n },\n feedback: {\n riskClass: \"low\",\n authorityBoundary: \"operator-review\",\n keywords: [\"feedback\", \"rating\", \"report\", \"score\", \"review\", \"complaint\"],\n },\n unknown: {\n riskClass: \"low\",\n authorityBoundary: \"deterministic\",\n keywords: [\"\"],\n },\n};\n\nconst AI_GAME_TASK_KEYWORD_PATTERNS: Readonly<Record<AiGameTaskKind, RegExp>> = {\n \"player-action-validation\": buildTaskPattern(\n AI_GAME_TASK_PROFILE_BY_KIND[\"player-action-validation\"].keywords,\n ),\n \"npc-action\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"npc-action\"].keywords),\n \"npc-dialogue\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"npc-dialogue\"].keywords),\n gossip: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.gossip.keywords),\n \"governance-feedback\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"governance-feedback\"].keywords),\n feedback: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.feedback.keywords),\n unknown: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.unknown.keywords),\n};\n\nfunction nowIsoString(): string {\n return new Date().toISOString();\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction normalizeToken(value: string): string {\n return value.trim().replace(/\\s+/g, \" \");\n}\n\nfunction buildTaskPattern(keywords: readonly string[]): RegExp {\n return new RegExp(\n keywords.filter((keyword) => keyword.length > 0).map((keyword) => `\\\\b${escapeRegExp(keyword)}\\\\b`).join(\"|\") || \"^$\",\n \"i\",\n );\n}\n\nfunction uniqueStrings(values: readonly string[]): string[] {\n return Array.from(new Set(values.filter((value) => value.length > 0)));\n}\n\nfunction isFeatureEnabled(\n featureFlag: AiGameFeatureFlagKey,\n snapshot: AiGameFeatureFlagSnapshot = {},\n): boolean {\n return snapshot[featureFlag] === true;\n}\n\nfunction normalizeTaskText(value: string): string {\n return value.trim().replace(/\\s+/g, \" \").toLowerCase();\n}\n\nfunction isActorRole(role?: AiGameActorRole): AiGameActorRole {\n return role ?? \"player\";\n}\n\nfunction normalizeTaskKind(taskKind?: AiGameTaskKind): AiGameTaskKind | undefined {\n if (!taskKind) {\n return undefined;\n }\n\n return (AI_GAME_TASK_KINDS as readonly string[]).includes(taskKind)\n ? taskKind\n : \"unknown\";\n}\n\nexport function classifyAiGameTask(taskText: string): AiGameTaskKind {\n const normalized = normalizeTaskText(taskText);\n\n if (!normalized) {\n return \"unknown\";\n }\n\n for (const taskKind of AI_GAME_TASK_KINDS) {\n if (AI_GAME_TASK_KEYWORD_PATTERNS[taskKind].test(normalized)) {\n return taskKind;\n }\n }\n\n return \"unknown\";\n}\n\nfunction resolveTaskAuthority(taskKind: AiGameTaskKind): AiGameTaskProfile {\n return AI_GAME_TASK_PROFILE_BY_KIND[taskKind];\n}\n\nfunction resolveTaskDecision(\n taskKind: AiGameTaskKind,\n profile: AiGameTaskProfile,\n actorRole: AiGameActorRole,\n): Omit<AiGameTaskDecision, \"taskId\" | \"taskKind\" | \"riskClass\" | \"authorityBoundary\" | \"reasonCodes\"> {\n if (profile.authorityBoundary === \"blocked\") {\n return {\n decision: \"blocked\",\n needsOperatorReview: actorRole !== \"system\",\n };\n }\n\n if (profile.authorityBoundary === \"deterministic\") {\n return {\n decision: \"allow\",\n needsOperatorReview: false,\n };\n }\n\n if (actorRole === \"system\") {\n return {\n decision: \"allow\",\n needsOperatorReview: false,\n };\n }\n\n return {\n decision: \"operator-review\",\n needsOperatorReview: true,\n };\n}\n\nfunction buildRequestIds(requests: readonly AiGameTaskRequest[]): string[] {\n return uniqueStrings(requests.map((request) => request.taskId.trim()).filter(Boolean));\n}\n\n/**\n * Resolve game AI task contracts for player actions, NPC actions, gossip, and governance.\n */\nexport function resolveAiGameTaskBatch(\n input: ResolveAiGameTaskInput,\n): AiGameTaskResolution {\n const actorRole = isActorRole(input.actorRole);\n const featureEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.workloads,\n input.featureFlags,\n );\n const reasonCodes = [...(input.reasonCodes ?? [])];\n type ResolvedAiGameTaskRequest = AiGameTaskRequest & { taskKind: AiGameTaskKind };\n const requests: ResolvedAiGameTaskRequest[] = input.requests.map((request): ResolvedAiGameTaskRequest => ({\n ...request,\n taskKind: normalizeTaskKind(request.taskKind) ?? classifyAiGameTask(request.taskText),\n }));\n\n if (!featureEnabled) {\n reasonCodes.push(\"game-feature-disabled\");\n const requestIds = buildRequestIds(requests);\n\n return {\n requestedTasks: requestIds,\n taskDecisions: Object.freeze(\n requestIds.map<AiGameTaskDecision>((taskId) => ({\n taskId,\n taskKind: \"unknown\",\n riskClass: \"critical\",\n authorityBoundary: \"blocked\",\n decision: \"blocked\",\n needsOperatorReview: false,\n reasonCodes: [\"feature-disabled\"],\n })),\n ),\n allowedTaskIds: Object.freeze([] as const),\n reviewTaskIds: Object.freeze([] as const),\n blockedTaskIds: Object.freeze(requestIds),\n needsOperatorReview: false,\n featureEnabled,\n enabledFeatureFlags: [],\n source: \"policy-disabled\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: \"deny\",\n },\n };\n }\n\n if (requests.length === 0) {\n reasonCodes.push(\"game-task-empty-request\");\n\n return {\n requestedTasks: Object.freeze([] as const),\n taskDecisions: Object.freeze([] as const),\n allowedTaskIds: Object.freeze([] as const),\n reviewTaskIds: Object.freeze([] as const),\n blockedTaskIds: Object.freeze([] as const),\n needsOperatorReview: false,\n featureEnabled,\n enabledFeatureFlags: [AI_GAME_FEATURE_FLAGS.workloads],\n source: \"policy-empty\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: \"allow\",\n },\n };\n }\n const taskDecisions: AiGameTaskDecision[] = [];\n for (const request of requests) {\n const taskKind: AiGameTaskKind = request.taskKind;\n const profile = resolveTaskAuthority(taskKind);\n const decision: Omit<\n AiGameTaskDecision,\n \"taskId\" | \"taskKind\" | \"riskClass\" | \"authorityBoundary\" | \"reasonCodes\"\n > = resolveTaskDecision(taskKind, profile, actorRole);\n\n taskDecisions.push({\n taskId: request.taskId,\n taskKind,\n riskClass: profile.riskClass,\n authorityBoundary: profile.authorityBoundary,\n ...decision,\n reasonCodes: [`task-${taskKind}-${decision.decision}`],\n });\n }\n\n const allowedTaskIds: string[] = [];\n const reviewTaskIds: string[] = [];\n const blockedTaskIds: string[] = [];\n\n for (const decision of taskDecisions) {\n if (decision.decision === \"allow\") {\n allowedTaskIds.push(decision.taskId);\n } else if (decision.decision === \"operator-review\") {\n reviewTaskIds.push(decision.taskId);\n } else {\n blockedTaskIds.push(decision.taskId);\n }\n\n reasonCodes.push(...decision.reasonCodes);\n }\n\n const hasBlockedTasks = blockedTaskIds.length > 0;\n const needsOperatorReview = taskDecisions.some((decision) => decision.needsOperatorReview);\n\n return {\n requestedTasks: Object.freeze(buildRequestIds(requests)),\n taskDecisions: Object.freeze(taskDecisions),\n allowedTaskIds: Object.freeze(uniqueStrings(allowedTaskIds)),\n reviewTaskIds: Object.freeze(uniqueStrings(reviewTaskIds)),\n blockedTaskIds: Object.freeze(uniqueStrings(blockedTaskIds)),\n needsOperatorReview,\n featureEnabled,\n enabledFeatureFlags: [AI_GAME_FEATURE_FLAGS.workloads],\n source: \"policy\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: hasBlockedTasks ? \"deny\" : needsOperatorReview ? \"defer\" : \"allow\",\n },\n };\n}\n\n/**\n * Resolve cache policy for player-account text before speech rendering.\n */\nexport function resolveAiGamePlayerAddressText(\n input: ResolveAiGamePlayerAddressInput,\n): ResolveAiGamePlayerAddressResult {\n const actorRole = isActorRole(input.actorRole);\n const cacheEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.ttsCacheEnabled,\n input.featureFlags,\n );\n const sourceText = normalizeToken(input.playerAddressText);\n const reasonCodes = [...(input.reasonCodes ?? [])];\n\n if (!sourceText) {\n reasonCodes.push(\"tts-empty-text\");\n\n return {\n sourceText,\n renderText: \"\",\n ttsCachePolicy: \"no-cache\",\n reasonCodes,\n enabledFeatureFlags: [],\n source: \"policy-empty\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy: \"no-cache\",\n },\n };\n }\n\n const aliasEntries = [\n ...uniqueStrings([normalizeToken(input.playerAlias ?? \"\")])\n .filter(Boolean)\n .map((alias) => ({\n alias,\n isAccountAlias: false,\n })),\n ...uniqueStrings([normalizeToken(input.accountAlias ?? \"\")])\n .filter(Boolean)\n .map((alias) => ({\n alias,\n isAccountAlias: true,\n })),\n ];\n\n let renderText = sourceText;\n let replaced = false;\n\n for (const alias of aliasEntries) {\n const pattern = new RegExp(`\\\\b${escapeRegExp(alias.alias)}\\\\b`, \"gi\");\n\n if (pattern.test(renderText)) {\n renderText = renderText.replace(pattern, alias.isAccountAlias ? \"[ACCOUNT]\" : \"[PLAYER]\");\n replaced = true;\n reasonCodes.push(`tts-redacted-${alias.alias.toLowerCase()}`);\n }\n }\n\n const nearCacheEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.ttsNearReuseEnabled,\n input.featureFlags,\n );\n\n if (!cacheEnabled) {\n reasonCodes.push(\"tts-cache-disabled\");\n\n return {\n sourceText,\n renderText,\n ttsCachePolicy: \"no-cache\",\n reasonCodes,\n enabledFeatureFlags: [],\n source: \"policy-disabled\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy: \"no-cache\",\n },\n };\n }\n\n const cachePolicy: AiGameTtsCachePolicy =\n !replaced\n ? \"exact-cache\"\n : nearCacheEnabled\n ? \"near-cache\"\n : \"no-cache\";\n\n if (cachePolicy === \"exact-cache\") {\n reasonCodes.push(\"tts-cache-exact\");\n }\n\n if (cachePolicy === \"near-cache\") {\n reasonCodes.push(\"tts-cache-near\");\n }\n\n if (cachePolicy === \"no-cache\") {\n reasonCodes.push(\"tts-cache-not-available\");\n }\n\n return {\n sourceText,\n renderText,\n ttsCachePolicy: cachePolicy,\n reasonCodes,\n enabledFeatureFlags: Object.freeze([\n AI_GAME_FEATURE_FLAGS.workloads,\n AI_GAME_FEATURE_FLAGS.ttsCacheEnabled,\n ...(nearCacheEnabled ? [AI_GAME_FEATURE_FLAGS.ttsNearReuseEnabled] : []),\n ]),\n source: \"policy\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy,\n },\n };\n}\n\nexport const packageDescriptor: AiPackageDescriptor = Object.freeze({\n packageName: AI_GAME_PACKAGE,\n featureFlagId: AI_GAME_FEATURE_FLAG_ID,\n envPrefix: AI_GAME_ENV_PREFIX,\n summary: \"Game-domain AI contracts for event recorder, canonical world-state, and NPC gossip projections.\",\n});\n\nexport const aiGameFeatureFlags = Object.freeze({\n contract: AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID,\n ingestion: AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,\n incident: AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,\n gossipTopics: AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,\n gossipPerspective: AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,\n gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,\n});\n\nexport const gameEventFeatureFlags = Object.freeze([\n aiGameFeatureFlags.contract,\n aiGameFeatureFlags.ingestion,\n aiGameFeatureFlags.incident,\n aiGameFeatureFlags.gossipTopics,\n aiGameFeatureFlags.gossipPerspective,\n aiGameFeatureFlags.gossipLifecycle,\n]);\n\nexport {\n isCanonicalWorldEvent,\n isCandidateWorldEvent,\n isIncidentResolved,\n normalizeIncidentImpactVector,\n} from \"./world-events.js\";\n\nexport {\n isGossipTopicActive,\n isGossipTopicCorrected,\n projectTopicForAudience,\n} from \"./gossip.js\";\n\nexport {\n AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,\n createQuietMeasureJudgmentEligibility,\n createQuietMeasureJudgmentResponse,\n isQuietMeasureAxis,\n isQuietMeasureMissionProbeMode,\n isQuietMeasureMissionResolutionShape,\n listQuietMeasureMissingEvidence,\n} from \"./quiet-measure.js\";\n\nexport * from \"./world-events.js\";\nexport * from \"./gossip.js\";\nexport * from \"./quiet-measure.js\";\n"],"mappings":";AA0PO,SAAS,sBAAsB,OAAyD;AAC7F,SAAO,MAAM,eAAe;AAC9B;AAEO,SAAS,sBAAsB,OAAyD;AAC7F,SAAO,MAAM,eAAe;AAC9B;AAEA,IAAM,2BAA2B;AAEjC,SAAS,iBAAiB,OAAuB;AA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wB,OAAO,OAAO;AAAA,EACjD,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/training-state.ts","../src/world-events.ts","../src/gossip.ts","../src/quiet-measure.ts","../src/index.ts"],"sourcesContent":["import {\n TRAINING_FEATURE_FLAG_ID,\n createTrainingInstitution,\n createTrainingProgressionRecord,\n isMccExpressionTrack,\n isTrainingTrustLevel,\n type MccExpressionTrack,\n type TrainingInstitution,\n type TrainingInstitutionType,\n type TrainingProgressionRecord,\n type TrainingTrustLevel,\n} from \"@plasius/training\";\n\nexport {\n isMccExpressionTrack,\n isTrainingTrustLevel,\n TRAINING_FEATURE_FLAG_ID as AI_GAME_TRAINING_INSTITUTIONS_FEATURE_FLAG_ID,\n};\n\nexport type {\n MccExpressionTrack as AiGameTrainingSpecializationLeaning,\n TrainingInstitution as AiGameTrainingInstitution,\n TrainingInstitutionType as AiGameTrainingInstitutionType,\n TrainingProgressionRecord as AiGameTrainingState,\n TrainingTrustLevel as AiGameTrainingTrustLevel,\n};\n\nexport const AI_GAME_TRAINING_STAGE_GATES = [\n \"system-first-awakening\",\n \"field-repetition\",\n \"first-social-institution\",\n \"advanced-specialization\",\n \"dominion-and-divine\",\n] as const;\n\nexport type AiGameTrainingStageGate =\n (typeof AI_GAME_TRAINING_STAGE_GATES)[number];\n\nexport const AI_GAME_TRAINING_TRUST_MARKER_SOURCES = [\n \"system\",\n \"mission\",\n \"institution\",\n \"sponsor\",\n] as const;\n\nexport type AiGameTrainingTrustMarkerSource =\n (typeof AI_GAME_TRAINING_TRUST_MARKER_SOURCES)[number];\n\nexport const AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS = [\n \"low\",\n \"medium\",\n \"high\",\n] as const;\n\nexport type AiGameTrainingRecommendationConfidenceBand =\n (typeof AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS)[number];\n\nexport const AI_GAME_TRAINING_RECOMMENDATION_READINESS = [\n \"ready\",\n \"needs-prerequisites\",\n \"institution-gated\",\n] as const;\n\nexport type AiGameTrainingRecommendationReadiness =\n (typeof AI_GAME_TRAINING_RECOMMENDATION_READINESS)[number];\n\nexport interface AiGameInstitutionEligibility {\n readonly institutionId: string;\n readonly institutionType: TrainingInstitutionType;\n readonly track: MccExpressionTrack;\n readonly eligible: boolean;\n readonly requiredStageGate: AiGameTrainingStageGate;\n readonly trustLevel: TrainingTrustLevel;\n readonly unmetPrerequisiteCodes: readonly string[];\n readonly reasonCodes: readonly string[];\n}\n\nexport interface AiGameTrainingTrustMarker {\n readonly markerId: string;\n readonly institutionId: string;\n readonly trustLevel: TrainingTrustLevel;\n readonly source: AiGameTrainingTrustMarkerSource;\n readonly awardedAtIso: string;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface AiGameSpecializationRecommendation {\n readonly recommendationId: string;\n readonly institutionId: string;\n readonly institutionType: TrainingInstitutionType;\n readonly leaning: MccExpressionTrack;\n readonly recommendedTrack: MccExpressionTrack;\n readonly confidenceBand: AiGameTrainingRecommendationConfidenceBand;\n readonly readiness: AiGameTrainingRecommendationReadiness;\n readonly unmetPrerequisiteCodes: readonly string[];\n readonly reasonCodes: readonly string[];\n}\n\nexport interface AiGameTrainingStateSnapshot {\n readonly progression: TrainingProgressionRecord;\n readonly institution: TrainingInstitution;\n readonly eligibility: readonly AiGameInstitutionEligibility[];\n readonly trustMarkers: readonly AiGameTrainingTrustMarker[];\n readonly recommendations: readonly AiGameSpecializationRecommendation[];\n}\n\nfunction freezeReadonlyArray<T>(items: readonly T[]): readonly T[] {\n return Object.freeze([...items]);\n}\n\nfunction assertNonEmptyString(value: string, label: string): void {\n if (value.trim().length === 0) {\n throw new Error(`${label} must be a non-empty string`);\n }\n}\n\nfunction assertIsoTimestamp(value: string, label: string): void {\n assertNonEmptyString(value, label);\n\n if (Number.isNaN(Date.parse(value))) {\n throw new Error(`${label} must be an ISO-8601 timestamp`);\n }\n}\n\nfunction isTrainingInstitutionType(value: string): value is TrainingInstitutionType {\n return value === \"school\"\n || value === \"barracks\"\n || value === \"academy\"\n || value === \"apprenticeship\";\n}\n\nexport function isAiGameTrainingStageGate(\n value: string,\n): value is AiGameTrainingStageGate {\n return (AI_GAME_TRAINING_STAGE_GATES as readonly string[]).includes(value);\n}\n\nexport function isAiGameTrainingTrustMarkerSource(\n value: string,\n): value is AiGameTrainingTrustMarkerSource {\n return (AI_GAME_TRAINING_TRUST_MARKER_SOURCES as readonly string[]).includes(value);\n}\n\nexport function isAiGameTrainingRecommendationConfidenceBand(\n value: string,\n): value is AiGameTrainingRecommendationConfidenceBand {\n return (AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS as readonly string[]).includes(value);\n}\n\nexport function isAiGameTrainingRecommendationReadiness(\n value: string,\n): value is AiGameTrainingRecommendationReadiness {\n return (AI_GAME_TRAINING_RECOMMENDATION_READINESS as readonly string[]).includes(value);\n}\n\nexport function createAiGameInstitutionEligibility(\n input: AiGameInstitutionEligibility,\n): AiGameInstitutionEligibility {\n assertNonEmptyString(input.institutionId, \"institutionId\");\n\n if (!isTrainingInstitutionType(input.institutionType)) {\n throw new Error(\"institutionType must be a supported training institution type\");\n }\n\n if (!isMccExpressionTrack(input.track)) {\n throw new Error(\"track must be a supported MCC expression track\");\n }\n\n if (!isAiGameTrainingStageGate(input.requiredStageGate)) {\n throw new Error(\"requiredStageGate must be a supported training stage gate\");\n }\n\n if (!isTrainingTrustLevel(input.trustLevel)) {\n throw new Error(\"trustLevel must be a supported training trust level\");\n }\n\n return Object.freeze({\n ...input,\n unmetPrerequisiteCodes: freezeReadonlyArray(input.unmetPrerequisiteCodes),\n reasonCodes: freezeReadonlyArray(input.reasonCodes),\n });\n}\n\nexport function createAiGameTrainingTrustMarker(\n input: AiGameTrainingTrustMarker,\n): AiGameTrainingTrustMarker {\n assertNonEmptyString(input.markerId, \"markerId\");\n assertNonEmptyString(input.institutionId, \"institutionId\");\n assertIsoTimestamp(input.awardedAtIso, \"awardedAtIso\");\n\n if (!isTrainingTrustLevel(input.trustLevel)) {\n throw new Error(\"trustLevel must be a supported training trust level\");\n }\n\n if (!isAiGameTrainingTrustMarkerSource(input.source)) {\n throw new Error(\"source must be a supported training trust marker source\");\n }\n\n return Object.freeze({\n ...input,\n reasonCodes: freezeReadonlyArray(input.reasonCodes),\n });\n}\n\nexport function createAiGameSpecializationRecommendation(\n input: AiGameSpecializationRecommendation,\n): AiGameSpecializationRecommendation {\n assertNonEmptyString(input.recommendationId, \"recommendationId\");\n assertNonEmptyString(input.institutionId, \"institutionId\");\n\n if (!isTrainingInstitutionType(input.institutionType)) {\n throw new Error(\"institutionType must be a supported training institution type\");\n }\n\n if (!isMccExpressionTrack(input.leaning)) {\n throw new Error(\"leaning must be a supported MCC expression track\");\n }\n\n if (!isMccExpressionTrack(input.recommendedTrack)) {\n throw new Error(\"recommendedTrack must be a supported MCC expression track\");\n }\n\n if (!isAiGameTrainingRecommendationConfidenceBand(input.confidenceBand)) {\n throw new Error(\"confidenceBand must be a supported training recommendation confidence band\");\n }\n\n if (!isAiGameTrainingRecommendationReadiness(input.readiness)) {\n throw new Error(\"readiness must be a supported training recommendation readiness\");\n }\n\n return Object.freeze({\n ...input,\n unmetPrerequisiteCodes: freezeReadonlyArray(input.unmetPrerequisiteCodes),\n reasonCodes: freezeReadonlyArray(input.reasonCodes),\n });\n}\n\nexport function createAiGameTrainingStateSnapshot(\n input: AiGameTrainingStateSnapshot,\n): AiGameTrainingStateSnapshot {\n return Object.freeze({\n progression: createTrainingProgressionRecord(input.progression),\n institution: createTrainingInstitution(input.institution),\n eligibility: freezeReadonlyArray(\n input.eligibility.map(createAiGameInstitutionEligibility),\n ),\n trustMarkers: freezeReadonlyArray(\n input.trustMarkers.map(createAiGameTrainingTrustMarker),\n ),\n recommendations: freezeReadonlyArray(\n input.recommendations.map(createAiGameSpecializationRecommendation),\n ),\n });\n}\n","export type Version = string;\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | readonly JsonValue[]\n | { readonly [key: string]: JsonValue };\n\nexport type GameWorldEventType =\n | \"monster.spawned\"\n | \"monster.killed\"\n | \"dungeon.created\"\n | \"dungeon.cleared\"\n | \"war.declared\"\n | \"war.resolved\"\n | \"famine.started\"\n | \"surplus.updated\"\n | \"system.checkpoint\";\n\nexport type GameEventVisibilityClass = \"global\" | \"regional\" | \"local\" | \"faction\" | \"secret\";\nexport type GameEventRecordType = \"candidate\" | \"canonical\";\nexport type GameEventSubmissionChannel = \"player\" | \"system\" | \"admin\" | \"simulation\";\nexport type GameEventActorKind = \"player\" | \"npc\" | \"monster\" | \"system\" | \"faction\" | \"environment\";\nexport type GameEventParticipantRole = \"causer\" | \"target\" | \"witness\" | \"owner\" | \"observer\";\nexport type GameEventSeverity = \"info\" | \"warning\" | \"critical\";\n\nexport interface GameEventActor {\n readonly kind: GameEventActorKind;\n readonly subjectRef: string;\n}\n\nexport interface GameEventParticipant {\n readonly role: GameEventParticipantRole;\n readonly actor: GameEventActor;\n}\n\nexport interface GameEventLocation {\n readonly world: string;\n readonly zone: string;\n readonly x?: number;\n readonly y?: number;\n readonly radiusMeters?: number;\n}\n\nexport interface GameEventCausation {\n readonly rootEventId?: string;\n readonly parentEventIds: readonly string[];\n readonly correlationId?: string;\n}\n\nexport interface GameWorldEventPayloadBase {\n readonly eventKind: GameEventSeverity;\n readonly summary: string;\n}\n\nexport interface MonsterSpawnedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"monster.spawned\";\n readonly monsterType: string;\n readonly monsterRef: string;\n}\n\nexport interface MonsterKilledPayload extends GameWorldEventPayloadBase {\n readonly kind: \"monster.killed\";\n readonly monsterRef: string;\n readonly killerRef?: string;\n readonly encounterResult: \"vanquished\" | \"escaped\" | \"failed\";\n}\n\nexport interface DungeonCreatedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"dungeon.created\";\n readonly dungeonRef: string;\n readonly dungeonType: string;\n readonly difficulty: number;\n}\n\nexport interface DungeonClearedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"dungeon.cleared\";\n readonly dungeonRef: string;\n readonly clearedByPartyRef: string;\n readonly durationSeconds: number;\n}\n\nexport interface WarDeclaredPayload extends GameWorldEventPayloadBase {\n readonly kind: \"war.declared\";\n readonly aggressorFactionRef: string;\n readonly defenderFactionRef: string;\n readonly disputedZone: string;\n}\n\nexport interface WarResolvedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"war.resolved\";\n readonly warEventRef: string;\n readonly outcome: \"ceasefire\" | \"victory\" | \"loss\" | \"draw\";\n readonly winnerFactionRef?: string;\n}\n\nexport interface FamineStartedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"famine.started\";\n readonly zoneRef: string;\n readonly severity: \"low\" | \"moderate\" | \"high\" | \"critical\";\n}\n\nexport interface SurplusUpdatedPayload extends GameWorldEventPayloadBase {\n readonly kind: \"surplus.updated\";\n readonly commodity: string;\n readonly region: string;\n readonly previousBalance: number;\n readonly delta: number;\n}\n\nexport interface SystemCheckpointPayload extends GameWorldEventPayloadBase {\n readonly kind: \"system.checkpoint\";\n readonly sequence: string;\n readonly checkpointState: JsonValue;\n}\n\nexport type GameWorldEventPayload =\n | MonsterSpawnedPayload\n | MonsterKilledPayload\n | DungeonCreatedPayload\n | DungeonClearedPayload\n | WarDeclaredPayload\n | WarResolvedPayload\n | FamineStartedPayload\n | SurplusUpdatedPayload\n | SystemCheckpointPayload;\n\nexport interface GameWorldEventEnvelope {\n readonly eventId: string;\n readonly eventType: GameWorldEventType;\n readonly occurredAtEpochMs: number;\n readonly recordedAtEpochMs: number;\n readonly schemaVersion: string;\n readonly visibility: GameEventVisibilityClass;\n readonly location: GameEventLocation;\n readonly participants: readonly GameEventParticipant[];\n readonly causation: GameEventCausation;\n readonly source: string;\n readonly payload: GameWorldEventPayload;\n readonly tags: readonly string[];\n}\n\nexport interface GameWorldEventCandidate extends GameWorldEventEnvelope {\n readonly recordType: \"candidate\";\n readonly candidateId: string;\n readonly submittedBy?: GameEventActor;\n readonly submittedAtEpochMs: number;\n readonly submissionChannel: GameEventSubmissionChannel;\n}\n\nexport interface GameWorldEventCanonical extends GameWorldEventEnvelope {\n readonly recordType: \"canonical\";\n readonly canonicalEventId: string;\n readonly sourceCandidateId?: string;\n readonly approvedBy: string;\n readonly approvedAtEpochMs: number;\n}\n\nexport type GameWorldEvent = GameWorldEventCandidate | GameWorldEventCanonical;\n\nexport interface GameEventValidationIssue {\n readonly field: string;\n readonly message: string;\n readonly severity: GameEventSeverity;\n}\n\nexport interface GameEventValidationResult {\n readonly valid: boolean;\n readonly issues: readonly GameEventValidationIssue[];\n}\n\nexport interface GameEventSubmissionReceipt {\n readonly accepted: boolean;\n readonly candidateId: string;\n readonly eventId: string;\n readonly notes: readonly string[];\n}\n\nexport interface GameEventCommitReceipt {\n readonly committed: boolean;\n readonly eventId: string;\n readonly sequence: string;\n}\n\nexport interface ProjectionProjectorCheckpoint {\n readonly streamId: string;\n readonly lastAppliedEventOffset: number;\n readonly lastAppliedEventId: string;\n readonly eventVersion: Version;\n readonly updatedAtEpochMs: number;\n}\n\nexport interface ProjectionCheckpointStore {\n getCheckpoint(streamId: string): Promise<ProjectionProjectorCheckpoint | null>;\n setCheckpoint(checkpoint: ProjectionProjectorCheckpoint): Promise<void>;\n}\n\nexport interface WorldEventIngestionPort {\n submitCandidate(candidate: GameWorldEventCandidate): Promise<GameEventSubmissionReceipt>;\n commitCanonical(event: GameWorldEventCanonical): Promise<GameEventCommitReceipt>;\n validateCandidate(candidate: GameWorldEventCandidate): GameEventValidationResult;\n}\n\nexport interface WorldEventProjectorPort {\n readonly streamId: string;\n readonly checkpointStore: ProjectionCheckpointStore;\n project(event: GameWorldEventCanonical): Promise<void>;\n}\n\nexport type WorldIncidentImpactKey = \"security\" | \"economy\" | \"ecology\" | \"politics\" | \"morale\" | \"magic\" | \"population\";\n\nexport type WorldIncidentScope = \"local\" | \"regional\" | \"global\";\n\nexport type WorldIncidentLifecycle = \"active\" | \"resolved\" | \"superseded\" | \"expired\";\n\nexport interface WorldIncidentImpactVector {\n readonly security: number;\n readonly economy: number;\n readonly ecology: number;\n readonly politics: number;\n readonly morale: number;\n readonly magic: number;\n readonly population: number;\n}\n\nexport interface WorldIncidentResolution {\n readonly resolvedAtEpochMs: number;\n readonly closingEventRef: string;\n readonly summary: string;\n}\n\nexport interface WorldIncidentThread {\n readonly incidentId: string;\n readonly scope: WorldIncidentScope;\n readonly lifecycle: WorldIncidentLifecycle;\n readonly causeEventRef: string;\n readonly impact: WorldIncidentImpactVector;\n readonly openedAtEpochMs: number;\n readonly updatedAtEpochMs: number;\n readonly supersededBy?: string;\n readonly resolution?: WorldIncidentResolution;\n readonly affectedEventRefs: readonly string[];\n}\n\nexport interface WorldIncidentRegistry {\n readonly incidents: readonly WorldIncidentThread[];\n readonly activeCount: number;\n}\n\nexport function isCanonicalWorldEvent(event: GameWorldEvent): event is GameWorldEventCanonical {\n return event.recordType === \"canonical\";\n}\n\nexport function isCandidateWorldEvent(event: GameWorldEvent): event is GameWorldEventCandidate {\n return event.recordType === \"candidate\";\n}\n\nconst WORLD_IMPACT_SCALE_LIMIT = 100;\n\nfunction clampImpactValue(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n return Math.max(0, Math.min(WORLD_IMPACT_SCALE_LIMIT, value));\n}\n\nexport function normalizeIncidentImpactVector(\n impact: Partial<WorldIncidentImpactVector> | Record<string, number>,\n): Readonly<WorldIncidentImpactVector> {\n return Object.freeze({\n security: clampImpactValue(Number(impact.security ?? 0)),\n economy: clampImpactValue(Number(impact.economy ?? 0)),\n ecology: clampImpactValue(Number(impact.ecology ?? 0)),\n politics: clampImpactValue(Number(impact.politics ?? 0)),\n morale: clampImpactValue(Number(impact.morale ?? 0)),\n magic: clampImpactValue(Number(impact.magic ?? 0)),\n population: clampImpactValue(Number(impact.population ?? 0)),\n });\n}\n\nexport function isIncidentResolved(incident: WorldIncidentThread): boolean {\n return incident.lifecycle === \"resolved\" || incident.lifecycle === \"expired\";\n}\n","export type GossipSalience = \"low\" | \"medium\" | \"high\" | \"critical\";\nexport type GossipConfidence = \"uncertain\" | \"possible\" | \"strong\" | \"verified\";\nexport type GossipTopicStatus = \"active\" | \"corrected\" | \"resolved\" | \"stale\";\nexport type GossipAudienceSegment = \"player\" | \"npc\" | \"public\";\nexport type GossipProjectionMode = \"segment-level\" | \"npc-level\";\n\nexport interface EventSourceLink {\n readonly sourceType: \"event\" | \"incident\";\n readonly sourceId: string;\n}\n\nexport interface GossipSpeechHint {\n readonly sentenceTone: \"whisper\" | \"formal\" | \"urgent\";\n readonly localizedHintKey: string;\n}\n\nexport interface GossipTopicPayload {\n readonly factSummary: string;\n readonly certainty: number;\n readonly salience: GossipSalience;\n readonly evidenceRefs: readonly EventSourceLink[];\n readonly speechHint: GossipSpeechHint;\n}\n\nexport interface GossipTopic {\n readonly topicId: string;\n readonly status: GossipTopicStatus;\n readonly emittedAtEpochMs: number;\n readonly expiresAtEpochMs: number;\n readonly sourceLink: EventSourceLink;\n readonly sourceEventRef: string;\n readonly lineageOf?: string;\n readonly replacedBy?: string;\n readonly payload: GossipTopicPayload;\n readonly confidenceLevel: GossipConfidence;\n readonly audienceScope: \"faction\" | \"region\" | \"public\";\n}\n\nexport interface WitnessChannel {\n readonly witnessRef: string;\n readonly seenAtEpochMs: number;\n readonly confidenceWeight: number;\n}\n\nexport interface PerspectiveRule {\n readonly locality: readonly string[];\n readonly factions: readonly string[];\n readonly relationshipScore: number;\n}\n\nexport interface KnowledgeSource {\n readonly sourceType: \"segment\" | \"npc\";\n readonly sourceRef: string;\n readonly relationshipToAudience?: number;\n}\n\nexport interface GossipPerspectiveProjection {\n readonly projectionMode: GossipProjectionMode;\n readonly audienceSegment: GossipAudienceSegment;\n readonly requestedByNpcRef?: string;\n readonly locality: string;\n readonly faction: string;\n readonly segmentRules: readonly PerspectiveRule[];\n readonly witnessChannels: readonly WitnessChannel[];\n}\n\nexport interface ProjectedGossipEnvelope {\n readonly topicId: string;\n readonly visible: boolean;\n readonly redactedPayload?: GossipTopicPayload;\n readonly reasons: readonly string[];\n}\n\nexport interface GossipLifecyclePort {\n readonly topicId: string;\n load(): Promise<GossipTopic | null>;\n applyCorrection(next: GossipTopic): Promise<void>;\n markResolved(topicId: string, replacementTopicId?: string): Promise<void>;\n}\n\nexport interface GossipTopicEnvelope {\n readonly topic: GossipTopic;\n readonly topics: readonly EventSourceLink[];\n}\n\nexport function isGossipTopicActive(topic: GossipTopic, nowEpochMs = Date.now()): boolean {\n return topic.status === \"active\" && topic.expiresAtEpochMs > nowEpochMs && topic.payload.certainty >= 0.35;\n}\n\nexport function isGossipTopicCorrected(topic: GossipTopic): boolean {\n return topic.status === \"corrected\";\n}\n\nfunction matchSegmentAudience(\n sourceValue: readonly string[], targetValue: readonly string[], fallback: boolean,\n): boolean {\n if (sourceValue.length === 0 || targetValue.length === 0) {\n return fallback;\n }\n\n return sourceValue.some((value) => targetValue.includes(value));\n}\n\nexport function projectTopicForAudience(\n topic: GossipTopic,\n projection: GossipPerspectiveProjection,\n nowEpochMs = Date.now(),\n): ProjectedGossipEnvelope {\n if (!isGossipTopicActive(topic, nowEpochMs)) {\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"inactive-or-expired-topic\"],\n };\n }\n\n const hasMatchingRule = projection.segmentRules.some((rule) =>\n matchSegmentAudience(rule.locality, [projection.locality], true) &&\n matchSegmentAudience(rule.factions, [projection.faction], false)\n );\n\n if (!hasMatchingRule) {\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"audience-not-authorized\"],\n };\n }\n\n if (projection.projectionMode === \"segment-level\" && topic.audienceScope === \"public\") {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"segment-level-allowed\"],\n };\n }\n\n if (\n projection.projectionMode === \"npc-level\" &&\n projection.requestedByNpcRef &&\n topic.audienceScope === \"public\" &&\n projection.requestedByNpcRef.length > 0\n ) {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"npc-level-allowed\"],\n };\n }\n\n if (\n projection.projectionMode === \"npc-level\" &&\n projection.requestedByNpcRef &&\n topic.audienceScope !== \"public\" &&\n projection.requestedByNpcRef.length > 0\n ) {\n return {\n topicId: topic.topicId,\n visible: true,\n redactedPayload: topic.payload,\n reasons: [\"npc-level-allowed\"],\n };\n }\n\n return {\n topicId: topic.topicId,\n visible: false,\n reasons: [\"scope-constraints\"],\n };\n}\n","export const AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID =\n \"isekai.player-system.quiet-measure.enabled\";\n\nexport const QUIET_MEASURE_AXES = [\n \"selflessness\",\n \"give\",\n \"mercy\",\n \"duty\",\n \"principle\",\n \"courtesy\",\n] as const;\n\nexport type QuietMeasureAxis = (typeof QUIET_MEASURE_AXES)[number];\n\nexport const QUIET_MEASURE_CONFIDENCE_BANDS = [\"low\", \"medium\", \"high\"] as const;\n\nexport type QuietMeasureConfidenceBand =\n (typeof QUIET_MEASURE_CONFIDENCE_BANDS)[number];\n\nexport const QUIET_MEASURE_SIGNAL_BANDS = [\n \"suppressed\",\n \"latent\",\n \"present\",\n \"dominant\",\n] as const;\n\nexport type QuietMeasureSignalBand = (typeof QUIET_MEASURE_SIGNAL_BANDS)[number];\n\nexport const QUIET_MEASURE_PERSPECTIVES = [\n \"system-truth\",\n \"observed-reputation\",\n] as const;\n\nexport type QuietMeasurePerspective = (typeof QUIET_MEASURE_PERSPECTIVES)[number];\n\nexport const QUIET_MEASURE_EVIDENCE_CLASSES = [\n \"declared-intent\",\n \"costly-choice\",\n \"private-conduct\",\n \"repair-after-harm\",\n \"weak-party-treatment\",\n \"observed-pattern\",\n \"social-mask\",\n] as const;\n\nexport type QuietMeasureEvidenceClass =\n (typeof QUIET_MEASURE_EVIDENCE_CLASSES)[number];\n\nexport const QUIET_MEASURE_DERIVED_READS = [\n \"nature\",\n \"mask\",\n \"veil-gap\",\n \"restitution\",\n] as const;\n\nexport type QuietMeasureDerivedRead =\n (typeof QUIET_MEASURE_DERIVED_READS)[number];\n\nexport const QUIET_MEASURE_MISSION_PROBE_MODES = [\n \"clarify\",\n \"tempt\",\n \"reinforce\",\n] as const;\n\nexport type QuietMeasureMissionProbeMode =\n (typeof QUIET_MEASURE_MISSION_PROBE_MODES)[number];\n\nexport const QUIET_MEASURE_MISSION_RESOLUTION_SHAPES = [\n \"restorative\",\n \"dominant\",\n \"detached\",\n \"performative\",\n] as const;\n\nexport type QuietMeasureMissionResolutionShape =\n (typeof QUIET_MEASURE_MISSION_RESOLUTION_SHAPES)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_DISCLOSURES = [\n \"title-and-verdict-only\",\n] as const;\n\nexport type QuietMeasureJudgmentDisclosure =\n (typeof QUIET_MEASURE_JUDGMENT_DISCLOSURES)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_REQUESTERS = [\n \"player\",\n \"system\",\n \"operator\",\n] as const;\n\nexport type QuietMeasureJudgmentRequester =\n (typeof QUIET_MEASURE_JUDGMENT_REQUESTERS)[number];\n\nexport const QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [\n \"repeated-meaningful-evidence\",\n \"private-or-low-witness-evidence\",\n \"costly-pressure-event\",\n] as const;\n\nexport type QuietMeasureJudgmentMissingEvidence =\n (typeof QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE)[number];\n\nexport interface QuietMeasureEvidenceWindow {\n readonly evidenceClass: QuietMeasureEvidenceClass;\n readonly sampleBand: \"sparse\" | \"growing\" | \"settled\";\n readonly includesPrivateConduct: boolean;\n readonly includesCostlyPressureEvent: boolean;\n readonly includesRepairAfterHarm: boolean;\n}\n\nexport interface QuietMeasureAxisSummary {\n readonly axis: QuietMeasureAxis;\n readonly signalBand: QuietMeasureSignalBand;\n readonly confidenceBand: QuietMeasureConfidenceBand;\n readonly evidenceWindow: QuietMeasureEvidenceWindow;\n}\n\nexport interface QuietMeasureDerivedReadSummary {\n readonly read: QuietMeasureDerivedRead;\n readonly perspective: QuietMeasurePerspective;\n readonly signalBand: QuietMeasureSignalBand;\n readonly confidenceBand: QuietMeasureConfidenceBand;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureTitleDescriptor {\n readonly titleId: string;\n readonly title: string;\n readonly verdictLabel: string;\n readonly perspective: QuietMeasurePerspective;\n readonly disclosure: QuietMeasureJudgmentDisclosure;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureMissionProbe {\n readonly probeId: string;\n readonly mode: QuietMeasureMissionProbeMode;\n readonly primaryRead: QuietMeasureDerivedRead;\n readonly supportedResolutionShapes: readonly QuietMeasureMissionResolutionShape[];\n readonly hiddenRuntime: true;\n readonly responsePerspective: QuietMeasurePerspective;\n readonly responseBias:\n | \"virtue-biased\"\n | \"vice-viable\"\n | \"ambiguity-preserving\";\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureMissionResolutionMetadata {\n readonly resolutionShape: QuietMeasureMissionResolutionShape;\n readonly surplusTendency:\n | \"compounding-trust\"\n | \"fear-and-tribute\"\n | \"ambiguity-preserving\";\n readonly worldReactionMode: \"fertile\" | \"brittle\" | \"uncertain\";\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentRequest {\n readonly subjectId: string;\n readonly requestedAtUtc: string;\n readonly requestedBy: QuietMeasureJudgmentRequester;\n readonly disclosure: QuietMeasureJudgmentDisclosure;\n}\n\nexport interface QuietMeasureJudgmentEligibility {\n readonly eligible: boolean;\n readonly repeatedMeaningfulEvidence: boolean;\n readonly includesPrivateOrLowWitnessEvidence: boolean;\n readonly includesCostlyPressureEvent: boolean;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentInsufficientEvidenceResponse {\n readonly kind: \"insufficient-evidence\";\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility & {\n readonly eligible: false;\n };\n readonly missingEvidence: readonly QuietMeasureJudgmentMissingEvidence[];\n readonly reasonCodes: readonly string[];\n}\n\nexport interface QuietMeasureJudgmentVerdictResponse {\n readonly kind: \"verdict\";\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility & {\n readonly eligible: true;\n };\n readonly title: QuietMeasureTitleDescriptor;\n readonly dominantReads: readonly QuietMeasureDerivedReadSummary[];\n readonly reasonCodes: readonly string[];\n}\n\nexport type QuietMeasureJudgmentResponse =\n | QuietMeasureJudgmentInsufficientEvidenceResponse\n | QuietMeasureJudgmentVerdictResponse;\n\nexport interface QuietMeasureJudgmentEligibilityInput {\n readonly repeatedMeaningfulEvidence?: boolean;\n readonly includesPrivateOrLowWitnessEvidence?: boolean;\n readonly includesCostlyPressureEvent?: boolean;\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface CreateQuietMeasureJudgmentResponseInput {\n readonly request: QuietMeasureJudgmentRequest;\n readonly eligibility: QuietMeasureJudgmentEligibility;\n readonly title?: QuietMeasureTitleDescriptor;\n readonly dominantReads?: readonly QuietMeasureDerivedReadSummary[];\n readonly reasonCodes?: readonly string[];\n}\n\nfunction isMember<T extends string>(\n value: string,\n members: readonly T[],\n): value is T {\n return (members as readonly string[]).includes(value);\n}\n\nfunction assertRecord(value: unknown, label: string): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(`${label} must be an object.`);\n }\n\n return value as Record<string, unknown>;\n}\n\nfunction normalizeNonEmptyString(value: unknown, label: string): string {\n if (typeof value !== \"string\") {\n throw new TypeError(`${label} must be a non-empty string.`);\n }\n\n const normalized = value.trim();\n if (normalized.length === 0) {\n throw new TypeError(`${label} must be a non-empty string.`);\n }\n\n return normalized;\n}\n\nfunction normalizeBoolean(value: unknown, label: string): boolean {\n if (typeof value !== \"boolean\") {\n throw new TypeError(`${label} must be a boolean.`);\n }\n\n return value;\n}\n\nfunction normalizeOptionalBoolean(value: unknown, fallback: boolean, label: string): boolean {\n if (value === undefined) {\n return fallback;\n }\n\n return normalizeBoolean(value, label);\n}\n\nfunction normalizeTimestamp(value: unknown, label: string): string {\n const normalized = normalizeNonEmptyString(value, label);\n const parsed = Date.parse(normalized);\n\n if (Number.isNaN(parsed)) {\n throw new TypeError(`${label} must be a valid ISO-8601 timestamp.`);\n }\n\n return normalized;\n}\n\nfunction normalizeMember<T extends string>(\n value: unknown,\n members: readonly T[],\n label: string,\n): T {\n const normalized = normalizeNonEmptyString(value, label);\n\n if (!isMember(normalized, members)) {\n throw new TypeError(`${label} must be one of: ${members.join(\", \")}.`);\n }\n\n return normalized;\n}\n\nfunction normalizeReasonCodes(value: unknown, label: string): readonly string[] {\n if (value === undefined) {\n return Object.freeze([]);\n }\n\n if (!Array.isArray(value)) {\n throw new TypeError(`${label} must be an array of strings.`);\n }\n\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== \"string\") {\n throw new TypeError(`${label}[${index}] must be a string.`);\n }\n }\n\n const normalized = value.map((entry) => entry.trim());\n if (normalized.some((entry) => entry.length === 0)) {\n throw new TypeError(`${label} must not contain blank strings.`);\n }\n\n return Object.freeze(Array.from(new Set(normalized)));\n}\n\nfunction normalizeJudgmentRequest(input: unknown): QuietMeasureJudgmentRequest {\n const request = assertRecord(input, \"Quiet Measure judgment request\");\n\n return Object.freeze({\n subjectId: normalizeNonEmptyString(\n request.subjectId,\n \"Quiet Measure judgment request subjectId\",\n ),\n requestedAtUtc: normalizeTimestamp(\n request.requestedAtUtc,\n \"Quiet Measure judgment request requestedAtUtc\",\n ),\n requestedBy: normalizeMember(\n request.requestedBy,\n QUIET_MEASURE_JUDGMENT_REQUESTERS,\n \"Quiet Measure judgment request requestedBy\",\n ),\n disclosure: normalizeMember(\n request.disclosure,\n QUIET_MEASURE_JUDGMENT_DISCLOSURES,\n \"Quiet Measure judgment request disclosure\",\n ),\n });\n}\n\nfunction normalizeJudgmentEligibility(input: unknown): QuietMeasureJudgmentEligibility {\n const eligibility = assertRecord(input, \"Quiet Measure judgment eligibility\");\n const repeatedMeaningfulEvidence = normalizeBoolean(\n eligibility.repeatedMeaningfulEvidence,\n \"Quiet Measure judgment eligibility repeatedMeaningfulEvidence\",\n );\n const includesPrivateOrLowWitnessEvidence = normalizeBoolean(\n eligibility.includesPrivateOrLowWitnessEvidence,\n \"Quiet Measure judgment eligibility includesPrivateOrLowWitnessEvidence\",\n );\n const includesCostlyPressureEvent = normalizeBoolean(\n eligibility.includesCostlyPressureEvent,\n \"Quiet Measure judgment eligibility includesCostlyPressureEvent\",\n );\n\n return Object.freeze({\n eligible:\n repeatedMeaningfulEvidence\n && includesPrivateOrLowWitnessEvidence\n && includesCostlyPressureEvent,\n repeatedMeaningfulEvidence,\n includesPrivateOrLowWitnessEvidence,\n includesCostlyPressureEvent,\n reasonCodes: normalizeReasonCodes(\n eligibility.reasonCodes,\n \"Quiet Measure eligibility reasonCodes\",\n ),\n });\n}\n\nfunction normalizeTitleDescriptor(input: unknown): QuietMeasureTitleDescriptor {\n const title = assertRecord(input, \"Quiet Measure title\");\n\n return Object.freeze({\n titleId: normalizeNonEmptyString(title.titleId, \"Quiet Measure title titleId\"),\n title: normalizeNonEmptyString(title.title, \"Quiet Measure title title\"),\n verdictLabel: normalizeNonEmptyString(\n title.verdictLabel,\n \"Quiet Measure title verdictLabel\",\n ),\n perspective: normalizeMember(\n title.perspective,\n QUIET_MEASURE_PERSPECTIVES,\n \"Quiet Measure title perspective\",\n ),\n disclosure: normalizeMember(\n title.disclosure,\n QUIET_MEASURE_JUDGMENT_DISCLOSURES,\n \"Quiet Measure title disclosure\",\n ),\n reasonCodes: normalizeReasonCodes(title.reasonCodes, \"Quiet Measure title reasonCodes\"),\n });\n}\n\nfunction normalizeDerivedReadSummary(\n input: unknown,\n index: number,\n): QuietMeasureDerivedReadSummary {\n const prefix = `Quiet Measure dominantReads[${index}]`;\n const dominantRead = assertRecord(input, prefix);\n\n return Object.freeze({\n read: normalizeMember(\n dominantRead.read,\n QUIET_MEASURE_DERIVED_READS,\n `${prefix} read`,\n ),\n perspective: normalizeMember(\n dominantRead.perspective,\n QUIET_MEASURE_PERSPECTIVES,\n `${prefix} perspective`,\n ),\n signalBand: normalizeMember(\n dominantRead.signalBand,\n QUIET_MEASURE_SIGNAL_BANDS,\n `${prefix} signalBand`,\n ),\n confidenceBand: normalizeMember(\n dominantRead.confidenceBand,\n QUIET_MEASURE_CONFIDENCE_BANDS,\n `${prefix} confidenceBand`,\n ),\n reasonCodes: normalizeReasonCodes(\n dominantRead.reasonCodes,\n `${prefix} reasonCodes`,\n ),\n });\n}\n\nfunction normalizeDominantReads(\n value: unknown,\n): readonly QuietMeasureDerivedReadSummary[] {\n if (value === undefined) {\n return Object.freeze([]);\n }\n\n if (!Array.isArray(value)) {\n throw new TypeError(\"Quiet Measure dominantReads must be an array.\");\n }\n\n return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));\n}\n\nexport function isQuietMeasureAxis(value: string): value is QuietMeasureAxis {\n return isMember(value, QUIET_MEASURE_AXES);\n}\n\nexport function isQuietMeasureMissionProbeMode(\n value: string,\n): value is QuietMeasureMissionProbeMode {\n return isMember(value, QUIET_MEASURE_MISSION_PROBE_MODES);\n}\n\nexport function isQuietMeasureMissionResolutionShape(\n value: string,\n): value is QuietMeasureMissionResolutionShape {\n return isMember(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);\n}\n\nexport function createQuietMeasureJudgmentEligibility(\n input: QuietMeasureJudgmentEligibilityInput = {},\n): QuietMeasureJudgmentEligibility {\n const repeatedMeaningfulEvidence = normalizeOptionalBoolean(\n input.repeatedMeaningfulEvidence,\n false,\n \"Quiet Measure eligibility repeatedMeaningfulEvidence\",\n );\n const includesPrivateOrLowWitnessEvidence = normalizeOptionalBoolean(\n input.includesPrivateOrLowWitnessEvidence,\n false,\n \"Quiet Measure eligibility includesPrivateOrLowWitnessEvidence\",\n );\n const includesCostlyPressureEvent = normalizeOptionalBoolean(\n input.includesCostlyPressureEvent,\n false,\n \"Quiet Measure eligibility includesCostlyPressureEvent\",\n );\n\n return Object.freeze({\n eligible:\n repeatedMeaningfulEvidence\n && includesPrivateOrLowWitnessEvidence\n && includesCostlyPressureEvent,\n repeatedMeaningfulEvidence,\n includesPrivateOrLowWitnessEvidence,\n includesCostlyPressureEvent,\n reasonCodes: normalizeReasonCodes(input.reasonCodes, \"Quiet Measure eligibility reasonCodes\"),\n });\n}\n\nexport function listQuietMeasureMissingEvidence(\n eligibility: QuietMeasureJudgmentEligibility,\n): readonly QuietMeasureJudgmentMissingEvidence[] {\n const normalizedEligibility = normalizeJudgmentEligibility(eligibility);\n const missing: QuietMeasureJudgmentMissingEvidence[] = [];\n\n if (!normalizedEligibility.repeatedMeaningfulEvidence) {\n missing.push(\"repeated-meaningful-evidence\");\n }\n\n if (!normalizedEligibility.includesPrivateOrLowWitnessEvidence) {\n missing.push(\"private-or-low-witness-evidence\");\n }\n\n if (!normalizedEligibility.includesCostlyPressureEvent) {\n missing.push(\"costly-pressure-event\");\n }\n\n return Object.freeze(missing);\n}\n\nexport function createQuietMeasureJudgmentResponse(\n input: CreateQuietMeasureJudgmentResponseInput,\n): QuietMeasureJudgmentResponse {\n const request = normalizeJudgmentRequest(input.request);\n const eligibility = normalizeJudgmentEligibility(input.eligibility);\n const missingEvidence = listQuietMeasureMissingEvidence(eligibility);\n const reasonCodes = normalizeReasonCodes(\n input.reasonCodes,\n \"Quiet Measure judgment response reasonCodes\",\n );\n const hasRequiredEvidence = missingEvidence.length === 0;\n\n if (!hasRequiredEvidence) {\n return Object.freeze({\n kind: \"insufficient-evidence\",\n request,\n eligibility: Object.freeze({\n ...eligibility,\n eligible: false,\n }),\n missingEvidence,\n reasonCodes,\n });\n }\n\n if (!input.title) {\n throw new TypeError(\n \"Quiet Measure verdict responses require a title descriptor when eligibility is met.\",\n );\n }\n\n return Object.freeze({\n kind: \"verdict\",\n request,\n eligibility: Object.freeze({\n ...eligibility,\n eligible: true,\n }),\n title: normalizeTitleDescriptor(input.title),\n dominantReads: normalizeDominantReads(input.dominantReads),\n reasonCodes,\n });\n}\n","export * from \"./training-state.js\";\n\nexport interface AiPackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport const AI_GAME_PACKAGE = \"@plasius/ai-game\";\nexport const AI_GAME_ENV_PREFIX = \"AI_GAME\";\nexport const AI_GAME_FEATURE_FLAG_ID = \"ai.game.enabled\";\nexport const AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID = \"ai.game.event-recorder.contracts.enabled\";\nexport const AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID = \"ai.game.event-recorder.ingestion.enabled\";\nexport const AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID = \"ai.game.event-recorder.impact.enabled\";\nexport const AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID = \"ai.game.npc-gossip.topics.enabled\";\nexport const AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID = \"ai.game.npc-gossip.perspective.enabled\";\nexport const AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID = \"ai.game.npc-gossip.lifecycle.enabled\";\n\nexport const AI_GAME_FEATURE_FLAGS = {\n workloads: AI_GAME_FEATURE_FLAG_ID,\n ttsCacheEnabled: \"ai.tts.cache.enabled\",\n ttsNearReuseEnabled: \"ai.tts.near-reuse.enabled\",\n} as const;\n\nexport type AiGameFeatureFlagKey =\n (typeof AI_GAME_FEATURE_FLAGS)[keyof typeof AI_GAME_FEATURE_FLAGS];\n\nexport type AiGameFeatureFlagSnapshot = Partial<Record<AiGameFeatureFlagKey, boolean>>;\n\nexport const AI_GAME_TASK_KINDS = [\n \"player-action-validation\",\n \"npc-action\",\n \"npc-dialogue\",\n \"gossip\",\n \"governance-feedback\",\n \"feedback\",\n \"unknown\",\n] as const;\n\nexport type AiGameTaskKind = (typeof AI_GAME_TASK_KINDS)[number];\n\nexport const AI_GAME_TASK_RISK_CLASSES = [\n \"low\",\n \"medium\",\n \"high\",\n \"critical\",\n] as const;\n\nexport type AiGameTaskRiskClass = (typeof AI_GAME_TASK_RISK_CLASSES)[number];\n\nexport const AI_GAME_TASK_AUTHORITY_BOUNDARIES = [\n \"deterministic\",\n \"human-review\",\n \"operator-review\",\n \"blocked\",\n] as const;\n\nexport type AiGameAuthorityBoundary =\n (typeof AI_GAME_TASK_AUTHORITY_BOUNDARIES)[number];\n\nexport const AI_GAME_TASK_DECISIONS = [\"allow\", \"operator-review\", \"blocked\"] as const;\n\nexport type AiGameTaskDecisionResult =\n (typeof AI_GAME_TASK_DECISIONS)[number];\n\nexport const AI_GAME_TASK_RESULTS = [\"allow\", \"defer\", \"deny\"] as const;\n\nexport type AiGameTaskResult = (typeof AI_GAME_TASK_RESULTS)[number];\n\nexport const AI_GAME_TTS_CACHE_POLICIES = [\n \"exact-cache\",\n \"near-cache\",\n \"no-cache\",\n] as const;\n\nexport type AiGameTtsCachePolicy =\n (typeof AI_GAME_TTS_CACHE_POLICIES)[number];\n\nexport const AI_GAME_ACTOR_ROLES = [\"player\", \"npc\", \"operator\", \"system\"] as const;\n\nexport type AiGameActorRole = (typeof AI_GAME_ACTOR_ROLES)[number];\n\nexport interface AiGameTaskRequest {\n readonly taskId: string;\n readonly taskText: string;\n readonly taskKind?: AiGameTaskKind;\n}\n\nexport interface AiGameTaskDecision {\n readonly taskId: string;\n readonly taskKind: AiGameTaskKind;\n readonly riskClass: AiGameTaskRiskClass;\n readonly authorityBoundary: AiGameAuthorityBoundary;\n readonly decision: AiGameTaskDecisionResult;\n readonly needsOperatorReview: boolean;\n readonly reasonCodes: readonly string[];\n}\n\nexport interface AiGamePolicyAuditBase {\n readonly policyId: string;\n readonly policyVersion: string;\n readonly correlationId: string;\n readonly requestId?: string;\n readonly actorId?: string;\n readonly actorRole: AiGameActorRole;\n readonly evaluatedAtUtc: string;\n}\n\nexport interface ResolveAiGameTaskInput {\n readonly actorRole?: AiGameActorRole;\n readonly actorId?: string;\n readonly requestId?: string;\n readonly correlationId?: string;\n readonly policyId?: string;\n readonly policyVersion?: string;\n readonly featureFlags?: AiGameFeatureFlagSnapshot;\n readonly requests: readonly AiGameTaskRequest[];\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface AiGameTaskResolution {\n readonly requestedTasks: readonly string[];\n readonly taskDecisions: readonly AiGameTaskDecision[];\n readonly allowedTaskIds: readonly string[];\n readonly reviewTaskIds: readonly string[];\n readonly blockedTaskIds: readonly string[];\n readonly needsOperatorReview: boolean;\n readonly featureEnabled: boolean;\n readonly enabledFeatureFlags: readonly AiGameFeatureFlagKey[];\n readonly source: \"policy\" | \"policy-disabled\" | \"policy-empty\";\n readonly audit: AiGamePolicyAuditBase & {\n readonly result: AiGameTaskResult;\n };\n}\n\nexport interface ResolveAiGamePlayerAddressInput {\n readonly playerAddressText: string;\n readonly playerAlias?: string;\n readonly accountAlias?: string;\n readonly actorRole?: AiGameActorRole;\n readonly actorId?: string;\n readonly requestId?: string;\n readonly correlationId?: string;\n readonly policyId?: string;\n readonly policyVersion?: string;\n readonly featureFlags?: AiGameFeatureFlagSnapshot;\n readonly reasonCodes?: readonly string[];\n}\n\nexport interface ResolveAiGamePlayerAddressResult {\n readonly sourceText: string;\n readonly renderText: string;\n readonly ttsCachePolicy: AiGameTtsCachePolicy;\n readonly reasonCodes: readonly string[];\n readonly enabledFeatureFlags: readonly AiGameFeatureFlagKey[];\n readonly source: \"policy\" | \"policy-disabled\" | \"policy-empty\";\n readonly audit: AiGamePolicyAuditBase & {\n readonly cachePolicy: AiGameTtsCachePolicy;\n };\n}\n\ninterface AiGameTaskProfile {\n readonly riskClass: AiGameTaskRiskClass;\n readonly authorityBoundary: AiGameAuthorityBoundary;\n readonly keywords: readonly string[];\n}\n\nconst AI_GAME_TASK_PROFILE_BY_KIND: Record<AiGameTaskKind, AiGameTaskProfile> = {\n \"player-action-validation\": {\n riskClass: \"medium\",\n authorityBoundary: \"human-review\",\n keywords: [\"move\", \"attack\", \"collect\", \"use\", \"open\", \"pick\", \"trade\", \"target\"],\n },\n \"npc-action\": {\n riskClass: \"high\",\n authorityBoundary: \"operator-review\",\n keywords: [\"summon\", \"kill\", \"ban\", \"spawn\", \"eject\", \"resurrect\", \"npc action\", \"npc-action\"],\n },\n \"npc-dialogue\": {\n riskClass: \"low\",\n authorityBoundary: \"deterministic\",\n keywords: [\"say\", \"says\", \"reply\", \"chat\", \"dialogue\", \"greet\", \"warn\", \"request\"],\n },\n gossip: {\n riskClass: \"high\",\n authorityBoundary: \"operator-review\",\n keywords: [\"rumor\", \"rumors\", \"gossip\", \"hearsay\", \"whisper\", \"spread\", \"denounce\"],\n },\n \"governance-feedback\": {\n riskClass: \"critical\",\n authorityBoundary: \"blocked\",\n keywords: [\"punish\", \"expel\", \"revoke\", \"ban\", \"forbid\", \"seize\"],\n },\n feedback: {\n riskClass: \"low\",\n authorityBoundary: \"operator-review\",\n keywords: [\"feedback\", \"rating\", \"report\", \"score\", \"review\", \"complaint\"],\n },\n unknown: {\n riskClass: \"low\",\n authorityBoundary: \"deterministic\",\n keywords: [\"\"],\n },\n};\n\nconst AI_GAME_TASK_KEYWORD_PATTERNS: Readonly<Record<AiGameTaskKind, RegExp>> = {\n \"player-action-validation\": buildTaskPattern(\n AI_GAME_TASK_PROFILE_BY_KIND[\"player-action-validation\"].keywords,\n ),\n \"npc-action\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"npc-action\"].keywords),\n \"npc-dialogue\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"npc-dialogue\"].keywords),\n gossip: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.gossip.keywords),\n \"governance-feedback\": buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND[\"governance-feedback\"].keywords),\n feedback: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.feedback.keywords),\n unknown: buildTaskPattern(AI_GAME_TASK_PROFILE_BY_KIND.unknown.keywords),\n};\n\nfunction nowIsoString(): string {\n return new Date().toISOString();\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction normalizeToken(value: string): string {\n return value.trim().replace(/\\s+/g, \" \");\n}\n\nfunction buildTaskPattern(keywords: readonly string[]): RegExp {\n return new RegExp(\n keywords.filter((keyword) => keyword.length > 0).map((keyword) => `\\\\b${escapeRegExp(keyword)}\\\\b`).join(\"|\") || \"^$\",\n \"i\",\n );\n}\n\nfunction uniqueStrings(values: readonly string[]): string[] {\n return Array.from(new Set(values.filter((value) => value.length > 0)));\n}\n\nfunction isFeatureEnabled(\n featureFlag: AiGameFeatureFlagKey,\n snapshot: AiGameFeatureFlagSnapshot = {},\n): boolean {\n return snapshot[featureFlag] === true;\n}\n\nfunction normalizeTaskText(value: string): string {\n return value.trim().replace(/\\s+/g, \" \").toLowerCase();\n}\n\nfunction isActorRole(role?: AiGameActorRole): AiGameActorRole {\n return role ?? \"player\";\n}\n\nfunction normalizeTaskKind(taskKind?: AiGameTaskKind): AiGameTaskKind | undefined {\n if (!taskKind) {\n return undefined;\n }\n\n return (AI_GAME_TASK_KINDS as readonly string[]).includes(taskKind)\n ? taskKind\n : \"unknown\";\n}\n\nexport function classifyAiGameTask(taskText: string): AiGameTaskKind {\n const normalized = normalizeTaskText(taskText);\n\n if (!normalized) {\n return \"unknown\";\n }\n\n for (const taskKind of AI_GAME_TASK_KINDS) {\n if (AI_GAME_TASK_KEYWORD_PATTERNS[taskKind].test(normalized)) {\n return taskKind;\n }\n }\n\n return \"unknown\";\n}\n\nfunction resolveTaskAuthority(taskKind: AiGameTaskKind): AiGameTaskProfile {\n return AI_GAME_TASK_PROFILE_BY_KIND[taskKind];\n}\n\nfunction resolveTaskDecision(\n taskKind: AiGameTaskKind,\n profile: AiGameTaskProfile,\n actorRole: AiGameActorRole,\n): Omit<AiGameTaskDecision, \"taskId\" | \"taskKind\" | \"riskClass\" | \"authorityBoundary\" | \"reasonCodes\"> {\n if (profile.authorityBoundary === \"blocked\") {\n return {\n decision: \"blocked\",\n needsOperatorReview: actorRole !== \"system\",\n };\n }\n\n if (profile.authorityBoundary === \"deterministic\") {\n return {\n decision: \"allow\",\n needsOperatorReview: false,\n };\n }\n\n if (actorRole === \"system\") {\n return {\n decision: \"allow\",\n needsOperatorReview: false,\n };\n }\n\n return {\n decision: \"operator-review\",\n needsOperatorReview: true,\n };\n}\n\nfunction buildRequestIds(requests: readonly AiGameTaskRequest[]): string[] {\n return uniqueStrings(requests.map((request) => request.taskId.trim()).filter(Boolean));\n}\n\n/**\n * Resolve game AI task contracts for player actions, NPC actions, gossip, and governance.\n */\nexport function resolveAiGameTaskBatch(\n input: ResolveAiGameTaskInput,\n): AiGameTaskResolution {\n const actorRole = isActorRole(input.actorRole);\n const featureEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.workloads,\n input.featureFlags,\n );\n const reasonCodes = [...(input.reasonCodes ?? [])];\n type ResolvedAiGameTaskRequest = AiGameTaskRequest & { taskKind: AiGameTaskKind };\n const requests: ResolvedAiGameTaskRequest[] = input.requests.map((request): ResolvedAiGameTaskRequest => ({\n ...request,\n taskKind: normalizeTaskKind(request.taskKind) ?? classifyAiGameTask(request.taskText),\n }));\n\n if (!featureEnabled) {\n reasonCodes.push(\"game-feature-disabled\");\n const requestIds = buildRequestIds(requests);\n\n return {\n requestedTasks: requestIds,\n taskDecisions: Object.freeze(\n requestIds.map<AiGameTaskDecision>((taskId) => ({\n taskId,\n taskKind: \"unknown\",\n riskClass: \"critical\",\n authorityBoundary: \"blocked\",\n decision: \"blocked\",\n needsOperatorReview: false,\n reasonCodes: [\"feature-disabled\"],\n })),\n ),\n allowedTaskIds: Object.freeze([] as const),\n reviewTaskIds: Object.freeze([] as const),\n blockedTaskIds: Object.freeze(requestIds),\n needsOperatorReview: false,\n featureEnabled,\n enabledFeatureFlags: [],\n source: \"policy-disabled\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: \"deny\",\n },\n };\n }\n\n if (requests.length === 0) {\n reasonCodes.push(\"game-task-empty-request\");\n\n return {\n requestedTasks: Object.freeze([] as const),\n taskDecisions: Object.freeze([] as const),\n allowedTaskIds: Object.freeze([] as const),\n reviewTaskIds: Object.freeze([] as const),\n blockedTaskIds: Object.freeze([] as const),\n needsOperatorReview: false,\n featureEnabled,\n enabledFeatureFlags: [AI_GAME_FEATURE_FLAGS.workloads],\n source: \"policy-empty\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: \"allow\",\n },\n };\n }\n const taskDecisions: AiGameTaskDecision[] = [];\n for (const request of requests) {\n const taskKind: AiGameTaskKind = request.taskKind;\n const profile = resolveTaskAuthority(taskKind);\n const decision: Omit<\n AiGameTaskDecision,\n \"taskId\" | \"taskKind\" | \"riskClass\" | \"authorityBoundary\" | \"reasonCodes\"\n > = resolveTaskDecision(taskKind, profile, actorRole);\n\n taskDecisions.push({\n taskId: request.taskId,\n taskKind,\n riskClass: profile.riskClass,\n authorityBoundary: profile.authorityBoundary,\n ...decision,\n reasonCodes: [`task-${taskKind}-${decision.decision}`],\n });\n }\n\n const allowedTaskIds: string[] = [];\n const reviewTaskIds: string[] = [];\n const blockedTaskIds: string[] = [];\n\n for (const decision of taskDecisions) {\n if (decision.decision === \"allow\") {\n allowedTaskIds.push(decision.taskId);\n } else if (decision.decision === \"operator-review\") {\n reviewTaskIds.push(decision.taskId);\n } else {\n blockedTaskIds.push(decision.taskId);\n }\n\n reasonCodes.push(...decision.reasonCodes);\n }\n\n const hasBlockedTasks = blockedTaskIds.length > 0;\n const needsOperatorReview = taskDecisions.some((decision) => decision.needsOperatorReview);\n\n return {\n requestedTasks: Object.freeze(buildRequestIds(requests)),\n taskDecisions: Object.freeze(taskDecisions),\n allowedTaskIds: Object.freeze(uniqueStrings(allowedTaskIds)),\n reviewTaskIds: Object.freeze(uniqueStrings(reviewTaskIds)),\n blockedTaskIds: Object.freeze(uniqueStrings(blockedTaskIds)),\n needsOperatorReview,\n featureEnabled,\n enabledFeatureFlags: [AI_GAME_FEATURE_FLAGS.workloads],\n source: \"policy\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n result: hasBlockedTasks ? \"deny\" : needsOperatorReview ? \"defer\" : \"allow\",\n },\n };\n}\n\n/**\n * Resolve cache policy for player-account text before speech rendering.\n */\nexport function resolveAiGamePlayerAddressText(\n input: ResolveAiGamePlayerAddressInput,\n): ResolveAiGamePlayerAddressResult {\n const actorRole = isActorRole(input.actorRole);\n const cacheEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.ttsCacheEnabled,\n input.featureFlags,\n );\n const sourceText = normalizeToken(input.playerAddressText);\n const reasonCodes = [...(input.reasonCodes ?? [])];\n\n if (!sourceText) {\n reasonCodes.push(\"tts-empty-text\");\n\n return {\n sourceText,\n renderText: \"\",\n ttsCachePolicy: \"no-cache\",\n reasonCodes,\n enabledFeatureFlags: [],\n source: \"policy-empty\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy: \"no-cache\",\n },\n };\n }\n\n const aliasEntries = [\n ...uniqueStrings([normalizeToken(input.playerAlias ?? \"\")])\n .filter(Boolean)\n .map((alias) => ({\n alias,\n isAccountAlias: false,\n })),\n ...uniqueStrings([normalizeToken(input.accountAlias ?? \"\")])\n .filter(Boolean)\n .map((alias) => ({\n alias,\n isAccountAlias: true,\n })),\n ];\n\n let renderText = sourceText;\n let replaced = false;\n\n for (const alias of aliasEntries) {\n const pattern = new RegExp(`\\\\b${escapeRegExp(alias.alias)}\\\\b`, \"gi\");\n\n if (pattern.test(renderText)) {\n renderText = renderText.replace(pattern, alias.isAccountAlias ? \"[ACCOUNT]\" : \"[PLAYER]\");\n replaced = true;\n reasonCodes.push(`tts-redacted-${alias.alias.toLowerCase()}`);\n }\n }\n\n const nearCacheEnabled = isFeatureEnabled(\n AI_GAME_FEATURE_FLAGS.ttsNearReuseEnabled,\n input.featureFlags,\n );\n\n if (!cacheEnabled) {\n reasonCodes.push(\"tts-cache-disabled\");\n\n return {\n sourceText,\n renderText,\n ttsCachePolicy: \"no-cache\",\n reasonCodes,\n enabledFeatureFlags: [],\n source: \"policy-disabled\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy: \"no-cache\",\n },\n };\n }\n\n const cachePolicy: AiGameTtsCachePolicy =\n !replaced\n ? \"exact-cache\"\n : nearCacheEnabled\n ? \"near-cache\"\n : \"no-cache\";\n\n if (cachePolicy === \"exact-cache\") {\n reasonCodes.push(\"tts-cache-exact\");\n }\n\n if (cachePolicy === \"near-cache\") {\n reasonCodes.push(\"tts-cache-near\");\n }\n\n if (cachePolicy === \"no-cache\") {\n reasonCodes.push(\"tts-cache-not-available\");\n }\n\n return {\n sourceText,\n renderText,\n ttsCachePolicy: cachePolicy,\n reasonCodes,\n enabledFeatureFlags: Object.freeze([\n AI_GAME_FEATURE_FLAGS.workloads,\n AI_GAME_FEATURE_FLAGS.ttsCacheEnabled,\n ...(nearCacheEnabled ? [AI_GAME_FEATURE_FLAGS.ttsNearReuseEnabled] : []),\n ]),\n source: \"policy\",\n audit: {\n policyId: input.policyId ?? \"game-task-policy-v1\",\n policyVersion: input.policyVersion ?? \"2026-05-01\",\n correlationId: input.correlationId ?? crypto.randomUUID(),\n requestId: input.requestId,\n actorId: input.actorId,\n actorRole,\n evaluatedAtUtc: nowIsoString(),\n cachePolicy,\n },\n };\n}\n\nexport const packageDescriptor: AiPackageDescriptor = Object.freeze({\n packageName: AI_GAME_PACKAGE,\n featureFlagId: AI_GAME_FEATURE_FLAG_ID,\n envPrefix: AI_GAME_ENV_PREFIX,\n summary: \"Game-domain AI contracts for event recorder, canonical world-state, and NPC gossip projections.\",\n});\n\nexport const aiGameFeatureFlags = Object.freeze({\n contract: AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID,\n ingestion: AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,\n incident: AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,\n gossipTopics: AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,\n gossipPerspective: AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,\n gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,\n});\n\nexport const gameEventFeatureFlags = Object.freeze([\n aiGameFeatureFlags.contract,\n aiGameFeatureFlags.ingestion,\n aiGameFeatureFlags.incident,\n aiGameFeatureFlags.gossipTopics,\n aiGameFeatureFlags.gossipPerspective,\n aiGameFeatureFlags.gossipLifecycle,\n]);\n\nexport {\n isCanonicalWorldEvent,\n isCandidateWorldEvent,\n isIncidentResolved,\n normalizeIncidentImpactVector,\n} from \"./world-events.js\";\n\nexport {\n isGossipTopicActive,\n isGossipTopicCorrected,\n projectTopicForAudience,\n} from \"./gossip.js\";\n\nexport {\n AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,\n createQuietMeasureJudgmentEligibility,\n createQuietMeasureJudgmentResponse,\n isQuietMeasureAxis,\n isQuietMeasureMissionProbeMode,\n isQuietMeasureMissionResolutionShape,\n listQuietMeasureMissingEvidence,\n} from \"./quiet-measure.js\";\n\nexport * from \"./world-events.js\";\nexport * from \"./gossip.js\";\nexport * from \"./quiet-measure.js\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAgBA,IAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,wCAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,mDAAmD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,4CAA4C;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AACF;AA6CA,SAAS,oBAAuB,OAAmC;AACjE,SAAO,OAAO,OAAO,CAAC,GAAG,KAAK,CAAC;AACjC;AAEA,SAAS,qBAAqB,OAAe,OAAqB;AAChE,MAAI,MAAM,KAAK,EAAE,WAAW,GAAG;AAC7B,UAAM,IAAI,MAAM,GAAG,KAAK,6BAA6B;AAAA,EACvD;AACF;AAEA,SAAS,mBAAmB,OAAe,OAAqB;AAC9D,uBAAqB,OAAO,KAAK;AAEjC,MAAI,OAAO,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AACnC,UAAM,IAAI,MAAM,GAAG,KAAK,gCAAgC;AAAA,EAC1D;AACF;AAEA,SAAS,0BAA0B,OAAiD;AAClF,SAAO,UAAU,YACZ,UAAU,cACV,UAAU,aACV,UAAU;AACjB;AAEO,SAAS,0BACd,OACkC;AAClC,SAAQ,6BAAmD,SAAS,KAAK;AAC3E;AAEO,SAAS,kCACd,OAC0C;AAC1C,SAAQ,sCAA4D,SAAS,KAAK;AACpF;AAEO,SAAS,6CACd,OACqD;AACrD,SAAQ,iDAAuE,SAAS,KAAK;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contracts are consumed from `@plasius/training`
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Context
8
+
9
+ Story `Plasius-LTD/plasius-ltd-site#421` needs Player System-readable training-state, institutional eligibility, trust-marker, and specialization recommendation contracts.
10
+
11
+ The institutional authority boundary already exists in the published `@plasius/training` package. Duplicating institution, trust, or track vocabulary inside `@plasius/ai-game` would create two competing sources of truth for the same progression model.
12
+
13
+ ## Decision
14
+
15
+ `@plasius/ai-game` consumes the published `@plasius/training` package and re-exports the canonical training-state vocabulary from that dependency.
16
+
17
+ `@plasius/ai-game` adds only the bridge-layer contracts that are specific to Player System consumption:
18
+
19
+ - stage-gated institutional eligibility
20
+ - trust markers
21
+ - specialization recommendations
22
+ - a frozen snapshot bundle that packages progression plus bridge metadata
23
+
24
+ ## Alternatives considered
25
+
26
+ 1. Recreate the training enums and progression record locally in `@plasius/ai-game`.
27
+ Rejected because it would drift from the authoritative package and violate the reuse-first rule.
28
+ 2. Move all Player System recommendation shapes into `@plasius/training`.
29
+ Rejected for now because the recommendation bundle is a consumer-facing bridge concern, not the core institutional authority boundary.
30
+
31
+ ## Consequences
32
+
33
+ - Institutional vocabulary stays canonical in one published package.
34
+ - Player System consumers can depend on `@plasius/ai-game` for a ready-to-read bridge surface without redefining training doctrine.
35
+ - Dependency management must now verify compatibility with the published `@plasius/training` package during build and release checks.
@@ -9,3 +9,4 @@
9
9
  - [ADR-0007: Gossip spread, decay, correction, and resolution](./adr-0007-gossip-spread-decay-correction-and-resolution.md)
10
10
  - [ADR-0008: Quiet Measure public contracts and hidden runtime boundary](./adr-0008-quiet-measure-public-contracts-and-hidden-runtime-boundary.md)
11
11
  - [ADR-0009: Protected-main releases use release-prep PRs and reconciled version state](./adr-0009-protected-main-release-preparation-and-version-reconciliation.md)
12
+ - [ADR-0010: Training contracts are consumed from @plasius/training](./adr-0010-training-contracts-consumed-from-training-package.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/ai-game",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Game-domain AI contracts for player action validation, NPC actions, gossip, and feedback.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -92,5 +92,8 @@
92
92
  },
93
93
  "overrides": {
94
94
  "minimatch": "^10.2.1"
95
+ },
96
+ "dependencies": {
97
+ "@plasius/training": "^0.1.3"
95
98
  }
96
99
  }