@plasius/ai-game 0.5.0 → 0.6.1
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/CHANGELOG.md +32 -0
- package/README.md +46 -1
- package/dist/index.cjs +712 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +242 -1
- package/dist/index.d.ts +242 -1
- package/dist/index.js +657 -5
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0015-mcc-guidance-contract-boundary.md +62 -0
- package/docs/adrs/adr-0016-observed-event-log-and-gossip-export-contract-boundary.md +52 -0
- package/docs/adrs/index.md +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID: () => AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,
|
|
27
27
|
AI_GAME_FEATURE_FLAGS: () => AI_GAME_FEATURE_FLAGS,
|
|
28
28
|
AI_GAME_FEATURE_FLAG_ID: () => AI_GAME_FEATURE_FLAG_ID,
|
|
29
|
+
AI_GAME_GOSSIP_EXPORT_AUDIENCES: () => AI_GAME_GOSSIP_EXPORT_AUDIENCES,
|
|
29
30
|
AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID: () => AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
|
|
30
31
|
AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID: () => AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
|
|
31
32
|
AI_GAME_IDENTITY_CONTRACT_VERSION: () => AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
@@ -36,6 +37,15 @@ __export(index_exports, {
|
|
|
36
37
|
AI_GAME_IDENTITY_TARGET_CATEGORIES: () => AI_GAME_IDENTITY_TARGET_CATEGORIES,
|
|
37
38
|
AI_GAME_IDENTITY_VISIBILITY_STATES: () => AI_GAME_IDENTITY_VISIBILITY_STATES,
|
|
38
39
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID: () => AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
40
|
+
AI_GAME_MCC_FOCUS_PRIORITIES: () => AI_GAME_MCC_FOCUS_PRIORITIES,
|
|
41
|
+
AI_GAME_MCC_GROWTH_DIRECTIONS: () => AI_GAME_MCC_GROWTH_DIRECTIONS,
|
|
42
|
+
AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION: () => AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
43
|
+
AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID: () => AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
44
|
+
AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS: () => AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS,
|
|
45
|
+
AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS: () => AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS,
|
|
46
|
+
AI_GAME_MCC_READINESS_BANDS: () => AI_GAME_MCC_READINESS_BANDS,
|
|
47
|
+
AI_GAME_MCC_WARNING_KINDS: () => AI_GAME_MCC_WARNING_KINDS,
|
|
48
|
+
AI_GAME_MCC_WARNING_STATES: () => AI_GAME_MCC_WARNING_STATES,
|
|
39
49
|
AI_GAME_MISSIONS_CONTRACT_VERSION: () => AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
40
50
|
AI_GAME_MISSIONS_FEATURE_FLAG_ID: () => AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
41
51
|
AI_GAME_MISSION_CLASSES: () => AI_GAME_MISSION_CLASSES,
|
|
@@ -49,6 +59,16 @@ __export(index_exports, {
|
|
|
49
59
|
AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING: () => AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING,
|
|
50
60
|
AI_GAME_MISSION_REWARD_CAP_SEMANTICS: () => AI_GAME_MISSION_REWARD_CAP_SEMANTICS,
|
|
51
61
|
AI_GAME_MISSION_REWARD_KINDS: () => AI_GAME_MISSION_REWARD_KINDS,
|
|
62
|
+
AI_GAME_OBSERVED_EVENT_KINDS: () => AI_GAME_OBSERVED_EVENT_KINDS,
|
|
63
|
+
AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION: () => AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION,
|
|
64
|
+
AI_GAME_OBSERVED_EVENT_LOG_FEATURE_FLAG_ID: () => AI_GAME_OBSERVED_EVENT_LOG_FEATURE_FLAG_ID,
|
|
65
|
+
AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH: () => AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH,
|
|
66
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAGS: () => AI_GAME_OBSERVED_EVENT_MAX_TAGS,
|
|
67
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAG_LENGTH: () => AI_GAME_OBSERVED_EVENT_MAX_TAG_LENGTH,
|
|
68
|
+
AI_GAME_OBSERVED_EVENT_MAX_WINDOW_EVENTS: () => AI_GAME_OBSERVED_EVENT_MAX_WINDOW_EVENTS,
|
|
69
|
+
AI_GAME_OBSERVED_EVENT_SIGNIFICANCE: () => AI_GAME_OBSERVED_EVENT_SIGNIFICANCE,
|
|
70
|
+
AI_GAME_OBSERVED_EVENT_SOURCES: () => AI_GAME_OBSERVED_EVENT_SOURCES,
|
|
71
|
+
AI_GAME_OBSERVED_EVENT_VISIBILITIES: () => AI_GAME_OBSERVED_EVENT_VISIBILITIES,
|
|
52
72
|
AI_GAME_PACKAGE: () => AI_GAME_PACKAGE,
|
|
53
73
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID: () => AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
54
74
|
AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES: () => AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
|
|
@@ -70,6 +90,14 @@ __export(index_exports, {
|
|
|
70
90
|
AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS: () => AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS,
|
|
71
91
|
AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES: () => AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES,
|
|
72
92
|
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID: () => AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
93
|
+
AI_GAME_SPELLCRAFT_AUTHORITATIVE_OWNER: () => AI_GAME_SPELLCRAFT_AUTHORITATIVE_OWNER,
|
|
94
|
+
AI_GAME_SPELLCRAFT_CHAOS_PRESSURES: () => AI_GAME_SPELLCRAFT_CHAOS_PRESSURES,
|
|
95
|
+
AI_GAME_SPELLCRAFT_COMMITMENT: () => AI_GAME_SPELLCRAFT_COMMITMENT,
|
|
96
|
+
AI_GAME_SPELLCRAFT_COMPLEXITIES: () => AI_GAME_SPELLCRAFT_COMPLEXITIES,
|
|
97
|
+
AI_GAME_SPELLCRAFT_FATIGUE_STATES: () => AI_GAME_SPELLCRAFT_FATIGUE_STATES,
|
|
98
|
+
AI_GAME_SPELLCRAFT_RECOMMENDATION_KINDS: () => AI_GAME_SPELLCRAFT_RECOMMENDATION_KINDS,
|
|
99
|
+
AI_GAME_SPELLCRAFT_TARGET_MODES: () => AI_GAME_SPELLCRAFT_TARGET_MODES,
|
|
100
|
+
AI_GAME_SPELLCRAFT_VERDICTS: () => AI_GAME_SPELLCRAFT_VERDICTS,
|
|
73
101
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES: () => AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
74
102
|
AI_GAME_TASK_DECISIONS: () => AI_GAME_TASK_DECISIONS,
|
|
75
103
|
AI_GAME_TASK_KINDS: () => AI_GAME_TASK_KINDS,
|
|
@@ -106,13 +134,19 @@ __export(index_exports, {
|
|
|
106
134
|
aiGameFeatureFlags: () => aiGameFeatureFlags,
|
|
107
135
|
assertAiGameIdentityProjectionContractVersion: () => assertAiGameIdentityProjectionContractVersion,
|
|
108
136
|
assertAiGameMissionContractVersion: () => assertAiGameMissionContractVersion,
|
|
137
|
+
assertAiGameObservedEventLogContractVersion: () => assertAiGameObservedEventLogContractVersion,
|
|
109
138
|
classifyAiGameTask: () => classifyAiGameTask,
|
|
110
139
|
createAiGameAcademicTrainingSnapshot: () => createAiGameAcademicTrainingSnapshot,
|
|
140
|
+
createAiGameGossipExport: () => createAiGameGossipExport,
|
|
111
141
|
createAiGameIdentityProjectionContract: () => createAiGameIdentityProjectionContract,
|
|
112
142
|
createAiGameIdentitySelfProjection: () => createAiGameIdentitySelfProjection,
|
|
113
143
|
createAiGameIdentityTargetProjection: () => createAiGameIdentityTargetProjection,
|
|
114
144
|
createAiGameInstitutionEligibility: () => createAiGameInstitutionEligibility,
|
|
115
145
|
createAiGameMartialTrainingSnapshot: () => createAiGameMartialTrainingSnapshot,
|
|
146
|
+
createAiGameMccFocusTarget: () => createAiGameMccFocusTarget,
|
|
147
|
+
createAiGameMccGuidanceSnapshot: () => createAiGameMccGuidanceSnapshot,
|
|
148
|
+
createAiGameMccReadinessState: () => createAiGameMccReadinessState,
|
|
149
|
+
createAiGameMccWarning: () => createAiGameMccWarning,
|
|
116
150
|
createAiGameMissionDefinition: () => createAiGameMissionDefinition,
|
|
117
151
|
createAiGameMissionMccFocusInfluence: () => createAiGameMissionMccFocusInfluence,
|
|
118
152
|
createAiGameMissionObjectiveState: () => createAiGameMissionObjectiveState,
|
|
@@ -123,6 +157,9 @@ __export(index_exports, {
|
|
|
123
157
|
createAiGameMissionRewardBound: () => createAiGameMissionRewardBound,
|
|
124
158
|
createAiGameMissionRewardEnvelope: () => createAiGameMissionRewardEnvelope,
|
|
125
159
|
createAiGameMissionRewardGrant: () => createAiGameMissionRewardGrant,
|
|
160
|
+
createAiGameObservedEvent: () => createAiGameObservedEvent,
|
|
161
|
+
createAiGameObservedEventHighlightSummary: () => createAiGameObservedEventHighlightSummary,
|
|
162
|
+
createAiGameObservedEventRecencyWindow: () => createAiGameObservedEventRecencyWindow,
|
|
126
163
|
createAiGamePlayerSystemAlert: () => createAiGamePlayerSystemAlert,
|
|
127
164
|
createAiGamePlayerSystemGuidanceCue: () => createAiGamePlayerSystemGuidanceCue,
|
|
128
165
|
createAiGamePlayerSystemPreferenceConfidenceState: () => createAiGamePlayerSystemPreferenceConfidenceState,
|
|
@@ -130,6 +167,8 @@ __export(index_exports, {
|
|
|
130
167
|
createAiGamePlayerSystemPreferenceProfile: () => createAiGamePlayerSystemPreferenceProfile,
|
|
131
168
|
createAiGamePlayerSystemSession: () => createAiGamePlayerSystemSession,
|
|
132
169
|
createAiGameSpecializationRecommendation: () => createAiGameSpecializationRecommendation,
|
|
170
|
+
createAiGameSpellcraftAdvisory: () => createAiGameSpellcraftAdvisory,
|
|
171
|
+
createAiGameSpellcraftRecommendation: () => createAiGameSpellcraftRecommendation,
|
|
133
172
|
createAiGameTrainingAcademicMissionPrerequisite: () => import_training.createTrainingAcademicMissionPrerequisite,
|
|
134
173
|
createAiGameTrainingAcademyAdmission: () => import_training.createTrainingAcademyAdmission,
|
|
135
174
|
createAiGameTrainingSchoolProgression: () => import_training.createTrainingSchoolProgression,
|
|
@@ -142,10 +181,16 @@ __export(index_exports, {
|
|
|
142
181
|
getAiGamePlayerSystemFocusModeContract: () => getAiGamePlayerSystemFocusModeContract,
|
|
143
182
|
getAiGamePlayerSystemGuidanceFallbackContract: () => getAiGamePlayerSystemGuidanceFallbackContract,
|
|
144
183
|
getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
|
|
184
|
+
isAiGameGossipExportAudience: () => isAiGameGossipExportAudience,
|
|
145
185
|
isAiGameIdentityKnowledgeState: () => isAiGameIdentityKnowledgeState,
|
|
146
186
|
isAiGameIdentityProjectionRead: () => isAiGameIdentityProjectionRead,
|
|
147
187
|
isAiGameIdentityTargetCategory: () => isAiGameIdentityTargetCategory,
|
|
148
188
|
isAiGameIdentityVisibilityState: () => isAiGameIdentityVisibilityState,
|
|
189
|
+
isAiGameMccFocusPriority: () => isAiGameMccFocusPriority,
|
|
190
|
+
isAiGameMccGrowthDirection: () => isAiGameMccGrowthDirection,
|
|
191
|
+
isAiGameMccReadinessBand: () => isAiGameMccReadinessBand,
|
|
192
|
+
isAiGameMccWarningKind: () => isAiGameMccWarningKind,
|
|
193
|
+
isAiGameMccWarningState: () => isAiGameMccWarningState,
|
|
149
194
|
isAiGameMissionClass: () => isAiGameMissionClass,
|
|
150
195
|
isAiGameMissionConfidenceBand: () => isAiGameMissionConfidenceBand,
|
|
151
196
|
isAiGameMissionFeedbackChannel: () => isAiGameMissionFeedbackChannel,
|
|
@@ -157,6 +202,10 @@ __export(index_exports, {
|
|
|
157
202
|
isAiGameMissionRepeatedSignalHandling: () => isAiGameMissionRepeatedSignalHandling,
|
|
158
203
|
isAiGameMissionRewardCapSemantic: () => isAiGameMissionRewardCapSemantic,
|
|
159
204
|
isAiGameMissionRewardKind: () => isAiGameMissionRewardKind,
|
|
205
|
+
isAiGameObservedEventKind: () => isAiGameObservedEventKind,
|
|
206
|
+
isAiGameObservedEventSignificance: () => isAiGameObservedEventSignificance,
|
|
207
|
+
isAiGameObservedEventSource: () => isAiGameObservedEventSource,
|
|
208
|
+
isAiGameObservedEventVisibility: () => isAiGameObservedEventVisibility,
|
|
160
209
|
isAiGamePlayerSystemAlertDeliverable: () => isAiGamePlayerSystemAlertDeliverable,
|
|
161
210
|
isAiGamePlayerSystemAlertPriority: () => isAiGamePlayerSystemAlertPriority,
|
|
162
211
|
isAiGamePlayerSystemConfidenceBand: () => isAiGamePlayerSystemConfidenceBand,
|
|
@@ -168,6 +217,12 @@ __export(index_exports, {
|
|
|
168
217
|
isAiGamePlayerSystemModule: () => isAiGamePlayerSystemModule,
|
|
169
218
|
isAiGamePlayerSystemPreferenceKind: () => isAiGamePlayerSystemPreferenceKind,
|
|
170
219
|
isAiGamePlayerSystemPreferenceSource: () => isAiGamePlayerSystemPreferenceSource,
|
|
220
|
+
isAiGameSpellcraftChaosPressure: () => isAiGameSpellcraftChaosPressure,
|
|
221
|
+
isAiGameSpellcraftComplexity: () => isAiGameSpellcraftComplexity,
|
|
222
|
+
isAiGameSpellcraftFatigueState: () => isAiGameSpellcraftFatigueState,
|
|
223
|
+
isAiGameSpellcraftRecommendationKind: () => isAiGameSpellcraftRecommendationKind,
|
|
224
|
+
isAiGameSpellcraftTargetMode: () => isAiGameSpellcraftTargetMode,
|
|
225
|
+
isAiGameSpellcraftVerdict: () => isAiGameSpellcraftVerdict,
|
|
171
226
|
isAiGameTrainingAcademicProgressStage: () => import_training.isTrainingAcademicProgressStage,
|
|
172
227
|
isAiGameTrainingAcademyAdmissionDecision: () => import_training.isTrainingAcademyAdmissionDecision,
|
|
173
228
|
isAiGameTrainingAntiSpellCounterWindow: () => import_training.isTrainingAntiSpellCounterWindow,
|
|
@@ -1382,6 +1437,603 @@ function assertAiGameIdentityProjectionContractVersion(value) {
|
|
|
1382
1437
|
assertContractVersion3(value);
|
|
1383
1438
|
}
|
|
1384
1439
|
|
|
1440
|
+
// src/observed-events.ts
|
|
1441
|
+
var AI_GAME_OBSERVED_EVENT_LOG_FEATURE_FLAG_ID = "isekai.player-system.logs.enabled";
|
|
1442
|
+
var AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION = "1.0";
|
|
1443
|
+
var AI_GAME_OBSERVED_EVENT_KINDS = [
|
|
1444
|
+
"combat",
|
|
1445
|
+
"crafting",
|
|
1446
|
+
"discovery",
|
|
1447
|
+
"mission",
|
|
1448
|
+
"social",
|
|
1449
|
+
"travel",
|
|
1450
|
+
"world"
|
|
1451
|
+
];
|
|
1452
|
+
var AI_GAME_OBSERVED_EVENT_SOURCES = [
|
|
1453
|
+
"player-action",
|
|
1454
|
+
"system-observation",
|
|
1455
|
+
"world-state"
|
|
1456
|
+
];
|
|
1457
|
+
var AI_GAME_OBSERVED_EVENT_VISIBILITIES = [
|
|
1458
|
+
"private",
|
|
1459
|
+
"party",
|
|
1460
|
+
"local",
|
|
1461
|
+
"public"
|
|
1462
|
+
];
|
|
1463
|
+
var AI_GAME_OBSERVED_EVENT_SIGNIFICANCE = [
|
|
1464
|
+
"routine",
|
|
1465
|
+
"notable",
|
|
1466
|
+
"critical"
|
|
1467
|
+
];
|
|
1468
|
+
var AI_GAME_GOSSIP_EXPORT_AUDIENCES = [
|
|
1469
|
+
"player",
|
|
1470
|
+
"npc",
|
|
1471
|
+
"public"
|
|
1472
|
+
];
|
|
1473
|
+
var AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH = 500;
|
|
1474
|
+
var AI_GAME_OBSERVED_EVENT_MAX_TAGS = 20;
|
|
1475
|
+
var AI_GAME_OBSERVED_EVENT_MAX_TAG_LENGTH = 64;
|
|
1476
|
+
var AI_GAME_OBSERVED_EVENT_MAX_WINDOW_EVENTS = 100;
|
|
1477
|
+
function freezeReadonlyArray5(items) {
|
|
1478
|
+
return Object.freeze([...items]);
|
|
1479
|
+
}
|
|
1480
|
+
function isMember4(value, members) {
|
|
1481
|
+
return members.includes(value);
|
|
1482
|
+
}
|
|
1483
|
+
function assertNonEmptyString5(value, label) {
|
|
1484
|
+
if (value.trim().length === 0) {
|
|
1485
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
function assertSafeText(value, label, maxLength) {
|
|
1489
|
+
assertNonEmptyString5(value, label);
|
|
1490
|
+
if (value.length > maxLength) {
|
|
1491
|
+
throw new Error(`${label} must be ${maxLength} characters or fewer`);
|
|
1492
|
+
}
|
|
1493
|
+
if ([...value].some((character) => {
|
|
1494
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
1495
|
+
return codePoint <= 31 || codePoint === 127;
|
|
1496
|
+
})) {
|
|
1497
|
+
throw new Error(`${label} must not contain control characters`);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function assertIsoTimestamp3(value, label) {
|
|
1501
|
+
assertNonEmptyString5(value, label);
|
|
1502
|
+
if (Number.isNaN(Date.parse(value))) {
|
|
1503
|
+
throw new Error(`${label} must be an ISO-8601 timestamp`);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
function assertContractVersion4(value) {
|
|
1507
|
+
if (value !== AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION) {
|
|
1508
|
+
throw new Error(
|
|
1509
|
+
`contractVersion must be ${AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION}`
|
|
1510
|
+
);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
function assertArrayLimit(value, label, maximum) {
|
|
1514
|
+
if (value.length > maximum) {
|
|
1515
|
+
throw new Error(`${label} must contain ${maximum} items or fewer`);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
function createStringArray2(values, label, maximum, itemMaximum) {
|
|
1519
|
+
assertArrayLimit(values, label, maximum);
|
|
1520
|
+
const result = values.map((value, index) => {
|
|
1521
|
+
assertSafeText(value, `${label}[${index}]`, itemMaximum);
|
|
1522
|
+
return value.trim();
|
|
1523
|
+
});
|
|
1524
|
+
if (new Set(result).size !== result.length) {
|
|
1525
|
+
throw new Error(`${label} must not contain duplicate values`);
|
|
1526
|
+
}
|
|
1527
|
+
return freezeReadonlyArray5(result);
|
|
1528
|
+
}
|
|
1529
|
+
function assertUniqueIds(values, label) {
|
|
1530
|
+
if (new Set(values).size !== values.length) {
|
|
1531
|
+
throw new Error(`${label} must not contain duplicate values`);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
function cloneObservedEvent(event) {
|
|
1535
|
+
return createAiGameObservedEvent(event);
|
|
1536
|
+
}
|
|
1537
|
+
function cloneRecencyWindow(window) {
|
|
1538
|
+
return createAiGameObservedEventRecencyWindow({
|
|
1539
|
+
contractVersion: window.contractVersion,
|
|
1540
|
+
windowId: window.windowId,
|
|
1541
|
+
startsAtIso: window.startsAtIso,
|
|
1542
|
+
endsAtIso: window.endsAtIso,
|
|
1543
|
+
events: window.events
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
function cloneHighlightSummary(summary) {
|
|
1547
|
+
return createAiGameObservedEventHighlightSummary({
|
|
1548
|
+
contractVersion: summary.contractVersion,
|
|
1549
|
+
summaryId: summary.summaryId,
|
|
1550
|
+
windowId: summary.windowId,
|
|
1551
|
+
title: summary.title,
|
|
1552
|
+
summary: summary.summary,
|
|
1553
|
+
significance: summary.significance,
|
|
1554
|
+
eventIds: summary.eventIds,
|
|
1555
|
+
reasonCodes: summary.reasonCodes
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
function isAiGameObservedEventKind(value) {
|
|
1559
|
+
return isMember4(value, AI_GAME_OBSERVED_EVENT_KINDS);
|
|
1560
|
+
}
|
|
1561
|
+
function isAiGameObservedEventSource(value) {
|
|
1562
|
+
return isMember4(value, AI_GAME_OBSERVED_EVENT_SOURCES);
|
|
1563
|
+
}
|
|
1564
|
+
function isAiGameObservedEventVisibility(value) {
|
|
1565
|
+
return isMember4(value, AI_GAME_OBSERVED_EVENT_VISIBILITIES);
|
|
1566
|
+
}
|
|
1567
|
+
function isAiGameObservedEventSignificance(value) {
|
|
1568
|
+
return isMember4(value, AI_GAME_OBSERVED_EVENT_SIGNIFICANCE);
|
|
1569
|
+
}
|
|
1570
|
+
function isAiGameGossipExportAudience(value) {
|
|
1571
|
+
return isMember4(value, AI_GAME_GOSSIP_EXPORT_AUDIENCES);
|
|
1572
|
+
}
|
|
1573
|
+
function createAiGameObservedEvent(input) {
|
|
1574
|
+
const contractVersion = input.contractVersion ?? AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION;
|
|
1575
|
+
assertContractVersion4(contractVersion);
|
|
1576
|
+
assertSafeText(input.eventId, "eventId", 200);
|
|
1577
|
+
assertIsoTimestamp3(input.occurredAtIso, "occurredAtIso");
|
|
1578
|
+
assertSafeText(input.subjectRef, "subjectRef", 200);
|
|
1579
|
+
assertSafeText(
|
|
1580
|
+
input.summary,
|
|
1581
|
+
"summary",
|
|
1582
|
+
AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH
|
|
1583
|
+
);
|
|
1584
|
+
if (!isAiGameObservedEventKind(input.kind)) {
|
|
1585
|
+
throw new Error(`kind must be one of: ${AI_GAME_OBSERVED_EVENT_KINDS.join(", ")}`);
|
|
1586
|
+
}
|
|
1587
|
+
if (!isAiGameObservedEventSource(input.source)) {
|
|
1588
|
+
throw new Error(
|
|
1589
|
+
`source must be one of: ${AI_GAME_OBSERVED_EVENT_SOURCES.join(", ")}`
|
|
1590
|
+
);
|
|
1591
|
+
}
|
|
1592
|
+
if (!isAiGameObservedEventSignificance(input.significance)) {
|
|
1593
|
+
throw new Error(
|
|
1594
|
+
`significance must be one of: ${AI_GAME_OBSERVED_EVENT_SIGNIFICANCE.join(", ")}`
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
if (!isAiGameObservedEventVisibility(input.visibility)) {
|
|
1598
|
+
throw new Error(
|
|
1599
|
+
`visibility must be one of: ${AI_GAME_OBSERVED_EVENT_VISIBILITIES.join(", ")}`
|
|
1600
|
+
);
|
|
1601
|
+
}
|
|
1602
|
+
const tags = createStringArray2(
|
|
1603
|
+
input.tags ?? [],
|
|
1604
|
+
"tags",
|
|
1605
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAGS,
|
|
1606
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAG_LENGTH
|
|
1607
|
+
);
|
|
1608
|
+
return Object.freeze({
|
|
1609
|
+
contractVersion,
|
|
1610
|
+
eventId: input.eventId.trim(),
|
|
1611
|
+
occurredAtIso: input.occurredAtIso,
|
|
1612
|
+
kind: input.kind,
|
|
1613
|
+
source: input.source,
|
|
1614
|
+
subjectRef: input.subjectRef.trim(),
|
|
1615
|
+
summary: input.summary.trim(),
|
|
1616
|
+
significance: input.significance,
|
|
1617
|
+
visibility: input.visibility,
|
|
1618
|
+
tags
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
function createAiGameObservedEventRecencyWindow(input) {
|
|
1622
|
+
const contractVersion = input.contractVersion ?? AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION;
|
|
1623
|
+
assertContractVersion4(contractVersion);
|
|
1624
|
+
assertSafeText(input.windowId, "windowId", 200);
|
|
1625
|
+
assertIsoTimestamp3(input.startsAtIso, "startsAtIso");
|
|
1626
|
+
assertIsoTimestamp3(input.endsAtIso, "endsAtIso");
|
|
1627
|
+
const startsAt = Date.parse(input.startsAtIso);
|
|
1628
|
+
const endsAt = Date.parse(input.endsAtIso);
|
|
1629
|
+
if (startsAt > endsAt) {
|
|
1630
|
+
throw new Error("startsAtIso must be before or equal to endsAtIso");
|
|
1631
|
+
}
|
|
1632
|
+
assertArrayLimit(
|
|
1633
|
+
input.events,
|
|
1634
|
+
"events",
|
|
1635
|
+
AI_GAME_OBSERVED_EVENT_MAX_WINDOW_EVENTS
|
|
1636
|
+
);
|
|
1637
|
+
const events = input.events.map(cloneObservedEvent);
|
|
1638
|
+
const eventIds = events.map((event) => event.eventId);
|
|
1639
|
+
assertUniqueIds(eventIds, "events");
|
|
1640
|
+
for (const event of events) {
|
|
1641
|
+
const occurredAt = Date.parse(event.occurredAtIso);
|
|
1642
|
+
if (occurredAt < startsAt || occurredAt > endsAt) {
|
|
1643
|
+
throw new Error(`event ${event.eventId} must occur inside the recency window`);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return Object.freeze({
|
|
1647
|
+
contractVersion,
|
|
1648
|
+
windowId: input.windowId.trim(),
|
|
1649
|
+
startsAtIso: input.startsAtIso,
|
|
1650
|
+
endsAtIso: input.endsAtIso,
|
|
1651
|
+
events: freezeReadonlyArray5(events)
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
function createAiGameObservedEventHighlightSummary(input) {
|
|
1655
|
+
const contractVersion = input.contractVersion ?? AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION;
|
|
1656
|
+
assertContractVersion4(contractVersion);
|
|
1657
|
+
assertSafeText(input.summaryId, "summaryId", 200);
|
|
1658
|
+
assertSafeText(input.windowId, "windowId", 200);
|
|
1659
|
+
assertSafeText(input.title, "title", 200);
|
|
1660
|
+
assertSafeText(
|
|
1661
|
+
input.summary,
|
|
1662
|
+
"summary",
|
|
1663
|
+
AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH
|
|
1664
|
+
);
|
|
1665
|
+
if (!isAiGameObservedEventSignificance(input.significance)) {
|
|
1666
|
+
throw new Error(
|
|
1667
|
+
`significance must be one of: ${AI_GAME_OBSERVED_EVENT_SIGNIFICANCE.join(", ")}`
|
|
1668
|
+
);
|
|
1669
|
+
}
|
|
1670
|
+
const eventIds = createStringArray2(input.eventIds, "eventIds", 100, 200);
|
|
1671
|
+
if (eventIds.length === 0) {
|
|
1672
|
+
throw new Error("eventIds must contain at least one event id");
|
|
1673
|
+
}
|
|
1674
|
+
const reasonCodes = createStringArray2(
|
|
1675
|
+
input.reasonCodes ?? [],
|
|
1676
|
+
"reasonCodes",
|
|
1677
|
+
20,
|
|
1678
|
+
100
|
|
1679
|
+
);
|
|
1680
|
+
return Object.freeze({
|
|
1681
|
+
contractVersion,
|
|
1682
|
+
summaryId: input.summaryId.trim(),
|
|
1683
|
+
windowId: input.windowId.trim(),
|
|
1684
|
+
title: input.title.trim(),
|
|
1685
|
+
summary: input.summary.trim(),
|
|
1686
|
+
significance: input.significance,
|
|
1687
|
+
eventIds,
|
|
1688
|
+
reasonCodes
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function createAiGameGossipExport(input) {
|
|
1692
|
+
const contractVersion = input.contractVersion ?? AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION;
|
|
1693
|
+
assertContractVersion4(contractVersion);
|
|
1694
|
+
assertSafeText(input.exportId, "exportId", 200);
|
|
1695
|
+
assertIsoTimestamp3(input.exportedAtIso, "exportedAtIso");
|
|
1696
|
+
if (!isAiGameGossipExportAudience(input.audience)) {
|
|
1697
|
+
throw new Error(
|
|
1698
|
+
`audience must be one of: ${AI_GAME_GOSSIP_EXPORT_AUDIENCES.join(", ")}`
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
const sourceWindow = cloneRecencyWindow(input.sourceWindow);
|
|
1702
|
+
const eventIds = new Set(sourceWindow.events.map((event) => event.eventId));
|
|
1703
|
+
const highlights = input.highlights.map(cloneHighlightSummary);
|
|
1704
|
+
const summaryIds = highlights.map((summary) => summary.summaryId);
|
|
1705
|
+
assertUniqueIds(summaryIds, "highlights");
|
|
1706
|
+
for (const highlight of highlights) {
|
|
1707
|
+
if (highlight.windowId !== sourceWindow.windowId) {
|
|
1708
|
+
throw new Error("highlight windowId must match sourceWindow windowId");
|
|
1709
|
+
}
|
|
1710
|
+
if (highlight.eventIds.some((eventId) => !eventIds.has(eventId))) {
|
|
1711
|
+
throw new Error("highlight eventIds must reference sourceWindow events");
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return Object.freeze({
|
|
1715
|
+
contractVersion,
|
|
1716
|
+
exportId: input.exportId.trim(),
|
|
1717
|
+
exportedAtIso: input.exportedAtIso,
|
|
1718
|
+
audience: input.audience,
|
|
1719
|
+
sourceWindow,
|
|
1720
|
+
highlights: freezeReadonlyArray5(highlights)
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
function assertAiGameObservedEventLogContractVersion(value) {
|
|
1724
|
+
assertContractVersion4(value);
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
// src/mcc-guidance.ts
|
|
1728
|
+
var AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID = "isekai.player-system.mcc-guidance.enabled";
|
|
1729
|
+
var AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION = "1.0";
|
|
1730
|
+
var AI_GAME_MCC_GROWTH_DIRECTIONS = [
|
|
1731
|
+
"internalized",
|
|
1732
|
+
"externalized",
|
|
1733
|
+
"hybrid"
|
|
1734
|
+
];
|
|
1735
|
+
var AI_GAME_MCC_FOCUS_PRIORITIES = ["primary", "secondary"];
|
|
1736
|
+
var AI_GAME_MCC_READINESS_BANDS = [
|
|
1737
|
+
"stable",
|
|
1738
|
+
"pressured",
|
|
1739
|
+
"restricted"
|
|
1740
|
+
];
|
|
1741
|
+
var AI_GAME_MCC_WARNING_STATES = [
|
|
1742
|
+
"clear",
|
|
1743
|
+
"advisory",
|
|
1744
|
+
"elevated",
|
|
1745
|
+
"critical"
|
|
1746
|
+
];
|
|
1747
|
+
var AI_GAME_MCC_WARNING_KINDS = [
|
|
1748
|
+
"thermal",
|
|
1749
|
+
"fatigue",
|
|
1750
|
+
"chaos-pressure",
|
|
1751
|
+
"target-burden",
|
|
1752
|
+
"stage-gate",
|
|
1753
|
+
"death-impairment"
|
|
1754
|
+
];
|
|
1755
|
+
var AI_GAME_SPELLCRAFT_RECOMMENDATION_KINDS = [
|
|
1756
|
+
"training",
|
|
1757
|
+
"material",
|
|
1758
|
+
"social-prerequisite",
|
|
1759
|
+
"refinement"
|
|
1760
|
+
];
|
|
1761
|
+
var AI_GAME_SPELLCRAFT_VERDICTS = [
|
|
1762
|
+
"recommended",
|
|
1763
|
+
"conditional",
|
|
1764
|
+
"blocked"
|
|
1765
|
+
];
|
|
1766
|
+
var AI_GAME_SPELLCRAFT_TARGET_MODES = [
|
|
1767
|
+
"self",
|
|
1768
|
+
"single-target",
|
|
1769
|
+
"area"
|
|
1770
|
+
];
|
|
1771
|
+
var AI_GAME_SPELLCRAFT_COMPLEXITIES = ["low", "medium", "high"];
|
|
1772
|
+
var AI_GAME_SPELLCRAFT_CHAOS_PRESSURES = [
|
|
1773
|
+
"low",
|
|
1774
|
+
"elevated",
|
|
1775
|
+
"volatile"
|
|
1776
|
+
];
|
|
1777
|
+
var AI_GAME_SPELLCRAFT_FATIGUE_STATES = [
|
|
1778
|
+
"steady",
|
|
1779
|
+
"strained",
|
|
1780
|
+
"exhausted"
|
|
1781
|
+
];
|
|
1782
|
+
var AI_GAME_SPELLCRAFT_COMMITMENT = "preview-only";
|
|
1783
|
+
var AI_GAME_SPELLCRAFT_AUTHORITATIVE_OWNER = "spellcraft-system";
|
|
1784
|
+
var AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS = 3;
|
|
1785
|
+
var AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS = 5;
|
|
1786
|
+
function freezeReadonlyArray6(items) {
|
|
1787
|
+
return Object.freeze([...items]);
|
|
1788
|
+
}
|
|
1789
|
+
function createStringArray3(values, label) {
|
|
1790
|
+
const normalized = values ?? [];
|
|
1791
|
+
normalized.forEach((value) => assertNonEmptyString6(value, `${label} entry`));
|
|
1792
|
+
return freezeReadonlyArray6(normalized);
|
|
1793
|
+
}
|
|
1794
|
+
function assertNonEmptyString6(value, label) {
|
|
1795
|
+
if (value.trim().length === 0) {
|
|
1796
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
function assertContractVersion5(value, label = "contractVersion") {
|
|
1800
|
+
if (value !== AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION) {
|
|
1801
|
+
throw new Error(`${label} must be ${AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION}`);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
function assertBoundedFraction(value, label) {
|
|
1805
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
1806
|
+
throw new Error(`${label} must be between 0 and 1`);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
function isMember5(value, members) {
|
|
1810
|
+
return members.includes(value);
|
|
1811
|
+
}
|
|
1812
|
+
function getWarningStateRank(state) {
|
|
1813
|
+
return AI_GAME_MCC_WARNING_STATES.indexOf(state);
|
|
1814
|
+
}
|
|
1815
|
+
function resolveWarningState(warnings) {
|
|
1816
|
+
return warnings.reduce(
|
|
1817
|
+
(mostSevere, warning) => getWarningStateRank(warning.state) > getWarningStateRank(mostSevere) ? warning.state : mostSevere,
|
|
1818
|
+
"clear"
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
function isAiGameMccGrowthDirection(value) {
|
|
1822
|
+
return (0, import_training.isMccExpressionTrack)(value);
|
|
1823
|
+
}
|
|
1824
|
+
function isAiGameMccFocusPriority(value) {
|
|
1825
|
+
return isMember5(value, AI_GAME_MCC_FOCUS_PRIORITIES);
|
|
1826
|
+
}
|
|
1827
|
+
function isAiGameMccReadinessBand(value) {
|
|
1828
|
+
return isMember5(value, AI_GAME_MCC_READINESS_BANDS);
|
|
1829
|
+
}
|
|
1830
|
+
function isAiGameMccWarningState(value) {
|
|
1831
|
+
return isMember5(value, AI_GAME_MCC_WARNING_STATES);
|
|
1832
|
+
}
|
|
1833
|
+
function isAiGameMccWarningKind(value) {
|
|
1834
|
+
return isMember5(value, AI_GAME_MCC_WARNING_KINDS);
|
|
1835
|
+
}
|
|
1836
|
+
function isAiGameSpellcraftRecommendationKind(value) {
|
|
1837
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_RECOMMENDATION_KINDS);
|
|
1838
|
+
}
|
|
1839
|
+
function isAiGameSpellcraftVerdict(value) {
|
|
1840
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_VERDICTS);
|
|
1841
|
+
}
|
|
1842
|
+
function isAiGameSpellcraftTargetMode(value) {
|
|
1843
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_TARGET_MODES);
|
|
1844
|
+
}
|
|
1845
|
+
function isAiGameSpellcraftComplexity(value) {
|
|
1846
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_COMPLEXITIES);
|
|
1847
|
+
}
|
|
1848
|
+
function isAiGameSpellcraftChaosPressure(value) {
|
|
1849
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_CHAOS_PRESSURES);
|
|
1850
|
+
}
|
|
1851
|
+
function isAiGameSpellcraftFatigueState(value) {
|
|
1852
|
+
return isMember5(value, AI_GAME_SPELLCRAFT_FATIGUE_STATES);
|
|
1853
|
+
}
|
|
1854
|
+
function createAiGameMccFocusTarget(input) {
|
|
1855
|
+
assertNonEmptyString6(input.targetId, "targetId");
|
|
1856
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1857
|
+
if (!isAiGameMccGrowthDirection(input.growthDirection)) {
|
|
1858
|
+
throw new Error("growthDirection must be a supported MCC growth direction");
|
|
1859
|
+
}
|
|
1860
|
+
if (!isAiGameMccFocusPriority(input.priority)) {
|
|
1861
|
+
throw new Error("priority must be a supported MCC focus priority");
|
|
1862
|
+
}
|
|
1863
|
+
assertNonEmptyString6(input.label, "label");
|
|
1864
|
+
assertNonEmptyString6(input.summary, "summary");
|
|
1865
|
+
assertBoundedFraction(input.influenceWeight, "influenceWeight");
|
|
1866
|
+
return Object.freeze({
|
|
1867
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
1868
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
1869
|
+
targetId: input.targetId,
|
|
1870
|
+
growthDirection: input.growthDirection,
|
|
1871
|
+
label: input.label,
|
|
1872
|
+
summary: input.summary,
|
|
1873
|
+
priority: input.priority,
|
|
1874
|
+
influenceWeight: input.influenceWeight,
|
|
1875
|
+
reasonCodes: createStringArray3(input.reasonCodes, "reasonCodes")
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
function createAiGameMccWarning(input) {
|
|
1879
|
+
assertNonEmptyString6(input.warningId, "warningId");
|
|
1880
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1881
|
+
if (!isAiGameMccWarningKind(input.kind)) {
|
|
1882
|
+
throw new Error("kind must be a supported MCC warning kind");
|
|
1883
|
+
}
|
|
1884
|
+
if (!isAiGameMccWarningState(input.state) || input.state === "clear") {
|
|
1885
|
+
throw new Error("state must be an active MCC warning state");
|
|
1886
|
+
}
|
|
1887
|
+
assertNonEmptyString6(input.summary, "summary");
|
|
1888
|
+
return Object.freeze({
|
|
1889
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
1890
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
1891
|
+
warningId: input.warningId,
|
|
1892
|
+
kind: input.kind,
|
|
1893
|
+
state: input.state,
|
|
1894
|
+
summary: input.summary,
|
|
1895
|
+
reasonCodes: createStringArray3(input.reasonCodes, "reasonCodes")
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
function createAiGameMccReadinessState(input) {
|
|
1899
|
+
assertNonEmptyString6(input.readinessId, "readinessId");
|
|
1900
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1901
|
+
if (!isAiGameMccReadinessBand(input.band)) {
|
|
1902
|
+
throw new Error("band must be a supported MCC readiness band");
|
|
1903
|
+
}
|
|
1904
|
+
const warnings = freezeReadonlyArray6(
|
|
1905
|
+
input.warnings.map((warning) => createAiGameMccWarning(warning))
|
|
1906
|
+
);
|
|
1907
|
+
const derivedWarningState = resolveWarningState(warnings);
|
|
1908
|
+
const warningState = input.warningState ?? derivedWarningState;
|
|
1909
|
+
if (!isAiGameMccWarningState(warningState)) {
|
|
1910
|
+
throw new Error("warningState must be a supported MCC warning state");
|
|
1911
|
+
}
|
|
1912
|
+
if (warningState !== derivedWarningState) {
|
|
1913
|
+
throw new Error("warningState must match the most severe warning");
|
|
1914
|
+
}
|
|
1915
|
+
return Object.freeze({
|
|
1916
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
1917
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
1918
|
+
readinessId: input.readinessId,
|
|
1919
|
+
band: input.band,
|
|
1920
|
+
warningState,
|
|
1921
|
+
warnings,
|
|
1922
|
+
reasonCodes: createStringArray3(input.reasonCodes, "reasonCodes")
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function createAiGameSpellcraftRecommendation(input) {
|
|
1926
|
+
assertNonEmptyString6(input.recommendationId, "recommendationId");
|
|
1927
|
+
assertNonEmptyString6(input.focusTargetId, "focusTargetId");
|
|
1928
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1929
|
+
if (!isAiGameSpellcraftRecommendationKind(input.kind)) {
|
|
1930
|
+
throw new Error("kind must be a supported spellcraft recommendation kind");
|
|
1931
|
+
}
|
|
1932
|
+
assertNonEmptyString6(input.title, "title");
|
|
1933
|
+
assertNonEmptyString6(input.summary, "summary");
|
|
1934
|
+
if (!isAiGameMccReadinessBand(input.readinessBand)) {
|
|
1935
|
+
throw new Error("readinessBand must be a supported MCC readiness band");
|
|
1936
|
+
}
|
|
1937
|
+
return Object.freeze({
|
|
1938
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
1939
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
1940
|
+
recommendationId: input.recommendationId,
|
|
1941
|
+
kind: input.kind,
|
|
1942
|
+
focusTargetId: input.focusTargetId,
|
|
1943
|
+
title: input.title,
|
|
1944
|
+
summary: input.summary,
|
|
1945
|
+
readinessBand: input.readinessBand,
|
|
1946
|
+
prerequisiteCodes: createStringArray3(input.prerequisiteCodes, "prerequisiteCodes"),
|
|
1947
|
+
reasonCodes: createStringArray3(input.reasonCodes, "reasonCodes")
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
function createAiGameSpellcraftAdvisory(input) {
|
|
1951
|
+
assertNonEmptyString6(input.advisoryId, "advisoryId");
|
|
1952
|
+
assertNonEmptyString6(input.recommendationId, "recommendationId");
|
|
1953
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1954
|
+
if (!isAiGameSpellcraftVerdict(input.verdict)) {
|
|
1955
|
+
throw new Error("verdict must be a supported spellcraft verdict");
|
|
1956
|
+
}
|
|
1957
|
+
if (!isAiGameSpellcraftTargetMode(input.targetMode)) {
|
|
1958
|
+
throw new Error("targetMode must be a supported spellcraft target mode");
|
|
1959
|
+
}
|
|
1960
|
+
if (!isAiGameSpellcraftComplexity(input.complexity)) {
|
|
1961
|
+
throw new Error("complexity must be a supported spellcraft complexity");
|
|
1962
|
+
}
|
|
1963
|
+
if (!isAiGameSpellcraftChaosPressure(input.chaosPressure)) {
|
|
1964
|
+
throw new Error("chaosPressure must be a supported spellcraft chaos pressure");
|
|
1965
|
+
}
|
|
1966
|
+
if (!isAiGameSpellcraftFatigueState(input.fatigueState)) {
|
|
1967
|
+
throw new Error("fatigueState must be a supported spellcraft fatigue state");
|
|
1968
|
+
}
|
|
1969
|
+
if (!isAiGameMccReadinessBand(input.readinessBand)) {
|
|
1970
|
+
throw new Error("readinessBand must be a supported MCC readiness band");
|
|
1971
|
+
}
|
|
1972
|
+
assertNonEmptyString6(input.summary, "summary");
|
|
1973
|
+
return Object.freeze({
|
|
1974
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
1975
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
1976
|
+
advisoryId: input.advisoryId,
|
|
1977
|
+
recommendationId: input.recommendationId,
|
|
1978
|
+
verdict: input.verdict,
|
|
1979
|
+
targetMode: input.targetMode,
|
|
1980
|
+
complexity: input.complexity,
|
|
1981
|
+
chaosPressure: input.chaosPressure,
|
|
1982
|
+
fatigueState: input.fatigueState,
|
|
1983
|
+
readinessBand: input.readinessBand,
|
|
1984
|
+
prerequisiteCodes: createStringArray3(input.prerequisiteCodes, "prerequisiteCodes"),
|
|
1985
|
+
warningCodes: createStringArray3(input.warningCodes, "warningCodes"),
|
|
1986
|
+
summary: input.summary,
|
|
1987
|
+
reasonCodes: createStringArray3(input.reasonCodes, "reasonCodes"),
|
|
1988
|
+
commitment: AI_GAME_SPELLCRAFT_COMMITMENT,
|
|
1989
|
+
authoritativeOwner: AI_GAME_SPELLCRAFT_AUTHORITATIVE_OWNER
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
function createAiGameMccGuidanceSnapshot(input) {
|
|
1993
|
+
assertNonEmptyString6(input.guidanceId, "guidanceId");
|
|
1994
|
+
assertContractVersion5(input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION);
|
|
1995
|
+
if (input.focusTargets.length === 0 || input.focusTargets.length > AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS) {
|
|
1996
|
+
throw new Error(
|
|
1997
|
+
`focusTargets must contain between 1 and ${AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS} targets`
|
|
1998
|
+
);
|
|
1999
|
+
}
|
|
2000
|
+
if (input.recommendations.length === 0 || input.recommendations.length > AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS) {
|
|
2001
|
+
throw new Error(
|
|
2002
|
+
`recommendations must contain between 1 and ${AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS} items`
|
|
2003
|
+
);
|
|
2004
|
+
}
|
|
2005
|
+
const focusTargets = freezeReadonlyArray6(
|
|
2006
|
+
input.focusTargets.map((target) => createAiGameMccFocusTarget(target))
|
|
2007
|
+
);
|
|
2008
|
+
const focusTargetIds = new Set(focusTargets.map((target) => target.targetId));
|
|
2009
|
+
if (focusTargetIds.size !== focusTargets.length) {
|
|
2010
|
+
throw new Error("focusTargets must have unique targetId values");
|
|
2011
|
+
}
|
|
2012
|
+
const readiness = createAiGameMccReadinessState(input.readiness);
|
|
2013
|
+
const recommendations = freezeReadonlyArray6(
|
|
2014
|
+
input.recommendations.map((recommendation) => {
|
|
2015
|
+
const created = createAiGameSpellcraftRecommendation(recommendation);
|
|
2016
|
+
if (!focusTargetIds.has(created.focusTargetId)) {
|
|
2017
|
+
throw new Error("focusTargetId must reference a supplied focus target");
|
|
2018
|
+
}
|
|
2019
|
+
return created;
|
|
2020
|
+
})
|
|
2021
|
+
);
|
|
2022
|
+
const advisory = createAiGameSpellcraftAdvisory(input.advisory);
|
|
2023
|
+
if (!recommendations.some((recommendation) => recommendation.recommendationId === advisory.recommendationId)) {
|
|
2024
|
+
throw new Error("advisory recommendationId must reference a supplied recommendation");
|
|
2025
|
+
}
|
|
2026
|
+
return Object.freeze({
|
|
2027
|
+
contractVersion: input.contractVersion ?? AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
2028
|
+
featureFlagId: AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
2029
|
+
guidanceId: input.guidanceId,
|
|
2030
|
+
focusTargets,
|
|
2031
|
+
readiness,
|
|
2032
|
+
recommendations,
|
|
2033
|
+
advisory
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
|
|
1385
2037
|
// src/world-events.ts
|
|
1386
2038
|
function isCanonicalWorldEvent(event) {
|
|
1387
2039
|
return event.recordType === "canonical";
|
|
@@ -1533,7 +2185,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
|
1533
2185
|
"private-or-low-witness-evidence",
|
|
1534
2186
|
"costly-pressure-event"
|
|
1535
2187
|
];
|
|
1536
|
-
function
|
|
2188
|
+
function isMember6(value, members) {
|
|
1537
2189
|
return members.includes(value);
|
|
1538
2190
|
}
|
|
1539
2191
|
function assertRecord(value, label) {
|
|
@@ -1574,7 +2226,7 @@ function normalizeTimestamp(value, label) {
|
|
|
1574
2226
|
}
|
|
1575
2227
|
function normalizeMember(value, members, label) {
|
|
1576
2228
|
const normalized = normalizeNonEmptyString(value, label);
|
|
1577
|
-
if (!
|
|
2229
|
+
if (!isMember6(normalized, members)) {
|
|
1578
2230
|
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
1579
2231
|
}
|
|
1580
2232
|
return normalized;
|
|
@@ -1707,13 +2359,13 @@ function normalizeDominantReads(value) {
|
|
|
1707
2359
|
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
1708
2360
|
}
|
|
1709
2361
|
function isQuietMeasureAxis(value) {
|
|
1710
|
-
return
|
|
2362
|
+
return isMember6(value, QUIET_MEASURE_AXES);
|
|
1711
2363
|
}
|
|
1712
2364
|
function isQuietMeasureMissionProbeMode(value) {
|
|
1713
|
-
return
|
|
2365
|
+
return isMember6(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
1714
2366
|
}
|
|
1715
2367
|
function isQuietMeasureMissionResolutionShape(value) {
|
|
1716
|
-
return
|
|
2368
|
+
return isMember6(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
1717
2369
|
}
|
|
1718
2370
|
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
1719
2371
|
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
@@ -2217,6 +2869,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2217
2869
|
AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,
|
|
2218
2870
|
AI_GAME_FEATURE_FLAGS,
|
|
2219
2871
|
AI_GAME_FEATURE_FLAG_ID,
|
|
2872
|
+
AI_GAME_GOSSIP_EXPORT_AUDIENCES,
|
|
2220
2873
|
AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
|
|
2221
2874
|
AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
|
|
2222
2875
|
AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
@@ -2227,6 +2880,15 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2227
2880
|
AI_GAME_IDENTITY_TARGET_CATEGORIES,
|
|
2228
2881
|
AI_GAME_IDENTITY_VISIBILITY_STATES,
|
|
2229
2882
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
2883
|
+
AI_GAME_MCC_FOCUS_PRIORITIES,
|
|
2884
|
+
AI_GAME_MCC_GROWTH_DIRECTIONS,
|
|
2885
|
+
AI_GAME_MCC_GUIDANCE_CONTRACT_VERSION,
|
|
2886
|
+
AI_GAME_MCC_GUIDANCE_FEATURE_FLAG_ID,
|
|
2887
|
+
AI_GAME_MCC_GUIDANCE_MAX_FOCUS_TARGETS,
|
|
2888
|
+
AI_GAME_MCC_GUIDANCE_MAX_RECOMMENDATIONS,
|
|
2889
|
+
AI_GAME_MCC_READINESS_BANDS,
|
|
2890
|
+
AI_GAME_MCC_WARNING_KINDS,
|
|
2891
|
+
AI_GAME_MCC_WARNING_STATES,
|
|
2230
2892
|
AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
2231
2893
|
AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
2232
2894
|
AI_GAME_MISSION_CLASSES,
|
|
@@ -2240,6 +2902,16 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2240
2902
|
AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING,
|
|
2241
2903
|
AI_GAME_MISSION_REWARD_CAP_SEMANTICS,
|
|
2242
2904
|
AI_GAME_MISSION_REWARD_KINDS,
|
|
2905
|
+
AI_GAME_OBSERVED_EVENT_KINDS,
|
|
2906
|
+
AI_GAME_OBSERVED_EVENT_LOG_CONTRACT_VERSION,
|
|
2907
|
+
AI_GAME_OBSERVED_EVENT_LOG_FEATURE_FLAG_ID,
|
|
2908
|
+
AI_GAME_OBSERVED_EVENT_MAX_SUMMARY_LENGTH,
|
|
2909
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAGS,
|
|
2910
|
+
AI_GAME_OBSERVED_EVENT_MAX_TAG_LENGTH,
|
|
2911
|
+
AI_GAME_OBSERVED_EVENT_MAX_WINDOW_EVENTS,
|
|
2912
|
+
AI_GAME_OBSERVED_EVENT_SIGNIFICANCE,
|
|
2913
|
+
AI_GAME_OBSERVED_EVENT_SOURCES,
|
|
2914
|
+
AI_GAME_OBSERVED_EVENT_VISIBILITIES,
|
|
2243
2915
|
AI_GAME_PACKAGE,
|
|
2244
2916
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
2245
2917
|
AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
|
|
@@ -2261,6 +2933,14 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2261
2933
|
AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS,
|
|
2262
2934
|
AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES,
|
|
2263
2935
|
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
2936
|
+
AI_GAME_SPELLCRAFT_AUTHORITATIVE_OWNER,
|
|
2937
|
+
AI_GAME_SPELLCRAFT_CHAOS_PRESSURES,
|
|
2938
|
+
AI_GAME_SPELLCRAFT_COMMITMENT,
|
|
2939
|
+
AI_GAME_SPELLCRAFT_COMPLEXITIES,
|
|
2940
|
+
AI_GAME_SPELLCRAFT_FATIGUE_STATES,
|
|
2941
|
+
AI_GAME_SPELLCRAFT_RECOMMENDATION_KINDS,
|
|
2942
|
+
AI_GAME_SPELLCRAFT_TARGET_MODES,
|
|
2943
|
+
AI_GAME_SPELLCRAFT_VERDICTS,
|
|
2264
2944
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
2265
2945
|
AI_GAME_TASK_DECISIONS,
|
|
2266
2946
|
AI_GAME_TASK_KINDS,
|
|
@@ -2297,13 +2977,19 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2297
2977
|
aiGameFeatureFlags,
|
|
2298
2978
|
assertAiGameIdentityProjectionContractVersion,
|
|
2299
2979
|
assertAiGameMissionContractVersion,
|
|
2980
|
+
assertAiGameObservedEventLogContractVersion,
|
|
2300
2981
|
classifyAiGameTask,
|
|
2301
2982
|
createAiGameAcademicTrainingSnapshot,
|
|
2983
|
+
createAiGameGossipExport,
|
|
2302
2984
|
createAiGameIdentityProjectionContract,
|
|
2303
2985
|
createAiGameIdentitySelfProjection,
|
|
2304
2986
|
createAiGameIdentityTargetProjection,
|
|
2305
2987
|
createAiGameInstitutionEligibility,
|
|
2306
2988
|
createAiGameMartialTrainingSnapshot,
|
|
2989
|
+
createAiGameMccFocusTarget,
|
|
2990
|
+
createAiGameMccGuidanceSnapshot,
|
|
2991
|
+
createAiGameMccReadinessState,
|
|
2992
|
+
createAiGameMccWarning,
|
|
2307
2993
|
createAiGameMissionDefinition,
|
|
2308
2994
|
createAiGameMissionMccFocusInfluence,
|
|
2309
2995
|
createAiGameMissionObjectiveState,
|
|
@@ -2314,6 +3000,9 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2314
3000
|
createAiGameMissionRewardBound,
|
|
2315
3001
|
createAiGameMissionRewardEnvelope,
|
|
2316
3002
|
createAiGameMissionRewardGrant,
|
|
3003
|
+
createAiGameObservedEvent,
|
|
3004
|
+
createAiGameObservedEventHighlightSummary,
|
|
3005
|
+
createAiGameObservedEventRecencyWindow,
|
|
2317
3006
|
createAiGamePlayerSystemAlert,
|
|
2318
3007
|
createAiGamePlayerSystemGuidanceCue,
|
|
2319
3008
|
createAiGamePlayerSystemPreferenceConfidenceState,
|
|
@@ -2321,6 +3010,8 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2321
3010
|
createAiGamePlayerSystemPreferenceProfile,
|
|
2322
3011
|
createAiGamePlayerSystemSession,
|
|
2323
3012
|
createAiGameSpecializationRecommendation,
|
|
3013
|
+
createAiGameSpellcraftAdvisory,
|
|
3014
|
+
createAiGameSpellcraftRecommendation,
|
|
2324
3015
|
createAiGameTrainingAcademicMissionPrerequisite,
|
|
2325
3016
|
createAiGameTrainingAcademyAdmission,
|
|
2326
3017
|
createAiGameTrainingSchoolProgression,
|
|
@@ -2333,10 +3024,16 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2333
3024
|
getAiGamePlayerSystemFocusModeContract,
|
|
2334
3025
|
getAiGamePlayerSystemGuidanceFallbackContract,
|
|
2335
3026
|
getAiGamePlayerSystemModuleContract,
|
|
3027
|
+
isAiGameGossipExportAudience,
|
|
2336
3028
|
isAiGameIdentityKnowledgeState,
|
|
2337
3029
|
isAiGameIdentityProjectionRead,
|
|
2338
3030
|
isAiGameIdentityTargetCategory,
|
|
2339
3031
|
isAiGameIdentityVisibilityState,
|
|
3032
|
+
isAiGameMccFocusPriority,
|
|
3033
|
+
isAiGameMccGrowthDirection,
|
|
3034
|
+
isAiGameMccReadinessBand,
|
|
3035
|
+
isAiGameMccWarningKind,
|
|
3036
|
+
isAiGameMccWarningState,
|
|
2340
3037
|
isAiGameMissionClass,
|
|
2341
3038
|
isAiGameMissionConfidenceBand,
|
|
2342
3039
|
isAiGameMissionFeedbackChannel,
|
|
@@ -2348,6 +3045,10 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2348
3045
|
isAiGameMissionRepeatedSignalHandling,
|
|
2349
3046
|
isAiGameMissionRewardCapSemantic,
|
|
2350
3047
|
isAiGameMissionRewardKind,
|
|
3048
|
+
isAiGameObservedEventKind,
|
|
3049
|
+
isAiGameObservedEventSignificance,
|
|
3050
|
+
isAiGameObservedEventSource,
|
|
3051
|
+
isAiGameObservedEventVisibility,
|
|
2351
3052
|
isAiGamePlayerSystemAlertDeliverable,
|
|
2352
3053
|
isAiGamePlayerSystemAlertPriority,
|
|
2353
3054
|
isAiGamePlayerSystemConfidenceBand,
|
|
@@ -2359,6 +3060,12 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2359
3060
|
isAiGamePlayerSystemModule,
|
|
2360
3061
|
isAiGamePlayerSystemPreferenceKind,
|
|
2361
3062
|
isAiGamePlayerSystemPreferenceSource,
|
|
3063
|
+
isAiGameSpellcraftChaosPressure,
|
|
3064
|
+
isAiGameSpellcraftComplexity,
|
|
3065
|
+
isAiGameSpellcraftFatigueState,
|
|
3066
|
+
isAiGameSpellcraftRecommendationKind,
|
|
3067
|
+
isAiGameSpellcraftTargetMode,
|
|
3068
|
+
isAiGameSpellcraftVerdict,
|
|
2362
3069
|
isAiGameTrainingAcademicProgressStage,
|
|
2363
3070
|
isAiGameTrainingAcademyAdmissionDecision,
|
|
2364
3071
|
isAiGameTrainingAntiSpellCounterWindow,
|