@plasius/ai-game 0.1.13 → 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 CHANGED
@@ -17,6 +17,20 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
17
17
  - **Security**
18
18
  - (placeholder)
19
19
 
20
+ ## [0.2.0] - 2026-07-10
21
+
22
+ - **Added**
23
+ - Added versioned Player System session, focus-mode, module, alert-priority, and preference-learning contracts under `isekai.player-system.core.enabled`.
24
+
25
+ - **Changed**
26
+ - (placeholder)
27
+
28
+ - **Fixed**
29
+ - (placeholder)
30
+
31
+ - **Security**
32
+ - (placeholder)
33
+
20
34
  ## [0.1.13] - 2026-06-28
21
35
 
22
36
  - **Added**
@@ -150,3 +164,4 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
150
164
  [0.1.11]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.1.11
151
165
  [0.1.12]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.1.12
152
166
  [0.1.13]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.1.13
167
+ [0.2.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.2.0
package/README.md CHANGED
@@ -67,6 +67,25 @@ The martial slice remains a bridge surface over the published
67
67
  of barracks drills, mission-earned unlocks, martial techniques, and bounded
68
68
  anti-spell fieldcraft without redefining those authority models locally.
69
69
 
70
+ ## Player System core contracts
71
+
72
+ The Player System core contracts are dependency-free shared boundaries under
73
+ `isekai.player-system.core.enabled`. They provide:
74
+
75
+ - versioned ambient, focused, and combat-safe focus-mode contracts;
76
+ - module descriptors for identity, missions, guild quests, event logs, MCC,
77
+ tutorials, and the points store;
78
+ - alert priorities with combat-safe delivery filtering that preserves critical
79
+ and high-priority alerts; and
80
+ - privacy-safe preference-learning inputs with bounded confidence scores,
81
+ confidence bands, and immutable session profiles.
82
+
83
+ Use `createAiGamePlayerSystemSession()`,
84
+ `createAiGamePlayerSystemPreferenceProfile()`, and
85
+ `selectAiGamePlayerSystemAlertsForFocusMode()` at package boundaries. The
86
+ contracts intentionally contain no account identifiers, credentials, or raw
87
+ player telemetry.
88
+
70
89
  ## Quiet Measure contracts
71
90
 
72
91
  The Quiet Measure surface is intentionally structured as a hidden-runtime contract, not a turnkey morality meter.
@@ -96,6 +115,7 @@ npm run pack:check
96
115
  - `ai.game.npc-gossip.perspective.enabled`
97
116
  - `ai.game.npc-gossip.lifecycle.enabled`
98
117
  - `isekai.player-system.quiet-measure.enabled`
118
+ - `isekai.player-system.core.enabled`
99
119
  - `isekai.training.institutions.enabled`
100
120
  - `isekai.training.academies.enabled`
101
121
  - `isekai.training.martial.enabled`
package/dist/index.cjs CHANGED
@@ -31,6 +31,17 @@ __export(index_exports, {
31
31
  AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID: () => AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
32
32
  AI_GAME_PACKAGE: () => AI_GAME_PACKAGE,
33
33
  AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID: () => AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
34
+ AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES: () => AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
35
+ AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS: () => AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS,
36
+ AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION: () => AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
37
+ AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID: () => AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
38
+ AI_GAME_PLAYER_SYSTEM_FOCUS_MODES: () => AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
39
+ AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS,
40
+ AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES: () => AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
41
+ AI_GAME_PLAYER_SYSTEM_MODULES: () => AI_GAME_PLAYER_SYSTEM_MODULES,
42
+ AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
43
+ AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS: () => AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS,
44
+ AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES: () => AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES,
34
45
  AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID: () => AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
35
46
  AI_GAME_TASK_AUTHORITY_BOUNDARIES: () => AI_GAME_TASK_AUTHORITY_BOUNDARIES,
36
47
  AI_GAME_TASK_DECISIONS: () => AI_GAME_TASK_DECISIONS,
@@ -70,6 +81,11 @@ __export(index_exports, {
70
81
  createAiGameAcademicTrainingSnapshot: () => createAiGameAcademicTrainingSnapshot,
71
82
  createAiGameInstitutionEligibility: () => createAiGameInstitutionEligibility,
72
83
  createAiGameMartialTrainingSnapshot: () => createAiGameMartialTrainingSnapshot,
84
+ createAiGamePlayerSystemAlert: () => createAiGamePlayerSystemAlert,
85
+ createAiGamePlayerSystemPreferenceConfidenceState: () => createAiGamePlayerSystemPreferenceConfidenceState,
86
+ createAiGamePlayerSystemPreferenceInput: () => createAiGamePlayerSystemPreferenceInput,
87
+ createAiGamePlayerSystemPreferenceProfile: () => createAiGamePlayerSystemPreferenceProfile,
88
+ createAiGamePlayerSystemSession: () => createAiGamePlayerSystemSession,
73
89
  createAiGameSpecializationRecommendation: () => createAiGameSpecializationRecommendation,
74
90
  createAiGameTrainingAcademicMissionPrerequisite: () => import_training.createTrainingAcademicMissionPrerequisite,
75
91
  createAiGameTrainingAcademyAdmission: () => import_training.createTrainingAcademyAdmission,
@@ -80,6 +96,16 @@ __export(index_exports, {
80
96
  createQuietMeasureJudgmentEligibility: () => createQuietMeasureJudgmentEligibility,
81
97
  createQuietMeasureJudgmentResponse: () => createQuietMeasureJudgmentResponse,
82
98
  gameEventFeatureFlags: () => gameEventFeatureFlags,
99
+ getAiGamePlayerSystemFocusModeContract: () => getAiGamePlayerSystemFocusModeContract,
100
+ getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
101
+ isAiGamePlayerSystemAlertDeliverable: () => isAiGamePlayerSystemAlertDeliverable,
102
+ isAiGamePlayerSystemAlertPriority: () => isAiGamePlayerSystemAlertPriority,
103
+ isAiGamePlayerSystemConfidenceBand: () => isAiGamePlayerSystemConfidenceBand,
104
+ isAiGamePlayerSystemFocusMode: () => isAiGamePlayerSystemFocusMode,
105
+ isAiGamePlayerSystemInputModality: () => isAiGamePlayerSystemInputModality,
106
+ isAiGamePlayerSystemModule: () => isAiGamePlayerSystemModule,
107
+ isAiGamePlayerSystemPreferenceKind: () => isAiGamePlayerSystemPreferenceKind,
108
+ isAiGamePlayerSystemPreferenceSource: () => isAiGamePlayerSystemPreferenceSource,
83
109
  isAiGameTrainingAcademicProgressStage: () => import_training.isTrainingAcademicProgressStage,
84
110
  isAiGameTrainingAcademyAdmissionDecision: () => import_training.isTrainingAcademyAdmissionDecision,
85
111
  isAiGameTrainingAntiSpellCounterWindow: () => import_training.isTrainingAntiSpellCounterWindow,
@@ -108,7 +134,9 @@ __export(index_exports, {
108
134
  packageDescriptor: () => packageDescriptor,
109
135
  projectTopicForAudience: () => projectTopicForAudience,
110
136
  resolveAiGamePlayerAddressText: () => resolveAiGamePlayerAddressText,
111
- resolveAiGameTaskBatch: () => resolveAiGameTaskBatch
137
+ resolveAiGamePlayerSystemConfidenceBand: () => resolveAiGamePlayerSystemConfidenceBand,
138
+ resolveAiGameTaskBatch: () => resolveAiGameTaskBatch,
139
+ selectAiGamePlayerSystemAlertsForFocusMode: () => selectAiGamePlayerSystemAlertsForFocusMode
112
140
  });
113
141
  module.exports = __toCommonJS(index_exports);
114
142
 
@@ -244,6 +272,390 @@ function createAiGameMartialTrainingSnapshot(input) {
244
272
  });
245
273
  }
246
274
 
275
+ // src/player-system.ts
276
+ var AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID = "isekai.player-system.core.enabled";
277
+ var AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION = "1.0";
278
+ var AI_GAME_PLAYER_SYSTEM_FOCUS_MODES = [
279
+ "ambient",
280
+ "focused",
281
+ "combat-safe"
282
+ ];
283
+ var AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES = ["voice", "touch"];
284
+ var AI_GAME_PLAYER_SYSTEM_MODULES = [
285
+ "identity",
286
+ "missions",
287
+ "guild-quests",
288
+ "event-log",
289
+ "mcc",
290
+ "tutorial",
291
+ "points-store"
292
+ ];
293
+ var AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES = [
294
+ "critical",
295
+ "high",
296
+ "normal",
297
+ "low"
298
+ ];
299
+ var AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS = [
300
+ "combat",
301
+ "exploration",
302
+ "crafting",
303
+ "social",
304
+ "governance"
305
+ ];
306
+ var AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES = [
307
+ "explicit",
308
+ "observed"
309
+ ];
310
+ var AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS = [
311
+ "low",
312
+ "medium",
313
+ "high"
314
+ ];
315
+ var DEFAULT_FOCUS_MODE_CONTRACTS = Object.freeze({
316
+ ambient: Object.freeze({
317
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
318
+ mode: "ambient",
319
+ acceptsInputModalities: Object.freeze([]),
320
+ allowsFullNavigation: false,
321
+ maximumVisibleModules: 1,
322
+ deliverableAlertPriorities: Object.freeze([
323
+ "critical",
324
+ "high",
325
+ "normal",
326
+ "low"
327
+ ])
328
+ }),
329
+ focused: Object.freeze({
330
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
331
+ mode: "focused",
332
+ acceptsInputModalities: Object.freeze([
333
+ "voice",
334
+ "touch"
335
+ ]),
336
+ allowsFullNavigation: true,
337
+ maximumVisibleModules: 3,
338
+ deliverableAlertPriorities: Object.freeze([
339
+ "critical",
340
+ "high",
341
+ "normal",
342
+ "low"
343
+ ])
344
+ }),
345
+ "combat-safe": Object.freeze({
346
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
347
+ mode: "combat-safe",
348
+ acceptsInputModalities: Object.freeze([
349
+ "voice",
350
+ "touch"
351
+ ]),
352
+ allowsFullNavigation: false,
353
+ maximumVisibleModules: 1,
354
+ deliverableAlertPriorities: Object.freeze([
355
+ "critical",
356
+ "high"
357
+ ])
358
+ })
359
+ });
360
+ var DEFAULT_MODULE_CONTRACTS = Object.freeze({
361
+ identity: Object.freeze({
362
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
363
+ module: "identity",
364
+ requiresFocusedMode: false,
365
+ availableInCombatSafeMode: true,
366
+ supportedInputModalities: Object.freeze([
367
+ "voice",
368
+ "touch"
369
+ ])
370
+ }),
371
+ missions: Object.freeze({
372
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
373
+ module: "missions",
374
+ requiresFocusedMode: true,
375
+ availableInCombatSafeMode: false,
376
+ supportedInputModalities: Object.freeze([
377
+ "voice",
378
+ "touch"
379
+ ])
380
+ }),
381
+ "guild-quests": Object.freeze({
382
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
383
+ module: "guild-quests",
384
+ requiresFocusedMode: true,
385
+ availableInCombatSafeMode: false,
386
+ supportedInputModalities: Object.freeze([
387
+ "voice",
388
+ "touch"
389
+ ])
390
+ }),
391
+ "event-log": Object.freeze({
392
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
393
+ module: "event-log",
394
+ requiresFocusedMode: true,
395
+ availableInCombatSafeMode: false,
396
+ supportedInputModalities: Object.freeze([
397
+ "voice",
398
+ "touch"
399
+ ])
400
+ }),
401
+ mcc: Object.freeze({
402
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
403
+ module: "mcc",
404
+ requiresFocusedMode: true,
405
+ availableInCombatSafeMode: false,
406
+ supportedInputModalities: Object.freeze([
407
+ "voice",
408
+ "touch"
409
+ ])
410
+ }),
411
+ tutorial: Object.freeze({
412
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
413
+ module: "tutorial",
414
+ requiresFocusedMode: true,
415
+ availableInCombatSafeMode: false,
416
+ supportedInputModalities: Object.freeze([
417
+ "voice",
418
+ "touch"
419
+ ])
420
+ }),
421
+ "points-store": Object.freeze({
422
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
423
+ module: "points-store",
424
+ requiresFocusedMode: true,
425
+ availableInCombatSafeMode: false,
426
+ supportedInputModalities: Object.freeze([
427
+ "voice",
428
+ "touch"
429
+ ])
430
+ })
431
+ });
432
+ var DEFAULT_SESSION_MODULES = Object.freeze([DEFAULT_MODULE_CONTRACTS.identity]);
433
+ var AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS = Object.freeze(
434
+ AI_GAME_PLAYER_SYSTEM_FOCUS_MODES.map(
435
+ (mode) => DEFAULT_FOCUS_MODE_CONTRACTS[mode]
436
+ )
437
+ );
438
+ var AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS = Object.freeze(
439
+ AI_GAME_PLAYER_SYSTEM_MODULES.map((module2) => DEFAULT_MODULE_CONTRACTS[module2])
440
+ );
441
+ function freezeReadonlyArray2(items) {
442
+ return Object.freeze([...items]);
443
+ }
444
+ function assertNonEmptyString2(value, label) {
445
+ if (value.trim().length === 0) {
446
+ throw new Error(`${label} must be a non-empty string`);
447
+ }
448
+ }
449
+ function assertContractVersion(value, label = "contractVersion") {
450
+ if (value !== AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION) {
451
+ throw new Error(`${label} must be ${AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION}`);
452
+ }
453
+ }
454
+ function assertIsoTimestamp(value, label) {
455
+ assertNonEmptyString2(value, label);
456
+ if (Number.isNaN(Date.parse(value))) {
457
+ throw new Error(`${label} must be an ISO-8601 timestamp`);
458
+ }
459
+ }
460
+ function assertConfidenceScore(value, label = "confidenceScore") {
461
+ if (!Number.isFinite(value) || value < 0 || value > 1) {
462
+ throw new Error(`${label} must be between 0 and 1`);
463
+ }
464
+ }
465
+ function assertNonNegativeInteger(value, label) {
466
+ if (!Number.isInteger(value) || value < 0) {
467
+ throw new Error(`${label} must be a non-negative integer`);
468
+ }
469
+ }
470
+ function isMember(value, members) {
471
+ return members.includes(value);
472
+ }
473
+ function isAiGamePlayerSystemFocusMode(value) {
474
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_FOCUS_MODES);
475
+ }
476
+ function isAiGamePlayerSystemInputModality(value) {
477
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES);
478
+ }
479
+ function isAiGamePlayerSystemModule(value) {
480
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_MODULES);
481
+ }
482
+ function isAiGamePlayerSystemAlertPriority(value) {
483
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES);
484
+ }
485
+ function isAiGamePlayerSystemPreferenceKind(value) {
486
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS);
487
+ }
488
+ function isAiGamePlayerSystemPreferenceSource(value) {
489
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES);
490
+ }
491
+ function isAiGamePlayerSystemConfidenceBand(value) {
492
+ return isMember(value, AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS);
493
+ }
494
+ function getAiGamePlayerSystemFocusModeContract(mode) {
495
+ return DEFAULT_FOCUS_MODE_CONTRACTS[mode];
496
+ }
497
+ function getAiGamePlayerSystemModuleContract(module2) {
498
+ return DEFAULT_MODULE_CONTRACTS[module2];
499
+ }
500
+ function isAiGamePlayerSystemAlertDeliverable(alert, mode) {
501
+ return getAiGamePlayerSystemFocusModeContract(mode).deliverableAlertPriorities.includes(
502
+ alert.priority
503
+ );
504
+ }
505
+ function selectAiGamePlayerSystemAlertsForFocusMode(alerts, mode) {
506
+ return freezeReadonlyArray2(
507
+ alerts.filter((alert) => isAiGamePlayerSystemAlertDeliverable(alert, mode))
508
+ );
509
+ }
510
+ function createAiGamePlayerSystemAlert(input) {
511
+ assertNonEmptyString2(input.alertId, "alertId");
512
+ assertNonEmptyString2(input.title, "title");
513
+ assertNonEmptyString2(input.message, "message");
514
+ assertIsoTimestamp(input.createdAtIso, "createdAtIso");
515
+ assertContractVersion(input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION);
516
+ if (!isAiGamePlayerSystemAlertPriority(input.priority)) {
517
+ throw new Error("priority must be a supported Player System alert priority");
518
+ }
519
+ if (!isAiGamePlayerSystemModule(input.sourceModule)) {
520
+ throw new Error("sourceModule must be a supported Player System module");
521
+ }
522
+ return Object.freeze({
523
+ ...input,
524
+ contractVersion: input.contractVersion ?? AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION
525
+ });
526
+ }
527
+ function resolveAiGamePlayerSystemConfidenceBand(confidenceScore) {
528
+ assertConfidenceScore(confidenceScore);
529
+ if (confidenceScore >= 0.67) {
530
+ return "high";
531
+ }
532
+ if (confidenceScore >= 0.34) {
533
+ return "medium";
534
+ }
535
+ return "low";
536
+ }
537
+ function createAiGamePlayerSystemPreferenceInput(input) {
538
+ assertNonEmptyString2(input.inputId, "inputId");
539
+ assertIsoTimestamp(input.capturedAtIso, "capturedAtIso");
540
+ assertConfidenceScore(input.confidenceScore);
541
+ if (!isAiGamePlayerSystemPreferenceKind(input.kind)) {
542
+ throw new Error("kind must be a supported Player System preference kind");
543
+ }
544
+ if (!isAiGamePlayerSystemPreferenceSource(input.source)) {
545
+ throw new Error("source must be a supported Player System preference source");
546
+ }
547
+ return Object.freeze({
548
+ ...input,
549
+ reasonCodes: freezeReadonlyArray2(input.reasonCodes ?? [])
550
+ });
551
+ }
552
+ function createAiGamePlayerSystemPreferenceConfidenceState(input) {
553
+ assertConfidenceScore(input.confidenceScore);
554
+ assertNonNegativeInteger(input.sampleCount, "sampleCount");
555
+ assertIsoTimestamp(input.lastUpdatedAtIso, "lastUpdatedAtIso");
556
+ const confidenceBand = resolveAiGamePlayerSystemConfidenceBand(
557
+ input.confidenceScore
558
+ );
559
+ if (input.confidenceBand !== void 0 && input.confidenceBand !== confidenceBand) {
560
+ throw new Error("confidenceBand must match confidenceScore");
561
+ }
562
+ return Object.freeze({
563
+ confidenceScore: input.confidenceScore,
564
+ confidenceBand,
565
+ sampleCount: input.sampleCount,
566
+ lastUpdatedAtIso: input.lastUpdatedAtIso
567
+ });
568
+ }
569
+ function createAiGamePlayerSystemPreferenceProfile(input) {
570
+ assertNonEmptyString2(input.profileId, "profileId");
571
+ const inputs = (input.inputs ?? []).map(
572
+ (preferenceInput) => createAiGamePlayerSystemPreferenceInput(preferenceInput)
573
+ );
574
+ const lastUpdatedAtIso = input.confidence?.lastUpdatedAtIso ?? (/* @__PURE__ */ new Date(0)).toISOString();
575
+ const confidenceScore = input.confidence?.confidenceScore ?? (inputs.length === 0 ? 0 : inputs.reduce((total, preferenceInput) => total + preferenceInput.confidenceScore, 0) / inputs.length);
576
+ const confidence = createAiGamePlayerSystemPreferenceConfidenceState({
577
+ confidenceScore,
578
+ sampleCount: input.confidence?.sampleCount ?? inputs.length,
579
+ lastUpdatedAtIso,
580
+ confidenceBand: input.confidence?.confidenceBand
581
+ });
582
+ return Object.freeze({
583
+ profileId: input.profileId,
584
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
585
+ inputs: freezeReadonlyArray2(inputs),
586
+ confidence
587
+ });
588
+ }
589
+ function createAiGamePlayerSystemSession(input) {
590
+ assertNonEmptyString2(input.sessionId, "sessionId");
591
+ if (!isAiGamePlayerSystemFocusMode(input.focusMode)) {
592
+ throw new Error("focusMode must be a supported Player System focus mode");
593
+ }
594
+ if (input.activeModule !== null && input.activeModule !== void 0 && !isAiGamePlayerSystemModule(input.activeModule)) {
595
+ throw new Error("activeModule must be a supported Player System module");
596
+ }
597
+ const modeContract = getAiGamePlayerSystemFocusModeContract(input.focusMode);
598
+ const modules = freezeReadonlyArray2(
599
+ (input.modules ?? DEFAULT_SESSION_MODULES).map(
600
+ (moduleContract) => Object.freeze({
601
+ ...moduleContract,
602
+ supportedInputModalities: freezeReadonlyArray2(
603
+ moduleContract.supportedInputModalities
604
+ )
605
+ })
606
+ )
607
+ );
608
+ const acceptedInputModalities = freezeReadonlyArray2(
609
+ input.acceptedInputModalities ?? modeContract.acceptsInputModalities
610
+ );
611
+ const pendingAlerts = freezeReadonlyArray2(
612
+ (input.pendingAlerts ?? []).map((alert) => createAiGamePlayerSystemAlert(alert))
613
+ );
614
+ if (modules.length > modeContract.maximumVisibleModules) {
615
+ throw new Error("modules exceed the focus mode visibility limit");
616
+ }
617
+ for (const modality of acceptedInputModalities) {
618
+ if (!isAiGamePlayerSystemInputModality(modality)) {
619
+ throw new Error("acceptedInputModalities contains an unsupported modality");
620
+ }
621
+ }
622
+ if (input.focusMode === "focused" && (!acceptedInputModalities.includes("voice") || !acceptedInputModalities.includes("touch"))) {
623
+ throw new Error("focused sessions must accept both voice and touch input");
624
+ }
625
+ for (const moduleContract of modules) {
626
+ assertContractVersion(moduleContract.contractVersion, "module contractVersion");
627
+ if (!isAiGamePlayerSystemModule(moduleContract.module)) {
628
+ throw new Error("modules contains an unsupported Player System module");
629
+ }
630
+ for (const modality of moduleContract.supportedInputModalities) {
631
+ if (!isAiGamePlayerSystemInputModality(modality)) {
632
+ throw new Error("modules contains an unsupported input modality");
633
+ }
634
+ }
635
+ if (input.focusMode === "combat-safe" && !moduleContract.availableInCombatSafeMode) {
636
+ throw new Error("combat-safe sessions cannot expose unsafe modules");
637
+ }
638
+ }
639
+ if (input.activeModule !== null && input.activeModule !== void 0 && !modules.some((moduleContract) => moduleContract.module === input.activeModule)) {
640
+ throw new Error("activeModule must be included in modules");
641
+ }
642
+ return Object.freeze({
643
+ sessionId: input.sessionId,
644
+ contractVersion: AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
645
+ featureFlagId: AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
646
+ focusMode: input.focusMode,
647
+ activeModule: input.activeModule ?? null,
648
+ modules,
649
+ acceptedInputModalities,
650
+ pendingAlerts,
651
+ preferenceProfile: createAiGamePlayerSystemPreferenceProfile({
652
+ profileId: input.preferenceProfile.profileId,
653
+ inputs: input.preferenceProfile.inputs,
654
+ confidence: input.preferenceProfile.confidence
655
+ })
656
+ });
657
+ }
658
+
247
659
  // src/world-events.ts
