@plasius/ai-game 0.4.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 CHANGED
@@ -17,6 +17,23 @@ 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.5.0] - 2026-07-11
21
+
22
+ - **Added**
23
+ - (placeholder)
24
+ - Added bounded Player System guidance cue contracts with explicit alert
25
+ priority, multimodal fallback identifiers, payload-size, and frequency
26
+ metadata under `isekai.player-system.guidance-nfr.enabled`.
27
+
28
+ - **Changed**
29
+ - (placeholder)
30
+
31
+ - **Fixed**
32
+ - (placeholder)
33
+
34
+ - **Security**
35
+ - (placeholder)
36
+
20
37
  ## [0.4.0] - 2026-07-10
21
38
 
22
39
  - **Added**
@@ -196,3 +213,4 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
196
213
  [0.2.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.2.0
197
214
  [0.3.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.3.0
198
215
  [0.4.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.4.0
216
+ [0.5.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.5.0
package/README.md CHANGED
@@ -86,6 +86,19 @@ Use `createAiGamePlayerSystemSession()`,
86
86
  contracts intentionally contain no account identifiers, credentials, or raw
87
87
  player telemetry.
88
88
 
89
+ ### Guidance cue contracts
90
+
91
+ Guidance cues reuse the core alert-priority vocabulary while adding explicit
92
+ multimodal fallback identifiers and bounded delivery assumptions under
93
+ `isekai.player-system.guidance-nfr.enabled`:
94
+
95
+ - `createAiGamePlayerSystemGuidanceCue()` validates cue source/fallback pairs.
96
+ - `maxPayloadBytes` is capped at 4,096 bytes and
97
+ `maxOccurrencesPerMinute` is capped at 30 to make client performance
98
+ assumptions machine-checkable.
99
+ - Voice, narration, and speech-capture failures map to touch/text summaries,
100
+ live-region status copy, and visible manual actions respectively.
101
+
89
102
  ## Adaptive mission contracts
90
103
 
91
104
  Adaptive System missions are versioned, dependency-free shared contracts under
@@ -163,6 +176,7 @@ npm run pack:check
163
176
  - `ai.game.npc-gossip.lifecycle.enabled`
164
177
  - `isekai.player-system.quiet-measure.enabled`
165
178
  - `isekai.player-system.core.enabled`
179
+ - `isekai.player-system.guidance-nfr.enabled`
166
180
  - `isekai.player-system.identity.enabled`
167
181
  - `isekai.training.institutions.enabled`
168
182
  - `isekai.training.academies.enabled`
package/dist/index.cjs CHANGED
@@ -57,6 +57,13 @@ __export(index_exports, {
57
57
  AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID: () => AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
58
58
  AI_GAME_PLAYER_SYSTEM_FOCUS_MODES: () => AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
59
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,
60
67
  AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES: () => AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
61
68
  AI_GAME_PLAYER_SYSTEM_MODULES: () => AI_GAME_PLAYER_SYSTEM_MODULES,
62
69
  AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS: () => AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
@@ -117,6 +124,7 @@ __export(index_exports, {
117
124
  createAiGameMissionRewardEnvelope: () => createAiGameMissionRewardEnvelope,
118
125
  createAiGameMissionRewardGrant: () => createAiGameMissionRewardGrant,
119
126
  createAiGamePlayerSystemAlert: () => createAiGamePlayerSystemAlert,
127
+ createAiGamePlayerSystemGuidanceCue: () => createAiGamePlayerSystemGuidanceCue,
120
128
  createAiGamePlayerSystemPreferenceConfidenceState: () => createAiGamePlayerSystemPreferenceConfidenceState,
121
129
  createAiGamePlayerSystemPreferenceInput: () => createAiGamePlayerSystemPreferenceInput,
122
130
  createAiGamePlayerSystemPreferenceProfile: () => createAiGamePlayerSystemPreferenceProfile,
@@ -132,6 +140,7 @@ __export(index_exports, {
132
140
  createQuietMeasureJudgmentResponse: () => createQuietMeasureJudgmentResponse,
133
141
  gameEventFeatureFlags: () => gameEventFeatureFlags,
134
142
  getAiGamePlayerSystemFocusModeContract: () => getAiGamePlayerSystemFocusModeContract,
143
+ getAiGamePlayerSystemGuidanceFallbackContract: () => getAiGamePlayerSystemGuidanceFallbackContract,
135
144
  getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
136
145
  isAiGameIdentityKnowledgeState: () => isAiGameIdentityKnowledgeState,
137
146
  isAiGameIdentityProjectionRead: () => isAiGameIdentityProjectionRead,
@@ -152,6 +161,9 @@ __export(index_exports, {
152
161
  isAiGamePlayerSystemAlertPriority: () => isAiGamePlayerSystemAlertPriority,
153
162
  isAiGamePlayerSystemConfidenceBand: () => isAiGamePlayerSystemConfidenceBand,
154
163
  isAiGamePlayerSystemFocusMode: () => isAiGamePlayerSystemFocusMode,
164
+ isAiGamePlayerSystemGuidanceCueSource: () => isAiGamePlayerSystemGuidanceCueSource,
165
+ isAiGamePlayerSystemGuidanceFallbackBehavior: () => isAiGamePlayerSystemGuidanceFallbackBehavior,
166
+ isAiGamePlayerSystemGuidanceFallbackId: () => isAiGamePlayerSystemGuidanceFallbackId,
155
167
  isAiGamePlayerSystemInputModality: () => isAiGamePlayerSystemInputModality,
156
168
  isAiGamePlayerSystemModule: () => isAiGamePlayerSystemModule,
157
169
  isAiGamePlayerSystemPreferenceKind: () => isAiGamePlayerSystemPreferenceKind,
@@ -328,6 +340,9 @@ function createAiGameMartialTrainingSnapshot(input) {
328
340
  // src/player-system.ts
329
341
  var AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID = "isekai.player-system.core.enabled";
330
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;
331
346
  var AI_GAME_PLAYER_SYSTEM_FOCUS_MODES = [
332
347
  "ambient",
333
348
  "focused",
@@ -349,6 +364,38 @@ var AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES = [
349
364
  "normal",
350
365
  "low"
351
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
+ ]);
352
399
  var AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS = [
353
400
  "combat",
354
401
  "exploration",
@@ -535,6 +582,63 @@ function isAiGamePlayerSystemModule(value) {
535
582
  function isAiGamePlayerSystemAlertPriority(value) {
536
583
  return isMember(value, AI_GAME_PLAYER_SYSTEM_ALERT_PRIORITIES);
537
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
+ }
538
642
  function isAiGamePlayerSystemPreferenceKind(value) {
539
643
  return isMember(value, AI_GAME_PLAYER_SYSTEM_PREFERENCE_KINDS);
540
644
  }
@@ -2144,6 +2248,13 @@ var gameEventFeatureFlags = Object.freeze([
2144
2248
  AI_GAME_PLAYER_SYSTEM_FEATURE_FLAG_ID,
2145
2249
  AI_GAME_PLAYER_SYSTEM_FOCUS_MODES,
2146
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,
2147
2258
  AI_GAME_PLAYER_SYSTEM_INPUT_MODALITIES,
2148
2259
  AI_GAME_PLAYER_SYSTEM_MODULES,
2149
2260
  AI_GAME_PLAYER_SYSTEM_MODULE_CONTRACTS,
@@ -2204,6 +2315,7 @@ var gameEventFeatureFlags = Object.freeze([
2204
2315
  createAiGameMissionRewardEnvelope,
2205
2316
  createAiGameMissionRewardGrant,
2206
2317
  createAiGamePlayerSystemAlert,
2318
+ createAiGamePlayerSystemGuidanceCue,
2207
2319
  createAiGamePlayerSystemPreferenceConfidenceState,
2208
2320
  createAiGamePlayerSystemPreferenceInput,
2209
2321
  createAiGamePlayerSystemPreferenceProfile,
@@ -2219,6 +2331,7 @@ var gameEventFeatureFlags = Object.freeze([
2219
2331
  createQuietMeasureJudgmentResponse,
2220
2332
  gameEventFeatureFlags,
2221
2333
  getAiGamePlayerSystemFocusModeContract,
2334
+ getAiGamePlayerSystemGuidanceFallbackContract,
2222
2335
  getAiGamePlayerSystemModuleContract,
2223
2336
  isAiGameIdentityKnowledgeState,
2224
2337
  isAiGameIdentityProjectionRead,
@@ -2239,6 +2352,9 @@ var gameEventFeatureFlags = Object.freeze([
2239
2352
  isAiGamePlayerSystemAlertPriority,
2240
2353
  isAiGamePlayerSystemConfidenceBand,
2241
2354
  isAiGamePlayerSystemFocusMode,
2355
+ isAiGamePlayerSystemGuidanceCueSource,
2356
+ isAiGamePlayerSystemGuidanceFallbackBehavior,
2357
+ isAiGamePlayerSystemGuidanceFallbackId,
2242
2358
  isAiGamePlayerSystemInputModality,
2243
2359
  isAiGamePlayerSystemModule,
2244
2360
  isAiGamePlayerSystemPreferenceKind,