@plasius/ai-game 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +45 -2
- package/dist/index.cjs +644 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +264 -1
- package/dist/index.d.ts +264 -1
- package/dist/index.js +596 -27
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0013-adaptive-mission-contract-boundary.md +63 -0
- package/docs/adrs/adr-0014-player-system-guidance-cue-contract-boundary.md +43 -0
- package/docs/adrs/index.md +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,19 @@ __export(index_exports, {
|
|
|
36
36
|
AI_GAME_IDENTITY_TARGET_CATEGORIES: () => AI_GAME_IDENTITY_TARGET_CATEGORIES,
|
|
37
37
|
AI_GAME_IDENTITY_VISIBILITY_STATES: () => AI_GAME_IDENTITY_VISIBILITY_STATES,
|
|
38
38
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID: () => AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
39
|
+
AI_GAME_MISSIONS_CONTRACT_VERSION: () => AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
40
|
+
AI_GAME_MISSIONS_FEATURE_FLAG_ID: () => AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
41
|
+
AI_GAME_MISSION_CLASSES: () => AI_GAME_MISSION_CLASSES,
|
|
42
|
+
AI_GAME_MISSION_CONFIDENCE_BANDS: () => AI_GAME_MISSION_CONFIDENCE_BANDS,
|
|
43
|
+
AI_GAME_MISSION_FEEDBACK_CHANNELS: () => AI_GAME_MISSION_FEEDBACK_CHANNELS,
|
|
44
|
+
AI_GAME_MISSION_INFLUENCE_SOURCES: () => AI_GAME_MISSION_INFLUENCE_SOURCES,
|
|
45
|
+
AI_GAME_MISSION_OBJECTIVE_STATUSES: () => AI_GAME_MISSION_OBJECTIVE_STATUSES,
|
|
46
|
+
AI_GAME_MISSION_PLAYER_RESPONSE_KINDS: () => AI_GAME_MISSION_PLAYER_RESPONSE_KINDS,
|
|
47
|
+
AI_GAME_MISSION_PREFERENCE_DIMENSIONS: () => AI_GAME_MISSION_PREFERENCE_DIMENSIONS,
|
|
48
|
+
AI_GAME_MISSION_READINESS_BANDS: () => AI_GAME_MISSION_READINESS_BANDS,
|
|
49
|
+
AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING: () => AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING,
|
|
50
|
+
AI_GAME_MISSION_REWARD_CAP_SEMANTICS: () => AI_GAME_MISSION_REWARD_CAP_SEMANTICS,
|
|
51
|
+
AI_GAME_MISSION_REWARD_KINDS: () => AI_GAME_MISSION_REWARD_KINDS,
|
|
39
52
|
AI_GAME_PACKAGE: () => AI_GAME_PACKAGE,
|
|
40
53
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID: () => AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
41
54
|
AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES: () => AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
|
|
@@ -44,6 +57,13 @@ __export(index_exports, {
|
|
|
44
57
|
AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID: () => AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
|
|
45
58
|
AI_GAME_PLAYER_SYSTEM_FOCUS_MODES: () => AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
|
|
46
59
|
AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS,
|
|
60
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE,
|
|
61
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES,
|
|
62
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_SOURCES: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_SOURCES,
|
|
63
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_BEHAVIORS: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_BEHAVIORS,
|
|
64
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_CONTRACTS,
|
|
65
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_IDS: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_IDS,
|
|
66
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_NFR_FEATURE_FLAG_ID: () => AI_GAME_PLAYER_SYSTEM_GUIDANCE_NFR_FEATURE_FLAG_ID,
|
|
47
67
|
AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES: () => AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
|
|
48
68
|
AI_GAME_PLAYER_SYSTEM_MODULES: () => AI_GAME_PLAYER_SYSTEM_MODULES,
|
|
49
69
|
AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
|
|
@@ -85,6 +105,7 @@ __export(index_exports, {
|
|
|
85
105
|
QUIET_MEASURE_SIGNAL_BANDS: () => QUIET_MEASURE_SIGNAL_BANDS,
|
|
86
106
|
aiGameFeatureFlags: () => aiGameFeatureFlags,
|
|
87
107
|
assertAiGameIdentityProjectionContractVersion: () => assertAiGameIdentityProjectionContractVersion,
|
|
108
|
+
assertAiGameMissionContractVersion: () => assertAiGameMissionContractVersion,
|
|
88
109
|
classifyAiGameTask: () => classifyAiGameTask,
|
|
89
110
|
createAiGameAcademicTrainingSnapshot: () => createAiGameAcademicTrainingSnapshot,
|
|
90
111
|
createAiGameIdentityProjectionContract: () => createAiGameIdentityProjectionContract,
|
|
@@ -92,7 +113,18 @@ __export(index_exports, {
|
|
|
92
113
|
createAiGameIdentityTargetProjection: () => createAiGameIdentityTargetProjection,
|
|
93
114
|
createAiGameInstitutionEligibility: () => createAiGameInstitutionEligibility,
|
|
94
115
|
createAiGameMartialTrainingSnapshot: () => createAiGameMartialTrainingSnapshot,
|
|
116
|
+
createAiGameMissionDefinition: () => createAiGameMissionDefinition,
|
|
117
|
+
createAiGameMissionMccFocusInfluence: () => createAiGameMissionMccFocusInfluence,
|
|
118
|
+
createAiGameMissionObjectiveState: () => createAiGameMissionObjectiveState,
|
|
119
|
+
createAiGameMissionPlayerModelEvidence: () => createAiGameMissionPlayerModelEvidence,
|
|
120
|
+
createAiGameMissionPlayerModelInfluenceInput: () => createAiGameMissionPlayerModelInfluenceInput,
|
|
121
|
+
createAiGameMissionPlayerResponse: () => createAiGameMissionPlayerResponse,
|
|
122
|
+
createAiGameMissionReadinessContext: () => createAiGameMissionReadinessContext,
|
|
123
|
+
createAiGameMissionRewardBound: () => createAiGameMissionRewardBound,
|
|
124
|
+
createAiGameMissionRewardEnvelope: () => createAiGameMissionRewardEnvelope,
|
|
125
|
+
createAiGameMissionRewardGrant: () => createAiGameMissionRewardGrant,
|
|
95
126
|
createAiGamePlayerSystemAlert: () => createAiGamePlayerSystemAlert,
|
|
127
|
+
createAiGamePlayerSystemGuidanceCue: () => createAiGamePlayerSystemGuidanceCue,
|
|
96
128
|
createAiGamePlayerSystemPreferenceConfidenceState: () => createAiGamePlayerSystemPreferenceConfidenceState,
|
|
97
129
|
createAiGamePlayerSystemPreferenceInput: () => createAiGamePlayerSystemPreferenceInput,
|
|
98
130
|
createAiGamePlayerSystemPreferenceProfile: () => createAiGamePlayerSystemPreferenceProfile,
|
|
@@ -108,15 +140,30 @@ __export(index_exports, {
|
|
|
108
140
|
createQuietMeasureJudgmentResponse: () => createQuietMeasureJudgmentResponse,
|
|
109
141
|
gameEventFeatureFlags: () => gameEventFeatureFlags,
|
|
110
142
|
getAiGamePlayerSystemFocusModeContract: () => getAiGamePlayerSystemFocusModeContract,
|
|
143
|
+
getAiGamePlayerSystemGuidanceFallbackContract: () => getAiGamePlayerSystemGuidanceFallbackContract,
|
|
111
144
|
getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
|
|
112
145
|
isAiGameIdentityKnowledgeState: () => isAiGameIdentityKnowledgeState,
|
|
113
146
|
isAiGameIdentityProjectionRead: () => isAiGameIdentityProjectionRead,
|
|
114
147
|
isAiGameIdentityTargetCategory: () => isAiGameIdentityTargetCategory,
|
|
115
148
|
isAiGameIdentityVisibilityState: () => isAiGameIdentityVisibilityState,
|
|
149
|
+
isAiGameMissionClass: () => isAiGameMissionClass,
|
|
150
|
+
isAiGameMissionConfidenceBand: () => isAiGameMissionConfidenceBand,
|
|
151
|
+
isAiGameMissionFeedbackChannel: () => isAiGameMissionFeedbackChannel,
|
|
152
|
+
isAiGameMissionInfluenceSource: () => isAiGameMissionInfluenceSource,
|
|
153
|
+
isAiGameMissionObjectiveStatus: () => isAiGameMissionObjectiveStatus,
|
|
154
|
+
isAiGameMissionPlayerResponseKind: () => isAiGameMissionPlayerResponseKind,
|
|
155
|
+
isAiGameMissionPreferenceDimension: () => isAiGameMissionPreferenceDimension,
|
|
156
|
+
isAiGameMissionReadinessBand: () => isAiGameMissionReadinessBand,
|
|
157
|
+
isAiGameMissionRepeatedSignalHandling: () => isAiGameMissionRepeatedSignalHandling,
|
|
158
|
+
isAiGameMissionRewardCapSemantic: () => isAiGameMissionRewardCapSemantic,
|
|
159
|
+
isAiGameMissionRewardKind: () => isAiGameMissionRewardKind,
|
|
116
160
|
isAiGamePlayerSystemAlertDeliverable: () => isAiGamePlayerSystemAlertDeliverable,
|
|
117
161
|
isAiGamePlayerSystemAlertPriority: () => isAiGamePlayerSystemAlertPriority,
|
|
118
162
|
isAiGamePlayerSystemConfidenceBand: () => isAiGamePlayerSystemConfidenceBand,
|
|
119
163
|
isAiGamePlayerSystemFocusMode: () => isAiGamePlayerSystemFocusMode,
|
|
164
|
+
isAiGamePlayerSystemGuidanceCueSource: () => isAiGamePlayerSystemGuidanceCueSource,
|
|
165
|
+
isAiGamePlayerSystemGuidanceFallbackBehavior: () => isAiGamePlayerSystemGuidanceFallbackBehavior,
|
|
166
|
+
isAiGamePlayerSystemGuidanceFallbackId: () => isAiGamePlayerSystemGuidanceFallbackId,
|
|
120
167
|
isAiGamePlayerSystemInputModality: () => isAiGamePlayerSystemInputModality,
|
|
121
168
|
isAiGamePlayerSystemModule: () => isAiGamePlayerSystemModule,
|
|
122
169
|
isAiGamePlayerSystemPreferenceKind: () => isAiGamePlayerSystemPreferenceKind,
|
|
@@ -149,6 +196,7 @@ __export(index_exports, {
|
|
|
149
196
|
packageDescriptor: () => packageDescriptor,
|
|
150
197
|
projectTopicForAudience: () => projectTopicForAudience,
|
|
151
198
|
resolveAiGameIdentityProjectionRead: () => resolveAiGameIdentityProjectionRead,
|
|
199
|
+
resolveAiGameMissionConfidenceBand: () => resolveAiGameMissionConfidenceBand,
|
|
152
200
|
resolveAiGamePlayerAddressText: () => resolveAiGamePlayerAddressText,
|
|
153
201
|
resolveAiGamePlayerSystemConfidenceBand: () => resolveAiGamePlayerSystemConfidenceBand,
|
|
154
202
|
resolveAiGameTaskBatch: () => resolveAiGameTaskBatch,
|
|
@@ -292,6 +340,9 @@ function createAiGameMartialTrainingSnapshot(input) {
|
|
|
292
340
|
// src/player-system.ts
|
|
293
341
|
var AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID = "isekai.player-system.core.enabled";
|
|
294
342
|
var AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION = "1.0";
|
|
343
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_NFR_FEATURE_FLAG_ID = "isekai.player-system.guidance-nfr.enabled";
|
|
344
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES = 4096;
|
|
345
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE = 30;
|
|
295
346
|
var AI_GAME_PLAYER_SYSTEM_FOCUS_MODES = [
|
|
296
347
|
"ambient",
|
|
297
348
|
"focused",
|
|
@@ -313,6 +364,38 @@ var AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES = [
|
|
|
313
364
|
"normal",
|
|
314
365
|
"low"
|
|
315
366
|
];
|
|
367
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_SOURCES = [
|
|
368
|
+
"voice",
|
|
369
|
+
"narration",
|
|
370
|
+
"speech-capture"
|
|
371
|
+
];
|
|
372
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_IDS = [
|
|
373
|
+
"voice-unavailable",
|
|
374
|
+
"narration-unavailable",
|
|
375
|
+
"speech-capture-unavailable"
|
|
376
|
+
];
|
|
377
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_BEHAVIORS = [
|
|
378
|
+
"touch-controls-and-text-summary",
|
|
379
|
+
"status-copy-and-live-region",
|
|
380
|
+
"manual-actions-stay-visible"
|
|
381
|
+
];
|
|
382
|
+
var AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_CONTRACTS = Object.freeze([
|
|
383
|
+
Object.freeze({
|
|
384
|
+
id: "voice-unavailable",
|
|
385
|
+
source: "voice",
|
|
386
|
+
behavior: "touch-controls-and-text-summary"
|
|
387
|
+
}),
|
|
388
|
+
Object.freeze({
|
|
389
|
+
id: "narration-unavailable",
|
|
390
|
+
source: "narration",
|
|
391
|
+
behavior: "status-copy-and-live-region"
|
|
392
|
+
}),
|
|
393
|
+
Object.freeze({
|
|
394
|
+
id: "speech-capture-unavailable",
|
|
395
|
+
source: "speech-capture",
|
|
396
|
+
behavior: "manual-actions-stay-visible"
|
|
397
|
+
})
|
|
398
|
+
]);
|
|
316
399
|
var AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS = [
|
|
317
400
|
"combat",
|
|
318
401
|
"exploration",
|
|
@@ -499,6 +582,63 @@ function isAiGamePlayerSystemModule(value) {
|
|
|
499
582
|
function isAiGamePlayerSystemAlertPriority(value) {
|
|
500
583
|
return isMember(value, AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES);
|
|
501
584
|
}
|
|
585
|
+
function isAiGamePlayerSystemGuidanceCueSource(value) {
|
|
586
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_SOURCES);
|
|
587
|
+
}
|
|
588
|
+
function isAiGamePlayerSystemGuidanceFallbackId(value) {
|
|
589
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_IDS);
|
|
590
|
+
}
|
|
591
|
+
function isAiGamePlayerSystemGuidanceFallbackBehavior(value) {
|
|
592
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_BEHAVIORS);
|
|
593
|
+
}
|
|
594
|
+
function getAiGamePlayerSystemGuidanceFallbackContract(fallbackId) {
|
|
595
|
+
const contract = AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_CONTRACTS.find(
|
|
596
|
+
(candidate) => candidate.id === fallbackId
|
|
597
|
+
);
|
|
598
|
+
if (!contract) {
|
|
599
|
+
throw new Error("fallbackId must identify a supported guidance fallback");
|
|
600
|
+
}
|
|
601
|
+
return contract;
|
|
602
|
+
}
|
|
603
|
+
function createAiGamePlayerSystemGuidanceCue(input) {
|
|
604
|
+
assertNonEmptyString2(input.cueId, "cueId");
|
|
605
|
+
assertContractVersion(
|
|
606
|
+
input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION
|
|
607
|
+
);
|
|
608
|
+
if (!isAiGamePlayerSystemAlertPriority(input.priority)) {
|
|
609
|
+
throw new Error("priority must be a supported Player System alert priority");
|
|
610
|
+
}
|
|
611
|
+
if (!isAiGamePlayerSystemGuidanceCueSource(input.source)) {
|
|
612
|
+
throw new Error("source must be a supported guidance cue source");
|
|
613
|
+
}
|
|
614
|
+
if (!isAiGamePlayerSystemGuidanceFallbackId(input.fallbackId)) {
|
|
615
|
+
throw new Error("fallbackId must identify a supported guidance fallback");
|
|
616
|
+
}
|
|
617
|
+
const fallback = getAiGamePlayerSystemGuidanceFallbackContract(input.fallbackId);
|
|
618
|
+
if (fallback.source !== input.source) {
|
|
619
|
+
throw new Error("fallbackId must match the guidance cue source");
|
|
620
|
+
}
|
|
621
|
+
if (!Number.isInteger(input.maxPayloadBytes) || input.maxPayloadBytes < 1 || input.maxPayloadBytes > AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES) {
|
|
622
|
+
throw new Error(
|
|
623
|
+
`maxPayloadBytes must be between 1 and ${AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES}`
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
if (!Number.isInteger(input.maxOccurrencesPerMinute) || input.maxOccurrencesPerMinute < 1 || input.maxOccurrencesPerMinute > AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE) {
|
|
627
|
+
throw new Error(
|
|
628
|
+
`maxOccurrencesPerMinute must be between 1 and ${AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE}`
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
return Object.freeze({
|
|
632
|
+
cueId: input.cueId,
|
|
633
|
+
contractVersion: input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
634
|
+
featureFlagId: AI_GAME_PLAYER_SYSTEM_GUIDANCE_NFR_FEATURE_FLAG_ID,
|
|
635
|
+
priority: input.priority,
|
|
636
|
+
source: input.source,
|
|
637
|
+
fallbackId: input.fallbackId,
|
|
638
|
+
maxPayloadBytes: input.maxPayloadBytes,
|
|
639
|
+
maxOccurrencesPerMinute: input.maxOccurrencesPerMinute
|
|
640
|
+
});
|
|
641
|
+
}
|
|
502
642
|
function isAiGamePlayerSystemPreferenceKind(value) {
|
|
503
643
|
return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS);
|
|
504
644
|
}
|
|
@@ -673,6 +813,435 @@ function createAiGamePlayerSystemSession(input) {
|
|
|
673
813
|
});
|
|
674
814
|
}
|
|
675
815
|
|
|
816
|
+
// src/missions.ts
|
|
817
|
+
var AI_GAME_MISSIONS_FEATURE_FLAG_ID = "isekai.player-system.missions.enabled";
|
|
818
|
+
var AI_GAME_MISSIONS_CONTRACT_VERSION = "1.0";
|
|
819
|
+
var AI_GAME_MISSION_CLASSES = [
|
|
820
|
+
"bootstrap",
|
|
821
|
+
"short-term",
|
|
822
|
+
"medium-term",
|
|
823
|
+
"long-horizon"
|
|
824
|
+
];
|
|
825
|
+
var AI_GAME_MISSION_OBJECTIVE_STATUSES = [
|
|
826
|
+
"pending",
|
|
827
|
+
"active",
|
|
828
|
+
"completed",
|
|
829
|
+
"failed",
|
|
830
|
+
"abandoned"
|
|
831
|
+
];
|
|
832
|
+
var AI_GAME_MISSION_PLAYER_RESPONSE_KINDS = [
|
|
833
|
+
"accepted",
|
|
834
|
+
"refused",
|
|
835
|
+
"ignored",
|
|
836
|
+
"declined",
|
|
837
|
+
"pinned",
|
|
838
|
+
"completed",
|
|
839
|
+
"failed",
|
|
840
|
+
"abandoned"
|
|
841
|
+
];
|
|
842
|
+
var AI_GAME_MISSION_PREFERENCE_DIMENSIONS = [
|
|
843
|
+
"combat",
|
|
844
|
+
"exploration",
|
|
845
|
+
"crafting",
|
|
846
|
+
"social",
|
|
847
|
+
"governance"
|
|
848
|
+
];
|
|
849
|
+
var AI_GAME_MISSION_CONFIDENCE_BANDS = [
|
|
850
|
+
"low",
|
|
851
|
+
"medium",
|
|
852
|
+
"high"
|
|
853
|
+
];
|
|
854
|
+
var AI_GAME_MISSION_INFLUENCE_SOURCES = [
|
|
855
|
+
"mission-response",
|
|
856
|
+
"player-declared",
|
|
857
|
+
"world-observation",
|
|
858
|
+
"mcc-focus",
|
|
859
|
+
"world-pressure",
|
|
860
|
+
"bootstrap-policy"
|
|
861
|
+
];
|
|
862
|
+
var AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING = [
|
|
863
|
+
"accumulate",
|
|
864
|
+
"cap-at-confidence",
|
|
865
|
+
"decay-duplicate",
|
|
866
|
+
"ignore-duplicate"
|
|
867
|
+
];
|
|
868
|
+
var AI_GAME_MISSION_READINESS_BANDS = [
|
|
869
|
+
"bootstrap",
|
|
870
|
+
"ready",
|
|
871
|
+
"needs-prerequisites",
|
|
872
|
+
"institution-gated"
|
|
873
|
+
];
|
|
874
|
+
var AI_GAME_MISSION_FEEDBACK_CHANNELS = [
|
|
875
|
+
"audio",
|
|
876
|
+
"visual"
|
|
877
|
+
];
|
|
878
|
+
var AI_GAME_MISSION_REWARD_KINDS = [
|
|
879
|
+
"currency",
|
|
880
|
+
"item",
|
|
881
|
+
"recipe",
|
|
882
|
+
"temporary-modifier",
|
|
883
|
+
"knowledge-unlock"
|
|
884
|
+
];
|
|
885
|
+
var AI_GAME_MISSION_REWARD_CAP_SEMANTICS = [
|
|
886
|
+
"hard-cap",
|
|
887
|
+
"soft-cap",
|
|
888
|
+
"non-stackable"
|
|
889
|
+
];
|
|
890
|
+
function freezeReadonlyArray3(items) {
|
|
891
|
+
return Object.freeze([...items]);
|
|
892
|
+
}
|
|
893
|
+
function isMember2(value, members) {
|
|
894
|
+
return members.includes(value);
|
|
895
|
+
}
|
|
896
|
+
function assertNonEmptyString3(value, label) {
|
|
897
|
+
if (value.trim().length === 0) {
|
|
898
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
function assertIsoTimestamp2(value, label) {
|
|
902
|
+
assertNonEmptyString3(value, label);
|
|
903
|
+
if (Number.isNaN(Date.parse(value))) {
|
|
904
|
+
throw new Error(`${label} must be an ISO-8601 timestamp`);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function assertBoundedConfidence(value, label = "confidenceScore") {
|
|
908
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
909
|
+
throw new Error(`${label} must be between 0 and 1`);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function assertPositiveInteger(value, label) {
|
|
913
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
914
|
+
throw new Error(`${label} must be a positive integer`);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
function assertNonNegativeInteger2(value, label) {
|
|
918
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
919
|
+
throw new Error(`${label} must be a non-negative integer`);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
function createStringArray(values, label) {
|
|
923
|
+
return freezeReadonlyArray3(
|
|
924
|
+
(values ?? []).map((value, index) => {
|
|
925
|
+
assertNonEmptyString3(value, `${label}[${index}]`);
|
|
926
|
+
return value;
|
|
927
|
+
})
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
function assertContractVersion2(value, label = "contractVersion") {
|
|
931
|
+
if (value !== AI_GAME_MISSIONS_CONTRACT_VERSION) {
|
|
932
|
+
throw new Error(`${label} must be ${AI_GAME_MISSIONS_CONTRACT_VERSION}`);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
function assertFeedbackChannels(channels) {
|
|
936
|
+
const set = new Set(channels);
|
|
937
|
+
if (!set.has("audio") || !set.has("visual")) {
|
|
938
|
+
throw new Error("feedbackChannels must include both audio and visual");
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function isAiGameMissionClass(value) {
|
|
942
|
+
return isMember2(value, AI_GAME_MISSION_CLASSES);
|
|
943
|
+
}
|
|
944
|
+
function isAiGameMissionObjectiveStatus(value) {
|
|
945
|
+
return isMember2(value, AI_GAME_MISSION_OBJECTIVE_STATUSES);
|
|
946
|
+
}
|
|
947
|
+
function isAiGameMissionPlayerResponseKind(value) {
|
|
948
|
+
return isMember2(value, AI_GAME_MISSION_PLAYER_RESPONSE_KINDS);
|
|
949
|
+
}
|
|
950
|
+
function isAiGameMissionPreferenceDimension(value) {
|
|
951
|
+
return isMember2(value, AI_GAME_MISSION_PREFERENCE_DIMENSIONS);
|
|
952
|
+
}
|
|
953
|
+
function isAiGameMissionConfidenceBand(value) {
|
|
954
|
+
return isMember2(value, AI_GAME_MISSION_CONFIDENCE_BANDS);
|
|
955
|
+
}
|
|
956
|
+
function isAiGameMissionInfluenceSource(value) {
|
|
957
|
+
return isMember2(value, AI_GAME_MISSION_INFLUENCE_SOURCES);
|
|
958
|
+
}
|
|
959
|
+
function isAiGameMissionRepeatedSignalHandling(value) {
|
|
960
|
+
return isMember2(value, AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING);
|
|
961
|
+
}
|
|
962
|
+
function isAiGameMissionReadinessBand(value) {
|
|
963
|
+
return isMember2(value, AI_GAME_MISSION_READINESS_BANDS);
|
|
964
|
+
}
|
|
965
|
+
function isAiGameMissionFeedbackChannel(value) {
|
|
966
|
+
return isMember2(value, AI_GAME_MISSION_FEEDBACK_CHANNELS);
|
|
967
|
+
}
|
|
968
|
+
function isAiGameMissionRewardKind(value) {
|
|
969
|
+
return isMember2(value, AI_GAME_MISSION_REWARD_KINDS);
|
|
970
|
+
}
|
|
971
|
+
function isAiGameMissionRewardCapSemantic(value) {
|
|
972
|
+
return isMember2(value, AI_GAME_MISSION_REWARD_CAP_SEMANTICS);
|
|
973
|
+
}
|
|
974
|
+
function resolveAiGameMissionConfidenceBand(confidenceScore) {
|
|
975
|
+
assertBoundedConfidence(confidenceScore);
|
|
976
|
+
if (confidenceScore < 0.34) {
|
|
977
|
+
return "low";
|
|
978
|
+
}
|
|
979
|
+
if (confidenceScore < 0.67) {
|
|
980
|
+
return "medium";
|
|
981
|
+
}
|
|
982
|
+
return "high";
|
|
983
|
+
}
|
|
984
|
+
function createAiGameMissionReadinessContext(input) {
|
|
985
|
+
if (!isAiGameMissionReadinessBand(input.readinessBand)) {
|
|
986
|
+
throw new Error("readinessBand must be a supported mission readiness band");
|
|
987
|
+
}
|
|
988
|
+
return Object.freeze({
|
|
989
|
+
readinessBand: input.readinessBand,
|
|
990
|
+
stageGateRefs: createStringArray(input.stageGateRefs, "stageGateRefs"),
|
|
991
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function createAiGameMissionMccFocusInfluence(input) {
|
|
995
|
+
assertNonEmptyString3(input.targetCode, "targetCode");
|
|
996
|
+
assertBoundedConfidence(input.influenceWeight, "influenceWeight");
|
|
997
|
+
return Object.freeze({
|
|
998
|
+
targetCode: input.targetCode,
|
|
999
|
+
influenceWeight: input.influenceWeight,
|
|
1000
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
function createAiGameMissionPlayerModelEvidence(input) {
|
|
1004
|
+
assertNonEmptyString3(input.evidenceId, "evidenceId");
|
|
1005
|
+
assertNonEmptyString3(input.sourceId, "sourceId");
|
|
1006
|
+
assertIsoTimestamp2(input.capturedAtIso, "capturedAtIso");
|
|
1007
|
+
assertPositiveInteger(input.repeatedSignalCount, "repeatedSignalCount");
|
|
1008
|
+
return Object.freeze({
|
|
1009
|
+
evidenceId: input.evidenceId,
|
|
1010
|
+
sourceId: input.sourceId,
|
|
1011
|
+
capturedAtIso: input.capturedAtIso,
|
|
1012
|
+
repeatedSignalCount: input.repeatedSignalCount,
|
|
1013
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
function createAiGameMissionPlayerModelInfluenceInput(input) {
|
|
1017
|
+
assertNonEmptyString3(input.influenceId, "influenceId");
|
|
1018
|
+
assertNonEmptyString3(input.missionId, "missionId");
|
|
1019
|
+
if (!isAiGameMissionPreferenceDimension(input.preferenceDimension)) {
|
|
1020
|
+
throw new Error(
|
|
1021
|
+
"preferenceDimension must be a supported mission preference dimension"
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
if (!isAiGameMissionInfluenceSource(input.source)) {
|
|
1025
|
+
throw new Error("source must be a supported mission influence source");
|
|
1026
|
+
}
|
|
1027
|
+
if (!isAiGameMissionRepeatedSignalHandling(input.repeatedSignalHandling)) {
|
|
1028
|
+
throw new Error(
|
|
1029
|
+
"repeatedSignalHandling must be a supported repeated signal handling mode"
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
assertBoundedConfidence(input.confidenceScore);
|
|
1033
|
+
const confidenceBand = input.confidenceBand ?? resolveAiGameMissionConfidenceBand(input.confidenceScore);
|
|
1034
|
+
if (!isAiGameMissionConfidenceBand(confidenceBand)) {
|
|
1035
|
+
throw new Error("confidenceBand must be a supported mission confidence band");
|
|
1036
|
+
}
|
|
1037
|
+
if (confidenceBand !== resolveAiGameMissionConfidenceBand(input.confidenceScore)) {
|
|
1038
|
+
throw new Error("confidenceBand must match confidenceScore");
|
|
1039
|
+
}
|
|
1040
|
+
return Object.freeze({
|
|
1041
|
+
influenceId: input.influenceId,
|
|
1042
|
+
missionId: input.missionId,
|
|
1043
|
+
preferenceDimension: input.preferenceDimension,
|
|
1044
|
+
source: input.source,
|
|
1045
|
+
confidenceScore: input.confidenceScore,
|
|
1046
|
+
confidenceBand,
|
|
1047
|
+
evidence: createAiGameMissionPlayerModelEvidence(input.evidence),
|
|
1048
|
+
repeatedSignalHandling: input.repeatedSignalHandling,
|
|
1049
|
+
readinessContext: createAiGameMissionReadinessContext(input.readinessContext),
|
|
1050
|
+
mccFocusInfluence: input.mccFocusInfluence ? createAiGameMissionMccFocusInfluence(input.mccFocusInfluence) : null,
|
|
1051
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
function createAiGameMissionRewardBound(input) {
|
|
1055
|
+
assertNonNegativeInteger2(input.minimum, "minimum");
|
|
1056
|
+
assertNonNegativeInteger2(input.maximum, "maximum");
|
|
1057
|
+
assertNonNegativeInteger2(input.cap, "cap");
|
|
1058
|
+
if (!isAiGameMissionRewardCapSemantic(input.capSemantic)) {
|
|
1059
|
+
throw new Error("capSemantic must be a supported mission reward cap semantic");
|
|
1060
|
+
}
|
|
1061
|
+
if (input.maximum < input.minimum) {
|
|
1062
|
+
throw new Error("maximum must be greater than or equal to minimum");
|
|
1063
|
+
}
|
|
1064
|
+
if (input.cap < input.maximum) {
|
|
1065
|
+
throw new Error("cap must be greater than or equal to maximum");
|
|
1066
|
+
}
|
|
1067
|
+
return Object.freeze({
|
|
1068
|
+
minimum: input.minimum,
|
|
1069
|
+
maximum: input.maximum,
|
|
1070
|
+
cap: input.cap,
|
|
1071
|
+
capSemantic: input.capSemantic
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function createAiGameMissionRewardGrant(input) {
|
|
1075
|
+
assertNonEmptyString3(input.rewardId, "rewardId");
|
|
1076
|
+
assertNonEmptyString3(input.label, "label");
|
|
1077
|
+
if (!isAiGameMissionRewardKind(input.kind)) {
|
|
1078
|
+
throw new Error("kind must be a supported mission reward kind");
|
|
1079
|
+
}
|
|
1080
|
+
const cannotSkipReasonCodes = createStringArray(
|
|
1081
|
+
input.cannotSkipReasonCodes,
|
|
1082
|
+
"cannotSkipReasonCodes"
|
|
1083
|
+
);
|
|
1084
|
+
if (cannotSkipReasonCodes.length === 0) {
|
|
1085
|
+
throw new Error("cannotSkipReasonCodes must contain at least one reason code");
|
|
1086
|
+
}
|
|
1087
|
+
const temporaryDurationMinutes = input.temporaryDurationMinutes ?? null;
|
|
1088
|
+
if (temporaryDurationMinutes !== null) {
|
|
1089
|
+
assertPositiveInteger(temporaryDurationMinutes, "temporaryDurationMinutes");
|
|
1090
|
+
}
|
|
1091
|
+
if (input.kind === "temporary-modifier" && temporaryDurationMinutes === null) {
|
|
1092
|
+
throw new Error(
|
|
1093
|
+
"temporaryDurationMinutes is required for temporary-modifier rewards"
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
return Object.freeze({
|
|
1097
|
+
rewardId: input.rewardId,
|
|
1098
|
+
kind: input.kind,
|
|
1099
|
+
label: input.label,
|
|
1100
|
+
bound: createAiGameMissionRewardBound(input.bound),
|
|
1101
|
+
readinessContext: createAiGameMissionReadinessContext(input.readinessContext),
|
|
1102
|
+
stageGateRefs: createStringArray(input.stageGateRefs, "stageGateRefs"),
|
|
1103
|
+
cannotSkipReasonCodes,
|
|
1104
|
+
temporaryDurationMinutes
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
function createAiGameMissionRewardEnvelope(input) {
|
|
1108
|
+
assertNonEmptyString3(input.missionId, "missionId");
|
|
1109
|
+
if (input.grants.length === 0) {
|
|
1110
|
+
throw new Error("grants must contain at least one reward grant");
|
|
1111
|
+
}
|
|
1112
|
+
return Object.freeze({
|
|
1113
|
+
contractVersion: AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
1114
|
+
missionId: input.missionId,
|
|
1115
|
+
featureFlagId: AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
1116
|
+
progressionSafe: true,
|
|
1117
|
+
accelerantOnly: true,
|
|
1118
|
+
grants: freezeReadonlyArray3(
|
|
1119
|
+
input.grants.map((grant) => createAiGameMissionRewardGrant(grant))
|
|
1120
|
+
),
|
|
1121
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function createAiGameMissionObjectiveState(input) {
|
|
1125
|
+
assertNonEmptyString3(input.objectiveId, "objectiveId");
|
|
1126
|
+
assertNonEmptyString3(input.objectiveCode, "objectiveCode");
|
|
1127
|
+
assertNonEmptyString3(input.label, "label");
|
|
1128
|
+
if (!isAiGameMissionObjectiveStatus(input.status)) {
|
|
1129
|
+
throw new Error("status must be a supported mission objective status");
|
|
1130
|
+
}
|
|
1131
|
+
assertPositiveInteger(input.targetCount, "targetCount");
|
|
1132
|
+
const currentCount = input.currentCount ?? 0;
|
|
1133
|
+
assertNonNegativeInteger2(currentCount, "currentCount");
|
|
1134
|
+
if (currentCount > input.targetCount) {
|
|
1135
|
+
throw new Error("currentCount must be less than or equal to targetCount");
|
|
1136
|
+
}
|
|
1137
|
+
assertIsoTimestamp2(input.updatedAtIso, "updatedAtIso");
|
|
1138
|
+
return Object.freeze({
|
|
1139
|
+
contractVersion: AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
1140
|
+
objectiveId: input.objectiveId,
|
|
1141
|
+
objectiveCode: input.objectiveCode,
|
|
1142
|
+
label: input.label,
|
|
1143
|
+
status: input.status,
|
|
1144
|
+
targetCount: input.targetCount,
|
|
1145
|
+
currentCount,
|
|
1146
|
+
optional: input.optional ?? false,
|
|
1147
|
+
updatedAtIso: input.updatedAtIso,
|
|
1148
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
function createAiGameMissionDefinition(input) {
|
|
1152
|
+
assertNonEmptyString3(input.missionId, "missionId");
|
|
1153
|
+
assertNonEmptyString3(input.missionCode, "missionCode");
|
|
1154
|
+
assertNonEmptyString3(input.title, "title");
|
|
1155
|
+
assertNonEmptyString3(input.summary, "summary");
|
|
1156
|
+
if (!isAiGameMissionClass(input.missionClass)) {
|
|
1157
|
+
throw new Error("missionClass must be a supported mission class");
|
|
1158
|
+
}
|
|
1159
|
+
const feedbackChannels = freezeReadonlyArray3(
|
|
1160
|
+
(input.feedbackChannels ?? AI_GAME_MISSION_FEEDBACK_CHANNELS).map((channel) => {
|
|
1161
|
+
if (!isAiGameMissionFeedbackChannel(channel)) {
|
|
1162
|
+
throw new Error("feedbackChannels must use supported mission channels");
|
|
1163
|
+
}
|
|
1164
|
+
return channel;
|
|
1165
|
+
})
|
|
1166
|
+
);
|
|
1167
|
+
assertFeedbackChannels(feedbackChannels);
|
|
1168
|
+
if (input.preferenceDimensions.length === 0) {
|
|
1169
|
+
throw new Error(
|
|
1170
|
+
"preferenceDimensions must contain at least one mission preference dimension"
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
const preferenceDimensions = freezeReadonlyArray3(
|
|
1174
|
+
input.preferenceDimensions.map((dimension) => {
|
|
1175
|
+
if (!isAiGameMissionPreferenceDimension(dimension)) {
|
|
1176
|
+
throw new Error(
|
|
1177
|
+
"preferenceDimensions must use supported mission preference dimensions"
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
return dimension;
|
|
1181
|
+
})
|
|
1182
|
+
);
|
|
1183
|
+
if (input.objectiveStates.length === 0) {
|
|
1184
|
+
throw new Error("objectiveStates must contain at least one mission objective");
|
|
1185
|
+
}
|
|
1186
|
+
return Object.freeze({
|
|
1187
|
+
contractVersion: AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
1188
|
+
missionId: input.missionId,
|
|
1189
|
+
missionCode: input.missionCode,
|
|
1190
|
+
featureFlagId: AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
1191
|
+
missionClass: input.missionClass,
|
|
1192
|
+
title: input.title,
|
|
1193
|
+
summary: input.summary,
|
|
1194
|
+
bootstrapSafe: input.bootstrapSafe ?? input.missionClass === "bootstrap",
|
|
1195
|
+
feedbackChannels,
|
|
1196
|
+
preferenceDimensions,
|
|
1197
|
+
nearbyOpportunityCodes: createStringArray(
|
|
1198
|
+
input.nearbyOpportunityCodes,
|
|
1199
|
+
"nearbyOpportunityCodes"
|
|
1200
|
+
),
|
|
1201
|
+
worldPressureCodes: createStringArray(
|
|
1202
|
+
input.worldPressureCodes,
|
|
1203
|
+
"worldPressureCodes"
|
|
1204
|
+
),
|
|
1205
|
+
readinessContext: createAiGameMissionReadinessContext(input.readinessContext),
|
|
1206
|
+
objectiveStates: freezeReadonlyArray3(
|
|
1207
|
+
input.objectiveStates.map(
|
|
1208
|
+
(objectiveState) => createAiGameMissionObjectiveState(objectiveState)
|
|
1209
|
+
)
|
|
1210
|
+
),
|
|
1211
|
+
rewardEnvelope: createAiGameMissionRewardEnvelope(input.rewardEnvelope),
|
|
1212
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
function createAiGameMissionPlayerResponse(input) {
|
|
1216
|
+
assertNonEmptyString3(input.responseId, "responseId");
|
|
1217
|
+
assertNonEmptyString3(input.missionId, "missionId");
|
|
1218
|
+
assertIsoTimestamp2(input.respondedAtIso, "respondedAtIso");
|
|
1219
|
+
if (!isAiGameMissionPlayerResponseKind(input.responseKind)) {
|
|
1220
|
+
throw new Error("responseKind must be a supported mission player response kind");
|
|
1221
|
+
}
|
|
1222
|
+
return Object.freeze({
|
|
1223
|
+
contractVersion: AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
1224
|
+
responseId: input.responseId,
|
|
1225
|
+
missionId: input.missionId,
|
|
1226
|
+
responseKind: input.responseKind,
|
|
1227
|
+
respondedAtIso: input.respondedAtIso,
|
|
1228
|
+
objectiveStates: freezeReadonlyArray3(
|
|
1229
|
+
(input.objectiveStates ?? []).map(
|
|
1230
|
+
(objectiveState) => createAiGameMissionObjectiveState(objectiveState)
|
|
1231
|
+
)
|
|
1232
|
+
),
|
|
1233
|
+
influenceInputs: freezeReadonlyArray3(
|
|
1234
|
+
(input.influenceInputs ?? []).map(
|
|
1235
|
+
(influenceInput) => createAiGameMissionPlayerModelInfluenceInput(influenceInput)
|
|
1236
|
+
)
|
|
1237
|
+
),
|
|
1238
|
+
reasonCodes: createStringArray(input.reasonCodes, "reasonCodes")
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
function assertAiGameMissionContractVersion(value) {
|
|
1242
|
+
assertContractVersion2(value);
|
|
1243
|
+
}
|
|
1244
|
+
|
|
676
1245
|
// src/identity.ts
|
|
677
1246
|
var AI_GAME_IDENTITY_FEATURE_FLAG_ID = "isekai.player-system.identity.enabled";
|
|
678
1247
|
var AI_GAME_IDENTITY_CONTRACT_VERSION = "1.0";
|
|
@@ -698,25 +1267,25 @@ var AI_GAME_IDENTITY_DISCLOSURE_POLICY = Object.freeze({
|
|
|
698
1267
|
visibleTargets: "partial-or-full-by-knowledge",
|
|
699
1268
|
occludedTargets: "partial-redacted"
|
|
700
1269
|
});
|
|
701
|
-
function
|
|
1270
|
+
function freezeReadonlyArray4(items) {
|
|
702
1271
|
return Object.freeze([...items]);
|
|
703
1272
|
}
|
|
704
|
-
function
|
|
1273
|
+
function assertNonEmptyString4(value, label) {
|
|
705
1274
|
if (value.trim().length === 0) {
|
|
706
1275
|
throw new Error(`${label} must be a non-empty string`);
|
|
707
1276
|
}
|
|
708
1277
|
}
|
|
709
|
-
function
|
|
1278
|
+
function assertContractVersion3(value, label = "contractVersion") {
|
|
710
1279
|
if (value !== AI_GAME_IDENTITY_CONTRACT_VERSION) {
|
|
711
1280
|
throw new Error(`${label} must be ${AI_GAME_IDENTITY_CONTRACT_VERSION}`);
|
|
712
1281
|
}
|
|
713
1282
|
}
|
|
714
|
-
function
|
|
1283
|
+
function isMember3(value, members) {
|
|
715
1284
|
return members.includes(value);
|
|
716
1285
|
}
|
|
717
1286
|
function createField(field) {
|
|
718
|
-
|
|
719
|
-
|
|
1287
|
+
assertNonEmptyString4(field.label, "field.label");
|
|
1288
|
+
assertNonEmptyString4(field.value, "field.value");
|
|
720
1289
|
return Object.freeze({
|
|
721
1290
|
contractVersion: AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
722
1291
|
label: field.label,
|
|
@@ -732,38 +1301,38 @@ function redactField(field, value) {
|
|
|
732
1301
|
});
|
|
733
1302
|
}
|
|
734
1303
|
function isAiGameIdentityProjectionRead(value) {
|
|
735
|
-
return
|
|
1304
|
+
return isMember3(value, AI_GAME_IDENTITY_PROJECTION_READS);
|
|
736
1305
|
}
|
|
737
1306
|
function isAiGameIdentityTargetCategory(value) {
|
|
738
|
-
return
|
|
1307
|
+
return isMember3(value, AI_GAME_IDENTITY_TARGET_CATEGORIES);
|
|
739
1308
|
}
|
|
740
1309
|
function isAiGameIdentityKnowledgeState(value) {
|
|
741
|
-
return
|
|
1310
|
+
return isMember3(value, AI_GAME_IDENTITY_KNOWLEDGE_STATES);
|
|
742
1311
|
}
|
|
743
1312
|
function isAiGameIdentityVisibilityState(value) {
|
|
744
|
-
return
|
|
1313
|
+
return isMember3(value, AI_GAME_IDENTITY_VISIBILITY_STATES);
|
|
745
1314
|
}
|
|
746
1315
|
function resolveAiGameIdentityProjectionRead(input) {
|
|
747
1316
|
return input.lineOfSight && input.knowledgeState === "full" ? "full" : "partial";
|
|
748
1317
|
}
|
|
749
1318
|
function createAiGameIdentitySelfProjection(input) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
1319
|
+
assertNonEmptyString4(input.entityId, "entityId");
|
|
1320
|
+
assertNonEmptyString4(input.label, "label");
|
|
1321
|
+
assertNonEmptyString4(input.summary, "summary");
|
|
753
1322
|
return Object.freeze({
|
|
754
1323
|
contractVersion: AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
755
1324
|
entityId: input.entityId,
|
|
756
1325
|
label: input.label,
|
|
757
1326
|
projectionRead: "self",
|
|
758
1327
|
summary: input.summary,
|
|
759
|
-
fields:
|
|
1328
|
+
fields: freezeReadonlyArray4(input.fields.map((field) => createField(field)))
|
|
760
1329
|
});
|
|
761
1330
|
}
|
|
762
1331
|
function createAiGameIdentityTargetProjection(input) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
1332
|
+
assertNonEmptyString4(input.targetId, "targetId");
|
|
1333
|
+
assertNonEmptyString4(input.label, "label");
|
|
1334
|
+
assertNonEmptyString4(input.summary, "summary");
|
|
1335
|
+
assertNonEmptyString4(input.combatSummary, "combatSummary");
|
|
767
1336
|
if (!isAiGameIdentityTargetCategory(input.category)) {
|
|
768
1337
|
throw new Error("category must be a supported identity target category");
|
|
769
1338
|
}
|
|
@@ -786,17 +1355,17 @@ function createAiGameIdentityTargetProjection(input) {
|
|
|
786
1355
|
projectionRead,
|
|
787
1356
|
summary: input.summary,
|
|
788
1357
|
combatSummary: input.combatSummary,
|
|
789
|
-
fields:
|
|
1358
|
+
fields: freezeReadonlyArray4(fields)
|
|
790
1359
|
});
|
|
791
1360
|
}
|
|
792
1361
|
function selectAiGameVisibleIdentityTargets(targets) {
|
|
793
|
-
return
|
|
1362
|
+
return freezeReadonlyArray4(
|
|
794
1363
|
targets.filter((target) => target.visibility === "visible" && target.lineOfSight)
|
|
795
1364
|
);
|
|
796
1365
|
}
|
|
797
1366
|
function createAiGameIdentityProjectionContract(input) {
|
|
798
1367
|
const self = createAiGameIdentitySelfProjection(input.self);
|
|
799
|
-
const targets =
|
|
1368
|
+
const targets = freezeReadonlyArray4(
|
|
800
1369
|
(input.targets ?? []).map((target) => createAiGameIdentityTargetProjection(target))
|
|
801
1370
|
);
|
|
802
1371
|
return Object.freeze({
|
|
@@ -810,7 +1379,7 @@ function createAiGameIdentityProjectionContract(input) {
|
|
|
810
1379
|
});
|
|
811
1380
|
}
|
|
812
1381
|
function assertAiGameIdentityProjectionContractVersion(value) {
|
|
813
|
-
|
|
1382
|
+
assertContractVersion3(value);
|
|
814
1383
|
}
|
|
815
1384
|
|
|
816
1385
|
// src/world-events.ts
|
|
@@ -964,7 +1533,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
|
964
1533
|
"private-or-low-witness-evidence",
|
|
965
1534
|
"costly-pressure-event"
|
|
966
1535
|
];
|
|
967
|
-
function
|
|
1536
|
+
function isMember4(value, members) {
|
|
968
1537
|
return members.includes(value);
|
|
969
1538
|
}
|
|
970
1539
|
function assertRecord(value, label) {
|
|
@@ -1005,7 +1574,7 @@ function normalizeTimestamp(value, label) {
|
|
|
1005
1574
|
}
|
|
1006
1575
|
function normalizeMember(value, members, label) {
|
|
1007
1576
|
const normalized = normalizeNonEmptyString(value, label);
|
|
1008
|
-
if (!
|
|
1577
|
+
if (!isMember4(normalized, members)) {
|
|
1009
1578
|
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
1010
1579
|
}
|
|
1011
1580
|
return normalized;
|
|
@@ -1138,13 +1707,13 @@ function normalizeDominantReads(value) {
|
|
|
1138
1707
|
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
1139
1708
|
}
|
|
1140
1709
|
function isQuietMeasureAxis(value) {
|
|
1141
|
-
return
|
|
1710
|
+
return isMember4(value, QUIET_MEASURE_AXES);
|
|
1142
1711
|
}
|
|
1143
1712
|
function isQuietMeasureMissionProbeMode(value) {
|
|
1144
|
-
return
|
|
1713
|
+
return isMember4(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
1145
1714
|
}
|
|
1146
1715
|
function isQuietMeasureMissionResolutionShape(value) {
|
|
1147
|
-
return
|
|
1716
|
+
return isMember4(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
1148
1717
|
}
|
|
1149
1718
|
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
1150
1719
|
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
@@ -1658,6 +2227,19 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1658
2227
|
AI_GAME_IDENTITY_TARGET_CATEGORIES,
|
|
1659
2228
|
AI_GAME_IDENTITY_VISIBILITY_STATES,
|
|
1660
2229
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
2230
|
+
AI_GAME_MISSIONS_CONTRACT_VERSION,
|
|
2231
|
+
AI_GAME_MISSIONS_FEATURE_FLAG_ID,
|
|
2232
|
+
AI_GAME_MISSION_CLASSES,
|
|
2233
|
+
AI_GAME_MISSION_CONFIDENCE_BANDS,
|
|
2234
|
+
AI_GAME_MISSION_FEEDBACK_CHANNELS,
|
|
2235
|
+
AI_GAME_MISSION_INFLUENCE_SOURCES,
|
|
2236
|
+
AI_GAME_MISSION_OBJECTIVE_STATUSES,
|
|
2237
|
+
AI_GAME_MISSION_PLAYER_RESPONSE_KINDS,
|
|
2238
|
+
AI_GAME_MISSION_PREFERENCE_DIMENSIONS,
|
|
2239
|
+
AI_GAME_MISSION_READINESS_BANDS,
|
|
2240
|
+
AI_GAME_MISSION_REPEATED_SIGNAL_HANDLING,
|
|
2241
|
+
AI_GAME_MISSION_REWARD_CAP_SEMANTICS,
|
|
2242
|
+
AI_GAME_MISSION_REWARD_KINDS,
|
|
1661
2243
|
AI_GAME_PACKAGE,
|
|
1662
2244
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
1663
2245
|
AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
|
|
@@ -1666,6 +2248,13 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1666
2248
|
AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
|
|
1667
2249
|
AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
|
|
1668
2250
|
AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS,
|
|
2251
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_OCCURRENCES_PER_MINUTE,
|
|
2252
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_MAX_PAYLOAD_BYTES,
|
|
2253
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_CUE_SOURCES,
|
|
2254
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_BEHAVIORS,
|
|
2255
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_CONTRACTS,
|
|
2256
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_FALLBACK_IDS,
|
|
2257
|
+
AI_GAME_PLAYER_SYSTEM_GUIDANCE_NFR_FEATURE_FLAG_ID,
|
|
1669
2258
|
AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
|
|
1670
2259
|
AI_GAME_PLAYER_SYSTEM_MODULES,
|
|
1671
2260
|
AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
|
|
@@ -1707,6 +2296,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1707
2296
|
QUIET_MEASURE_SIGNAL_BANDS,
|
|
1708
2297
|
aiGameFeatureFlags,
|
|
1709
2298
|
assertAiGameIdentityProjectionContractVersion,
|
|
2299
|
+
assertAiGameMissionContractVersion,
|
|
1710
2300
|
classifyAiGameTask,
|
|
1711
2301
|
createAiGameAcademicTrainingSnapshot,
|
|
1712
2302
|
createAiGameIdentityProjectionContract,
|
|
@@ -1714,7 +2304,18 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1714
2304
|
createAiGameIdentityTargetProjection,
|
|
1715
2305
|
createAiGameInstitutionEligibility,
|
|
1716
2306
|
createAiGameMartialTrainingSnapshot,
|
|
2307
|
+
createAiGameMissionDefinition,
|
|
2308
|
+
createAiGameMissionMccFocusInfluence,
|
|
2309
|
+
createAiGameMissionObjectiveState,
|
|
2310
|
+
createAiGameMissionPlayerModelEvidence,
|
|
2311
|
+
createAiGameMissionPlayerModelInfluenceInput,
|
|
2312
|
+
createAiGameMissionPlayerResponse,
|
|
2313
|
+
createAiGameMissionReadinessContext,
|
|
2314
|
+
createAiGameMissionRewardBound,
|
|
2315
|
+
createAiGameMissionRewardEnvelope,
|
|
2316
|
+
createAiGameMissionRewardGrant,
|
|
1717
2317
|
createAiGamePlayerSystemAlert,
|
|
2318
|
+
createAiGamePlayerSystemGuidanceCue,
|
|
1718
2319
|
createAiGamePlayerSystemPreferenceConfidenceState,
|
|
1719
2320
|
createAiGamePlayerSystemPreferenceInput,
|
|
1720
2321
|
createAiGamePlayerSystemPreferenceProfile,
|
|
@@ -1730,15 +2331,30 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1730
2331
|
createQuietMeasureJudgmentResponse,
|
|
1731
2332
|
gameEventFeatureFlags,
|
|
1732
2333
|
getAiGamePlayerSystemFocusModeContract,
|
|
2334
|
+
getAiGamePlayerSystemGuidanceFallbackContract,
|
|
1733
2335
|
getAiGamePlayerSystemModuleContract,
|
|
1734
2336
|
isAiGameIdentityKnowledgeState,
|
|
1735
2337
|
isAiGameIdentityProjectionRead,
|
|
1736
2338
|
isAiGameIdentityTargetCategory,
|
|
1737
2339
|
isAiGameIdentityVisibilityState,
|
|
2340
|
+
isAiGameMissionClass,
|
|
2341
|
+
isAiGameMissionConfidenceBand,
|
|
2342
|
+
isAiGameMissionFeedbackChannel,
|
|
2343
|
+
isAiGameMissionInfluenceSource,
|
|
2344
|
+
isAiGameMissionObjectiveStatus,
|
|
2345
|
+
isAiGameMissionPlayerResponseKind,
|
|
2346
|
+
isAiGameMissionPreferenceDimension,
|
|
2347
|
+
isAiGameMissionReadinessBand,
|
|
2348
|
+
isAiGameMissionRepeatedSignalHandling,
|
|
2349
|
+
isAiGameMissionRewardCapSemantic,
|
|
2350
|
+
isAiGameMissionRewardKind,
|
|
1738
2351
|
isAiGamePlayerSystemAlertDeliverable,
|
|
1739
2352
|
isAiGamePlayerSystemAlertPriority,
|
|
1740
2353
|
isAiGamePlayerSystemConfidenceBand,
|
|
1741
2354
|
isAiGamePlayerSystemFocusMode,
|
|
2355
|
+
isAiGamePlayerSystemGuidanceCueSource,
|
|
2356
|
+
isAiGamePlayerSystemGuidanceFallbackBehavior,
|
|
2357
|
+
isAiGamePlayerSystemGuidanceFallbackId,
|
|
1742
2358
|
isAiGamePlayerSystemInputModality,
|
|
1743
2359
|
isAiGamePlayerSystemModule,
|
|
1744
2360
|
isAiGamePlayerSystemPreferenceKind,
|
|
@@ -1771,6 +2387,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
1771
2387
|
packageDescriptor,
|
|
1772
2388
|
projectTopicForAudience,
|
|
1773
2389
|
resolveAiGameIdentityProjectionRead,
|
|
2390
|
+
resolveAiGameMissionConfidenceBand,
|
|
1774
2391
|
resolveAiGamePlayerAddressText,
|
|
1775
2392
|
resolveAiGamePlayerSystemConfidenceBand,
|
|
1776
2393
|
resolveAiGameTaskBatch,
|