248
660
  function isCanonicalWorldEvent(event) {
249
661
  return event.recordType === "canonical";
@@ -395,7 +807,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
395
807
  "private-or-low-witness-evidence",
396
808
  "costly-pressure-event"
397
809
  ];
398
- function isMember(value, members) {
810
+ function isMember2(value, members) {
399
811
  return members.includes(value);
400
812
  }
401
813
  function assertRecord(value, label) {
@@ -436,7 +848,7 @@ function normalizeTimestamp(value, label) {
436
848
  }
437
849
  function normalizeMember(value, members, label) {
438
850
  const normalized = normalizeNonEmptyString(value, label);
439
- if (!isMember(normalized, members)) {
851
+ if (!isMember2(normalized, members)) {
440
852
  throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
441
853
  }
442
854
  return normalized;
@@ -569,13 +981,13 @@ function normalizeDominantReads(value) {
569
981
  return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
570
982
  }
571
983
  function isQuietMeasureAxis(value) {
572
- return isMember(value, QUIET_MEASURE_AXES);
984
+ return isMember2(value, QUIET_MEASURE_AXES);
573
985
  }
574
986
  function isQuietMeasureMissionProbeMode(value) {
575
- return isMember(value, QUIET_MEASURE_MISSION_PROBE_MODES);
987
+ return isMember2(value, QUIET_MEASURE_MISSION_PROBE_MODES);
576
988
  }
577
989
  function isQuietMeasureMissionResolutionShape(value) {
578
- return isMember(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
990
+ return isMember2(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
579
991
  }
580
992
  function createQuietMeasureJudgmentEligibility(input = {}) {
581
993
  const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
@@ -1084,6 +1496,17 @@ var gameEventFeatureFlags = Object.freeze([
1084
1496
  AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
1085
1497
  AI_GAME_PACKAGE,
1086
1498
  AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
1499
+ AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES,
1500
+ AI_GAME_PLAYER_SYSTEM_CONFIDENCE_BANDS,
1501
+ AI_GAME_PLAYER_SYSTEM_CONTRACT_VERSION,
1502
+ AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
1503
+ AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
1504
+ AI_GAME_PLAYER_SYSTEM_FOCUS_MODE_CONTRACTS,
1505
+ AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
1506
+ AI_GAME_PLAYER_SYSTEM_MODULES,
1507
+ AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
1508
+ AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS,
1509
+ AI_GAME_PLAYER_SYSTEM_PREFERENCE_SOURCES,
1087
1510
  AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
1088
1511
  AI_GAME_TASK_AUTHORITY_BOUNDARIES,
1089
1512
  AI_GAME_TASK_DECISIONS,
@@ -1123,6 +1546,11 @@ var gameEventFeatureFlags = Object.freeze([
1123
1546
  createAiGameAcademicTrainingSnapshot,
1124
1547
  createAiGameInstitutionEligibility,
1125
1548
  createAiGameMartialTrainingSnapshot,
1549
+ createAiGamePlayerSystemAlert,
1550
+ createAiGamePlayerSystemPreferenceConfidenceState,
1551
+ createAiGamePlayerSystemPreferenceInput,
1552
+ createAiGamePlayerSystemPreferenceProfile,
1553
+ createAiGamePlayerSystemSession,
1126
1554
  createAiGameSpecializationRecommendation,
1127
1555
  createAiGameTrainingAcademicMissionPrerequisite,
1128
1556
  createAiGameTrainingAcademyAdmission,
@@ -1133,6 +1561,16 @@ var gameEventFeatureFlags = Object.freeze([
1133
1561
  createQuietMeasureJudgmentEligibility,
1134
1562
  createQuietMeasureJudgmentResponse,
1135
1563
  gameEventFeatureFlags,
1564
+ getAiGamePlayerSystemFocusModeContract,
1565
+ getAiGamePlayerSystemModuleContract,
1566
+ isAiGamePlayerSystemAlertDeliverable,
1567
+ isAiGamePlayerSystemAlertPriority,
1568
+ isAiGamePlayerSystemConfidenceBand,
1569
+ isAiGamePlayerSystemFocusMode,
1570
+ isAiGamePlayerSystemInputModality,
1571
+ isAiGamePlayerSystemModule,
1572
+ isAiGamePlayerSystemPreferenceKind,
1573
+ isAiGamePlayerSystemPreferenceSource,
1136
1574
  isAiGameTrainingAcademicProgressStage,
1137
1575
  isAiGameTrainingAcademyAdmissionDecision,
1138
1576
  isAiGameTrainingAntiSpellCounterWindow,
@@ -1161,6 +1599,8 @@ var gameEventFeatureFlags = Object.freeze([
1161
1599
  packageDescriptor,
1162
1600
  projectTopicForAudience,
1163
1601
  resolveAiGamePlayerAddressText,
1164
- resolveAiGameTaskBatch
1602
+ resolveAiGamePlayerSystemConfidenceBand,
1603
+ resolveAiGameTaskBatch,
1604
+ selectAiGamePlayerSystemAlertsForFocusMode
1165
1605
  });
1166
1606
  //# sourceMappingURL=index.cjs.map