@plasius/ai-game 0.1.12 → 0.2.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 +31 -0
- package/README.md +23 -0
- package/dist/index.cjs +492 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -7
- package/dist/index.d.ts +124 -7
- package/dist/index.js +465 -36
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0011-player-system-core-contract-boundary.md +56 -0
- package/docs/adrs/index.md +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
// src/training-state.ts
|
|
2
2
|
import {
|
|
3
|
+
TRAINING_ACADEMIES_FEATURE_FLAG_ID,
|
|
3
4
|
TRAINING_FEATURE_FLAG_ID,
|
|
4
5
|
TRAINING_MARTIAL_FEATURE_FLAG_ID,
|
|
6
|
+
TRAINING_TRUST_MARKER_SOURCES,
|
|
7
|
+
TRAINING_ACADEMIC_PROGRESS_STAGES,
|
|
8
|
+
TRAINING_ACADEMY_ADMISSION_DECISIONS,
|
|
9
|
+
TRAINING_INSTRUCTION_ACCESS_LEVELS,
|
|
10
|
+
TRAINING_TECHNIQUE_MASTERY_STATES,
|
|
5
11
|
TRAINING_MARTIAL_TECHNIQUE_TRACKS,
|
|
6
12
|
TRAINING_BARRACKS_DRILL_DELIVERY_MODES,
|
|
7
13
|
TRAINING_MARTIAL_TECHNIQUE_FAMILIES,
|
|
8
14
|
TRAINING_ANTI_SPELL_FIELDCRAFT_FAMILIES,
|
|
9
15
|
TRAINING_ANTI_SPELL_COUNTER_WINDOWS,
|
|
16
|
+
createTrainingAcademicMissionPrerequisite,
|
|
17
|
+
createTrainingAcademyAdmission,
|
|
10
18
|
createTrainingAntiSpellFieldcraftDiscipline,
|
|
11
19
|
createTrainingBarracksDrill,
|
|
12
20
|
createTrainingInstitution,
|
|
13
21
|
createTrainingMartialTechnique,
|
|
14
22
|
createTrainingMissionTechniqueUnlock,
|
|
15
23
|
createTrainingProgressionRecord,
|
|
24
|
+
createTrainingSchoolProgression,
|
|
25
|
+
createTrainingTrackSelection,
|
|
26
|
+
createTrainingTrustMarker,
|
|
27
|
+
isTrainingAcademicProgressStage,
|
|
28
|
+
isTrainingAcademyAdmissionDecision,
|
|
16
29
|
isMccExpressionTrack,
|
|
17
30
|
isTrainingAntiSpellCounterWindow,
|
|
18
31
|
isTrainingAntiSpellFieldcraftFamily,
|
|
19
32
|
isTrainingBarracksDrillDeliveryMode,
|
|
33
|
+
isTrainingInstructionAccessLevel,
|
|
20
34
|
isTrainingMartialTechniqueFamily,
|
|
21
35
|
isTrainingMartialTechniqueTrack,
|
|
36
|
+
isTrainingTechniqueMasteryState,
|
|
37
|
+
isTrainingTrustMarkerSource,
|
|
22
38
|
isTrainingTrustLevel
|
|
23
39
|
} from "@plasius/training";
|
|
24
40
|
var AI_GAME_TRAINING_STAGE_GATES = [
|
|
@@ -28,12 +44,6 @@ var AI_GAME_TRAINING_STAGE_GATES = [
|
|
|
28
44
|
"advanced-specialization",
|
|
29
45
|
"dominion-and-divine"
|
|
30
46
|
];
|
|
31
|
-
var AI_GAME_TRAINING_TRUST_MARKER_SOURCES = [
|
|
32
|
-
"system",
|
|
33
|
-
"mission",
|
|
34
|
-
"institution",
|
|
35
|
-
"sponsor"
|
|
36
|
-
];
|
|
37
47
|
var AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS = [
|
|
38
48
|
"low",
|
|
39
49
|
"medium",
|
|
@@ -52,21 +62,12 @@ function assertNonEmptyString(value, label) {
|
|
|
52
62
|
throw new Error(`${label} must be a non-empty string`);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
|
-
function assertIsoTimestamp(value, label) {
|
|
56
|
-
assertNonEmptyString(value, label);
|
|
57
|
-
if (Number.isNaN(Date.parse(value))) {
|
|
58
|
-
throw new Error(`${label} must be an ISO-8601 timestamp`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
65
|
function isTrainingInstitutionType(value) {
|
|
62
66
|
return value === "school" || value === "barracks" || value === "academy" || value === "apprenticeship";
|
|
63
67
|
}
|
|
64
68
|
function isAiGameTrainingStageGate(value) {
|
|
65
69
|
return AI_GAME_TRAINING_STAGE_GATES.includes(value);
|
|
66
70
|
}
|
|
67
|
-
function isAiGameTrainingTrustMarkerSource(value) {
|
|
68
|
-
return AI_GAME_TRAINING_TRUST_MARKER_SOURCES.includes(value);
|
|
69
|
-
}
|
|
70
71
|
function isAiGameTrainingRecommendationConfidenceBand(value) {
|
|
71
72
|
return AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS.includes(value);
|
|
72
73
|
}
|
|
@@ -94,19 +95,7 @@ function createAiGameInstitutionEligibility(input) {
|
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
function createAiGameTrainingTrustMarker(input) {
|
|
97
|
-
|
|
98
|
-
assertNonEmptyString(input.institutionId, "institutionId");
|
|
99
|
-
assertIsoTimestamp(input.awardedAtIso, "awardedAtIso");
|
|
100
|
-
if (!isTrainingTrustLevel(input.trustLevel)) {
|
|
101
|
-
throw new Error("trustLevel must be a supported training trust level");
|
|
102
|
-
}
|
|
103
|
-
if (!isAiGameTrainingTrustMarkerSource(input.source)) {
|
|
104
|
-
throw new Error("source must be a supported training trust marker source");
|
|
105
|
-
}
|
|
106
|
-
return Object.freeze({
|
|
107
|
-
...input,
|
|
108
|
-
reasonCodes: freezeReadonlyArray(input.reasonCodes)
|
|
109
|
-
});
|
|
98
|
+
return createTrainingTrustMarker(input);
|
|
110
99
|
}
|
|
111
100
|
function createAiGameSpecializationRecommendation(input) {
|
|
112
101
|
assertNonEmptyString(input.recommendationId, "recommendationId");
|
|
@@ -147,6 +136,20 @@ function createAiGameTrainingStateSnapshot(input) {
|
|
|
147
136
|
)
|
|
148
137
|
});
|
|
149
138
|
}
|
|
139
|
+
function createAiGameAcademicTrainingSnapshot(input) {
|
|
140
|
+
return Object.freeze({
|
|
141
|
+
schoolProgression: createTrainingSchoolProgression(input.schoolProgression),
|
|
142
|
+
academyAdmissions: freezeReadonlyArray(
|
|
143
|
+
input.academyAdmissions.map(createTrainingAcademyAdmission)
|
|
144
|
+
),
|
|
145
|
+
trackSelections: freezeReadonlyArray(
|
|
146
|
+
input.trackSelections.map(createTrainingTrackSelection)
|
|
147
|
+
),
|
|
148
|
+
recommendations: freezeReadonlyArray(
|
|
149
|
+
input.recommendations.map(createAiGameSpecializationRecommendation)
|
|
150
|
+
)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
150
153
|
function createAiGameMartialTrainingSnapshot(input) {
|
|
151
154
|
return Object.freeze({
|
|
152
155
|
barracksDrills: freezeReadonlyArray(
|
|
@@ -164,6 +167,390 @@ function createAiGameMartialTrainingSnapshot(input) {
|
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
|
|
170
|
+
// src/player-system.ts
|
|
171
|
+
var AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID = "isekai.player-system.core.enabled";
|
|
172
|
+
var AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION = "1.0";
|
|
173
|
+
var AI_GAME_PLAYER_SYSTEM_FOCUS_MODES = [
|
|
174
|
+
"ambient",
|
|
175
|
+
"focused",
|
|
176
|
+
"combat-safe"
|
|
177
|
+
];
|
|
178
|
+
var AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES = ["voice", "touch"];
|
|
179
|
+
var AI_GAME_PLAYER_SYSTEM_MODULES = [
|
|
180
|
+
"identity",
|
|
181
|
+
"missions",
|
|
182
|
+
"guild-quests",
|
|
183
|
+
"event-log",
|
|
184
|
+
"mcc",
|
|
185
|
+
"tutorial",
|
|
186
|
+
"points-store"
|
|
187
|
+
];
|
|
188
|
+
var AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES = [
|
|
189
|
+
"critical",
|
|
190
|
+
"high",
|
|
191
|
+
"normal",
|
|
192
|
+
"low"
|
|
193
|
+
];
|
|
194
|
+
var AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS = [
|
|
195
|
+
"combat",
|
|
196
|
+
"exploration",
|
|
197
|
+
"crafting",
|
|
198
|
+
"social",
|
|
199
|
+
"governance"
|
|
200
|
+
];
|
|
201
|
+
var AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES = [
|
|
202
|
+
"explicit",
|
|
203
|
+
"observed"
|
|
204
|
+
];
|
|
205
|
+
var AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS = [
|
|
206
|
+
"low",
|
|
207
|
+
"medium",
|
|
208
|
+
"high"
|
|
209
|
+
];
|
|
210
|
+
var DEFAULT_FOCUS_MODE_CONTRACTS = Object.freeze({
|
|
211
|
+
ambient: Object.freeze({
|
|
212
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
213
|
+
mode: "ambient",
|
|
214
|
+
acceptsInputModalities: Object.freeze([]),
|
|
215
|
+
allowsFullNavigation: false,
|
|
216
|
+
maximumVisibleModules: 1,
|
|
217
|
+
deliverableAlertPriorities: Object.freeze([
|
|
218
|
+
"critical",
|
|
219
|
+
"high",
|
|
220
|
+
"normal",
|
|
221
|
+
"low"
|
|
222
|
+
])
|
|
223
|
+
}),
|
|
224
|
+
focused: Object.freeze({
|
|
225
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
226
|
+
mode: "focused",
|
|
227
|
+
acceptsInputModalities: Object.freeze([
|
|
228
|
+
"voice",
|
|
229
|
+
"touch"
|
|
230
|
+
]),
|
|
231
|
+
allowsFullNavigation: true,
|
|
232
|
+
maximumVisibleModules: 3,
|
|
233
|
+
deliverableAlertPriorities: Object.freeze([
|
|
234
|
+
"critical",
|
|
235
|
+
"high",
|
|
236
|
+
"normal",
|
|
237
|
+
"low"
|
|
238
|
+
])
|
|
239
|
+
}),
|
|
240
|
+
"combat-safe": Object.freeze({
|
|
241
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
242
|
+
mode: "combat-safe",
|
|
243
|
+
acceptsInputModalities: Object.freeze([
|
|
244
|
+
"voice",
|
|
245
|
+
"touch"
|
|
246
|
+
]),
|
|
247
|
+
allowsFullNavigation: false,
|
|
248
|
+
maximumVisibleModules: 1,
|
|
249
|
+
deliverableAlertPriorities: Object.freeze([
|
|
250
|
+
"critical",
|
|
251
|
+
"high"
|
|
252
|
+
])
|
|
253
|
+
})
|
|
254
|
+
});
|
|
255
|
+
var DEFAULT_MODULE_CONTRACTS = Object.freeze({
|
|
256
|
+
identity: Object.freeze({
|
|
257
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
258
|
+
module: "identity",
|
|
259
|
+
requiresFocusedMode: false,
|
|
260
|
+
availableInCombatSafeMode: true,
|
|
261
|
+
supportedInputModalities: Object.freeze([
|
|
262
|
+
"voice",
|
|
263
|
+
"touch"
|
|
264
|
+
])
|
|
265
|
+
}),
|
|
266
|
+
missions: Object.freeze({
|
|
267
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
268
|
+
module: "missions",
|
|
269
|
+
requiresFocusedMode: true,
|
|
270
|
+
availableInCombatSafeMode: false,
|
|
271
|
+
supportedInputModalities: Object.freeze([
|
|
272
|
+
"voice",
|
|
273
|
+
"touch"
|
|
274
|
+
])
|
|
275
|
+
}),
|
|
276
|
+
"guild-quests": Object.freeze({
|
|
277
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
278
|
+
module: "guild-quests",
|
|
279
|
+
requiresFocusedMode: true,
|
|
280
|
+
availableInCombatSafeMode: false,
|
|
281
|
+
supportedInputModalities: Object.freeze([
|
|
282
|
+
"voice",
|
|
283
|
+
"touch"
|
|
284
|
+
])
|
|
285
|
+
}),
|
|
286
|
+
"event-log": Object.freeze({
|
|
287
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
288
|
+
module: "event-log",
|
|
289
|
+
requiresFocusedMode: true,
|
|
290
|
+
availableInCombatSafeMode: false,
|
|
291
|
+
supportedInputModalities: Object.freeze([
|
|
292
|
+
"voice",
|
|
293
|
+
"touch"
|
|
294
|
+
])
|
|
295
|
+
}),
|
|
296
|
+
mcc: Object.freeze({
|
|
297
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
298
|
+
module: "mcc",
|
|
299
|
+
requiresFocusedMode: true,
|
|
300
|
+
availableInCombatSafeMode: false,
|
|
301
|
+
supportedInputModalities: Object.freeze([
|
|
302
|
+
"voice",
|
|
303
|
+
"touch"
|
|
304
|
+
])
|
|
305
|
+
}),
|
|
306
|
+
tutorial: Object.freeze({
|
|
307
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
308
|
+
module: "tutorial",
|
|
309
|
+
requiresFocusedMode: true,
|
|
310
|
+
availableInCombatSafeMode: false,
|
|
311
|
+
supportedInputModalities: Object.freeze([
|
|
312
|
+
"voice",
|
|
313
|
+
"touch"
|
|
314
|
+
])
|
|
315
|
+
}),
|
|
316
|
+
"points-store": Object.freeze({
|
|
317
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
318
|
+
module: "points-store",
|
|
319
|
+
requiresFocusedMode: true,
|
|
320
|
+
availableInCombatSafeMode: false,
|
|
321
|
+
supportedInputModalities: Object.freeze([
|
|
322
|
+
"voice",
|
|
323
|
+
"touch"
|
|
324
|
+
])
|
|
325
|
+
})
|
|
326
|
+
});
|
|
327
|
+
var DEFAULT_SESSION_MODULES = Object.freeze([DEFAULT_MODULE_CONTRACTS.identity]);
|
|
328
|
+
var AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS = Object.freeze(
|
|
329
|
+
AI_GAME_PLAYER_SYSTEM_FOCUS_MODES.map(
|
|
330
|
+
(mode) => DEFAULT_FOCUS_MODE_CONTRACTS[mode]
|
|
331
|
+
)
|
|
332
|
+
);
|
|
333
|
+
var AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS = Object.freeze(
|
|
334
|
+
AI_GAME_PLAYER_SYSTEM_MODULES.map((module) => DEFAULT_MODULE_CONTRACTS[module])
|
|
335
|
+
);
|
|
336
|
+
function freezeReadonlyArray2(items) {
|
|
337
|
+
return Object.freeze([...items]);
|
|
338
|
+
}
|
|
339
|
+
function assertNonEmptyString2(value, label) {
|
|
340
|
+
if (value.trim().length === 0) {
|
|
341
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function assertContractVersion(value, label = "contractVersion") {
|
|
345
|
+
if (value !== AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION) {
|
|
346
|
+
throw new Error(`${label} must be ${AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION}`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function assertIsoTimestamp(value, label) {
|
|
350
|
+
assertNonEmptyString2(value, label);
|
|
351
|
+
if (Number.isNaN(Date.parse(value))) {
|
|
352
|
+
throw new Error(`${label} must be an ISO-8601 timestamp`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function assertConfidenceScore(value, label = "confidenceScore") {
|
|
356
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
357
|
+
throw new Error(`${label} must be between 0 and 1`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function assertNonNegativeInteger(value, label) {
|
|
361
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
362
|
+
throw new Error(`${label} must be a non-negative integer`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function isMember(value, members) {
|
|
366
|
+
return members.includes(value);
|
|
367
|
+
}
|
|
368
|
+
function isAiGamePlayerSystemFocusMode(value) {
|
|
369
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_FOCUS_MODES);
|
|
370
|
+
}
|
|
371
|
+
function isAiGamePlayerSystemInputModality(value) {
|
|
372
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES);
|
|
373
|
+
}
|
|
374
|
+
function isAiGamePlayerSystemModule(value) {
|
|
375
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_MODULES);
|
|
376
|
+
}
|
|
377
|
+
function isAiGamePlayerSystemAlertPriority(value) {
|
|
378
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES);
|
|
379
|
+
}
|
|
380
|
+
function isAiGamePlayerSystemPreferenceKind(value) {
|
|
381
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS);
|
|
382
|
+
}
|
|
383
|
+
function isAiGamePlayerSystemPreferenceSource(value) {
|
|
384
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES);
|
|
385
|
+
}
|
|
386
|
+
function isAiGamePlayerSystemConfidenceBand(value) {
|
|
387
|
+
return isMember(value, AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS);
|
|
388
|
+
}
|
|
389
|
+
function getAiGamePlayerSystemFocusModeContract(mode) {
|
|
390
|
+
return DEFAULT_FOCUS_MODE_CONTRACTS[mode];
|
|
391
|
+
}
|
|
392
|
+
function getAiGamePlayerSystemModuleContract(module) {
|
|
393
|
+
return DEFAULT_MODULE_CONTRACTS[module];
|
|
394
|
+
}
|
|
395
|
+
function isAiGamePlayerSystemAlertDeliverable(alert, mode) {
|
|
396
|
+
return getAiGamePlayerSystemFocusModeContract(mode).deliverableAlertPriorities.includes(
|
|
397
|
+
alert.priority
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
function selectAiGamePlayerSystemAlertsForFocusMode(alerts, mode) {
|
|
401
|
+
return freezeReadonlyArray2(
|
|
402
|
+
alerts.filter((alert) => isAiGamePlayerSystemAlertDeliverable(alert, mode))
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
function createAiGamePlayerSystemAlert(input) {
|
|
406
|
+
assertNonEmptyString2(input.alertId, "alertId");
|
|
407
|
+
assertNonEmptyString2(input.title, "title");
|
|
408
|
+
assertNonEmptyString2(input.message, "message");
|
|
409
|
+
assertIsoTimestamp(input.createdAtIso, "createdAtIso");
|
|
410
|
+
assertContractVersion(input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION);
|
|
411
|
+
if (!isAiGamePlayerSystemAlertPriority(input.priority)) {
|
|
412
|
+
throw new Error("priority must be a supported Player System alert priority");
|
|
413
|
+
}
|
|
414
|
+
if (!isAiGamePlayerSystemModule(input.sourceModule)) {
|
|
415
|
+
throw new Error("sourceModule must be a supported Player System module");
|
|
416
|
+
}
|
|
417
|
+
return Object.freeze({
|
|
418
|
+
...input,
|
|
419
|
+
contractVersion: input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function resolveAiGamePlayerSystemConfidenceBand(confidenceScore) {
|
|
423
|
+
assertConfidenceScore(confidenceScore);
|
|
424
|
+
if (confidenceScore >= 0.67) {
|
|
425
|
+
return "high";
|
|
426
|
+
}
|
|
427
|
+
if (confidenceScore >= 0.34) {
|
|
428
|
+
return "medium";
|
|
429
|
+
}
|
|
430
|
+
return "low";
|
|
431
|
+
}
|
|
432
|
+
function createAiGamePlayerSystemPreferenceInput(input) {
|
|
433
|
+
assertNonEmptyString2(input.inputId, "inputId");
|
|
434
|
+
assertIsoTimestamp(input.capturedAtIso, "capturedAtIso");
|
|
435
|
+
assertConfidenceScore(input.confidenceScore);
|
|
436
|
+
if (!isAiGamePlayerSystemPreferenceKind(input.kind)) {
|
|
437
|
+
throw new Error("kind must be a supported Player System preference kind");
|
|
438
|
+
}
|
|
439
|
+
if (!isAiGamePlayerSystemPreferenceSource(input.source)) {
|
|
440
|
+
throw new Error("source must be a supported Player System preference source");
|
|
441
|
+
}
|
|
442
|
+
return Object.freeze({
|
|
443
|
+
...input,
|
|
444
|
+
reasonCodes: freezeReadonlyArray2(input.reasonCodes ?? [])
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
function createAiGamePlayerSystemPreferenceConfidenceState(input) {
|
|
448
|
+
assertConfidenceScore(input.confidenceScore);
|
|
449
|
+
assertNonNegativeInteger(input.sampleCount, "sampleCount");
|
|
450
|
+
assertIsoTimestamp(input.lastUpdatedAtIso, "lastUpdatedAtIso");
|
|
451
|
+
const confidenceBand = resolveAiGamePlayerSystemConfidenceBand(
|
|
452
|
+
input.confidenceScore
|
|
453
|
+
);
|
|
454
|
+
if (input.confidenceBand !== void 0 && input.confidenceBand !== confidenceBand) {
|
|
455
|
+
throw new Error("confidenceBand must match confidenceScore");
|
|
456
|
+
}
|
|
457
|
+
return Object.freeze({
|
|
458
|
+
confidenceScore: input.confidenceScore,
|
|
459
|
+
confidenceBand,
|
|
460
|
+
sampleCount: input.sampleCount,
|
|
461
|
+
lastUpdatedAtIso: input.lastUpdatedAtIso
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function createAiGamePlayerSystemPreferenceProfile(input) {
|
|
465
|
+
assertNonEmptyString2(input.profileId, "profileId");
|
|
466
|
+
const inputs = (input.inputs ?? []).map(
|
|
467
|
+
(preferenceInput) => createAiGamePlayerSystemPreferenceInput(preferenceInput)
|
|
468
|
+
);
|
|
469
|
+
const lastUpdatedAtIso = input.confidence?.lastUpdatedAtIso ?? (/* @__PURE__ */ new Date(0)).toISOString();
|
|
470
|
+
const confidenceScore = input.confidence?.confidenceScore ?? (inputs.length === 0 ? 0 : inputs.reduce((total, preferenceInput) => total + preferenceInput.confidenceScore, 0) / inputs.length);
|
|
471
|
+
const confidence = createAiGamePlayerSystemPreferenceConfidenceState({
|
|
472
|
+
confidenceScore,
|
|
473
|
+
sampleCount: input.confidence?.sampleCount ?? inputs.length,
|
|
474
|
+
lastUpdatedAtIso,
|
|
475
|
+
confidenceBand: input.confidence?.confidenceBand
|
|
476
|
+
});
|
|
477
|
+
return Object.freeze({
|
|
478
|
+
profileId: input.profileId,
|
|
479
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
480
|
+
inputs: freezeReadonlyArray2(inputs),
|
|
481
|
+
confidence
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function createAiGamePlayerSystemSession(input) {
|
|
485
|
+
assertNonEmptyString2(input.sessionId, "sessionId");
|
|
486
|
+
if (!isAiGamePlayerSystemFocusMode(input.focusMode)) {
|
|
487
|
+
throw new Error("focusMode must be a supported Player System focus mode");
|
|
488
|
+
}
|
|
489
|
+
if (input.activeModule !== null && input.activeModule !== void 0 && !isAiGamePlayerSystemModule(input.activeModule)) {
|
|
490
|
+
throw new Error("activeModule must be a supported Player System module");
|
|
491
|
+
}
|
|
492
|
+
const modeContract = getAiGamePlayerSystemFocusModeContract(input.focusMode);
|
|
493
|
+
const modules = freezeReadonlyArray2(
|
|
494
|
+
(input.modules ?? DEFAULT_SESSION_MODULES).map(
|
|
495
|
+
(moduleContract) => Object.freeze({
|
|
496
|
+
...moduleContract,
|
|
497
|
+
supportedInputModalities: freezeReadonlyArray2(
|
|
498
|
+
moduleContract.supportedInputModalities
|
|
499
|
+
)
|
|
500
|
+
})
|
|
501
|
+
)
|
|
502
|
+
);
|
|
503
|
+
const acceptedInputModalities = freezeReadonlyArray2(
|
|
504
|
+
input.acceptedInputModalities ?? modeContract.acceptsInputModalities
|
|
505
|
+
);
|
|
506
|
+
const pendingAlerts = freezeReadonlyArray2(
|
|
507
|
+
(input.pendingAlerts ?? []).map((alert) => createAiGamePlayerSystemAlert(alert))
|
|
508
|
+
);
|
|
509
|
+
if (modules.length > modeContract.maximumVisibleModules) {
|
|
510
|
+
throw new Error("modules exceed the focus mode visibility limit");
|
|
511
|
+
}
|
|
512
|
+
for (const modality of acceptedInputModalities) {
|
|
513
|
+
if (!isAiGamePlayerSystemInputModality(modality)) {
|
|
514
|
+
throw new Error("acceptedInputModalities contains an unsupported modality");
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (input.focusMode === "focused" && (!acceptedInputModalities.includes("voice") || !acceptedInputModalities.includes("touch"))) {
|
|
518
|
+
throw new Error("focused sessions must accept both voice and touch input");
|
|
519
|
+
}
|
|
520
|
+
for (const moduleContract of modules) {
|
|
521
|
+
assertContractVersion(moduleContract.contractVersion, "module contractVersion");
|
|
522
|
+
if (!isAiGamePlayerSystemModule(moduleContract.module)) {
|
|
523
|
+
throw new Error("modules contains an unsupported Player System module");
|
|
524
|
+
}
|
|
525
|
+
for (const modality of moduleContract.supportedInputModalities) {
|
|
526
|
+
if (!isAiGamePlayerSystemInputModality(modality)) {
|
|
527
|
+
throw new Error("modules contains an unsupported input modality");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if (input.focusMode === "combat-safe" && !moduleContract.availableInCombatSafeMode) {
|
|
531
|
+
throw new Error("combat-safe sessions cannot expose unsafe modules");
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
if (input.activeModule !== null && input.activeModule !== void 0 && !modules.some((moduleContract) => moduleContract.module === input.activeModule)) {
|
|
535
|
+
throw new Error("activeModule must be included in modules");
|
|
536
|
+
}
|
|
537
|
+
return Object.freeze({
|
|
538
|
+
sessionId: input.sessionId,
|
|
539
|
+
contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
540
|
+
featureFlagId: AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
|
|
541
|
+
focusMode: input.focusMode,
|
|
542
|
+
activeModule: input.activeModule ?? null,
|
|
543
|
+
modules,
|
|
544
|
+
acceptedInputModalities,
|
|
545
|
+
pendingAlerts,
|
|
546
|
+
preferenceProfile: createAiGamePlayerSystemPreferenceProfile({
|
|
547
|
+
profileId: input.preferenceProfile.profileId,
|
|
548
|
+
inputs: input.preferenceProfile.inputs,
|
|
549
|
+
confidence: input.preferenceProfile.confidence
|
|
550
|
+
})
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
|
|
167
554
|
// src/world-events.ts
|
|
168
555
|
function isCanonicalWorldEvent(event) {
|
|
169
556
|
return event.recordType === "canonical";
|
|
@@ -315,7 +702,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
|
315
702
|
"private-or-low-witness-evidence",
|
|
316
703
|
"costly-pressure-event"
|
|
317
704
|
];
|
|
318
|
-
function
|
|
705
|
+
function isMember2(value, members) {
|
|
319
706
|
return members.includes(value);
|
|
320
707
|
}
|
|
321
708
|
function assertRecord(value, label) {
|
|
@@ -356,7 +743,7 @@ function normalizeTimestamp(value, label) {
|
|
|
356
743
|
}
|
|
357
744
|
function normalizeMember(value, members, label) {
|
|
358
745
|
const normalized = normalizeNonEmptyString(value, label);
|
|
359
|
-
if (!
|
|
746
|
+
if (!isMember2(normalized, members)) {
|
|
360
747
|
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
361
748
|
}
|
|
362
749
|
return normalized;
|
|
@@ -489,13 +876,13 @@ function normalizeDominantReads(value) {
|
|
|
489
876
|
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
490
877
|
}
|
|
491
878
|
function isQuietMeasureAxis(value) {
|
|
492
|
-
return
|
|
879
|
+
return isMember2(value, QUIET_MEASURE_AXES);
|
|
493
880
|
}
|
|
494
881
|
function isQuietMeasureMissionProbeMode(value) {
|
|
495
|
-
return
|
|
882
|
+
return isMember2(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
496
883
|
}
|
|
497
884
|
function isQuietMeasureMissionResolutionShape(value) {
|
|
498
|
-
return
|
|
885
|
+
return isMember2(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
499
886
|
}
|
|
500
887
|
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
501
888
|
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
@@ -1003,23 +1390,39 @@ export {
|
|
|
1003
1390
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
1004
1391
|
AI_GAME_PACKAGE,
|
|
1005
1392
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
1393
|
+
AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
|
|
1394
|
+
AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS,
|
|
1395
|
+
AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
|
|
1396
|
+
AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
|
|
1397
|
+
AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
|
|
1398
|
+
AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS,
|
|
1399
|
+
AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
|
|
1400
|
+
AI_GAME_PLAYER_SYSTEM_MODULES,
|
|
1401
|
+
AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
|
|
1402
|
+
AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS,
|
|
1403
|
+
AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES,
|
|
1006
1404
|
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
1007
1405
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
1008
1406
|
AI_GAME_TASK_DECISIONS,
|
|
1009
1407
|
AI_GAME_TASK_KINDS,
|
|
1010
1408
|
AI_GAME_TASK_RESULTS,
|
|
1011
1409
|
AI_GAME_TASK_RISK_CLASSES,
|
|
1410
|
+
TRAINING_ACADEMIC_PROGRESS_STAGES as AI_GAME_TRAINING_ACADEMIC_PROGRESS_STAGES,
|
|
1411
|
+
TRAINING_ACADEMIES_FEATURE_FLAG_ID as AI_GAME_TRAINING_ACADEMIES_FEATURE_FLAG_ID,
|
|
1412
|
+
TRAINING_ACADEMY_ADMISSION_DECISIONS as AI_GAME_TRAINING_ACADEMY_ADMISSION_DECISIONS,
|
|
1012
1413
|
TRAINING_ANTI_SPELL_COUNTER_WINDOWS as AI_GAME_TRAINING_ANTI_SPELL_COUNTER_WINDOWS,
|
|
1013
1414
|
TRAINING_ANTI_SPELL_FIELDCRAFT_FAMILIES as AI_GAME_TRAINING_ANTI_SPELL_FIELDCRAFT_FAMILIES,
|
|
1014
1415
|
TRAINING_BARRACKS_DRILL_DELIVERY_MODES as AI_GAME_TRAINING_BARRACKS_DRILL_DELIVERY_MODES,
|
|
1015
1416
|
TRAINING_FEATURE_FLAG_ID as AI_GAME_TRAINING_INSTITUTIONS_FEATURE_FLAG_ID,
|
|
1417
|
+
TRAINING_INSTRUCTION_ACCESS_LEVELS as AI_GAME_TRAINING_INSTRUCTION_ACCESS_LEVELS,
|
|
1016
1418
|
TRAINING_MARTIAL_FEATURE_FLAG_ID as AI_GAME_TRAINING_MARTIAL_FEATURE_FLAG_ID,
|
|
1017
1419
|
TRAINING_MARTIAL_TECHNIQUE_FAMILIES as AI_GAME_TRAINING_MARTIAL_TECHNIQUE_FAMILIES,
|
|
1018
1420
|
TRAINING_MARTIAL_TECHNIQUE_TRACKS as AI_GAME_TRAINING_MARTIAL_TECHNIQUE_TRACKS,
|
|
1019
1421
|
AI_GAME_TRAINING_RECOMMENDATION_CONFIDENCE_BANDS,
|
|
1020
1422
|
AI_GAME_TRAINING_RECOMMENDATION_READINESS,
|
|
1021
1423
|
AI_GAME_TRAINING_STAGE_GATES,
|
|
1022
|
-
|
|
1424
|
+
TRAINING_TECHNIQUE_MASTERY_STATES as AI_GAME_TRAINING_TECHNIQUE_MASTERY_STATES,
|
|
1425
|
+
TRAINING_TRUST_MARKER_SOURCES as AI_GAME_TRAINING_TRUST_MARKER_SOURCES,
|
|
1023
1426
|
AI_GAME_TTS_CACHE_POLICIES,
|
|
1024
1427
|
QUIET_MEASURE_AXES,
|
|
1025
1428
|
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
@@ -1034,23 +1437,47 @@ export {
|
|
|
1034
1437
|
QUIET_MEASURE_SIGNAL_BANDS,
|
|
1035
1438
|
aiGameFeatureFlags,
|
|
1036
1439
|
classifyAiGameTask,
|
|
1440
|
+
createAiGameAcademicTrainingSnapshot,
|
|
1037
1441
|
createAiGameInstitutionEligibility,
|
|
1038
1442
|
createAiGameMartialTrainingSnapshot,
|
|
1443
|
+
createAiGamePlayerSystemAlert,
|
|
1444
|
+
createAiGamePlayerSystemPreferenceConfidenceState,
|
|
1445
|
+
createAiGamePlayerSystemPreferenceInput,
|
|
1446
|
+
createAiGamePlayerSystemPreferenceProfile,
|
|
1447
|
+
createAiGamePlayerSystemSession,
|
|
1039
1448
|
createAiGameSpecializationRecommendation,
|
|
1449
|
+
createTrainingAcademicMissionPrerequisite as createAiGameTrainingAcademicMissionPrerequisite,
|
|
1450
|
+
createTrainingAcademyAdmission as createAiGameTrainingAcademyAdmission,
|
|
1451
|
+
createTrainingSchoolProgression as createAiGameTrainingSchoolProgression,
|
|
1040
1452
|
createAiGameTrainingStateSnapshot,
|
|
1453
|
+
createTrainingTrackSelection as createAiGameTrainingTrackSelection,
|
|
1041
1454
|
createAiGameTrainingTrustMarker,
|
|
1042
1455
|
createQuietMeasureJudgmentEligibility,
|
|
1043
1456
|
createQuietMeasureJudgmentResponse,
|
|
1044
1457
|
gameEventFeatureFlags,
|
|
1458
|
+
getAiGamePlayerSystemFocusModeContract,
|
|
1459
|
+
getAiGamePlayerSystemModuleContract,
|
|
1460
|
+
isAiGamePlayerSystemAlertDeliverable,
|
|
1461
|
+
isAiGamePlayerSystemAlertPriority,
|
|
1462
|
+
isAiGamePlayerSystemConfidenceBand,
|
|
1463
|
+
isAiGamePlayerSystemFocusMode,
|
|
1464
|
+
isAiGamePlayerSystemInputModality,
|
|
1465
|
+
isAiGamePlayerSystemModule,
|
|
1466
|
+
isAiGamePlayerSystemPreferenceKind,
|
|
1467
|
+
isAiGamePlayerSystemPreferenceSource,
|
|
1468
|
+
isTrainingAcademicProgressStage as isAiGameTrainingAcademicProgressStage,
|
|
1469
|
+
isTrainingAcademyAdmissionDecision as isAiGameTrainingAcademyAdmissionDecision,
|
|
1045
1470
|
isTrainingAntiSpellCounterWindow as isAiGameTrainingAntiSpellCounterWindow,
|
|
1046
1471
|
isTrainingAntiSpellFieldcraftFamily as isAiGameTrainingAntiSpellFieldcraftFamily,
|
|
1047
1472
|
isTrainingBarracksDrillDeliveryMode as isAiGameTrainingBarracksDrillDeliveryMode,
|
|
1473
|
+
isTrainingInstructionAccessLevel as isAiGameTrainingInstructionAccessLevel,
|
|
1048
1474
|
isTrainingMartialTechniqueFamily as isAiGameTrainingMartialTechniqueFamily,
|
|
1049
1475
|
isTrainingMartialTechniqueTrack as isAiGameTrainingMartialTechniqueTrack,
|
|
1050
1476
|
isAiGameTrainingRecommendationConfidenceBand,
|
|
1051
1477
|
isAiGameTrainingRecommendationReadiness,
|
|
1052
1478
|
isAiGameTrainingStageGate,
|
|
1053
|
-
|
|
1479
|
+
isTrainingTechniqueMasteryState as isAiGameTrainingTechniqueMasteryState,
|
|
1480
|
+
isTrainingTrustMarkerSource as isAiGameTrainingTrustMarkerSource,
|
|
1054
1481
|
isCandidateWorldEvent,
|
|
1055
1482
|
isCanonicalWorldEvent,
|
|
1056
1483
|
isGossipTopicActive,
|
|
@@ -1066,6 +1493,8 @@ export {
|
|
|
1066
1493
|
packageDescriptor,
|
|
1067
1494
|
projectTopicForAudience,
|
|
1068
1495
|
resolveAiGamePlayerAddressText,
|
|
1069
|
-
|
|
1496
|
+
resolveAiGamePlayerSystemConfidenceBand,
|
|
1497
|
+
resolveAiGameTaskBatch,
|
|
1498
|
+
selectAiGamePlayerSystemAlertsForFocusMode
|
|
1070
1499
|
};
|
|
1071
1500
|
//# sourceMappingURL=index.js.map
|